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

Side by Side Diff: gfx/platform_font_gtk.cc

Issue 5158006: Convert SizeStringInt from taking a wstring to a string16. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « gfx/canvas_skia_mac.mm ('k') | gfx/platform_font_mac.mm » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "gfx/platform_font_gtk.h" 5 #include "gfx/platform_font_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <fontconfig/fontconfig.h> 8 #include <fontconfig/fontconfig.h>
9 #include <gdk/gdk.h> 9 #include <gdk/gdk.h>
10 #include <gtk/gtk.h> 10 #include <gtk/gtk.h>
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 int PlatformFontGtk::GetBaseline() const { 214 int PlatformFontGtk::GetBaseline() const {
215 return ascent_; 215 return ascent_;
216 } 216 }
217 217
218 int PlatformFontGtk::GetAverageCharacterWidth() const { 218 int PlatformFontGtk::GetAverageCharacterWidth() const {
219 return SkScalarRound(average_width_); 219 return SkScalarRound(average_width_);
220 } 220 }
221 221
222 int PlatformFontGtk::GetStringWidth(const std::wstring& text) const { 222 int PlatformFontGtk::GetStringWidth(const std::wstring& text) const {
223 int width = 0, height = 0; 223 int width = 0, height = 0;
224 CanvasSkia::SizeStringInt(text, Font(const_cast<PlatformFontGtk*>(this)), 224 CanvasSkia::SizeStringInt(WideToUTF16Hack(text),
225 Font(const_cast<PlatformFontGtk*>(this)),
225 &width, &height, gfx::Canvas::NO_ELLIPSIS); 226 &width, &height, gfx::Canvas::NO_ELLIPSIS);
226 return width; 227 return width;
227 } 228 }
228 229
229 int PlatformFontGtk::GetExpectedTextWidth(int length) const { 230 int PlatformFontGtk::GetExpectedTextWidth(int length) const {
230 double char_width = const_cast<PlatformFontGtk*>(this)->GetAverageWidth(); 231 double char_width = const_cast<PlatformFontGtk*>(this)->GetAverageWidth();
231 return round(static_cast<float>(length) * char_width); 232 return round(static_cast<float>(length) * char_width);
232 } 233 }
233 234
234 int PlatformFontGtk::GetStyle() const { 235 int PlatformFontGtk::GetStyle() const {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 return new PlatformFontGtk(native_font); 435 return new PlatformFontGtk(native_font);
435 } 436 }
436 437
437 // static 438 // static
438 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::wstring& font_name, 439 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::wstring& font_name,
439 int font_size) { 440 int font_size) {
440 return new PlatformFontGtk(font_name, font_size); 441 return new PlatformFontGtk(font_name, font_size);
441 } 442 }
442 443
443 } // namespace gfx 444 } // namespace gfx
OLDNEW
« no previous file with comments | « gfx/canvas_skia_mac.mm ('k') | gfx/platform_font_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698