| OLD | NEW |
| 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" | 8 #include "SkFontDescriptor.h" |
| 9 #include "SkFontMgr.h" | 9 #include "SkFontMgr.h" |
| 10 #include "SkOncePtr.h" | 10 #include "SkOncePtr.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 return this->onCreateFromData(data, ttcIndex); | 125 return this->onCreateFromData(data, ttcIndex); |
| 126 } | 126 } |
| 127 | 127 |
| 128 SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, int ttcIndex) con
st { | 128 SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, int ttcIndex) con
st { |
| 129 if (nullptr == stream) { | 129 if (nullptr == stream) { |
| 130 return nullptr; | 130 return nullptr; |
| 131 } | 131 } |
| 132 return this->onCreateFromStream(stream, ttcIndex); | 132 return this->onCreateFromStream(stream, ttcIndex); |
| 133 } | 133 } |
| 134 | 134 |
| 135 SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, const FontParamet
ers& params) const { |
| 136 if (nullptr == stream) { |
| 137 return nullptr; |
| 138 } |
| 139 return this->onCreateFromStream(stream, params); |
| 140 } |
| 141 |
| 135 SkTypeface* SkFontMgr::createFromFontData(SkFontData* data) const { | 142 SkTypeface* SkFontMgr::createFromFontData(SkFontData* data) const { |
| 136 if (nullptr == data) { | 143 if (nullptr == data) { |
| 137 return nullptr; | 144 return nullptr; |
| 138 } | 145 } |
| 139 return this->onCreateFromFontData(data); | 146 return this->onCreateFromFontData(data); |
| 140 } | 147 } |
| 141 | 148 |
| 142 // This implementation is temporary until it can be made pure virtual. | 149 // This implementation is temporary until it can be made pure virtual. |
| 150 SkTypeface* SkFontMgr::onCreateFromStream(SkStreamAsset* stream, const FontParam
eters& p) const { |
| 151 return this->createFromStream(stream, p.getCollectionIndex()); |
| 152 } |
| 153 |
| 154 // This implementation is temporary until it can be made pure virtual. |
| 143 SkTypeface* SkFontMgr::onCreateFromFontData(SkFontData* data) const { | 155 SkTypeface* SkFontMgr::onCreateFromFontData(SkFontData* data) const { |
| 144 SkTypeface* ret = this->createFromStream(data->detachStream(), data->getInde
x()); | 156 SkTypeface* ret = this->createFromStream(data->detachStream(), data->getInde
x()); |
| 145 delete data; | 157 delete data; |
| 146 return ret; | 158 return ret; |
| 147 } | 159 } |
| 148 | 160 |
| 149 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const { | 161 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const { |
| 150 if (nullptr == path) { | 162 if (nullptr == path) { |
| 151 return nullptr; | 163 return nullptr; |
| 152 } | 164 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 } | 271 } |
| 260 } | 272 } |
| 261 | 273 |
| 262 if (currentScore.score > maxScore.score) { | 274 if (currentScore.score > maxScore.score) { |
| 263 maxScore = currentScore; | 275 maxScore = currentScore; |
| 264 } | 276 } |
| 265 } | 277 } |
| 266 | 278 |
| 267 return this->createTypeface(maxScore.index); | 279 return this->createTypeface(maxScore.index); |
| 268 } | 280 } |
| OLD | NEW |