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

leonardo at ghostscript.com leonardo at ghostscript.com
Wed Aug 29 00:09:02 PDT 2007


Author: leonardo
Date: 2007-08-29 00:09:01 -0700 (Wed, 29 Aug 2007)
New Revision: 8213

Modified:
   trunk/gs/src/zchar1.c
   trunk/gs/src/zfcid0.c
Log:
Fix (font rendering) : CIDFontType 9 missed PaintType.

DETAILS :

Bug 687970 "PaintType and StrokeWidth ignored with CIDFonts".

To make a decision about filling or stroking,
the old code uses PaintType of the current font,
However with CIDFont 9 it is a Type 1 subsidiary,
which has no PaintType.

The patch implements the 'or' logic for the PaintType of the root font
and the PaintType of the current font. We believe it should 
correctly handle cases when PaintType 2 is set to
a root font or to its descendent. However we have not enough 
practical test cases to test all varuiants.

Particularly, we would like to test a Type 0 font with
2 descendents, each of which is CIDFontType 9
and they have didfferent PaintType.
In such case this patch may need a further improvement.

The desision about filling or stroking a character is done in type1exec_bbox
and in nobbox_finish. The patch also passes a pointer to gs_text_enum_t instance 
to type1exec_bbox to provide the data for the decision.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/src/zchar1.c
===================================================================
--- trunk/gs/src/zchar1.c	2007-08-28 16:18:27 UTC (rev 8212)
+++ trunk/gs/src/zchar1.c	2007-08-29 07:09:01 UTC (rev 8213)
@@ -157,7 +157,7 @@
 private int op_type1_cleanup(i_ctx_t *);
 private void op_type1_free(i_ctx_t *);
 private int bbox_getsbw_continue(i_ctx_t *);
-private int type1exec_bbox(i_ctx_t *, gs_type1exec_state *, gs_font *, op_proc_t *exec_cont);
+private int type1exec_bbox(i_ctx_t *, gs_text_enum_t *, gs_type1exec_state *, gs_font *, op_proc_t *exec_cont);
 private int bbox_finish_fill(i_ctx_t *);
 private int bbox_finish_stroke(i_ctx_t *);
 private int bbox_fill(i_ctx_t *);
@@ -247,7 +247,7 @@
 	op_proc_t exec_cont = 0;
 
 	cxs.char_bbox = pfont1->FontBBox;
-	code = type1exec_bbox(i_ctx_p, &cxs, pfont, &exec_cont);
+	code = type1exec_bbox(i_ctx_p, penum, &cxs, pfont, &exec_cont);
 	if (code >= 0 && exec_cont != 0)
 	    code = (*exec_cont)(i_ctx_p);
 	return code;
@@ -326,13 +326,14 @@
 /* Do all the work for the case where we have a bounding box. */
 /* Returns exec_cont - a function, which must be called by caller after this function. */
 private int
-type1exec_bbox(i_ctx_t *i_ctx_p, gs_type1exec_state * pcxs,
+type1exec_bbox(i_ctx_t *i_ctx_p, gs_text_enum_t *penum, gs_type1exec_state * pcxs,
 	       gs_font * pfont, op_proc_t *exec_cont)
 {
     os_ptr op = osp;
     gs_type1_state *const pcis = &pcxs->cis;
     gs_font_base *const pbfont = (gs_font_base *) pfont;
-    op_proc_t cont = (pbfont->PaintType == 0 ? bbox_finish_fill : bbox_finish_stroke);
+    op_proc_t cont = (pbfont->PaintType == 0 && penum->orig_font->PaintType == 0
+			? bbox_finish_fill : bbox_finish_stroke);
 
 
     /*
@@ -604,7 +605,7 @@
     if (code < 0)
 	return code;
     cxs.char_bbox = pfont1->FontBBox;
-    code = type1exec_bbox(i_ctx_p, &cxs, pfont, exec_cont);
+    code = type1exec_bbox(i_ctx_p, penum, &cxs, pfont, exec_cont);
     return code;
 }
 private int
@@ -839,9 +840,11 @@
 	    code = type1_exec_init(&pcxs->cis, penum, igs, pfont1);
 	    if (code < 0)
 		return code;
-	    code = type1exec_bbox(i_ctx_p, pcxs, pfont, &exec_cont);
+	    code = type1exec_bbox(i_ctx_p, penum, pcxs, pfont, &exec_cont);
 	} else {
-	    cont = (pbfont->PaintType == 0 ? nobbox_fill : nobbox_stroke), exec_cont = 0;
+	    cont = (pbfont->PaintType == 0 && penum->orig_font->PaintType == 0
+			? nobbox_fill : nobbox_stroke);
+	    exec_cont = 0;
 	    code = zchar_set_cache(i_ctx_p, pbfont, op - 1, NULL,
 				   pcxs->sbw + 2,
 				   &pcxs->char_bbox,

Modified: trunk/gs/src/zfcid0.c
===================================================================
--- trunk/gs/src/zfcid0.c	2007-08-28 16:18:27 UTC (rev 8212)
+++ trunk/gs/src/zfcid0.c	2007-08-29 07:09:01 UTC (rev 8213)
@@ -465,10 +465,10 @@
 	if (code < 0)
 	    goto fail;
     }
-    code = build_gs_simple_font(i_ctx_p, op, &pfont, ft_CID_encrypted,
+    code = build_gs_outline_font(i_ctx_p, op, &pfont, ft_CID_encrypted, 
 				&st_gs_font_cid0, &build,
-				bf_Encoding_optional |
-				bf_UniqueID_ignored);
+				bf_Encoding_optional | bf_UniqueID_ignored, 
+				build_gs_simple_font);
     if (code < 0)
 	goto fail;
     if (code == 1) {



More information about the gs-cvs mailing list