texlive[49956] Build/source/texk/web2c/eptexdir: pdfsavepos (ptex and

commits+hironobu at tug.org commits+hironobu at tug.org
Wed Feb 6 11:59:29 CET 2019


Revision: 49956
          http://tug.org/svn/texlive?view=revision&revision=49956
Author:   hironobu
Date:     2019-02-06 11:59:29 +0100 (Wed, 06 Feb 2019)
Log Message:
-----------
pdfsavepos (ptex and friends 2 of 5)

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/eptexdir/ChangeLog
    trunk/Build/source/texk/web2c/eptexdir/eptex.ech
    trunk/Build/source/texk/web2c/eptexdir/eptex_version.h
    trunk/Build/source/texk/web2c/eptexdir/pdfutils.ch

Added Paths:
-----------
    trunk/Build/source/texk/web2c/eptexdir/tests/pdfsavepos.tex

Modified: trunk/Build/source/texk/web2c/eptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/ChangeLog	2019-02-06 10:58:23 UTC (rev 49955)
+++ trunk/Build/source/texk/web2c/eptexdir/ChangeLog	2019-02-06 10:59:29 UTC (rev 49956)
@@ -1,3 +1,11 @@
+2019-01-31  Hironori Kitagawa  <h_kitagawa2001 at 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 at gmail.com>
 
 	* eptex.defines: Add dumpkanji and undumpkanji.

Modified: trunk/Build/source/texk/web2c/eptexdir/eptex.ech
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/eptex.ech	2019-02-06 10:58:23 UTC (rev 49955)
+++ trunk/Build/source/texk/web2c/eptexdir/eptex.ech	2019-02-06 10:59:29 UTC (rev 49956)
@@ -26,8 +26,8 @@
 @y
 @d eTeX_version_string=='-2.6' {current \eTeX\ version}
 @#
- at d epTeX_version_string=='-180901'
- at d epTeX_version_number==180901
+ at d epTeX_version_string=='-190131'
+ at d epTeX_version_number==190131
 @z
 
 @x e-pTeX: banner

Modified: trunk/Build/source/texk/web2c/eptexdir/eptex_version.h
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/eptex_version.h	2019-02-06 10:58:23 UTC (rev 49955)
+++ trunk/Build/source/texk/web2c/eptexdir/eptex_version.h	2019-02-06 10:59:29 UTC (rev 49956)
@@ -1 +1 @@
-#define EPTEX_VERSION "180901"
+#define EPTEX_VERSION "190131"

Modified: trunk/Build/source/texk/web2c/eptexdir/pdfutils.ch
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/pdfutils.ch	2019-02-06 10:58:23 UTC (rev 49955)
+++ trunk/Build/source/texk/web2c/eptexdir/pdfutils.ch	2019-02-06 10:59:29 UTC (rev 49956)
@@ -1406,8 +1406,8 @@
 @ 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,12 +1424,7 @@
   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
 
@@ -1436,24 +1431,18 @@
 @ @<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.
@@ -1460,21 +1449,21 @@
 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,7 +1484,7 @@
    (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;
@@ -1502,9 +1491,6 @@
   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;
 

Added: trunk/Build/source/texk/web2c/eptexdir/tests/pdfsavepos.tex
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/tests/pdfsavepos.tex	                        (rev 0)
+++ trunk/Build/source/texk/web2c/eptexdir/tests/pdfsavepos.tex	2019-02-06 10:59:29 UTC (rev 49956)
@@ -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


Property changes on: trunk/Build/source/texk/web2c/eptexdir/tests/pdfsavepos.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property


More information about the tex-live-commits mailing list