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

Behdad Esfahbod behdad at kemper.freedesktop.org
Sun Aug 7 05:27:54 PDT 2011


 src/Makefile.am               |    3 
 src/check-internal-symbols.sh |    3 
 src/check-libstdc++.sh        |    3 
 src/hb-buffer.cc              |   10 +++
 src/hb-glib.cc                |    8 +-
 src/hb-ot-name-private.hh     |  128 ++++++++++++++++++++++++++++++++++++++++++
 src/hb-shape.cc               |   16 ++---
 src/hb-uniscribe-shape.cc     |   62 ++++++++++++++------
 src/test.cc                   |    5 -
 test/Makefile.am              |    8 --
 10 files changed, 209 insertions(+), 37 deletions(-)

New commits:
commit 826e22732dd8697600a1392f48af21b7b3ce6271
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Aug 7 03:53:42 2011 -0400

    [uniscribe] Fix blob lifecycles

diff --git a/src/hb-uniscribe-shape.cc b/src/hb-uniscribe-shape.cc
index da0bced..82ef648 100644
--- a/src/hb-uniscribe-shape.cc
+++ b/src/hb-uniscribe-shape.cc
@@ -73,6 +73,8 @@ populate_log_font (LOGFONTW  *lf,
 					   lf->lfFaceName,
 					   sizeof (lf->lfFaceName[0]) * LF_FACESIZE)
 					  / sizeof (lf->lfFaceName[0]);
+  hb_blob_destroy (blob);
+
   if (unlikely (!len)) {
     DEBUG_MSG (UNISCRIBE, NULL, "Didn't find English name table entry");
     return FALSE;
@@ -195,7 +197,6 @@ retry:
 
   DWORD num_fonts_installed;
   HANDLE fh = AddFontMemResourceEx ((void *) blob_data, blob_length, 0, &num_fonts_installed);
-  hb_blob_destroy (blob);
   if (unlikely (!fh))
     FAIL ("AddFontMemResourceEx() failed");
 
commit ff199ba356f0eb5bc6252203eea18a1d1fd28934
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Aug 7 03:43:46 2011 -0400

    Fix shaper_list manipulation, aaaaaaaaaaaaargh

diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index 78c39dd..7833a39 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -78,7 +78,7 @@ static struct static_shaper_list_t
     }
 
     unsigned int count = 3; /* initial, fallback, null */
-    for (const char *p = env; (p == strchr (p, ',')) && p++; )
+    for (const char *p = env; (p = strchr (p, ',')) && p++; )
       count++;
 
     unsigned int len = strlen (env);
@@ -95,7 +95,7 @@ static struct static_shaper_list_t
 
     count = 0;
     shaper_list[count++] = buffer;
-    for (char *p = buffer; (p == strchr (p, ',')) && (*p = '\0', TRUE) && p++; )
+    for (char *p = buffer; (p = strchr (p, ',')) && (*p = '\0', TRUE) && p++; )
       shaper_list[count++] = p;
     shaper_list[count++] = "fallback";
     shaper_list[count] = NULL;
@@ -136,11 +136,13 @@ hb_shape_full (hb_font_t           *font,
   } else {
     while (*shaper_list) {
       for (unsigned int i = 0; i < ARRAY_LENGTH (shapers); i++)
-	if (0 == strcmp (*shaper_list, shapers[i].name) &&
-	    likely (shapers[i].func (font, buffer,
-				     features, num_features,
-				     shaper_options)))
-	  return TRUE;
+	if (0 == strcmp (*shaper_list, shapers[i].name)) {
+	  if (likely (shapers[i].func (font, buffer,
+				       features, num_features,
+				       shaper_options)))
+	    return TRUE;
+	  break;
+	}
       shaper_list++;
     }
   }
commit 206e32934592b915b1f3052aecf014c6ced729e1
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Aug 7 01:10:55 2011 -0400

    [test] test-object is not FreeType-specific, move it to the right place

diff --git a/test/Makefile.am b/test/Makefile.am
index 18f36df..b3c8cc2 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -20,6 +20,7 @@ TEST_PROGS = \
 	test-buffer \
 	test-common \
 	test-font \
+	test-object \
 	test-shape \
 	test-unicode \
 	test-version \
@@ -46,12 +47,9 @@ endif
 if HAVE_FREETYPE
 test_c_CPPFLAGS += $(FREETYPE_CFLAGS)
 test_cplusplus_CPPFLAGS += $(FREETYPE_CFLAGS)
+endif
 
-# TODO replace freetype with other stuff in the following test
-TEST_PROGS += test-object
-test_object_CPPFLAGS = $(AM_CPPFLAGS) $(FREETYPE_CFLAGS)
-test_object_LDADD = $(LDADD) $(FREETYPE_LIBS)
-
+if HAVE_FREETYPE
 TEST_PROGS += test-shape-complex
 test_shape_complex_CPPFLAGS = $(AM_CPPFLAGS) $(FREETYPE_CFLAGS)
 test_shape_complex_LDADD = $(LDADD) $(FREETYPE_LIBS)
commit 577326b86af80cc137eea81f4cc1e30adf9232b1
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Aug 7 01:04:40 2011 -0400

    [uniscribe] Fix cluster calculation

diff --git a/src/hb-uniscribe-shape.cc b/src/hb-uniscribe-shape.cc
index 8527ec8..da0bced 100644
--- a/src/hb-uniscribe-shape.cc
+++ b/src/hb-uniscribe-shape.cc
@@ -288,7 +288,11 @@ retry:
 
   /* Calculate visual-clusters.  That's what we ship. */
   for (unsigned int i = 0; i < buffer->len; i++)
-    vis_clusters[log_clusters[buffer->info[i].utf16_index()]] = buffer->info[i].cluster;
+    vis_clusters[i] = 0;
+  for (unsigned int i = 0; i < buffer->len; i++) {
+    uint32_t *p = &vis_clusters[log_clusters[buffer->info[i].utf16_index()]];
+    *p = MIN (*p, buffer->info[i].cluster);
+  }
   for (unsigned int i = 1; i < glyphs_len; i++)
     if (!glyph_props[i].sva.fClusterStart)
     vis_clusters[i] = vis_clusters[i - 1];
commit f6d83b2dcf120f9d6f0a28c6f5de2da7addf9089
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Aug 7 00:59:58 2011 -0400

    Minor

diff --git a/src/test.cc b/src/test.cc
index 4051829..d096ab3 100644
--- a/src/test.cc
+++ b/src/test.cc
@@ -93,7 +93,7 @@ main (int argc, char **argv)
 
   hb_buffer_t *buffer = hb_buffer_create (0);
 
-  hb_buffer_add_utf8 (buffer, "test", 4, 0, 4);
+  hb_buffer_add_utf8 (buffer, "\xe0\xa4\x95\xe0\xa5\x8d\xe0\xa4\xb0\xe0\xa5\x8d\xe0\xa4\x95", -1, 0, -1);
 
   hb_shape (font, buffer, NULL, 0);
 
@@ -106,7 +106,7 @@ main (int argc, char **argv)
     hb_glyph_info_t *info = &infos[i];
     hb_glyph_position_t *pos = &positions[i];
 
-    printf ("cluster %d	glyph %d at	(%d,%d)+(%d,%d)\n",
+    printf ("cluster %d	glyph 0x%x at	(%d,%d)+(%d,%d)\n",
 	    info->cluster,
 	    info->codepoint,
 	    pos->x_offset,
commit 2eb474afb4a09f4da8f14b444bd6066769010224
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Aug 7 00:59:38 2011 -0400

    [uniscribe] Fix shaper
    
    It's kinda working finally!

diff --git a/src/hb-uniscribe-shape.cc b/src/hb-uniscribe-shape.cc
index d6d3d79..8527ec8 100644
--- a/src/hb-uniscribe-shape.cc
+++ b/src/hb-uniscribe-shape.cc
@@ -176,7 +176,7 @@ retry:
 			      script_tags,
 			      &item_count);
   if (unlikely (FAILED (hr)))
-    FAIL ("ScriptItemizeOpenType() failed: %d", hr);
+    FAIL ("ScriptItemizeOpenType() failed: 0x%08xL", hr);
 
 #undef MAX_ITEMS
 
@@ -248,8 +248,10 @@ retry:
 	  FAIL ("Buffer resize failed");
 	goto retry;
       }
+      if (unlikely (hr == USP_E_SCRIPT_NOT_IN_FONT))
+	FAIL ("ScriptShapeOpenType() failed: Font doesn't support script");
       if (unlikely (FAILED (hr)))
-	FAIL ("ScriptShapeOpenType() failed: %d", hr);
+	FAIL ("ScriptShapeOpenType() failed: 0x%08xL", hr);
 
       hr = ScriptPlaceOpenType (hdc,
 				&script_cache,
@@ -271,7 +273,7 @@ retry:
 				offsets + glyphs_offset,
 				NULL);
       if (unlikely (FAILED (hr)))
-	FAIL ("ScriptPlaceOpenType() failed: %d", hr);
+	FAIL ("ScriptPlaceOpenType() failed: 0x%08xL", hr);
 
       glyphs_offset += glyphs_len;
   }
@@ -312,6 +314,7 @@ retry:
     info->var1.u32 = offsets[i].du;
     info->var2.u32 = offsets[i].dv;
   }
+  buffer->len = glyphs_len;
 
   /* Set glyph positions */
   buffer->clear_positions ();
commit f22e661147691ebc9d531aa28a850988e6503f9b
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Aug 7 00:59:12 2011 -0400

    [glib] Protect against invalid characters

diff --git a/src/hb-glib.cc b/src/hb-glib.cc
index 1b322ea..1fd54e5 100644
--- a/src/hb-glib.cc
+++ b/src/hb-glib.cc
@@ -254,8 +254,10 @@ hb_glib_unicode_compose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
   len = g_unichar_to_utf8 (a, utf8);
   len += g_unichar_to_utf8 (b, utf8 + len);
   normalized = g_utf8_normalize (utf8, len, G_NORMALIZE_NFC);
-
   len = g_utf8_strlen (normalized, -1);
+  if (unlikely (!len))
+    return FALSE;
+
   if (len == 1) {
     *ab = g_utf8_get_char (normalized);
     ret = TRUE;
@@ -288,8 +290,10 @@ hb_glib_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
 
   len = g_unichar_to_utf8 (ab, utf8);
   normalized = g_utf8_normalize (utf8, len, G_NORMALIZE_NFD);
-
   len = g_utf8_strlen (normalized, -1);
+  if (unlikely (!len))
+    return FALSE;
+
   if (len == 1) {
     *a = g_utf8_get_char (normalized);
     *b = 0;
commit 144cd49a0eb3ccc749325d0ee14b3ebf4367c971
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Aug 7 00:51:50 2011 -0400

    [buffer] Accept -1 for text_length and item_length
    
    A -1 text_length means: zero-terminated string.
    A -1 item_length means: to the end of string.

diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index e19e7dd..53b3200 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -712,6 +712,16 @@ hb_buffer_guess_properties (hb_buffer_t *buffer)
 
 #define ADD_UTF(T) \
 	HB_STMT_START { \
+	  if (text_length == -1) { \
+	    text_length = 0; \
+	    const T *p = (const T *) text; \
+	    while (*p) { \
+	      text_length++; \
+	      p++; \
+	    } \
+	  } \
+	  if (item_length == -1) \
+	    item_length = text_length - item_offset; \
 	  const T *next = (const T *) text + item_offset; \
 	  const T *end = next + item_length; \
 	  while (next < end) { \
commit e9c71fab30fd1d5b163c8a072f9e2d3eb8ba3a92
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Aug 7 00:00:27 2011 -0400

    Fix name-table lookup
    
    Oops!

diff --git a/src/hb-ot-name-private.hh b/src/hb-ot-name-private.hh
index 3355bd9..d2acba1 100644
--- a/src/hb-ot-name-private.hh
+++ b/src/hb-ot-name-private.hh
@@ -92,7 +92,7 @@ struct name
       return 0;
 
     unsigned int length = MIN (buffer_length, (unsigned int) match->length);
-    memcmp (buffer, (this + stringOffset) + match->offset, length);
+    memcpy (buffer, (char *) this + stringOffset + match->offset, length);
     return length;
   }
 
diff --git a/src/hb-uniscribe-shape.cc b/src/hb-uniscribe-shape.cc
index 0934d5d..d6d3d79 100644
--- a/src/hb-uniscribe-shape.cc
+++ b/src/hb-uniscribe-shape.cc
@@ -81,9 +81,11 @@ populate_log_font (LOGFONTW  *lf,
     DEBUG_MSG (UNISCRIBE, NULL, "Font name too long");
     return FALSE;
   }
+
   for (unsigned int i = 0; i < len; i++)
     lf->lfFaceName[i] = hb_be_uint16 (lf->lfFaceName[i]);
   lf->lfFaceName[len] = 0;
+
   return TRUE;
 }
 
commit 3fd2b5bece28c81e3e379352f09eee39d19ac372
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Aug 6 22:59:54 2011 -0400

    [uniscribe] Use font size directly

diff --git a/src/hb-uniscribe-shape.cc b/src/hb-uniscribe-shape.cc
index 3b1a178..0934d5d 100644
--- a/src/hb-uniscribe-shape.cc
+++ b/src/hb-uniscribe-shape.cc
@@ -65,7 +65,7 @@ populate_log_font (LOGFONTW  *lf,
 {
   memset (lf, 0, sizeof (*lf));
   int dpi = GetDeviceCaps (hdc, LOGPIXELSY);
-  lf->lfHeight = MulDiv (font->x_scale, dpi, 72);
+  lf->lfHeight = -font->y_scale;
 
   hb_blob_t *blob = Sanitizer<name>::sanitize (hb_face_reference_table (font->face, HB_TAG ('n','a','m','e')));
   const name *name_table = Sanitizer<name>::lock_instance (blob);
commit 892eb2e462b40451b8f73879eab66310d884386a
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Aug 6 22:06:52 2011 -0400

    [uniscribe] Make font selection work
    
    Not tested yet.

diff --git a/src/hb-ot-name-private.hh b/src/hb-ot-name-private.hh
index cbc8c81..3355bd9 100644
--- a/src/hb-ot-name-private.hh
+++ b/src/hb-ot-name-private.hh
@@ -39,6 +39,20 @@
 
 struct NameRecord
 {
+  static int cmp (const NameRecord *a, const NameRecord *b)
+  {
+    int ret;
+    ret = b->platformID.cmp (a->platformID);
+    if (ret) return ret;
+    ret = b->encodingID.cmp (a->encodingID);
+    if (ret) return ret;
+    ret = b->languageID.cmp (a->languageID);
+    if (ret) return ret;
+    ret = b->nameID.cmp (a->nameID);
+    if (ret) return ret;
+    return 0;
+  }
+
   inline bool sanitize (hb_sanitize_context_t *c, void *base) {
     TRACE_SANITIZE ();
     /* We can check from base all the way up to the end of string... */
@@ -60,6 +74,28 @@ struct name
 {
   static const hb_tag_t Tag	= HB_OT_TAG_name;
 
+  inline unsigned int get_name (unsigned int platform_id,
+				unsigned int encoding_id,
+				unsigned int language_id,
+				unsigned int name_id,
+				void *buffer,
+				unsigned int buffer_length) const
+  {
+    NameRecord key;
+    key.platformID.set (platform_id);
+    key.encodingID.set (encoding_id);
+    key.languageID.set (language_id);
+    key.nameID.set (name_id);
+    NameRecord *match = (NameRecord *) bsearch (&key, nameRecord, count, sizeof (nameRecord[0]), (hb_compare_func_t) NameRecord::cmp);
+
+    if (!match)
+      return 0;
+
+    unsigned int length = MIN (buffer_length, (unsigned int) match->length);
+    memcmp (buffer, (this + stringOffset) + match->offset, length);
+    return length;
+  }
+
   inline bool sanitize_records (hb_sanitize_context_t *c) {
     TRACE_SANITIZE ();
     unsigned int _count = count;
@@ -70,6 +106,7 @@ struct name
 
   inline bool sanitize (hb_sanitize_context_t *c) {
     TRACE_SANITIZE ();
+    return true;
     return c->check_struct (this) &&
 	   likely (format == 0 || format == 1) &&
 	   c->check_array (nameRecord, nameRecord[0].static_size, count) &&
diff --git a/src/hb-uniscribe-shape.cc b/src/hb-uniscribe-shape.cc
index ecc801e..3b1a178 100644
--- a/src/hb-uniscribe-shape.cc
+++ b/src/hb-uniscribe-shape.cc
@@ -58,19 +58,33 @@ DWORD GetFontData(
 );
 */
 
-static void
+static bool
 populate_log_font (LOGFONTW  *lf,
 		   HDC        hdc,
-		   hb_font_t *font,
-		   hb_blob_t *blob)
+		   hb_font_t *font)
 {
   memset (lf, 0, sizeof (*lf));
   int dpi = GetDeviceCaps (hdc, LOGPIXELSY);
   lf->lfHeight = MulDiv (font->x_scale, dpi, 72);
 
-  WCHAR family_name[] = {'n','a','z','l','i'};
-  for (unsigned int i = 0; family_name[i] && i < LF_FACESIZE - 1; i++)
-    lf->lfFaceName[i] = family_name[i];
+  hb_blob_t *blob = Sanitizer<name>::sanitize (hb_face_reference_table (font->face, HB_TAG ('n','a','m','e')));
+  const name *name_table = Sanitizer<name>::lock_instance (blob);
+  unsigned int len = name_table->get_name (3, 1, 0x409, 4,
+					   lf->lfFaceName,
+					   sizeof (lf->lfFaceName[0]) * LF_FACESIZE)
+					  / sizeof (lf->lfFaceName[0]);
+  if (unlikely (!len)) {
+    DEBUG_MSG (UNISCRIBE, NULL, "Didn't find English name table entry");
+    return FALSE;
+  }
+  if (unlikely (len >= LF_FACESIZE)) {
+    DEBUG_MSG (UNISCRIBE, NULL, "Font name too long");
+    return FALSE;
+  }
+  for (unsigned int i = 0; i < len; i++)
+    lf->lfFaceName[i] = hb_be_uint16 (lf->lfFaceName[i]);
+  lf->lfFaceName[len] = 0;
+  return TRUE;
 }
 
 hb_bool_t
@@ -179,6 +193,7 @@ retry:
 
   DWORD num_fonts_installed;
   HANDLE fh = AddFontMemResourceEx ((void *) blob_data, blob_length, 0, &num_fonts_installed);
+  hb_blob_destroy (blob);
   if (unlikely (!fh))
     FAIL ("AddFontMemResourceEx() failed");
 
@@ -187,7 +202,8 @@ retry:
   HDC hdc = GetDC (NULL); /* XXX The DC should be cached on the face I guess? */
 
   LOGFONTW log_font;
-  populate_log_font (&log_font, hdc, font, blob);
+  if (unlikely (!populate_log_font (&log_font, hdc, font)))
+    FAIL ("populate_log_font() failed");
 
   HFONT hfont = CreateFontIndirectW (&log_font);
   SelectObject (hdc, hfont);
diff --git a/src/test.cc b/src/test.cc
index 860e4d2..4051829 100644
--- a/src/test.cc
+++ b/src/test.cc
@@ -38,7 +38,6 @@
 #include <stdio.h>
 
 
-
 int
 main (int argc, char **argv)
 {
commit b492299eb3c398701557e452f6c2c9bd370fbbf3
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Aug 5 20:34:50 2011 -0400

    Start implementing the 'name' table

diff --git a/src/Makefile.am b/src/Makefile.am
index ff5a6d2..e999c6c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,11 +28,12 @@ HBSOURCES =  \
 	hb-open-type-private.hh \
 	hb-ot-head-private.hh \
 	hb-ot-maxp-private.hh \
+	hb-ot-name-private.hh \
+	hb-ot-tag.cc \
 	hb-private.hh \
 	hb-shape.cc \
 	hb-unicode-private.hh \
 	hb-unicode.cc \
-	hb-ot-tag.cc \
 	$(NULL)
 HBHEADERS = \
 	hb.h \
diff --git a/src/hb-ot-name-private.hh b/src/hb-ot-name-private.hh
new file mode 100644
index 0000000..cbc8c81
--- /dev/null
+++ b/src/hb-ot-name-private.hh
@@ -0,0 +1,91 @@
+/*
+ * Copyright © 2011  Google, Inc.
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_NAME_PRIVATE_HH
+#define HB_OT_NAME_PRIVATE_HH
+
+#include "hb-open-type-private.hh"
+
+
+
+/*
+ * name
+ */
+
+#define HB_OT_TAG_name HB_TAG('n','a','m','e')
+
+struct NameRecord
+{
+  inline bool sanitize (hb_sanitize_context_t *c, void *base) {
+    TRACE_SANITIZE ();
+    /* We can check from base all the way up to the end of string... */
+    return c->check_struct (this) &&
+	   c->check_range ((char *) base, (unsigned int) length + offset);
+  }
+
+  USHORT	platformID;	/* Platform ID. */
+  USHORT	encodingID;	/* Platform-specific encoding ID. */
+  USHORT	languageID;	/* Language ID. */
+  USHORT	nameID;		/* Name ID. */
+  USHORT	length;		/* String length (in bytes). */
+  USHORT	offset;		/* String offset from start of storage area (in bytes). */
+  public:
+  DEFINE_SIZE_STATIC (12);
+};
+
+struct name
+{
+  static const hb_tag_t Tag	= HB_OT_TAG_name;
+
+  inline bool sanitize_records (hb_sanitize_context_t *c) {
+    TRACE_SANITIZE ();
+    unsigned int _count = count;
+    for (unsigned int i = 0; i < _count; i++)
+      if (!nameRecord[i].sanitize (c, this + stringOffset)) return false;
+    return true;
+  }
+
+  inline bool sanitize (hb_sanitize_context_t *c) {
+    TRACE_SANITIZE ();
+    return c->check_struct (this) &&
+	   likely (format == 0 || format == 1) &&
+	   c->check_array (nameRecord, nameRecord[0].static_size, count) &&
+	   sanitize_records (c);
+  }
+
+  /* We only implement format 0 for now. */
+  private:
+  USHORT	format;			/* Format selector (=0/1). */
+  USHORT	count;			/* Number of name records. */
+  Offset	stringOffset;		/* Offset to start of string storage (from start of table). */
+  NameRecord	nameRecord[VAR];	/* The name records where count is the number of records. */
+  public:
+  DEFINE_SIZE_ARRAY (6, nameRecord);
+};
+
+
+
+#endif /* HB_OT_NAME_PRIVATE_HH */
diff --git a/src/hb-uniscribe-shape.cc b/src/hb-uniscribe-shape.cc
index 6c93f3b..ecc801e 100644
--- a/src/hb-uniscribe-shape.cc
+++ b/src/hb-uniscribe-shape.cc
@@ -28,17 +28,19 @@
 
 #include "hb-private.hh"
 
+#include <windows.h>
+#include <usp10.h>
+
+typedef ULONG WIN_ULONG;
+
 #include "hb-uniscribe.h"
 
+#include "hb-ot-name-private.hh"
 #include "hb-ot-tag.h"
 
 #include "hb-font-private.hh"
-
 #include "hb-buffer-private.hh"
 
-#include <windows.h>
-#include <usp10.h>
-
 
 
 #ifndef HB_DEBUG_UNISCRIBE
@@ -143,7 +145,7 @@ retry:
 
   SCRIPT_ITEM items[MAX_ITEMS + 1];
   SCRIPT_STATE bidi_state = {0};
-  ULONG script_tags[MAX_ITEMS];
+  WIN_ULONG script_tags[MAX_ITEMS];
   int item_count;
 
   bidi_state.uBidiLevel = HB_DIRECTION_IS_FORWARD (buffer->props.direction) ? 0 : 1;
commit 4538efacca84329a60ff69851de70027d9b4f567
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Aug 5 20:11:06 2011 -0400

    Skip tests by returning 77
    
    automake test runner understands this.

diff --git a/src/check-internal-symbols.sh b/src/check-internal-symbols.sh
index 2885fa4..a2f32b1 100755
--- a/src/check-internal-symbols.sh
+++ b/src/check-internal-symbols.sh
@@ -11,7 +11,7 @@ if which nm 2>/dev/null >/dev/null; then
 	:
 else
 	echo "check-internal-symbols.sh: 'nm' not found; skipping test"
-	exit 0
+	exit 77
 fi
 
 so=.libs/libharfbuzz.so
@@ -23,6 +23,7 @@ if test -f "$so"; then
 	fi
 else
 	echo "check-internal-symbols.sh: libharfbuzz.so not found; skipping test"
+	exit 77
 fi
 
 exit $stat
diff --git a/src/check-libstdc++.sh b/src/check-libstdc++.sh
index 40e73b0..bbc8ac3 100755
--- a/src/check-libstdc++.sh
+++ b/src/check-libstdc++.sh
@@ -11,7 +11,7 @@ if which ldd 2>/dev/null >/dev/null; then
 	:
 else
 	echo "check-libstdc++.sh: 'ldd' not found; skipping test"
-	exit 0
+	exit 77
 fi
 
 so=.libs/libharfbuzz.so
@@ -23,6 +23,7 @@ if test -f "$so"; then
 	fi
 else
 	echo "check-libstdc++.sh: libharfbuzz.so not found; skipping test"
+	exit 77
 fi
 
 exit $stat



More information about the HarfBuzz mailing list