Unicode output with FreeType?
Miscellaneous Forums/General Discussion/Unicode output with FreeType?
Currently Blitz Family has no CJK/Unicode display support yet, I don't expect there'll be an official Unicode mod that can read/display unicode in the window surface.
However that'll be useful if Blitz want to have Asia(CJK) market, a creation tool called RPG Maker XP uses FreeType to display Japanese, the renderer has nice effects.
Althought FreeType some licensing issues with Apple, still trying to compile and use it, don't know if it works yet.
I thought blitzmax supported unicode.
the "UTF-16" support only available in source saving and value passing, however it can't display Unicode in compiled application anyway.
It's not a major problem, but the BlitzMax page misleads user.
So I'm starting find another onethat can do this job.
FreeType? That seems like overkill. We already have TrueType drawing routines, they just need to be updated to be able to access the unicode glyphs in TrueType fonts. I recommend UTF-8.
I think this is possible in the next version, which should be out this week. I haven't tried with non-English fonts yet, but DrawText can now show the non-ASCII characters in Arial, etc, so I imagine it'll be fine.
By "non-ASCII characters" are you referring to extended ASCII / latin-1 / whatever glyphs are sitting in 128-255? Unicode characters extend much further than that (64k+) and cannot be represented by the conventional one-byte-per-character method of encoding strings.
Non-English fonts won't solve the problem, as there are - for example - far more than 256 Chinese characters.
I could be wrong, actually. Are you able to point me to such a font?
Well to be honest I would love to bring my game to the asian market and as it is on track to be finished, I see no reason why it can't get there.
Need to be able to display asian char sets though.
Here's a page with a bunch of 14,000+ glyph TrueType fonts:
http://www.travelphrases.info/gallery/Fonts_ChineseTraditional.htmlI found it via a google search for chinese+unicode+font+download
I downloaded and installed the font HanWangCC02, which claims to have support for the "Bopomofo" character set. I then looked up Bopomofo on this page:
http://www.unicode.org/charts/Looking at the PDF, I picked an arbitrary character, U+3113, which looks somewhat like a candelabra. I entered the character into wordpad.exe (I'm on XP SP 2) by holding alt and entering its decimal representation on the numpad prefixed by a zero (3113h = alt+012563). Lo and behold, my candelabra appears! My new font was selected for me automatically - presumably because I don't have any other fonts with glyphs for that character.
That works...

From...
Graphics 640, 480, 0, 2
font = LoadImageFont ("C:\Windows\Fonts\wtcc02.ttf", 48)
If Not font Print "Doh!"; End
SetImageFont font
Cls
DrawText "Hello world", 0, 0
DrawText Chr ($3113), 0, 100
Flip
WaitMouse
End
Three cheers! :D
This program's quite nice when you stick this (GPL) font in the same folder:
http://www.artfiles.org/freebsd.org/distfiles/zh-wangttf/wtcc02.ttf (7MB!)
AppTitle = "Unicode Twirler"
Type Fader
Global FadeList:TList
Field x# = Rand (0, GraphicsWidth () - 1)
Field y# = Rand (0, GraphicsHeight () - 1)
Field ang# = Rnd (0, 359)
Field angspeed# = Rnd (0.1, 5)
Field fade# = 1.0
Field fadespeed# = Rnd (0.001, 0.01)
Field scale# = 1
Field scaler# = Rnd (-0.1, 0.1)
'Field ascii = 255
Field ascii:Long = Rand (12560, 12570)'(2 ^ 63) - 1)
Field r = Rand (0, 255), g = Rand (0, 255), b = Rand (0, 255)
Method New ()
If FadeList = Null Then FadeList = CreateList ()
ListAddLast FadeList, Self
End Method
Function DrawAll ()
If FadeList
For f:Fader = EachIn Fader.FadeList
f.fade = f.fade - f.fadespeed
If f.fade <0
ListRemove FadeList, f
Else
f.ang = f.ang + f.angspeed
SetRotation f.ang
f.scale = f.scale + f.scaler
SetScale f.scale, f.scale
SetAlpha f.fade
SetColor f.r, f.g, f.b
DrawText Chr (f.ascii), f.x, f.y
EndIf
Next
EndIf
End Function
End Type
Graphics 640, 480, 0
SetBlend ALPHABLEND
SetHandle 64, 64
font = LoadImageFont ("wtcc02.ttf", 128)
If font SetImageFont font Else Notify "You need this font in the same folder as this program:~nhttp://www.artfiles.org/freebsd.org/distfiles/zh-wangttf/wtcc02.ttf"; End
Repeat
Cls
If Rand (0, 99) > 90
f:Fader = New Fader
EndIf
Fader.DrawAll
Flip
Until KeyHit (KEY_ESCAPE)
End

(That jagginess is cured by loading the imagefont in a larger size, but isn't as noticeable when running anyway.)
That works, however the compiler can't recognize the unicode string(unicode strings existence will make the source uncompilable)
seems the only way is to convert every char to the corresponding value, which is a big task and hard to do.
Have seen some game that using the external file method like Megaman 6 for PC.
There is no such thing as a "unicode string" as unicode does not describe an encoding scheme. What encoding method are you using? UTF-8? UTF-16?
Didn't you earlier say that ""UTF-16" support only available in source saving and value passing". Did you verify that?
Yoxola, are you sure it's not just the IDE that can't take the character?
You can try:
Make any new source code and trying to type any CJK string in "" quota and trying to compile it.
That should explains that, if you don't actually use CJK you may not be able to understand how important UTF support is.
Èç¹ûÄ㲻ʹÓÃÖÐÎÄ£¬Äã¿ÉÄÜÓÀÔ¶²»ÖªµÀÆäÖØÒªÐÔ......
Once again:
CJK is not an encoding scheme. What encoding method are you using?
UTF-16 under XP
"ÎÒÏëÄã¸ù±¾²»¶®£¬¿´À´Ã»ÓиúÄãÓ‘Â۵ıØÒªÁË"