OLD | NEW |
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 <map> | 7 #include <map> |
8 | 8 |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 std::map<std::string, std::string>::const_iterator it = | 41 std::map<std::string, std::string>::const_iterator it = |
42 font_map->find(StringToLowerASCII(filename)); | 42 font_map->find(StringToLowerASCII(filename)); |
43 if (it == font_map->end()) | 43 if (it == font_map->end()) |
44 return; | 44 return; |
45 | 45 |
46 internal::ParseFontFamilyString(it->second, font_names); | 46 internal::ParseFontFamilyString(it->second, font_names); |
47 } | 47 } |
48 | 48 |
49 // Returns true if |text| contains only ASCII digits. | 49 // Returns true if |text| contains only ASCII digits. |
50 bool ContainsOnlyDigits(const std::string& text) { | 50 bool ContainsOnlyDigits(const std::string& text) { |
51 return text.find_first_not_of("0123456789") == string16::npos; | 51 return text.find_first_not_of("0123456789") == base::string16::npos; |
52 } | 52 } |
53 | 53 |
54 // Appends a Font with the given |name| and |size| to |fonts| unless the last | 54 // Appends a Font with the given |name| and |size| to |fonts| unless the last |
55 // entry is already a font with that name. | 55 // entry is already a font with that name. |
56 void AppendFont(const std::string& name, int size, std::vector<Font>* fonts) { | 56 void AppendFont(const std::string& name, int size, std::vector<Font>* fonts) { |
57 if (fonts->empty() || fonts->back().GetFontName() != name) | 57 if (fonts->empty() || fonts->back().GetFontName() != name) |
58 fonts->push_back(Font(name, size)); | 58 fonts->push_back(Font(name, size)); |
59 } | 59 } |
60 | 60 |
61 // Queries the registry to get a list of linked fonts for |font|. | 61 // Queries the registry to get a list of linked fonts for |font|. |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // Note: One possibility would be to always merge both lists of fonts, | 234 // Note: One possibility would be to always merge both lists of fonts, |
235 // but it is not clear whether there are any real world scenarios | 235 // but it is not clear whether there are any real world scenarios |
236 // where this would actually help. | 236 // where this would actually help. |
237 if (fonts->empty()) | 237 if (fonts->empty()) |
238 fonts = font_link->GetLinkedFonts(current_font_); | 238 fonts = font_link->GetLinkedFonts(current_font_); |
239 | 239 |
240 return fonts; | 240 return fonts; |
241 } | 241 } |
242 | 242 |
243 } // namespace gfx | 243 } // namespace gfx |
OLD | NEW |