Skip to content

feat: add JVM platform support (JNA + AWT Graphics2D)#35

Merged
erweixin merged 2 commits intoerweixin:mainfrom
keta1:feat/jvm
Apr 8, 2026
Merged

feat: add JVM platform support (JNA + AWT Graphics2D)#35
erweixin merged 2 commits intoerweixin:mainfrom
keta1:feat/jvm

Conversation

@keta1
Copy link
Copy Markdown
Contributor

@keta1 keta1 commented Apr 7, 2026

Summary

  • Add JVM bindings for RaTeX via JNA with AWT Graphics2D rendering
  • Includes RaTeXNative (FFI), RaTeXEngine (parse API), RaTeXRenderer (float-precision drawing), RaTeXFontLoader (filesystem + classpath), and DisplayList (serialization)
  • Cross-platform build script (build-jvm.sh) with host-only and --all (cargo-zigbuild) modes
  • Swing demo app with PNG export for 16 sample formulas
  • Maven Central publishing via vanniktech plugin

Test plan

  • Run bash platforms/jvm/build-jvm.sh to build native library
  • Run demo app: cd demo/jvm && ./gradlew run
  • Run demo PNG export: cd demo/jvm && ./gradlew run --args="--png"
  • Verify rendered formulas match Android output quality

@erweixin erweixin self-assigned this Apr 7, 2026
@erweixin
Copy link
Copy Markdown
Owner

erweixin commented Apr 7, 2026

Thank you for your PR!

Do we need a release-jvm.yml workflow similar to release-android.yml?

@keta1
Copy link
Copy Markdown
Contributor Author

keta1 commented Apr 7, 2026

Yes, added release-jvm.yml in the latest commit. It follows the same pattern as release-android.yml — builds native libs for all platforms via cargo-zigbuild, then publishes to Maven Central on tag push. Uses the same secrets.

keta1 and others added 2 commits April 7, 2026 19:28
Add JVM bindings for RaTeX via JNA with AWT Graphics2D rendering:

- RaTeXNative: JNA interface to libratex_ffi C ABI
- RaTeXEngine: sync/async LaTeX parsing with proper native memory cleanup
- RaTeXRenderer: float-precision rendering using Line2D/Rectangle2D
- RaTeXFontLoader: filesystem + classpath font loading with warning logs
- DisplayList: kotlinx.serialization data classes mirroring Rust types
- build-jvm.sh: host-only and cross-platform (cargo-zigbuild) build modes
- Demo app: Swing GUI + PNG export for 16 sample formulas
- Maven Central publishing via vanniktech plugin

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Builds native libraries for all platforms (macOS/Linux/Windows,
x86-64/aarch64) via cargo-zigbuild, then publishes to Maven Central
on version tag push.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@erweixin erweixin merged commit 7fac107 into erweixin:main Apr 8, 2026
1 check passed
@keta1 keta1 deleted the feat/jvm branch April 8, 2026 02:17
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.

2 participants