diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 22:58:26 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 22:58:26 +0000 |
commit | 3701009cea1762df31f8108ca182ded30333a303 (patch) | |
tree | ec9a42cec30666ec67d903f807c1f45c43a215b3 /skia | |
parent | 98d9e2d62e8313915dc112d10899c2dc48e4845c (diff) | |
download | chromium_src-3701009cea1762df31f8108ca182ded30333a303.zip chromium_src-3701009cea1762df31f8108ca182ded30333a303.tar.gz chromium_src-3701009cea1762df31f8108ca182ded30333a303.tar.bz2 |
Skia: remove fHeight
Skia was previously calculating the leading value incorrectly, leading
us to add fHeight to get the height of a line of text. Now that Skia
is calculating fLeading correctly, we can remove fHeight.
http://codereview.chromium.org/62123
https://bugs.webkit.org/show_bug.cgi?id=25083
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13299 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/include/SkPaint.h | 1 | ||||
-rw-r--r-- | skia/ports/SkFontHost_FreeType.cpp | 17 |
2 files changed, 7 insertions, 11 deletions
diff --git a/skia/include/SkPaint.h b/skia/include/SkPaint.h index b871bda..d13d090 100644 --- a/skia/include/SkPaint.h +++ b/skia/include/SkPaint.h @@ -616,7 +616,6 @@ public: SkScalar fDescent; //!< The recommended distance below the baseline (will be >= 0) SkScalar fBottom; //!< The greatest distance below the baseline for any glyph (will be >= 0) SkScalar fLeading; //!< The recommended distance to add between lines of text (will be >= 0) - SkScalar fHeight; //!< the vertical distance between two consecutive baselines (>= 0) SkScalar fAvgCharWidth; //!< the average charactor width (>= 0) SkScalar fXMin; //!< The minimum bounding box x value for all glyphs SkScalar fXMax; //!< The maximum bounding box x value for all glyphs diff --git a/skia/ports/SkFontHost_FreeType.cpp b/skia/ports/SkFontHost_FreeType.cpp index 8ffb3ca..46ae2d6 100644 --- a/skia/ports/SkFontHost_FreeType.cpp +++ b/skia/ports/SkFontHost_FreeType.cpp @@ -860,8 +860,8 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, return; } - SkPoint pts[7]; - SkFixed ys[7]; + SkPoint pts[6]; + SkFixed ys[6]; FT_Face face = fFace; int upem = face->units_per_EM; SkFixed scaleY = fScaleY; @@ -870,7 +870,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, SkScalar xmin = static_cast<SkScalar>(face->bbox.xMin) / upem; SkScalar xmax = static_cast<SkScalar>(face->bbox.xMax) / upem; - int leading = face->height - face->ascender + face->descender; + int leading = face->height - (face->ascender + face->descender); if (leading < 0) { leading = 0; } @@ -884,8 +884,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, ys[2] = -face->descender; ys[3] = -face->bbox.yMin; ys[4] = leading; - ys[5] = face->height; - ys[6] = os2 ? os2->xAvgCharWidth : 0; + ys[5] = os2 ? os2->xAvgCharWidth : 0; SkScalar x_height; if (os2 && os2->sxHeight) { @@ -904,7 +903,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, } // convert upem-y values into scalar points - for (int i = 0; i < 7; i++) { + for (int i = 0; i < 6; i++) { SkFixed y = SkMulDiv(scaleY, ys[i], upem); SkFixed x = SkFixedMul(mxy, y); y = SkFixedMul(myy, y); @@ -917,8 +916,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, mx->fDescent = pts[2].fX; mx->fBottom = pts[3].fX; mx->fLeading = pts[4].fX; - mx->fHeight = pts[5].fX; - mx->fAvgCharWidth = pts[6].fX; + mx->fAvgCharWidth = pts[5].fX; mx->fXMin = xmin; mx->fXMax = xmax; mx->fXHeight = x_height; @@ -933,8 +931,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, my->fDescent = pts[2].fY; my->fBottom = pts[3].fY; my->fLeading = pts[4].fY; - my->fHeight = pts[5].fY; - my->fAvgCharWidth = pts[6].fY; + my->fAvgCharWidth = pts[5].fY; my->fXMin = xmin; my->fXMax = xmax; my->fXHeight = x_height; |