fix(cli): icon should render explicit svg text node fonts (fix: #10022) #10039
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes the first problem mentioned in #10022: SVG text nodes are generally not rendering in
cargo tauri icon
.After applying this patch, it should be observed that running
cargo tauri icon
against an SVG with a<text>
node no longer warns about not finding fonts that exist on a (Linux) system. Further, visually reviewing the resulting image files created should now show text rendered.However, the correct font is still not selected for generic font-families on Linux systems that are using
fontconfig
. This includes "sans-serif", "sans", "comic", etc. In reviewing the fontdb library, which is used for font selection, I found that the font that the library selects for generic families is not the one thatfc-match
selects. There is no warning associated here, the user would have to visually confirm that this is the case.The fontdb team is aware of the issue and has an open issue for it:
fontdb: Support automatic determination of default family names on Linux from fontconfig #24
For the time being, I would recommend explicitly defining the exact font to use in an SVG, which is typically the case anyway. Of course, distributing the font with the SVG would ensure better cross-platform compatibility regardless.