Skip to contents

A minimal helper for specifying text font and size. If font_family is NULL, it is resolved to "Open Sans" (with a warning if the family is not available and a fallback is used).

Usage

style_text(size = 11, font_family = NULL)

Arguments

size

Numeric ggplot2 text size (mm).

font_family

Optional font family name. If NULL, defaults to "Open Sans".

Value

A named list with elements size, font_family.

Examples

# Use default font family ("Open Sans" if available)
style_text(size = 11)
#> ! Font family "Open Sans" not found; using default family "DejaVu Sans".
#> $size
#> [1] 11
#> 
#> $font_family
#> [1] "DejaVu Sans"
#> 

# Explicit font
style_text(size = 11, font_family = "Helvetica")
#> ! Font family "Helvetica" not found; using default family "Nimbus Sans".
#> $size
#> [1] 11
#> 
#> $font_family
#> [1] "Nimbus Sans"
#>