| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkTypes.h" // Keep this before any #ifdef ... | 8 #include "SkTypes.h" // Keep this before any #ifdef ... |
| 9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
| 10 | 10 |
| (...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 if (perGlyphInfo & kHAdvance_PerGlyphInfo) { | 1611 if (perGlyphInfo & kHAdvance_PerGlyphInfo) { |
| 1612 if (info->fStyle & SkAdvancedTypefaceMetrics::kFixedPitch_Style) { | 1612 if (info->fStyle & SkAdvancedTypefaceMetrics::kFixedPitch_Style) { |
| 1613 SkAdvancedTypefaceMetrics::WidthRange range(0); | 1613 SkAdvancedTypefaceMetrics::WidthRange range(0); |
| 1614 range.fAdvance.append(1, &min_width); | 1614 range.fAdvance.append(1, &min_width); |
| 1615 SkAdvancedTypefaceMetrics::FinishRange( | 1615 SkAdvancedTypefaceMetrics::FinishRange( |
| 1616 &range, 0, SkAdvancedTypefaceMetrics::WidthRange::kDefault); | 1616 &range, 0, SkAdvancedTypefaceMetrics::WidthRange::kDefault); |
| 1617 info->fGlyphWidths.emplace_back(std::move(range)); | 1617 info->fGlyphWidths.emplace_back(std::move(range)); |
| 1618 } else { | 1618 } else { |
| 1619 CTFontRef borrowedCTFont = ctFont.get(); | 1619 CTFontRef borrowedCTFont = ctFont.get(); |
| 1620 info->setGlyphWidths( | 1620 info->setGlyphWidths( |
| 1621 SkToInt(glyphCount), glyphIDs, glyphIDsCount, | 1621 SkToInt(glyphCount), |
| 1622 SkAdvancedTypefaceMetrics::GetAdvance( | 1622 glyphIDs, |
| 1623 [borrowedCTFont](int gId, int16_t* data) { | 1623 glyphIDsCount, |
| 1624 CGSize advance; | 1624 SkAdvancedTypefaceMetrics::GetAdvance([borrowedCTFont](int gId,
int16_t* data) { |
| 1625 advance.width = 0; | 1625 CGSize advance; |
| 1626 CGGlyph glyph = gId; | 1626 advance.width = 0; |
| 1627 CTFontGetAdvancesForGlyphs( | 1627 CGGlyph glyph = gId; |
| 1628 borrowedCTFont, kCTFontHorizontalOrientation
, | 1628 CTFontGetAdvancesForGlyphs(borrowedCTFont, kCTFontHorizontal
Orientation, |
| 1629 &glyph, &advance, 1); | 1629 &glyph, &advance, 1); |
| 1630 *data = sk_float_round2int(advance.width); | 1630 *data = sk_float_round2int(advance.width); |
| 1631 return true; | 1631 return true; |
| 1632 })); | 1632 }) |
| 1633 ); |
| 1633 } | 1634 } |
| 1634 } | 1635 } |
| 1635 return info; | 1636 return info; |
| 1636 } | 1637 } |
| 1637 | 1638 |
| 1638 /////////////////////////////////////////////////////////////////////////////// | 1639 /////////////////////////////////////////////////////////////////////////////// |
| 1639 | 1640 |
| 1640 static SK_SFNT_ULONG get_font_type_tag(const SkTypeface_Mac* typeface) { | 1641 static SK_SFNT_ULONG get_font_type_tag(const SkTypeface_Mac* typeface) { |
| 1641 CTFontRef ctFont = typeface->fFontRef.get(); | 1642 CTFontRef ctFont = typeface->fFontRef.get(); |
| 1642 AutoCFRelease<CFNumberRef> fontFormatRef( | 1643 AutoCFRelease<CFNumberRef> fontFormatRef( |
| (...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2575 | 2576 |
| 2576 return SkSafeRef(GetDefaultFace()); | 2577 return SkSafeRef(GetDefaultFace()); |
| 2577 } | 2578 } |
| 2578 }; | 2579 }; |
| 2579 | 2580 |
| 2580 /////////////////////////////////////////////////////////////////////////////// | 2581 /////////////////////////////////////////////////////////////////////////////// |
| 2581 | 2582 |
| 2582 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } | 2583 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } |
| 2583 | 2584 |
| 2584 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 2585 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
| OLD | NEW |