Skip to content

Commit 996b731

Browse files
committed
Align image inclusion in XeTeX and dvipdfmx
Bounding box reading remains split, but image inclusion is aligned as this means we will be able to add PDF attributes in due course.
1 parent 08bcd49 commit 996b731

File tree

3 files changed

+25
-140
lines changed

3 files changed

+25
-140
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-
<use example-image.pdf>
50+
<example-image.pdf>

testfiles-xetex/xetex001.tlg

Lines changed: 8 additions & 52 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-
<use example-image-a.pdf>
4+
<example-image-a.pdf>
55
File: example-image-a.pdf Graphic file (type pdf)
6-
<use example-image-a.pdf, page 1>
6+
<example-image-a.pdf>
77
File: az2.pdf Graphic file (type pdf)
8-
<use az2.pdf>
8+
<az2.pdf>
99
File: az2.pdf Graphic file (type pdf)
10-
<use az2.pdf>
10+
<az2.pdf>
1111
Completed box being shipped out [1]
1212
\vbox(633.0+0.0)x407.0
1313
.\glue 16.0
@@ -24,18 +24,7 @@ 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-
.....\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
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>>>>}
3928
....\penalty 10000
4029
....\glue(\parfillskip) 0.0 plus 1.0fil
4130
....\glue(\rightskip) 0.0
@@ -45,18 +34,7 @@ Completed box being shipped out [1]
4534
...\hbox(240.8994+0.0)x345.0, glue set 8.80078fil
4635
....\hbox(0.0+0.0)x15.0
4736
....\hbox(240.8994+0.0)x321.19922
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
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>>>>}
6038
....\penalty 10000
6139
....\glue(\parfillskip) 0.0 plus 1.0fil
6240
....\glue(\rightskip) 0.0
@@ -66,18 +44,7 @@ Completed box being shipped out [1]
6644
...\hbox(50.18736+0.0)x345.0, glue set 299.88759fil
6745
....\hbox(0.0+0.0)x15.0
6846
....\hbox(50.18736+0.0)x30.11241
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
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>>>>}
8148
....\penalty 10000
8249
....\glue(\parfillskip) 0.0 plus 1.0fil
8350
....\glue(\rightskip) 0.0
@@ -110,18 +77,7 @@ Completed box being shipped out [2]
11077
...\hbox(36.13489+0.0)x345.0, glue set 293.86511fil
11178
....\hbox(0.0+0.0)x15.0
11279
....\hbox(36.13489+0.0)x36.13489
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
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>>>>}
12581
....\penalty 10000
12682
....\glue(\parfillskip) 0.0 plus 1.0fil
12783
....\glue(\rightskip) 0.0

xetex.def

Lines changed: 16 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -148,98 +148,26 @@
148148
}%
149149
}
150150
\def\Gread@@xetex@box#1box{#1}
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-
}
151+
\newif\ifGread@transgroup
159152
\def\Ginclude@pdf#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-
}%
203-
}
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-
}%
153+
\let\Gin@decode\@empty
154+
\Gin@interpolatefalse
155+
\Gread@transgrouptrue
156+
\Ginclude@dvipdfmx{#1}%
237157
}
238158
\def\Ginclude@bmp#1{%
159+
\let\Gin@page\@empty
160+
\let\Gin@pagebox\@empty
161+
\Gread@transgroupfalse
162+
\Ginclude@dvipdfmx{#1}%
163+
}
164+
\def\Ginclude@dvipdfmx#1{%
239165
\Gin@log{<#1>}%
240166
\bgroup
241167
\def\@tempa{!}%
242168
\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
243171
bbox\GPT@space\Gin@llx\GPT@space\Gin@lly\GPT@space\Gin@urx\GPT@space\Gin@ury\GPT@space
244172
clip\GPT@space\ifGin@clip 1\else 0\fi\GPT@space
245173
\ifx\Gin@scalex\@tempa\else width\GPT@space\the\Gin@req@width\GPT@space\fi
@@ -248,15 +176,16 @@
248176
\ifnum0%
249177
\ifx\Gin@decode\@empty\else 1\fi
250178
\ifGin@interpolate 1\fi
179+
\ifGread@transgroup 1\fi
251180
>0 %
252181
<<%
253182
\ifx\Gin@decode\@empty\else /Decode[\Gin@decode]\fi
183+
\ifGread@transgroup/Group<</S/Transparency/K false/I false>>\fi
254184
\ifGin@interpolate /Interpolate true\fi
255185
>>%
256186
\fi
257187
}%
258-
\egroup
259-
}
188+
\egroup}
260189
\newif\if@trim@vport
261190
\def\Ginclude@eps#1{%
262191
\Gin@log{<#1>}%

0 commit comments

Comments
 (0)