From db14019a23d96bc8a444b6576a5da8bd1cfbc8b0 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Wed, 4 Aug 2010 11:41:34 +0100 Subject: Merge WebKit at r64523 : Initial merge by git. Change-Id: Ibb796c6802e757b1d9b40f58205cfbe4da95fcd4 --- .../graphics/mac/FontCustomPlatformData.cpp | 24 ++++++++++++++++++---- .../platform/graphics/mac/FontCustomPlatformData.h | 3 +++ 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'WebCore/platform/graphics/mac') diff --git a/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp b/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp index 256b5a4..c591ddc 100644 --- a/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Computer, Inc. + * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,10 +21,11 @@ #include "config.h" #include "FontCustomPlatformData.h" -#include -#include "SharedBuffer.h" #include "FontPlatformData.h" #include "OpenTypeSanitizer.h" +#include "SharedBuffer.h" +#include "WOFFFileFormat.h" +#include namespace WebCore { @@ -50,6 +51,16 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) if (!transcodeBuffer) return 0; // validation failed. buffer = transcodeBuffer.get(); +#else + RefPtr sfntBuffer; + if (isWOFF(buffer)) { + Vector sfnt; + if (!convertWOFFToSfnt(buffer, sfnt)) + return 0; + + sfntBuffer = SharedBuffer::adoptVector(sfnt); + buffer = sfntBuffer.get(); + } #endif ATSFontContainerRef containerRef = 0; @@ -60,7 +71,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) RetainPtr bufferData(AdoptCF, buffer->createCFData()); RetainPtr dataProvider(AdoptCF, CGDataProviderCreateWithCFData(bufferData.get())); - + cgFontRef.adoptCF(CGFontCreateWithDataProvider(dataProvider.get())); if (!cgFontRef) return 0; @@ -101,4 +112,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) return new FontCustomPlatformData(containerRef, fontRef, cgFontRef.releaseRef()); } +bool FontCustomPlatformData::supportsFormat(const String& format) +{ + return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") || equalIgnoringCase(format, "woff"); +} + } diff --git a/WebCore/platform/graphics/mac/FontCustomPlatformData.h b/WebCore/platform/graphics/mac/FontCustomPlatformData.h index 2c1222f..f2cd2cc 100644 --- a/WebCore/platform/graphics/mac/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/mac/FontCustomPlatformData.h @@ -33,6 +33,7 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; +class String; struct FontCustomPlatformData : Noncopyable { FontCustomPlatformData(ATSFontContainerRef container, ATSFontRef atsFont, CGFontRef cgFont) @@ -42,6 +43,8 @@ struct FontCustomPlatformData : Noncopyable { FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); + static bool supportsFormat(const String&); + ATSFontContainerRef m_atsContainer; ATSFontRef m_atsFont; CGFontRef m_cgFont; -- cgit v1.1