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

leonardo at ghostscript.com leonardo at ghostscript.com
Mon Jan 29 02:58:46 PST 2007


Author: leonardo
Date: 2007-01-29 02:58:45 -0800 (Mon, 29 Jan 2007)
New Revision: 7655

Modified:
   trunk/gs/src/zfcid1.c
Log:
Fix (True Type renderer) : Account glyph bbox when setting up the cache device (continued).

DETAILS :

The patch 
http://ghostscript.com/pipermail/gs-cvs/2007-January/007142.html 
appears incomplete. This one fixes that.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/src/zfcid1.c
===================================================================
--- trunk/gs/src/zfcid1.c	2007-01-28 16:53:40 UTC (rev 7654)
+++ trunk/gs/src/zfcid1.c	2007-01-29 10:58:45 UTC (rev 7655)
@@ -135,8 +135,8 @@
 #define GET_S16_MSB(p) (int)((GET_U16_MSB(p) ^ 0x8000) - 0x8000)
 
 private int
-z11_get_metrics(gs_font_type42 * pfont, uint glyph_index, int wmode,
-		float sbw[4])
+z11_get_metrics(gs_font_type42 * pfont, uint glyph_index, 
+		gs_type42_metrics_options_t options, float sbw[4])
 {
     gs_font_cid2 *const pfcid = (gs_font_cid2 *)pfont;
     int skip = pfcid->cidata.MetricsCount << 1;
@@ -144,26 +144,34 @@
     const byte *pmetrics;
     int lsb, width;
     int code = 0;
+    int wmode = gs_type42_metrics_options_wmode(options);
 
     gdata.memory = pfont->memory;
     if (wmode >= skip >> 2 ||
 	(code = pfcid->cidata.orig_procs.get_outline(pfont, glyph_index, &gdata)) < 0 ||
 	gdata.bits.size < skip
 	)
-	return pfcid->cidata.orig_procs.get_metrics(pfont, glyph_index, wmode,
-						    sbw);
-    pmetrics = gdata.bits.data + skip - 4 - (wmode << 2);
-    lsb = GET_S16_MSB(pmetrics + 2);
-    width = GET_U16_MSB(pmetrics + 0);
-    {
-	double factor = 1.0 / pfont->data.unitsPerEm;
+	return pfcid->cidata.orig_procs.get_metrics(pfont, glyph_index, options, sbw);
+    if(gs_type42_metrics_options_bbox_requested(options)) {
+	code = pfcid->cidata.orig_procs.get_metrics(pfont, glyph_index, 
+			gs_type42_metrics_options_BBOX, sbw);;
+	if (code < 0)
+	    return code;
+    }
+    if (gs_type42_metrics_options_sbw_requested(options)) {
+	pmetrics = gdata.bits.data + skip - 4 - (wmode << 2);
+	lsb = GET_S16_MSB(pmetrics + 2);
+	width = GET_U16_MSB(pmetrics + 0);
+	{
+	    double factor = 1.0 / pfont->data.unitsPerEm;
 
-	if (wmode) {
-	    sbw[0] = 0, sbw[1] = -lsb * factor;
-	    sbw[2] = 0, sbw[3] = -width * factor;
-	} else {
-	    sbw[0] = lsb * factor, sbw[1] = 0;
-	    sbw[2] = width * factor, sbw[3] = 0;
+	    if (wmode) {
+		sbw[0] = 0, sbw[1] = -lsb * factor;
+		sbw[2] = 0, sbw[3] = -width * factor;
+	    } else {
+		sbw[0] = lsb * factor, sbw[1] = 0;
+		sbw[2] = width * factor, sbw[3] = 0;
+	    }
 	}
     }
     gs_glyph_data_free(&gdata, "z11_get_metrics");



More information about the gs-cvs mailing list