summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 23:16:46 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 23:16:46 +0000
commitc8bdcb753bcbe960bc239419180d085534ef8432 (patch)
treeee4fe15caace7a6e8a893b5b52ec421fbcfc5269 /skia
parent9903c6cd6567c8a9e0227232a83387db6383ef9d (diff)
downloadchromium_src-c8bdcb753bcbe960bc239419180d085534ef8432.zip
chromium_src-c8bdcb753bcbe960bc239419180d085534ef8432.tar.gz
chromium_src-c8bdcb753bcbe960bc239419180d085534ef8432.tar.bz2
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
Diffstat (limited to 'skia')
-rw-r--r--skia/include/SkPaint.h1
-rw-r--r--skia/ports/SkFontHost_FreeType.cpp17
2 files changed, 11 insertions, 7 deletions
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<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,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;