1utils::globalVariables("!!")
2
3#' @import htmltools
4#' @import sass
5#' @importFrom utils modifyList packageVersion download.file URLencode getFromNamespace
6#' @importFrom stats setNames na.omit
7#' @importFrom grDevices col2rgb
8#' @importFrom tools file_path_sans_ext
9#' @importFrom jquerylib jquery_core
10#' @importFrom jsonlite fromJSON
11#' @importFrom rlang := list2
12NULL
13
14
15#' Helpers for importing web fonts
16#'
17#' `font_google()`, `font_link()`, and `font_face()` are all re-exported from
18#' the \pkg{sass} package (see [sass::font_face()] for details). For a quick
19#' example of how to use these functions with [bslib::bs_theme()], see the
20#' examples section below.
21#'
22#' @importFrom sass font_face
23#' @export font_face
24#' @name font_face
25#' @examples
26#'
27#' # If you have an internet connection, running the following code
28#' # will download, cache, and import the relevant Google Font files
29#' # for local use
30#' theme <- bs_theme(
31#'   base_font = font_google("Fira Sans"),
32#'   code_font = font_google("Fira Code"),
33#'   heading_font = font_google("Fredoka One")
34#' )
35#' if (interactive()) {
36#'   bs_theme_preview(theme)
37#' }
38#'
39#' # Three different yet equivalent ways of importing a remotely-hosted Google Font
40#' a <- font_google("Crimson Pro", wght = "200..900", local = FALSE)
41#' b <- font_link(
42#'   "Crimson Pro",
43#'   href = "https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@200..900"
44#' )
45#' url <- "https://fonts.gstatic.com/s/crimsonpro/v13/q5uDsoa5M_tv7IihmnkabARboYF6CsKj.woff2"
46#' c <- font_face(
47#'   family = "Crimson Pro",
48#'   style = "normal",
49#'   weight = "200 900",
50#'   src = paste0("url(", url, ") format('woff2')")
51#' )
52#' theme <- bs_theme(base_font = c)
53#' if (interactive()) {
54#'   bs_theme_preview(theme)
55#' }
56NULL
57
58#' @importFrom sass font_link
59#' @export font_link
60#' @name font_link
61#' @rdname font_face
62NULL
63
64#' @importFrom sass font_google
65#' @export font_google
66#' @name font_google
67#' @rdname font_face
68NULL
69
70#' @importFrom sass font_collection
71#' @export font_collection
72#' @name font_collection
73#' @rdname font_face
74NULL
75