mitchelloharawild / icons

R package to easily insert web icons to RMarkdown
https://pkg.mitchelloharawild.com/icons
313 stars 43 forks source link

Academicon icons not rendering? #45

Closed giabaio closed 3 years ago

giabaio commented 3 years ago

Since the recent update, I seem to have an issue with academicons icons, which basically do not render. I'm using icon in conjunction with xaringan --- the previous syntax

`r icon::ai("pubmed")`

would work perfectly. But when I use the new syntax, nothing really shows up... The code works for fontawesome icons, so for instance, something like

`r icon::fontawesome("r-project")`

adds the R logo. But no academicons icon is rendered.

Just for completeness, I've also tested this here. If I add to the original html code the element

<svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;fill:currentColor;position:relative;display:inline-block;top:.1em;">
  [ comment ]
  <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path>
</svg>

(which is the output of icon::fontawesome("r-project")), then the R logo is rendered.

But if I add to the html code

<svg xmlns="http://www.w3.org/2000/svg" style="height:1em;fill:currentColor;position:relative;display:inline-block;top:.1em;">
  <path transform="scale(1,-1) translate(0,-448)" d="M120.192 270.263h0.000976563s49.7627 140.605 245.478 -1.97754c0 -51.3457 -0.376953 -206.691 -0.376953 -268.285c-212.277 179.855 -248.861 26.4814 -248.861 26.4814c0 95.8271 -98.1035 84.4092 -98.1035 84.4092v255.18s22.5059 -1.68164 45.9482 -13.333 v31.2627s58.9102 -13.3506 55.915 -113.737zM307.399 96.4414h-0.000976562h44.1396l-25.6816 169.619h-43.875l-36.4658 -90.6494l-34.4355 90.6494h-43.4268l-28.8018 -169.619h43.875l14.1758 97.6543h0.448242l38.9365 -97.6543h17.5596l40.7285 97.6543h0.448242z"></path>
</svg>

(the output of icon::academicons("pubmed")), nothing shows up.

I notice that the two output differ because the one produced from academicons misses the

  [ comment ]

bit --- could this be the problem? (I don't know much about how svg are created/coded up, so this may be totally irrelevant...).

Apologies if I'm missing something obvious & thanks for your help! Gianluca

mitchelloharawild commented 3 years ago

Thanks, the issue was to do with the sizing of the icons. I've rewritten download_academicons() to use the svgs directly instead of the font file (which wasn't available when I first wrote the function).

This should work well now.

giabaio commented 3 years ago

Brilliant --- it does work now. Thanks!