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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 FontListImpl::FontListImpl(const std::vector<Font>& fonts) | 98 FontListImpl::FontListImpl(const std::vector<Font>& fonts) |
99 : fonts_(fonts), | 99 : fonts_(fonts), |
100 common_height_(-1), | 100 common_height_(-1), |
101 common_baseline_(-1), | 101 common_baseline_(-1), |
102 font_style_(-1), | 102 font_style_(-1), |
103 font_size_(-1) { | 103 font_size_(-1) { |
104 DCHECK(!fonts.empty()); | 104 DCHECK(!fonts.empty()); |
105 font_style_ = fonts[0].GetStyle(); | 105 font_style_ = fonts[0].GetStyle(); |
106 font_size_ = fonts[0].GetFontSize(); | 106 font_size_ = fonts[0].GetFontSize(); |
107 #if DCHECK_IS_ON | 107 #if DCHECK_IS_ON() |
108 for (size_t i = 1; i < fonts.size(); ++i) { | 108 for (size_t i = 1; i < fonts.size(); ++i) { |
109 DCHECK_EQ(fonts[i].GetStyle(), font_style_); | 109 DCHECK_EQ(fonts[i].GetStyle(), font_style_); |
110 DCHECK_EQ(fonts[i].GetFontSize(), font_size_); | 110 DCHECK_EQ(fonts[i].GetFontSize(), font_size_); |
111 } | 111 } |
112 #endif | 112 #endif |
113 } | 113 } |
114 | 114 |
115 FontListImpl::FontListImpl(const Font& font) | 115 FontListImpl::FontListImpl(const Font& font) |
116 : common_height_(-1), | 116 : common_height_(-1), |
117 common_baseline_(-1), | 117 common_baseline_(-1), |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 font_style_ = fonts_[0].GetStyle(); | 239 font_style_ = fonts_[0].GetStyle(); |
240 font_size_ = fonts_[0].GetFontSize(); | 240 font_size_ = fonts_[0].GetFontSize(); |
241 } else { | 241 } else { |
242 std::vector<std::string> font_names; | 242 std::vector<std::string> font_names; |
243 ParseFontDescriptionString(font_description_string_, &font_names, | 243 ParseFontDescriptionString(font_description_string_, &font_names, |
244 &font_style_, &font_size_); | 244 &font_style_, &font_size_); |
245 } | 245 } |
246 } | 246 } |
247 | 247 |
248 } // namespace gfx | 248 } // namespace gfx |
OLD | NEW |