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

Side by Side Diff: chrome/browser/gtk/options/fonts_page_gtk.cc

Issue 3083022: Rework gfx::Font by moving platform-specific code into inner classes.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | « chrome/browser/gtk/bookmark_utils_gtk.cc ('k') | chrome/browser/gtk/tabs/tab_renderer_gtk.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) 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 "chrome/browser/gtk/options/fonts_page_gtk.h" 5 #include "chrome/browser/gtk/options/fonts_page_gtk.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/default_encoding_combo_model.h" 10 #include "chrome/browser/default_encoding_combo_model.h"
11 #include "chrome/browser/gtk/gtk_util.h" 11 #include "chrome/browser/gtk/gtk_util.h"
12 #include "chrome/browser/gtk/options/options_layout_gtk.h" 12 #include "chrome/browser/gtk/options/options_layout_gtk.h"
13 #include "chrome/browser/profile.h" 13 #include "chrome/browser/profile.h"
14 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
15 #include "gfx/font.h" 15 #include "gfx/font.h"
16 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
17 17
18 namespace { 18 namespace {
19 19
20 // Make a Gtk font name string from a font family name and pixel size. 20 // Make a Gtk font name string from a font family name and pixel size.
21 std::string MakeFontName(std::string family_name, int pixel_size) { 21 std::string MakeFontName(std::string family_name, int pixel_size) {
22 // The given font might not be available (the default fonts we use are not 22 // The given font might not be available (the default fonts we use are not
23 // installed by default on some distros). So figure out which font we are 23 // installed by default on some distros). So figure out which font we are
24 // actually falling back to and display that. (See crbug.com/31381.) 24 // actually falling back to and display that. (See crbug.com/31381.)
25 std::wstring actual_family_name = gfx::Font::CreateFont( 25 std::wstring actual_family_name = gfx::Font(
26 UTF8ToWide(family_name), pixel_size).FontName(); 26 UTF8ToWide(family_name), pixel_size).GetFontName();
27 std::string fontname; 27 std::string fontname;
28 // TODO(mattm): We can pass in the size in pixels (px), and the font button 28 // TODO(mattm): We can pass in the size in pixels (px), and the font button
29 // actually honors it, but when you open the selector it interprets it as 29 // actually honors it, but when you open the selector it interprets it as
30 // points. See crbug.com/17857 30 // points. See crbug.com/17857
31 SStringPrintf(&fontname, "%s, %dpx", WideToUTF8(actual_family_name).c_str(), 31 SStringPrintf(&fontname, "%s, %dpx", WideToUTF8(actual_family_name).c_str(),
32 pixel_size); 32 pixel_size);
33 return fontname; 33 return fontname;
34 } 34 }
35 35
36 } // namespace 36 } // namespace
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 SetFontsFromButton(&fixed_width_name_, 177 SetFontsFromButton(&fixed_width_name_,
178 &fixed_width_size_, 178 &fixed_width_size_,
179 font_button); 179 font_button);
180 } 180 }
181 181
182 void FontsPageGtk::OnDefaultEncodingChanged(GtkWidget* combo_box) { 182 void FontsPageGtk::OnDefaultEncodingChanged(GtkWidget* combo_box) {
183 int index = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box)); 183 int index = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box));
184 default_encoding_.SetValue(default_encoding_combobox_model_-> 184 default_encoding_.SetValue(default_encoding_combobox_model_->
185 GetEncodingCharsetByIndex(index)); 185 GetEncodingCharsetByIndex(index));
186 } 186 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/bookmark_utils_gtk.cc ('k') | chrome/browser/gtk/tabs/tab_renderer_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698