PDA

View Full Version : Unicode text?


elb
2003.10.09, 12:30 PM
I was wondering if anyone has experience rendering Unicode text in OpenGL on OS X/Carbon. I tried a simple test using aglUseFont and found that it only works for ASCII (the first 256 glyphs just repeat for count > 256). So no luck thereึ

Freetype and ftgl look impressive but I was hoping someone had actually used it for Unicode? Or is there another way?


Thanks!

DoG
2003.10.09, 02:03 PM
I have to say, a rather interesting question. I never actually thought of it.

I assume the hard way would be to render Cocoa glyphs to a texture, and then convert that for OpenGL usability.

No idea what the easy way could be.

For sure, you needed a different access mechanism than simply calling an OpenGL display list.

Dunno what the case could be with creating outline fonts in GL. This gets a spot on my ToDo list.

OneSadCookie
2003.10.09, 03:22 PM
I can confirm that FTGL will let you draw unicode text very easily.

It's also not difficult to roll your own text-drawing stuff using FreeType directly.

Apple has sample code showing how to render an NSTextView to a texture. This gives you nice Cocoa text including all the kerning, ligatures and antialiasing.

It's not difficult to use CoreGraphics to render a string to a texture, but that only takes MacRoman and only does a single line if you do things the easy way... the hard way involves using ATSUI, which is pretty complex. I haven't tried this one :)