[gs-cvs] rev 8271 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Sun Oct 7 11:09:11 PDT 2007
Author: leonardo
Date: 2007-10-07 11:09:11 -0700 (Sun, 07 Oct 2007)
New Revision: 8271
Modified:
trunk/gs/src/gdevpdtb.c
trunk/gs/src/gsfont.c
Log:
Fix (pdfwrite) : Ignore font errors that do not belong to embedded subset.
DETAILS :
Bug 689068 "ps2pdf13 fails with Error: /invalidfont in --ashow--".
The document could successfully rasterize,
but failed with invalidfont when converting to PDF.
It happened due to a missed glyph,
which is not atually used in the doeument.
The patch skips font errors that do not belong to the font subset.
However if the user requests to embed a complete font,
a warning is printed to stderr and the document fails
due to the font error as before the patch.
Changes :
1. gdevpdtb.c : Process a coplete font copy error as explained above.
2. gsfont.c : Ignore missed glyphs when computing the "fixed width" font feature.
EXPECTED DIFFERENCES :
None,
Modified: trunk/gs/src/gdevpdtb.c
===================================================================
--- trunk/gs/src/gdevpdtb.c 2007-10-04 06:46:54 UTC (rev 8270)
+++ trunk/gs/src/gdevpdtb.c 2007-10-07 18:09:11 UTC (rev 8271)
@@ -198,9 +198,23 @@
goto fail;
}
code = gs_copy_font_complete((gs_font *)font, complete);
- if (code < 0)
+ if (code < 0 && pbfont->do_subset == DO_SUBSET_NO) {
+ char buf[gs_font_name_max + 1];
+ int l = min(copied->font_name.size, sizeof(buf) - 1);
+
+ memcpy(buf, copied->font_name.chars, l);
+ buf[l] = 0;
+ eprintf1("Can't embed the complete font %s due to font error.\n", buf);
goto fail;
- if (pbfont->num_glyphs < 0) { /* Type 1 */
+ }
+ if (code < 0) {
+ /* A font error happened, but it may be caused by a glyph,
+ which is not used in the document. Continue with subsetting the font.
+ If the failed glyph will be used in the document,
+ another error will hgappen when the glyph is used.
+ */
+ complete = copied;
+ } else if (pbfont->num_glyphs < 0) { /* Type 1 */
int index, count;
gs_glyph glyph;
Modified: trunk/gs/src/gsfont.c
===================================================================
--- trunk/gs/src/gsfont.c 2007-10-04 06:46:54 UTC (rev 8270)
+++ trunk/gs/src/gsfont.c 2007-10-07 18:09:11 UTC (rev 8271)
@@ -818,6 +818,8 @@
int fixed_width = 0;
int index;
int code = 0; /* Quiet compiler. */
+ int ecode = 0;
+ bool has_glyphs = false;
for (index = 0;
fixed_width >= 0 &&
@@ -829,8 +831,10 @@
code = font->procs.glyph_info(font, glyph, pmat,
(GLYPH_INFO_WIDTH0 << wmode),
&glyph_info);
- if (code < 0)
- return code;
+ if (code < 0) {
+ ecode = code;
+ continue;
+ }
if (notdef == gs_no_glyph && gs_font_glyph_is_notdef(bfont, glyph)) {
notdef = glyph;
info->MissingWidth = (int)glyph_info.width[wmode].x;
@@ -842,9 +846,10 @@
fixed_width = (int)glyph_info.width[wmode].x;
else if (glyph_info.width[wmode].x != fixed_width)
fixed_width = min_int;
+ has_glyphs = true;
}
- if (code < 0)
- return code;
+ if (ecode < 0 && !has_glyphs)
+ return ecode;
if (fixed_width > 0) {
info->Flags |= FONT_IS_FIXED_WIDTH;
info->members |= FONT_INFO_AVG_WIDTH | FONT_INFO_MAX_WIDTH |
More information about the gs-cvs
mailing list