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 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1892 if (!*proc) { | 1892 if (!*proc) { |
1893 HRESULT hr = HRESULT_FROM_WIN32(GetLastError()); | 1893 HRESULT hr = HRESULT_FROM_WIN32(GetLastError()); |
1894 if (!IS_ERROR(hr)) { | 1894 if (!IS_ERROR(hr)) { |
1895 hr = ERROR_PROC_NOT_FOUND; | 1895 hr = ERROR_PROC_NOT_FOUND; |
1896 } | 1896 } |
1897 return hr; | 1897 return hr; |
1898 } | 1898 } |
1899 return S_OK; | 1899 return S_OK; |
1900 } | 1900 } |
1901 | 1901 |
1902 extern SkFontMgr* SkFontMgr_New_DirectWrite(); | |
1903 SkFontMgr* SkFontMgr_New_DirectWrite() { | 1902 SkFontMgr* SkFontMgr_New_DirectWrite() { |
1904 IDWriteFactory* factory; | 1903 IDWriteFactory* factory; |
1905 HRNM(get_dwrite_factory(&factory), "Could not get factory."); | 1904 HRNM(get_dwrite_factory(&factory), "Could not get factory."); |
1906 | 1905 |
1907 SkTScopedComPtr<IDWriteFontCollection> sysFontCollection; | 1906 SkTScopedComPtr<IDWriteFontCollection> sysFontCollection; |
1908 HRNM(factory->GetSystemFontCollection(&sysFontCollection, FALSE), | 1907 HRNM(factory->GetSystemFontCollection(&sysFontCollection, FALSE), |
1909 "Could not get system font collection."); | 1908 "Could not get system font collection."); |
1910 | 1909 |
1911 WCHAR localeNameStorage[LOCALE_NAME_MAX_LENGTH]; | 1910 WCHAR localeNameStorage[LOCALE_NAME_MAX_LENGTH]; |
1912 WCHAR* localeName = NULL; | 1911 WCHAR* localeName = NULL; |
1913 int localeNameLen = 0; | 1912 int localeNameLen = 0; |
1914 | 1913 |
1915 // Dynamically load GetUserDefaultLocaleName function, as it is not availabl
e on XP. | 1914 // Dynamically load GetUserDefaultLocaleName function, as it is not availabl
e on XP. |
1916 GetUserDefaultLocaleNameProc getUserDefaultLocaleNameProc = NULL; | 1915 GetUserDefaultLocaleNameProc getUserDefaultLocaleNameProc = NULL; |
1917 HRESULT hr = GetGetUserDefaultLocaleNameProc(&getUserDefaultLocaleNameProc); | 1916 HRESULT hr = GetGetUserDefaultLocaleNameProc(&getUserDefaultLocaleNameProc); |
1918 if (NULL == getUserDefaultLocaleNameProc) { | 1917 if (NULL == getUserDefaultLocaleNameProc) { |
1919 SK_TRACEHR(hr, "Could not get GetUserDefaultLocaleName."); | 1918 SK_TRACEHR(hr, "Could not get GetUserDefaultLocaleName."); |
1920 } else { | 1919 } else { |
1921 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); | 1920 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); |
1922 if (localeNameLen) { | 1921 if (localeNameLen) { |
1923 localeName = localeNameStorage; | 1922 localeName = localeNameStorage; |
1924 }; | 1923 }; |
1925 } | 1924 } |
1926 | 1925 |
1927 return SkNEW_ARGS(SkFontMgr_DirectWrite, (sysFontCollection.get(), localeNam
e, localeNameLen)); | 1926 return SkNEW_ARGS(SkFontMgr_DirectWrite, (sysFontCollection.get(), localeNam
e, localeNameLen)); |
1928 } | 1927 } |
OLD | NEW |