[gs-cvs] gs/src

Igor Melichev igor at ghostscript.com
Thu Jul 14 03:28:01 PDT 2005


Update of /cvs/ghostscript/gs/src
In directory casper2:/tmp/cvs-serv13358/gs/src

Modified Files:
	gdevpdtf.c devs.mak 
Log Message:
Fix (ps2write) : Embed standard fonts, which use extention glyphs due to encoding conflicts.

DETAILS :

This is a partial fix for the bug 688169 "ps2write : text dissappears",
which is related to the problem with ADOBE1-4.pdf .

When Widths array defines several widths for same glyph,
the PDF interpreter duplicates glyphs inserting extended glyph names.
However if the font name is standard, the font was not embedded and the
extended glyph names were missed. This patch forces embedding
the fonts what have extended glyph names.

This problem doesn't happen with pdfwrite, because it collapses
extended glyph names back to original ones.

Note that there exists a case, in which a font has extended glyphs but
they are not used in the document. In this case the font embedding is not necesary,
but ps2write does embed it. This happens because the current architecture 
does not allow to detect such case, because the decision about a font embedding 
is being made before a text is processed. Dalaying it until the end of the text would
need to delay object ID assignation for the font descriptor and for the font file.
This change would be too deep, so we don't do it now.

If an user strongly needs to minimise the output when 
a standard font uses extended glyph name,
we recommend to perform a 2-pass distillation :
the first pass computes exact font subsets,
and the second pass won't receive unused glyphs.
We believe that such need is pretty rare.

EXPECTED DIFFERENCES :

None.


Index: gdevpdtf.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdtf.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- gdevpdtf.c	5 Apr 2005 09:48:46 -0000	1.44
+++ gdevpdtf.c	14 Jul 2005 10:27:59 -0000	1.45
@@ -27,6 +27,7 @@
 #include "gxfcopy.h"
 #include "gxfont.h"
 #include "gxfont1.h"
+#include "gdevpsf.h"
 #include "gdevpdfx.h"
 #include "gdevpdtb.h"
 #include "gdevpdtd.h"
@@ -599,6 +600,29 @@
     return (find_std_appearance(pdev, (gs_font_base *)font, -1,
 				pairs, num_glyphs) == index);
 }
+private bool
+has_extension_glyphs(gs_font *pfont)
+{
+    psf_glyph_enum_t genum;
+    gs_glyph glyph;
+    gs_const_string str;
+    int code, j, l;
+    const int sl = strlen(gx_extendeg_glyph_name_separator);
+
+    psf_enumerate_glyphs_begin(&genum, (gs_font *)pfont, NULL, 0, GLYPH_SPACE_NAME);
+    for (glyph = gs_no_glyph; (code = psf_enumerate_glyphs_next(&genum, &glyph)) != 1; ) {
+	code = pfont->procs.glyph_name(pfont, glyph, &str);
+	if (code < 0)
+	    return code;
+	l = str.size - sl, j;
+	for (j = 0; j < l; j ++)
+	    if (!memcmp(gx_extendeg_glyph_name_separator, str.data + j, sl))
+		return true;
+    }
+    psf_enumerate_glyphs_reset(&genum);
+    return false;
+}
+
 /*
  * Choose a name for embedded font.
  */
@@ -630,8 +654,11 @@
     if (pdev->CompatibilityLevel < 1.3) {
 	if (index >= 0 && 
 	    (embed_as_standard_called = true,
-	     do_embed_as_standard = embed_as_standard(pdev, font, index, pairs, num_glyphs)))
+		do_embed_as_standard = embed_as_standard(pdev, font, index, pairs, num_glyphs))) {
+	    if (pdev->ForOPDFRead && has_extension_glyphs(font))
+		return FONT_EMBED_YES;
 	    return FONT_EMBED_STANDARD;
+	}
     }
     /* Check the Embed lists. */
     if (!embed_list_includes(&pdev->params.NeverEmbed, chars, size) ||

Index: devs.mak
===================================================================
RCS file: /cvs/ghostscript/gs/src/devs.mak,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- devs.mak	8 Jul 2005 22:04:31 -0000	1.132
+++ devs.mak	14 Jul 2005 10:27:59 -0000	1.133
@@ -1003,7 +1003,7 @@
 $(GLOBJ)gdevpdtf.$(OBJ) : $(GLSRC)gdevpdtf.c $(gx_h) $(memory__h)\
  $(string__h) $(gserrors_h) $(gsutil_h)\
  $(gxfcache_h) $(gxfcid_h) $(gxfcmap_h) $(gxfcopy_h) $(gxfont_h) $(gxfont1_h)\
- $(gdevpdfx_h) $(gdevpdtb_h) $(gdevpdtd_h) $(gdevpdtf_h) $(gdevpdtw_h)
+ $(gdevpsf_h) $(gdevpdfx_h) $(gdevpdtb_h) $(gdevpdtd_h) $(gdevpdtf_h) $(gdevpdtw_h)
 	$(GLCC) $(GLO_)gdevpdtf.$(OBJ) $(C_) $(GLSRC)gdevpdtf.c
 
 $(GLOBJ)gdevpdti.$(OBJ) : $(GLSRC)gdevpdti.c $(memory__h) $(string__h) $(gx_h)\



More information about the gs-cvs mailing list