Author: alexcher
Date: 2008-03-09 19:18:38 -0700 (Sun, 09 Mar 2008)
New Revision: 8594

Modified:
   trunk/gs/src/zchar1.c
Log:
When the font has no /FontBBox but provides character width through /Metrics
dictionary, use them instead of the calculated width. The old code did so only
when both the width and side bearings were defined. Bug 689740, customer 353.

DIFFERENCES:
None


Modified: trunk/gs/src/zchar1.c
===================================================================
--- trunk/gs/src/zchar1.c	2008-03-09 18:32:16 UTC (rev 8593)
+++ trunk/gs/src/zchar1.c	2008-03-10 02:18:38 UTC (rev 8594)
@@ -289,12 +289,22 @@
 	 * create the path twice, since we can't know the
 	 * oversampling factor until after setcachedevice.
 	 */
-	if (cxs.present == metricsSideBearingAndWidth) {
-	    gs_point sbpt;
+	switch (cxs.present) {
+            case metricsSideBearingAndWidth: { 
+                gs_point pt;
 
-	    sbpt.x = cxs.sbw[0], sbpt.y = cxs.sbw[1];
-	    gs_type1_set_lsb(pcis, &sbpt);
-	}
+	        pt.x = cxs.sbw[0], pt.y = cxs.sbw[1];
+	        gs_type1_set_lsb(pcis, &pt);
+            }
+            /* fall through */
+            case metricsWidthOnly: {
+                gs_point pt;
+
+	        pt.x = cxs.sbw[2], pt.y = cxs.sbw[3];
+                gs_type1_set_width(pcis, &pt);
+            }
+        }
+
 	/* Continue interpreting. */
       icont:
 	code = type1_continue_dispatch(i_ctx_p, &cxs, opstr, &other_subr, 4);
@@ -308,9 +318,16 @@
 		return type1_call_OtherSubr(i_ctx_p, &cxs, nobbox_continue,
 					    &other_subr);
 	    case type1_result_sbw:	/* [h]sbw, just continue */
-		if (cxs.present != metricsSideBearingAndWidth)
-		    type1_cis_get_metrics(pcis, cxs.sbw);
-		opstr = 0;
+                switch (cxs.present) {
+                    case metricsNone:
+                        cxs.sbw[0] = fixed2float(pcis->lsb.x);
+                        cxs.sbw[1] = fixed2float(pcis->lsb.y);
+                    /* fall through */
+                    case metricsWidthOnly:
+                        cxs.sbw[2] = fixed2float(pcis->width.x);
+                        cxs.sbw[3] = fixed2float(pcis->width.y);
+                }
+                opstr = 0;
 		goto icont;
 	}
     }

_______________________________________________
gs-cvs mailing list
gs-cvs@ghostscript.com
http://www.ghostscript.com/mailman/listinfo/gs-cvs
