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

Unified Diff: skia/ports/font_mgr_factory.cc

Issue 1524473002: Remove fontconfig. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years 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 | « skia/BUILD.gn ('k') | third_party/fontconfig/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+}
« no previous file with comments | « skia/BUILD.gn ('k') | third_party/fontconfig/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698