Archived

This topic is now archived and is closed to further replies.

Glut, GLUT_BITMAP_HELVETICA_18 and non a-z charachters like "åäö"

This topic is 5130 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Has anyone used glutBitmapCharacter with characters not in the standard english language, like å ä ö ? (If theese characters displays right I do not know.) Extended ascii codes I think they are called. Ascii values ranging from 128 to 255. Thanks for any answers!

Share this post


Link to post
Share on other sites
I believe that the nehe font code can be modified to display these characters, if you are stuck for a way to do it.

(Not very helpful, I know )

Share this post


Link to post
Share on other sites
Well, I have had theese characters displayed using wgl-functions when using windows API, but then I had really big troubles getting joysticks to work with directinput8/9 and gave that up, so I tried SDL_TTF, which I did not get to work at all for some reason I dont know why (SDL_TTF since I got joysticks to work fairly easy in SDL), so I took a look at glut fonts, and that was just so much easier and in a couple of minutes I got it to display what I wanted except for those characters mentioned in the question.
I might have to give the SDL_TTF a day or two more or something.

Anyway, Thanks for the answer!

Share this post


Link to post
Share on other sites
I got it to work with glut now. A bit strange I''d say, but those extended ascii tables must be a bit tricky.
Anyway. I had to add an if for every extended ascii character that I wanted to write.


for(i=0;i<255;i++)
{
if(strText==''\0'')
{break;}
if(strText[i]==''å'') //134 å 229
{glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18 , 229);}
else if(strText[i]==''ä'') //132 ä 228
{glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18 , 228);}
else if(strText[i]==''ö'') //148 ö 246
{glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18 , 246);}
else
{
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18 , strText[i]);
}
}

The commented numbers are what ascii codes in the extended ascii table the characters can have (different ones for different tables I found out...)
http://www.asciitable.com/
http://www.idevelopment.info/data/Programming/ascii_table/PROGRAMMING_ascii_table.shtml

I guess the extended characters might display like the box-sign if you haven''t got scandinavian characters.
Hope this helps someone more than me.

Share this post


Link to post
Share on other sites
You should consider switching to textured fonts instead because i remember glutBitmapFonts are very slow. It is fine for debugging and all, but if your app has alot of text, you should switch.

Share this post


Link to post
Share on other sites
Mkay...
Actually my text just displays speed and gear and some messages sometimes.
I haven''t noticed any performance hit anyway, so I''ll go with this for now.
Thanks for pointing it out to me anyway!

Share this post


Link to post
Share on other sites