Changeset 147020 in webkit


Ignore:
Timestamp:
Mar 27, 2013 4:57:50 PM (11 years ago)
Author:
pierre.rossi@gmail.com
Message:

[Qt] Add WOFF support when using zlib
https://bugs.webkit.org/show_bug.cgi?id=112805

Reviewed by Allan Sandfeld Jensen.

Source/WebCore:

Covered by existing test:
fast/css/font-face-woff.html

  • Target.pri: Conditional inclusion of WOFFFileFormat
  • platform/graphics/qt/FontCustomPlatformDataQt.cpp:

(WebCore::createFontCustomPlatformData): Try to unpack WOFF data, otherwise spit out a warning and bail.
(WebCore::FontCustomPlatformData::supportsFormat): accept WOFF webfonts if USE(ZLIB).

LayoutTests:

  • platform/qt-5.0-wk2/TestExpectations: keep skipped for WK2 due to a WTR bug.
  • platform/qt/TestExpectations: unskip font-face-woff.html
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r147019 r147020  
     12013-03-27  Pierre Rossi  <pierre.rossi@gmail.com>
     2
     3        [Qt] Add WOFF support when using zlib
     4        https://bugs.webkit.org/show_bug.cgi?id=112805
     5
     6        Reviewed by Allan Sandfeld Jensen.
     7
     8        * platform/qt-5.0-wk2/TestExpectations: keep skipped for WK2 due to a WTR bug.
     9        * platform/qt/TestExpectations: unskip font-face-woff.html
     10
    1112013-03-27  Robert Hogan  <robert@webkit.org>
    212
  • trunk/LayoutTests/platform/qt-5.0-wk2/TestExpectations

    r146194 r147020  
    147147webkit.org/b/108646 compositing/layer-creation/fixed-position-no-content.html [ Skip ]
    148148
     149# [Qt][WK2] WTR doesn't dump pixels in a way that's consistent with other ports
     150webkit.org/b/113320 fast/css/font-face-woff.html [ Skip ]
    149151########################################
    150152
  • trunk/LayoutTests/platform/qt/TestExpectations

    r147001 r147020  
    227227userscripts
    228228plugins/plugin-document-load-prevented-userscript.html
    229 
    230 # ------ Doesn't support WOFF yet.
    231 fast/css/font-face-woff.html
    232229
    233230# Need to implement getFormValue().
  • trunk/Source/WebCore/ChangeLog

    r147019 r147020  
     12013-03-27  Pierre Rossi  <pierre.rossi@gmail.com>
     2
     3        [Qt] Add WOFF support when using zlib
     4        https://bugs.webkit.org/show_bug.cgi?id=112805
     5
     6        Reviewed by Allan Sandfeld Jensen.
     7
     8        Covered by existing test:
     9        fast/css/font-face-woff.html
     10
     11        * Target.pri: Conditional inclusion of WOFFFileFormat
     12        * platform/graphics/qt/FontCustomPlatformDataQt.cpp:
     13        (WebCore::createFontCustomPlatformData): Try to unpack WOFF data, otherwise spit out a warning and bail.
     14        (WebCore::FontCustomPlatformData::supportsFormat): accept WOFF webfonts if USE(ZLIB).
     15
    1162013-03-27  Robert Hogan  <robert@webkit.org>
    217
  • trunk/Source/WebCore/Target.pri

    r146908 r147020  
    42304230}
    42314231
     4232use?(ZLIB) {
     4233    HEADERS += platform/graphics/WOFFFileFormat.h
     4234    SOURCES += platform/graphics/WOFFFileFormat.cpp
     4235}
     4236
    42324237!have?(sqlite3):exists($${SQLITE3SRCDIR}/sqlite3.c) {
    42334238    # Build sqlite3 into WebCore from source
  • trunk/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp

    r136520 r147020  
    2525#include "FontPlatformData.h"
    2626#include "SharedBuffer.h"
     27#if USE(ZLIB)
     28#include "WOFFFileFormat.h"
     29#endif
    2730#include <QStringList>
    2831
     
    4043    ASSERT_ARG(buffer, buffer);
    4144
     45#if USE(ZLIB)
     46    RefPtr<SharedBuffer> sfntBuffer;
     47    if (isWOFF(buffer)) {
     48        Vector<char> sfnt;
     49        if (!convertWOFFToSfnt(buffer, sfnt))
     50            return 0;
     51
     52        sfntBuffer = SharedBuffer::adoptVector(sfnt);
     53        buffer = sfntBuffer.get();
     54    }
     55#endif // USE(ZLIB)
     56
    4257    const QByteArray fontData(buffer->data(), buffer->size());
     58#if !USE(ZLIB)
     59    if (fontData.startsWith("wOFF")) {
     60        qWarning("WOFF support requires QtWebKit to be built with zlib support.");
     61        return 0;
     62    }
     63#endif // !USE(ZLIB)
    4364    // Pixel size doesn't matter at this point, it is set in FontCustomPlatformData::fontPlatformData.
    4465    QRawFont rawFont(fontData, /*pixelSize = */0, QFont::PreferDefaultHinting);
     
    5374bool FontCustomPlatformData::supportsFormat(const String& format)
    5475{
    55     return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype");
     76    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype")
     77#if USE(ZLIB)
     78            || equalIgnoringCase(format, "woff")
     79#endif
     80    ;
    5681}
    5782
Note: See TracChangeset for help on using the changeset viewer.