get text width from wglUseFontOutlines

Mar 22, 2013 at 3:01 PM
For drawing fonts in OpenGL I use wglUseFontOutlines. How it is possible to use the last parameter of this method?
When I take a look into the class FontOutlines the last parameter is zero:
//  Create the font bitmaps.
bool result = Win32.wglUseFontOutlines(gl.RenderContextProvider.DeviceContextHandle, 0, 255, nextListBase, deviation, extrusion, (int)fontOutlineFormat, IntPtr.Zero);
My idea was something like this (but i doesnt work):
GlyphMetricsFloat[] fGmF = new GlyphMetricsFloat[256];

IntPtr ptrGmf = Marshal.UnsafeAddrOfPinnedArrayElement(fGmF,0);

bool result = Win32.wglUseFontOutlines(gl.RenderContextProvider.DeviceContextHandle, 0, 255, nextListBase,
               deviation, extrusion, (int)fontOutlineFormat, ptrGmf);
Class GlyphMatricsFloat i saw in TAO Framework.

My goal is to write a InputField in OpenGL. I have to know when the text reached the right border of the InputField. I hope that it is possible to read the width of the text from ptrGmf.
Coordinator
Mar 23, 2013 at 8:36 PM
Howdy, I have just changed the code:

http://sharpgl.codeplex.com/SourceControl/changeset/23905

You can now use a GLYPHMETRICSFLOAT array just as below:
var glyphMetrics = new GLYPHMETRICSFLOAT[255];

//  Create the font bitmaps.
bool result = Win32.wglUseFontOutlines(gl.RenderContextProvider.DeviceContextHandle, 0, 255, listBase,
  deviation, extrusion, (int)fontOutlineFormat, glyphMetrics);
Just check out the latest changeset to get this functionality - it'll be in the next release but this changeset is safe to use.
Mar 25, 2013 at 12:19 PM
thanks a lot...