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

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

Issue 12656: Linux: match average char width with Windows (Closed)
Patch Set: 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 8e0e3f6d4b0e5d0a3d88309f962509cd2cd2bba4..7b8a75e9f29ddb35f1f18c060216d69c84a7c1b3 100644
--- a/webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp
+++ b/webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp
@@ -52,10 +52,15 @@ void SimpleFontData::platformInit()
if (!glyphPageZero)
return;
- static const UChar32 e_char = 'e';
static const UChar32 M_char = 'M';
- m_avgCharWidth = widthForGlyph(glyphPageZero->glyphDataForCharacter(e_char).glyph);
m_maxCharWidth = widthForGlyph(glyphPageZero->glyphDataForCharacter(M_char).glyph);
+
+ if (metrics.fAvgCharWidth) {
+ m_avgCharWidth = SkScalarRound(metrics.fAvgCharWidth);
+ } else {
+ static const UChar32 x_char = 'x';
ojan 2008/11/26 00:17:45 Why "x" as the fallback? This is what Firefox uses
agl 2008/11/26 00:22:19 Microsoft documents suggest using the 'x' width an
+ m_avgCharWidth = widthForGlyph(glyphPageZero->glyphDataForCharacter(x_char).glyph);
+ }
}
void SimpleFontData::platformDestroy()

Powered by Google App Engine
This is Rietveld 408576698