SVG support in Gtk4

Hi I’m using gtkmm 4, which I built using jhbuild.
My app has custom icons which are Gtk::Image objects which loads png files.
When launched on a 4K screen the icons seem too small, for this reason I tried loading svg files.
AFter reading this textures and paintables – GTK Development Blog
I tried loading the svg file using Gtk::Picture::set_filename() but the image was not visible.

I also tried loading the svg files using Gdk::Pixbuf and got exception, so I called gdk_pixbuf_get_formats() and saw that svg is not among the supported formats.
Do I need to rebuild the gtkmm library for svg support?

No, you need to install librsvg, which is the library providing the SVG loader for gdk-pixbuf.

It’s already installed, I can run rsvg-view-3 to view svg files. :thinking:

Does you distribution split the library from the gdk-pixbuf format loader?

As I said I built gdk-pixbuf. That was before I installed librsvg

You need to rebuild gdk-pixbuf then.

If you built gdk-pixbuf yourself, then you’ll have to call gdk-pixbuf-query-loaders with the location of the shared modules of the pixbuf loaders, in order to let gdk-pixbuf know that the SVG loader is now available.

Glad to find out I didn’t have to rebuild! THX!!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.