Closed steveharoz closed 8 months ago
This is just handed off to the R graphics engine so you should be able to use the generic fonts that R knows. See e.g. here (was the first link I found, not otherwise relevant): https://cran.r-project.org/web/packages/svglite/vignettes/fonts.html
library(ggplot2)
mtcars |>
tibble::rownames_to_column(var = "model") |>
ggplot() +
aes(x = disp, y = mpg) +
ggtext::geom_richtext(
aes(label = glue::glue("<span style='font-family:mono;'>{model}</span>"))
)
Created on 2023-11-13 with reprex v2.0.2
In a browser, you can use generic font-types for font families. For example `My website: <span style"font-family: monospace;">http://abcd.com
But that doesn't seem to work with ggtext. It'd be great if that ability was added for those of us who can never remember the names of fonts. Here are some web-safe fallbacks: