Today we are pleased to release a new version of svglite. This release fixes many bugs, includes new documentation vignettes, and improves fonts support.
You can install svglite with:
Fonts are tricky with SVG because they are needed at two stages:
When creating the SVG file, the fonts are needed in order to correctly measure the amount space each character occupies. This is particularly important for plot that use
When drawing the SVG file on screen, the fonts are needed to draw each character correctly.
For the best display, that means you need to have the same fonts installed on both the computer that generates the SVG file and the computer that draws it. By default, svglite uses fonts that are installed on pretty much every computer. svglite’s font support is now much more flexible thanks to two new arguments:
system_fontsallows you to specify the name of a font installed on your computer. This is useful, for example, if you’d like to use a font with better CJK support:
svglite("Rplots.svg", system_fonts = list(sans = "Arial Unicode MS")) plot.new() text(0.5, 0.5, "正規分布") dev.off()
user_fontsallows you to specify a font installed in a R package (like fontquiver). This is needed if you want to generate identical plot across different operating systems, and are using in the upcoming vdiffr package which provides graphical unit tests.
For more details, see
This update also fixes many bugs. The most important is that text is now properly scaled within the plot, and we provide a vignette that describes the details:
vignette("scaling"). It documents, for instance, how to include a svglite graphic in a web page with the figure text consistently scaled with the surrounding text.
Find a full list of changes in the release notes.
Welcome to the rstudio::glimpse() newsletter. Get a glimpse into our tools and how to use them.
Python users can now use Shiny to create interactive data-driven web applications by writing Python code.