Gentoo Archives: gentoo-user

From: Matthias Hanft <mh@×××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] PHP, Haru, Ghostscript, Courier, and Nimbus
Date: Mon, 07 Nov 2022 17:35:33
Message-Id: 58ea2197-6c3e-a9ce-4e5f-38b3f7941661@hanft.de
In Reply to: Re: [gentoo-user] PHP, Haru, Ghostscript, Courier, and Nimbus by Michael
1 Michael wrote:
2 >
3 > If your customers do not have Nimbus fonts available on their OS/PDF viewer,
4 > the viewer application will proceed using font substitution. It will use
5 > whichever font family it thinks is the closest match, I would assume
6 > Helvetica. Their application appears to get confused and substitute the
7 > Nimbus fonts with something else. In any case, the solution to this is to
8 > embed the Nimbus fonts in the PDF file.
9
10 How would I do that? It seems to be impossible for "Courier" because this
11 is a built-in font "and all viewers can display them", as stated at
12 https://durak.org/sean/pubs/software/php-7.0.0/haru.builtin.fonts.html
13 So it won't make much sense to embed Courier into the PDF anyway?!
14
15 It's just that >=ghostscript-gpl-9.56 won't write the requested font name
16 $myFont=$myPdf->getFont('Courier', 'WinAnsiEncoding');
17 into the PDF, but the substituted font name "Nimbus" (which seems to
18 confuse some PDF readers). Why did they change it from 9.55 to 9.56?
19 This is strange...
20
21 To be completely independent from any PDF display software, I could imagine
22 that the following could help:
23
24 - install media-fonts/corefonts
25 - load the ttf font with embed=true:
26 https://durak.org/sean/pubs/software/php-7.0.0/harudoc.loadttf.html
27 for example,
28 $myFontName=$myPdf->loadTTF('/usr/share/fonts/corefonts/cour.ttf', TRUE);
29 $myFont=$myPdf->getFont($myFontName, 'WinAnsiEncoding');
30
31 but I guess it will blow up my nice little PDF files (29 K only!) to a
32 multiple size... :-(
33
34 Anyway, I'll give it a try.
35
36 -Matt

Replies

Subject Author
[gentoo-user] Re: PHP, Haru, Ghostscript, Courier, and Nimbus Grant Edwards <grant.b.edwards@×××××.com>