jessedoyle / prawn-icon

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

Is there an easy way to be backwards compatible with FontAwesome 4? #38

Closed rv0 closed 4 years ago

rv0 commented 4 years ago

Coming from https://github.com/asciidoctor/asciidoctor-pdf/issues/1157 It would be nice to retain FA4 compatibility without downgrading, by using something like icon-set=fa4

jessedoyle commented 4 years ago

Hey @rv0 - thanks for using Prawn::Icon!

When we implemented FontAwesome 5, considerable effort was put on implementing a compatibility shim (https://github.com/jessedoyle/prawn-icon/blob/master/data/fonts/fa4/shims.yml) that was to be compatible with all font-awesome 4 icons.

Therefore, any FontAwesome 4 icon key should be able to be used and it'll render the appropriate font-awesome 5 variant (with a deprecation warning).

We could bundle in the latest FontAwesome 4 assets and use the fa4 prefix to explicitly reference that icon set. It may take me a bit of time to implement this (I have a vacation coming up), but I would be open to this solution.

Of course, PRs are always welcome if anyone wants to implement this.

jessedoyle commented 4 years ago

I wanted to ask, is there a particular icon key that you're noticing isn't properly mapped using the compatibility shim? The issue you linked references fa-hdd-o.

The compatibility shim does currently map the hdd-o key: https://github.com/jessedoyle/prawn-icon/blob/master/data/fonts/fa4/shims.yml#L211.

rv0 commented 4 years ago

Hi

Thanks for your prompt reply. It seems the reason it did not work is because the compatibility shim in asciidoctor-pdf was broken (see new posts in linked issue)

Kind regards

jessedoyle commented 4 years ago

@rv0 - Thanks for the update!

For now I'll close this issue then, feel free to comment if it remains a concern and we can investigate further options.

npiper commented 1 year ago

Raised a new issue on a missing fa-4 font mapping.

Out of interest could we get an elaboration in a contribution README how to roll in a new font library like this? Is there an API / Contract implementation to follow?