Reputation: 2489
I'm trying to move away from the extrafont
package due to these issues. This is a bit of a shame as apart from that this package works great; but alas it seems that showtext
is the best alternative.
But I'm struggling a bit as the documentation of the package is very short.
I have added one of my custom fonts (actually it's about 15) using:
library(showtext)
font_add(family = "Myriad Pro",regular = "C:/USER/Downloads/Myriad Pro Regular.ttf")
showtext_auto()
And then I would suspect that in every new script (once I've installed the font) I would only need something like this:
library(showtext)
showtext_auto()
library(ggplot2)
ggplot(mtcars, aes(y = hp, x = mpg)) + geom_line() + theme(text = element_text(family = "Myriad Pro"))
But then it always gives me about 50 warnings:
...
48: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... :
font family 'Myriad Pro' not found, will use 'sans' instead
49: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... :
font family 'Myriad Pro' not found, will use 'sans' instead
50: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... :
font family 'Myriad Pro' not found, will use 'sans' instead
Am I doing something wrong? Surely it can't be that I need to import the font every single time I start a new script, right?
Thanks for your help!
p.s. font used here available from here.
Upvotes: 0
Views: 204