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

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Apr 12 12:51:07 PDT 2012


 configure.ac                       |    6 ++--
 src/Makefile.am                    |   11 +++-----
 src/hb-blob.h                      |    6 +++-
 src/hb-buffer.h                    |    4 +++
 src/hb-common.h                    |   10 +++++--
 src/hb-fallback-shape-private.hh   |    9 +++----
 src/hb-fallback-shape.cc           |    9 +++----
 src/hb-font.h                      |    4 +++
 src/hb-ft.cc                       |    2 +
 src/hb-ft.h                        |    2 -
 src/hb-glib.h                      |    1 
 src/hb-gobject.h                   |    1 
 src/hb-graphite2-private.hh        |   42 +++++++++++++++++++++++++++++++++
 src/hb-graphite2.cc                |    5 +--
 src/hb-graphite2.h                 |   10 +------
 src/hb-icu.h                       |    1 
 src/hb-ot-layout-common-private.hh |    2 -
 src/hb-ot-layout-gdef-table.hh     |    2 -
 src/hb-ot-layout-gpos-table.hh     |    5 +--
 src/hb-ot-layout-gsub-table.hh     |    2 -
 src/hb-ot-layout-private.hh        |    2 -
 src/hb-ot-layout.h                 |    8 +++---
 src/hb-ot-shape-private.hh         |    8 ++++--
 src/hb-ot-shape.cc                 |   11 +++-----
 src/hb-ot-shape.h                  |   47 -------------------------------------
 src/hb-ot-tag.h                    |    6 +++-
 src/hb-ot.h                        |    3 +-
 src/hb-private.hh                  |    5 +++
 src/hb-shape.cc                    |   24 +++++++-----------
 src/hb-shape.h                     |    5 +++
 src/hb-unicode.h                   |    4 +++
 src/hb-uniscribe-private.hh        |   42 +++++++++++++++++++++++++++++++++
 src/hb-uniscribe.cc                |    9 +++----
 src/hb-uniscribe.h                 |   10 -------
 src/hb-version.h.in                |    4 +++
 src/hb.h                           |    2 +
 util/helper-cairo.hh               |    5 ++-
 util/options.hh                    |    9 ++++++-
 util/view-cairo.cc                 |   31 ++++++++++++++++--------
 util/view-cairo.hh                 |    1 
 40 files changed, 222 insertions(+), 148 deletions(-)

New commits:
commit 69b84a8f6c789726815261c2e86692de7a65d6e8
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 12 15:50:40 2012 -0400

    Fix hb-view surface size calc for vertical text
    
    For some reason it doesn't quite work with IranianNastaliq, but
    that looks like a font issue.

diff --git a/util/helper-cairo.hh b/util/helper-cairo.hh
index 5edfc3a..bc3fe1d 100644
--- a/util/helper-cairo.hh
+++ b/util/helper-cairo.hh
@@ -64,8 +64,9 @@ struct helper_cairo_line_t {
       g_free (utf8);
   }
 
-  double get_width (void) {
-    return glyphs[num_glyphs].x;
+  void get_advance (double *x_advance, double *y_advance) {
+    *x_advance = glyphs[num_glyphs].x;
+    *y_advance = glyphs[num_glyphs].y;
   }
 };
 
diff --git a/util/options.hh b/util/options.hh
index 165e7a1..da95017 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -48,6 +48,13 @@
 #include <glib.h>
 #include <glib/gprintf.h>
 
+#undef MIN
+template <typename Type> static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; }
+
+#undef MAX
+template <typename Type> static inline Type MAX (const Type &a, const Type &b) { return a > b ? a : b; }
+
+
 void fail (hb_bool_t suggest_help, const char *format, ...) G_GNUC_NORETURN;
 
 
diff --git a/util/view-cairo.cc b/util/view-cairo.cc
index f766a4f..ce578ed 100644
--- a/util/view-cairo.cc
+++ b/util/view-cairo.cc
@@ -38,6 +38,7 @@ view_cairo_t::consume_line (hb_buffer_t  *buffer,
 			    const char   *text,
 			    unsigned int  text_len)
 {
+  direction = hb_buffer_get_direction (buffer);
   helper_cairo_line_t l;
   helper_cairo_line_from_buffer (&l, buffer, text, text_len, scale);
   g_array_append_val (lines, l);
@@ -63,14 +64,17 @@ view_cairo_t::get_surface_size (cairo_scaled_font_t *scaled_font,
 
   cairo_scaled_font_extents (scaled_font, &font_extents);
 
-  *h = font_extents.ascent
-     + font_extents.descent
-     + ((int) lines->len - 1) * (font_extents.height + line_space);
-  *w = 0;
+  bool vertical = HB_DIRECTION_IS_VERTICAL (direction);
+  (vertical ? *w : *h) = (int) lines->len * (font_extents.height + line_space) - line_space;
+  (vertical ? *h : *w) = 0;
   for (unsigned int i = 0; i < lines->len; i++) {
     helper_cairo_line_t &line = g_array_index (lines, helper_cairo_line_t, i);
-    double line_width = line.get_width ();
-    *w = MAX (*w, line_width);
+    double x_advance, y_advance;
+    line.get_advance (&x_advance, &y_advance);
+    if (vertical)
+      *h =  MAX (*h, y_advance);
+    else
+      *w =  MAX (*w, x_advance);
   }
 
   *w += margin.l + margin.r;
@@ -97,17 +101,26 @@ view_cairo_t::draw (cairo_t *cr)
 {
   cairo_save (cr);
 
+  bool vertical = HB_DIRECTION_IS_VERTICAL (direction);
+  int v = vertical ? 1 : 0;
+  int h = vertical ? 0 : 1;
   cairo_font_extents_t font_extents;
   cairo_font_extents (cr, &font_extents);
   cairo_translate (cr, margin.l, margin.t);
+  double descent;
+  if (vertical)
+    descent = font_extents.height * .5;
+  else
+    descent = font_extents.height - font_extents.ascent;
+  cairo_translate (cr, v * -descent, h * -descent);
   for (unsigned int i = 0; i < lines->len; i++)
   {
     helper_cairo_line_t &l = g_array_index (lines, helper_cairo_line_t, i);
 
     if (i)
-      cairo_translate (cr, 0, line_space);
+      cairo_translate (cr, v * line_space, h * line_space);
 
-    cairo_translate (cr, 0, font_extents.ascent);
+    cairo_translate (cr, v * font_extents.height, h * font_extents.height);
 
     if (annotate) {
       cairo_save (cr);
@@ -137,8 +150,6 @@ view_cairo_t::draw (cairo_t *cr)
 			      l.cluster_flags);
     else
       cairo_show_glyphs (cr, l.glyphs, l.num_glyphs);
-
-    cairo_translate (cr, 0, font_extents.height - font_extents.ascent);
   }
 
   cairo_restore (cr);
diff --git a/util/view-cairo.hh b/util/view-cairo.hh
index 564f5c7..0f4fe94 100644
--- a/util/view-cairo.hh
+++ b/util/view-cairo.hh
@@ -52,6 +52,7 @@ struct view_cairo_t : output_options_t, view_options_t {
   void get_surface_size (cairo_scaled_font_t *scaled_font, double *w, double *h);
   void draw (cairo_t *cr);
 
+  hb_direction_t direction; // Remove this, make segment_properties accessible
   GArray *lines;
   double scale;
 };
commit 6bd9b479b8b2befbb0847282e93beade197c8038
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 12 14:53:53 2012 -0400

    Hide backend-specific shape functions
    
    Also remove shaper_options argument to hb_shape_full().  That was
    unused and for "future".  Let it go.
    
    More shaper API coming in preparation for plan/planned API.

diff --git a/configure.ac b/configure.ac
index 9c0a22d..319d480 100644
--- a/configure.ac
+++ b/configure.ac
@@ -136,11 +136,11 @@ AM_CONDITIONAL(HAVE_ICU, $have_icu)
 
 dnl ==========================================================================
 
-PKG_CHECK_MODULES(GRAPHITE, graphite2, have_graphite=true, have_graphite=false)
+PKG_CHECK_MODULES(GRAPHITE2, graphite2, have_graphite=true, have_graphite=false)
 if $have_graphite; then
-    AC_DEFINE(HAVE_GRAPHITE, 1, [Have Graphite library])
+    AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite library])
 fi
-AM_CONDITIONAL(HAVE_GRAPHITE, $have_graphite)
+AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite)
 
 dnl ==========================================================================
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 27c69a7..9311ab7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -77,7 +77,6 @@ HBSOURCES += \
 HBHEADERS += \
 	hb-ot.h \
 	hb-ot-layout.h \
-	hb-ot-shape.h \
 	hb-ot-tag.h \
 	$(NULL)
 endif
@@ -118,17 +117,17 @@ HBSOURCES += hb-ft.cc
 HBHEADERS += hb-ft.h
 endif
 
-if HAVE_GRAPHITE
-HBCFLAGS += $(GRAPHITE_CFLAGS)
-HBLIBS   += $(GRAPHITE_LIBS)
-HBSOURCES += hb-graphite2.cc
+if HAVE_GRAPHITE2
+HBCFLAGS += $(GRAPHITE2_CFLAGS)
+HBLIBS   += $(GRAPHITE2_LIBS)
+HBSOURCES += hb-graphite2.cc hb-graphite2-private.hh
 HBHEADERS += hb-graphite2.h
 endif
 
 if HAVE_UNISCRIBE
 HBCFLAGS += $(UNISCRIBE_CFLAGS)
 HBLIBS   += $(UNISCRIBE_LIBS)
-HBSOURCES += hb-uniscribe.cc
+HBSOURCES += hb-uniscribe.cc hb-uniscribe-private.hh
 HBHEADERS += hb-uniscribe.h
 endif
 
diff --git a/src/hb-fallback-shape-private.hh b/src/hb-fallback-shape-private.hh
index d0beb16..159456d 100644
--- a/src/hb-fallback-shape-private.hh
+++ b/src/hb-fallback-shape-private.hh
@@ -36,11 +36,10 @@ HB_BEGIN_DECLS
 
 
 HB_INTERNAL hb_bool_t
-hb_fallback_shape (hb_font_t          *font,
-		   hb_buffer_t        *buffer,
-		   const hb_feature_t *features,
-		   unsigned int        num_features,
-		   const char * const *shaper_options);
+_hb_fallback_shape (hb_font_t          *font,
+		    hb_buffer_t        *buffer,
+		    const hb_feature_t *features,
+		    unsigned int        num_features);
 
 
 HB_END_DECLS
diff --git a/src/hb-fallback-shape.cc b/src/hb-fallback-shape.cc
index 2fd527f..6822d2e 100644
--- a/src/hb-fallback-shape.cc
+++ b/src/hb-fallback-shape.cc
@@ -29,11 +29,10 @@
 #include "hb-buffer-private.hh"
 
 hb_bool_t
-hb_fallback_shape (hb_font_t          *font,
-		   hb_buffer_t        *buffer,
-		   const hb_feature_t *features,
-		   unsigned int        num_features,
-		   const char * const *shaper_options)
+_hb_fallback_shape (hb_font_t          *font,
+		    hb_buffer_t        *buffer,
+		    const hb_feature_t *features,
+		    unsigned int        num_features)
 {
   buffer->guess_properties ();
 
diff --git a/src/hb-graphite2-private.hh b/src/hb-graphite2-private.hh
new file mode 100644
index 0000000..644ea75
--- /dev/null
+++ b/src/hb-graphite2-private.hh
@@ -0,0 +1,42 @@
+/*
+ * Copyright © 2012  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_GRAPHITE2_PRIVATE_HH
+#define HB_GRAPHITE2_PRIVATE_HH
+
+#include "hb-private.hh"
+
+#include "hb-graphite2.h"
+
+
+HB_INTERNAL hb_bool_t
+_hb_graphite2_shape (hb_font_t          *font,
+		     hb_buffer_t        *buffer,
+		     const hb_feature_t *features,
+		     unsigned int        num_features);
+
+
+#endif /* HB_GRAPHITE2_PRIVATE_HH */
diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc
index 0675759..64f22f7 100644
--- a/src/hb-graphite2.cc
+++ b/src/hb-graphite2.cc
@@ -212,11 +212,10 @@ _hb_gr_font_get_data (hb_font_t *font)
 
 
 hb_bool_t
-hb_graphite_shape (hb_font_t          *font,
+_hb_graphite_shape (hb_font_t          *font,
 		   hb_buffer_t        *buffer,
 		   const hb_feature_t *features,
-		   unsigned int        num_features,
-		   const char * const *shaper_options)
+		   unsigned int        num_features)
 {
 
   buffer->guess_properties ();
diff --git a/src/hb-graphite2.h b/src/hb-graphite2.h
index 3eba9e0..2d16cc8 100644
--- a/src/hb-graphite2.h
+++ b/src/hb-graphite2.h
@@ -33,13 +33,6 @@ HB_BEGIN_DECLS
 
 #define HB_GRAPHITE_TAG_Silf HB_TAG('S','i','l','f')
 
-hb_bool_t
-hb_graphite_shape (hb_font_t          *font,
-		   hb_buffer_t        *buffer,
-		   const hb_feature_t *features,
-		   unsigned int        num_features,
-		   const char * const *shaper_options);
-
 /* TODO add gr_font/face etc getters and other glue API */
 
 HB_END_DECLS
diff --git a/src/hb-ot-shape-private.hh b/src/hb-ot-shape-private.hh
index 41afd68..2ceb6f2 100644
--- a/src/hb-ot-shape-private.hh
+++ b/src/hb-ot-shape-private.hh
@@ -29,8 +29,6 @@
 
 #include "hb-private.hh"
 
-#include "hb-ot-shape.h"
-
 #include "hb-ot-map-private.hh"
 #include "hb-ot-shape-complex-private.hh"
 #include "hb-ot-shape-normalize-private.hh"
@@ -96,6 +94,12 @@ hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unic
 
 HB_INTERNAL void _hb_set_unicode_props (hb_buffer_t *buffer);
 
+HB_INTERNAL hb_bool_t
+_hb_ot_shape (hb_font_t          *font,
+	      hb_buffer_t        *buffer,
+	      const hb_feature_t *features,
+	      unsigned int        num_features);
+
 #include "hb-ot-shape-complex-private.hh"
 
 #endif /* HB_OT_SHAPE_PRIVATE_HH */
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 92481ed..4b20cb3 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -419,11 +419,10 @@ hb_ot_shape_execute (hb_ot_shape_plan_t *plan,
 }
 
 hb_bool_t
-hb_ot_shape (hb_font_t          *font,
-	     hb_buffer_t        *buffer,
-	     const hb_feature_t *features,
-	     unsigned int        num_features,
-	     const char * const *shaper_options)
+_hb_ot_shape (hb_font_t          *font,
+	      hb_buffer_t        *buffer,
+	      const hb_feature_t *features,
+	      unsigned int        num_features)
 {
   hb_ot_shape_plan_t plan;
 
@@ -434,5 +433,3 @@ hb_ot_shape (hb_font_t          *font,
 
   return TRUE;
 }
-
-
diff --git a/src/hb-ot-shape.h b/src/hb-ot-shape.h
deleted file mode 100644
index cc18be6..0000000
--- a/src/hb-ot-shape.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright © 2010  Red Hat, 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.
- *
- * Red Hat Author(s): Behdad Esfahbod
- */
-
-#ifndef HB_OT_H_IN
-#error "Include <hb-ot.h> instead."
-#endif
-
-#ifndef HB_OT_SHAPE_H
-#define HB_OT_SHAPE_H
-
-HB_BEGIN_DECLS
-
-#include "hb.h"
-
-hb_bool_t
-hb_ot_shape (hb_font_t          *font,
-	     hb_buffer_t        *buffer,
-	     const hb_feature_t *features,
-	     unsigned int        num_features,
-	     const char * const *shaper_options);
-
-
-HB_END_DECLS
-
-#endif /* HB_OT_SHAPE_H */
diff --git a/src/hb-ot.h b/src/hb-ot.h
index a825a86..a4cb371 100644
--- a/src/hb-ot.h
+++ b/src/hb-ot.h
@@ -31,7 +31,6 @@
 #include "hb.h"
 
 #include "hb-ot-layout.h"
-#include "hb-ot-shape.h"
 #include "hb-ot-tag.h"
 
 HB_BEGIN_DECLS
diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index 9357f81..3d5f56c 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -31,30 +31,29 @@
 #include "hb-buffer-private.hh"
 
 #ifdef HAVE_GRAPHITE
-#include "hb-graphite2.h"
+#include "hb-graphite2-private.hh"
 #endif
 #ifdef HAVE_UNISCRIBE
-# include "hb-uniscribe.h"
+# include "hb-uniscribe-private.hh"
 #endif
 #ifdef HAVE_OT
-# include "hb-ot-shape.h"
+# include "hb-ot-shape-private.hh"
 #endif
 #include "hb-fallback-shape-private.hh"
 
 typedef hb_bool_t (*hb_shape_func_t) (hb_font_t          *font,
 				      hb_buffer_t        *buffer,
 				      const hb_feature_t *features,
-				      unsigned int        num_features,
-				      const char * const *shaper_options);
+				      unsigned int        num_features);
 
-#define HB_SHAPER_IMPLEMENT(name) {#name, hb_##name##_shape}
+#define HB_SHAPER_IMPLEMENT(name) {#name, _hb_##name##_shape}
 static struct hb_shaper_pair_t {
   char name[16];
   hb_shape_func_t func;
 } shapers[] = {
   /* v--- Add new shapers in the right place here */
 #ifdef HAVE_GRAPHITE
-  HB_SHAPER_IMPLEMENT (graphite),
+  HB_SHAPER_IMPLEMENT (graphite2),
 #endif
 #ifdef HAVE_UNISCRIBE
   HB_SHAPER_IMPLEMENT (uniscribe),
@@ -120,22 +119,17 @@ hb_shape_full (hb_font_t          *font,
 	       hb_buffer_t        *buffer,
 	       const hb_feature_t *features,
 	       unsigned int        num_features,
-	       const char * const *shaper_options,
 	       const char * const *shaper_list)
 {
   if (likely (!shaper_list)) {
     for (unsigned int i = 0; i < ARRAY_LENGTH (shapers); i++)
-      if (likely (shapers[i].func (font, buffer,
-				   features, num_features,
-				   shaper_options)))
+      if (likely (shapers[i].func (font, buffer, features, num_features)))
         return TRUE;
   } else {
     while (*shaper_list) {
       for (unsigned int i = 0; i < ARRAY_LENGTH (shapers); i++)
 	if (0 == strcmp (*shaper_list, shapers[i].name)) {
-	  if (likely (shapers[i].func (font, buffer,
-				       features, num_features,
-				       shaper_options)))
+	  if (likely (shapers[i].func (font, buffer, features, num_features)))
 	    return TRUE;
 	  break;
 	}
@@ -151,5 +145,5 @@ hb_shape (hb_font_t           *font,
 	  const hb_feature_t  *features,
 	  unsigned int         num_features)
 {
-  hb_shape_full (font, buffer, features, num_features, NULL, NULL);
+  hb_shape_full (font, buffer, features, num_features, NULL);
 }
diff --git a/src/hb-shape.h b/src/hb-shape.h
index 99c24ab..1a0d6cf 100644
--- a/src/hb-shape.h
+++ b/src/hb-shape.h
@@ -57,7 +57,6 @@ hb_shape_full (hb_font_t          *font,
 	       hb_buffer_t        *buffer,
 	       const hb_feature_t *features,
 	       unsigned int        num_features,
-	       const char * const *shaper_options,
 	       const char * const *shaper_list);
 
 const char **
diff --git a/src/hb-uniscribe-private.hh b/src/hb-uniscribe-private.hh
new file mode 100644
index 0000000..239ab0c
--- /dev/null
+++ b/src/hb-uniscribe-private.hh
@@ -0,0 +1,42 @@
+/*
+ * Copyright © 2012  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_UNISCRIBE_PRIVATE_HH
+#define HB_UNISCRIBE_PRIVATE_HH
+
+#include "hb-private.hh"
+
+#include "hb-uniscribe.h"
+
+
+HB_INTERNAL hb_bool_t
+_hb_uniscribe_shape (hb_font_t          *font,
+		     hb_buffer_t        *buffer,
+		     const hb_feature_t *features,
+		     unsigned int        num_features);
+
+
+#endif /* HB_UNISCRIBE_PRIVATE_HH */
diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index ce86074..41ce5e6 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -223,11 +223,10 @@ hb_uniscribe_font_get_hfont (hb_font_t *font)
 
 
 hb_bool_t
-hb_uniscribe_shape (hb_font_t          *font,
-		    hb_buffer_t        *buffer,
-		    const hb_feature_t *features,
-		    unsigned int        num_features,
-		    const char * const *shaper_options)
+_hb_uniscribe_shape (hb_font_t          *font,
+		     hb_buffer_t        *buffer,
+		     const hb_feature_t *features,
+		     unsigned int        num_features)
 {
   buffer->guess_properties ();
 
diff --git a/src/hb-uniscribe.h b/src/hb-uniscribe.h
index 7bf8090..216610e 100644
--- a/src/hb-uniscribe.h
+++ b/src/hb-uniscribe.h
@@ -35,13 +35,6 @@
 HB_BEGIN_DECLS
 
 
-hb_bool_t
-hb_uniscribe_shape (hb_font_t          *font,
-		    hb_buffer_t        *buffer,
-		    const hb_feature_t *features,
-		    unsigned int        num_features,
-		    const char * const *shaper_options);
-
 LOGFONTW *
 hb_uniscribe_font_get_logfontw (hb_font_t *font);
 
diff --git a/util/options.hh b/util/options.hh
index d6322cd..165e7a1 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -166,7 +166,7 @@ struct shape_options_t : option_group_t
     }
 
     setup_buffer (buffer);
-    return hb_shape_full (font, buffer, features, num_features, NULL, shapers);
+    return hb_shape_full (font, buffer, features, num_features, shapers);
   }
 
   const char *direction;
commit c6035cf802c60f0526f421f39a55886061df94ee
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 12 13:23:59 2012 -0400

    Add names to enums
    
    gdb was showing <anonymous enum> instead of useful stuff, so name
    all our enums.

diff --git a/src/hb-blob.h b/src/hb-blob.h
index 360310b..d47cc90 100644
--- a/src/hb-blob.h
+++ b/src/hb-blob.h
@@ -36,7 +36,7 @@
 HB_BEGIN_DECLS
 
 
-typedef enum {
+typedef enum _hb_memory_mode_t {
   HB_MEMORY_MODE_DUPLICATE,
   HB_MEMORY_MODE_READONLY,
   HB_MEMORY_MODE_WRITABLE,
diff --git a/src/hb-common.h b/src/hb-common.h
index df929ea..dd86334 100644
--- a/src/hb-common.h
+++ b/src/hb-common.h
@@ -99,7 +99,7 @@ hb_tag_t hb_tag_from_string (const char *s, int len);
 
 /* hb_direction_t */
 
-typedef enum {
+typedef enum _hb_direction_t {
   HB_DIRECTION_INVALID = -1,
   HB_DIRECTION_LTR = 0,
   HB_DIRECTION_RTL,
@@ -140,7 +140,7 @@ hb_language_get_default (void);
 
 /* hb_unicode_general_category_t */
 
-typedef enum
+typedef enum _hb_unicode_general_category_t
 {
   HB_UNICODE_GENERAL_CATEGORY_CONTROL,			/* Cc */
   HB_UNICODE_GENERAL_CATEGORY_FORMAT,			/* Cf */
@@ -179,7 +179,7 @@ typedef enum
 
 /* http://unicode.org/iso15924/ */
 /* http://goo.gl/x9ilM */
-typedef enum
+typedef enum _hb_script_t
 {
   /* Unicode-1.1 additions */
   HB_SCRIPT_COMMON			= HB_TAG ('Z','y','y','y'),
diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh
index d478e29..ff967ea 100644
--- a/src/hb-ot-layout-common-private.hh
+++ b/src/hb-ot-layout-common-private.hh
@@ -271,7 +271,7 @@ typedef RecordListOf<Feature> FeatureList;
 
 struct LookupFlag : USHORT
 {
-  enum {
+  enum Flags {
     RightToLeft		= 0x0001u,
     IgnoreBaseGlyphs	= 0x0002u,
     IgnoreLigatures	= 0x0004u,
diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh
index ee9c508..f3f76fa 100644
--- a/src/hb-ot-layout-gdef-table.hh
+++ b/src/hb-ot-layout-gdef-table.hh
@@ -327,7 +327,7 @@ struct GDEF
 {
   static const hb_tag_t Tag	= HB_OT_TAG_GDEF;
 
-  enum {
+  enum GlyphClasses {
     UnclassifiedGlyph	= 0,
     BaseGlyph		= 1,
     LigatureGlyph	= 2,
diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index f843fa3..7a3c117 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -46,8 +46,7 @@ typedef Value ValueRecord[VAR];
 
 struct ValueFormat : USHORT
 {
-  enum
-  {
+  enum Flags {
     xPlacement	= 0x0001,	/* Includes horizontal adjustment for placement */
     yPlacement	= 0x0002,	/* Includes vertical adjustment for placement */
     xAdvance	= 0x0004,	/* Includes horizontal adjustment for advance */
@@ -1336,7 +1335,7 @@ struct PosLookupSubTable
 {
   friend struct PosLookup;
 
-  enum {
+  enum Type {
     Single		= 1,
     Pair		= 2,
     Cursive		= 3,
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 941c669..8f01e13 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -678,7 +678,7 @@ struct SubstLookupSubTable
 {
   friend struct SubstLookup;
 
-  enum {
+  enum Type {
     Single		= 1,
     Multiple		= 2,
     Alternate		= 3,
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index bf7e43b..943fba1 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -44,7 +44,7 @@
 #define props_cache() var1.u16[1] /* glyph_props cache */
 
 /* XXX cleanup */
-typedef enum {
+typedef enum _hb_ot_layout_glyph_class_t {
   HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED	= 0x0001,
   HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH	= 0x0002,
   HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE	= 0x0004,
commit d1c9eb458c843215da8df84b596bfae51fee135b
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 12 13:17:44 2012 -0400

    Make it an error to include non-top-level headers
    
    Users should #include <hb.h> (or hb-ft.h, hb-glib.h, etc), but
    never things like hb-shape.h directly.  This makes it easier to
    refactor headers later on without breaking compatibility.

diff --git a/src/hb-blob.h b/src/hb-blob.h
index 50c9ae3..360310b 100644
--- a/src/hb-blob.h
+++ b/src/hb-blob.h
@@ -24,6 +24,10 @@
  * Red Hat Author(s): Behdad Esfahbod
  */
 
+#ifndef HB_H_IN
+#error "Include <hb.h> instead."
+#endif
+
 #ifndef HB_BLOB_H
 #define HB_BLOB_H
 
diff --git a/src/hb-buffer.h b/src/hb-buffer.h
index 9582ebe..ca1bbf4 100644
--- a/src/hb-buffer.h
+++ b/src/hb-buffer.h
@@ -27,6 +27,10 @@
  * Google Author(s): Behdad Esfahbod
  */
 
+#ifndef HB_H_IN
+#error "Include <hb.h> instead."
+#endif
+
 #ifndef HB_BUFFER_H
 #define HB_BUFFER_H
 
diff --git a/src/hb-common.h b/src/hb-common.h
index 4265bb3..df929ea 100644
--- a/src/hb-common.h
+++ b/src/hb-common.h
@@ -26,6 +26,10 @@
  * Google Author(s): Behdad Esfahbod
  */
 
+#ifndef HB_H_IN
+#error "Include <hb.h> instead."
+#endif
+
 #ifndef HB_COMMON_H
 #define HB_COMMON_H
 
diff --git a/src/hb-font.h b/src/hb-font.h
index 8a9dda5..7e64515 100644
--- a/src/hb-font.h
+++ b/src/hb-font.h
@@ -24,6 +24,10 @@
  * Red Hat Author(s): Behdad Esfahbod
  */
 
+#ifndef HB_H_IN
+#error "Include <hb.h> instead."
+#endif
+
 #ifndef HB_FONT_H
 #define HB_FONT_H
 
diff --git a/src/hb-ft.h b/src/hb-ft.h
index c1772ac..696251e 100644
--- a/src/hb-ft.h
+++ b/src/hb-ft.h
@@ -29,8 +29,6 @@
 
 #include "hb.h"
 
-#include "hb-font.h"
-
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
diff --git a/src/hb-glib.h b/src/hb-glib.h
index 3bc3ebf..63a9d33 100644
--- a/src/hb-glib.h
+++ b/src/hb-glib.h
@@ -30,6 +30,7 @@
 #define HB_GLIB_H
 
 #include "hb.h"
+
 #include <glib.h>
 
 HB_BEGIN_DECLS
diff --git a/src/hb-gobject.h b/src/hb-gobject.h
index 25fc941..4f23fdd 100644
--- a/src/hb-gobject.h
+++ b/src/hb-gobject.h
@@ -28,6 +28,7 @@
 #define HB_GOBJECT_H
 
 #include "hb.h"
+
 #include <glib-object.h>
 
 HB_BEGIN_DECLS
diff --git a/src/hb-graphite2.h b/src/hb-graphite2.h
index 68bd019..3eba9e0 100644
--- a/src/hb-graphite2.h
+++ b/src/hb-graphite2.h
@@ -26,8 +26,7 @@
 #ifndef HB_GRAPHITE2_H
 #define HB_GRAPHITE2_H
 
-#include "hb-common.h"
-#include "hb-shape.h"
+#include "hb.h"
 
 HB_BEGIN_DECLS
 
@@ -41,6 +40,8 @@ hb_graphite_shape (hb_font_t          *font,
 		   unsigned int        num_features,
 		   const char * const *shaper_options);
 
+/* TODO add gr_font/face etc getters and other glue API */
+
 HB_END_DECLS
 
 #endif /* HB_GRAPHITE2_H */
diff --git a/src/hb-icu.h b/src/hb-icu.h
index ecabec2..d22a8e1 100644
--- a/src/hb-icu.h
+++ b/src/hb-icu.h
@@ -30,6 +30,7 @@
 #define HB_ICU_H
 
 #include "hb.h"
+
 #include <unicode/uscript.h>
 
 
diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h
index 447e35d..430e54c 100644
--- a/src/hb-ot-layout.h
+++ b/src/hb-ot-layout.h
@@ -24,12 +24,14 @@
  * Red Hat Author(s): Behdad Esfahbod
  */
 
+#ifndef HB_OT_H_IN
+#error "Include <hb-ot.h> instead."
+#endif
+
 #ifndef HB_OT_LAYOUT_H
 #define HB_OT_LAYOUT_H
 
-#include "hb-common.h"
-#include "hb-buffer.h"
-#include "hb-font.h"
+#include "hb.h"
 
 #include "hb-ot-tag.h"
 
diff --git a/src/hb-ot-shape.h b/src/hb-ot-shape.h
index 1897e84..cc18be6 100644
--- a/src/hb-ot-shape.h
+++ b/src/hb-ot-shape.h
@@ -24,15 +24,16 @@
  * Red Hat Author(s): Behdad Esfahbod
  */
 
+#ifndef HB_OT_H_IN
+#error "Include <hb-ot.h> instead."
+#endif
+
 #ifndef HB_OT_SHAPE_H
 #define HB_OT_SHAPE_H
 
-#include "hb-common.h"
-#include "hb-shape.h"
-
-
 HB_BEGIN_DECLS
 
+#include "hb.h"
 
 hb_bool_t
 hb_ot_shape (hb_font_t          *font,
diff --git a/src/hb-ot-tag.h b/src/hb-ot-tag.h
index 427a069..1bf12ab 100644
--- a/src/hb-ot-tag.h
+++ b/src/hb-ot-tag.h
@@ -24,10 +24,14 @@
  * Red Hat Author(s): Behdad Esfahbod
  */
 
+#ifndef HB_OT_H_IN
+#error "Include <hb-ot.h> instead."
+#endif
+
 #ifndef HB_OT_TAG_H
 #define HB_OT_TAG_H
 
-#include "hb-common.h"
+#include "hb.h"
 
 HB_BEGIN_DECLS
 
diff --git a/src/hb-ot.h b/src/hb-ot.h
index fd6dd58..a825a86 100644
--- a/src/hb-ot.h
+++ b/src/hb-ot.h
@@ -26,6 +26,7 @@
 
 #ifndef HB_OT_H
 #define HB_OT_H
+#define HB_OT_H_IN
 
 #include "hb.h"
 
@@ -36,4 +37,5 @@
 HB_BEGIN_DECLS
 HB_END_DECLS
 
+#undef HB_OT_H_IN
 #endif /* HB_OT_H */
diff --git a/src/hb-private.hh b/src/hb-private.hh
index c757e2d..f561260 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -33,7 +33,10 @@
 #include "config.h"
 #endif
 
-#include "hb-common.h"
+#include "hb.h"
+#include "hb-ot.h"
+#define HB_H_IN
+#define HB_OT_H_IN
 
 #include <stdlib.h>
 #include <stddef.h>
diff --git a/src/hb-shape.h b/src/hb-shape.h
index 685b11d..99c24ab 100644
--- a/src/hb-shape.h
+++ b/src/hb-shape.h
@@ -24,6 +24,10 @@
  * Red Hat Author(s): Behdad Esfahbod
  */
 
+#ifndef HB_H_IN
+#error "Include <hb.h> instead."
+#endif
+
 #ifndef HB_SHAPE_H
 #define HB_SHAPE_H
 
diff --git a/src/hb-unicode.h b/src/hb-unicode.h
index 13886df..205e4c7 100644
--- a/src/hb-unicode.h
+++ b/src/hb-unicode.h
@@ -28,6 +28,10 @@
  * Google Author(s): Behdad Esfahbod
  */
 
+#ifndef HB_H_IN
+#error "Include <hb.h> instead."
+#endif
+
 #ifndef HB_UNICODE_H
 #define HB_UNICODE_H
 
diff --git a/src/hb-uniscribe.h b/src/hb-uniscribe.h
index dbcacd7..7bf8090 100644
--- a/src/hb-uniscribe.h
+++ b/src/hb-uniscribe.h
@@ -27,8 +27,7 @@
 #ifndef HB_UNISCRIBE_H
 #define HB_UNISCRIBE_H
 
-#include "hb-common.h"
-#include "hb-shape.h"
+#include "hb.h"
 
 #define _WIN32_WINNT 0x0500
 #include <windows.h>
diff --git a/src/hb-version.h.in b/src/hb-version.h.in
index 47a9b30..43634f9 100644
--- a/src/hb-version.h.in
+++ b/src/hb-version.h.in
@@ -24,6 +24,10 @@
  * Google Author(s): Behdad Esfahbod
  */
 
+#ifndef HB_H_IN
+#error "Include <hb.h> instead."
+#endif
+
 #ifndef HB_VERSION_H
 #define HB_VERSION_H
 
diff --git a/src/hb.h b/src/hb.h
index 0a2ebd9..996dc91 100644
--- a/src/hb.h
+++ b/src/hb.h
@@ -26,6 +26,7 @@
 
 #ifndef HB_H
 #define HB_H
+#define HB_H_IN
 
 #include "hb-blob.h"
 #include "hb-buffer.h"
@@ -38,4 +39,5 @@
 HB_BEGIN_DECLS
 HB_END_DECLS
 
+#undef HB_H_IN
 #endif /* HB_H */
commit 323190c27b80cddc9b3c42d19f1f243e2acb2411
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 12 12:29:10 2012 -0400

    Minor

diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index 23c2cc0..da5a4b4 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -61,6 +61,8 @@
  *     provide any API to get to the transform/delta set on the face. :(
  *
  *   - Always use FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH?
+ *
+ *   - FT_Load_Glyph() is exteremely costly.  Do something about it?
  */
 
 



More information about the HarfBuzz mailing list