Bug 152287 - [Font Features] TrueType fonts trigger real features even when synthesis is applied
Summary: [Font Features] TrueType fonts trigger real features even when synthesis is a...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
: 152109 (view as bug list)
Depends on:
Blocks: 149779
  Show dependency treegraph
 
Reported: 2015-12-14 19:08 PST by Myles C. Maxfield
Modified: 2016-01-13 15:04 PST (History)
6 users (show)

See Also:


Attachments
Patch (25.61 KB, patch)
2015-12-14 19:11 PST, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (43.65 KB, patch)
2015-12-14 21:43 PST, Myles C. Maxfield
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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. ***