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 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1811 ABC abcWidths; | 1811 ABC abcWidths; |
1812 if (GetCharABCWidths(hdc, stem_chars[i], stem_chars[i], &abcWidths)) { | 1812 if (GetCharABCWidths(hdc, stem_chars[i], stem_chars[i], &abcWidths)) { |
1813 int16_t width = abcWidths.abcB; | 1813 int16_t width = abcWidths.abcB; |
1814 if (width > 0 && width < min_width) { | 1814 if (width > 0 && width < min_width) { |
1815 min_width = width; | 1815 min_width = width; |
1816 info->fStemV = min_width; | 1816 info->fStemV = min_width; |
1817 } | 1817 } |
1818 } | 1818 } |
1819 } | 1819 } |
1820 | 1820 |
1821 if (perGlyphInfo & kHAdvance_PerGlyphInfo) { | |
1822 info->setGlyphWidths( | |
1823 glyphCount, | |
1824 glyphIDs, | |
1825 glyphIDsCount, | |
1826 SkAdvancedTypefaceMetrics::GetAdvance([hdc](int gId, int16_t* advanc
e) { | |
1827 // Initialize the MAT2 structure to | |
1828 // the identify transformation matrix. | |
1829 static const MAT2 mat2 = { | |
1830 SkScalarToFIXED(1), SkScalarToFIXED(0), | |
1831 SkScalarToFIXED(0), SkScalarToFIXED(1)}; | |
1832 int flags = GGO_METRICS | GGO_GLYPH_INDEX; | |
1833 GLYPHMETRICS gm; | |
1834 if (GDI_ERROR == GetGlyphOutline(hdc, gId, flags, &gm, 0, nullpt
r, &mat2)) { | |
1835 return false; | |
1836 } | |
1837 SkASSERT(advance); | |
1838 *advance = gm.gmCellIncX; | |
1839 return true; | |
1840 }) | |
1841 ); | |
1842 } | |
1843 | |
1844 Error: | 1821 Error: |
1845 ReturnInfo: | 1822 ReturnInfo: |
1846 SelectObject(hdc, savefont); | 1823 SelectObject(hdc, savefont); |
1847 DeleteObject(designFont); | 1824 DeleteObject(designFont); |
1848 DeleteObject(font); | 1825 DeleteObject(font); |
1849 DeleteDC(hdc); | 1826 DeleteDC(hdc); |
1850 | 1827 |
1851 return info; | 1828 return info; |
1852 } | 1829 } |
1853 | 1830 |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2506 | 2483 |
2507 private: | 2484 private: |
2508 SkTDArray<ENUMLOGFONTEX> fLogFontArray; | 2485 SkTDArray<ENUMLOGFONTEX> fLogFontArray; |
2509 }; | 2486 }; |
2510 | 2487 |
2511 /////////////////////////////////////////////////////////////////////////////// | 2488 /////////////////////////////////////////////////////////////////////////////// |
2512 | 2489 |
2513 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; } | 2490 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; } |
2514 | 2491 |
2515 #endif//defined(SK_BUILD_FOR_WIN32) | 2492 #endif//defined(SK_BUILD_FOR_WIN32) |
OLD | NEW |