[gs-cvs] gs/src
Igor Melichev
igor at casper.ghostscript.com
Fri Jul 19 06:36:01 PDT 2002
Update of /cvs/ghostscript/gs/src
In directory casper:/tmp/cvs-serv19716/gs/src
Modified Files:
gdevpdfe.c gdevpdtb.c gdevpdtd.c gdevpsf2.c gdevpdtb.h
gdevpsf.h
Log Message:
Fix: Always write FontBBox into CFF, even though the spec says it's
optional, to work around a problem when printing the resulting file
with Adobe Acrobat Reader 4 to HP PostScript printers.
Source Forge bug "[ 578899 ] Missing /FontBBox when converting to ps?"
Index: gdevpdfe.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdfe.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- gdevpdfe.c 18 Jun 2002 00:31:20 -0000 1.17
+++ gdevpdfe.c 19 Jul 2002 13:35:59 -0000 1.18
@@ -189,7 +189,8 @@
private int
pdf_embed_font_as_type2(gx_device_pdf *pdev, gs_font_type1 *font,
long FontFile_id, gs_glyph subset_glyphs[256],
- uint subset_size, const gs_const_string *pfname)
+ uint subset_size, const gs_const_string *pfname,
+ gs_int_rect *FontBBox)
{
int code;
pdf_data_writer_t writer;
@@ -201,7 +202,8 @@
if (code < 0)
return code;
code = psf_write_type2_font(writer.binary.strm, font, options,
- subset_glyphs, subset_size, pfname);
+ subset_glyphs, subset_size, pfname,
+ FontBBox);
pdf_end_fontfile(pdev, &writer);
return code;
}
@@ -210,7 +212,8 @@
private int
pdf_embed_font_type1(gx_device_pdf *pdev, gs_font_type1 *font,
long FontFile_id, gs_glyph subset_glyphs[256],
- uint subset_size, const gs_const_string *pfname)
+ uint subset_size, const gs_const_string *pfname,
+ gs_int_rect *FontBBox)
{
switch (((const gs_font *)font)->FontType) {
case ft_encrypted:
@@ -221,7 +224,8 @@
/* falls through */
case ft_encrypted2:
return pdf_embed_font_as_type2(pdev, font, FontFile_id,
- subset_glyphs, subset_size, pfname);
+ subset_glyphs, subset_size, pfname,
+ FontBBox);
default:
return_error(gs_error_rangecheck);
}
@@ -355,7 +359,8 @@
}
code = pdf_embed_font_type1(pdev, (gs_font_type1 *)font,
FontFile_id, subset_list,
- subset_size, &font_name);
+ subset_size, &font_name,
+ &pfd->values.FontBBox);
break;
case ft_TrueType:
if (do_subset) {
Index: gdevpdtb.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdtb.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- gdevpdtb.c 28 Jun 2002 22:36:19 -0000 1.4
+++ gdevpdtb.c 19 Jul 2002 13:35:59 -0000 1.5
@@ -399,7 +399,8 @@
* Write an embedded font.
*/
int
-pdf_write_embedded_font(gx_device_pdf *pdev, pdf_base_font_t *pbfont)
+pdf_write_embedded_font(gx_device_pdf *pdev, pdf_base_font_t *pbfont,
+ gs_int_rect *FontBBox)
{
bool do_subset = pdf_do_subset_font(pdev, pbfont);
gs_font_base *out_font =
@@ -442,7 +443,7 @@
(gs_font_type1 *)out_font,
TYPE2_OPTIONS |
(pdev->CompatibilityLevel < 1.3 ? WRITE_TYPE2_AR3 : 0),
- NULL, 0, &fnstr);
+ NULL, 0, &fnstr, FontBBox);
goto finish;
case ft_TrueType: {
Index: gdevpdtd.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdtd.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- gdevpdtd.c 27 Jun 2002 17:53:53 -0000 1.3
+++ gdevpdtd.c 19 Jul 2002 13:35:59 -0000 1.4
@@ -504,7 +504,8 @@
if (!pfd->common.object->written &&
(code = pdf_compute_font_descriptor(pfd)) >= 0 &&
(!pfd->embed ||
- (code = pdf_write_embedded_font(pdev, pfd->base_font)) >= 0)
+ (code = pdf_write_embedded_font(pdev, pfd->base_font,
+ &pfd->common.values.FontBBox)) >= 0)
)
DO_NOTHING;
return code;
Index: gdevpsf2.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpsf2.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- gdevpsf2.c 26 Jun 2002 23:17:24 -0000 1.22
+++ gdevpsf2.c 19 Jul 2002 13:35:59 -0000 1.23
@@ -66,6 +66,7 @@
long start_pos;
cff_string_table_t std_strings;
cff_string_table_t strings;
+ gs_int_rect FontBBox;
} cff_writer_t;
typedef struct cff_glyph_subset_s {
psf_outline_glyphs_t glyphs;
@@ -545,17 +546,22 @@
if (pinfo->members & FONT_INFO_FAMILY_NAME)
cff_put_string_value(pcw, pinfo->FamilyName.data,
pinfo->FamilyName.size, TOP_FamilyName);
- /* (Weight) */
- if (pbfont->FontBBox.p.x != 0 || pbfont->FontBBox.p.y != 0 ||
- pbfont->FontBBox.q.x != 0 || pbfont->FontBBox.q.y != 0
- ) {
- /* An omitted FontBBox is equivalent to an empty one. */
- cff_put_real(pcw, pbfont->FontBBox.p.x);
- cff_put_real(pcw, pbfont->FontBBox.p.y);
- cff_put_real(pcw, pbfont->FontBBox.q.x);
- cff_put_real(pcw, pbfont->FontBBox.q.y);
- cff_put_op(pcw, TOP_FontBBox);
- }
+ if (pcw->FontBBox.p.x != 0 || pcw->FontBBox.p.y != 0 ||
+ pcw->FontBBox.q.x != 0 || pcw->FontBBox.q.y != 0
+ ) {
+ /* An omitted FontBBox is equivalent to an empty one. */
+ /*
+ * Since Acrobat Reader 4 on Solaris doesn't like
+ * an omitted FontBBox, we copy it here from
+ * the font descriptor, because the base font
+ * is allowed to omit it's FontBBox.
+ */
+ cff_put_real(pcw, pcw->FontBBox.p.x);
+ cff_put_real(pcw, pcw->FontBBox.p.y);
+ cff_put_real(pcw, pcw->FontBBox.q.x);
+ cff_put_real(pcw, pcw->FontBBox.q.y);
+ cff_put_op(pcw, TOP_FontBBox);
+ }
if (uid_is_UniqueID(&pbfont->UID))
cff_put_int_value(pcw, pbfont->UID.id, TOP_UniqueID);
else if (uid_is_XUID(&pbfont->UID)) {
@@ -1099,7 +1105,8 @@
int
psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
gs_glyph *subset_glyphs, uint subset_size,
- const gs_const_string *alt_font_name)
+ const gs_const_string *alt_font_name,
+ gs_int_rect *FontBBox)
{
gs_font_base *const pbfont = (gs_font_base *)pfont;
cff_writer_t writer;
@@ -1154,6 +1161,7 @@
writer.glyph_data = psf_type1_glyph_data;
writer.offset_size = 1; /* arbitrary */
writer.start_pos = stell(s);
+ writer.FontBBox = *FontBBox;
/* Initialize the enumeration of the glyphs. */
psf_enumerate_glyphs_begin(&genum, (gs_font *)pfont,
Index: gdevpdtb.h
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdtb.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gdevpdtb.h 27 Jun 2002 17:53:53 -0000 1.2
+++ gdevpdtb.h 19 Jul 2002 13:35:59 -0000 1.3
@@ -113,7 +113,8 @@
/*
* Write an embedded font, possibly subsetted.
*/
-int pdf_write_embedded_font(gx_device_pdf *pdev, pdf_base_font_t *pbfont);
+int pdf_write_embedded_font(gx_device_pdf *pdev, pdf_base_font_t *pbfont,
+ gs_int_rect *FontBBox);
/*
* Write the CharSet data for a subsetted font, as a PDF string.
Index: gdevpsf.h
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpsf.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- gdevpsf.h 25 Jun 2002 06:52:05 -0000 1.19
+++ gdevpsf.h 19 Jul 2002 13:35:59 -0000 1.20
@@ -199,7 +199,8 @@
#define WRITE_TYPE2_NO_GSUBRS 8 /* omit GlobalSubrs */
int psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
gs_glyph *subset_glyphs, uint subset_size,
- const gs_const_string *alt_font_name);
+ const gs_const_string *alt_font_name,
+ gs_int_rect *FontBBox);
#ifndef gs_font_cid0_DEFINED
# define gs_font_cid0_DEFINED
More information about the gs-cvs
mailing list