PDA

View Full Version : Writing text in french



dvm
04-28-2004, 07:52 AM
Hello to everyone,
I'm trying to write text to my application using the bitmap font method provided in OpenGL game programming book. For the ones that don't have the book the method is:

unsigned int listBase;
HFONT hFont;
char *theString = "Hello! I'm the String.";
...
listBase = glGenLists(96);
hFont = CreateFont(...);
SelectObject(g_HDC, hFont);
wglUseFontBitmaps(g_HDC, 32, 96, listBase);
...
glRasterPos2i(0,0);
glPushAttrib(GL_LIST_BIT);
glListBase(base - 32);
glCallLists(strlen(str), GL_UNSIGNED_BYTE, str);
glPopAttrib();
...
glDeleteLists(base, 96);My problem right now is two-fold.
First I use VC++ 6.0. The editor (or more correctly the font?) does not seem to support French (I'm a Greek student having his placement in France, so whether I like it or not I need to output French, the program is for kids). Also I remember a year ago when I tried to output Greek with the aforementioned method I failed. So I think that even if I manage to write a french string in the editor the text will not show up on the screen.
Do any of you have a similar experience? How did you solve your problem? Thank you for your time.

04-28-2004, 08:33 AM
Just the first idea that comes into mind:
First of all,you must have a font that supports french installed in your system.Inside WordPad(or a similar app),use that font to write the string you want.Copy that,and paste it into the VC6 editor and use that as a literal.It may not look correct in the VC editor,but it is.Now,when you use wglUseFontOutlines,the hdc must have selected the same french font you used with WordPad(insert its name in the typeface param of CreateFont).That's all,I believe the text will be displayed correctly.Of course,you must use a TrueType font.

dvm
04-29-2004, 01:01 AM
The problem was a little bit easier to solve. I do think that what you write about the string being good in VC although it doesn't seem correct is true.
Anyway what I did was change the default language in the regional options so that fixed the VC++ thing.
As one user in another forum pointed out to me, the french characters are above the range of 32-127 that I was creating for. So I just increased my list length from 96 to 223 (255 - 32, I suppose its to avoid having unprintable characters taking up list space) and voila! (God I hate French). Thanks for your time though!