summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--examples/checkbox/src/main.rs2
-rw-r--r--src/program.rs16
2 files changed, 5 insertions, 13 deletions
diff --git a/examples/checkbox/src/main.rs b/examples/checkbox/src/main.rs
index c9ee502e..8d18cb81 100644
--- a/examples/checkbox/src/main.rs
+++ b/examples/checkbox/src/main.rs
@@ -5,7 +5,7 @@ const ICON_FONT: Font = Font::with_name("icons");
pub fn main() -> iced::Result {
iced::sandbox("Checkbox - Iced", Example::update, Example::view)
- .fonts([include_bytes!("../fonts/icons.ttf").as_slice().into()])
+ .font(include_bytes!("../fonts/icons.ttf").as_slice())
.run()
}
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`].