PDA

View Full Version : Rotate TTF Font Glyph?



dutchcoffee
11-29-2014, 05:36 PM
I've been searching for an answer, but I can't seem to find what I'm looking for.

Basically, I have a TTF font with some custom glyphs. I have successfully drawn the glyph on my OpenGL canvas (C# using Tao). My question is: is it possible to rotate the glyph (from 0-360 degrees)?

I need to be able to rotate the glyph depending on the heading data received - this way, the glyph is facing the correct direction.

If this is not possible, any suggested alternatives? I've considered importing the glyph as an image and converting it to a bitmap - but I'm not sure if this will work either.

GClements
11-29-2014, 10:28 PM
Get the rasterised glyph data, make a texture from it, render a textured quad (which you can transform as you wish).

Bitmaps (in the sense of glBitmap) cannot be transformed, and are deprecated in OpenGL 3 and later.

dutchcoffee
11-30-2014, 11:47 AM
When you say "get rasterised glyph data", what exactly do you mean? Do I need to convert my font file to a specific format? Or...?

GClements
11-30-2014, 08:38 PM
When you say "get rasterised glyph data", what exactly do you mean?
A 2D array of intensity values, i.e. a monochrome image for a particular glyph at a particular size.

In C#, you'd typically create a System.Drawing.Graphics object for rendering into a bitmap, render text into the bitmap, then upload the bitmap data into a texture.