summaryrefslogtreecommitdiffstats
path: root/src/program.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-16 16:58:48 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-16 16:58:48 +0100
commitcfc0383bbfff083786840e3f1fd499e5991fa629 (patch)
tree30306bbaee7a31090ace9d7725d46c2c0027fe6b /src/program.rs
parentbad3b1ac4777b4d9b57c6ba9473fb97753a77124 (diff)
downloadiced-cfc0383bbfff083786840e3f1fd499e5991fa629.tar.gz
iced-cfc0383bbfff083786840e3f1fd499e5991fa629.tar.bz2
iced-cfc0383bbfff083786840e3f1fd499e5991fa629.zip
Replace `Program::fonts` with simpler `font` method
Diffstat (limited to '')
-rw-r--r--src/program.rs16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/program.rs b/src/program.rs
index c6c702f1..37ff64b1 100644
--- a/src/program.rs
+++ b/src/program.rs
@@ -312,18 +312,10 @@ impl<P: Definition> Program<P> {
}
}
- /// Sets the fonts that will be loaded at the start of the [`Program`].
- pub fn fonts(
- self,
- fonts: impl IntoIterator<Item = Cow<'static, [u8]>>,
- ) -> Self {
- Self {
- settings: Settings {
- fonts: fonts.into_iter().collect(),
- ..self.settings
- },
- ..self
- }
+ /// Adds a font to the list of fonts that will be loaded at the start of the [`Program`].
+ pub fn font(mut self, font: impl Into<Cow<'static, [u8]>>) -> Self {
+ self.settings.fonts.push(font.into());
+ self
}
/// Sets the [`window::Settings::position`] to [`window::Position::Centered`] in the [`Program`].