Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
jrnold committed Jun 7, 2018
1 parent 9d678c5 commit eb6f033
Show file tree
Hide file tree
Showing 62 changed files with 4,554 additions and 476 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Expand Up @@ -6,3 +6,5 @@
^codecov\.yml$
^.*\.Rproj$
^\.Rproj\.user$
^_pkgdown\.yml$
^docs$
3 changes: 2 additions & 1 deletion DESCRIPTION
Expand Up @@ -18,10 +18,11 @@ Imports:
ggplot2 (>= 2.2.1),
extrafont
Suggests:
spelling,
tufte,
knitr,
rmarkdown,
scales,
spelling,
testthat,
covr
Authors@R: c(person("Jeffrey", "Arnold", role = c("aut", "cre"), email = "jeffrey.arnold@gmail.com",
Expand Down
13 changes: 5 additions & 8 deletions NAMESPACE
@@ -1,25 +1,22 @@
# Generated by roxygen2: do not edit by hand

export(GeomQuartilePlot)
export(GeomRangeFrame)
export(GeomTufteboxplot)
export(StatFivenumber)
export(extended_range_breaks)
export(extended_range_breaks_)
export(font_et)
export(geom_quartileplot)
export(geom_rangeframe)
export(geom_tufteboxplot)
export(import_et_book)
export(smart_digits)
export(smart_digits_format)
export(import_ggtufte_fonts)
export(range_breaks)
export(stat_fivenumber)
export(theme_tufte)
export(tufte_theme_fonts)
importFrom(ggplot2,Geom)
importFrom(ggplot2,GeomPoint)
importFrom(ggplot2,GeomSegment)
importFrom(ggplot2,StatSummaryBin)
importFrom(ggplot2,aes)
importFrom(ggplot2,element_blank)
importFrom(ggplot2,element_text)
importFrom(ggplot2,ggproto)
importFrom(ggplot2,ggproto_parent)
importFrom(ggplot2,layer)
Expand Down
35 changes: 33 additions & 2 deletions R/et-book.R
Expand Up @@ -15,7 +15,7 @@
#' @references <https://edwardtufte.github.io/et-book/>
#' @source <https://github.com/edwardtufte/et-book>
#' @export
import_et_book <- function() {
import_ggtufte_fonts <- function() {
# function adapted from hbrthemes::import_roboto_condensed
font_dir <- system.file("fonts", package = "ggtufte")

Expand All @@ -41,6 +41,10 @@ import_et_book <- function() {
#' - `"ETBembo BoldLF"`: Bold (lining figures)
#' - `"ETBembo DisplayItalic"`: Display Italic (oldstyle figures)
#'
#' For headings, the sans serif font, Gill Sans is used.
#' Since there is no Gill Sans variant with an open license, the similar
#' Lato font is included with this package.
#'
#' @md
#' @title ET Book fonts R variable aliases
#' @format length 5 character vector. Values are the
Expand All @@ -53,4 +57,31 @@ font_et <- c("Roman (line figures)" = "ETBembo RomanLF",
"Roman (old-style figures)" = "ETBembo RomanOSF",
"Bold (line figures)" = "ETBembo BoldLF",
"Semi-bold (old-style figures)" = "ETBembo SemiBoldOSF",
"Display italic" = "ETBembo DisplayItalic")
"Display italic" = "ETBembo DisplayItalic")

# choose
get_etbembo <- function(italic = FALSE) {
fonttable <- extrafont::fonttable()
if (italic) {
if ("ETBembo DisplayItalic" %in% fonttable[["FullName"]]) {
return("ETBembo DisplayItalic")
}
} else {
if ("ETBembo RomanLF" %in% fonttable[["FullName"]]) {
return("ETBembo RomanLF")
}
}
"Palatino"
}

# Gill Sans type font
get_gill_sans <- function() {
fallbacks <- c("Gill Sans Nova", "Gill Sans MT", "Gill Sans Std",
"Lato", "sans")
fontlist <- extrafont::fonts()
for (font in fallbacks) {
if (font %in% fontlist) {
return(font)
}
}
}

0 comments on commit eb6f033

Please sign in to comment.