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

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu May 17 18:24:01 PDT 2012


 TODO                     |   12 ++++--
 src/Makefile.am          |    1 
 src/hb-atomic-private.hh |   84 +++++++++++++++++++++++++++++++++++++++++++++++
 src/hb-mutex-private.hh  |   25 +++++++------
 src/hb-object-private.hh |   52 +----------------------------
 src/hb-set-private.hh    |    4 +-
 src/hb-set.cc            |    4 +-
 src/hb-tt-font.cc        |    3 +
 src/hb-warning.cc        |    2 -
 9 files changed, 116 insertions(+), 71 deletions(-)

New commits:
commit 22afd66a30d01b6771405e76777306f600807bea
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu May 17 21:23:49 2012 -0400

    Add hb_atomic_int_set() again

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index f9050c3..60b319a 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -44,7 +44,8 @@
 
 #include <intrin.h>
 typedef long hb_atomic_int_t;
-#define hb_atomic_int_add(AI, V)	_InterlockedExchangeAdd (&(AI), V)
+#define hb_atomic_int_add(AI, V)	_InterlockedExchangeAdd (&(AI), (V))
+#define hb_atomic_int_set(AI, V)	_InterlockedExchange (&(AI), (V))
 #define hb_atomic_int_get(AI)		(_ReadBarrier (), (AI))
 
 
@@ -61,10 +62,11 @@ typedef int32_t hb_atomic_int_t;
 #include <glib.h>
 typedef volatile int hb_atomic_int_t;
 #if GLIB_CHECK_VERSION(2,29,5)
-#define hb_atomic_int_add(AI, V)	g_atomic_int_add (&(AI), V)
+#define hb_atomic_int_add(AI, V)	g_atomic_int_add (&(AI), (V))
 #else
-#define hb_atomic_int_add(AI, V)	g_atomic_int_exchange_and_add (&(AI), V)
+#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))
 
 
@@ -73,6 +75,7 @@ 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), (AI) - (V))
+#define hb_atomic_int_set(AI)		((void) ((AI) = (V)))
 #define hb_atomic_int_get(AI)		(AI)
 
 #endif
commit 4aa7258cb16176a89e1547fee8f86571fdd98307
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu May 17 21:01:04 2012 -0400

    Fix type conflicts on Windows without glib

diff --git a/src/hb-tt-font.cc b/src/hb-tt-font.cc
index ccd86e1..b2f24f6 100644
--- a/src/hb-tt-font.cc
+++ b/src/hb-tt-font.cc
@@ -24,12 +24,13 @@
  * Google Author(s): Behdad Esfahbod
  */
 
+#include "hb-font-private.hh" /* Shall be first since may include windows.h */
+
 #include "hb-open-type-private.hh"
 
 #include "hb-ot-hhea-table.hh"
 #include "hb-ot-hmtx-table.hh"
 
-#include "hb-font-private.hh"
 #include "hb-blob.h"
 
 #include <string.h>
commit f039e79d5438a8fc4a3ec11a387bbfc0f6b83024
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu May 17 20:55:12 2012 -0400

    Don't use min/max as function names
    
    They can be macros on some systems.  Eg. mingw32.

diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index 3a7eb81..717e530 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -102,7 +102,7 @@ struct _hb_set_t
     for (unsigned int i = 0; i < ELTS; i++)
       elts[i] &= ~other->elts[i];
   }
-  inline hb_codepoint_t min (void) const
+  inline hb_codepoint_t get_min (void) const
   {
     for (unsigned int i = 0; i < ELTS; i++)
       if (elts[i])
@@ -111,7 +111,7 @@ struct _hb_set_t
 	    return i * BITS + j;
     return 0;
   }
-  inline hb_codepoint_t max (void) const
+  inline hb_codepoint_t get_max (void) const
   {
     for (unsigned int i = ELTS; i; i--)
       if (elts[i - 1])
diff --git a/src/hb-set.cc b/src/hb-set.cc
index 9d013a1..0e8adde 100644
--- a/src/hb-set.cc
+++ b/src/hb-set.cc
@@ -167,11 +167,11 @@ hb_set_subtract (hb_set_t *set,
 hb_codepoint_t
 hb_set_min (hb_set_t *set)
 {
-  return set->min ();
+  return set->get_min ();
 }
 
 hb_codepoint_t
 hb_set_max (hb_set_t *set)
 {
-  return set->max ();
+  return set->get_max ();
 }
commit 34961e3198e27fa37fd4cfdad12ef86a2e9e51c2
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu May 17 20:50:38 2012 -0400

    Prefer native atomic/mutex ops to glib's

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index c4dabe1..f9050c3 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -1,7 +1,7 @@
 /*
  * Copyright © 2007  Chris Wilson
  * Copyright © 2009,2010  Red Hat, Inc.
- * Copyright © 2011  Google, Inc.
+ * Copyright © 2011,2012  Google, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
@@ -39,25 +39,15 @@
 
 /* We need external help for these */
 
-#if !defined(HB_NO_MT) && defined(HAVE_GLIB)
-
-#include <glib.h>
-typedef volatile int hb_atomic_int_t;
-#if GLIB_CHECK_VERSION(2,29,5)
-#define hb_atomic_int_add(AI, V)	g_atomic_int_add (&(AI), V)
-#else
-#define hb_atomic_int_add(AI, V)	g_atomic_int_exchange_and_add (&(AI), V)
-#endif
-#define hb_atomic_int_get(AI)		g_atomic_int_get (&(AI))
 
-
-#elif !defined(HB_NO_MT) && defined(_MSC_VER) && _MSC_VER >= 1600
+#if !defined(HB_NO_MT) && defined(_MSC_VER) && _MSC_VER >= 1600
 
 #include <intrin.h>
 typedef long hb_atomic_int_t;
 #define hb_atomic_int_add(AI, V)	_InterlockedExchangeAdd (&(AI), V)
 #define hb_atomic_int_get(AI)		(_ReadBarrier (), (AI))
 
+
 #elif !defined(HB_NO_MT) && defined(__APPLE__)
 
 #include <libkern/OSAtomic.h>
@@ -65,6 +55,19 @@ typedef int32_t hb_atomic_int_t;
 #define hb_atomic_int_add(AI, V)	(OSAtomicAdd32Barrier((V), &(AI)), (AI) - (V))
 #define hb_atomic_int_get(AI)		OSAtomicAdd32Barrier(0, &(AI))
 
+
+#elif !defined(HB_NO_MT) && defined(HAVE_GLIB)
+
+#include <glib.h>
+typedef volatile int hb_atomic_int_t;
+#if GLIB_CHECK_VERSION(2,29,5)
+#define hb_atomic_int_add(AI, V)	g_atomic_int_add (&(AI), V)
+#else
+#define hb_atomic_int_add(AI, V)	g_atomic_int_exchange_and_add (&(AI), V)
+#endif
+#define hb_atomic_int_get(AI)		g_atomic_int_get (&(AI))
+
+
 #else
 
 #define HB_ATOMIC_INT_NIL 1
diff --git a/src/hb-mutex-private.hh b/src/hb-mutex-private.hh
index 95228f8..bdb438f 100644
--- a/src/hb-mutex-private.hh
+++ b/src/hb-mutex-private.hh
@@ -39,17 +39,8 @@
 
 /* We need external help for these */
 
-#if !defined(HB_NO_MT) && defined(HAVE_GLIB)
 
-#include <glib.h>
-typedef GStaticMutex hb_mutex_impl_t;
-#define HB_MUTEX_IMPL_INIT	G_STATIC_MUTEX_INIT
-#define hb_mutex_impl_init(M)	g_static_mutex_init (M)
-#define hb_mutex_impl_lock(M)	g_static_mutex_lock (M)
-#define hb_mutex_impl_unlock(M)	g_static_mutex_unlock (M)
-#define hb_mutex_impl_free(M)	g_static_mutex_free (M)
-
-#elif !defined(HB_NO_MT) && defined(_MSC_VER) || defined(__MINGW32__)
+#if !defined(HB_NO_MT) && defined(_MSC_VER) || defined(__MINGW32__)
 
 #include <windows.h>
 typedef CRITICAL_SECTION hb_mutex_impl_t;
@@ -59,6 +50,7 @@ typedef CRITICAL_SECTION hb_mutex_impl_t;
 #define hb_mutex_impl_unlock(M)	LeaveCriticalSection (M)
 #define hb_mutex_impl_free(M)	DeleteCriticalSection (M)
 
+
 #elif !defined(HB_NO_MT) && defined(__APPLE__)
 
 #include <pthread.h>
@@ -69,6 +61,18 @@ typedef pthread_mutex_t hb_mutex_impl_t;
 #define hb_mutex_impl_unlock(M)	pthread_mutex_unlock (M)
 #define hb_mutex_impl_free(M)	pthread_mutex_destroy (M)
 
+
+#elif !defined(HB_NO_MT) && defined(HAVE_GLIB)
+
+#include <glib.h>
+typedef GStaticMutex hb_mutex_impl_t;
+#define HB_MUTEX_IMPL_INIT	G_STATIC_MUTEX_INIT
+#define hb_mutex_impl_init(M)	g_static_mutex_init (M)
+#define hb_mutex_impl_lock(M)	g_static_mutex_lock (M)
+#define hb_mutex_impl_unlock(M)	g_static_mutex_unlock (M)
+#define hb_mutex_impl_free(M)	g_static_mutex_free (M)
+
+
 #else
 
 #define HB_MUTEX_IMPL_NIL 1
commit ec3ba4b96fc4f262db1ff9f906628c32f26c9b7d
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu May 17 20:30:46 2012 -0400

    Move atomic ops into their own header

diff --git a/src/Makefile.am b/src/Makefile.am
index 63d4e31..fc4cb29 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,6 +15,7 @@ lib_LTLIBRARIES = libharfbuzz.la
 HBCFLAGS =
 HBLIBS =
 HBSOURCES =  \
+	hb-atomic-private.hh \
 	hb-blob.cc \
 	hb-buffer-private.hh \
 	hb-buffer.cc \
diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
new file mode 100644
index 0000000..c4dabe1
--- /dev/null
+++ b/src/hb-atomic-private.hh
@@ -0,0 +1,78 @@
+/*
+ * Copyright © 2007  Chris Wilson
+ * Copyright © 2009,2010  Red Hat, Inc.
+ * 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.
+ *
+ * Contributor(s):
+ *	Chris Wilson <chris at chris-wilson.co.uk>
+ * Red Hat Author(s): Behdad Esfahbod
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_ATOMIC_PRIVATE_HH
+#define HB_ATOMIC_PRIVATE_HH
+
+#include "hb-private.hh"
+
+
+/* atomic_int */
+
+/* We need external help for these */
+
+#if !defined(HB_NO_MT) && defined(HAVE_GLIB)
+
+#include <glib.h>
+typedef volatile int hb_atomic_int_t;
+#if GLIB_CHECK_VERSION(2,29,5)
+#define hb_atomic_int_add(AI, V)	g_atomic_int_add (&(AI), V)
+#else
+#define hb_atomic_int_add(AI, V)	g_atomic_int_exchange_and_add (&(AI), V)
+#endif
+#define hb_atomic_int_get(AI)		g_atomic_int_get (&(AI))
+
+
+#elif !defined(HB_NO_MT) && defined(_MSC_VER) && _MSC_VER >= 1600
+
+#include <intrin.h>
+typedef long hb_atomic_int_t;
+#define hb_atomic_int_add(AI, V)	_InterlockedExchangeAdd (&(AI), V)
+#define hb_atomic_int_get(AI)		(_ReadBarrier (), (AI))
+
+#elif !defined(HB_NO_MT) && defined(__APPLE__)
+
+#include <libkern/OSAtomic.h>
+typedef int32_t hb_atomic_int_t;
+#define hb_atomic_int_add(AI, V)	(OSAtomicAdd32Barrier((V), &(AI)), (AI) - (V))
+#define hb_atomic_int_get(AI)		OSAtomicAdd32Barrier(0, &(AI))
+
+#else
+
+#define HB_ATOMIC_INT_NIL 1
+typedef volatile int hb_atomic_int_t;
+#define hb_atomic_int_add(AI, V)	((AI) += (V), (AI) - (V))
+#define hb_atomic_int_get(AI)		(AI)
+
+#endif
+
+
+#endif /* HB_ATOMIC_PRIVATE_HH */
diff --git a/src/hb-mutex-private.hh b/src/hb-mutex-private.hh
index 7b960c5..95228f8 100644
--- a/src/hb-mutex-private.hh
+++ b/src/hb-mutex-private.hh
@@ -35,7 +35,6 @@
 #include "hb-private.hh"
 
 
-
 /* mutex */
 
 /* We need external help for these */
diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh
index 754dcfa..edd8921 100644
--- a/src/hb-object-private.hh
+++ b/src/hb-object-private.hh
@@ -34,10 +34,10 @@
 
 #include "hb-private.hh"
 
+#include "hb-atomic-private.hh"
 #include "hb-mutex-private.hh"
 
 
-
 /* Debug */
 
 #ifndef HB_DEBUG_OBJECT
@@ -45,49 +45,6 @@
 #endif
 
 
-/* atomic_int */
-
-/* We need external help for these */
-
-#if !defined(HB_NO_MT) && defined(HAVE_GLIB)
-
-#include <glib.h>
-typedef volatile int hb_atomic_int_t;
-#if GLIB_CHECK_VERSION(2,29,5)
-#define hb_atomic_int_add(AI, V)	g_atomic_int_add (&(AI), V)
-#else
-#define hb_atomic_int_add(AI, V)	g_atomic_int_exchange_and_add (&(AI), V)
-#endif
-#define hb_atomic_int_get(AI)		g_atomic_int_get (&(AI))
-
-
-#elif !defined(HB_NO_MT) && defined(_MSC_VER) && _MSC_VER >= 1600
-
-#include <intrin.h>
-typedef long hb_atomic_int_t;
-#define hb_atomic_int_add(AI, V)	_InterlockedExchangeAdd (&(AI), V)
-#define hb_atomic_int_get(AI)		(_ReadBarrier (), (AI))
-
-#elif !defined(HB_NO_MT) && defined(__APPLE__)
-
-#include <libkern/OSAtomic.h>
-typedef int32_t hb_atomic_int_t;
-#define hb_atomic_int_add(AI, V)	(OSAtomicAdd32Barrier((V), &(AI)), (AI) - (V))
-#define hb_atomic_int_get(AI)		OSAtomicAdd32Barrier(0, &(AI))
-
-#else
-
-#define HB_ATOMIC_INT_NIL 1
-
-typedef volatile int hb_atomic_int_t;
-#define hb_atomic_int_add(AI, V)	((AI) += (V), (AI) - (V))
-#define hb_atomic_int_get(AI)		(AI)
-
-#endif
-
-
-
-
 /* reference_count */
 
 typedef struct {
@@ -198,7 +155,7 @@ struct _hb_object_header_t {
   inline void trace (const char *function) const {
     if (unlikely (!this)) return;
     /* XXX We cannot use DEBUG_MSG_FUNC here since that one currecntly only
-     * prints the class name and throughs away the template info. */
+     * prints the class name and throws away the template info. */
     DEBUG_MSG (OBJECT, (void *) this,
 	       "%s refcount=%d",
 	       function,
@@ -208,8 +165,6 @@ struct _hb_object_header_t {
 };
 
 
-
-
 /* object */
 
 template <typename Type>
@@ -260,7 +215,4 @@ static inline void *hb_object_get_user_data (Type               *obj,
 }
 
 
-
-
-
 #endif /* HB_OBJECT_PRIVATE_HH */
diff --git a/src/hb-warning.cc b/src/hb-warning.cc
index 1ba0f99..6b5585f 100644
--- a/src/hb-warning.cc
+++ b/src/hb-warning.cc
@@ -24,8 +24,8 @@
  * Google Author(s): Behdad Esfahbod
  */
 
+#include "hb-atomic-private.hh"
 #include "hb-mutex-private.hh"
-#include "hb-object-private.hh"
 
 
 #if !defined(HB_NO_MT) && defined(HB_ATOMIC_INT_NIL)
commit de0878395be5c72d7058faac8f64715bdd42eb3b
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu May 17 20:15:49 2012 -0400

    Update TODO

diff --git a/TODO b/TODO
index b6b7c89..8918fd0 100644
--- a/TODO
+++ b/TODO
@@ -18,12 +18,14 @@ General fixes:
   layer, such that uniscribe and other backends can use.
 
 - Uniscribe backend needs to enforce one direction only, otherwise cluster
-  values can confused the user.
+  values can confuse the user.
 
-- GSUB ligation should call merge_clusters().
+- GSUB ligation should call merge_clusters().  Also other places.
 
 - Convert NBSP into space glyph.
 
+- Synthetic GDEF.
+
 
 API issues to fix before 1.0:
 ============================
@@ -34,6 +36,8 @@ API issues to fix before 1.0:
 
 - 'const' for getter APIs? (use mutable internally)
 
+- blob_from_file?
+
 
 API additions
 =============
@@ -65,8 +69,6 @@ API additions
 
 - Add hb-fribidi glue?
 
-- Add segmentation API
-
 
 hb-view / hb-shape enhancements:
 ===============================
@@ -96,3 +98,5 @@ Optimizations:
 - Avoid allocating blob objects internally for for_data() faces?
 
 - Add caching layer to hb-ft?
+
+- Cache feature-less shape plans internally on the face.



More information about the HarfBuzz mailing list