RESOLVED FIXED 147722
Implement font-feature-settings
https://bugs.webkit.org/show_bug.cgi?id=147722
Summary Implement font-feature-settings
Myles C. Maxfield
Reported 2015-08-05 22:05:23 PDT
Implement font-feature-settings
Attachments
No caching yet (5.08 KB, patch)
2015-08-05 22:06 PDT, Myles C. Maxfield
no flags
Patch (24.08 KB, patch)
2015-08-06 17:14 PDT, Myles C. Maxfield
no flags
Patch (28.56 KB, patch)
2015-08-06 18:00 PDT, Myles C. Maxfield
no flags
Patch (28.62 KB, patch)
2015-08-06 18:22 PDT, Myles C. Maxfield
no flags
Patch (29.11 KB, patch)
2015-08-06 18:44 PDT, Myles C. Maxfield
no flags
Patch (30.25 KB, patch)
2015-08-06 19:01 PDT, Myles C. Maxfield
no flags
Patch (30.41 KB, patch)
2015-08-06 19:13 PDT, Myles C. Maxfield
no flags
Archive of layout-test-results from ews107 for mac-mavericks-wk2 (593.55 KB, application/zip)
2015-08-06 20:11 PDT, Build Bot
no flags
Patch (30.68 KB, patch)
2015-08-06 21:24 PDT, Myles C. Maxfield
no flags
Patch (32.61 KB, patch)
2015-08-06 22:34 PDT, Myles C. Maxfield
no flags
Patch (18.33 KB, patch)
2015-08-07 02:26 PDT, Myles C. Maxfield
no flags
Patch (154.94 KB, patch)
2015-08-07 03:10 PDT, Myles C. Maxfield
no flags
Patch (154.97 KB, patch)
2015-08-07 10:10 PDT, Myles C. Maxfield
no flags
Patch (118.17 KB, patch)
2015-08-07 10:54 PDT, Myles C. Maxfield
no flags
Patch (118.16 KB, patch)
2015-08-07 10:57 PDT, Myles C. Maxfield
simon.fraser: review+
Myles C. Maxfield
Comment 1 2015-08-05 22:06:11 PDT
Created attachment 258349 [details] No caching yet
Myles C. Maxfield
Comment 2 2015-08-05 22:08:02 PDT
<div style="font: 100px 'Hiragino Sans GB'; -webkit-font-feature-settings: 'trad';">&#x4f53;</div> has a different on OS X
Myles C. Maxfield
Comment 3 2015-08-06 17:14:23 PDT
Myles C. Maxfield
Comment 4 2015-08-06 17:15:04 PDT
Still needs tests. Reftests will be difficult, so I think (for now) I'll make dump-render-tree tests.
WebKit Commit Bot
Comment 5 2015-08-06 17:15:48 PDT
Attachment 258425 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:19: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 14 files If any of these errors are false positives, please file a bug against check-webkit-style.
Myles C. Maxfield
Comment 6 2015-08-06 18:00:35 PDT
WebKit Commit Bot
Comment 7 2015-08-06 18:02:37 PDT
Attachment 258427 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:19: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 18 files If any of these errors are false positives, please file a bug against check-webkit-style.
Myles C. Maxfield
Comment 8 2015-08-06 18:22:36 PDT
WebKit Commit Bot
Comment 9 2015-08-06 18:24:16 PDT
Attachment 258428 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:19: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 18 files If any of these errors are false positives, please file a bug against check-webkit-style.
Myles C. Maxfield
Comment 10 2015-08-06 18:44:34 PDT
WebKit Commit Bot
Comment 11 2015-08-06 18:46:34 PDT
Attachment 258431 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:19: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 18 files If any of these errors are false positives, please file a bug against check-webkit-style.
Myles C. Maxfield
Comment 12 2015-08-06 19:01:07 PDT
WebKit Commit Bot
Comment 13 2015-08-06 19:03:53 PDT
Attachment 258432 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:19: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 19 files If any of these errors are false positives, please file a bug against check-webkit-style.
Myles C. Maxfield
Comment 14 2015-08-06 19:13:36 PDT
WebKit Commit Bot
Comment 15 2015-08-06 19:15:06 PDT
Attachment 258433 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:19: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 19 files If any of these errors are false positives, please file a bug against check-webkit-style.
Build Bot
Comment 16 2015-08-06 20:10:58 PDT
Comment on attachment 258433 [details] Patch Attachment 258433 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/25348 New failing tests: fonts/unicode-character-font-crash.html
Build Bot
Comment 17 2015-08-06 20:11:00 PDT
Created attachment 258435 [details] Archive of layout-test-results from ews107 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Myles C. Maxfield
Comment 18 2015-08-06 21:24:27 PDT
WebKit Commit Bot
Comment 19 2015-08-06 21:27:50 PDT
Attachment 258444 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:19: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 19 files If any of these errors are false positives, please file a bug against check-webkit-style.
Myles C. Maxfield
Comment 20 2015-08-06 22:34:54 PDT
Myles C. Maxfield
Comment 21 2015-08-07 02:26:06 PDT
Myles C. Maxfield
Comment 22 2015-08-07 03:10:43 PDT
Myles C. Maxfield
Comment 23 2015-08-07 03:11:54 PDT
Comment on attachment 258477 [details] Patch Marking as r? because this is ready to review (even though EWS is going to show all red because this patch depends on https://bugs.webkit.org/show_bug.cgi?id=147775)
Myles C. Maxfield
Comment 24 2015-08-07 10:10:41 PDT
Myles C. Maxfield
Comment 25 2015-08-07 10:54:54 PDT
Myles C. Maxfield
Comment 26 2015-08-07 10:57:52 PDT
Myles C. Maxfield
Comment 27 2015-08-07 12:10:17 PDT
Daniel Bates
Comment 28 2015-08-07 13:17:46 PDT
Comment on attachment 258512 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=258512&action=review I know that this patch was already reviewed and landed. I had some comments and questions. > Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:33 > + // FIXME: We should map OpenType feature strings to the TrueType feature type identifiers listed in <CoreText/SFNTLayoutTypes.h> Nit: Missing a period at the end of this sentence. > Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:35 > + UNUSED_PARAM(features); > + UNUSED_PARAM(feature); Do we get a compiler warning for an empty function? If not then I suggest we remove the name of each argument (e.g. features) in the prototype for this function such that is reads: static inline void appendTrueTypeFeature(CFMutableArrayRef, const FontFeature&) Then we do not need to use UNUSED_PARAM(). > Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:45 > + CFStringRef featureDictionaryKeys[] = {kCTFontOpenTypeFeatureTag, kCTFontOpenTypeFeatureValue}; > + CFTypeRef featureDictionaryValues[] = {featureKey.get(), featureValue.get()}; Nit: It is an unwritten convention that when using aggregate initialization syntax that we put a space character after the opening brace and a space character before the closing brace such that these line would read: > Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:46 > + RetainPtr<CFDictionaryRef> featureDictionary = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, (const void**)featureDictionaryKeys, featureDictionaryValues, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); We should use WTF_ARRAY_LENGTH(featureDictionaryValues) to compute the number of elements in the array featureDictionaryValues instead of hardcoding its size (2). > Source/WebCore/platform/graphics/ios/FontCacheIOS.mm:88 > + if (substituteFont && description.featureSettings() && description.featureSettings()->size()) The first conjunct is unnecessary because substituteFont is always non-null when we reach this line (since we return early if substituteFont is null on line 86). > Source/WebCore/platform/graphics/ios/FontCacheIOS.mm:698 > + if (ctFont && fontDescription.featureSettings() && fontDescription.featureSettings()->size()) Similarly, the first conjunct is unnecessary because ctFont will always be non-null when we reach this line. > Source/WebCore/platform/graphics/mac/FontCacheMac.mm:517 > + if (result && description.featureSettings() && description.featureSettings()->size()) > + result = applyFontFeatureSettings(result.get(), *description.featureSettings()); We check the same conditions before each call to applyFontFeatureSettings(). Unless these call site show up in a profile, I suggest moving the checks into applyFontFeatureSettings(). > Source/WebCore/platform/graphics/mac/FontCacheMac.mm:519 > if (!result) > return nullptr; I take it that it is less likely for result to be non-null in this function and hence the choice to have this if-block come after the if-block that starts on line 516?
Myles C. Maxfield
Comment 29 2015-08-07 14:05:23 PDT
(In reply to comment #28) > Comment on attachment 258512 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=258512&action=review > > I know that this patch was already reviewed and landed. I had some comments > and questions. > > > Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:33 > > + // FIXME: We should map OpenType feature strings to the TrueType feature type identifiers listed in <CoreText/SFNTLayoutTypes.h> > > Nit: Missing a period at the end of this sentence. > > > Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:35 > > + UNUSED_PARAM(features); > > + UNUSED_PARAM(feature); > > Do we get a compiler warning for an empty function? If not then I suggest we > remove the name of each argument (e.g. features) in the prototype for this > function such that is reads: > > static inline void appendTrueTypeFeature(CFMutableArrayRef, const > FontFeature&) > > Then we do not need to use UNUSED_PARAM(). > > > Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:45 > > + CFStringRef featureDictionaryKeys[] = {kCTFontOpenTypeFeatureTag, kCTFontOpenTypeFeatureValue}; > > + CFTypeRef featureDictionaryValues[] = {featureKey.get(), featureValue.get()}; > > Nit: It is an unwritten convention that when using aggregate initialization > syntax that we put a space character after the opening brace and a space > character before the closing brace such that these line would read: > > > Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:46 > > + RetainPtr<CFDictionaryRef> featureDictionary = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, (const void**)featureDictionaryKeys, featureDictionaryValues, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); > > We should use WTF_ARRAY_LENGTH(featureDictionaryValues) to compute the > number of elements in the array featureDictionaryValues instead of > hardcoding its size (2). > > > Source/WebCore/platform/graphics/ios/FontCacheIOS.mm:88 > > + if (substituteFont && description.featureSettings() && description.featureSettings()->size()) > > The first conjunct is unnecessary because substituteFont is always non-null > when we reach this line (since we return early if substituteFont is null on > line 86). > > > Source/WebCore/platform/graphics/ios/FontCacheIOS.mm:698 > > + if (ctFont && fontDescription.featureSettings() && fontDescription.featureSettings()->size()) > > Similarly, the first conjunct is unnecessary because ctFont will always be > non-null when we reach this line. > > > Source/WebCore/platform/graphics/mac/FontCacheMac.mm:517 > > + if (result && description.featureSettings() && description.featureSettings()->size()) > > + result = applyFontFeatureSettings(result.get(), *description.featureSettings()); > > We check the same conditions before each call to applyFontFeatureSettings(). > Unless these call site show up in a profile, I suggest moving the checks > into applyFontFeatureSettings(). > > > Source/WebCore/platform/graphics/mac/FontCacheMac.mm:519 > > if (!result) > > return nullptr; > > I take it that it is less likely for result to be non-null in this function > and hence the choice to have this if-block come after the if-block that > starts on line 516? Performed in https://bugs.webkit.org/show_bug.cgi?id=147793
Myles C. Maxfield
Comment 30 2015-08-18 23:37:33 PDT
*** Bug 134332 has been marked as a duplicate of this bug. ***
Jon Lee
Comment 31 2015-12-04 15:48:05 PST
Note You need to log in before you can comment on or make changes to this bug.