On 2017-12-18 at 15:42:15 +0000, Markus Kuhn wrote:
PDFs produced by pdftex can shrink significantly in size when processed through ghostscript's pdfwrite driver.
I understand a main reason for that is that ghostscript converts any Type 1 fonts that it finds into CFF (aka Type 1C) fonts.
I also understand that
- Type 1 fonts are eexec-encrypted, and such ciphertext cannot benefit from PDF's (de)flate compression.
- CFF fonts, on the other hand, are a compacter plain-text format and compress well.
- CFF fonts are also compatible with Type1, i.e. it is possible to convert any Type 1 font into a CFF font without loss of information.
Is all of this correct?
Hi Markus, yes, but CFF doesn't compress plain-text. The keywords you see in a disassembled font are replaced by op-codes (small numbers) like 00 version 01 Notice 02 FullName 03 FamilyName 04 Weight 05 FontBBox Thus a CFF font is quite compact even before it's compressed.
If so, isn't the continued use of Type 1 fonts in the TeX ecosystem an anachronism?
Shouldn't TeXLive ship instead CFF/Type 1C versions of the BlueSky Computer Modern fonts and shouldn't tools like pdftex switch to using them directly?
TeX Live just provides what people upload to CTAN. It's not possible to modify any packages. Even if we could write a script which converts all Type 1 fonts to CFF, we still have to adapt the .map files. But this isn't enough, see below.
Has someone looked into what would be involved with a Type 1 to CFF migration for pdftex?
pdftex and dvips create subsets of fonts and thus have to understand the font format. AFAIK they only understand Type 1 and Type 3 and pdftex also understands TTF. In order to support CFF, pdftex and dvips (which fortunately share the same code for Type 1 subsetting) must be enabled to convert Type 1 to CFF on the fly. If such code already exists in dvipdfm, all we need is a volunteer who does the work.
It seems at the moment, pdftex is actually replacing any Type 1C glyphs that it finds in a PDF file embedded with \pdfximage with the much less space-efficient Type 1 glyphs that it find in its font map files.
I don't think that pdftex replaces glyphs. That would require that pdftex understands CFF. I assume that pdftex first determines whether a font with the same name exists within the TEXMF tree. If true, it drops the embedded font and creates a common subset of the glyphs used in the embedded file and the main document. But the actual glyphs come from the font found in the TEXMF tree. Markus, I'm glad that you asked. I'm convinced that Type 1 fonts can be converted to CFF on the fly reliably and that many people enjoy the smaller PDF files. I don't see any technical restrictions. We just need volunteers. Regards, Reinhard -- ------------------------------------------------------------------ Reinhard Kotucha Phone: +49-511-3373112 Marschnerstr. 25 D-30167 Hannover mailto:reinhard.kotucha@web.de ------------------------------------------------------------------