You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got an .svg I'm trying to render which has text on it. The image comes up fine but none of the text is rendered.
I turned on console debug logging and it looks like fontdb (via usvg) is failing to find any of the fonts on my system (Ubuntu 20.04). Tried it with a bunch of fonts I know there are files for, no luck.
Digging around in the Druid source, looks like it might be the default usvg constructor not initializing its fontdb properly (load_system_fonts() etc). If I haven't got the wrong end of the stick, would you like me to open a merge request to add that?
RUST_LOG=debug cargo run
Compiling logic v0.1.0 (/home/myuser/myproject)
Finished dev [unoptimized + debuginfo] target(s) in 7.65s
Running `target/debug/gui`
[2021-06-16T20:11:10Z WARN usvg::svgtree::parse] Failed to parse stroke value: 'transparent'.
[2021-06-16T20:11:10Z WARN usvg::convert::text::convert] No match for 'Times,serif' font-family.
[2021-06-16T20:11:10Z WARN usvg::convert::text::convert] No match for 'Times,serif' font-family.
[2021-06-16T20:11:10Z WARN usvg::convert::text::convert] No match for 'sahadeva' font-family.
[2021-06-16T20:11:10Z WARN usvg::convert::text::convert] No match for 'sahadeva' font-family.
[2021-06-16T20:11:10Z WARN usvg::convert::text::convert] No match for 'sahadeva' font-family.
[2021-06-16T20:11:10Z WARN usvg::convert::text::convert] No match for 'sahadeva' font-family.
[2021-06-16T20:11:10Z WARN usvg::convert::text::convert] No match for 'sahadeva' font-family.
[2021-06-16T20:11:10Z WARN usvg::convert::text::convert] No match for 'sahadeva' font-family.
[2021-06-16T20:11:10Z WARN usvg::convert::text::convert] No match for 'sahadeva' font-family.
[2021-06-16T20:11:10Z WARN usvg::convert::text::convert] No match for 'sahadeva' font-family.
[2021-06-16T20:11:10Z WARN druid::menu] MenuDesc::platform_default is not implemented for this platform.
[2021-06-16T20:11:10Z DEBUG druid::localization] available locales [], current en-GB
[2021-06-16T20:11:10Z DEBUG druid::localization] resolved: [en-US]
[2021-06-16T20:11:10Z INFO druid_shell::platform::gtk::application] gtk: Activated application
Code
(Cribbed from the svg example)
use druid::{
widget::{FillStrat,Flex,Svg,SvgData,WidgetExt},AppLauncher,LocalizedString,Widget,WindowDesc,};pubfnmain(){
env_logger::init();let main_window = WindowDesc::new(|| ui_builder()).title(LocalizedString::new("svg-demo-window-title").with_placeholder("Rawr!"));let data = 0_u32;AppLauncher::with_window(main_window).launch(data).expect("launch failed");}fnui_builder() -> implWidget<u32>{let tiger_svg = include_str!("../../run/chip_000.svg").parse::<SvgData>().unwrap();letmut col = Flex::column();
col.add_flex_child(Svg::new(tiger_svg.clone()).fill_mode(FillStrat::Fill),1.0);
col.debug_paint_layout()}
Sorry to let this sit. I haven't really played around much with the svg support myself, and I don't have any particular insight, but if you are able to come up with a concise patch that gets this working for you, I'd be happy to merge!
I've got an
.svg
I'm trying to render which has text on it. The image comes up fine but none of the text is rendered.I turned on console debug logging and it looks like
fontdb
(viausvg
) is failing to find any of the fonts on my system (Ubuntu 20.04). Tried it with a bunch of fonts I know there are files for, no luck.Digging around in the Druid source, looks like it might be the default
usvg
constructor not initializing itsfontdb
properly (load_system_fonts()
etc). If I haven't got the wrong end of the stick, would you like me to open a merge request to add that?How It Looks In Druid (screenshot)
How It Looks in Firefox
SVG I was using
Log Output
Code
(Cribbed from the svg example)
Using this toml:
The text was updated successfully, but these errors were encountered: