[NTG-pdftex] pdftex.ch: pdf_set_rule() redundant output

Hartmut Henkel hartmut_henkel@gmx.de
Thu, 8 May 2003 21:29:24 +0200 (CEST)


This is not a bug at all, IMHO just a little bit of redundant code in
the pdf output: The rule-drawing by pdf_set_rule(), 2nd else clause,
brackets also the "re f" box drawing by "q []0d 0 J" and "S Q", which is
not required, as filling commands ignore dash and linecap info, and
there is also nothing to Stroke. Therefore one can completely omit the
grouping. I have tried it and could not find any difference in
appearence.

The patch would be easy, see below.

Greetings Hartmut


--- pdftex.ch.orig	Thu Mar 27 22:10:26 2003
+++ pdftex.ch	Wed May  7 23:16:10 2003
@@ -1675,31 +1675,34 @@
 begin
     pdf_end_text;
     pdf_set_origin;
-    pdf_print_ln("q");
-    pdf_print_ln("[]0 d");
-    pdf_print_ln("0 J");
     if h <= one_bp then begin
+        pdf_print_ln("q");
+        pdf_print_ln("[]0 d");
+        pdf_print_ln("0 J");
         pdf_print_bp(h); pdf_print_ln(" w");
         pdf_print("0 "); pdf_print_bp((h + 1)/2); pdf_print_ln(" m");
         pdf_print_bp(w); pdf_print(" "); pdf_print_bp((h + 1)/2);
         pdf_print_ln(" l");
+        pdf_print_ln("S");
+        pdf_print_ln("Q");
     end
     else if w <= one_bp then begin
+        pdf_print_ln("q");
+        pdf_print_ln("[]0 d");
+        pdf_print_ln("0 J");
         pdf_print_bp(w); pdf_print_ln(" w");
         pdf_print_bp((w + 1)/2); pdf_print_ln(" 0 m");
         pdf_print_bp((w + 1)/2); pdf_print(" "); pdf_print_bp(h);
         pdf_print_ln(" l");
+        pdf_print_ln("S");
+        pdf_print_ln("Q");
     end
     else begin
-        pdf_print_ln("0 j");
-        pdf_print_ln("0 w");
         pdf_print_bp(pdf_x(x)); pdf_out(" ");
         pdf_print_bp(pdf_y(y)); pdf_out(" ");
         pdf_print_bp(w); pdf_out(" ");
         pdf_print_bp(h); pdf_print_ln(" re f");
     end;
-    pdf_print_ln("S");
-    pdf_print_ln("Q");
 end;


------------------------------------------------------------------------
Dr.-Ing. Hartmut Henkel
Oftersheim, Germany
E-Mail: hartmut_henkel@gmx.de
http://www.circuitwizard.de
------------------------------------------------------------------------