[fpc-pascal] fpPDF and support of Latin2 charset

LacaK lacak at zoznam.sk
Tue Mar 19 13:48:07 CET 2019


>
>> Hi,
>>
>> I am trying work with fpPDF. I can create PDF document, but character 
>> out of ASCII range are displayed wrong (in PDF file they are stored 
>> as UTF8).
>> Probably it is because I use standard Courier font, which is 
>> expecting only "Latin characters" ? I use:
>>
>> FontIndex := PDF.AddFont('Courier'); // --> test1.pdf
>>
>> When I want to use TTF font:
>>
>> FontIndex := PDF.AddFont('cour.ttf','CourierNew');  // --> test2.pdf
>> (nothing else this line has changed)
>>
>> I get strange PDF file (I can open it but content is wrong)
>>
>> What I am doing wrong? Is there way how to get correct PDF with 
>> characters from Latin2 code page?
>
> Not to my knowledge. You must use unicode for characters outside the 
> ASCII range.

Seems, that Adobe in 
https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf 
in Annex D2: "Latin Character Set and Encodings" specifies exactly which 
characters are supported (by standard 14 fonts). Characters not listed 
there are simply replaced by "X" in Adobe Acrobat Reader. But Foxit 
reader displays them correctly (so I can use full range of characters 
from CP1250 when I specify appropriate <</Type /Encoding /BaseEncoding 
/WinAnsiEncoding /Differences [...] ...

Seems that in case when standard fonts are used fpPDF does not convert 
Utf8String on input of WriteText() function CP1252 ...?


>
>> Is there way how to get correct PDF file WITHOUT embedding full 
>> Courier font?
>
> You can embed only the needed characters for every font ?
Probably yes, but fpPDF will not handle this automatically? AFAIK I can 
not control this.

But why I get unreadable characters? What I am doing wrong ?

-Laco.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190319/b1721cdf/attachment.html>


More information about the fpc-pascal mailing list