diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-18 18:23:11 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-18 18:23:11 +0000 |
commit | ba344be55afdf1e5589b5f18bc5fb26412857e1d (patch) | |
tree | 13dd056826b7f20e5ee8c99aab70ae0bc9a5c154 /webkit | |
parent | b47a27febe50d49b21e43fe141a0efa6ff04ed59 (diff) | |
download | chromium_src-ba344be55afdf1e5589b5f18bc5fb26412857e1d.zip chromium_src-ba344be55afdf1e5589b5f18bc5fb26412857e1d.tar.gz chromium_src-ba344be55afdf1e5589b5f18bc5fb26412857e1d.tar.bz2 |
Fix the set of fonts used for test_shell.
With this change, the Google homepage renders pixel exact to Firefox on my
Goobuntu box (which isn't using subpixel rendering). Note that, although the
pixels are the same, the colours are very slightly different when it comes to
anti-aliasing. I suspect this is because Skia is currently missing a gamma
table.
Review URL: http://codereview.chromium.org/11211
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5614 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/port/platform/graphics/chromium/FontPlatformDataLinux.cpp | 4 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_gtk.cc | 38 |
2 files changed, 40 insertions, 2 deletions
diff --git a/webkit/port/platform/graphics/chromium/FontPlatformDataLinux.cpp b/webkit/port/platform/graphics/chromium/FontPlatformDataLinux.cpp index 0dba7f2..b047cb334 100644 --- a/webkit/port/platform/graphics/chromium/FontPlatformDataLinux.cpp +++ b/webkit/port/platform/graphics/chromium/FontPlatformDataLinux.cpp @@ -50,10 +50,10 @@ FontPlatformData& FontPlatformData::operator=(const FontPlatformData& src) m_textSize = src.m_textSize; m_fakeBold = src.m_fakeBold; m_fakeItalic = src.m_fakeItalic; - + return *this; } - + void FontPlatformData::setupPaint(SkPaint* paint) const { const float ts = m_textSize > 0 ? m_textSize : 12; diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc index 3d62e88..b8dab9a 100644 --- a/webkit/tools/test_shell/test_shell_gtk.cc +++ b/webkit/tools/test_shell/test_shell_gtk.cc @@ -6,6 +6,7 @@ #include <errno.h> #include <fcntl.h> +#include <fontconfig/fontconfig.h> #include <gtk/gtk.h> #include <unistd.h> @@ -31,6 +32,43 @@ void TestShell::InitializeTestShell(bool interactive) { window_list_ = new WindowList; web_prefs_ = new WebPreferences; interactive_ = interactive; + + // We wish to make the layout tests reproducable with respect to fonts. Skia + // uses fontconfig to resolve font family names from WebKit into actual font + // files found on the current system. This means that fonts vary based on the + // system and also on the fontconfig configuration. + // + // To avoid this we initialise fontconfig here and install a configuration + // which only knows about a few, select, fonts. + + // This is the list of fonts that fontconfig will know about. It will try its + // best to match based only on the fonts here in. The paths are where these + // fonts are found on our Ubuntu boxes. + static const char *const fonts[] = { + "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf", + "/usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf", + "/usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf", + "/usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf", + "/usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf", + "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Italic.ttf", + "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold.ttf", + "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold_Italic.ttf", + "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf", + "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold.ttf", + "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Italic.ttf", + "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold_Italic.ttf", + NULL + }; + + FcInit(); + FcConfig* fontcfg = FcConfigCreate(); + for (unsigned i = 0; fonts[i]; ++i) { + if (!FcConfigAppFontAddFile(fontcfg, (FcChar8 *) fonts[i])) + LOG(FATAL) << "Failed to load font " << fonts[i]; + } + + if (!FcConfigSetCurrent(fontcfg)) + LOG(FATAL) << "Failed to set the default font configuration"; } // static |