hrbrthemes icon indicating copy to clipboard operation
hrbrthemes copied to clipboard

font family not found in Windows font database

Open jcpsantiago opened this issue 6 years ago • 11 comments

None of the fonts is working for me on Windows 10. I can use roboto and ibm plex (and Arial Narrow) outside of Rstudio.

This won't work for me, resulting in a plot with R's default font (vanilla Arial?)

library(hrbrthemes)
library(tidyverse)

import_roboto_condensed()

ggplot(mtcars, aes(mpg, wt)) +
  geom_point() +
  labs(x="Fuel effiiency (mpg)", y="Weight (tons)",
       title="Seminal ggplot2 scatterplot example",
       subtitle="A plot that is only useful for demonstration purposes",
       caption="Brought to you by the letter 'g'") + 
  theme_ipsum_rc()

I'm using R 3.4.2, Rstudio 1.1.383 and the latest theme package ‘0.5.0’.

jcpsantiago avatar Jan 15 '18 14:01 jcpsantiago

Installed the fonts from the hrbrthemes folder and that fixed it. Maybe I had the wrong version of the fonts installed on my system. Anyway it's working now

jcpsantiago avatar Jan 15 '18 14:01 jcpsantiago

Sorry.. seems to work for roboto and titillium, but not ibm plex or arial narrow, even after installing the fonts from the R directory. and running import_plex_sans

jcpsantiago avatar Jan 15 '18 14:01 jcpsantiago

Windows can do some weird things w/r/t fonts. Can you paste the output of sessionInfo()? I may be able to recreate the environment in a VM and troubleshoot.

hrbrmstr avatar Jan 18 '18 23:01 hrbrmstr

> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] stringi_1.1.6    bindrcpp_0.2     here_0.1         hrbrthemes_0.5.0 forcats_0.2.0    stringr_1.2.0   
 [7] dplyr_0.7.4      purrr_0.2.4      readr_1.1.1      tidyr_0.7.2      tibble_1.3.4     ggplot2_2.2.1   
[13] tidyverse_1.2.1 

loaded via a namespace (and not attached):
 [1] reshape2_1.4.2   haven_1.1.0      lattice_0.20-35  colorspace_1.3-2 htmltools_0.3.6  yaml_2.1.15     
 [7] rlang_0.1.6      foreign_0.8-69   glue_1.2.0       modelr_0.1.1     readxl_1.0.0     bindr_0.1       
[13] plyr_1.8.4       munsell_0.4.3    gtable_0.2.0     cellranger_1.1.0 ggsci_2.8        rvest_0.3.2     
[19] evaluate_0.10.1  psych_1.7.8      labeling_0.3     knitr_1.18       extrafont_0.17   parallel_3.4.2  
[25] Rttf2pt1_1.3.5   broom_0.4.3      Rcpp_0.12.14     backports_1.1.1  scales_0.5.0     jsonlite_1.5    
[31] mnormt_1.5-5     hms_0.4.0        digest_0.6.12    rprojroot_1.2    grid_3.4.2       cli_1.0.0       
[37] tools_3.4.2      magrittr_1.5     lazyeval_0.2.1   crayon_1.3.4     extrafontdb_1.0  pkgconfig_2.0.1 
[43] xml2_1.1.1       lubridate_1.7.1  assertthat_0.2.0 rmarkdown_1.8    httr_1.3.1       rstudioapi_0.7  
[49] R6_2.2.2         nlme_3.1-131     compiler_3.4.2  

jcpsantiago avatar Jan 19 '18 11:01 jcpsantiago

I've encountered the same issue. Did you have any luck getting to the bottom of it? I would love to be able to get things working and use your themes in my project. Here is my session info:

`> sessionInfo() R version 3.6.0 (2019-04-26) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale: [1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] ggtree_1.14.6 hrbrthemes_0.6.0 ggpubr_0.2.1 magrittr_1.5 evomap_0.0.0.9000 phytools_0.6-99 maps_3.3.0 nlme_3.1-140
[9] geiger_2.0.6.2 ape_5.3 forcats_0.4.0 stringr_1.4.0 dplyr_0.8.1 purrr_0.3.2 readr_1.3.1 tidyr_0.8.3
[17] tibble_2.1.3 ggplot2_3.2.1 tidyverse_1.2.1

loaded via a namespace (and not attached): [1] httr_1.4.0 jsonlite_1.6 modelr_0.1.4 gtools_3.8.1 assertthat_0.2.1 expm_0.999-4
[7] rvcheck_0.1.3 animation_2.6 cellranger_1.1.0 gdtools_0.2.0 Rttf2pt1_1.3.7 numDeriv_2016.8-1.1
[13] pillar_1.4.1 backports_1.1.4 lattice_0.20-38 glue_1.3.1 quadprog_1.5-7 phangorn_2.5.5
[19] extrafontdb_1.0 digest_0.6.19 ggsignif_0.5.0 rvest_0.3.4 colorspace_1.4-1 cowplot_0.9.4
[25] htmltools_0.3.6 Matrix_1.2-17 pkgconfig_2.0.2 broom_0.5.2 haven_2.1.0 mvtnorm_1.0-11
[31] tidytree_0.2.4 scales_1.0.0 combinat_0.0-8 generics_0.0.2 ellipsis_0.2.0 withr_2.1.2
[37] lazyeval_0.2.2 cli_1.1.0 mnormt_1.5-5 crayon_1.3.4 readxl_1.3.1 evaluate_0.14
[43] MASS_7.3-51.4 xml2_1.2.0 tools_3.6.0 hms_0.4.2 munsell_0.5.0 plotrix_3.7-6
[49] packrat_0.5.0 compiler_3.6.0 systemfonts_0.1.1 clusterGeneration_1.3.4 rlang_0.4.0 grid_3.6.0
[55] rstudioapi_0.10 subplex_1.5-4 igraph_1.2.4.1 labeling_0.3 rmarkdown_1.13 gtable_0.3.0
[61] deSolve_1.21 R6_2.4.0 lubridate_1.7.4 knitr_1.23 extrafont_0.17 fastmatch_1.1-0
[67] treeio_1.6.2 stringi_1.4.3 parallel_3.6.0 Rcpp_1.0.1 scatterplot3d_0.3-41 tidyselect_0.2.5
[73] xfun_0.6 coda_0.19-2 `

MaxKerney avatar Sep 08 '19 20:09 MaxKerney

I seem to have managed to get things working now. The trick for me was to 1) make sure that the fonts were installed in the "C:\Windows\Fonts" folder (it seems that Windows can sometimes show a font as installed even if it's in another location); 2) manually call extrafont::font_import(); 3) Restart R and call library(hrhrthemes) again.

MaxKerney avatar Sep 29 '19 22:09 MaxKerney

Running into the same problem despite trying @MK212 's approach. Sessioninfo below:

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_Sweden.1252  LC_CTYPE=English_Sweden.1252    LC_MONETARY=English_Sweden.1252
[4] LC_NUMERIC=C                    LC_TIME=English_Sweden.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] gridExtra_2.3    hrbrthemes_0.6.0 ggplot2_3.2.1    glmnet_3.0-2     Matrix_1.2-17   

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3        pillar_1.4.3      compiler_3.6.1    iterators_1.0.12  tools_3.6.1       extrafont_0.17   
 [7] digest_0.6.23     evaluate_0.14     lifecycle_0.1.0   tibble_2.1.3      gtable_0.3.0      lattice_0.20-38  
[13] pkgconfig_2.0.3   rlang_0.4.2       foreach_1.4.7     rstudioapi_0.10   xfun_0.12         Rttf2pt1_1.3.8   
[19] withr_2.1.2       dplyr_0.8.3       knitr_1.27        systemfonts_0.1.1 gdtools_0.2.1     grid_3.6.1       
[25] tidyselect_0.2.5  glue_1.3.1        R6_2.4.1          rmarkdown_2.1     farver_2.0.3      purrr_0.3.3      
[31] extrafontdb_1.0   magrittr_1.5      scales_1.1.0      codetools_0.2-16  htmltools_0.4.0   assertthat_0.2.1 
[37] shape_1.4.4       colorspace_1.4-1  labeling_0.3      lazyeval_0.2.2    munsell_0.5.0     crayon_1.3.4

soedr avatar Jan 23 '20 20:01 soedr

Calling extrafont::loadfonts(device="win") solved the issue for me. Only needed once.

soedr avatar Jan 28 '20 17:01 soedr

import_roboto_condensed + extrafont::loadfonts(device ='win') + restart worked for me

johnmackintosh avatar Jan 29 '20 19:01 johnmackintosh

Installed the fonts from the hrbrthemes folder and that fixed it. Maybe I had the wrong version of the fonts installed on my system. Anyway it's working now

Can you explain how you did this?

rickyars avatar Jun 15 '22 12:06 rickyars

Installed the fonts from the hrbrthemes folder and that fixed it. Maybe I had the wrong version of the fonts installed on my system. Anyway it's working now

Can you explain how you did this?

A message pops up with a path: "You will likely need to install these fonts on your system as well.

You can find them in [C:/Users/username/AppData/Local/R/win-library/4.2/hrbrthemes/fonts/roboto-condensed]"

Just go to settings - personalize and install the fonts from there.

EliDerDeli avatar Dec 10 '22 11:12 EliDerDeli