21

I have a set of one-page documents written in LaTex.

The same file compiled in LuaLaTeX is about 23 times larger than when it is complied using XeLaTex (about 641 KB vs 28 kb). I tried with a couple of difference fonts, and the LuaLaTeX compiled PDF was always significantly larger than the one made with XeLaTeX.

The anyone know the cause if this difference in output file size?

  • 3
    Maybe the one does not include the fonts directly but the other one does? Also check for the PDF version and compression level. – Martin Scharrer May 04 '12 at 20:00
  • Different compression levels do not make up such a big difference. And does TeX ever produce a PDF without fonts? That would be crazy. – topskip May 04 '12 at 20:31
  • 2
  • 1
    @PatrickGundlach: What do I as a traditional pdflatex user know about this crazy xelatex and what it does with fonts? ;-) – Martin Scharrer May 04 '12 at 21:29
  • @MartinScharrer True. And it is merely a strong hope that no TeX engine ever produces PDFs without embedding all fonts. – topskip May 05 '12 at 08:54
  • @PatrickGundlach: You actually can switch off the inclusion of the 14(?) PS standard fonts in a global config file, and fonts from included PDFs might not be included (in the main PDF). – Martin Scharrer May 05 '12 at 09:09
  • @MartinScharrer But I am not sure if this is very clever. I believe (I really don't know) that this leads to a lot of problems (font substitution of unknown fonts). – topskip May 05 '12 at 09:26
  • @PatrickGundlach: Well the standard PS should be available with Adobe Reader etc., but I agree that it is not wise to not include them. Also publishers are very strict on all fonts being included. – Martin Scharrer May 05 '12 at 09:58
  • @PatrickGundlach: the "normal" thing to do, in the early days of pdf from *tex, was exactly that -- leave the fonts out and let recipient's reader sort it out. for many purposes, that's entirely reasonable -- for example, package docs really don't need ultimate accuracy so long as they remain basically readable. it's only more recently that us people in the street are starting to think as you do; of course print shops have always insisted on embedding, but that's not surprising. – wasteofspace May 05 '12 at 14:52

1 Answers1

27

This is because LuaTeX embeds Type1 fonts whereas XeTeX uses Type1C fonts. Type1C fonts are compact fonts (CFF). See my answer on Why does pdflatex produce bigger output files than latex+dvipdfm? for more details.

$ pdffonts onepage-lualatex.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
KBBDIF+CMR10                         Type 1            yes yes no       4  0

$ pdffonts onepage-xelatex.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
WEDQOW+CMR10                         Type 1C           yes yes no       4  0

and

$ ls -lh onepage-lualatex.pdf onepage-xelatex.pdf
-rw-r--r-- 1 patrick staff  17K  4. Mai 22:10 onepage-lualatex.pdf
-rw-rw-rw- 1 patrick staff 4,9K  4. Mai 22:08 onepage-xelatex.pdf
topskip
  • 37,020
  • This makes sense. I think I understand the difference, though I'm not sure what advantage Type 1 would then have over Type 1C. Is is relatively trivial to get LuaLaTeX to use Type 1C? File size is important for our current TeX usage. – Scribblemacher May 07 '12 at 13:34
  • @Scribblemacher I don't know if it is possible at all to get LuaTeX to write Type1C files. If file size is important, then you might try to use a built in font and don't include any. (Ask a new question ;-)) – topskip May 09 '12 at 08:11