Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Font Awesome in R, loaded but not found by waffle

I downloaded the otf files from this website. My IT dept installed "Font Awesome 5 Free Regular" and I used

library(extrafont)
font_import()
loadfonts(device = "win")

I can see Font Awesome as "Font Awesome 5 Free Regular" is registered. When I tried to use it with this test code:

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

I get

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

but that link doesn't go anywhere.

I would like to use Font Awesome (or a good alternative) to make interesting waffle charts. Did I load the font incorrectly? Is there a better alternative I am missing? I have been using this article as a guide. I have also read a related question here on stackoverflow, but it did not help. I have restarted Rstudio (and the computer) several times and no luck.

Update

Still not working. I have removed and reinstalled the waffle and emojifont packages. I Still get the error code : "Error: FontAwesome not found. Install via: https://github.com/FortAwesome/Font-Awesome/tree/master/fonts"

like image 364
Lauren Avatar asked Jul 12 '18 17:07

Lauren


2 Answers

For anyone who ends up here in 2021 and fails to get it working with extrafont, here is an alternative approach:

  1. Use the legacy FontAwesome ttf, that Silviculturalist linked to: https://github.com/FortAwesome/Font-Awesome/releases/tag/v4.7.0
  2. Extract fontawesome-webfont.ttf to your work directory (or some directory you can access)
  3. Use the waffle, emojifont and showtext packages to create the chart, sample code below
install.packages(c("waffle", "emojifont", "showtext"))
 
library(waffle)
library(emojifont)
library(showtext)

font_add(family = "FontAwesome", 
         regular = "fontawesome-webfont.ttf")

waffle(c(5,12,18), rows = 5, use_glyph = "subway", glyph_size = 10, 
title = "Subways!", legend_pos="right")
like image 155
bencekd Avatar answered Nov 14 '22 22:11

bencekd


You may want to try using FontAwesome v. 4.7 I had the same issue as you but it resolved itself immediately when I installed the .ttf version.

like image 23
Silviculturalist Avatar answered Nov 14 '22 22:11

Silviculturalist