[fpc-pascal] fpPDF and support of Latin2 charset

LacaK lacak at zoznam.sk
Wed Mar 20 15:05:52 CET 2019

>>>>>> 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 ?
>>> It seems that there is problem specific to CourierNew font (cour.ttf).
>>> With Arial (arial.ttf) it works as expected.
>>> Attached program which demonstrates problem.
>> Reported as bug https://bugs.freepascal.org/view.php?id=35251
>> (probably there is problem in parsing Courier New TTF font?)
> I am not sure this is the reason.
> I suspect that the Arial font has unicode glyphs, and courier not.
I do not know, but with other fonts: Arial, Verdana, Consolas it works 
as expected. Do you think, that Courier New is only exception?

When I look at 
https://docs.microsoft.com/en-us/typography/font-list/courier-new I do 
not see there something special compared to other fonts ...

But my knowledge about font structures (and also about PDF internals) is 
minimal ...

> Because how is the PDF generator supposed to know that it should 
> transcode your text to latin 2 ?

I do not know if it is necesssary.

I have used FPDF port of PHP PDF library, which I have rewritten to 
pascal and there I can use "Courier New" font.
(in both ways as embedded and also when not embedded)

Probably FPDF handles PDF generation bit differently, but when I write 
into file any text in code page CP1250 and I embedd Courier New font 
(generated in advance by using makefont.php utility) then I get correct 

So my raw guess was that it must be doable also using fcl-pdf somehow?


More information about the fpc-pascal mailing list