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

alexcher at ghostscript.com alexcher at ghostscript.com
Sat Aug 4 14:42:53 PDT 2007


Author: alexcher
Date: 2007-08-04 14:42:53 -0700 (Sat, 04 Aug 2007)
New Revision: 8175

Modified:
   trunk/gs/src/zbfont.c
   trunk/gs/src/zfont.c
Log:
Change the order of tests to identify fonts with FID attribute that have been
both scaled and copied. Bug 689390

DETAILS:
Prior to this revision Ghostscript mis-recognized such fonts as scaled-only
in build_gs_font() and rejected with /invalidfont during font validation.

DIFFERENCES:
None


Modified: trunk/gs/src/zbfont.c
===================================================================
--- trunk/gs/src/zbfont.c	2007-08-04 14:30:04 UTC (rev 8174)
+++ trunk/gs/src/zbfont.c	2007-08-04 21:42:53 UTC (rev 8175)
@@ -680,30 +680,30 @@
 	 * anyway).
 	 */
 	pfont = r_ptr(pfid, gs_font);
-	if (pfont->base == pfont) {	/* original font */
-	    if (!level2_enabled)
-		return_error(e_invalidfont);
-	    if (obj_eq(pfont->memory, pfont_dict(pfont), op)) {
+	/*
+	 * If the following condition is false this is a re-encoded font,
+         * or some other questionable situation in which the FID
+	 * was preserved.  Pretend the FID wasn't there.
+	 */
+	if (obj_eq(pfont->memory, pfont_dict(pfont), op)) {
+	    if (pfont->base == pfont) {	/* original font */
+	        if (!level2_enabled)
+		    return_error(e_invalidfont);
 		*ppfont = pfont;
 		return 1;
+	    } else {		/* This was made by makefont or scalefont. */
+	        /* Just insert the new name. */
+	        gs_matrix mat;
+	        ref fname;			/* t_string */
+
+	        code = sub_font_params(imemory, op, &mat, NULL, &fname);
+	        if (code < 0)
+		    return code;
+	        code = 1;
+	        copy_font_name(&pfont->font_name, &fname);
+	        goto set_name;
 	    }
-	    /*
-	     * This is a re-encoded font, or some other
-	     * questionable situation in which the FID
-	     * was preserved.  Pretend the FID wasn't there.
-	     */
-	} else {		/* This was made by makefont or scalefont. */
-	    /* Just insert the new name. */
-	    gs_matrix mat;
-	    ref fname;			/* t_string */
-
-	    code = sub_font_params(imemory, op, &mat, NULL, &fname);
-	    if (code < 0)
-		return code;
-	    code = 1;
-	    copy_font_name(&pfont->font_name, &fname);
-	    goto set_name;
-	}
+        }
     }
     /* This is a new font. */
     if (!r_has_attr(aop, a_write))

Modified: trunk/gs/src/zfont.c
===================================================================
--- trunk/gs/src/zfont.c	2007-08-04 14:30:04 UTC (rev 8174)
+++ trunk/gs/src/zfont.c	2007-08-04 21:42:53 UTC (rev 8175)
@@ -262,12 +262,12 @@
 	)
 	return_error(e_invalidfont);
     pfont = r_ptr(pid, gs_font);
+    if (pfont == 0)
+	return_error(e_invalidfont);	/* unregistered font */
     pdata = pfont->client_data;
     if (!obj_eq(pfont->memory, &pdata->dict, pfdict))
 	return_error(e_invalidfont);
     *ppfont = pfont;
-    if (pfont == 0)
-	return_error(e_invalidfont);	/* unregistered font */
     return 0;
 }
 



More information about the gs-cvs mailing list