diff options
author | Hironobu Yamashita <h.y.acetaminophen@gmail.com> | 2019-02-06 10:59:29 +0000 |
---|---|---|
committer | Hironobu Yamashita <h.y.acetaminophen@gmail.com> | 2019-02-06 10:59:29 +0000 |
commit | b59508c74f4961c1fa83ac4d2906c98e40bd2650 (patch) | |
tree | f279492062b0c89fd0ff70e03bb1c7dcbe4448c4 | |
parent | 174b83580efb7953436f4ab9cfbebddc19936217 (diff) |
pdfsavepos (ptex and friends 2 of 5)
git-svn-id: svn://tug.org/texlive/trunk@49956 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/web2c/eptexdir/ChangeLog | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/eptexdir/eptex.ech | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/eptexdir/eptex_version.h | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/eptexdir/pdfutils.ch | 46 | ||||
-rw-r--r-- | Build/source/texk/web2c/eptexdir/tests/pdfsavepos.tex | 12 |
5 files changed, 39 insertions, 33 deletions
diff --git a/Build/source/texk/web2c/eptexdir/ChangeLog b/Build/source/texk/web2c/eptexdir/ChangeLog index b1ad6f6545b..a88c403b096 100644 --- a/Build/source/texk/web2c/eptexdir/ChangeLog +++ b/Build/source/texk/web2c/eptexdir/ChangeLog @@ -1,3 +1,11 @@ +2019-01-31 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp> + + * pdfutils.ch: Improve \pdfsavepos when papersize special + at the middle of shipout procedure is involved. + Pointed out by N. Abe. + https://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=2564 + * tests/pdfsavepos.tex: Added. + 2019-01-23 Hironobu Yamashita <h.y.acetaminophen@gmail.com> * eptex.defines: Add dumpkanji and undumpkanji. diff --git a/Build/source/texk/web2c/eptexdir/eptex.ech b/Build/source/texk/web2c/eptexdir/eptex.ech index 057904b52cb..5cc86a0093d 100644 --- a/Build/source/texk/web2c/eptexdir/eptex.ech +++ b/Build/source/texk/web2c/eptexdir/eptex.ech @@ -26,8 +26,8 @@ @y @d eTeX_version_string=='-2.6' {current \eTeX\ version} @# -@d epTeX_version_string=='-180901' -@d epTeX_version_number==180901 +@d epTeX_version_string=='-190131' +@d epTeX_version_number==190131 @z @x e-pTeX: banner diff --git a/Build/source/texk/web2c/eptexdir/eptex_version.h b/Build/source/texk/web2c/eptexdir/eptex_version.h index 28bcc2bf34e..cd40e324dec 100644 --- a/Build/source/texk/web2c/eptexdir/eptex_version.h +++ b/Build/source/texk/web2c/eptexdir/eptex_version.h @@ -1 +1 @@ -#define EPTEX_VERSION "180901" +#define EPTEX_VERSION "190131" diff --git a/Build/source/texk/web2c/eptexdir/pdfutils.ch b/Build/source/texk/web2c/eptexdir/pdfutils.ch index 92c41b2e1ee..a805b730a9d 100644 --- a/Build/source/texk/web2c/eptexdir/pdfutils.ch +++ b/Build/source/texk/web2c/eptexdir/pdfutils.ch @@ -1406,8 +1406,8 @@ end; @ Next, we implement \.{\\pdfsavepos} and related primitives. @<Glob...@>= -@!cur_page_width: scaled; {width of page being shipped} -@!cur_page_height: scaled; {height of page being shipped} +@!cur_page_width: scaled; {"physical" width of page being shipped} +@!cur_page_height: scaled; {"physical" height of page being shipped} @!pdf_last_x_pos: integer; @!pdf_last_y_pos: integer; @@ -1424,57 +1424,46 @@ begin dir_dtou: begin pdf_last_x_pos := cur_v; pdf_last_y_pos := -cur_h; end; endcases; pdf_last_x_pos := pdf_last_x_pos + 4736286; - case dvi_dir of - dir_tate,dir_dtou: - pdf_last_y_pos := cur_page_height - pdf_last_y_pos - 4736286; - dir_yoko: - pdf_last_y_pos := cur_page_height - pdf_last_y_pos - 4736286; - endcases; + pdf_last_y_pos := cur_page_height - pdf_last_y_pos - 4736286; {4736286 = 1in, the funny DVI origin offset} end @ @<Calculate DVI page dimensions and margins@>= if pdf_page_height <> 0 then cur_page_height := pdf_page_height - else if (type(p)=dir_node) then begin - if (box_dir(list_ptr(p))=dir_tate)or(box_dir(list_ptr(p))=dir_dtou) then - cur_page_height := width(p) + 2*v_offset + 2*4736286 - else - cur_page_height := height(p) + depth(p) + 2*v_offset + 2*4736286; - end + else if (box_dir(p)=dir_tate)or(box_dir(p)=dir_dtou) then + cur_page_height := width(p) + 2*v_offset + 2*4736286 else cur_page_height := height(p) + depth(p) + 2*v_offset + 2*4736286; + {4736286 = 1in, the funny DVI origin offset} if pdf_page_width <> 0 then cur_page_width := pdf_page_width - else if (type(p)=dir_node) then begin - if (box_dir(list_ptr(p))=dir_tate)or(box_dir(list_ptr(p))=dir_dtou) then - cur_page_width := height(p) + depth(p) + 2*h_offset + 2*4736286 - else - cur_page_width := width(p) + 2*h_offset + 2*4736286; - end + else if (box_dir(p)=dir_tate)or(box_dir(p)=dir_dtou) then + cur_page_width := height(p) + depth(p) + 2*h_offset + 2*4736286 else - cur_page_width := width(p) + 2*h_offset + 2*4736286; + cur_page_width := width(p) + 2*h_offset + 2*4736286 + {4736286 = 1in, the funny DVI origin offset} @ Of course \epTeX\ can produce a \.{DVI} file only, not a PDF file. A \.{DVI} file does not have the information of the page height, which is needed to implement \.{\\pdflastypos} correctly. To keep the information of the page height, I (H.~Kitagawa) -adopted \.{\\pdfpageheight} primitive from pdf\TeX. +adopted \.{\\pdfpageheight} primitive from pdf\TeX. -In \pTeX (and \hbox{\epTeX}), the papersize special +In \pTeX (and \hbox{\epTeX}), the papersize special \.{\\special\{papersize=\<width>,\<height>\}} is commonly used -for specifying page width/height. +for specifying page width/height. If \.{\\readpapersizespecial} is greater than~0, the papersize special also changes the value of \.{\\pdfpagewidth} and \.{\\pdfpageheight}. This process is done in the following routine. {\def\<#1>{\langle\hbox{#1\/}\rangle} -In present implementation, the papersize special $\<special>$, +In present implementation, the papersize special $\<special>$, which can be interpreted by this routine, is defined as follows. $$\eqalign{% \<special> &\longrightarrow \.{papersize=}\<length>\.{,}\<length>\cr - \<length> &\longrightarrow \<decimal> + \<length> &\longrightarrow \<decimal> \<optional~\.{true}>\<physical unit>\cr \<decimal> &\longrightarrow \.{.} \mid \<digit>\<decimal> \mid \<decimal>\<digit>\cr @@ -1495,16 +1484,13 @@ ifps(10) @, (sop(k+9)<>'=') then goto done; k:=k+10; @<Read dimensions in the argument in the papersize special@>; -ifps(1) @, sop(k)=',' then begin +ifps(1) @, sop(k)=',' then begin incr(k); cw:=s; @<Read dimensions in the argument in the papersize special@>; if pool_ptr>k then goto done; geq_word_define(dimen_base+pdf_page_width_code,cw); geq_word_define(dimen_base+pdf_page_height_code,s);@| cur_page_height := s; cur_page_width := cw; - if (dvi_dir=dir_tate)or(dvi_dir=dir_dtou) then begin - t:=cur_page_height; cur_page_height:=cur_page_width; - cur_page_width:=t; end; end; end; diff --git a/Build/source/texk/web2c/eptexdir/tests/pdfsavepos.tex b/Build/source/texk/web2c/eptexdir/tests/pdfsavepos.tex new file mode 100644 index 00000000000..7bde48aa574 --- /dev/null +++ b/Build/source/texk/web2c/eptexdir/tests/pdfsavepos.tex @@ -0,0 +1,12 @@ +\documentclass[dvipdfmx]{tarticle} +\setlength{\pdfpagewidth}{\paperwidth} +\setlength{\pdfpageheight}{\paperheight} +% 以下二行をコメントアウトしたりしなかったりして試してみる. +\special{papersize=\the\paperwidth,\the\paperheight}% (a) +\AtBeginDvi{\special{papersize=\the\paperwidth, \the\paperheight}}% (b) +\begin{document} +A\pdfsavepos +\newpage +\message{pdflatexpos = \the\dimexpr\pdflastxpos sp, pdflastypos = \the\dimexpr\pdflastypos sp, + pdfpagewidth = \the\pdfpagewidth, pdfpageheight = \the\pdfpageheight} +\end{document}
\ No newline at end of file |