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

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

Issue 10081007: Remove unused and unnecessary constructor from PlatformFont classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 default_font_ = new Font(desc); 103 default_font_ = new Font(desc);
104 pango_font_description_free(desc); 104 pango_font_description_free(desc);
105 105
106 DCHECK(default_font_); 106 DCHECK(default_font_);
107 } 107 }
108 108
109 InitFromPlatformFont( 109 InitFromPlatformFont(
110 static_cast<PlatformFontPango*>(default_font_->platform_font())); 110 static_cast<PlatformFontPango*>(default_font_->platform_font()));
111 } 111 }
112 112
113 PlatformFontPango::PlatformFontPango(const Font& other) {
114 InitFromPlatformFont(
115 static_cast<PlatformFontPango*>(other.platform_font()));
116 }
117
118 PlatformFontPango::PlatformFontPango(NativeFont native_font) { 113 PlatformFontPango::PlatformFontPango(NativeFont native_font) {
119 std::vector<std::string> family_names; 114 std::vector<std::string> family_names;
120 base::SplitString(pango_font_description_get_family(native_font), ',', 115 base::SplitString(pango_font_description_get_family(native_font), ',',
121 &family_names); 116 &family_names);
122 std::string font_family = FindBestMatchFontFamilyName(family_names); 117 std::string font_family = FindBestMatchFontFamilyName(family_names);
123 InitWithNameAndSize(font_family, gfx::GetPangoFontSizeInPixels(native_font)); 118 InitWithNameAndSize(font_family, gfx::GetPangoFontSizeInPixels(native_font));
124 119
125 int style = 0; 120 int style = 0;
126 if (pango_font_description_get_weight(native_font) == PANGO_WEIGHT_BOLD) { 121 if (pango_font_description_get_weight(native_font) == PANGO_WEIGHT_BOLD) {
127 // TODO(davemoore) What should we do about other weights? We currently 122 // TODO(davemoore) What should we do about other weights? We currently
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 379
385 //////////////////////////////////////////////////////////////////////////////// 380 ////////////////////////////////////////////////////////////////////////////////
386 // PlatformFont, public: 381 // PlatformFont, public:
387 382
388 // static 383 // static
389 PlatformFont* PlatformFont::CreateDefault() { 384 PlatformFont* PlatformFont::CreateDefault() {
390 return new PlatformFontPango; 385 return new PlatformFontPango;
391 } 386 }
392 387
393 // static 388 // static
394 PlatformFont* PlatformFont::CreateFromFont(const Font& other) {
395 return new PlatformFontPango(other);
396 }
397
398 // static
399 PlatformFont* PlatformFont::CreateFromNativeFont(NativeFont native_font) { 389 PlatformFont* PlatformFont::CreateFromNativeFont(NativeFont native_font) {
400 return new PlatformFontPango(native_font); 390 return new PlatformFontPango(native_font);
401 } 391 }
402 392
403 // static 393 // static
404 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, 394 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name,
405 int font_size) { 395 int font_size) {
406 return new PlatformFontPango(font_name, font_size); 396 return new PlatformFontPango(font_name, font_size);
407 } 397 }
408 398
409 } // namespace gfx 399 } // 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