Replace Program::fonts with simpler font method
This commit is contained in:
parent
bad3b1ac47
commit
cfc0383bbf
2 changed files with 5 additions and 13 deletions
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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`].
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue