[cairo-commit] 2 commits - src/cairo-pdf-surface.c
src/cairo-ps-surface.c src/cairo-scaled-font-subsets-private.h
src/cairo-type1-subset.c
Kristian Høgsberg
krh at kemper.freedesktop.org
Tue Sep 5 11:20:14 PDT 2006
src/cairo-pdf-surface.c | 4 ++--
src/cairo-ps-surface.c | 2 +-
src/cairo-scaled-font-subsets-private.h | 4 +++-
src/cairo-type1-subset.c | 11 ++++++-----
4 files changed, 12 insertions(+), 9 deletions(-)
New commits:
diff-tree 49fa8d353b2926760fa92684546b2fc79985c782 (from d81de15804f210afe9905a4163a5e34ff2be5b5b)
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Tue Sep 5 14:19:48 2006 -0400
Correct the value of /LastChar in the PDF Type 1 font dictionary.
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 04f5e73..68d0e7c 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -1665,7 +1665,7 @@ _cairo_pdf_surface_emit_type1_font_subse
" /Widths [",
subset_resource.id,
subset.base_font,
- font_subset->num_glyphs,
+ font_subset->num_glyphs - 1,
descriptor.id);
for (i = 0; i < font_subset->num_glyphs; i++)
diff-tree d81de15804f210afe9905a4163a5e34ff2be5b5b (from e5a9c2330867ae11befa8a966aa0a50c31c82a32)
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Tue Sep 5 14:19:26 2006 -0400
Fix Type 1 embedding in PDF
PDF Files with Type 1 fonts fail to open in any version of
ghostscript prior to 8.54. The problem is the hex encoding of the
encrypted portion of the font. The PDF reference says this should
only be in binary.
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 91a1968..04f5e73 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -1594,7 +1594,7 @@ _cairo_pdf_surface_emit_type1_font_subse
snprintf (name, sizeof name, "CairoFont-%d-%d",
font_subset->font_id, font_subset->subset_id);
- status = _cairo_type1_subset_init (&subset, name, font_subset);
+ status = _cairo_type1_subset_init (&subset, name, font_subset, FALSE);
if (status)
return status;
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 6ae3a38..019a53d 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -399,7 +399,7 @@ _cairo_ps_surface_emit_type1_font_subset
snprintf (name, sizeof name, "CairoFont-%d-%d",
font_subset->font_id, font_subset->subset_id);
- status = _cairo_type1_subset_init (&subset, name, font_subset);
+ status = _cairo_type1_subset_init (&subset, name, font_subset, TRUE);
if (status)
return status;
diff --git a/src/cairo-scaled-font-subsets-private.h b/src/cairo-scaled-font-subsets-private.h
index c41e477..8122c5c 100644
--- a/src/cairo-scaled-font-subsets-private.h
+++ b/src/cairo-scaled-font-subsets-private.h
@@ -239,6 +239,7 @@ typedef struct _cairo_type1_subset {
* _cairo_type1_subset_init:
* @type1_subset: a #cairo_type1_subset_t to initialize
* @font_subset: the #cairo_scaled_font_subset_t to initialize from
+ * @hex_encode: if true the encrypted portion of the font is hex encoded
*
* If possible (depending on the format of the underlying
* cairo_scaled_font_t and the font backend in use) generate a type1
@@ -253,7 +254,8 @@ typedef struct _cairo_type1_subset {
cairo_private cairo_status_t
_cairo_type1_subset_init (cairo_type1_subset_t *type_subset,
const char *name,
- cairo_scaled_font_subset_t *font_subset);
+ cairo_scaled_font_subset_t *font_subset,
+ cairo_bool_t hex_encode);
/**
* _cairo_type1_subset_fini:
diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index 8ee1f40..6f1be2c 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -103,7 +103,8 @@ typedef struct _cairo_type1_font_subset
static cairo_status_t
_cairo_type1_font_subset_create (cairo_unscaled_font_t *unscaled_font,
- cairo_type1_font_subset_t **subset_return)
+ cairo_type1_font_subset_t **subset_return,
+ cairo_bool_t hex_encode)
{
cairo_ft_unscaled_font_t *ft_unscaled_font;
FT_Face face;
@@ -145,6 +146,7 @@ _cairo_type1_font_subset_create (cairo_u
if (font->glyphs == NULL)
goto fail2;
+ font->hex_encode = hex_encode;
font->num_glyphs = 0;
for (i = 0; i < face->num_glyphs; i++)
font->glyphs[i].subset_index = -1;
@@ -900,7 +902,6 @@ cairo_type1_font_subset_write (cairo_typ
}
font->eexec_key = private_dict_key;
- font->hex_encode = TRUE;
font->hex_column = 0;
cairo_type1_font_subset_write_private_dict (font, name);
@@ -994,7 +995,8 @@ cairo_type1_font_subset_destroy (void *a
cairo_status_t
_cairo_type1_subset_init (cairo_type1_subset_t *type1_subset,
const char *name,
- cairo_scaled_font_subset_t *scaled_font_subset)
+ cairo_scaled_font_subset_t *scaled_font_subset,
+ cairo_bool_t hex_encode)
{
cairo_type1_font_subset_t *font;
cairo_status_t status;
@@ -1008,7 +1010,7 @@ _cairo_type1_subset_init (cairo_type1_su
unscaled_font = _cairo_ft_scaled_font_get_unscaled_font (scaled_font_subset->scaled_font);
- status = _cairo_type1_font_subset_create (unscaled_font, &font);
+ status = _cairo_type1_font_subset_create (unscaled_font, &font, hex_encode);
if (status)
return status;
@@ -1079,4 +1081,3 @@ _cairo_type1_subset_fini (cairo_type1_su
free (subset->widths);
free (subset->data);
}
-
More information about the cairo-commit
mailing list