fixing text_svg
This commit is contained in:
parent
bf6add5c67
commit
049e5bd7cc
3 changed files with 30 additions and 28 deletions
|
@ -546,34 +546,34 @@ pub(crate) fn slide_view(
|
||||||
let slide_text = slide.text();
|
let slide_text = slide.text();
|
||||||
|
|
||||||
// SVG based
|
// SVG based
|
||||||
// let font = SvgFont::from(font).size(font_size.floor() as u8);
|
let font = SvgFont::from(font).size(font_size.floor() as u8);
|
||||||
// let text = text_svg::TextSvg::new()
|
let text = text_svg::TextSvg::new()
|
||||||
// .text(&slide_text)
|
.text(&slide_text)
|
||||||
// .fill("#fff")
|
.fill("#fff")
|
||||||
// .shadow(text_svg::shadow(2, 2, 5, "#000000"))
|
.shadow(text_svg::shadow(2, 2, 5, "#000000"))
|
||||||
// .stroke(text_svg::stroke(1, "#000"))
|
.stroke(text_svg::stroke(1, "#000"))
|
||||||
// .font(font)
|
.font(font)
|
||||||
// .view()
|
.view()
|
||||||
// .map(|m| Message::None);
|
.map(|m| Message::None);
|
||||||
|
|
||||||
// let text = text!("{}", &slide_text);
|
// let text = text!("{}", &slide_text);
|
||||||
// text widget based
|
// text widget based
|
||||||
let lines = slide_text.lines();
|
// let lines = slide_text.lines();
|
||||||
let text: Vec<Element<Message>> = lines
|
// let text: Vec<Element<Message>> = lines
|
||||||
.map(|t| {
|
// .map(|t| {
|
||||||
rich_text([span(format!("{}\n", t))
|
// rich_text([span(format!("{}\n", t))
|
||||||
.background(
|
// .background(
|
||||||
Background::Color(Color::BLACK)
|
// Background::Color(Color::BLACK)
|
||||||
.scale_alpha(0.4),
|
// .scale_alpha(0.4),
|
||||||
)
|
// )
|
||||||
.padding(1)])
|
// .padding(1)])
|
||||||
.size(font_size)
|
// .size(font_size)
|
||||||
.font(font)
|
// .font(font)
|
||||||
.center()
|
// .center()
|
||||||
.into()
|
// .into()
|
||||||
})
|
// })
|
||||||
.collect();
|
// .collect();
|
||||||
let text = Column::with_children(text).spacing(6);
|
// let text = Column::with_children(text).spacing(6);
|
||||||
|
|
||||||
//Next
|
//Next
|
||||||
let text_container = Container::new(text)
|
let text_container = Container::new(text)
|
||||||
|
|
|
@ -249,11 +249,11 @@ impl TextSvg {
|
||||||
self.fill, stroke, text);
|
self.fill, stroke, text);
|
||||||
|
|
||||||
// debug!(final_svg);
|
// debug!(final_svg);
|
||||||
lazy(self.clone(), move |_s| Svg::new(Handle::from_memory(
|
Svg::new(Handle::from_memory(
|
||||||
Box::leak(<std::string::String as Clone>::clone(&final_svg).into_boxed_str()).as_bytes(),
|
Box::leak(<std::string::String as Clone>::clone(&final_svg).into_boxed_str()).as_bytes(),
|
||||||
))
|
))
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.height(Length::Fill))
|
.height(Length::Fill)
|
||||||
.into()
|
.into()
|
||||||
})).width(Length::Fill).height(Length::Fill).into()
|
})).width(Length::Fill).height(Length::Fill).into()
|
||||||
}
|
}
|
||||||
|
|
4
todo.org
4
todo.org
|
@ -7,9 +7,11 @@ This does almost work. There is a clear amount of lag or rather hang up since sw
|
||||||
|
|
||||||
Actually, what if we just made the svg at load/creation time and stored it in the file system for later, then load the entire songs svg's into memory during the presentation to speed things up? Would that be faster than creating them at on the fly? Is it the creation of them that is slow or the rendering?
|
Actually, what if we just made the svg at load/creation time and stored it in the file system for later, then load the entire songs svg's into memory during the presentation to speed things up? Would that be faster than creating them at on the fly? Is it the creation of them that is slow or the rendering?
|
||||||
|
|
||||||
** SVG performs badly
|
** ~SVG performs badly~ JK lolZ!!
|
||||||
Since SVG's apparently run poorly in iced, instead I'll need to see about either creating a new text element, or teaching Iced to render strokes and shadows on text.
|
Since SVG's apparently run poorly in iced, instead I'll need to see about either creating a new text element, or teaching Iced to render strokes and shadows on text.
|
||||||
|
|
||||||
|
Apparently svg was slow due to the lazy widget, which idk why I used in the first place.
|
||||||
|
|
||||||
* TODO [#C] Make the presenter more modular so things are easier to change.
|
* TODO [#C] Make the presenter more modular so things are easier to change.
|
||||||
|
|
||||||
* TODO [#A] Need to fix tests now that the basic app is working
|
* TODO [#A] Need to fix tests now that the basic app is working
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue