FreeType string width and height?
Is there a way to find the length of a string will be before you render each glyph of the string? And if there is not, what is a safe estimate? I thought the font size multiplied by the string length would be a safe guess, but it is showing that it is a little short some times.
Query FreeType for the glyphs for each character, and place these in an array. The 'advance' field of each glyph is the width, so loop through your string adding the advance for that particular character.
Of course, this doesn't take tab stops into account, but you probably don't need those.
Of course, this doesn't take tab stops into account, but you probably don't need those.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement