|
8 | 8 |
|
9 | 9 | #include <utility>
|
10 | 10 |
|
| 11 | +#include "src/sk4d_comp.h" |
11 | 12 | #include "src/utils/SkOSPath.h"
|
12 | 13 | #include "modules/skottie/include/sk4d_skottie.h"
|
13 | 14 | #include "modules/skottie/src/sk4d_skottie_mapping.h"
|
14 | 15 | #include "modules/skresources/src/sk4d_resources_mapping.h"
|
| 16 | +#include "modules/skshaper/utils/FactoryHelpers.h" |
15 | 17 |
|
16 | 18 | double sk4d_skottieanimation_get_duration(const sk_skottieanimation_t* self) {
|
17 | 19 | return AsSkottieAnimation(self)->duration();
|
@@ -42,12 +44,14 @@ sk_skottieanimation_t* sk4d_skottieanimation_make_from_file(const char file_name
|
42 | 44 | if (!stream)
|
43 | 45 | return nullptr;
|
44 | 46 | auto rp = skresources::DataURIResourceProviderProxy::Make(skresources::FileResourceProvider::Make(SkOSPath::Dirname(file_name), skresources::ImageDecodeStrategy::kPreDecode), skresources::ImageDecodeStrategy::kPreDecode);
|
45 |
| - return ToSkottieAnimation(skottie::Animation::Builder().setResourceProvider(std::move(rp)).setFontManager(sk_ref_sp(AsFontMgr(font_provider))).make(stream.get()).release()); |
| 47 | + return ToSkottieAnimation(skottie::Animation::Builder().setResourceProvider(std::move(rp)).setFontManager(Sk4DComp::CustomFontMgrWithSystemFonts(sk_ref_sp(AsFontMgr(font_provider)))) |
| 48 | + .setTextShapingFactory(SkShapers::BestAvailable()).make(stream.get()).release()); |
46 | 49 | }
|
47 | 50 |
|
48 | 51 | sk_skottieanimation_t* sk4d_skottieanimation_make_from_stream(sk_stream_t* stream, sk_resourceprovider_t* resource_provider, sk_fontmgr_t* font_provider) {
|
49 | 52 | auto rp = skresources::DataURIResourceProviderProxy::Make(sk_ref_sp(AsResourceProvider(resource_provider)), skresources::ImageDecodeStrategy::kPreDecode);
|
50 |
| - return ToSkottieAnimation(skottie::Animation::Builder().setResourceProvider(std::move(rp)).setFontManager(sk_ref_sp(AsFontMgr(font_provider))).make(AsStream(stream)).release()); |
| 53 | + return ToSkottieAnimation(skottie::Animation::Builder().setResourceProvider(std::move(rp)).setFontManager(Sk4DComp::CustomFontMgrWithSystemFonts(sk_ref_sp(AsFontMgr(font_provider)))) |
| 54 | + .setTextShapingFactory(SkShapers::BestAvailable()).make(AsStream(stream)).release()); |
51 | 55 | }
|
52 | 56 |
|
53 | 57 | void sk4d_skottieanimation_ref(const sk_skottieanimation_t* self) {
|
|
0 commit comments