| 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 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1612 int16_t width = (int16_t) boundingRects[i].size.width; | 1612 int16_t width = (int16_t) boundingRects[i].size.width; |
| 1613 if (width > 0 && width < min_width) { | 1613 if (width > 0 && width < min_width) { |
| 1614 min_width = width; | 1614 min_width = width; |
| 1615 info->fStemV = min_width; | 1615 info->fStemV = min_width; |
| 1616 } | 1616 } |
| 1617 } | 1617 } |
| 1618 } | 1618 } |
| 1619 | 1619 |
| 1620 if (perGlyphInfo & kHAdvance_PerGlyphInfo) { | 1620 if (perGlyphInfo & kHAdvance_PerGlyphInfo) { |
| 1621 if (info->fStyle & SkAdvancedTypefaceMetrics::kFixedPitch_Style) { | 1621 if (info->fStyle & SkAdvancedTypefaceMetrics::kFixedPitch_Style) { |
| 1622 skia_advanced_typeface_metrics_utils::appendRange(&info->fGlyphWidth
s, 0); | 1622 SkAdvancedTypefaceMetrics::WidthRange range(0); |
| 1623 info->fGlyphWidths->fAdvance.append(1, &min_width); | 1623 range.fAdvance.append(1, &min_width); |
| 1624 skia_advanced_typeface_metrics_utils::finishRange(info->fGlyphWidths
.get(), 0, | 1624 SkAdvancedTypefaceMetrics::FinishRange( |
| 1625 SkAdvancedTypefaceMetrics::WidthRange::kDefault); | 1625 &range, 0, SkAdvancedTypefaceMetrics::WidthRange::kDefault); |
| 1626 info->fGlyphWidths.emplace_back(std::move(range)); |
| 1626 } else { | 1627 } else { |
| 1627 info->fGlyphWidths.reset( | 1628 info->setGlyphWidths(ctFont.get(), SkToInt(glyphCount), glyphIDs, |
| 1628 skia_advanced_typeface_metrics_utils::getAdvanceData(ctFont.get(
), | 1629 glyphIDsCount, &getWidthAdvance); |
| 1629 SkToInt(glyphCount), | |
| 1630 glyphIDs, | |
| 1631 glyphIDsCount, | |
| 1632 &getWidthAdvance)); | |
| 1633 } | 1630 } |
| 1634 } | 1631 } |
| 1635 return info; | 1632 return info; |
| 1636 } | 1633 } |
| 1637 | 1634 |
| 1638 /////////////////////////////////////////////////////////////////////////////// | 1635 /////////////////////////////////////////////////////////////////////////////// |
| 1639 | 1636 |
| 1640 static SK_SFNT_ULONG get_font_type_tag(const SkTypeface_Mac* typeface) { | 1637 static SK_SFNT_ULONG get_font_type_tag(const SkTypeface_Mac* typeface) { |
| 1641 CTFontRef ctFont = typeface->fFontRef.get(); | 1638 CTFontRef ctFont = typeface->fFontRef.get(); |
| 1642 AutoCFRelease<CFNumberRef> fontFormatRef( | 1639 AutoCFRelease<CFNumberRef> fontFormatRef( |
| (...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2575 | 2572 |
| 2576 return SkSafeRef(GetDefaultFace()); | 2573 return SkSafeRef(GetDefaultFace()); |
| 2577 } | 2574 } |
| 2578 }; | 2575 }; |
| 2579 | 2576 |
| 2580 /////////////////////////////////////////////////////////////////////////////// | 2577 /////////////////////////////////////////////////////////////////////////////// |
| 2581 | 2578 |
| 2582 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } | 2579 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } |
| 2583 | 2580 |
| 2584 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 2581 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
| OLD | NEW |