diff options
-rw-r--r-- | skia/include/SkPaint.h | 1 | ||||
-rw-r--r-- | skia/ports/SkFontHost_FreeType.cpp | 9 | ||||
-rw-r--r-- | webkit/port/platform/graphics/chromium/SimpleFontDataLinux.cpp | 5 | ||||
-rw-r--r-- | webkit/tools/test_shell/resources/linux-fontconfig-config | 18 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_gtk.cc | 3 |
5 files changed, 31 insertions, 5 deletions
diff --git a/skia/include/SkPaint.h b/skia/include/SkPaint.h index b556de8..73e3dbd 100644 --- a/skia/include/SkPaint.h +++ b/skia/include/SkPaint.h @@ -586,6 +586,7 @@ public: SkScalar fDescent; //!< The recommended distance below the baseline (will be >= 0) SkScalar fBottom; //!< The greatest distance below the baseline for any glyph (will be >= 0) SkScalar fLeading; //!< The recommended distance to add between lines of text (will be >= 0) + SkScalar fHeight; //!< the vertical distance between two consecutive baselines (>= 0) }; /** Return the recommend spacing between lines (which will be diff --git a/skia/ports/SkFontHost_FreeType.cpp b/skia/ports/SkFontHost_FreeType.cpp index c10415d..2a2444e 100644 --- a/skia/ports/SkFontHost_FreeType.cpp +++ b/skia/ports/SkFontHost_FreeType.cpp @@ -739,8 +739,8 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, SkP return; } - SkPoint pts[5]; - SkFixed ys[5]; + SkPoint pts[6]; + SkFixed ys[6]; FT_Face face = fFace; int upem = face->units_per_EM; SkFixed scaleY = fScaleY; @@ -756,9 +756,10 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, SkP ys[2] = -face->descender; ys[3] = -face->bbox.yMin; ys[4] = leading; + ys[5] = face->height; // convert upem-y values into scalar points - for (int i = 0; i < 5; i++) + for (int i = 0; i < 6; i++) { SkFixed y = SkMulDiv(scaleY, ys[i], upem); SkFixed x = SkFixedMul(mxy, y); @@ -773,6 +774,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, SkP mx->fDescent = pts[2].fX; mx->fBottom = pts[3].fX; mx->fLeading = pts[4].fX; + mx->fHeight = pts[5].fX; } if (my) { @@ -781,6 +783,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, SkP my->fDescent = pts[2].fY; my->fBottom = pts[3].fY; my->fLeading = pts[4].fY; + my->fHeight = pts[5].fY; } } 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) { |