This commit is contained in:
elvis
2025-12-02 05:00:48 +01:00
parent 36e5acb1ad
commit ec87f96046
3 changed files with 10 additions and 2 deletions

View File

@ -109,7 +109,9 @@ fn generate_to_evaluate(
let mut input_hashes = vec![];
match graph[n_id].user_data.template {
| NodeInstruction::SaveString | NodeInstruction::SaveSvg => {
| NodeInstruction::SaveString |
NodeInstruction::SaveSvg |
NodeInstruction::SaveRasterization => {
res.push(n_id);
invalid_ids.insert(n_id);
outputs_cache.invalidate_outputs(graph, n_id);

View File

@ -26,6 +26,9 @@ pub(crate) struct Svg {
impl Svg {
pub(crate) fn parse_dot_string(dot_str: &str) -> Result<Svg, String> {
if dot_str.is_empty() {
return Err("Dot string is empty".into());
}
let mut fontdb = fontdb::Database::new();
fontdb.load_system_fonts();
@ -43,6 +46,9 @@ impl Svg {
gb.visit_graph(&g);
let mut graph = gb.get();
let mut svg = SVGWriter::new();
if graph.num_nodes() == 0 {
return Err("No nodes in dot graph".into());
}
graph.do_it(false, false, false, &mut svg);
// convert svg to string
let content = svg.finalize();