PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

font height

Hi.

Whats the best way to find the font height of a given string? Obviously GAPIDraw provides the mechanism to get the width, but how about the height?

-David
Hi,

Usually (always?) you want all your text to be on the same distance in the y-direction. I have never seen variable y distance based on the height of the characters. Can you give an example why this might be needed?
Guest · 22 Jun 2003, 20:35 UTC — text height
Hi.

I mean more of a general way to get the font height from the font. I can ( and am currently ) just hardcoding the font heights, but I thought there'd be a way to get it from the font itself. If I call GetHeight() on the font I just get the surface height which isn't the font height. Is there a method I've overlooked? Thanks!
( I have about 4 fonts of varying sizes and styles so far. )

-David
Unfortunately there is not such a method. But if you design your font bitmap so it is exactly the height of the font (or the height of the font + 1 with kerning information) you can simply call GetHeight on the surface (or GetHeight-1 if you use the advanced font format)...