From f42d28c678cd72979d64eebed9ea879c59e2576a Mon Sep 17 00:00:00 2001 From: "agl@chromium.org" Date: Wed, 26 Nov 2008 00:23:23 +0000 Subject: Linux: match average char width with Windows Review URL: http://codereview.chromium.org/12656 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6017 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/port/platform/graphics/chromium/FontCacheLinux.cpp | 3 +-- webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'webkit') diff --git a/webkit/port/platform/graphics/chromium/FontCacheLinux.cpp b/webkit/port/platform/graphics/chromium/FontCacheLinux.cpp index 7a0606c..ab37374 100644 --- a/webkit/port/platform/graphics/chromium/FontCacheLinux.cpp +++ b/webkit/port/platform/graphics/chromium/FontCacheLinux.cpp @@ -42,7 +42,6 @@ const AtomicString& FontCache::alternateFamilyName(const AtomicString& familyNam FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font) { - notImplemented(); return 0; } @@ -111,7 +110,7 @@ AtomicString FontCache::getGenericFontForScript(UScriptCode script, const FontDescription&) { notImplemented(); - return AtomicString(); + return AtomicString("Times New Roman"); } } // namespace WebCore diff --git a/webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp b/webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp index 8e0e3f6..7b8a75e 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'; + m_avgCharWidth = widthForGlyph(glyphPageZero->glyphDataForCharacter(x_char).glyph); + } } void SimpleFontData::platformDestroy() -- cgit v1.1