diff --git a/src/skia/Font.cpp b/src/skia/Font.cpp index 307ff1009..0b5b42ba9 100644 --- a/src/skia/Font.cpp +++ b/src/skia/Font.cpp @@ -1,6 +1,7 @@ #include "common.h" #include #include +#include #include #include #include @@ -369,6 +370,22 @@ fontarguments &SkFontArguments::getVariationDesignPosition) ; +py::class_ font_scanner(m, "FontScanner"); + +font_scanner + .def(py::init(&SkFontScanner_Make_FreeType)) + .def("scanFile", &SkFontScanner::scanFile, + py::arg("stream"), py::arg("numFaces")) + .def("scanFace", &SkFontScanner::scanFace, + py::arg("stream"), py::arg("faceIndex"), py::arg("numInstances")) + .def("MakeFromData", + [] (const SkFontScanner& self, sk_sp data, const SkFontArguments& args) { + std::unique_ptr stream(new SkMemoryStream(data)); + return self.MakeFromStream(std::move(stream), args); + }, + py::arg("data"), py::arg("args")) + ; + py::class_, SkRefCnt> typeface( m, "Typeface", R"docstring( The :py:class:`Typeface` class specifies the typeface and intrinsic style of diff --git a/src/skia/TextBlob.cpp b/src/skia/TextBlob.cpp index 8ff1fa709..8994b6424 100644 --- a/src/skia/TextBlob.cpp +++ b/src/skia/TextBlob.cpp @@ -65,6 +65,10 @@ py::class_(iter, "Run") iter .def(py::init()) + .def("__iter__", + [] (SkTextBlob::Iter& it) { + return it; + }) .def("__next__", [] (SkTextBlob::Iter& it) { SkTextBlob::Iter::Run run;