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

Side by Side Diff: skia/ext/SkFontHost_fontconfig_direct.cpp

Issue 11877020: The Chrome-side of changes to use MSung* fonts as Chinese serif fonts. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 | « chrome/app/resources/platform_locale_settings/locale_settings_cros_zh-TW.xtb ('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 /* libs/graphics/ports/SkFontHost_fontconfig_direct.cpp 1 /* libs/graphics/ports/SkFontHost_fontconfig_direct.cpp
2 ** 2 **
3 ** Copyright 2009, Google Inc. 3 ** Copyright 2009, Google Inc.
4 ** 4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License"); 5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License. 6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at 7 ** You may obtain a copy of the License at
8 ** 8 **
9 ** http://www.apache.org/licenses/LICENSE-2.0 9 ** http://www.apache.org/licenses/LICENSE-2.0
10 ** 10 **
(...skipping 26 matching lines...) Expand all
37 SERIF, 37 SERIF,
38 MONO, 38 MONO,
39 SYMBOL, 39 SYMBOL,
40 PGOTHIC, 40 PGOTHIC,
41 GOTHIC, 41 GOTHIC,
42 PMINCHO, 42 PMINCHO,
43 MINCHO, 43 MINCHO,
44 SIMSUN, 44 SIMSUN,
45 NSIMSUN, 45 NSIMSUN,
46 SIMHEI, 46 SIMHEI,
47 PMINGLIU,
48 MINGLIU,
49 PMINGLIUHK,
50 MINGLIUHK,
47 }; 51 };
48 52
49 // Match the font name against a whilelist of fonts, returning the equivalence 53 // Match the font name against a whilelist of fonts, returning the equivalence
50 // class. 54 // class.
51 FontEquivClass GetFontEquivClass(const char* fontname) 55 FontEquivClass GetFontEquivClass(const char* fontname)
52 { 56 {
53 // It would be nice for fontconfig to tell us whether a given suggested 57 // It would be nice for fontconfig to tell us whether a given suggested
54 // replacement is a "strong" match (that is, an equivalent font) or 58 // replacement is a "strong" match (that is, an equivalent font) or
55 // a "weak" match (that is, fontconfig's next-best attempt at finding a 59 // a "weak" match (that is, fontconfig's next-best attempt at finding a
56 // substitute). However, I played around with the fontconfig API for 60 // substitute). However, I played around with the fontconfig API for
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 115
112 // MS 明朝 116 // MS 明朝
113 { MINCHO, "MS Mincho" }, 117 { MINCHO, "MS Mincho" },
114 { MINCHO, "\xef\xbc\xad\xef\xbc\xb3 \xe6\x98\x8e\xe6\x9c\x9d" }, 118 { MINCHO, "\xef\xbc\xad\xef\xbc\xb3 \xe6\x98\x8e\xe6\x9c\x9d" },
115 { MINCHO, "IPAMincho" }, 119 { MINCHO, "IPAMincho" },
116 { MINCHO, "MotoyaG04MinchoMono" }, 120 { MINCHO, "MotoyaG04MinchoMono" },
117 121
118 // 宋体 122 // 宋体
119 { SIMSUN, "Simsun" }, 123 { SIMSUN, "Simsun" },
120 { SIMSUN, "\xe5\xae\x8b\xe4\xbd\x93" }, 124 { SIMSUN, "\xe5\xae\x8b\xe4\xbd\x93" },
125 { SIMSUN, "MSung GB18030" },
121 { SIMSUN, "Song ASC" }, 126 { SIMSUN, "Song ASC" },
122 127
123 // 新宋体 128 // 新宋体
124 { NSIMSUN, "NSimsun" }, 129 { NSIMSUN, "NSimsun" },
125 { NSIMSUN, "\xe6\x96\xb0\xe5\xae\x8b\xe4\xbd\x93" }, 130 { NSIMSUN, "\xe6\x96\xb0\xe5\xae\x8b\xe4\xbd\x93" },
131 { NSIMSUN, "MSung GB18030" },
126 { NSIMSUN, "N Song ASC" }, 132 { NSIMSUN, "N Song ASC" },
127 133
128 // 黑体 134 // 黑体
129 { SIMHEI, "Simhei" }, 135 { SIMHEI, "Simhei" },
130 { SIMHEI, "\xe9\xbb\x91\xe4\xbd\x93" }, 136 { SIMHEI, "\xe9\xbb\x91\xe4\xbd\x93" },
131 { SIMHEI, "MYingHeiGB18030" }, 137 { SIMHEI, "MYingHeiGB18030" },
132 { SIMHEI, "MYingHeiB5HK" }, 138 { SIMHEI, "MYingHeiB5HK" },
139
140 // 新細明體
141 { PMINGLIU, "PMingLiU"},
142 { PMINGLIU, "\xe6\x96\xb0\xe7\xb4\xb0\xe6\x98\x8e\xe9\xab\x94" },
143 { PMINGLIU, "MSung B5HK"},
144
145 // 細明體
146 { MINGLIU, "MingLiU"},
147 { MINGLIU, "\xe7\xb4\xb0\xe6\x98\x8e\xe9\xab\x94" },
148 { MINGLIU, "MSung B5HK"},
149
150 // 新細明體
151 { PMINGLIUHK, "PMingLiU_HKSCS"},
152 { PMINGLIUHK, "\xe6\x96\xb0\xe7\xb4\xb0\xe6\x98\x8e\xe9\xab\x94_HKSCS" } ,
153 { PMINGLIUHK, "MSung B5HK"},
154
155 // 細明體
156 { MINGLIUHK, "MingLiU_HKSCS"},
157 { MINGLIUHK, "\xe7\xb4\xb0\xe6\x98\x8e\xe9\xab\x94_HKSCS" },
158 { MINGLIUHK, "MSung B5HK"},
133 }; 159 };
134 160
135 static const size_t kFontCount = 161 static const size_t kFontCount =
136 sizeof(kFontEquivMap)/sizeof(kFontEquivMap[0]); 162 sizeof(kFontEquivMap)/sizeof(kFontEquivMap[0]);
137 163
138 // TODO(jungshik): If this loop turns out to be hot, turn 164 // TODO(jungshik): If this loop turns out to be hot, turn
139 // the array to a static (hash)map to speed it up. 165 // the array to a static (hash)map to speed it up.
140 for (size_t i = 0; i < kFontCount; ++i) { 166 for (size_t i = 0; i < kFontCount; ++i) {
141 if (strcasecmp(kFontEquivMap[i].name, fontname) == 0) 167 if (strcasecmp(kFontEquivMap[i].name, fontname) == 0)
142 return kFontEquivMap[i].clazz; 168 return kFontEquivMap[i].clazz;
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 495
470 int FontConfigDirect::Open(unsigned filefaceid) { 496 int FontConfigDirect::Open(unsigned filefaceid) {
471 SkAutoMutexAcquire ac(mutex_); 497 SkAutoMutexAcquire ac(mutex_);
472 const std::map<unsigned, std::string>::const_iterator 498 const std::map<unsigned, std::string>::const_iterator
473 i = fileid_to_filename_.find(FileFaceIdToFileId(filefaceid)); 499 i = fileid_to_filename_.find(FileFaceIdToFileId(filefaceid));
474 if (i == fileid_to_filename_.end()) 500 if (i == fileid_to_filename_.end())
475 return -1; 501 return -1;
476 502
477 return open(i->second.c_str(), O_RDONLY); 503 return open(i->second.c_str(), O_RDONLY);
478 } 504 }
OLDNEW
« no previous file with comments | « chrome/app/resources/platform_locale_settings/locale_settings_cros_zh-TW.xtb ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698