⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 204107 in webkit


Ignore:
Timestamp:
Aug 3, 2016, 4:50:19 PM (10 years ago)
Author:
mmaxfield@apple.com
Message:

[iOS] SF-Heavy is not accessible from web content
​https://bugs.webkit.org/show_bug.cgi?id=160522
<rdar://problem/27685273>

Reviewed by Simon Fraser.

Source/WebCore:

The mappings we were using from CSS font-weight to CoreText font weight were inaccurate.
Instead, these new mappings should be used.

Test: fast/text/system-font-weight.html

  • platform/graphics/ios/FontCacheIOS.mm:

(WebCore::systemFontModificationAttributes):

LayoutTests:

  • platform/ios-simulator/fast/text/system-font-weight-expected.txt: iOS 9 is not

expected to pass this test, but there is no way to specify that currently using
TestExpectations. Instead, we can create an iOS 9 specific result.

  • fast/text/system-font-weight-expected.txt:
  • fast/text/system-font-weight.html:
Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r204096 r204107  
     12016-08-03  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [iOS] SF-Heavy is not accessible from web content
     4        https://bugs.webkit.org/show_bug.cgi?id=160522
     5        <rdar://problem/27685273>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * platform/ios-simulator/fast/text/system-font-weight-expected.txt: iOS 9 is not
     10        expected to pass this test, but there is no way to specify that currently using
     11        TestExpectations. Instead, we can create an iOS 9 specific result.
     12        * fast/text/system-font-weight-expected.txt:
     13        * fast/text/system-font-weight.html:
     14
    1152016-08-03  Ryan Haddad  <ryanhaddad@apple.com>
    216
  • trunk/LayoutTests/fast/text/system-font-weight-expected.txt

    r203764 r204107  
    44
    55
    6 PASS six.offsetWidth is not nine.offsetWidth
     6PASS four.offsetWidth is not three.offsetWidth
     7PASS five.offsetWidth is not four.offsetWidth
     8PASS six.offsetWidth is not five.offsetWidth
     9PASS eight.offsetWidth is not seven.offsetWidth
    710PASS successfullyParsed is true
    811
    912TEST COMPLETE
    10 Hello, WorldHello, World
     13Hello, World
     14Hello, World
     15Hello, World
     16Hello, World
     17Hello, World
     18Hello, World
     19Hello, World
     20Hello, World
     21Hello, World
  • trunk/LayoutTests/fast/text/system-font-weight.html

    r203764 r204107  
    66<body>
    77<div style="font: 19px -apple-system">
    8 <span id="six" style="font-weight: 600;">Hello, World</span><span id="nine" style="font-weight: 900;">Hello, World</span>
     8<div><span id="one" style="font-weight: 100;">Hello, World</span></div>
     9<div><span id="two" style="font-weight: 200;">Hello, World</span></div>
     10<div><span id="three" style="font-weight: 300;">Hello, World</span></div>
     11<div><span id="four" style="font-weight: 400;">Hello, World</span></div>
     12<div><span id="five" style="font-weight: 500;">Hello, World</span></div>
     13<div><span id="six" style="font-weight: 600;">Hello, World</span></div>
     14<div><span id="seven" style="font-weight: 700;">Hello, World</span></div>
     15<div><span id="eight" style="font-weight: 800;">Hello, World</span></div>
     16<div><span id="nine" style="font-weight: 900;">Hello, World</span></div>
    917</div>
    1018<script>
    1119description("This test makes sure that extra-heavy weights of the system font can be achieved.");
     20var one = document.getElementById("one");
     21var two = document.getElementById("two");
     22var three = document.getElementById("three");
     23var four = document.getElementById("four");
     24var five = document.getElementById("five");
    1225var six = document.getElementById("six");
     26var seven = document.getElementById("seven");
     27var eight = document.getElementById("eight");
    1328var nine = document.getElementById("nine");
    14 shouldNotBe("six.offsetWidth", "nine.offsetWidth");
     29shouldNotBe("four.offsetWidth", "three.offsetWidth");
     30shouldNotBe("five.offsetWidth", "four.offsetWidth");
     31shouldNotBe("six.offsetWidth", "five.offsetWidth");
     32shouldNotBe("eight.offsetWidth", "seven.offsetWidth");
    1533</script>
    1634<script src="../../resources/js-test-post.js"></script>
  • trunk/Source/WebCore/ChangeLog

    r204104 r204107  
     12016-08-03  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [iOS] SF-Heavy is not accessible from web content
     4        https://bugs.webkit.org/show_bug.cgi?id=160522
     5        <rdar://problem/27685273>
     6
     7        Reviewed by Simon Fraser.
     8
     9        The mappings we were using from CSS font-weight to CoreText font weight were inaccurate.
     10        Instead, these new mappings should be used.
     11
     12        Test: fast/text/system-font-weight.html
     13
     14        * platform/graphics/ios/FontCacheIOS.mm:
     15        (WebCore::systemFontModificationAttributes):
     16
    1172016-08-03  Anders Carlsson  <andersca@apple.com>
    218
  • trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm

    r203764 r204107  
    156156
    157157    ASSERT(weight >= FontWeight100 && weight <= FontWeight900);
    158     float ctWeights[] = { -0.7, -0.5, -0.23, 0, 0.2, 0.3, 0.4, 0.6, 0.8 };
     158    float ctWeights[] = {
     159        static_cast<float>(kCTFontWeightUltraLight),
     160        static_cast<float>(kCTFontWeightThin),
     161        static_cast<float>(kCTFontWeightLight),
     162        static_cast<float>(kCTFontWeightRegular),
     163        static_cast<float>(kCTFontWeightMedium),
     164        static_cast<float>(kCTFontWeightSemibold),
     165        static_cast<float>(kCTFontWeightBold),
     166        static_cast<float>(kCTFontWeightHeavy),
     167        static_cast<float>(kCTFontWeightBlack)
     168    };
    159169    [traitsDictionary setObject:[NSNumber numberWithFloat:ctWeights[weight]] forKey:static_cast<NSString *>(kCTFontWeightTrait)];
    160170
Note: See TracChangeset for help on using the changeset viewer.