1

I just noticed today that our internal document generation system (using XeLaTeX under the hood) does not produce binarily identical PDFs given the same inputs (which is something that we need to ensure for our own traceability mandates). I set out today to fix the problem and came across this anwer which helped me get part of the way there.

Unfortunately, I was still seeing differences in the final output hashes. I recompiled the documents with \special{dvipdfmx:config z 0} so that I could try to see a textual diff and that helped me see that the font names themselves are getting prefixed with a string of 5 characters which change for each compilation.


MWE (xelatex):

% filename: mwe.tex
\documentclass{minimal}

\begin{document}
A
\end{document}

If I compile this document twice

$ xelatex -jobname=mwe1 mwe.tex
$ xelatex -jobname=mwe2 mwe.tex

and then look at the fonts contained in each

$ pdffonts mwe1.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
AMLHNB+LMRoman10-Regular-Identity-H  CID Type 0C       Identity-H       yes yes yes      5  0
$ pdffonts mwe2.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
DVQZGA+LMRoman10-Regular-Identity-H  CID Type 0C       Identity-H       yes yes yes      5  0  

then I see that this 5-character prefix seems to be changing at random. This is preventing me from achieving my ultimate goal of binarily reproducible builds.

Question

Is there anything I can do to prevent this prefix from changing each build? If not, then is there any way to coerce xelatex to avoid using a prefix altogether?


For further information, pdflatex does not seem to exhibit this problem (though the font name it derives is different from xelatex, which is to be expected, I suppose).

$ pdflatex -jobname=pdftex1 mwe.tex
$ pdflatex -jobname=pdftex2 mwe.tex

produces

$ pdffonts pdftex1.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
GBZLEI+CMR10                         Type 1            Builtin          yes yes no       4  0
$ pdffonts pdftex2.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
GBZLEI+CMR10                         Type 1            Builtin          yes yes no       4  0 
2

0

Browse other questions tagged .