Skip to content

Commit

Permalink
🐛 font missing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ecoisilva committed Jun 20, 2024
1 parent 394bdb0 commit a688a97
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 26 deletions.
2 changes: 1 addition & 1 deletion R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions R/fct_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
30 changes: 15 additions & 15 deletions R/mod_tab_about.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions R/mod_tab_sims.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
10 changes: 7 additions & 3 deletions R/utils_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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(

Expand All @@ -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(

Expand All @@ -558,7 +562,7 @@ theme_movedesign <- function(ft_size = 13,
axis.title.y = ggplot2::element_text(
family = font, angle = 90, vjust = 2)) %>%
suppressWarnings()

}
}


Expand Down
6 changes: 3 additions & 3 deletions inst/app/www/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit a688a97

Please sign in to comment.