From c8bdcb753bcbe960bc239419180d085534ef8432 Mon Sep 17 00:00:00 2001 From: "agl@chromium.org" Date: Tue, 7 Apr 2009 23:16:46 +0000 Subject: Revert "Skia: remove fHeight" This reverts r13300 and r13299. Something clearly went wrong with the layout tests that I didn't notice. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13301 0039d316-1c4b-4281-b951-d872f2087c98 --- DEPS | 2 +- chrome/common/gfx/chrome_font_skia.cc | 2 +- skia/include/SkPaint.h | 1 + skia/ports/SkFontHost_FreeType.cpp | 17 ++++++++++------- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/DEPS b/DEPS index e7d67b2..d73f05a 100644 --- a/DEPS +++ b/DEPS @@ -19,7 +19,7 @@ deps = { "http://googletest.googlecode.com/svn/trunk@214", "src/third_party/WebKit": - "/trunk/deps/third_party/WebKit@13297", + "/trunk/deps/third_party/WebKit@13293", "src/third_party/icu38": "/trunk/deps/third_party/icu38@13083", diff --git a/chrome/common/gfx/chrome_font_skia.cc b/chrome/common/gfx/chrome_font_skia.cc index 0c3b721..6c80c8d 100644 --- a/chrome/common/gfx/chrome_font_skia.cc +++ b/chrome/common/gfx/chrome_font_skia.cc @@ -42,7 +42,7 @@ void ChromeFont::calculateMetrics() { height_ = ascent_ + metrics.fVDMXDescent; } else { ascent_ = SkScalarRound(-metrics.fAscent); - height_ = SkScalarRound(metrics.fAscent + metrics.fDescent + metrics.fLeading); + height_ = SkScalarRound(metrics.fHeight); } if (metrics.fAvgCharWidth) { diff --git a/skia/include/SkPaint.h b/skia/include/SkPaint.h index d13d090..b871bda 100644 --- a/skia/include/SkPaint.h +++ b/skia/include/SkPaint.h @@ -616,6 +616,7 @@ 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 46ae2d6..8ffb3ca 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[6]; - SkFixed ys[6]; + SkPoint pts[7]; + SkFixed ys[7]; 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(face->bbox.xMin) / upem; SkScalar xmax = static_cast(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,7 +884,8 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, ys[2] = -face->descender; ys[3] = -face->bbox.yMin; ys[4] = leading; - ys[5] = os2 ? os2->xAvgCharWidth : 0; + ys[5] = face->height; + ys[6] = os2 ? os2->xAvgCharWidth : 0; SkScalar x_height; if (os2 && os2->sxHeight) { @@ -903,7 +904,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, } // convert upem-y values into scalar points - for (int i = 0; i < 6; i++) { + for (int i = 0; i < 7; i++) { SkFixed y = SkMulDiv(scaleY, ys[i], upem); SkFixed x = SkFixedMul(mxy, y); y = SkFixedMul(myy, y); @@ -916,7 +917,8 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, mx->fDescent = pts[2].fX; mx->fBottom = pts[3].fX; mx->fLeading = pts[4].fX; - mx->fAvgCharWidth = pts[5].fX; + mx->fHeight = pts[5].fX; + mx->fAvgCharWidth = pts[6].fX; mx->fXMin = xmin; mx->fXMax = xmax; mx->fXHeight = x_height; @@ -931,7 +933,8 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, my->fDescent = pts[2].fY; my->fBottom = pts[3].fY; my->fLeading = pts[4].fY; - my->fAvgCharWidth = pts[5].fY; + my->fHeight = pts[5].fY; + my->fAvgCharWidth = pts[6].fY; my->fXMin = xmin; my->fXMax = xmax; my->fXHeight = x_height; -- cgit v1.1