I wrote a script where I load some packages, a specific font (via extrafont), do some data wrangling, plot a graph via ggplot() and save the graph via ggsave() with device "cairo_pdf".
Everything works fine except a tiny difference by using either R-Studio or R to source the script. In R-Studio it works with no problems. In R it also runs without problems, but the PDF-File doesn't show German Umlauts (ä,ö,ü). Instead "für" it shows "für" for example.
This only happens when sourcing the script in R. When I copy & paste the contents of the script to the Console in R, the pdf contains the Umlauts as it should. Also sourcing in R-Studio is showing the Umlauts.
I'm working on Windows 10 and using R 4.0.3. Not sure if you need an MWE since this doesn't seem to be a code related problem?