[pango] [HB] Start adding Unicode funcs



commit a6abd02a45946959a4f3c64fb25cb84d83913e2a
Author: Behdad Esfahbod <behdad behdad org>
Date:   Mon Aug 10 20:05:16 2009 -0400

    [HB] Start adding Unicode funcs

 pango/opentype/Makefile.am          |    3 +
 pango/opentype/hb-font-private.h    |   29 +----
 pango/opentype/hb-font.cc           |  163 +++++++-------------------
 pango/opentype/hb-font.h            |  140 ++++++++---------------
 pango/opentype/hb-unicode-private.h |   54 +++++++++
 pango/opentype/hb-unicode.c         |   89 ++++++++++++++
 pango/opentype/hb-unicode.h         |  220 +++++++++++++++++++++++++++++++++++
 pango/pango-ot-info.c               |    2 +-
 8 files changed, 464 insertions(+), 236 deletions(-)
---
diff --git a/pango/opentype/Makefile.am b/pango/opentype/Makefile.am
index 9d69186..f4015bd 100644
--- a/pango/opentype/Makefile.am
+++ b/pango/opentype/Makefile.am
@@ -14,6 +14,9 @@ HBSOURCES =  \
 	hb-font.cc \
 	hb-font-private.h \
 	hb-private.h \
+	hb-unicode.c \
+	hb-unicode.h \
+	hb-unicode-private.h \
 	hb-open-file-private.hh \
 	hb-open-type-private.hh \
 	hb-ot-layout.cc \
diff --git a/pango/opentype/hb-font-private.h b/pango/opentype/hb-font-private.h
index 13f07b0..6ec1e99 100644
--- a/pango/opentype/hb-font-private.h
+++ b/pango/opentype/hb-font-private.h
@@ -31,15 +31,16 @@
 
 #include "hb-font.h"
 
+#include "hb-unicode-private.h"
 #include "hb-ot-layout-private.h"
 
 HB_BEGIN_DECLS
 
 /*
- * hb_font_callbacks_t
+ * hb_font_funcs_t
  */
 
-struct _hb_font_callbacks_t {
+struct _hb_font_funcs_t {
   hb_reference_count_t ref_count;
 
   /*
@@ -52,23 +53,6 @@ struct _hb_font_callbacks_t {
 
 
 /*
- * hb_unicode_callbacks_t
- */
-
-struct _hb_unicode_callbacks_t {
-  hb_reference_count_t ref_count;
-
-  /*
-  hb_unicode_get_general_category_func_t general_category_func);
-  hb_unicode_get_combining_class_func_t combining_class_func);
-  hb_unicode_get_mirroring_char_func_t mirroring_char_func);
-  hb_unicode_get_script_func_t script_func);
-  hb_unicode_get_eastasian_width_func_t eastasian_width_func);
-  */
-};
-
-
-/*
  * hb_face_t
  */
 
@@ -82,8 +66,7 @@ struct _hb_face_t {
   hb_destroy_func_t    destroy;
   void                *user_data;
 
-  hb_font_callbacks_t *fcallbacks;
-  hb_unicode_callbacks_t *ucallbacks;
+  hb_unicode_funcs_t *unicode;
 
   hb_ot_layout_t ot_layout;
 };
@@ -96,13 +79,13 @@ struct _hb_face_t {
 struct _hb_font_t {
   hb_reference_count_t ref_count;
 
-  hb_face_t *face;
-
   hb_16dot16_t x_scale;
   hb_16dot16_t y_scale;
 
   unsigned int x_ppem;
   unsigned int y_ppem;
+
+  hb_font_funcs_t *klass;
 };
 
 
diff --git a/pango/opentype/hb-font.cc b/pango/opentype/hb-font.cc
index b22dc01..ea2216e 100644
--- a/pango/opentype/hb-font.cc
+++ b/pango/opentype/hb-font.cc
@@ -33,10 +33,10 @@
 #include "hb-blob.h"
 
 /*
- * hb_font_callbacks_t
+ * hb_font_funcs_t
  */
 
-static hb_font_callbacks_t _hb_font_callbacks_nil = {
+static hb_font_funcs_t _hb_font_funcs_nil = {
   HB_REFERENCE_COUNT_INVALID /* ref_count */
   /*
   hb_font_get_glyph_func_t glyph_func;
@@ -46,113 +46,51 @@ static hb_font_callbacks_t _hb_font_callbacks_nil = {
   */
 };
 
-hb_font_callbacks_t *
-hb_font_callbacks_create (void)
+hb_font_funcs_t *
+hb_font_funcs_create (void)
 {
-  hb_font_callbacks_t *fcallbacks;
+  hb_font_funcs_t *ffuncs;
 
-  if (!HB_OBJECT_DO_CREATE (hb_font_callbacks_t, fcallbacks))
-    return &_hb_font_callbacks_nil;
+  if (!HB_OBJECT_DO_CREATE (hb_font_funcs_t, ffuncs))
+    return &_hb_font_funcs_nil;
 
-  return fcallbacks;
+  return ffuncs;
 }
 
-hb_font_callbacks_t *
-hb_font_callbacks_reference (hb_font_callbacks_t *fcallbacks)
+hb_font_funcs_t *
+hb_font_funcs_reference (hb_font_funcs_t *ffuncs)
 {
-  HB_OBJECT_DO_REFERENCE (fcallbacks);
+  HB_OBJECT_DO_REFERENCE (ffuncs);
 }
 
 unsigned int
-hb_font_callbacks_get_reference_count (hb_font_callbacks_t *fcallbacks)
+hb_font_funcs_get_reference_count (hb_font_funcs_t *ffuncs)
 {
-  HB_OBJECT_DO_GET_REFERENCE_COUNT (fcallbacks);
+  HB_OBJECT_DO_GET_REFERENCE_COUNT (ffuncs);
 }
 
 void
-hb_font_callbacks_destroy (hb_font_callbacks_t *fcallbacks)
+hb_font_funcs_destroy (hb_font_funcs_t *ffuncs)
 {
-  HB_OBJECT_DO_DESTROY (fcallbacks);
+  HB_OBJECT_DO_DESTROY (ffuncs);
 
-  free (fcallbacks);
+  free (ffuncs);
 }
 
-hb_font_callbacks_t *
-hb_font_callbacks_copy (hb_font_callbacks_t *other_fcallbacks)
+hb_font_funcs_t *
+hb_font_funcs_copy (hb_font_funcs_t *other_ffuncs)
 {
-  hb_font_callbacks_t *fcallbacks;
+  hb_font_funcs_t *ffuncs;
 
-  if (!HB_OBJECT_DO_CREATE (hb_font_callbacks_t, fcallbacks))
-    return &_hb_font_callbacks_nil;
+  if (!HB_OBJECT_DO_CREATE (hb_font_funcs_t, ffuncs))
+    return &_hb_font_funcs_nil;
 
-  *fcallbacks = *other_fcallbacks;
+  *ffuncs = *other_ffuncs;
 
   /* re-init refcount */
-  HB_OBJECT_DO_INIT (fcallbacks);
+  HB_OBJECT_DO_INIT (ffuncs);
 
-  return fcallbacks;
-}
-
-
-
-/*
- * hb_unicode_callbacks_t
- */
-
-static hb_unicode_callbacks_t _hb_unicode_callbacks_nil = {
-  HB_REFERENCE_COUNT_INVALID /* ref_count */
-  /*
-  hb_unicode_get_general_category_func_t general_category_func);
-  hb_unicode_get_combining_class_func_t combining_class_func);
-  hb_unicode_get_mirroring_char_func_t mirroring_char_func);
-  hb_unicode_get_script_func_t script_func);
-  hb_unicode_get_eastasian_width_func_t eastasian_width_func);
-  */
-};
-
-hb_unicode_callbacks_t *
-hb_unicode_callbacks_create (void)
-{
-  hb_unicode_callbacks_t *ucallbacks;
-
-  if (!HB_OBJECT_DO_CREATE (hb_unicode_callbacks_t, ucallbacks))
-    return &_hb_unicode_callbacks_nil;
-
-  return ucallbacks;
-}
-
-hb_unicode_callbacks_t *
-hb_unicode_callbacks_reference (hb_unicode_callbacks_t *ucallbacks)
-{
-  HB_OBJECT_DO_REFERENCE (ucallbacks);
-}
-
-unsigned int
-hb_unicode_callbacks_get_reference_count (hb_unicode_callbacks_t *ucallbacks)
-{
-  HB_OBJECT_DO_GET_REFERENCE_COUNT (ucallbacks);
-}
-
-void
-hb_unicode_callbacks_destroy (hb_unicode_callbacks_t *ucallbacks)
-{
-  HB_OBJECT_DO_DESTROY (ucallbacks);
-
-  free (ucallbacks);
-}
-
-hb_unicode_callbacks_t *
-hb_unicode_callbacks_copy (hb_unicode_callbacks_t *other_ucallbacks)
-{
-  hb_unicode_callbacks_t *ucallbacks;
-
-  if (!HB_OBJECT_DO_CREATE (hb_unicode_callbacks_t, ucallbacks))
-    return &_hb_unicode_callbacks_nil;
-
-  *ucallbacks = *other_ucallbacks;
-  HB_OBJECT_DO_INIT (ucallbacks);
-
-  return ucallbacks;
+  return ffuncs;
 }
 
 
@@ -188,8 +126,7 @@ static hb_face_t _hb_face_nil = {
   NULL, /* destroy */
   NULL, /* user_data */
 
-  NULL, /* fcallbacks */
-  NULL  /* ucallbacks */
+  NULL  /* unicode */
 };
 
 hb_face_t *
@@ -257,39 +194,26 @@ hb_face_destroy (hb_face_t *face)
   if (face->destroy)
     face->destroy (face->user_data);
 
-  hb_font_callbacks_destroy (face->fcallbacks);
-  hb_unicode_callbacks_destroy (face->ucallbacks);
+  hb_unicode_funcs_destroy (face->unicode);
 
   free (face);
 }
 
 void
-hb_face_set_font_callbacks (hb_face_t *face,
-			    hb_font_callbacks_t *fcallbacks)
+hb_face_set_unicode_funcs (hb_face_t *face,
+			       hb_unicode_funcs_t *unicode)
 {
   if (HB_OBJECT_IS_INERT (face))
     return;
 
-  hb_font_callbacks_reference (fcallbacks);
-  hb_font_callbacks_destroy (face->fcallbacks);
-  face->fcallbacks = fcallbacks;
-}
-
-void
-hb_face_set_unicode_callbacks (hb_face_t *face,
-			       hb_unicode_callbacks_t *ucallbacks)
-{
-  if (HB_OBJECT_IS_INERT (face))
-    return;
-
-  hb_unicode_callbacks_reference (ucallbacks);
-  hb_unicode_callbacks_destroy (face->ucallbacks);
-  face->ucallbacks = ucallbacks;
+  hb_unicode_funcs_reference (unicode);
+  hb_unicode_funcs_destroy (face->unicode);
+  face->unicode = unicode;
 }
 
 hb_blob_t *
 hb_face_get_table (hb_face_t *face,
-		   hb_tag_t tag)
+		   hb_tag_t   tag)
 {
   if (HB_UNLIKELY (!face || !face->get_table))
     return hb_blob_create_empty ();
@@ -305,25 +229,23 @@ hb_face_get_table (hb_face_t *face,
 static hb_font_t _hb_font_nil = {
   HB_REFERENCE_COUNT_INVALID, /* ref_count */
 
-  NULL, /* face */
-
   0, /* x_scale */
   0, /* y_scale */
 
   0, /* x_ppem */
-  0  /* y_ppem */
+  0, /* y_ppem */
+
+  NULL /* klass */
 };
 
 hb_font_t *
-hb_font_create (hb_face_t *face)
+hb_font_create (void)
 {
   hb_font_t *font;
 
   if (!HB_OBJECT_DO_CREATE (hb_font_t, font))
     return &_hb_font_nil;
 
-  font->face = hb_face_reference (face);
-
   return font;
 }
 
@@ -344,18 +266,21 @@ hb_font_destroy (hb_font_t *font)
 {
   HB_OBJECT_DO_DESTROY (font);
 
-  hb_face_destroy (font->face);
+  hb_font_funcs_destroy (font->klass);
 
   free (font);
 }
 
-hb_face_t *
-hb_font_get_face (hb_font_t *font)
+void
+hb_font_set_funcs (hb_font_t       *font,
+		   hb_font_funcs_t *klass)
 {
   if (HB_OBJECT_IS_INERT (font))
-    return &_hb_face_nil;
+    return;
 
-  return font->face;
+  hb_font_funcs_reference (klass);
+  hb_font_funcs_destroy (font->klass);
+  font->klass = klass;
 }
 
 void
diff --git a/pango/opentype/hb-font.h b/pango/opentype/hb-font.h
index b3c342f..4535d1b 100644
--- a/pango/opentype/hb-font.h
+++ b/pango/opentype/hb-font.h
@@ -29,146 +29,99 @@
 
 #include "hb-common.h"
 #include "hb-blob.h"
+#include "hb-unicode.h"
 
 HB_BEGIN_DECLS
 
-typedef struct _hb_font_callbacks_t hb_font_callbacks_t;
-typedef struct _hb_unicode_callbacks_t hb_unicode_callbacks_t;
-
-typedef struct _hb_face_t hb_face_t;
-typedef struct _hb_font_t hb_font_t;
-
-typedef hb_blob_t * (*hb_get_table_func_t)  (hb_tag_t tag, void *user_data);
-
 
 /*
- * hb_font_callbacks_t
+ * hb_face_t
  */
 
-hb_font_callbacks_t *
-hb_font_callbacks_create (void);
-
-hb_font_callbacks_t *
-hb_font_callbacks_reference (hb_font_callbacks_t *fcallbacks);
-
-unsigned int
-hb_font_callbacks_get_reference_count (hb_font_callbacks_t *fcallbacks);
+typedef struct _hb_face_t hb_face_t;
 
-void
-hb_font_callbacks_destroy (hb_font_callbacks_t *fcallbacks);
+hb_face_t *
+hb_face_create_for_data (hb_blob_t    *blob,
+			 unsigned int  index);
 
-hb_font_callbacks_t *
-hb_font_callbacks_copy (hb_font_callbacks_t *fcallbacks);
+typedef hb_blob_t * (*hb_get_table_func_t)  (hb_tag_t tag, void *user_data);
 
-/*
+/* calls destory() when not needing user_data anymore */
+hb_face_t *
+hb_face_create_for_tables (hb_get_table_func_t  get_table,
+			   hb_destroy_func_t    destroy,
+			   void                *user_data);
 
-void
-hb_font_callbacks_set_glyph_func (hb_font_callbacks_t *fcallbacks,
-				  hb_font_get_glyph_func_t glyph_func);
+hb_face_t *
+hb_face_reference (hb_face_t *face);
 
-void
-hb_font_callbacks_set_contour_point_func (hb_font_callbacks_t *fcallbacks,
-					  hb_font_get_contour_point_func_t contour_point_func);
+unsigned int
+hb_face_get_reference_count (hb_face_t *face);
 
 void
-hb_font_callbacks_set_glyph_metrics_func (hb_font_callbacks_t *fcallbacks,
-					  hb_font_get_glyph_metrics_func_t glyph_metrics_func);
+hb_face_destroy (hb_face_t *face);
 
 void
-hb_font_callbacks_set_kerning_func (hb_font_callbacks_t *fcallbacks,
-				    hb_font_get_kerning_func_t kerning_func);
+hb_face_set_unicode_funcs (hb_face_t *face,
+			   hb_unicode_funcs_t *unicode_funcs);
 
-*/
+hb_blob_t *
+hb_face_get_table (hb_face_t *face,
+		   hb_tag_t   tag);
 
 
 /*
- * hb_unicode_callbacks_t
+ * hb_font_funcs_t
  */
 
-hb_unicode_callbacks_t *
-hb_unicode_callbacks_create (void);
+typedef struct _hb_font_funcs_t hb_font_funcs_t;
+
+hb_font_funcs_t *
+hb_font_funcs_create (void);
 
-hb_unicode_callbacks_t *
-hb_unicode_callbacks_reference (hb_unicode_callbacks_t *ucallbacks);
+hb_font_funcs_t *
+hb_font_funcs_reference (hb_font_funcs_t *ffuncs);
 
 unsigned int
-hb_unicode_callbacks_get_reference_count (hb_unicode_callbacks_t *ucallbacks);
+hb_font_funcs_get_reference_count (hb_font_funcs_t *ffuncs);
 
 void
-hb_unicode_callbacks_destroy (hb_unicode_callbacks_t *ucallbacks);
+hb_font_funcs_destroy (hb_font_funcs_t *ffuncs);
 
-hb_unicode_callbacks_t *
-hb_unicode_callbacks_copy (hb_unicode_callbacks_t *ucallbacks);
+hb_font_funcs_t *
+hb_font_funcs_copy (hb_font_funcs_t *ffuncs);
 
 /*
 
 void
-hb_unicode_callbacks_set_general_category_func (hb_unicode_callbacks_t *ucallbacks,
-						hb_unicode_get_general_category_func_t general_category_func);
-
-void
-hb_unicode_callbacks_set_combining_class_func (hb_unicode_callbacks_t *ucallbacks,
-					       hb_unicode_get_combining_class_func_t combining_class_func);
+hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
+			      hb_font_get_glyph_func_t glyph_func);
 
 void
-hb_unicode_callbacks_set_mirroring_char_func (hb_unicode_callbacks_t *ucallbacks,
-					      hb_unicode_get_mirroring_char_func_t mirroring_char_func);
+hb_font_funcs_set_contour_point_func (hb_font_funcs_t *ffuncs,
+				      hb_font_get_contour_point_func_t contour_point_func);
 
 void
-hb_unicode_callbacks_set_script_func (hb_unicode_callbacks_t *ucallbacks,
-				      hb_unicode_get_script_func_t script_func);
+hb_font_funcs_set_glyph_metrics_func (hb_font_funcs_t *ffuncs,
+				      hb_font_get_glyph_metrics_func_t glyph_metrics_func);
 
 void
-hb_unicode_callbacks_set_eastasian_width_func (hb_unicode_callbacks_t *ucallbacks,
-					       hb_unicode_get_eastasian_width_func_t eastasian_width_func);
+hb_font_funcs_set_kerning_func (hb_font_funcs_t *ffuncs,
+				hb_font_get_kerning_func_t kerning_func);
 
 */
 
 
 /*
- * hb_face_t
- */
-
-hb_face_t *
-hb_face_create_for_data (hb_blob_t    *blob,
-			 unsigned int  index);
-
-/* calls destory() when not needing user_data anymore */
-hb_face_t *
-hb_face_create_for_tables (hb_get_table_func_t  get_table,
-			   hb_destroy_func_t    destroy,
-			   void                *user_data);
-
-hb_face_t *
-hb_face_reference (hb_face_t *face);
-
-unsigned int
-hb_face_get_reference_count (hb_face_t *face);
-
-void
-hb_face_destroy (hb_face_t *face);
-
-void
-hb_face_set_font_callbacks (hb_face_t *face,
-			    hb_font_callbacks_t *fcallbacks);
-
-void
-hb_face_set_unicode_callbacks (hb_face_t *face,
-			       hb_unicode_callbacks_t *ucallbacks);
-
-hb_blob_t *
-hb_face_get_table (hb_face_t *face,
-		   hb_tag_t tag);
-
-
-/*
  * hb_font_t
  */
 
 /* Fonts are very light-weight objects */
 
+typedef struct _hb_font_t hb_font_t;
+
 hb_font_t *
-hb_font_create (hb_face_t *face);
+hb_font_create (void);
 
 hb_font_t *
 hb_font_reference (hb_font_t *font);
@@ -179,8 +132,9 @@ hb_font_get_reference_count (hb_font_t *font);
 void
 hb_font_destroy (hb_font_t *font);
 
-hb_face_t *
-hb_font_get_face (hb_font_t *font);
+void
+hb_font_set_funcs (hb_font_t       *font,
+		   hb_font_funcs_t *klass);
 
 /*
  * XXX
diff --git a/pango/opentype/hb-unicode-private.h b/pango/opentype/hb-unicode-private.h
new file mode 100644
index 0000000..de71083
--- /dev/null
+++ b/pango/opentype/hb-unicode-private.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2009  Red Hat, Inc.
+ *
+ *  This is part of HarfBuzz, an OpenType Layout engine 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_UNICODE_PRIVATE_H
+#define HB_UNICODE_PRIVATE_H
+
+#include "hb-private.h"
+
+#include "hb-unicode.h"
+
+HB_BEGIN_DECLS
+
+/*
+ * hb_unicode_funcs_t
+ */
+
+struct _hb_unicode_funcs_t {
+  hb_reference_count_t ref_count;
+
+  /*
+  hb_unicode_get_general_category_func_t general_category_func);
+  hb_unicode_get_combining_class_func_t combining_class_func);
+  hb_unicode_get_mirroring_char_func_t mirroring_char_func);
+  hb_unicode_get_script_func_t script_func);
+  hb_unicode_get_eastasian_width_func_t eastasian_width_func);
+  */
+};
+
+HB_END_DECLS
+
+#endif /* HB_UNICODE_PRIVATE_H */
diff --git a/pango/opentype/hb-unicode.c b/pango/opentype/hb-unicode.c
new file mode 100644
index 0000000..ecb4148
--- /dev/null
+++ b/pango/opentype/hb-unicode.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2009  Red Hat, Inc.
+ *
+ *  This is part of HarfBuzz, an OpenType Layout engine 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
+ */
+
+#include "hb-private.h"
+
+#include "hb-unicode-private.h"
+
+/*
+ * hb_unicode_funcs_t
+ */
+
+static hb_unicode_funcs_t _hb_unicode_funcs_nil = {
+  HB_REFERENCE_COUNT_INVALID /* ref_count */
+  /*
+  hb_unicode_get_general_category_func_t general_category_func);
+  hb_unicode_get_combining_class_func_t combining_class_func);
+  hb_unicode_get_mirroring_char_func_t mirroring_char_func);
+  hb_unicode_get_script_func_t script_func);
+  hb_unicode_get_eastasian_width_func_t eastasian_width_func);
+  */
+};
+
+hb_unicode_funcs_t *
+hb_unicode_funcs_create (void)
+{
+  hb_unicode_funcs_t *ufuncs;
+
+  if (!HB_OBJECT_DO_CREATE (hb_unicode_funcs_t, ufuncs))
+    return &_hb_unicode_funcs_nil;
+
+  return ufuncs;
+}
+
+hb_unicode_funcs_t *
+hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs)
+{
+  HB_OBJECT_DO_REFERENCE (ufuncs);
+}
+
+unsigned int
+hb_unicode_funcs_get_reference_count (hb_unicode_funcs_t *ufuncs)
+{
+  HB_OBJECT_DO_GET_REFERENCE_COUNT (ufuncs);
+}
+
+void
+hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs)
+{
+  HB_OBJECT_DO_DESTROY (ufuncs);
+
+  free (ufuncs);
+}
+
+hb_unicode_funcs_t *
+hb_unicode_funcs_copy (hb_unicode_funcs_t *other_ufuncs)
+{
+  hb_unicode_funcs_t *ufuncs;
+
+  if (!HB_OBJECT_DO_CREATE (hb_unicode_funcs_t, ufuncs))
+    return &_hb_unicode_funcs_nil;
+
+  *ufuncs = *other_ufuncs;
+  HB_OBJECT_DO_INIT (ufuncs);
+
+  return ufuncs;
+}
diff --git a/pango/opentype/hb-unicode.h b/pango/opentype/hb-unicode.h
new file mode 100644
index 0000000..51b00db
--- /dev/null
+++ b/pango/opentype/hb-unicode.h
@@ -0,0 +1,220 @@
+/*
+ * Copyright (C) 2009  Red Hat, Inc.
+ *
+ *  This is part of HarfBuzz, an OpenType Layout engine 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_UNICODE_H
+#define HB_UNICODE_H
+
+#include "hb-common.h"
+
+HB_BEGIN_DECLS
+
+/* Unicode General Category property */
+typedef enum
+{
+  HB_CATEGORY_CONTROL,
+  HB_CATEGORY_FORMAT,
+  HB_CATEGORY_UNASSIGNED,
+  HB_CATEGORY_PRIVATE_USE,
+  HB_CATEGORY_SURROGATE,
+  HB_CATEGORY_LOWERCASE_LETTER,
+  HB_CATEGORY_MODIFIER_LETTER,
+  HB_CATEGORY_OTHER_LETTER,
+  HB_CATEGORY_TITLECASE_LETTER,
+  HB_CATEGORY_UPPERCASE_LETTER,
+  HB_CATEGORY_COMBINING_MARK,
+  HB_CATEGORY_ENCLOSING_MARK,
+  HB_CATEGORY_NON_SPACING_MARK,
+  HB_CATEGORY_DECIMAL_NUMBER,
+  HB_CATEGORY_LETTER_NUMBER,
+  HB_CATEGORY_OTHER_NUMBER,
+  HB_CATEGORY_CONNECT_PUNCTUATION,
+  HB_CATEGORY_DASH_PUNCTUATION,
+  HB_CATEGORY_CLOSE_PUNCTUATION,
+  HB_CATEGORY_FINAL_PUNCTUATION,
+  HB_CATEGORY_INITIAL_PUNCTUATION,
+  HB_CATEGORY_OTHER_PUNCTUATION,
+  HB_CATEGORY_OPEN_PUNCTUATION,
+  HB_CATEGORY_CURRENCY_SYMBOL,
+  HB_CATEGORY_MODIFIER_SYMBOL,
+  HB_CATEGORY_MATH_SYMBOL,
+  HB_CATEGORY_OTHER_SYMBOL,
+  HB_CATEGORY_LINE_SEPARATOR,
+  HB_CATEGORY_PARAGRAPH_SEPARATOR,
+  HB_CATEGORY_SPACE_SEPARATOR
+} hb_category_t;
+
+/* Unicode Script property */
+typedef enum
+{                               /* ISO 15924 code */
+  HB_SCRIPT_INVALID_CODE = -1,
+  HB_SCRIPT_COMMON       = 0,   /* Zyyy */
+  HB_SCRIPT_INHERITED,          /* Qaai */
+  HB_SCRIPT_ARABIC,             /* Arab */
+  HB_SCRIPT_ARMENIAN,           /* Armn */
+  HB_SCRIPT_BENGALI,            /* Beng */
+  HB_SCRIPT_BOPOMOFO,           /* Bopo */
+  HB_SCRIPT_CHEROKEE,           /* Cher */
+  HB_SCRIPT_COPTIC,             /* Qaac */
+  HB_SCRIPT_CYRILLIC,           /* Cyrl (Cyrs) */
+  HB_SCRIPT_DESERET,            /* Dsrt */
+  HB_SCRIPT_DEVANAGARI,         /* Deva */
+  HB_SCRIPT_ETHIOPIC,           /* Ethi */
+  HB_SCRIPT_GEORGIAN,           /* Geor (Geon, Geoa) */
+  HB_SCRIPT_GOTHIC,             /* Goth */
+  HB_SCRIPT_GREEK,              /* Grek */
+  HB_SCRIPT_GUJARATI,           /* Gujr */
+  HB_SCRIPT_GURMUKHI,           /* Guru */
+  HB_SCRIPT_HAN,                /* Hani */
+  HB_SCRIPT_HANGUL,             /* Hang */
+  HB_SCRIPT_HEBREW,             /* Hebr */
+  HB_SCRIPT_HIRAGANA,           /* Hira */
+  HB_SCRIPT_KANNADA,            /* Knda */
+  HB_SCRIPT_KATAKANA,           /* Kana */
+  HB_SCRIPT_KHMER,              /* Khmr */
+  HB_SCRIPT_LAO,                /* Laoo */
+  HB_SCRIPT_LATIN,              /* Latn (Latf, Latg) */
+  HB_SCRIPT_MALAYALAM,          /* Mlym */
+  HB_SCRIPT_MONGOLIAN,          /* Mong */
+  HB_SCRIPT_MYANMAR,            /* Mymr */
+  HB_SCRIPT_OGHAM,              /* Ogam */
+  HB_SCRIPT_OLD_ITALIC,         /* Ital */
+  HB_SCRIPT_ORIYA,              /* Orya */
+  HB_SCRIPT_RUNIC,              /* Runr */
+  HB_SCRIPT_SINHALA,            /* Sinh */
+  HB_SCRIPT_SYRIAC,             /* Syrc (Syrj, Syrn, Syre) */
+  HB_SCRIPT_TAMIL,              /* Taml */
+  HB_SCRIPT_TELUGU,             /* Telu */
+  HB_SCRIPT_THAANA,             /* Thaa */
+  HB_SCRIPT_THAI,               /* Thai */
+  HB_SCRIPT_TIBETAN,            /* Tibt */
+  HB_SCRIPT_CANADIAN_ABORIGINAL, /* Cans */
+  HB_SCRIPT_YI,                 /* Yiii */
+  HB_SCRIPT_TAGALOG,            /* Tglg */
+  HB_SCRIPT_HANUNOO,            /* Hano */
+  HB_SCRIPT_BUHID,              /* Buhd */
+  HB_SCRIPT_TAGBANWA,           /* Tagb */
+
+  /* Unicode-4.0 additions */
+  HB_SCRIPT_BRAILLE,            /* Brai */
+  HB_SCRIPT_CYPRIOT,            /* Cprt */
+  HB_SCRIPT_LIMBU,              /* Limb */
+  HB_SCRIPT_OSMANYA,            /* Osma */
+  HB_SCRIPT_SHAVIAN,            /* Shaw */
+  HB_SCRIPT_LINEAR_B,           /* Linb */
+  HB_SCRIPT_TAI_LE,             /* Tale */
+  HB_SCRIPT_UGARITIC,           /* Ugar */
+
+  /* Unicode-4.1 additions */
+  HB_SCRIPT_NEW_TAI_LUE,        /* Talu */
+  HB_SCRIPT_BUGINESE,           /* Bugi */
+  HB_SCRIPT_GLAGOLITIC,         /* Glag */
+  HB_SCRIPT_TIFINAGH,           /* Tfng */
+  HB_SCRIPT_SYLOTI_NAGRI,       /* Sylo */
+  HB_SCRIPT_OLD_PERSIAN,        /* Xpeo */
+  HB_SCRIPT_KHAROSHTHI,         /* Khar */
+
+  /* Unicode-5.0 additions */
+  HB_SCRIPT_UNKNOWN,            /* Zzzz */
+  HB_SCRIPT_BALINESE,           /* Bali */
+  HB_SCRIPT_CUNEIFORM,          /* Xsux */
+  HB_SCRIPT_PHOENICIAN,         /* Phnx */
+  HB_SCRIPT_PHAGS_PA,           /* Phag */
+  HB_SCRIPT_NKO,                /* Nkoo */
+
+  /* Unicode-5.1 additions */
+  HB_SCRIPT_KAYAH_LI,           /* Kali */
+  HB_SCRIPT_LEPCHA,             /* Lepc */
+  HB_SCRIPT_REJANG,             /* Rjng */
+  HB_SCRIPT_SUNDANESE,          /* Sund */
+  HB_SCRIPT_SAURASHTRA,         /* Saur */
+  HB_SCRIPT_CHAM,               /* Cham */
+  HB_SCRIPT_OL_CHIKI,           /* Olck */
+  HB_SCRIPT_VAI,                /* Vaii */
+  HB_SCRIPT_CARIAN,             /* Cari */
+  HB_SCRIPT_LYCIAN,             /* Lyci */
+  HB_SCRIPT_LYDIAN              /* Lydi */
+} hb_script_t;
+
+
+/*
+ * hb_unicode_funcs_t
+ */
+
+typedef struct _hb_unicode_funcs_t hb_unicode_funcs_t;
+
+hb_unicode_funcs_t *
+hb_unicode_funcs_create (void);
+
+hb_unicode_funcs_t *
+hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs);
+
+unsigned int
+hb_unicode_funcs_get_reference_count (hb_unicode_funcs_t *ufuncs);
+
+void
+hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs);
+
+hb_unicode_funcs_t *
+hb_unicode_funcs_copy (hb_unicode_funcs_t *ufuncs);
+
+
+
+/* funcs */
+
+#if 0
+typedef hb_codepoint_t (*hb_unicode_get_mirroring_char_func_t) (hb_codepoint_t unicode);
+typedef hb_category_t (*hb_unicode_get_general_category_func_t) (hb_codepoint_t unicode);
+typedef hb_script_t (*hb_unicode_get_script_func_t) (hb_codepoint_t unicode);
+typedef unsigned int (*hb_unicode_get_combining_class_func_t) (hb_codepoint_t unicode);
+typedef unsigned int (*hb_unicode_get_eastasian_width_func_t) (hb_codepoint_t unicode);
+
+
+void
+hb_unicode_funcs_set_mirroring_char_func (hb_unicode_funcs_t *ufuncs,
+					  hb_unicode_get_mirroring_char_func_t mirroring_char_func);
+
+void
+hb_unicode_funcs_set_general_category_func (hb_unicode_funcs_t *ufuncs,
+					    hb_unicode_get_general_category_func_t general_category_func);
+
+void
+hb_unicode_funcs_set_script_func (hb_unicode_funcs_t *ufuncs,
+				  hb_unicode_get_script_func_t script_func);
+
+void
+hb_unicode_funcs_set_combining_class_func (hb_unicode_funcs_t *ufuncs,
+					   hb_unicode_get_combining_class_func_t combining_class_func);
+
+void
+hb_unicode_funcs_set_eastasian_width_func (hb_unicode_funcs_t *ufuncs,
+					   hb_unicode_get_eastasian_width_func_t eastasian_width_func);
+
+#endif
+
+
+HB_END_DECLS
+
+#endif /* HB_FONT_H */
diff --git a/pango/pango-ot-info.c b/pango/pango-ot-info.c
index b6a211b..9dd34ff 100644
--- a/pango/pango-ot-info.c
+++ b/pango/pango-ot-info.c
@@ -542,7 +542,7 @@ _pango_ot_info_position    (const PangoOTInfo    *info,
   hb_buffer_clear_positions (buffer->buffer);
 
   /* XXX reuse hb_font */
-  hb_font = hb_font_create (info->hb_face);
+  hb_font = hb_font_create ();
   hb_font_set_scale (hb_font,
 		     info->face->size->metrics.x_scale,
 		     info->face->size->metrics.y_scale);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]