diff options
-rw-r--r-- | pango/fonts.c | 23 | ||||
-rw-r--r-- | pango/pango-font-private.h | 6 |
2 files changed, 21 insertions, 8 deletions
diff --git a/pango/fonts.c b/pango/fonts.c index 004089fc..e502d2b3 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -745,9 +745,18 @@ pango_font_description_merge_static (PangoFontDescription *desc, desc->mask |= new_mask; } -static gint -compute_distance (const PangoFontDescription *a, - const PangoFontDescription *b) +gboolean +pango_font_description_is_similar (const PangoFontDescription *a, + const PangoFontDescription *b) +{ + return a->variant == b->variant && + a->stretch == b->stretch && + a->gravity == b->gravity; +} + +int +pango_font_description_compute_distance (const PangoFontDescription *a, + const PangoFontDescription *b) { if (a->style == b->style) { @@ -792,12 +801,10 @@ pango_font_description_better_match (const PangoFontDescription *desc, g_return_val_if_fail (desc != NULL, G_MAXINT); g_return_val_if_fail (new_match != NULL, G_MAXINT); - if (new_match->variant == desc->variant && - new_match->stretch == desc->stretch && - new_match->gravity == desc->gravity) + if (pango_font_description_is_similar (new_match, desc)) { - int old_distance = old_match ? compute_distance (desc, old_match) : G_MAXINT; - int new_distance = compute_distance (desc, new_match); + int old_distance = old_match ? pango_font_description_compute_distance (desc, old_match) : G_MAXINT; + int new_distance = pango_font_description_compute_distance (desc, new_match); if (new_distance < old_distance) return TRUE; diff --git a/pango/pango-font-private.h b/pango/pango-font-private.h index 885e38c1..f378ccdc 100644 --- a/pango/pango-font-private.h +++ b/pango/pango-font-private.h @@ -63,6 +63,12 @@ static inline int pango_font_get_absolute_size (PangoFont *font) return priv->get_absolute_size (font); } +gboolean pango_font_description_is_similar (const PangoFontDescription *a, + const PangoFontDescription *b); + +int pango_font_description_compute_distance (const PangoFontDescription *a, + const PangoFontDescription *b); + G_END_DECLS #endif /* __PANGO_FONT_PRIVATE_H__ */ |