Closed aadimator closed 7 months ago
You need to add fontweight=900
to display it, notice that it must be this exact number.
import mpl_fontkit as fk
import matplotlib.pyplot as plt
fk.install_fontawesome(verbose=False)
plt.text(.5, .5, "\uf183\uf182\uf221", fontfamily="Font Awesome 6 Free", fontweight=900)
And you get:
In case you want to know, Font awesome distributed the "Free" font in two styles, weight 400 and weight 900. Unfortunately, it's not way for us to tell which icon is available in which style. So if you find something doesn't work, try either fontweight=400
or 900
. However, if one of your glyph is in 400 and one is in 900, and you want to plot them together, it won't be easy. But that's what we can get for a free version.
Thanks a bunch. That solved the issue for me.
I've trying to render the Font Awesome Icons using mpl_fontkit and the examples provided on the website. The icons in the example work fine, but when I change the utf8 to some other "Free" icon, it doesn't show. It just shows a blank box. I've tried several icons, all free, and they don't work. I've tried a couple of "Brands" icons as well, and they seem to be working fine. I have no idea what the problem could be.
Here's a basic program for reproducible problem:
And the output is:
When I uncomment the original icons as specified in the Oil example, they seem to be working fine:
But changing the utf8 values produces the above output. Can you tell me what I'm doing wrong here?