Arcadia-Science / arcadiathemeR

Package for creating ggplot style plots in R that adhere to Arcadia Science style guidelines
Other
1 stars 0 forks source link

Fixed loading/embedding fonts and custom save function #31

Closed elizabethmcd closed 2 months ago

elizabethmcd commented 2 months ago

This PR reworks the logic of loading our custom fonts. The load_arcadia_fonts() function now uses the extrafont package instead of showtext package in order to embed the fonts in exported plots. This fixes the large problem in #27 where fonts loaded with showtext were exported as paths/shapes and not as text or vectors, and therefore not editable in Illustrator. This is now fixed. The font loading function has also been changed to execute and check/load the fonts when the package is loaded instead of being called every time the theme_arcadia() function is applied to a plot. Changing to this logic also prints the specific Suisse fonts that are used when the package is loaded, which addresses #15.

This PR also adds a custom save function which addresses #5 so users don't have to remember things like DPI and sizing (which I'm not sure I have correctly here but it is easily adjustable).

This should be the last PR before I cut the first release. There are still some small issues and enhancement requests but what was fixed here were previously the largest barriers to cutting a release.

@taylorreiter I kindly request that in addition to reviewing this PR, that you install this branch of the package and test that this actually works on your system, and that you can export plots with editable text in Illustrator. This would give me increased confidence that things are working properly and ready for a first release of the package.

elizabethmcd commented 2 months ago

One question inline, but when I tried to install and run this I get:

library(arcadiathemeR)
Loading Suisse fonts...
Custom fonts 'Suisse Int'l Semi Bold, Suisse Int'l Medium, Suisse Int'l Mono' not found. Using fallback font 'sans'.

I scrolled through the readme and didn't see any instructions for where my font files should live for arcadiathemeR to find them.

I just added instructions for downloading the fonts (specifically for the R package to work you must have the .ttf formatted files) and where to put them. I also added the note that this is only confirmed to work on Mac OS.

elizabethmcd commented 2 months ago

@mezarque @taylorreiter Wondering if I can get one of you to take one last look and raise any last issues or give approval so I can cut a release today before teaching the AUG session.