Skip to content
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

Allow disabling image loading and saving functionalities #38

Closed
wants to merge 1 commit into from

Conversation

takase1121
Copy link

@takase1121 takase1121 commented Sep 22, 2024

I am testing out PlutoSVG to render OT-SVG fonts in Lite XL. I'm impressed by the results (it did work) but I've noticed a 400kb increase in the binary size, in -O3 stripped. I then noticed that plutovg is vendoring stb_image to load surfaces from images and write surfaces to files. I am only planning to use Pluto(S)VG to render graphics to memory, so I didn't need to stb_image and stb_image_write to read and write images.

This PR includes the PLUTOVG_USE_STB_IMAGE (CMake) and use_stb_image (meson) options to enable / disable image support. This would also indirectly allow the library to support other image libraries in the future, like how nanovg/fontstash.h supports FreeType and stbtt for rendering text. The following screenshot shows 300kb being saved by just omitting stb_image.h and stb_image_write.h.

stb_image included stb_image not included
image image

@sammycage
Copy link
Owner

sammycage commented Sep 22, 2024

Thank you for your contribution! I understand your concern about the increase in binary size. It's fantastic to hear that PlutoSVG is performing well for rendering OT-SVG fonts in Lite XL!

Image loading is crucial for PlutoSVG to fully adhere to the OTF-SVG specifications, as it must support PNG and JPEG formats for accurate rendering. Your suggestion to provide options for enabling or disabling image support is a valuable insight.

@sammycage sammycage added the wontfix This will not be worked on label Oct 9, 2024
@sammycage sammycage closed this Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants