Advertisement

Urgent utf-8 to ascii

Started by March 14, 2005 07:09 AM
3 comments, last by HellCreator 19 years, 11 months ago
Please I need help with bitmaped fonts as in nehe tutorials there 3 bmp files with russian,hebrew and arabic fonts with range 0-255 16*16 pixels each gliph they loaded and stored in diferent gltexid[3] I reading string from file utf-8 coded only one language is used in one single file.I need to convert it some how to ascii lower for latins and to uppers respectively for other languages then i will pass it to glprintf(fontif,str)
Can't be root?Reboot!mount -r /home/hell
tolower ?? toupper?? see MSDN... its part of the STL i just dunno if it works with UTF-8
The world isn't unpredictable. It's CHAOTIC.
Advertisement
I think you can use MultiByteToWideChar to convert the UTF-8 string to 16-bit unicode and then WideCharToMultiByte to convert it back to the desired character set (code page).
You still need to choose which character set to use somehow. One way would be to try to convert the string into each available font, count the number of unrepresentable characters and select the best match.

Another possibility would be to create your own unicode mapping table for all of the fonts. This could be accomplished by calling MultiByteToWideChar to translate each character in each font into unicode and storing them in a common table indicating which font and character index to use.
But then you'd have to handle 16-bit characters further into the system which might complicate things.
Quote:
Original post by Intamin AG
tolower ?? toupper?? see MSDN... its part of the STL i just dunno if it works with UTF-8

Thanks
MSDN not relevant anymore to me I using java the question is more general
my code work only hardcoded but in different way on diferent OS respectively to CP or locale installed
 String text1="english text";  String text_he="òáøéú text";  byte[]ru={178,200,193};  String line=fromfile.getBytes("UTF-8");  ...do raster here     gl.glprintf2d(10,10,0,text1);//english string hardcoded     gl.glprintf2d(10,28,0,text_he);//hebrew hardcoded to Latin1     gl.glprintf2d(10,44,0,ru);//ascii hardcoded each byte     gl.glprintf2d(10,62,0,line);//all goes wrong here !!!!  ...back to original projection type

when I compile it then working fine - it compiled into Latin1 set
but if I pass string from file or from console then output unexpected
String is multibyte each char is 2 bytes
and when I pass it to glprintf the function processes each byte in array such as
gl.glCallList(gl_list_array[text[curent_byte]]); and if I make my array byte by byte handly it works allways because I know ascii of each ext page for my languages
Can't be root?Reboot!mount -r /home/hell
Quote:
Original post by doynax
Another possibility would be to create your own unicode mapping table for all of the fonts...


Thanks it was urgent thread but today I did my presentation
and has choosed not to show russian and arabic sets

Finally I got 96 score on my college degree project

Actually I was thinking about this option too
but it makes to die of rapid programming consept in java?
When no choise I will do it exact that way You proposing
With respect to Your idea but I will be in need to provide to my IDE also some converter to my "/uX" format
Can't be root?Reboot!mount -r /home/hell

This topic is closed to new replies.

Advertisement