OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_list_impl.h" | 5 #include "ui/gfx/font_list_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 } | 181 } |
182 return font_description_string_; | 182 return font_description_string_; |
183 } | 183 } |
184 | 184 |
185 int FontListImpl::GetFontSize() const { | 185 int FontListImpl::GetFontSize() const { |
186 if (font_size_ == -1) | 186 if (font_size_ == -1) |
187 CacheFontStyleAndSize(); | 187 CacheFontStyleAndSize(); |
188 return font_size_; | 188 return font_size_; |
189 } | 189 } |
190 | 190 |
| 191 const FontRenderParams& FontListImpl::GetFontRenderParams() const { |
| 192 return GetPrimaryFont().GetFontRenderParams(); |
| 193 } |
| 194 |
191 const std::vector<Font>& FontListImpl::GetFonts() const { | 195 const std::vector<Font>& FontListImpl::GetFonts() const { |
192 if (fonts_.empty()) { | 196 if (fonts_.empty()) { |
193 DCHECK(!font_description_string_.empty()); | 197 DCHECK(!font_description_string_.empty()); |
194 | 198 |
195 std::vector<std::string> font_names; | 199 std::vector<std::string> font_names; |
196 // It's possible that gfx::Font::UNDERLINE is specified and it's already | 200 // It's possible that gfx::Font::UNDERLINE is specified and it's already |
197 // stored in |font_style_| but |font_description_string_| doesn't have the | 201 // stored in |font_style_| but |font_description_string_| doesn't have the |
198 // underline info. So we should respect |font_style_| as long as it's | 202 // underline info. So we should respect |font_style_| as long as it's |
199 // valid. | 203 // valid. |
200 int style = 0; | 204 int style = 0; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 font_style_ = fonts_[0].GetStyle(); | 243 font_style_ = fonts_[0].GetStyle(); |
240 font_size_ = fonts_[0].GetFontSize(); | 244 font_size_ = fonts_[0].GetFontSize(); |
241 } else { | 245 } else { |
242 std::vector<std::string> font_names; | 246 std::vector<std::string> font_names; |
243 ParseFontDescriptionString(font_description_string_, &font_names, | 247 ParseFontDescriptionString(font_description_string_, &font_names, |
244 &font_style_, &font_size_); | 248 &font_style_, &font_size_); |
245 } | 249 } |
246 } | 250 } |
247 | 251 |
248 } // namespace gfx | 252 } // namespace gfx |
OLD | NEW |