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

Side by Side Diff: ui/gfx/font_fallback_win.cc

Issue 1278973003: Revert of Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/font_fallback_win.h" 5 #include "ui/gfx/font_fallback_win.h"
6 6
7 #include <usp10.h> 7 #include <usp10.h>
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 return 1; 173 return 1;
174 } 174 }
175 175
176 } // namespace 176 } // namespace
177 177
178 namespace internal { 178 namespace internal {
179 179
180 void ParseFontLinkEntry(const std::string& entry, 180 void ParseFontLinkEntry(const std::string& entry,
181 std::string* filename, 181 std::string* filename,
182 std::string* font_name) { 182 std::string* font_name) {
183 std::vector<std::string> parts = base::SplitString( 183 std::vector<std::string> parts;
184 entry, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 184 base::SplitString(entry, ',', &parts);
185 filename->clear(); 185 filename->clear();
186 font_name->clear(); 186 font_name->clear();
187 if (parts.size() > 0) 187 if (parts.size() > 0)
188 *filename = parts[0]; 188 *filename = parts[0];
189 // The second entry may be the font name or the first scaling factor, if the 189 // The second entry may be the font name or the first scaling factor, if the
190 // entry does not contain a font name. If it contains only digits, assume it 190 // entry does not contain a font name. If it contains only digits, assume it
191 // is a scaling factor. 191 // is a scaling factor.
192 if (parts.size() > 1 && !ContainsOnlyDigits(parts[1])) 192 if (parts.size() > 1 && !ContainsOnlyDigits(parts[1]))
193 *font_name = parts[1]; 193 *font_name = parts[1];
194 } 194 }
195 195
196 void ParseFontFamilyString(const std::string& family, 196 void ParseFontFamilyString(const std::string& family,
197 std::vector<std::string>* font_names) { 197 std::vector<std::string>* font_names) {
198 // The entry is comma separated, having the font filename as the first value 198 // The entry is comma separated, having the font filename as the first value
199 // followed optionally by the font family name and a pair of integer scaling 199 // followed optionally by the font family name and a pair of integer scaling
200 // factors. 200 // factors.
201 // TODO(asvitkine): Should we support these scaling factors? 201 // TODO(asvitkine): Should we support these scaling factors?
202 *font_names = base::SplitString( 202 base::SplitString(family, '&', font_names);
203 family, "&", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
204 if (!font_names->empty()) { 203 if (!font_names->empty()) {
205 const size_t index = font_names->back().find('('); 204 const size_t index = font_names->back().find('(');
206 if (index != std::string::npos) { 205 if (index != std::string::npos) {
207 font_names->back().resize(index); 206 font_names->back().resize(index);
208 base::TrimWhitespace(font_names->back(), base::TRIM_TRAILING, 207 base::TrimWhitespace(font_names->back(), base::TRIM_TRAILING,
209 &font_names->back()); 208 &font_names->back());
210 } 209 }
211 } 210 }
212 } 211 }
213 212
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 font.GetFontSize()); 321 font.GetFontSize());
323 found_fallback = true; 322 found_fallback = true;
324 } 323 }
325 } 324 }
326 DeleteEnhMetaFile(meta_file); 325 DeleteEnhMetaFile(meta_file);
327 326
328 return found_fallback; 327 return found_fallback;
329 } 328 }
330 329
331 } // namespace gfx 330 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc ('k') | ui/gfx/font_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698