[gs-cvs] gs/src

Igor Melichev igor at casper.ghostscript.com
Tue Apr 16 03:11:32 PDT 2002


Update of /cvs/ghostscript/gs/src
In directory casper:/tmp/cvs-serv23848/gs/src

Modified Files:
      Tag: GS_7_0X
	gdevpdfs.c 
Log Message:
Fix : pdfwrite wrongly computed line width for fonts with PaintType 2.


Index: gdevpdfs.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdfs.c,v
retrieving revision 1.7.2.2
retrieving revision 1.7.2.3
diff -u -d -r1.7.2.2 -r1.7.2.3
--- gdevpdfs.c	11 Apr 2002 15:49:45 -0000	1.7.2.2
+++ gdevpdfs.c	16 Apr 2002 10:11:30 -0000	1.7.2.3
@@ -1412,25 +1412,23 @@
 	    gs_imager_state *pis = pte->pis;
 	    float save_width = pis->line_params.half_width;
 	    const gs_font *font = ppts->font;
-	    const gs_font *bfont = font;
 	    double scaled_width = font->StrokeWidth;
 
-	    /*
-	     * The font's StrokeWidth is in the character coordinate system,
-	     * which means that it should be scaled by the inverse of any
-	     * scaling in the FontMatrix.  Do the best we can with this.
+	    /* Note that we compute pis->line_params.half_width in device space,
+	     * even though it logically represents a value in user space.  
+	     * The 'scale' value compensates for this.
 	     */
-	    while (bfont != bfont->base)
-		bfont = bfont->base;
-	    scaled_width *= font_matrix_scaling(bfont) /
-		font_matrix_scaling(font);
+	    scaled_width *= font_matrix_scaling(font);
+	    scaled_width *= min(hypot(pte->pis->ctm.xx, pte->pis->ctm.yx) / 
+                                    pdev->HWResolution[0] * pdev->HWResolution[1],
+                                hypot(pte->pis->ctm.xy, pte->pis->ctm.yy));
 	    pis->line_params.half_width = scaled_width / 2;
 	    code = pdf_prepare_stroke(pdev, pis);
 	    if (code >= 0) {
-		/*
-		 * See stream_to_text in gdevpdfu.c re the computation of
-		 * the scaling value.
-		 */
+                /*
+                 * See stream_to_text in gdevpdfu.c re the computation of
+                 * the scaling value.
+                 */
 		double scale = 72.0 / pdev->HWResolution[1];
 
 		code = gdev_vector_prepare_stroke((gx_device_vector *)pdev,




More information about the gs-cvs mailing list