Closed jonmmease closed 1 year ago
When a font specification includes a font family quoted in double quotes, image export crashes the Python kernel.
import vl_convert as vlc spec = { "$schema": "https://vega.github.io/schema/vega-lite/v5.json", "layer": [ { "data": { "name": "df", "values": [{"a": 1, "b": 1}, {"a": 2, "b": 3}, {"a": 3, "b": 2}] }, "layer": [ { "transform": [], "layer": [ { "mark": {"type": "line"}, } ], "encoding": { "x": { "field": "a", "type": "quantitative" }, "y": { "field": "b", "type": "quantitative" }, } } ] } ], "config": { "style": { "guide-label": { "font": "Arial, sans-serif" }, "guide-title": { "font": "Arial, sans-serif" } } } } # Works ok svg = vlc.vegalite_to_svg(spec) # Update font strings to quote Arial. Crashes kernel spec["config"]["style"]["guide-label"]["font"] = "\"Arial\", sans-serif" spec["config"]["style"]["guide-label"]["font"] = "\"Arial\", sans-serif" svg = vlc.vegalite_to_svg(spec)
A little more info in the stack trace is available when running the example in Rust:
thread '<unnamed>' panicked at 'Failed to parse text SVG: ParsingFailed(ParserError(InvalidAttribute(InvalidSpace(73, TextPos { row: 3, col: 54 }), TextPos { row: 3, col: 54 })))', vl-convert-rs/src/text.rs:187:59 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace fatal runtime error: failed to initiate panic, error 5 Fatal Python error: Aborted
The first thing we should do is update error handling to not panic and crash the kernel on SVG parse failure. Then we should fix the bug 😄
When a font specification includes a font family quoted in double quotes, image export crashes the Python kernel.
A little more info in the stack trace is available when running the example in Rust:
The first thing we should do is update error handling to not panic and crash the kernel on SVG parse failure. Then we should fix the bug 😄