From 993b263de9682936c42133461c0843a28f9dbd7b Mon Sep 17 00:00:00 2001 From: Eivind Moe Hammersmark Date: Wed, 15 Mar 2023 09:53:42 +0100 Subject: [PATCH] move font files, get fonts from package dir. --- DESCRIPTION | 9 ++++++--- R/ggnorad.R | 19 ++++++++++-------- {fonts => inst/fonts}/NoradSans-Bold.otf | Bin .../fonts}/NoradSans-BoldItalic.otf | Bin {fonts => inst/fonts}/NoradSans-Italic.otf | Bin {fonts => inst/fonts}/NoradSans-Medium.otf | Bin .../fonts}/NoradSans-MediumItalic.otf | Bin {fonts => inst/fonts}/NoradSans-Regular.otf | Bin {fonts => inst/fonts}/NoradSerif-Bold.otf | Bin .../fonts}/NoradSerif-BoldItalic.otf | Bin {fonts => inst/fonts}/NoradSerif-Italic.otf | Bin {fonts => inst/fonts}/NoradSerif-Medium.otf | Bin .../fonts}/NoradSerif-MediumItalic.otf | Bin {fonts => inst/fonts}/NoradSerif-Regular.otf | Bin 14 files changed, 17 insertions(+), 11 deletions(-) rename {fonts => inst/fonts}/NoradSans-Bold.otf (100%) rename {fonts => inst/fonts}/NoradSans-BoldItalic.otf (100%) rename {fonts => inst/fonts}/NoradSans-Italic.otf (100%) rename {fonts => inst/fonts}/NoradSans-Medium.otf (100%) rename {fonts => inst/fonts}/NoradSans-MediumItalic.otf (100%) rename {fonts => inst/fonts}/NoradSans-Regular.otf (100%) rename {fonts => inst/fonts}/NoradSerif-Bold.otf (100%) rename {fonts => inst/fonts}/NoradSerif-BoldItalic.otf (100%) rename {fonts => inst/fonts}/NoradSerif-Italic.otf (100%) rename {fonts => inst/fonts}/NoradSerif-Medium.otf (100%) rename {fonts => inst/fonts}/NoradSerif-MediumItalic.otf (100%) rename {fonts => inst/fonts}/NoradSerif-Regular.otf (100%) diff --git a/DESCRIPTION b/DESCRIPTION index 58f4e7f..ddb5f66 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 +Version: 0.3.0 +Authors@R: c( + person("Einar", "Tornes", email = "einar.tornes@norad.no", role = c("aut", "cre")), + person("Eivind", "Hammersmark", "Moe", email = "eivind.moe.hammersmark@norad.no", 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 diff --git a/R/ggnorad.R b/R/ggnorad.R index b2b95b3..a53e104 100644 --- a/R/ggnorad.R +++ b/R/ggnorad.R @@ -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()) diff --git a/fonts/NoradSans-Bold.otf b/inst/fonts/NoradSans-Bold.otf similarity index 100% rename from fonts/NoradSans-Bold.otf rename to inst/fonts/NoradSans-Bold.otf diff --git a/fonts/NoradSans-BoldItalic.otf b/inst/fonts/NoradSans-BoldItalic.otf similarity index 100% rename from fonts/NoradSans-BoldItalic.otf rename to inst/fonts/NoradSans-BoldItalic.otf diff --git a/fonts/NoradSans-Italic.otf b/inst/fonts/NoradSans-Italic.otf similarity index 100% rename from fonts/NoradSans-Italic.otf rename to inst/fonts/NoradSans-Italic.otf diff --git a/fonts/NoradSans-Medium.otf b/inst/fonts/NoradSans-Medium.otf similarity index 100% rename from fonts/NoradSans-Medium.otf rename to inst/fonts/NoradSans-Medium.otf diff --git a/fonts/NoradSans-MediumItalic.otf b/inst/fonts/NoradSans-MediumItalic.otf similarity index 100% rename from fonts/NoradSans-MediumItalic.otf rename to inst/fonts/NoradSans-MediumItalic.otf diff --git a/fonts/NoradSans-Regular.otf b/inst/fonts/NoradSans-Regular.otf similarity index 100% rename from fonts/NoradSans-Regular.otf rename to inst/fonts/NoradSans-Regular.otf diff --git a/fonts/NoradSerif-Bold.otf b/inst/fonts/NoradSerif-Bold.otf similarity index 100% rename from fonts/NoradSerif-Bold.otf rename to inst/fonts/NoradSerif-Bold.otf diff --git a/fonts/NoradSerif-BoldItalic.otf b/inst/fonts/NoradSerif-BoldItalic.otf similarity index 100% rename from fonts/NoradSerif-BoldItalic.otf rename to inst/fonts/NoradSerif-BoldItalic.otf diff --git a/fonts/NoradSerif-Italic.otf b/inst/fonts/NoradSerif-Italic.otf similarity index 100% rename from fonts/NoradSerif-Italic.otf rename to inst/fonts/NoradSerif-Italic.otf diff --git a/fonts/NoradSerif-Medium.otf b/inst/fonts/NoradSerif-Medium.otf similarity index 100% rename from fonts/NoradSerif-Medium.otf rename to inst/fonts/NoradSerif-Medium.otf diff --git a/fonts/NoradSerif-MediumItalic.otf b/inst/fonts/NoradSerif-MediumItalic.otf similarity index 100% rename from fonts/NoradSerif-MediumItalic.otf rename to inst/fonts/NoradSerif-MediumItalic.otf diff --git a/fonts/NoradSerif-Regular.otf b/inst/fonts/NoradSerif-Regular.otf similarity index 100% rename from fonts/NoradSerif-Regular.otf rename to inst/fonts/NoradSerif-Regular.otf