Allow users to change font used to render text in SVGs
- Dominant language
- Rust
- Stars
- 30.6k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 72
Description
Issue #5977 added text rendering support to SVGs which is very useful.
Currently however, [resvg is only directed to load system fonts](https://github.com/emilk/egui/pull/5979/changes#diff-c12631ab6062eedee2b57388d68481f603204767f15b5dea557aac6e7763a64eR37), which while useful can be limiting.
I would propose an alternate method to construct the `SVGLoader` or `ImageLoader` that allows a user to specify a font, preferably from `egui`'s already existing font handling functionality. I haven't dug through the code related to `ImageLoaders` etc too much, so not sure where or even if it is possible to add an alternate constructor method.
An alternate solution would be to tie directly into `egui`'s font handling functionality rather than default to system fonts. This would be slightly better, as your fonts would be consistent throughout the application. There still would need to be a way to select the specific font or font family.
Being able to specify or override fonts for specific font styles or families would be even better.
When I have a little bit of time, I plan on digging into `egui` and `egui_extras` code and writing up a pull request, but wanted to document the issue in the meantime.
Thanks in advance!
Contributor guide
Research direction
Start by tracing the SVGLoader and ImageLoader entry points in egui_extras, then compare their system-font loading with egui’s existing font handling. Decide how font or family selection should be exposed, including any per-style overrides, and consider how to verify that SVG text uses the selected fonts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100