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

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

Issue 23966003: Update the freetype backed fonthost to keep the style and fixed width attributes for a font stream. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: updating per comments Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 2013 Google Inc. 2 * Copyright 2013 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 "SkFontStyle.h" 9 #include "SkFontStyle.h"
10 #include "SkFontConfigInterface.h" 10 #include "SkFontConfigInterface.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 265
266 virtual SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) { 266 virtual SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) {
267 const size_t length = stream->getLength(); 267 const size_t length = stream->getLength();
268 if (!length) { 268 if (!length) {
269 return NULL; 269 return NULL;
270 } 270 }
271 if (length >= 1024 * 1024 * 1024) { 271 if (length >= 1024 * 1024 * 1024) {
272 return NULL; // don't accept too large fonts (>= 1GB) for safety. 272 return NULL; // don't accept too large fonts (>= 1GB) for safety.
273 } 273 }
274 274
275 // TODO should the caller give us the style? 275 // TODO should the caller give us the style or should we get it from fre etype?
276 SkTypeface::Style style = SkTypeface::kNormal; 276 SkTypeface::Style style = SkTypeface::kNormal;
277 SkTypeface* face = SkNEW_ARGS(FontConfigTypeface, (style, stream)); 277 SkTypeface* face = SkNEW_ARGS(FontConfigTypeface, (style, false, stream) );
278 return face; 278 return face;
279 } 279 }
280 280
281 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) { 281 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) {
282 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path)); 282 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path));
283 return stream.get() ? this->createFromStream(stream, ttcIndex) : NULL; 283 return stream.get() ? this->createFromStream(stream, ttcIndex) : NULL;
284 } 284 }
285 285
286 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], 286 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
287 unsigned styleBits) SK_OVERRIDE { 287 unsigned styleBits) SK_OVERRIDE {
288 return FontConfigTypeface::LegacyCreateTypeface(NULL, familyName, 288 return FontConfigTypeface::LegacyCreateTypeface(NULL, familyName,
289 (SkTypeface::Style)styleBits); 289 (SkTypeface::Style)styleBits);
290 } 290 }
291 }; 291 };
292 292
293 SkFontMgr* SkFontMgr::Factory() { 293 SkFontMgr* SkFontMgr::Factory() {
294 SkFontConfigInterface* fci = RefFCI(); 294 SkFontConfigInterface* fci = RefFCI();
295 return fci ? SkNEW_ARGS(SkFontMgr_fontconfig, (fci)) : NULL; 295 return fci ? SkNEW_ARGS(SkFontMgr_fontconfig, (fci)) : NULL;
296 } 296 }
OLDNEW
« no previous file with comments | « no previous file | src/ports/SkFontConfigTypeface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698