jessedoyle / prawn-icon

Easy icons for Prawn.
Other
28 stars 15 forks source link

Can you configure to use the PRO icons if you have a licence? #54

Closed jasper502 closed 2 years ago

jessedoyle commented 2 years ago

Hi @jasper502! Thanks for using prawn-icon!

Right now prawn-icon doesn't offer out-of-the-box support for a FontAwesome pro licence.

A number of years ago, I did reach out FortAwesome/FontAwesome developers and asked if it was okay to distribute parts of FontAwesome pro (i.e. metadata files, unicode mappings, etc.) without the actual font/SVG files in an open-source library.

The response I received at the time was that open-source libraries cannot distribute any components of FontAwesome Pro software to "non-creators".

With that begin said, prawn-icon supports configuration for loading custom font files. Therefore you should be able to include your Pro icon fonts via this mechanism:

i.e.

Prawn::Icon.configure do |config|
  config.font_directory = '/path/to/fonts'
end

You'd have to setup your font directory to to have directories for each font family (i.e. fab, fas, far, fa4, etc.) similar to how prawn-icon does internally: https://github.com/jessedoyle/prawn-icon/tree/master/data/fonts.

Then for the fab, fas and far families, you would replace the .ttf font files with the pro versions. Finally, you'd need to provide a "legend" file that maps the pro icon keys to their unicode value in the font file (similar to this).

I've written a simple script (here) that parses the icons.yml metadata file from the free version of FontAwesome for the web and generates the necessary "legend" files that prawn-icon requires. It's possible that this may function for FontAwesome pro as well, but I haven't personally tested it.

So long story short, unfortunately prawn-icon doesn't include support for FontAwesome pro out-of-the-box. But it's definitely possible to use the pro icons if you configure a custom font directory for prawn-icon. It'll require a bit of configuration, but it shouldn't be too difficult in the grand scheme of things.

jessedoyle commented 2 years ago

For now I'm going to close this issue. Feel free to comment again if you have more questions!