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

ken at ghostscript.com ken at ghostscript.com
Tue Dec 18 02:03:07 PST 2007


Author: ken
Date: 2007-12-18 02:03:07 -0800 (Tue, 18 Dec 2007)
New Revision: 8449

Modified:
   trunk/gs/src/gdevpdtd.c
Log:
Fix (pdfwrite): Font Descriptors for fonts not embedded, due to
EmbedAllFonts=false, did not preserve the original font name.

Details:
Bug #689597 "PDF created with NoEmbed has wrong BaseFont name".

(gdevpdtd.c) pdf_font_descriptor_alloc, do not use the 'embed'
status to determine whether to use the font or key name. Always
use the font name.

pdf_compute_font_descriptor. Remove the simplistic test for
symbolic. In the loop retrieving glyph information, check to see 
if the glyph name is present in ISO Latin 1. If not, the font is
symbolic.

EXPECTED DIFFERENCES:
None.


Modified: trunk/gs/src/gdevpdtd.c
===================================================================
--- trunk/gs/src/gdevpdtd.c	2007-12-18 10:02:09 UTC (rev 8448)
+++ trunk/gs/src/gdevpdtd.c	2007-12-18 10:03:07 UTC (rev 8449)
@@ -216,7 +216,7 @@
     pdf_base_font_t *pbfont;
     int code = pdf_base_font_alloc(pdev, &pbfont, font, 
 		(font->orig_FontMatrix.xx == 0 && font->orig_FontMatrix.xy == 0 
-		    ? &font->FontMatrix : &font->orig_FontMatrix), false, !embed);
+		    ? &font->FontMatrix : &font->orig_FontMatrix), false, false);
 
     if (code < 0)
 	return code;
@@ -369,19 +369,8 @@
     default:
 	break;
     }
+
     /*
-     * See the note on FONT_IS_ADOBE_ROMAN / FONT_USES_STANDARD_ENCODING
-     * in gdevpdtd.h for why the following substitution is made.
-     */
-#if 0
-#  define CONSIDER_FONT_SYMBOLIC(pdev, bfont) font_is_symbolic(bfont)
-#else
-#  define CONSIDER_FONT_SYMBOLIC(pdev, bfont)\
-  ((bfont)->encoding_index != ENCODING_INDEX_STANDARD) && (!pdev->PDFA || bfont->FontType != ft_TrueType)
-#endif
-    if (CONSIDER_FONT_SYMBOLIC(pdev, bfont))
-	desc.Flags |= FONT_IS_SYMBOLIC;
-    /*
      * Scan the entire glyph space to compute Ascent, Descent, FontBBox, and
      * the fixed width if any.  For non-symbolic fonts, also note the
      * bounding boxes for Latin letters and a couple of other characters,
@@ -397,6 +386,7 @@
 	 ) {
 	gs_glyph_info_t info;
 	gs_const_string gname;
+	gs_glyph glyph_known_enc;
 
 	code = bfont->procs.glyph_info((gs_font *)bfont, glyph, pmat, members, &info);
 	if (code == gs_error_VMerror)
@@ -434,9 +424,23 @@
 	if (is_cid)
 	    continue;
 	code = bfont->procs.glyph_name((gs_font *)bfont, glyph, &gname);
-	if (code < 0)
+	if (code < 0) {
+	    /* If we fail to get the glyph name, best assume this is a symbolic font */
+	    desc.Flags |= FONT_IS_SYMBOLIC;
 	    continue;
-	switch (gname.size) {
+	}
+	/* See if the glyph name is in any of the known encodings */
+        glyph_known_enc = gs_c_name_glyph(gname.data, gname.size);
+	if (glyph_known_enc == gs_no_glyph) {
+	    desc.Flags |= FONT_IS_SYMBOLIC;
+	    continue;
+	}
+	/* Finally check if the encoded glyph is in Standard Encoding */
+	if (gs_c_decode(glyph_known_enc, 0) == gs_no_glyph) {
+	    desc.Flags |= FONT_IS_SYMBOLIC;
+	    continue;
+	}
+        switch (gname.size) {
 	case 5:
 	    if (!memcmp(gname.data, "colon", 5))
 		bbox_colon = info.bbox, have_colon = true;
@@ -450,6 +454,7 @@
 	default:
 	    continue;
 	}
+
 	if (gname.data[0] >= 'A' && gname.data[0] <= 'Z') {
 	    cap_height = max(cap_height, (int)info.bbox.q.y);
 	    if (gname.data[0] == 'I')



More information about the gs-cvs mailing list