
Register a handwriting font for reproducible sketch text
Source:R/fonts-sketch.R
register_sketch_font.RdRegisters a font file under a family name with systemfonts so that
geom_sketch_text(), theme_sketch() (base_family = "auto"), and the
font resolver can find it on font-aware devices (ragg, svglite, cairo)
without installing the font system-wide. Call it once per session (e.g. in a
script or .Rprofile); ship the .ttf/.otf alongside your project for
fully reproducible output.
Arguments
- family
Family name to register the font under (e.g.
"Caveat"). This is the name you then pass tofamily =orbase_family =.- plain
Path to the regular/plain font file (
.ttfor.otf).- bold, italic, bolditalic
Optional paths to the bold/italic faces; default to
plain.- ...
Passed to
systemfonts::register_font().
See also
Other sketch-theme:
element_sketch_line(),
ggsketch_check_fonts(),
scale_roughness_continuous(),
scale_sketch,
sketch_palette(),
theme_sketch()
Examples
if (FALSE) { # \dontrun{
# Download Caveat from Google Fonts, then:
register_sketch_font("Caveat", "fonts/Caveat-Regular.ttf")
library(ggplot2)
ggplot(mtcars, aes(wt, mpg)) +
geom_sketch_point(seed = 1L) +
theme_sketch(base_family = "Caveat")
} # }