Don't use shorthand font property in SVG output
See original GitHub issueCurrently the SVG output of vega uses the shorthand font property. This is a feature that librsvg doesn’t support at this point (and in fact there is a discussion in that issue that kind of seems to suggest that it might not be spec compliant, although I’m not sure about that). librsvg seems by far the best option right now to convert a SVG image into PNG, PDF, PS etc., and it seems really widely used in all sorts of software. There also doesn’t seem to be any real alternative open source solution that one could use instead, so I think it would be great if vega just outputed SVG files that librsvg then can convert successfully.
The only change that would be required is really that instead of using the font
property in the CSS style
attribute, vega would output individual properties like font-style
, font-family
etc.
This is currently a pretty big problem for the julia wrapper for VegaLite.jl. We use librsvg for all our output handling (saving to PNG, PDF, PS, viewing things in clients that don’t support vega-lite nativly etc.), and this essentially means that right now any non-standard font configuration doesn’t show properly.
CC @domoritz and @kanitw because it affects a Vega-Lite frontend.
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (7 by maintainers)
Top GitHub Comments
Great. I’m closing out the issue. The updated SVG output will be included in the next Vega release!
One reason we use a single font string is for consistent use between Canvas (which accepts only a single font string) and SVG (which accepts either). So the change points noted above are correct, but changing them directly would break Canvas rendering.
It is frustrating to make changes based on another tool’s lack of coverage of web standards, but I’m also sympathetic to the arguments advanced here! I’ll take a look and see if I can find a reasonable fix.