vega / vl-convert

Utilities for converting Vega-Lite specs from the command line and Python
BSD 3-Clause "New" or "Revised" License
96 stars 12 forks source link

Fix spec using labelExpr and tickBand results in error #73

Closed jonmmease closed 1 year ago

jonmmease commented 1 year ago

Closes https://github.com/vega/vl-convert/issues/72.

The issue was that we were expecting Vega to always include a "text" key when requesting the text width of a string. For some reason, with the spec from #72 the text key is missing. This PR updates out logic to treat a missing text field as an empty string and return width zero. With this change the spec renders properly:

no_text_in_font_metrics

I also made an update to the test logic to make it easier to add new image baselines in the future. Now when a baseline doesn't exist the computed image is written to the "failed" directory.