Util function getCaretAtPoint can't get the uniform text caret vertical position for number/character and Chinese text.
HawtinZeng opened this issue · comments
https://stackblitz.com/edit/vitejs-vite-xq3mug?file=package.json,src%2Fmain.js, click this link, and click the text in the scene, you will find get different vertical position for number/character and Chinese text. The compareing screentshot as below:
number or character:
Chinese text:
Thanks for the report!
The caretTop and caretHeight are calculated here -- the difference is due to the Latin and Chinese font files containing different ascender/descender metrics. I'm open to changing how those values are chosen, if you know of a good reliable method that would make them match.
As for your example, I think keeping it external is best, it can stay on Stackblitz and maybe we can add a link to it in the documentation.
I will append the demo link into the doc soon, and by the way, do u know how to calculate the font length before text.sync, i want to draw some lines and dots based on text length before drawing troika text😂😂