Replies: 3 comments
-
Why don't you just enclose only target characters in |
Beta Was this translation helpful? Give feedback.
-
Perhaps I was not clear with the result I am looking for. In all cases the SvgText has only one character. The results of Bounds on all these elementes, and even the bounds of the internal span are the same: <text>o</text>
<text><tspan>o</tspan><text> What I would want is that the Bounds of "o" to be as if it was like the character "|" was also next to it. Usually in most font families the "|" has the full ascent and descent. I mean height-wise, not width-wise. Getting a result like what I want, helps center text vertically in a specific rectangle. Else depending of whether the user typed "vvg" or "vvv", the bounds change (top X and height), and so the level of the baseline changes when centering vertically, making "vvg" move higher. |
Beta Was this translation helpful? Give feedback.
-
A workaround would be to just do what you wrote: use the vertical bounds of |
Beta Was this translation helpful? Give feedback.
-
I am trying to create a method that gets the bounds of an SvgText, but always have it include the full ascent and descent of the font, even if no letter is using it completely.
Here is an example of what I am trying to do:
Assume only the letter "o" in an SvgText (ignore others). Text.Bounds correctly returns the bounds, For example the letter "o" would return bounds of 0,10, 30,40. (the green rectangle above).
However I would like to create an extension method that makes Bounds always include the full ascent and descent of the letter. In this case this method would return always the yellow rectangle (0,0,30,50) for the letter "o".
Notice in this case, any letter tested individually, even the "p" or the "O" would always return the same height and top-left position. Only the width would change.
I've noticed that the file GdiFontDefn.cs has many methods to calculate these metrics. Is there any way to do the above easily using already implemented methods?
Thank you for you help. Even a guideline to take would be helpful for me!
Beta Was this translation helpful? Give feedback.
All reactions