Index: src/ports/SkFontMgr_fontconfig.cpp |
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp |
index 88d4de59297b342fbe1482c0771569bb93d27663..6a40e5080d4fa55ad81069914b0f1c2ad6968fbb 100644 |
--- a/src/ports/SkFontMgr_fontconfig.cpp |
+++ b/src/ports/SkFontMgr_fontconfig.cpp |
@@ -834,6 +834,29 @@ protected: |
isFixedWidth); |
} |
+ SkTypeface* onCreateFromStream(SkStreamAsset* s, const FontParameters& params) const override { |
+ using Scanner = SkTypeface_FreeType::Scanner; |
+ SkAutoTDelete<SkStreamAsset> stream(s); |
+ bool isFixedPitch; |
+ SkFontStyle style; |
+ SkString name; |
+ Scanner::AxisDefinitions axisDefinitions; |
+ if (!fScanner.scanFont(stream, params.getCollectionIndex(), &name, &style, &isFixedPitch, |
+ &axisDefinitions)) |
+ { |
+ return nullptr; |
+ } |
+ |
+ int paramAxisCount; |
+ const FontParameters::Axis* paramAxes = params.getAxes(¶mAxisCount); |
+ SkAutoSTMalloc<4, SkFixed> axisValues(axisDefinitions.count()); |
+ Scanner::computeAxisValues(axisDefinitions, paramAxes, paramAxisCount, axisValues, name); |
+ |
+ SkFontData* data(new SkFontData(stream.detach(), params.getCollectionIndex(), |
+ axisValues.get(), axisDefinitions.count())); |
+ return new SkTypeface_stream(data, style, isFixedPitch); |
+ } |
+ |
SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override { |
return this->createFromStream(new SkMemoryStream(data), ttcIndex); |
} |