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 26 matching lines...) Expand all Loading... |
37 namespace gfx { | 37 namespace gfx { |
38 | 38 |
39 FontListImpl::FontListImpl(const std::string& font_description_string) | 39 FontListImpl::FontListImpl(const std::string& font_description_string) |
40 : font_description_string_(font_description_string), | 40 : font_description_string_(font_description_string), |
41 common_height_(-1), | 41 common_height_(-1), |
42 common_baseline_(-1), | 42 common_baseline_(-1), |
43 font_style_(-1), | 43 font_style_(-1), |
44 font_size_(-1) { | 44 font_size_(-1) { |
45 DCHECK(!font_description_string.empty()); | 45 DCHECK(!font_description_string.empty()); |
46 // DCHECK description string ends with "px" for size in pixel. | 46 // DCHECK description string ends with "px" for size in pixel. |
47 DCHECK(base::EndsWith(font_description_string, "px", true)); | 47 DCHECK(base::EndsWith(font_description_string, "px", |
| 48 base::CompareCase::SENSITIVE)); |
48 } | 49 } |
49 | 50 |
50 FontListImpl::FontListImpl(const std::vector<std::string>& font_names, | 51 FontListImpl::FontListImpl(const std::vector<std::string>& font_names, |
51 int font_style, | 52 int font_style, |
52 int font_size) | 53 int font_size) |
53 : font_description_string_(BuildDescription(font_names, font_style, | 54 : font_description_string_(BuildDescription(font_names, font_style, |
54 font_size)), | 55 font_size)), |
55 common_height_(-1), | 56 common_height_(-1), |
56 common_baseline_(-1), | 57 common_baseline_(-1), |
57 font_style_(font_style), | 58 font_style_(font_style), |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 font_style_ = fonts_[0].GetStyle(); | 190 font_style_ = fonts_[0].GetStyle(); |
190 font_size_ = fonts_[0].GetFontSize(); | 191 font_size_ = fonts_[0].GetFontSize(); |
191 } else { | 192 } else { |
192 std::vector<std::string> font_names; | 193 std::vector<std::string> font_names; |
193 CHECK(FontList::ParseDescription(font_description_string_, &font_names, | 194 CHECK(FontList::ParseDescription(font_description_string_, &font_names, |
194 &font_style_, &font_size_)); | 195 &font_style_, &font_size_)); |
195 } | 196 } |
196 } | 197 } |
197 | 198 |
198 } // namespace gfx | 199 } // namespace gfx |
OLD | NEW |