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

Side by Side Diff: app/gfx/font_skia.cc

Issue 115877: linux: simplify gfx::Font constructor logic and add CHECK()s. (Closed)
Patch Set: Created 11 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 | « app/gfx/font_gtk.cc ('k') | no next file » | 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) 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 "app/gfx/canvas.h" 7 #include "app/gfx/canvas.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 int Font::ave_char_width() const { 79 int Font::ave_char_width() const {
80 return avg_width_; 80 return avg_width_;
81 } 81 }
82 82
83 Font Font::CreateFont(const std::wstring& font_family, int font_size) { 83 Font Font::CreateFont(const std::wstring& font_family, int font_size) {
84 DCHECK_GT(font_size, 0); 84 DCHECK_GT(font_size, 0);
85 85
86 SkTypeface* tf = SkTypeface::CreateFromName( 86 SkTypeface* tf = SkTypeface::CreateFromName(
87 base::SysWideToUTF8(font_family).c_str(), SkTypeface::kNormal); 87 base::SysWideToUTF8(font_family).c_str(), SkTypeface::kNormal);
88 DCHECK(tf) << "Could not find font: " << base::SysWideToUTF8(font_family); 88 // Temporary CHECK for tracking down
89 // http://code.google.com/p/chromium/issues/detail?id=12530
90 CHECK(tf) << "Could not find font: " << base::SysWideToUTF8(font_family);
89 SkAutoUnref tf_helper(tf); 91 SkAutoUnref tf_helper(tf);
90 92
91 return Font(tf, font_family, font_size, NORMAL); 93 return Font(tf, font_family, font_size, NORMAL);
92 } 94 }
93 95
94 Font Font::DeriveFont(int size_delta, int style) const { 96 Font Font::DeriveFont(int size_delta, int style) const {
95 // If the delta is negative, if must not push the size below 1 97 // If the delta is negative, if must not push the size below 1
96 if (size_delta < 0) { 98 if (size_delta < 0) {
97 DCHECK_LT(-size_delta, font_size_); 99 DCHECK_LT(-size_delta, font_size_);
98 } 100 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 151
150 int Font::FontSize() { 152 int Font::FontSize() {
151 return font_size_; 153 return font_size_;
152 } 154 }
153 155
154 NativeFont Font::nativeFont() const { 156 NativeFont Font::nativeFont() const {
155 return typeface_; 157 return typeface_;
156 } 158 }
157 159
158 } // namespace gfx 160 } // namespace gfx
OLDNEW
« no previous file with comments | « app/gfx/font_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698