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

2012-07-30 Thread Behdad Esfahbod
 src/hb-old/harfbuzz-arabic.c|  
 12 +++---
 src/hb-old/harfbuzz-gpos.c  |  
  6 ++---
 src/hb-old/harfbuzz-gsub.c  |  
  6 ++---
 src/hb-old/harfbuzz-tibetan.c   |  
  1 
 src/hb-ot-shape-complex-arabic.cc   |  
  2 -
 src/hb-ot-shape-complex-indic.cc|  
  4 ---
 src/hb-ot-shape-complex-misc.cc |  
 12 +++---
 src/hb-ot-shape-complex-private.hh  |  
  9 +++
 src/hb-ot-shape.cc  |  
  4 ++-
 src/hb-unicode.cc   |  
  8 ++
 src/indic.cc|  
 11 ++---
 test/shaping/texts/in-tree/shaper-default/script-hebrew/misc/diacritics.txt |  
  1 
 12 files changed, 51 insertions(+), 25 deletions(-)

New commits:
commit 7e34601dededd521bcef15111e39293df3d0d13d
Author: Behdad Esfahbod beh...@behdad.org
Date:   Mon Jul 30 14:53:41 2012 -0400

Unbreak Hangul jamo composition

When we removed the separate Hangul shaper, the specific normalization
preference of Hangul was lost.  Fix that.  Also, the Thai shaper was
copied from Hangul, so had the fully-composed normalization behavior,
which was unnecessary.  So, fix that too.

diff --git a/src/hb-ot-shape-complex-arabic.cc 
b/src/hb-ot-shape-complex-arabic.cc
index 75f5fe9..1f63c12 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -206,7 +206,7 @@ _hb_ot_shape_complex_override_features_arabic 
(hb_ot_map_builder_t *map,
 }
 
 hb_ot_shape_normalization_mode_t
-_hb_ot_shape_complex_normalization_preference_arabic (void)
+_hb_ot_shape_complex_normalization_preference_arabic (const 
hb_segment_properties_t *props)
 {
   return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
 }
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index e4c151a..c7025ff 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -420,10 +420,8 @@ _hb_ot_shape_complex_override_features_indic 
(hb_ot_map_builder_t *map,
 
 
 hb_ot_shape_normalization_mode_t
-_hb_ot_shape_complex_normalization_preference_indic (void)
+_hb_ot_shape_complex_normalization_preference_indic (const 
hb_segment_properties_t *props)
 {
-  /* We want split matras decomposed by the common shaping logic. */
-  /* XXX sort this out after adding per-shaper normalizers. */
   return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
 }
 
diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc
index 4578f0b..4b9e6a6 100644
--- a/src/hb-ot-shape-complex-misc.cc
+++ b/src/hb-ot-shape-complex-misc.cc
@@ -79,8 +79,14 @@ _hb_ot_shape_complex_override_features_default 
(hb_ot_map_builder_t *map HB_UNUS
 }
 
 hb_ot_shape_normalization_mode_t
-_hb_ot_shape_complex_normalization_preference_default (void)
+_hb_ot_shape_complex_normalization_preference_default (const 
hb_segment_properties_t *props)
 {
+  switch ((hb_tag_t) props-script)
+  {
+/* Unicode-1.1 additions */
+case HB_SCRIPT_HANGUL:
+  return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL;
+  }
   return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
 }
 
@@ -108,9 +114,9 @@ _hb_ot_shape_complex_override_features_thai 
(hb_ot_map_builder_t *map HB_UNUSED,
 }
 
 hb_ot_shape_normalization_mode_t
-_hb_ot_shape_complex_normalization_preference_thai (void)
+_hb_ot_shape_complex_normalization_preference_thai (const 
hb_segment_properties_t *props HB_UNUSED)
 {
-  return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL;
+  return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
 }
 
 void
diff --git a/src/hb-ot-shape-complex-private.hh 
b/src/hb-ot-shape-complex-private.hh
index d444cd6..689ca61 100644
--- a/src/hb-ot-shape-complex-private.hh
+++ b/src/hb-ot-shape-complex-private.hh
@@ -270,23 +270,22 @@ hb_ot_shape_complex_override_features 
(hb_ot_complex_shaper_t shaper,
  * normalization_preference()
  *
  * Called during shape_execute().
- *
- * Shapers should return true if it prefers decomposed (NFD) input rather than 
precomposed (NFC).
  */
 
-typedef hb_ot_shape_normalization_mode_t 
hb_ot_shape_complex_normalization_preference_func_t (void);
+typedef hb_ot_shape_normalization_mode_t 
hb_ot_shape_complex_normalization_preference_func_t (const 
hb_segment_properties_t *props HB_UNUSED);
 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
   HB_INTERNAL hb_ot_shape_complex_normalization_preference_func_t 
_hb_ot_shape_complex_normalization_preference_##name;
   HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
 #undef HB_COMPLEX_SHAPER_IMPLEMENT
 
 static inline hb_ot_shape_normalization_mode_t

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

2012-05-27 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-indic-machine.rl |2 +-
 src/hb-ot-shape-complex-indic.cc |2 +-
 src/hb-set-private.hh|   31 ---
 src/hb-set.cc|   14 ++
 src/hb-set.h |   13 +
 util/hb-ot-shape-closure.cc  |8 +---
 util/helper-cairo.cc |2 +-
 util/options.cc  |6 +-
 8 files changed, 68 insertions(+), 10 deletions(-)

New commits:
commit 8f8956a55fff95e5ad529d2f124c9528d1f4f81d
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri May 25 14:30:24 2012 -0400

[util] Add hidden --shaper that is equivalent of --shapers

diff --git a/util/helper-cairo.cc b/util/helper-cairo.cc
index de45fb3..77fd1a6 100644
--- a/util/helper-cairo.cc
+++ b/util/helper-cairo.cc
@@ -297,7 +297,7 @@ helper_cairo_create_context (double w, double h,
 
 
   unsigned int fr, fg, fb, fa, br, bg, bb, ba;
-  br = bg = bb = ba = 255;
+  br = bg = bb = 0; ba = 255;
   sscanf (view_opts-back + (*view_opts-back=='#'), %2x%2x%2x%2x, br, bg, 
bb, ba);
   fr = fg = fb = 0; fa = 255;
   sscanf (view_opts-fore + (*view_opts-fore=='#'), %2x%2x%2x%2x, fr, fg, 
fb, fa);
diff --git a/util/options.cc b/util/options.cc
index 363a150..463daee 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2011  Google, Inc.
+ * Copyright © 2011,2012  Google, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
@@ -178,6 +178,7 @@ parse_shapers (const char *name G_GNUC_UNUSED,
   GError**error G_GNUC_UNUSED)
 {
   shape_options_t *shape_opts = (shape_options_t *) data;
+  g_free (shape_opts-shapers);
   shape_opts-shapers = g_strsplit (arg, ,, 0);
   return TRUE;
 }
@@ -330,6 +331,7 @@ parse_features (const char *name G_GNUC_UNUSED,
   char *p;
 
   shape_opts-num_features = 0;
+  g_free (shape_opts-features);
   shape_opts-features = NULL;
 
   if (!*s)
@@ -387,6 +389,8 @@ shape_options_t::add_options (option_parser_t *parser)
   {
 {list-shapers,   0, G_OPTION_FLAG_NO_ARG,
  G_OPTION_ARG_CALLBACK,(gpointer) 
list_shapers,   List available shapers and quit,  NULL},
+{shaper, 0, G_OPTION_FLAG_HIDDEN,
+ G_OPTION_ARG_CALLBACK,(gpointer) 
parse_shapers,  Hidden duplicate of --shapers,NULL},
 {shapers,0, 0, G_OPTION_ARG_CALLBACK,(gpointer) 
parse_shapers,  Comma-separated list of shapers to try,list},
 {direction,  0, 0, G_OPTION_ARG_STRING,  this-direction,   
Set text direction (default: auto),   ltr/rtl/ttb/btt},
 {language,   0, 0, G_OPTION_ARG_STRING,  this-language,
Set text language (default: $LANG),   langstr},
commit 29ce446d3161b7ea5874352e5f8eb33cd59338c3
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri May 25 14:17:54 2012 -0400

Add set iterator

diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index df96b99..9d8ba4a 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -32,6 +32,7 @@
 #include hb-object-private.hh
 
 
+/* TODO Make this faster and memmory efficient. */
 
 struct _hb_set_t
 {
@@ -51,6 +52,7 @@ struct _hb_set_t
   }
   inline void add (hb_codepoint_t g)
   {
+if (unlikely (g == SENTINEL)) return;
 if (unlikely (g  MAX_G)) return;
 elt (g) |= mask (g);
   }
@@ -107,6 +109,23 @@ struct _hb_set_t
 for (unsigned int i = 0; i  ELTS; i++)
   elts[i] ^= other-elts[i];
   }
+  inline bool next (hb_codepoint_t *codepoint)
+  {
+if (unlikely (*codepoint == SENTINEL)) {
+  hb_codepoint_t i = get_min ();
+  if (i != SENTINEL) {
+*codepoint = i;
+   return true;
+  } else
+return false;
+}
+for (hb_codepoint_t i = *codepoint + 1; i  MAX_G + 1; i++)
+  if (has (i)) {
+*codepoint = i;
+   return true;
+  }
+return false;
+  }
   inline hb_codepoint_t get_min (void) const
   {
 for (unsigned int i = 0; i  ELTS; i++)
@@ -114,7 +133,7 @@ struct _hb_set_t
for (unsigned int j = 0; i  BITS; j++)
  if (elts[i]  (1  j))
return i * BITS + j;
-return 0;
+return SENTINEL;
   }
   inline hb_codepoint_t get_max (void) const
   {
@@ -123,15 +142,16 @@ struct _hb_set_t
for (unsigned int j = BITS; j; j--)
  if (elts[i - 1]  (1  (j - 1)))
return (i - 1) * BITS + (j - 1);
-return 0;
+return SENTINEL;
   }
 
   typedef uint32_t elt_t;
-  static const unsigned int MAX_G = 65536 - 1;
+  static const unsigned int MAX_G = 65536 - 1; /* XXX Fix this... */
   static const unsigned int SHIFT = 5;
   static const unsigned int BITS = (1  SHIFT);
   static const unsigned int MASK = BITS - 1;
   static const unsigned int ELTS = (MAX_G + 1 + (BITS - 1)) / BITS;
+  static  const hb_codepoint_t SENTINEL = (hb_codepoint_t) -1;
 
   elt_t elt 

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

2012-05-24 Thread Behdad Esfahbod
 TODO   
|   18 
 src/hb-atomic-private.hh   
|2 
 src/hb-ot-layout-gsub-table.hh 
|   10 
 src/hb-ot-layout-gsubgpos-private.hh   
|   23 
 test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/MANIFEST   
|2 
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST 
   |5 
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/lam-alef.txt
|   28 
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/language-arabic.txt
 |  695 ++
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/language-persian.txt
|   48 
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/language-urdu.txt
   |  188 ++
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/ligature-diacritics.txt
 |1 
 
test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/ligature-diacritics.txt
|1 
 12 files changed, 993 insertions(+), 28 deletions(-)

New commits:
commit cde1c0114ba66a45d907e81a49bf625e0dc946b0
Author: Behdad Esfahbod beh...@behdad.org
Date:   Thu May 24 10:46:39 2012 -0400

Fix hb_atomic_int_set() implementation for HB_NO_MT

As pointed out by Jonathan Kew.

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 03d7df1..684e856 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -79,7 +79,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_set(AI, V)   ((void) ((AI) = (V)))
 #define hb_atomic_int_get(AI)  (AI)
 
 #endif
commit 3b9b7133bea787f787170beea073f185e36d2327
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed May 23 22:00:25 2012 -0400

Update TODO

diff --git a/TODO b/TODO
index 18d730c..168ff9a 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,8 @@
 General fixes:
 =
 
-- Warn at compile time (and runtime with HB_DEBUG?) if no Unicode funcs
-  found / set.
+- Warn at compile time (and runtime with HB_DEBUG?) if no Unicode / font
+  funcs found / set.
 
 - In hb_shape(), assert if direction is INVALID.
 
@@ -26,10 +26,24 @@ General fixes:
 
 - Synthetic GDEF.
 
+- Add Pango backend?
+
+- Add ICUlayout backend?
+
+- Add ICUlayout API?
+
+- Add Old HarfBuzz backend?
+
+- Add Old HarfBuzz API?
+
 
 API issues to fix before 1.0:
 
 
+- Add default font_funcs / Unicode funcs API and to utils.
+
+- Add init_func to font_funcs.  Adjust ft.
+
 - Add pkg-config files for glue codes (harfbuzz-glib, etc)
 
 - Figure out how many .so objects, how to link, etc
commit ff3524c21aabf5d0d6014d1ce1b3e12ca5f0990f
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed May 23 21:50:43 2012 -0400

Add Arabic diacritics tests

diff --git 
a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/MANIFEST 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/MANIFEST
index ff8270e..0ac75c3 100644
--- a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/MANIFEST
+++ b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/MANIFEST
@@ -1 +1 @@
-ligature-diacritics.txt
+diacritics
diff --git 
a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
new file mode 100644
index 000..df0e4b5
--- /dev/null
+++ 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
@@ -0,0 +1,5 @@
+lam-alef.txt
+language-arabic.txt
+language-persian.txt
+language-urdu.txt
+ligature-diacritics.txt
diff --git 
a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/lam-alef.txt
 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/lam-alef.txt
new file mode 100644
index 000..26f6f7b
--- /dev/null
+++ 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/lam-alef.txt
@@ -0,0 +1,28 @@
+لًا
+ـلًا
+لاً
+ـلاً
+لّا
+ـلّا
+لاّ
+ـلاّ
+لًّا
+ـلًّا
+لاًّ
+ـلاًّ
+لَّا
+ـلَّا
+لاَّ
+ـلاَّ
+لَا
+ـلَا
+لاَ
+ـلاَ
+لُا
+ـلُا
+لاُ
+ـلاُ
+لِا
+ـلِا
+لاِ
+ـلاِ
diff --git 
a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/language-arabic.txt
 
b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/language-arabic.txt
new file mode 100644
index 000..24eb0c9
--- /dev/null
+++ 

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

2012-05-08 Thread Behdad Esfahbod
 test/shaping/Makefile.am   |   
 1 
 test/shaping/hb-diff   |   
10 
 test/shaping/hb-diff-colorize  |   
 7 
 test/shaping/hb_test_tools.py  |  
192 ++
 test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/MANIFEST|   
 1 
 test/shaping/texts/in-tree/shaper-arabic/script-mongolian/misc/poem.txt|   
 4 
 test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/MANIFEST |   
 1 
 test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/reph.txt |   
10 
 8 files changed, 143 insertions(+), 83 deletions(-)

New commits:
commit f1eb008cc727370e1bd0dc32fdf301f62d9ff981
Author: Behdad Esfahbod beh...@behdad.org
Date:   Tue May 8 23:41:41 2012 +0200

Add hb-diff-colorize

Accepts --format=html now.

diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am
index 1694eca..f216c5d 100644
--- a/test/shaping/Makefile.am
+++ b/test/shaping/Makefile.am
@@ -11,6 +11,7 @@ manifests:
 
 EXTRA_DIST += \
hb-diff \
+   hb-diff-colorize \
hb-diff-filter-failures \
hb-manifest-read \
hb-manifest-update \
diff --git a/test/shaping/hb-diff b/test/shaping/hb-diff
index eac3ff6..6a13fa2 100755
--- a/test/shaping/hb-diff
+++ b/test/shaping/hb-diff
@@ -3,8 +3,8 @@
 from hb_test_tools import *
 import sys, os
 
-if len (sys.argv)  3:
-   print usage: %s file1 file2... % sys.argv[0]
+if len (sys.argv)  2:
+   print usage: %s FILES... % sys.argv[0]
sys.exit (1)
 
 ZipDiffer.diff_files (FileHelpers.open_file_or_stdin (f) for f in sys.argv[1:])
diff --git a/test/shaping/hb-diff-colorize b/test/shaping/hb-diff-colorize
new file mode 100755
index 000..4e045d2
--- /dev/null
+++ b/test/shaping/hb-diff-colorize
@@ -0,0 +1,7 @@
+#!/usr/bin/python
+
+from hb_test_tools import *
+
+formatter = ColorFormatter.Auto (sys.argv)
+colorizer = DiffColorizer (formatter=formatter)
+UtilMains.process_multiple_files 
(FilterHelpers.filter_printer_function_no_newline (colorizer.colorize_diff))
diff --git a/test/shaping/hb_test_tools.py b/test/shaping/hb_test_tools.py
index 65640bc..03a7710 100644
--- a/test/shaping/hb_test_tools.py
+++ b/test/shaping/hb_test_tools.py
@@ -1,65 +1,81 @@
 #!/usr/bin/python
 
-import sys, os, re, difflib, unicodedata, errno
+import sys, os, re, difflib, unicodedata, errno, cgi
 from itertools import *
 
 diff_symbols = -+=*^%$#@!~/
 diff_colors = ['red', 'green', 'blue']
 
-class Colors:
+class ColorFormatter:
+
class Null:
-   red = ''
-   green = ''
-   end = ''
+   @staticmethod
+   def start_color (c): return ''
+   @staticmethod
+   def end_color (): return ''
+   @staticmethod
+   def escape (s): return s
+   @staticmethod
+   def newline (): return '\n'
+
class ANSI:
-   red = '\033[41;37;1m'
-   green = '\033[42;37;1m'
-   end = '\033[m'
+   @staticmethod
+   def start_color (c):
+   return {
+   'red': '\033[41;37;1m',
+   'green': '\033[42;37;1m',
+   'blue': '\033[44;37;1m',
+   }[c]
+   @staticmethod
+   def end_color ():
+   return '\033[m'
+   @staticmethod
+   def escape (s): return s
+   @staticmethod
+   def newline (): return '\n'
+
class HTML:
-   red = 'span style=color:red'
-   green = 'span style=color:green'
-   end = '/span'
+   @staticmethod
+   def start_color (c):
+   return 'span style=background:%s' % c
+   @staticmethod
+   def end_color ():
+   return '/span'
+   @staticmethod
+   def escape (s): return cgi.escape (s)
+   @staticmethod
+   def newline (): return 'br/\n'
 
@staticmethod
def Auto (argv = [], out = sys.stdout):
-   if os.isatty (out.fileno ()):
-   color = Colors.ANSI
-   else:
-   color = Colors.Null
-   if --color in argv:
-   argv.remove (--color)
-   color = Colors.ANSI
-   if --color=ansi in argv:
-   argv.remove (--color=ansi)
-   color = Colors.ANSI
-   if --color=html in argv:
-   argv.remove (--color=html)
-   color = Colors.HTML
-   if --no-color in argv:
-   argv.remove (--no-color)
-   color = 

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

2011-05-25 Thread Behdad Esfahbod
 TODO |   14 ++-
 src/hb-font.cc   |  107 
 src/hb-font.h|   50 +--
 src/hb-ft.cc |   26 ++
 src/hb-ot-layout-gpos-private.hh |  167 ++-
 src/hb-ot-shape.cc   |9 +-
 test/test-font.c |   73 ++---
 test/test-shape.c|   40 -
 8 files changed, 229 insertions(+), 257 deletions(-)

New commits:
commit 2d8ebcb9d089c2cfbefac71ca6350e2703ab13e3
Author: Behdad Esfahbod beh...@behdad.org
Date:   Wed May 25 11:27:33 2011 -0400

[API] One last font-funcs API change

Now that vertical text works correctly, I'm doing a last round
modification of the font-funcs API to simplify.  Expect no more
changes around here.

diff --git a/src/hb-font.cc b/src/hb-font.cc
index ae2910c..27ec005 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -56,40 +56,28 @@ hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED,
   return FALSE;
 }
 
-static void
+static hb_position_t
 hb_font_get_glyph_h_advance_nil (hb_font_t *font HB_UNUSED,
 void *font_data HB_UNUSED,
 hb_codepoint_t glyph,
-hb_position_t *advance,
 void *user_data HB_UNUSED)
 {
-  if (font-parent) {
-hb_font_get_glyph_h_advance (font-parent,
-glyph,
-advance);
-*advance = font-parent_scale_x_distance (*advance);
-return;
-  }
+  if (font-parent)
+return font-parent_scale_x_distance (hb_font_get_glyph_h_advance 
(font-parent, glyph));
 
-  *advance = font-x_scale;
+  return font-x_scale;
 }
 
-static void
+static hb_position_t
 hb_font_get_glyph_v_advance_nil (hb_font_t *font HB_UNUSED,
 void *font_data HB_UNUSED,
 hb_codepoint_t glyph,
-hb_position_t *advance,
 void *user_data HB_UNUSED)
 {
-  if (font-parent) {
-hb_font_get_glyph_v_advance (font-parent,
-glyph,
-advance);
-*advance = font-parent_scale_y_distance (*advance);
-return;
-  }
+  if (font-parent)
+return font-parent_scale_y_distance (hb_font_get_glyph_v_advance 
(font-parent, glyph));
 
-  *advance = font-y_scale;
+  return font-y_scale;
 }
 
 static hb_bool_t
@@ -134,42 +122,30 @@ hb_font_get_glyph_v_origin_nil (hb_font_t *font HB_UNUSED,
   return FALSE;
 }
 
-static void
+static hb_position_t
 hb_font_get_glyph_h_kerning_nil (hb_font_t *font HB_UNUSED,
 void *font_data HB_UNUSED,
 hb_codepoint_t left_glyph,
 hb_codepoint_t right_glyph,
-hb_position_t *kerning,
 void *user_data HB_UNUSED)
 {
-  if (font-parent) {
-hb_font_get_glyph_h_kerning (font-parent,
-left_glyph, right_glyph,
-kerning);
-*kerning = font-parent_scale_x_distance (*kerning);
-return;
-  }
+  if (font-parent)
+return font-parent_scale_x_distance (hb_font_get_glyph_h_kerning 
(font-parent, left_glyph, right_glyph));
 
-  *kerning = 0;
+  return 0;
 }
 
-static void
+static hb_position_t
 hb_font_get_glyph_v_kerning_nil (hb_font_t *font HB_UNUSED,
 void *font_data HB_UNUSED,
 hb_codepoint_t top_glyph,
 hb_codepoint_t bottom_glyph,
-hb_position_t *kerning,
 void *user_data HB_UNUSED)
 {
-  if (font-parent) {
-hb_font_get_glyph_v_kerning (font-parent,
-top_glyph, bottom_glyph,
-kerning);
-*kerning = font-parent_scale_y_distance (*kerning);
-return;
-  }
+  if (font-parent)
+return font-parent_scale_y_distance (hb_font_get_glyph_v_kerning 
(font-parent, top_glyph, bottom_glyph));
 
-  *kerning = 0;
+  return 0;
 }
 
 static hb_bool_t
@@ -340,26 +316,22 @@ hb_font_get_glyph (hb_font_t *font,
 font-klass-user_data.glyph);
 }
 
-void
+hb_position_t
 hb_font_get_glyph_h_advance (hb_font_t *font,
-hb_codepoint_t glyph,
-hb_position_t *advance)
+hb_codepoint_t glyph)
 {
-  *advance = 0;
-  font-klass-get.glyph_h_advance (font, font-user_data,
-   glyph, advance,
-   font-klass-user_data.glyph_h_advance);
+  return font-klass-get.glyph_h_advance (font, font-user_data,
+  glyph,
+  

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

2011-04-27 Thread Tom Hacohen
On Wed, 2011-04-27 at 06:38 -0700, Behdad Esfahbod wrote:
 commit d4bee9f813bb299b1c4aab7c33d588be2a7d354b
 Author: Behdad Esfahbod beh...@behdad.org
 Date:   Wed Apr 27 09:24:37 2011 -0400
 
 [API] Add hb_unicode_funcs_get_default() 

Thanks a lot!

--
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


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

2010-07-23 Thread Behdad Esfahbod
 src/Makefile.am  |5 
 src/check-c-linkage-decls.sh |   18 ++
 src/check-header-guards.sh   |2 
 src/hb-blob-private.h|2 
 src/hb-blob.c|   18 +-
 src/hb-blob.h|2 
 src/hb-buffer-private.hh |1 
 src/hb-buffer.cc |7 
 src/hb-buffer.h  |1 
 src/hb-common.c  |6 
 src/hb-common.h  |   21 +-
 src/hb-font-private.h|   96 
 src/hb-font-private.hh   |   97 -
 src/hb-font.cc   |6 
 src/hb-font.h|1 
 src/hb-ft.c  |  246 
 src/hb-ft.cc |  240 
 src/hb-ft.h  |2 
 src/hb-glib.c|6 
 src/hb-glib.h|2 
 src/hb-graphite.cc   |8 -
 src/hb-graphite.h|3 
 src/hb-icu.c |6 
 src/hb-icu.h |2 
 src/hb-language.c|5 
 src/hb-language.h|2 
 src/hb-object-private.h  |2 
 src/hb-open-file-private.hh  |4 
 src/hb-open-type-private.hh  |5 
 src/hb-ot-head-private.hh|  261 +--
 src/hb-ot-layout-common-private.hh   |6 
 src/hb-ot-layout-gdef-private.hh |6 
 src/hb-ot-layout-gpos-private.hh |6 
 src/hb-ot-layout-gsub-private.hh |7 
 src/hb-ot-layout-gsubgpos-private.hh |   13 +
 src/hb-ot-layout-private.hh  |6 
 src/hb-ot-layout.cc  |5 
 src/hb-ot-layout.h   |1 
 src/hb-ot-shape.cc   |6 
 src/hb-ot-shape.h|2 
 src/hb-ot-tag.c  |5 
 src/hb-ot-tag.h  |2 
 src/hb-ot.h  |3 
 src/hb-private.h |5 
 src/hb-shape.cc  |5 
 src/hb-shape.h   |1 
 src/hb-unicode-private.h |1 
 src/hb-unicode.c |6 
 src/hb-unicode.h |1 
 src/hb.h |3 
 src/main.cc  |6 
 51 files changed, 683 insertions(+), 490 deletions(-)

New commits:
commit acdba3f90b232fc12fcb200dca2584481b339118
Author: Behdad Esfahbod beh...@behdad.org
Date:   Fri Jul 23 15:11:18 2010 -0400

Prefer C linkage

diff --git a/src/Makefile.am b/src/Makefile.am
index a8ba69c..409c939 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -113,6 +113,7 @@ main_CPPFLAGS = $(HBCFLAGS)
 main_LDADD = libharfbuzz.la $(HBLIBS)
 
 TESTS = \
+   check-c-linkage-decls.sh \
check-header-guards.sh \
check-internal-symbols.sh \
$(NULL)
diff --git a/src/check-c-linkage-decls.sh b/src/check-c-linkage-decls.sh
new file mode 100755
index 000..c262516
--- /dev/null
+++ b/src/check-c-linkage-decls.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+LC_ALL=C
+export LC_ALL
+
+test -z $srcdir  srcdir=.
+stat=0
+
+cd $srcdir
+
+for x in *.c *.cc *.h *.hh ; do
+   if ! grep -q HB_BEGIN_DECLS $x || ! grep -q HB_END_DECLS $x; then
+   echo Ouch, file $x does not HB_BEGIN_DECLS / HB_END_DECLS
+   stat=1
+   fi
+done
+
+exit $stat
diff --git a/src/hb-blob-private.h b/src/hb-blob-private.h
index c91af65..92109ed 100644
--- a/src/hb-blob-private.h
+++ b/src/hb-blob-private.h
@@ -33,6 +33,7 @@
 
 HB_BEGIN_DECLS
 
+
 struct _hb_blob_t {
   hb_reference_count_t ref_count;
 
@@ -52,6 +53,7 @@ struct _hb_blob_t {
 
 extern HB_INTERNAL hb_blob_t _hb_blob_nil;
 
+
 HB_END_DECLS
 
 #endif /* HB_BLOB_PRIVATE_H */
diff --git a/src/hb-blob.c b/src/hb-blob.c
index 0357fb4..926481d 100644
--- a/src/hb-blob.c
+++ b/src/hb-blob.c
@@ -35,13 +35,16 @@
 #include sys/mman.h
 #endif /* HAVE_SYS_MMAN_H */
 
+#include stdio.h
+#include errno.h
+
+HB_BEGIN_DECLS
+
+
 #ifndef HB_DEBUG_BLOB
 #define HB_DEBUG_BLOB HB_DEBUG+0
 #endif
 
-#include stdio.h
-#include errno.h
-
 hb_blob_t _hb_blob_nil = {
   HB_REFERENCE_COUNT_INVALID, /* ref_count */
 
@@ -273,7 +276,7 @@ _try_make_writable_inplace_unix_locked (hb_blob_t *blob)
 }
 
 static void
-_try_writable_inplace_locked (hb_blob_t *blob)
+try_writable_inplace_locked (hb_blob_t *blob)
 {
   if (HB_DEBUG_BLOB)
 fprintf (stderr, %p %s: making writable\n, blob, __FUNCTION__);
@@ -301,7 +304,7 @@ hb_blob_try_writable_inplace (hb_blob_t *blob)
   hb_mutex_lock (blob-lock);
 
   if (blob-mode == HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE)
-_try_writable_inplace_locked (blob);
+try_writable_inplace_locked (blob);
 
   mode = blob-mode;
 
@@ -321,7 +324,7 @@ hb_blob_try_writable (hb_blob_t *blob)
   hb_mutex_lock (blob-lock);