I wonder what is necessary to render theme aware icons in gtk-rs (GTK4) on Windows. I added icons to resources and can successfully render PNG files. Drop-in replacement with SVG does not render anything. Would it be possible to use icon-fonts like in web development? If so, how can I add a custom font in gtk4?
my folder structure
[root]
resources/
icons/
scalable/
actions/
svgicon.svg
pngicon.png
gresources.xml
src/
main.rs
window.ui
window.rs
build.rs
Cargo.toml
gresources.xml
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/myapp/gui/">
<file compressed="true">icons/scalable/actions/pngicon.png</file>
<file compressed="true">icons/scalable/actions/svgicon.svg</file>
</gresource>
</gresources>
window.ui
<child>
<object class="GtkPicture">
<property name="file">resource:///myapp/gui/icons/scalable/actions/svgicon.svg</property>
<property name="width-request">100</property>
<property name="height-request">100</property>
</object>
</child>
<child>
<object class="GtkPicture">
<property name="file">resource:///myapp/gui/icons/scalable/actions/pngicon.png</property>
<property name="width-request">100</property>
<property name="height-request">100</property>
</object>
</child>
As mentioned the png image renders but svg doesn't. I read people could use librsvg to render the svgs on windows but this can't compile because of missing libxml2 on windows. I wonder why this is so problematic and how the freedesktop (default icons) are built and rendered in gtk?
Thanks in advance for help
Luckily I could answer my answer on my own now. At the end of the rustbook for gtk-rs it explains how to use libadwita (which I am not interested in) and there it explains librsvg can be built as well with gvsbuild tool similar like gtk4 has been build
gvsbuild build libadwaita librsvg
Building this library instantly fixed my issue of not loading svgs.