| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/common/gfx/chrome_font.h" | 5 #include "chrome/common/gfx/chrome_font.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 | 9 |
| 10 #include "skia/include/SkTypeface.h" | 10 #include "skia/include/SkTypeface.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 71 } |
| 72 | 72 |
| 73 int ChromeFont::baseline() const { | 73 int ChromeFont::baseline() const { |
| 74 return ascent_; | 74 return ascent_; |
| 75 } | 75 } |
| 76 | 76 |
| 77 int ChromeFont::ave_char_width() const { | 77 int ChromeFont::ave_char_width() const { |
| 78 return avg_width_; | 78 return avg_width_; |
| 79 } | 79 } |
| 80 | 80 |
| 81 ChromeFont ChromeFont::CreateFont(const std::wstring& font_name, int font_size)
{ | 81 ChromeFont ChromeFont::CreateFont(const std::wstring& font_name, |
| 82 int font_size) { |
| 82 DCHECK_GT(font_size, 0); | 83 DCHECK_GT(font_size, 0); |
| 83 | 84 |
| 84 SkTypeface* tf = SkTypeface::Create(base::SysWideToUTF8(font_name).c_str(), | 85 SkTypeface* tf = SkTypeface::Create(base::SysWideToUTF8(font_name).c_str(), |
| 85 SkTypeface::kNormal); | 86 SkTypeface::kNormal); |
| 86 SkAutoUnref tf_helper(tf); | 87 SkAutoUnref tf_helper(tf); |
| 87 | 88 |
| 88 return ChromeFont(tf, font_name, font_size, NORMAL); | 89 return ChromeFont(tf, font_name, font_size, NORMAL); |
| 89 } | 90 } |
| 90 | 91 |
| 91 ChromeFont ChromeFont::DeriveFont(int size_delta, int style) const { | 92 ChromeFont ChromeFont::DeriveFont(int size_delta, int style) const { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 return font_name_; | 155 return font_name_; |
| 155 } | 156 } |
| 156 | 157 |
| 157 int ChromeFont::FontSize() { | 158 int ChromeFont::FontSize() { |
| 158 return font_size_; | 159 return font_size_; |
| 159 } | 160 } |
| 160 | 161 |
| 161 NativeFont ChromeFont::nativeFont() const { | 162 NativeFont ChromeFont::nativeFont() const { |
| 162 return typeface_; | 163 return typeface_; |
| 163 } | 164 } |
| OLD | NEW |