Index: skia/ext/fontmgr_default_win.cc |
=================================================================== |
--- skia/ext/fontmgr_default_win.cc (revision 0) |
+++ skia/ext/fontmgr_default_win.cc (working copy) |
@@ -0,0 +1,29 @@ |
+// Copyright (c) 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 "third_party/skia/include/core/SkTypes.h" |
+#include "third_party/skia/include/ports/SkFontMgr.h" |
+#include "third_party/skia/include/ports/SkTypeface_win.h" |
+ |
+namespace { |
+ |
+static SkFontMgr* default_fontmgr = NULL; |
+ |
+}; // namespace |
+ |
+void SK_API SkSetFontMgr(SkFontMgr* fontmgr) { |
+ ::default_fontmgr = SkRef(fontmgr); |
+} |
+ |
+SkFontMgr* SkFontMgr::Factory() { |
+ if (::default_fontmgr) { |
+ return SkRef(::default_fontmgr); |
+ } else { |
+ SkFontMgr* fontmgr = SkFontMgr_New_DirectWrite(); |
+ if (NULL == fontmgr) { |
+ fontmgr = SkFontMgr_New_GDI(); |
+ } |
+ return fontmgr; |
+ } |
+} |