Changeset 219223 in webkit


Ignore:
Timestamp:
Jul 6, 2017 4:04:18 PM (7 years ago)
Author:
mmaxfield@apple.com
Message:

[Cocoa] Improve performance of font lookups
https://bugs.webkit.org/show_bug.cgi?id=173960
<rdar://problem/31996891>

Reviewed by Darin Adler.

PerformanceTests:

  • Layout/font-fallback-font-family.html: Added.
  • Layout/resources/font-fallback-font-family.html: Added.

Source/WebCore:

Looking up kCTFontPostScriptNameAttribute is faster than kCTFontNameAttribute.

No new tests because there is no behavior change.

  • platform/spi/cocoa/CoreTextSPI.h:
  • platform/graphics/cocoa/FontCacheCoreText.cpp:

(WebCore::FontDatabase::fontForPostScriptName):

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/PerformanceTests/ChangeLog

    r218057 r219223  
     12017-07-06  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [Cocoa] Improve performance of font lookups
     4        https://bugs.webkit.org/show_bug.cgi?id=173960
     5        <rdar://problem/31996891>
     6
     7        Reviewed by Darin Adler.
     8
     9        * Layout/font-fallback-font-family.html: Added.
     10        * Layout/resources/font-fallback-font-family.html: Added.
     11
    1122017-06-10  Dan Bernstein  <mitz@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r219221 r219223  
     12017-07-06  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [Cocoa] Improve performance of font lookups
     4        https://bugs.webkit.org/show_bug.cgi?id=173960
     5        <rdar://problem/31996891>
     6
     7        Reviewed by Darin Adler.
     8
     9        Looking up kCTFontPostScriptNameAttribute is faster than kCTFontNameAttribute.
     10
     11        No new tests because there is no behavior change.
     12
     13        * platform/spi/cocoa/CoreTextSPI.h:
     14        * platform/graphics/cocoa/FontCacheCoreText.cpp:
     15        (WebCore::FontDatabase::fontForPostScriptName):
     16
    1172017-07-06  Myles C. Maxfield  <mmaxfield@apple.com>
    218
  • trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp

    r219199 r219223  
    911911        return m_postScriptNameToFontDescriptors.ensure(folded, [&] {
    912912            auto postScriptNameString = folded.createCFString();
    913             CFTypeRef keys[] = { kCTFontEnabledAttribute, kCTFontNameAttribute };
     913#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300)
     914            CFStringRef nameAttribute = kCTFontPostScriptNameAttribute;
     915#else
     916            CFStringRef nameAttribute = kCTFontNameAttribute;
     917#endif
     918            CFTypeRef keys[] = { kCTFontEnabledAttribute, nameAttribute };
    914919            CFTypeRef values[] = { kCFBooleanTrue, postScriptNameString.get() };
    915920            auto attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
  • trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h

    r216962 r219223  
    6868extern const CFStringRef kCTFontReferenceURLAttribute;
    6969extern const CFStringRef kCTFontOpticalSizeAttribute;
     70extern const CFStringRef kCTFontPostScriptNameAttribute;
    7071
    7172bool CTFontTransformGlyphs(CTFontRef, CGGlyph glyphs[], CGSize advances[], CFIndex count, CTFontTransformOptions);
Note: See TracChangeset for help on using the changeset viewer.