Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multilingual Unicode rendering in opengl

I have to extend an OpenGL-Rendering system to support international characters (especially Hebrew, Arabic and cyrillic).

Development platform is Windows(XP|Vista|7), alas using Embercardero Delphi 2010.

I currently use wglOutLineFont(...) to build my font's display list and glCallLists(length(m_Text), UNSIGNED_SHORT, PWchar(m_Text) ) to render my strings.

While this is feasible for Latin-1 Characters, building the full Unicode character set in advance is pretty time-consuming (about 8.5 minutes on my machine), so I am looking for a more efficient solution. I thought about limiting the range from u+0020 - u+077f (Latin, Greek, Cyrillic, Arabic and Hebrew) to include just the glyphs I need, but that would just be a solution for my current needs, and will become insufficient once other encoding is needed.

On the upside, I do not have to worry about left-to right or right-to left direction as our application can handle this already.

I would expect this to be a well-known problem, so I would like to ask if there is any reference material on this on the web, or if you could share some insight on this?

Edit A clarification: I use a polygonal font representations. Each Font is constructed at unit size (1.0) in advance and scaled appropriately using glScalef(...) before rendering. I did decide against pre-rasterizing since the users might zoom in quite closely (The application is used for CAD), so rastering artifacts would become visible.

Additionally, since a scene seldom exceeds more then a few hundred characters (mainly labels and measurements), the speed gain from pre-rasterization is negligible.

like image 446
sum1stolemyname Avatar asked Mar 15 '10 07:03

sum1stolemyname


1 Answers

Don't pre-build the display lists :- create an intermediate sprite that builds the lists on demand, and caches them. Trying to pre-compute lists - or pre generate rasterized textures at every font size, font face, and for all characters, is impractical, Especially when you scale to far eastern character sets.

like image 176
Chris Becke Avatar answered Sep 24 '22 14:09

Chris Becke