[HarfBuzz] harfbuzz-ng: Branch 'master' - 7 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Fri Jun 1 10:47:01 PDT 2012
TODO | 1
src/hb-atomic-private.hh | 8 -
src/hb-font-private.hh | 2
src/hb-font.cc | 80 +++++++---
src/hb-font.h | 28 +++
src/hb-ft.cc | 52 +++++-
src/hb-object-private.hh | 12 -
src/hb-unicode-private.hh | 4
src/hb-warning.cc | 13 +
test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt | 1
test/shaping/texts/in-tree/shaper-indic/south-east-asian/MANIFEST | 1
test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/MANIFEST | 1
test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/MANIFEST | 1
test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/misc.txt | 1
util/hb-ot-shape-closure.cc | 11 -
util/options.cc | 10 -
16 files changed, 168 insertions(+), 58 deletions(-)
New commits:
commit 96a9ef0c9fca8d58d8dc6baf6b262d96587abee0
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Jun 1 13:46:26 2012 -0400
Remove tab character like other "zero-width" characters
Uniscribe does that, this make comparing results to Uniscribe
easier.
diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh
index 519fa0b..ddba1ac 100644
--- a/src/hb-unicode-private.hh
+++ b/src/hb-unicode-private.hh
@@ -149,7 +149,8 @@ _hb_unicode_is_zero_width (hb_codepoint_t ch)
(ch >= 0x202A && ch <= 0x202E) ||
(ch >= 0x2060 && ch <= 0x2063) ||
(ch == 0x2028)
- )) || unlikely (ch == 0x00AD
+ )) || unlikely (ch == 0x0009
+ || ch == 0x00AD
|| ch == 0x034F
|| ch == 0xFEFF);
}
commit cd6a5493411fea30a04466128e1a37b4d89c6a72
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Jun 1 13:45:25 2012 -0400
Remove unused variable
diff --git a/util/hb-ot-shape-closure.cc b/util/hb-ot-shape-closure.cc
index 7bb8ae6..2a4fdcf 100644
--- a/util/hb-ot-shape-closure.cc
+++ b/util/hb-ot-shape-closure.cc
@@ -62,8 +62,6 @@ struct shape_closure_consumer_t : option_group_t
const char *text,
unsigned int text_len)
{
- FT_Face ft_face = show_glyph_names ? hb_ft_font_get_face (font) : NULL;
-
hb_set_clear (glyphs);
shaper.shape_closure (text, text_len, font, buffer, glyphs);
commit 0558d55bac7fb9279aac859b465e7c0e3ad97492
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon May 28 10:46:47 2012 -0400
Remove hb_atomic_int_set/get()
We never use them in fact...
I'm just adjusting these as I better understand the requirements of
the code and the guarantees of each operation.
diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 458c984..d6bd1c9 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -47,8 +47,6 @@
#include <intrin.h>
typedef long hb_atomic_int_t;
#define hb_atomic_int_add(AI, V) _InterlockedExchangeAdd (&(AI), (V))
-#define hb_atomic_int_set(AI, V) ((AI) = (V), MemoryBarrier ())
-#define hb_atomic_int_get(AI) (MemoryBarrier (), (AI))
#elif !defined(HB_NO_MT) && defined(__APPLE__)
@@ -56,8 +54,6 @@ typedef long hb_atomic_int_t;
#include <libkern/OSAtomic.h>
typedef int32_t hb_atomic_int_t;
#define hb_atomic_int_add(AI, V) (OSAtomicAdd32Barrier ((V), &(AI)) - (V))
-#define hb_atomic_int_set(AI, V) ((AI) = (V), OSMemoryBarrier ())
-#define hb_atomic_int_get(AI) (OSMemoryBarrier (), (AI))
#elif !defined(HB_NO_MT) && defined(HAVE_GLIB)
@@ -69,8 +65,6 @@ typedef volatile int hb_atomic_int_t;
#else
#define hb_atomic_int_add(AI, V) g_atomic_int_exchange_and_add (&(AI), (V))
#endif
-#define hb_atomic_int_set(AI, V) g_atomic_int_set (&(AI), (V))
-#define hb_atomic_int_get(AI) g_atomic_int_get (&(AI))
#else
@@ -78,8 +72,6 @@ typedef volatile int hb_atomic_int_t;
#define HB_ATOMIC_INT_NIL 1
typedef volatile int hb_atomic_int_t;
#define hb_atomic_int_add(AI, V) (((AI) += (V)) - (V))
-#define hb_atomic_int_set(AI, V) ((void) ((AI) = (V)))
-#define hb_atomic_int_get(AI) (AI)
#endif
diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh
index edd8921..2be20d3 100644
--- a/src/hb-object-private.hh
+++ b/src/hb-object-private.hh
@@ -48,17 +48,15 @@
/* reference_count */
typedef struct {
- hb_atomic_int_t ref_count;
+ const hb_atomic_int_t ref_count;
#define HB_REFERENCE_COUNT_INVALID_VALUE ((hb_atomic_int_t) -1)
#define HB_REFERENCE_COUNT_INVALID {HB_REFERENCE_COUNT_INVALID_VALUE}
- inline void init (int v) { ref_count = v; /* non-atomic is fine */ }
- inline int inc (void) { return hb_atomic_int_add (ref_count, 1); }
- inline int dec (void) { return hb_atomic_int_add (ref_count, -1); }
+ inline void init (int v) { const_cast<hb_atomic_int_t &> (ref_count) = v; }
+ inline int inc (void) { return hb_atomic_int_add (const_cast<hb_atomic_int_t &> (ref_count), 1); }
+ inline int dec (void) { return hb_atomic_int_add (const_cast<hb_atomic_int_t &> (ref_count), -1); }
- inline int get (void) { return hb_atomic_int_get (ref_count); }
- inline int get_unsafe (void) const { return ref_count; }
inline bool is_invalid (void) const { return ref_count == HB_REFERENCE_COUNT_INVALID_VALUE; }
} hb_reference_count_t;
@@ -159,7 +157,7 @@ struct _hb_object_header_t {
DEBUG_MSG (OBJECT, (void *) this,
"%s refcount=%d",
function,
- this ? ref_count.get_unsafe () : 0);
+ this ? ref_count.ref_count : 0);
}
};
commit 4efdffec095e19ceeb4b319d60201e84ece30fd9
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sun May 27 22:39:48 2012 -0400
Minor Malayalam test case
From https://bugs.freedesktop.org/show_bug.cgi?id=45166
diff --git a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt
index 1b17ef6..633058f 100644
--- a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt
+++ b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt
@@ -58,3 +58,4 @@
à´àµà´±àµà´±àµà´¯à´¾à´à´¿
à´¸àµà´µà´¾à´¤à´¨àµà´¤àµà´°àµà´¯à´
ഹാരàµâà´¡àµâà´µàµà´¯à´°àµâ
+യാതàµà´°à´¾à´àµà´²à´¿
commit dfff5b3021016d3a472c100272fd8e2f52307860
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sun May 27 22:07:04 2012 -0400
Add Myanmar test case
diff --git a/test/shaping/texts/in-tree/shaper-indic/south-east-asian/MANIFEST b/test/shaping/texts/in-tree/shaper-indic/south-east-asian/MANIFEST
index 5abc7e9..86c5b79 100644
--- a/test/shaping/texts/in-tree/shaper-indic/south-east-asian/MANIFEST
+++ b/test/shaping/texts/in-tree/shaper-indic/south-east-asian/MANIFEST
@@ -1,2 +1,3 @@
script-khmer
+script-myanmar
script-thai
diff --git a/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/MANIFEST b/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/MANIFEST
new file mode 100644
index 0000000..b8752e7
--- /dev/null
+++ b/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/MANIFEST
@@ -0,0 +1 @@
+misc
diff --git a/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/MANIFEST b/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/MANIFEST
new file mode 100644
index 0000000..29cfb2f
--- /dev/null
+++ b/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/MANIFEST
@@ -0,0 +1 @@
+misc.txt
diff --git a/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/misc.txt b/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/misc.txt
new file mode 100644
index 0000000..470c7c0
--- /dev/null
+++ b/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/misc.txt
@@ -0,0 +1 @@
+áá®ááá¯á áºáá¾ áá¬ááºáá¼á®á¸áá¾ááºááẠá¡á¬áá¯ááá¹áááá±á¸áá½á¾ááºá¸á
á¬ááᯠááá½ááºáá±á¸áá±á¸áá¬áá¶áááºááẠá¡áááá¹áá¬ááºáá»áẠáááááááºáá²á·áááºá
commit bce095524b3e69a47f8e88a2fb02d6ab537f9b0a
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sun May 27 11:29:21 2012 -0400
Add hb_font_get_glyph_name() and hb_font_get_glyph_from_name()
diff --git a/TODO b/TODO
index 168ff9a..4a1ad19 100644
--- a/TODO
+++ b/TODO
@@ -57,6 +57,7 @@ API additions
=============
- Buffer (de)serialize API ala hb-shape?
+
- Move feature parsing from util into the library
- Add hb-cairo glue
diff --git a/src/hb-font-private.hh b/src/hb-font-private.hh
index d896e72..e10e105 100644
--- a/src/hb-font-private.hh
+++ b/src/hb-font-private.hh
@@ -50,6 +50,8 @@
HB_FONT_FUNC_IMPLEMENT (glyph_v_kerning) \
HB_FONT_FUNC_IMPLEMENT (glyph_extents) \
HB_FONT_FUNC_IMPLEMENT (glyph_contour_point) \
+ HB_FONT_FUNC_IMPLEMENT (glyph_name) \
+ HB_FONT_FUNC_IMPLEMENT (glyph_from_name) \
/* ^--- Add new callbacks here */
struct _hb_font_funcs_t {
diff --git a/src/hb-font.cc b/src/hb-font.cc
index e314ad5..1862ac3 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -44,7 +44,7 @@
*/
static hb_bool_t
-hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED,
+hb_font_get_glyph_nil (hb_font_t *font,
void *font_data HB_UNUSED,
hb_codepoint_t unicode,
hb_codepoint_t variation_selector,
@@ -59,7 +59,7 @@ hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED,
}
static hb_position_t
-hb_font_get_glyph_h_advance_nil (hb_font_t *font HB_UNUSED,
+hb_font_get_glyph_h_advance_nil (hb_font_t *font,
void *font_data HB_UNUSED,
hb_codepoint_t glyph,
void *user_data HB_UNUSED)
@@ -71,7 +71,7 @@ hb_font_get_glyph_h_advance_nil (hb_font_t *font HB_UNUSED,
}
static hb_position_t
-hb_font_get_glyph_v_advance_nil (hb_font_t *font HB_UNUSED,
+hb_font_get_glyph_v_advance_nil (hb_font_t *font,
void *font_data HB_UNUSED,
hb_codepoint_t glyph,
void *user_data HB_UNUSED)
@@ -83,7 +83,7 @@ hb_font_get_glyph_v_advance_nil (hb_font_t *font HB_UNUSED,
}
static hb_bool_t
-hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED,
+hb_font_get_glyph_h_origin_nil (hb_font_t *font,
void *font_data HB_UNUSED,
hb_codepoint_t glyph,
hb_position_t *x,
@@ -91,9 +91,7 @@ hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED,
void *user_data HB_UNUSED)
{
if (font->parent) {
- hb_bool_t ret = hb_font_get_glyph_h_origin (font->parent,
- glyph,
- x, y);
+ hb_bool_t ret = hb_font_get_glyph_h_origin (font->parent, glyph, x, y);
if (ret)
font->parent_scale_position (x, y);
return ret;
@@ -104,7 +102,7 @@ hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED,
}
static hb_bool_t
-hb_font_get_glyph_v_origin_nil (hb_font_t *font HB_UNUSED,
+hb_font_get_glyph_v_origin_nil (hb_font_t *font,
void *font_data HB_UNUSED,
hb_codepoint_t glyph,
hb_position_t *x,
@@ -112,9 +110,7 @@ hb_font_get_glyph_v_origin_nil (hb_font_t *font HB_UNUSED,
void *user_data HB_UNUSED)
{
if (font->parent) {
- hb_bool_t ret = hb_font_get_glyph_v_origin (font->parent,
- glyph,
- x, y);
+ hb_bool_t ret = hb_font_get_glyph_v_origin (font->parent, glyph, x, y);
if (ret)
font->parent_scale_position (x, y);
return ret;
@@ -125,7 +121,7 @@ hb_font_get_glyph_v_origin_nil (hb_font_t *font HB_UNUSED,
}
static hb_position_t
-hb_font_get_glyph_h_kerning_nil (hb_font_t *font HB_UNUSED,
+hb_font_get_glyph_h_kerning_nil (hb_font_t *font,
void *font_data HB_UNUSED,
hb_codepoint_t left_glyph,
hb_codepoint_t right_glyph,
@@ -138,7 +134,7 @@ hb_font_get_glyph_h_kerning_nil (hb_font_t *font HB_UNUSED,
}
static hb_position_t
-hb_font_get_glyph_v_kerning_nil (hb_font_t *font HB_UNUSED,
+hb_font_get_glyph_v_kerning_nil (hb_font_t *font,
void *font_data HB_UNUSED,
hb_codepoint_t top_glyph,
hb_codepoint_t bottom_glyph,
@@ -151,7 +147,7 @@ hb_font_get_glyph_v_kerning_nil (hb_font_t *font HB_UNUSED,
}
static hb_bool_t
-hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
+hb_font_get_glyph_extents_nil (hb_font_t *font,
void *font_data HB_UNUSED,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents,
@@ -173,7 +169,7 @@ hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
}
static hb_bool_t
-hb_font_get_glyph_contour_point_nil (hb_font_t *font HB_UNUSED,
+hb_font_get_glyph_contour_point_nil (hb_font_t *font,
void *font_data HB_UNUSED,
hb_codepoint_t glyph,
unsigned int point_index,
@@ -182,9 +178,7 @@ hb_font_get_glyph_contour_point_nil (hb_font_t *font HB_UNUSED,
void *user_data HB_UNUSED)
{
if (font->parent) {
- hb_bool_t ret = hb_font_get_glyph_contour_point (font->parent,
- glyph, point_index,
- x, y);
+ hb_bool_t ret = hb_font_get_glyph_contour_point (font->parent, glyph, point_index, x, y);
if (ret)
font->parent_scale_position (x, y);
return ret;
@@ -194,6 +188,34 @@ hb_font_get_glyph_contour_point_nil (hb_font_t *font HB_UNUSED,
return FALSE;
}
+static hb_bool_t
+hb_font_get_glyph_name_nil (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_codepoint_t glyph,
+ char *name, unsigned int size,
+ void *user_data HB_UNUSED)
+{
+ if (font->parent)
+ return hb_font_get_glyph_name (font->parent, glyph, name, size);
+
+ snprintf (name, size, "gid%u", glyph);
+ return FALSE;
+}
+
+static hb_bool_t
+hb_font_get_glyph_from_name_nil (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ const char *name, int len, /* -1 means nul-terminated */
+ hb_codepoint_t *glyph,
+ void *user_data HB_UNUSED)
+{
+ if (font->parent)
+ return hb_font_get_glyph_from_name (font->parent, name, len, glyph);
+
+ *glyph = 0;
+ return FALSE;
+}
+
static hb_font_funcs_t _hb_font_funcs_nil = {
HB_OBJECT_HEADER_STATIC,
@@ -405,6 +427,28 @@ hb_font_get_glyph_contour_point (hb_font_t *font,
font->klass->user_data.glyph_contour_point);
}
+hb_bool_t
+hb_font_get_glyph_name (hb_font_t *font,
+ hb_codepoint_t glyph,
+ char *name, unsigned int size)
+{
+ return font->klass->get.glyph_name (font, font->user_data,
+ glyph,
+ name, size,
+ font->klass->user_data.glyph_name);
+}
+
+hb_bool_t
+hb_font_get_glyph_from_name (hb_font_t *font,
+ const char *name, int len, /* -1 means nul-terminated */
+ hb_codepoint_t *glyph)
+{
+ return font->klass->get.glyph_from_name (font, font->user_data,
+ name, len,
+ glyph,
+ font->klass->user_data.glyph_from_name);
+}
+
/* A bit higher-level, and with fallback */
diff --git a/src/hb-font.h b/src/hb-font.h
index 7e64515..b98759b 100644
--- a/src/hb-font.h
+++ b/src/hb-font.h
@@ -192,6 +192,16 @@ typedef hb_bool_t (*hb_font_get_glyph_contour_point_func_t) (hb_font_t *font, vo
void *user_data);
+typedef hb_bool_t (*hb_font_get_glyph_name_func_t) (hb_font_t *font, void *font_data,
+ hb_codepoint_t glyph,
+ char *name, unsigned int size,
+ void *user_data);
+typedef hb_bool_t (*hb_font_get_glyph_from_name_func_t) (hb_font_t *font, void *font_data,
+ const char *name, int len, /* -1 means nul-terminated */
+ hb_codepoint_t *glyph,
+ void *user_data);
+
+
/* func setters */
void
@@ -235,6 +245,15 @@ hb_font_funcs_set_glyph_contour_point_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_contour_point_func_t func,
void *user_data, hb_destroy_func_t destroy);
+void
+hb_font_funcs_set_glyph_name_func (hb_font_funcs_t *ffuncs,
+ hb_font_get_glyph_name_func_t glyph_func,
+ void *user_data, hb_destroy_func_t destroy);
+void
+hb_font_funcs_set_glyph_from_name_func (hb_font_funcs_t *ffuncs,
+ hb_font_get_glyph_from_name_func_t glyph_func,
+ void *user_data, hb_destroy_func_t destroy);
+
/* func dispatch */
@@ -276,6 +295,15 @@ hb_font_get_glyph_contour_point (hb_font_t *font,
hb_codepoint_t glyph, unsigned int point_index,
hb_position_t *x, hb_position_t *y);
+hb_bool_t
+hb_font_get_glyph_name (hb_font_t *font,
+ hb_codepoint_t glyph,
+ char *name, unsigned int size);
+hb_bool_t
+hb_font_get_glyph_from_name (hb_font_t *font,
+ const char *name, int len, /* -1 means nul-terminated */
+ hb_codepoint_t *glyph);
+
/* high-level funcs, with fallback */
diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index da5a4b4..90adc0d 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -231,21 +231,55 @@ hb_ft_get_glyph_contour_point (hb_font_t *font HB_UNUSED,
return TRUE;
}
+static hb_bool_t
+hb_ft_get_glyph_name (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t glyph,
+ char *name, unsigned int size,
+ void *user_data HB_UNUSED)
+{
+ FT_Face ft_face = (FT_Face) font_data;
+
+ hb_bool_t ret = !FT_Get_Glyph_Name (ft_face, glyph, name, size);
+ if (!ret)
+ snprintf (name, size, "gid%u", glyph);
+
+ return ret;
+}
+
+static hb_bool_t
+hb_ft_get_glyph_from_name (hb_font_t *font,
+ void *font_data,
+ const char *name, int len, /* -1 means nul-terminated */
+ hb_codepoint_t *glyph,
+ void *user_data HB_UNUSED)
+{
+ FT_Face ft_face = (FT_Face) font_data;
+
+ if (len < 0)
+ *glyph = FT_Get_Name_Index (ft_face, (FT_String *) name);
+ else {
+ /* Make a nul-terminated version. */
+ char buf[128];
+ len = MIN (len, (int) sizeof (buf) - 1);
+ strncpy (buf, name, len);
+ buf[len] = '\0';
+ *glyph = FT_Get_Name_Index (ft_face, buf);
+ }
+
+ return *glyph != 0;
+}
+
+
static hb_font_funcs_t ft_ffuncs = {
HB_OBJECT_HEADER_STATIC,
TRUE, /* immutable */
{
- hb_ft_get_glyph,
- hb_ft_get_glyph_h_advance,
- hb_ft_get_glyph_v_advance,
- hb_ft_get_glyph_h_origin,
- hb_ft_get_glyph_v_origin,
- hb_ft_get_glyph_h_kerning,
- hb_ft_get_glyph_v_kerning,
- hb_ft_get_glyph_extents,
- hb_ft_get_glyph_contour_point,
+#define HB_FONT_FUNC_IMPLEMENT(name) hb_ft_get_##name,
+ HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
}
};
diff --git a/util/hb-ot-shape-closure.cc b/util/hb-ot-shape-closure.cc
index 55481c6..7bb8ae6 100644
--- a/util/hb-ot-shape-closure.cc
+++ b/util/hb-ot-shape-closure.cc
@@ -78,13 +78,10 @@ struct shape_closure_consumer_t : option_group_t
first = false;
else
printf (" ");
- /* TODO refactor this */
- char glyph_name[30];
+ char glyph_name[32];
if (show_glyph_names) {
- if (!FT_Get_Glyph_Name (ft_face, i, glyph_name, sizeof (glyph_name)))
- printf ("%s", glyph_name);
- else
- printf ("gid%u", i);
+ hb_font_get_glyph_name (font, i, glyph_name, sizeof (glyph_name));
+ printf ("%s", glyph_name);
} else
printf ("%u", i);
}
diff --git a/util/options.cc b/util/options.cc
index 463daee..c404b8a 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -725,8 +725,6 @@ format_options_t::serialize_glyphs (hb_buffer_t *buffer,
hb_bool_t utf8_clusters,
GString *gs)
{
- FT_Face ft_face = show_glyph_names ? hb_ft_font_get_face (font) : NULL;
-
unsigned int num_glyphs = hb_buffer_get_length (buffer);
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, NULL);
hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer, NULL);
@@ -737,12 +735,10 @@ format_options_t::serialize_glyphs (hb_buffer_t *buffer,
if (i)
g_string_append_c (gs, '|');
- char glyph_name[30];
+ char glyph_name[32];
if (show_glyph_names) {
- if (!FT_Get_Glyph_Name (ft_face, info->codepoint, glyph_name, sizeof (glyph_name)))
- g_string_append_printf (gs, "%s", glyph_name);
- else
- g_string_append_printf (gs, "gid%u", info->codepoint);
+ hb_font_get_glyph_name (font, info->codepoint, glyph_name, sizeof (glyph_name));
+ g_string_append_printf (gs, "%s", glyph_name);
} else
g_string_append_printf (gs, "%u", info->codepoint);
commit bc145658bdaeaeea0cdbd719e2756f09a2dbfb48
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sun May 27 10:45:57 2012 -0400
Warn if no Unicode functions implementation is found
diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh
index c06dfe5..519fa0b 100644
--- a/src/hb-unicode-private.hh
+++ b/src/hb-unicode-private.hh
@@ -97,6 +97,7 @@ extern HB_INTERNAL hb_unicode_funcs_t _hb_glib_unicode_funcs;
extern HB_INTERNAL hb_unicode_funcs_t _hb_icu_unicode_funcs;
#define _hb_unicode_funcs_default _hb_icu_unicode_funcs
#else
+#define HB_UNICODE_FUNCS_NIL 1
extern HB_INTERNAL hb_unicode_funcs_t _hb_unicode_funcs_nil;
#define _hb_unicode_funcs_default _hb_unicode_funcs_nil
#endif
diff --git a/src/hb-warning.cc b/src/hb-warning.cc
index 6b5585f..c13731b 100644
--- a/src/hb-warning.cc
+++ b/src/hb-warning.cc
@@ -51,3 +51,16 @@
#warning "To suppress these warnings, define HB_NO_MT"
#endif
#endif
+
+
+#include "hb-unicode-private.hh"
+
+#if !defined(HB_NO_UNICODE_FUNCS) && defined(HB_UNICODE_FUNCS_NIL)
+#ifdef _MSC_VER
+#pragma message("Could not find any Unicode functions implementation, you have to provide your own")
+#pragma message("To suppress this warnings, define HB_NO_UNICODE_FUNCS")
+#else
+#warning "Could not find any Unicode functions implementation, you have to provide your own"
+#warning "To suppress this warning, define HB_NO_UNICODE_FUNCS"
+#endif
+#endif
More information about the HarfBuzz
mailing list