Stage fixes for underline position.

R=reed@google.com

Author: bungeman@google.com

Review URL: https://codereview.chromium.org/271333002

git-svn-id: http://skia.googlecode.com/svn/trunk@14726 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-05-14 14:54:51 +00:00
parent f700fb2f13
commit d3031aa5ae
2 changed files with 17 additions and 0 deletions

View File

@ -1407,7 +1407,12 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx,
ymin = -SkIntToScalar(face->bbox.yMin) / upem;
ymax = -SkIntToScalar(face->bbox.yMax) / upem;
underlineThickness = SkIntToScalar(face->underline_thickness) / upem;
#ifdef SK_IGNORE_UNDERLINE_POSITION_FIX
underlinePosition = -SkIntToScalar(face->underline_position) / upem;
#else
underlinePosition = -SkIntToScalar(face->underline_position +
face->underline_thickness / 2) / upem;
#endif
if(mx) {
mx->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
@ -1483,8 +1488,13 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx,
mx->fXMax = xmax;
mx->fXHeight = x_height;
mx->fCapHeight = cap_height;
#ifdef SK_IGNORE_UNDERLINE_POSITION_FIX
mx->fUnderlineThickness = underlineThickness;
mx->fUnderlinePosition = underlinePosition;
#else
mx->fUnderlineThickness = underlineThickness * mxy;
mx->fUnderlinePosition = underlinePosition * mxy;
#endif
}
if (my) {
my->fTop = ymax * myy;
@ -1497,8 +1507,13 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx,
my->fXMax = xmax;
my->fXHeight = x_height;
my->fCapHeight = cap_height;
#ifdef SK_IGNORE_UNDERLINE_POSITION_FIX
my->fUnderlineThickness = underlineThickness;
my->fUnderlinePosition = underlinePosition;
#else
my->fUnderlineThickness = underlineThickness * myy;
my->fUnderlinePosition = underlinePosition * myy;
#endif
}
}

View File

@ -1055,6 +1055,8 @@ void SkScalerContext_GDI::generateFontMetrics(SkPaint::FontMetrics* mx, SkPaint:
my->fMaxCharWidth = SkIntToScalar(otm.otmTextMetrics.tmMaxCharWidth);
my->fXMin = SkIntToScalar(otm.otmrcFontBox.left);
my->fXMax = SkIntToScalar(otm.otmrcFontBox.right);
#endif
#ifndef SK_IGNORE_UNDERLINE_POSITION_FIX
my->fUnderlineThickness = SkIntToScalar(otm.otmsUnderscoreSize);
my->fUnderlinePosition = -SkIntToScalar(otm.otmsUnderscorePosition);