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

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

Issue 1819753003: Allow various font weights in gfx. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a lost comment and modify a render text unittest to not test black because of test env font con… Created 4 years, 6 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
« no previous file with comments | « ui/gfx/font.h ('k') | ui/gfx/font_list.h » ('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.h" 5 #include "ui/gfx/font.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "ui/gfx/platform_font.h" 9 #include "ui/gfx/platform_font.h"
10 10
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 Font::Font(const std::string& font_name, int font_size) 36 Font::Font(const std::string& font_name, int font_size)
37 : platform_font_(PlatformFont::CreateFromNameAndSize(font_name, 37 : platform_font_(PlatformFont::CreateFromNameAndSize(font_name,
38 font_size)) { 38 font_size)) {
39 } 39 }
40 40
41 Font::~Font() { 41 Font::~Font() {
42 } 42 }
43 43
44 Font Font::Derive(int size_delta, int style) const { 44 Font Font::Derive(int size_delta, int style, Font::Weight weight) const {
45 return platform_font_->DeriveFont(size_delta, style); 45 return platform_font_->DeriveFont(size_delta, style, weight);
46 } 46 }
47 47
48 int Font::GetHeight() const { 48 int Font::GetHeight() const {
49 return platform_font_->GetHeight(); 49 return platform_font_->GetHeight();
50 } 50 }
51 51
52 int Font::GetBaseline() const { 52 int Font::GetBaseline() const {
53 return platform_font_->GetBaseline(); 53 return platform_font_->GetBaseline();
54 } 54 }
55 55
(...skipping 14 matching lines...) Expand all
70 } 70 }
71 71
72 std::string Font::GetActualFontNameForTesting() const { 72 std::string Font::GetActualFontNameForTesting() const {
73 return platform_font_->GetActualFontNameForTesting(); 73 return platform_font_->GetActualFontNameForTesting();
74 } 74 }
75 75
76 int Font::GetFontSize() const { 76 int Font::GetFontSize() const {
77 return platform_font_->GetFontSize(); 77 return platform_font_->GetFontSize();
78 } 78 }
79 79
80 Font::Weight Font::GetWeight() const {
81 return platform_font_->GetWeight();
82 }
83
80 const FontRenderParams& Font::GetFontRenderParams() const { 84 const FontRenderParams& Font::GetFontRenderParams() const {
81 return platform_font_->GetFontRenderParams(); 85 return platform_font_->GetFontRenderParams();
82 } 86 }
83 87
84 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_IOS) 88 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_IOS)
85 NativeFont Font::GetNativeFont() const { 89 NativeFont Font::GetNativeFont() const {
86 return platform_font_->GetNativeFont(); 90 return platform_font_->GetNativeFont();
87 } 91 }
88 #endif 92 #endif
89 93
94 #ifndef NDEBUG
95 std::ostream& operator<<(std::ostream& stream, const Font::Weight weight) {
96 return stream << static_cast<int>(weight);
97 }
98 #endif
99
90 } // namespace gfx 100 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/font.h ('k') | ui/gfx/font_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698