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

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

Issue 12469003: Fixed a few warnings (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright 2009 Google Inc. 2 * Copyright 2009 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 /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ 8 /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */
9 9
10 #include <string> 10 #include <string>
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // Return true if |font_a| and |font_b| are visually and at the metrics 189 // Return true if |font_a| and |font_b| are visually and at the metrics
190 // level interchangeable. 190 // level interchangeable.
191 bool IsMetricCompatibleReplacement(const char* font_a, const char* font_b) 191 bool IsMetricCompatibleReplacement(const char* font_a, const char* font_b)
192 { 192 {
193 FontEquivClass class_a = GetFontEquivClass(font_a); 193 FontEquivClass class_a = GetFontEquivClass(font_a);
194 FontEquivClass class_b = GetFontEquivClass(font_b); 194 FontEquivClass class_b = GetFontEquivClass(font_b);
195 195
196 return class_a != OTHER && class_a == class_b; 196 return class_a != OTHER && class_a == class_b;
197 } 197 }
198 198
199 inline unsigned FileFaceIdToFileId(unsigned filefaceid)
200 {
201 return filefaceid >> 4;
202 }
203
204 inline unsigned FileIdAndFaceIndexToFileFaceId(unsigned fileid, int face_index)
205 {
206 SkASSERT((face_index & 0xfu) == face_index);
207 return (fileid << 4) | face_index;
208 }
209
sugoi 2013/03/05 20:16:45 unused functions
210 // Normally we only return exactly the font asked for. In last-resort 199 // Normally we only return exactly the font asked for. In last-resort
211 // cases, the request either doesn't specify a font or is one of the 200 // cases, the request either doesn't specify a font or is one of the
212 // basic font names like "Sans", "Serif" or "Monospace". This function 201 // basic font names like "Sans", "Serif" or "Monospace". This function
213 // tells you whether a given request is for such a fallback. 202 // tells you whether a given request is for such a fallback.
214 bool IsFallbackFontAllowed(const std::string& family) { 203 bool IsFallbackFontAllowed(const std::string& family) {
215 const char* family_cstr = family.c_str(); 204 const char* family_cstr = family.c_str();
216 return family.empty() || 205 return family.empty() ||
217 strcasecmp(family_cstr, "sans") == 0 || 206 strcasecmp(family_cstr, "sans") == 0 ||
218 strcasecmp(family_cstr, "serif") == 0 || 207 strcasecmp(family_cstr, "serif") == 0 ||
219 strcasecmp(family_cstr, "monospace") == 0; 208 strcasecmp(family_cstr, "monospace") == 0;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 if (outStyle) { 418 if (outStyle) {
430 *outStyle = GetFontStyle(match); 419 *outStyle = GetFontStyle(match);
431 } 420 }
432 return true; 421 return true;
433 } 422 }
434 423
435 SkStream* SkFontConfigInterfaceDirect::openStream(const FontIdentity& identity) { 424 SkStream* SkFontConfigInterfaceDirect::openStream(const FontIdentity& identity) {
436 int fd = open(identity.fString.c_str(), O_RDONLY); 425 int fd = open(identity.fString.c_str(), O_RDONLY);
437 return (fd >= 0) ? SkNEW_ARGS(SkFDStream, (fd, true)) : NULL; 426 return (fd >= 0) ? SkNEW_ARGS(SkFDStream, (fd, true)) : NULL;
438 } 427 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698