From a688a9744eb1450c9e41cb22a67e9206a204a900 Mon Sep 17 00:00:00 2001 From: ecoisilva Date: Thu, 20 Jun 2024 09:22:16 +0200 Subject: [PATCH] :bug: font missing issue --- R/app_server.R | 2 +- R/fct_helpers.R | 1 + R/mod_tab_about.R | 30 +++++++++++++++--------------- R/mod_tab_sims.R | 8 ++++---- R/utils_helpers.R | 10 +++++++--- inst/app/www/custom.css | 6 +++--- 6 files changed, 31 insertions(+), 26 deletions(-) diff --git a/R/app_server.R b/R/app_server.R index e93493a..199a8ea 100644 --- a/R/app_server.R +++ b/R/app_server.R @@ -66,7 +66,7 @@ app_server <- function(input, output, session) { is_analyses = FALSE, is_report = FALSE, is_meta = FALSE, - is_font = TRUE, + is_font = FALSE, add_note = FALSE, err_prev = rep(1, 5), diff --git a/R/fct_helpers.R b/R/fct_helpers.R index e110800..8bebaf5 100644 --- a/R/fct_helpers.R +++ b/R/fct_helpers.R @@ -802,6 +802,7 @@ extract_pars <- function( tmp_name <- ifelse(any(grepl("decay", nms.obj)), "decay", "\u03C4") tmp <- sum.obj$CI[grep(tmp_name, nms.obj), ] + unit <- extract_units(nms.obj[grep(tmp_name, nms.obj)]) } if (!is.null(nrow(tmp))) diff --git a/R/mod_tab_about.R b/R/mod_tab_about.R index 2f7a76b..d8c8984 100644 --- a/R/mod_tab_about.R +++ b/R/mod_tab_about.R @@ -286,21 +286,21 @@ mod_tab_about_server <- function(id, rv) { # MAIN REACTIVE VALUES ------------------------------------------------ - observe({ - - font_available <- tryCatch({ - sysfonts::font_add_google(name = "Roboto Condensed", - family = "Roboto Condensed") - }, error = function(e) { - warning("Font failed.") - }) - - rv$is_font <- TRUE - if (inherits(font_available, "error")) { - rv$is_font <- FALSE - } - - }) # end of observe + # observe({ + # + # font_available <- tryCatch({ + # sysfonts::font_add_google(name = "Roboto Condensed", + # family = "Roboto Condensed") + # }, error = function(e) { + # warning("Font failed.") + # }) + # + # rv$is_font <- TRUE + # if (inherits(font_available, "error")) { + # rv$is_font <- FALSE + # } + # + # }) # end of observe observe({ rv$which_data <- input$which_data diff --git a/R/mod_tab_sims.R b/R/mod_tab_sims.R index 5792b75..d301430 100644 --- a/R/mod_tab_sims.R +++ b/R/mod_tab_sims.R @@ -1246,14 +1246,14 @@ mod_tab_sims_server <- function(id, rv) { # Time elapsed: ggplot2::annotate( - "text", family = "Roboto Condensed", + "text", family = "Consolas", # family = "Roboto Condensed", col = pal$mdn, x = min(datfull$x) + diff(range(datfull$x)) * .2, y = ymax - diff(range(datfull$y)) * .1, fontface = 2, size = 5, lineheight = 1.5, label = paste("Time elapsed:\n")) + ggplot2::annotate( - "text", family = "Roboto Condensed", + "text", family = "Consolas", # family = "Roboto Condensed", col = pal$mdn, x = min(datfull$x) + diff(range(datfull$x)) * .2, y = ymax - diff(range(datfull$y)) * .1, @@ -1263,14 +1263,14 @@ mod_tab_sims_server <- function(id, rv) { # Distance traveled: ggplot2::annotate( - "text", family = "Roboto Condensed", + "text", family = "Consolas", # family = "Roboto Condensed", col = pal$mdn, x = max(datfull$x) - diff(range(datfull$x)) * .2, y = ymax - diff(range(datfull$y)) * .1, fontface = 2, size = 5, lineheight = 1.5, label = paste("Distance traveled:\n")) + ggplot2::annotate( - "text", family = "Roboto Condensed", + "text", family = "Consolas", # family = "Roboto Condensed", col = pal$mdn, x = max(datfull$x) - diff(range(datfull$x)) * .2, y = ymax - diff(range(datfull$y)) * .1, diff --git a/R/utils_helpers.R b/R/utils_helpers.R index 0e4df0c..4607186 100644 --- a/R/utils_helpers.R +++ b/R/utils_helpers.R @@ -295,6 +295,8 @@ staticBlock <- function(text, #' @noRd extract_units <- function(input, name = NULL) { + if (length(input) == 0) return(NULL) + # if (class(input)[1] != "list" && class(input[[1]])[1] != "ctmm") { # input <- summary(input) # } else { @@ -513,7 +515,9 @@ theme_movedesign <- function(ft_size = 13, font = "Roboto Condensed", font_available = TRUE) { - if (!font_available) + if (!font_available) { + # font <- "Consolas" + ggplot2::theme_minimal() %+replace% # replace elements ggplot2::theme( @@ -536,7 +540,7 @@ theme_movedesign <- function(ft_size = 13, angle = 90, vjust = 2)) %>% suppressWarnings() - else + } else { ggplot2::theme_minimal() %+replace% # replace elements ggplot2::theme( @@ -558,7 +562,7 @@ theme_movedesign <- function(ft_size = 13, axis.title.y = ggplot2::element_text( family = font, angle = 90, vjust = 2)) %>% suppressWarnings() - + } } diff --git a/inst/app/www/custom.css b/inst/app/www/custom.css index 9b424fb..453c75c 100644 --- a/inst/app/www/custom.css +++ b/inst/app/www/custom.css @@ -40,9 +40,9 @@ --black: #000; --sans: 'Plus Jakarta Sans', sans-serif; - --monosans: 'Roboto Condensed', Consola, monospace, sans-serif; - --monosans: 'Roboto Condensed', Consola, monospace, sans-serif; - --mono: 'Fira Mono', Consola, monospace, sans-serif; + --monosans: 'Roboto Condensed', Consolas, monospace, sans-serif; + --monosans: 'Roboto Condensed', Consolas, monospace, sans-serif; + --mono: 'Fira Mono', Consolas, monospace, sans-serif; } .cl-mdn { color: var(--midnight) !important; }