diff options
author | Steve Block <steveblock@google.com> | 2011-05-18 13:36:51 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-05-24 15:38:28 +0100 |
commit | 2fc2651226baac27029e38c9d6ef883fa32084db (patch) | |
tree | e396d4bf89dcce6ed02071be66212495b1df1dec /Source/WebCore/platform/graphics/pango | |
parent | b3725cedeb43722b3b175aaeff70552e562d2c94 (diff) | |
download | external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.zip external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.gz external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.bz2 |
Merge WebKit at r78450: Initial merge by git.
Change-Id: I6d3e5f1f868ec266a0aafdef66182ddc3f265dc1
Diffstat (limited to 'Source/WebCore/platform/graphics/pango')
-rw-r--r-- | Source/WebCore/platform/graphics/pango/FontCustomPlatformDataPango.cpp | 2 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp | 22 |
2 files changed, 15 insertions, 9 deletions
diff --git a/Source/WebCore/platform/graphics/pango/FontCustomPlatformDataPango.cpp b/Source/WebCore/platform/graphics/pango/FontCustomPlatformDataPango.cpp index a158689..f9d36d3 100644 --- a/Source/WebCore/platform/graphics/pango/FontCustomPlatformDataPango.cpp +++ b/Source/WebCore/platform/graphics/pango/FontCustomPlatformDataPango.cpp @@ -30,7 +30,7 @@ FontCustomPlatformData::~FontCustomPlatformData() { } -FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontRenderingMode) +FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontWidthVariant, FontRenderingMode) { return FontPlatformData(m_fontFace, size, bold, italic); } diff --git a/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp b/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp index d0bf836..3fe15b3 100644 --- a/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp +++ b/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp @@ -49,21 +49,27 @@ void SimpleFontData::platformInit() cairo_font_extents_t font_extents; cairo_text_extents_t text_extents; cairo_scaled_font_extents(m_platformData.m_scaledFont, &font_extents); - m_ascent = static_cast<int>(lroundf(font_extents.ascent)); - m_descent = static_cast<int>(lroundf(font_extents.descent)); - m_lineSpacing = static_cast<int>(lroundf(font_extents.height)); + + m_fontMetrics.setAscent(font_extents.ascent); + m_fontMetrics.setDescent(font_extents.descent); + // There seems to be some rounding error in cairo (or in how we // use cairo) with some fonts, like DejaVu Sans Mono, which makes // cairo report a height smaller than ascent + descent, which is // wrong and confuses WebCore's layout system. Workaround this // while we figure out what's going on. - if (m_lineSpacing < m_ascent + m_descent) - m_lineSpacing = m_ascent + m_descent; + float lineSpacing = font_extents.height; + if (lineSpacing < font_extents.ascent + font_extents.descent) + lineSpacing = font_extents.ascent + font_extents.descent; + m_fontMetrics.setLineSpacing(lroundf(lineSpacing)); + m_fontMetrics.setLineGap(lineSpacing - font_extents.ascent - font_extents.descent); + cairo_scaled_font_text_extents(m_platformData.m_scaledFont, "x", &text_extents); - m_xHeight = text_extents.height; + m_fontMetrics.setXHeight(text_extents.height); + cairo_scaled_font_text_extents(m_platformData.m_scaledFont, " ", &text_extents); - m_spaceWidth = static_cast<float>(text_extents.x_advance); - m_lineGap = m_lineSpacing - m_ascent - m_descent; + m_spaceWidth = static_cast<float>(text_extents.x_advance); + m_syntheticBoldOffset = m_platformData.syntheticBold() ? 1.0f : 0.f; } |