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 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2494 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override { | 2494 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override { |
2495 // could be in base impl | 2495 // could be in base impl |
2496 return this->createFromStream(new SkMemoryStream(data)); | 2496 return this->createFromStream(new SkMemoryStream(data)); |
2497 } | 2497 } |
2498 | 2498 |
2499 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override
{ | 2499 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override
{ |
2500 // could be in base impl | 2500 // could be in base impl |
2501 return this->createFromStream(SkStream::NewFromFile(path)); | 2501 return this->createFromStream(SkStream::NewFromFile(path)); |
2502 } | 2502 } |
2503 | 2503 |
2504 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE | |
2505 SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBi
ts) const override { | |
2506 SkFontStyle style = SkFontStyle::FromOldStyle(styleBits); | |
2507 #else | |
2508 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl
e) const override { | 2504 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl
e) const override { |
2509 #endif | |
2510 LOGFONT lf; | 2505 LOGFONT lf; |
2511 if (nullptr == familyName) { | 2506 if (nullptr == familyName) { |
2512 lf = get_default_font(); | 2507 lf = get_default_font(); |
2513 } else { | 2508 } else { |
2514 logfont_for_name(familyName, &lf); | 2509 logfont_for_name(familyName, &lf); |
2515 } | 2510 } |
2516 | 2511 |
2517 lf.lfWeight = style.weight(); | 2512 lf.lfWeight = style.weight(); |
2518 lf.lfItalic = style.isItalic() ? TRUE : FALSE; | 2513 lf.lfItalic = style.isItalic() ? TRUE : FALSE; |
2519 return SkCreateTypefaceFromLOGFONT(lf); | 2514 return SkCreateTypefaceFromLOGFONT(lf); |
2520 } | 2515 } |
2521 | 2516 |
2522 private: | 2517 private: |
2523 SkTDArray<ENUMLOGFONTEX> fLogFontArray; | 2518 SkTDArray<ENUMLOGFONTEX> fLogFontArray; |
2524 }; | 2519 }; |
2525 | 2520 |
2526 /////////////////////////////////////////////////////////////////////////////// | 2521 /////////////////////////////////////////////////////////////////////////////// |
2527 | 2522 |
2528 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; } | 2523 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; } |
2529 | 2524 |
2530 #endif//defined(SK_BUILD_FOR_WIN32) | 2525 #endif//defined(SK_BUILD_FOR_WIN32) |
OLD | NEW |