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

Unified Diff: skia/ext/fontmgr_default_win.cc

Issue 344653002: Customize SkFontMgr::Factory to control DirectWrite vs. GDI selection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
Index: skia/ext/fontmgr_default_win.cc
diff --git a/skia/ext/fontmgr_default_win.cc b/skia/ext/fontmgr_default_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..41ce2b921dec4b622b77715cc4801a68557862a6
--- /dev/null
+++ b/skia/ext/fontmgr_default_win.cc
@@ -0,0 +1,29 @@
+// Copyright 2014 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 "skia/ext/fontmgr_default_win.h"
+
+#include "content/common/sandbox_win.h"
+#include "content/public/renderer/render_font_warmup_win.h"
+#include "third_party/skia/include/ports/SkFontMgr.h"
+#include "third_party/skia/include/ports/SkTypeface_win.h"
+
+namespace {
+
+SkFontMgr* g_default_fontmgr;
+
+} // namespace
+
+void SetDefaultSkiaFactory(SkFontMgr* fontmgr) {
+ g_default_fontmgr = fontmgr;
+}
+
+SK_API SkFontMgr* SkFontMgr::Factory() {
+ // This will be set when DirectWrite is in use, and an SkFontMgr has been
+ // created with the pre-sandbox warmed up one. Otherwise, we fallback to a
+ // GDI SkFontMgr which is used in the browser.
+ if (g_default_fontmgr)
+ return g_default_fontmgr;
+ return SkFontMgr_New_GDI();
+}

Powered by Google App Engine
This is Rietveld 408576698