summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-20 05:00:01 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-20 05:00:01 +0000
commit0e479a0e035819f98232cce525ff1e8e0e339f7d (patch)
tree0abfa26e80b5bde75b194a86a16c668da3404cc4 /webkit
parentf5acee683608d2f0c199058493592a421065f9e5 (diff)
downloadchromium_src-0e479a0e035819f98232cce525ff1e8e0e339f7d.zip
chromium_src-0e479a0e035819f98232cce525ff1e8e0e339f7d.tar.gz
chromium_src-0e479a0e035819f98232cce525ff1e8e0e339f7d.tar.bz2
More font metrics work for Linux
* Add cursive and fantasy fonts (Comic Sans and Impact) * Pipe the height parameter from FreeType via skia * Another tweak to the metrics algorithms Review URL: http://codereview.chromium.org/11312 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5758 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp5
-rw-r--r--webkit/tools/test_shell/resources/linux-fontconfig-config18
-rw-r--r--webkit/tools/test_shell/test_shell_gtk.cc3
3 files changed, 24 insertions, 2 deletions
diff --git a/webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp b/webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp
index 29b5d74..34fb478 100644
--- a/webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp
+++ b/webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp
@@ -32,9 +32,10 @@ void SimpleFontData::platformInit()
// 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_descent = SkScalarCeil(metrics.fHeight) - m_ascent;
m_xHeight = SkScalarToFloat(-metrics.fAscent) * 0.56f; // hack I stole from the Windows port
- m_lineGap = SkScalarCeil(metrics.fLeading);
+ m_lineGap = SkScalarCeil(metrics.fHeight -
+ (metrics.fDescent - metrics.fAscent));
m_lineSpacing = m_ascent + m_descent + m_lineGap;
// In WebKit/WebCore/platform/graphics/SimpleFontData.cpp, m_spaceWidth is
diff --git a/webkit/tools/test_shell/resources/linux-fontconfig-config b/webkit/tools/test_shell/resources/linux-fontconfig-config
index 57757c3..69d7bd2 100644
--- a/webkit/tools/test_shell/resources/linux-fontconfig-config
+++ b/webkit/tools/test_shell/resources/linux-fontconfig-config
@@ -73,4 +73,22 @@
<string>Courier New</string>
</edit>
</match>
+
+ <match target="pattern">
+ <test qual="any" name="family">
+ <string>cursive</string>
+ </test>
+ <edit name="family" mode="assign">
+ <string>Comic Sans MS</string>
+ </edit>
+ </match>
+
+ <match target="pattern">
+ <test qual="any" name="family">
+ <string>fantasy</string>
+ </test>
+ <edit name="family" mode="assign">
+ <string>Impact</string>
+ </edit>
+ </match>
</fontconfig>
diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc
index eb1f31a..22cac45 100644
--- a/webkit/tools/test_shell/test_shell_gtk.cc
+++ b/webkit/tools/test_shell/test_shell_gtk.cc
@@ -85,6 +85,9 @@ void TestShell::InitializeTestShell(bool interactive) {
"/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",
+ "/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf",
+ "/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS_Bold.ttf",
+ "/usr/share/fonts/truetype/msttcorefonts/Impact.ttf",
NULL
};
for (size_t i = 0; fonts[i]; ++i) {