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.
This commit is contained in:
Chris Cochrun 2024-12-14 14:31:28 -06:00
parent 96419003a7
commit 2c15073dbc
2 changed files with 5 additions and 3 deletions

View file

@ -265,7 +265,8 @@ impl Presenter {
pub fn view(&self) -> Element<Message> { pub fn view(&self) -> Element<Message> {
responsive(|size| { 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 weight = Weight::Normal;
let stretch = Stretch::Normal; let stretch = Stretch::Normal;
let style = Style::Normal; let style = Style::Normal;
@ -330,7 +331,8 @@ impl Presenter {
pub fn view_preview(&self) -> Element<Message> { pub fn view_preview(&self) -> Element<Message> {
responsive(|size| { 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 weight = Weight::Normal;
let stretch = Stretch::Normal; let stretch = Stretch::Normal;
let style = Style::Normal; let style = Style::Normal;

View file

@ -2,7 +2,7 @@
(text "This is frodo" :font-size 70)) (text "This is frodo" :font-size 70))
(slide (video :source "~/vids/test/camprules2024.mp4" :fit contain)) (slide (video :source "~/vids/test/camprules2024.mp4" :fit contain))
(song :id 7 :author "North Point Worship" (song :id 7 :author "North Point Worship"
:font "Quicksand Bold" :font-size 60 :font "Quicksand" :font-size 60
:title "Death Was Arrested" :title "Death Was Arrested"
:background (image :source "file:///home/chris/nc/tfc/openlp/CMG - Bright Mountains 01.jpg" :fit cover) :background (image :source "file:///home/chris/nc/tfc/openlp/CMG - Bright Mountains 01.jpg" :fit cover)
:text-alignment center :text-alignment center