[pango] [HB] Add hb_font_funcs_make_immutable()



commit 620858ee966c7999b206dd3a883542a1057a8d41
Author: Behdad Esfahbod <behdad behdad org>
Date:   Mon Aug 10 23:50:51 2009 -0400

    [HB] Add hb_font_funcs_make_immutable()

 pango/opentype/hb-font-private.h |    4 ++++
 pango/opentype/hb-font.cc        |   17 +++++++++++++++--
 pango/opentype/hb-font.h         |    3 +++
 3 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/pango/opentype/hb-font-private.h b/pango/opentype/hb-font-private.h
index 6ec1e99..efd7109 100644
--- a/pango/opentype/hb-font-private.h
+++ b/pango/opentype/hb-font-private.h
@@ -43,6 +43,8 @@ HB_BEGIN_DECLS
 struct _hb_font_funcs_t {
   hb_reference_count_t ref_count;
 
+  hb_bool_t immutable;
+
   /*
   hb_font_get_glyph_func_t glyph_func;
   hb_font_get_contour_point_func_t contour_point_func;
@@ -51,6 +53,8 @@ struct _hb_font_funcs_t {
   */
 };
 
+HB_INTERNAL hb_font_funcs_t
+_hb_font_funcs_nil;
 
 /*
  * hb_face_t
diff --git a/pango/opentype/hb-font.cc b/pango/opentype/hb-font.cc
index 784dc56..b090ad9 100644
--- a/pango/opentype/hb-font.cc
+++ b/pango/opentype/hb-font.cc
@@ -37,8 +37,11 @@
  * hb_font_funcs_t
  */
 
-static hb_font_funcs_t _hb_font_funcs_nil = {
-  HB_REFERENCE_COUNT_INVALID /* ref_count */
+hb_font_funcs_t _hb_font_funcs_nil = {
+  HB_REFERENCE_COUNT_INVALID, /* ref_count */
+
+  TRUE  /* immutable */
+
   /*
   hb_font_get_glyph_func_t glyph_func;
   hb_font_get_contour_point_func_t contour_point_func;
@@ -90,10 +93,20 @@ hb_font_funcs_copy (hb_font_funcs_t *other_ffuncs)
 
   /* re-init refcount */
   HB_OBJECT_DO_INIT (ffuncs);
+  ffuncs->immutable = FALSE;
 
   return ffuncs;
 }
 
+void
+hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs)
+{
+  if (HB_OBJECT_IS_INERT (ffuncs))
+    return;
+
+  ffuncs->immutable = TRUE;
+}
+
 
 
 /*
diff --git a/pango/opentype/hb-font.h b/pango/opentype/hb-font.h
index 4535d1b..26e49bb 100644
--- a/pango/opentype/hb-font.h
+++ b/pango/opentype/hb-font.h
@@ -91,6 +91,9 @@ hb_font_funcs_destroy (hb_font_funcs_t *ffuncs);
 hb_font_funcs_t *
 hb_font_funcs_copy (hb_font_funcs_t *ffuncs);
 
+void
+hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs);
+
 /*
 
 void



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