summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2013-03-15 06:13:09 -0400
committerBehdad Esfahbod <behdad@behdad.org>2013-03-15 06:25:34 -0400
commit0942b1962d2ee8574c0aff345eb871e2daccea1e (patch)
treec8e8483a1465237bf42017e26b5239733ac79997 /pango
parent71006c534a5599f0a69f4bd9b6677b2a6ad5adb3 (diff)
downloadpango-0942b1962d2ee8574c0aff345eb871e2daccea1e.tar.gz
Bug 682846 - Use G_DEFINE_TYPE in pangowin32-fontmap
Based on patch from Chun-wei Fan.
Diffstat (limited to 'pango')
-rw-r--r--pango/pangocairo-win32fontmap.c2
-rw-r--r--pango/pangowin32-fontmap.c76
-rw-r--r--pango/pangowin32-private.h1
3 files changed, 22 insertions, 57 deletions
diff --git a/pango/pangocairo-win32fontmap.c b/pango/pangocairo-win32fontmap.c
index d64e9a99..b58d16f6 100644
--- a/pango/pangocairo-win32fontmap.c
+++ b/pango/pangocairo-win32fontmap.c
@@ -91,8 +91,6 @@ G_DEFINE_TYPE_WITH_CODE (PangoCairoWin32FontMap, pango_cairo_win32_font_map, PAN
static void
pango_cairo_win32_font_map_finalize (GObject *object)
{
- PangoCairoWin32FontMap *cwfontmap = PANGO_CAIRO_WIN32_FONT_MAP (object);
-
G_OBJECT_CLASS (pango_cairo_win32_font_map_parent_class)->finalize (object);
}
diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c
index eb54e61d..68ec2ee0 100644
--- a/pango/pangowin32-fontmap.c
+++ b/pango/pangowin32-fontmap.c
@@ -36,7 +36,8 @@
#include "pangowin32-private.h"
#include "modules.h"
-typedef struct _PangoWin32Family PangoWin32Family;
+typedef struct _PangoWin32Family PangoWin32Family;
+typedef PangoFontFamilyClass PangoWin32FamilyClass;
struct _PangoWin32Family
{
@@ -48,6 +49,7 @@ struct _PangoWin32Family
gboolean is_monospace;
};
+
#if !defined(NTM_PS_OPENTYPE)
# define NTM_PS_OPENTYPE 0x20000
#endif
@@ -58,11 +60,17 @@ struct _PangoWin32Family
#define PANGO_WIN32_TYPE_FAMILY (pango_win32_family_get_type ())
#define PANGO_WIN32_FAMILY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_WIN32_TYPE_FAMILY, PangoWin32Family))
-#define PANGO_WIN32_IS_FAMILY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_WIN32_TYPE_FAMILY))
+#define PANGO_WIN32_IS_FAMILY (object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_WIN32_TYPE_FAMILY))
+#define PANGO_WIN32_FAMILY_CLASS (klass) (G_TYPE_CHECK_CLASS_CAST (klass), PANGO_WIN32_TYPE_FAMILY, PangoWin32Family))
+#define PANGO_WIN32_IS_FAMILY_CLASS (klass) (G_TYPE_CHECK_CLASS_CAST (klass), PANGO_WIN32_TYPE_FAMILY))
+#define PANGO_WIN32_FAMILY_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), PANGO_WIN32_FAMILY, PangoWin32FamilyClass))
#define PANGO_WIN32_TYPE_FACE (pango_win32_face_get_type ())
#define PANGO_WIN32_FACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_WIN32_TYPE_FACE, PangoWin32Face))
#define PANGO_WIN32_IS_FACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_WIN32_TYPE_FACE))
+#define PANGO_WIN32_FACE_CLASS (klass) (G_TYPE_CHECK_CLASS_CAST (klass), PANGO_WIN32_TYPE_FACE, PangoWin32Face))
+#define PANGO_WIN32_IS_FACE_CLASS (klass) (G_TYPE_CHECK_CLASS_CAST (klass), PANGO_WIN32_TYPE_FACE))
+#define PANGO_WIN32_FACE_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), PANGO_WIN32_FACE, PangoWin32FaceClass))
static GType pango_win32_face_get_type (void);
@@ -832,6 +840,8 @@ pango_win32_family_is_monospace (PangoFontFamily *family)
return win32family->is_monospace;
}
+G_DEFINE_TYPE (PangoWin32Family, pango_win32_family, PANGO_TYPE_FONT_FAMILY)
+
static void
pango_win32_family_class_init (PangoFontFamilyClass *class)
{
@@ -840,32 +850,9 @@ pango_win32_family_class_init (PangoFontFamilyClass *class)
class->is_monospace = pango_win32_family_is_monospace;
}
-static GType
-pango_win32_family_get_type (void)
+static void
+pango_win32_family_init (PangoWin32Family *family)
{
- static GType object_type = 0;
-
- if (G_UNLIKELY (!object_type))
- {
- const GTypeInfo object_info =
- {
- sizeof (PangoFontFamilyClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) pango_win32_family_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PangoWin32Family),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_register_static (PANGO_TYPE_FONT_FAMILY,
- I_("PangoWin32Family"),
- &object_info, 0);
- }
-
- return object_type;
}
static void
@@ -1640,6 +1627,8 @@ pango_win32_face_is_synthesized (PangoFontFace *face)
return win32face->is_synthetic;
}
+G_DEFINE_TYPE (PangoWin32Face, pango_win32_face, PANGO_TYPE_FONT_FACE)
+
static void
pango_win32_face_class_init (PangoFontFaceClass *class)
{
@@ -1650,6 +1639,11 @@ pango_win32_face_class_init (PangoFontFaceClass *class)
}
static void
+pango_win32_face_init (PangoWin32Face *face)
+{
+}
+
+static void
pango_win32_face_list_sizes (PangoFontFace *face,
int **sizes,
int *n_sizes)
@@ -1662,34 +1656,6 @@ pango_win32_face_list_sizes (PangoFontFace *face,
*n_sizes = 0;
}
-static GType
-pango_win32_face_get_type (void)
-{
- static GType object_type = 0;
-
- if (G_UNLIKELY (!object_type))
- {
- static const GTypeInfo object_info =
- {
- sizeof (PangoFontFaceClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) pango_win32_face_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PangoWin32Face),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_register_static (PANGO_TYPE_FONT_FACE,
- I_("PangoWin32Face"),
- &object_info, 0);
- }
-
- return object_type;
-}
-
/**
* pango_win32_font_map_get_font_cache:
* @font_map: a #PangoWin32FontMap.
diff --git a/pango/pangowin32-private.h b/pango/pangowin32-private.h
index 73df2e99..ba95f9bc 100644
--- a/pango/pangowin32-private.h
+++ b/pango/pangowin32-private.h
@@ -85,6 +85,7 @@ typedef struct _PangoWin32FontMapClass PangoWin32FontMapClass;
typedef struct _PangoWin32Font PangoWin32Font;
typedef struct _PangoWin32FontClass PangoWin32FontClass;
typedef struct _PangoWin32Face PangoWin32Face;
+typedef PangoFontFaceClass PangoWin32FaceClass;
typedef struct _PangoWin32GlyphInfo PangoWin32GlyphInfo;
typedef struct _PangoWin32MetricsInfo PangoWin32MetricsInfo;