RESOLVED FIXED 199653
New York font erroneously gets synthetic bold
https://bugs.webkit.org/show_bug.cgi?id=199653
Summary New York font erroneously gets synthetic bold
Myles C. Maxfield
Reported 2019-07-09 19:53:09 PDT
New York erroneously gets synthetic bold
Attachments
WIP (20.27 KB, patch)
2019-07-09 19:53 PDT, Myles C. Maxfield
no flags
WIP (19.39 KB, patch)
2019-07-10 13:34 PDT, Myles C. Maxfield
no flags
Needs tests (52.21 KB, patch)
2019-07-10 18:04 PDT, Myles C. Maxfield
no flags
Patch (86.61 KB, patch)
2019-07-11 13:08 PDT, Myles C. Maxfield
no flags
Patch (87.64 KB, patch)
2019-07-11 15:29 PDT, Myles C. Maxfield
no flags
Patch (87.71 KB, patch)
2019-07-11 15:32 PDT, Myles C. Maxfield
simon.fraser: review+
Myles C. Maxfield
Comment 1 2019-07-09 19:53:28 PDT
Myles C. Maxfield
Comment 2 2019-07-10 13:34:43 PDT
Myles C. Maxfield
Comment 3 2019-07-10 18:04:43 PDT
Created attachment 373883 [details] Needs tests
Myles C. Maxfield
Comment 4 2019-07-10 18:05:22 PDT
One thing I shouldn't forget to do is to add code to catch the dot-prefixed name to make sure it explicitly doesn't work.
EWS Watchlist
Comment 5 2019-07-10 18:05:47 PDT
Attachment 373883 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:8: 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 31 files If any of these errors are false positives, please file a bug against check-webkit-style.
Myles C. Maxfield
Comment 6 2019-07-10 18:19:33 PDT
Jiang Jiang
Comment 7 2019-07-10 23:12:13 PDT
Comment on attachment 373883 [details] Needs tests View in context: https://bugs.webkit.org/attachment.cgi?id=373883&action=review > Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:60 > + auto result = adoptCF(CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, parameters.size, locale)); Shouldn't need to start with this. > Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:85 > + // FIXME: Use applyWeightItalicsAndFallbackBehavior() once <rdar://problem/33046041> is fixed. Isn't this fixed long long time ago? > Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:141 > + CFTypeRef traitsValues[] = { weightNumber.get(), italicsNumber.get(), design ? static_cast<CFTypeRef>(design) : static_cast<CFTypeRef>(kCFBooleanTrue) }; We shouldn't use kCFBooleanTrue as the value in any case, either left design out, or use kCTFontUIFontDesignDefault.
Myles C. Maxfield
Comment 8 2019-07-11 13:02:35 PDT
Comment on attachment 373883 [details] Needs tests View in context: https://bugs.webkit.org/attachment.cgi?id=373883&action=review >> Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:85 >> + // FIXME: Use applyWeightItalicsAndFallbackBehavior() once <rdar://problem/33046041> is fixed. > > Isn't this fixed long long time ago? I'll remove this in a subsequent patch.
Myles C. Maxfield
Comment 9 2019-07-11 13:08:14 PDT
Myles C. Maxfield
Comment 10 2019-07-11 14:06:18 PDT
Running fast/text/design-system-ui-{11,14}.html causes #14 to fail
Myles C. Maxfield
Comment 11 2019-07-11 14:15:41 PDT
file:///Users/mmaxfield/src/WebKit/OpenSource/LayoutTests/fast/text/design-system-ui-11.html file:///Users/mmaxfield/src/WebKit/OpenSource/LayoutTests/fast/text/design-system-ui-14.html
Myles C. Maxfield
Comment 12 2019-07-11 14:20:31 PDT
window.internals.invalidateFontCache(); in the test appears to fix this.
Myles C. Maxfield
Comment 13 2019-07-11 15:29:56 PDT
Myles C. Maxfield
Comment 14 2019-07-11 15:32:09 PDT
Simon Fraser (smfr)
Comment 15 2019-07-11 16:18:21 PDT
Comment on attachment 373965 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=373965&action=review > Source/WTF/ChangeLog:3 > + New York erroneously gets synthetic bold The state, or the city? Oh, you mean the font? Please say so. > Source/WebCore/ChangeLog:15 > + WKPreferencesSetShouldAllowDesignSystemUIFonts(true) Nope > Source/WebCore/ChangeLog:16 > + or -[WKPreferences _shouldAllowDesignSystemUIFonts] = YES. OK > Source/WTF/wtf/Platform.h:1598 > +#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 60000) || (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 130000) I have no idea. > Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp:57 > +#if HAVE(DESIGN_SYSTEM_UI_FONTS) Blank line above please. > Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp:112 > + if (auto use = systemFontUse(cssFamily, shouldAllowDesignSystemUIFonts())) So hard to distinguish between 'use' noun, and 'use' verb. > Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp:131 > + if (auto use = systemFontUse(cssFamily, shouldAllowDesignSystemUIFonts())) { Ditto. > Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:50 > +RetainPtr<CTFontRef> SystemFontDatabaseCoreText::createSystemUI(const CascadeListParameters& parameters, CFStringRef locale) createSystemUIFont? > Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:58 > +RetainPtr<CTFontRef> SystemFontDatabaseCoreText::createDesignSystemUI(ClientUse clientUse, const CascadeListParameters& parameters) createSystemUIFont? > Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:78 > +RetainPtr<CTFontRef> SystemFontDatabaseCoreText::createTextStyle(const CascadeListParameters& parameters) It makes a font, not a text style. > Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:132 > +RetainPtr<CTFontRef> SystemFontDatabaseCoreText::applyWeightItalicsAndFallbackBehavior(CTFontRef font, CGFloat weight, bool italic, float size, AllowUserInstalledFonts allowUserInstalledFonts, CFStringRef design) This should be called createFontByApplying... > Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:214 > + static NeverDestroyed<AtomString> systemUI = AtomString("system-ui-serif", AtomString::ConstructFromLiteral); systemUI -> systemUISerif > Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:219 > + static NeverDestroyed<AtomString> systemUI = AtomString("system-ui-monospaced", AtomString::ConstructFromLiteral); systemUI -> systemUIMonospaced > Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:224 > + static NeverDestroyed<AtomString> systemUI = AtomString("system-ui-rounded", AtomString::ConstructFromLiteral); systemUI -> systemUIRounded > Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h:99 > + enum class ClientUse { : uint8_t if anyone stores it. > Source/WebCore/platform/graphics/mac/FontCacheMac.mm:111 > +#if HAVE(DESIGN_SYSTEM_UI_FONTS) > + if (fontDescription.shouldAllowDesignSystemUIFonts()) { > + Optional<SystemFontDatabaseCoreText::ClientUse> designSystemUI; > + if (equalLettersIgnoringASCIICase(family, "-apple-system-ui-serif")) > + designSystemUI = SystemFontDatabaseCoreText::ClientUse::ForSystemUISerif; > + else if (equalLettersIgnoringASCIICase(family, "-apple-system-ui-monospaced")) > + designSystemUI = SystemFontDatabaseCoreText::ClientUse::ForSystemUIMonospaced; > + else if (equalLettersIgnoringASCIICase(family, "-apple-system-ui-rounded")) > + designSystemUI = SystemFontDatabaseCoreText::ClientUse::ForSystemUIRounded; > + > + if (designSystemUI) { > + auto cascadeList = SystemFontDatabaseCoreText::singleton().cascadeList(fontDescription, family, *designSystemUI, allowUserInstalledFonts); > + if (!cascadeList.isEmpty()) > + return createFontForInstalledFonts(cascadeList[0].get(), size, allowUserInstalledFonts); > + } > + } > +#endif Need to share more of this code between macOS and iOS. > Source/WebCore/svg/graphics/SVGImage.cpp:474 > + m_page->settings().setShouldAllowDesignSystemUIFonts(false); It's false by default so no need to do anything. > Source/WebCore/testing/InternalSettings.cpp:88 > + , m_shouldAllowDesignSystemUIFonts(settings.shouldAllowDesignSystemUIFonts()) Remove > Source/WebCore/testing/InternalSettings.cpp:188 > + settings.setShouldAllowDesignSystemUIFonts(m_shouldAllowDesignSystemUIFonts); Remove > Source/WebCore/testing/InternalSettings.cpp:704 > +ExceptionOr<void> InternalSettings::setShouldAllowDesignSystemUIFonts(bool allow) > +{ > + if (!m_page) > + return Exception { InvalidAccessError }; > + settings().setShouldAllowDesignSystemUIFonts(allow); > + return { }; > +} Remove > Source/WebCore/testing/InternalSettings.h:89 > + ExceptionOr<void> setShouldAllowDesignSystemUIFonts(bool); Remove > Source/WebCore/testing/InternalSettings.h:189 > + bool m_shouldAllowDesignSystemUIFonts; Remove > Source/WebCore/testing/InternalSettings.idl:49 > + [MayThrowException] void setShouldAllowDesignSystemUIFonts(boolean ignore); This shouldn't be necessary. All Settings can be changed from tests already. > Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h:576 > +WK_EXPORT void WKPreferencesSetShouldAllowDesignSystemUIFonts(WKPreferencesRef, bool flag); > +WK_EXPORT bool WKPreferencesGetShouldAllowDesignSystemUIFonts(WKPreferencesRef); I don't know why we're still adding to the C SPI
Myles C. Maxfield
Comment 16 2019-07-11 18:08:35 PDT
Radar WebKit Bug Importer
Comment 17 2019-07-11 18:09:21 PDT
Aakash Jain
Comment 19 2019-07-11 19:01:21 PDT
FontCacheCoreText.cpp:1250:73: error: unused parameter 'family' [-Werror,-Wunused-parameter] FontCacheCoreText.cpp:1250:104: error: unused parameter 'fontDescription' [-Werror,-Wunused-parameter] FontCacheCoreText.cpp:1250:127: error: unused parameter 'size' [-Werror,-Wunused-parameter] FontCacheCoreText.cpp:1250:157: error: unused parameter 'allowUserInstalledFonts' [-Werror,-Wunused-parameter] In file included from /Volumes/Data/slave/ios-12-release/build/WebKitBuild/Release-iphoneos/DerivedSources/WebCore/unified-sources/UnifiedSource360.cpp:8: ./platform/graphics/cocoa/FontCacheCoreText.cpp:1250:73: error: unused parameter 'family' [-Werror,-Wunused-parameter] static RetainPtr<CTFontRef> fontWithFamilySpecialCase(const AtomString& family, const FontDescription& fontDescription, float size, AllowUserInstalledFonts allowUserInstalledFonts) ^ ./platform/graphics/cocoa/FontCacheCoreText.cpp:1250:104: error: unused parameter 'fontDescription' [-Werror,-Wunused-parameter] static RetainPtr<CTFontRef> fontWithFamilySpecialCase(const AtomString& family, const FontDescription& fontDescription, float size, AllowUserInstalledFonts allowUserInstalledFonts) ^ ./platform/graphics/cocoa/FontCacheCoreText.cpp:1250:127: error: unused parameter 'size' [-Werror,-Wunused-parameter] static RetainPtr<CTFontRef> fontWithFamilySpecialCase(const AtomString& family, const FontDescription& fontDescription, float size, AllowUserInstalledFonts allowUserInstalledFonts) ^ ./platform/graphics/cocoa/FontCacheCoreText.cpp:1250:157: error: unused parameter 'allowUserInstalledFonts' [-Werror,-Wunused-parameter] static RetainPtr<CTFontRef> fontWithFamilySpecialCase(const AtomString& family, const FontDescription& fontDescription, float size, AllowUserInstalledFonts allowUserInstalledFonts) ^ 4 errors generated.
Aakash Jain
Comment 20 2019-07-11 19:06:07 PDT Comment hidden (obsolete)
Simon Fraser (smfr)
Comment 22 2019-07-11 19:10:24 PDT
Why was EWS green? Fixing.
Aakash Jain
Comment 23 2019-07-11 19:11:40 PDT
The commit in r247377 seems substantially different from the last uploaded patch (373965). Might be good idea to atleast run the patch through EWS before landing (if not using commit-queue).
Simon Fraser (smfr)
Comment 24 2019-07-11 19:32:32 PDT
Myles C. Maxfield
Comment 25 2019-07-15 17:18:04 PDT
WebKit Commit Bot
Comment 26 2019-07-15 17:21:47 PDT
Re-opened since this is blocked by bug 199816
Myles C. Maxfield
Comment 27 2019-07-15 17:54:03 PDT
Myles C. Maxfield
Comment 28 2019-07-16 09:18:11 PDT
Note You need to log in before you can comment on or make changes to this bug.