[cairo-commit] 2 commits - src/cairo-scaled-font-subsets.c src/cairo-win32-font.c

Adrian Johnson ajohnson at kemper.freedesktop.org
Fri Feb 23 04:48:32 PST 2007


 src/cairo-scaled-font-subsets.c |    9 +++++----
 src/cairo-win32-font.c          |    6 ++----
 2 files changed, 7 insertions(+), 8 deletions(-)

New commits:
diff-tree a1e5b91588a4f51c03487b480f13c100d07f64f8 (from 27312591fe7ce14f65aac88ee7206ddcf3cbd0b1)
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Fri Feb 23 22:55:29 2007 +1030

    Subsetting: Add check for malloc() error

diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c
index 838e757..d98cba2 100644
--- a/src/cairo-scaled-font-subsets.c
+++ b/src/cairo-scaled-font-subsets.c
@@ -341,11 +341,12 @@ _cairo_sub_font_collect (void *entry, vo
         /* No need to check for out of memory here. If to_unicode is NULL, the PDF
          * surface does not emit an ToUnicode stream */
         subset.to_unicode = malloc (collection->num_glyphs*sizeof(unsigned long));
-        for (j = 0; j < collection->num_glyphs; j++) {
-            /* default unicode character required when mapping fails */
-            subset.to_unicode[j] = 0xfffd;
+        if (subset.to_unicode) {
+            for (j = 0; j < collection->num_glyphs; j++) {
+                /* default unicode character required when mapping fails */
+                subset.to_unicode[j] = 0xfffd;
+            }
         }
-
         (collection->font_subset_callback) (&subset,
 					    collection->font_subset_callback_closure);
 
diff-tree 27312591fe7ce14f65aac88ee7206ddcf3cbd0b1 (from 3b168e45510e02caf54e4b3cd0df76df6420d304)
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Fri Feb 23 22:14:42 2007 +1030

    Win32: Fix _cairo_win32_scaled_font_map_glyphs_to_unicode return type

diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
index e1f5e2c..42a55b0 100644
--- a/src/cairo-win32-font.c
+++ b/src/cairo-win32-font.c
@@ -1281,7 +1281,7 @@ _cairo_win32_scaled_font_load_truetype_t
     return status;
 }
 
-static cairo_int_status_t
+static void
 _cairo_win32_scaled_font_map_glyphs_to_unicode (void *abstract_font,
                                                       cairo_scaled_font_subset_t *font_subset)
 {
@@ -1289,12 +1289,10 @@ _cairo_win32_scaled_font_map_glyphs_to_u
     unsigned int i;
 
     if (scaled_font->glyph_indexing)
-        return CAIRO_INT_STATUS_UNSUPPORTED;
+        return;
 
     for (i = 0; i < font_subset->num_glyphs; i++)
         font_subset->to_unicode[i] = font_subset->glyphs[i];
-
-    return CAIRO_STATUS_SUCCESS;
 }
 
 static void


More information about the cairo-commit mailing list