mirror of https://github.com/vitalif/phantomjs
Enable WOFF file support.
Background: WOFF format requires that WebKit should be compiled with zlib. Related issues: http://code.google.com/p/phantomjs/issues/detail?id=5921.8
parent
eb3c9caa6e
commit
04b74f99fd
|
@ -18,6 +18,7 @@ set QT_CFG=%QT_CFG% -no-declarative
|
|||
set QT_CFG=%QT_CFG% -no-script
|
||||
set QT_CFG=%QT_CFG% -no-multimedia
|
||||
|
||||
set QT_CFG=%QT_CFG% -qt-zlib
|
||||
set QT_CFG=%QT_CFG% -qt-libpng
|
||||
set QT_CFG=%QT_CFG% -qt-libjpeg
|
||||
set QT_CFG=%QT_CFG% -no-libmng
|
||||
|
|
|
@ -170,6 +170,10 @@ contains(DEFINES, ENABLE_XSLT=1) {
|
|||
QT *= xmlpatterns
|
||||
}
|
||||
|
||||
contains(DEFINES, ENABLE_ZLIB=1) {
|
||||
include($$QT_SOURCE_TREE/src/3rdparty/zlib_dependency.pri)
|
||||
}
|
||||
|
||||
contains(DEFINES, ENABLE_SQLITE=1) {
|
||||
!system-sqlite:exists( $${SQLITE3SRCDIR}/sqlite3.c ) {
|
||||
INCLUDEPATH += $${SQLITE3SRCDIR}
|
||||
|
|
|
@ -988,6 +988,7 @@ SOURCES += \
|
|||
platform/graphics/PathTraversalState.cpp \
|
||||
platform/graphics/Pattern.cpp \
|
||||
platform/graphics/RoundedIntRect.cpp \
|
||||
platform/graphics/WOFFFileFormat.cpp \
|
||||
platform/graphics/SegmentedFontData.cpp \
|
||||
platform/graphics/ShadowBlur.cpp \
|
||||
platform/graphics/SVGGlyph.cpp \
|
||||
|
@ -1958,6 +1959,7 @@ HEADERS += \
|
|||
platform/graphics/PathTraversalState.h \
|
||||
platform/graphics/Pattern.h \
|
||||
platform/graphics/RoundedIntRect.h \
|
||||
platform/graphics/WOFFFileFormat.h \
|
||||
platform/graphics/qt/FontCustomPlatformData.h \
|
||||
platform/graphics/qt/ImageDecoderQt.h \
|
||||
platform/graphics/qt/StillImageQt.h \
|
||||
|
|
|
@ -45,6 +45,8 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) {
|
|||
!contains(DEFINES, ENABLE_DIRECTORY_UPLOAD=.): DEFINES += ENABLE_DIRECTORY_UPLOAD=0
|
||||
!contains(DEFINES, ENABLE_FILE_SYSTEM=.): DEFINES += ENABLE_FILE_SYSTEM=0
|
||||
!contains(DEFINES, ENABLE_QUOTA=.): DEFINES += ENABLE_QUOTA=0
|
||||
# enable zlib support for WOFF fonts
|
||||
!contains(DEFINES, ENABLE_ZLIB=.): DEFINES += ENABLE_ZLIB=1
|
||||
|
||||
# turn on SQLITE support if any of the dependent features are turned on
|
||||
!contains(DEFINES, ENABLE_SQLITE=.) {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "FontPlatformData.h"
|
||||
#include "SharedBuffer.h"
|
||||
#include "WOFFFileFormat.h"
|
||||
#include <QFontDatabase>
|
||||
#include <QStringList>
|
||||
|
||||
|
@ -50,6 +51,15 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
|
|||
{
|
||||
ASSERT_ARG(buffer, buffer);
|
||||
|
||||
RefPtr<SharedBuffer> sfntBuffer;
|
||||
if (isWOFF(buffer)) {
|
||||
Vector<char> sfnt;
|
||||
if (!convertWOFFToSfnt(buffer, sfnt))
|
||||
return 0;
|
||||
sfntBuffer = SharedBuffer::adoptVector(sfnt);
|
||||
buffer = sfntBuffer.get();
|
||||
}
|
||||
|
||||
int id = QFontDatabase::addApplicationFontFromData(QByteArray(buffer->data(), buffer->size()));
|
||||
if (id == -1)
|
||||
return 0;
|
||||
|
@ -63,7 +73,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
|
|||
|
||||
bool FontCustomPlatformData::supportsFormat(const String& format)
|
||||
{
|
||||
return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype");
|
||||
return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") || equalIgnoringCase(format, "woff");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue