-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nvgTextBounds doesn't calculate for spaces at the end of a string #636
Comments
Looking at the source, the calculation for the spacing is done by int fons__tt_getGlyphKernAdvance(FONSttFontImpl *font, int glyph1, int glyph2)
{
FT_Vector ftKerning;
FT_Get_Kerning(font->font, glyph1, glyph2, FT_KERNING_DEFAULT, &ftKerning);
return (int)((ftKerning.x + 32) >> 6); // Round up and convert to integer
} So the answer should lie with FreeType (or stb_truetype) I believe. |
Ah. I see. I just made a simple workaround by appending a space if needed. Thanks! |
I revise my answer here. Actually I think In this picture you can see how in the third line " Space around ", you can see the actually emitted spaces and notice how the blue enclosing rectangle (uses You can also see that there is still a problem with the right alignment in my code 😄 |
Any method to fix the space render error? |
I use |
Given text such as "abc ", nvgTextBounds doesn't include the space at the end. I assume this is an intentional feature. Is there any other way to get the bounds of the text including space besides appending another space if there is one at the end?
The text was updated successfully, but these errors were encountered: