PDA

View Full Version : Non english fonts in OpenGL



SanDan
12-26-2001, 09:06 AM
Hi,

Dose any one know of an OpenGL library that supports non english fonts like (Arabic, Hebru, Chineas, ..etc)?

I've been playing around with GL text screen saver that comes with windows, and it dose not show arabic correctly...

If there is no such library then I might take up building one http://www.opengl.org/discussion_boards/ubb/smile.gif

Thanks

mtrooper
12-29-2001, 11:53 AM
The solution using windows fonts:



void createFont(int fontSize, DWORD charSet, char *fontName)
{
GLuint base=glGenLists(256);
HFONT hFont;
hFont=CreateFont(-size,
0,
0,
0,
FW_BOLD,
false,
false,
false,
charSet,
OUT_TT_PRECIS,
CLIP_DEFAULT_PRECIS,
ANTIALIASED_QUALITY,
FF_DONTCARE|DEFAULT_PITCH,
fontName);
SelectObject(hDC, hFont);
wglUseFontBitmaps(hDC, 0, 256, base))
}


If you want, for example Arial font, size 24 and eastern european chars, you'd call it like:
createFont(24, EASTEUROPE_CHARSET, "Arial");
For print function see either OpenGL red book, MSDN or Nehe's site

genetic
12-29-2001, 12:15 PM
mrtrooper is right. with CreateFont u register ur own logical font. go to http://msdn.microsoft.com and search for CreateFont function. For detail explanation go to NeHe site http://nehe.gamedev.net and look at OpenGL tutorial 13. There is he explaining how to create bitmap fonts :-)

Good luck.

SanDan
12-30-2001, 09:59 AM
Thanks guys,

I've jumped on NeHe code and changed the font to Tahoma arabic, and made the char set ARABIC_CHARSET. The Characters are displayed on the screen from left to right, and the characters are disjoined. Now thats wrong, arabic like hebrew is written from right to left. So is this the task of the operating system, or OpenGL?

My guess is its the task of the operating system, so I will work on it from that angle and see what I can do.

thanks