summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/WebCore/Target.pri5
-rw-r--r--Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp27
2 files changed, 31 insertions, 1 deletions
diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri
index 1f41c8583..16915a4e0 100644
--- a/Source/WebCore/Target.pri
+++ b/Source/WebCore/Target.pri
@@ -4043,6 +4043,11 @@ use?(WEBP) {
SOURCES += platform/image-decoders/webp/WEBPImageDecoder.cpp
}
+use?(ZLIB) {
+ HEADERS += platform/graphics/WOFFFileFormat.h
+ SOURCES += platform/graphics/WOFFFileFormat.cpp
+}
+
!have?(sqlite3):exists($${SQLITE3SRCDIR}/sqlite3.c) {
# Build sqlite3 into WebCore from source
# somewhat copied from $$QT_SOURCE_TREE/src/plugins/sqldrivers/sqlite/sqlite.pro
diff --git a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
index 2be38550e..5c36380d2 100644
--- a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
@@ -24,6 +24,9 @@
#include "FontPlatformData.h"
#include "SharedBuffer.h"
+#if USE(ZLIB)
+#include "WOFFFileFormat.h"
+#endif
#include <QStringList>
namespace WebCore {
@@ -39,7 +42,25 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
{
ASSERT_ARG(buffer, buffer);
+#if USE(ZLIB)
+ RefPtr<SharedBuffer> sfntBuffer;
+ if (isWOFF(buffer)) {
+ Vector<char> sfnt;
+ if (!convertWOFFToSfnt(buffer, sfnt))
+ return 0;
+
+ sfntBuffer = SharedBuffer::adoptVector(sfnt);
+ buffer = sfntBuffer.get();
+ }
+#endif // USE(ZLIB)
+
const QByteArray fontData(buffer->data(), buffer->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())
@@ -52,7 +73,11 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
bool FontCustomPlatformData::supportsFormat(const String& format)
{
- return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype");
+ return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype")
+#if USE(ZLIB)
+ || equalIgnoringCase(format, "woff")
+#endif
+ ;
}
}