Bug 152287

Summary: [Font Features] TrueType fonts trigger real features even when synthesis is applied
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: New BugsAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, jonlee, koivisto, simon.fraser, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 149779    
Attachments:
Description Flags
Patch
none
Patch darin: review+

Description Myles C. Maxfield 2015-12-14 19:08:37 PST
[Font Features] TrueType fonts trigger real features even when synthesis is applied
Comment 1 Myles C. Maxfield 2015-12-14 19:11:30 PST
Created attachment 267334 [details]
Patch
Comment 2 Myles C. Maxfield 2015-12-14 21:43:40 PST
Created attachment 267344 [details]
Patch
Comment 3 Darin Adler 2015-12-14 22:01:48 PST
Comment on attachment 267344 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=267344&action=review

> Source/WebCore/platform/graphics/cocoa/FontCocoa.mm:481
> +        if (!CFDictionaryContainsKey(featureType, kCTFontFeatureTypeIdentifierKey))
> +            continue;
> +        int rawFeatureKey;
> +        CFNumberRef featureKey = static_cast<CFNumberRef>(CFDictionaryGetValue(featureType, kCTFontFeatureTypeIdentifierKey));

Should check for null instead of calling CFDictionaryContainsKey and then CFDictionaryGetValue. More efficient: saves one hash table lookup.

> Source/WebCore/platform/graphics/cocoa/FontCocoa.mm:487
> +        CFArrayRef featureSelectors = static_cast<CFArrayRef>(CFDictionaryGetValue(featureType, kCTFontFeatureTypeSelectorsKey));
> +        CFIndex selectorsCount = CFArrayGetCount(featureSelectors);

Do we have a guarantee this won’t be null?

> Source/WebCore/platform/graphics/cocoa/FontCocoa.mm:493
> +            if (!CFDictionaryContainsKey(featureSelector, kCTFontFeatureSelectorDefaultKey))
> +                continue;
> +            int rawIsDefault;
> +            CFNumberRef isDefault = static_cast<CFNumberRef>(CFDictionaryGetValue(featureSelector, kCTFontFeatureSelectorDefaultKey));

Should check for null instead of calling CFDictionaryContainsKey and then CFDictionaryGetValue. More efficient: saves one hash table lookup.
Comment 4 Myles C. Maxfield 2015-12-15 13:56:08 PST
Committed r194114: <http://trac.webkit.org/changeset/194114>
Comment 5 Jon Lee 2015-12-18 11:04:00 PST
rdar://problem/23957523
Comment 6 Myles C. Maxfield 2016-01-13 15:04:24 PST
*** Bug 152109 has been marked as a duplicate of this bug. ***