Changeset 64434 in webkit


Ignore:
Timestamp:
Jul 31, 2010 10:04:57 PM (14 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/8234766> Add WOFF support for @font-face
https://bugs.webkit.org/show_bug.cgi?id=31302

Reviewed by Darin Adler.

WebCore:

  • WebCore.vcproj/WebCore.vcproj: Added WOFFFileFormat.{cpp,h}.
  • WebCore.vcproj/WebCoreCommon.vsprops: Added $(WebKitLibraries)\include\zlib to the header search path.
  • WebCore.xcodeproj/project.pbxproj: Added WOFFFileFormat.{cpp,h} and linking against libz.
  • css/CSSFontFaceSrcValue.cpp:

(WebCore::CSSFontFaceSrcValue::isSupportedFormat): Replaced hard-coded list of supported formats with
call to FontCustomPlatformData::supportsFormat().

  • platform/graphics/WOFFFileFormat.cpp: Added.

(WebCore::isWOFF): Checks if the buffer has the WOFF signature.
(WebCore::convertWOFFToSfnt): Extracts the sfnt payload of a WOFF package.

  • platform/graphics/WOFFFileFormat.h: Added.
  • platform/graphics/cairo/FontCustomPlatformData.cpp:

(WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype.

  • platform/graphics/cairo/FontCustomPlatformData.h:
  • platform/graphics/chromium/FontCustomPlatformData.cpp:

(WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype,
and also for woff if the OpenType sanitizer is enabled.

  • platform/graphics/chromium/FontCustomPlatformData.h:
  • platform/graphics/gtk/FontCustomPlatformDataPango.cpp:

(WebCore::FontCustomPlatformData::supportsFormat): Added. Returns false.

  • platform/graphics/haiku/FontCustomPlatformData.cpp:

(WebCore::FontCustomPlatformData::supportsFormat): Ditto.

  • platform/graphics/haiku/FontCustomPlatformData.h:
  • platform/graphics/mac/FontCustomPlatformData.cpp:

(WebCore::freeSfntData):
(WebCore::createFontCustomPlatformData): If the OpenType font sanitizer is not enabled, use convertWOFFToSfnt().
(WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype, opentype and woff.

  • platform/graphics/mac/FontCustomPlatformData.h:
  • platform/graphics/qt/FontCustomPlatformData.h:
  • platform/graphics/qt/FontCustomPlatformDataQt.cpp:

(WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype.

  • platform/graphics/win/FontCustomPlatformData.cpp:

(WebCore::createFontCustomPlatformData): If the OpenType font sanitizer is not enabled, use convertWOFFToSfnt().
(WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype, opentype and woff.

  • platform/graphics/win/FontCustomPlatformData.h:
  • platform/graphics/win/FontCustomPlatformDataCairo.cpp:

(WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype.

  • platform/graphics/win/FontCustomPlatformDataCairo.h:
  • platform/graphics/wince/FontCustomPlatformData.cpp:

(WebCore::FontCustomPlatformData::supportsFormat): Ditto.

  • platform/graphics/wince/FontCustomPlatformData.h:

LayoutTests:

  • platform/mac/Skipped: Enabled fast/css/font-face-woff.html.
  • platform/mac/fast/css/font-face-woff-expected.checksum: Added.
  • platform/mac/fast/css/font-face-woff-expected.png: Added.
  • platform/mac/fast/css/font-face-woff-expected.txt: Added.
Location:
trunk
Files:
5 added
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r64433 r64434  
     12010-07-31  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        <rdar://problem/8234766> Add WOFF support for @font-face
     6        https://bugs.webkit.org/show_bug.cgi?id=31302
     7
     8        * platform/mac/Skipped: Enabled fast/css/font-face-woff.html.
     9        * platform/mac/fast/css/font-face-woff-expected.checksum: Added.
     10        * platform/mac/fast/css/font-face-woff-expected.png: Added.
     11        * platform/mac/fast/css/font-face-woff-expected.txt: Added.
     12
    1132010-07-31  Sam Weinig  <sam@webkit.org>
    214
  • trunk/LayoutTests/platform/mac/Skipped

    r64424 r64434  
    156156# https://bugs.webkit.org/show_bug.cgi?id=33812
    157157fast/dom/icon-url-property.html
    158 
    159 # Doesn't support WOFF yet.
    160 fast/css/font-face-woff.html
    161158
    162159# EventSendingController does not send events on areas outside the WebView.
  • trunk/WebCore/ChangeLog

    r64432 r64434  
     12010-07-31  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        <rdar://problem/8234766> Add WOFF support for @font-face
     6        https://bugs.webkit.org/show_bug.cgi?id=31302
     7
     8        * WebCore.vcproj/WebCore.vcproj: Added WOFFFileFormat.{cpp,h}.
     9        * WebCore.vcproj/WebCoreCommon.vsprops: Added $(WebKitLibraries)\include\zlib to the header search path.
     10        * WebCore.xcodeproj/project.pbxproj: Added WOFFFileFormat.{cpp,h} and linking against libz.
     11        * css/CSSFontFaceSrcValue.cpp:
     12        (WebCore::CSSFontFaceSrcValue::isSupportedFormat): Replaced hard-coded list of supported formats with
     13        call to FontCustomPlatformData::supportsFormat().
     14        * platform/graphics/WOFFFileFormat.cpp: Added.
     15        (WebCore::isWOFF): Checks if the buffer has the WOFF signature.
     16        (WebCore::convertWOFFToSfnt): Extracts the sfnt payload of a WOFF package.
     17        * platform/graphics/WOFFFileFormat.h: Added.
     18        * platform/graphics/cairo/FontCustomPlatformData.cpp:
     19        (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype.
     20        * platform/graphics/cairo/FontCustomPlatformData.h:
     21        * platform/graphics/chromium/FontCustomPlatformData.cpp:
     22        (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype,
     23        and also for woff if the OpenType sanitizer is enabled.
     24        * platform/graphics/chromium/FontCustomPlatformData.h:
     25        * platform/graphics/gtk/FontCustomPlatformDataPango.cpp:
     26        (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns false.
     27        * platform/graphics/haiku/FontCustomPlatformData.cpp:
     28        (WebCore::FontCustomPlatformData::supportsFormat): Ditto.
     29        * platform/graphics/haiku/FontCustomPlatformData.h:
     30        * platform/graphics/mac/FontCustomPlatformData.cpp:
     31        (WebCore::freeSfntData):
     32        (WebCore::createFontCustomPlatformData): If the OpenType font sanitizer is not enabled, use convertWOFFToSfnt().
     33        (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype, opentype and woff.
     34        * platform/graphics/mac/FontCustomPlatformData.h:
     35        * platform/graphics/qt/FontCustomPlatformData.h:
     36        * platform/graphics/qt/FontCustomPlatformDataQt.cpp:
     37        (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype.
     38        * platform/graphics/win/FontCustomPlatformData.cpp:
     39        (WebCore::createFontCustomPlatformData): If the OpenType font sanitizer is not enabled, use convertWOFFToSfnt().
     40        (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype, opentype and woff.
     41        * platform/graphics/win/FontCustomPlatformData.h:
     42        * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
     43        (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype.
     44        * platform/graphics/win/FontCustomPlatformDataCairo.h:
     45        * platform/graphics/wince/FontCustomPlatformData.cpp:
     46        (WebCore::FontCustomPlatformData::supportsFormat): Ditto.
     47        * platform/graphics/wince/FontCustomPlatformData.h:
     48
    1492010-07-31  Ryosuke Niwa  <rniwa@webkit.org>
    250
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r64425 r64434  
    2436124361                                </File>
    2436224362                                <File
     24363                                        RelativePath="..\platform\graphics\WOFFFileFormat.cpp"
     24364                                        >
     24365                                </File>
     24366                                <File
     24367                                        RelativePath="..\platform\graphics\WOFFFileFormat.h"
     24368                                        >
     24369                                </File>
     24370                                <File
    2436324371                                        RelativePath="..\platform\graphics\UnitBezier.h"
    2436424372                                        >
  • trunk/WebCore/WebCore.vcproj/WebCoreCommon.vsprops

    r63833 r64434  
    88        <Tool
    99                Name="VCCLCompilerTool"
    10                 AdditionalIncludeDirectories="&quot;$(ProjectDir)..&quot;;&quot;$(ProjectDir)..\accessibility&quot;;&quot;$(ProjectDir)..\accessibility\win&quot;;&quot;$(ProjectDir)..\bridge&quot;;&quot;$(ProjectDir)..\bridge\c&quot;;&quot;$(ProjectDir)..\bridge\jsc&quot;;&quot;$(ProjectDir)..\css&quot;;&quot;$(ProjectDir)..\editing&quot;;&quot;$(ProjectDir)..\rendering&quot;;&quot;$(ProjectDir)..\rendering\style&quot;;&quot;$(ProjectDir)..\bindings&quot;;&quot;$(ProjectDir)..\bindings\generic&quot;;&quot;$(ProjectDir)..\bindings\js&quot;;&quot;$(ProjectDir)..\dom&quot;;&quot;$(ProjectDir)..\dom\default&quot;;&quot;$(ProjectDir)..\history&quot;;&quot;$(ProjectDir)..\html&quot;;&quot;$(ProjectDir)..\html\canvas&quot;;&quot;$(ProjectDir)..\inspector&quot;;&quot;$(ProjectDir)..\loader&quot;;&quot;$(ProjectDir)..\loader\appcache&quot;;&quot;$(ProjectDir)..\loader\archive&quot;;&quot;$(ProjectDir)..\loader\archive\cf&quot;;&quot;$(ProjectDir)..\loader\icon&quot;;&quot;$(ProjectDir)..\notifications&quot;;&quot;$(ProjectDir)..\page&quot;;&quot;$(ProjectDir)..\page\animation&quot;;&quot;$(ProjectDir)..\page\win&quot;;&quot;$(ProjectDir)..\platform&quot;;&quot;$(ProjectDir)..\platform\animation&quot;;&quot;$(ProjectDir)..\platform\mock&quot;;&quot;$(ProjectDir)..\platform\sql&quot;;&quot;$(ProjectDir)..\platform\win&quot;;&quot;$(ProjectDir)..\platform\network&quot;;&quot;$(ProjectDir)..\platform\network\win&quot;;&quot;$(ProjectDir)..\platform\cf&quot;;&quot;$(ProjectDir)..\platform\graphics&quot;;&quot;$(ProjectDir)..\platform\graphics\filters&quot;;&quot;$(ProjectDir)..\platform\graphics\opentype&quot;;&quot;$(ProjectDir)..\platform\graphics\transforms&quot;;&quot;$(ProjectDir)..\platform\text&quot;;&quot;$(ProjectDir)..\platform\text\transcoder&quot;;&quot;$(ProjectDir)..\platform\graphics\win&quot;;&quot;$(ProjectDir)..\xml&quot;;&quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources&quot;;&quot;$(ProjectDir)..\plugins&quot;;&quot;$(ProjectDir)..\plugins\win&quot;;&quot;$(ProjectDir)..\svg\animation&quot;;&quot;$(ProjectDir)..\svg\graphics&quot;;&quot;$(ProjectDir)..\svg\graphics\filters&quot;;&quot;$(ProjectDir)..\svg&quot;;&quot;$(ProjectDir)..\wml&quot;;&quot;$(ProjectDir)..\storage&quot;;&quot;$(ProjectDir)..\websockets&quot;;&quot;$(ProjectDir)..\workers&quot;;&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\private&quot;;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitLibrariesDir)\include\sqlite&quot;;&quot;$(WebKitLibrariesDir)\include\JavaScriptCore&quot;"
     10                AdditionalIncludeDirectories="&quot;$(ProjectDir)..&quot;;&quot;$(ProjectDir)..\accessibility&quot;;&quot;$(ProjectDir)..\accessibility\win&quot;;&quot;$(ProjectDir)..\bridge&quot;;&quot;$(ProjectDir)..\bridge\c&quot;;&quot;$(ProjectDir)..\bridge\jsc&quot;;&quot;$(ProjectDir)..\css&quot;;&quot;$(ProjectDir)..\editing&quot;;&quot;$(ProjectDir)..\rendering&quot;;&quot;$(ProjectDir)..\rendering\style&quot;;&quot;$(ProjectDir)..\bindings&quot;;&quot;$(ProjectDir)..\bindings\generic&quot;;&quot;$(ProjectDir)..\bindings\js&quot;;&quot;$(ProjectDir)..\dom&quot;;&quot;$(ProjectDir)..\dom\default&quot;;&quot;$(ProjectDir)..\history&quot;;&quot;$(ProjectDir)..\html&quot;;&quot;$(ProjectDir)..\html\canvas&quot;;&quot;$(ProjectDir)..\inspector&quot;;&quot;$(ProjectDir)..\loader&quot;;&quot;$(ProjectDir)..\loader\appcache&quot;;&quot;$(ProjectDir)..\loader\archive&quot;;&quot;$(ProjectDir)..\loader\archive\cf&quot;;&quot;$(ProjectDir)..\loader\icon&quot;;&quot;$(ProjectDir)..\notifications&quot;;&quot;$(ProjectDir)..\page&quot;;&quot;$(ProjectDir)..\page\animation&quot;;&quot;$(ProjectDir)..\page\win&quot;;&quot;$(ProjectDir)..\platform&quot;;&quot;$(ProjectDir)..\platform\animation&quot;;&quot;$(ProjectDir)..\platform\mock&quot;;&quot;$(ProjectDir)..\platform\sql&quot;;&quot;$(ProjectDir)..\platform\win&quot;;&quot;$(ProjectDir)..\platform\network&quot;;&quot;$(ProjectDir)..\platform\network\win&quot;;&quot;$(ProjectDir)..\platform\cf&quot;;&quot;$(ProjectDir)..\platform\graphics&quot;;&quot;$(ProjectDir)..\platform\graphics\filters&quot;;&quot;$(ProjectDir)..\platform\graphics\opentype&quot;;&quot;$(ProjectDir)..\platform\graphics\transforms&quot;;&quot;$(ProjectDir)..\platform\text&quot;;&quot;$(ProjectDir)..\platform\text\transcoder&quot;;&quot;$(ProjectDir)..\platform\graphics\win&quot;;&quot;$(ProjectDir)..\xml&quot;;&quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources&quot;;&quot;$(ProjectDir)..\plugins&quot;;&quot;$(ProjectDir)..\plugins\win&quot;;&quot;$(ProjectDir)..\svg\animation&quot;;&quot;$(ProjectDir)..\svg\graphics&quot;;&quot;$(ProjectDir)..\svg\graphics\filters&quot;;&quot;$(ProjectDir)..\svg&quot;;&quot;$(ProjectDir)..\wml&quot;;&quot;$(ProjectDir)..\storage&quot;;&quot;$(ProjectDir)..\websockets&quot;;&quot;$(ProjectDir)..\workers&quot;;&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\private&quot;;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitLibrariesDir)\include\sqlite&quot;;&quot;$(WebKitLibrariesDir)\include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\zlib&quot;"
    1111                PreprocessorDefinitions="__WIN32__;DISABLE_3D_RENDERING;WEBCORE_CONTEXT_MENUS"
    1212                UsePrecompiledHeader="2"
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r64425 r64434  
    784784                37919C230B7D188600A56998 /* PositionIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37919C210B7D188600A56998 /* PositionIterator.cpp */; };
    785785                37919C240B7D188600A56998 /* PositionIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 37919C220B7D188600A56998 /* PositionIterator.h */; settings = {ATTRIBUTES = (); }; };
     786                379919961200DDF400EA041C /* WOFFFileFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 379919941200DDF400EA041C /* WOFFFileFormat.cpp */; };
     787                379919971200DDF400EA041C /* WOFFFileFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 379919951200DDF400EA041C /* WOFFFileFormat.h */; };
     788                379919B21200DE5000EA041C /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 379919B11200DE5000EA041C /* libz.dylib */; };
    786789                37ACCE420DA2980F0089E602 /* FontRenderingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 37ACCE410DA2980F0089E602 /* FontRenderingMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
    787790                37ACCF690DA414E70089E602 /* FontDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37ACCE620DA2AA960089E602 /* FontDescription.cpp */; };
     
    65246527                37919C210B7D188600A56998 /* PositionIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PositionIterator.cpp; sourceTree = "<group>"; };
    65256528                37919C220B7D188600A56998 /* PositionIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PositionIterator.h; sourceTree = "<group>"; };
     6529                379919941200DDF400EA041C /* WOFFFileFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WOFFFileFormat.cpp; sourceTree = "<group>"; };
     6530                379919951200DDF400EA041C /* WOFFFileFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WOFFFileFormat.h; sourceTree = "<group>"; };
     6531                379919B11200DE5000EA041C /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
    65266532                37ACCE410DA2980F0089E602 /* FontRenderingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontRenderingMode.h; sourceTree = "<group>"; };
    65276533                37ACCE620DA2AA960089E602 /* FontDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontDescription.cpp; sourceTree = "<group>"; };
     
    1107211078                                A88AD52F09524B92001DD196 /* QuartzCore.framework in Frameworks */,
    1107311079                                1A7FA7CC0DDA4B770028F8A5 /* SystemConfiguration.framework in Frameworks */,
     11080                                379919B21200DE5000EA041C /* libz.dylib in Frameworks */,
    1107411081                        );
    1107511082                        runOnlyForDeploymentPostprocessing = 0;
     
    1113811145                                1CFAE3220A6D6A3F0032593D /* libobjc.dylib */,
    1113911146                                DD763BB10992C2C900740B8E /* libxml2.dylib */,
     11147                                379919B11200DE5000EA041C /* libz.dylib */,
    1114011148                                49C7BA781042EFAE0009D447 /* OpenGL.framework */,
    1114111149                                A85D7A2F0879EBA9006A9172 /* QuartzCore.framework */,
     
    1562615634                                939B02EC0EA2DBC400C54570 /* WidthIterator.cpp */,
    1562715635                                939B02ED0EA2DBC400C54570 /* WidthIterator.h */,
     15636                                379919941200DDF400EA041C /* WOFFFileFormat.cpp */,
     15637                                379919951200DDF400EA041C /* WOFFFileFormat.h */,
    1562815638                        );
    1562915639                        path = graphics;
     
    1998419994                                D39D006D11F8E308006041F2 /* PopupMenuMac.h in Headers */,
    1998519995                                D39D009D11F907E6006041F2 /* SearchPopupMenuMac.h in Headers */,
     19996                                379919971200DDF400EA041C /* WOFFFileFormat.h in Headers */,
    1998619997                        );
    1998719998                        runOnlyForDeploymentPostprocessing = 0;
     
    2238522396                                C572EE0D1201C736007D8F82 /* IDBIndexBackendImpl.cpp in Sources */,
    2238622397                                C572EE1E1201C9BC007D8F82 /* JSIDBIndex.cpp in Sources */,
     22398                                379919961200DDF400EA041C /* WOFFFileFormat.cpp in Sources */,
    2238722399                        );
    2238822400                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/css/CSSFontFaceSrcValue.cpp

    r58517 r64434  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2010 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727#include "CSSFontFaceSrcValue.h"
    2828#include "CSSStyleSheet.h"
     29#include "FontCustomPlatformData.h"
    2930#include "Node.h"
    3031
     
    4950    }
    5051
    51     return equalIgnoringCase(m_format, "truetype") || equalIgnoringCase(m_format, "opentype")
    52 #if ENABLE(OPENTYPE_SANITIZER)
    53            || equalIgnoringCase(m_format, "woff")
    54 #endif
     52    return FontCustomPlatformData::supportsFormat(m_format)
    5553#if ENABLE(SVG_FONTS)
    5654           || isSVGFontFaceSrc()
  • trunk/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp

    r55510 r64434  
    2222#include "FontCustomPlatformData.h"
    2323
     24#include "FontPlatformData.h"
    2425#include "SharedBuffer.h"
    25 #include "FontPlatformData.h"
    2626
    2727namespace WebCore {
     
    7171}
    7272
     73bool FontCustomPlatformData::supportsFormat(const String& format)
     74{
     75    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype");
    7376}
     77
     78}
  • trunk/WebCore/platform/graphics/cairo/FontCustomPlatformData.h

    r55510 r64434  
    3131class FontPlatformData;
    3232class SharedBuffer;
     33class String;
    3334
    3435struct FontCustomPlatformData : Noncopyable {
     
    4142    FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode);
    4243
     44    static bool supportsFormat(const String&);
     45
    4346    cairo_font_face_t* m_fontFace;
    4447};
  • trunk/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp

    r55089 r64434  
    202202}
    203203
    204 }
     204bool FontCustomPlatformData::supportsFormat(const String& format)
     205{
     206    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype")
     207#if ENABLE(OPENTYPE_SANITIZER)
     208        || equalIgnoringCase(format, "woff")
     209#endif
     210    ;
     211}
     212
     213}
  • trunk/WebCore/platform/graphics/chromium/FontCustomPlatformData.h

    r52791 r64434  
    4747class FontPlatformData;
    4848class SharedBuffer;
     49class String;
    4950
    5051struct FontCustomPlatformData : Noncopyable {
     
    6566                                      FontRenderingMode = NormalRenderingMode);
    6667
     68    static bool supportsFormat(const String&);
     69
    6770#if OS(WINDOWS)
    6871    HANDLE m_fontReference;
  • trunk/WebCore/platform/graphics/gtk/FontCustomPlatformDataPango.cpp

    r31574 r64434  
    4747}
    4848
     49bool FontCustomPlatformData::supportsFormat(const String& /* format */)
     50{
     51    return false;
    4952}
     53
     54}
  • trunk/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp

    r48006 r64434  
    4343}
    4444
     45bool FontCustomPlatformData::supportsFormat(const String& /* format */)
     46{
     47    return false;
    4548}
     49
     50}
  • trunk/WebCore/platform/graphics/haiku/FontCustomPlatformData.h

    r48006 r64434  
    2929    class FontPlatformData;
    3030    class SharedBuffer;
     31    class String;
    3132
    3233    struct FontCustomPlatformData : Noncopyable {
     
    3435        FontCustomPlatformData() { }
    3536        ~FontCustomPlatformData();
     37
     38        static bool supportsFormat(const String&);
    3639
    3740        FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode);
  • trunk/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp

    r51623 r64434  
    11/*
    2  * Copyright (C) 2007 Apple Computer, Inc.
     2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
    33 *
    44 * This library is free software; you can redistribute it and/or
     
    2222#include "FontCustomPlatformData.h"
    2323
    24 #include <ApplicationServices/ApplicationServices.h>
    25 #include "SharedBuffer.h"
    2624#include "FontPlatformData.h"
    2725#include "OpenTypeSanitizer.h"
     26#include "SharedBuffer.h"
     27#include "WOFFFileFormat.h"
     28#include <ApplicationServices/ApplicationServices.h>
    2829
    2930namespace WebCore {
     
    5152        return 0; // validation failed.
    5253    buffer = transcodeBuffer.get();
     54#else
     55    RefPtr<SharedBuffer> sfntBuffer;
     56    if (isWOFF(buffer)) {
     57        Vector<char> sfnt;
     58        if (!convertWOFFToSfnt(buffer, sfnt))
     59            return 0;
     60
     61        sfntBuffer = SharedBuffer::adoptVector(sfnt);
     62        buffer = sfntBuffer.get();
     63    }
    5364#endif
    5465
     
    6172    RetainPtr<CFDataRef> bufferData(AdoptCF, buffer->createCFData());
    6273    RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(bufferData.get()));
    63    
     74
    6475    cgFontRef.adoptCF(CGFontCreateWithDataProvider(dataProvider.get()));
    6576    if (!cgFontRef)
     
    102113}
    103114
     115bool FontCustomPlatformData::supportsFormat(const String& format)
     116{
     117    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") || equalIgnoringCase(format, "woff");
    104118}
     119
     120}
  • trunk/WebCore/platform/graphics/mac/FontCustomPlatformData.h

    r41939 r64434  
    3434class FontPlatformData;
    3535class SharedBuffer;
     36class String;
    3637
    3738struct FontCustomPlatformData : Noncopyable {
     
    4243
    4344    FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode);
     45
     46    static bool supportsFormat(const String&);
    4447
    4548    ATSFontContainerRef m_atsContainer;
  • trunk/WebCore/platform/graphics/qt/FontCustomPlatformData.h

    r61663 r64434  
    2828namespace WebCore {
    2929
     30class FontPlatformData;
    3031class SharedBuffer;
    31 class FontPlatformData;
     32class String;
    3233
    3334struct FontCustomPlatformData : Noncopyable {
     
    3839
    3940    FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode);
     41
     42    static bool supportsFormat(const String&);
    4043};
    4144
  • trunk/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp

    r54490 r64434  
    6262}
    6363
     64bool FontCustomPlatformData::supportsFormat(const String& format)
     65{
     66    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype");
    6467}
    6568
     69}
  • trunk/WebCore/platform/graphics/win/FontCustomPlatformData.cpp

    r55975 r64434  
    11/*
    2  * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
    33 *
    44 * This library is free software; you can redistribute it and/or
     
    2727#include "SharedBuffer.h"
    2828#include "SoftLinking.h"
     29#include "WOFFFileFormat.h"
    2930#include <ApplicationServices/ApplicationServices.h>
    3031#include <WebKitSystemInterface/WebKitSystemInterface.h>
     
    168169    ASSERT(T2embedLibrary());
    169170
     171    RefPtr<SharedBuffer> sfntBuffer;
     172    if (isWOFF(buffer)) {
     173        Vector<char> sfnt;
     174        if (!convertWOFFToSfnt(buffer, sfnt))
     175            return 0;
     176
     177        sfntBuffer = SharedBuffer::adoptVector(sfnt);
     178        buffer = sfntBuffer.get();
     179    }
     180
    170181    // Introduce the font to GDI. AddFontMemResourceEx cannot be used, because it will pollute the process's
    171182    // font namespace (Windows has no API for creating an HFONT from data without exposing the font to the
     
    201212}
    202213
    203 }
     214bool FontCustomPlatformData::supportsFormat(const String& format)
     215{
     216    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") || equalIgnoringCase(format, "woff");
     217}
     218
     219}
  • trunk/WebCore/platform/graphics/win/FontCustomPlatformData.h

    r55975 r64434  
    3232class FontPlatformData;
    3333class SharedBuffer;
     34class String;
    3435
    3536struct FontCustomPlatformData : Noncopyable {
     
    4445    FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode);
    4546
     47    static bool supportsFormat(const String&);
     48
    4649    HANDLE m_fontReference;
    4750    String m_name;
  • trunk/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp

    r30441 r64434  
    5959}
    6060
     61bool FontCustomPlatformData::supportsFormat(const String& format)
     62{
     63    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype");
    6164}
     65
     66}
  • trunk/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h

    r30441 r64434  
    3030class FontPlatformData;
    3131class SharedBuffer;
     32class String;
    3233
    3334struct FontCustomPlatformDataCairo : Noncopyable {
     
    4041    FontPlatformData fontPlatformData(int size, bool bold, bool italic);
    4142
     43    static bool supportsFormat(const String&);
     44
    4245    cairo_font_face_t* m_fontFace;
    4346};
  • trunk/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp

    r58941 r64434  
    8484}
    8585
     86bool FontCustomPlatformData::supportsFormat(const String& format)
     87{
     88    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype");
    8689}
     90
     91}
  • trunk/WebCore/platform/graphics/wince/FontCustomPlatformData.h

    r47975 r64434  
    4646
    4747        FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode);
     48
     49        static bool supportsFormat(const String&);
     50
    4851        String m_name;
    4952    };
Note: See TracChangeset for help on using the changeset viewer.