Why iced fonts look different(maybe ugly)?

Above is a simple GTK4 application with only a label.

It respects the system-wide selected font and size. It also looks good(grayscale antialiasing selected from gnome-tweaks)

image

Below is default iced-rs font. It is not the same size with system and not looking good.

I thought it was about antialiasing, after I set Settings.antialiasing = true; it is still same. Nothing changed.

How to make iced-rs’s fonts as same as the system?

If you want your applications to look and feel exactly like GTK applications, it’s probably better to just use GTK (via the gtk4-rs crate). However, having said that, the main issue that I personally have with the default font settings in iced is the font weight (“normal” font weight looks too thin for my taste, especially with light themes).

Additionally, you could also look up what your actual system font is and maybe also adjust the size like so:

iced::application("My App", update, view)
	.settings(iced::Settings {
		default_font: iced::Font {
			family: iced::font::Family::Name("Droid Sans"),
			weight: iced::font::Weight::Medium,
			..iced::Font::default()
		},
		default_text_size: iced::Pixels(13.0),
		..iced::Settings::default()
	})
	.run()

You could also try to programmatically read (some of) these settings from your system configuration, maybe using a tool like gsettings (e.g. gsettings get org.gnome.desktop.interface font-name). If you just want to play around with iced and develop some small apps for personal use, this is a quick and dirty way.

1 Like