[XeTeX] Controlling font embedding in PDF output

Ross Moore ross.moore at mq.edu.au
Fri Nov 16 20:07:59 CET 2018

Hi Werner,

On 17/11/2018, at 1:36, "Werner LEMBERG" <wl at gnu.org> wrote:

> > > Is there a simple option to make XeTeX (or rather xdvipdfmx) not
> > > embed fonts in PDFs? I'm going to post-process the output, which
> > > will do the embedding.
> >
> > Perhaps it is easier to generate the PDF, then remove the embedded
> > fonts?
> Not for my use case, which is to include many PDFs (generated by
> LilyPond) into a master PDF (generated by XeLaTeX). The
> post-processor (Ghostscript's ps2pdf script) should then compute
> subsetted fonts for the whole document, which can make the final PDF
> *a lot* smaller in comparison to the standard way because subsetted
> fonts usually can't be merged.

Are you sure that this is even feasible, in that the same characters are referred to in the same way, in each of the Lilypond PDFs?

If the fonts are all Type1, with the same encodings in each PDF, this would be OK.
But I've seen PDFs where the subsetting of Type0 or TTF fonts is as an array, which simply assigns a number to the used glyphs, perhaps in the order of first occurrence within the PDF. These certainly cannot be merged, without adjusting essentially every string in every embedded PDF.

> In LilyPond I can control whether its output PDF gets generated
> (1) the usual way (using subsetted fonts), (2) with embedded but not
> subsetted fonts, or (3) without embedded fonts. Ideally, I want
> option (3) for XeTeX (and for pdfTeX and luatex also, BTW). If this
> isn't possible, I would like to enforce option (2) so that ps2pdf can
> still do a decent job (at the cost of larger intermediate PDFs).

If you can get this to work, I'd be very interested in the technique.
Otherwise, a possible alternative approach is to combine the PDFs into a single Portfolio, using Adobe's Acrobat Pro. However I'd doubt that this gives any saving in file size over inclusion as attachments.

> Werner

Hope this helps.


More information about the XeTeX mailing list