The sample program from Thorsten (pbPDF-EmbedFont.pb) with the font Lucida Sanc Unicode (l_10646.ttf ) works, but does not support the styles bold, italic or bolditalic. With every other font tested so far there are the following problems:
1. a black square with a white cross or a small black square is placed in front of each string and
2. with some fonts the following message appears additionally (at least in Adobe Acrobat): "In the font [here the font name] the value for /Flags is incorrect".
3. as a side effect I noticed that "PDF::Bookmark" does not support Unicode (or I don't know how). Here the Cyrillic characters are output as question marks.
Has anyone ever gotten a font with multiple styles with Unicode characters to work.
To understand the problem I have attached the pictures and a small example program. For testing please copy this together with the "ArialMT" fonts (arial.ttf/ariali.ttf …) from c:\windows\fonts\ into the examples folder of the pdfModule.
Code: Select all
XIncludeFile "..\pbPDFModule.pbi"
Define.s Path2Font=""
Define.s Font="ArialMT-"
Define.s File=Font+"pbPDF-EmbedFont.pdf"
Define.s String=" <- "
Define.i i
For i=$0400 To $0410 ;testweise ein paar kyrillische Zeichen
String=String+Chr(i)
Next i
#PDF = 1
If PDF::Create(#PDF)
PDF::AddPage(#PDF)
Debug PDF::EmbedFont(#PDF, Path2Font+"arial.ttf", "ArialMT", "", PDF::#Unicode)
Debug PDF::EmbedFont(#PDF, Path2Font+"ariali.ttf", "ArialMT", "I", PDF::#Unicode)
Debug PDF::EmbedFont(#PDF, Path2Font+"arialbd.ttf", "ArialMT", "B", PDF::#Unicode)
Debug PDF::EmbedFont(#PDF, Path2Font+"arialbi.ttf", "ArialMT", "BI", PDF::#Unicode)
PDF::SetFont(#PDF,"ArialMT", "", 14)
PDF::PlaceText(#PDF,Font+"Regular"+String, 10, 20)
PDF::SetFont(#PDF, "ArialMT", "I", 14)
PDF::PlaceText(#PDF, Font+"Italic"+String, 10, 30)
PDF::SetFont(#PDF, "ArialMT", "B", 14)
PDF::PlaceText(#PDF, Font+"Bold"+string, 10, 40)
PDF::SetFont(#PDF, "ArialMT", "BI", 14)
PDF::PlaceText(#PDF, Font+"BoldItalic"+String, 10, 50)
PDF::BookMark(#PDF, "Bookmark"+string, 0, #PB_Default, #PB_Default)
PDF::Close(#PDF, File)
EndIf
RunProgram(File)