Nothing
#' @param version Version of the library
#' @rdname fontawesome
#' @importFrom utils download.file
#' @export
download_fontawesome <- function(version = "dev"){
if(version == "dev"){
url <- "https://github.com/FortAwesome/Font-Awesome/archive/master.zip"
version <- jsonlite::read_json("https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest")$tag_name
}
else{
url <- glue("https://github.com/FortAwesome/Font-Awesome/archive/{version}.zip")
version <- package_version(version)
}
if(version >= package_version("5.6.0")){
path <- "svgs"
}
else{
path <- c("advanced-options", "raw-svg")
}
install_icon_zip(
"fontawesome", url, path,
meta = list(name = "Font Awesome", version = version, licence = "CC BY 4.0")
)
invisible(fontawesome)
}
#' Font Awesome icons
#'
#' @param name Name of the icon
#' @param style Style of the icon. If NULL, a default style will be chosen for the specified icon.
#'
#' @section License:
#' This package uses Font Awesome Free. Its icons are distributed under the
#' [CC BY 4.0 License](https://fontawesome.com/license/free), which requires
#' attribution when the icons are used.
#'
#' @return `download_fontawesome()` invisibly returns the `fontawesome`
#' icon set after downloading and installing its SVG files locally.
#'
#' `fontawesome(name, style)` returns an `icons` vector (an SVG tag) for
#' the requested icon.
#'
#' @rdname fontawesome
#' @export
fontawesome <- new_icon_set(
"fontawesome",
function(name, style = NULL){
if(is.null(style)){
icon_guess(name, "fontawesome")
} else {
icon_fn$get(c(style, name))
}
}
)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.