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();
|
||||
|
||||
// SVG based
|
||||
// let font = SvgFont::from(font).size(font_size.floor() as u8);
|
||||
// let text = text_svg::TextSvg::new()
|
||||
// .text(&slide_text)
|
||||
// .fill("#fff")
|
||||
// .shadow(text_svg::shadow(2, 2, 5, "#000000"))
|
||||
// .stroke(text_svg::stroke(1, "#000"))
|
||||
// .font(font)
|
||||
// .view()
|
||||
// .map(|m| Message::None);
|
||||
let font = SvgFont::from(font).size(font_size.floor() as u8);
|
||||
let text = text_svg::TextSvg::new()
|
||||
.text(&slide_text)
|
||||
.fill("#fff")
|
||||
.shadow(text_svg::shadow(2, 2, 5, "#000000"))
|
||||
.stroke(text_svg::stroke(1, "#000"))
|
||||
.font(font)
|
||||
.view()
|
||||
.map(|m| Message::None);
|
||||
|
||||
// let text = text!("{}", &slide_text);
|
||||
// text widget based
|
||||
let lines = slide_text.lines();
|
||||
let text: Vec<Element<Message>> = lines
|
||||
.map(|t| {
|
||||
rich_text([span(format!("{}\n", t))
|
||||
.background(
|
||||
Background::Color(Color::BLACK)
|
||||
.scale_alpha(0.4),
|
||||
)
|
||||
.padding(1)])
|
||||
.size(font_size)
|
||||
.font(font)
|
||||
.center()
|
||||
.into()
|
||||
})
|
||||
.collect();
|
||||
let text = Column::with_children(text).spacing(6);
|
||||
// let lines = slide_text.lines();
|
||||
// let text: Vec<Element<Message>> = lines
|
||||
// .map(|t| {
|
||||
// rich_text([span(format!("{}\n", t))
|
||||
// .background(
|
||||
// Background::Color(Color::BLACK)
|
||||
// .scale_alpha(0.4),
|
||||
// )
|
||||
// .padding(1)])
|
||||
// .size(font_size)
|
||||
// .font(font)
|
||||
// .center()
|
||||
// .into()
|
||||
// })
|
||||
// .collect();
|
||||
// let text = Column::with_children(text).spacing(6);
|
||||
|
||||
//Next
|
||||
let text_container = Container::new(text)
|
||||
|
|
|
@ -249,11 +249,11 @@ impl TextSvg {
|
|||
self.fill, stroke, text);
|
||||
|
||||
// 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(),
|
||||
))
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill))
|
||||
.height(Length::Fill)
|
||||
.into()
|
||||
})).width(Length::Fill).height(Length::Fill).into()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue