akrinke / Font-Stash

A dynamic font glyph cache for OpenGL.
114 stars 18 forks source link

String width problem? #4

Closed eykamp closed 11 years ago

eykamp commented 11 years ago

When I use sth_dim_text to calculate the width of a string, I get surprising results. I would expect the following two strings to be the same length:

"LLLLL " and "LLL LL".

However, it appears that strings with terminal spaces are reported to be shorter than expected. I have confirmed that in both cases the function iterates properly over all characters in the string, and is selecting what seem to be the proper glyphs. However the length of those glyphs seems to not be consistently calculated.

I have tried this with several TTF fonts, including the venerable OCRA. Is it possible this is somehow related to TTF hinting? Or is it a problem with Font-Stash?

akrinke commented 11 years ago

Thank you for the report! The latest commit should fix the issue.

eykamp commented 11 years ago

And thanks for the fix and the great lib!