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 "app/gfx/font.h" | 5 #include "app/gfx/font.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <map> | 8 #include <map> |
9 #include <pango/pango.h> | 9 #include <pango/pango.h> |
10 | 10 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 254 |
255 int Font::GetExpectedTextWidth(int length) const { | 255 int Font::GetExpectedTextWidth(int length) const { |
256 double char_width = const_cast<Font*>(this)->avg_width(); | 256 double char_width = const_cast<Font*>(this)->avg_width(); |
257 return round(static_cast<float>(length) * char_width); | 257 return round(static_cast<float>(length) * char_width); |
258 } | 258 } |
259 | 259 |
260 int Font::style() const { | 260 int Font::style() const { |
261 return style_; | 261 return style_; |
262 } | 262 } |
263 | 263 |
264 std::wstring Font::FontName() { | 264 const std::wstring& Font::FontName() const { |
265 return font_family_; | 265 return font_family_; |
266 } | 266 } |
267 | 267 |
268 int Font::FontSize() { | 268 int Font::FontSize() { |
269 return font_size_; | 269 return font_size_; |
270 } | 270 } |
271 | 271 |
272 NativeFont Font::nativeFont() const { | 272 NativeFont Font::nativeFont() const { |
273 return typeface_; | 273 return typeface_; |
274 } | 274 } |
275 | 275 |
276 } // namespace gfx | 276 } // namespace gfx |
OLD | NEW |