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

Side by Side Diff: src/ports/SkFontHost_fontconfig.cpp

Issue 16439004: Fix issues related to resolving fonts based on name. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: defer cache change to another CLwq Created 7 years, 6 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 | « src/core/SkTypeface.cpp ('k') | no next file » | 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 2008 Google Inc. 2 * Copyright 2008 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 "SkFontConfigInterface.h" 8 #include "SkFontConfigInterface.h"
9 #include "SkFontConfigTypeface.h" 9 #include "SkFontConfigTypeface.h"
10 #include "SkFontDescriptor.h" 10 #include "SkFontDescriptor.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if (!length) { 115 if (!length) {
116 return NULL; 116 return NULL;
117 } 117 }
118 if (length >= 1024 * 1024 * 1024) { 118 if (length >= 1024 * 1024 * 1024) {
119 return NULL; // don't accept too large fonts (>= 1GB) for safety. 119 return NULL; // don't accept too large fonts (>= 1GB) for safety.
120 } 120 }
121 121
122 // TODO should the caller give us the style? 122 // TODO should the caller give us the style?
123 SkTypeface::Style style = SkTypeface::kNormal; 123 SkTypeface::Style style = SkTypeface::kNormal;
124 SkTypeface* face = SkNEW_ARGS(FontConfigTypeface, (style, stream)); 124 SkTypeface* face = SkNEW_ARGS(FontConfigTypeface, (style, stream));
125 SkTypefaceCache::Add(face, style);
126 return face; 125 return face;
127 } 126 }
128 127
129 SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) { 128 SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) {
130 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path)); 129 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path));
131 return stream.get() ? CreateTypefaceFromStream(stream) : NULL; 130 return stream.get() ? CreateTypefaceFromStream(stream) : NULL;
132 } 131 }
133 132
134 /////////////////////////////////////////////////////////////////////////////// 133 ///////////////////////////////////////////////////////////////////////////////
135 134
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 : 0; 188 : 0;
190 } 189 }
191 190
192 void FontConfigTypeface::onGetFontDescriptor(SkFontDescriptor* desc, 191 void FontConfigTypeface::onGetFontDescriptor(SkFontDescriptor* desc,
193 bool* isLocalStream) const { 192 bool* isLocalStream) const {
194 desc->setFamilyName(this->getFamilyName()); 193 desc->setFamilyName(this->getFamilyName());
195 *isLocalStream = SkToBool(this->getLocalStream()); 194 *isLocalStream = SkToBool(this->getLocalStream());
196 } 195 }
197 196
198 /////////////////////////////////////////////////////////////////////////////// 197 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/core/SkTypeface.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698