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

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Aug 28 09:53:29 PDT 2013


 configure.ac                         |   50 ++++++++++++++--
 docs/reference/Makefile.am           |   12 +++
 docs/reference/harfbuzz-docs.xml     |    3 
 docs/reference/harfbuzz-sections.txt |   48 +++++++++++++++
 src/Makefile.am                      |  108 +++++++++++++++++++++++------------
 src/harfbuzz-gobject.pc.in           |   12 +++
 src/hb-gobject-enums.cc.tmpl         |   11 +--
 src/hb-gobject-enums.h.tmpl          |   55 +++++++++++++++++
 src/hb-gobject-structs.cc            |   84 +++++++++++++++++++++------
 src/hb-gobject-structs.h             |   87 ++++++++++++++++++++++++++++
 src/hb-gobject.h                     |   38 +-----------
 11 files changed, 406 insertions(+), 102 deletions(-)

New commits:
commit 71ef22b04d466803076af1da6763fecab95ce5bb
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Aug 28 12:52:55 2013 -0400

    Turn hb-gobject, and introspection off by default
    
    Also enable bootstrapping without them.

diff --git a/configure.ac b/configure.ac
index e98005a..c19e1e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,8 +52,16 @@ m4_define([hb_libtool_current],
 HB_LIBTOOL_VERSION_INFO=hb_libtool_current:hb_libtool_revision:hb_libtool_age
 AC_SUBST(HB_LIBTOOL_VERSION_INFO)
 
-GOBJECT_INTROSPECTION_CHECK([1.32.0])
-GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
+# Documentation
+have_gtk_doc=false
+m4_ifdef([GTK_DOC_CHECK], [
+	GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
+	if test "x$enable_gtk_doc" = xyes; then
+		have_gtk_doc=true
+	fi
+], [
+	AM_CONDITIONAL([ENABLE_GTK_DOC], false)
+])
 
 # Functions and headers
 AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty)
@@ -144,10 +152,12 @@ if $have_glib; then
 fi
 AM_CONDITIONAL(HAVE_GLIB, $have_glib)
 
+dnl ===========================================================================
+
 AC_ARG_WITH(gobject,
 	[AS_HELP_STRING([--with-gobject=@<:@yes/no/auto@:>@],
 			[Use gobject @<:@default=auto@:>@])],,
-	[with_gobject=auto])
+	[with_gobject=no])
 have_gobject=false
 if test "x$with_gobject" = "xyes" -o "x$with_gobject" = "xauto"; then
 	PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0, have_gobject=true, :)
@@ -164,6 +174,25 @@ AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
 
 dnl ===========================================================================
 
+
+dnl ===========================================================================
+# Gobject-Introspection
+have_introspection=false
+m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
+	if $have_gobject; then
+		GOBJECT_INTROSPECTION_CHECK([1.32.0])
+		if test "x$found_introspection" = xyes; then
+			have_introspection=true
+		fi
+	else
+		AM_CONDITIONAL([HAVE_INTROSPECTION], false)
+	fi
+], [
+	AM_CONDITIONAL([HAVE_INTROSPECTION], false)
+])
+
+dnl ===========================================================================
+
 have_ucdn=true
 if $have_glib; then
 	have_ucdn=false
@@ -417,7 +446,7 @@ Test / platform shapers (not normally needed):
 	Uniscribe:		${have_uniscribe}
 
 Other features:
-	Documentation:		${enable_gtk_doc}
+	Documentation:		${have_gtk_doc}
 	GObject bindings:	${have_gobject}
-	Introspection:		${found_introspection}
+	Introspection:		${have_introspection}
 ])
diff --git a/src/Makefile.am b/src/Makefile.am
index fb7caf3..684e415 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -371,13 +371,13 @@ TESTS_ENVIRONMENT = \
 	HBHEADERS="$(HBHEADERS) $(HBNODISTHEADERS)" \
 	$(NULL)
 
+if HAVE_INTROSPECTION
+
 -include $(INTROSPECTION_MAKEFILE)
 INTROSPECTION_GIRS = harfbuzz-$(HB_VERSION_MAJOR).0.gir # What does the 0 mean anyway?!
 INTROSPECTION_SCANNER_ARGS = -I$(srcdir) -n hb --identifier-prefix=hb_ --warn-all
 INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
 
-if HAVE_INTROSPECTION
-
 harfbuzz-0.0.gir: libharfbuzz.la libharfbuzz-gobject.la
 harfbuzz_0_0_gir_INCLUDES = GObject-2.0
 harfbuzz_0_0_gir_CFLAGS = \
@@ -408,6 +408,7 @@ typelibdir = $(libdir)/girepository-1.0
 typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
 
 CLEANFILES += $(gir_DATA) $(typelib_DATA)
+
 endif
 
 -include $(top_srcdir)/git.mk
commit d8f507099b9ae5f0c643fb8dddbb069df6f62a94
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Aug 26 21:26:24 2013 -0400

    Hookup harfbuzz-gobject to introspection

diff --git a/src/Makefile.am b/src/Makefile.am
index 726a1c8..fb7caf3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -378,7 +378,7 @@ INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
 
 if HAVE_INTROSPECTION
 
-harfbuzz-0.0.gir: libharfbuzz.la
+harfbuzz-0.0.gir: libharfbuzz.la libharfbuzz-gobject.la
 harfbuzz_0_0_gir_INCLUDES = GObject-2.0
 harfbuzz_0_0_gir_CFLAGS = \
 	$(INCLUDES) \
@@ -387,9 +387,19 @@ harfbuzz_0_0_gir_CFLAGS = \
 	-DHB_H_IN \
 	-DHB_OT_H \
 	-DHB_OT_H_IN \
+	-DHB_GOBJECT_H \
+	-DHB_GOBJECT_H_IN \
+	$(NULL)
+harfbuzz_0_0_gir_LIBS = \
+	libharfbuzz.la \
+	libharfbuzz-gobject.la \
+	$(NULL)
+harfbuzz_0_0_gir_FILES = \
+	$(HBHEADERS) \
+	$(HBNODISTHEADERS) \
+	hb-gobject-enums.h \
+	hb-gobject-structs.h \
 	$(NULL)
-harfbuzz_0_0_gir_LIBS = libharfbuzz.la
-harfbuzz_0_0_gir_FILES = $(HBHEADERS) $(HBNODISTHEADERS)
 
 girdir = $(datadir)/gir-1.0
 gir_DATA = $(INTROSPECTION_GIRS)
commit 71439a8c7ae9df25193bc3ad0f203117d2884a19
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Aug 26 20:56:58 2013 -0400

    [gobject] Flesh out hb-gobject
    
    Move it to new harfbuzz-gobject library.  Implement enums and
    boxed types for object-types.  Still have to do boxed types for
    value types.

diff --git a/configure.ac b/configure.ac
index 132d070..e98005a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -144,9 +144,16 @@ if $have_glib; then
 fi
 AM_CONDITIONAL(HAVE_GLIB, $have_glib)
 
+AC_ARG_WITH(gobject,
+	[AS_HELP_STRING([--with-gobject=@<:@yes/no/auto@:>@],
+			[Use gobject @<:@default=auto@:>@])],,
+	[with_gobject=auto])
 have_gobject=false
-if $have_glib; then
-	PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0 >= 2.16, have_gobject=true, :)
+if test "x$with_gobject" = "xyes" -o "x$with_gobject" = "xauto"; then
+	PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0, have_gobject=true, :)
+fi
+if test "x$with_gobject" = "xyes" -a "x$have_gobject" != "xtrue"; then
+	AC_MSG_ERROR([gobject support requested but gobject-2.0 / glib-2.0 not found])
 fi
 if $have_gobject; then
 	AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
@@ -411,5 +418,6 @@ Test / platform shapers (not normally needed):
 
 Other features:
 	Documentation:		${enable_gtk_doc}
+	GObject bindings:	${have_gobject}
 	Introspection:		${found_introspection}
 ])
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index c5bdb35..127f986 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -21,7 +21,7 @@ DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml
 # gtk-doc will search all .c and .h files beneath these paths
 # for inline comments documenting functions and macros.
 # e.g. DOC_SOURCE_DIR=$(top_srcdir)/gtk $(top_srcdir)/gdk
-DOC_SOURCE_DIR=$(top_srcdir)/src
+DOC_SOURCE_DIR=$(top_srcdir)/src $(top_builddir)/src
 
 # Extra options to pass to gtkdoc-scangobj. Not normally needed.
 SCANGOBJ_OPTIONS=
@@ -58,6 +58,11 @@ EXTRA_HFILES=$(top_builddir)/src/hb-version.h
 # Header files or dirs to ignore when scanning. Use base file/dir names
 # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code
 IGNORE_HFILES=`cd $(top_srcdir)/src; find . -path './hb-*/*.h' | sed 's@^.*/@@'`
+if HAVE_GOBJECT
+else
+# XXX Prevent "make dist"
+IGNORE_HFILES+=hb-gobject.h
+endif
 
 # Images to copy into HTML directory.
 # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
@@ -83,7 +88,10 @@ expand_content_files=
 # e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
 # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
 GTKDOC_CFLAGS=
-GTKDOC_LIBS=
+GTKDOC_LIBS=$(top_builddir)/src/libharfbuzz.la
+if HAVE_GOBJECT
+GTKDOC_LIBS+=$(top_builddir)/src/libharfbuzz-gobject.la
+endif
 
 # This includes the standard gtk-doc make rules, copied by gtkdocize.
 include $(top_srcdir)/gtk-doc.make
diff --git a/docs/reference/harfbuzz-docs.xml b/docs/reference/harfbuzz-docs.xml
index 7062d6a..2731fab 100644
--- a/docs/reference/harfbuzz-docs.xml
+++ b/docs/reference/harfbuzz-docs.xml
@@ -26,6 +26,7 @@
     <xi:include href="xml/hb-shape.xml"/>
 
     <xi:include href="xml/hb-version.xml"/>
+    <xi:include href="xml/hb-deprecated.xml"/>
 
     <xi:include href="xml/hb-set.xml"/>
 
@@ -44,6 +45,8 @@
     <xi:include href="xml/hb-uniscribe.xml"/>
     <xi:include href="xml/hb-coretext.xml"/>
 
+    <xi:include href="xml/hb-gobject.xml"/>
+
   </chapter>
   <chapter id="object-tree">
     <title>Object Hierarchy</title>
diff --git a/docs/reference/harfbuzz-sections.txt b/docs/reference/harfbuzz-sections.txt
index 6a76638..3072ce4 100644
--- a/docs/reference/harfbuzz-sections.txt
+++ b/docs/reference/harfbuzz-sections.txt
@@ -102,7 +102,6 @@ hb_script_from_string
 hb_script_get_horizontal_direction
 hb_script_t
 hb_script_to_iso15924_tag
-HB_SCRIPT_CANADIAN_ABORIGINAL
 hb_tag_from_string
 hb_tag_t
 hb_tag_to_string
@@ -127,6 +126,13 @@ uint8_t
 </SECTION>
 
 <SECTION>
+<FILE>hb-deprecated</FILE>
+HB_BUFFER_FLAGS_DEFAULT
+HB_BUFFER_SERIALIZE_FLAGS_DEFAULT
+HB_SCRIPT_CANADIAN_ABORIGINAL
+</SECTION>
+
+<SECTION>
 <FILE>hb-coretext</FILE>
 hb_coretext_face_get_cg_font
 hb_coretext_font_get_ct_font
@@ -249,6 +255,46 @@ hb_glib_script_to_script
 
 <SECTION>
 <FILE>hb-gobject</FILE>
+HB_GOBJECT_TYPE_BLOB
+HB_GOBJECT_TYPE_BUFFER
+HB_GOBJECT_TYPE_BUFFER_CONTENT_TYPE
+HB_GOBJECT_TYPE_BUFFER_FLAGS
+HB_GOBJECT_TYPE_BUFFER_SERIALIZE_FLAGS
+HB_GOBJECT_TYPE_BUFFER_SERIALIZE_FORMAT
+HB_GOBJECT_TYPE_DIRECTION
+HB_GOBJECT_TYPE_FACE
+HB_GOBJECT_TYPE_FONT
+HB_GOBJECT_TYPE_FONT_FUNCS
+HB_GOBJECT_TYPE_MEMORY_MODE
+HB_GOBJECT_TYPE_OT_LAYOUT_GLYPH_CLASS
+HB_GOBJECT_TYPE_SCRIPT
+HB_GOBJECT_TYPE_SHAPE_PLAN
+HB_GOBJECT_TYPE_UNICODE_COMBINING_CLASS
+HB_GOBJECT_TYPE_UNICODE_FUNCS
+HB_GOBJECT_TYPE_UNICODE_GENERAL_CATEGORY
+hb_gobject_blob_get_type
+hb_gobject_buffer_content_type_get_type
+hb_gobject_buffer_flags_get_type
+hb_gobject_buffer_get_type
+hb_gobject_buffer_serialize_flags_get_type
+hb_gobject_buffer_serialize_format_get_type
+hb_gobject_direction_get_type
+hb_gobject_face_get_type
+hb_gobject_font_funcs_get_type
+hb_gobject_font_get_type
+hb_gobject_memory_mode_get_type
+hb_gobject_ot_layout_glyph_class_get_type
+hb_gobject_script_get_type
+hb_gobject_shape_plan_get_type
+hb_gobject_unicode_combining_class_get_type
+hb_gobject_unicode_funcs_get_type
+hb_gobject_unicode_general_category_get_type
+<SUBSECTION Private>
+HB_GOBJECT_H_IN
+</SECTION>
+
+<SECTION>
+<FILE>hb-gobject</FILE>
 
 </SECTION>
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 6109a62..726a1c8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -126,21 +126,6 @@ HBSOURCES += hb-glib.cc
 HBHEADERS += hb-glib.h
 endif
 
-if HAVE_GOBJECT
-HBCFLAGS += $(GOBJECT_CFLAGS)
-HBLIBS   += $(GOBJECT_LIBS)
-HBSOURCES += hb-gobject-structs.cc
-nodist_HBSOURCES = hb-gobject-enums.cc
-HBHEADERS += hb-gobject.h
-BUILT_SOURCES += hb-gobject-enums.cc
-EXTRA_DIST += hb-gobject-enums.cc.tmpl
-DISTCLEANFILES += hb-gobject-enums.cc
-
-hb-gobject-enums.cc: hb-gobject-enums.cc.tmpl $(HBHEADERS)
-	$(AM_V_GEN) $(GLIB_MKENUMS) --template $^ > "$@.tmp" && \
-	mv "$@.tmp" "$@" || ( $(RM) "@.tmp" && false )
-endif
-
 if HAVE_FREETYPE
 HBCFLAGS += $(FREETYPE_CFLAGS)
 HBLIBS   += $(FREETYPE_LIBS)
@@ -236,6 +221,39 @@ pkgconfig_DATA += harfbuzz-icu.pc
 EXTRA_DIST += harfbuzz-icu.pc.in
 endif
 
+if HAVE_GOBJECT
+lib_LTLIBRARIES += libharfbuzz-gobject.la
+libharfbuzz_gobject_la_SOURCES = hb-gobject-structs.cc
+nodist_libharfbuzz_gobject_la_SOURCES = hb-gobject-enums.cc
+libharfbuzz_gobject_la_CPPFLAGS = $(GOBJECT_CFLAGS)
+libharfbuzz_gobject_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(HB_LIBTOOL_VERSION_INFO) -no-undefined
+libharfbuzz_gobject_la_LIBADD = $(GOBJECT_LIBS) libharfbuzz.la
+pkginclude_HEADERS += hb-gobject.h hb-gobject-structs.h
+nodist_pkginclude_HEADERS += hb-gobject-enums.h
+pkgconfig_DATA += harfbuzz-gobject.pc
+EXTRA_DIST += harfbuzz-gobject.pc.in
+
+BUILT_SOURCES += \
+	hb-gobject-enums.cc \
+	hb-gobject-enums.h \
+	$(NULL)
+EXTRA_DIST += \
+	hb-gobject-enums.cc.tmpl \
+	hb-gobject-enums.h.tmpl \
+	$(NULL)
+DISTCLEANFILES += \
+	hb-gobject-enums.cc \
+	hb-gobject-enums.h \
+	$(NULL)
+hb-gobject-enums.%: hb-gobject-enums.%.tmpl $(HBHEADERS)
+	$(AM_V_GEN) $(GLIB_MKENUMS) \
+		--identifier-prefix hb_ --symbol-prefix hb_gobject \
+		--template $^ | \
+	sed 's/_t_get_type/_get_type/g; s/_T (/ (/g' > "$@.tmp" && \
+	mv "$@.tmp" "$@" || ( $(RM) "@.tmp" && false )
+endif
+
+
 %.pc: %.pc.in $(top_builddir)/config.status
 	$(AM_V_GEN) \
 	$(SED)	-e 's@%prefix%@$(prefix)@g' \
diff --git a/src/harfbuzz-gobject.pc.in b/src/harfbuzz-gobject.pc.in
new file mode 100644
index 0000000..7008360
--- /dev/null
+++ b/src/harfbuzz-gobject.pc.in
@@ -0,0 +1,12 @@
+prefix=%prefix%
+exec_prefix=%exec_prefix%
+libdir=%libdir%
+includedir=%includedir%
+
+Name: harfbuzz
+Description: HarfBuzz text shaping library GObject integration
+Version: %VERSION%
+
+Requires: harfbuzz gobject-2.0 glib-2.0
+Libs: -L${libdir} -lharfbuzz-gobject
+Cflags: -I${includedir}/harfbuzz
diff --git a/src/hb-gobject-enums.cc.tmpl b/src/hb-gobject-enums.cc.tmpl
index 05abd89..ca458a3 100644
--- a/src/hb-gobject-enums.cc.tmpl
+++ b/src/hb-gobject-enums.cc.tmpl
@@ -45,13 +45,12 @@
 /*** END file-production ***/
 
 /*** BEGIN value-header ***/
-inline static /* TODO(behdad) disable these for now until we fix them... */
 GType
 @enum_name at _get_type (void)
 {
-  static volatile gsize g_define_type_id__volatile = 0;
+  static gsize type_id = 0;
 
-  if (g_once_init_enter (&g_define_type_id__volatile))
+  if (g_once_init_enter (&type_id))
     {
       static const G at Type@Value values[] = {
 /*** END value-header ***/
@@ -63,12 +62,12 @@ GType
 /*** BEGIN value-tail ***/
         { 0, NULL, NULL }
       };
-      GType g_define_type_id =
+      GType id =
         g_ at type@_register_static (g_intern_static_string ("@EnumName@"), values);
-      g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+      g_once_init_leave (&type_id, id);
     }
 
-  return g_define_type_id__volatile;
+  return type_id;
 }
 
 /*** END value-tail ***/
diff --git a/src/hb-gobject-enums.h.tmpl b/src/hb-gobject-enums.h.tmpl
new file mode 100644
index 0000000..6ecda06
--- /dev/null
+++ b/src/hb-gobject-enums.h.tmpl
@@ -0,0 +1,55 @@
+/*** BEGIN file-header ***/
+/*
+ * Copyright © 2013  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_GOBJECT_H_IN
+#error "Include <hb-gobject.h> instead."
+#endif
+
+#ifndef HB_GOBJECT_ENUMS_H
+#define HB_GOBJECT_ENUMS_H
+
+#include "hb.h"
+
+#include <glib-object.h>
+
+HB_BEGIN_DECLS
+
+
+/*** END file-header ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name at _get_type (void) G_GNUC_CONST;
+#define @ENUMPREFIX at _TYPE_@ENUMSHORT@ (@enum_name at _get_type ())
+
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+
+HB_END_DECLS
+
+#endif /* HB_GOBJECT_ENUMS_H */
+/*** END file-tail ***/
diff --git a/src/hb-gobject-structs.cc b/src/hb-gobject-structs.cc
index cec4854..6525542 100644
--- a/src/hb-gobject-structs.cc
+++ b/src/hb-gobject-structs.cc
@@ -37,27 +37,77 @@
 
 #include "hb-gobject.h"
 
-#define _HB_DEFINE_BOXED_TYPE(Name,underscore_name,copy_func,free_func) \
+#define HB_DEFINE_BOXED_TYPE(name,copy_func,free_func) \
 GType \
-underscore_name##_get_type (void) \
+hb_gobject_##name##_get_type (void) \
 { \
-   static volatile gsize type = 0; \
-   if (g_once_init_enter (&type)) { \
-      GType t = g_boxed_type_register_static (g_intern_static_string (#Name), \
-					      (GBoxedCopyFunc) copy_func, \
-					      (GBoxedFreeFunc) free_func); \
-      g_once_init_leave (&type, t); \
+   static gsize type_id = 0; \
+   if (g_once_init_enter (&type_id)) { \
+      GType id = g_boxed_type_register_static (g_intern_static_string ("hb_" #name "_t"), \
+					       (GBoxedCopyFunc) copy_func, \
+					       (GBoxedFreeFunc) free_func); \
+      g_once_init_leave (&type_id, id); \
    } \
-   return type; \
+   return type_id; \
 }
 
-#define HB_DEFINE_BOXED_TYPE(name) \
-	_HB_DEFINE_BOXED_TYPE (hb_##name, hb_gobject_##name, hb_##name##_reference, hb_##name##_destroy);
+#define HB_DEFINE_OBJECT_TYPE(name) \
+	HB_DEFINE_BOXED_TYPE (name, hb_##name##_reference, hb_##name##_destroy);
 
-HB_DEFINE_BOXED_TYPE (buffer)
-HB_DEFINE_BOXED_TYPE (blob)
-HB_DEFINE_BOXED_TYPE (face)
-HB_DEFINE_BOXED_TYPE (font)
-HB_DEFINE_BOXED_TYPE (font_funcs)
-HB_DEFINE_BOXED_TYPE (unicode_funcs)
+HB_DEFINE_OBJECT_TYPE (buffer)
+HB_DEFINE_OBJECT_TYPE (blob)
+HB_DEFINE_OBJECT_TYPE (face)
+HB_DEFINE_OBJECT_TYPE (font)
+HB_DEFINE_OBJECT_TYPE (font_funcs)
+HB_DEFINE_OBJECT_TYPE (set)
+HB_DEFINE_OBJECT_TYPE (shape_plan)
+HB_DEFINE_OBJECT_TYPE (unicode_funcs)
 
+
+static hb_feature_t *feature_reference (hb_feature_t *g)
+{
+  hb_feature_t *c = (hb_feature_t *) calloc (1, sizeof (hb_feature_t));
+  if (unlikely (!c)) return NULL;
+  *c = *g;
+  return c;
+}
+static void feature_destroy (hb_feature_t *g) { free (g); }
+HB_DEFINE_BOXED_TYPE (feature, feature_reference, feature_destroy)
+
+static hb_glyph_info_t *glyph_info_reference (hb_glyph_info_t *g)
+{
+  hb_glyph_info_t *c = (hb_glyph_info_t *) calloc (1, sizeof (hb_glyph_info_t));
+  if (unlikely (!c)) return NULL;
+  *c = *g;
+  return c;
+}
+static void glyph_info_destroy (hb_glyph_info_t *g) { free (g); }
+HB_DEFINE_BOXED_TYPE (glyph_info, glyph_info_reference, glyph_info_destroy)
+
+static hb_glyph_position_t *glyph_position_reference (hb_glyph_position_t *g)
+{
+  hb_glyph_position_t *c = (hb_glyph_position_t *) calloc (1, sizeof (hb_glyph_position_t));
+  if (unlikely (!c)) return NULL;
+  *c = *g;
+  return c;
+}
+static void glyph_position_destroy (hb_glyph_position_t *g) { free (g); }
+HB_DEFINE_BOXED_TYPE (glyph_position, glyph_position_reference, glyph_position_destroy)
+
+static hb_language_t language_reference (hb_language_t l) { return l; }
+static void language_destroy (hb_language_t l) { }
+HB_DEFINE_BOXED_TYPE (language, language_reference, language_destroy)
+
+static hb_segment_properties_t *segment_properties_reference (hb_segment_properties_t *g)
+{
+  hb_segment_properties_t *c = (hb_segment_properties_t *) calloc (1, sizeof (hb_segment_properties_t));
+  if (unlikely (!c)) return NULL;
+  *c = *g;
+  return c;
+}
+static void segment_properties_destroy (hb_segment_properties_t *g) { free (g); }
+HB_DEFINE_BOXED_TYPE (segment_properties, segment_properties_reference, segment_properties_destroy)
+
+static hb_user_data_key_t user_data_key_reference (hb_user_data_key_t l) { return l; }
+static void user_data_key_destroy (hb_user_data_key_t l) { }
+HB_DEFINE_BOXED_TYPE (user_data_key, user_data_key_reference, user_data_key_destroy)
diff --git a/src/hb-gobject-structs.h b/src/hb-gobject-structs.h
new file mode 100644
index 0000000..48af088
--- /dev/null
+++ b/src/hb-gobject-structs.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright © 2011  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_GOBJECT_H_IN
+#error "Include <hb-gobject.h> instead."
+#endif
+
+#ifndef HB_GOBJECT_STRUCTS_H
+#define HB_GOBJECT_STRUCTS_H
+
+#include "hb.h"
+
+#include <glib-object.h>
+
+HB_BEGIN_DECLS
+
+
+/* Object types */
+
+GType hb_gobject_blob_get_type (void);
+#define HB_GOBJECT_TYPE_BLOB (hb_gobject_blob_get_type ())
+
+GType hb_gobject_buffer_get_type (void);
+#define HB_GOBJECT_TYPE_BUFFER (hb_gobject_buffer_get_type ())
+
+GType hb_gobject_face_get_type (void);
+#define HB_GOBJECT_TYPE_FACE (hb_gobject_face_get_type ())
+
+GType hb_gobject_font_get_type (void);
+#define HB_GOBJECT_TYPE_FONT (hb_gobject_font_get_type ())
+
+GType hb_gobject_font_funcs_get_type (void);
+#define HB_GOBJECT_TYPE_FONT_FUNCS (hb_gobject_font_funcs_get_type ())
+
+GType hb_gobject_set_get_type (void);
+#define HB_GOBJECT_TYPE_SET (hb_gobject_set_get_type ())
+
+GType hb_gobject_shape_plan_get_type (void);
+#define HB_GOBJECT_TYPE_SHAPE_PLAN (hb_gobject_shape_plan_get_type ())
+
+GType hb_gobject_unicode_funcs_get_type (void);
+#define HB_GOBJECT_TYPE_UNICODE_FUNCS (hb_gobject_unicode_funcs_get_type ())
+
+/* Value types */
+
+GType hb_gobject_feature_get_type (void);
+#define HB_GOBJECT_TYPE_FEATURE (hb_gobject_feature_get_type ())
+
+GType hb_gobject_glyph_info_get_type (void);
+#define HB_GOBJECT_TYPE_GLYPH_INFO (hb_gobject_glyph_info_get_type ())
+
+GType hb_gobject_glyph_position_get_type (void);
+#define HB_GOBJECT_TYPE_GLYPH_POSITION (hb_gobject_glyph_position_get_type ())
+
+GType hb_gobject_segment_properties_get_type (void);
+#define HB_GOBJECT_TYPE_SEGMENT_PROPERTIES (hb_gobject_segment_properties_get_type ())
+
+GType hb_gobject_user_data_key_get_type (void);
+#define HB_GOBJECT_TYPE_USER_DATA_KEY (hb_gobject_user_data_key_get_type ())
+
+
+HB_END_DECLS
+
+#endif /* HB_GOBJECT_H */
diff --git a/src/hb-gobject.h b/src/hb-gobject.h
index 3076460..ea1bd25 100644
--- a/src/hb-gobject.h
+++ b/src/hb-gobject.h
@@ -26,45 +26,15 @@
 
 #ifndef HB_GOBJECT_H
 #define HB_GOBJECT_H
+#define HB_GOBJECT_H_IN
 
 #include "hb.h"
 
-#include <glib-object.h>
+#include "hb-gobject-enums.h"
+#include "hb-gobject-structs.h"
 
 HB_BEGIN_DECLS
-
-#ifndef __GTK_DOC_IGNORE__
-/* Objects */
-
-#define HB_GOBJECT_TYPE_BLOB hb_gobject_blob_get_type ()
-GType
-hb_gobject_blob_get_type (void);
-
-#define HB_GOBJECT_TYPE_BUFFER hb_gobject_buffer_get_type ()
-GType
-hb_gobject_buffer_get_type (void);
-
-#define HB_GOBJECT_TYPE_FACE hb_gobject_face_get_type ()
-GType
-hb_gobject_face_get_type (void);
-
-#define HB_GOBJECT_TYPE_FONT hb_gobject_font_get_type ()
-GType
-hb_gobject_font_get_type (void);
-
-#define HB_GOBJECT_TYPE_FONT_FUNCS hb_gobject_font_funcs_get_type ()
-GType
-hb_gobject_font_funcs_get_type (void);
-
-#define HB_GOBJECT_TYPE_UNICODE_FUNCS hb_gobject_unicode_funcs_get_type ()
-GType
-hb_gobject_unicode_funcs_get_type (void);
-
-#endif /* __GTK_DOC_IGNORE__ */
-
-/* Enums */
-
-
 HB_END_DECLS
 
+#undef HB_GOBJECT_H_IN
 #endif /* HB_GOBJECT_H */
commit 23027f7611b53b594e4b4008e916e42b5154f6ac
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Aug 22 19:03:21 2013 -0400

    [introspection] Enable gobject-introspection again

diff --git a/configure.ac b/configure.ac
index 4fc1e6f..132d070 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,7 +52,7 @@ m4_define([hb_libtool_current],
 HB_LIBTOOL_VERSION_INFO=hb_libtool_current:hb_libtool_revision:hb_libtool_age
 AC_SUBST(HB_LIBTOOL_VERSION_INFO)
 
-dnl GOBJECT_INTROSPECTION_CHECK([0.9.0])
+GOBJECT_INTROSPECTION_CHECK([1.32.0])
 GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
 
 # Functions and headers
@@ -409,6 +409,7 @@ Test / platform shapers (not normally needed):
 	Old HarfBuzz:		${have_hb_old}
 	Uniscribe:		${have_uniscribe}
 
-Documentation:
-	Referece docs:		${enable_gtk_doc}
+Other features:
+	Documentation:		${enable_gtk_doc}
+	Introspection:		${found_introspection}
 ])
diff --git a/src/Makefile.am b/src/Makefile.am
index 4fb2712..6109a62 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -353,26 +353,33 @@ TESTS_ENVIRONMENT = \
 	HBHEADERS="$(HBHEADERS) $(HBNODISTHEADERS)" \
 	$(NULL)
 
-#-include $(INTROSPECTION_MAKEFILE)
-#INTROSPECTION_GIRS = hb-1.0.gir
-#INTROSPECTION_SCANNER_ARGS = -I$(srcdir) -n hb --identifier-prefix=hb_
-#INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
-#
-#if HAVE_INTROSPECTION
-#
-#hb-1.0.gir: libharfbuzz.la
-#hb_1_0_gir_INCLUDES = GObject-2.0
-#hb_1_0_gir_CFLAGS = $(INCLUDES) $(HBCFLAGS) -DHB_H -DHB_H_IN -DHB_OT_H -DHB_OT_H_IN
-#hb_1_0_gir_LIBS = libharfbuzz.la
-#hb_1_0_gir_FILES = $(HBHEADERS) $(HBNODISTHEADERS)
-#
-#girdir = $(datadir)/gir-1.0
-#gir_DATA = $(INTROSPECTION_GIRS)
-#
-#typelibdir = $(libdir)/girepository-1.0
-#typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
-#
-#CLEANFILES += $(gir_DATA) $(typelib_DATA)
-#endif
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS = harfbuzz-$(HB_VERSION_MAJOR).0.gir # What does the 0 mean anyway?!
+INTROSPECTION_SCANNER_ARGS = -I$(srcdir) -n hb --identifier-prefix=hb_ --warn-all
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+
+if HAVE_INTROSPECTION
+
+harfbuzz-0.0.gir: libharfbuzz.la
+harfbuzz_0_0_gir_INCLUDES = GObject-2.0
+harfbuzz_0_0_gir_CFLAGS = \
+	$(INCLUDES) \
+	$(HBCFLAGS) \
+	-DHB_H \
+	-DHB_H_IN \
+	-DHB_OT_H \
+	-DHB_OT_H_IN \
+	$(NULL)
+harfbuzz_0_0_gir_LIBS = libharfbuzz.la
+harfbuzz_0_0_gir_FILES = $(HBHEADERS) $(HBNODISTHEADERS)
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif
 
 -include $(top_srcdir)/git.mk



More information about the HarfBuzz mailing list