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

egui_extras: feature svg_text #4659

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

egui_extras: feature svg_text #4659

wants to merge 3 commits into from

Conversation

xNWP
Copy link

@xNWP xNWP commented Jun 14, 2024

Added

  • Adds svg text rendering support via the svg_text feature flag.

Changed

  • Updates resvg from 0.37 to 0.42.

Copy link
Contributor

@murl-digital murl-digital left a comment

Choose a reason for hiding this comment

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

that allow(unused_mut) caught my eye but otherwise lgtm

edit: i should really read commit messages first, could you put in a comment explaining it?

crates/egui_extras/src/image.rs Show resolved Hide resolved
@xNWP
Copy link
Author

xNWP commented Jun 14, 2024

that allow(unused_mut) caught my eye but otherwise lgtm

edit: i should really read commit messages first, could you put in a comment explaining it?

commented!

@murl-digital
Copy link
Contributor

i think for demonstration purposes (and to make testing easier in the future), it'd be a good idea to add an example that shows text in svgs in action

Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

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

I agree that an example would be nice, but LGTM anyway.

Would this text rendering work on web?

@xNWP
Copy link
Author

xNWP commented Jun 20, 2024

Would this text rendering work on web?

I was wondering the same thing shortly after making the PR 😅, I'm not great at web dev stuff but I'll take a look at it now and test some things.

i think for demonstration purposes (and to make testing easier in the future), it'd be a good idea to add an example that shows text in svgs in action

after checking the web stuff I'll also look at how y'all test/write example code and see what I can do 😊

@xNWP
Copy link
Author

xNWP commented Jun 22, 2024

Would this text rendering work on web?

Short answer, no.
Long answer is that the main workhorse of this PR is the load_system_fonts function on the Font Database type that resvg re-exports from the fontdb crate (https://github.com/RazrFalcon/fontdb/blob/fd24f8c9d7b57f30a6f6ba560c697a7854c94858/src/lib.rs#L352). This function is just a conditional compilation switch based on the target os which simply does nothing for wasm. I looked into how support could be added to this crate, however it looks like the way to do it would be the Local Font Access API which has little to no browser support (only experimental Chrome + Edge support) https://developer.mozilla.org/en-US/docs/Web/API/Local_Font_Access_API

@emilk
Copy link
Owner

emilk commented Jun 23, 2024

Thanks for testing web. Please document your findings, i.e. document that the svg_text won't work on web, and why (linking to relevant issues, if any).

We should also figure out a solution to the duplicated dependencies.

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.

None yet

3 participants