iced_core/settings.rs
1//! Configure your application.
2use crate::{Font, Pixels};
3
4use std::borrow::Cow;
5
6/// The settings of an iced program.
7#[derive(Debug, Clone)]
8pub struct Settings {
9 /// The identifier of the application.
10 ///
11 /// If provided, this identifier may be used to identify the application or
12 /// communicate with it through the windowing system.
13 pub id: Option<String>,
14
15 /// The fonts to load on boot.
16 pub fonts: Vec<Cow<'static, [u8]>>,
17
18 /// The default [`Font`] to be used.
19 ///
20 /// By default, it uses [`Family::SansSerif`](crate::font::Family::SansSerif).
21 pub default_font: Font,
22
23 /// The text size that will be used by default.
24 ///
25 /// The default value is `16.0`.
26 pub default_text_size: Pixels,
27
28 /// If set to true, the renderer will try to perform antialiasing for some
29 /// primitives.
30 ///
31 /// Enabling it can produce a smoother result in some widgets, like the
32 /// `canvas` widget, at a performance cost.
33 ///
34 /// By default, it is disabled.
35 pub antialiasing: bool,
36}
37
38impl Default for Settings {
39 fn default() -> Self {
40 Self {
41 id: None,
42 fonts: Vec::new(),
43 default_font: Font::default(),
44 default_text_size: Pixels(16.0),
45 antialiasing: false,
46 }
47 }
48}