Ensure aveCharWidth is wide enough for numerals. b=410405 r=pavlov a1.9=schrep

This commit is contained in:
karlt+%karlt.net 2008-04-16 01:03:51 +00:00
Родитель a451cc92b8
Коммит cdafd45cef
1 изменённых файлов: 8 добавлений и 5 удалений

Просмотреть файл

@ -871,7 +871,7 @@ gfxPangoFont::GetCharSize(char aChar, gfxSize& aInkSize, gfxSize& aLogSize,
pango_glyph_string_free(glstr);
}
// rounding and truncation functions for a Freetype floating point number
// rounding and truncation functions for a Freetype fixed point number
// (FT26Dot6) stored in a 32bit integer with high 26 bits for the integer
// part and low 6 bits for the fractional part.
#define MOZ_FT_ROUND(x) (((x) + 32) & ~63) // 63 = 2^6 - 1
@ -913,8 +913,12 @@ gfxPangoFont::GetMetrics()
mMetrics.maxDescent =
pango_font_metrics_get_descent(pfm) / FLOAT_PANGO_SCALE;
// This is used for the width of text input elements so be liberal
// rather than conservative in the estimate.
mMetrics.aveCharWidth =
pango_font_metrics_get_approximate_char_width(pfm) / FLOAT_PANGO_SCALE;
PR_MAX(pango_font_metrics_get_approximate_char_width(pfm),
pango_font_metrics_get_approximate_digit_width(pfm))
/ FLOAT_PANGO_SCALE;
mMetrics.underlineOffset =
pango_font_metrics_get_underline_position(pfm) / FLOAT_PANGO_SCALE;
@ -930,8 +934,7 @@ gfxPangoFont::GetMetrics()
// We're going to overwrite this below if we have a FT_Face
// (which we normally should have...).
mMetrics.maxAdvance =
pango_font_metrics_get_approximate_char_width(pfm) / FLOAT_PANGO_SCALE;
mMetrics.maxAdvance = mMetrics.aveCharWidth;
} else {
mMetrics.maxAscent = 0.0;
mMetrics.maxDescent = 0.0;
@ -944,7 +947,7 @@ gfxPangoFont::GetMetrics()
}
// ??
mMetrics.emHeight = mAdjustedSize ? mAdjustedSize : GetStyle()->size;
mMetrics.emHeight = mAdjustedSize;
gfxFloat lineHeight = mMetrics.maxAscent + mMetrics.maxDescent;
if (lineHeight > mMetrics.emHeight)