Sign in to follow this  
ShmeeBegek

TrueType Fonts

Recommended Posts

I have a simple reference question about TrueType fonts... I've been on MSDN for Hours but the documentation is tangled and confusing. How exactly can I find the vertically largest possible character in the font ? I need to know this to render the font properly... and to fit it into my Widgets. Thanks, ~SPH

Share this post


Link to post
Share on other sites
Call GetTextMetrics and look at the tmHeight member of the resulting TEXTMETRICS structure. That will tell you the maximum height but not exactly which character has that height.

I'm not sure why it would be useful but if you need the exact character the only thing I can think of is to call GetFontUnicodeRanges to get the list of all characters in the font, then for each character call GetGlyphOutline to get the height of that individual character.

Share this post


Link to post
Share on other sites
Hey,

This is what I had... but it (of course) just gives me back the "height" that I gave in CreateFont, which is evidently not the height of the characters that are being printed. Maybe this is just extra space around the characters vertically?

Also the size of the characters being printed in my app. is not the number that I gave (64), rather, it is 42 or 44 (confirmed by both measuring pixels in Paintbrush and using OpenOffice with the font).

This is a bit odd... I'm using wglUseFontBitmaps to draw them with no scaling of any kind.

Thanks, ~SPH

EDIT: I've found that with the font that I am using size 42 font is actually 64 pixels high (I noticed this when selecting text)... I suppose that it is just extra white-space around the characters... thanks for your help I suppose that that solves the problem.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this