summaryrefslogtreecommitdiffstats
path: root/app/gfx/font_skia.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-03 17:38:39 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-03 17:38:39 +0000
commitfbe15197e5c207e27245a3bcc4ccaf1e9b39d81d (patch)
treec321a69f86cb01de685de8a6ddb63b532da20418 /app/gfx/font_skia.cc
parent9509e75d2d4650cf47384878e42fa90cee22e5fe (diff)
downloadchromium_src-fbe15197e5c207e27245a3bcc4ccaf1e9b39d81d.zip
chromium_src-fbe15197e5c207e27245a3bcc4ccaf1e9b39d81d.tar.gz
chromium_src-fbe15197e5c207e27245a3bcc4ccaf1e9b39d81d.tar.bz2
Revert "Workaround Skia and Pango measuring font heights differently by asking Pango"
This reverts commit r25131. It seems to have regressed Linux startup; will track perf builder after committing this to be sure. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25325 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/gfx/font_skia.cc')
-rw-r--r--app/gfx/font_skia.cc27
1 files changed, 3 insertions, 24 deletions
diff --git a/app/gfx/font_skia.cc b/app/gfx/font_skia.cc
index 988683c..4308bf6 100644
--- a/app/gfx/font_skia.cc
+++ b/app/gfx/font_skia.cc
@@ -41,13 +41,9 @@ void Font::calculateMetrics() {
PaintSetup(&paint);
paint.getFontMetrics(&metrics);
- // We need to know the number of whole pixels for these measurements. The
- // height is the number of whole pixels above the baseline, plus the number
- // of whole pixels below it.
- ascent_ = SkScalarCeil(-metrics.fAscent);
- height_ = ascent_ +
- SkScalarCeil(metrics.fDescent) +
- SkScalarCeil(metrics.fLeading);
+ ascent_ = SkScalarRound(-metrics.fAscent);
+ height_ = SkScalarRound(-metrics.fAscent + metrics.fDescent +
+ metrics.fLeading);
if (metrics.fAvgCharWidth) {
avg_width_ = SkScalarRound(metrics.fAvgCharWidth);
@@ -58,23 +54,6 @@ void Font::calculateMetrics() {
avg_width_ = static_cast<int>(ceilf(SkScalarToFloat(width)));
}
-
- // HACK ALERT! Skia and Pango don't agree about how to vertically size text.
- // Since we use Pango in gfx::Canvas, we need to use its version of the
- // height or various layouts will look weird.
- //
- // From debugging, it looks like Skia's notion of ascenders and descenders
- // are correct from the pixel rendering, but includes no leading or other
- // space around the text. Pango includes extra space (at least for the fonts
- // tested). To hack around this, we now ask Pango to get the height of a
- // string: we use "l" for the highest ascender, and "g" to get a descender.
- //
- // TODO(brettw/jhawkins): figure out how to get the real height that Pango
- // will use in a reasonable way. This is a horrible hack!
- int width, height;
- Canvas cvs(1, 1, true);
- cvs.SizeStringInt(L"lg", *this, &width, &height, 0);
- height_ = height;
}
void Font::CopyFont(const Font& other) {