[gs-cvs] rev 7591 - trunk/gs/src

leonardo at ghostscript.com leonardo at ghostscript.com
Tue Jan 9 13:15:02 PST 2007


Author: leonardo
Date: 2007-01-09 13:15:01 -0800 (Tue, 09 Jan 2007)
New Revision: 7591

Modified:
   trunk/gs/src/gxhintn1.c
   trunk/gs/src/zchar1.c
Log:
Type 1 hinter : Implementing a contour sign normalization, part 5.

DETAILS :

Removes bugs from the last patch.
It finaly closes Bug 688947  
"Ghostscript renders font incorrectly (letter 'o' filled in)",
but CET 16-01.PS still has problems.

1. 'e2' was wrong - Debugged with a.pdf .
2. (optimization) Return if no nesting contours.
   nesting_sum works for that.
3. Removed the check "this->subglyph_count <= 1",
   which was entirely wrong.   
4. In zchar1.c restoring Raph's trick about 
    using even-odd filling rule in the CPSI compatible mode.
   It was unintentionally removed by the last patch.
   No, we don't want it to live prmanently,
   but now it's not the right time for removing it.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/src/gxhintn1.c
===================================================================
--- trunk/gs/src/gxhintn1.c	2007-01-09 18:40:39 UTC (rev 7590)
+++ trunk/gs/src/gxhintn1.c	2007-01-09 21:15:01 UTC (rev 7591)
@@ -43,7 +43,7 @@
 {
     int b = this->contour[c];
     int e = this->contour[c + 1] - 1; /* Skip 'close'. */
-    int e2 = (b + e) / 2;
+    int e2 = (b + e + 1) / 2;
     int i;
     t1_pole p;
 
@@ -82,6 +82,9 @@
     if (k <= 1)
 	return bar_winding_angle(x0, y0, x3, y3);
     else {
+	/* Assuming the trapezoid is not self-intersecting and 
+	   the curve is inside the trapezoid 
+	   due to Type 1 constraints. */
 	double a0 = bar_winding_angle(x0, y0, x1, y1);
 	double a1 = bar_winding_angle(x1, y1, x2, y2);
 	double a2 = bar_winding_angle(x2, y2, x3, y3);
@@ -524,18 +527,20 @@
 private void t1_hinter__fix_subglyph_contour_signs(t1_hinter * this, int first_contour, int last_contour)
 {
     double area[MAX_NORMALIZING_CONTOURS];
-    int i, j, k = 0, l, m;
+    int i, j, k, l, m;
     double a = 0;
     byte inside[MAX_NORMALIZING_CONTOURS][MAX_NORMALIZING_CONTOURS];
     int nesting[MAX_NORMALIZING_CONTOURS];
     gs_rect bbox[MAX_NORMALIZING_CONTOURS];
     byte isolated[MAX_NORMALIZING_CONTOURS];
+    int nesting_sum;
 
     if (first_contour == last_contour) {
 	/* Don't fix a single contour. */
 	return;
     }
     /* Compute contour bboxes : */
+    k = 0;
     for(i =  first_contour; i <= last_contour; i++) {
 	int b = this->contour[i];
 	int e = this->contour[i + 1] - 1;
@@ -656,15 +661,29 @@
 	}
     } while(m);
     /* Compute nesting numbers : */
+    nesting_sum = 0;
     memset(nesting, 0, sizeof(nesting));
     for (i = 0; i < k; i++) {
 	for (j = 0; j < k; j++) {
 	    if (inside[i][j]) {
+		nesting[i]++;
+		nesting_sum++;
+	    }
+	}
+    }
+    if (nesting_sum == 0) {
+	/* No nesting contours - don't fix. 
+	   We want to save time from computing contour intersections. */
+	return;
+    }
+    /* Check contour intersections : */
+    for (i = 0; i < k; i++) {
+	for (j = 0; j < k; j++) {
+	    if (inside[i][j]) {
 		if (t1_hinter__contour_intersection(this, isolated[i], isolated[j])) {
 		    /* Contours intersect - don't fix. */
 		    return;
 		}
-		nesting[i]++;
 	    }
 	}
     }
@@ -681,10 +700,6 @@
 {
     int i;
 
-    if (this->subglyph_count <= 1)  {
-	/* Nothing to adjust. */
-	return;
-    }
     if (this->subglyph_count >= 3) {
 	/* 3 or more subglyphs.
 	   We didn't meet so complex characters with wrong contours signs. 

Modified: trunk/gs/src/zchar1.c
===================================================================
--- trunk/gs/src/zchar1.c	2007-01-09 18:40:39 UTC (rev 7590)
+++ trunk/gs/src/zchar1.c	2007-01-09 21:15:01 UTC (rev 7591)
@@ -66,7 +66,8 @@
 /* *********************************************************************
  * Make this dynamic via a global (somewhat better than a COMPILE option
  ***********************************************************************/
-#define GS_CHAR_FILL gs_fill
+extern bool CPSI_mode;
+#define GS_CHAR_FILL (CPSI_mode ? gs_eofill : gs_fill)
 
 /* ---------------- Utilities ---------------- */
 



More information about the gs-cvs mailing list