R graphics get modern text support, with ragg package

February 16, 2021

Topic

Coding  /  , ,

Thomas Lin Pedersen announced the ragg package, which makes font usage in R more straightforward:

I’m extremely pleased to present the culmination of several years of work spanning the systemfonts, textshaping, and ragg packages. These releases complete our efforts to create a high-quality, performant raster graphics device that works the same way on every operating system.

This blog post presents our improvements to ragg’s font rendering so that it now “just works” regardless of what you throw at it. This includes:

  1. Support for non-Latin scripts including Right-to-Left (RtL) scripts
  2. Support for OpenType features such as ligatures, glyph substitutions, etc.
  3. Support for color fonts
  4. Support for font fallback

All of the above comes in addition to the fact that ragg is able to use all of your installed fonts.

If you’ve tried to make publication-level graphics completely in R, you’re probably familiar with the challenge of using non-default fonts. The correct steps depend on your system and the words you want to add. It’s one of the reasons I bring R output into Adobe Illustrator, so now there’s one less extra step. Nice.