Paper.js PointText Get base coordinates instead of bottom left corner

Check out this Paper.js sketch . Press "TEXT" to see the bounding box. Note that I set the property leadingto the same as the font size. By default, this is 1.2 times the font size, according to the documentation .

Why is there a space with an edge at the bottom of the PointText? How can it be removed so that the bounding box wraps the text strongly? Alternatively, how can we determine the y value of the true baseline of the text, and not what we are currently giving?

EDIT

The "margin" below is for letters that have descenders, for example q and p. So the real question here is, how can I get the y coordinate of the baseline for a PointText? I need a baseline because this is how we use the insert text in another library and the insert must be identical.

+4
source share
2 answers

The interval is correct. Change "TEXT" to "Texas" and you will see that the descriptors in the "j" symbol have an equal distance below them, like the top of the uppercase characters.

I do not believe that there is a way to get the text borders of a PointText element.

, , arthur.sw - . , , . . , , ; , , .

. , , globalToLocal localToGlobal

sketch, .

+2

, , 95,5% FontSize. .

0

Source: https://habr.com/ru/post/1627876/


All Articles