[cairo-commit] 3 commits - src/cairo-cff-subset.c src/cairo-surface.c src/cairo-truetype-subset.c

Adrian Johnson ajohnson at kemper.freedesktop.org
Wed May 16 20:16:21 PDT 2007


 src/cairo-cff-subset.c      |    7 +++++++
 src/cairo-surface.c         |    4 +---
 src/cairo-truetype-subset.c |   34 +---------------------------------
 3 files changed, 9 insertions(+), 36 deletions(-)

New commits:
diff-tree 6a42ddf0f9e9e4b8dc5fa6a98ef4448f1c149789 (from 67e752f75fdc561aca419f798a1650feb22e59a4)
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Thu May 17 12:45:22 2007 +0930

    TrueType Subsetting: Remove post table
    
    The post table is not used now that TrueType fonts are embedded
    in PDF as CID fonts.

diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index 804eaa8..7f168a5 100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -712,37 +712,6 @@ cairo_truetype_font_write_maxp_table (ca
     return font->status;
 }
 
-static cairo_status_t
-cairo_truetype_font_write_post_table (cairo_truetype_font_t *font,
-				      unsigned long          tag)
-{
-    char buf[10];
-    int n;
-    unsigned i;
-
-    cairo_truetype_font_write_be32 (font, 0x00020000);
-    cairo_truetype_font_write_be32 (font, 0);
-    cairo_truetype_font_write_be16 (font, 0);
-    cairo_truetype_font_write_be16 (font, 1);
-    cairo_truetype_font_write_be32 (font, 0);
-    cairo_truetype_font_write_be32 (font, 0);
-    cairo_truetype_font_write_be32 (font, 0);
-    cairo_truetype_font_write_be32 (font, 0);
-    cairo_truetype_font_write_be32 (font, 0);
-    cairo_truetype_font_write_be16 (font, font->base.num_glyphs);
-    cairo_truetype_font_write_be16 (font, 0);
-    for (i = 1; i < font->base.num_glyphs; i++)
-        cairo_truetype_font_write_be16 (font, i + 257);
-
-    for (i = 1; i < font->base.num_glyphs; i++) {
-        n = snprintf(buf + 1, 9, "g%d", i - 1);
-        buf[0] = n;
-        cairo_truetype_font_write (font, buf, n + 1);
-    }
-
-    return font->status;
-}
-
 typedef struct table table_t;
 struct table {
     unsigned long tag;
@@ -769,8 +738,7 @@ static const table_t truetype_tables[] =
     { TT_TAG_loca, cairo_truetype_font_write_loca_table,     7 },
     { TT_TAG_maxp, cairo_truetype_font_write_maxp_table,     8 },
     { TT_TAG_name, cairo_truetype_font_write_generic_table,  9 },
-    { TT_TAG_post, cairo_truetype_font_write_post_table,    10 },
-    { TT_TAG_prep, cairo_truetype_font_write_generic_table, 11 },
+    { TT_TAG_prep, cairo_truetype_font_write_generic_table, 10 },
 };
 
 static cairo_status_t
diff-tree 67e752f75fdc561aca419f798a1650feb22e59a4 (from 99a6983017e1cd27f8a598487f8a72cfa6d411f1)
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Thu May 17 11:48:25 2007 +0930

    CFF Subsetting: Filter out Unique ID from subset
    
    The subsetted font is not the same as the original font so it should not
    have the same XUID and UniqueID.

diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c
index a448e37..2adc709 100644
--- a/src/cairo-cff-subset.c
+++ b/src/cairo-cff-subset.c
@@ -58,8 +58,10 @@
 #define POSTSCRIPT_OP    0x0c15
 #define PRIVATE_OP       0x0012
 #define ROS_OP           0x0c1e
+#define UNIQUEID_OP      0x000d
 #define VERSION_OP       0x0000
 #define WEIGHT_OP        0x0004
+#define XUID_OP          0x000e
 
 #define NUM_STD_STRINGS 391
 
@@ -894,6 +896,11 @@ cairo_cff_font_read_top_dict (cairo_cff_
     cff_dict_remove (font->top_dict, ENCODING_OP);
     cff_dict_remove (font->top_dict, PRIVATE_OP);
 
+    /* Remove the unique identifier operators as the subsetted font is
+     * not the same is the original font. */
+    cff_dict_remove (font->top_dict, UNIQUEID_OP);
+    cff_dict_remove (font->top_dict, XUID_OP);
+
 fail:
     cff_index_fini (&index);
 
diff-tree 99a6983017e1cd27f8a598487f8a72cfa6d411f1 (from c5ae0f1232e8cef860bc1fc0b449ddf9d9063d22)
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Thu May 17 10:17:09 2007 +0930

    Ensure surface backend finish() is never called more than once.
    
    Previously if the backend finish() function returned an error status,
    surface->finished was not set true. This would result in the backend
    finish() function being called twice which in the case of the PostScript
    backend caused a seg fault.

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 680ff0c..d7ef33f 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -502,10 +502,8 @@ cairo_surface_finish (cairo_surface_t *s
     }
 
     status = surface->backend->finish (surface);
-    if (status) {
+    if (status)
 	_cairo_surface_set_error (surface, status);
-	return;
-    }
 
     surface->finished = TRUE;
 }


More information about the cairo-commit mailing list