Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1456)

Unified Diff: webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp

Issue 11284: Match Windows font metrics on Linux. (Closed)
Patch Set: Addressing comments Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp
diff --git a/webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp b/webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp
index 73712756078e6d2fd9b8d3a8b06f8e12c813e091..29b5d74dfd81a60685cb0f89aa511f35e1693198 100644
--- a/webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp
+++ b/webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp
@@ -29,17 +29,13 @@ void SimpleFontData::platformInit()
m_font.setupPaint(&paint);
paint.getFontMetrics(&metrics);
- // use ceil instead of round to favor descent, given a lot of accidental
- // clipping of descenders (e.g. 14pt 'g') in textedit fields
- const int descent = SkScalarCeil(metrics.fDescent);
- const int span = SkScalarRound(metrics.fDescent - metrics.fAscent);
- const int ascent = span - descent;
-
- m_ascent = ascent;
- m_descent = descent;
+ // Beware those who step here: This code is designed to match Win32 font
+ // metrics *exactly*.
+ m_ascent = SkScalarCeil(-metrics.fAscent);
+ m_descent = SkScalarCeil(metrics.fDescent);
m_xHeight = SkScalarToFloat(-metrics.fAscent) * 0.56f; // hack I stole from the Windows port
- m_lineSpacing = ascent + descent;
- m_lineGap = SkScalarRound(metrics.fLeading);
+ m_lineGap = SkScalarCeil(metrics.fLeading);
+ m_lineSpacing = m_ascent + m_descent + m_lineGap;
// In WebKit/WebCore/platform/graphics/SimpleFontData.cpp, m_spaceWidth is
// calculated for us, but we need to calculate m_maxCharWidth and

Powered by Google App Engine
This is Rietveld 408576698