# [pdftex] pdftex - Encoding for metafont PK fonts

Pali Rohár pali.rohar at gmail.com
Sun Jun 26 22:56:40 CEST 2016

```On Sunday 26 June 2016 13:35:22 Pali Rohár wrote:
> On Sunday 26 June 2016 07:54:19 Reinhard Kotucha wrote:
> > On 2016-06-25 at 22:56:48 +0000, Ross Moore wrote:
> >  > But it is pity that it is not possible to specify that enc file
> >  > also for PK fonts generated by MetaFont. Or it is somehow
> >  > possible?
> >  >
> >  > I see no reason why not, but could easily be wrong.
> >  > But I must admit that I’ve not tried it with a PK font.
> >
> > Dear Ross,
> > I assume that the main problem is that Metafont is using numerical
> > glyph indices but in order to re-encode a font, it's required that
> > each glyph has a name.
>
> Yes! And that glyph name for each numberical value (index) is
> available in encode file (csr.enc). This is reason why I'm tryint to
> tell pdftex:
>
> "hey pdftex, please use csr.enc for my csb12 PK font, it contains
> mapping index --> glyph name which you need to building cmap file"

Ok, it is really not possible with pdftex. I looked into pdftex source
code and code for writing PK & Type 3 fonts in PDFtex does not use
encoding vectors...

Also code for loading mapfile cannot be used for PK fonts (checker
refuse it).

I looked deeply how pdftex working with Type 3 and PK fonts and created
small patch which adds support for generating /ToUnicode object (from
\pdfglyphtounicode table) and which allows to load enc file also PK
fonts.

Patch was created against pdftex in TeXLive 2012 (which is on my
system), but is really small and should be very easy to rewrite/apply it
on new versions.

Patch pdftex-pkfonts-encfile-tounicode.patch is attached.

Let me know what do you think about it and if it can be added to pdftex
project.

--
Pali Rohár
pali.rohar at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pdftex-pkfonts-encfile-tounicode.patch
Type: text/x-patch
Size: 5231 bytes
Desc: not available