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

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

Issue 869763002: SkTypeface to use SkStreamAsset. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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.h ('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 "SkFontMgr.h" 8 #include "SkFontMgr.h"
9 #include "SkLazyPtr.h" 9 #include "SkLazyPtr.h"
10 #include "SkStream.h" 10 #include "SkStream.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 SkUnichar character) const S K_OVERRIDE { 61 SkUnichar character) const S K_OVERRIDE {
62 return NULL; 62 return NULL;
63 } 63 }
64 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, 64 virtual SkTypeface* onMatchFaceStyle(const SkTypeface*,
65 const SkFontStyle&) const SK_OVERRIDE { 65 const SkFontStyle&) const SK_OVERRIDE {
66 return NULL; 66 return NULL;
67 } 67 }
68 SkTypeface* onCreateFromData(SkData*, int) const SK_OVERRIDE { 68 SkTypeface* onCreateFromData(SkData*, int) const SK_OVERRIDE {
69 return NULL; 69 return NULL;
70 } 70 }
71 SkTypeface* onCreateFromStream(SkStream* stream, int) const SK_OVERRIDE { 71 SkTypeface* onCreateFromStream(SkStreamAsset* stream, int) const SK_OVERRIDE {
72 SkDELETE(stream); 72 SkDELETE(stream);
73 return NULL; 73 return NULL;
74 } 74 }
75 SkTypeface* onCreateFromFile(const char[], int) const SK_OVERRIDE { 75 SkTypeface* onCreateFromFile(const char[], int) const SK_OVERRIDE {
76 return NULL; 76 return NULL;
77 } 77 }
78 SkTypeface* onLegacyCreateTypeface(const char [], unsigned) const SK_OVERRID E { 78 SkTypeface* onLegacyCreateTypeface(const char [], unsigned) const SK_OVERRID E {
79 return NULL; 79 return NULL;
80 } 80 }
81 }; 81 };
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return this->onMatchFaceStyle(face, fs); 119 return this->onMatchFaceStyle(face, fs);
120 } 120 }
121 121
122 SkTypeface* SkFontMgr::createFromData(SkData* data, int ttcIndex) const { 122 SkTypeface* SkFontMgr::createFromData(SkData* data, int ttcIndex) const {
123 if (NULL == data) { 123 if (NULL == data) {
124 return NULL; 124 return NULL;
125 } 125 }
126 return this->onCreateFromData(data, ttcIndex); 126 return this->onCreateFromData(data, ttcIndex);
127 } 127 }
128 128
129 SkTypeface* SkFontMgr::createFromStream(SkStream* stream, int ttcIndex) const { 129 SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, int ttcIndex) con st {
130 if (NULL == stream) { 130 if (NULL == stream) {
131 return NULL; 131 return NULL;
132 } 132 }
133 return this->onCreateFromStream(stream, ttcIndex); 133 return this->onCreateFromStream(stream, ttcIndex);
134 } 134 }
135 135
136 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const { 136 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const {
137 if (NULL == path) { 137 if (NULL == path) {
138 return NULL; 138 return NULL;
139 } 139 }
140 return this->onCreateFromFile(path, ttcIndex); 140 return this->onCreateFromFile(path, ttcIndex);
141 } 141 }
142 142
143 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], 143 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[],
144 unsigned styleBits) const { 144 unsigned styleBits) const {
145 return this->onLegacyCreateTypeface(familyName, styleBits); 145 return this->onLegacyCreateTypeface(familyName, styleBits);
146 } 146 }
147 147
148 // As a template argument this must have external linkage. 148 // As a template argument this must have external linkage.
149 SkFontMgr* sk_fontmgr_create_default() { 149 SkFontMgr* sk_fontmgr_create_default() {
150 SkFontMgr* fm = SkFontMgr::Factory(); 150 SkFontMgr* fm = SkFontMgr::Factory();
151 return fm ? fm : SkNEW(SkEmptyFontMgr); 151 return fm ? fm : SkNEW(SkEmptyFontMgr);
152 } 152 }
153 153
154 SK_DECLARE_STATIC_LAZY_PTR(SkFontMgr, singleton, sk_fontmgr_create_default); 154 SK_DECLARE_STATIC_LAZY_PTR(SkFontMgr, singleton, sk_fontmgr_create_default);
155 155
156 SkFontMgr* SkFontMgr::RefDefault() { 156 SkFontMgr* SkFontMgr::RefDefault() {
157 return SkRef(singleton.get()); 157 return SkRef(singleton.get());
158 } 158 }
OLDNEW
« no previous file with comments | « src/core/SkFontDescriptor.h ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698