From 6b26808148a93e14c77459eb4a8d67be98b57a8e Mon Sep 17 00:00:00 2001 From: exoticus Date: Fri, 10 Apr 2020 23:16:05 +0200 Subject: [PATCH] =?UTF-8?q?hmmm=20=F0=9F=A4=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/caching_shaper.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/renderer/caching_shaper.rs b/src/renderer/caching_shaper.rs index 160a3ae..02b7e95 100644 --- a/src/renderer/caching_shaper.rs +++ b/src/renderer/caching_shaper.rs @@ -67,16 +67,16 @@ impl ExtendedFontFamily { None } -} - -fn to_family(x: ExtendedFontFamily) -> FontFamily { - let mut y = FontFamily::new(); - for font in x.fonts { - y.add_font(font); + pub fn to_family(self) -> FontFamily { + let mut new_family = FontFamily::new(); + + for font in self.fonts { + new_family.add_font(font); + } + + new_family } - - y } pub struct FontLoader { @@ -172,19 +172,19 @@ pub fn build_collection_by_font_name( } if let Some(family) = loader.get_or_load(SYSTEM_SYMBOL_FONT, false) { - collection.add_family(to_family(family)); + collection.add_family(family.to_family()); } if let Some(family) = loader.get_or_load(SYSTEM_EMOJI_FONT, false) { - collection.add_family(to_family(family)); + collection.add_family(family.to_family()); } if let Some(family) = loader.get_or_load(EXTRA_SYMBOL_FONT, true) { - collection.add_family(to_family(family)); + collection.add_family(family.to_family()); } if let Some(family) = loader.get_or_load(MISSING_GLYPH_FONT, true) { - collection.add_family(to_family(family)); + collection.add_family(family.to_family()); } collection