From 2c15073dbce36db37ad2ba432c598024cd911f59 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Sat, 14 Dec 2024 14:31:28 -0600 Subject: [PATCH] fixed fonts sorta... Need to better understand the dangers that `Box::leak()` presents, but I think this essentially means any font that shows up with hold it's place in memory until the box is destroyed, making it seem to be 'static. --- src/ui/presenter.rs | 6 ++++-- test_presentation.lisp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ui/presenter.rs b/src/ui/presenter.rs index 0717d27..9238da5 100644 --- a/src/ui/presenter.rs +++ b/src/ui/presenter.rs @@ -265,7 +265,8 @@ impl Presenter { pub fn view(&self) -> Element { responsive(|size| { - let family = Family::Name("VictorMono Nerd Font"); + let font = self.current_slide.font().into_boxed_str(); + let family = Family::Name(Box::leak(font)); let weight = Weight::Normal; let stretch = Stretch::Normal; let style = Style::Normal; @@ -330,7 +331,8 @@ impl Presenter { pub fn view_preview(&self) -> Element { responsive(|size| { - let family = Family::Name("VictorMono Nerd Font"); + let font = self.current_slide.font().into_boxed_str(); + let family = Family::Name(Box::leak(font)); let weight = Weight::Normal; let stretch = Stretch::Normal; let style = Style::Normal; diff --git a/test_presentation.lisp b/test_presentation.lisp index 2428a10..5e7e53c 100644 --- a/test_presentation.lisp +++ b/test_presentation.lisp @@ -2,7 +2,7 @@ (text "This is frodo" :font-size 70)) (slide (video :source "~/vids/test/camprules2024.mp4" :fit contain)) (song :id 7 :author "North Point Worship" - :font "Quicksand Bold" :font-size 60 + :font "Quicksand" :font-size 60 :title "Death Was Arrested" :background (image :source "file:///home/chris/nc/tfc/openlp/CMG - Bright Mountains 01.jpg" :fit cover) :text-alignment center