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

Side by Side Diff: content/common/font_list_gtk.cc

Issue 7044012: Support getting the font list in Pepper. This currently only works out of (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 | « content/common/font_list.h ('k') | content/common/font_list_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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/webui/options/font_settings_utils.h" 5 #include "content/common/font_list.h"
6
7 #include <pango/pango.h>
8 #include <pango/pangocairo.h>
6 9
7 #include <set> 10 #include <set>
8 #include <string> 11 #include <string>
9 12
10 #include <pango/pango.h>
11 #include <pango/pangocairo.h>
12
13 #include "base/values.h" 13 #include "base/values.h"
14 14
15 ListValue* FontSettingsUtilities::GetFontsList() { 15 namespace content {
16
17 ListValue* GetFontList_SlowBlocking() {
16 ListValue* font_list = new ListValue; 18 ListValue* font_list = new ListValue;
17 19
18 PangoFontMap* font_map = ::pango_cairo_font_map_get_default(); 20 PangoFontMap* font_map = ::pango_cairo_font_map_get_default();
19 PangoFontFamily** families = NULL; 21 PangoFontFamily** families = NULL;
20 int num_families = 0; 22 int num_families = 0;
21 ::pango_font_map_list_families(font_map, &families, &num_families); 23 ::pango_font_map_list_families(font_map, &families, &num_families);
22 24
23 std::set<std::string> sorted_families; 25 std::set<std::string> sorted_families;
24 for (int i = 0; i < num_families; i++) { 26 for (int i = 0; i < num_families; i++) {
25 sorted_families.insert(::pango_font_family_get_name(families[i])); 27 sorted_families.insert(::pango_font_family_get_name(families[i]));
26 } 28 }
27 g_free(families); 29 g_free(families);
28 30
29 for (std::set<std::string>::const_iterator iter = sorted_families.begin(); 31 for (std::set<std::string>::const_iterator iter = sorted_families.begin();
30 iter != sorted_families.end(); ++iter) { 32 iter != sorted_families.end(); ++iter) {
31 ListValue* font_item = new ListValue(); 33 ListValue* font_item = new ListValue();
32 font_item->Append(Value::CreateStringValue(*iter)); 34 font_item->Append(Value::CreateStringValue(*iter));
33 font_item->Append(Value::CreateStringValue(*iter)); // localized name. 35 font_item->Append(Value::CreateStringValue(*iter)); // localized name.
34 // TODO(yusukes): Support localized family names. 36 // TODO(yusukes): Support localized family names.
35 font_list->Append(font_item); 37 font_list->Append(font_item);
36 } 38 }
37 39
38 return font_list; 40 return font_list;
39 } 41 }
40 42
41 void FontSettingsUtilities::ValidateSavedFonts(PrefService* prefs) { 43 } // namespace content
42 // nothing to do for GTK.
43 }
OLDNEW
« no previous file with comments | « content/common/font_list.h ('k') | content/common/font_list_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698