Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // This provides a minimal factory for |SkFontMgr| (with no fonts available from | |
| 6 // the system). It uses |SkFontMgr_New_Custom_Embedded()| from | |
| 7 // third_party/skia/src/ports/SkFontMgr_custom.cpp. | |
| 8 // | |
| 9 // TODO(vtl): We should really have our own, even more minimal |SkFontMgr| | |
| 10 // implementation. SkFontMgr_custom.cpp includes the ability to gets fonts from | |
| 11 // disk (or find them from a directory), which we don't want/need, and | |
| 12 // necessitates bringing in third_party/skia/src/utils/SkOSFile.cpp. | |
| 13 | |
| 14 #include "third_party/skia/include/ports/SkFontMgr.h" | |
| 15 | |
| 16 // These are actually declared in | |
| 17 // third_party/skia/src/ports/SkFontMgr_custom.cpp (and not in any header). So | |
| 18 // we have to (partially) repeat the declarations. | |
| 19 struct SkEmbeddedResource; | |
| 20 struct SkEmbeddedResourceHeader { | |
| 21 const SkEmbeddedResource* entries; | |
| 22 int count; | |
| 23 }; | |
|
jamesr
2015/12/11 22:41:11
holy shit
| |
| 24 SkFontMgr* SkFontMgr_New_Custom_Embedded( | |
| 25 const SkEmbeddedResourceHeader* header); | |
| 26 | |
| 27 // Static factory function declared in SkFontMgr.h. | |
| 28 // static | |
| 29 SkFontMgr* SkFontMgr::Factory() { | |
| 30 static const SkEmbeddedResourceHeader kNoEmbeddedFonts = {nullptr, 0}; | |
| 31 return SkFontMgr_New_Custom_Embedded(&kNoEmbeddedFonts); | |
| 32 } | |
| OLD | NEW |