Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: ui/gfx/font_list.cc

Issue 119993002: Makes gfx::FontList carry UNDERLINE flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disabled FontListTest.FontDescString_DeriveFontListWithSizeDeltaAndStyle on Android. Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/android/pylib/gtest/filter/ui_unittests_disabled ('k') | ui/gfx/font_list_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_list.h" 5 #include "ui/gfx/font_list.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 if (font_size_ == -1) 247 if (font_size_ == -1)
248 CacheFontStyleAndSize(); 248 CacheFontStyleAndSize();
249 return font_size_; 249 return font_size_;
250 } 250 }
251 251
252 const std::vector<Font>& FontList::GetFonts() const { 252 const std::vector<Font>& FontList::GetFonts() const {
253 if (fonts_.empty()) { 253 if (fonts_.empty()) {
254 DCHECK(!font_description_string_.empty()); 254 DCHECK(!font_description_string_.empty());
255 255
256 std::vector<std::string> font_names; 256 std::vector<std::string> font_names;
257 // It's possible that gfx::Font::UNDERLINE is specified and it's already
258 // stored in |font_style_| but |font_description_string_| doesn't have the
259 // underline info. So we should respect |font_style_| as long as it's
260 // valid.
261 int style = 0;
257 ParseFontDescriptionString(font_description_string_, &font_names, 262 ParseFontDescriptionString(font_description_string_, &font_names,
258 &font_style_, &font_size_); 263 &style, &font_size_);
264 if (font_style_ == -1)
265 font_style_ = style;
259 for (size_t i = 0; i < font_names.size(); ++i) { 266 for (size_t i = 0; i < font_names.size(); ++i) {
260 DCHECK(!font_names[i].empty()); 267 DCHECK(!font_names[i].empty());
261 268
262 Font font(font_names[i], font_size_); 269 Font font(font_names[i], font_size_);
263 if (font_style_ == Font::NORMAL) 270 if (font_style_ == Font::NORMAL)
264 fonts_.push_back(font); 271 fonts_.push_back(font);
265 else 272 else
266 fonts_.push_back(font.DeriveFont(0, font_style_)); 273 fonts_.push_back(font.DeriveFont(0, font_style_));
267 } 274 }
268 } 275 }
(...skipping 22 matching lines...) Expand all
291 font_style_ = fonts_[0].GetStyle(); 298 font_style_ = fonts_[0].GetStyle();
292 font_size_ = fonts_[0].GetFontSize(); 299 font_size_ = fonts_[0].GetFontSize();
293 } else { 300 } else {
294 std::vector<std::string> font_names; 301 std::vector<std::string> font_names;
295 ParseFontDescriptionString(font_description_string_, &font_names, 302 ParseFontDescriptionString(font_description_string_, &font_names,
296 &font_style_, &font_size_); 303 &font_style_, &font_size_);
297 } 304 }
298 } 305 }
299 306
300 } // namespace gfx 307 } // namespace gfx
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/filter/ui_unittests_disabled ('k') | ui/gfx/font_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698