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/chromium/FontChromiumWin.cpp | |
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/chromium/FontChromiumWin.cpp')
-rw-r--r-- | Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp index 5da4d5a..e57a84c 100644 --- a/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp +++ b/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp @@ -246,10 +246,11 @@ IntRect TransparencyAwareGlyphPainter::estimateTextBounds() for (int i = 0; i < m_numGlyphs; i++) totalWidth += lroundf(m_glyphBuffer.advanceAt(m_from + i)); - return IntRect(m_point.x() - (m_font->ascent() + m_font->descent()) / 2, - m_point.y() - m_font->ascent() - m_font->lineGap(), - totalWidth + m_font->ascent() + m_font->descent(), - m_font->lineSpacing()); + const FontMetrics& fontMetrics = m_font->fontMetrics(); + return IntRect(m_point.x() - (fontMetrics.ascent() + fontMetrics.descent()) / 2, + m_point.y() - fontMetrics.ascent() - fontMetrics.lineGap(), + totalWidth + fontMetrics.ascent() + fontMetrics.descent(), + fontMetrics.lineSpacing()); } bool TransparencyAwareGlyphPainter::drawGlyphs(int numGlyphs, @@ -270,7 +271,7 @@ bool TransparencyAwareGlyphPainter::drawGlyphs(int numGlyphs, // Windows' origin is the top-left of the bounding box, so we have // to subtract off the font ascent to get it. int x = lroundf(m_point.x() + startAdvance); - int y = lroundf(m_point.y() - m_font->ascent()); + int y = lroundf(m_point.y() - m_font->fontMetrics().ascent()); // If there is a non-blur shadow and both the fill color and shadow color // are opaque, handle without skia. @@ -354,10 +355,11 @@ IntRect TransparencyAwareUniscribePainter::estimateTextBounds() // This algorithm for estimating how much extra space we need (the text may // go outside the selection rect) is based roughly on // TransparencyAwareGlyphPainter::estimateTextBounds above. - return IntRect(left - (m_font->ascent() + m_font->descent()) / 2, - m_point.y() - m_font->ascent() - m_font->lineGap(), - (right - left) + m_font->ascent() + m_font->descent(), - m_font->lineSpacing()); + const FontMetrics& fontMetrics = m_font->fontMetrics(); + return IntRect(left - (fontMetrics.ascent() + fontMetrics.descent()) / 2, + m_point.y() - fontMetrics.ascent() - fontMetrics.lineGap(), + (right - left) + fontMetrics.ascent() + fontMetrics.descent(), + fontMetrics.lineSpacing()); } } // namespace @@ -367,6 +369,11 @@ bool Font::canReturnFallbackFontsForComplexText() return false; } +bool Font::canExpandAroundIdeographsInComplexText() +{ + return false; +} + void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* font, const GlyphBuffer& glyphBuffer, @@ -496,14 +503,14 @@ void Font::drawComplexText(GraphicsContext* graphicsContext, COLORREF savedTextColor = GetTextColor(hdc); SetTextColor(hdc, textColor); state.draw(graphicsContext, hdc, static_cast<int>(point.x()) + shadowOffset.width(), - static_cast<int>(point.y() - ascent()) + shadowOffset.height(), from, to); + static_cast<int>(point.y() - fontMetrics().ascent()) + shadowOffset.height(), from, to); SetTextColor(hdc, savedTextColor); } // Uniscribe counts the coordinates from the upper left, while WebKit uses // the baseline, so we have to subtract off the ascent. state.draw(graphicsContext, hdc, static_cast<int>(point.x()), - static_cast<int>(point.y() - ascent()), from, to); + static_cast<int>(point.y() - fontMetrics().ascent()), from, to); context->canvas()->endPlatformPaint(); } |