OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
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 #undef GetGlyphIndices | 9 #undef GetGlyphIndices |
10 | 10 |
(...skipping 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 | 1782 |
1783 if (NULL == fontFamily.get()) { | 1783 if (NULL == fontFamily.get()) { |
1784 // No family with given name, try default. | 1784 // No family with given name, try default. |
1785 HRNM(this->getDefaultFontFamily(&fontFamily), "Could not get default fon
t family."); | 1785 HRNM(this->getDefaultFontFamily(&fontFamily), "Could not get default fon
t family."); |
1786 } | 1786 } |
1787 | 1787 |
1788 SkTScopedComPtr<IDWriteFont> font; | 1788 SkTScopedComPtr<IDWriteFont> font; |
1789 DWRITE_FONT_WEIGHT weight = (styleBits & SkTypeface::kBold) | 1789 DWRITE_FONT_WEIGHT weight = (styleBits & SkTypeface::kBold) |
1790 ? DWRITE_FONT_WEIGHT_BOLD | 1790 ? DWRITE_FONT_WEIGHT_BOLD |
1791 : DWRITE_FONT_WEIGHT_NORMAL; | 1791 : DWRITE_FONT_WEIGHT_NORMAL; |
1792 DWRITE_FONT_STRETCH stretch = DWRITE_FONT_STRETCH_UNDEFINED; | 1792 DWRITE_FONT_STRETCH stretch = DWRITE_FONT_STRETCH_NORMAL; |
1793 DWRITE_FONT_STYLE italic = (styleBits & SkTypeface::kItalic) | 1793 DWRITE_FONT_STYLE italic = (styleBits & SkTypeface::kItalic) |
1794 ? DWRITE_FONT_STYLE_ITALIC | 1794 ? DWRITE_FONT_STYLE_ITALIC |
1795 : DWRITE_FONT_STYLE_NORMAL; | 1795 : DWRITE_FONT_STYLE_NORMAL; |
1796 HRNM(fontFamily->GetFirstMatchingFont(weight, stretch, italic, &font), | 1796 HRNM(fontFamily->GetFirstMatchingFont(weight, stretch, italic, &font), |
1797 "Could not get matching font."); | 1797 "Could not get matching font."); |
1798 | 1798 |
1799 SkTScopedComPtr<IDWriteFontFace> fontFace; | 1799 SkTScopedComPtr<IDWriteFontFace> fontFace; |
1800 HRNM(font->CreateFontFace(&fontFace), "Could not create font face."); | 1800 HRNM(font->CreateFontFace(&fontFace), "Could not create font face."); |
1801 | 1801 |
1802 return this->createTypefaceFromDWriteFont(fontFace.get(), font.get(), fontFa
mily.get()); | 1802 return this->createTypefaceFromDWriteFont(fontFace.get(), font.get(), fontFa
mily.get()); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 SK_TRACEHR(hr, "Could not get GetUserDefaultLocaleName."); | 1912 SK_TRACEHR(hr, "Could not get GetUserDefaultLocaleName."); |
1913 } else { | 1913 } else { |
1914 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); | 1914 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); |
1915 if (localeNameLen) { | 1915 if (localeNameLen) { |
1916 localeName = localeNameStorage; | 1916 localeName = localeNameStorage; |
1917 }; | 1917 }; |
1918 } | 1918 } |
1919 | 1919 |
1920 return SkNEW_ARGS(SkFontMgr_DirectWrite, (sysFontCollection.get(), localeNam
e, localeNameLen)); | 1920 return SkNEW_ARGS(SkFontMgr_DirectWrite, (sysFontCollection.get(), localeNam
e, localeNameLen)); |
1921 } | 1921 } |
OLD | NEW |