Skip to content

Commit

Permalink
Merge pull request #38 from Metropolitan-Council/37-theme_council-err…
Browse files Browse the repository at this point in the history
…or-with-fonts

theme_council() font error on Windows machines
  • Loading branch information
eroten authored Jul 22, 2022
2 parents 610e828 + 02b732e commit d56df29
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 13 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ jobs:
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: rcmdcheck
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v1
- uses: r-lib/actions/check-r-package@v2
with:
args: 'c("--no-manual", "--as-cran")'
error-on: '"error"'
check-dir: '"check"'
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: councilR
Title: Functions and Templates for the Metropolitan Council
Version: 0.1.2.9000
Version: 0.1.2.9001
Date: 2022-03-15
Authors@R: c(
person("Metropolitan Council", role = "cph"),
Expand Down Expand Up @@ -55,5 +55,5 @@ Config/testthat/edition: 3
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
RoxygenNote: 7.2.0
Website: https://github.com/Metropolitan-Council/councilR
1 change: 0 additions & 1 deletion R/import_from_emissions.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#' @title Import data table from greenhouse gas emissions scenario planning database
#'
#'
#' @param table_name character, which table to pull.
#' @param uid character, your network id.
#' Default is `getOption("councilR.uid")`. For example, `"mc\\rotenle"`
Expand Down
16 changes: 13 additions & 3 deletions R/theme_council.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Council ggplot2 theme
#' @title Council ggplot2 theme
#'
#' The default `theme_council()` plus a more simple `theme_council_open()` for making MetCouncil figures. `theme_council()` will be appropriate in most cases while `theme_council_open()` is appropriate for single scatterplots or line graphs.
#' @description The default `theme_council()` plus a more simple `theme_council_open()` for making MetCouncil figures. `theme_council()` will be appropriate in most cases while `theme_council_open()` is appropriate for single scatterplots or line graphs.
#'
#' Please note that the y-axis text is horizontal, and long axis names will need to be wrapped; the `str_wrap` function from `stringr` will be useful. For example, consider using this piece of code: `labs(y = stringr::str_wrap("Axis labels are now horizontal, but you still need to insert some code to wrap long labels", width = 15))`
#'
Expand Down Expand Up @@ -105,7 +105,17 @@ theme_council <- function(base_size = 11,
requireNamespace("showtext", quietly = TRUE)

showtext::showtext_auto()
sysfonts::font_paths()
if(grepl("mac", osVersion)){
sysfonts::font_paths()
} else {
# if windows, add the user-level font files to font paths
sysfonts::font_paths(
paste0("C:\\Users\\",
Sys.info()["user"],
"\\AppData\\Local\\Microsoft\\Windows\\Fonts"))
}


files <- sysfonts::font_files()

sysfonts::font_add("HelveticaNeueLT Std Cn", "HelveticaNeueLTStd-Cn.otf")
Expand Down
3 changes: 2 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ By contributing to this project, you agree to abide by its terms.

Thanks to all the folks who have contributed to this project in one way or another

[&#x0040;ashleyasmus](https://github.com/ashleyasmus), [&#x0040;ehesch](https://github.com/ehesch), [&#x0040;eroten](https://github.com/eroten), and [&#x0040;leonx075](https://github.com/leonx075).
[&#x0040;ashleyasmus](https://github.com/ashleyasmus), [&#x0040;ehesch](https://github.com/ehesch), [&#x0040;eroten](https://github.com/eroten),
[&#x0040;svelick](https://github.com/svelick), and [&#x0040;leonx075](https://github.com/leonx075).



Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ or another

[@ashleyasmus](https://github.com/ashleyasmus),
[@ehesch](https://github.com/ehesch),
[@eroten](https://github.com/eroten), and
[@eroten](https://github.com/eroten),
[@svelick](https://github.com/svelick), and
[@leonx075](https://github.com/leonx075).
3 changes: 1 addition & 2 deletions man/theme_council.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d56df29

Please sign in to comment.