Add missing font APIs#137
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR exposes process-wide font registration APIs to Kotlin/Java by wiring dotlottie_load_font / dotlottie_unload_font through the existing JNI bridge, enabling font-stripped animations to resolve text styles when loaded from in-memory data sources.
Changes:
- Added
nativeLoadFont/nativeUnloadFontexternals to the core JNI interface (com.lottiefiles.dotlottie.core.jni.DotLottiePlayer). - Exposed public
loadFont/unloadFontstatic APIs oncom.dotlottie.dlplayer.DotLottiePlayer. - Added matching convenience APIs on
DotLottieController(Compose runtime) delegating to the player-level APIs. - Implemented the corresponding JNI bridge functions and registered them via
RegisterNatives.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| dotlottie/src/main/kotlin/com/lottiefiles/dotlottie/core/jni/DotLottiePlayer.kt | Declares new JNI externals for font load/unload. |
| dotlottie/src/main/kotlin/com/dotlottie/dlplayer/DotLottiePlayer.kt | Exposes public Kotlin/Java static loadFont / unloadFont wrappers returning Boolean success. |
| dotlottie/src/main/java/com/lottiefiles/dotlottie/core/compose/runtime/DotLottieController.kt | Adds Compose-side static convenience methods delegating to DotLottiePlayer. |
| dotlottie/src/main/cpp/jni_bridge.cpp | Implements and registers the new JNI methods calling the native C APIs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Expose font loading APIs
Adds
loadFont/unloadFonttoDotLottiePlayerandDotLottieController, wired through JNI to the existing nativedotlottie_load_font/dotlottie_unload_fontC API (not previously exposed to Kotlin).Lets callers register a font by name into ThorVG's global font registry before an animation loads.
Closes #126