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

Started by
4 comments, last by Tompa 20 years, 4 months ago
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!
Advertisement
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 )
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!
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==''å'') //134 å 229<br> {glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18 , 229);}<br>else if(strText==''ä'') //132 ä 228<br> {glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18 , 228);}<br>else if(strText==''ö'') //148 ö 246<br> {glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18 , 246);}<br>else<br> {<br> glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18 , strText);<br> }<br>}<br><br>The commented numbers are what ascii codes in the extended ascii table the characters can have (different &#111;nes for different tables I found out…)<br>http://www.asciitable.com/<br>http://www.idevelopment.info/data/Programming/ascii_table/PROGRAMMING_ascii_table.shtml<br><br>I guess the extended characters might display like the box-sign if you haven''t got scandinavian characters.<br>Hope this helps someone more than me. <img src="smile.gif" width=15 height=15 align=middle><br> </i>
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.
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!

This topic is closed to new replies.

Advertisement