Unicodes above 65000?
BlitzMax Forums/BlitzMax Programming/Unicodes above 65000?
| ||
At the moment I'm experiencing with unicode fonts under blitzmax. For chinese and japanese fonts it seems to be very easy use it in blitzmax SuperStrict Graphics 800,600 Global ZeichenFont:Timagefont=LoadImageFont("msgothic.ttf",60) Global Zeichen$ Zeichen=Chr(20098) SetImageFont ZeichenFont DrawText Zeichen ,100,100 Flip 0 WaitKey()(the msgothic.tff is part of microsoft office, another nice font is CODE2000.ttf, which can be found at http://www.code2000.net/ , but also the normal ARIAL.TTF show nice arabien characters around 1500) The function CHR$() can handle parameters above 255. What you see on the screen are chinese characters. This works very well. But there are also unicode characters beyond the 65000. And here blitzmax begins to display again form zero (like CHR$(x mod 65248) ). Zeichen= Chr(33) + Chr(33+65248) DrawText Zeichen ,100,100 So I cannot reach the sign of musical symbols or hieroglyphs. Question:Does anybody know more about this? And perhaphs knows a workaround? Here is my font displaying tool for experimenting. Nice characters are around 900,1000, 8200, 8500, 9300, 12300, 20000ff SuperStrict Graphics 1024,768 Global NeutralFont:Timagefont=LoadImageFont("",10) Global ZeichenFont:Timagefont=LoadImageFont("msgothic.ttf",60) Global Anfang%, Such%, Taste% such=-1 Repeat If Anfang <>Such Then Cls Such=Anfang For Local i%= 0 To 99 Local X%, Y%, Zeichen$ x= i Mod 10 y= i/10 Zeichen=Chr(Anfang+i) SetColor 255,255,255 DrawRect X*102,Y*75,100,73 SetColor 5,5,5 SetImageFont NeutralFont DrawText (Anfang+i),x*102+10,y*75+62 SetImageFont ZeichenFont DrawText Zeichen ,x*102+10,y*75+0 Next SetColor 255,255,255 SetImageFont NeutralFont DrawText "press any key... <H>=+100 <T>=+1000 <Z>=+10000 <R>=Reset",50,752 EndIf Taste =GetChar() Select Taste Case 0 Case Asc("r") 'reset" Anfang=0 Case Asc("t") ' thousand" Anfang=Anfang+1000 Case Asc("z") ' ten thousand" Anfang=Anfang+10000 Default ' hundred Anfang=Anfang+100 End Select Flip 0 Delay 30 Until AppTerminate() |
| ||
You can get glyphes directly out of TImageFont and draw them. I've tested with a Egyptian font named "Aegyptus" grabbed from this page http://users.teilar.gr/~g1951d/ The Hieroglyphs are located around 78000. They look quite interesting. :) |
| ||
Oh thank you, this is really nice. I never understood, why the font-functions have this "..image.." in their names. (LoadImageFont, etc..) Now I know, that BlitzMax converts the font to a list of Types with images as one of the fields. And I see, their must be a table of translation from "unicode" to "real position in the list". Thank you for this. I can use this very good, because I have to handle single signs anyway. But let me ask one more question: Where do you guyes get all this information? In VB6 I could examine or experiment with the types by writing al unfinished line "font." in my code. In this moment VB6 opened a list with all properties and methods, the object offers. Now it was possible to follow the structure into the deep. In BlitzMax I do not really know a lot about the possibilities the types offer. Some days ago someone showed me, that it is possible to add something behind Strings like... Value%=Text$.ToInt() Never discovered this in the manual... Where can I see all those functions and methods? Is their anywhere a description of the e.g. Font-Type "TImageFont"? |
| ||
All BRL modules are shipped with source codes. You can read or modifiy them as you wish. TImageFont is defined in Brl.Max2D, which is located at BMXPATH/mod/brl.mod/max2d.mod |
| ||
In VB6 I could examine or experiment with the types by writing al unfinished line "font." in my code. In this moment VB6 opened a list with all properties and methods, the object offers. Now it was possible to follow the structure into the deep. Use Blide (www.blide.org). It supports Intellisense. There is a free version available. |