diff options
| author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-03-27 17:02:03 +0100 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-28 16:18:11 +0100 |
| commit | 44329e0faee75171545189ad7be58ac4c36652fe (patch) | |
| tree | 569270ba3a5aac710119326bd517da6690243ff0 | |
| parent | d386c390be7eda670c21f72960b1845bdea11a62 (diff) | |
| download | qtwebkit-44329e0faee75171545189ad7be58ac4c36652fe.tar.gz | |
[Qt] Support kerning in fast path font rendering
https://bugs.webkit.org/show_bug.cgi?id=106013
Reviewed by Jocelyn Turcotte.
To support kerning in the fast font path we need to implement SimpleFontData::applyTransforms.
This patch changes the types used by the fast path GlyphBuffer to match those used by Qt,
and implements SimpleFontData::applyTransforms using QRawFont::advancesForGlyphIndexes.
* platform/graphics/GlyphBuffer.h:
(GlyphBufferAdvance):
(WebCore::GlyphBufferAdvance::GlyphBufferAdvance):
(WebCore::GlyphBufferAdvance::setWidth):
(WebCore::GlyphBufferAdvance::width):
(WebCore::GlyphBufferAdvance::height):
(WebCore::GlyphBuffer::add):
* platform/graphics/SimpleFontData.h:
(WebCore::SimpleFontData::applyTransforms):
* platform/graphics/WidthIterator.h:
(WebCore::WidthIterator::supportsTypesettingFeatures):
Change-Id: I9c94b19a9ca94b15385dfe71d6f26d030de59544
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146209 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
| -rw-r--r-- | Source/WebCore/platform/graphics/GlyphBuffer.h | 16 | ||||
| -rw-r--r-- | Source/WebCore/platform/graphics/WidthIterator.h | 8 |
2 files changed, 21 insertions, 3 deletions
diff --git a/Source/WebCore/platform/graphics/GlyphBuffer.h b/Source/WebCore/platform/graphics/GlyphBuffer.h index 5feafb140..3aec08e65 100644 --- a/Source/WebCore/platform/graphics/GlyphBuffer.h +++ b/Source/WebCore/platform/graphics/GlyphBuffer.h @@ -56,6 +56,8 @@ class SimpleFontData; typedef cairo_glyph_t GlyphBufferGlyph; #elif OS(WINCE) typedef wchar_t GlyphBufferGlyph; +#elif PLATFORM(QT) +typedef quint32 GlyphBufferGlyph; #else typedef Glyph GlyphBufferGlyph; #endif @@ -89,6 +91,18 @@ public: private: float advance; }; +#elif PLATFORM(QT) +struct GlyphBufferAdvance : public QPointF { +public: + GlyphBufferAdvance(const QPointF& advance) + : QPointF(advance) + { + } + + void setWidth(qreal width) { QPointF::setX(width); } + qreal width() const { return QPointF::x(); } + qreal height() const { return QPointF::y(); } +}; #else typedef FloatSize GlyphBufferAdvance; #endif @@ -156,6 +170,8 @@ public: m_advances.append(advance); #elif OS(WINCE) m_advances.append(width); +#elif PLATFORM(QT) + m_advances.append(QPointF(width, 0)); #else m_advances.append(FloatSize(width, 0)); #endif diff --git a/Source/WebCore/platform/graphics/WidthIterator.h b/Source/WebCore/platform/graphics/WidthIterator.h index 1996a0978..8e4e06997 100644 --- a/Source/WebCore/platform/graphics/WidthIterator.h +++ b/Source/WebCore/platform/graphics/WidthIterator.h @@ -61,13 +61,15 @@ public: static bool supportsTypesettingFeatures(const Font& font) { -#if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED <= 1080 - return !font.typesettingFeatures(); -#else +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED > 1080 if (!font.isPrinterFont()) return !font.typesettingFeatures(); return !(font.typesettingFeatures() & ~(Kerning | Ligatures)); +#elif PLATFORM(QT) && QT_VERSION >= 0x050100 + return !(font.typesettingFeatures() & ~Kerning) && !font.isSmallCaps(); +#else + return !font.typesettingFeatures(); #endif } |
