summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-20 05:00:01 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-20 05:00:01 +0000
commit0e479a0e035819f98232cce525ff1e8e0e339f7d (patch)
tree0abfa26e80b5bde75b194a86a16c668da3404cc4 /skia
parentf5acee683608d2f0c199058493592a421065f9e5 (diff)
downloadchromium_src-0e479a0e035819f98232cce525ff1e8e0e339f7d.zip
chromium_src-0e479a0e035819f98232cce525ff1e8e0e339f7d.tar.gz
chromium_src-0e479a0e035819f98232cce525ff1e8e0e339f7d.tar.bz2
More font metrics work for Linux
* Add cursive and fantasy fonts (Comic Sans and Impact) * Pipe the height parameter from FreeType via skia * Another tweak to the metrics algorithms Review URL: http://codereview.chromium.org/11312 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5758 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r--skia/include/SkPaint.h1
-rw-r--r--skia/ports/SkFontHost_FreeType.cpp9
2 files changed, 7 insertions, 3 deletions
diff --git a/skia/include/SkPaint.h b/skia/include/SkPaint.h
index b556de8..73e3dbd 100644
--- a/skia/include/SkPaint.h
+++ b/skia/include/SkPaint.h
@@ -586,6 +586,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)
};
/** Return the recommend spacing between lines (which will be
diff --git a/skia/ports/SkFontHost_FreeType.cpp b/skia/ports/SkFontHost_FreeType.cpp
index c10415d..2a2444e 100644
--- a/skia/ports/SkFontHost_FreeType.cpp
+++ b/skia/ports/SkFontHost_FreeType.cpp
@@ -739,8 +739,8 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, SkP
return;
}
- SkPoint pts[5];
- SkFixed ys[5];
+ SkPoint pts[6];
+ SkFixed ys[6];
FT_Face face = fFace;
int upem = face->units_per_EM;
SkFixed scaleY = fScaleY;
@@ -756,9 +756,10 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, SkP
ys[2] = -face->descender;
ys[3] = -face->bbox.yMin;
ys[4] = leading;
+ ys[5] = face->height;
// convert upem-y values into scalar points
- for (int i = 0; i < 5; i++)
+ for (int i = 0; i < 6; i++)
{
SkFixed y = SkMulDiv(scaleY, ys[i], upem);
SkFixed x = SkFixedMul(mxy, y);
@@ -773,6 +774,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, SkP
mx->fDescent = pts[2].fX;
mx->fBottom = pts[3].fX;
mx->fLeading = pts[4].fX;
+ mx->fHeight = pts[5].fX;
}
if (my)
{
@@ -781,6 +783,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, SkP
my->fDescent = pts[2].fY;
my->fBottom = pts[3].fY;
my->fLeading = pts[4].fY;
+ my->fHeight = pts[5].fY;
}
}