Haru library, TruType Font and CP1250

451 views
Skip to first unread message

kudlaty

unread,
Mar 6, 2012, 5:49:45 AM3/6/12
to Harbour Users
Hi

I'm new in using library Haru to creating PDF and I have a strange
problem with trutype fonts.

This is my code:
.....................................
cFont := HPDF_LoadTTFontFromFile (hPDF, "c:\windows\fonts\COUR.ttf",
HPDF_TRUE)
hFCourier := HPDF_GetFont( hPDF, cFont, "CP1250" )
cFont := HPDF_LoadTTFontFromFile (hPDF, "c:\windows\fonts\COURBD.ttf",
HPDF_TRUE)
hFCourierB := HPDF_GetFont( hPDF, cFont, "CP1250" )
cFont := HPDF_LoadTTFontFromFile (hPDF, "c:\windows\fonts\TIMES.ttf",
HPDF_TRUE)
hFTimes := HPDF_GetFont( hPDF, cFont, "CP1250" )

cFont := HPDF_LoadTTFontFromFile (hPDF, "c:\windows\fonts
\TIMESBD.ttf", HPDF_TRUE)
hFTimesB := HPDF_GetFont( hPDF, cFont, "CP1250" )

cFont := HPDF_LoadTTFontFromFile (hPDF, "c:\windows\fonts
\ARIALBD.ttf", HPDF_TRUE)
hFTytul := HPDF_GetFont( hPDF, cFont, "CP1250" )
.....................................
HPDF_Page_SetFontAndSize( page, hFTimesB, 9 )

Everything works fine. PDF is created and in Acrobate Reader looks
perfect. All polish chars.
BUT
When I open PDF with Foxit Reader all fonts in bold (TIMESBD,
ARIALBD, COURBD) are changed and I don't have polish chars.
It looks like Foxit uses alternative font.
But why ??
I use HPDF_LoadTTFontFromFile with HPDF_TRUE what should embed the
font.

Opening my PDF in Acrobat Reader on "Windows XP english version" is
just disaster. Other fonts without polish chars in right places.

Is there Anyone who could explain this?
In the last resort I will be using only Acrobat Reader but maybe I do
sth. wrong.

Błażej Powroźnik

kudlaty

unread,
Mar 6, 2012, 6:48:42 AM3/6/12
to Harbour Users
I made a little experiment
I changed code to:

cFont := HPDF_LoadTTFontFromFile (hPDF, "c:\windows\fonts
\TIMESBD.ttf", HPDF_FALSE)
hFTimesB := HPDF_GetFont( hPDF, cFont, "CP1250" )

PDF is identical
HPDF_TRUE i HPDF_FALSE make identical files.

le...@yandex.ru

unread,
Mar 6, 2012, 3:48:09 PM3/6/12
to Harbour Users
it works
cFont := HPDF_LoadTTFontFromFile (hPDF, "c:\windows\fonts
\TIMESBD.ttf", .f.)
or
cFont := HPDF_LoadTTFontFromFile (hPDF, "c:\windows\fonts
\TIMESBD.ttf", .t.)

kudlaty

unread,
Mar 7, 2012, 4:17:11 AM3/7/12
to Harbour Users


On 6 Mar, 21:48, "le...@yandex.ru" <le...@yandex.ru> wrote:
> it works
> cFont := HPDF_LoadTTFontFromFile (hPDF, "c:\windows\fonts
> \TIMESBD.ttf",  .f.)
> or
> cFont := HPDF_LoadTTFontFromFile (hPDF, "c:\windows\fonts
> \TIMESBD.ttf",  .t.)
>
> On 6 ÜÐà, 15:48, kudlaty <kudl...@proscan.com.pl> wrote:
>
I couldn't believe. It was so simple.
You saved my life.
Many thanks
Błażej Powroźnik
Reply all
Reply to author
Forward
0 new messages