#include "pangox-private.h"
typedef struct _PangoXFamily PangoXFamily;
+typedef struct _PangoXFamilyClass PangoXFamilyClass;
typedef struct _PangoXSizeInfo PangoXSizeInfo;
/* Number of freed fonts */
GSList *font_entries;
};
+struct _PangoXFamilyClass
+{
+ PangoFontFamilyClass parent_class;
+};
+
struct _PangoXFace
{
PangoFontFace parent_instance;
{ "condensed", PANGO_STRETCH_CONDENSED },
};
-static void pango_x_font_map_init (PangoXFontMap *fontmap);
-static void pango_x_font_map_class_init (PangoFontMapClass *class);
-
static void pango_x_font_map_finalize (GObject *object);
static PangoFont *pango_x_font_map_load_font (PangoFontMap *fontmap,
PangoContext *context,
GType pango_x_face_get_type (void);
-
-static PangoFontClass *font_map_parent_class; /* Parent class structure for PangoXFontMap */
-
-GType
-pango_x_font_map_get_type (void)
-{
- static GType object_type = 0;
-
- if (G_UNLIKELY (!object_type))
- {
- const GTypeInfo object_info =
- {
- sizeof (PangoFontMapClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) pango_x_font_map_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PangoXFontMap),
- 0, /* n_preallocs */
- (GInstanceInitFunc) pango_x_font_map_init,
- NULL /* value_table */
- };
-
- object_type = g_type_register_static (PANGO_TYPE_FONT_MAP,
- I_("PangoXFontMap"),
- &object_info, 0);
- }
-
- return object_type;
-}
+G_DEFINE_TYPE (PangoXFontMap, pango_x_font_map, PANGO_TYPE_FONT_MAP);
static void
pango_x_font_map_init (PangoXFontMap *xfontmap)
}
static void
-pango_x_font_map_class_init (PangoFontMapClass *class)
+pango_x_font_map_class_init (PangoXFontMapClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
-
- font_map_parent_class = g_type_class_peek_parent (class);
+ PangoFontMapClass *font_map_class = PANGO_FONT_MAP_CLASS (class);
object_class->finalize = pango_x_font_map_finalize;
- class->load_font = pango_x_font_map_load_font;
- class->list_families = pango_x_font_map_list_families;
- class->shape_engine_type = PANGO_RENDER_TYPE_X;
+
+ font_map_class->load_font = pango_x_font_map_load_font;
+ font_map_class->list_families = pango_x_font_map_list_families;
+ font_map_class->shape_engine_type = PANGO_RENDER_TYPE_X;
}
/*
fontmaps = g_list_remove (fontmaps, xfontmap);
- G_OBJECT_CLASS (font_map_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango_x_font_map_parent_class)->finalize (object);
}
static void
return xface->face_name;
}
+typedef PangoFontFaceClass PangoXFaceClass;
+G_DEFINE_TYPE (PangoXFace, pango_x_face, PANGO_TYPE_FONT_FACE);
+
static void
-pango_x_face_class_init (PangoFontFaceClass *class)
+pango_x_face_class_init (PangoXFaceClass *class)
{
class->describe = pango_x_face_describe;
class->get_face_name = pango_x_face_get_face_name;
}
-GType
-pango_x_face_get_type (void)
+static void
+pango_x_face_init (PangoXFace *self)
{
- static GType object_type = 0;
-
- if (G_UNLIKELY (!object_type))
- {
- const GTypeInfo object_info =
- {
- sizeof (PangoFontFaceClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) pango_x_face_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PangoXFace),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- NULL /* value_table */
- };
-
- object_type = g_type_register_static (PANGO_TYPE_FONT_FACE,
- I_("PangoXFace"),
- &object_info, 0);
- }
-
- return object_type;
}
/* Cut and paste here to avoid an inter-module dependency */
return xfamily->family_name;
}
+G_DEFINE_TYPE (PangoXFamily, pango_x_family, PANGO_TYPE_FONT_FAMILY);
+
static void
-pango_x_family_class_init (PangoFontFamilyClass *class)
+pango_x_family_class_init (PangoXFamilyClass *klass)
{
- class->list_faces = pango_x_family_list_faces;
- class->get_name = pango_x_family_get_name;
+ PangoFontFamilyClass *font_family_class = PANGO_FONT_FAMILY_CLASS (klass);
+
+ font_family_class->list_faces = pango_x_family_list_faces;
+ font_family_class->get_name = pango_x_family_get_name;
}
-GType
-pango_x_family_get_type (void)
+static void
+pango_x_family_init (PangoXFamily *self)
{
- static GType object_type = 0;
-
- if (G_UNLIKELY (!object_type))
- {
- const GTypeInfo object_info =
- {
- sizeof (PangoFontFamilyClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) pango_x_family_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PangoXFamily),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- NULL /* value_table */
- };
-
- object_type = g_type_register_static (PANGO_TYPE_FONT_FAMILY,
- I_("PangoXFamily"),
- &object_info, 0);
- }
-
- return object_type;
}
-