# [tex-live] [XeTeX] xetex.def

Joseph Wright joseph.wright at morningstar2.co.uk
Tue May 9 15:27:26 CEST 2017

On 09/05/2017 14:19, Akira Kakuto wrote:
> Dear Joseph,
>
>> Following a bug report for (x)dvipdfmx box scaling, we are talking a
>> look at xetex.def and dvidpfmx.def to fix that and related issues. This
>> raises a question: what is the reason for having two .def files here. A
>> quick test suggests that XeTeX (xdvipdfmx) can happily use dvipdfmx.def
>> with the exception of a few lines at the end of the file: those could
>
> I'm not familiar with the drivers, but I think that the independent
> xetex.def is definitely needed.
>
> I think that images png, jpg, pdf, are efficiently embedded in XeTeX,
> probably by using primitives, while dvipdfmx requires an external
> program extractbb to obtain sizes of the images.
>
> For example,
>
> %
> % xelatex test.tex    (xetex.def)
> %
> \documentclass[12pt]{article}
> \usepackage{graphicx}
> \usepackage{pdfpages}
> \begin{document}
> \includepdf[pages={1-9}]{xtst.pdf}
> \end{document}
>
> is far faster than
>
> %
> % xelatex test.tex   (dvipdfmx.def)
> %
> \documentclass[12pt,dvipdfmx]{article}
> \usepackage{graphicx}
> \usepackage{pdfpages}
> \begin{document}
> \includepdf[pages={1-9}]{xtst.pdf}
> \end{document}
>
> Best,
> Akira

Image inclusion is one I'd looked at, and certainly there is some
benefit from using the primitive for bounding-box lookup. However, that
doesn't mean that the entire .def files have to be different: for
example, we might pull them 'back together' in a .dtx and have only the
image inclusion bit varying. Other operations (scaling, rotation, colour
support, ...) seem to be addressable using common code, and indeed final
image inclusion (as opposed to BB extraction) could be done using a
common path for the shared data types (probably though as the BB lookup
is separate one should stick to the primitives in XeTeX).

So the question is what are the _essentials_ of the difference: really
it's about 'how much difference do we need to look after in the .def files'.

Joseph