Index: src/ports/SkFontMgr_custom.cpp |
diff --git a/src/ports/SkFontMgr_custom.cpp b/src/ports/SkFontMgr_custom.cpp |
index 200173d987a4cf5030fcab2c188d1e640834eb70..0fc5180dd4ea4d3aa6b3f8e3dbf5a51bf957f30c 100644 |
--- a/src/ports/SkFontMgr_custom.cpp |
+++ b/src/ports/SkFontMgr_custom.cpp |
@@ -291,6 +291,19 @@ protected: |
return new SkTypeface_Stream(std::move(data), style, isFixedPitch, false, name); |
} |
+ SkTypeface* onCreateFromFontData(SkFontData* data) const override { |
+ bool isFixedPitch; |
+ SkFontStyle style; |
+ SkString name; |
+ if (!fScanner.scanFont(data->getStream(), data->getIndex(), |
+ &name, &style, &isFixedPitch, nullptr)) |
+ { |
+ return nullptr; |
+ } |
+ std::unique_ptr<SkFontData> unique_data(data); |
+ return new SkTypeface_Stream(std::move(unique_data), style, isFixedPitch, false, name); |
+ } |
+ |
SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override { |
SkAutoTDelete<SkStreamAsset> stream(SkStream::NewFromFile(path)); |
return stream.get() ? this->createFromStream(stream.release(), ttcIndex) : nullptr; |