Skip to content

Commit 063bc18

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 799e5df commit 063bc18

File tree

1 file changed

+16
-87
lines changed

1 file changed

+16
-87
lines changed

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)