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

Side by Side Diff: src/core/SkFontMgr.cpp

Issue 1139123008: Revert of Font variations. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/core/SkFontDescriptor.cpp ('k') | src/core/SkTypeface.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 2015 Google Inc. 2 * Copyright 2015 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 "SkFontDescriptor.h"
9 #include "SkFontMgr.h" 8 #include "SkFontMgr.h"
10 #include "SkLazyPtr.h" 9 #include "SkLazyPtr.h"
11 #include "SkStream.h" 10 #include "SkStream.h"
12 #include "SkTypes.h" 11 #include "SkTypes.h"
13 12
14 class SkFontStyle; 13 class SkFontStyle;
15 class SkTypeface; 14 class SkTypeface;
16 15
17 class SkEmptyFontStyleSet : public SkFontStyleSet { 16 class SkEmptyFontStyleSet : public SkFontStyleSet {
18 public: 17 public:
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 return this->onCreateFromData(data, ttcIndex); 126 return this->onCreateFromData(data, ttcIndex);
128 } 127 }
129 128
130 SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, int ttcIndex) con st { 129 SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, int ttcIndex) con st {
131 if (NULL == stream) { 130 if (NULL == stream) {
132 return NULL; 131 return NULL;
133 } 132 }
134 return this->onCreateFromStream(stream, ttcIndex); 133 return this->onCreateFromStream(stream, ttcIndex);
135 } 134 }
136 135
137 SkTypeface* SkFontMgr::createFromFontData(SkFontData* data) const {
138 if (NULL == data) {
139 return NULL;
140 }
141 return this->onCreateFromFontData(data);
142 }
143
144 // This implementation is temporary until it can be made pure virtual.
145 SkTypeface* SkFontMgr::onCreateFromFontData(SkFontData* data) const {
146 SkTypeface* ret = this->createFromStream(data->detachStream(), data->getInde x());
147 delete data;
148 return ret;
149 }
150
151 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const { 136 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const {
152 if (NULL == path) { 137 if (NULL == path) {
153 return NULL; 138 return NULL;
154 } 139 }
155 return this->onCreateFromFile(path, ttcIndex); 140 return this->onCreateFromFile(path, ttcIndex);
156 } 141 }
157 142
158 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], 143 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[],
159 unsigned styleBits) const { 144 unsigned styleBits) const {
160 return this->onLegacyCreateTypeface(familyName, styleBits); 145 return this->onLegacyCreateTypeface(familyName, styleBits);
161 } 146 }
162 147
163 // As a template argument this must have external linkage. 148 // As a template argument this must have external linkage.
164 SkFontMgr* sk_fontmgr_create_default() { 149 SkFontMgr* sk_fontmgr_create_default() {
165 SkFontMgr* fm = SkFontMgr::Factory(); 150 SkFontMgr* fm = SkFontMgr::Factory();
166 return fm ? fm : SkNEW(SkEmptyFontMgr); 151 return fm ? fm : SkNEW(SkEmptyFontMgr);
167 } 152 }
168 153
169 SK_DECLARE_STATIC_LAZY_PTR(SkFontMgr, singleton, sk_fontmgr_create_default); 154 SK_DECLARE_STATIC_LAZY_PTR(SkFontMgr, singleton, sk_fontmgr_create_default);
170 155
171 SkFontMgr* SkFontMgr::RefDefault() { 156 SkFontMgr* SkFontMgr::RefDefault() {
172 return SkRef(singleton.get()); 157 return SkRef(singleton.get());
173 } 158 }
OLDNEW
« no previous file with comments | « src/core/SkFontDescriptor.cpp ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698