I have received a few comments and questions about changing fonts in plots and themes. Some of you are running into trouble. This is, unfortunately, quite common. I debated touching upon int in class, and now i regret not doing so.
The issues with using different fonts and, specially, saving them to your pdf figure are a “common” issue, but not quite an R issue. The problem is with the tools that R uses in the background to save the images as well as with the way in which different OS let R read the system fonts. Using different fonts in figures can be a a bit challenging depending on which file format you output to. Bitmaps (.png, .jpg) are easy, because it just has to “print” the image into pixels. For .eps and .svg is relatively similar, as it draws the lines around the letters, they just become a drawing. Pdf, however, is a bit different because it actually saves the text as text. This is great because it allows you to edit it later if needed (although i wold recommend just changing the code and re-doing the figure...), and it can also be read by screen readers, making it accesible… however, it needs to embed the font in the file, and that can be a problem.
There are ways around it, and i debated going into detail on it in class. Unfortunately they are also different between Mac and PC. Given hat i have received a couple of comments about it, i will touch upon it in the beginning of the class.
For now i am going to leave you with this blog post, so you can read that blog post in detail, which goes through most of the issues and how to work around them.
Hello,
I have received a few comments and questions about changing fonts in plots and themes. Some of you are running into trouble. This is, unfortunately, quite common. I debated touching upon int in class, and now i regret not doing so.
The issues with using different fonts and, specially, saving them to your pdf figure are a “common” issue, but not quite an R issue. The problem is with the tools that R uses in the background to save the images as well as with the way in which different OS let R read the system fonts. Using different fonts in figures can be a a bit challenging depending on which file format you output to. Bitmaps (
.png
,.jpg
) are easy, because it just has to “print” the image into pixels. For.eps
and.svg
is relatively similar, as it draws the lines around the letters, they just become a drawing. Pdf, however, is a bit different because it actually saves the text as text. This is great because it allows you to edit it later if needed (although i wold recommend just changing the code and re-doing the figure...), and it can also be read by screen readers, making it accesible… however, it needs to embed the font in the file, and that can be a problem.There are ways around it, and i debated going into detail on it in class. Unfortunately they are also different between Mac and PC. Given hat i have received a couple of comments about it, i will touch upon it in the beginning of the class.
For now i am going to leave you with this blog post, so you can read that blog post in detail, which goes through most of the issues and how to work around them.
Pepe