[gs-cvs] gs/src

Igor Melichev igor at ghostscript.com
Thu May 27 12:05:39 PDT 2004


Update of /cvs/ghostscript/gs/src
In directory casper:/tmp/cvs-serv15756/gs/src

Modified Files:
	gdevpdf.c gdevpdfg.c gdevpdfj.c gdevpdfu.c gdevpdte.c 
	gdevpdtf.c gdevpdti.c gdevpdtt.c gdevpdfg.h gdevpdfx.h 
	gdevpdtf.h gdevpdtt.h devs.mak 
Log Message:
(pdfwrite) : 1. Implementing a dynamic recongnition for Type 3 charproc variations;
2. Bug : Viewer state could desynchronize when entering a charproc accumulation.

DETAILS :

Bug 687472 "barcode wrongly converted to type3 font".

Type 3 glyph variations may appear if BuildChar uses setcharwidth.
If a charproc uses setcharwidth, we perform the charproc accumulation 
for each character occurance, and compare the accumulated stream with older
ones if they exist. In the case of exact equality
(including the character name and character code),
the old charproc is used. Othervise we embed a new one.

If the character code was used with another charproc,
we create another PDF font to resolve the conflict.
Thus a single PS Type 3 font may convert into several
PDF Type 3 fonts, and the text may be broken into smaller pieces.
Particularly this happens with the test file of the bug 687472.
Viewers must account that implementing the text serchability.

A new array pdfont->u.simple.s.type3.cached is used to remember whether
a charproc uses setcachedevice[2]. If a character used it at ones,
we assume that all further its occurances to do same.
We think that this assumption is implied by PLRM.

Viewer state was not saved when entering a charproc accumulation,
and was not restored after exiting it (a bug).
This could cause wrong object attributes
and excessive commands written into PDF.
This patch fixes that.

Some PDFs become longer due to excessive ExtGState objects
generated for dropped copies of charprocs.
Opened a new bug 687487 for tracking this issue.

EXPECTED DIFFERENCES :

An unimportant difference with pdfwrite -r72 :
136-01.ps
prob1.pdf
tpc2.ps 
xes2ps-problem.pdf

An unimportant difference with pdfwrite -r300 :
260-01.ps
tpc2.ps
xes2ps-problem.pdf


Index: gdevpdf.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdf.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- a/gdevpdf.c	27 May 2004 10:25:27 -0000	1.93
+++ b/gdevpdf.c	27 May 2004 19:05:36 -0000	1.94
@@ -285,7 +285,8 @@
  false,				/* AR4_save_bug */
  0,				/* font3 */
  0,				/* accumulating_substream_resource */
- {0,0,0,0,0,0,0,0,0}		/* charproc_ctm */
+ {0,0,0,0,0,0,0,0,0},		/* charproc_ctm */
+ 0				/* charproc_just_accumulated */
 };
 
 /* ---------------- Device open/close ---------------- */

Index: gdevpdfg.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdfg.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- a/gdevpdfg.c	15 Apr 2004 17:26:36 -0000	1.49
+++ b/gdevpdfg.c	27 May 2004 19:05:36 -0000	1.50
@@ -72,7 +72,8 @@
     memcpy(pdev->vgstack[i].dash_pattern, pdev->dash_pattern, 
 		sizeof(pdev->vgstack[i].dash_pattern));
     pdev->vgstack_depth++;
-    stream_puts(s, "q\n");
+    if (s)
+	stream_puts(s, "q\n");
     return 0;
 }
 
@@ -112,7 +113,8 @@
 
     if (i < pdev->vgstack_bottom)
 	return_error(gs_error_unregistered); /* Must not happen. */
-    stream_puts(s, "Q\n");
+    if (s)
+	stream_puts(s, "Q\n");
     pdf_load_viewer_state(pdev, pdev->vgstack + i);
     return 0;
 }
@@ -1303,7 +1305,7 @@
 }
 
 /* Update the graphics state for filling. */
-private int
+int
 pdf_try_prepare_fill(gx_device_pdf *pdev, const gs_imager_state *pis)
 {
     pdf_resource_t *pres = 0;

Index: gdevpdfj.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdfj.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- a/gdevpdfj.c	2 Apr 2004 14:21:39 -0000	1.30
+++ b/gdevpdfj.c	27 May 2004 19:05:37 -0000	1.31
@@ -416,6 +416,12 @@
     return code < 0 ? code : code1;
 }
 
+private int 
+nocheck(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_resource_t *pres1)
+{
+    return 1;
+}
+
 /*
  * Finish writing an image.  If in-line, write the BI/dict/ID/data/EI and
  * return 1; if a resource, write the resource definition and return 0.
@@ -451,7 +457,7 @@
 	    *(cos_object_t *)named = *pco;
 	    pres->object = COS_OBJECT(named);
 	} else if (!pres->named) { /* named objects are written at the end */
-	    code = pdf_find_same_resource(pdev, resourceXObject, &piw->pres);
+	    code = pdf_find_same_resource(pdev, resourceXObject, &piw->pres, nocheck);
 	    if (code < 0)
 		return code;
 	    if (code > 0) {

Index: gdevpdfu.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdfu.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- a/gdevpdfu.c	13 Feb 2004 08:08:35 -0000	1.51
+++ b/gdevpdfu.c	27 May 2004 19:05:37 -0000	1.52
@@ -449,7 +449,7 @@
     /* fixme : remove *pres from resource chain. */
     pres->where_used = 0;
     pres->object->written = true;
-    if (rtype == resourceXObject) {
+    if (rtype == resourceXObject || rtype == resourceCharProc) {
 	int code = cos_stream_release_pieces((cos_stream_t *)pres->object);
 
 	if (code < 0)
@@ -482,7 +482,8 @@
 
 /* Find same resource. */
 int
-pdf_find_same_resource(gx_device_pdf * pdev, pdf_resource_type_t rtype, pdf_resource_t **ppres)
+pdf_find_same_resource(gx_device_pdf * pdev, pdf_resource_type_t rtype, pdf_resource_t **ppres,
+	int (*eq)(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_resource_t *pres1))
 {
     pdf_resource_t **pchain = pdev->resources[rtype].chains;
     pdf_resource_t *pres;
@@ -498,8 +499,13 @@
 		if (code < 0)
 		    return code;
 		if (code > 0) {
-		    *ppres = pres;
-		    return 1;
+		    code = eq(pdev, *ppres, pres);
+		    if (code < 0)
+			return code;
+		    if (code > 0) {
+			*ppres = pres;
+			return 1;
+		    }
 		}
 	    }
 	}

Index: gdevpdte.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdte.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- a/gdevpdte.c	25 May 2004 09:20:49 -0000	1.58
+++ b/gdevpdte.c	27 May 2004 19:05:37 -0000	1.59
@@ -613,9 +613,16 @@
 	    real_widths[ch] = pwidths->real_width.w;
 	}
     } else {
-	if (font->FontType == ft_user_defined && 
-		!(pdfont->used[ch >> 3] & 0x80 >> (ch & 7)))
-	    return gs_error_undefined;
+	if (font->FontType == ft_user_defined) {
+	    if (!(pdfont->used[ch >> 3] & 0x80 >> (ch & 7)))
+		return gs_error_undefined; /* The charproc was not accumulated. */
+	    if (!pdev->charproc_just_accumulated &&
+		!(pdfont->u.simple.s.type3.cached[ch >> 3] & 0x80 >> (ch & 7))) {
+		 /* The charproc uses setcharwidth. 
+		    Need to accumulate again to check for a glyph variation. */
+		return gs_error_undefined;
+	    }
+	}
 	pwidths->Width.w = pdfont->Widths[ch];
 	pwidths->Width.v = pdfont->u.simple.v[ch];
 	if (font->FontType == ft_user_defined) {
@@ -661,19 +668,28 @@
 	(pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH ?
 	 pte->text.space.s_char : -1);
     int widths_differ = 0, code;
+    gx_device_pdf *pdev = (gx_device_pdf *)pte->dev;
+    pdf_font_resource_t *pdfont;
 
+    code = pdf_attached_font_resource(pdev, (gs_font *)font, &pdfont, NULL, NULL, NULL, NULL);
+    if (code < 0)
+	return code;
     if (font->FontType == ft_user_defined) {
-	gx_device_pdf *pdev = (gx_device_pdf *)pte->dev;
-
 	pdf_font3_scale(pdev, (gs_font *)font, &scale);
 	scale *= ppts->values.size;
     } else
 	scale = 0.001 * ppts->values.size;
     for (i = 0, w.x = w.y = 0; i < pstr->size; ++i) {
 	pdf_glyph_widths_t cw;
+	gs_char ch = pstr->data[i];
 
-	code = pdf_char_widths((gx_device_pdf *)pte->dev,
-	                           ppts->values.pdfont, pstr->data[i], font,
+	if (font->FontType == ft_user_defined &&
+	    (i > 0 || !pdev->charproc_just_accumulated) &&
+	    !(pdfont->u.simple.s.type3.cached[ch >> 3] & (0x80 >> (ch & 7))))
+	    code = gs_error_undefined;
+	else 
+	    code = pdf_char_widths((gx_device_pdf *)pte->dev,
+	                           ppts->values.pdfont, ch, font,
 				   &cw);
 	if (code < 0) {
 	    if (i)

Index: gdevpdtf.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdtf.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- a/gdevpdtf.c	14 Mar 2004 22:01:26 -0000	1.35
+++ b/gdevpdtf.c	27 May 2004 19:05:37 -0000	1.36
@@ -85,6 +85,8 @@
      ENUM_RETURN(0);
 }
 case 10: switch (pdfont->FontType) {
+ case ft_user_defined:
+     ENUM_RETURN(pdfont->u.simple.s.type3.cached);
  case ft_CID_encrypted:
  case ft_CID_TrueType:
      ENUM_RETURN(pdfont->u.cidfont.parent);
@@ -113,6 +115,7 @@
 	RELOC_VAR(pdfont->u.simple.Encoding);
 	RELOC_VAR(pdfont->u.simple.v);
 	RELOC_VAR(pdfont->u.simple.s.type3.char_procs);
+	RELOC_VAR(pdfont->u.simple.s.type3.cached);
 	break;
     case ft_CID_encrypted:
     case ft_CID_TrueType:

Index: gdevpdti.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdti.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- a/gdevpdti.c	27 May 2004 10:28:13 -0000	1.28
+++ b/gdevpdti.c	27 May 2004 19:05:37 -0000	1.29
@@ -400,7 +400,7 @@
     pcp->font = pdfont;
     pcp->char_code = ch;
     pcp->char_name = *gnstr;
-    pcp->real_width.x = pdfont->Widths[ch] = pw[font->WMode ? 6 : 0];
+    pcp->real_width.x = pw[font->WMode ? 6 : 0];
     pcp->real_width.y = pw[font->WMode ? 7 : 1];
     pcp->v.x = pw[8];
     pcp->v.y = pw[9];
@@ -416,7 +416,9 @@
 	pprintg6(pdev->strm, "%g %g %g %g %g %g d1\n", 
 	    (float)pw[0], (float)pw[1], (float)pw[2], 
 	    (float)pw[3], (float)pw[4], (float)pw[5]);
+	pdfont->u.simple.s.type3.cached[ch >> 3] |= 0x80 >> (ch & 7);
     }
+    pdfont->used[ch >> 3] |= 0x80 >> (ch & 7);
     pdev->font3 = (pdf_resource_t *)pdfont;
     return 0;
 }
@@ -465,6 +467,9 @@
 	pdev->strm = save_strm;
 	return code;
     }
+    code = pdf_save_viewer_state(pdev, NULL);
+    if (code < 0)
+	return code;
     pdev->strm = writer.binary.strm;
     pdev->sbstack[sbstack_ptr].context = pdev->context;
     pdf_text_state_copy(pdev->sbstack[sbstack_ptr].text_state, pdev->text->text_state);
@@ -481,7 +486,9 @@
     pdev->sbstack[sbstack_ptr].skip_colors = pdev->skip_colors;
     pdev->sbstack[sbstack_ptr].font3 = pdev->font3;
     pdev->sbstack[sbstack_ptr].accumulating_substream_resource = pdev->accumulating_substream_resource;
+    pdev->sbstack[sbstack_ptr].charproc_just_accumulated = pdev->charproc_just_accumulated;
     pdev->skip_colors = false;
+    pdev->charproc_just_accumulated = false;
     pdev->sbstack_depth++;
     pdev->procsets = 0;
     pdev->font3 = 0;
@@ -542,10 +549,73 @@
     pdev->sbstack[sbstack_ptr].font3 = 0;
     pdev->accumulating_substream_resource = pdev->sbstack[sbstack_ptr].accumulating_substream_resource;
     pdev->sbstack[sbstack_ptr].accumulating_substream_resource = 0;
+    pdev->charproc_just_accumulated = pdev->sbstack[sbstack_ptr].charproc_just_accumulated;
     pdev->sbstack_depth = sbstack_ptr;
+    code = pdf_restore_viewer_state(pdev, NULL);
+    if (code < 0)
+	return code;
     return code;
 }
 
+private int 
+pdf_is_same_charproc1(gx_device_pdf * pdev, pdf_char_proc_t *pcp0, pdf_char_proc_t *pcp1)
+{
+    if (pcp0->char_code != pcp1->char_code)
+	return false; /* We need same encoding. */
+    if (bytes_compare(pcp0->char_name.data, pcp0->char_name.size, 
+		      pcp1->char_name.data, pcp1->char_name.size))
+	return false; /* We need same encoding. */
+    if (pcp0->real_width.x != pcp1->real_width.x)
+	return false;
+    if (pcp0->real_width.y != pcp1->real_width.y)
+	return false;
+    if (pcp0->v.x != pcp1->v.x)
+	return false;
+    if (pcp0->v.y != pcp1->v.y)
+	return false;
+    return true;
+}
+
+private int 
+pdf_is_same_charproc(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_resource_t *pres1)
+{
+    return pdf_is_same_charproc1(pdev, (pdf_char_proc_t *)pres0, (pdf_char_proc_t *)pres1);
+}
+
+private int 
+pdf_find_same_charproc(gx_device_pdf *pdev, 
+	    pdf_font_resource_t *pdfont, pdf_char_proc_t **ppcp)
+{
+    pdf_char_proc_t *pcp;
+    int code;
+
+    for (pcp = pdfont->u.simple.s.type3.char_procs; pcp != NULL; pcp = pcp->char_next) {
+	if (*ppcp != pcp && pdf_is_same_charproc1(pdev, pcp, *ppcp)) {
+	    *ppcp = pcp;
+	    return 1;
+	}
+    }
+    pcp = *ppcp;
+    code = pdf_find_same_resource(pdev, resourceCharProc, (pdf_resource_t **)ppcp, pdf_is_same_charproc);
+    if (code <= 0)
+	return code;
+    /* fixme : do we need more checks here ? */
+    return 1;
+}
+
+private bool
+pdf_is_charproc_defined(gx_device_pdf *pdev, pdf_font_resource_t *pdfont, gs_char ch)
+{
+    pdf_char_proc_t *pcp;
+
+    for (pcp = pdfont->u.simple.s.type3.char_procs; pcp != NULL; pcp = pcp->char_next) {
+	if (pcp->char_code == ch) {
+	    return true;
+	}
+    }
+    return false;
+}
+
 /*
  * Complete charproc accumulation for a Type 3 font.
  */
@@ -558,31 +628,67 @@
        unless the font is defined recursively.
        But we don't want such assumption. */
     pdf_char_proc_t *pcp = (pdf_char_proc_t *)pres;
-    pdf_font_resource_t *font3 = (pdf_font_resource_t *)pdev->font3;
     pdf_font_resource_t *pdfont;
-    int ch = pcp->char_code;
+    gs_char ch = pcp->char_code;
     double *real_widths;
     byte *glyph_usage;
     int char_cache_size, width_cache_size;
     gs_glyph glyph0;
+    bool checking_glyph_variation = false;
     int i;
 
-    code = pdf_attached_font_resource(pdev, font, &pdfont,
-		&glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
+    code = pdf_attached_font_resource(pdev, font, &pdfont, NULL, NULL, NULL, NULL);
     if (code < 0)
 	return code;
-    if (pdfont != font3)
+    if (pdfont != (pdf_font_resource_t *)pdev->font3)
 	return_error(gs_error_unregistered); /* Must not happen. */
     if (ch == GS_NO_CHAR)
 	return_error(gs_error_unregistered); /* Must not happen. */
-    if (ch >= char_cache_size || ch >= width_cache_size)
+    if (ch >= 256)
 	return_error(gs_error_unregistered); /* Must not happen. */
     code = pdf_exit_substream(pdev);
     if (code < 0)
 	return code;
+    if (pdfont->used[ch >> 3] & (0x80 >> (ch & 7))) {
+	if (!(pdfont->u.simple.s.type3.cached[ch >> 3] & (0x80 >> (ch & 7)))) {
+	    checking_glyph_variation = true;
+	    code = pdf_find_same_charproc(pdev, pdfont, &pcp);
+	    if (code < 0)
+		return code;
+	    if (code != 0) {
+		code = pdf_cancel_resource(pdev, (pdf_resource_t *)pres, resourceCharProc);
+		if (code < 0)
+		    return code;
+		if (pcp->font != pdfont) {
+		    code = pdf_attach_font_resource(pdev, font, pcp->font);
+		    if (code < 0)
+			return code;
+		}
+		pdev->charproc_just_accumulated = true;
+		return 0;
+	    }
+	    if (pdf_is_charproc_defined(pdev, pdfont, ch)) {
+		code = pdf_make_font3_resource(pdev, font, &pdfont);
+		if (code < 0)
+		    return code;
+		code = pdf_attach_font_resource(pdev, font, pdfont);
+		if (code < 0)
+		    return code;
+	    }
+	}
+    }
+    code = pdf_attached_font_resource(pdev, font, &pdfont,
+		&glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
+    if (code < 0)
+	return code;
+    if (ch >= char_cache_size || ch >= width_cache_size)
+	return_error(gs_error_unregistered); /* Must not happen. */
+    if (checking_glyph_variation)
+	pdev->charproc_just_accumulated = true;
     glyph0 = font->procs.encode_char(font, ch, GLYPH_SPACE_NAME);
     pcp->char_next = pdfont->u.simple.s.type3.char_procs;
     pdfont->u.simple.s.type3.char_procs = pcp;
+    pdfont->Widths[ch] = pcp->real_width.x;
     real_widths[ch * 2    ] = pcp->real_width.x;
     real_widths[ch * 2 + 1] = pcp->real_width.y;
     glyph_usage[ch / 8] |= 0x80 >> (ch & 7);

Index: gdevpdtt.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdtt.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- a/gdevpdtt.c	27 May 2004 10:28:29 -0000	1.78
+++ b/gdevpdtt.c	27 May 2004 19:05:37 -0000	1.79
@@ -907,21 +907,30 @@
 /*
  * Create a font resource object for a gs_font of Type 3.
  */
-private int
+int
 pdf_make_font3_resource(gx_device_pdf *pdev, gs_font *font,
 		       pdf_font_resource_t **ppdfont)
 {
     const gs_font_base *bfont = (const gs_font_base *)font;
     pdf_font_resource_t *pdfont;
+    byte *cached;
     int code;
 
+    cached = gs_alloc_bytes(pdev->pdf_memory, 256/8, "pdf_make_font3_resource");
+    if (cached == NULL)
+	return_error(gs_error_VMerror);
     code = font_resource_encoded_alloc(pdev, &pdfont, bfont->id, 
 		    ft_user_defined, pdf_write_contents_bitmap);
-    if (code < 0)
+    if (code < 0) {
+	gs_free_object(pdev->pdf_memory, cached, "pdf_make_font3_resource");
 	return code;
+    }
+    memset(cached, 0, 256 / 8);
     pdfont->u.simple.s.type3.bitmap_font = false;
     pdfont->u.simple.BaseEncoding = pdf_refine_encoding_index(
 			bfont->nearest_encoding_index, true);
+    pdfont->u.simple.s.type3.char_procs = NULL;
+    pdfont->u.simple.s.type3.cached = cached;
     pdfont->u.simple.s.type3.FontBBox.p.x = (int)floor(bfont->FontBBox.p.x);
     pdfont->u.simple.s.type3.FontBBox.p.y = (int)floor(bfont->FontBBox.p.y);
     pdfont->u.simple.s.type3.FontBBox.q.x = (int)ceil(bfont->FontBBox.q.x);
@@ -1982,6 +1991,7 @@
 	}
 	if (code == TEXT_PROCESS_RENDER) {
 	    pdev->charproc_ctm = penum->pis->ctm;
+    	    pdev->charproc_just_accumulated = false;
 	    if (penum->current_font->FontType == ft_user_defined && 
 		    !(penum->pte_default->text.operation & TEXT_DO_CHARWIDTH)) {
 		/* Must set an identity CTM for the charproc accumulation.

Index: gdevpdfg.h
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdfg.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- a/gdevpdfg.h	20 Jan 2004 15:08:09 -0000	1.29
+++ b/gdevpdfg.h	27 May 2004 19:05:37 -0000	1.30
@@ -132,6 +132,7 @@
  * Bring the graphics state up to date for a drawing operation.
  * (Text uses either fill or stroke.)
  */
+int pdf_try_prepare_fill(gx_device_pdf *pdev, const gs_imager_state *pis);
 int pdf_prepare_fill(gx_device_pdf *pdev, const gs_imager_state *pis);
 int pdf_prepare_stroke(gx_device_pdf *pdev, const gs_imager_state *pis);
 int pdf_prepare_image(gx_device_pdf *pdev, const gs_imager_state *pis);

Index: gdevpdfx.h
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdfx.h,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- a/gdevpdfx.h	27 May 2004 10:28:31 -0000	1.88
+++ b/gdevpdfx.h	27 May 2004 19:05:37 -0000	1.89
@@ -354,6 +354,7 @@
     bool		skip_colors;
     pdf_resource_t      *font3;
     pdf_resource_t	*accumulating_substream_resource;
+    bool		charproc_just_accumulated;
 } pdf_substream_save;
 
 #define private_st_pdf_substream_save()\
@@ -556,6 +557,9 @@
     pdf_resource_t *font3; /* The owner of the accumulated charstring. */
     pdf_resource_t *accumulating_substream_resource;
     gs_matrix_fixed charproc_ctm;
+    bool charproc_just_accumulated; /* A flag for controlling 
+			the glyph variation recognition. 
+			Used only with uncached charprocs. */
 };
 
 #define is_in_page(pdev)\
@@ -703,8 +707,9 @@
 		       gs_id rid, pdf_resource_t **ppres, long id);
 
 /* Find same resource. */
-int pdf_find_same_resource(gx_device_pdf * pdev, pdf_resource_type_t rtype, 
-	pdf_resource_t **ppres);
+int pdf_find_same_resource(gx_device_pdf * pdev, 
+	pdf_resource_type_t rtype, pdf_resource_t **ppres,
+	int (*eq)(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_resource_t *pres1));
 
 /* Find a resource of a given type by gs_id. */
 pdf_resource_t *pdf_find_resource_by_gs_id(gx_device_pdf * pdev,

Index: gdevpdtf.h
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdtf.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- a/gdevpdtf.h	16 Oct 2003 20:42:50 -0000	1.21
+++ b/gdevpdtf.h	27 May 2004 19:05:37 -0000	1.22
@@ -230,6 +230,7 @@
 					     For a while restrict with 10 fonts.
 					     Should be enough for known cases (251-01.ps) */
 		    int used_fonts_count;
+		    byte *cached;
 		} type3;
 
 	    } s;

Index: gdevpdtt.h
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdtt.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- a/gdevpdtt.h	13 Mar 2004 18:28:52 -0000	1.22
+++ b/gdevpdtt.h	27 May 2004 19:05:37 -0000	1.23
@@ -175,19 +175,23 @@
  * Retrive font resource attached to a font.
  * allocating glyph_usage and real_widths on request.
  */
-int
-pdf_attached_font_resource(gx_device_pdf *pdev, gs_font *font,  
+int pdf_attached_font_resource(gx_device_pdf *pdev, gs_font *font,  
 			   pdf_font_resource_t **pdfont, byte **glyph_usage,
 			   double **real_widths, int *num_chars, int *num_widths);
 
 /*
  * Attach font resource to a font.
  */
-int
-pdf_attach_font_resource(gx_device_pdf *pdev, gs_font *font, 
+int pdf_attach_font_resource(gx_device_pdf *pdev, gs_font *font, 
 			 pdf_font_resource_t *pdfont); 
 
 /*
+ * Create a font resource object for a gs_font of Type 3.
+ */
+int pdf_make_font3_resource(gx_device_pdf *pdev, gs_font *font,
+		       pdf_font_resource_t **ppdfont);
+
+/*
  * Compute the cached values in the text processing state from the text
  * parameters, pdfont, and pis->ctm.  Return either an error code (< 0) or a
  * mask of operation attributes that the caller must emulate.  Currently the

Index: devs.mak
===================================================================
RCS file: /cvs/ghostscript/gs/src/devs.mak,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- a/devs.mak	24 May 2004 23:35:20 -0000	1.111
+++ b/devs.mak	27 May 2004 19:05:37 -0000	1.112
@@ -945,7 +945,7 @@
 
 $(GLOBJ)gdevpdti.$(OBJ) : $(GLSRC)gdevpdti.c $(memory__h) $(string__h) $(gx_h)\
  $(gserrors_h) $(gsutil_h)\
- $(gdevpdfx_h)\
+ $(gdevpdfx_h) $(gdevpdfg_h)\
  $(gdevpdtf_h) $(gdevpdti_h) $(gdevpdts_h) $(gdevpdtw_h) $(gdevpdtt_h) $(gdevpdfo_h)
 	$(GLCC) $(GLO_)gdevpdti.$(OBJ) $(C_) $(GLSRC)gdevpdti.c
 



More information about the gs-cvs mailing list