| Index: Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm
|
| diff --git a/Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm b/Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm
|
| index 88a346095cb4a09964074ce9da7d8e7560687324..b7b8f756fe30a5dd845d4418487cec8a7505a20e 100644
|
| --- a/Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm
|
| +++ b/Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm
|
| @@ -28,10 +28,8 @@
|
| #import <AvailabilityMacros.h>
|
| #import <wtf/text/WTFString.h>
|
|
|
| -#if OS(MACOSX)
|
| #import "platform/fonts/harfbuzz/HarfBuzzFace.h"
|
| #include "third_party/skia/include/ports/SkTypeface_mac.h"
|
| -#endif
|
|
|
| namespace blink {
|
|
|
| @@ -79,24 +77,16 @@ FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool syntheticBol
|
| m_cgFont.adoptCF(cgFont);
|
| }
|
|
|
| -FontPlatformData:: ~FontPlatformData()
|
| -{
|
| - if (m_font && m_font != reinterpret_cast<NSFont *>(-1))
|
| - CFRelease(m_font);
|
| -}
|
| -
|
| void FontPlatformData::platformDataInit(const FontPlatformData& f)
|
| {
|
| - m_font = f.m_font && f.m_font != reinterpret_cast<NSFont *>(-1) ? [f.m_font retain] : f.m_font;
|
| + m_font = f.m_font ? [f.m_font retain] : f.m_font;
|
|
|
| m_cgFont = f.m_cgFont;
|
| m_CTFont = f.m_CTFont;
|
|
|
| -#if OS(MACOSX)
|
| m_inMemoryFont = f.m_inMemoryFont;
|
| m_harfBuzzFace = f.m_harfBuzzFace;
|
| m_typeface = f.m_typeface;
|
| -#endif
|
| }
|
|
|
| const FontPlatformData& FontPlatformData::platformDataAssign(const FontPlatformData& f)
|
| @@ -104,31 +94,24 @@ const FontPlatformData& FontPlatformData::platformDataAssign(const FontPlatformD
|
| m_cgFont = f.m_cgFont;
|
| if (m_font == f.m_font)
|
| return *this;
|
| - if (f.m_font && f.m_font != reinterpret_cast<NSFont *>(-1))
|
| + if (f.m_font)
|
| CFRetain(f.m_font);
|
| - if (m_font && m_font != reinterpret_cast<NSFont *>(-1))
|
| + if (m_font)
|
| CFRelease(m_font);
|
| m_font = f.m_font;
|
| m_CTFont = f.m_CTFont;
|
| -#if OS(MACOSX)
|
| +
|
| m_inMemoryFont = f.m_inMemoryFont;
|
| m_harfBuzzFace = f.m_harfBuzzFace;
|
| m_typeface = f.m_typeface;
|
| -#endif
|
| +
|
| return *this;
|
| }
|
|
|
| -bool FontPlatformData::platformIsEqual(const FontPlatformData& other) const
|
| -{
|
| - if (m_font || other.m_font)
|
| - return m_font == other.m_font;
|
| - return m_cgFont == other.m_cgFont;
|
| -}
|
|
|
| void FontPlatformData::setFont(NSFont *font)
|
| {
|
| ASSERT_ARG(font, font);
|
| - ASSERT(m_font != reinterpret_cast<NSFont *>(-1));
|
|
|
| if (m_font == font)
|
| return;
|
| @@ -143,7 +126,6 @@ void FontPlatformData::setFont(NSFont *font)
|
| NSFont* loadedFont = 0;
|
| loadFont(m_font, m_textSize, loadedFont, cgFont);
|
|
|
| -#if OS(MACOSX)
|
| // If loadFont replaced m_font with a fallback font, then release the
|
| // previous font to counter the retain above. Then retain the new font.
|
| if (loadedFont != m_font) {
|
| @@ -151,7 +133,6 @@ void FontPlatformData::setFont(NSFont *font)
|
| CFRetain(loadedFont);
|
| m_font = loadedFont;
|
| }
|
| -#endif
|
|
|
| m_cgFont.adoptCF(cgFont);
|
| #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
|
| @@ -244,11 +225,6 @@ static CTFontDescriptorRef cascadeToLastResortAndDisableSwashesFontDescriptor()
|
| return descriptor;
|
| }
|
|
|
| -String FontPlatformData::fontFamilyName() const
|
| -{
|
| - return String(CTFontCopyDisplayName(ctFont()));
|
| -}
|
| -
|
| CTFontRef FontPlatformData::ctFont() const
|
| {
|
| if (m_CTFont)
|
| @@ -288,16 +264,7 @@ CTFontRef FontPlatformData::ctFont() const
|
| return m_CTFont.get();
|
| }
|
|
|
| -SkTypeface* FontPlatformData::typeface() const {
|
| - if (m_typeface)
|
| - return m_typeface.get();
|
| -
|
| - m_typeface = adoptRef(SkCreateTypefaceFromCTFont(ctFont()));
|
| - return m_typeface.get();
|
| -}
|
| -
|
| -#if OS(MACOSX)
|
| -static bool isAATFont(CTFontRef ctFont)
|
| +bool FontPlatformData::isAATFont(CTFontRef ctFont) const
|
| {
|
| CFDataRef table = CTFontCopyTable(ctFont, kCTFontTableMort, 0);
|
| if (table) {
|
| @@ -311,21 +278,5 @@ static bool isAATFont(CTFontRef ctFont)
|
| }
|
| return false;
|
| }
|
| -#endif
|
| -
|
| -HarfBuzzFace* FontPlatformData::harfBuzzFace() const
|
| -{
|
| - CTFontRef font = ctFont();
|
| - // HarfBuzz can't handle AAT font
|
| - if (isAATFont(font))
|
| - return 0;
|
| -
|
| - if (!m_harfBuzzFace) {
|
| - uint64_t uniqueID = reinterpret_cast<uintptr_t>(font);
|
| - m_harfBuzzFace = HarfBuzzFace::create(const_cast<FontPlatformData*>(this), uniqueID);
|
| - }
|
| - return m_harfBuzzFace.get();
|
| -}
|
| -
|
|
|
| } // namespace blink
|
|
|