2

When including images in XeTeX using \XeTeXpicfile I noticed that the dimensions of the output picture are wrong. I created the following MWE:

\nopagenumbers
% The TeXbook, p. 311
\def\hidehrule#1#2{\kern-#1%
  \hrule height#1 depth#2 \kern-#2 }
\def\hidevrule#1#2{\kern-#1{\dimen0=#1
    \advance\dimen0 by#2\vrule width\dimen0}\kern-#2 }
\def\makeblankbox#1#2{\hbox{\lower\dp0\vbox{\hidehrule{#1}{#2}%
    \kern-#1 % overlap the rules at the corners
    \hbox to \wd0{\hidevrule{#1}{#2}%
      \raise\ht0\vbox to #1{}% set the vrule height
      \lower\dp0\vtop to #1{}% set the vrule depth
      \hfil\hidevrule{#2}{#1}}%
    \kern-#1\hidehrule{#2}{#1}}}}

\def\pic#1{\setbox0=\vbox{\XeTeXpicfile #1 width 8cm}
  \vbox{\leavevmode\copy0\kern-\wd0\makeblankbox{.25pt}{.25pt}}}

\pic{test-cmyk300.jpg}
\bigskip
\pic{test-cmyk72.jpg}
\bigskip
\pic{test-rgb300.jpg}
\bye

Please download test-cmyk300.jpg, test-cmyk72.jpg and test-rgb300.jpg and watch the XeTeX output. (Side note: this is a detail of The Haywain Triptych.)

You'll notice that the 300 DPI CMYK image is enlarged, even though the parameter width 8cm is given. A workaround is to set the image resolution to 72 DPI, in which case the size is exactly right. Using a lower DPI setting the image is also scaled down. This problem doesn't exist with RGB images.

Is this a bug in XeTeX?

  • I suspect a bug in xdvipdfmx rather than XeTeX: I do see the erroneous behaviour here. – Joseph Wright Feb 6 '15 at 19:33
1

It was a bug in XeTeX and was fixed. See http://tug.org/pipermail/xetex/2015-February/025727.html

| improve this answer | |
0

On further investigation, it turned out to be a bug in xdvipdfmx and is fixed, thanks to Akira Kakuto.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.