Skip to content

Commit 8eddb32

Browse files
committed
Revert "Align image inclusion in XeTeX and dvipdfmx"
This reverts commit 996b731.
1 parent d2ff70f commit 8eddb32

File tree

3 files changed

+140
-25
lines changed

3 files changed

+140
-25
lines changed

testfiles-plain/eplain-001.xetex.tlg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ xetex.def: ....-..-.. v... Graphics/color driver for xetex
4747
\Gin@req@width=\dimen...
4848
))
4949
example-image.pdf: Graphic file (type pdf)
50-
<example-image.pdf>
50+
<use example-image.pdf>

testfiles-xetex/xetex001.tlg

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
This is a generated file for the l3build validation system.
22
Don't change this file in any respect.
33
File: example-image-a.pdf Graphic file (type pdf)
4-
<example-image-a.pdf>
4+
<use example-image-a.pdf>
55
File: example-image-a.pdf Graphic file (type pdf)
6-
<example-image-a.pdf>
6+
<use example-image-a.pdf, page 1>
77
File: az2.pdf Graphic file (type pdf)
8-
<az2.pdf>
8+
<use az2.pdf>
99
File: az2.pdf Graphic file (type pdf)
10-
<az2.pdf>
10+
<use az2.pdf>
1111
Completed box being shipped out [1]
1212
\vbox(633.0+0.0)x407.0
1313
.\glue 16.0
@@ -24,7 +24,18 @@ Completed box being shipped out [1]
2424
...\hbox(240.8994+0.0)x345.0, glue set 8.80078fil
2525
....\hbox(0.0+0.0)x15.0
2626
....\hbox(240.8994+0.0)x321.19922
27-
.....\special{pdf:image pagebox cropbox bbox 0 0 319.99922 239.9994 clip 0 width 321.19922pt (example-image-a.pdf) <</Group<</S/Transparency/K false/I false>>>>}
27+
.....\hbox(240.9+0.0)x321.20001
28+
......\hbox(240.9+0.0)x321.20001
29+
.......\hbox(240.9+0.0)x0.0
30+
........\special{pdf:btrans}
31+
........\special{x:scale 1 1}
32+
........\hbox(240.9+0.0)x0.0, glue set - 321.20001fil
33+
.........\hbox(240.9+0.0)x321.20001
34+
..........\XeTeXpdffile "./example-image-a.pdf"
35+
.........\glue 0.0 plus 1.0fil minus 1.0fil
36+
........\special{pdf:etrans}
37+
.......\kern 321.20001
38+
.......\glue 0.0 plus 1.0fil minus 1.0fil
2839
....\penalty 10000
2940
....\glue(\parfillskip) 0.0 plus 1.0fil
3041
....\glue(\rightskip) 0.0
@@ -34,7 +45,18 @@ Completed box being shipped out [1]
3445
...\hbox(240.8994+0.0)x345.0, glue set 8.80078fil
3546
....\hbox(0.0+0.0)x15.0
3647
....\hbox(240.8994+0.0)x321.19922
37-
.....\special{pdf:image page 1 pagebox cropbox bbox 0 0 319.99922 239.9994 clip 0 width 321.19922pt (example-image-a.pdf) <</Group<</S/Transparency/K false/I false>>>>}
48+
.....\hbox(240.9+0.0)x321.20001
49+
......\hbox(240.9+0.0)x321.20001
50+
.......\hbox(240.9+0.0)x0.0
51+
........\special{pdf:btrans}
52+
........\special{x:scale 1 1}
53+
........\hbox(240.9+0.0)x0.0, glue set - 321.20001fil
54+
.........\hbox(240.9+0.0)x321.20001
55+
..........\XeTeXpdffile "./example-image-a.pdf"
56+
.........\glue 0.0 plus 1.0fil minus 1.0fil
57+
........\special{pdf:etrans}
58+
.......\kern 321.20001
59+
.......\glue 0.0 plus 1.0fil minus 1.0fil
3860
....\penalty 10000
3961
....\glue(\parfillskip) 0.0 plus 1.0fil
4062
....\glue(\rightskip) 0.0
@@ -44,7 +66,18 @@ Completed box being shipped out [1]
4466
...\hbox(50.18736+0.0)x345.0, glue set 299.88759fil
4567
....\hbox(0.0+0.0)x15.0
4668
....\hbox(50.18736+0.0)x30.11241
47-
.....\special{pdf:image pagebox cropbox bbox 0 0 29.99992 49.99988 clip 0 width 30.11241pt (az2.pdf) <</Group<</S/Transparency/K false/I false>>>>}
69+
.....\hbox(50.1875+0.0)x30.1125
70+
......\hbox(50.1875+0.0)x30.1125
71+
.......\hbox(50.1875+0.0)x0.0
72+
........\special{pdf:btrans}
73+
........\special{x:scale 1 1}
74+
........\hbox(50.1875+0.0)x0.0, glue set - 30.1125fil
75+
.........\hbox(50.1875+0.0)x30.1125
76+
..........\XeTeXpdffile "./az2.pdf"
77+
.........\glue 0.0 plus 1.0fil minus 1.0fil
78+
........\special{pdf:etrans}
79+
.......\kern 30.1125
80+
.......\glue 0.0 plus 1.0fil minus 1.0fil
4881
....\penalty 10000
4982
....\glue(\parfillskip) 0.0 plus 1.0fil
5083
....\glue(\rightskip) 0.0
@@ -77,7 +110,18 @@ Completed box being shipped out [2]
77110
...\hbox(36.13489+0.0)x345.0, glue set 293.86511fil
78111
....\hbox(0.0+0.0)x15.0
79112
....\hbox(36.13489+0.0)x36.13489
80-
.....\special{pdf:image pagebox artbox bbox 0 0 35.9999 35.9999 clip 0 width 36.13489pt (az2.pdf) <</Group<</S/Transparency/K false/I false>>>>}
113+
.....\hbox(36.135+0.0)x36.135
114+
......\hbox(36.135+0.0)x36.135
115+
.......\hbox(36.135+0.0)x0.0
116+
........\special{pdf:btrans}
117+
........\special{x:scale 1 1}
118+
........\hbox(36.135+0.0)x0.0, glue set - 36.135fil
119+
.........\hbox(36.135+0.0)x36.135
120+
..........\XeTeXpdffile "./az2.pdf"
121+
.........\glue 0.0 plus 1.0fil minus 1.0fil
122+
........\special{pdf:etrans}
123+
.......\kern 36.135
124+
.......\glue 0.0 plus 1.0fil minus 1.0fil
81125
....\penalty 10000
82126
....\glue(\parfillskip) 0.0 plus 1.0fil
83127
....\glue(\rightskip) 0.0

xetex.def

Lines changed: 87 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -148,26 +148,98 @@
148148
}%
149149
}
150150
\def\Gread@@xetex@box#1box{#1}
151-
\newif\ifGread@transgroup
151+
\def\GPT@setup@scale{%
152+
\def\@tempa{!}%
153+
\ifx\Gin@scaley\@tempa
154+
\let\Gin@scaley\Gin@scalex
155+
\else
156+
\ifx\Gin@scalex\@tempa\let\Gin@scalex\Gin@scaley\fi
157+
\fi
158+
}
152159
\def\Ginclude@pdf#1{%
153-
\let\Gin@decode\@empty
154-
\Gin@interpolatefalse
155-
\Gread@transgrouptrue
156-
\Ginclude@dvipdfmx{#1}%
160+
\GPT@setup@scale
161+
\Gin@log{%
162+
<use #1%
163+
\ifx\Gin@page\@empty\else, page \Gin@page\fi
164+
>%
165+
}%
166+
\hbox{%
167+
\Gscale@box{\Gin@scalex}[\Gin@scaley]{%
168+
\@ifundefined{Gin@vllx}{%
169+
\GPT@viewportfalse
170+
% without viewport/trim clipping does not make sense
171+
% for pdfTeX
172+
\Gin@clipfalse
173+
}{}%
174+
\ifGin@clip
175+
\if!\Gin@vllx\Gin@vlly\Gin@vurx\Gin@vury!%
176+
\else
177+
\let\GPT@clipend\GPT@DoClipEnd
178+
\setbox\@tempboxa\hbox\bgroup
179+
\fi
180+
\fi
181+
\ifGPT@viewport
182+
\ifdim\Gin@vlly\p@=\z@
183+
\else
184+
\lower\Gin@vlly bp\hbox\bgroup
185+
\fi
186+
\ifdim\Gin@vllx\p@=\z@
187+
\else
188+
\hskip-\Gin@vllx bp\relax
189+
\fi
190+
\fi
191+
\XeTeXpdffile"#1" %
192+
\ifx\Gin@page\@empty\else page \Gin@page\fi
193+
\ifx\Gin@pagebox\@empty\else\expandafter\Gread@@xetex@box\Gin@pagebox\fi
194+
\ifGPT@viewport
195+
\ifdim\Gin@vlly\p@=\z@
196+
\else
197+
\egroup
198+
\fi
199+
\GPT@clipend
200+
\fi
201+
}%
202+
}%
157203
}
158-
\def\Ginclude@bmp#1{%
159-
\let\Gin@page\@empty
160-
\let\Gin@pagebox\@empty
161-
\Gread@transgroupfalse
162-
\Ginclude@dvipdfmx{#1}%
204+
\newif\ifGPT@viewport
205+
\GPT@viewporttrue
206+
\let\GPT@clipend\relax
207+
\def\GPT@DoClipEnd{%
208+
\egroup
209+
\dp\@tempboxa\z@
210+
% \Gin@urx and \Gin@ury already contain the correct values,
211+
% so both cases viewport and trim can be handled together:
212+
\dimen@\Gin@urx\p@
213+
\advance\dimen@ -\Gin@llx\p@
214+
\wd\@tempboxa\strip@pt\dimen@ bp\relax
215+
\dimen@\Gin@ury\p@
216+
\advance\dimen@ -\Gin@lly\p@
217+
\ht\@tempboxa\strip@pt\dimen@ bp\relax
218+
\GPT@clipbox\@tempboxa
219+
\box\@tempboxa
220+
}
221+
\def\GPT@clipbox#1{%
222+
\setbox#1=\hbox{%
223+
\Gin@defaultbp\WIDTH{\wd#1}%
224+
\Gin@defaultbp\DEPTH{\dp#1}%
225+
\@tempdima\ht#1%
226+
\advance\@tempdima\dp#1%
227+
\Gin@defaultbp\TOTALHEIGHT{\@tempdima}%
228+
\special{x:gsave}%
229+
\special{%
230+
pdf:literal
231+
0 -\DEPTH\GPT@space \WIDTH\GPT@space \TOTALHEIGHT\GPT@space re W n
232+
}%
233+
\rlap{\box#1}%
234+
\special{x:grestore}%
235+
\hskip\wd#1%
236+
}%
163237
}
164-
\def\Ginclude@dvipdfmx#1{%
238+
\def\Ginclude@bmp#1{%
165239
\Gin@log{<#1>}%
166240
\bgroup
167241
\def\@tempa{!}%
168242
\special{pdf:image\GPT@space
169-
\ifx\Gin@page\@empty\else page\GPT@space\Gin@page\GPT@space\fi
170-
\ifx\Gin@pagebox\@empty\else pagebox\GPT@space\Gin@pagebox\GPT@space\fi
171243
bbox\GPT@space\Gin@llx\GPT@space\Gin@lly\GPT@space\Gin@urx\GPT@space\Gin@ury\GPT@space
172244
clip\GPT@space\ifGin@clip 1\else 0\fi\GPT@space
173245
\ifx\Gin@scalex\@tempa\else width\GPT@space\the\Gin@req@width\GPT@space\fi
@@ -176,16 +248,15 @@
176248
\ifnum0%
177249
\ifx\Gin@decode\@empty\else 1\fi
178250
\ifGin@interpolate 1\fi
179-
\ifGread@transgroup 1\fi
180251
>0 %
181252
<<%
182253
\ifx\Gin@decode\@empty\else /Decode[\Gin@decode]\fi
183-
\ifGread@transgroup/Group<</S/Transparency/K false/I false>>\fi
184254
\ifGin@interpolate /Interpolate true\fi
185255
>>%
186256
\fi
187257
}%
188-
\egroup}
258+
\egroup
259+
}
189260
\newif\if@trim@vport
190261
\def\Ginclude@eps#1{%
191262
\Gin@log{<#1>}%

0 commit comments

Comments
 (0)