[API] Make hb_font_create() take a face and reference it
authorBehdad Esfahbod <behdad@behdad.org>
Tue, 3 May 2011 00:46:32 +0000 (20:46 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Tue, 3 May 2011 00:47:23 +0000 (20:47 -0400)
15 files changed:
src/hb-font-private.hh
src/hb-font.cc
src/hb-font.h
src/hb-ft.cc
src/hb-ot-layout-gdef-private.hh
src/hb-ot-layout-gpos-private.hh
src/hb-ot-layout.cc
src/hb-ot-layout.h
src/hb-ot-map-private.hh
src/hb-ot-shape.cc
src/hb-ot-shape.h
src/hb-shape.cc
src/hb-shape.h
src/hb-view.cc
test/test-object.c

index b028d5f..9e1ee51 100644 (file)
@@ -83,6 +83,8 @@ struct _hb_face_t {
 struct _hb_font_t {
   hb_object_header_t header;
 
+  hb_face_t *face;
+
   unsigned int x_scale;
   unsigned int y_scale;
 
index 2de3950..1242375 100644 (file)
@@ -43,7 +43,6 @@ HB_BEGIN_DECLS
 
 static hb_codepoint_t
 hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED,
-                      hb_face_t *face HB_UNUSED,
                       const void *user_data HB_UNUSED,
                       hb_codepoint_t unicode HB_UNUSED,
                       hb_codepoint_t variation_selector HB_UNUSED)
@@ -51,7 +50,6 @@ hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED,
 
 static void
 hb_font_get_glyph_advance_nil (hb_font_t *font HB_UNUSED,
-                              hb_face_t *face HB_UNUSED,
                               const void *user_data HB_UNUSED,
                               hb_codepoint_t glyph HB_UNUSED,
                               hb_position_t *x_advance HB_UNUSED,
@@ -60,7 +58,6 @@ hb_font_get_glyph_advance_nil (hb_font_t *font HB_UNUSED,
 
 static void
 hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
-                              hb_face_t *face HB_UNUSED,
                               const void *user_data HB_UNUSED,
                               hb_codepoint_t glyph HB_UNUSED,
                               hb_glyph_extents_t *extents HB_UNUSED)
@@ -68,7 +65,6 @@ hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
 
 static hb_bool_t
 hb_font_get_contour_point_nil (hb_font_t *font HB_UNUSED,
-                              hb_face_t *face HB_UNUSED,
                               const void *user_data HB_UNUSED,
                               unsigned int point_index HB_UNUSED,
                               hb_codepoint_t glyph HB_UNUSED,
@@ -78,7 +74,6 @@ hb_font_get_contour_point_nil (hb_font_t *font HB_UNUSED,
 
 static hb_position_t
 hb_font_get_kerning_nil (hb_font_t *font HB_UNUSED,
-                        hb_face_t *face HB_UNUSED,
                         const void *user_data HB_UNUSED,
                         hb_codepoint_t first_glyph HB_UNUSED,
                         hb_codepoint_t second_glyph HB_UNUSED)
@@ -241,48 +236,48 @@ hb_font_funcs_get_kerning_func (hb_font_funcs_t *ffuncs)
 
 
 hb_codepoint_t
-hb_font_get_glyph (hb_font_t *font, hb_face_t *face,
+hb_font_get_glyph (hb_font_t *font,
                   hb_codepoint_t unicode, hb_codepoint_t variation_selector)
 {
-  return font->klass->v.get_glyph (font, face, font->user_data,
+  return font->klass->v.get_glyph (font, font->user_data,
                                   unicode, variation_selector);
 }
 
 void
-hb_font_get_glyph_advance (hb_font_t *font, hb_face_t *face,
+hb_font_get_glyph_advance (hb_font_t *font,
                           hb_codepoint_t glyph,
                           hb_position_t *x_advance, hb_position_t *y_advance)
 {
   *x_advance = *y_advance = 0;
-  return font->klass->v.get_glyph_advance (font, face, font->user_data,
+  return font->klass->v.get_glyph_advance (font, font->user_data,
                                           glyph, x_advance, y_advance);
 }
 
 void
-hb_font_get_glyph_extents (hb_font_t *font, hb_face_t *face,
+hb_font_get_glyph_extents (hb_font_t *font,
                           hb_codepoint_t glyph, hb_glyph_extents_t *extents)
 {
   memset (extents, 0, sizeof (*extents));
-  return font->klass->v.get_glyph_extents (font, face, font->user_data,
+  return font->klass->v.get_glyph_extents (font, font->user_data,
                                           glyph, extents);
 }
 
 hb_bool_t
-hb_font_get_contour_point (hb_font_t *font, hb_face_t *face,
+hb_font_get_contour_point (hb_font_t *font,
                           unsigned int point_index,
                           hb_codepoint_t glyph, hb_position_t *x, hb_position_t *y)
 {
   *x = 0; *y = 0;
-  return font->klass->v.get_contour_point (font, face, font->user_data,
+  return font->klass->v.get_contour_point (font, font->user_data,
                                           point_index,
                                           glyph, x, y);
 }
 
 hb_position_t
-hb_font_get_kerning (hb_font_t *font, hb_face_t *face,
+hb_font_get_kerning (hb_font_t *font,
                     hb_codepoint_t first_glyph, hb_codepoint_t second_glyph)
 {
-  return font->klass->v.get_kerning (font, face, font->user_data,
+  return font->klass->v.get_kerning (font, font->user_data,
                                     first_glyph, second_glyph);
 }
 
@@ -462,6 +457,8 @@ hb_face_get_upem (hb_face_t *face)
 static hb_font_t _hb_font_nil = {
   HB_OBJECT_HEADER_STATIC,
 
+  &_hb_face_nil,
+
   0, /* x_scale */
   0, /* y_scale */
 
@@ -474,13 +471,18 @@ static hb_font_t _hb_font_nil = {
 };
 
 hb_font_t *
-hb_font_create (void)
+hb_font_create (hb_face_t *face)
 {
   hb_font_t *font;
 
+  if (unlikely (!face))
+    face = &_hb_face_nil;
+  if (unlikely (hb_object_is_inert (face)))
+    return &_hb_font_nil;
   if (!(font = hb_object_create<hb_font_t> ()))
     return &_hb_font_nil;
 
+  font->face = hb_face_reference (face);
   font->klass = &_hb_font_funcs_nil;
 
   return font;
@@ -497,6 +499,7 @@ hb_font_destroy (hb_font_t *font)
 {
   if (!hb_object_destroy (font)) return;
 
+  hb_face_destroy (font->face);
   hb_font_funcs_destroy (font->klass);
   if (font->destroy)
     font->destroy (font->user_data);
@@ -521,6 +524,13 @@ hb_font_get_user_data (hb_font_t          *font,
 }
 
 
+hb_face_t *
+hb_font_get_face (hb_font_t *font)
+{
+  return font->face;
+}
+
+
 void
 hb_font_set_funcs (hb_font_t         *font,
                   hb_font_funcs_t   *klass,
index c26ab01..e8e344d 100644 (file)
@@ -121,18 +121,18 @@ typedef struct _hb_glyph_extents_t
     hb_position_t height;
 } hb_glyph_extents_t;
 
-typedef hb_codepoint_t (*hb_font_get_glyph_func_t) (hb_font_t *font, hb_face_t *face, const void *user_data,
+typedef hb_codepoint_t (*hb_font_get_glyph_func_t) (hb_font_t *font, const void *user_data,
                                                    hb_codepoint_t unicode, hb_codepoint_t variation_selector);
-typedef void (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, hb_face_t *face, const void *user_data,
+typedef void (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, const void *user_data,
                                                  hb_codepoint_t glyph,
                                                  hb_position_t *x_advance, hb_position_t *y_advance);
-typedef void (*hb_font_get_glyph_extents_func_t) (hb_font_t *font, hb_face_t *face, const void *user_data,
+typedef void (*hb_font_get_glyph_extents_func_t) (hb_font_t *font, const void *user_data,
                                                  hb_codepoint_t glyph,
                                                  hb_glyph_extents_t *extents);
-typedef hb_bool_t (*hb_font_get_contour_point_func_t) (hb_font_t *font, hb_face_t *face, const void *user_data,
+typedef hb_bool_t (*hb_font_get_contour_point_func_t) (hb_font_t *font, const void *user_data,
                                                       unsigned int point_index, hb_codepoint_t glyph,
                                                       hb_position_t *x, hb_position_t *y);
-typedef hb_position_t (*hb_font_get_kerning_func_t) (hb_font_t *font, hb_face_t *face, const void *user_data,
+typedef hb_position_t (*hb_font_get_kerning_func_t) (hb_font_t *font, const void *user_data,
                                                     hb_codepoint_t first_glyph, hb_codepoint_t second_glyph);
 
 
@@ -176,26 +176,26 @@ hb_font_funcs_get_kerning_func (hb_font_funcs_t *ffuncs);
 
 
 hb_codepoint_t
-hb_font_get_glyph (hb_font_t *font, hb_face_t *face,
+hb_font_get_glyph (hb_font_t *font,
                   hb_codepoint_t unicode, hb_codepoint_t variation_selector);
 
 void
-hb_font_get_glyph_advance (hb_font_t *font, hb_face_t *face,
+hb_font_get_glyph_advance (hb_font_t *font,
                           hb_codepoint_t glyph,
                           hb_position_t *x_advance, hb_position_t *y_advance);
 
 void
-hb_font_get_glyph_extents (hb_font_t *font, hb_face_t *face,
+hb_font_get_glyph_extents (hb_font_t *font,
                           hb_codepoint_t glyph,
                           hb_glyph_extents_t *extents);
 
 hb_bool_t
-hb_font_get_contour_point (hb_font_t *font, hb_face_t *face,
+hb_font_get_contour_point (hb_font_t *font,
                           unsigned int point_index, hb_codepoint_t glyph,
                           hb_position_t *x, hb_position_t *y);
 
 hb_position_t
-hb_font_get_kerning (hb_font_t *font, hb_face_t *face,
+hb_font_get_kerning (hb_font_t *font,
                     hb_codepoint_t first_glyph, hb_codepoint_t second_glyph);
 
 
@@ -206,7 +206,7 @@ hb_font_get_kerning (hb_font_t *font, hb_face_t *face,
 /* Fonts are very light-weight objects */
 
 hb_font_t *
-hb_font_create (void);
+hb_font_create (hb_face_t *face);
 
 hb_font_t *
 hb_font_reference (hb_font_t *font);
@@ -226,6 +226,10 @@ hb_font_get_user_data (hb_font_t          *font,
                       hb_user_data_key_t *key);
 
 
+hb_face_t *
+hb_font_get_face (hb_font_t *font);
+
+
 void
 hb_font_set_funcs (hb_font_t         *font,
                   hb_font_funcs_t   *klass,
index 4afcd6c..e4e77f5 100644 (file)
@@ -38,7 +38,6 @@ HB_BEGIN_DECLS
 
 static hb_codepoint_t
 hb_ft_get_glyph (hb_font_t *font HB_UNUSED,
-                hb_face_t *face HB_UNUSED,
                 const void *user_data,
                 hb_codepoint_t unicode,
                 hb_codepoint_t variation_selector)
@@ -58,7 +57,6 @@ hb_ft_get_glyph (hb_font_t *font HB_UNUSED,
 
 static void
 hb_ft_get_glyph_advance (hb_font_t *font HB_UNUSED,
-                        hb_face_t *face HB_UNUSED,
                         const void *user_data,
                         hb_codepoint_t glyph,
                         hb_position_t *x_advance,
@@ -78,7 +76,6 @@ hb_ft_get_glyph_advance (hb_font_t *font HB_UNUSED,
 
 static void
 hb_ft_get_glyph_extents (hb_font_t *font HB_UNUSED,
-                        hb_face_t *face HB_UNUSED,
                         const void *user_data,
                         hb_codepoint_t glyph,
                         hb_glyph_extents_t *extents)
@@ -100,7 +97,6 @@ hb_ft_get_glyph_extents (hb_font_t *font HB_UNUSED,
 
 static hb_bool_t
 hb_ft_get_contour_point (hb_font_t *font HB_UNUSED,
-                        hb_face_t *face HB_UNUSED,
                         const void *user_data,
                         unsigned int point_index,
                         hb_codepoint_t glyph,
@@ -129,7 +125,6 @@ hb_ft_get_contour_point (hb_font_t *font HB_UNUSED,
 
 static hb_position_t
 hb_ft_get_kerning (hb_font_t *font HB_UNUSED,
-                  hb_face_t *face HB_UNUSED,
                   const void *user_data,
                   hb_codepoint_t first_glyph,
                   hb_codepoint_t second_glyph)
@@ -244,7 +239,7 @@ hb_ft_font_create (FT_Face           ft_face,
 {
   hb_font_t *font;
 
-  font = hb_font_create ();
+  font = hb_font_create (hb_ft_face_create_cached (ft_face));
   hb_font_set_funcs (font,
                     hb_ft_get_font_funcs (),
                     ft_face, destroy);
index 4d4ad93..010f819 100644 (file)
@@ -121,7 +121,7 @@ struct CaretValueFormat2
   inline int get_caret_value (hb_ot_layout_context_t *c, hb_direction_t direction, hb_codepoint_t glyph_id) const
   {
     hb_position_t x, y;
-    if (hb_font_get_contour_point (c->font, c->face, caretValuePoint, glyph_id, &x, &y))
+    if (hb_font_get_contour_point (c->font, caretValuePoint, glyph_id, &x, &y))
       return HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y;
     else
       return 0;
index 9d1f3be..1e277ce 100644 (file)
@@ -243,7 +243,7 @@ struct AnchorFormat2
       hb_bool_t ret = false;
 
       if (x_ppem || y_ppem)
-       ret = hb_font_get_contour_point (layout->font, layout->face, anchorPoint, glyph_id, &cx, &cy);
+       ret = hb_font_get_contour_point (layout->font, anchorPoint, glyph_id, &cx, &cy);
       *x = x_ppem && ret ? cx : layout->scale_x (xCoordinate);
       *y = y_ppem && ret ? cy : layout->scale_y (yCoordinate);
   }
index e79f945..03a9455 100644 (file)
@@ -193,7 +193,6 @@ hb_ot_layout_get_attach_points (hb_face_t      *face,
 
 unsigned int
 hb_ot_layout_get_ligature_carets (hb_font_t      *font,
-                                 hb_face_t      *face,
                                  hb_direction_t  direction,
                                  hb_codepoint_t  glyph,
                                  unsigned int    start_offset,
@@ -202,8 +201,8 @@ hb_ot_layout_get_ligature_carets (hb_font_t      *font,
 {
   hb_ot_layout_context_t c;
   c.font = font;
-  c.face = face;
-  return _get_gdef (face).get_lig_carets (&c, direction, glyph, start_offset, caret_count, caret_array);
+  c.face = font->face;
+  return _get_gdef (c.face).get_lig_carets (&c, direction, glyph, start_offset, caret_count, caret_array);
 }
 
 /*
@@ -470,15 +469,14 @@ hb_ot_layout_position_start (hb_buffer_t  *buffer)
 
 hb_bool_t
 hb_ot_layout_position_lookup   (hb_font_t    *font,
-                               hb_face_t    *face,
                                hb_buffer_t  *buffer,
                                unsigned int  lookup_index,
                                hb_mask_t     mask)
 {
   hb_ot_layout_context_t c;
   c.font = font;
-  c.face = face;
-  return _get_gpos (face).position_lookup (&c, buffer, lookup_index, mask);
+  c.face = font->face;
+  return _get_gpos (c.face).position_lookup (&c, buffer, lookup_index, mask);
 }
 
 void
index 9e58510..a6dbc61 100644 (file)
@@ -59,7 +59,6 @@ hb_ot_layout_get_attach_points (hb_face_t      *face,
 /* Ligature caret positions */
 unsigned int
 hb_ot_layout_get_ligature_carets (hb_font_t      *font,
-                                 hb_face_t      *face,
                                  hb_direction_t  direction,
                                  hb_codepoint_t  glyph,
                                  unsigned int    start_offset,
@@ -185,7 +184,6 @@ hb_ot_layout_position_start (hb_buffer_t  *buffer);
 
 hb_bool_t
 hb_ot_layout_position_lookup (hb_font_t    *font,
-                             hb_face_t    *face,
                              hb_buffer_t  *buffer,
                              unsigned int  lookup_index,
                              hb_mask_t     mask);
index 6296187..e0fe51b 100644 (file)
@@ -121,7 +121,7 @@ struct hb_ot_map_t {
 
   inline void position (hb_font_t *font, hb_face_t *face, hb_buffer_t *buffer) const {
     for (unsigned int i = 0; i < lookup_count[1]; i++)
-      hb_ot_layout_position_lookup (font, face, buffer, lookup_maps[1][i].index, lookup_maps[1][i].mask);
+      hb_ot_layout_position_lookup (font, buffer, lookup_maps[1][i].index, lookup_maps[1][i].mask);
   }
 
   private:
index d6bfd65..e01f372 100644 (file)
@@ -29,6 +29,8 @@
 #include "hb-ot-shape-private.hh"
 #include "hb-ot-shape-complex-private.hh"
 
+#include "hb-font-private.hh"
+
 HB_BEGIN_DECLS
 
 
@@ -209,7 +211,6 @@ hb_mirror_chars (hb_ot_shape_context_t *c)
 
 static void
 hb_map_glyphs (hb_font_t    *font,
-              hb_face_t    *face,
               hb_buffer_t  *buffer)
 {
   if (unlikely (!buffer->len))
@@ -219,21 +220,21 @@ hb_map_glyphs (hb_font_t    *font,
   unsigned int count = buffer->len - 1;
   for (buffer->i = 0; buffer->i < count;) {
     if (unlikely (is_variation_selector (buffer->info[buffer->i + 1].codepoint))) {
-      buffer->replace_glyph (hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, buffer->info[buffer->i + 1].codepoint));
+      buffer->replace_glyph (hb_font_get_glyph (font, buffer->info[buffer->i].codepoint, buffer->info[buffer->i + 1].codepoint));
       buffer->i++;
     } else {
-      buffer->replace_glyph (hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, 0));
+      buffer->replace_glyph (hb_font_get_glyph (font, buffer->info[buffer->i].codepoint, 0));
     }
   }
   if (likely (buffer->i < buffer->len))
-    buffer->replace_glyph (hb_font_get_glyph (font, face, buffer->info[buffer->i].codepoint, 0));
+    buffer->replace_glyph (hb_font_get_glyph (font, buffer->info[buffer->i].codepoint, 0));
   buffer->swap ();
 }
 
 static void
 hb_substitute_default (hb_ot_shape_context_t *c)
 {
-  hb_map_glyphs (c->font, c->face, c->buffer);
+  hb_map_glyphs (c->font, c->buffer);
 }
 
 static void
@@ -252,7 +253,7 @@ hb_position_default (hb_ot_shape_context_t *c)
 
   unsigned int count = c->buffer->len;
   for (unsigned int i = 0; i < count; i++) {
-    hb_font_get_glyph_advance (c->font, c->face, c->buffer->info[i].codepoint,
+    hb_font_get_glyph_advance (c->font, c->buffer->info[i].codepoint,
                               &c->buffer->pos[i].x_advance,
                               &c->buffer->pos[i].y_advance);
   }
@@ -271,7 +272,7 @@ hb_truetype_kern (hb_ot_shape_context_t *c)
   unsigned int count = c->buffer->len;
   for (unsigned int i = 1; i < count; i++) {
     hb_position_t kern, kern1, kern2;
-    kern = hb_font_get_kerning (c->font, c->face, c->buffer->info[i - 1].codepoint, c->buffer->info[i].codepoint);
+    kern = hb_font_get_kerning (c->font, c->buffer->info[i - 1].codepoint, c->buffer->info[i].codepoint);
     kern1 = kern >> 1;
     kern2 = kern - kern1;
     c->buffer->pos[i - 1].x_advance += kern1;
@@ -355,26 +356,24 @@ hb_ot_shape_plan_internal (hb_ot_shape_plan_t       *plan,
 void
 hb_ot_shape_execute (hb_ot_shape_plan_t *plan,
                     hb_font_t          *font,
-                    hb_face_t          *face,
                     hb_buffer_t        *buffer,
                     const hb_feature_t *user_features,
                     unsigned int        num_user_features)
 {
-  hb_ot_shape_context_t c = {plan, font, face, buffer, user_features, num_user_features};
+  hb_ot_shape_context_t c = {plan, font, font->face, buffer, user_features, num_user_features};
   hb_ot_shape_execute_internal (&c);
 }
 
 void
 hb_ot_shape (hb_font_t          *font,
-            hb_face_t          *face,
             hb_buffer_t        *buffer,
             const hb_feature_t *features,
             unsigned int        num_features)
 {
   hb_ot_shape_plan_t plan;
 
-  hb_ot_shape_plan_internal (&plan, face, &buffer->props, features, num_features);
-  hb_ot_shape_execute (&plan, font, face, buffer, features, num_features);
+  hb_ot_shape_plan_internal (&plan, font->face, &buffer->props, features, num_features);
+  hb_ot_shape_execute (&plan, font, buffer, features, num_features);
 }
 
 
index d6a3dc7..70a8172 100644 (file)
@@ -35,7 +35,6 @@ HB_BEGIN_DECLS
 
 void
 hb_ot_shape (hb_font_t          *font,
-            hb_face_t          *face,
             hb_buffer_t        *buffer,
             const hb_feature_t *features,
             unsigned int        num_features);
index 94b9118..cc711ea 100644 (file)
@@ -41,29 +41,15 @@ HB_BEGIN_DECLS
 
 static void
 hb_shape_internal (hb_font_t          *font,
-                  hb_face_t          *face,
                   hb_buffer_t        *buffer,
                   const hb_feature_t *features,
                   unsigned int        num_features)
 {
-#if 0 && defined(HAVE_GRAPHITE)
-  hb_blob_t *silf_blob;
-  silf_blob = hb_face_reference_table (face, HB_GRAPHITE_TAG_Silf);
-  if (hb_blob_get_length(silf_blob))
-  {
-    hb_graphite_shape(font, face, buffer, features, num_features);
-    hb_blob_destroy(silf_blob);
-    return;
-  }
-  hb_blob_destroy(silf_blob);
-#endif
-
-  hb_ot_shape (font, face, buffer, features, num_features);
+  hb_ot_shape (font, buffer, features, num_features);
 }
 
 void
 hb_shape (hb_font_t          *font,
-         hb_face_t          *face,
          hb_buffer_t        *buffer,
          const hb_feature_t *features,
          unsigned int        num_features)
@@ -98,7 +84,7 @@ hb_shape (hb_font_t          *font,
     //buffer->props.language = hb_language_get_default ();
   }
 
-  hb_shape_internal (font, face, buffer, features, num_features);
+  hb_shape_internal (font, buffer, features, num_features);
 
   buffer->props = orig_props;
 }
index 2c6755a..39383af 100644 (file)
@@ -43,7 +43,6 @@ typedef struct _hb_feature_t {
 
 void
 hb_shape (hb_font_t          *font,
-         hb_face_t          *face,
          hb_buffer_t        *buffer,
          const hb_feature_t *features,
          unsigned int        num_features);
index 7d936dd..fac4109 100644 (file)
@@ -344,7 +344,6 @@ _hb_cr_text_glyphs (cairo_t *cr,
 {
   cairo_scaled_font_t *scaled_font = cairo_get_scaled_font (cr);
   FT_Face ft_face = cairo_ft_scaled_font_lock_face (scaled_font);
-  hb_face_t *hb_face = hb_ft_face_create_cached (ft_face);
   hb_font_t *hb_font = hb_ft_font_create (ft_face, NULL);
   hb_buffer_t *hb_buffer;
   cairo_glyph_t *cairo_glyphs;
@@ -366,7 +365,7 @@ _hb_cr_text_glyphs (cairo_t *cr,
     len = strlen (text);
   hb_buffer_add_utf8 (hb_buffer, text, len, 0, len);
 
-  hb_shape (hb_font, hb_face, hb_buffer, features, num_features);
+  hb_shape (hb_font, hb_buffer, features, num_features);
 
   num_glyphs = hb_buffer_get_length (hb_buffer);
   hb_glyph = hb_buffer_get_glyph_infos (hb_buffer, NULL);
@@ -386,7 +385,6 @@ _hb_cr_text_glyphs (cairo_t *cr,
   cairo_glyphs[i].x = x * (1./64);
   hb_buffer_destroy (hb_buffer);
   hb_font_destroy (hb_font);
-  hb_face_destroy (hb_face);
   cairo_ft_scaled_font_unlock_face (scaled_font);
 
   if (pnum_glyphs)
index 0fbabd8..297aa29 100644 (file)
@@ -74,12 +74,15 @@ create_face_inert (void)
 static void *
 create_font (void)
 {
-  return hb_font_create ();
+  hb_face_t *face = (hb_face_t *) create_face ();
+  hb_font_t *font = hb_font_create (face);
+  hb_face_destroy (face);
+  return font;
 }
 static void *
 create_font_inert (void)
 {
-  return NULL;
+  return hb_font_create (create_face_inert ());
 }
 
 static void *