Is there a way to draw a specific glyph from a font to a bitmap?

I need to render glyphs to a bitmap but I am unable to find a way to do this with the .Net framework. Previously I used ExtTextOut with ETO_GLYPH_INDEX but there is no clear mapping of this functionality to.Net.

[282 byte] By [Scythen] at [2007-12-24]
# 1
ETO_GLYPH_INDEX uses the glyph placement array returned by GetCharacterPlacement(). That function is declared obsolete in the SDK, replaced by Uniscribe. Obscure stuff and no sign of that in the .NET Framework. On the off-chance you just want to create a bitmap from a string:
public static Bitmap CreateBitmapFromGlyph(string glyph, Font fnt)
{
Size sz = TextRenderer.MeasureText(glyph, fnt);
Bitmap bmp = new Bitmap(sz.Width, sz.Height);
Graphics gr = Graphics.FromImage(bmp);
gr.FillRectangle(Brushes.White, new Rectangle(0, 0, sz.Width, sz.Height));
gr.DrawString(glyph, fnt, Brushes.Black, 0, 0);
return bmp;
}
private void button1_Click(object sender, EventArgs e)
{
Bitmap bmp = CreateBitmapFromGlyph("A", new Font(this.Font.FontFamily, 36));
bmp.Save(@"c:\temp\glyph.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
}
nobugz at 2007-10-8 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2

Actually I am using Uniscribe and I need to generate glyphs in a texture for use with the output of Uniscribe. After I processes my text with Uniscribe I'm left with a bunch of glyphs and advance information that I used with D3D and the glyph texture to render the text.

So, I really need to be able to draw glyphs by index into a texture, I can’t use the string.

Scythen at 2007-10-8 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 3

Apparently this can’t be done without using the native Win32 API ExtTextOut?

Scythen at 2007-10-8 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified