[gs-cvs] rev 7526 - in trunk/gs: doc src

leonardo at ghostscript.com leonardo at ghostscript.com
Sun Dec 24 03:46:12 PST 2006


Author: leonardo
Date: 2006-12-24 03:46:11 -0800 (Sun, 24 Dec 2006)
New Revision: 7526

Modified:
   trunk/gs/doc/pscet_status.txt
   trunk/gs/src/gxchar.c
Log:
Fix (font renderer) : Expand the Type 3 character box to negative coordinates.

DETAILS :

setcachedevice, setcachedevice defines a box for clipping a character image.
According to Postscript specification, "If any marks fall outside this
bounding box, the result is unpredictable." (See PLRM3 page 659).

Some CET tests defines a Type 3 characters, which have the bbox
[0 0 1000 1000] and then execute "10 10 1000 1000 rectstroke" for 
painting the character. Some parts of that rectangle fall slightly 
outside the box, but both CPSI and Tek paint them.

When caching a character, the old Ghostscript code expands the character box to
increasing coordinates. It allows to paint charater elements,
which fall slightly outside the box. However the old code doesn't
expand to negative (decreesing) direction, causing an asymmetric behavior.
For example in CET 13-18.PS a Type 3 charater missed its elements
depending on the device initial matrix : with display device
the character doesn't miss elements, but with ppmraw device 
(which has initial matrix with mapping Y upside down)
the character missed a horizontal line, which with 600dpi falls to 
t5he pixel coordinate Y=-1.

This patch provides the box expansion in all 4 directions.
Rather the problem happens mainly with Type 3 fonts
the patch changes the behavior for all font types.

Note : Some characters may occupy a bigger space in the cache,
so the memory map changes.

Note2 : We're not sure why the old code expands the box
in 2 pixels. Likely 1 pixel is a strong expansion, 
and another one compensates an inaccurate rounding.
We don't change it now to minimize raster differences.

EXPECTED DIFFERENCES :

Normal 300 dpi :
"014-09.ps" 
"015-09.ps" 
"017-01.ps" 
"020-01.ps" 
"205-09.ps" 
"220-07.ps" 
"226-01.ps" 
"238-01.ps" 
"260-01.ps" 
"264-01.ps" 
"289-01.ps" 
"297-01.ps" 
"298-09.ps" 
"321-09.ps" 
"Bug687840.pdf" 
"Bug687846.ps" 

Normal 72 dpi :

"012-09.ps" 
"013-09.ps" 
"014-09.ps" 
"015-09.ps" 
"017-01.ps" 
"020-01.ps" 
"093-01.ps" 
"205-09.ps" 
"220-07.ps" 
"226-01.ps" 
"238-01.ps" 
"289-01.ps" 
"297-01.ps" 
"298-09.ps" 
"321-09.ps" 
"KozukaB-ILEmbed.pdf"

pdfwrite 72 dpi : 

"014-09.ps" 
"015-09.ps" 
"017-01.ps" 
"020-01.ps" 
"093-01.ps" 
"205-09.ps" 
"220-07.ps" 
"226-01.ps" 
"238-01.ps" 
"297-01.ps" 
"298-09.ps" 
"321-09.ps" 
"405-01.ps" 
"450-01.ps" 
"456-01.ps" 
"HeiseiMinStd.pdf" 
"KozukaB-ILEmbed.pdf" 

pdfwrite 300 dpi :

"014-09.ps" 
"015-09.ps" 
"017-01.ps" 
"020-01.ps" 
"093-01.ps" 
"205-09.ps" 
"220-07.ps" 
"226-01.ps" 
"238-01.ps" 
"260-01.ps" 
"264-01.ps" 
"297-01.ps" 
"298-09.ps" 
"321-09.ps" 
"405-01.ps" 
"415-01.ps" 
"450-01.ps" 
"456-01.ps" 
"483-05-fixed.ps" 
"Bug687489.ps" 
"Bug687840.pdf" 
"Bug687846.ps" 


Modified: trunk/gs/doc/pscet_status.txt
===================================================================
--- trunk/gs/doc/pscet_status.txt	2006-12-24 08:31:52 UTC (rev 7525)
+++ trunk/gs/doc/pscet_status.txt	2006-12-24 11:46:11 UTC (rev 7526)
@@ -3015,8 +3015,7 @@
 		square in item 13 in the column labeled 'MUCH'. - ADC
                 assign Alex (initial analysis).
 
-13-18-1  DIFF	The top line in several squares are missing. - ADC
-                assign: Igor.
+13-18-1  OK
 
 13-18-10  OK	Minor differences in positions and character shapes - ADC
 
@@ -3028,28 +3027,21 @@
 		position of both square in item 25 in she same column.a  GS shows
 		a square in item 13 in the column labeled 'MUCH'. - ADC
 
-13-18-2  DIFF	The top line in several squares are missing, etc. - ADC
-                assign: Igor.
+13-18-2  OK
 
-13-18-3  DIFF	The top line in several squares are missing, etc. - ADC
-                assign: Igor.
+13-18-3  OK
 
-13-18-4  DIFF	The top line in several squares are missing, etc. - ADC
-                assign: Igor.
+13-18-4  OK
 
 13-18-5  OK	
 
-13-18-6  DIFF	The top line in several squares are missing, etc. - ADC
-                assign: Igor.
+13-18-6  OK
 
-13-18-7  DIFF	The top line in several squares are missing, etc. - ADC
-                assign: Igor.
+13-18-7  OK
 
-13-18-8  DIFF	The top line in several squares are missing, etc. - ADC
-                assign: Igor.
+13-18-8  OK
 
-13-18-9  DIFF	The top line in several squares are missing, etc. - ADC
-                assign: Igor.
+13-18-9  OK
 
 13-19-1  AOK	GS has a better stroke adjustment. not impotant. Analyzed by Igor.
 

Modified: trunk/gs/src/gxchar.c
===================================================================
--- trunk/gs/src/gxchar.c	2006-12-24 08:31:52 UTC (rev 7525)
+++ trunk/gs/src/gxchar.c	2006-12-24 11:46:11 UTC (rev 7526)
@@ -566,8 +566,8 @@
 	    cdim.y > max_cdim[log2_scale.y]
 	    )
 	    return 0;		/* much too big */
-	iwidth = ((ushort) fixed2int_var(cdim.x) + 2) << log2_scale.x;
-	iheight = ((ushort) fixed2int_var(cdim.y) + 2) << log2_scale.y;
+	iwidth = ((ushort) fixed2int_var(cdim.x) + 3) << log2_scale.x;
+	iheight = ((ushort) fixed2int_var(cdim.y) + 3) << log2_scale.y;
 	if_debug3('k', "[k]iwidth=%u iheight=%u dev_cache %s\n",
 		  (uint) iwidth, (uint) iheight,
 		  (penum->dev_cache == 0 ? "not set" : "set"));
@@ -617,8 +617,8 @@
 	}
 	/* The mins handle transposed coordinate systems.... */
 	/* Truncate the offsets to avoid artifacts later. */
-	cc->offset.x = fixed_ceiling(-cll.x);
-	cc->offset.y = fixed_ceiling(-cll.y);
+	cc->offset.x = fixed_ceiling(-cll.x) + fixed_1;
+	cc->offset.y = fixed_ceiling(-cll.y) + fixed_1;
 	if_debug4('k', "[k]width=%u, height=%u, offset=[%g %g]\n",
 		  (uint) iwidth, (uint) iheight,
 		  fixed2float(cc->offset.x),



More information about the gs-cvs mailing list