Index: content/browser/renderer_host/pepper/pepper_truetype_font_list_linux.cc |
diff --git a/content/browser/renderer_host/pepper/pepper_truetype_font_list_linux.cc b/content/browser/renderer_host/pepper/pepper_truetype_font_list_linux.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b077753f49272e95e60d576b4ff80cca933ceac4 |
--- /dev/null |
+++ b/content/browser/renderer_host/pepper/pepper_truetype_font_list_linux.cc |
@@ -0,0 +1,32 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/browser/renderer_host/pepper/pepper_truetype_font_list.h" |
+ |
+#include <pango/pango.h> |
+#include <pango/pangocairo.h> |
+ |
+#include <set> |
+#include <string> |
+ |
+namespace content { |
+ |
+void GetFontFamilies_SlowBlocking(std::vector<std::string>* font_families) { |
+ PangoFontMap* font_map = ::pango_cairo_font_map_get_default(); |
+ PangoFontFamily** families = NULL; |
+ int num_families = 0; |
+ ::pango_font_map_list_families(font_map, &families, &num_families); |
+ |
+ std::set<std::string> sorted_families; |
+ for (int i = 0; i < num_families; i++) |
+ sorted_families.insert(::pango_font_family_get_name(families[i])); |
dmichael (off chromium)
2013/03/13 20:20:25
BTW, why do you do the intermediate set thing? Is
bbudge
2013/03/13 21:20:37
This code is originally from content/common/font_l
bbudge
2013/03/13 22:48:50
I removed the use of a set. I sort the vector in t
|
+ g_free(families); |
+ |
dmichael (off chromium)
2013/03/13 20:20:25
DCHECK(font_families->empty());
?
bbudge
2013/03/13 21:20:37
See comment below.
On 2013/03/13 20:20:25, dmichae
bbudge
2013/03/13 22:48:50
This API is pretty foolproof. There is no provisio
|
+ font_families->reserve(sorted_families.size()); |
+ std::set<std::string>::const_iterator iter = sorted_families.begin(); |
+ for (; iter != sorted_families.end(); ++iter) |
+ font_families->push_back(*iter); |
dmichael (off chromium)
2013/03/13 20:20:25
could also do font_families->insert(font_families.
bbudge
2013/03/13 22:48:50
Eliminated 'set'
On 2013/03/13 20:20:25, dmichael
|
+} |
+ |
+} // namespace content |