From cfc0383bbfff083786840e3f1fd499e5991fa629 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 16 Mar 2024 16:58:48 +0100 Subject: Replace `Program::fonts` with simpler `font` method --- src/program.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/program.rs') 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 Program

{ } } - /// Sets the fonts that will be loaded at the start of the [`Program`]. - pub fn fonts( - self, - fonts: impl IntoIterator>, - ) -> 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>) -> Self { + self.settings.fonts.push(font.into()); + self } /// Sets the [`window::Settings::position`] to [`window::Position::Centered`] in the [`Program`]. -- cgit