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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
702 | 702 |
703 return wcscmp(dwFaceFontFamilyNameChar.get(), dwFontFamilyNameChar.get()) == 0 && | 703 return wcscmp(dwFaceFontFamilyNameChar.get(), dwFontFamilyNameChar.get()) == 0 && |
704 wcscmp(dwFaceFontNameChar.get(), dwFontNameChar.get()) == 0; | 704 wcscmp(dwFaceFontNameChar.get(), dwFontNameChar.get()) == 0; |
705 } | 705 } |
706 | 706 |
707 SkTypeface* SkCreateTypefaceFromDWriteFont(IDWriteFontFace* fontFace, | 707 SkTypeface* SkCreateTypefaceFromDWriteFont(IDWriteFontFace* fontFace, |
708 IDWriteFont* font, | 708 IDWriteFont* font, |
709 IDWriteFontFamily* fontFamily, | 709 IDWriteFontFamily* fontFamily, |
710 StreamFontFileLoader* fontFileLoader = NULL, | 710 StreamFontFileLoader* fontFileLoader = NULL, |
711 IDWriteFontCollectionLoader* fontColl ectionLoader = NULL) { | 711 IDWriteFontCollectionLoader* fontColl ectionLoader = NULL) { |
712 SkTypeface* face = SkTypefaceCache::FindByProcAndRef(FindByDWriteFont, font) ; | 712 SkTypeface* face = NULL; //SkTypefaceCache::FindByProcAndRef(FindByDWriteFon t, font); |
bungeman-skia
2013/08/13 13:51:54
Need a todo to use a local cache.
reed1
2013/08/13 15:28:27
Done.
| |
713 if (NULL == face) { | 713 if (NULL == face) { |
714 face = DWriteFontTypeface::Create(fontFace, font, fontFamily, | 714 face = DWriteFontTypeface::Create(fontFace, font, fontFamily, |
715 fontFileLoader, fontCollectionLoader); | 715 fontFileLoader, fontCollectionLoader); |
716 SkTypefaceCache::Add(face, get_style(font), fontCollectionLoader != NULL ); | 716 SkTypefaceCache::Add(face, get_style(font), fontCollectionLoader != NULL ); |
bungeman-skia
2013/08/13 13:51:54
Does this need to be commented out as well? This w
reed1
2013/08/13 15:28:27
Done.
| |
717 } | 717 } |
718 return face; | 718 return face; |
719 } | 719 } |
720 | 720 |
721 void SkDWriteFontFromTypeface(const SkTypeface* face, IDWriteFont** font) { | 721 void SkDWriteFontFromTypeface(const SkTypeface* face, IDWriteFont** font) { |
722 if (NULL == face) { | 722 if (NULL == face) { |
723 HRVM(get_default_font(font), "Could not get default font."); | 723 HRVM(get_default_font(font), "Could not get default font."); |
724 } else { | 724 } else { |
725 *font = SkRefComPtr(static_cast<const DWriteFontTypeface*>(face)->fDWrit eFont.get()); | 725 *font = SkRefComPtr(static_cast<const DWriteFontTypeface*>(face)->fDWrit eFont.get()); |
726 } | 726 } |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1843 printf("SkFontHost::CreateTypefaceFromFile unimplemented"); | 1843 printf("SkFontHost::CreateTypefaceFromFile unimplemented"); |
1844 return NULL; | 1844 return NULL; |
1845 } | 1845 } |
1846 | 1846 |
1847 SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) { | 1847 SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) { |
1848 return create_from_stream(stream, 0); | 1848 return create_from_stream(stream, 0); |
1849 } | 1849 } |
1850 | 1850 |
1851 #endif | 1851 #endif |
1852 | 1852 |
1853 SkFontMgr* SkFontMgr::Factory() { | 1853 extern SkFontMgr* SkFontMgr_New_DirectWrite(); |
1854 SkFontMgr* SkFontMgr_New_DirectWrite() { | |
1854 IDWriteFactory* factory; | 1855 IDWriteFactory* factory; |
1855 HRNM(get_dwrite_factory(&factory), "Could not get factory."); | 1856 HRNM(get_dwrite_factory(&factory), "Could not get factory."); |
1856 | 1857 |
1857 SkTScopedComPtr<IDWriteFontCollection> sysFontCollection; | 1858 SkTScopedComPtr<IDWriteFontCollection> sysFontCollection; |
1858 HRNM(factory->GetSystemFontCollection(&sysFontCollection, FALSE), | 1859 HRNM(factory->GetSystemFontCollection(&sysFontCollection, FALSE), |
1859 "Could not get system font collection."); | 1860 "Could not get system font collection."); |
1860 | 1861 |
1861 WCHAR localeNameStorage[LOCALE_NAME_MAX_LENGTH]; | 1862 WCHAR localeNameStorage[LOCALE_NAME_MAX_LENGTH]; |
1862 WCHAR* localeName = NULL; | 1863 WCHAR* localeName = NULL; |
1863 int localeNameLen = GetUserDefaultLocaleName(localeNameStorage, LOCALE_NAME_ MAX_LENGTH); | 1864 int localeNameLen = GetUserDefaultLocaleName(localeNameStorage, LOCALE_NAME_ MAX_LENGTH); |
1864 if (localeNameLen) { | 1865 if (localeNameLen) { |
1865 localeName = localeNameStorage; | 1866 localeName = localeNameStorage; |
1866 }; | 1867 }; |
1867 | 1868 |
1868 return SkNEW_ARGS(SkFontMgr_DirectWrite, (sysFontCollection.get(), localeNam e, localeNameLen)); | 1869 return SkNEW_ARGS(SkFontMgr_DirectWrite, (sysFontCollection.get(), localeNam e, localeNameLen)); |
1869 } | 1870 } |
1871 | |
OLD | NEW |