PDA

View Full Version : Extruding fonts



Devdept2
02-07-2011, 01:50 AM
Hi,

I want to extrude the fonts in OpenGL, so I'm using the GetGlyphOutline Windows function.
The fonts I build from the outlines I get are bigger than the fonts created with wglUseFontOutlines, so probably I have to scale them.

I noticed that wglUseFontOutlines returns a GLYPHMETRICSFLOAT structure (with float values), while GetGlyphOutline returns a GLYPHMETRICS structure (with short/ uint values) describing the fonts bounding box and increment in X and Y.

What is the relation between the two?
How can I properly scale the lines returned by GetFontOutline so that the output is similar to the fonts created with wglUseFontOutlines?
Thanks

ZbuffeR
02-07-2011, 02:07 AM
I guess this should help :
http://msdn.microsoft.com/en-us/library/dd183564%28v=vs.85%29.aspx

Devdept2
02-07-2011, 02:49 AM
Hi,
so you mean that wglUseFontOutlines returns the metrics in device units and the GetGlyphOutline returns the metrics in design units?

Is there another way to get the outlines of the font created by the wglUseFontOutlines?

Where can I get more informations on this subject?
Thanks

Devdept2
04-21-2011, 01:40 AM
I solved the problem by applying the scale given by the floatMetrics[0].gmfBlackBoxY / metrics.gmBlackBoxY

where floatMetrics is the GLYPHMETRICSFLOAT object returned by the wglUseFontOutlines and metrics is the GLYPHMETRICS object returned by the GetGlyphOutline.

Now there is only a little difference between the font built by the wglUseFontOutlines and the one built with the GetGlyphOutline.

This scale factor varies with the FontFamily(and FontStyle), but
I was expecting it to remain the same since it should just be a matter of the different units used by the wglUseFontOutlines and GetGlyphOutline, am I wrong?