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

Side by Side Diff: src/fonts/SkTestScalerContext.cpp

Issue 574873002: Add onGetFamilyName to SkTypeface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add .get() for DirectWrite. Created 6 years, 3 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/SkTestScalerContext.h ('k') | src/ports/SkFontConfigTypeface.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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkDescriptor.h" 10 #include "SkDescriptor.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 int SkTestTypeface::onCharsToGlyphs(const void* chars, Encoding encoding, 168 int SkTestTypeface::onCharsToGlyphs(const void* chars, Encoding encoding,
169 uint16_t glyphs[], int glyphCount) const { 169 uint16_t glyphs[], int glyphCount) const {
170 SkASSERT(encoding == kUTF16_Encoding); 170 SkASSERT(encoding == kUTF16_Encoding);
171 for (int index = 0; index < glyphCount; ++index) { 171 for (int index = 0; index < glyphCount; ++index) {
172 SkUnichar ch = ((SkUnichar*) chars)[index]; 172 SkUnichar ch = ((SkUnichar*) chars)[index];
173 glyphs[index] = fTestFont->codeToIndex(ch); 173 glyphs[index] = fTestFont->codeToIndex(ch);
174 } 174 }
175 return glyphCount; 175 return glyphCount;
176 } 176 }
177 177
178 void SkTestTypeface::onGetFamilyName(SkString* familyName) const {
179 *familyName = fTestFont->fName;
180 }
181
178 SkTypeface::LocalizedStrings* SkTestTypeface::onCreateFamilyNameIterator() const { 182 SkTypeface::LocalizedStrings* SkTestTypeface::onCreateFamilyNameIterator() const {
179 SkString familyName(fTestFont->fName); 183 SkString familyName(fTestFont->fName);
180 SkString language("und"); //undetermined 184 SkString language("und"); //undetermined
181 SkASSERT(0); // incomplete 185 SkASSERT(0); // incomplete
182 return NULL; 186 return NULL;
183 // return new SkOTUtils::LocalizedStrings_SingleName(familyName, language); 187 // return new SkOTUtils::LocalizedStrings_SingleName(familyName, language);
184 } 188 }
185 189
186 class SkTestScalerContext : public SkScalerContext { 190 class SkTestScalerContext : public SkScalerContext {
187 public: 191 public:
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 288 }
285 289
286 private: 290 private:
287 SkTestTypeface* fFace; 291 SkTestTypeface* fFace;
288 SkMatrix fMatrix; 292 SkMatrix fMatrix;
289 }; 293 };
290 294
291 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc) const { 295 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc) const {
292 return SkNEW_ARGS(SkTestScalerContext, (const_cast<SkTestTypeface*>(this), d esc)); 296 return SkNEW_ARGS(SkTestScalerContext, (const_cast<SkTestTypeface*>(this), d esc));
293 } 297 }
OLDNEW
« no previous file with comments | « src/fonts/SkTestScalerContext.h ('k') | src/ports/SkFontConfigTypeface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698