diff --git a/DESCRIPTION b/DESCRIPTION index 7c58ef9..c73f9fe 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: hrbragg Type: Package Title: Typography-centric Themes, Theme Components, and Utilities for 'ggplot2' and 'ragg'. -Version: 0.1.0 +Version: 0.2.0 Date: 2021-02-16 Authors@R: c( person( diff --git a/NAMESPACE b/NAMESPACE index 4c2be9d..7227aeb 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -6,14 +6,11 @@ export(elb) export(ell) export(elr) export(elt) -export(gs_pkg) -export(gsc_pkg) export(install_goldman_sans) +export(install_goldman_sans_condensed) export(install_inter) export(install_roboto_condensed) -export(inter_pkg) export(preview_variant) -export(rc_pkg) export(reconfigure_font) export(reset_ggplot2_defaults) export(scale_x_comma) diff --git a/R/check-register-install.R b/R/check-register-install.R new file mode 100644 index 0000000..ddeedbd --- /dev/null +++ b/R/check-register-install.R @@ -0,0 +1,114 @@ +font_is_installed <- function(family) { + first <- systemfonts::font_info(family[1])[["family"]][1] + first == family[1] +} + +it_is_ok_to_annoy <- function() { + getOption("hrbragg.verbose", TRUE) && interactive() +} + +startup_msg <- function(...) { + if (it_is_ok_to_annoy()) packageStartupMessage(...) +} + +register_reconfig <- function(family, + glob_prefix, + inst_f, + font_dir, + width = "normal", + ligatures = NULL, + letters = NULL, + numbers = NULL, + ...) { + + if (!font_is_installed(family)) { + + startup_msg( + "Please run '", inst_f, "' to install '", family, "', then restart your R session." + ) + + return() + + # startup_msg( + # "Using {hrbragg} copy of '", family, ". ", + # "Run '", inst_f, "' to install the font." + # ) + # + # systemfonts::register_font( + # name = family, + # plain = system.file("fonts", font_dir, package = "hrbragg") + # ) + + } + + startup_msg("Registering '", family, "' font variant.") + + reconfigure_font( + prefix = "hrbragg-pkg tab", + family = family, + width = width, + ligatures = ligatures, + tnum = 1, ... + ) -> has_tnum + + reconfigure_font( + prefix = "hrbragg-pkg prop", + family = family, + width = width, + ligatures = "discretionary", + tnum = 0, ... + ) -> no_tnum + + assign(sprintf("%s_pkg", glob_prefix), has_tnum, .GlobalEnv) + assign(sprintf("%s_pkg_prop", glob_prefix), no_tnum, .GlobalEnv) + +} + +register_fonts <- function() { + + register_reconfig( + family = "Inter", + glob_prefix = "inter", + inst_f = "install_inter()", + font_dir = "inter", + width = "normal", + ligatures = "discretionary", + calt = 1, case = 1, dlig = 1, ss01 = 1, + kern = 1, zero = 0, salt = 0 + ) + + register_reconfig( + family = "Roboto Condensed", + glob_prefix = "rc", + inst_f = "install_roboto_condensed()", + font_dir = "roboto-condensed", + width = "normal", + ligatures = "standard", + ccmp = 1, kern = 1 + ) + + register_reconfig( + family = "Goldman Sans", + glob_prefix = "gs", + inst_f = "install_goldman_sans()", + font_dir = "goldman-sans", + width = "normal", + ligatures = "standard", + kern = 1 + ) + + register_reconfig( + family = "Goldman Sans Condensed", + glob_prefix = "gsc", + inst_f = "install_goldman_sans_condensed()", + font_dir = "goldman-sans-condensed", + width = "semicondensed", + ligatures = "standard", + kern = 1 + ) + + startup_msg( + "Use `options(hrbragg.verbose = FALSE)` to silence font registration messages" + ) + +} \ No newline at end of file diff --git a/R/finish-theme.R b/R/finish-theme.R new file mode 100644 index 0000000..fdb6721 --- /dev/null +++ b/R/finish-theme.R @@ -0,0 +1,221 @@ +finish_theme <- function(base_size, + line_height, + plot_title_size, + plot_title_position, + plot_title_margin, + subtitle_size, + subtitle_margin, + strip_text_size, + strip_placement, + caption_size, + caption_margin, + axis_text_size, + axis_title_size, + axis_title_just, + panel_spacing, + plot_margin, + mode, + background_colour, + foreground_colour, + grid_col, + axis_col, + grid, + axis, + ticks, + base_family, + plot_title_family, + subtitle_family, + strip_text_family, + axis_text_family, + caption_family, + axis_title_family) { + + c( + "GeomRect", "GeomLabel", "GeomTile", "GeomViolin" + ) -> has_reverse_cols + + geoms <- ls(pattern = '^Geom', env = as.environment('package:ggplot2')) + + for (geom in geoms) { + + update_geom_defaults( + geom = get(geom), + new = list( + # arrow.fill = background_colour, + # outlier.colour = foreground_colour, + # outlier.fill = background_colour, + colour = foreground_colour, + fill = if (geom %in% c(has_reverse_cols)) background_colour else NA, + family = base_family, + lineheight = line_height + ) + ) + + } + + theme_minimal( + base_family = base_family, + base_size = base_size, + ) + + theme( + rect = element_rect(colour = foreground_colour, fill = background_colour), + line = element_line(colour = foreground_colour), + title = element_text(colour = foreground_colour), + legend.background = element_blank(), + legend.key = element_blank(), + legend.text = element_text(colour = foreground_colour, family = inter_pkg$medium), + legend.title = element_text(colour = foreground_colour, family = inter_pkg$semibold) + ) -> ret + + + if (inherits(grid, "character") | grid == TRUE) { + + ret + + theme( + panel.grid = element_line(colour = grid_col, size = 0.2), + panel.grid.major = element_line(colour = grid_col, size = 0.2), + panel.grid.minor = element_line(colour = grid_col, size = 0.15) + ) -> ret + + if (inherits(grid, "character")) { + if (regexpr("X", grid)[1] < 0) ret <- ret + theme(panel.grid.major.x = element_blank()) + if (regexpr("Y", grid)[1] < 0) ret <- ret + theme(panel.grid.major.y = element_blank()) + if (regexpr("x", grid)[1] < 0) ret <- ret + theme(panel.grid.minor.x = element_blank()) + if (regexpr("y", grid)[1] < 0) ret <- ret + theme(panel.grid.minor.y = element_blank()) + } + + } else { + ret <- ret + theme(panel.grid = element_blank()) + } + + if (inherits(axis, "character") | axis == TRUE) { + ret <- ret + theme(axis.line = element_line(colour = axis_col, size = 0.15)) + if (inherits(axis, "character")) { + axis <- tolower(axis) + if (regexpr("x", axis)[1] < 0) { + ret <- ret + theme(axis.line.x = element_blank()) + } else { + ret <- ret + theme(axis.line.x = element_line(colour = axis_col, size = 0.15)) + } + if (regexpr("y", axis)[1] < 0) { + ret <- ret + theme(axis.line.y = element_blank()) + } else { + ret <- ret + theme(axis.line.y = element_line(colour = axis_col, size = 0.15)) + } + } else { + ret + theme( + axis.line.x = element_line(colour = axis_col, size = 0.15), + axis.line.y = element_line(colour = axis_col, size = 0.15) + ) -> ret + } + } else { + ret <- ret + theme(axis.line = element_blank()) + } + + if (!ticks) { + + ret + theme( + axis.ticks = element_blank(), + axis.ticks.x = element_blank(), + axis.ticks.y = element_blank() + ) -> ret + + } else { + + ret + theme( + axis.ticks = element_line(size = 0.15), + axis.ticks.x = element_line(size = 0.15), + axis.ticks.y = element_line(size = 0.15), + axis.ticks.length = grid::unit(5, "pt") + ) -> ret + + } + + xj <- switch(tolower(substr(axis_title_just, 1, 1)), b = 0, l = 0, m = 0.5, c = 0.5, r = 1, t = 1) + yj <- switch(tolower(substr(axis_title_just, 2, 2)), b = 0, l = 0, m = 0.5, c = 0.5, r = 1, t = 1) + + ret + + theme( + axis.text.x = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height), + axis.text.x.top = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height), + axis.text.x.bottom = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height), + + axis.text.y = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height), + axis.text.y.left = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height), + axis.text.y.right = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height), + + axis.title = element_text( + size = axis_title_size, + family = axis_title_family, lineheight = line_height + ), + + axis.title.x = element_text( + hjust = xj, size = axis_title_size, + family = axis_title_family, lineheight = line_height + ), + axis.title.x.top = element_text( + hjust = xj, size = axis_title_size, + family = axis_title_family, lineheight = line_height + ), + axis.title.x.bottom = element_text( + hjust = xj, size = axis_title_size, + family = axis_title_family, lineheight = line_height + ), + + axis.title.y = element_text( + hjust = yj, size = axis_title_size, + family = axis_title_family, lineheight = line_height + ), + axis.title.y.left = element_text( + hjust = yj, size = axis_title_size, + family = axis_title_family, lineheight = line_height + ), + axis.title.y.right = element_text( + hjust = yj, size = axis_title_size, angle = 90, + family = axis_title_family, lineheight = line_height + ), + + strip.placement = strip_placement, + strip.text = element_text( + hjust = 0, size = strip_text_size, color = foreground_colour, + family = strip_text_family, lineheight = line_height + ), + strip.text.x = element_text( + hjust = 0, size = strip_text_size, color = foreground_colour, + family = strip_text_family, lineheight = line_height + ), + strip.background = element_rect( + fill = background_colour, color = NA + ), + strip.background.x = element_rect( + fill = background_colour, color = NA + ), + strip.background.y = element_rect( + fill = background_colour, color = NA + ), + strip.text.y = element_text( + hjust = 0, size = strip_text_size, color = foreground_colour, + family = strip_text_family, lineheight = line_height + ), + panel.spacing = panel_spacing, + panel.background = element_rect(color = NA, fill = background_colour), + plot.background = element_rect(color = NA, fill = background_colour), + plot.title.position = plot_title_position, + plot.margin = plot_margin, + plot.title = element_text( + hjust = 0, size = plot_title_size, margin = margin(b = plot_title_margin), + family = plot_title_family, lineheight = line_height + ), + plot.subtitle = element_text( + hjust = 0, size = subtitle_size, margin = margin(b = subtitle_margin), + family = subtitle_family, lineheight = line_height + ), + plot.caption = element_text( + hjust = 1, size = caption_size, margin = margin(t = caption_margin), + family = caption_family, lineheight = line_height + ), + ) -> ret + + ret + +} \ No newline at end of file diff --git a/R/install-fonts.R b/R/install-fonts.R index b7e91f2..80007b7 100644 --- a/R/install-fonts.R +++ b/R/install-fonts.R @@ -33,7 +33,7 @@ install_font <- function(family_name, sub_dir) { } -#' Install Goldman Sans (Condensed) +#' Install Goldman Sans #' #' Goldman Sans is a clean, modern typeface designed for dense data-rich #' environments. From open letter shapes, enlarged x-height, and optical @@ -45,8 +45,15 @@ install_font <- function(family_name, sub_dir) { #' @references [Goldman Sans](https://design.gs.com/d/story/goldman-sans/) #' @examples #' install_goldman_sans() +#' install_goldman_sans_condensed() install_goldman_sans <- function() { - install_font("Goldman Sans (Condensed)", "goldman-sans") + install_font("Goldman Sans", "goldman-sans") +} + +#' @rdname install_goldman_sans +#' @export +install_goldman_sans_condensed <- function() { + install_font("Goldman Sans", "goldman-sans-condensed") } #' Install Roboto Condensed diff --git a/R/theme-gs.R b/R/theme-gs.R index 49ea208..6619e41 100644 --- a/R/theme-gs.R +++ b/R/theme-gs.R @@ -80,199 +80,45 @@ theme_gs <- function( ticks = FALSE) { base_family <- gsc_pkg$normal - plot_title_family <- gs_pkg$bold - subtitle_family <- gs_pkg$normal - strip_text_family <- gsc_pkg$bold + plot_title_family <- gs_pkg_prop$bold + subtitle_family <- gs_pkg_prop$normal + strip_text_family <- gs_pkg_prop$bold axis_text_family <- gsc_pkg$normal - caption_family <- gsc_pkg$normal - axis_title_family <- gs_pkg$medium + caption_family <- gs_pkg_prop$normal + axis_title_family <- gs_pkg_prop$medium - c( - "GeomRect", "GeomLabel", "GeomTile", "GeomViolin" - ) -> has_reverse_cols - - geoms <- ls(pattern = '^Geom', env = as.environment('package:ggplot2')) - - for (geom in geoms) { - - update_geom_defaults( - geom = get(geom), - new = list( - arrow.fill = background_colour, - outlier.colour = foreground_colour, - outlier.fill = background_colour, - colour = foreground_colour, - fill = if (geom %in% c(has_reverse_cols)) background_colour else NA, - family = base_family, - lineheight = line_height - ) - ) - - } - - theme_minimal( - base_family = base_family, + finish_theme( base_size = base_size, - ) + - theme( - rect = element_rect(colour = foreground_colour, fill = background_colour), - line = element_line(colour = foreground_colour), - title = element_text(colour = foreground_colour), - legend.background = element_blank(), - legend.key = element_blank(), - legend.text = element_text(colour = foreground_colour, family = inter_pkg$medium), - legend.title = element_text(colour = foreground_colour, family = inter_pkg$semibold) - ) -> ret - - - if (inherits(grid, "character") | grid == TRUE) { - - ret + - theme( - panel.grid = element_line(colour = grid_col, size = 0.2), - panel.grid.major = element_line(colour = grid_col, size = 0.2), - panel.grid.minor = element_line(colour = grid_col, size = 0.15) - ) -> ret - - if (inherits(grid, "character")) { - if (regexpr("X", grid)[1] < 0) ret <- ret + theme(panel.grid.major.x = element_blank()) - if (regexpr("Y", grid)[1] < 0) ret <- ret + theme(panel.grid.major.y = element_blank()) - if (regexpr("x", grid)[1] < 0) ret <- ret + theme(panel.grid.minor.x = element_blank()) - if (regexpr("y", grid)[1] < 0) ret <- ret + theme(panel.grid.minor.y = element_blank()) - } - - } else { - ret <- ret + theme(panel.grid = element_blank()) - } - - if (inherits(axis, "character") | axis == TRUE) { - ret <- ret + theme(axis.line = element_line(colour = axis_col, size = 0.15)) - if (inherits(axis, "character")) { - axis <- tolower(axis) - if (regexpr("x", axis)[1] < 0) { - ret <- ret + theme(axis.line.x = element_blank()) - } else { - ret <- ret + theme(axis.line.x = element_line(colour = axis_col, size = 0.15)) - } - if (regexpr("y", axis)[1] < 0) { - ret <- ret + theme(axis.line.y = element_blank()) - } else { - ret <- ret + theme(axis.line.y = element_line(colour = axis_col, size = 0.15)) - } - } else { - ret + theme( - axis.line.x = element_line(colour = axis_col, size = 0.15), - axis.line.y = element_line(colour = axis_col, size = 0.15) - ) -> ret - } - } else { - ret <- ret + theme(axis.line = element_blank()) - } - - if (!ticks) { - - ret + theme( - axis.ticks = element_blank(), - axis.ticks.x = element_blank(), - axis.ticks.y = element_blank() - ) -> ret - - } else { - - ret + theme( - axis.ticks = element_line(size = 0.15), - axis.ticks.x = element_line(size = 0.15), - axis.ticks.y = element_line(size = 0.15), - axis.ticks.length = grid::unit(5, "pt") - ) -> ret - - } - - xj <- switch(tolower(substr(axis_title_just, 1, 1)), b = 0, l = 0, m = 0.5, c = 0.5, r = 1, t = 1) - yj <- switch(tolower(substr(axis_title_just, 2, 2)), b = 0, l = 0, m = 0.5, c = 0.5, r = 1, t = 1) - - ret + - theme( - axis.text.x = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height), - axis.text.x.top = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height), - axis.text.x.bottom = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height), - - axis.text.y = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height), - axis.text.y.left = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height), - axis.text.y.right = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height), - - axis.title = element_text( - size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - - axis.title.x = element_text( - hjust = xj, size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - axis.title.x.top = element_text( - hjust = xj, size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - axis.title.x.bottom = element_text( - hjust = xj, size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - - axis.title.y = element_text( - hjust = yj, size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - axis.title.y.left = element_text( - hjust = yj, size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - axis.title.y.right = element_text( - hjust = yj, size = axis_title_size, angle = 90, - family = axis_title_family, lineheight = line_height - ), - - strip.placement = strip_placement, - strip.text = element_text( - hjust = 0, size = strip_text_size, color = foreground_colour, - family = strip_text_family, lineheight = line_height - ), - strip.text.x = element_text( - hjust = 0, size = strip_text_size, color = foreground_colour, - family = strip_text_family, lineheight = line_height - ), - strip.background = element_rect( - fill = background_colour, color = NA - ), - strip.background.x = element_rect( - fill = background_colour, color = NA - ), - strip.background.y = element_rect( - fill = background_colour, color = NA - ), - strip.text.y = element_text( - hjust = 0, size = strip_text_size, color = foreground_colour, - family = strip_text_family, lineheight = line_height - ), - panel.spacing = panel_spacing, - panel.background = element_rect(color = NA, fill = background_colour), - plot.background = element_rect(color = NA, fill = background_colour), - plot.title.position = plot_title_position, - plot.margin = plot_margin, - plot.title = element_text( - hjust = 0, size = plot_title_size, margin = margin(b = plot_title_margin), - family = plot_title_family, lineheight = line_height - ), - plot.subtitle = element_text( - hjust = 0, size = subtitle_size, margin = margin(b = subtitle_margin), - family = subtitle_family, lineheight = line_height - ), - plot.caption = element_text( - hjust = 1, size = caption_size, margin = margin(t = caption_margin), - family = caption_family, lineheight = line_height - ), - ) -> ret - - ret + line_height = line_height, + plot_title_size = plot_title_size, + plot_title_position = plot_title_position, + plot_title_margin = plot_title_margin, + subtitle_size = subtitle_size, + subtitle_margin = subtitle_margin, + strip_text_size = strip_text_size, + strip_placement = strip_placement, + caption_size = caption_size, + caption_margin = caption_margin, + axis_text_size = axis_text_size, + axis_title_size = axis_title_size, + axis_title_just = axis_title_just, + panel_spacing = panel_spacing, + plot_margin = plot_margin, + mode = mode, + background_colour = background_colour, + foreground_colour = foreground_colour, + grid_col = grid_col, + axis_col = axis_col, + grid = grid, + axis = axis, + ticks = ticks, + base_family = base_family, + plot_title_family = plot_title_family, + subtitle_family = subtitle_family, + strip_text_family = strip_text_family, + axis_text_family = axis_text_family, + caption_family = caption_family, + axis_title_family = axis_title_family + ) } diff --git a/R/theme-inter.R b/R/theme-inter.R index 9b13eba..33a5fa2 100644 --- a/R/theme-inter.R +++ b/R/theme-inter.R @@ -80,199 +80,45 @@ theme_inter <- function( ticks = FALSE) { base_family <- inter_pkg$normal - plot_title_family <- inter_pkg$ultrabold - subtitle_family <- inter_pkg$medium - strip_text_family <- inter_pkg$semibold + plot_title_family <- inter_pkg_prop$ultrabold + subtitle_family <- inter_pkg_prop$medium + strip_text_family <- inter_pkg_prop$semibold axis_text_family <- inter_pkg$normal - caption_family <- inter_pkg$normal - axis_title_family <- inter_pkg$medium + caption_family <- inter_pkg_prop$normal + axis_title_family <- inter_pkg_prop$medium - c( - "GeomRect", "GeomLabel", "GeomTile", "GeomViolin" - ) -> has_reverse_cols - - geoms <- ls(pattern = '^Geom', env = as.environment('package:ggplot2')) - - for (geom in geoms) { - - update_geom_defaults( - geom = get(geom), - new = list( - # arrow.fill = background_colour, - # outlier.colour = foreground_colour, - # outlier.fill = background_colour, - colour = foreground_colour, - fill = if (geom %in% c(has_reverse_cols)) background_colour else NA, - family = base_family, - lineheight = line_height - ) - ) - - } - - theme_minimal( - base_family = base_family, + finish_theme( base_size = base_size, - ) + - theme( - rect = element_rect(colour = foreground_colour, fill = background_colour), - line = element_line(colour = foreground_colour), - title = element_text(colour = foreground_colour), - legend.background = element_blank(), - legend.key = element_blank(), - legend.text = element_text(colour = foreground_colour, family = inter_pkg$medium), - legend.title = element_text(colour = foreground_colour, family = inter_pkg$semibold) - ) -> ret - - - if (inherits(grid, "character") | grid == TRUE) { - - ret + - theme( - panel.grid = element_line(colour = grid_col, size = 0.2), - panel.grid.major = element_line(colour = grid_col, size = 0.2), - panel.grid.minor = element_line(colour = grid_col, size = 0.15) - ) -> ret - - if (inherits(grid, "character")) { - if (regexpr("X", grid)[1] < 0) ret <- ret + theme(panel.grid.major.x = element_blank()) - if (regexpr("Y", grid)[1] < 0) ret <- ret + theme(panel.grid.major.y = element_blank()) - if (regexpr("x", grid)[1] < 0) ret <- ret + theme(panel.grid.minor.x = element_blank()) - if (regexpr("y", grid)[1] < 0) ret <- ret + theme(panel.grid.minor.y = element_blank()) - } - - } else { - ret <- ret + theme(panel.grid = element_blank()) - } - - if (inherits(axis, "character") | axis == TRUE) { - ret <- ret + theme(axis.line = element_line(colour = axis_col, size = 0.15)) - if (inherits(axis, "character")) { - axis <- tolower(axis) - if (regexpr("x", axis)[1] < 0) { - ret <- ret + theme(axis.line.x = element_blank()) - } else { - ret <- ret + theme(axis.line.x = element_line(colour = axis_col, size = 0.15)) - } - if (regexpr("y", axis)[1] < 0) { - ret <- ret + theme(axis.line.y = element_blank()) - } else { - ret <- ret + theme(axis.line.y = element_line(colour = axis_col, size = 0.15)) - } - } else { - ret + theme( - axis.line.x = element_line(colour = axis_col, size = 0.15), - axis.line.y = element_line(colour = axis_col, size = 0.15) - ) -> ret - } - } else { - ret <- ret + theme(axis.line = element_blank()) - } - - if (!ticks) { - - ret + theme( - axis.ticks = element_blank(), - axis.ticks.x = element_blank(), - axis.ticks.y = element_blank() - ) -> ret - - } else { - - ret + theme( - axis.ticks = element_line(size = 0.15), - axis.ticks.x = element_line(size = 0.15), - axis.ticks.y = element_line(size = 0.15), - axis.ticks.length = grid::unit(5, "pt") - ) -> ret - - } - - xj <- switch(tolower(substr(axis_title_just, 1, 1)), b = 0, l = 0, m = 0.5, c = 0.5, r = 1, t = 1) - yj <- switch(tolower(substr(axis_title_just, 2, 2)), b = 0, l = 0, m = 0.5, c = 0.5, r = 1, t = 1) - - ret + - theme( - axis.text.x = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height), - axis.text.x.top = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height), - axis.text.x.bottom = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height), - - axis.text.y = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height), - axis.text.y.left = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height), - axis.text.y.right = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height), - - axis.title = element_text( - size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - - axis.title.x = element_text( - hjust = xj, size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - axis.title.x.top = element_text( - hjust = xj, size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - axis.title.x.bottom = element_text( - hjust = xj, size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - - axis.title.y = element_text( - hjust = yj, size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - axis.title.y.left = element_text( - hjust = yj, size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - axis.title.y.right = element_text( - hjust = yj, size = axis_title_size, angle = 90, - family = axis_title_family, lineheight = line_height - ), - - strip.placement = strip_placement, - strip.text = element_text( - hjust = 0, size = strip_text_size, color = foreground_colour, - family = strip_text_family, lineheight = line_height - ), - strip.text.x = element_text( - hjust = 0, size = strip_text_size, color = foreground_colour, - family = strip_text_family, lineheight = line_height - ), - strip.background = element_rect( - fill = background_colour, color = NA - ), - strip.background.x = element_rect( - fill = background_colour, color = NA - ), - strip.background.y = element_rect( - fill = background_colour, color = NA - ), - strip.text.y = element_text( - hjust = 0, size = strip_text_size, color = foreground_colour, - family = strip_text_family, lineheight = line_height - ), - panel.spacing = panel_spacing, - panel.background = element_rect(color = NA, fill = background_colour), - plot.background = element_rect(color = NA, fill = background_colour), - plot.title.position = plot_title_position, - plot.margin = plot_margin, - plot.title = element_text( - hjust = 0, size = plot_title_size, margin = margin(b = plot_title_margin), - family = plot_title_family, lineheight = line_height - ), - plot.subtitle = element_text( - hjust = 0, size = subtitle_size, margin = margin(b = subtitle_margin), - family = subtitle_family, lineheight = line_height - ), - plot.caption = element_text( - hjust = 1, size = caption_size, margin = margin(t = caption_margin), - family = caption_family, lineheight = line_height - ), - ) -> ret - - ret + line_height = line_height, + plot_title_size = plot_title_size, + plot_title_position = plot_title_position, + plot_title_margin = plot_title_margin, + subtitle_size = subtitle_size, + subtitle_margin = subtitle_margin, + strip_text_size = strip_text_size, + strip_placement = strip_placement, + caption_size = caption_size, + caption_margin = caption_margin, + axis_text_size = axis_text_size, + axis_title_size = axis_title_size, + axis_title_just = axis_title_just, + panel_spacing = panel_spacing, + plot_margin = plot_margin, + mode = mode, + background_colour = background_colour, + foreground_colour = foreground_colour, + grid_col = grid_col, + axis_col = axis_col, + grid = grid, + axis = axis, + ticks = ticks, + base_family = base_family, + plot_title_family = plot_title_family, + subtitle_family = subtitle_family, + strip_text_family = strip_text_family, + axis_text_family = axis_text_family, + caption_family = caption_family, + axis_title_family = axis_title_family + ) } diff --git a/R/theme-rc.R b/R/theme-rc.R index 6f918ab..483d226 100644 --- a/R/theme-rc.R +++ b/R/theme-rc.R @@ -80,199 +80,44 @@ theme_rc <- function( ticks = FALSE) { base_family <- rc_pkg$normal - plot_title_family <- rc_pkg$bold - subtitle_family <- rc_pkg$normal - strip_text_family <- rc_pkg$bold + plot_title_family <- rc_pkg_prop$bold + subtitle_family <- rc_pkg_prop$normal + strip_text_family <- rc_pkg_prop$bold axis_text_family <- rc_pkg$normal - caption_family <- rc_pkg$normal_light - axis_title_family <- rc_pkg$bold + caption_family <- rc_pkg_prop$normal_light + axis_title_family <- rc_pkg_prop$bold - c( - "GeomRect", "GeomLabel", "GeomTile", "GeomViolin" - ) -> has_reverse_cols - - geoms <- ls(pattern = '^Geom', env = as.environment('package:ggplot2')) - - for (geom in geoms) { - - update_geom_defaults( - geom = get(geom), - new = list( - arrow.fill = background_colour, - outlier.colour = foreground_colour, - outlier.fill = background_colour, - colour = foreground_colour, - fill = if (geom %in% c(has_reverse_cols)) background_colour else NA, - family = base_family, - lineheight = line_height - ) - ) - - } - - theme_minimal( - base_family = base_family, + finish_theme( base_size = base_size, - ) + - theme( - rect = element_rect(colour = foreground_colour, fill = background_colour), - line = element_line(colour = foreground_colour), - title = element_text(colour = foreground_colour), - legend.background = element_blank(), - legend.key = element_blank(), - legend.text = element_text(colour = foreground_colour, family = inter_pkg$medium), - legend.title = element_text(colour = foreground_colour, family = inter_pkg$semibold) - ) -> ret - - - if (inherits(grid, "character") | grid == TRUE) { - - ret + - theme( - panel.grid = element_line(colour = grid_col, size = 0.2), - panel.grid.major = element_line(colour = grid_col, size = 0.2), - panel.grid.minor = element_line(colour = grid_col, size = 0.15) - ) -> ret - - if (inherits(grid, "character")) { - if (regexpr("X", grid)[1] < 0) ret <- ret + theme(panel.grid.major.x = element_blank()) - if (regexpr("Y", grid)[1] < 0) ret <- ret + theme(panel.grid.major.y = element_blank()) - if (regexpr("x", grid)[1] < 0) ret <- ret + theme(panel.grid.minor.x = element_blank()) - if (regexpr("y", grid)[1] < 0) ret <- ret + theme(panel.grid.minor.y = element_blank()) - } - - } else { - ret <- ret + theme(panel.grid = element_blank()) - } - - if (inherits(axis, "character") | axis == TRUE) { - ret <- ret + theme(axis.line = element_line(colour = axis_col, size = 0.15)) - if (inherits(axis, "character")) { - axis <- tolower(axis) - if (regexpr("x", axis)[1] < 0) { - ret <- ret + theme(axis.line.x = element_blank()) - } else { - ret <- ret + theme(axis.line.x = element_line(colour = axis_col, size = 0.15)) - } - if (regexpr("y", axis)[1] < 0) { - ret <- ret + theme(axis.line.y = element_blank()) - } else { - ret <- ret + theme(axis.line.y = element_line(colour = axis_col, size = 0.15)) - } - } else { - ret + theme( - axis.line.x = element_line(colour = axis_col, size = 0.15), - axis.line.y = element_line(colour = axis_col, size = 0.15) - ) -> ret - } - } else { - ret <- ret + theme(axis.line = element_blank()) - } - - if (!ticks) { - - ret + theme( - axis.ticks = element_blank(), - axis.ticks.x = element_blank(), - axis.ticks.y = element_blank() - ) -> ret - - } else { - - ret + theme( - axis.ticks = element_line(size = 0.15), - axis.ticks.x = element_line(size = 0.15), - axis.ticks.y = element_line(size = 0.15), - axis.ticks.length = grid::unit(5, "pt") - ) -> ret - - } - - xj <- switch(tolower(substr(axis_title_just, 1, 1)), b = 0, l = 0, m = 0.5, c = 0.5, r = 1, t = 1) - yj <- switch(tolower(substr(axis_title_just, 2, 2)), b = 0, l = 0, m = 0.5, c = 0.5, r = 1, t = 1) - - ret + - theme( - axis.text.x = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height), - axis.text.x.top = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height), - axis.text.x.bottom = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height), - - axis.text.y = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height), - axis.text.y.left = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height), - axis.text.y.right = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height), - - axis.title = element_text( - size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - - axis.title.x = element_text( - hjust = xj, size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - axis.title.x.top = element_text( - hjust = xj, size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - axis.title.x.bottom = element_text( - hjust = xj, size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - - axis.title.y = element_text( - hjust = yj, size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - axis.title.y.left = element_text( - hjust = yj, size = axis_title_size, - family = axis_title_family, lineheight = line_height - ), - axis.title.y.right = element_text( - hjust = yj, size = axis_title_size, angle = 90, - family = axis_title_family, lineheight = line_height - ), - - strip.placement = strip_placement, - strip.text = element_text( - hjust = 0, size = strip_text_size, color = foreground_colour, - family = strip_text_family, lineheight = line_height - ), - strip.text.x = element_text( - hjust = 0, size = strip_text_size, color = foreground_colour, - family = strip_text_family, lineheight = line_height - ), - strip.background = element_rect( - fill = background_colour, color = NA - ), - strip.background.x = element_rect( - fill = background_colour, color = NA - ), - strip.background.y = element_rect( - fill = background_colour, color = NA - ), - strip.text.y = element_text( - hjust = 0, size = strip_text_size, color = foreground_colour, - family = strip_text_family, lineheight = line_height - ), - panel.spacing = panel_spacing, - panel.background = element_rect(color = NA, fill = background_colour), - plot.background = element_rect(color = NA, fill = background_colour), - plot.title.position = plot_title_position, - plot.margin = plot_margin, - plot.title = element_text( - hjust = 0, size = plot_title_size, margin = margin(b = plot_title_margin), - family = plot_title_family, lineheight = line_height - ), - plot.subtitle = element_text( - hjust = 0, size = subtitle_size, margin = margin(b = subtitle_margin), - family = subtitle_family, lineheight = line_height - ), - plot.caption = element_text( - hjust = 1, size = caption_size, margin = margin(t = caption_margin), - family = caption_family, lineheight = line_height - ), - ) -> ret - - ret - + line_height = line_height, + plot_title_size = plot_title_size, + plot_title_position = plot_title_position, + plot_title_margin = plot_title_margin, + subtitle_size = subtitle_size, + subtitle_margin = subtitle_margin, + strip_text_size = strip_text_size, + strip_placement = strip_placement, + caption_size = caption_size, + caption_margin = caption_margin, + axis_text_size = axis_text_size, + axis_title_size = axis_title_size, + axis_title_just = axis_title_just, + panel_spacing = panel_spacing, + plot_margin = plot_margin, + mode = mode, + background_colour = background_colour, + foreground_colour = foreground_colour, + grid_col = grid_col, + axis_col = axis_col, + grid = grid, + axis = axis, + ticks = ticks, + base_family = base_family, + plot_title_family = plot_title_family, + subtitle_family = subtitle_family, + strip_text_family = strip_text_family, + axis_text_family = axis_text_family, + caption_family = caption_family, + axis_title_family = axis_title_family + ) } diff --git a/R/x-font-reg.R b/R/x-font-reg.R index 1e855c3..70dd197 100644 --- a/R/x-font-reg.R +++ b/R/x-font-reg.R @@ -1,9 +1,10 @@ -#' Inter Font Variant +#' Inter Font Variants #' -#' On load hrbragg creates a custom Inter font family variant -#' and makes it available in the global environment. +#' On load hrbragg creates two custom Inter font family variants: +#' (`inter_pkg`, `inter_pkg_prop`) and makes them available in the +#' global environment. #' -#' The reconfigured family variant has the following features: +#' The reconfigured family variants share the following features: #' #' - `calt`: (_Contextual Alternates_): Applies a second substitution feature #' based on a match of a character pattern within a context of surrounding patterns @@ -12,12 +13,15 @@ #' - `kern` (_Kerning_): Fine horizontal positioning of one glyph to the next, based on the shapes of the glyphs #' - `salt` (_Stylistic Alternates_): **DISABLED** — Either replaces with, or displays list of, stylistic alternatives for a character #' - `ss01` (_Stylistic set 1: Alternate digits_): An alternate style of digits. -#' - `tnum` (_Tabular Figures_): Replaces numerals with glyphs of uniform width, often also lnum #' - `zero` (_Slashed Zero_): **DISABLED** — Replaces 0 figure with slashed 0 #' +#' They differ in that the `_prop` variant does not have tabular numbers +#' (`tnum`) enabled (which is more appropriate for titles and general +#' annotations). +#' #' Inter online documentation has [specific descriptions and examples of these features](https://rsms.me/inter/#features). #' -#' This object has the following names corresponding to individual, +#' The objects have the following names corresponding to individual, #' customized font variants (ordered by font weight): #' #' - `ultralight` @@ -38,29 +42,36 @@ #' - `heavy_italic` #' #' @docType data +#' @name inter_pkg #' @format A list -#' @export -inter_pkg <- NULL +NULL + +#' @name inter_pkg_prop +#' @rdname inter_pkg +NULL -#' Robot Condensed Font Variant +#' Roboto Condensed Font Variants #' -#' On load hrbragg creates a custom Roboto Condensed font family variant -#' and makes it available in the global environment. +#' On load hrbragg creates two custom Roboto Condensed font family variants: +#' (`rc_pkg`, `rc_pkg_prop`) and makes them available in the global environment. #' -#' The reconfigured family variant has the following features: +#' The reconfigured family variants have the following features: #' #' - `ccmp` (_Glyph Composition/Decomposition_): Either calls a ligature replacement #' on a sequence of characters or replaces a character with a sequence of glyphs. #' Provides logic that can for example effectively alter the order of input characters. #' - `liga`/`ligatures` (_Standard Ligatures_): Replaces (by default) sequence of characters with a single ligature glyph #' - `kern` (_Kerning_): Fine horizontal positioning of one glyph to the next, based on the shapes of the glyphs -#' - `tnum` (_Tabular Figures_): Replaces numerals with glyphs of uniform width, often also lnum #' +#' They differ in that the `_prop` variant does not have tabular numbers +#' (`tnum`) enabled (which is more appropriate for titles and general +#' annotations). + #' Roboto Condensed #' [font family preview/info](https://fonts.google.com/specimen/Roboto+Condensed) #' -#' This object has the following names corresponding to individual, +#' This objects have the following names corresponding to individual, #' customized font variants (ordered by font weight): #' #' - `normal_light` @@ -70,20 +81,33 @@ inter_pkg <- NULL #' #' @docType data #' @format A list -#' @export -rc_pkg <- NULL +#' @name rc_pkg +NULL +# rc_pkg <- NULL + +#' @name rc_pkg_prop +#' @rdname rc_pkg +NULL #' Goldman Sans & Goldman Sans Condensed Font Variants #' -#' On load hrbragg creates a custom Goldman Sans & Goldman Sans Condensed -#' font family variants and makes them available in the global environment. +#' On load hrbragg creates four custom Goldman Sans & Goldman Sans Condensed +#' font family variants: (`gs_pkg`, `gs_pkg_prop`, `gsc_pkg`, `gsc_pkg_prop`) +#' and makes them available in the global environment. +#' +#' The reconfigured family variants have the following features: +#' +#' - `dlig`/`ligatures` (_Discretionary Ligatures_): Ligatures to be applied at the user's discretion +#' - `kern` (_Kerning_): Fine horizontal positioning of one glyph to the next, based on the shapes of the glyphs #' -#' The reconfigured family variant has the following features: +#' They differ in that the `_prop` variant does not have tabular numbers +#' (`tnum`) enabled (which is more appropriate for titles and general +#' annotations). #' -#' This object has the following names corresponding to individual, +#' The objects have the following names corresponding to individual, #' customized font variants (ordered by font weight): #' -#' **Goldman Sans** (`gs_rc`) +#' **Goldman Sans** (`gs_pkg`, `gs_pkg_prop`) #' #' - `light` #' - `normal_italic` @@ -94,17 +118,24 @@ rc_pkg <- NULL #' - `bold_italic` #' - `heavy` #' -#' **Goldman Sans Condensed** (`gsc_rc`) +#' **Goldman Sans Condensed** (`gsc_pkg`, `gsc_pkg_prop`) #' #' - `normal` #' - `bold` #' #' @docType data #' @format A list -#' @export -gs_pkg <- NULL +#' @name gs_pkg +NULL -#' @docType data -#' @format A list -#' @export -gsc_pkg <- NULL +#' @name gs_pkg_prop +#' @rdname gs_pkg +NULL + +#' @name gsc_pkg +#' @rdname gs_pkg +NULL + +#' @name gsc_pkg_prop +#' @rdname gs_pkg +NULL diff --git a/R/zzz.R b/R/zzz.R index 70c4ecf..1920e58 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,87 +1,3 @@ .onLoad <- function(...) { - - if (systemfonts::font_info("Inter")[["family"]][1] == "Inter") { - if (interactive()) packageStartupMessage("Registering 'Inter' font variant.") - reconfigure_font( - prefix = "hrbragg-pkg", - family = "Inter", - width = "normal", - ligatures = "discretionary", - calt = 1, tnum = 1, case = 1, - dlig = 1, ss01 = 1, kern = 1, - zero = 0, salt = 0 - ) ->> inter_pkg - } else { - packageStartupMessage( - "Please run `install_inter()`. This is only an interim requirement." - ) - } - - if (systemfonts::font_info("Roboto Condensed")[["family"]][1] == "Roboto Condensed") { - reconfigure_font( - prefix = "hrbragg", - family = "Roboto Condensed", - width = "normal", - ligatures = "standard", - ccmp = 1, kern = 1, tnum = 1 - ) ->> rc_pkg - } else { - packageStartupMessage( - "Please run `install_roboto_condensed()`. This is only an interim requirement." - ) - } - - if (systemfonts::font_info("Goldman Sans")[["family"]][1] == "Goldman Sans") { - - reconfigure_font( - prefix = "hrbragg", - family = "Goldman Sans", - width = "normal", - ligatures = "standard", - kern = 1, tnum = 1 - ) ->> gs_pkg - - reconfigure_font( - prefix = "hrbragg", - family = "Goldman Sans Condensed", - width = "semicondensed", - ligatures = "standard", - kern = 1, tnum = 1 - ) ->> gsc_pkg - - - } else { - packageStartupMessage( - "Please run `install_goldman_sans()`. This is only an interim requirement." - ) - } - - + register_fonts() } - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/README.Rmd b/README.Rmd index a9a7a93..55ceaa8 100644 --- a/README.Rmd +++ b/README.Rmd @@ -9,7 +9,8 @@ hrbrpkghelpr::global_opts() ```{r ragg, echo = FALSE} knitr::opts_chunk$set( - dev = "ragg_png" + dev = "ragg_png", + cache = TRUE ) ``` diff --git a/README.md b/README.md index c3afeaa..2a72ee8 100644 --- a/README.md +++ b/README.md @@ -36,14 +36,14 @@ The following functions are implemented: - `elt`: Shortcut for element\_text - `feature_dict`: OpenType feature description lookup table - `gs_pkg`: Goldman Sans & Goldman Sans Condensed Font Variants -- `install_goldman_sans`: Install Goldman Sans (Condensed) +- `install_goldman_sans`: Install Goldman Sans - `install_inter`: Install Inter - `install_roboto_condensed`: Install Roboto Condensed -- `inter_pkg`: Inter Font Variant +- `inter_pkg`: Inter Font Variants - `opentype_typographic_features`: OpenType Typographic Features - `preview_variant`: Preview numbers, kerning, and ligatures from font variants you create -- `rc_pkg`: Robot Condensed Font Variant +- `rc_pkg`: Roboto Condensed Font Variants - `reconfigure_font`: Create an complete, alternate font family with the same customized features - `reset_ggplot2_defaults`: Restore all ggplot2 geom to default @@ -92,23 +92,23 @@ install_inter() ``` r str(inter_pkg, 1) ## List of 17 -## $ ultralight_italic: chr "hrbragg-pkg Inter Thin Italic" -## $ ultralight : chr "hrbragg-pkg Inter Thin" -## $ light : chr "hrbragg-pkg Inter Extra Light" -## $ light_italic : chr "hrbragg-pkg Inter Extra Light Italic" -## $ normal_italic : chr "hrbragg-pkg Inter Light Italic" -## $ normal_light : chr "hrbragg-pkg Inter Light" -## $ normal : chr "hrbragg-pkg Inter Regular" -## $ medium_italic : chr "hrbragg-pkg Inter Medium Italic" -## $ medium : chr "hrbragg-pkg Inter Medium" -## $ semibold : chr "hrbragg-pkg Inter Semi Bold" -## $ semibold_italic : chr "hrbragg-pkg Inter Semi Bold Italic" -## $ bold : chr "hrbragg-pkg Inter Bold" -## $ bold_italic : chr "hrbragg-pkg Inter Bold Italic" -## $ ultrabold_italic : chr "hrbragg-pkg Inter Extra Bold Italic" -## $ ultrabold : chr "hrbragg-pkg Inter Extra Bold" -## $ heavy_italic : chr "hrbragg-pkg Inter Black Italic" -## $ heavy : chr "hrbragg-pkg Inter Black" +## $ ultralight : chr "hrbragg-pkg tab Inter Thin" +## $ ultralight_italic: chr "hrbragg-pkg tab Inter Thin Italic" +## $ light : chr "hrbragg-pkg tab Inter Extra Light" +## $ light_italic : chr "hrbragg-pkg tab Inter Extra Light Italic" +## $ normal_italic : chr "hrbragg-pkg tab Inter Light Italic" +## $ normal : chr "hrbragg-pkg tab Inter Regular" +## $ normal_light : chr "hrbragg-pkg tab Inter Light" +## $ medium_italic : chr "hrbragg-pkg tab Inter Medium Italic" +## $ medium : chr "hrbragg-pkg tab Inter Medium" +## $ semibold_italic : chr "hrbragg-pkg tab Inter Semi Bold Italic" +## $ semibold : chr "hrbragg-pkg tab Inter Semi Bold" +## $ bold : chr "hrbragg-pkg tab Inter Bold" +## $ bold_italic : chr "hrbragg-pkg tab Inter Bold Italic" +## $ ultrabold : chr "hrbragg-pkg tab Inter Extra Bold" +## $ ultrabold_italic : chr "hrbragg-pkg tab Inter Extra Bold Italic" +## $ heavy : chr "hrbragg-pkg tab Inter Black" +## $ heavy_italic : chr "hrbragg-pkg tab Inter Black Italic" ## - attr(*, "family")= chr "Inter" data("feature_dict") @@ -274,10 +274,10 @@ preview_variant(barlow) | Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) | |:-----|---------:|-----:|-----:|-----:|------------:|-----:|---------:|-----:| -| SVG | 1 | 0.02 | 2574 | 0.34 | 0 | 0.00 | 0 | 0.00 | -| R | 19 | 0.45 | 1131 | 0.15 | 215 | 0.42 | 642 | 0.45 | -| Rmd | 1 | 0.02 | 74 | 0.01 | 43 | 0.08 | 67 | 0.05 | -| SUM | 21 | 0.50 | 3779 | 0.50 | 258 | 0.50 | 709 | 0.50 | +| SVG | 1 | 0.02 | 2574 | 0.35 | 0 | 0.00 | 0 | 0.00 | +| R | 21 | 0.46 | 977 | 0.13 | 158 | 0.39 | 679 | 0.46 | +| Rmd | 1 | 0.02 | 75 | 0.01 | 43 | 0.11 | 67 | 0.04 | +| SUM | 23 | 0.50 | 3626 | 0.50 | 201 | 0.50 | 746 | 0.50 | clock Package Metrics for hrbragg diff --git a/inst/fonts/goldman-sans/GoldmanSansCd_Bd.ttf b/inst/fonts/goldman-sans-condensed/GoldmanSansCd_Bd.ttf similarity index 100% rename from inst/fonts/goldman-sans/GoldmanSansCd_Bd.ttf rename to inst/fonts/goldman-sans-condensed/GoldmanSansCd_Bd.ttf diff --git a/inst/fonts/goldman-sans/GoldmanSansCd_Rg.ttf b/inst/fonts/goldman-sans-condensed/GoldmanSansCd_Rg.ttf similarity index 100% rename from inst/fonts/goldman-sans/GoldmanSansCd_Rg.ttf rename to inst/fonts/goldman-sans-condensed/GoldmanSansCd_Rg.ttf diff --git a/man/figures/README-dark-mode-01-1.png b/man/figures/README-dark-mode-01-1.png index d92a4cc..8f80fbe 100644 Binary files a/man/figures/README-dark-mode-01-1.png and b/man/figures/README-dark-mode-01-1.png differ diff --git a/man/figures/README-dark-mode-01-gs-1.png b/man/figures/README-dark-mode-01-gs-1.png index 77904a4..5658ef8 100644 Binary files a/man/figures/README-dark-mode-01-gs-1.png and b/man/figures/README-dark-mode-01-gs-1.png differ diff --git a/man/figures/README-dark-mode-01-rc-1.png b/man/figures/README-dark-mode-01-rc-1.png index f9763fb..c79adfd 100644 Binary files a/man/figures/README-dark-mode-01-rc-1.png and b/man/figures/README-dark-mode-01-rc-1.png differ diff --git a/man/figures/README-dark-mode-02-1.png b/man/figures/README-dark-mode-02-1.png index 00d8032..b37b7ba 100644 Binary files a/man/figures/README-dark-mode-02-1.png and b/man/figures/README-dark-mode-02-1.png differ diff --git a/man/figures/README-light-mode-01-1.png b/man/figures/README-light-mode-01-1.png index 64664d3..2f7a3b2 100644 Binary files a/man/figures/README-light-mode-01-1.png and b/man/figures/README-light-mode-01-1.png differ diff --git a/man/figures/README-light-mode-01-gs-1.png b/man/figures/README-light-mode-01-gs-1.png index d2c6ec0..bb6aae6 100644 Binary files a/man/figures/README-light-mode-01-gs-1.png and b/man/figures/README-light-mode-01-gs-1.png differ diff --git a/man/figures/README-light-mode-01-rc-1.png b/man/figures/README-light-mode-01-rc-1.png index 67a7d01..a84a47b 100644 Binary files a/man/figures/README-light-mode-01-rc-1.png and b/man/figures/README-light-mode-01-rc-1.png differ diff --git a/man/figures/README-light-mode-02-1.png b/man/figures/README-light-mode-02-1.png index b3a6639..f7fe426 100644 Binary files a/man/figures/README-light-mode-02-1.png and b/man/figures/README-light-mode-02-1.png differ diff --git a/man/figures/README-preview-00-1.png b/man/figures/README-preview-00-1.png index 934e794..00e5ade 100644 Binary files a/man/figures/README-preview-00-1.png and b/man/figures/README-preview-00-1.png differ diff --git a/man/figures/README-preview-01-1.png b/man/figures/README-preview-01-1.png index bc1033d..622c726 100644 Binary files a/man/figures/README-preview-01-1.png and b/man/figures/README-preview-01-1.png differ diff --git a/man/figures/README-preview-02-1.png b/man/figures/README-preview-02-1.png index 4bf88a5..4a3bee3 100644 Binary files a/man/figures/README-preview-02-1.png and b/man/figures/README-preview-02-1.png differ diff --git a/man/gs_pkg.Rd b/man/gs_pkg.Rd index d79a88d..a61e4ac 100644 --- a/man/gs_pkg.Rd +++ b/man/gs_pkg.Rd @@ -3,24 +3,33 @@ \docType{data} \name{gs_pkg} \alias{gs_pkg} +\alias{gs_pkg_prop} +\alias{gsc_pkg} +\alias{gsc_pkg_prop} \title{Goldman Sans & Goldman Sans Condensed Font Variants} \format{ A list } -\usage{ -gs_pkg -} \description{ -On load hrbragg creates a custom Goldman Sans & Goldman Sans Condensed -font family variants and makes them available in the global environment. +On load hrbragg creates four custom Goldman Sans & Goldman Sans Condensed +font family variants: (\code{gs_pkg}, \code{gs_pkg_prop}, \code{gsc_pkg}, \code{gsc_pkg_prop}) +and makes them available in the global environment. } \details{ -The reconfigured family variant has the following features: +The reconfigured family variants have the following features: +\itemize{ +\item \code{dlig}/\code{ligatures} (\emph{Discretionary Ligatures}): Ligatures to be applied at the user's discretion +\item \code{kern} (\emph{Kerning}): Fine horizontal positioning of one glyph to the next, based on the shapes of the glyphs +} + +They differ in that the \verb{_prop} variant does not have tabular numbers +(\code{tnum}) enabled (which is more appropriate for titles and general +annotations). -This object has the following names corresponding to individual, +The objects have the following names corresponding to individual, customized font variants (ordered by font weight): -\strong{Goldman Sans} (\code{gs_rc}) +\strong{Goldman Sans} (\code{gs_pkg}, \code{gs_pkg_prop}) \itemize{ \item \code{light} \item \code{normal_italic} @@ -32,10 +41,9 @@ customized font variants (ordered by font weight): \item \code{heavy} } -\strong{Goldman Sans Condensed} (\code{gsc_rc}) +\strong{Goldman Sans Condensed} (\code{gsc_pkg}, \code{gsc_pkg_prop}) \itemize{ \item \code{normal} \item \code{bold} } } -\keyword{datasets} diff --git a/man/install_goldman_sans.Rd b/man/install_goldman_sans.Rd index 013c285..78c9e3e 100644 --- a/man/install_goldman_sans.Rd +++ b/man/install_goldman_sans.Rd @@ -2,9 +2,12 @@ % Please edit documentation in R/install-fonts.R \name{install_goldman_sans} \alias{install_goldman_sans} -\title{Install Goldman Sans (Condensed)} +\alias{install_goldman_sans_condensed} +\title{Install Goldman Sans} \usage{ install_goldman_sans() + +install_goldman_sans_condensed() } \description{ Goldman Sans is a clean, modern typeface designed for dense data-rich @@ -17,6 +20,7 @@ clarity in mind. Both normal and condensed versions are provided. } \examples{ install_goldman_sans() +install_goldman_sans_condensed() } \references{ \href{https://design.gs.com/d/story/goldman-sans/}{Goldman Sans} diff --git a/man/inter_pkg.Rd b/man/inter_pkg.Rd index 35f8660..20de256 100644 --- a/man/inter_pkg.Rd +++ b/man/inter_pkg.Rd @@ -3,19 +3,18 @@ \docType{data} \name{inter_pkg} \alias{inter_pkg} -\title{Inter Font Variant} +\alias{inter_pkg_prop} +\title{Inter Font Variants} \format{ A list } -\usage{ -inter_pkg -} \description{ -On load hrbragg creates a custom Inter font family variant -and makes it available in the global environment. +On load hrbragg creates two custom Inter font family variants: +(\code{inter_pkg}, \code{inter_pkg_prop}) and makes them available in the +global environment. } \details{ -The reconfigured family variant has the following features: +The reconfigured family variants share the following features: \itemize{ \item \code{calt}: (\emph{Contextual Alternates}): Applies a second substitution feature based on a match of a character pattern within a context of surrounding patterns @@ -24,13 +23,16 @@ based on a match of a character pattern within a context of surrounding patterns \item \code{kern} (\emph{Kerning}): Fine horizontal positioning of one glyph to the next, based on the shapes of the glyphs \item \code{salt} (\emph{Stylistic Alternates}): \strong{DISABLED} — Either replaces with, or displays list of, stylistic alternatives for a character \item \code{ss01} (\emph{Stylistic set 1: Alternate digits}): An alternate style of digits. -\item \code{tnum} (\emph{Tabular Figures}): Replaces numerals with glyphs of uniform width, often also lnum \item \code{zero} (\emph{Slashed Zero}): \strong{DISABLED} — Replaces 0 figure with slashed 0 } +They differ in that the \verb{_prop} variant does not have tabular numbers +(\code{tnum}) enabled (which is more appropriate for titles and general +annotations). + Inter online documentation has \href{https://rsms.me/inter/#features}{specific descriptions and examples of these features}. -This object has the following names corresponding to individual, +The objects have the following names corresponding to individual, customized font variants (ordered by font weight): \itemize{ \item \code{ultralight} @@ -51,4 +53,3 @@ customized font variants (ordered by font weight): \item \code{heavy_italic} } } -\keyword{datasets} diff --git a/man/rc_pkg.Rd b/man/rc_pkg.Rd index bb3e92a..f101a5b 100644 --- a/man/rc_pkg.Rd +++ b/man/rc_pkg.Rd @@ -3,32 +3,32 @@ \docType{data} \name{rc_pkg} \alias{rc_pkg} -\title{Robot Condensed Font Variant} +\alias{rc_pkg_prop} +\title{Roboto Condensed Font Variants} \format{ A list } -\usage{ -rc_pkg -} \description{ -On load hrbragg creates a custom Roboto Condensed font family variant -and makes it available in the global environment. +On load hrbragg creates two custom Roboto Condensed font family variants: +(\code{rc_pkg}, \code{rc_pkg_prop}) and makes them available in the global environment. } \details{ -The reconfigured family variant has the following features: +The reconfigured family variants have the following features: \itemize{ \item \code{ccmp} (\emph{Glyph Composition/Decomposition}): Either calls a ligature replacement on a sequence of characters or replaces a character with a sequence of glyphs. Provides logic that can for example effectively alter the order of input characters. \item \code{liga}/\code{ligatures} (\emph{Standard Ligatures}): Replaces (by default) sequence of characters with a single ligature glyph \item \code{kern} (\emph{Kerning}): Fine horizontal positioning of one glyph to the next, based on the shapes of the glyphs -\item \code{tnum} (\emph{Tabular Figures}): Replaces numerals with glyphs of uniform width, often also lnum } +They differ in that the \verb{_prop} variant does not have tabular numbers +(\code{tnum}) enabled (which is more appropriate for titles and general +annotations). Roboto Condensed \href{https://fonts.google.com/specimen/Roboto+Condensed}{font family preview/info} -This object has the following names corresponding to individual, +This objects have the following names corresponding to individual, customized font variants (ordered by font weight): \itemize{ \item \code{normal_light} @@ -37,4 +37,3 @@ customized font variants (ordered by font weight): \item \code{bold} } } -\keyword{datasets}