Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: src/ports/SkFontHost_win.cpp

Issue 1873923002: Begin switch to SkFontStyle for legacy calls. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Dont update bzl file now. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ports/SkFontHost_mac.cpp ('k') | src/ports/SkFontMgr_android.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], 2504 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
2505 unsigned styleBits) const overrid e { 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 {
2509 #endif
2506 LOGFONT lf; 2510 LOGFONT lf;
2507 if (nullptr == familyName) { 2511 if (nullptr == familyName) {
2508 lf = get_default_font(); 2512 lf = get_default_font();
2509 } else { 2513 } else {
2510 logfont_for_name(familyName, &lf); 2514 logfont_for_name(familyName, &lf);
2511 } 2515 }
2512 2516
2513 SkTypeface::Style style = (SkTypeface::Style)styleBits; 2517 lf.lfWeight = style.weight();
2514 lf.lfWeight = (style & SkTypeface::kBold) != 0 ? FW_BOLD : FW_NORMAL; 2518 lf.lfItalic = style.isItalic() ? TRUE : FALSE;
2515 lf.lfItalic = ((style & SkTypeface::kItalic) != 0);
2516 return SkCreateTypefaceFromLOGFONT(lf); 2519 return SkCreateTypefaceFromLOGFONT(lf);
2517 } 2520 }
2518 2521
2519 private: 2522 private:
2520 SkTDArray<ENUMLOGFONTEX> fLogFontArray; 2523 SkTDArray<ENUMLOGFONTEX> fLogFontArray;
2521 }; 2524 };
2522 2525
2523 /////////////////////////////////////////////////////////////////////////////// 2526 ///////////////////////////////////////////////////////////////////////////////
2524 2527
2525 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; } 2528 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; }
2526 2529
2527 #endif//defined(SK_BUILD_FOR_WIN32) 2530 #endif//defined(SK_BUILD_FOR_WIN32)
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_mac.cpp ('k') | src/ports/SkFontMgr_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698