OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkDWrite.h" | 8 #include "SkDWrite.h" |
9 #include "SkDWriteFontFileStream.h" | 9 #include "SkDWriteFontFileStream.h" |
10 #include "SkFontMgr.h" | 10 #include "SkFontMgr.h" |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 "Could not match font in family."); | 721 "Could not match font in family."); |
722 | 722 |
723 SkTScopedComPtr<IDWriteFontFace> fontFace; | 723 SkTScopedComPtr<IDWriteFontFace> fontFace; |
724 HRNM(font->CreateFontFace(&fontFace), "Could not create font face."); | 724 HRNM(font->CreateFontFace(&fontFace), "Could not create font face."); |
725 | 725 |
726 return fFontMgr->createTypefaceFromDWriteFont(fontFace.get(), font.get(), | 726 return fFontMgr->createTypefaceFromDWriteFont(fontFace.get(), font.get(), |
727 fFontFamily.get()); | 727 fFontFamily.get()); |
728 } | 728 } |
729 | 729 |
730 //////////////////////////////////////////////////////////////////////////////// | 730 //////////////////////////////////////////////////////////////////////////////// |
| 731 #include "SkTypeface_win.h" |
731 | 732 |
732 SkFontMgr* SkFontMgr_New_DirectWrite(IDWriteFactory* factory) { | 733 SK_API SkFontMgr* SkFontMgr_New_DirectWrite(IDWriteFactory* factory) { |
733 if (NULL == factory) { | 734 if (NULL == factory) { |
734 factory = sk_get_dwrite_factory(); | 735 factory = sk_get_dwrite_factory(); |
735 if (NULL == factory) { | 736 if (NULL == factory) { |
736 return NULL; | 737 return NULL; |
737 } | 738 } |
738 } | 739 } |
739 | 740 |
740 SkTScopedComPtr<IDWriteFontCollection> sysFontCollection; | 741 SkTScopedComPtr<IDWriteFontCollection> sysFontCollection; |
741 HRNM(factory->GetSystemFontCollection(&sysFontCollection, FALSE), | 742 HRNM(factory->GetSystemFontCollection(&sysFontCollection, FALSE), |
742 "Could not get system font collection."); | 743 "Could not get system font collection."); |
(...skipping 11 matching lines...) Expand all Loading... |
754 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); | 755 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); |
755 if (localeNameLen) { | 756 if (localeNameLen) { |
756 localeName = localeNameStorage; | 757 localeName = localeNameStorage; |
757 }; | 758 }; |
758 } | 759 } |
759 | 760 |
760 return SkNEW_ARGS(SkFontMgr_DirectWrite, (factory, sysFontCollection.get(), | 761 return SkNEW_ARGS(SkFontMgr_DirectWrite, (factory, sysFontCollection.get(), |
761 localeName, localeNameLen)); | 762 localeName, localeNameLen)); |
762 } | 763 } |
763 | 764 |
764 //////////////////////////////////////////////////////////////////////////////// | |
765 | |
766 #include "SkFontMgr_indirect.h" | 765 #include "SkFontMgr_indirect.h" |
767 #include "SkTypeface_win.h" | 766 SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { |
768 SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { | |
769 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite()); | 767 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite()); |
770 if (impl.get() == NULL) { | 768 if (impl.get() == NULL) { |
771 return NULL; | 769 return NULL; |
772 } | 770 } |
773 return SkNEW_ARGS(SkFontMgr_Indirect, (impl.get(), proxy)); | 771 return SkNEW_ARGS(SkFontMgr_Indirect, (impl.get(), proxy)); |
774 } | 772 } |
OLD | NEW |