| Differences between
and this patch
- a/Source/WebCore/ChangeLog +12 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2016-09-07  Myles C. Maxfield  <mmaxfield@apple.com>
2
3
        [Cocoa] Improve performance of glyph advance metrics gathering
4
        https://bugs.webkit.org/show_bug.cgi?id=161119
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        No new tests (OOPS!).
9
10
        * platform/graphics/cocoa/FontCocoa.mm:
11
        (WebCore::Font::platformWidthForGlyph):
12
1
2016-09-06  Commit Queue  <commit-queue@webkit.org>
13
2016-09-06  Commit Queue  <commit-queue@webkit.org>
2
14
3
        Unreviewed, rolling out r205521, r205526, and r205532.
15
        Unreviewed, rolling out r205521, r205526, and r205532.
- a/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm -1 / +17 lines
Lines 596-601 FloatRect Font::platformBoundsForGlyph(Glyph glyph) const a/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm_sec1
596
    return boundingBox;
596
    return boundingBox;
597
}
597
}
598
598
599
#if !((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000))
599
static inline Optional<CGSize> advanceForColorBitmapFont(const FontPlatformData& platformData, Glyph glyph)
600
static inline Optional<CGSize> advanceForColorBitmapFont(const FontPlatformData& platformData, Glyph glyph)
600
{
601
{
601
    CTFontRef font = platformData.font();
602
    CTFontRef font = platformData.font();
Lines 617-632 static inline bool canUseFastGlyphAdvanceGetter(const FontPlatformData& platform a/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm_sec2
617
    }
618
    }
618
    return true;
619
    return true;
619
}
620
}
621
#endif
620
622
621
float Font::platformWidthForGlyph(Glyph glyph) const
623
float Font::platformWidthForGlyph(Glyph glyph) const
622
{
624
{
623
    CGSize advance = CGSizeZero;
625
    CGSize advance = CGSizeZero;
624
    bool horizontal = platformData().orientation() == Horizontal;
626
    bool horizontal = platformData().orientation() == Horizontal;
627
    CGFontRenderingStyle style = kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization | kCGFontAntialiasingStyleUnfiltered;
628
629
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000)
630
    if (platformData().size()) {
631
        CTFontOrientation orientation = horizontal || m_isBrokenIdeographFallback ? kCTFontOrientationHorizontal : kCTFontOrientationVertical;
632
        // FIXME: Remove this special-casing when <rdar://problem/28197291> is fixed.
633
        if (CTFontIsAppleColorEmoji(m_platformData.ctFont()))
634
            CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), orientation, &glyph, &advance, 1);
635
        else
636
            CTFontGetUnsummedAdvancesForGlyphsAndStyle(m_platformData.ctFont(), orientation, style, &glyph, &advance, 1);
637
    }
638
639
#else
640
625
    bool populatedAdvance = false;
641
    bool populatedAdvance = false;
626
    if ((horizontal || m_isBrokenIdeographFallback) && canUseFastGlyphAdvanceGetter(this->platformData(), glyph, advance, populatedAdvance)) {
642
    if ((horizontal || m_isBrokenIdeographFallback) && canUseFastGlyphAdvanceGetter(this->platformData(), glyph, advance, populatedAdvance)) {
627
        float pointSize = platformData().size();
643
        float pointSize = platformData().size();
628
        CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSize);
644
        CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSize);
629
        CGFontRenderingStyle style = kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization | kCGFontAntialiasingStyleUnfiltered;
630
        if (!CGFontGetGlyphAdvancesForStyle(platformData().cgFont(), &m, style, &glyph, 1, &advance)) {
645
        if (!CGFontGetGlyphAdvancesForStyle(platformData().cgFont(), &m, style, &glyph, 1, &advance)) {
631
            RetainPtr<CFStringRef> fullName = adoptCF(CGFontCopyFullName(platformData().cgFont()));
646
            RetainPtr<CFStringRef> fullName = adoptCF(CGFontCopyFullName(platformData().cgFont()));
632
            LOG_ERROR("Unable to cache glyph widths for %@ %f", fullName.get(), pointSize);
647
            LOG_ERROR("Unable to cache glyph widths for %@ %f", fullName.get(), pointSize);
Lines 634-639 float Font::platformWidthForGlyph(Glyph glyph) const a/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm_sec3
634
        }
649
        }
635
    } else if (!populatedAdvance && platformData().size())
650
    } else if (!populatedAdvance && platformData().size())
636
        CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), horizontal ? kCTFontOrientationHorizontal : kCTFontOrientationVertical, &glyph, &advance, 1);
651
        CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), horizontal ? kCTFontOrientationHorizontal : kCTFontOrientationVertical, &glyph, &advance, 1);
652
#endif
637
653
638
    return advance.width + m_syntheticBoldOffset;
654
    return advance.width + m_syntheticBoldOffset;
639
}
655
}

Return to Bug 161119