vega / vl-convert

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

Vendor fallback sans-serif font #10

Closed jonmmease closed 1 year ago

jonmmease commented 1 year ago

By default, Vega specifies "sans-serif" as the font family for text in exported SVG files. Also by default, resvg looks for "Arial" as the "sans-serif" font family. When Arial is not available, text will fail to render properly.

This PR embeds the "Liberation Sans" font in the vl-convert-rs crate and uses it as the fallback for "sans-serif" when "Arial" and "Helvetica" are not available. Liberation Sans was chosen because it is very similar to Arial (See comparison at http://www.identifont.com/differences?first=Arial&second=Liberation+Sans&q=Go) and is released under the SIL Open Font License which allows for redistribution. The license text is included in at vl-convert-rs/fonts/liberation-sans/SIL Open Font License.txt.

Hat tip to https://github.com/daylinmorgan/okab/issues/1 for the idea!