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

Unified Diff: content/browser/renderer_host/pepper/pepper_truetype_font_list_win.cc

Issue 12600019: Add Pepper TrueType font API plumbing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux_aura. Pango headers missing. Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/pepper/pepper_truetype_font_list_mac.mm ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/pepper/pepper_truetype_font_list_win.cc
diff --git a/content/browser/renderer_host/pepper/pepper_truetype_font_list_win.cc b/content/browser/renderer_host/pepper/pepper_truetype_font_list_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6a3ee0faf0c07bc21048453de21c77ed106476c4
--- /dev/null
+++ b/content/browser/renderer_host/pepper/pepper_truetype_font_list_win.cc
@@ -0,0 +1,44 @@
+// 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 <windows.h>
+
+#include "base/utf_string_conversions.h"
+#include "base/win/scoped_hdc.h"
+
+namespace content {
+
+namespace {
+
+static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEXW* logical_font,
+ NEWTEXTMETRICEXW* physical_font,
+ DWORD font_type,
+ LPARAM lparam) {
+ std::vector<std::string>* font_families =
+ reinterpret_cast<std::vector<std::string>*>(lparam);
+ if (font_families) {
+ const LOGFONTW& lf = logical_font->elfLogFont;
+ if (lf.lfFaceName[0] && lf.lfFaceName[0] != '@' &&
+ lf.lfOutPrecision == OUT_STROKE_PRECIS) { // Outline fonts only.
+ std::string face_name(UTF16ToUTF8(lf.lfFaceName));
+ font_families->push_back(face_name);
+ }
+ }
+ return 1;
+}
+
+} // namespace
+
+void GetFontFamilies_SlowBlocking(std::vector<std::string>* font_families) {
+ LOGFONTW logfont;
+ memset(&logfont, 0, sizeof(logfont));
+ logfont.lfCharSet = DEFAULT_CHARSET;
+ base::win::ScopedCreateDC hdc(::GetDC(NULL));
+ ::EnumFontFamiliesExW(hdc, &logfont, (FONTENUMPROCW)&EnumFontFamExProc,
+ (LPARAM)font_families, 0);
+}
+
+} // namespace content
« no previous file with comments | « content/browser/renderer_host/pepper/pepper_truetype_font_list_mac.mm ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698