Skip to content

Commit

Permalink
move font files, get fonts from package dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindhammers committed Mar 15, 2023
1 parent a46f0a0 commit 993b263
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 11 deletions.
9 changes: 6 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
Package: noradplot
Type: Package
Title: Norad colour palette and theme for ggplot2 graphics
Version: 0.1.0
Author: Norad
Maintainer: Einar Tornes <[email protected]>
Version: 0.3.0
Authors@R: c(
person("Einar", "Tornes", email = "[email protected]", role = c("aut", "cre")),
person("Eivind", "Hammersmark", "Moe", email = "[email protected]", role = "aut"),
person("Norad", role = c("cph", "fnd"))
)
Description: Provides Norads colour palette and theme for creating ggplot2 graphics. Credits: Based on Simon Jackson's blog post: Creating corporate colour palettes for ggplot2, BBC BBC Visual and Data Journalism cookbook for R graphics: https://bbc.github.io/rcookbook/ and Meghan Halls blog post Creating Custom colour palettes for ggplot2: https://meghan.rbind.io/blog/2022-10-11-creating-custom-color-palettes-with-ggplot2/.
License: MIT + file LICENSE
Encoding: UTF-8
Expand Down
19 changes: 11 additions & 8 deletions R/ggnorad.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ ggnorad <- function(...) {

showtext::showtext_auto()

fonts_dir <- system.file("fonts", package = "noradplot")
sysfonts::font_add(family = "Norad Sans",
regular = "https://github.com/noradno/noradplot/raw/main/fonts/NoradSans-Regular.otf",
bold = "https://github.com/noradno/noradplot/raw/main/fonts/NoradSans-Bold.otf",
italic = "https://github.com/noradno/noradplot/raw/main/fonts/NoradSans-Italic.otf",
bolditalic = "https://github.com/noradno/noradplot/raw/main/fonts/NoradSans-BoldItalic.otf")
regular = paste0(fonts_dir, "/NoradSans-Regular.otf"),
bold = paste0(fonts_dir, "/NoradSans-Bold.otf"),
italic = paste0(fonts_dir, "/NoradSans-Italic.otf"),
bolditalic = paste0(fonts_dir, "/NoradSans-BoldItalic.otf"))

sysfonts::font_add(family = "Norad Serif",
regular = "https://github.com/noradno/noradplot/raw/main/fonts/NoradSerif-Regular.otf",
bold = "https://github.com/noradno/noradplot/raw/main/fonts/NoradSerif-Bold.otf",
italic = "https://github.com/noradno/noradplot/raw/main/fonts/NoradSerif-Italic.otf",
bolditalic = "https://github.com/noradno/noradplot/raw/main/fonts/NoradSerif-BoldItalic.otf")
regular = paste0(fonts_dir, "/NoradSerif-Regular.otf"),
bold = paste0(fonts_dir, "/NoradSerif-Bold.otf"),
italic = paste0(fonts_dir, "/NoradSerif-Italic.otf"),
bolditalic = paste0(fonts_dir, "/NoradSerif-BoldItalic.otf"))

ggplot2::update_geom_defaults("path", list(linewidth = 1))

ggplot2::theme_set(theme_norad())
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 993b263

Please sign in to comment.