[gs-commits] rev 10903 - branches/gs_2_colors/Resource/Init

robin at ghostscript.com robin at ghostscript.com
Tue Mar 9 22:34:08 UTC 2010


Author: robin
Date: 2010-03-09 22:34:08 +0000 (Tue, 09 Mar 2010)
New Revision: 10903

Modified:
   branches/gs_2_colors/Resource/Init/pdf_ops.ps
Log:
Type 3 font glyphs that use the d0 operator are free to set their own
color as they run. They assume however that the current color is set in
the graphics state when they are run.

Unfortunately, this doesn't map nicely into our "2 color" world, so we need
to ensure that Type3 d0 glyphs are always called with the current color set
both as stroke and fill color. The easiest way to do this is to set both
stroke and fill colors to the same thing before calling the show operator,
and that is what this review does.

This is a bit of a shame, because we'd really like to be able to have separate
colors when calling text stuff for pdfwrites sake. Will discuss this more
with Ken tomorrow to see if we can find a better solution.

This gets us down to just 5 differences, in 2 files.



Modified: branches/gs_2_colors/Resource/Init/pdf_ops.ps
===================================================================
--- branches/gs_2_colors/Resource/Init/pdf_ops.ps	2010-03-09 22:22:29 UTC (rev 10902)
+++ branches/gs_2_colors/Resource/Init/pdf_ops.ps	2010-03-09 22:34:08 UTC (rev 10903)
@@ -319,6 +319,20 @@
   FillOverprint setoverprint
   FillConstantAlpha SoftMask .settransparencyparams
 } def
+/setfillstatetext {
+  FillColor FillColorSpace setgcolor setfillblend
+  .swapcolors
+  FillColor FillColorSpace setgcolor setfillblend
+  .swapcolors
+} def
+/setstrokestatetext {
+  StrokeColor StrokeColorSpace setgcolor StrokeOverprint setoverprint
+  StrokeConstantAlpha SoftMask .settransparencyparams
+  .swapcolors
+  StrokeColor StrokeColorSpace setgcolor StrokeOverprint setoverprint
+  StrokeConstantAlpha SoftMask .settransparencyparams
+  .swapcolors
+} def
 /setfillstate {
   FillColor FillColorSpace setgcolor setfillblend
 } def
@@ -747,9 +761,9 @@
 
 /pdfwrite_textrenderingprocs [
 	% Tr 0 - Fill
-	{ setfillstate show } bind
+	{ setfillstatetext show } bind
 	% Tr 1 - Stroke
-	{ setstrokestate
+	{ setstrokestatetext
         % Need to set the stroke width to a value which gives the correct
         % width under pdfwrite. Pdfwrite uses (in text mode) an identity
         % CTM, so we need to calculate the stroke width which would result
@@ -766,8 +780,8 @@
         .swapcolors show .swapcolors } bind
 	% Tr 2 - Fill then Stroke
 	{ gsave 0 .settextrenderingmode 
-	  setfillstate dup show currentpoint 3 -1 roll 
-	  grestore gsave setstrokestate
+	  setfillstatetext dup show currentpoint 3 -1 roll 
+	  grestore gsave setstrokestatetext
         false charpath 
         % We need to make sure the matrix used for the stroke
         % and therefore stroke width does not include the 
@@ -779,18 +793,18 @@
 	  grestore moveto
 	} bind
 	% Tr 3 - Neither fill nor stroke
-	{ setfillstate show } bind
+	{ setfillstatetext show } bind
 	% Tr 4 - Fill, add to clip
 	{ gsave 0 .settextrenderingmode 
-	  setfillstate dup show grestore true charpath } bind
+	  setfillstatetext dup show grestore true charpath } bind
 	% Tr 5 - Stroke, add to clip
 	{ gsave 1 .settextrenderingmode 
-	  setstrokestate dup .swapcolors show .swapcolors grestore
+	  setstrokestatetext dup .swapcolors show .swapcolors grestore
 	  true charpath } bind
 	% Tr 6 - Fill, stroke, add to clip
 	{ gsave 0 .settextrenderingmode 
-	  setfillstate dup show grestore gsave dup 
-	  setstrokestate false charpath 
+	  setfillstatetext dup show grestore gsave dup 
+	  setstrokestatetext false charpath 
         % We need to make sure the matrix used for the stroke
         % and therefore stroke width does not include the 
         % Text Matrix Tm.
@@ -811,7 +825,7 @@
 	}
 	{
 		TextRenderingMode 0 eq {
-	        { setfillstate show }
+	        { setfillstatetext show }
 	      } {
 	        TextRenderingMode 3 eq {
 	            	% Some PDF files execute 'tm' with a singular matrix,
@@ -828,7 +842,7 @@
 	              dup dup 1 get 0 eq { 3 }{ 2 } ifelse 1 put
 	            } if
 	            setmatrix
-	            2 index setfillstate show % Tr was set to graphic state.
+	            2 index setfillstatetext show % Tr was set to graphic state.
 	            setmatrix 
 		    % now set the currentpoint using the original matrix
 	            gsave
@@ -847,7 +861,7 @@
        % Tr was set to graphic state.
        { FontMatrixNonHV {
            {
-             setfillstate
+             setfillstatetext
              [ TextSpacing WordSpacing 3 index
                {					    % str [... weach wword c undef|ythis xthis|undef
 		 exch % will be removed, unless FontMatrix.xx/yy == 0 (FontMatrixNonHV already true)
@@ -864,10 +878,10 @@
            }
          } {
            WordSpacing 0 eq
-            { { setfillstate TextSpacing 0 Vexch 3 -1 roll ashow } }
+            { { setfillstatetext TextSpacing 0 Vexch 3 -1 roll ashow } }
 	    { TextSpacing 0 eq
-              { { setfillstate WordSpacing 0 Vexch 32 4 -1 roll widthshow } }
-              { { setfillstate WordSpacing 0 Vexch 32
+              { { setfillstatetext WordSpacing 0 Vexch 32 4 -1 roll widthshow } }
+              { { setfillstatetext WordSpacing 0 Vexch 32
                    TextSpacing 0 Vexch 6 -1 roll awidthshow } }
 	      ifelse
 	    }
@@ -937,13 +951,13 @@
   } ifelse
 } bdef
 
-/tf { setfillstate currentpoint fill moveto } bdef
+/tf { setfillstatetext currentpoint fill moveto } bdef
 /tn { currentpoint newpath moveto } bdef % Obsolete, never used.
 % For stroking characters, temporarily restore the graphics CTM so that
 % the line width will be transformed properly.
 /Tmatrix matrix def
 /tS
- { setstrokestate
+ { setstrokestatetext
    currentpoint //Tmatrix currentmatrix TextSaveMatrix setmatrix .swapcolors stroke .swapcolors
    setmatrix moveto
  } bdef



More information about the gs-commits mailing list