diff options
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | ChangeLog.pre-1-10 | 20 | ||||
-rw-r--r-- | ChangeLog.pre-1-6 | 20 | ||||
-rw-r--r-- | ChangeLog.pre-1-8 | 20 | ||||
-rw-r--r-- | pango/fonts.c | 98 | ||||
-rw-r--r-- | pango/pango-context.c | 42 | ||||
-rw-r--r-- | pango/pango-context.h | 6 | ||||
-rw-r--r-- | pango/pango-fontmap.c | 35 | ||||
-rw-r--r-- | pango/pango-layout.c | 2 | ||||
-rw-r--r-- | pango/pango-types.h | 2 | ||||
-rw-r--r-- | pango/pango-utils.c | 2 | ||||
-rw-r--r-- | pango/pangofc-font.c | 51 | ||||
-rw-r--r-- | pango/pangofc-font.h | 4 | ||||
-rw-r--r-- | pango/pangofc-fontmap.c | 47 | ||||
-rw-r--r-- | pango/pangoft2-fontmap.c | 36 | ||||
-rw-r--r-- | pango/pangoft2-private.h | 30 | ||||
-rw-r--r-- | pango/pangoft2-render.c | 42 | ||||
-rw-r--r-- | pango/pangoft2.c | 79 | ||||
-rw-r--r-- | pango/pangoft2.h | 23 | ||||
-rw-r--r-- | pango/pangowin32-fontmap.c | 37 | ||||
-rw-r--r-- | pango/pangowin32.c | 39 | ||||
-rw-r--r-- | pango/pangoxft-font.c | 44 | ||||
-rw-r--r-- | pango/pangoxft-fontmap.c | 40 |
23 files changed, 241 insertions, 498 deletions
@@ -1,3 +1,23 @@ +Sat Jul 10 17:33:38 2004 Owen Taylor <otaylor@redhat.com> + + * pango/pangoft2-private.h pango/pangoft2-render.c + pango/pango-context.[ch] pango/pangoft2.[ch] pango/pango-utils. + pango/pango-types.h pango/pangofc-fontmap.c: Make PangoMatrix + arguments const where appropriate. + + * pango/pango-context.c pango/fonts.c pango/pangofc-font.c + pangofc-fontmap.c pango/pangoft2.c pango/pangoft2-fontmap.c + pango/pangoxft-font.c pango/pangoxft-fontmap.c + pango/pangowin32-fontmap.c: Use G_DEFINE_TYPE comprehensively. + + * pango/pangoft2-private.h pangoft2.c: Un-staticify + pango_ft2_font_get_type. + +Sat Jul 10 16:55:46 2004 Owen Taylor <otaylor@redhat.com> + + * pango/pangofc-font.h (struct _PangoFcFont): + s/hinted/is_hinted/ s/transform/is_transformed/. + Sat Jul 10 16:39:44 2004 Owen Taylor <otaylor@redhat.com> * pango/pangofc-font.[ch]: Add hinted/transform flags diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index bf60861c..84b5fee9 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,23 @@ +Sat Jul 10 17:33:38 2004 Owen Taylor <otaylor@redhat.com> + + * pango/pangoft2-private.h pango/pangoft2-render.c + pango/pango-context.[ch] pango/pangoft2.[ch] pango/pango-utils. + pango/pango-types.h pango/pangofc-fontmap.c: Make PangoMatrix + arguments const where appropriate. + + * pango/pango-context.c pango/fonts.c pango/pangofc-font.c + pangofc-fontmap.c pango/pangoft2.c pango/pangoft2-fontmap.c + pango/pangoxft-font.c pango/pangoxft-fontmap.c + pango/pangowin32-fontmap.c: Use G_DEFINE_TYPE comprehensively. + + * pango/pangoft2-private.h pangoft2.c: Un-staticify + pango_ft2_font_get_type. + +Sat Jul 10 16:55:46 2004 Owen Taylor <otaylor@redhat.com> + + * pango/pangofc-font.h (struct _PangoFcFont): + s/hinted/is_hinted/ s/transform/is_transformed/. + Sat Jul 10 16:39:44 2004 Owen Taylor <otaylor@redhat.com> * pango/pangofc-font.[ch]: Add hinted/transform flags diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6 index bf60861c..84b5fee9 100644 --- a/ChangeLog.pre-1-6 +++ b/ChangeLog.pre-1-6 @@ -1,3 +1,23 @@ +Sat Jul 10 17:33:38 2004 Owen Taylor <otaylor@redhat.com> + + * pango/pangoft2-private.h pango/pangoft2-render.c + pango/pango-context.[ch] pango/pangoft2.[ch] pango/pango-utils. + pango/pango-types.h pango/pangofc-fontmap.c: Make PangoMatrix + arguments const where appropriate. + + * pango/pango-context.c pango/fonts.c pango/pangofc-font.c + pangofc-fontmap.c pango/pangoft2.c pango/pangoft2-fontmap.c + pango/pangoxft-font.c pango/pangoxft-fontmap.c + pango/pangowin32-fontmap.c: Use G_DEFINE_TYPE comprehensively. + + * pango/pangoft2-private.h pangoft2.c: Un-staticify + pango_ft2_font_get_type. + +Sat Jul 10 16:55:46 2004 Owen Taylor <otaylor@redhat.com> + + * pango/pangofc-font.h (struct _PangoFcFont): + s/hinted/is_hinted/ s/transform/is_transformed/. + Sat Jul 10 16:39:44 2004 Owen Taylor <otaylor@redhat.com> * pango/pangofc-font.[ch]: Add hinted/transform flags diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index bf60861c..84b5fee9 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,3 +1,23 @@ +Sat Jul 10 17:33:38 2004 Owen Taylor <otaylor@redhat.com> + + * pango/pangoft2-private.h pango/pangoft2-render.c + pango/pango-context.[ch] pango/pangoft2.[ch] pango/pango-utils. + pango/pango-types.h pango/pangofc-fontmap.c: Make PangoMatrix + arguments const where appropriate. + + * pango/pango-context.c pango/fonts.c pango/pangofc-font.c + pangofc-fontmap.c pango/pangoft2.c pango/pangoft2-fontmap.c + pango/pangoxft-font.c pango/pangoxft-fontmap.c + pango/pangowin32-fontmap.c: Use G_DEFINE_TYPE comprehensively. + + * pango/pangoft2-private.h pangoft2.c: Un-staticify + pango_ft2_font_get_type. + +Sat Jul 10 16:55:46 2004 Owen Taylor <otaylor@redhat.com> + + * pango/pangofc-font.h (struct _PangoFcFont): + s/hinted/is_hinted/ s/transform/is_transformed/. + Sat Jul 10 16:39:44 2004 Owen Taylor <otaylor@redhat.com> * pango/pangofc-font.[ch]: Add hinted/transform flags diff --git a/pango/fonts.c b/pango/fonts.c index 5afe8bfd..f2efbd7d 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -999,33 +999,17 @@ pango_font_description_to_filename (const PangoFontDescription *desc) return result; } - -GType -pango_font_get_type (void) + +G_DEFINE_TYPE (PangoFont, pango_font, G_TYPE_OBJECT) + +static void +pango_font_class_init (PangoFontClass *class) { - static GType object_type = 0; +} - if (!object_type) - { - static const GTypeInfo object_info = - { - sizeof (PangoFontClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - NULL, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoFont), - 0, /* n_preallocs */ - NULL /* init */ - }; - - object_type = g_type_register_static (G_TYPE_OBJECT, - "PangoFont", - &object_info, 0); - } - - return object_type; +static void +pango_font_init (PangoFont *font) +{ } /** @@ -1362,32 +1346,16 @@ pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics) * PangoFontFamily */ -GType -pango_font_family_get_type (void) +G_DEFINE_TYPE (PangoFontFamily, pango_font_family, G_TYPE_OBJECT) + +static void +pango_font_family_class_init (PangoFontFamilyClass *class) { - static GType object_type = 0; +} - if (!object_type) - { - static const GTypeInfo object_info = - { - sizeof (PangoFontFamilyClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - NULL, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoFontFamily), - 0, /* n_preallocs */ - NULL /* init */ - }; - - object_type = g_type_register_static (G_TYPE_OBJECT, - "PangoFontFamily", - &object_info, 0); - } - - return object_type; +static void +pango_font_family_init (PangoFontFamily *family) +{ } /** @@ -1465,32 +1433,16 @@ pango_font_family_is_monospace (PangoFontFamily *family) * PangoFontFace */ -GType -pango_font_face_get_type (void) +G_DEFINE_TYPE (PangoFontFace, pango_font_face, G_TYPE_OBJECT) + +static void +pango_font_face_class_init (PangoFontFaceClass *class) { - static GType object_type = 0; +} - if (!object_type) - { - static const GTypeInfo object_info = - { - sizeof (PangoFontFaceClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - NULL, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoFont), - 0, /* n_preallocs */ - NULL /* init */ - }; - - object_type = g_type_register_static (G_TYPE_OBJECT, - "PangoFontFace", - &object_info, 0); - } - - return object_type; +static void +pango_font_face_init (PangoFontFace *face) +{ } /** diff --git a/pango/pango-context.c b/pango/pango-context.c index 7565103e..21a2e8c3 100644 --- a/pango/pango-context.c +++ b/pango/pango-context.c @@ -48,39 +48,9 @@ struct _PangoContextClass }; -static void pango_context_init (PangoContext *context); -static void pango_context_class_init (PangoContextClass *klass); static void pango_context_finalize (GObject *object); -static gpointer parent_class; - -GType -pango_context_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - static const GTypeInfo object_info = - { - sizeof (PangoContextClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_context_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoContext), - 0, /* n_preallocs */ - (GInstanceInitFunc) pango_context_init, - }; - - object_type = g_type_register_static (G_TYPE_OBJECT, - "PangoContext", - &object_info, 0); - } - - return object_type; -} +G_DEFINE_TYPE (PangoContext, pango_context, G_TYPE_OBJECT) static void pango_context_init (PangoContext *context) @@ -103,8 +73,6 @@ pango_context_class_init (PangoContextClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = pango_context_finalize; } @@ -122,7 +90,7 @@ pango_context_finalize (GObject *object) if (context->matrix) pango_matrix_free (context->matrix); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (pango_context_parent_class)->finalize (object); } @@ -169,8 +137,8 @@ pango_context_new (void) * matrices, depending on how the text is fit to the pixel grid. **/ void -pango_context_set_matrix (PangoContext *context, - PangoMatrix *matrix) +pango_context_set_matrix (PangoContext *context, + const PangoMatrix *matrix) { g_return_if_fail (PANGO_IS_CONTEXT (context)); @@ -194,7 +162,7 @@ pango_context_set_matrix (PangoContext *context, * matrix is owned by Pango and must not be modified or * freed. **/ -PangoMatrix * +G_CONST_RETURN PangoMatrix * pango_context_get_matrix (PangoContext *context) { g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL); diff --git a/pango/pango-context.h b/pango/pango-context.h index a5ae7c74..385c2d93 100644 --- a/pango/pango-context.h +++ b/pango/pango-context.h @@ -79,9 +79,9 @@ void pango_context_set_base_dir (PangoContext PangoDirection direction); PangoDirection pango_context_get_base_dir (PangoContext *context); -void pango_context_set_matrix (PangoContext *context, - PangoMatrix *matrix); -PangoMatrix *pango_context_get_matrix (PangoContext *context); +void pango_context_set_matrix (PangoContext *context, + const PangoMatrix *matrix); +G_CONST_RETURN PangoMatrix *pango_context_get_matrix (PangoContext *context); /* Break a string of Unicode characters into segments with * consistent shaping/language engine and bidrectional level. diff --git a/pango/pango-fontmap.c b/pango/pango-fontmap.c index fb348ea1..c94e1a24 100644 --- a/pango/pango-fontmap.c +++ b/pango/pango-fontmap.c @@ -23,41 +23,13 @@ #include "pango-utils.h" #include <stdlib.h> -static void pango_font_map_class_init (PangoFontMapClass *class); static PangoFontset *pango_font_map_real_load_fontset (PangoFontMap *fontmap, PangoContext *context, const PangoFontDescription *desc, PangoLanguage *language); -GType -pango_font_map_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - static const GTypeInfo object_info = - { - sizeof (PangoFontMapClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_font_map_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoFontMap), - 0, /* n_preallocs */ - NULL /* init */ - }; - - object_type = g_type_register_static (G_TYPE_OBJECT, - "PangoFontMap", - &object_info, 0); - } - - return object_type; -} - +G_DEFINE_TYPE (PangoFontMap, pango_font_map, G_TYPE_OBJECT) static void pango_font_map_class_init (PangoFontMapClass *class) @@ -65,6 +37,11 @@ pango_font_map_class_init (PangoFontMapClass *class) class->load_fontset = pango_font_map_real_load_fontset; } +static void +pango_font_map_init (PangoFontMap *fontmap) +{ +} + /** * pango_font_map_load_font: * @fontmap: a #PangoFontMap diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 2d43dfab..533cf833 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -162,8 +162,6 @@ static int *pango_layout_line_get_vis2log_map (PangoLayoutLine *line, static void pango_layout_get_item_properties (PangoItem *item, ItemProperties *properties); -static void pango_layout_init (PangoLayout *layout); -static void pango_layout_class_init (PangoLayoutClass *klass); static void pango_layout_finalize (GObject *object); G_DEFINE_TYPE (PangoLayout, pango_layout, G_TYPE_OBJECT) diff --git a/pango/pango-types.h b/pango/pango-types.h index e7c64f7f..0902c6ac 100644 --- a/pango/pango-types.h +++ b/pango/pango-types.h @@ -96,7 +96,7 @@ struct _PangoMatrix **/ #define PANGO_MATRIX_INIT { 1., 0., 0., 1., 0., 0. } -PangoMatrix *pango_matrix_copy (PangoMatrix *matrix); +PangoMatrix *pango_matrix_copy (const PangoMatrix *matrix); void pango_matrix_free (PangoMatrix *matrix); void pango_matrix_translate (PangoMatrix *matrix, diff --git a/pango/pango-utils.c b/pango/pango-utils.c index 768ac8e6..ef8c222a 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -997,7 +997,7 @@ pango_parse_stretch (const char *str, * pango_matrix_free(). **/ PangoMatrix * -pango_matrix_copy (PangoMatrix *matrix) +pango_matrix_copy (const PangoMatrix *matrix) { g_return_val_if_fail (matrix != NULL, NULL); diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c index f1f72420..20772d8c 100644 --- a/pango/pangofc-font.c +++ b/pango/pangofc-font.c @@ -57,7 +57,6 @@ struct _PangoFcFontPrivate PangoFcDecoder *decoder; }; -static void pango_fc_font_class_init (PangoFcFontClass *class); static void pango_fc_font_finalize (GObject *object); static void pango_fc_font_set_property (GObject *object, guint prop_id, @@ -72,45 +71,14 @@ static PangoFontMetrics * pango_fc_font_get_metrics (PangoFont *font, PangoLanguage *language); static PangoFontDescription *pango_fc_font_describe (PangoFont *font); -static GObjectClass *parent_class; +G_DEFINE_TYPE (PangoFcFont, pango_fc_font, PANGO_TYPE_FONT) -GType -pango_fc_font_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - static const GTypeInfo object_info = - { - sizeof (PangoFcFontClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_fc_font_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoFcFont), - 0, /* n_preallocs */ - NULL /* init */ - }; - - object_type = g_type_register_static (PANGO_TYPE_FONT, - "PangoFcFont", - &object_info, - G_TYPE_FLAG_ABSTRACT); - } - - return object_type; -} - static void pango_fc_font_class_init (PangoFcFontClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); PangoFontClass *font_class = PANGO_FONT_CLASS (class); - parent_class = g_type_class_peek_parent (class); - object_class->finalize = pango_fc_font_finalize; object_class->set_property = pango_fc_font_set_property; font_class->describe = pango_fc_font_describe; @@ -128,6 +96,11 @@ pango_fc_font_class_init (PangoFcFontClass *class) } static void +pango_fc_font_init (PangoFcFont *fcfont) +{ +} + +static void free_metrics_info (PangoFcMetricsInfo *info) { pango_font_metrics_unref (info->metrics); @@ -152,7 +125,7 @@ pango_fc_font_finalize (GObject *object) if (priv->decoder) _pango_fc_font_set_decoder (fcfont, NULL); - parent_class->finalize (object); + G_OBJECT_CLASS (pango_fc_font_parent_class)->finalize (object); } static gboolean @@ -208,8 +181,8 @@ pango_fc_font_set_property (GObject *object, FcPatternReference (pattern); fcfont->font_pattern = pattern; fcfont->description = pango_fc_font_description_from_pattern (pattern, TRUE); - fcfont->hinted = pattern_is_hinted (pattern); - fcfont->transform = pattern_is_transformed (pattern); + fcfont->is_hinted = pattern_is_hinted (pattern); + fcfont->is_transformed = pattern_is_transformed (pattern); } break; default: @@ -335,7 +308,7 @@ get_face_metrics (PangoFcFont *fcfont, FT_Vector_Transform (&vector, &ft_matrix); metrics->ascent = PANGO_UNITS_26_6 (vector.y); } - else if (fcfont->hinted) + else if (fcfont->is_hinted) { metrics->descent = - PANGO_UNITS_26_6 (face->size->metrics.descender); metrics->ascent = PANGO_UNITS_26_6 (face->size->metrics.ascender); @@ -390,7 +363,7 @@ get_face_metrics (PangoFcFont *fcfont, /* If hinting is on for this font, quantize the underline and strikethrough position * to integer values. */ - if (fcfont->hinted) + if (fcfont->is_hinted) { quantize_position (&metrics->underline_thickness, &metrics->underline_position); quantize_position (&metrics->strikethrough_thickness, &metrics->strikethrough_position); @@ -767,7 +740,7 @@ _pango_fc_font_get_raw_extents (PangoFcFont *fcfont, { logical_rect->x = 0; logical_rect->width = PANGO_UNITS_26_6 (gm->horiAdvance); - if (fcfont->hinted) + if (fcfont->is_hinted) { logical_rect->y = - PANGO_UNITS_26_6 (face->size->metrics.ascender); logical_rect->height = PANGO_UNITS_26_6 (face->size->metrics.ascender - face->size->metrics.descender); diff --git a/pango/pangofc-font.h b/pango/pangofc-font.h index 70e72432..f3db9a86 100644 --- a/pango/pangofc-font.h +++ b/pango/pangofc-font.h @@ -75,8 +75,8 @@ struct _PangoFcFont GSList *metrics_by_lang; - guint hinted : 1; - guint transform : 1; + guint is_hinted : 1; + guint is_transformed : 1; }; /** diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index 2fc88d50..e779b43d 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -113,8 +113,6 @@ struct _PangoFcFindFuncInfo static GType pango_fc_family_get_type (void); static GType pango_fc_face_get_type (void); -static void pango_fc_font_map_init (PangoFcFontMap *fontmap); -static void pango_fc_font_map_class_init (PangoFontMapClass *class); static void pango_fc_font_map_finalize (GObject *object); static PangoFont * pango_fc_font_map_load_font (PangoFontMap *fontmap, PangoContext *context, @@ -137,35 +135,7 @@ static guint pango_fc_coverage_key_hash (PangoFcCoverageKey *key); static gboolean pango_fc_coverage_key_equal (PangoFcCoverageKey *key1, PangoFcCoverageKey *key2); -static PangoFontClass *parent_class; - -GType -pango_fc_font_map_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - static const GTypeInfo object_info = - { - sizeof (PangoFcFontMapClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_fc_font_map_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoFcFontMap), - 0, /* n_preallocs */ - (GInstanceInitFunc) pango_fc_font_map_init, - }; - - object_type = g_type_register_static (PANGO_TYPE_FONT_MAP, - "PangoFcFontMap", - &object_info, 0); - } - - return object_type; -} +G_DEFINE_TYPE (PangoFcFontMap, pango_fc_font_map, PANGO_TYPE_FONT_MAP) static void pango_fc_font_map_init (PangoFcFontMap *fcfontmap) @@ -198,17 +168,16 @@ pango_fc_font_map_init (PangoFcFontMap *fcfontmap) } static void -pango_fc_font_map_class_init (PangoFontMapClass *class) +pango_fc_font_map_class_init (PangoFcFontMapClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); - - parent_class = g_type_class_peek_parent (class); + PangoFontMapClass *fontmap_class = PANGO_FONT_MAP_CLASS (class); object_class->finalize = pango_fc_font_map_finalize; - class->load_font = pango_fc_font_map_load_font; - class->load_fontset = pango_fc_font_map_load_fontset; - class->list_families = pango_fc_font_map_list_families; - class->shape_engine_type = PANGO_RENDER_TYPE_FC; + fontmap_class->load_font = pango_fc_font_map_load_font; + fontmap_class->load_fontset = pango_fc_font_map_load_fontset; + fontmap_class->list_families = pango_fc_font_map_list_families; + fontmap_class->shape_engine_type = PANGO_RENDER_TYPE_FC; g_type_class_add_private (object_class, sizeof (PangoFcFontMapPrivate)); } @@ -404,7 +373,7 @@ pango_fc_font_map_finalize (GObject *object) priv->findfuncs = g_slist_delete_link (priv->findfuncs, priv->findfuncs); } - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (pango_fc_font_map_parent_class)->finalize (object); } /* Add a mapping from xfont->font_pattern to xfont */ diff --git a/pango/pangoft2-fontmap.c b/pango/pangoft2-fontmap.c index 4d4c7a57..723fb495 100644 --- a/pango/pangoft2-fontmap.c +++ b/pango/pangoft2-fontmap.c @@ -67,8 +67,6 @@ struct _PangoFT2FontMapClass PangoFcFontMapClass parent_class; }; -static void pango_ft2_font_map_class_init (PangoFT2FontMapClass *class); -static void pango_ft2_font_map_init (PangoFT2FontMap *fontmap); static void pango_ft2_font_map_finalize (GObject *object); static void pango_ft2_font_map_default_substitute (PangoFcFontMap *fcfontmap, FcPattern *pattern); @@ -77,35 +75,7 @@ static PangoFcFont * pango_ft2_font_map_new_font (PangoFcFontMap static PangoFT2FontMap *pango_ft2_global_fontmap = NULL; -static GObjectClass *parent_class; - -GType -pango_ft2_font_map_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - static const GTypeInfo object_info = - { - sizeof (PangoFT2FontMapClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_ft2_font_map_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoFT2FontMap), - 0, /* n_preallocs */ - (GInstanceInitFunc) pango_ft2_font_map_init, - }; - - object_type = g_type_register_static (PANGO_TYPE_FC_FONT_MAP, - "PangoFT2FontMap", - &object_info, 0); - } - - return object_type; -} +G_DEFINE_TYPE (PangoFT2FontMap, pango_ft2_font_map, PANGO_TYPE_FC_FONT_MAP) static void pango_ft2_font_map_class_init (PangoFT2FontMapClass *class) @@ -113,8 +83,6 @@ pango_ft2_font_map_class_init (PangoFT2FontMapClass *class) GObjectClass *gobject_class = G_OBJECT_CLASS (class); PangoFcFontMapClass *fcfontmap_class = PANGO_FC_FONT_MAP_CLASS (class); - parent_class = g_type_class_peek_parent (class); - gobject_class->finalize = pango_ft2_font_map_finalize; fcfontmap_class->default_substitute = pango_ft2_font_map_default_substitute; fcfontmap_class->new_font = pango_ft2_font_map_new_font; @@ -138,7 +106,7 @@ pango_ft2_font_map_finalize (GObject *object) FT_Done_FreeType (ft2fontmap->library); - parent_class->finalize (object); + G_OBJECT_CLASS (pango_ft2_font_map_parent_class)->finalize (object); } /** diff --git a/pango/pangoft2-private.h b/pango/pangoft2-private.h index 29ab5b50..76735416 100644 --- a/pango/pangoft2-private.h +++ b/pango/pangoft2-private.h @@ -79,6 +79,12 @@ struct _PangoFT2GlyphInfo void *cached_glyph; }; +#define PANGO_TYPE_FT2_FONT (pango_ft2_font_get_type ()) +#define PANGO_FT2_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FT2_FONT, PangoFT2Font)) +#define PANGO_FT2_IS_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FT2_FONT)) + +GType pango_ft2_font_get_type (void); + PangoFT2Font * _pango_ft2_font_new (PangoFT2FontMap *ft2fontmap, FcPattern *pattern); FT_Library _pango_ft2_font_map_get_library (PangoFontMap *fontmap); @@ -92,17 +98,17 @@ void pango_ft2_font_set_cache_glyph_data (PangoFont *font, void pango_ft2_font_set_glyph_cache_destroy (PangoFont *font, GDestroyNotify destroy_notify); -void _pango_ft2_draw_rect (FT_Bitmap *bitmap, - PangoMatrix *matrix, - int x, - int y, - int width, - int height); -void _pango_ft2_draw_error_underline (FT_Bitmap *bitmap, - PangoMatrix *matrix, - int x, - int y, - int width, - int height); +void _pango_ft2_draw_rect (FT_Bitmap *bitmap, + const PangoMatrix *matrix, + int x, + int y, + int width, + int height); +void _pango_ft2_draw_error_underline (FT_Bitmap *bitmap, + const PangoMatrix *matrix, + int x, + int y, + int width, + int height); #endif /* __PANGOFT2_PRIVATE_H__ */ diff --git a/pango/pangoft2-render.c b/pango/pangoft2-render.c index 367429e1..73b33570 100644 --- a/pango/pangoft2-render.c +++ b/pango/pangoft2-render.c @@ -227,10 +227,10 @@ typedef struct } Point; static void -to_device (PangoMatrix *matrix, - double x, - double y, - Point *result) +to_device (const PangoMatrix *matrix, + double x, + double y, + Point *result) { result->x = (x * matrix->xx + y * matrix->xy) / PANGO_SCALE + matrix->x0; result->y = (x * matrix->yx + y * matrix->yy) / PANGO_SCALE + matrix->y0; @@ -270,12 +270,12 @@ compare_points (const void *a, * is done anti-aliased. **/ void -_pango_ft2_draw_rect (FT_Bitmap *bitmap, - PangoMatrix *matrix, - int x, - int y, - int width, - int height) +_pango_ft2_draw_rect (FT_Bitmap *bitmap, + const PangoMatrix *matrix, + int x, + int y, + int width, + int height) { static const PangoMatrix identity = PANGO_MATRIX_INIT; Point points[4]; @@ -390,11 +390,11 @@ _pango_ft2_draw_rect (FT_Bitmap *bitmap, #define HEIGHT_SQUARES 2.5 static void -get_total_matrix (PangoMatrix *total, - PangoMatrix *global, - int x, - int y, - int square) +get_total_matrix (PangoMatrix *total, + const PangoMatrix *global, + int x, + int y, + int square) { PangoMatrix local; gdouble scale = 0.5 * square; @@ -433,12 +433,12 @@ get_total_matrix (PangoMatrix *total, * in the original rectangle) **/ void -_pango_ft2_draw_error_underline (FT_Bitmap *bitmap, - PangoMatrix *matrix, - int x, - int y, - int width, - int height) +_pango_ft2_draw_error_underline (FT_Bitmap *bitmap, + const PangoMatrix *matrix, + int x, + int y, + int width, + int height) { int square = height / HEIGHT_SQUARES; diff --git a/pango/pangoft2.c b/pango/pangoft2.c index f787f00d..98228282 100644 --- a/pango/pangoft2.c +++ b/pango/pangoft2.c @@ -38,10 +38,7 @@ #define FT_LOAD_TARGET_MONO FT_LOAD_MONOCHROME #endif -#define PANGO_TYPE_FT2_FONT (pango_ft2_font_get_type ()) -#define PANGO_FT2_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FT2_FONT, PangoFT2Font)) #define PANGO_FT2_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FT2_FONT, PangoFT2FontClass)) -#define PANGO_FT2_IS_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FT2_FONT)) #define PANGO_FT2_IS_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FT2_FONT)) #define PANGO_FT2_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FT2_FONT, PangoFT2FontClass)) @@ -59,10 +56,6 @@ typedef struct int bitmap_top; } PangoFT2RenderedGlyph; -static PangoFontClass *parent_class; /* Parent class structure for PangoFT2Font */ - -static void pango_ft2_font_class_init (PangoFT2FontClass *class); -static void pango_ft2_font_init (PangoFT2Font *ft2font); static void pango_ft2_font_finalize (GObject *object); static void pango_ft2_font_get_glyph_extents (PangoFont *font, @@ -79,8 +72,6 @@ static guint pango_ft2_font_real_get_glyph (PangoFcFont *font, static PangoGlyph pango_ft2_font_real_get_unknown_glyph (PangoFcFont *font, gunichar wc); -static GType pango_ft2_font_get_type (void); - static void pango_ft2_get_item_properties (PangoItem *item, PangoUnderline *uline, gboolean *strikethrough, @@ -263,33 +254,7 @@ pango_ft2_font_get_face (PangoFont *font) return ft2font->face; } -static GType -pango_ft2_font_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - static const GTypeInfo object_info = - { - sizeof (PangoFT2FontClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_ft2_font_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoFT2Font), - 0, /* n_preallocs */ - (GInstanceInitFunc) pango_ft2_font_init, - }; - - object_type = g_type_register_static (PANGO_TYPE_FC_FONT, - "PangoFT2Font", - &object_info, 0); - } - - return object_type; -} +G_DEFINE_TYPE (PangoFT2Font, pango_ft2_font, PANGO_TYPE_FC_FONT) static void pango_ft2_font_init (PangoFT2Font *ft2font) @@ -308,8 +273,6 @@ pango_ft2_font_class_init (PangoFT2FontClass *class) PangoFontClass *font_class = PANGO_FONT_CLASS (class); PangoFcFontClass *fc_font_class = PANGO_FC_FONT_CLASS (class); - parent_class = g_type_class_peek_parent (class); - object_class->finalize = pango_ft2_font_finalize; font_class->get_glyph_extents = pango_ft2_font_get_glyph_extents; @@ -362,11 +325,11 @@ pango_ft2_font_render_glyph (PangoFont *font, } static void -transform_point (PangoMatrix *matrix, - int x, - int y, - int *x_out_pixels, - int *y_out_pixels) +transform_point (const PangoMatrix *matrix, + int x, + int y, + int *x_out_pixels, + int *y_out_pixels) { double x_out = (matrix->xx * x + matrix->xy * y) / PANGO_SCALE + matrix->x0; double y_out = (matrix->yx * x + matrix->yy * y) / PANGO_SCALE + matrix->y0; @@ -394,12 +357,12 @@ transform_point (PangoMatrix *matrix, * transformation matrix to that passed in to this function. **/ void -pango_ft2_render_transformed (FT_Bitmap *bitmap, - PangoMatrix *matrix, - PangoFont *font, - PangoGlyphString *glyphs, - int x, - int y) +pango_ft2_render_transformed (FT_Bitmap *bitmap, + const PangoMatrix *matrix, + PangoFont *font, + PangoGlyphString *glyphs, + int x, + int y) { FT_UInt glyph_index; int i; @@ -720,7 +683,7 @@ pango_ft2_font_finalize (GObject *object) pango_ft2_free_glyph_info_callback, object); g_hash_table_destroy (ft2font->glyph_info); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (pango_ft2_font_parent_class)->finalize (object); } /** @@ -758,7 +721,7 @@ pango_ft2_get_unknown_glyph (PangoFont *font) static void draw_underline (FT_Bitmap *bitmap, - PangoMatrix *matrix, + const PangoMatrix *matrix, PangoFontMetrics *metrics, PangoUnderline uline, int x, @@ -814,12 +777,12 @@ draw_underline (FT_Bitmap *bitmap, } static void -draw_strikethrough (FT_Bitmap *bitmap, - PangoMatrix *matrix, - PangoFontMetrics *metrics, - int x, - int width, - int base_y) +draw_strikethrough (FT_Bitmap *bitmap, + const PangoMatrix *matrix, + PangoFontMetrics *metrics, + int x, + int width, + int base_y) { int strikethrough_thickness = pango_font_metrics_get_strikethrough_thickness (metrics); int strikethrough_position = pango_font_metrics_get_strikethrough_position (metrics); @@ -854,7 +817,7 @@ pango_ft2_render_layout_line_subpixel (FT_Bitmap *bitmap, PangoRectangle logical_rect; PangoRectangle ink_rect; int x_off = 0; - PangoMatrix *matrix; + const PangoMatrix *matrix; matrix = pango_context_get_matrix (pango_layout_get_context (line->layout)); diff --git a/pango/pangoft2.h b/pango/pangoft2.h index 16386c6d..ffa50cae 100644 --- a/pango/pangoft2.h +++ b/pango/pangoft2.h @@ -45,17 +45,18 @@ typedef void (*PangoFT2SubstituteFunc) (FcPattern *pattern, /* Calls for applications */ -void pango_ft2_render (FT_Bitmap *bitmap, - PangoFont *font, - PangoGlyphString *glyphs, - gint x, - gint y); -void pango_ft2_render_transformed (FT_Bitmap *bitmap, - PangoMatrix *matrix, - PangoFont *font, - PangoGlyphString *glyphs, - int x, - int y); +void pango_ft2_render (FT_Bitmap *bitmap, + PangoFont *font, + PangoGlyphString *glyphs, + gint x, + gint y); +void pango_ft2_render_transformed (FT_Bitmap *bitmap, + const PangoMatrix *matrix, + PangoFont *font, + PangoGlyphString *glyphs, + int x, + int y); + void pango_ft2_render_layout_line (FT_Bitmap *bitmap, PangoLayoutLine *line, int x, diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c index ba93d30c..8d462ad0 100644 --- a/pango/pangowin32-fontmap.c +++ b/pango/pangowin32-fontmap.c @@ -99,9 +99,6 @@ static void pango_win32_face_list_sizes (PangoFontFace *face, int **sizes, int *n_sizes); -static void pango_win32_font_map_init (PangoWin32FontMap *fontmap); -static void pango_win32_font_map_class_init (PangoFontMapClass *class); - static void pango_win32_font_map_finalize (GObject *object); static PangoFont *pango_win32_font_map_load_font (PangoFontMap *fontmap, PangoContext *context, @@ -115,35 +112,7 @@ static void pango_win32_fontmap_cache_clear (PangoWin32FontMap static void pango_win32_insert_font (PangoWin32FontMap *fontmap, LOGFONT *lfp); -static PangoFontClass *font_map_parent_class; /* Parent class structure for PangoWin32FontMap */ - -static GType -pango_win32_font_map_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - static const GTypeInfo object_info = - { - sizeof (PangoFontMapClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_win32_font_map_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoWin32FontMap), - 0, /* n_preallocs */ - (GInstanceInitFunc) pango_win32_font_map_init, - }; - - object_type = g_type_register_static (PANGO_TYPE_FONT_MAP, - "PangoWin32FontMap", - &object_info, 0); - } - - return object_type; -} +G_DEFINE_TYPE (PangoWin32FontMap, pango_win32_font_map, PANGO_TYPE_FONT_MAP) /* A hash function for LOGFONTs that takes into consideration only * those fields that indicate a specific .ttf file is in use: @@ -188,8 +157,6 @@ pango_win32_font_map_class_init (PangoFontMapClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); - font_map_parent_class = g_type_class_peek_parent (class); - object_class->finalize = pango_win32_font_map_finalize; class->load_font = pango_win32_font_map_load_font; class->list_families = pango_win32_font_map_list_families; @@ -293,7 +260,7 @@ pango_win32_font_map_finalize (GObject *object) pango_win32_font_cache_free (win32fontmap->font_cache); - G_OBJECT_CLASS (font_map_parent_class)->finalize (object); + G_OBJECT_CLASS (pango_win32_font_map_parent_class)->finalize (object); } /* diff --git a/pango/pangowin32.c b/pango/pangowin32.c index 1a7f3f5c..9ecadeb0 100644 --- a/pango/pangowin32.c +++ b/pango/pangowin32.c @@ -52,10 +52,6 @@ struct _PangoWin32FontClass PangoFontClass parent_class; }; -static PangoFontClass *parent_class; /* Parent class structure for PangoWin32Font */ - -static void pango_win32_font_class_init (PangoWin32FontClass *class); -static void pango_win32_font_init (PangoWin32Font *win32font); static void pango_win32_font_dispose (GObject *object); static void pango_win32_font_finalize (GObject *object); @@ -142,33 +138,7 @@ pango_win32_get_context (void) return result; } -static GType -pango_win32_font_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - static const GTypeInfo object_info = - { - sizeof (PangoWin32FontClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_win32_font_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoWin32Font), - 0, /* n_preallocs */ - (GInstanceInitFunc) pango_win32_font_init, - }; - - object_type = g_type_register_static (PANGO_TYPE_FONT, - "PangoWin32Font", - &object_info, 0); - } - - return object_type; -} +G_DEFINE_TYPE (PangoWin32Font, pango_win32_font, PANGO_TYPE_FONT) static void pango_win32_font_init (PangoWin32Font *win32font) @@ -231,8 +201,6 @@ pango_win32_font_class_init (PangoWin32FontClass *class) GObjectClass *object_class = G_OBJECT_CLASS (class); PangoFontClass *font_class = PANGO_FONT_CLASS (class); - parent_class = g_type_class_peek_parent (class); - object_class->finalize = pango_win32_font_finalize; object_class->dispose = pango_win32_font_dispose; @@ -245,6 +213,11 @@ pango_win32_font_class_init (PangoWin32FontClass *class) pango_win32_get_dc (); } +static void +pango_win32_font_init (PangoWin32Font *win32font) +{ +} + PangoWin32Font * pango_win32_font_new (PangoFontMap *fontmap, const LOGFONT *lfp, diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c index 8b7412ee..6634f353 100644 --- a/pango/pangoxft-font.c +++ b/pango/pangoxft-font.c @@ -41,10 +41,7 @@ struct _PangoXftFontClass PangoFcFontClass parent_class; }; -static PangoFontClass *parent_class; /* Parent class structure for PangoXftFont */ - -static void pango_xft_font_class_init (PangoXftFontClass *class); -static void pango_xft_font_finalize (GObject *object); +static void pango_xft_font_finalize (GObject *object); static void pango_xft_font_get_glyph_extents (PangoFont *font, PangoGlyph glyph, @@ -63,33 +60,7 @@ static void pango_xft_font_real_shutdown (PangoFcFont *font) static XftFont *xft_font_get_font (PangoFont *font); -GType -pango_xft_font_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - static const GTypeInfo object_info = - { - sizeof (PangoXftFontClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_xft_font_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoXftFont), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - }; - - object_type = g_type_register_static (PANGO_TYPE_FC_FONT, - "PangoXftFont", - &object_info, 0); - } - - return object_type; -} +G_DEFINE_TYPE (PangoXftFont, pango_xft_font, PANGO_TYPE_FC_FONT) static void pango_xft_font_class_init (PangoXftFontClass *class) @@ -98,8 +69,6 @@ pango_xft_font_class_init (PangoXftFontClass *class) PangoFontClass *font_class = PANGO_FONT_CLASS (class); PangoFcFontClass *fc_font_class = PANGO_FC_FONT_CLASS (class); - parent_class = g_type_class_peek_parent (class); - object_class->finalize = pango_xft_font_finalize; font_class->get_glyph_extents = pango_xft_font_get_glyph_extents; @@ -112,6 +81,11 @@ pango_xft_font_class_init (PangoXftFontClass *class) fc_font_class->shutdown = pango_xft_font_real_shutdown; } +static void +pango_xft_font_init (PangoXftFont *xftfont) +{ +} + PangoXftFont * _pango_xft_font_new (PangoXftFontMap *xftfontmap, FcPattern *pattern) @@ -438,7 +412,7 @@ pango_xft_font_finalize (GObject *object) if (xfont->glyph_info) g_hash_table_destroy (xfont->glyph_info); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (pango_xft_font_parent_class)->finalize (object); } static void @@ -568,7 +542,7 @@ pango_xft_font_get_glyph_extents (PangoFont *font, } else if (glyph) { - if (!fcfont->transform) + if (!fcfont->is_transformed) get_glyph_extents_xft (fcfont, glyph, ink_rect, logical_rect); else get_glyph_extents_raw (xfont, glyph, ink_rect, logical_rect); diff --git a/pango/pangoxft-fontmap.c b/pango/pangoxft-fontmap.c index ca362cb2..6d91ea6b 100644 --- a/pango/pangoxft-fontmap.c +++ b/pango/pangoxft-fontmap.c @@ -56,44 +56,15 @@ struct _PangoXftFontMapClass PangoFcFontMapClass parent_class; }; -static void pango_xft_font_map_class_init (PangoXftFontMapClass *class); static void pango_xft_font_map_default_substitute (PangoFcFontMap *fcfontmap, FcPattern *pattern); static PangoFcFont * pango_xft_font_map_new_font (PangoFcFontMap *fcfontmap, FcPattern *pattern); static void pango_xft_font_map_finalize (GObject *object); -static GObjectClass *parent_class; - static GSList *fontmaps = NULL; -GType -pango_xft_font_map_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - static const GTypeInfo object_info = - { - sizeof (PangoXftFontMapClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_xft_font_map_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoXftFontMap), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - }; - - object_type = g_type_register_static (PANGO_TYPE_FC_FONT_MAP, - "PangoXftFontMap", - &object_info, 0); - } - - return object_type; -} +G_DEFINE_TYPE (PangoXftFontMap, pango_xft_font_map, PANGO_TYPE_FC_FONT_MAP) static void pango_xft_font_map_class_init (PangoXftFontMapClass *class) @@ -101,14 +72,17 @@ pango_xft_font_map_class_init (PangoXftFontMapClass *class) GObjectClass *gobject_class = G_OBJECT_CLASS (class); PangoFcFontMapClass *fcfontmap_class = PANGO_FC_FONT_MAP_CLASS (class); - parent_class = g_type_class_peek_parent (class); - gobject_class->finalize = pango_xft_font_map_finalize; fcfontmap_class->default_substitute = pango_xft_font_map_default_substitute; fcfontmap_class->new_font = pango_xft_font_map_new_font; } static void +pango_xft_font_map_init (PangoXftFontMap *xftfontmap) +{ +} + +static void pango_xft_font_map_finalize (GObject *object) { PangoXftFontMap *xftfontmap = PANGO_XFT_FONT_MAP (object); @@ -118,7 +92,7 @@ pango_xft_font_map_finalize (GObject *object) if (xftfontmap->substitute_destroy) xftfontmap->substitute_destroy (xftfontmap->substitute_data); - parent_class->finalize (object); + G_OBJECT_CLASS (pango_xft_font_map_parent_class)->finalize (object); } |