[HarfBuzz] harfbuzz: Branch 'master' - 4 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Feb 12 12:36:14 PST 2013


 configure.ac                             |    4 +-
 src/hb-atomic-private.hh                 |    2 -
 src/hb-common.cc                         |   20 ++++++++++-
 src/hb-mutex-private.hh                  |    2 -
 src/hb-ot-shape-complex-indic-private.hh |    2 -
 src/hb-ot-shape-complex-indic.cc         |   53 ++-----------------------------
 src/hb-ot-shape-complex-myanmar.cc       |    7 +---
 src/hb-private.hh                        |   29 ++++++++++++++++
 util/options.cc                          |    4 +-
 util/options.hh                          |    2 -
 10 files changed, 62 insertions(+), 63 deletions(-)

New commits:
commit e2aab4b5db88c368c11cee81368b9ad41399e585
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Feb 12 15:35:32 2013 -0500

    Improve checks for setmode()
    
    As reported by Jonathan, OS X has setmode() that is something other
    than what setmode() is on Win32.  So, limit invocation to Windows
    platforms only.

diff --git a/configure.ac b/configure.ac
index 8ae0d01..370cba3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,8 +55,8 @@ dnl GOBJECT_INTROSPECTION_CHECK([0.9.0])
 dnl GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
 
 # Functions and headers
-AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap setmode isatty)
-AC_CHECK_HEADERS(unistd.h sys/mman.h io.h)
+AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty)
+AC_CHECK_HEADERS(unistd.h sys/mman.h)
 
 # Compiler flags
 AC_CANONICAL_HOST
diff --git a/util/options.cc b/util/options.cc
index bd4d55e..5e57548 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -413,7 +413,7 @@ font_options_t::get_font (void) const
       /* read it */
       GString *gs = g_string_new (NULL);
       char buf[BUFSIZ];
-#ifdef HAVE_SETMODE
+#if defined(_WIN32) || defined(__CYGWIN__)
       setmode (fileno (stdin), _O_BINARY);
 #endif
       while (!feof (stdin)) {
@@ -557,7 +557,7 @@ output_options_t::get_file_handle (void)
   if (output_file)
     fp = fopen (output_file, "wb");
   else {
-#ifdef HAVE_SETMODE
+#if defined(_WIN32) || defined(__CYGWIN__)
     setmode (fileno (stdout), _O_BINARY);
 #endif
     fp = stdout;
diff --git a/util/options.hh b/util/options.hh
index 298a3f2..8944067 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -43,7 +43,7 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h> /* for isatty() */
 #endif
-#ifdef HAVE_IO_H
+#if defined(_WIN32) || defined(__CYGWIN__)
 #include <io.h> /* for setmode() under Windows */
 #endif
 
commit a6c1e040e594faeefd61b456ef995c7886cdea78
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Feb 12 15:31:58 2013 -0500

    Improve check for Windows platforms
    
    Instead of checking for compiler, check for platform.

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index c7456e0..bb10fe1 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -42,7 +42,7 @@
 #if 0
 
 
-#elif !defined(HB_NO_MT) && (defined(_MSC_VER) || defined(__MINGW32__))
+#elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__))
 
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
diff --git a/src/hb-mutex-private.hh b/src/hb-mutex-private.hh
index fcbdb31..0fb21c2 100644
--- a/src/hb-mutex-private.hh
+++ b/src/hb-mutex-private.hh
@@ -42,7 +42,7 @@
 #if 0
 
 
-#elif !defined(HB_NO_MT) && (defined(_MSC_VER) || defined(__MINGW32__))
+#elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__))
 
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
commit 9e1f80ab3eea4a74cdaa6a390e4925a479ece1c5
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Feb 12 15:28:21 2013 -0500

    [SEA] Treat Consonant_Final like Consonant_Medial

diff --git a/src/hb-ot-shape-complex-indic-private.hh b/src/hb-ot-shape-complex-indic-private.hh
index cb33de1..39268b1 100644
--- a/src/hb-ot-shape-complex-indic-private.hh
+++ b/src/hb-ot-shape-complex-indic-private.hh
@@ -97,7 +97,7 @@ enum indic_syllabic_category_t {
   INDIC_SYLLABIC_CATEGORY_BINDU			= OT_SM,
   INDIC_SYLLABIC_CATEGORY_CONSONANT		= OT_C,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD	= OT_C,
-  INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL	= OT_C,
+  INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL	= OT_CM,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_HEAD_LETTER	= OT_C,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL	= OT_CM,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER	= OT_NBSP,
commit bab02d339f39ed5168daaef9461227f78e596a2f
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Feb 12 15:26:45 2013 -0500

    Rename HB_OT_INDIC_OPTIONS env var to HB_OPTIONS
    
    The Myanmar shaper now respects the uniscribe-bug-compatibility
    option too.

diff --git a/src/hb-common.cc b/src/hb-common.cc
index 27ecfa7..540d252 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -36,6 +36,24 @@
 #include <locale.h>
 
 
+/* hb_options_t */
+
+hb_options_union_t _hb_options;
+
+void
+_hb_options_init (void)
+{
+  hb_options_union_t u;
+  u.i = 0;
+  u.opts.initialized = 1;
+
+  char *c = getenv ("HB_OPTIONS");
+  u.opts.uniscribe_bug_compatible = c && strstr (c, "uniscribe-bug-compatible");
+
+  /* This is idempotent and threadsafe. */
+  _hb_options = u;
+}
+
 
 /* hb_tag_t */
 
@@ -414,5 +432,3 @@ hb_version_check (unsigned int major,
 {
   return HB_VERSION_CHECK (major, minor, micro);
 }
-
-
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index fe62783..41872df 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -268,49 +268,6 @@ set_indic_properties (hb_glyph_info_t &info)
 
 
 /*
- * Global Indic shaper options.
- */
-
-struct indic_options_t
-{
-  int initialized : 1;
-  int uniscribe_bug_compatible : 1;
-};
-
-union indic_options_union_t {
-  int i;
-  indic_options_t opts;
-};
-ASSERT_STATIC (sizeof (int) == sizeof (indic_options_union_t));
-
-static indic_options_union_t
-indic_options_init (void)
-{
-  indic_options_union_t u;
-  u.i = 0;
-  u.opts.initialized = 1;
-
-  char *c = getenv ("HB_OT_INDIC_OPTIONS");
-  u.opts.uniscribe_bug_compatible = c && strstr (c, "uniscribe-bug-compatible");
-
-  return u;
-}
-
-static inline indic_options_t
-indic_options (void)
-{
-  static indic_options_union_t options;
-
-  if (unlikely (!options.i)) {
-    /* This is idempotent and threadsafe. */
-    options = indic_options_init ();
-  }
-
-  return options.opts;
-}
-
-
-/*
  * Indic configurations.  Note that we do not want to keep every single script-specific
  * behavior in these tables necessarily.  This should mainly be used for per-script
  * properties that are cheaper keeping here, than in the code.  Ie. if, say, one and
@@ -484,7 +441,7 @@ static void
 override_features_indic (hb_ot_shape_planner_t *plan)
 {
   /* Uniscribe does not apply 'kern'. */
-  if (indic_options ().uniscribe_bug_compatible)
+  if (hb_options ().uniscribe_bug_compatible)
     plan->map.add_feature (HB_TAG('k','e','r','n'), 0, true);
 
   plan->map.add_feature (HB_TAG('l','i','g','a'), 0, true);
@@ -1044,7 +1001,7 @@ initial_reordering_standalone_cluster (const hb_ot_shape_plan_t *plan,
   /* We treat NBSP/dotted-circle as if they are consonants, so we should just chain.
    * Only if not in compatibility mode that is... */
 
-  if (indic_options ().uniscribe_bug_compatible)
+  if (hb_options ().uniscribe_bug_compatible)
   {
     /* For dotted-circle, this is what Uniscribe does:
      * If dotted-circle is the last glyph, it just does nothing.
@@ -1380,7 +1337,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
        * Uniscribe doesn't do this.
        * TEST: U+0930,U+094D,U+0915,U+094B,U+094D
        */
-      if (!indic_options ().uniscribe_bug_compatible &&
+      if (!hb_options ().uniscribe_bug_compatible &&
 	  unlikely (is_halant_or_coeng (info[new_reph_pos]))) {
 	for (unsigned int i = base + 1; i < new_reph_pos; i++)
 	  if (info[i].indic_category() == OT_M) {
@@ -1484,7 +1441,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
   /*
    * Finish off the clusters and go home!
    */
-  if (indic_options ().uniscribe_bug_compatible)
+  if (hb_options ().uniscribe_bug_compatible)
   {
     /* Uniscribe merges the entire cluster.
      * This means, half forms are submerged into the main consonants cluster.
@@ -1600,7 +1557,7 @@ decompose_indic (const hb_ot_shape_normalize_context_t *c,
 
     hb_codepoint_t glyph;
 
-    if (indic_options ().uniscribe_bug_compatible ||
+    if (hb_options ().uniscribe_bug_compatible ||
 	(c->font->get_glyph (ab, 0, &glyph) &&
 	 indic_plan->pstf.would_substitute (&glyph, 1, true, c->font->face)))
     {
diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc
index 27a656d..8c7697f 100644
--- a/src/hb-ot-shape-complex-myanmar.cc
+++ b/src/hb-ot-shape-complex-myanmar.cc
@@ -128,12 +128,9 @@ override_features_myanmar (hb_ot_shape_planner_t *plan)
    * Windows 8 has lookups for it.  But testing suggests that
    * Windows 8 Uniscribe is NOT applying it.  It *is* applying
    * 'mkmk' however.
-   *
-   * We want to apply it, since that's the right thing to do.
    */
-#if 0
-  plan->map.add_feature (HB_TAG('m','a','r','k'), 0, true);
-#endif
+  if (hb_options ().uniscribe_bug_compatible)
+    plan->map.add_feature (HB_TAG('m','a','r','k'), 0, true);
 }
 
 
diff --git a/src/hb-private.hh b/src/hb-private.hh
index be0d505..15e4f5f 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -854,4 +854,33 @@ hb_codepoint_parse (const char *s, unsigned int len, int base, hb_codepoint_t *o
 }
 
 
+/* Global runtime options. */
+
+struct hb_options_t
+{
+  int initialized : 1;
+  int uniscribe_bug_compatible : 1;
+};
+
+union hb_options_union_t {
+  int i;
+  hb_options_t opts;
+};
+ASSERT_STATIC (sizeof (int) == sizeof (hb_options_union_t));
+
+HB_INTERNAL void
+_hb_options_init (void);
+
+extern HB_INTERNAL hb_options_union_t _hb_options;
+
+static inline hb_options_t
+hb_options (void)
+{
+  if (unlikely (!_hb_options.i))
+    _hb_options_init ();
+
+  return _hb_options.opts;
+}
+
+
 #endif /* HB_PRIVATE_HH */



More information about the HarfBuzz mailing list