[HarfBuzz] harfbuzz-ng: Branch 'master' - 3 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Sun Aug 14 06:17:52 PDT 2011
configure.ac | 13 +++++++++-
src/Makefile.am | 43 +++++++++++++++-------------------
src/hb-common.h | 3 +-
src/hb-ft.cc | 2 +
src/hb-glib.cc | 3 --
src/hb-gobject.cc | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++
src/hb-gobject.h | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 166 insertions(+), 29 deletions(-)
New commits:
commit c214cff55ce539d004d069a484dac3988953cb11
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sun Aug 14 15:17:16 2011 +0200
Start adding gobject-introspection support
diff --git a/configure.ac b/configure.ac
index d960856..6cd1018 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,12 +74,23 @@ fi
dnl ==========================================================================
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, have_glib=true, have_glib=false)
-PKG_CHECK_MODULES(GTHREAD, gthread-2.0, , have_glib=false)
if $have_glib; then
AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
fi
AM_CONDITIONAL(HAVE_GLIB, $have_glib)
+PKG_CHECK_MODULES(GTHREAD, gthread-2.0, have_gthread=true, have_gthread=false)
+if $have_gthread; then
+ AC_DEFINE(HAVE_GTHREAD, 1, [Have gthread2 library])
+fi
+AM_CONDITIONAL(HAVE_GTHREAD, $have_gthread)
+
+PKG_CHECK_MODULES(GOBJECT, gobject-2.0, have_gobject=true, have_gobject=false)
+if $have_gobject; then
+ AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
+fi
+AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
+
dnl ==========================================================================
PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, have_cairo=false)
diff --git a/src/Makefile.am b/src/Makefile.am
index 62a5b39..0e21466 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -83,45 +83,36 @@ endif
if HAVE_GLIB
HBCFLAGS += $(GLIB_CFLAGS)
HBLIBS += $(GLIB_LIBS)
-HBSOURCES += \
- hb-glib.cc \
- $(NULL)
-HBHEADERS += \
- hb-glib.h \
- $(NULL)
+HBSOURCES += hb-glib.cc
+HBHEADERS += hb-glib.h
+endif
+
+if HAVE_GOBJECT
+HBCFLAGS += $(GOBJECT_CFLAGS)
+HBLIBS += $(GOBJECT_LIBS)
+HBSOURCES += hb-gobject.cc
+HBHEADERS += hb-gobject.h
endif
if HAVE_ICU
HBCFLAGS += $(ICU_CFLAGS)
HBLIBS += $(ICU_LIBS)
-HBSOURCES += \
- hb-icu.cc \
- $(NULL)
-HBHEADERS += \
- hb-icu.h \
- $(NULL)
+HBSOURCES += hb-icu.cc
+HBHEADERS += hb-icu.h
endif
if HAVE_FREETYPE
HBCFLAGS += $(FREETYPE_CFLAGS)
HBLIBS += $(FREETYPE_LIBS)
-HBSOURCES += \
- hb-ft.cc \
- $(NULL)
-HBHEADERS += \
- hb-ft.h \
- $(NULL)
+HBSOURCES += hb-ft.cc
+HBHEADERS += hb-ft.h
endif
if HAVE_UNISCRIBE
HBCFLAGS += $(UNISCRIBE_CFLAGS)
HBLIBS += $(UNISCRIBE_LIBS)
-HBSOURCES += \
- hb-uniscribe-shape.cc \
- $(NULL)
-HBHEADERS += \
- hb-uniscribe.h \
- $(NULL)
+HBSOURCES += hb-uniscribe-shape.cc
+HBHEADERS += hb-uniscribe.h
endif
CXXLINK = $(LINK)
@@ -177,4 +168,8 @@ TESTS_ENVIRONMENT = \
HBHEADERS="$(HBHEADERS)" \
$(NULL)
+scan:
+ g-ir-scanner $(HBCFLAGS) $(HBHEADERS) -n hb --strip-prefix=hb --library libharfbuzz.la
+
+
-include $(top_srcdir)/git.mk
diff --git a/src/hb-common.h b/src/hb-common.h
index 4687809..e4f1991 100644
--- a/src/hb-common.h
+++ b/src/hb-common.h
@@ -306,6 +306,7 @@ hb_script_get_horizontal_direction (hb_script_t script);
/* User data */
typedef struct _hb_user_data_key_t {
+ /*< private >*/
char unused;
} hb_user_data_key_t;
diff --git a/src/hb-glib.cc b/src/hb-glib.cc
index 1fd54e5..f990988 100644
--- a/src/hb-glib.cc
+++ b/src/hb-glib.cc
@@ -32,8 +32,6 @@
#include "hb-unicode-private.hh"
-#include <glib.h>
-
#if !GLIB_CHECK_VERSION(2,29,14)
static const hb_script_t
@@ -349,4 +347,3 @@ hb_glib_get_unicode_funcs (void)
return &_hb_glib_unicode_funcs;
}
-
diff --git a/src/hb-gobject.cc b/src/hb-gobject.cc
new file mode 100644
index 0000000..cec4854
--- /dev/null
+++ b/src/hb-gobject.cc
@@ -0,0 +1,63 @@
+/*
+ * 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
+ */
+
+#include "hb-private.hh"
+
+/* g++ didn't like older gtype.h gcc-only code path. */
+#include <glib.h>
+#if !GLIB_CHECK_VERSION(2,29,16)
+#undef __GNUC__
+#undef __GNUC_MINOR__
+#define __GNUC__ 2
+#define __GNUC_MINOR__ 6
+#endif
+
+#include "hb-gobject.h"
+
+#define _HB_DEFINE_BOXED_TYPE(Name,underscore_name,copy_func,free_func) \
+GType \
+underscore_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); \
+ } \
+ return type; \
+}
+
+#define HB_DEFINE_BOXED_TYPE(name) \
+ _HB_DEFINE_BOXED_TYPE (hb_##name, hb_gobject_##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)
+
diff --git a/src/hb-gobject.h b/src/hb-gobject.h
new file mode 100644
index 0000000..25fc941
--- /dev/null
+++ b/src/hb-gobject.h
@@ -0,0 +1,68 @@
+/*
+ * 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
+#define HB_GOBJECT_H
+
+#include "hb.h"
+#include <glib-object.h>
+
+HB_BEGIN_DECLS
+
+
+/* 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);
+
+
+/* Enums */
+
+
+HB_END_DECLS
+
+#endif /* HB_GOBJECT_H */
commit 9527fb200ffbbd839334e99b51d9671752d393db
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sat Aug 13 19:03:48 2011 +0200
Fix missing return
diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index aa73e7b..57ab034 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -425,4 +425,6 @@ hb_ft_font_get_face (hb_font_t *font)
if (font->destroy == (hb_destroy_func_t) FT_Done_Face ||
font->destroy == (hb_destroy_func_t) _do_nothing)
return (FT_Face) font->user_data;
+
+ return NULL;
}
commit 77a328769545f6b2970d8491fe77fe98781961cf
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sat Aug 13 17:16:45 2011 +0200
Minor
diff --git a/src/hb-common.h b/src/hb-common.h
index a0ab17e..4687809 100644
--- a/src/hb-common.h
+++ b/src/hb-common.h
@@ -94,7 +94,7 @@ hb_tag_t hb_tag_from_string (const char *s);
/* hb_direction_t */
-typedef enum _hb_direction_t {
+typedef enum {
HB_DIRECTION_INVALID = -1,
HB_DIRECTION_LTR = 0,
HB_DIRECTION_RTL,
More information about the HarfBuzz
mailing list