[NTG-pdftex] [PATCH] pdftex - Add new \pdfpkscalable primitive

Pali Rohár pali.rohar at gmail.com
Thu Mar 30 19:10:02 CEST 2017


Hi!

As Karl suggested, I implemented new pdfTeX primitive for controlling if 
PK font specified in \pdfmapline or \pdfmapfile should be treated as 
scalable or not. Now by default PK fonts in mapfile/mapline are 
scalable.

Setting value to boolean register \pdfpkscalable takes affect for 
followings \pdfmapfile and \pdfmapline calls. When is 1 (true) then PK 
fonts specified in mapfile/mapline are scalable, when 0 (false) then 
non-scalable (like if they are not specified in mapfile/mapline). 
Default value is \pdfpkscalable=1 (so behaviour like before).

It is useful for specifying enc file for non scalable PK font file (as 
most bitmap PK fonts does not scale).

In patch I defined new fm type flags F_TYPE3 and F_SCALT3FONT, so fm 
entry can be correctly check if is type 3 or not. Next I split behaviour 
of current function hasfmentry() into hasfmentry() and isscalable(). 
hasfmentry() returns true if font id has fm entry (like before), and 
isscalable() returns true if font id is scalable. In more places was 
used call hasfmentry() just for checking if font is scalable. Now after 
introducing non-scalable PK fonts in fm entry, check for scalable font 
cannot be done by hasfmentry().

So after this change font is *not* scalable (OR):
* was not specified in \pdfmapfile or \pdfmapline
* is PK Type3 and \pdfpkscalable was set to 0 prior map line processing

Example for pdftex -ini:

\pdfoutput=1 \catcode`\{=1 \catcode`\}=2
\pdfpkresolution=600 \hsize=4in \vsize=4in \parfillskip=0pt plus1fil
\pdfcompresslevel=0 \pdfobjcompresslevel=0
\output={\shipout\box255}
\input glyphtounicode
\pdfgentounicode=1
\pdfmapline{} % disable all Type1 fonts
\pdfpkscalable=0
\pdfmapline{cmr10 <7t.enc}
\font\fa=cmr10
\fa ffi test
\vskip10pt
\font\fb=cmr10 at 60pt
\fb ffi test
\end

When line with pdfmap 7t.enc is commented, then output PDF would not 
have Unicode definition for ffi ligature.

When line \pdfpkscalable=0 is commented, then font at 60pt would look 
very ugly in result PDF file (just scaled \fa cmr10 with 600dpi).

Suggestions or improvements to my patch are welcome!

-- 
Pali Rohár
pali.rohar at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pdftex-add-pdfpkscalable-primitive.patch
Type: text/x-patch
Size: 8970 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-pdftex/attachments/20170330/418c570b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mailman.ntg.nl/pipermail/ntg-pdftex/attachments/20170330/418c570b/attachment.sig>


More information about the ntg-pdftex mailing list