[cairo-commit] src/cairo-truetype-subset.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Aug 8 04:30:55 PDT 2006


 src/cairo-truetype-subset.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

New commits:
diff-tree 519bd3d3e972a88adea5bcf6ea7f582fe69c305c (from 501e5cc8839e104ec21a5aba61cff3580d34f26b)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Aug 8 07:24:01 2006 -0400

    [TrueType] Fix leaks.

diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index 6753b23..66b7cdf 100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -133,6 +133,15 @@ _cairo_truetype_font_create (cairo_scale
     if (!backend->load_truetype_table)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
+    /* FIXME: We should either support subsetting vertical fonts, or fail on
+     * vertical.  Currently font_options_t doesn't have vertical flag, but
+     * it should be added in the future.  For now, the freetype backend
+     * returns UNSUPPORTED in load_truetype_table if the font is vertical.
+     *
+     *  if (cairo_font_options_get_vertical_layout (scaled_font_subset->scaled_font))
+     *   return CAIRO_INT_STATUS_UNSUPPORTED;
+     */
+
     size = sizeof (tt_head_t);
     if (backend->load_truetype_table (scaled_font_subset->scaled_font,
                                       TT_TAG_head, 0, (unsigned char *) &head,
@@ -163,13 +172,6 @@ _cairo_truetype_font_create (cairo_scale
                                  TT_TAG_name, 0, (unsigned char *) name,
                                  &size);
 
-    /* FIXME: Figure out how to determine if the font is vertical without
-     *  requiring freetype.
-     *
-     *  if (_cairo_ft_scaled_font_is_vertical (scaled_font_subset->scaled_font))
-     *   return CAIRO_INT_STATUS_UNSUPPORTED;
-     */
-
     font = malloc (sizeof (cairo_truetype_font_t));
     if (font == NULL)
 	goto fail0;
@@ -222,6 +224,9 @@ _cairo_truetype_font_create (cairo_scale
         }
     }
 
+    free (name);
+    name = NULL;
+
     if (font->base.base_font == NULL) {
         font->base.base_font = malloc (30);
         if (font->base.base_font == NULL)
@@ -265,7 +270,8 @@ _cairo_truetype_font_create (cairo_scale
  fail1:
     free (font);
  fail0:
-    free (name);
+    if (name)
+	free (name);
     return status;
 }
 


More information about the cairo-commit mailing list