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

Unified Diff: src/ports/SkFontMgr_custom.cpp

Issue 2057293002: Implement SkFontMgr_Custom::onCreateFromFontData. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix move. Created 4 years, 6 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698