question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't use shorthand font property in SVG output

See original GitHub issue

Currently 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:closed
  • Created 5 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
jheercommented, Jun 12, 2018

Great. I’m closing out the issue. The updated SVG output will be included in the next Vega release!

1reaction
jheercommented, Jun 11, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Use SVG Font Properties - Vanseo Design
The font shorthand is only available as a CSS property and can't be used as an attribute on SVG elements. One thing to...
Read more >
Text — SVG 2
It is normally the same baseline as the dominant baseline but by using the shorthand vertical-align property (preferred) or the longhand alignment-baseline ...
Read more >
Font Shorthand | CSS-Tricks
You need to supply at least font-size and font-family for the shorthand to work, otherwise it'll just be a syntax error and do...
Read more >
CSS Font Shorthand Property - W3Schools
To shorten the code, it is also possible to specify all the individual font properties in one property. The font property is a...
Read more >
The Beginner's Guide to CSS Shorthand - HubSpot Blog
In addition to the CSS border property, the margin, padding, background, font, animation, transition, and flex properties all have a shorthand.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found