Skip to content

Add missing font APIs#137

Merged
afsalz merged 2 commits into
mainfrom
fix/load-fonts
Jul 3, 2026
Merged

Add missing font APIs#137
afsalz merged 2 commits into
mainfrom
fix/load-fonts

Conversation

@afsalz

@afsalz afsalz commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Expose font loading APIs

Adds loadFont / unloadFont to DotLottiePlayer and DotLottieController, wired through JNI to the existing native dotlottie_load_font / dotlottie_unload_font C 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

@changeset-bot

changeset-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f155ba6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@theashraf
theashraf requested a review from Copilot July 3, 2026 05:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 / nativeUnloadFont externals to the core JNI interface (com.lottiefiles.dotlottie.core.jni.DotLottiePlayer).
  • Exposed public loadFont / unloadFont static APIs on com.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.

Comment thread dotlottie/src/main/cpp/jni_bridge.cpp
Comment thread dotlottie/src/main/cpp/jni_bridge.cpp
@afsalz
afsalz merged commit 417e521 into main Jul 3, 2026
2 checks passed
@afsalz
afsalz deleted the fix/load-fonts branch July 3, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose global in-memory font loading APIs via JNI to support font-stripped animations

3 participants