Sign in to follow this  

GetGlyphOutline - different black box for GGO_METRICS and _BITMAP

Recommended Posts

Hello, I haven't been able to find an answer to the issue I am having with GetGlyphOutline. When getting info for the same character, passing GGO_METRICS flag returns one black box size, and passing GGO_GRAY8_BITMAP returns another black box size. Which is the correct one to use? Currently what happens is that the texture coordinates cause the right edge of my glyph to be cut off (even though the glyph appears fully on the glyph texture) because the texture coordinates are set using values returned with METRICS flag, and the bitmap is written into texture with size returned from GGO_GRAY8_BITMAP. I am very confused on what's going on - should I never use GGO_METRICS and only use _BITMAP? But then, why do they have GGO_METRICS in the first place?
const MAT2 MTX2_IDENTITY = { 0, 1,  0, 0,  0, 0,  0, 1 };


// Assuming arial 10 is selected into DC

GetGlyphOutline(hDC, 'V', GGO_GRAY8_BITMAP, &gm, 0, NULL, &MTX2_IDENTITY);

// gm.bmBlackBoxX = 13

GetGlyphOutline(hDC, 'V', GGO_METRICS, &gm, 0, NULL, &MTX2_IDENTITY);

// gm.gmBlackBoxX = 11

Share this post

Link to post
Share on other sites
My best bet is that, after hinting (grid fitting), the two glyphs are rasterized differently.
Unfortunatly, the documentation seem to be a bit vague about that. GLYPHMETRICS is described to be in device units, so it seems possible, if not realistic, that hinting is considered.
What xoyojank makes sense, although I am not well aware where he found that information.

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