Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is kerning encoded on embedded Adobe Type 1 fonts in PDF files?

Tags:

pdf

fonts

kerning

Adobe PDF reference talks about /Widths array and /FontFile stream, but Adobe Type 1 font programs (.pfb or .pfa files) don't include font metrics; they are included in font metric files (.afm or .pfm files) but these are not embedded in PDF file.

PDF can just encode char width metrics or it can encode kerning pair too? How?

like image 277
MRuizEscribano Avatar asked Aug 19 '13 00:08

MRuizEscribano


People also ask

How do I change the embedded subset font in PDF?

Bring up the Adobe PDF settings and properties, then Adobe PDF settings. Embed your font. Edit the default settings and navigate to Font, click the Embed all fonts option. Your font should now be installed for use.

What are embedded fonts in PDF?

“Embedding fonts” ensures that all of the font information used to make your document look the way it does is stored in the PDF file. So, no matter what fonts a balloter (or reader) has on their computer, they'll be able to see the file as you intended it to be seen.

How do I know if fonts are embedded in a PDF?

To check that your fonts are embedded in Adobe Acrobat, go to File on the top menu and select Properties… then select the Fonts tab, this will list the font used in the document. You want to check that they are either (Embedded) or (Embedded Subset).

Why does the font change in PDF?

Sometimes a PDF file looks fine on screen but it prints in an unsightly substitute font which impedes reading, or symbols are replaced by small rectangles. This is due to Adobe trying to re-create the document using its own fonts instead of the document's fonts.


1 Answers

If you study the section 9.4.4 of the PDF specification ISO 32000-1 (see below), you'll see that no special kerning information (e.g. extracted from the font program) are included in the calculation of the glyph displacement.

You'll also see, though, that there is a Tj value which denotes a number in a TJ array, if any, which specifies a position adjustment. This value is used to implement kerning.

E.g. that phrase "denotes a number in a TJ array, if any, which specifies a position adjustment" from the specification itself is set as:

[( de)-5.5(no)-5.5(te)-5.5(s a nu)-5.5(m)-5.7(b).5(e)-5.5(r).3( in a )]TJ
...

You see for example kerning applied in denotes between 'e' and 'n', 'o' and 't', and 'e' and 's'.

The section from the specification:

The section 9.4.4 referenced above

like image 96
mkl Avatar answered Oct 03 '22 17:10

mkl