Bunch of independent changes (ouch)
authorBehdad Esfahbod <behdad@behdad.org>
Fri, 16 Nov 2012 02:39:46 +0000 (18:39 -0800)
committerBehdad Esfahbod <behdad@behdad.org>
Fri, 16 Nov 2012 02:48:10 +0000 (18:48 -0800)
API additions:

hb_segment_properties_t
HB_SEGMENT_PROPERTIES_DEFAULT
hb_segment_properties_equal()
hb_segment_properties_hash()

hb_buffer_set_segment_properties()
hb_buffer_get_segment_properties()

hb_ot_layout_glyph_class_t

hb_shape_plan_t
hb_shape_plan_create()
hb_shape_plan_create_cached()
hb_shape_plan_get_empty()
hb_shape_plan_reference()
hb_shape_plan_destroy()
hb_shape_plan_set_user_data()
hb_shape_plan_get_user_data()
hb_shape_plan_execute()

hb_ot_shape_plan_collect_lookups()

API changes:

Rename hb_ot_layout_feature_get_lookup_indexes() to
hb_ot_layout_feature_get_lookups().

New header file:

hb-shape-plan.h

And a bunch of prototyped but not implemented stuff.  Coming soon.
(Tests fail because of the prototypes right now.)

18 files changed:
src/Makefile.am
src/hb-buffer-private.hh
src/hb-buffer.cc
src/hb-buffer.h
src/hb-ot-layout-private.hh
src/hb-ot-layout.cc
src/hb-ot-layout.h
src/hb-ot-map-private.hh
src/hb-ot-map.cc
src/hb-ot-shape-private.hh
src/hb-ot-shape.cc
src/hb-ot.h
src/hb-shape-plan-private.hh
src/hb-shape-plan.cc
src/hb-shape-plan.h
src/hb-shaper-private.hh
src/hb-shaper.cc
src/hb.h

index aca8abf..bb7601e 100644 (file)
@@ -43,7 +43,6 @@ HBSOURCES =  \
        hb-shape.cc \
        hb-shape-plan-private.hh \
        hb-shape-plan.cc \
-       hb-shape-plan.h \
        hb-shaper-list.hh \
        hb-shaper-impl-private.hh \
        hb-shaper-private.hh \
@@ -62,6 +61,7 @@ HBHEADERS = \
        hb-font.h \
        hb-set.h \
        hb-shape.h \
+       hb-shape-plan.h \
        hb-unicode.h \
        hb-version.h \
        $(NULL)
index 6c1f3a3..80ca7ae 100644 (file)
 #include "hb-unicode-private.hh"
 
 
-
 ASSERT_STATIC (sizeof (hb_glyph_info_t) == 20);
 ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
 
 
 /*
- * hb_segment_properties_t
- */
-
-typedef struct hb_segment_properties_t {
-    hb_direction_t      direction;
-    hb_script_t         script;
-    hb_language_t       language;
-    ASSERT_POD ();
-} hb_segment_properties_t;
-
-#define _HB_BUFFER_PROPS_DEFAULT { HB_DIRECTION_INVALID, HB_SCRIPT_INVALID, HB_LANGUAGE_INVALID }
-
-static inline hb_bool_t
-hb_segment_properties_equal (const hb_segment_properties_t *a,
-                            const hb_segment_properties_t *b)
-{
-  return a->direction == b->direction &&
-        a->script    == b->script    &&
-        a->language  == b->language;
-}
-
-
-#if 0
-static inline unsigned int
-hb_segment_properties_hash (const hb_segment_properties_t *p)
-{
-  /* TODO improve */
-  return (unsigned int) p->direction +
-        (unsigned int) p->script +
-        (intptr_t) (p->language);
-}
-#endif
-
-
-
-/*
  * hb_buffer_t
  */
 
index ee5a888..5d38b3c 100644 (file)
 #define HB_DEBUG_BUFFER (HB_DEBUG+0)
 #endif
 
+
+hb_bool_t
+hb_segment_properties_equal (const hb_segment_properties_t *a,
+                            const hb_segment_properties_t *b)
+{
+  return a->direction == b->direction &&
+        a->script    == b->script    &&
+        a->language  == b->language  &&
+        a->reserved1 == b->reserved1 &&
+        a->reserved2 == b->reserved2;
+
+}
+
+unsigned int
+hb_segment_properties_hash (const hb_segment_properties_t *p)
+{
+  return (unsigned int) p->direction ^
+        (unsigned int) p->script ^
+        (intptr_t) (p->language);
+}
+
+
+
 /* Here is how the buffer works internally:
  *
  * There are two info pointers: info and out_info.  They always have
@@ -151,7 +174,7 @@ hb_buffer_t::clear (void)
   if (unlikely (hb_object_is_inert (this)))
     return;
 
-  hb_segment_properties_t default_props = _HB_BUFFER_PROPS_DEFAULT;
+  hb_segment_properties_t default_props = HB_SEGMENT_PROPERTIES_DEFAULT;
   props = default_props;
   flags = HB_BUFFER_FLAGS_DEFAULT;
 
@@ -589,7 +612,7 @@ hb_buffer_get_empty (void)
     HB_OBJECT_HEADER_STATIC,
 
     const_cast<hb_unicode_funcs_t *> (&_hb_unicode_funcs_nil),
-    _HB_BUFFER_PROPS_DEFAULT,
+    HB_SEGMENT_PROPERTIES_DEFAULT,
     HB_BUFFER_FLAGS_DEFAULT,
 
     HB_BUFFER_CONTENT_TYPE_INVALID,
@@ -726,6 +749,24 @@ hb_buffer_get_language (hb_buffer_t *buffer)
 }
 
 void
+hb_buffer_set_segment_properties (hb_buffer_t *buffer,
+                                 const hb_segment_properties_t *props)
+{
+  if (unlikely (hb_object_is_inert (buffer)))
+    return;
+
+  buffer->props = *props;
+}
+
+void
+hb_buffer_get_segment_properties (hb_buffer_t *buffer,
+                                 hb_segment_properties_t *props)
+{
+  *props = buffer->props;
+}
+
+
+void
 hb_buffer_set_flags (hb_buffer_t       *buffer,
                     hb_buffer_flags_t  flags)
 {
index cd574c3..255f005 100644 (file)
@@ -41,8 +41,6 @@
 HB_BEGIN_DECLS
 
 
-typedef struct hb_buffer_t hb_buffer_t;
-
 typedef struct hb_glyph_info_t {
   hb_codepoint_t codepoint;
   hb_mask_t      mask;
@@ -64,6 +62,36 @@ typedef struct hb_glyph_position_t {
 } hb_glyph_position_t;
 
 
+typedef struct hb_segment_properties_t {
+  hb_direction_t  direction;
+  hb_script_t     script;
+  hb_language_t   language;
+  /*< private >*/
+  void           *reserved1;
+  void           *reserved2;
+} hb_segment_properties_t;
+
+#define HB_SEGMENT_PROPERTIES_DEFAULT {HB_DIRECTION_INVALID, \
+                                      HB_SCRIPT_INVALID, \
+                                      HB_LANGUAGE_INVALID, \
+                                      NULL, \
+                                      NULL}
+
+hb_bool_t
+hb_segment_properties_equal (const hb_segment_properties_t *a,
+                            const hb_segment_properties_t *b);
+
+unsigned int
+hb_segment_properties_hash (const hb_segment_properties_t *p);
+
+
+
+/*
+ * hb_buffer_t
+ */
+
+typedef struct hb_buffer_t hb_buffer_t;
+
 hb_buffer_t *
 hb_buffer_create (void);
 
@@ -127,9 +155,21 @@ void
 hb_buffer_set_language (hb_buffer_t   *buffer,
                        hb_language_t  language);
 
+
 hb_language_t
 hb_buffer_get_language (hb_buffer_t *buffer);
 
+void
+hb_buffer_set_segment_properties (hb_buffer_t *buffer,
+                                 const hb_segment_properties_t *props);
+
+void
+hb_buffer_get_segment_properties (hb_buffer_t *buffer,
+                                 hb_segment_properties_t *props);
+
+void
+hb_buffer_guess_properties (hb_buffer_t *buffer);
+
 
 typedef enum {
   HB_BUFFER_FLAGS_DEFAULT                      = 0x00000000,
@@ -171,9 +211,6 @@ hb_buffer_reverse (hb_buffer_t *buffer);
 void
 hb_buffer_reverse_clusters (hb_buffer_t *buffer);
 
-void
-hb_buffer_guess_properties (hb_buffer_t *buffer);
-
 
 /* Filling the buffer in */
 
index 16b460d..055933f 100644 (file)
  * GDEF
  */
 
-typedef enum {
-  HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED        = 0x0001,
-  HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH  = 0x0002,
-  HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE    = 0x0004,
-  HB_OT_LAYOUT_GLYPH_CLASS_MARK                = 0x0008,
-  HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT   = 0x0010
-} hb_ot_layout_glyph_class_t;
-
 
 
 /*
index 0b85dc5..e57b765 100644 (file)
@@ -374,12 +374,12 @@ hb_ot_layout_language_find_feature (hb_face_t    *face,
 }
 
 unsigned int
-hb_ot_layout_feature_get_lookup_indexes (hb_face_t    *face,
-                                        hb_tag_t      table_tag,
-                                        unsigned int  feature_index,
-                                        unsigned int  start_offset,
-                                        unsigned int *lookup_count /* IN/OUT */,
-                                        unsigned int *lookup_indexes /* OUT */)
+hb_ot_layout_feature_get_lookups (hb_face_t    *face,
+                                 hb_tag_t      table_tag,
+                                 unsigned int  feature_index,
+                                 unsigned int  start_offset,
+                                 unsigned int *lookup_count /* IN/OUT */,
+                                 unsigned int *lookup_indexes /* OUT */)
 {
   const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
   const OT::Feature &f = g.get_feature (feature_index);
index ac086c9..3f6e5d9 100644 (file)
@@ -50,6 +50,27 @@ HB_BEGIN_DECLS
 hb_bool_t
 hb_ot_layout_has_glyph_classes (hb_face_t *face);
 
+typedef enum {
+  HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED        = 0x0001,
+  HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH  = 0x0002,
+  HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE    = 0x0004,
+  HB_OT_LAYOUT_GLYPH_CLASS_MARK                = 0x0008,
+  HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT   = 0x0010
+} hb_ot_layout_glyph_class_t;
+
+#ifdef HB_NOT_IMPLEMENTED
+hb_ot_layout_glyph_class_t
+hb_ot_layout_get_glyph_class (hb_face_t      *face,
+                             hb_codepoint_t  glyph);
+#endif
+
+#ifdef HB_NOT_IMPLEMENTED
+hb_ot_layout_get_glyphs_in_class (hb_face_t                  *face,
+                                 hb_ot_layout_glyph_class_t  klass,
+                                 hb_set_t                   *glyphs /* OUT */);
+#endif
+
+
 /* Not that useful.  Provides list of attach points for a glyph that a
  * client may want to cache */
 unsigned int
@@ -154,12 +175,64 @@ hb_ot_layout_language_find_feature (hb_face_t    *face,
                                    unsigned int *feature_index);
 
 unsigned int
-hb_ot_layout_feature_get_lookup_indexes (hb_face_t    *face,
+hb_ot_layout_feature_get_lookups (hb_face_t    *face,
+                                 hb_tag_t      table_tag,
+                                 unsigned int  feature_index,
+                                 unsigned int  start_offset,
+                                 unsigned int *lookup_count /* IN/OUT */,
+                                 unsigned int *lookup_indexes /* OUT */);
+
+#ifdef HB_NOT_IMPLEMENTED
+void
+hb_ot_layout_collect_lookups (hb_face_t      *face,
+                             hb_tag_t        table_tag,
+                             const hb_tag_t *scripts,
+                             const hb_tag_t *languages,
+                             const hb_tag_t *features,
+                             hb_set_t       *lookup_indexes /* OUT */);
+#endif
+
+void
+hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan,
+                                 hb_tag_t         table_tag,
+                                 hb_set_t        *lookup_indexes /* OUT */);
+
+#ifdef HB_NOT_IMPLEMENTED
+void
+hb_ot_layout_lookup_collect_glyphs (hb_face_t    *face,
+                                   hb_tag_t      table_tag,
+                                   unsigned int  lookup_index,
+                                   hb_set_t     *glyphs_before, /* OUT. May be NULL */
+                                   hb_set_t     *glyphs_input,  /* OUT. May be NULL */
+                                   hb_set_t     *glyphs_after,  /* OUT. May be NULL */
+                                   hb_set_t     *glyphs_output  /* OUT. May be NULL */);
+#endif
+
+#ifdef HB_NOT_IMPLEMENTED
+typedef struct
+{
+  const hb_codepoint_t *before,
+  unsigned int          before_length,
+  const hb_codepoint_t *input,
+  unsigned int          input_length,
+  const hb_codepoint_t *after,
+  unsigned int          after_length,
+} hb_ot_layout_glyph_sequence_t;
+
+typedef hb_bool_t
+(*hb_ot_layout_glyph_sequence_func_t) (hb_font_t    *font,
+                                      hb_tag_t      table_tag,
+                                      unsigned int  lookup_index,
+                                      const hb_ot_layout_glyph_sequence_t *sequence,
+                                      void         *user_data);
+
+void
+hb_ot_layout_lookup_enumerate_sequences (hb_face_t    *face,
                                         hb_tag_t      table_tag,
-                                        unsigned int  feature_index,
-                                        unsigned int  start_offset,
-                                        unsigned int *lookup_count /* IN/OUT */,
-                                        unsigned int *lookup_indexes /* OUT */);
+                                        unsigned int  lookup_index,
+                                        hb_ot_layout_glyph_sequence_func_t callback,
+                                        void         *user_data);
+#endif
 
 
 /*
@@ -179,7 +252,21 @@ hb_ot_layout_lookup_would_substitute (hb_face_t            *face,
 void
 hb_ot_layout_lookup_substitute_closure (hb_face_t    *face,
                                        unsigned int  lookup_index,
-                                       hb_set_t     *glyphs);
+                                       hb_set_t     *glyphs
+                                       /*TODO , hb_bool_t  inclusive */);
+
+#ifdef HB_NOT_IMPLEMENTED
+/* Note: You better have GDEF when using this API, or marks won't do much. */
+hb_bool_t
+hb_ot_layout_lookup_substitute (hb_font_t            *font,
+                               unsigned int          lookup_index,
+                               const hb_ot_layout_glyph_sequence_t *sequence,
+                               unsigned int          out_size,
+                               hb_codepoint_t       *glyphs_out,   /* OUT */
+                               unsigned int         *clusters_out, /* OUT */
+                               unsigned int         *out_length    /* OUT */);
+#endif
+
 
 /*
  * GPOS
@@ -188,6 +275,15 @@ hb_ot_layout_lookup_substitute_closure (hb_face_t    *face,
 hb_bool_t
 hb_ot_layout_has_positioning (hb_face_t *face);
 
+#ifdef HB_NOT_IMPLEMENTED
+/* Note: You better have GDEF when using this API, or marks won't do much. */
+hb_bool_t
+hb_ot_layout_lookup_position (hb_font_t            *font,
+                             unsigned int          lookup_index,
+                             const hb_ot_layout_glyph_sequence_t *sequence,
+                             hb_glyph_position_t  *positions /* IN / OUT */);
+#endif
+
 
 HB_END_DECLS
 
index c7dbea5..b140207 100644 (file)
@@ -115,7 +115,7 @@ struct hb_ot_map_t
     *lookup_count = end - start;
   }
 
-  HB_INTERNAL void substitute_closure (const struct hb_ot_shape_plan_t *plan, hb_face_t *face, hb_set_t *glyphs) const;
+  HB_INTERNAL void collect_lookups (unsigned int table_index, hb_set_t *lookups) const;
   HB_INTERNAL void substitute (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const;
   HB_INTERNAL void position (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const;
 
index 26ca1a3..62f7904 100644 (file)
@@ -41,11 +41,11 @@ hb_ot_map_t::add_lookups (hb_face_t    *face,
   offset = 0;
   do {
     len = ARRAY_LENGTH (lookup_indices);
-    hb_ot_layout_feature_get_lookup_indexes (face,
-                                            table_tags[table_index],
-                                            feature_index,
-                                            offset, &len,
-                                            lookup_indices);
+    hb_ot_layout_feature_get_lookups (face,
+                                     table_tags[table_index],
+                                     feature_index,
+                                     offset, &len,
+                                     lookup_indices);
 
     for (unsigned int i = 0; i < len; i++) {
       hb_ot_map_t::lookup_map_t *lookup = lookups[table_index].push ();
@@ -138,11 +138,10 @@ void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_
     hb_ot_layout_position_lookup (font, buffer, lookups[table_index][i].index, lookups[table_index][i].mask);
 }
 
-void hb_ot_map_t::substitute_closure (const hb_ot_shape_plan_t *plan, hb_face_t *face, hb_set_t *glyphs) const
+void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_out) const
 {
-  unsigned int table_index = 0;
   for (unsigned int i = 0; i < lookups[table_index].len; i++)
-    hb_ot_layout_lookup_substitute_closure (face, lookups[table_index][i].index, glyphs);
+    hb_set_add (lookups_out, lookups[table_index][i].index);
 }
 
 void hb_ot_map_builder_t::add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func)
index 76bf3ee..23e80b7 100644 (file)
@@ -46,7 +46,16 @@ struct hb_ot_shape_plan_t
   hb_ot_map_t map;
   const void *data;
 
-  inline void substitute_closure (hb_face_t *face, hb_set_t *glyphs) const { map.substitute_closure (this, face, glyphs); }
+  inline void collect_lookups (hb_tag_t table_tag, hb_set_t *lookups) const
+  {
+    unsigned int table_index;
+    switch (table_tag) {
+      case HB_OT_TAG_GSUB: table_index = 0; break;
+      case HB_OT_TAG_GPOS: table_index = 1; break;
+      default: return;
+    }
+    map.collect_lookups (table_index, lookups);
+  }
   inline void substitute (hb_font_t *font, hb_buffer_t *buffer) const { map.substitute (this, font, buffer); }
   inline void position (hb_font_t *font, hb_buffer_t *buffer) const { map.position (this, font, buffer); }
 
index 4b9afb7..7ef35c0 100644 (file)
@@ -572,16 +572,35 @@ _hb_ot_shape (hb_shape_plan_t    *shape_plan,
 }
 
 
+void
+hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan,
+                                 hb_tag_t         table_tag,
+                                 hb_set_t        *lookup_indexes /* OUT */)
+{
+  HB_SHAPER_DATA_GET (shape_plan)->collect_lookups (table_tag, lookup_indexes);
+}
 
-static inline void
-hb_ot_map_glyphs_dumb (hb_font_t    *font,
-                      hb_buffer_t  *buffer)
+
+/* TODO Move this to hb-ot-shape-normalize, make it do decompose, and make it public. */
+static void
+add_char (hb_font_t          *font,
+         hb_unicode_funcs_t *unicode,
+         hb_bool_t           mirror,
+         hb_codepoint_t      u,
+         hb_set_t           *glyphs)
 {
-  unsigned int count = buffer->len;
-  for (unsigned int i = 0; i < count; i++)
-    font->get_glyph (buffer->info[i].codepoint, 0, &buffer->info[i].codepoint);
+  hb_codepoint_t glyph;
+  if (font->get_glyph (u, 0, &glyph))
+    glyphs->add (glyph);
+  if (mirror)
+  {
+    hb_codepoint_t m = unicode->mirroring (u);
+    if (m != u && font->get_glyph (m, 0, &glyph))
+      glyphs->add (glyph);
+  }
 }
 
+
 void
 hb_ot_shape_glyphs_closure (hb_font_t          *font,
                            hb_buffer_t        *buffer,
@@ -593,26 +612,27 @@ hb_ot_shape_glyphs_closure (hb_font_t          *font,
 
   buffer->guess_properties ();
 
-  /* TODO cache / ensure correct backend, etc. */
-  hb_shape_plan_t *shape_plan = hb_shape_plan_create (font->face, &buffer->props, features, num_features, NULL);
+  const char *shapers[] = {"ot", NULL};
+  hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face, &buffer->props,
+                                                            features, num_features, shapers);
 
-  /* TODO: normalization? have shapers do closure()? */
-  /* TODO: Deal with mirrored chars? */
-  hb_ot_map_glyphs_dumb (font, buffer);
+  bool mirror = hb_script_get_horizontal_direction (buffer->props.script) == HB_DIRECTION_RTL;
 
-  /* Seed it.  It's user's responsibility to have cleard glyphs
-   * if that's what they desire. */
   unsigned int count = buffer->len;
   for (unsigned int i = 0; i < count; i++)
-    glyphs->add (buffer->info[i].codepoint);
+    add_char (font, buffer->unicode, mirror, buffer->info[i].codepoint, glyphs);
+
+  hb_set_t lookups;
+  lookups.init ();
+  hb_ot_shape_plan_collect_lookups (shape_plan, HB_OT_TAG_GSUB, &lookups);
 
   /* And find transitive closure. */
   hb_set_t copy;
   copy.init ();
-
   do {
     copy.set (glyphs);
-    HB_SHAPER_DATA_GET (shape_plan)->substitute_closure (font->face, glyphs);
+    for (hb_codepoint_t lookup_index = -1; hb_set_next (&lookups, &lookup_index);)
+      hb_ot_layout_lookup_substitute_closure (font->face, lookup_index, glyphs);
   } while (!copy.is_equal (glyphs));
 
   hb_shape_plan_destroy (shape_plan);
index 2d750c3..8073906 100644 (file)
@@ -35,6 +35,7 @@
 
 HB_BEGIN_DECLS
 
+/* TODO remove */
 void
 hb_ot_shape_glyphs_closure (hb_font_t          *font,
                            hb_buffer_t        *buffer,
index d6a57d6..c5a9927 100644 (file)
@@ -28,9 +28,8 @@
 #define HB_SHAPE_PLAN_PRIVATE_HH
 
 #include "hb-private.hh"
-
 #include "hb-shape-plan.h"
-
+#include "hb-object-private.hh"
 #include "hb-shaper-private.hh"
 
 
index 038f6af..d73a828 100644 (file)
@@ -24,8 +24,6 @@
  * Google Author(s): Behdad Esfahbod
  */
 
-#include "hb-private.hh"
-
 #include "hb-shape-plan-private.hh"
 #include "hb-shaper-private.hh"
 #include "hb-font-private.hh"
@@ -119,7 +117,7 @@ hb_shape_plan_get_empty (void)
 
     true, /* default_shaper_list */
     NULL, /* face */
-    _HB_BUFFER_PROPS_DEFAULT, /* props */
+    HB_SEGMENT_PROPERTIES_DEFAULT, /* props */
 
     NULL, /* shaper_func */
 
@@ -153,9 +151,26 @@ hb_shape_plan_destroy (hb_shape_plan_t *shape_plan)
   free (shape_plan);
 }
 
+hb_bool_t
+hb_shape_plan_set_user_data (hb_shape_plan_t    *shape_plan,
+                            hb_user_data_key_t *key,
+                            void *              data,
+                            hb_destroy_func_t   destroy,
+                            hb_bool_t           replace)
+{
+  return hb_object_set_user_data (shape_plan, key, data, destroy, replace);
+}
+
+void *
+hb_shape_plan_get_user_data (hb_shape_plan_t    *shape_plan,
+                            hb_user_data_key_t *key)
+{
+  return hb_object_get_user_data (shape_plan, key);
+}
+
 
 hb_bool_t
-hb_shape_plan_execute (hb_shape_plan      *shape_plan,
+hb_shape_plan_execute (hb_shape_plan_t    *shape_plan,
                       hb_font_t          *font,
                       hb_buffer_t        *buffer,
                       const hb_feature_t *features,
index f1a14a9..1f74ba5 100644 (file)
  * Google Author(s): Behdad Esfahbod
  */
 
+#ifndef HB_H_IN
+#error "Include <hb.h> instead."
+#endif
+
 #ifndef HB_SHAPE_PLAN_H
 #define HB_SHAPE_PLAN_H
 
-/* TODO To become public one day */
-
-#include "hb-private.hh"
-
-#include "hb-buffer-private.hh"
+#include "hb-common.h"
+#include "hb-font.h"
 
+HB_BEGIN_DECLS
 
-typedef struct hb_shape_plan_t hb_shape_plan;
-
-/*
- * hb_shape_plan_t
- */
+typedef struct hb_shape_plan_t hb_shape_plan_t;
 
-HB_INTERNAL hb_shape_plan_t *
+hb_shape_plan_t *
 hb_shape_plan_create (hb_face_t                     *face,
                      const hb_segment_properties_t *props,
                      const hb_feature_t            *user_features,
                      unsigned int                   num_user_features,
                      const char * const            *shaper_list);
 
-HB_INTERNAL hb_shape_plan_t *
+hb_shape_plan_t *
 hb_shape_plan_create_cached (hb_face_t                     *face,
                             const hb_segment_properties_t *props,
                             const hb_feature_t            *user_features,
                             unsigned int                   num_user_features,
                             const char * const            *shaper_list);
 
-HB_INTERNAL hb_shape_plan_t *
+hb_shape_plan_t *
 hb_shape_plan_get_empty (void);
 
-HB_INTERNAL hb_shape_plan_t *
+hb_shape_plan_t *
 hb_shape_plan_reference (hb_shape_plan_t *shape_plan);
 
-HB_INTERNAL void
+void
 hb_shape_plan_destroy (hb_shape_plan_t *shape_plan);
 
+hb_bool_t
+hb_shape_plan_set_user_data (hb_shape_plan_t    *shape_plan,
+                            hb_user_data_key_t *key,
+                            void *              data,
+                            hb_destroy_func_t   destroy,
+                            hb_bool_t           replace);
+
+void *
+hb_shape_plan_get_user_data (hb_shape_plan_t    *shape_plan,
+                            hb_user_data_key_t *key);
+
 
-HB_INTERNAL hb_bool_t
-hb_shape_plan_execute (hb_shape_plan      *shape_plan,
+hb_bool_t
+hb_shape_plan_execute (hb_shape_plan_t    *shape_plan,
                       hb_font_t          *font,
                       hb_buffer_t        *buffer,
                       const hb_feature_t *features,
                       unsigned int        num_features);
 
+#ifdef HB_NOT_IMPLEMENTED
+const char *
+hb_shape_plan_get_shaper (hb_shape_plan_t *shape_plan);
+#endif
+
+
+HB_END_DECLS
 
 #endif /* HB_SHAPE_PLAN_H */
index 186318d..9d30c1e 100644 (file)
@@ -29,8 +29,6 @@
 
 #include "hb-private.hh"
 
-#include "hb-shape-plan.h" /* TODO remove */
-
 typedef hb_bool_t hb_shape_func_t (hb_shape_plan_t    *shape_plan,
                                   hb_font_t          *font,
                                   hb_buffer_t        *buffer,
index a16ffc8..1c1aed9 100644 (file)
@@ -25,8 +25,8 @@
  */
 
 #include "hb-private.hh"
-
 #include "hb-shaper-private.hh"
+#include "hb-atomic-private.hh"
 
 
 static const hb_shaper_pair_t all_shapers[] = {
index d36040e..52c479c 100644 (file)
--- a/src/hb.h
+++ b/src/hb.h
@@ -34,6 +34,7 @@
 #include "hb-font.h"
 #include "hb-set.h"
 #include "hb-shape.h"
+#include "hb-shape-plan.h"
 #include "hb-unicode.h"
 #include "hb-version.h"