|
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 |
CTFontGetUnsummedAdvancesForGlyphsAndStyle(m_platformData.ctFont(), horizontal || m_isBrokenIdeographFallback ? kCTFontOrientationHorizontal : kCTFontOrientationVertical, style, &glyph, &advance, 1); |
| 632 |
|
| 633 |
#else |
| 634 |
|
| 625 |
bool populatedAdvance = false; |
635 |
bool populatedAdvance = false; |
| 626 |
if ((horizontal || m_isBrokenIdeographFallback) && canUseFastGlyphAdvanceGetter(this->platformData(), glyph, advance, populatedAdvance)) { |
636 |
if ((horizontal || m_isBrokenIdeographFallback) && canUseFastGlyphAdvanceGetter(this->platformData(), glyph, advance, populatedAdvance)) { |
| 627 |
float pointSize = platformData().size(); |
637 |
float pointSize = platformData().size(); |
| 628 |
CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSize); |
638 |
CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSize); |
| 629 |
CGFontRenderingStyle style = kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization | kCGFontAntialiasingStyleUnfiltered; |
|
|
| 630 |
if (!CGFontGetGlyphAdvancesForStyle(platformData().cgFont(), &m, style, &glyph, 1, &advance)) { |
639 |
if (!CGFontGetGlyphAdvancesForStyle(platformData().cgFont(), &m, style, &glyph, 1, &advance)) { |
| 631 |
RetainPtr<CFStringRef> fullName = adoptCF(CGFontCopyFullName(platformData().cgFont())); |
640 |
RetainPtr<CFStringRef> fullName = adoptCF(CGFontCopyFullName(platformData().cgFont())); |
| 632 |
LOG_ERROR("Unable to cache glyph widths for %@ %f", fullName.get(), pointSize); |
641 |
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 |
} |
643 |
} |
| 635 |
} else if (!populatedAdvance && platformData().size()) |
644 |
} else if (!populatedAdvance && platformData().size()) |
| 636 |
CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), horizontal ? kCTFontOrientationHorizontal : kCTFontOrientationVertical, &glyph, &advance, 1); |
645 |
CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), horizontal ? kCTFontOrientationHorizontal : kCTFontOrientationVertical, &glyph, &advance, 1); |
|
|
646 |
#endif |
| 637 |
|
647 |
|
| 638 |
return advance.width + m_syntheticBoldOffset; |
648 |
return advance.width + m_syntheticBoldOffset; |
| 639 |
} |
649 |
} |