Chromium Code Reviews| 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..120d641c80adae4f66b7f3d84c1a5f3d38546b77 |
| --- /dev/null |
| +++ b/content/browser/renderer_host/pepper/pepper_truetype_font_list_linux.cc |
| @@ -0,0 +1,35 @@ |
| +// 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 { |
| + |
| +std::vector<std::string> GetFontFamilies_SlowBlocking() { |
| + 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++) { |
|
dmichael (off chromium)
2013/03/12 18:07:58
nit: Don't need curly braces here; inconsistent w.
bbudge
2013/03/13 01:26:50
Done.
|
| + sorted_families.insert(::pango_font_family_get_name(families[i])); |
| + } |
| + g_free(families); |
| + |
| + std::vector<std::string> font_families; |
| + 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/12 18:07:58
vector has a begin/end constructor that should wor
bbudge
2013/03/13 01:26:50
This is now an 'out' param rather than return valu
|
| + |
| + return font_families; |
| +} |
| + |
| +} // namespace content |