| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |