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

Side by Side Diff: src/fonts/SkFontMgr_indirect.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/fonts/SkFontMgr_fontconfig.cpp ('k') | src/ports/SkFontConfigInterface_direct.h » ('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 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 "SkFontMgr.h" 9 #include "SkFontMgr.h"
10 #include "SkFontMgr_indirect.h" 10 #include "SkFontMgr_indirect.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 177 }
178 178
179 SkTypeface* SkFontMgr_Indirect::onCreateFromFile(const char path[], int ttcIndex ) const { 179 SkTypeface* SkFontMgr_Indirect::onCreateFromFile(const char path[], int ttcIndex ) const {
180 return fImpl->createFromFile(path, ttcIndex); 180 return fImpl->createFromFile(path, ttcIndex);
181 } 181 }
182 182
183 SkTypeface* SkFontMgr_Indirect::onCreateFromData(SkData* data, int ttcIndex) con st { 183 SkTypeface* SkFontMgr_Indirect::onCreateFromData(SkData* data, int ttcIndex) con st {
184 return fImpl->createFromData(data, ttcIndex); 184 return fImpl->createFromData(data, ttcIndex);
185 } 185 }
186 186
187 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
187 SkTypeface* SkFontMgr_Indirect::onLegacyCreateTypeface(const char familyName[], 188 SkTypeface* SkFontMgr_Indirect::onLegacyCreateTypeface(const char familyName[],
188 unsigned styleBits) const { 189 unsigned styleBits) const {
189 bool bold = SkToBool(styleBits & SkTypeface::kBold); 190 SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
190 bool italic = SkToBool(styleBits & SkTypeface::kItalic); 191 #else
191 SkFontStyle style = SkFontStyle(bold ? SkFontStyle::kBold_Weight 192 SkTypeface* SkFontMgr_Indirect::onLegacyCreateTypeface(const char familyName[],
192 : SkFontStyle::kNormal_Weight, 193 SkFontStyle style) const {
193 SkFontStyle::kNormal_Width, 194 #endif
194 italic ? SkFontStyle::kItalic_Slant
195 : SkFontStyle::kUpright_Slant);
196
197 SkAutoTUnref<SkTypeface> face(this->matchFamilyStyle(familyName, style)); 195 SkAutoTUnref<SkTypeface> face(this->matchFamilyStyle(familyName, style));
198 196
199 if (nullptr == face.get()) { 197 if (nullptr == face.get()) {
200 face.reset(this->matchFamilyStyle(nullptr, style)); 198 face.reset(this->matchFamilyStyle(nullptr, style));
201 } 199 }
202 200
203 if (nullptr == face.get()) { 201 if (nullptr == face.get()) {
204 SkFontIdentity fontId = this->fProxy->matchIndexStyle(0, style); 202 SkFontIdentity fontId = this->fProxy->matchIndexStyle(0, style);
205 face.reset(this->createTypefaceFromFontId(fontId)); 203 face.reset(this->createTypefaceFromFontId(fontId));
206 } 204 }
207 205
208 return face.release(); 206 return face.release();
209 } 207 }
OLDNEW
« no previous file with comments | « src/fonts/SkFontMgr_fontconfig.cpp ('k') | src/ports/SkFontConfigInterface_direct.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698