[HarfBuzz] harfbuzz-ng: Branch 'master' - 5 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Wed May 11 19:34:41 PDT 2011
TODO | 2 -
src/hb-common.cc | 5 ++--
src/hb-mutex-private.hh | 42 ---------------------------------------
src/hb-ot-layout.cc | 13 ++++++++++++
src/hb-ot-layout.h | 8 +++++++
src/hb-ot-shape-private.hh | 6 ++++-
src/hb-ot-shape.cc | 4 ---
src/hb-private.hh | 48 ---------------------------------------------
8 files changed, 31 insertions(+), 97 deletions(-)
New commits:
commit 46d6a21cc8613519e6ce27b1925e29285cccb71d
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed May 11 22:33:13 2011 -0400
[API] Add hb_ot_layout_substitute_start/finish()
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 8398bba..0d34e11 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -440,6 +440,14 @@ hb_ot_layout_has_substitution (hb_face_t *face)
return &_get_gsub (face) != &Null(GSUB);
}
+void
+hb_ot_layout_substitute_start (hb_buffer_t *buffer)
+{
+ unsigned int count = buffer->len;
+ for (unsigned int i = 0; i < count; i++)
+ buffer->info[i].var1.u32 = buffer->info[i].var2.u32 = 0;
+}
+
hb_bool_t
hb_ot_layout_substitute_lookup (hb_face_t *face,
hb_buffer_t *buffer,
@@ -449,6 +457,11 @@ hb_ot_layout_substitute_lookup (hb_face_t *face,
return _get_gsub (face).substitute_lookup (face, buffer, lookup_index, mask);
}
+void
+hb_ot_layout_substitute_finish (hb_buffer_t *buffer)
+{
+}
+
/*
* GPOS
diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h
index a6dbc61..5257244 100644
--- a/src/hb-ot-layout.h
+++ b/src/hb-ot-layout.h
@@ -165,12 +165,20 @@ hb_ot_layout_feature_get_lookup_indexes (hb_face_t *face,
hb_bool_t
hb_ot_layout_has_substitution (hb_face_t *face);
+/* Should be called before all the substitute_lookup's are done. */
+void
+hb_ot_layout_substitute_start (hb_buffer_t *buffer);
+
hb_bool_t
hb_ot_layout_substitute_lookup (hb_face_t *face,
hb_buffer_t *buffer,
unsigned int lookup_index,
hb_mask_t mask);
+/* Should be called after all the substitute_lookup's are done */
+void
+hb_ot_layout_substitute_finish (hb_buffer_t *buffer);
+
/*
* GPOS
*/
commit c84d15f52e1183164502d45b476b54f8fe812e0f
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed May 11 22:23:15 2011 -0400
Remove unused hb_set_t
diff --git a/src/hb-private.hh b/src/hb-private.hh
index 09f7bc1..33d5a3e 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -408,54 +408,6 @@ struct hb_lockable_set_t
};
-template <typename item_t>
-struct hb_set_t
-{
- struct lock_t {
- int unused;
-
- inline void lock (void) {}
- inline void unlock (void) {}
- };
-
- hb_lockable_set_t <item_t, lock_t> set;
-
- template <typename T>
- inline item_t *replace_or_insert (T v)
- {
- lock_t lock;
- return set.replace_or_insert (v, lock);
- }
-
- template <typename T>
- inline void remove (T v)
- {
- lock_t lock;
- set.remove (v, lock);
- }
-
- template <typename T>
- inline bool find (T v, item_t *i)
- {
- lock_t lock;
- return set.find (v, i, lock);
- }
-
- template <typename T>
- inline item_t *find_or_insert (T v)
- {
- lock_t lock;
- return set.find_or_insert (v, lock);
- }
-
- void finish (void)
- {
- lock_t lock;
- set.finish (lock);
- }
-
-};
-
HB_BEGIN_DECLS
commit 389a7c9e67549b1a9f7c538965e4647077f8e6ec
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed May 11 22:21:38 2011 -0400
Remove hb_static_threadsafe_set_t
diff --git a/src/hb-common.cc b/src/hb-common.cc
index 782d85a..20993c6 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -162,7 +162,8 @@ struct hb_language_item_t {
void finish (void) { free (lang); }
};
-static hb_static_threadsafe_set_t<hb_language_item_t> langs;
+static hb_static_mutex_t langs_lock;
+static hb_lockable_set_t<hb_language_item_t, hb_static_mutex_t> langs;
hb_language_t
hb_language_from_string (const char *str)
@@ -170,7 +171,7 @@ hb_language_from_string (const char *str)
if (!str || !*str)
return NULL;
- hb_language_item_t *item = langs.find_or_insert (str);
+ hb_language_item_t *item = langs.find_or_insert (str, langs_lock);
return likely (item) ? item->lang : NULL;
}
diff --git a/src/hb-mutex-private.hh b/src/hb-mutex-private.hh
index 4ff4b32..91c9438 100644
--- a/src/hb-mutex-private.hh
+++ b/src/hb-mutex-private.hh
@@ -109,46 +109,4 @@ struct hb_static_mutex_t : hb_mutex_t
HB_END_DECLS
-
-template <typename item_t>
-struct hb_static_threadsafe_set_t
-{
- hb_lockable_set_t <item_t, hb_static_mutex_t> set;
- hb_static_mutex_t lock;
-
- template <typename T>
- inline item_t *replace_or_insert (T v)
- {
- return set.replace_or_insert (v, lock);
- }
-
- template <typename T>
- inline void remove (T v)
- {
- set.remove (v, lock);
- }
-
- template <typename T>
- inline bool find (T v, item_t *i)
- {
- return set.find (v, i, lock);
- }
-
- template <typename T>
- inline item_t *find_or_insert (T v)
- {
- return set.find_or_insert (v, lock);
- }
-
- void finish (void)
- {
- set.finish (lock);
- }
-};
-
-
-HB_BEGIN_DECLS
-
-HB_END_DECLS
-
#endif /* HB_MUTEX_PRIVATE_HH */
commit e06d4eda7bbdb3a1be1f1ce8d98b059a0730f14d
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed May 11 22:18:31 2011 -0400
Use constructor/destructor for hb_ot_shape_plan_t
diff --git a/src/hb-ot-shape-private.hh b/src/hb-ot-shape-private.hh
index b95815a..4ea73f5 100644
--- a/src/hb-ot-shape-private.hh
+++ b/src/hb-ot-shape-private.hh
@@ -52,7 +52,11 @@ struct hb_ot_shape_plan_t
hb_ot_map_t map;
hb_ot_complex_shaper_t shaper;
- inline void finish (void) { map.finish (); }
+ hb_ot_shape_plan_t (void) : map () {}
+ ~hb_ot_shape_plan_t (void) { map.finish (); }
+
+ private:
+ NO_COPY (hb_ot_shape_plan_t);
};
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index aa5b920..71eae42 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -377,12 +377,10 @@ hb_ot_shape (hb_font_t *font,
const hb_feature_t *features,
unsigned int num_features)
{
- hb_ot_shape_plan_t plan = hb_ot_shape_plan_t ();
+ hb_ot_shape_plan_t plan;
hb_ot_shape_plan_internal (&plan, font->face, &buffer->props, features, num_features);
hb_ot_shape_execute (&plan, font, buffer, features, num_features);
-
- plan.finish ();
}
commit a5e4e109460ea23fa5e64926a1676c6a02ab6ba2
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed May 11 22:00:56 2011 -0400
Minor
diff --git a/TODO b/TODO
index 7d38803..e0663ff 100644
--- a/TODO
+++ b/TODO
@@ -18,7 +18,7 @@ API issues to fix before 1.0:
- Add sanitize API
-- Add glib GBoxedType stuff
+- Add glib GBoxedType stuff and introspection
API to add (maybe after 1.0):
More information about the HarfBuzz
mailing list