r767 - in branches/stable: doc/manual source/src/texk/web2c/pdftexdir tests tests/05-mediabox

karl at freefriends.org karl at freefriends.org
Sun Feb 19 00:49:56 CET 2017


Author: karl
Date: 2017-02-18 23:49:54 +0000 (Sat, 18 Feb 2017)
New Revision: 767

Added:
   branches/stable/tests/05-mediabox/
   branches/stable/tests/05-mediabox/Makefile
   branches/stable/tests/05-mediabox/test-normal.tex
   branches/stable/tests/05-mediabox/test-omit-mediabox.tex
Modified:
   branches/stable/doc/manual/ChangeLog
   branches/stable/doc/manual/Makefile
   branches/stable/doc/manual/pdftex-t.tex
   branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog
   branches/stable/source/src/texk/web2c/pdftexdir/NEWS
   branches/stable/source/src/texk/web2c/pdftexdir/pdftex.web
Log:
omit built-in /MediaBox if specified in \pdfpageattr

Modified: branches/stable/doc/manual/ChangeLog
===================================================================
--- branches/stable/doc/manual/ChangeLog	2017-02-16 16:38:15 UTC (rev 766)
+++ branches/stable/doc/manual/ChangeLog	2017-02-18 23:49:54 UTC (rev 767)
@@ -1,3 +1,15 @@
+2017-02-18  Karl Berry  <karl at freefriends.org>
+
+	* pdftex-t.tex (\pdfpageattr): document new behavior of
+	omitting our /MediaBox if "/MediaBox" is present in this token list.
+
+2017-02-01  Karl Berry  <karl at freefriends.org>
+
+	* pdftex-t.tex (Map files): clarify that decimal 4 = bit position 3
+	= symbolic, for embedded fonts, and specify the 0x22 default for
+	non-embedded fonts.
+	Report from Gernot Hassenpflug to pdftex, 1 Dec 2016 14:01:30.
+
 2016-07-05  Karl Berry  <karl at freefriends.org>
 
 	* pdftex-t.tex (\pdfcatalog): show "openaction <action spec>"

Modified: branches/stable/doc/manual/Makefile
===================================================================
--- branches/stable/doc/manual/Makefile	2017-02-16 16:38:15 UTC (rev 766)
+++ branches/stable/doc/manual/Makefile	2017-02-18 23:49:54 UTC (rev 767)
@@ -16,7 +16,7 @@
 
 common_deps = pdftex-t.tex pdftex-w.txt pdftex-help.txt pdftex-syntax.tex
 pdftex-a.pdf a:	$(common_deps)
-	$(context) --result=$@ $<
+	$(context) --mode=a4 --result=$@ $<
 
 pdftex-l.pdf l:	$(common_deps)
 	$(context) --mode=letter --result=$@ $<

Modified: branches/stable/doc/manual/pdftex-t.tex
===================================================================
--- branches/stable/doc/manual/pdftex-t.tex	2017-02-16 16:38:15 UTC (rev 766)
+++ branches/stable/doc/manual/pdftex-t.tex	2017-02-18 23:49:54 UTC (rev 767)
@@ -785,7 +785,7 @@
 for instance full screen or clipped. A closer look at the page object no.~2
 (\typ{/Type /Page}) shows that a mediabox (\typ{/MediaBox}) is part of the
 page description. A mediabox acts like the (high-resolution) bounding box
-in a \POSTSCRIPT\ file. \PDFTEX\ users can add dictionary stuff to page
+in a \POSTSCRIPT\ file. \PDFTEX\ users can add dictionary entries to page
 objects with the \type{\pdfpageattr} primitive.
 
 Although in most cases macro packages will shield users from these
@@ -1580,12 +1580,14 @@
 
 \stopnarrower
 
-If the {\em fontflags} field is not given, \PDFTEX\ treats it as being~4,
-a symbolic font. If you do not know the correct value, it is best not
-to specify it at all, as specifying a bad value of font flags may cause
-trouble in viewers. On the other hand this option is not absolutely
-useless because it provides backward compatibility with older map files
-(see the {\em fontfile} description below).
+If the {\em fontflags} field is not given, and the font is embedded,
+\PDFTEX\ treats it as being~4 (decimal, that is, bit position 3 is set),
+a symbolic font. For non-embedded fonts, the default value is
+\type{0x22}, a non-symbolic serif font. If you do not know the correct
+value, it is best not to specify it at all, as specifying a bad value of
+font flags may cause trouble in viewers. On the other hand this option
+is not absolutely useless because it provides backward compatibility
+with older map files (see the {\em fontfile} description below).
 
 \stopdescription
 
@@ -3248,7 +3250,7 @@
 \type{/Rotate}, the number of degrees (in multiples of 90) the page
 should be rotated clockwise when it is displayed or printed.
 
-% /MediaBox is not a good example, since will never take an effect
+% /MediaBox is not a good example, since will never take effect
 
 \starttyping
 \pdfpagesattr
@@ -3261,9 +3263,15 @@
 
 This is similar to \type{\pdfpagesattr}, but has priority over it.
 It can be used to override any attribute given by \type{\pdfpagesattr}
-for individual pages. The token list is expanded when \PDFTEX\ ships out
+for an individual page. The token list is expanded when \PDFTEX\ ships out
 a page. The contents are added to the attributes of the current page.
 
+If the \type{\pdfpageattr} value contains the string \type{/MediaBox},
+then \PDFTEX\ omits outputting its own \type{/MediaBox} value (which is
+\type{[0 0 }\Something{\it page\_width} \Something{\it
+page\_height}\type{]}).  (This behaviour was introduced in version
+1.40.18.)
+
 \pdftexprimitive{\Syntax{\Tex{\pdfpageresources} \Whatever{tokens}}}
 \bookmark{\tex{pdfpageresources}}
 

Modified: branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog
===================================================================
--- branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog	2017-02-16 16:38:15 UTC (rev 766)
+++ branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog	2017-02-18 23:49:54 UTC (rev 767)
@@ -1,3 +1,11 @@
+2017-02-18  Heiko Oberdiek  <heiko.oberdiek at googlemail.com>
+
+	* pdftex.web (substr_of_str): move earlier.
+	(Write out page object): if \MediaBox was given in \pdfpageattr,
+	do not output our own.
+	Mail from Michael Altmann to pdftex, 9 Feb 2017 13:19:05.
+	http://tug.org/pipermail/pdftex/2017-February/009097.html
+
 2017-02-16  Karl Berry  <karl at freefriends.org>
 
 	* regex/regex_internal.h (alloca) [!alloca]: do not try

Modified: branches/stable/source/src/texk/web2c/pdftexdir/NEWS
===================================================================
--- branches/stable/source/src/texk/web2c/pdftexdir/NEWS	2017-02-16 16:38:15 UTC (rev 766)
+++ branches/stable/source/src/texk/web2c/pdftexdir/NEWS	2017-02-18 23:49:54 UTC (rev 767)
@@ -1,9 +1,13 @@
+pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017)
 - changes:
   - rename envvar SOURCE_DATE_EPOCH_TEX_PRIMITIVES to FORCE_SOURCE_DATE;
     no changes in functionality.
+  - if the \pdfpageattr token list contains the string "/MediaBox",
+    omitting output of the default /MediaBox.
 
 - bugfixes:
   - \pdflastmatch more reliable when there was no match
+
 ---------------------------------------------------
 pdfTeX 3.14159265-2.6-1.40.17 (TeX Live 2016)  (May 20, 2016)
 - changes:
@@ -28,6 +32,7 @@
 
 - bugfixes:
   - do not crash if font size of a vf >= 2048pt.
+
 ---------------------------------------------------
 pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015)
 - changes:
@@ -37,6 +42,7 @@
 
 - bugfixes:
   - ensure line-ending after a group dict in the output.
+
 ---------------------------------------------------
 pdfTeX 3.14159265-2.6-1.40.15 (TeX Live 2014)
 - changes:

Modified: branches/stable/source/src/texk/web2c/pdftexdir/pdftex.web
===================================================================
--- branches/stable/source/src/texk/web2c/pdftexdir/pdftex.web	2017-02-16 16:38:15 UTC (rev 766)
+++ branches/stable/source/src/texk/web2c/pdftexdir/pdftex.web	2017-02-18 23:49:54 UTC (rev 767)
@@ -1,4 +1,4 @@
-% Copyright 1996-2016 Han Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh,
+% Copyright 1996-2017 Han Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh,
 % <thanh@@pdftex.org>
 
 % This file is part of pdfTeX.
@@ -18813,6 +18813,28 @@
     end;
 end;
 
+@ |substr_of_str| is used in |pdf_ship_out| and |pdf_print_info|.
+ at p function substr_of_str(s, t: str_number):boolean;
+label continue,exit;
+var j, k, kk: pool_pointer; {running indices}
+begin
+    k:=str_start[t];
+    while (k < str_start[t+1] - length(s)) do begin
+        j:=str_start[s];
+        kk:=k;
+        while (j < str_start[s+1]) do begin
+            if str_pool[j] <> str_pool[kk] then
+                goto continue;
+            incr(j);
+            incr(kk);
+        end;
+        substr_of_str:=true;
+        return;
+        continue: incr(k);
+    end;
+    substr_of_str:=false;
+end;
+
 @ |pdf_ship_out| is used instead of |ship_out| to shipout a box to PDF
 output. If |shipping_page| is not set then the output will be a Form object,
 otherwise it will be a Page object.
@@ -18820,6 +18842,8 @@
 @p procedure pdf_ship_out(p: pointer; shipping_page: boolean); {output the box |p|}
 label done, done1;
 var i,j,k:integer; {general purpose accumulators}
+s: pool_pointer; {index into |str_pool|}
+mediabox_given: boolean;
 save_font_list: pointer; {to save |pdf_font_list| during flushing pending forms}
 save_obj_list: pointer; {to save |pdf_obj_list|}
 save_ximage_list: pointer; {to save |pdf_ximage_list|}
@@ -19092,10 +19116,18 @@
 pdf_print_ln("/Type /Page");
 pdf_indirect_ln("Contents", pdf_last_stream);
 pdf_indirect_ln("Resources", pdf_last_resources);
-pdf_print("/MediaBox [0 0 ");
-pdf_print_mag_bp(cur_page_width); pdf_out(" ");
-pdf_print_mag_bp(cur_page_height);
-pdf_print_ln("]");
+mediabox_given:=false;
+if pdf_page_attr <> null then begin
+    s:=tokens_to_string(pdf_page_attr);
+    mediabox_given:=substr_of_str("/MediaBox", s);
+    flush_str(s);
+end;
+if not mediabox_given then begin
+    pdf_print("/MediaBox [0 0 ");
+    pdf_print_mag_bp(cur_page_width); pdf_out(" ");
+    pdf_print_mag_bp(cur_page_height);
+    pdf_print_ln("]");
+end;
 if pdf_page_attr <> null then
     pdf_print_toks_ln(pdf_page_attr);
 @<Generate parent pages object@>;
@@ -19973,28 +20005,7 @@
 |/Producer| and |/Creator| are only set if the token list
 |pdf_info_toks| converted to a string does not contain these key strings.
 
- at p function substr_of_str(s, t: str_number):boolean;
-label continue,exit;
-var j, k, kk: pool_pointer; {running indices}
-begin
-    k:=str_start[t];
-    while (k < str_start[t+1] - length(s)) do begin
-        j:=str_start[s];
-        kk:=k;
-        while (j < str_start[s+1]) do begin
-            if str_pool[j] <> str_pool[kk] then
-                goto continue;
-            incr(j);
-            incr(kk);
-        end;
-        substr_of_str:=true;
-        return;
-        continue: incr(k);
-    end;
-    substr_of_str:=false;
-end;
-
-procedure pdf_print_info; {print info object}
+ at p procedure pdf_print_info; {print info object}
 var s: str_number;
     creator_given, producer_given, creationdate_given, moddate_given, trapped_given: boolean;
 begin

Index: branches/stable/tests/05-mediabox
===================================================================
--- branches/stable/tests/05-mediabox	2017-02-16 16:38:15 UTC (rev 766)
+++ branches/stable/tests/05-mediabox	2017-02-18 23:49:54 UTC (rev 767)

Property changes on: branches/stable/tests/05-mediabox
___________________________________________________________________
Added: svn:ignore
## -0,0 +1 ##
+*.pdf
Added: branches/stable/tests/05-mediabox/Makefile
===================================================================
--- branches/stable/tests/05-mediabox/Makefile	                        (rev 0)
+++ branches/stable/tests/05-mediabox/Makefile	2017-02-18 23:49:54 UTC (rev 767)
@@ -0,0 +1,24 @@
+# $Id$
+# Public domain.
+
+include ../Common.mak
+
+default: test-normal test-omit-mediabox
+
+test-normal:
+	$(prog) test-normal.tex
+	grep -q /MediaBox.*314 test-normal.pdf 
+
+test-omit-mediabox:
+	$(prog) test-omit-mediabox.tex
+	grep -q /MediaBox.*271 test-omit-mediabox.pdf   # should be there
+	! grep -q /MediaBox.*314 test-omit-mediabox.pdf # should not
+
+force:
+
+clean:
+	rm -f *.log *.pdf *.fmt *.aux
+
+fmt:
+	$(prog) \*pdflatex.ini
+	$(prog) \*pdfetex.ini


Property changes on: branches/stable/tests/05-mediabox/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id
\ No newline at end of property
Added: branches/stable/tests/05-mediabox/test-normal.tex
===================================================================
--- branches/stable/tests/05-mediabox/test-normal.tex	                        (rev 0)
+++ branches/stable/tests/05-mediabox/test-normal.tex	2017-02-18 23:49:54 UTC (rev 767)
@@ -0,0 +1,4 @@
+\pdfoutput=1
+\pdfpagewidth=314bp
+\pdfpageheight=315bp
+X.\end


Property changes on: branches/stable/tests/05-mediabox/test-normal.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: branches/stable/tests/05-mediabox/test-omit-mediabox.tex
===================================================================
--- branches/stable/tests/05-mediabox/test-omit-mediabox.tex	                        (rev 0)
+++ branches/stable/tests/05-mediabox/test-omit-mediabox.tex	2017-02-18 23:49:54 UTC (rev 767)
@@ -0,0 +1,5 @@
+\pdfoutput=1 \catcode`\{=1 \catcode`\}=2
+\pdfpagewidth=314bp
+\pdfpageheight=315bp
+\pdfpageattr{/MediaBox [ 0 1 271 272 ]}
+X.\end


Property changes on: branches/stable/tests/05-mediabox/test-omit-mediabox.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property


More information about the pdftex-commits mailing list