Fix missing fonts in useful corpora
diff --git a/scripts/useful_deliko_subcorpora.R b/scripts/useful_deliko_subcorpora.R
index 3613548..8ccc26d 100755
--- a/scripts/useful_deliko_subcorpora.R
+++ b/scripts/useful_deliko_subcorpora.R
@@ -138,7 +138,7 @@
make_copy_icon <- function(text) {
glue(
- " <span class='copy-icon' style='cursor: pointer; color: #6c757d; margin-left: 5px; font-size: 0.9em;' title='Click to copy to clipboard' data-copy='{text}'>📋</span>"
+ " <span class='copy-icon' style='cursor: pointer; color: #6c757d; margin-left: 5px; font-size: 0.9em; font-family: \"FontAwesome\"; font-weight: 900;' title='Click to copy to clipboard' data-copy='{text}'></span>"
)
}
@@ -194,6 +194,20 @@
"}"
)
+fontawesome_dependency <- htmltools::htmlDependency(
+ name = "fontawesome",
+ version = "4.3.0",
+ src = c(href = "https://corpora.ids-mannheim.de/font/"),
+ stylesheet = "fontawesome-webfont.css"
+)
+
+firasanscondensed_dependency <- htmltools::htmlDependency(
+ name = "fira-sans-condensed",
+ version = "1.0.0",
+ src = c(href = "https://corpora.ids-mannheim.de/font/"),
+ stylesheet = "fira-condensed.css"
+)
+
format_number_de <- function(x) format(x, big.mark = ".", decimal.mark = ",", scientific = FALSE, trim = TRUE)
format_number_en <- function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE, trim = TRUE)
@@ -290,7 +304,7 @@
names(table_data) <- c(title_header, vc_header, tokens_header, documents_header, "tokens_sort", "documents_sort")
- datatable(
+ widget <- datatable(
table_data,
escape = FALSE,
options = list(
@@ -317,21 +331,25 @@
language = list(url = language_url),
initComplete = JS(
"function(settings, json) {",
- " $(this.api().table().header()).css({'font-family': 'Fira Sans'});",
- " $(this.api().table().body()).css({'font-family': 'Fira Sans'});",
+ " $(this.api().table().header()).css({'font-family': 'Fira Sans Condensed, sans-serif'});",
+ " $(this.api().table().body()).css({'font-family': 'Fira Sans Condensed, sans-serif'});",
"}"
)
),
filter = "bottom",
rownames = FALSE
) %>%
- formatStyle(colnames(table_data), fontFamily = "Fira Sans, Lato, sans-serif") %>%
+ formatStyle(colnames(table_data), fontFamily = "Fira Sans Condensed, sans-serif") %>%
formatStyle(
c(tokens_header, documents_header),
- fontFamily = "Fira Sans, Lato, sans-serif",
+ fontFamily = "Fira Sans Condensed, sans-serif",
fontVariantNumeric = "tabular-nums"
) %>%
htmlwidgets::onRender(copy_js)
+
+ widget$dependencies <- c(widget$dependencies, list(fontawesome_dependency, firasanscondensed_dependency))
+
+ widget
}
widget_de <- make_table(vc_definitions, "de")