Index: skia/ports/font_mgr_factory.cc |
diff --git a/skia/ports/font_mgr_factory.cc b/skia/ports/font_mgr_factory.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..781b7abf7f224481616427e968298f6fb8095e8a |
--- /dev/null |
+++ b/skia/ports/font_mgr_factory.cc |
@@ -0,0 +1,32 @@ |
+// Copyright 2015 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. |
+ |
+// This provides a minimal factory for |SkFontMgr| (with no fonts available from |
+// the system). It uses |SkFontMgr_New_Custom_Embedded()| from |
+// third_party/skia/src/ports/SkFontMgr_custom.cpp. |
+// |
+// TODO(vtl): We should really have our own, even more minimal |SkFontMgr| |
+// implementation. SkFontMgr_custom.cpp includes the ability to gets fonts from |
+// disk (or find them from a directory), which we don't want/need, and |
+// necessitates bringing in third_party/skia/src/utils/SkOSFile.cpp. |
+ |
+#include "third_party/skia/include/ports/SkFontMgr.h" |
+ |
+// These are actually declared in |
+// third_party/skia/src/ports/SkFontMgr_custom.cpp (and not in any header). So |
+// we have to (partially) repeat the declarations. |
+struct SkEmbeddedResource; |
+struct SkEmbeddedResourceHeader { |
+ const SkEmbeddedResource* entries; |
+ int count; |
+}; |
jamesr
2015/12/11 22:41:11
holy shit
|
+SkFontMgr* SkFontMgr_New_Custom_Embedded( |
+ const SkEmbeddedResourceHeader* header); |
+ |
+// Static factory function declared in SkFontMgr.h. |
+// static |
+SkFontMgr* SkFontMgr::Factory() { |
+ static const SkEmbeddedResourceHeader kNoEmbeddedFonts = {nullptr, 0}; |
+ return SkFontMgr_New_Custom_Embedded(&kNoEmbeddedFonts); |
+} |