When I render a ggplot with custom fonts it works in the IDE however in Quarto. I keep getting this error:
Error in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
invalid font type
Calls: .main ... drawDetails -> drawDetails.text -> grid.Call.graphics
For example, here is my script:
---
title: "TEST"
format: pdf
editor: visual
---
This plot works:
```{r echo=FALSE, message=FALSE, warning=FALSE}
library(tidyverse)
mtcars |>
count (cyl) |>
ggplot (aes (x = cyl, y = n)) +
geom_col() +
labs (title = "Plot 1") +
geom_text (aes (label = n),
vjust = -1)
This plot does not:
mtcars |>
count (cyl) |>
ggplot (aes (x = cyl, y = n)) +
geom_col() +
labs (title = "Plot 2") +
geom_text (aes (label = n),
vjust = -1,
family = "Montserrat") +
theme (text = element_text(size = 12, family = "Montserrat"))