diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-05-22 00:25:20 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-05-22 00:25:20 +0000 |
commit | bd1ededd198c3d49367e6315dcfb2008e695f232 (patch) | |
tree | 95dca9552e931e4086119f2f08527b99f77f0027 /pango/pangofc-font.c | |
parent | d54bd3a213fd550509e07e5bfbce5f1df8599565 (diff) | |
download | pango-bd1ededd198c3d49367e6315dcfb2008e695f232.tar.gz |
Bug 342525 – With PangoFc and PangoWin32, approximate digit width is not
2006-05-21 Behdad Esfahbod <behdad@gnome.org>
Bug 342525 – With PangoFc and PangoWin32, approximate digit width is
not what it says
* pango/pangofc-font.c (pango_fc_font_create_metrics_for_context):
Likewise for PangoFc. Compute average instead of max.
(max_glpyh_with): Now unused, drop.
Diffstat (limited to 'pango/pangofc-font.c')
-rw-r--r-- | pango/pangofc-font.c | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c index 2c0968d4..e31155a0 100644 --- a/pango/pangofc-font.c +++ b/pango/pangofc-font.c @@ -392,30 +392,6 @@ get_face_metrics (PangoFcFont *fcfont, PANGO_FC_FONT_UNLOCK_FACE (fcfont); } -static int -max_glyph_width (PangoLayout *layout) -{ - int max_width = 0; - GSList *l, *r; - - for (l = pango_layout_get_lines (layout); l; l = l->next) - { - PangoLayoutLine *line = l->data; - - for (r = line->runs; r; r = r->next) - { - PangoGlyphString *glyphs = ((PangoGlyphItem *)r->data)->glyphs; - int i; - - for (i = 0; i < glyphs->num_glyphs; i++) - if (glyphs->glyphs[i].geometry.width > max_width) - max_width = glyphs->glyphs[i].geometry.width; - } - } - - return max_width; -} - PangoFontMetrics * pango_fc_font_create_metrics_for_context (PangoFcFont *fcfont, PangoContext *context) @@ -435,12 +411,11 @@ pango_fc_font_create_metrics_for_context (PangoFcFont *fcfont, pango_layout_set_text (layout, sample_str, -1); pango_layout_get_extents (layout, NULL, &extents); - - metrics->approximate_char_width = - extents.width / g_utf8_strlen (sample_str, -1); + metrics->approximate_char_width = extents.width / g_utf8_strlen (sample_str, -1); pango_layout_set_text (layout, "0123456789", -1); - metrics->approximate_digit_width = max_glyph_width (layout); + pango_layout_get_extents (layout, NULL, &extents); + metrics->approximate_digit_width = extents.width / 10; g_object_unref (layout); |