Code: Select all
Function testFont(fileTTF)
/* Test all chars in a font */
Picture = CreateBrush(Nil, 2480, 3507, #WHITE)
SelectBrush(Picture)
OpenFont(1, fileTTF, 120, {Engine = #FONTENGINE_INBUILT})
UseFont(1)
SetFontColor(#BLACK)
SetFontStyle(#NORMAL|#ANTIALIAS)
For i=0 To 15
For j=0 To 15
car=i*16+j
/* codes 0,91 and 93 gives problem */
If car<>0 And car<>91 And car<>93
TextOut(j*150,i*200,ConvertStr(Chr(car), #ENCODING_RAW, #ENCODING_UTF8))
EndIf
Next
Next
saveFile = "C:\\Temp\\FontTest.png"
SaveBrush(Picture, saveFile, #WHITE, #IMGFMT_PNG)
EndSelect()
FreeBrush(Picture)
CloseFont(1)
EndFunction
f$ = FileRequest("Select a TTF font")
testFont(f$)
End
However, it doesn't always work. It often happens that some characters are missing, and in one case they were all missing too! I also tried Chr () alone, without ENCODING_RAW and #ENCODING_UTF8 and ByteChr () instead of Chr (). All in vain, I can't get the entire character set contained in the font. This code has been executed under Hollywood 7.1.
How could I do?