diff options
Diffstat (limited to 'Source/WebCore/platform/graphics/qt')
4 files changed, 22 insertions, 12 deletions
diff --git a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp index 39cd47ce2..78e159aa0 100644 --- a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp +++ b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp @@ -24,9 +24,7 @@ #include "FontPlatformData.h" #include "SharedBuffer.h" -#if USE(ZLIB) #include "WOFFFileFormat.h" -#endif #include <QStringList> namespace WebCore { @@ -41,7 +39,6 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer& buffer) { -#if USE(ZLIB) SharedBuffer* fontBuffer = &buffer; RefPtr<SharedBuffer> sfntBuffer; if (isWOFF(&buffer)) { @@ -52,15 +49,9 @@ std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffe sfntBuffer = SharedBuffer::adoptVector(sfnt); fontBuffer = sfntBuffer.get(); } -#endif // USE(ZLIB) const QByteArray fontData(fontBuffer->data(), fontBuffer->size()); -#if !USE(ZLIB) - if (fontData.startsWith("wOFF")) { - qWarning("WOFF support requires QtWebKit to be built with zlib support."); - return 0; - } -#endif // !USE(ZLIB) + // Pixel size doesn't matter at this point, it is set in FontCustomPlatformData::fontPlatformData. QRawFont rawFont(fontData, /*pixelSize = */0, QFont::PreferDefaultHinting); if (!rawFont.isValid()) @@ -75,8 +66,9 @@ bool FontCustomPlatformData::supportsFormat(const String& format) { return equalLettersIgnoringASCIICase(format, "truetype") || equalLettersIgnoringASCIICase(format, "opentype") -#if USE(ZLIB) || equalLettersIgnoringASCIICase(format, "woff") +#if USE(WOFF2) + || equalLettersIgnoringASCIICase(format, "woff2") #endif ; } diff --git a/Source/WebCore/platform/graphics/qt/FontPlatformData.h b/Source/WebCore/platform/graphics/qt/FontPlatformData.h index 14e36f018..c8375ebcd 100644 --- a/Source/WebCore/platform/graphics/qt/FontPlatformData.h +++ b/Source/WebCore/platform/graphics/qt/FontPlatformData.h @@ -34,6 +34,8 @@ namespace WebCore { +class SharedBuffer; + class FontPlatformDataPrivate : public RefCounted<FontPlatformDataPrivate> { WTF_MAKE_NONCOPYABLE(FontPlatformDataPrivate); WTF_MAKE_FAST_ALLOCATED; public: @@ -117,6 +119,7 @@ public: FontOrientation orientation() const { return Horizontal; } // FIXME: Implement. void setOrientation(FontOrientation) { } // FIXME: Implement. + PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const; unsigned hash() const; diff --git a/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp b/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp index a239d643d..2ed4a98c3 100644 --- a/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp +++ b/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp @@ -25,6 +25,7 @@ #include "FontPlatformData.h" #include "FontCascade.h" +#include "SharedBuffer.h" #include <wtf/text/WTFString.h> namespace WebCore { @@ -139,6 +140,20 @@ bool FontPlatformData::operator==(const FontPlatformData& other) const return equals; } +PassRefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const +{ + const char tag[4] = { + char(table & 0xff), + char((table & 0xff00) >> 8), + char((table & 0xff0000) >> 16), + char(table >> 24) + }; + QByteArray tableData = m_data->rawFont.fontTable(tag); + + // TODO: Wrap SharedBuffer around QByteArray when it's possible + return SharedBuffer::create(tableData.data(), tableData.size()); +} + unsigned FontPlatformData::hash() const { if (!m_data) diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index 618bf63ae..9e992381c 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -362,7 +362,7 @@ void GraphicsContext3DPrivate::createGraphicsSurfaces(const IntSize& size) { #if USE(GRAPHICS_SURFACE) if (size.isEmpty()) - m_graphicsSurface.clear(); + m_graphicsSurface = nullptr; else m_graphicsSurface = GraphicsSurface::create(size, m_surfaceFlags, m_platformContext); #endif |