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 <usp10.h> | 7 #include <usp10.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // system fonts and their font link chains. | 106 // system fonts and their font link chains. |
107 class CachedFontLinkSettings { | 107 class CachedFontLinkSettings { |
108 public: | 108 public: |
109 static CachedFontLinkSettings* GetInstance(); | 109 static CachedFontLinkSettings* GetInstance(); |
110 | 110 |
111 // Returns the linked fonts list correspond to |font|. Returned value will | 111 // Returns the linked fonts list correspond to |font|. Returned value will |
112 // never be null. | 112 // never be null. |
113 const std::vector<Font>* GetLinkedFonts(const Font& font); | 113 const std::vector<Font>* GetLinkedFonts(const Font& font); |
114 | 114 |
115 private: | 115 private: |
116 friend struct DefaultSingletonTraits<CachedFontLinkSettings>; | 116 friend struct base::DefaultSingletonTraits<CachedFontLinkSettings>; |
117 | 117 |
118 CachedFontLinkSettings(); | 118 CachedFontLinkSettings(); |
119 virtual ~CachedFontLinkSettings(); | 119 virtual ~CachedFontLinkSettings(); |
120 | 120 |
121 // Map of system fonts, from file names to font families. | 121 // Map of system fonts, from file names to font families. |
122 std::map<std::string, std::string> cached_system_fonts_; | 122 std::map<std::string, std::string> cached_system_fonts_; |
123 | 123 |
124 // Map from font names to vectors of linked fonts. | 124 // Map from font names to vectors of linked fonts. |
125 std::map<std::string, std::vector<Font> > cached_linked_fonts_; | 125 std::map<std::string, std::vector<Font> > cached_linked_fonts_; |
126 | 126 |
127 DISALLOW_COPY_AND_ASSIGN(CachedFontLinkSettings); | 127 DISALLOW_COPY_AND_ASSIGN(CachedFontLinkSettings); |
128 }; | 128 }; |
129 | 129 |
130 // static | 130 // static |
131 CachedFontLinkSettings* CachedFontLinkSettings::GetInstance() { | 131 CachedFontLinkSettings* CachedFontLinkSettings::GetInstance() { |
132 return Singleton<CachedFontLinkSettings, | 132 return base::Singleton< |
133 LeakySingletonTraits<CachedFontLinkSettings> >::get(); | 133 CachedFontLinkSettings, |
| 134 base::LeakySingletonTraits<CachedFontLinkSettings>>::get(); |
134 } | 135 } |
135 | 136 |
136 const std::vector<Font>* CachedFontLinkSettings::GetLinkedFonts( | 137 const std::vector<Font>* CachedFontLinkSettings::GetLinkedFonts( |
137 const Font& font) { | 138 const Font& font) { |
138 const std::string& font_name = font.GetFontName(); | 139 const std::string& font_name = font.GetFontName(); |
139 std::map<std::string, std::vector<Font> >::const_iterator it = | 140 std::map<std::string, std::vector<Font> >::const_iterator it = |
140 cached_linked_fonts_.find(font_name); | 141 cached_linked_fonts_.find(font_name); |
141 if (it != cached_linked_fonts_.end()) | 142 if (it != cached_linked_fonts_.end()) |
142 return &it->second; | 143 return &it->second; |
143 | 144 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 font.GetFontSize()); | 323 font.GetFontSize()); |
323 found_fallback = true; | 324 found_fallback = true; |
324 } | 325 } |
325 } | 326 } |
326 DeleteEnhMetaFile(meta_file); | 327 DeleteEnhMetaFile(meta_file); |
327 | 328 |
328 return found_fallback; | 329 return found_fallback; |
329 } | 330 } |
330 | 331 |
331 } // namespace gfx | 332 } // namespace gfx |
OLD | NEW |