[pdftex] pdftex - Encoding for metafont PK fonts

Pali Rohár pali.rohar at gmail.com
Sat Jun 25 12:46:06 CEST 2016

On Friday 24 June 2016 23:10:04 Paul Vojta wrote:
> For PK fonts as produced by MetaFont (which are not PS Type 3),
> probably the way to go would be to create a virtual font to achieve
> the reencoding. That is the standard way to go in the dvi driver
> world.

Ok, to make it clear. I have PK font file (automatically generated from 
MetaFont when running pdftex) and this PK font is in IL2 encoding.

pdftex see input file in IL2 encoding and so it correctly handle font 
rendering and use metrics, kerns, ligatures, ...

When I print PDF document generated by pdftex, everything is OK, it 
looks perfectly.

Problem is if I open that PDF document in PDF reader and I want to 
select and copy text from document. Or when I want to search it.

All PDF readers which I tested think that text in that PDF document is 
in Latin1 encoding, not Latin2 (IL2) in which is that PK font.

So e.g. when I select character 'č' PDF reader copy 'è'. 'č' is at 
position 0xE8 in Latin2 and at position 0xE8 in Latin1 is 'è'.

Maybe PDF readers could think that font is not in Latin1, but in Unicode 
as IIRC Unicode at positions 128-255 have same characters as Latin1 

Unicode character U+00E8 is for sure 'è'. So I bet this is reason why 
PDF reader thinks that I selected character 'è' and not 'č'.

For Type 1 PFB fonts (even in IL2 encoding) this is not a problem, 
because for each characters there is stored unified glyph name and there 
is standard conversion table from glyph name to unicode character.

So probably in PK fonts is not any conversion table from 8bit character 
to unicode character and so something (pdftex? PDF reader?) assume 
either Latin1 or Unicode.

In detail my question is: How to tell pdftex encoding of PK font 
(generated from MetaFont)?

> For information on virtual fonts:  use Google.

With above detailed description, are you sure that virtual fonts could 
do this unicode mapping?

Are not virtual fonts again only 8bit (as opposite of glyph names and 

Pali Rohár
pali.rohar at gmail.com
-------------- 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://tug.org/pipermail/pdftex/attachments/20160625/5974b45b/attachment.bin>

More information about the pdftex mailing list