| 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" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "ui/gfx/font.h" | 12 #include "ui/gfx/font.h" |
| 13 #include "ui/gfx/font_list.h" | 13 #include "ui/gfx/font_list.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // Returns a font description from |families|, |style|, and |size_pixels|. | 17 // Returns a font description from |families|, |style|, and |size_pixels|. |
| 18 std::string BuildDescription(const std::vector<std::string>& families, | 18 std::string BuildDescription(const std::vector<std::string>& families, |
| 19 int style, | 19 int style, |
| 20 int size_pixels) { | 20 int size_pixels) { |
| 21 std::string description = base::JoinString(families, ","); | 21 std::string description = JoinString(families, ','); |
| 22 description += ","; | 22 description += ","; |
| 23 | 23 |
| 24 if (style & gfx::Font::BOLD) | 24 if (style & gfx::Font::BOLD) |
| 25 description += "Bold "; | 25 description += "Bold "; |
| 26 if (style & gfx::Font::ITALIC) | 26 if (style & gfx::Font::ITALIC) |
| 27 description += "Italic "; | 27 description += "Italic "; |
| 28 | 28 |
| 29 description += base::IntToString(size_pixels); | 29 description += base::IntToString(size_pixels); |
| 30 description += "px"; | 30 description += "px"; |
| 31 | 31 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 font_style_ = fonts_[0].GetStyle(); | 189 font_style_ = fonts_[0].GetStyle(); |
| 190 font_size_ = fonts_[0].GetFontSize(); | 190 font_size_ = fonts_[0].GetFontSize(); |
| 191 } else { | 191 } else { |
| 192 std::vector<std::string> font_names; | 192 std::vector<std::string> font_names; |
| 193 CHECK(FontList::ParseDescription(font_description_string_, &font_names, | 193 CHECK(FontList::ParseDescription(font_description_string_, &font_names, |
| 194 &font_style_, &font_size_)); | 194 &font_style_, &font_size_)); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace gfx | 198 } // namespace gfx |
| OLD | NEW |