Chromium Code Reviews| OLD | NEW | 
|---|---|
| 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 Loading... | |
| 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, gfx::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 Loading... | |
| 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 gfx::Font::Weight Font::GetWeight() const { | |
| 
 
Alexei Svitkine (slow)
2016/04/05 16:38:50
Remove gfx::
 
 | |
| 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 gfx::Font::Weight weight) { | |
| 
 
Alexei Svitkine (slow)
2016/04/05 16:38:50
Remove gfx::
 
 | |
| 96 return stream << static_cast<int>(weight); | |
| 97 } | |
| 98 #endif | |
| 99 | |
| 90 } // namespace gfx | 100 } // namespace gfx | 
| OLD | NEW |