Title: [266693] trunk/Source
Revision
266693
Author
mmaxfi...@apple.com
Date
2020-09-06 23:19:36 -0700 (Sun, 06 Sep 2020)

Log Message

[iOS] attachmentActionFont() Needs to use kCTFontSymbolicTrait: @(kCTFontTraitTightLeading | kCTFontTraitEmphasized) to get the short emphasized footnote font
https://bugs.webkit.org/show_bug.cgi?id=215707
<rdar://problem/63930892>

Reviewed by Darin Adler.

Source/WebCore:

This is the correct way to get the short emphasized footnote font.

* rendering/RenderThemeIOS.mm:
(WebCore::attachmentActionFont):

Source/WebCore/PAL:

* pal/spi/cocoa/CoreTextSPI.h: Add an optimzation for platforms which support it.

Source/WTF:

* wtf/PlatformHave.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (266692 => 266693)


--- trunk/Source/WTF/ChangeLog	2020-09-07 06:11:07 UTC (rev 266692)
+++ trunk/Source/WTF/ChangeLog	2020-09-07 06:19:36 UTC (rev 266693)
@@ -1,5 +1,15 @@
 2020-09-06  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        [iOS] attachmentActionFont() Needs to use kCTFontSymbolicTrait: @(kCTFontTraitTightLeading | kCTFontTraitEmphasized) to get the short emphasized footnote font
+        https://bugs.webkit.org/show_bug.cgi?id=215707
+        <rdar://problem/63930892>
+
+        Reviewed by Darin Adler.
+
+        * wtf/PlatformHave.h:
+
+2020-09-06  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         CTFontGetPhysicalSymbolicTraits() is faster than CTFontCopyPhysicalFont()/CTFontGetSymbolicTraits()
         https://bugs.webkit.org/show_bug.cgi?id=215685
 

Modified: trunk/Source/WTF/wtf/PlatformHave.h (266692 => 266693)


--- trunk/Source/WTF/wtf/PlatformHave.h	2020-09-07 06:11:07 UTC (rev 266692)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2020-09-07 06:19:36 UTC (rev 266693)
@@ -743,3 +743,10 @@
 #if PLATFORM(COCOA) && !(PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500)
 #define HAVE_CTFONTGETPHYSICALSYMBOLICTRAITS 1
 #endif
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000) \
+    || ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000) \
+    || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 70000) \
+    || (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 140000)
+#define HAVE_CTFONTDESCRIPTOR_CREATE_WITH_TEXT_STYLE_AND_ATTRIBUTES 1
+#endif

Modified: trunk/Source/WebCore/ChangeLog (266692 => 266693)


--- trunk/Source/WebCore/ChangeLog	2020-09-07 06:11:07 UTC (rev 266692)
+++ trunk/Source/WebCore/ChangeLog	2020-09-07 06:19:36 UTC (rev 266693)
@@ -1,5 +1,18 @@
 2020-09-06  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        [iOS] attachmentActionFont() Needs to use kCTFontSymbolicTrait: @(kCTFontTraitTightLeading | kCTFontTraitEmphasized) to get the short emphasized footnote font
+        https://bugs.webkit.org/show_bug.cgi?id=215707
+        <rdar://problem/63930892>
+
+        Reviewed by Darin Adler.
+
+        This is the correct way to get the short emphasized footnote font.
+
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::attachmentActionFont):
+
+2020-09-06  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         [Cocoa] Prepare for migrating to CTFontHasTable() once it's faster than CTFontCopyAvailableTables()
         https://bugs.webkit.org/show_bug.cgi?id=215688
 

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (266692 => 266693)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2020-09-07 06:11:07 UTC (rev 266692)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2020-09-07 06:19:36 UTC (rev 266693)
@@ -208,6 +208,7 @@
 $(PROJECT_DIR)/Modules/mediastream/RTCRtpCapabilities.idl
 $(PROJECT_DIR)/Modules/mediastream/RTCRtpCodecCapability.idl
 $(PROJECT_DIR)/Modules/mediastream/RTCRtpCodecParameters.idl
+$(PROJECT_DIR)/Modules/mediastream/RTCRtpCodingParameters.idl
 $(PROJECT_DIR)/Modules/mediastream/RTCRtpContributingSource.idl
 $(PROJECT_DIR)/Modules/mediastream/RTCRtpEncodingParameters.idl
 $(PROJECT_DIR)/Modules/mediastream/RTCRtpFecParameters.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (266692 => 266693)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-09-07 06:11:07 UTC (rev 266692)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-09-07 06:19:36 UTC (rev 266693)
@@ -1456,6 +1456,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRTCRtpCodecCapability.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRTCRtpCodecParameters.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRTCRtpCodecParameters.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRTCRtpCodingParameters.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRTCRtpCodingParameters.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRTCRtpContributingSource.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRTCRtpContributingSource.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRTCRtpEncodingParameters.cpp

Modified: trunk/Source/WebCore/PAL/ChangeLog (266692 => 266693)


--- trunk/Source/WebCore/PAL/ChangeLog	2020-09-07 06:11:07 UTC (rev 266692)
+++ trunk/Source/WebCore/PAL/ChangeLog	2020-09-07 06:19:36 UTC (rev 266693)
@@ -1,5 +1,15 @@
 2020-09-06  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        [iOS] attachmentActionFont() Needs to use kCTFontSymbolicTrait: @(kCTFontTraitTightLeading | kCTFontTraitEmphasized) to get the short emphasized footnote font
+        https://bugs.webkit.org/show_bug.cgi?id=215707
+        <rdar://problem/63930892>
+
+        Reviewed by Darin Adler.
+
+        * pal/spi/cocoa/CoreTextSPI.h: Add an optimzation for platforms which support it.
+
+2020-09-06  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         [Cocoa] Prepare for migrating to CTFontHasTable() once it's faster than CTFontCopyAvailableTables()
         https://bugs.webkit.org/show_bug.cgi?id=215688
 

Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h (266692 => 266693)


--- trunk/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h	2020-09-07 06:11:07 UTC (rev 266692)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h	2020-09-07 06:19:36 UTC (rev 266693)
@@ -77,6 +77,11 @@
     kCTCompositionLanguageTraditionalChinese,
 };
 
+enum {
+    kCTFontTraitTightLeading = (1 << 15),
+    kCTFontTraitEmphasized = kCTFontTraitBold,
+};
+
 #endif
 
 WTF_EXTERN_C_BEGIN
@@ -115,6 +120,7 @@
 CTFontDescriptorRef CTFontDescriptorCreateForUIType(CTFontUIFontType, CGFloat size, CFStringRef language);
 CTFontDescriptorRef CTFontDescriptorCreateWithTextStyle(CFStringRef style, CFStringRef size, CFStringRef language);
 CTFontDescriptorRef CTFontDescriptorCreateCopyWithSymbolicTraits(CTFontDescriptorRef original, CTFontSymbolicTraits symTraitValue, CTFontSymbolicTraits symTraitMask);
+CTFontDescriptorRef CTFontDescriptorCreateWithTextStyleAndAttributes(CFStringRef style, CFStringRef size, CFDictionaryRef attributes);
 CFBitVectorRef CTFontCopyGlyphCoverageForFeature(CTFontRef, CFDictionaryRef feature);
 
 CTFontDescriptorRef CTFontDescriptorCreateWithAttributesAndOptions(CFDictionaryRef attributes, CTFontDescriptorOptions);

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (266692 => 266693)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2020-09-07 06:11:07 UTC (rev 266692)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2020-09-07 06:19:36 UTC (rev 266693)
@@ -1399,11 +1399,16 @@
 
 static RetainPtr<CTFontRef> attachmentActionFont()
 {
-    RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(kCTUIFontTextStyleShortFootnote, RenderThemeIOS::singleton().contentSizeCategory(), 0));
-    RetainPtr<CTFontDescriptorRef> emphasizedFontDescriptor = adoptCF(CTFontDescriptorCreateCopyWithAttributes(fontDescriptor.get(),
-        (CFDictionaryRef)@{
-            (id)kCTFontDescriptorTextStyleAttribute: (id)kCTFontDescriptorTextStyleEmphasized
-    }));
+    auto style = kCTUIFontTextStyleFootnote;
+    auto size = RenderThemeIOS::singleton().contentSizeCategory();
+    auto attributes = static_cast<CFDictionaryRef>(@{ (id)kCTFontTraitsAttribute: @{ (id)kCTFontSymbolicTrait: @(kCTFontTraitTightLeading | kCTFontTraitEmphasized) } });
+#if HAVE(CTFONTDESCRIPTOR_CREATE_WITH_TEXT_STYLE_AND_ATTRIBUTES)
+    auto emphasizedFontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyleAndAttributes(style, size, attributes));
+#else
+    auto fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(style, size, 0));
+    auto emphasizedFontDescriptor = adoptCF(CTFontDescriptorCreateCopyWithAttributes(fontDescriptor.get(), attributes));
+#endif
+
     return adoptCF(CTFontCreateWithFontDescriptor(emphasizedFontDescriptor.get(), 0, nullptr));
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to