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

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

Issue 1873923002: Begin switch to SkFontStyle for legacy calls. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixes, rebase. 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "SkDataTable.h" 8 #include "SkDataTable.h"
9 #include "SkFixed.h" 9 #include "SkFixed.h"
10 #include "SkFontDescriptor.h" 10 #include "SkFontDescriptor.h"
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 const int ttcIndex = fontData->getIndex(); 875 const int ttcIndex = fontData->getIndex();
876 SkFontStyle style; 876 SkFontStyle style;
877 bool isFixedWidth = false; 877 bool isFixedWidth = false;
878 if (!fScanner.scanFont(stream, ttcIndex, nullptr, &style, &isFixedWidth, nullptr)) { 878 if (!fScanner.scanFont(stream, ttcIndex, nullptr, &style, &isFixedWidth, nullptr)) {
879 return nullptr; 879 return nullptr;
880 } 880 }
881 881
882 return new SkTypeface_stream(fontData, style, isFixedWidth); 882 return new SkTypeface_stream(fontData, style, isFixedWidth);
883 } 883 }
884 884
885 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], 885 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
886 unsigned styleBits) const overrid e { 886 SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBi ts) const override {
887 bool bold = styleBits & SkTypeface::kBold; 887 SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
888 bool italic = styleBits & SkTypeface::kItalic; 888 #else
889 SkFontStyle style = SkFontStyle(bold ? SkFontStyle::kBold_Weight 889 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl e) const override {
890 : SkFontStyle::kNormal_Weight, 890 #endif
891 SkFontStyle::kNormal_Width,
892 italic ? SkFontStyle::kItalic_Slant
893 : SkFontStyle::kUpright_Slant);
894 SkAutoTUnref<SkTypeface> typeface(this->matchFamilyStyle(familyName, sty le)); 891 SkAutoTUnref<SkTypeface> typeface(this->matchFamilyStyle(familyName, sty le));
895 if (typeface.get()) { 892 if (typeface.get()) {
896 return typeface.release(); 893 return typeface.release();
897 } 894 }
898 895
899 return this->matchFamilyStyle(nullptr, style); 896 return this->matchFamilyStyle(nullptr, style);
900 } 897 }
901 }; 898 };
902 899
903 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { 900 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) {
904 return new SkFontMgr_fontconfig(fc); 901 return new SkFontMgr_fontconfig(fc);
905 } 902 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698