hrbrmstr/waffle

FontAwesome not found, Waffle version 0.7.0, R version 3.4.3 (2017-11-30)

cawoodjm opened this issue ยท 20 comments

Version Details
R version 3.4.3 (2017-11-30)
Waffle version 0.7.0

Issue
When I run the below script I receive the following error message.

"Error: FontAwesome not found. Install via: https://github.com/FortAwesome/Font-Awesome/tree/master/fonts"
*** Please note, when I follow the above link it takes users to a 404 error page. ***

The steps I followed to correct, were to install the Fontawesome files from GitHub as indicated in the waffle package support documentation. I checked that he FA fonts were loaded by running fa_list(), which returned the list of fonts available. I would like to know if I need to call the FA fonts in a different manner to use the use_glyph function within waffle.

Script
library(waffle)
test <- c(40)
waffle(test, rows=1,use_glyph = 'male')

I have the same issue it seems:

waffle(tmp, rows=8, use_glyph = "child")
Error in readLines(fa_url) : HTTP error 404.

Having a quick glance, it looks like this link in your code @hrbrmstr is invalid:
https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/css/font-awesome.css

So it seems you are using a css stylesheet from that location which is not valid any more.

BW

The example script was a bit busy for this thread, so I simplified it. I do not have control if the package is using CSS style, it loaded that way when the package was installed. What I really desire is to just use a custom glyph to use with the waffle package.

I wanted to start with a clean install of the waffle package, so I remove and installed. When I call the package I receive the following warning. It appears that waffle cannot find a particular font. Can I found out which one it needs and where to pull the install package.

library(waffle)
Loading required package: ggplot2
Warning messages:
1: In grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
font family not found in Windows font database
2: In grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
font family not found in Windows font database

Hi,
I can use emojifont and font awesome by using the X11() window. However, I can't load font awesome using waffle package.

I have all packages and fonts successfully installed, but I still getting the same error message:

waffle(c(50, 30, 15, 5), rows = 5, use_glyph = "child", glyph_size = 6, title = "Look I made an infographic using R!")

Error: FontAwesome not found. Install via: https://github.com/FortAwesome/Font-Awesome/tree/master/fonts

code

library(ggplot2)
library(emojifont)
library(waffle)
library(extrafont)

system.file("fonts", package="waffle")

load.fontawesome()

load.fontawesome(font = "fontawesome-webfont.ttf")

X11()

set.seed(2016-03-09)
fa <- fontawesome(c('fa-github', 'fa-weibo', 'fa-twitter', 'fa-android', 'fa-coffee'))
d <- data.frame(x=rnorm(20),
y=rnorm(20),
label=sample(fa, 20, replace=T))

ggplot(d, aes(x, y, color=label, label=label)) +
geom_text(family='fontawesome-webfont', size=6)+
xlab(NULL)+ylab(NULL) +
theme(legend.text=element_text(family='fontawesome-webfont'))

ggplot() + geom_fontawesome("fa-github", color='black') + theme_void()

this is working, it shows a lot of squares.

waffle(c(50, 30, 15, 5), rows = 5, title = "Your basic waffle chart")

this one shows me the error FontAwesome not found, even though I have succesfully installed all the packages above.

waffle(c(50, 30, 15, 5), rows = 5, use_glyph = "child", glyph_size = 6,
title = "Look I made an infographic using R!")

Does anyone can help me with this?

FontAwesome needs to be installed as a system (i.e. OS) font and made available to R via extrafont's font-import capabilities.

Ok. I did:

font_import()
fonts()[grep("Awesome", fonts())]
# [1] "FontAwesome"

It worked, now I can plot inside rstudio.

However, I can't see the icons, just weird rectangles:
erro-waffle

Then I saw that other people are experiencing the same issue: #43

I tried to install both 5.0 and 4.7 (as suggested by other user) versions, however I still getting the rectangles instead of images, even when I call X11() first.

Any ideas how to fix this?

PS. Using macbook it is happening the same thing.

In order to help other users experiencing same issue:

After installing fontawesome.ttf and call font_import() and loadfonts(device = "win") I was finally able to see few icons, however not all of them.

This is how it lookslike when the icon works:

waffle(c(50, 30, 15, 5), rows = 5, use_glyph = "music", glyph_size = 6)

music-icon

This is how it lookslike when the icon is not available (there is also the weird rectangle as I described above):

waffle(c(50, 30, 15, 5), rows = 5, use_glyph = "calculator", glyph_size = 6)

calculator-icon

This is a list with icons that are currently working for me: medkit, ambulance, bolt, circle, home, phone, music, film, plane, play, comments.

This is a list with icons that are not working: bed, calculator, money-bill-alt, percent, bicycle, adress-book, parachute-box, map, newspapper, bus, podcast, exchange-alt, warnings.

I get the boxes with a dot in as posted above regardless of which glyph I try. Did you ever manage to fix this?

  1. fontawesome-webfont.ttf is needed rather than the .otf one;
  2. install above ttf to the OS font;
  3. font_import it with extrafont package, and loadfonts(device = "win") when you are using windows;
  4. it will work fine, for full icon list please refer to fontawesome cheatsheet
    image

This is a list with icons that are not working: bed, calculator, money-bill-alt, percent, bicycle, adress-book, parachute-box, map, newspapper, bus, podcast, exchange-alt, warnings.

suggest to refer to your ttf file version and its icons list, as for v4.7, at least "bed, calculator, bicycle" are supported.

I am running into a similar issue. I have downloaded the desktop version of Font Awesome. I see otf files but not ttf files. How do I find those?

https://fontawesome.com/how-to-use/on-the-desktop/setup/getting-started

@soroosj If you download the "web" version (https://fontawesome.com/download) you should see the ttf files.

I have the same issue. I have installed the .ttfs. When I use font_import(), Font Awesome never shows up in the list. I have tried V 4 and V5.

same issue
install above ttf to the OS font. CHECK
font_import it with extrafont package, and loadfonts(device = "win") when you are using windows. CHECK

> fonttable() %>% filter(str_detect(FamilyName,"^Font.")) %>% select(fontfile,FamilyName)

             fontfile                    FamilyName

1 C:\Windows\Fonts\fa-brands-400.ttf Font Awesome 5 Brands Regular
2 C:\Windows\Fonts\fa-solid-900.ttf Font Awesome 5 Free Solid
3 C:\Windows\Fonts\fontawesome-webfont.ttf FontAwesome
4 C:\Windows\Fonts\fa-regular-400.ttf Font Awesome 5 Free Regular

>waffle(c(50, 30, 15, 5), use_glyph = "music")

Warning message:
In grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
font family not found in Windows font database

> > sessionInfo()

R version 3.5.0 (2018-04-23)
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 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252

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

other attached packages:
[1] extrafont_0.17 waffle_1.0.1 hrbrthemes_0.6.0 forcats_0.4.0 stringr_1.4.0 dplyr_0.8.3
[7] purrr_0.3.2 readr_1.3.1 tidyr_1.0.0 tibble_2.1.3 ggplot2_3.2.1 tidyverse_1.2.1

loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 lubridate_1.7.4 lattice_0.20-35 utf8_1.1.4 assertthat_0.2.1 zeallot_0.1.0
[7] digest_0.6.21 R6_2.4.0 cellranger_1.1.0 plyr_1.8.4 backports_1.1.4 evaluate_0.14
[13] httr_1.4.1 pillar_1.4.2 gdtools_0.2.0 rlang_0.4.0 lazyeval_0.2.2 curl_4.2
[19] readxl_1.3.1 rstudioapi_0.10 extrafontdb_1.0 DT_0.9 rmarkdown_1.15 labeling_0.3
[25] htmlwidgets_1.5.1 munsell_0.5.0 broom_0.5.2 compiler_3.5.0 modelr_0.1.5 xfun_0.9
[31] pkgconfig_2.0.3 systemfonts_0.1.1 htmltools_0.3.6 tidyselect_0.2.5 gridExtra_2.3 fansi_0.4.0
[37] crayon_1.3.4 withr_2.1.2 grid_3.5.0 nlme_3.1-137 jsonlite_1.6 Rttf2pt1_1.3.7
[43] gtable_0.3.0 lifecycle_0.1.0 magrittr_1.5 scales_1.0.0 cli_1.1.0 stringi_1.4.3
[49] xml2_1.2.2 generics_0.0.2 vctrs_0.2.0 RColorBrewer_1.1-2 tools_3.5.0 glue_1.3.1
[55] hms_0.5.1 yaml_2.2.0 colorspace_1.4-1 sessioninfo_1.1.1 rvest_0.3.4 knitr_1.25
[61] haven_2.1.1

Still, Font Awesome doesn't show up on the list.

Same error as apsteinmetz but on a mac

fonttable() %>% filter(str_detect(FamilyName,"^Font.")) %>% select(fontfile,FamilyName)

yields

  fontfile              FamilyName 

1 /Users/andrecalerovaldez/Library/Fonts/fa-brands-400.ttf Font Awesome 5 Brands Regular
2 /Users/andrecalerovaldez/Library/Fonts/fa-solid-900.ttf Font Awesome 5 Free Solid

Then calls to waffle create this warning
In grid.Call.graphics(C_text, as.graphicsAnnot(x$label), ... : no font could be found for family "FontAwesome5Free-Solid"

:(

Has there ever been anymore solutions to this? Still experiencing this issue. I have downloaded everything properly with fonts()[grep("Awesome", fonts())] displaying "FontAwesome", yet when I go to plot a waffle chart with the music glyph I receive this error message: font family 'FontAwesome' not found, will use 'wqy-microhei' instead. Any help is appreciated!

having the same problem as @amazzarolo

I experienced the same probllem as @eirini-zormpa and @amazzarolo.
But the following walkthrough solved the issue in my macOS environment:

First, check the font names and its file location:

fonttable() %>% 
  dplyr::filter(stringr::str_detect(FamilyName,"^Font.")) %>% 
  select(FontName, fontfile)
FontName                                       fontfile
  1. FontAwesome5Brands-Regular /Users/fronori/Library/Fonts/fa-brands-400.ttf
  2. FontAwesome5Free-Regular /Users/fronori/Library/Fonts/fa-regular-400.ttf
  3. FontAwesome5Free-Solid /Users/fronori/Library/Fonts/fa-solid-900.ttf

If any FontAwesome font is not appeared, install the proper .ttf files into your OS first.

Second, add Awesome fonts and its file locations to R by the font_add() function of showtext package. You can specify the FontName and fontfile displayed in the above step. Then, showtext_auto() function allows newly opened graphics devices to use the showtext to draw text.

library(showtext)
font_add(family = "FontAwesome5Free-Solid", regular = "/Users/fronori/Library/Fonts/fa-solid-900.ttf")
font_add(family = "FontAwesome5Free-Regular", regular = "/Users/fronori/Library/Fonts/fa-regular-400.ttf")
font_add(family = "FontAwesome5Brands-Regular", regular = "/Users/fronori/Library/Fonts/fa-brands-400.ttf")
showtext_auto()

Finaly, voila!
waffle(c(50, 30, 15, 5), rows = 5, use_glyph = "music", glyph_size = 6)
In may case, Roboto Condensed is also needed to use waffle package without warnings. So I installed it.
I hope this post will be helpful for those who suffer from similar problems!

sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6

After a while of frustration, following the clear instructions here did it for me eventually:

https://www.listendata.com/2019/06/create-infographics-with-r.html