latex3 / graphics-def

driver option files for color and graphics
LaTeX Project Public License v1.3c
10 stars 7 forks source link

Scaling bug in current xetex.def #13

Open nolda opened 7 years ago

nolda commented 7 years ago

Using \scalebox with XeLaTeX and current xetex.def may misalign content.

Consider the following MWE:

\documentclass{article}
\usepackage{graphics}
\usepackage{pstricks,pst-node}
\pagestyle{empty}
\newcommand{\sample}{%
\psset{nodesep=1pt}
\Rnode{A}{left} \hskip4em \Rnode{B}{right}%
\ncline{|-|}{A}{B}\naput{center}%
}

\begin{document}
\sample
\vskip\baselineskip
\scalebox{0.8}{\sample}
\end{document}

In the second, scaled sample, the "center" label is misaligned if the MWE is compiled with XeLaTeX and v. 5.0h of xetex.def (cf. the attached mwe_xetex-def_5.0h.pdf). With v. 4.10 of xetex.def (commit edf0eb48e2e70f7dc1147e79e28a7dceeda605d0) or with PDFTeX, however, it compiles correctly (cf. mwe_xetex-def_4.10.pdf and mwe_pdftex-def.pdf, respectively). mwe_xetex-def_5.0h.pdf mwe_xetex-def_4.10.pdf mwe_pdftex-def.pdf

josephwright commented 7 years ago

The issue comes up as we've altered how scalings are done: one can use the xdvipdfmx built-in x:scale or a PDF transformation matrix. The latter was what was used by v4.10, but that is then not 'aware' of any other effects, most notably hyperlinks: scaling misplaced those. The x:scale approach doesn't have that problem as the driver is tracking everything. I'll see if I can track down why that's failing here: I have a feeling it's because the PStricks stuff has to happen at the 'bare metal' end ...

josephwright commented 7 years ago

BTW, the use of a PDF-based scaling matrix wasn't in the release for all that long: a few months last year. It seemed attractive until the hyperlink business came up.