Changeset 218616 in webkit


Ignore:
Timestamp:
Jun 20, 2017 4:52:22 PM (7 years ago)
Author:
mmaxfield@apple.com
Message:

[Cocoa] The system Japanese font cannot be italicized
https://bugs.webkit.org/show_bug.cgi?id=173300
<rdar://problem/31805407>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Items in the system font cascade list may lie about whether or not they support italics.
In order to get the truth, we need to use the physical font underlying the font in question,
because this one won't lie. Then, we can interrogate this physical font about its traits
in order to synthesize italics correctly.

Test: fast/text/system-font-japanese-synthetic-italic.html

  • platform/graphics/cocoa/FontCacheCoreText.cpp:

(WebCore::lookupFallbackFont):

  • platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:

(WebCore::FontFamilySpecificationCoreText::fontRanges):

LayoutTests:

  • fast/text/system-font-japanese-synthetic-italic-expected-mismatch.html: Added.
  • fast/text/system-font-japanese-synthetic-italic.html: Added.
  • platform/mac/TestExpectations: This codepath doesn't work in El Capitan.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r218614 r218616  
     12017-06-20  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [Cocoa] The system Japanese font cannot be italicized
     4        https://bugs.webkit.org/show_bug.cgi?id=173300
     5        <rdar://problem/31805407>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        * fast/text/system-font-japanese-synthetic-italic-expected-mismatch.html: Added.
     10        * fast/text/system-font-japanese-synthetic-italic.html: Added.
     11        * platform/mac/TestExpectations: This codepath doesn't work in El Capitan.
     12
    1132017-06-20  Ryan Haddad  <ryanhaddad@apple.com>
    214
  • trunk/LayoutTests/platform/mac/TestExpectations

    r218614 r218616  
    16061606webkit.org/b/173487 imported/w3c/web-platform-tests/IndexedDB/large-nested-cloning.html [ Pass Failure ]
    16071607
     1608webkit.org/b/313156 [ ElCapitan ] fast/text/system-font-japanese-synthetic-italic.html [ ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r218615 r218616  
     12017-06-20  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [Cocoa] The system Japanese font cannot be italicized
     4        https://bugs.webkit.org/show_bug.cgi?id=173300
     5        <rdar://problem/31805407>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Items in the system font cascade list may lie about whether or not they support italics.
     10        In order to get the truth, we need to use the physical font underlying the font in question,
     11        because this one won't lie. Then, we can interrogate this physical font about its traits
     12        in order to synthesize italics correctly.
     13
     14        Test: fast/text/system-font-japanese-synthetic-italic.html
     15
     16        * platform/graphics/cocoa/FontCacheCoreText.cpp:
     17        (WebCore::lookupFallbackFont):
     18        * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
     19        (WebCore::FontFamilySpecificationCoreText::fontRanges):
     20
    1212017-06-20  Chris Dumez  <cdumez@apple.com>
    222
  • trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp

    r218614 r218616  
    12931293
    12941294    CFIndex coveredLength = 0;
    1295     auto result = adoptCF(CTFontCreateForCharactersWithLanguage(font, characters, length, localeString.get(), &coveredLength));
     1295    RetainPtr<CTFontRef> result;
     1296#if !USE_PLATFORM_SYSTEM_FALLBACK_LIST && ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000))
     1297    result = adoptCF(CTFontCreatePhysicalFontForCharactersWithLanguage(font, characters, length, localeString.get(), &coveredLength));
     1298#else
     1299    result = adoptCF(CTFontCreateForCharactersWithLanguage(font, characters, length, localeString.get(), &coveredLength));
     1300#endif
    12961301
    12971302#if PLATFORM(IOS)
  • trunk/Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp

    r218614 r218616  
    2929#include "FontCache.h"
    3030#include "FontSelector.h"
     31#include "SoftLinking.h"
    3132#include <CoreText/CoreText.h>
     33
     34#if USE_PLATFORM_SYSTEM_FALLBACK_LIST
     35SOFT_LINK_FRAMEWORK(CoreText);
     36SOFT_LINK_MAY_FAIL(CoreText, CTFontCopyPhysicalFont, CTFontRef, (CTFontRef font), (font));
     37#endif
    3238
    3339namespace WebCore {
     
    4854    auto font = adoptCF(CTFontCreateWithFontDescriptor(m_fontDescriptor.get(), size, nullptr));
    4955
     56    auto fontForSynthesisComputation = font;
     57#if USE_PLATFORM_SYSTEM_FALLBACK_LIST
     58    if (canLoadCTFontCopyPhysicalFont()) {
     59        if (auto physicalFont = adoptCF(CTFontCopyPhysicalFont(font.get())))
     60            fontForSynthesisComputation = physicalFont;
     61    }
     62#endif
     63
    5064    font = preparePlatformFont(font.get(), fontDescription, nullptr, nullptr, { }, fontDescription.computedSize());
    5165
    5266    bool syntheticBold, syntheticOblique;
    53     std::tie(syntheticBold, syntheticOblique) = computeNecessarySynthesis(font.get(), fontDescription).boldObliquePair();
     67    std::tie(syntheticBold, syntheticOblique) = computeNecessarySynthesis(fontForSynthesisComputation.get(), fontDescription).boldObliquePair();
    5468
    5569    FontPlatformData fontPlatformData(font.get(), size, syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.textRenderingMode());
Note: See TracChangeset for help on using the changeset viewer.