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 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1923 static SkTypeface* create_from_stream(SkStreamAsset* stream) { | 1923 static SkTypeface* create_from_stream(SkStreamAsset* stream) { |
1924 // Create a unique and unpredictable font name. | 1924 // Create a unique and unpredictable font name. |
1925 // Avoids collisions and access from CSS. | 1925 // Avoids collisions and access from CSS. |
1926 char familyName[BASE64_GUID_ID_LEN]; | 1926 char familyName[BASE64_GUID_ID_LEN]; |
1927 const int familyNameSize = SK_ARRAY_COUNT(familyName); | 1927 const int familyNameSize = SK_ARRAY_COUNT(familyName); |
1928 if (FAILED(create_unique_font_name(familyName, familyNameSize))) { | 1928 if (FAILED(create_unique_font_name(familyName, familyNameSize))) { |
1929 return nullptr; | 1929 return nullptr; |
1930 } | 1930 } |
1931 | 1931 |
1932 // Change the name of the font. | 1932 // Change the name of the font. |
1933 SkAutoTUnref<SkData> rewrittenFontData(SkOTUtils::RenameFont(stream, familyN
ame, familyNameSize-1)); | 1933 sk_sp<SkData> rewrittenFontData(SkOTUtils::RenameFont(stream, familyName, fa
milyNameSize-1)); |
1934 if (nullptr == rewrittenFontData.get()) { | 1934 if (nullptr == rewrittenFontData.get()) { |
1935 return nullptr; | 1935 return nullptr; |
1936 } | 1936 } |
1937 | 1937 |
1938 // Register the font with GDI. | 1938 // Register the font with GDI. |
1939 HANDLE fontReference = activate_font(rewrittenFontData.get()); | 1939 HANDLE fontReference = activate_font(rewrittenFontData.get()); |
1940 if (nullptr == fontReference) { | 1940 if (nullptr == fontReference) { |
1941 return nullptr; | 1941 return nullptr; |
1942 } | 1942 } |
1943 | 1943 |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2506 | 2506 |
2507 private: | 2507 private: |
2508 SkTDArray<ENUMLOGFONTEX> fLogFontArray; | 2508 SkTDArray<ENUMLOGFONTEX> fLogFontArray; |
2509 }; | 2509 }; |
2510 | 2510 |
2511 /////////////////////////////////////////////////////////////////////////////// | 2511 /////////////////////////////////////////////////////////////////////////////// |
2512 | 2512 |
2513 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; } | 2513 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; } |
2514 | 2514 |
2515 #endif//defined(SK_BUILD_FOR_WIN32) | 2515 #endif//defined(SK_BUILD_FOR_WIN32) |
OLD | NEW |