Title: [195568] branches/safari-601.1.46-branch

Diff

Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (195567 => 195568)


--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog	2016-01-26 00:35:17 UTC (rev 195567)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog	2016-01-26 00:43:39 UTC (rev 195568)
@@ -1,3 +1,17 @@
+2016-01-20  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r195150. rdar://problem/24208162
+
+    2016-01-15  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+            [Cocoa] Font features are not applied to the system font
+            https://bugs.webkit.org/show_bug.cgi?id=153053
+
+            Reviewed by Dean Jackson.
+
+            * fast/text/system-font-features-expected.html: Added.
+            * fast/text/system-font-features.html: Added.
+
 2016-01-20  Babak Shafiei  <bshaf...@apple.com>
 
         Merge r195075.

Added: branches/safari-601.1.46-branch/LayoutTests/fast/text/system-font-features-expected.html (0 => 195568)


--- branches/safari-601.1.46-branch/LayoutTests/fast/text/system-font-features-expected.html	                        (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/fast/text/system-font-features-expected.html	2016-01-26 00:43:39 UTC (rev 195568)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that font features are applied to -apple-system.
+<div style="font: 50px -apple-system-monospaced-numbers;">0123456789</div>
+</body>
+</html>

Added: branches/safari-601.1.46-branch/LayoutTests/fast/text/system-font-features.html (0 => 195568)


--- branches/safari-601.1.46-branch/LayoutTests/fast/text/system-font-features.html	                        (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/fast/text/system-font-features.html	2016-01-26 00:43:39 UTC (rev 195568)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that font features are applied to -apple-system.
+<div style="font: 50px -apple-system; font-variant-numeric: tabular-nums;">0123456789</div>
+</body>
+</html>

Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (195567 => 195568)


--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2016-01-26 00:35:17 UTC (rev 195567)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2016-01-26 00:43:39 UTC (rev 195568)
@@ -1,3 +1,21 @@
+2016-01-20  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r195150. rdar://problem/24208162
+
+    2016-01-15  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+            [Cocoa] Font features are not applied to the system font
+            https://bugs.webkit.org/show_bug.cgi?id=153053
+
+            Reviewed by Dean Jackson.
+
+            We simply need to call preparePlatformFont() on it.
+
+            Test: fast/text/system-font-features.html
+
+            * platform/graphics/cocoa/FontCacheCoreText.cpp:
+            (WebCore::fontWithFamily):
+
 2016-01-20  Babak Shafiei  <bshaf...@apple.com>
 
         Merge r195132.

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (195567 => 195568)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/FontCacheMac.mm	2016-01-26 00:35:17 UTC (rev 195567)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/FontCacheMac.mm	2016-01-26 00:43:39 UTC (rev 195568)
@@ -273,117 +273,113 @@
     int chosenWeight;
     NSFont *font;
 
+    RetainPtr<CTFontRef> foundFont = fontWithFamilySpecialCase(family, weight, desiredTraits, size);
+    if (!foundFont) {
 #if ENABLE(PLATFORM_FONT_LOOKUP)
-
-    const auto& whitelist = fontWhitelist();
-    if (whitelist.size() && !whitelist.contains(family.lower()))
-        return nil;
-    CTFontSymbolicTraits requestedTraits = 0;
-    if (desiredTraits & NSFontItalicTrait)
-        requestedTraits |= kCTFontItalicTrait;
-    if (weight >= FontWeight600)
-        requestedTraits |= kCTFontBoldTrait;
-
-    NSString *desiredFamily = family;
-    RetainPtr<CTFontRef> foundFont = adoptCF(CTFontCreateForCSS((CFStringRef)desiredFamily, toCoreTextFontWeight(weight), requestedTraits, size));
-    foundFont = applyFontFeatureSettings(foundFont.get(), nullptr, nullptr, featureSettings, variantSettings);
-    if (!foundFont)
-        return nil;
-    font = CFBridgingRelease(CFRetain(foundFont.get()));
-    availableFamily = [font familyName];
-    chosenWeight = [fontManager weightOfFont:font];
-
-#else
-
-    UNUSED_PARAM(featureSettings);
-    UNUSED_PARAM(variantSettings);
-
-    NSFontTraitMask desiredTraitsForNameMatch = desiredTraits | (weight >= FontWeight600 ? NSBoldFontMask : 0);
-    if (hasDesiredFamilyToAvailableFamilyMapping(family, desiredTraitsForNameMatch, availableFamily)) {
-        if (!availableFamily) {
-            // We already know the desired font family does not map to any available font family.
+        const auto& whitelist = fontWhitelist();
+        if (whitelist.size() && !whitelist.contains(family.lower()))
             return nil;
-        }
-    }
+        CTFontSymbolicTraits requestedTraits = 0;
+        if (desiredTraits & NSFontItalicTrait)
+            requestedTraits |= kCTFontItalicTrait;
+        if (weight >= FontWeight600)
+            requestedTraits |= kCTFontBoldTrait;
 
-    if (!availableFamily) {
         NSString *desiredFamily = family;
-
-        // Do a simple case insensitive search for a matching font family.
-        // NSFontManager requires exact name matches.
-        // This addresses the problem of matching arial to Arial, etc., but perhaps not all the issues.
-        for (availableFamily in [fontManager availableFontFamilies]) {
-            if ([desiredFamily caseInsensitiveCompare:availableFamily] == NSOrderedSame)
-                break;
+        foundFont = platformFontLookupWithFamily(family, desiredTraits, weight, size);
+        if (!foundFont)
+            return nil;
+        font = CFBridgingRelease(CFRetain(foundFont.get()));
+        availableFamily = [font familyName];
+        chosenWeight = [fontManager weightOfFont:font];
+#else
+        foundFont = platformFontWithFamily(family, desiredTraits, weight, textRenderingMode, size);
+        NSFontTraitMask desiredTraitsForNameMatch = desiredTraits | (weight >= FontWeight600 ? NSBoldFontMask : 0);
+        if (hasDesiredFamilyToAvailableFamilyMapping(family, desiredTraitsForNameMatch, availableFamily)) {
+            if (!availableFamily) {
+                // We already know the desired font family does not map to any available font family.
+                return nil;
+            }
         }
 
         if (!availableFamily) {
-            // Match by PostScript name.
-            NSFont *nameMatchedFont = nil;
-            for (NSString *availableFont in [fontManager availableFonts]) {
-                if ([desiredFamily caseInsensitiveCompare:availableFont] == NSOrderedSame) {
-                    nameMatchedFont = [NSFont fontWithName:availableFont size:size];
+            NSString *desiredFamily = family;
 
-                    // Special case Osaka-Mono. According to <rdar://problem/3999467>, we need to
-                    // treat Osaka-Mono as fixed pitch.
-                    if ([desiredFamily caseInsensitiveCompare:@"Osaka-Mono"] == NSOrderedSame && !desiredTraitsForNameMatch)
-                        return nameMatchedFont;
+            // Do a simple case insensitive search for a matching font family.
+            // NSFontManager requires exact name matches.
+            // This addresses the problem of matching arial to Arial, etc., but perhaps not all the issues.
+            for (availableFamily in [fontManager availableFontFamilies]) {
+                if ([desiredFamily caseInsensitiveCompare:availableFamily] == NSOrderedSame)
+                    break;
+            }
 
-                    NSFontTraitMask traits = [fontManager traitsOfFont:nameMatchedFont];
-                    if ((traits & desiredTraitsForNameMatch) == desiredTraitsForNameMatch)
-                        return [fontManager convertFont:nameMatchedFont toHaveTrait:desiredTraitsForNameMatch];
+            if (!availableFamily) {
+                // Match by PostScript name.
+                NSFont *nameMatchedFont = nil;
+                for (NSString *availableFont in [fontManager availableFonts]) {
+                    if ([desiredFamily caseInsensitiveCompare:availableFont] == NSOrderedSame) {
+                        nameMatchedFont = [NSFont fontWithName:availableFont size:size];
 
-                    availableFamily = [nameMatchedFont familyName];
-                    break;
+                        // Special case Osaka-Mono. According to <rdar://problem/3999467>, we need to
+                        // treat Osaka-Mono as fixed pitch.
+                        if ([desiredFamily caseInsensitiveCompare:@"Osaka-Mono"] == NSOrderedSame && !desiredTraitsForNameMatch)
+                            return nameMatchedFont;
+
+                        NSFontTraitMask traits = [fontManager traitsOfFont:nameMatchedFont];
+                        if ((traits & desiredTraitsForNameMatch) == desiredTraitsForNameMatch)
+                            return [fontManager convertFont:nameMatchedFont toHaveTrait:desiredTraitsForNameMatch];
+
+                        availableFamily = [nameMatchedFont familyName];
+                        break;
+                    }
                 }
             }
+
+            rememberDesiredFamilyToAvailableFamilyMapping(family, desiredTraitsForNameMatch, availableFamily);
+            if (!availableFamily)
+                return nil;
         }
 
-        rememberDesiredFamilyToAvailableFamilyMapping(family, desiredTraitsForNameMatch, availableFamily);
-        if (!availableFamily)
-            return nil;
-    }
+        // Found a family, now figure out what weight and traits to use.
+        bool choseFont = false;
+        chosenWeight = 0;
+        NSFontTraitMask chosenTraits = 0;
+        NSString *chosenFullName = 0;
 
-    // Found a family, now figure out what weight and traits to use.
-    bool choseFont = false;
-    chosenWeight = 0;
-    NSFontTraitMask chosenTraits = 0;
-    NSString *chosenFullName = 0;
+        int appKitDesiredWeight = toAppKitFontWeight(weight);
+        NSArray *fonts = [fontManager availableMembersOfFontFamily:availableFamily];
+        for (NSArray *fontInfo in fonts) {
+            // Array indices must be hard coded because of lame AppKit API.
+            NSString *fontFullName = [fontInfo objectAtIndex:0];
+            NSInteger fontWeight = [[fontInfo objectAtIndex:2] intValue];
+            NSFontTraitMask fontTraits = [[fontInfo objectAtIndex:3] unsignedIntValue];
 
-    int appKitDesiredWeight = toAppKitFontWeight(weight);
-    NSArray *fonts = [fontManager availableMembersOfFontFamily:availableFamily];
-    for (NSArray *fontInfo in fonts) {
-        // Array indices must be hard coded because of lame AppKit API.
-        NSString *fontFullName = [fontInfo objectAtIndex:0];
-        NSInteger fontWeight = [[fontInfo objectAtIndex:2] intValue];
-        NSFontTraitMask fontTraits = [[fontInfo objectAtIndex:3] unsignedIntValue];
+            BOOL newWinner;
+            if (!choseFont)
+                newWinner = acceptableChoice(desiredTraits, fontTraits);
+            else
+                newWinner = betterChoice(desiredTraits, appKitDesiredWeight, chosenTraits, chosenWeight, fontTraits, fontWeight);
 
-        BOOL newWinner;
-        if (!choseFont)
-            newWinner = acceptableChoice(desiredTraits, fontTraits);
-        else
-            newWinner = betterChoice(desiredTraits, appKitDesiredWeight, chosenTraits, chosenWeight, fontTraits, fontWeight);
+            if (newWinner) {
+                choseFont = YES;
+                chosenWeight = fontWeight;
+                chosenTraits = fontTraits;
+                chosenFullName = fontFullName;
 
-        if (newWinner) {
-            choseFont = YES;
-            chosenWeight = fontWeight;
-            chosenTraits = fontTraits;
-            chosenFullName = fontFullName;
-
-            if (chosenWeight == appKitDesiredWeight && (chosenTraits & IMPORTANT_FONT_TRAITS) == (desiredTraits & IMPORTANT_FONT_TRAITS))
-                break;
+                if (chosenWeight == appKitDesiredWeight && (chosenTraits & IMPORTANT_FONT_TRAITS) == (desiredTraits & IMPORTANT_FONT_TRAITS))
+                    break;
+            }
         }
-    }
 
-    if (!choseFont)
-        return nil;
+        if (!choseFont)
+            return nil;
 
-    font = [NSFont fontWithName:chosenFullName size:size];
-    auto foundFont = applyFontFeatureSettings((CTFontRef)font, nullptr, nullptr, featureSettings, variantSettings);
-    font = CFBridgingRelease(CFRetain(foundFont.get()));
+        font = [NSFont fontWithName:chosenFullName size:size];
+        auto foundFont = applyFontFeatureSettings((CTFontRef)font, nullptr, nullptr, featureSettings, variantSettings);
+        font = CFBridgingRelease(CFRetain(foundFont.get()));
+#endif        
+    }
 
-#endif
-
     if (!font)
         return nil;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to