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

Side by Side Diff: ui/gfx/platform_font_pango.cc

Issue 16051006: ui/gfx: Use base::string16 now that string16 was moved into base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 | « ui/gfx/platform_font_pango.h ('k') | ui/gfx/platform_font_win.h » ('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) 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/platform_font_pango.h" 5 #include "ui/gfx/platform_font_pango.h"
6 6
7 #include <fontconfig/fontconfig.h> 7 #include <fontconfig/fontconfig.h>
8 #include <pango/pango.h> 8 #include <pango/pango.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 int PlatformFontPango::GetBaseline() const { 192 int PlatformFontPango::GetBaseline() const {
193 return ascent_pixels_; 193 return ascent_pixels_;
194 } 194 }
195 195
196 int PlatformFontPango::GetAverageCharacterWidth() const { 196 int PlatformFontPango::GetAverageCharacterWidth() const {
197 const_cast<PlatformFontPango*>(this)->InitPangoMetrics(); 197 const_cast<PlatformFontPango*>(this)->InitPangoMetrics();
198 return SkScalarRound(average_width_pixels_); 198 return SkScalarRound(average_width_pixels_);
199 } 199 }
200 200
201 int PlatformFontPango::GetStringWidth(const string16& text) const { 201 int PlatformFontPango::GetStringWidth(const base::string16& text) const {
202 return Canvas::GetStringWidth(text, 202 return Canvas::GetStringWidth(text,
203 Font(const_cast<PlatformFontPango*>(this))); 203 Font(const_cast<PlatformFontPango*>(this)));
204 } 204 }
205 205
206 int PlatformFontPango::GetExpectedTextWidth(int length) const { 206 int PlatformFontPango::GetExpectedTextWidth(int length) const {
207 double char_width = const_cast<PlatformFontPango*>(this)->GetAverageWidth(); 207 double char_width = const_cast<PlatformFontPango*>(this)->GetAverageWidth();
208 return round(static_cast<float>(length) * char_width); 208 return round(static_cast<float>(length) * char_width);
209 } 209 }
210 210
211 int PlatformFontPango::GetStyle() const { 211 int PlatformFontPango::GetStyle() const {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 return new PlatformFontPango(native_font); 384 return new PlatformFontPango(native_font);
385 } 385 }
386 386
387 // static 387 // static
388 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, 388 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name,
389 int font_size) { 389 int font_size) {
390 return new PlatformFontPango(font_name, font_size); 390 return new PlatformFontPango(font_name, font_size);
391 } 391 }
392 392
393 } // namespace gfx 393 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/platform_font_pango.h ('k') | ui/gfx/platform_font_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698