[HarfBuzz] harfbuzz-ng: Branch 'master' - 5 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Apr 29 11:32:15 PDT 2010


 src/hb-buffer.c                      |    6 +-
 src/hb-font.cc                       |   44 ++++++++--------
 src/hb-ft.c                          |   19 ++++---
 src/hb-object-private.h              |    2 
 src/hb-open-type-private.hh          |   91 +++++++++++++++--------------------
 src/hb-ot-layout-gdef-private.hh     |    4 -
 src/hb-ot-layout-gpos-private.hh     |   11 +++-
 src/hb-ot-layout-gsubgpos-private.hh |    8 +--
 src/hb-ot-layout.cc                  |    4 -
 src/hb-ot-shape.c                    |    2 
 src/hb-private.h                     |   25 ++++++---
 src/hb-shape.c                       |   32 ++++++------
 src/hb-unicode.c                     |    8 +--
 13 files changed, 132 insertions(+), 124 deletions(-)

New commits:
commit a8d960bd26883ee937b04ca2a3c16a3644870356
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 29 14:31:56 2010 -0400

    [GPOS] Speedup apply_value()

diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index c139692..fb9ec9f 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -106,8 +106,13 @@ struct ValueFormat : USHORT
     if (format & xAdvance)   glyph_pos->x_advance += _hb_16dot16_mul_round (x_scale, *(SHORT*)values++);
     if (format & yAdvance)   glyph_pos->y_advance += _hb_16dot16_mul_round (y_scale, *(SHORT*)values++);
 
+    if (!has_device ()) return;
+
     x_ppem = layout_context->font->x_ppem;
     y_ppem = layout_context->font->y_ppem;
+
+    if (!x_ppem && !y_ppem) return;
+
     /* pixel -> fractional pixel */
     if (format & xPlaDevice) {
       if (x_ppem) glyph_pos->x_offset  += (base+*(OffsetTo<Device>*)values++).get_delta (x_ppem) << 16; else values++;
@@ -142,7 +147,7 @@ struct ValueFormat : USHORT
 
   public:
 
-  inline bool has_device () {
+  inline bool has_device () const {
     unsigned int format = *this;
     return (format & devices) != 0;
   }
commit 2cd1ea4411d0808559a942ff3fa4e637f9c9a9c8
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 29 14:15:32 2010 -0400

    [ft] Disallow getting the entire font data with tag=0

diff --git a/src/hb-ft.c b/src/hb-ft.c
index 2174da5..f245a04 100644
--- a/src/hb-ft.c
+++ b/src/hb-ft.c
@@ -152,6 +152,9 @@ _get_table  (hb_tag_t tag, void *user_data)
   FT_ULong  length = 0;
   FT_Error error;
 
+  if (HB_UNLIKELY (tag == HB_TAG_NONE))
+    return hb_blob_create_empty ();
+
   error = FT_Load_Sfnt_Table (ft_face, tag, 0, NULL, &length);
   if (error)
     return hb_blob_create_empty ();
commit 33d13fdda99acaeffa9600737e8870278d053ebe
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 29 13:56:44 2010 -0400

    Rename HB_GNUC_UNUSED -> HB_UNUSED

diff --git a/src/hb-buffer.c b/src/hb-buffer.c
index 777ee7f..f169c35 100644
--- a/src/hb-buffer.c
+++ b/src/hb-buffer.c
@@ -594,7 +594,7 @@ hb_utf8_next (const uint8_t *text,
 void
 hb_buffer_add_utf8 (hb_buffer_t  *buffer,
 		    const char   *text,
-		    unsigned int  text_length HB_GNUC_UNUSED,
+		    unsigned int  text_length HB_UNUSED,
 		    unsigned int  item_offset,
 		    unsigned int  item_length)
 {
@@ -628,7 +628,7 @@ hb_utf16_next (const uint16_t *text,
 void
 hb_buffer_add_utf16 (hb_buffer_t    *buffer,
 		     const uint16_t *text,
-		     unsigned int    text_length HB_GNUC_UNUSED,
+		     unsigned int    text_length HB_UNUSED,
 		     unsigned int    item_offset,
 		     unsigned int    item_length)
 {
@@ -640,7 +640,7 @@ hb_buffer_add_utf16 (hb_buffer_t    *buffer,
 void
 hb_buffer_add_utf32 (hb_buffer_t    *buffer,
 		     const uint32_t *text,
-		     unsigned int    text_length HB_GNUC_UNUSED,
+		     unsigned int    text_length HB_UNUSED,
 		     unsigned int    item_offset,
 		     unsigned int    item_length)
 {
diff --git a/src/hb-font.cc b/src/hb-font.cc
index d0d58f1..a17cab5 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -40,37 +40,37 @@
  */
 
 static hb_codepoint_t
-hb_font_get_glyph_nil (hb_font_t *font HB_GNUC_UNUSED,
-		       hb_face_t *face HB_GNUC_UNUSED,
-		       const void *user_data HB_GNUC_UNUSED,
-		       hb_codepoint_t unicode HB_GNUC_UNUSED,
-		       hb_codepoint_t variation_selector HB_GNUC_UNUSED)
+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)
 { return 0; }
 
 static hb_bool_t
-hb_font_get_contour_point_nil (hb_font_t *font HB_GNUC_UNUSED,
-			       hb_face_t *face HB_GNUC_UNUSED,
-			       const void *user_data HB_GNUC_UNUSED,
-			       unsigned int point_index HB_GNUC_UNUSED,
-			       hb_codepoint_t glyph HB_GNUC_UNUSED,
-			       hb_position_t *x HB_GNUC_UNUSED,
-			       hb_position_t *y HB_GNUC_UNUSED)
+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,
+			       hb_position_t *x HB_UNUSED,
+			       hb_position_t *y HB_UNUSED)
 { return false; }
 
 static void
-hb_font_get_glyph_metrics_nil (hb_font_t *font HB_GNUC_UNUSED,
-			       hb_face_t *face HB_GNUC_UNUSED,
-			       const void *user_data HB_GNUC_UNUSED,
-			       hb_codepoint_t glyph HB_GNUC_UNUSED,
-			       hb_glyph_metrics_t *metrics HB_GNUC_UNUSED)
+hb_font_get_glyph_metrics_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_metrics_t *metrics HB_UNUSED)
 { }
 
 static hb_position_t
-hb_font_get_kerning_nil (hb_font_t *font HB_GNUC_UNUSED,
-			 hb_face_t *face HB_GNUC_UNUSED,
-			 const void *user_data HB_GNUC_UNUSED,
-			 hb_codepoint_t first_glyph HB_GNUC_UNUSED,
-			 hb_codepoint_t second_glyph HB_GNUC_UNUSED)
+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)
 { return 0; }
 
 hb_font_funcs_t _hb_font_funcs_nil = {
diff --git a/src/hb-ft.c b/src/hb-ft.c
index 3e91eff..2174da5 100644
--- a/src/hb-ft.c
+++ b/src/hb-ft.c
@@ -34,8 +34,8 @@
 #include FT_TRUETYPE_TABLES_H
 
 static hb_codepoint_t
-hb_ft_get_glyph (hb_font_t *font HB_GNUC_UNUSED,
-		 hb_face_t *face HB_GNUC_UNUSED,
+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)
@@ -54,8 +54,8 @@ hb_ft_get_glyph (hb_font_t *font HB_GNUC_UNUSED,
 }
 
 static hb_bool_t
-hb_ft_get_contour_point (hb_font_t *font HB_GNUC_UNUSED,
-			 hb_face_t *face HB_GNUC_UNUSED,
+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,
@@ -83,8 +83,8 @@ hb_ft_get_contour_point (hb_font_t *font HB_GNUC_UNUSED,
 }
 
 static void
-hb_ft_get_glyph_metrics (hb_font_t *font HB_GNUC_UNUSED,
-			 hb_face_t *face HB_GNUC_UNUSED,
+hb_ft_get_glyph_metrics (hb_font_t *font HB_UNUSED,
+			 hb_face_t *face HB_UNUSED,
 			 const void *user_data,
 			 hb_codepoint_t glyph,
 			 hb_glyph_metrics_t *metrics)
@@ -110,8 +110,8 @@ hb_ft_get_glyph_metrics (hb_font_t *font HB_GNUC_UNUSED,
 }
 
 static hb_position_t
-hb_ft_get_kerning (hb_font_t *font HB_GNUC_UNUSED,
-		   hb_face_t *face HB_GNUC_UNUSED,
+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)
diff --git a/src/hb-object-private.h b/src/hb-object-private.h
index e24bc91..937b1df 100644
--- a/src/hb-object-private.h
+++ b/src/hb-object-private.h
@@ -62,7 +62,7 @@ typedef struct {
 #define HB_DEBUG_OBJECT HB_DEBUG+0
 #endif
 
-static HB_GNUC_UNUSED inline hb_bool_t /* always returns TRUE */
+static HB_UNUSED inline hb_bool_t /* always returns TRUE */
 _hb_object_debug_out (const void *obj,
 		      hb_reference_count_t *ref_count,
 		      const char *function)
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index f59629f..bbd88a7 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -133,7 +133,7 @@ ASSERT_STATIC (sizeof (Type) + 1 <= sizeof (_Null##Type))
 
 #define SANITIZE_ARG_DEF \
 	hb_sanitize_context_t *context, \
-	unsigned int sanitize_depth HB_GNUC_UNUSED
+	unsigned int sanitize_depth HB_UNUSED
 #define SANITIZE_ARG \
 	context, \
 	(HB_DEBUG_SANITIZE ? sanitize_depth + 1 : 0)
@@ -146,7 +146,7 @@ struct hb_sanitize_context_t
 };
 
 
-static HB_GNUC_UNUSED void
+static HB_UNUSED void
 _hb_sanitize_init (hb_sanitize_context_t *context,
 		   hb_blob_t *blob)
 {
@@ -160,8 +160,8 @@ _hb_sanitize_init (hb_sanitize_context_t *context,
 	     blob, context->start, context->end, context->end - context->start);
 }
 
-static HB_GNUC_UNUSED void
-_hb_sanitize_fini (hb_sanitize_context_t *context HB_GNUC_UNUSED,
+static HB_UNUSED void
+_hb_sanitize_fini (hb_sanitize_context_t *context HB_UNUSED,
 		   hb_blob_t *blob)
 {
   if (HB_DEBUG_SANITIZE)
@@ -171,7 +171,7 @@ _hb_sanitize_fini (hb_sanitize_context_t *context HB_GNUC_UNUSED,
   hb_blob_unlock (blob);
 }
 
-static HB_GNUC_UNUSED inline bool
+static HB_UNUSED inline bool
 _hb_sanitize_check (SANITIZE_ARG_DEF,
 		    const char *base,
 		    unsigned int len)
@@ -191,7 +191,7 @@ _hb_sanitize_check (SANITIZE_ARG_DEF,
   return ret;
 }
 
-static HB_GNUC_UNUSED inline bool
+static HB_UNUSED inline bool
 _hb_sanitize_array (SANITIZE_ARG_DEF,
 		    const char *base,
 		    unsigned int record_size,
@@ -211,10 +211,10 @@ _hb_sanitize_array (SANITIZE_ARG_DEF,
   return HB_LIKELY (!overflows) && _hb_sanitize_check (SANITIZE_ARG, base, record_size * len);
 }
 
-static HB_GNUC_UNUSED inline bool
+static HB_UNUSED inline bool
 _hb_sanitize_edit (SANITIZE_ARG_DEF,
-		   const char *base HB_GNUC_UNUSED,
-		   unsigned int len HB_GNUC_UNUSED)
+		   const char *base HB_UNUSED,
+		   unsigned int len HB_UNUSED)
 {
   context->edit_count++;
 
diff --git a/src/hb-ot-layout-gdef-private.hh b/src/hb-ot-layout-gdef-private.hh
index e85b578..a2eed5b 100644
--- a/src/hb-ot-layout-gdef-private.hh
+++ b/src/hb-ot-layout-gdef-private.hh
@@ -91,7 +91,7 @@ struct CaretValueFormat1
   friend struct CaretValue;
 
   private:
-  inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id HB_GNUC_UNUSED) const
+  inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id HB_UNUSED) const
   {
     /* TODO vertical */
     return _hb_16dot16_mul_round (context->font->x_scale, coordinate);
@@ -138,7 +138,7 @@ struct CaretValueFormat3
 {
   friend struct CaretValue;
 
-  inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id HB_GNUC_UNUSED) const
+  inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id HB_UNUSED) const
   {
     /* TODO vertical */
     return _hb_16dot16_mul_round (context->font->x_scale, coordinate) +
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 07c4117..c139692 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -194,7 +194,7 @@ struct AnchorFormat1
   friend struct Anchor;
 
   private:
-  inline void get_anchor (hb_ot_layout_context_t *layout_context, hb_codepoint_t glyph_id HB_GNUC_UNUSED,
+  inline void get_anchor (hb_ot_layout_context_t *layout_context, hb_codepoint_t glyph_id HB_UNUSED,
 			  hb_position_t *x, hb_position_t *y) const
   {
       *x = _hb_16dot16_mul_round (layout_context->font->x_scale, xCoordinate);
@@ -250,7 +250,7 @@ struct AnchorFormat3
   friend struct Anchor;
 
   private:
-  inline void get_anchor (hb_ot_layout_context_t *layout_context, hb_codepoint_t glyph_id HB_GNUC_UNUSED,
+  inline void get_anchor (hb_ot_layout_context_t *layout_context, hb_codepoint_t glyph_id HB_UNUSED,
 			  hb_position_t *x, hb_position_t *y) const
   {
       *x = _hb_16dot16_mul_round (layout_context->font->x_scale, xCoordinate);
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index f6a03d6..50126b4 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -46,8 +46,8 @@
 	hb_apply_context_t *context, \
 	hb_ot_layout_context_t *layout_context, \
 	hb_buffer_t *buffer, \
-	unsigned int context_length HB_GNUC_UNUSED, \
-	unsigned int apply_depth HB_GNUC_UNUSED
+	unsigned int context_length HB_UNUSED, \
+	unsigned int apply_depth HB_UNUSED
 #define APPLY_ARG \
 	context, \
 	layout_context, \
@@ -73,7 +73,7 @@ struct ContextFuncs
 };
 
 
-static inline bool match_glyph (hb_codepoint_t glyph_id, const USHORT &value, const char *data HB_GNUC_UNUSED)
+static inline bool match_glyph (hb_codepoint_t glyph_id, const USHORT &value, const char *data HB_UNUSED)
 {
   return glyph_id == value;
 }
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 757722b..a450046 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -595,8 +595,8 @@ hb_ot_layout_position_lookup   (hb_font_t    *font,
 }
 
 void
-hb_ot_layout_position_finish (hb_font_t    *font HB_GNUC_UNUSED,
-			      hb_face_t    *face HB_GNUC_UNUSED,
+hb_ot_layout_position_finish (hb_font_t    *font HB_UNUSED,
+			      hb_face_t    *face HB_UNUSED,
 			      hb_buffer_t  *buffer)
 {
   unsigned int i, j;
diff --git a/src/hb-ot-shape.c b/src/hb-ot-shape.c
index 54d2895..7ff8166 100644
--- a/src/hb-ot-shape.c
+++ b/src/hb-ot-shape.c
@@ -114,7 +114,7 @@ setup_lookups (hb_face_t    *face,
 
 
 hb_bool_t
-_hb_ot_substitute_complex (hb_font_t    *font HB_GNUC_UNUSED,
+_hb_ot_substitute_complex (hb_font_t    *font HB_UNUSED,
 			   hb_face_t    *face,
 			   hb_buffer_t  *buffer,
 			   hb_feature_t *features,
diff --git a/src/hb-private.h b/src/hb-private.h
index 1ad094c..9130b04 100644
--- a/src/hb-private.h
+++ b/src/hb-private.h
@@ -117,16 +117,16 @@
 #endif
 
 #if __GNUC__ >= 3
-#define HB_GNUC_PURE	__attribute__((pure))
-#define HB_GNUC_CONST	__attribute__((const))
+#define HB_PURE_FUNC	__attribute__((pure))
+#define HB_CONST_FUNC	__attribute__((const))
 #else
-#define HB_GNUC_PURE
-#define HB_GNUC_CONST
+#define HB_PURE_FUNC
+#define HB_CONST_FUNC
 #endif
 #if __GNUC__ >= 4
-#define HB_GNUC_UNUSED	__attribute__((unused))
+#define HB_UNUSED	__attribute__((unused))
 #else
-#define HB_GNUC_UNUSED
+#define HB_UNUSED
 #endif
 
 
@@ -161,7 +161,7 @@
  * in libgcc in case a target does not have one, which should be just as
  * good as the open-coded solution below, (which is "HACKMEM 169").
  */
-static HB_GNUC_UNUSED inline unsigned int
+static HB_UNUSED inline unsigned int
 _hb_popcount32 (uint32_t mask)
 {
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
@@ -240,7 +240,7 @@ typedef int hb_mutex_t;
 #define HB_DEBUG 0
 #endif
 
-static HB_GNUC_UNUSED inline hb_bool_t /* always returns TRUE */
+static HB_UNUSED inline hb_bool_t /* always returns TRUE */
 _hb_trace (const char *what,
 	   const char *function,
 	   const void *obj,
diff --git a/src/hb-shape.c b/src/hb-shape.c
index 2e4f3f6..89c0117 100644
--- a/src/hb-shape.c
+++ b/src/hb-shape.c
@@ -113,8 +113,8 @@ static void
 hb_substitute_default (hb_font_t    *font,
 		       hb_face_t    *face,
 		       hb_buffer_t  *buffer,
-		       hb_feature_t *features HB_GNUC_UNUSED,
-		       unsigned int  num_features HB_GNUC_UNUSED)
+		       hb_feature_t *features HB_UNUSED,
+		       unsigned int  num_features HB_UNUSED)
 {
   hb_mirror_chars (buffer);
   hb_map_glyphs (font, face, buffer);
@@ -131,11 +131,11 @@ hb_substitute_complex (hb_font_t    *font,
 }
 
 static void
-hb_substitute_fallback (hb_font_t    *font HB_GNUC_UNUSED,
-			hb_face_t    *face HB_GNUC_UNUSED,
-			hb_buffer_t  *buffer HB_GNUC_UNUSED,
-			hb_feature_t *features HB_GNUC_UNUSED,
-			unsigned int  num_features HB_GNUC_UNUSED)
+hb_substitute_fallback (hb_font_t    *font HB_UNUSED,
+			hb_face_t    *face HB_UNUSED,
+			hb_buffer_t  *buffer HB_UNUSED,
+			hb_feature_t *features HB_UNUSED,
+			unsigned int  num_features HB_UNUSED)
 {
   /* TODO Arabic */
 }
@@ -147,8 +147,8 @@ static void
 hb_position_default (hb_font_t    *font,
 		     hb_face_t    *face,
 		     hb_buffer_t  *buffer,
-		     hb_feature_t *features HB_GNUC_UNUSED,
-		     unsigned int  num_features HB_GNUC_UNUSED)
+		     hb_feature_t *features HB_UNUSED,
+		     unsigned int  num_features HB_UNUSED)
 {
   unsigned int count;
 
@@ -174,11 +174,11 @@ hb_position_complex (hb_font_t    *font,
 }
 
 static void
-hb_position_fallback (hb_font_t    *font HB_GNUC_UNUSED,
-		      hb_face_t    *face HB_GNUC_UNUSED,
-		      hb_buffer_t  *buffer HB_GNUC_UNUSED,
-		      hb_feature_t *features HB_GNUC_UNUSED,
-		      unsigned int  num_features HB_GNUC_UNUSED)
+hb_position_fallback (hb_font_t    *font HB_UNUSED,
+		      hb_face_t    *face HB_UNUSED,
+		      hb_buffer_t  *buffer HB_UNUSED,
+		      hb_feature_t *features HB_UNUSED,
+		      unsigned int  num_features HB_UNUSED)
 {
   /* TODO Mark pos */
 }
@@ -187,8 +187,8 @@ static void
 hb_truetype_kern (hb_font_t    *font,
 		  hb_face_t    *face,
 		  hb_buffer_t  *buffer,
-		  hb_feature_t *features HB_GNUC_UNUSED,
-		  unsigned int  num_features HB_GNUC_UNUSED)
+		  hb_feature_t *features HB_UNUSED,
+		  unsigned int  num_features HB_UNUSED)
 {
   unsigned int count;
 
diff --git a/src/hb-unicode.c b/src/hb-unicode.c
index b6bd4ba..b75fe7e 100644
--- a/src/hb-unicode.c
+++ b/src/hb-unicode.c
@@ -33,10 +33,10 @@
  */
 
 static hb_codepoint_t hb_unicode_get_mirroring_nil (hb_codepoint_t unicode) { return unicode; }
-static hb_category_t hb_unicode_get_general_category_nil (hb_codepoint_t unicode HB_GNUC_UNUSED) { return HB_CATEGORY_OTHER_LETTER; }
-static hb_script_t hb_unicode_get_script_nil (hb_codepoint_t unicode HB_GNUC_UNUSED) { return HB_SCRIPT_UNKNOWN; }
-static unsigned int hb_unicode_get_combining_class_nil (hb_codepoint_t unicode HB_GNUC_UNUSED) { return 0; }
-static unsigned int hb_unicode_get_eastasian_width_nil (hb_codepoint_t unicode HB_GNUC_UNUSED) { return 1; }
+static hb_category_t hb_unicode_get_general_category_nil (hb_codepoint_t unicode HB_UNUSED) { return HB_CATEGORY_OTHER_LETTER; }
+static hb_script_t hb_unicode_get_script_nil (hb_codepoint_t unicode HB_UNUSED) { return HB_SCRIPT_UNKNOWN; }
+static unsigned int hb_unicode_get_combining_class_nil (hb_codepoint_t unicode HB_UNUSED) { return 0; }
+static unsigned int hb_unicode_get_eastasian_width_nil (hb_codepoint_t unicode HB_UNUSED) { return 1; }
 
 hb_unicode_funcs_t _hb_unicode_funcs_nil = {
   HB_REFERENCE_COUNT_INVALID, /* ref_count */
commit 7d3a126334f8e6f6441561c1bb592bd3fa7a2c5c
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 29 13:54:01 2010 -0400

    Define HB_FUNC for portability to non-gcc

diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index b91a7f6..f59629f 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -127,7 +127,7 @@ ASSERT_STATIC (sizeof (Type) + 1 <= sizeof (_Null##Type))
 #define TRACE_SANITIZE() \
 	HB_STMT_START { \
 	  if (HB_DEBUG_SANITIZE) \
-		  _hb_trace ("SANITIZE", __PRETTY_FUNCTION__, this, sanitize_depth, HB_DEBUG_SANITIZE); \
+		  _hb_trace ("SANITIZE", HB_FUNC, this, sanitize_depth, HB_DEBUG_SANITIZE); \
 	} HB_STMT_END
 
 
@@ -266,7 +266,7 @@ struct Sanitizer
 
   retry:
     if (HB_DEBUG_SANITIZE)
-      fprintf (stderr, "Sanitizer %p start %s\n", blob, __PRETTY_FUNCTION__);
+      fprintf (stderr, "Sanitizer %p start %s\n", blob, HB_FUNC);
 
     _hb_sanitize_init (context, blob);
 
@@ -277,7 +277,7 @@ struct Sanitizer
       if (context->edit_count) {
 	if (HB_DEBUG_SANITIZE)
 	  fprintf (stderr, "Sanitizer %p passed first round with %d edits; doing a second round %s\n",
-		   blob, context->edit_count, __PRETTY_FUNCTION__);
+		   blob, context->edit_count, HB_FUNC);
 
         /* sanitize again to ensure no toe-stepping */
         context->edit_count = 0;
@@ -285,7 +285,7 @@ struct Sanitizer
 	if (context->edit_count) {
 	  if (HB_DEBUG_SANITIZE)
 	    fprintf (stderr, "Sanitizer %p requested %d edits in second round; FAILLING %s\n",
-		     blob, context->edit_count, __PRETTY_FUNCTION__);
+		     blob, context->edit_count, HB_FUNC);
 	  sane = false;
 	}
       }
@@ -296,13 +296,13 @@ struct Sanitizer
       if (edit_count && !hb_blob_is_writable (blob) && hb_blob_try_writable (blob)) {
         /* ok, we made it writable by relocating.  try again */
 	if (HB_DEBUG_SANITIZE)
-	  fprintf (stderr, "Sanitizer %p retry %s\n", blob, __PRETTY_FUNCTION__);
+	  fprintf (stderr, "Sanitizer %p retry %s\n", blob, HB_FUNC);
         goto retry;
       }
     }
 
     if (HB_DEBUG_SANITIZE)
-      fprintf (stderr, "Sanitizer %p %s %s\n", blob, sane ? "passed" : "FAILED", __PRETTY_FUNCTION__);
+      fprintf (stderr, "Sanitizer %p %s %s\n", blob, sane ? "passed" : "FAILED", HB_FUNC);
     if (sane)
       return blob;
     else {
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 042daa2..f6a03d6 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -38,7 +38,7 @@
 #define TRACE_APPLY() \
 	HB_STMT_START { \
 	  if (HB_DEBUG_APPLY) \
-		  _hb_trace ("APPLY", __PRETTY_FUNCTION__, this, apply_depth, HB_DEBUG_APPLY); \
+		  _hb_trace ("APPLY", HB_FUNC, this, apply_depth, HB_DEBUG_APPLY); \
 	} HB_STMT_END
 
 
diff --git a/src/hb-private.h b/src/hb-private.h
index 2c118a6..1ad094c 100644
--- a/src/hb-private.h
+++ b/src/hb-private.h
@@ -145,6 +145,15 @@
 #endif
 
 
+#if __GNUC__ >= 3
+#define HB_FUNC __PRETTY_FUNCTION__
+#elif defined(_MSC_VER)
+#define HB_FUNC __FUNCSIG__
+#else
+#define HB_FUNC __func__
+#endif
+
+
 /* Return the number of 1 bits in mask.
  *
  * GCC 3.4 supports a "population count" builtin, which on many targets is
commit fa030175ca998b00cc42cbced6e98de323ec01ec
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 29 13:48:26 2010 -0400

    [sanitize] Make debug code always available to the compiler
    
    Such that we don't break debug build all the time.

diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index a1763af..b91a7f6 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -155,20 +155,18 @@ _hb_sanitize_init (hb_sanitize_context_t *context,
   context->writable = hb_blob_is_writable (blob);
   context->edit_count = 0;
 
-#if HB_DEBUG_SANITIZE
-  fprintf (stderr, "sanitize %p init [%p..%p] (%u bytes)\n",
-	   blob, context->start, context->end, context->end - context->start);
-#endif
+  if (HB_DEBUG_SANITIZE)
+    fprintf (stderr, "sanitize %p init [%p..%p] (%u bytes)\n",
+	     blob, context->start, context->end, context->end - context->start);
 }
 
 static HB_GNUC_UNUSED void
 _hb_sanitize_fini (hb_sanitize_context_t *context HB_GNUC_UNUSED,
 		   hb_blob_t *blob)
 {
-#if HB_DEBUG_SANITIZE
-  fprintf (stderr, "sanitize %p fini [%p..%p] %u edit requests\n",
-	   blob, context->start, context->end, context->edit_count);
-#endif
+  if (HB_DEBUG_SANITIZE)
+    fprintf (stderr, "sanitize %p fini [%p..%p] %u edit requests\n",
+	     blob, context->start, context->end, context->edit_count);
 
   hb_blob_unlock (blob);
 }
@@ -182,15 +180,14 @@ _hb_sanitize_check (SANITIZE_ARG_DEF,
 	     base <= context->end &&
 	     (unsigned int) (context->end - base) >= len;
 
-#if HB_DEBUG_SANITIZE
-  if (sanitize_depth < HB_DEBUG_SANITIZE) \
+  if (HB_DEBUG_SANITIZE && (int) sanitize_depth < (int) HB_DEBUG_SANITIZE) \
     fprintf (stderr, "SANITIZE(%p) %-*d-> check [%p..%p] (%d bytes) in [%p..%p] -> %s\n", \
 	     base,
 	     sanitize_depth, sanitize_depth,
 	     base, base+len, len,
 	     context->start, context->end,
 	     ret ? "pass" : "FAIL");
-#endif
+
   return ret;
 }
 
@@ -202,15 +199,14 @@ _hb_sanitize_array (SANITIZE_ARG_DEF,
 {
   bool overflows = len >= ((unsigned int) -1) / record_size;
 
-#if HB_DEBUG_SANITIZE
-  if (sanitize_depth < HB_DEBUG_SANITIZE) \
+
+  if (HB_DEBUG_SANITIZE && (int) sanitize_depth < (int) HB_DEBUG_SANITIZE)
     fprintf (stderr, "SANITIZE(%p) %-*d-> array [%p..%p] (%d*%d=%ld bytes) in [%p..%p] -> %s\n", \
 	     base,
 	     sanitize_depth, sanitize_depth,
 	     base, base + (record_size * len), record_size, len, (unsigned long) record_size * len,
 	     context->start, context->end,
 	     !overflows ? "does not overflow" : "OVERFLOWS FAIL");
-#endif
 
   return HB_LIKELY (!overflows) && _hb_sanitize_check (SANITIZE_ARG, base, record_size * len);
 }
@@ -222,15 +218,14 @@ _hb_sanitize_edit (SANITIZE_ARG_DEF,
 {
   context->edit_count++;
 
-#if HB_DEBUG_SANITIZE
-  fprintf (stderr, "SANITIZE(%p) %-*d-> edit(%u) [%p..%p] (%d bytes) in [%p..%p] -> %s\n", \
-	   base,
-	   sanitize_depth, sanitize_depth,
-	   context->edit_count,
-	   base, base+len, len,
-	   context->start, context->end,
-	   context->writable ? "granted" : "REJECTED");
-#endif
+  if (HB_DEBUG_SANITIZE && (int) sanitize_depth < (int) HB_DEBUG_SANITIZE)
+    fprintf (stderr, "SANITIZE(%p) %-*d-> edit(%u) [%p..%p] (%d bytes) in [%p..%p] -> %s\n", \
+	     base,
+	     sanitize_depth, sanitize_depth,
+	     context->edit_count,
+	     base, base+len, len,
+	     context->start, context->end,
+	     context->writable ? "granted" : "REJECTED");
 
   return context->writable;
 }
@@ -270,9 +265,8 @@ struct Sanitizer
     /* TODO is_sane() stuff */
 
   retry:
-#if HB_DEBUG_SANITIZE
-    fprintf (stderr, "Sanitizer %p start %s\n", blob, __PRETTY_FUNCTION__);
-#endif
+    if (HB_DEBUG_SANITIZE)
+      fprintf (stderr, "Sanitizer %p start %s\n", blob, __PRETTY_FUNCTION__);
 
     _hb_sanitize_init (context, blob);
 
@@ -281,18 +275,17 @@ struct Sanitizer
     sane = t->sanitize (SANITIZE_ARG);
     if (sane) {
       if (context->edit_count) {
-#if HB_DEBUG_SANITIZE
-	fprintf (stderr, "Sanitizer %p passed first round with %d edits; doing a second round %s\n",
-		 blob, context->edit_count, __PRETTY_FUNCTION__);
-#endif
+	if (HB_DEBUG_SANITIZE)
+	  fprintf (stderr, "Sanitizer %p passed first round with %d edits; doing a second round %s\n",
+		   blob, context->edit_count, __PRETTY_FUNCTION__);
+
         /* sanitize again to ensure no toe-stepping */
         context->edit_count = 0;
 	sane = t->sanitize (SANITIZE_ARG);
 	if (context->edit_count) {
-#if HB_DEBUG_SANITIZE
-	  fprintf (stderr, "Sanitizer %p requested %d edits in second round; FAILLING %s\n",
-		   blob, context->edit_count, __PRETTY_FUNCTION__);
-#endif
+	  if (HB_DEBUG_SANITIZE)
+	    fprintf (stderr, "Sanitizer %p requested %d edits in second round; FAILLING %s\n",
+		     blob, context->edit_count, __PRETTY_FUNCTION__);
 	  sane = false;
 	}
       }
@@ -302,16 +295,14 @@ struct Sanitizer
       _hb_sanitize_fini (context, blob);
       if (edit_count && !hb_blob_is_writable (blob) && hb_blob_try_writable (blob)) {
         /* ok, we made it writable by relocating.  try again */
-#if HB_DEBUG_SANITIZE
-	fprintf (stderr, "Sanitizer %p retry %s\n", blob, __PRETTY_FUNCTION__);
-#endif
+	if (HB_DEBUG_SANITIZE)
+	  fprintf (stderr, "Sanitizer %p retry %s\n", blob, __PRETTY_FUNCTION__);
         goto retry;
       }
     }
 
-#if HB_DEBUG_SANITIZE
-    fprintf (stderr, "Sanitizer %p %s %s\n", blob, sane ? "passed" : "FAILED", __PRETTY_FUNCTION__);
-#endif
+    if (HB_DEBUG_SANITIZE)
+      fprintf (stderr, "Sanitizer %p %s %s\n", blob, sane ? "passed" : "FAILED", __PRETTY_FUNCTION__);
     if (sane)
       return blob;
     else {



More information about the HarfBuzz mailing list