r-lib / ragg
1
get_dims <- function(width, height, units, res) {
2 1
  dims <- c(width, height) * switch(
3 1
    units,
4 1
    'in' = res,
5 1
    'cm' = res / 2.54,
6 1
    'mm' = res / 25.4,
7 1
    'px' = 1,
8 1
    stop('Unknown unit. Please use either px, in, cm, or, mm', call. = FALSE)
9
  )
10 1
  as.integer(dims)
11
}
12

13
validate_path <- function(path) {
14 1
  dir <- dirname(path)
15 1
  if (!dir.exists(dir)) {
16 0
    dir.create(dir, recursive = TRUE)
17
  }
18 1
  dir <- normalizePath(dir)
19 1
  file.path(dir, basename(path))
20
}
21

22
#' @importFrom systemfonts register_font
23
#' @export
24
systemfonts::register_font
25

26
#' @importFrom systemfonts register_variant
27
#' @export
28
systemfonts::register_variant
29

30
#' @importFrom systemfonts font_feature
31
#' @export
32
systemfonts::font_feature
33

34
#' @importFrom textshaping get_font_features
35
#' @export
36
textshaping::get_font_features

Read our documentation on viewing source code .

Loading