Skip to content

Update lunasvg API to support v3.0+ (FreeType compat) #8656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

moretromain
Copy link
Contributor

@moretromain moretromain commented May 26, 2025

LunaSVG went to 3.0 a few months back (Oct 2024), which introduced a breaking change in the Matrix/Transform API for SVG rendering (https://github.com/sammycage/lunasvg/releases/tag/v3.0.0).
Here is an updated version of imgui_freetype with support for LunaSVG v3.0+
We could also maintain compatibility for both pre/post 3.0 by adding a ifdef on LUNASVG_VERSION_MAJOR, I didn't do it yet to keep the code as straigtforward as possible

Main changes in LunaSVG:

  • lunasvg::Matrix::transform() has been removed, in favor of Matrix::multiply(Matrix)
  • lunasvg::Document no longer carries its own transform matrix, it's up to the caller to maintain it and pass it to Document::render()

@ocornut
Copy link
Owner

ocornut commented May 26, 2025

Thank you for your PR!
cc @pthom @sakiodre for feedback.

I think we should make an effort to support both versions using compile-time checks.
Then in a year or so we can decide to remove the old code.

@moretromain
Copy link
Contributor Author

Done! I added a check on LUNASVG_VERSION_MAJOR to maintain compat with older lunasvg.
Thanks!

@ocornut
Copy link
Owner

ocornut commented May 30, 2025

Merged as e6913f5, thank you!

@ocornut ocornut closed this May 30, 2025
ocornut added a commit that referenced this pull request May 30, 2025
@pthom
Copy link
Contributor

pthom commented May 30, 2025

Thanks a lot!

@moretromain
Copy link
Contributor Author

Thanks guys, one less patch to maintain :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants