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" | 8 #include "SkTypes.h" |
9 #if defined(SK_BUILD_FOR_WIN32) | 9 #if defined(SK_BUILD_FOR_WIN32) |
10 | 10 |
(...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 | 1819 |
1820 if (perGlyphInfo & kHAdvance_PerGlyphInfo) { | 1820 if (perGlyphInfo & kHAdvance_PerGlyphInfo) { |
1821 if (info->fStyle & SkAdvancedTypefaceMetrics::kFixedPitch_Style) { | 1821 if (info->fStyle & SkAdvancedTypefaceMetrics::kFixedPitch_Style) { |
1822 SkAdvancedTypefaceMetrics::WidthRange range(0); | 1822 SkAdvancedTypefaceMetrics::WidthRange range(0); |
1823 range.fAdvance.append(1, &min_width); | 1823 range.fAdvance.append(1, &min_width); |
1824 SkAdvancedTypefaceMetrics::FinishRange( | 1824 SkAdvancedTypefaceMetrics::FinishRange( |
1825 &range, 0, SkAdvancedTypefaceMetrics::WidthRange::kDefault); | 1825 &range, 0, SkAdvancedTypefaceMetrics::WidthRange::kDefault); |
1826 info->fGlyphWidths.emplace_back(std::move(range)); | 1826 info->fGlyphWidths.emplace_back(std::move(range)); |
1827 } else { | 1827 } else { |
1828 info->setGlyphWidths( | 1828 info->setGlyphWidths( |
1829 glyphCount, glyphIDs, glyphIDsCount, | 1829 glyphCount, |
1830 SkAdvancedTypefaceMetrics::GetAdvance( | 1830 glyphIDs, |
1831 [hdc](int gId, int16_t* advance) { | 1831 glyphIDsCount, |
1832 // Initialize the MAT2 structure to | 1832 SkAdvancedTypefaceMetrics::GetAdvance([hdc](int gId, int16_t* ad
vance) { |
1833 // the identify transformation matrix. | 1833 // Initialize the MAT2 structure to |
1834 static const MAT2 mat2 = { | 1834 // the identify transformation matrix. |
1835 SkScalarToFIXED(1), SkScalarToFIXED(0), | 1835 static const MAT2 mat2 = { |
1836 SkScalarToFIXED(0), SkScalarToFIXED(1)}; | 1836 SkScalarToFIXED(1), SkScalarToFIXED(0), |
1837 int flags = GGO_METRICS | GGO_GLYPH_INDEX; | 1837 SkScalarToFIXED(0), SkScalarToFIXED(1)}; |
1838 GLYPHMETRICS gm; | 1838 int flags = GGO_METRICS | GGO_GLYPH_INDEX; |
1839 if (GDI_ERROR == GetGlyphOutline( | 1839 GLYPHMETRICS gm; |
1840 hdc, gId, flags, &gm, 0, nullptr, &m
at2)) { | 1840 if (GDI_ERROR == GetGlyphOutline(hdc, gId, flags, &gm, 0, nu
llptr, &mat2)) { |
1841 return false; | 1841 return false; |
1842 } | 1842 } |
1843 SkASSERT(advance); | 1843 SkASSERT(advance); |
1844 *advance = gm.gmCellIncX; | 1844 *advance = gm.gmCellIncX; |
1845 return true; | 1845 return true; |
1846 })); | 1846 }) |
| 1847 ); |
1847 } | 1848 } |
1848 } | 1849 } |
1849 | 1850 |
1850 Error: | 1851 Error: |
1851 ReturnInfo: | 1852 ReturnInfo: |
1852 SelectObject(hdc, savefont); | 1853 SelectObject(hdc, savefont); |
1853 DeleteObject(designFont); | 1854 DeleteObject(designFont); |
1854 DeleteObject(font); | 1855 DeleteObject(font); |
1855 DeleteDC(hdc); | 1856 DeleteDC(hdc); |
1856 | 1857 |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2512 | 2513 |
2513 private: | 2514 private: |
2514 SkTDArray<ENUMLOGFONTEX> fLogFontArray; | 2515 SkTDArray<ENUMLOGFONTEX> fLogFontArray; |
2515 }; | 2516 }; |
2516 | 2517 |
2517 /////////////////////////////////////////////////////////////////////////////// | 2518 /////////////////////////////////////////////////////////////////////////////// |
2518 | 2519 |
2519 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; } | 2520 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; } |
2520 | 2521 |
2521 #endif//defined(SK_BUILD_FOR_WIN32) | 2522 #endif//defined(SK_BUILD_FOR_WIN32) |
OLD | NEW |