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

Side by Side Diff: ports/SkFontConfigInterface_direct.cpp

Issue 12879008: Add an entry for Cambria-Caladea to the list of metric compatible fonts. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/src/
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
« no previous file with comments | « no previous file | 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 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 GOTHIC, 56 GOTHIC,
57 PMINCHO, 57 PMINCHO,
58 MINCHO, 58 MINCHO,
59 SIMSUN, 59 SIMSUN,
60 NSIMSUN, 60 NSIMSUN,
61 SIMHEI, 61 SIMHEI,
62 PMINGLIU, 62 PMINGLIU,
63 MINGLIU, 63 MINGLIU,
64 PMINGLIUHK, 64 PMINGLIUHK,
65 MINGLIUHK, 65 MINGLIUHK,
66 CAMBRIA,
66 }; 67 };
67 68
68 // Match the font name against a whilelist of fonts, returning the equivalence 69 // Match the font name against a whilelist of fonts, returning the equivalence
69 // class. 70 // class.
70 FontEquivClass GetFontEquivClass(const char* fontname) 71 FontEquivClass GetFontEquivClass(const char* fontname)
71 { 72 {
72 // It would be nice for fontconfig to tell us whether a given suggested 73 // It would be nice for fontconfig to tell us whether a given suggested
73 // replacement is a "strong" match (that is, an equivalent font) or 74 // replacement is a "strong" match (that is, an equivalent font) or
74 // a "weak" match (that is, fontconfig's next-best attempt at finding a 75 // a "weak" match (that is, fontconfig's next-best attempt at finding a
75 // substitute). However, I played around with the fontconfig API for 76 // substitute). However, I played around with the fontconfig API for
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 { NSIMSUN, "\xe6\x96\xb0\xe5\xae\x8b\xe4\xbd\x93" }, 146 { NSIMSUN, "\xe6\x96\xb0\xe5\xae\x8b\xe4\xbd\x93" },
146 { NSIMSUN, "MSung GB18030" }, 147 { NSIMSUN, "MSung GB18030" },
147 { NSIMSUN, "N Song ASC" }, 148 { NSIMSUN, "N Song ASC" },
148 149
149 // 黑体 150 // 黑体
150 { SIMHEI, "Simhei" }, 151 { SIMHEI, "Simhei" },
151 { SIMHEI, "\xe9\xbb\x91\xe4\xbd\x93" }, 152 { SIMHEI, "\xe9\xbb\x91\xe4\xbd\x93" },
152 { SIMHEI, "MYingHeiGB18030" }, 153 { SIMHEI, "MYingHeiGB18030" },
153 { SIMHEI, "MYingHeiB5HK" }, 154 { SIMHEI, "MYingHeiB5HK" },
154 155
155 // 新細明體 156 // 新細明體
156 { PMINGLIU, "PMingLiU"}, 157 { PMINGLIU, "PMingLiU"},
157 { PMINGLIU, "\xe6\x96\xb0\xe7\xb4\xb0\xe6\x98\x8e\xe9\xab\x94" }, 158 { PMINGLIU, "\xe6\x96\xb0\xe7\xb4\xb0\xe6\x98\x8e\xe9\xab\x94" },
158 { PMINGLIU, "MSung B5HK"}, 159 { PMINGLIU, "MSung B5HK"},
159 160
160 // 細明體 161 // 細明體
161 { MINGLIU, "MingLiU"}, 162 { MINGLIU, "MingLiU"},
162 { MINGLIU, "\xe7\xb4\xb0\xe6\x98\x8e\xe9\xab\x94" }, 163 { MINGLIU, "\xe7\xb4\xb0\xe6\x98\x8e\xe9\xab\x94" },
163 { MINGLIU, "MSung B5HK"}, 164 { MINGLIU, "MSung B5HK"},
164 165
165 // 新細明體 166 // 新細明體
166 { PMINGLIUHK, "PMingLiU_HKSCS"}, 167 { PMINGLIUHK, "PMingLiU_HKSCS"},
167 { PMINGLIUHK, "\xe6\x96\xb0\xe7\xb4\xb0\xe6\x98\x8e\xe9\xab\x94_HKSCS" }, 168 { PMINGLIUHK, "\xe6\x96\xb0\xe7\xb4\xb0\xe6\x98\x8e\xe9\xab\x94_HKSCS" } ,
168 { PMINGLIUHK, "MSung B5HK"}, 169 { PMINGLIUHK, "MSung B5HK"},
169 170
170 // 細明體 171 // 細明體
171 { MINGLIUHK, "MingLiU_HKSCS"}, 172 { MINGLIUHK, "MingLiU_HKSCS"},
172 { MINGLIUHK, "\xe7\xb4\xb0\xe6\x98\x8e\xe9\xab\x94_HKSCS" }, 173 { MINGLIUHK, "\xe7\xb4\xb0\xe6\x98\x8e\xe9\xab\x94_HKSCS" },
173 { MINGLIUHK, "MSung B5HK"}, 174 { MINGLIUHK, "MSung B5HK"},
175
176 // Cambria
177 { CAMBRIA, "Cambria" },
178 { CAMBRIA, "Caladea" },
174 }; 179 };
175 180
176 static const size_t kFontCount = 181 static const size_t kFontCount =
177 sizeof(kFontEquivMap)/sizeof(kFontEquivMap[0]); 182 sizeof(kFontEquivMap)/sizeof(kFontEquivMap[0]);
178 183
179 // TODO(jungshik): If this loop turns out to be hot, turn 184 // TODO(jungshik): If this loop turns out to be hot, turn
180 // the array to a static (hash)map to speed it up. 185 // the array to a static (hash)map to speed it up.
181 for (size_t i = 0; i < kFontCount; ++i) { 186 for (size_t i = 0; i < kFontCount; ++i) {
182 if (strcasecmp(kFontEquivMap[i].name, fontname) == 0) 187 if (strcasecmp(kFontEquivMap[i].name, fontname) == 0)
183 return kFontEquivMap[i].clazz; 188 return kFontEquivMap[i].clazz;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 if (outStyle) { 423 if (outStyle) {
419 *outStyle = GetFontStyle(match); 424 *outStyle = GetFontStyle(match);
420 } 425 }
421 return true; 426 return true;
422 } 427 }
423 428
424 SkStream* SkFontConfigInterfaceDirect::openStream(const FontIdentity& identity) { 429 SkStream* SkFontConfigInterfaceDirect::openStream(const FontIdentity& identity) {
425 int fd = open(identity.fString.c_str(), O_RDONLY); 430 int fd = open(identity.fString.c_str(), O_RDONLY);
426 return (fd >= 0) ? SkNEW_ARGS(SkFDStream, (fd, true)) : NULL; 431 return (fd >= 0) ? SkNEW_ARGS(SkFDStream, (fd, true)) : NULL;
427 } 432 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698