Quarto Windows font database warning

Can someone help me solve the Windows font database problem as described below?

Operating system: Windows 11 Pro.
Quarto: version 1.3.450
R version: R-4.3.1
RStudio IDE: 2023.09.01 Build 494

In a quarto document (.qmd file) , when I run a R chunk with ggplot code the correct assigned base_family font, e.g. Comic Sans MS, is shown in the plot.

When I render the quarto document from within RStudio IDE a font warning is shown (see below), and the font is incorrect:

Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family
not found in Windows font database

My Quarto-R code:

author: Miguel Eersel
toc: true


penguins <- palmerpenguins::penguins |> 

penguins |> 
  ggplot(aes(species, bill_length_mm, fill = sex)) +
    size = 3,
    alpha = 0.75,
    shape = 21,
    col = 'black',
    position = position_jitterdodge(seed = 34543)
  ) +
  theme_minimal(base_size = 16, base_family = "Comic Sans MS")  +

    x = element_blank(),
    y = element_blank(),
    subtitle = 'Bill Length',
    fill = 'Sex',
    title = 'Chinstrap Penguins have the Strongest Difference\nin Bill Lengths Between Genders',
  ) +
  scale_fill_discrete(labels = \(x) str_to_title(x)) 

A stupid question but are you sure you have this font installed?

I don't have it as I am using Linux but your code is fine if I substitute a Linux font. I used base_family = "Lobster Two") which is a rather neat font.


Searching the Internet, I have found a solution for my problem.

Install packages {extrafont} and {extrafontdb}

Download and install the new fonts.

In RStudio IDE in R, register the new fonts only once:

In the Quarto document, in the first R-chunk add:

1 Like

Nice, it appears you solved your problem.
Please indicate it is closed.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.