[HarfBuzz] harfbuzz-ng: Branch 'master' - 7 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Mon May 24 10:02:46 PDT 2010
src/hb-font-private.hh | 10 ++++++----
src/hb-font.cc | 46 ++++++++++++++++++++++------------------------
src/hb-ft.cc | 12 ++++++------
src/hb-glib.c | 14 +++++++-------
src/hb-icu.c | 14 +++++++-------
src/hb-object-private.h | 24 +++++++++++++-----------
src/hb-ot-shape.cc | 23 +++++++++++++----------
src/hb-unicode-private.h | 12 +++++++-----
src/hb-unicode.c | 41 +++++++++++++++++++----------------------
9 files changed, 100 insertions(+), 96 deletions(-)
New commits:
commit c442672ec2fb83ed41f3994b3aa4f92a097664ab
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon May 24 18:02:32 2010 +0100
Fix struct initializers
diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index 1360733..aee64f6 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -128,13 +128,13 @@ hb_ft_get_kerning (hb_font_t *font HB_UNUSED,
static hb_font_funcs_t ft_ffuncs = {
HB_REFERENCE_COUNT_INVALID, /* ref_count */
-
TRUE, /* immutable */
-
- hb_ft_get_glyph,
- hb_ft_get_contour_point,
- hb_ft_get_glyph_metrics,
- hb_ft_get_kerning
+ {
+ hb_ft_get_glyph,
+ hb_ft_get_contour_point,
+ hb_ft_get_glyph_metrics,
+ hb_ft_get_kerning
+ }
};
hb_font_funcs_t *
diff --git a/src/hb-glib.c b/src/hb-glib.c
index f1497d9..d336c46 100644
--- a/src/hb-glib.c
+++ b/src/hb-glib.c
@@ -41,14 +41,14 @@ static unsigned int hb_glib_get_eastasian_width (hb_codepoint_t unicode) { retur
static hb_unicode_funcs_t glib_ufuncs = {
HB_REFERENCE_COUNT_INVALID, /* ref_count */
-
TRUE, /* immutable */
-
- hb_glib_get_general_category,
- hb_glib_get_combining_class,
- hb_glib_get_mirroring,
- hb_glib_get_script,
- hb_glib_get_eastasian_width
+ {
+ hb_glib_get_general_category,
+ hb_glib_get_combining_class,
+ hb_glib_get_mirroring,
+ hb_glib_get_script,
+ hb_glib_get_eastasian_width
+ }
};
hb_unicode_funcs_t *
diff --git a/src/hb-icu.c b/src/hb-icu.c
index 2d1ef85..dc97a54 100644
--- a/src/hb-icu.c
+++ b/src/hb-icu.c
@@ -231,14 +231,14 @@ hb_icu_get_script (hb_codepoint_t unicode)
static hb_unicode_funcs_t icu_ufuncs = {
HB_REFERENCE_COUNT_INVALID, /* ref_count */
-
TRUE, /* immutable */
-
- hb_icu_get_general_category,
- hb_icu_get_combining_class,
- hb_icu_get_mirroring,
- hb_icu_get_script,
- hb_icu_get_eastasian_width
+ {
+ hb_icu_get_general_category,
+ hb_icu_get_combining_class,
+ hb_icu_get_mirroring,
+ hb_icu_get_script,
+ hb_icu_get_eastasian_width
+ }
};
hb_unicode_funcs_t *
commit f5ac9de259773a5f86809892e58166a485d70a3d
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon May 24 18:01:09 2010 +0100
Minor
diff --git a/src/hb-object-private.h b/src/hb-object-private.h
index e99bfbe..4d6321a 100644
--- a/src/hb-object-private.h
+++ b/src/hb-object-private.h
@@ -62,20 +62,19 @@ typedef struct {
#define HB_DEBUG_OBJECT HB_DEBUG+0
#endif
-static inline hb_bool_t /* always returns TRUE */
-_hb_object_debug_out (const void *obj,
- hb_reference_count_t *ref_count,
- const char *function)
+static inline void
+_hb_trace_object (const void *obj,
+ hb_reference_count_t *ref_count,
+ const char *function)
{
if (HB_DEBUG_OBJECT)
- fprintf (stderr, "%p refcount=%d %s\n",
+ fprintf (stderr, "OBJECT(%p) refcount=%d %s\n",
obj,
HB_REFERENCE_COUNT_GET_VALUE (*ref_count),
function);
- return TRUE;
}
-#define HB_OBJECT_DEBUG_OUT(obj) _hb_object_debug_out ((void *) obj, &obj->ref_count, __FUNCTION__)
+#define TRACE_OBJECT(obj) _hb_trace_object (obj, &obj->ref_count, __FUNCTION__)
@@ -96,8 +95,11 @@ _hb_object_debug_out (const void *obj,
likely (( \
(void) ( \
((obj) = (Type *) calloc (1, sizeof (Type))) && \
- HB_OBJECT_DO_INIT_EXPR (obj) && \
- HB_OBJECT_DEBUG_OUT (obj) \
+ ( \
+ HB_OBJECT_DO_INIT_EXPR (obj), \
+ TRACE_OBJECT (obj), \
+ TRUE \
+ ) \
), \
(obj) \
))
@@ -107,7 +109,7 @@ _hb_object_debug_out (const void *obj,
int old_count; \
if (unlikely (!(obj) || HB_OBJECT_IS_INERT (obj))) \
return obj; \
- HB_OBJECT_DEBUG_OUT (obj); \
+ TRACE_OBJECT (obj); \
old_count = hb_reference_count_inc (obj->ref_count); \
assert (old_count > 0); \
return obj; \
@@ -125,7 +127,7 @@ _hb_object_debug_out (const void *obj,
int old_count; \
if (unlikely (!(obj) || HB_OBJECT_IS_INERT (obj))) \
return; \
- HB_OBJECT_DEBUG_OUT (obj); \
+ TRACE_OBJECT (obj); \
old_count = hb_reference_count_dec (obj->ref_count); \
assert (old_count > 0); \
if (old_count != 1) \
commit f97bf4f81257c97a46dff51be31b2ec214d6c270
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon May 24 17:50:19 2010 +0100
Make sure we initialize all callbacks upon creation
Also fixes issue with unicode callbacks never being set really.
diff --git a/src/hb-font.cc b/src/hb-font.cc
index 72dc044..34c2345 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -75,14 +75,12 @@ hb_font_get_kerning_nil (hb_font_t *font HB_UNUSED,
hb_font_funcs_t _hb_font_funcs_nil = {
HB_REFERENCE_COUNT_INVALID, /* ref_count */
-
TRUE, /* immutable */
-
{
- hb_font_get_glyph_nil,
- hb_font_get_contour_point_nil,
- hb_font_get_glyph_metrics_nil,
- hb_font_get_kerning_nil
+ hb_font_get_glyph_nil,
+ hb_font_get_contour_point_nil,
+ hb_font_get_glyph_metrics_nil,
+ hb_font_get_kerning_nil
}
};
@@ -94,6 +92,8 @@ hb_font_funcs_create (void)
if (!HB_OBJECT_DO_CREATE (hb_font_funcs_t, ffuncs))
return &_hb_font_funcs_nil;
+ ffuncs->v = _hb_font_funcs_nil.v;
+
return ffuncs;
}
@@ -125,11 +125,7 @@ hb_font_funcs_copy (hb_font_funcs_t *other_ffuncs)
if (!HB_OBJECT_DO_CREATE (hb_font_funcs_t, ffuncs))
return &_hb_font_funcs_nil;
- *ffuncs = *other_ffuncs;
-
- /* re-init refcount */
- HB_OBJECT_DO_INIT (ffuncs);
- ffuncs->immutable = FALSE;
+ ffuncs->v = other_ffuncs->v;
return ffuncs;
}
diff --git a/src/hb-unicode.c b/src/hb-unicode.c
index 69ba58c..77efb67 100644
--- a/src/hb-unicode.c
+++ b/src/hb-unicode.c
@@ -40,9 +40,7 @@ static unsigned int hb_unicode_get_eastasian_width_nil (hb_codepoint_t unicode H
hb_unicode_funcs_t _hb_unicode_funcs_nil = {
HB_REFERENCE_COUNT_INVALID, /* ref_count */
-
TRUE, /* immutable */
-
{
hb_unicode_get_general_category_nil,
hb_unicode_get_combining_class_nil,
@@ -60,8 +58,7 @@ hb_unicode_funcs_create (void)
if (!HB_OBJECT_DO_CREATE (hb_unicode_funcs_t, ufuncs))
return &_hb_unicode_funcs_nil;
- *ufuncs = _hb_unicode_funcs_nil;
- HB_OBJECT_DO_INIT (ufuncs);
+ ufuncs->v = _hb_unicode_funcs_nil.v;
return ufuncs;
}
@@ -94,9 +91,7 @@ hb_unicode_funcs_copy (hb_unicode_funcs_t *other_ufuncs)
if (!HB_OBJECT_DO_CREATE (hb_unicode_funcs_t, ufuncs))
return &_hb_unicode_funcs_nil;
- *ufuncs = *other_ufuncs;
- HB_OBJECT_DO_INIT (ufuncs);
- ufuncs->immutable = FALSE;
+ ufuncs->v = other_ufuncs->v;
return ufuncs;
}
commit bf36a1074ab23abeab0a7a6c47db26770dc1ab0a
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon May 24 17:46:21 2010 +0100
Move all callback functions in a vtable structs
diff --git a/src/hb-font-private.hh b/src/hb-font-private.hh
index a58701e..406e195 100644
--- a/src/hb-font-private.hh
+++ b/src/hb-font-private.hh
@@ -44,10 +44,12 @@ struct _hb_font_funcs_t {
hb_bool_t immutable;
- hb_font_get_glyph_func_t get_glyph;
- hb_font_get_contour_point_func_t get_contour_point;
- hb_font_get_glyph_metrics_func_t get_glyph_metrics;
- hb_font_get_kerning_func_t get_kerning;
+ struct {
+ hb_font_get_glyph_func_t get_glyph;
+ hb_font_get_contour_point_func_t get_contour_point;
+ hb_font_get_glyph_metrics_func_t get_glyph_metrics;
+ hb_font_get_kerning_func_t get_kerning;
+ } v;
};
extern HB_INTERNAL hb_font_funcs_t _hb_font_funcs_nil;
diff --git a/src/hb-font.cc b/src/hb-font.cc
index a55deb3..72dc044 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -78,10 +78,12 @@ hb_font_funcs_t _hb_font_funcs_nil = {
TRUE, /* immutable */
+ {
hb_font_get_glyph_nil,
hb_font_get_contour_point_nil,
hb_font_get_glyph_metrics_nil,
hb_font_get_kerning_nil
+ }
};
hb_font_funcs_t *
@@ -149,7 +151,7 @@ hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
if (ffuncs->immutable)
return;
- ffuncs->get_glyph = glyph_func ? glyph_func : hb_font_get_glyph_nil;
+ ffuncs->v.get_glyph = glyph_func ? glyph_func : hb_font_get_glyph_nil;
}
void
@@ -159,7 +161,7 @@ hb_font_funcs_set_contour_point_func (hb_font_funcs_t *ffuncs,
if (ffuncs->immutable)
return;
- ffuncs->get_contour_point = contour_point_func ? contour_point_func : hb_font_get_contour_point_nil;
+ ffuncs->v.get_contour_point = contour_point_func ? contour_point_func : hb_font_get_contour_point_nil;
}
void
@@ -169,7 +171,7 @@ hb_font_funcs_set_glyph_metrics_func (hb_font_funcs_t *ffuncs,
if (ffuncs->immutable)
return;
- ffuncs->get_glyph_metrics = glyph_metrics_func ? glyph_metrics_func : hb_font_get_glyph_metrics_nil;
+ ffuncs->v.get_glyph_metrics = glyph_metrics_func ? glyph_metrics_func : hb_font_get_glyph_metrics_nil;
}
void
@@ -179,7 +181,7 @@ hb_font_funcs_set_kerning_func (hb_font_funcs_t *ffuncs,
if (ffuncs->immutable)
return;
- ffuncs->get_kerning = kerning_func ? kerning_func : hb_font_get_kerning_nil;
+ ffuncs->v.get_kerning = kerning_func ? kerning_func : hb_font_get_kerning_nil;
}
@@ -187,8 +189,8 @@ hb_codepoint_t
hb_font_get_glyph (hb_font_t *font, hb_face_t *face,
hb_codepoint_t unicode, hb_codepoint_t variation_selector)
{
- return font->klass->get_glyph (font, face, font->user_data,
- unicode, variation_selector);
+ return font->klass->v.get_glyph (font, face, font->user_data,
+ unicode, variation_selector);
}
hb_bool_t
@@ -197,9 +199,9 @@ hb_font_get_contour_point (hb_font_t *font, hb_face_t *face,
hb_codepoint_t glyph, hb_position_t *x, hb_position_t *y)
{
*x = 0; *y = 0;
- return font->klass->get_contour_point (font, face, font->user_data,
- point_index,
- glyph, x, y);
+ return font->klass->v.get_contour_point (font, face, font->user_data,
+ point_index,
+ glyph, x, y);
}
void
@@ -207,16 +209,16 @@ hb_font_get_glyph_metrics (hb_font_t *font, hb_face_t *face,
hb_codepoint_t glyph, hb_glyph_metrics_t *metrics)
{
memset (metrics, 0, sizeof (*metrics));
- return font->klass->get_glyph_metrics (font, face, font->user_data,
- glyph, metrics);
+ return font->klass->v.get_glyph_metrics (font, face, font->user_data,
+ glyph, metrics);
}
hb_position_t
hb_font_get_kerning (hb_font_t *font, hb_face_t *face,
hb_codepoint_t first_glyph, hb_codepoint_t second_glyph)
{
- return font->klass->get_kerning (font, face, font->user_data,
- first_glyph, second_glyph);
+ return font->klass->v.get_kerning (font, face, font->user_data,
+ first_glyph, second_glyph);
}
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 062cbfa..7343578 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -283,7 +283,7 @@ hb_form_clusters (hb_buffer_t *buffer)
{
unsigned int count = buffer->len;
for (unsigned int i = 1; i < count; i++)
- if (buffer->unicode->get_general_category (buffer->info[i].codepoint) == HB_CATEGORY_NON_SPACING_MARK)
+ if (buffer->unicode->v.get_general_category (buffer->info[i].codepoint) == HB_CATEGORY_NON_SPACING_MARK)
buffer->info[i].cluster = buffer->info[i - 1].cluster;
}
@@ -309,7 +309,7 @@ hb_ensure_native_direction (hb_buffer_t *buffer)
static void
hb_mirror_chars (hb_buffer_t *buffer)
{
- hb_unicode_get_mirroring_func_t get_mirroring = buffer->unicode->get_mirroring;
+ hb_unicode_get_mirroring_func_t get_mirroring = buffer->unicode->v.get_mirroring;
if (HB_DIRECTION_IS_FORWARD (buffer->direction))
return;
diff --git a/src/hb-unicode-private.h b/src/hb-unicode-private.h
index 01272da..9bb566e 100644
--- a/src/hb-unicode-private.h
+++ b/src/hb-unicode-private.h
@@ -42,11 +42,13 @@ struct _hb_unicode_funcs_t {
hb_bool_t immutable;
- hb_unicode_get_general_category_func_t get_general_category;
- hb_unicode_get_combining_class_func_t get_combining_class;
- hb_unicode_get_mirroring_func_t get_mirroring;
- hb_unicode_get_script_func_t get_script;
- hb_unicode_get_eastasian_width_func_t get_eastasian_width;
+ struct {
+ hb_unicode_get_general_category_func_t get_general_category;
+ hb_unicode_get_combining_class_func_t get_combining_class;
+ hb_unicode_get_mirroring_func_t get_mirroring;
+ hb_unicode_get_script_func_t get_script;
+ hb_unicode_get_eastasian_width_func_t get_eastasian_width;
+ } v;
};
extern HB_INTERNAL hb_unicode_funcs_t _hb_unicode_funcs_nil;
diff --git a/src/hb-unicode.c b/src/hb-unicode.c
index 1813940..69ba58c 100644
--- a/src/hb-unicode.c
+++ b/src/hb-unicode.c
@@ -43,11 +43,13 @@ hb_unicode_funcs_t _hb_unicode_funcs_nil = {
TRUE, /* immutable */
- hb_unicode_get_general_category_nil,
- hb_unicode_get_combining_class_nil,
- hb_unicode_get_mirroring_nil,
- hb_unicode_get_script_nil,
- hb_unicode_get_eastasian_width_nil
+ {
+ hb_unicode_get_general_category_nil,
+ hb_unicode_get_combining_class_nil,
+ hb_unicode_get_mirroring_nil,
+ hb_unicode_get_script_nil,
+ hb_unicode_get_eastasian_width_nil
+ }
};
hb_unicode_funcs_t *
@@ -116,7 +118,7 @@ hb_unicode_funcs_set_mirroring_func (hb_unicode_funcs_t *ufuncs,
if (ufuncs->immutable)
return;
- ufuncs->get_mirroring = mirroring_func ? mirroring_func : hb_unicode_get_mirroring_nil;
+ ufuncs->v.get_mirroring = mirroring_func ? mirroring_func : hb_unicode_get_mirroring_nil;
}
void
@@ -126,7 +128,7 @@ hb_unicode_funcs_set_general_category_func (hb_unicode_funcs_t *ufuncs,
if (ufuncs->immutable)
return;
- ufuncs->get_general_category = general_category_func ? general_category_func : hb_unicode_get_general_category_nil;
+ ufuncs->v.get_general_category = general_category_func ? general_category_func : hb_unicode_get_general_category_nil;
}
void
@@ -136,7 +138,7 @@ hb_unicode_funcs_set_script_func (hb_unicode_funcs_t *ufuncs,
if (ufuncs->immutable)
return;
- ufuncs->get_script = script_func ? script_func : hb_unicode_get_script_nil;
+ ufuncs->v.get_script = script_func ? script_func : hb_unicode_get_script_nil;
}
void
@@ -146,7 +148,7 @@ hb_unicode_funcs_set_combining_class_func (hb_unicode_funcs_t *ufuncs,
if (ufuncs->immutable)
return;
- ufuncs->get_combining_class = combining_class_func ? combining_class_func : hb_unicode_get_combining_class_nil;
+ ufuncs->v.get_combining_class = combining_class_func ? combining_class_func : hb_unicode_get_combining_class_nil;
}
void
@@ -156,7 +158,7 @@ hb_unicode_funcs_set_eastasian_width_func (hb_unicode_funcs_t *ufuncs,
if (ufuncs->immutable)
return;
- ufuncs->get_eastasian_width = eastasian_width_func ? eastasian_width_func : hb_unicode_get_eastasian_width_nil;
+ ufuncs->v.get_eastasian_width = eastasian_width_func ? eastasian_width_func : hb_unicode_get_eastasian_width_nil;
}
@@ -164,35 +166,35 @@ hb_codepoint_t
hb_unicode_get_mirroring (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t unicode)
{
- return ufuncs->get_mirroring (unicode);
+ return ufuncs->v.get_mirroring (unicode);
}
hb_category_t
hb_unicode_get_general_category (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t unicode)
{
- return ufuncs->get_general_category (unicode);
+ return ufuncs->v.get_general_category (unicode);
}
hb_script_t
hb_unicode_get_script (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t unicode)
{
- return ufuncs->get_script (unicode);
+ return ufuncs->v.get_script (unicode);
}
unsigned int
hb_unicode_get_combining_class (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t unicode)
{
- return ufuncs->get_combining_class (unicode);
+ return ufuncs->v.get_combining_class (unicode);
}
unsigned int
hb_unicode_get_eastasian_width (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t unicode)
{
- return ufuncs->get_eastasian_width (unicode);
+ return ufuncs->v.get_eastasian_width (unicode);
}
commit bbc7a99d01298f9be1ebaaceacbc9bc961e247e5
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri May 21 18:24:34 2010 +0100
Move mirroring around a bit
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index a226b43..062cbfa 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -351,7 +351,6 @@ hb_substitute_default (hb_font_t *font,
hb_feature_t *features HB_UNUSED,
unsigned int num_features HB_UNUSED)
{
- hb_mirror_chars (buffer);
hb_map_glyphs (font, face, buffer);
}
@@ -445,12 +444,13 @@ hb_ot_shape (hb_font_t *font,
buffer->clear_masks ();
- hb_substitute_default (font, face, buffer, features, num_features);
+ /* Mirroring needs to see the original direction */
+ hb_mirror_chars (buffer);
- /* We do this after substitute_default because mirroring needs to
- * see the original direction. */
original_direction = hb_ensure_native_direction (buffer);
+ hb_substitute_default (font, face, buffer, features, num_features);
+
substitute_fallback = !hb_ot_substitute_complex (font, face, buffer, features, num_features, original_direction);
if (substitute_fallback)
commit bd0987386b3a4dddf208ccf1a70ebfff6242ba73
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri May 21 18:06:35 2010 +0100
Add a few more standard features
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index b4f30a5..a226b43 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -32,15 +32,17 @@
/* XXX vertical */
hb_tag_t default_features[] = {
- /* GSUB */
+ HB_TAG('c','a','l','t'),
HB_TAG('c','c','m','p'),
- HB_TAG('l','o','c','l'),
- HB_TAG('l','i','g','a'),
HB_TAG('c','l','i','g'),
- /* GPOS */
+ HB_TAG('c','s','w','h'),
+ HB_TAG('c','u','r','s'),
HB_TAG('k','e','r','n'),
+ HB_TAG('l','i','g','a'),
+ HB_TAG('l','o','c','l'),
HB_TAG('m','a','r','k'),
HB_TAG('m','k','m','k'),
+ HB_TAG('r','l','i','g')
};
enum {
commit 75f3469ca6d626b08eb411984a2ba7fd48ca5b5f
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri May 21 17:59:04 2010 +0100
Add note
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 8b1863c..b4f30a5 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -30,6 +30,7 @@
#include "hb-ot-layout.h"
+/* XXX vertical */
hb_tag_t default_features[] = {
/* GSUB */
HB_TAG('c','c','m','p'),
More information about the HarfBuzz
mailing list