Open raytsang opened 11 years ago
You can replace
_fontDetails = new UIFontCharInfo[256];
in UIText.cs with something like
_fontDetails = new UIFontCharInfo[65536];
to make sure all UTF-16 characters will fit into that array, so that error won't occur and your text will render.
However... I can't consider this a really good idea, because that single array will take 2 MB in memory for each font, despite the number of characters present in that font. For that reason, I believe UIText.cs has to be pretty much rewritten in order to allow adequate performance without a large memory hit.
info face="µØ±d²Ó¶êÅé(P)" size=18 bold=1 italic=0 charset="" unicode=1 stretchH=150 smooth=1 aa=1 padding=2,2,2,2 spacing=2,2 outline=2 common lineHeight=27 base=20 scaleW=512 scaleH=256 pages=1 packed=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4 page id=0 file="Chinese_0.png" chars count=5 char id=20013 x=111 y=0 width=24 height=35 xoffset=-3 yoffset=-16 xadvance=18 page=0 chnl=15 char id=20491 x=84 y=0 width=25 height=35 xoffset=-4 yoffset=-16 xadvance=18 page=0 chnl=15 char id=23383 x=0 y=0 width=26 height=35 xoffset=-4 yoffset=-16 xadvance=18 page=0 chnl=15 char id=24190 x=28 y=0 width=26 height=35 xoffset=-4 yoffset=-16 xadvance=18 page=0 chnl=15 char id=25991 x=56 y=0 width=26 height=35 xoffset=-4 yoffset=-16 xadvance=18 page=0 chnl=15
a simple file with 5 character generated by bmfont
it got error messages...
IndexOutOfRangeException: Array index is out of range. UIText.loadConfigfile (System.String filename) (at Assets/Plugins/UIToolkit/UIElements/UIText.cs:136) UIText..ctor (.UIToolkit manager, System.String fontFilename, System.String textureFilename) (at Assets/Plugins/UIToolkit/UIElements/UIText.cs:87) MainMenu.Start () (at Assets/Script/MainMenu.cs:185)