Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FA Pro icons support #6

Open
alexhayes opened this issue Nov 10, 2021 · 6 comments
Open

FA Pro icons support #6

alexhayes opened this issue Nov 10, 2021 · 6 comments

Comments

@alexhayes
Copy link

Firstly thanks for making this!

I'm wondering, it says to get in contact if we're looking for FA Pro icon support. Is this something you plan to add or is there some way for it to be enabled?

@alexhayes alexhayes changed the title Pro Support FA Pro icons support Nov 10, 2021
@Gurupreet
Copy link
Owner

Hi @alexhayes Thanks for raising it. I will need to sort out the process of importing pro icons for people who have bought it already. Let me see how to proceed and would definitely will be adding it in coming future.

@alexhayes
Copy link
Author

Let me know if you'd like me to explore how this could be done.

@Gurupreet
Copy link
Owner

Hi @alexhayes please feel free to explore and raise any documentation of PR to support :)

@alexhayes
Copy link
Author

alexhayes commented Nov 22, 2021

Hi @Gurupreet after investigating this I don't believe this is going to be possible using the current approach of output vals in the FaIcons object. The problem is that with all the icons in Font Awesome 5 Pro the generated FaIcons object is too large and results in a "Code too large" compilation error - as described in this StackOverflow post.

I investigated various alternatives, such as perhaps using a properties file, using XML or perhaps even using protobufs as a faster alternative to XML (it's a massive XML file!). All require a large refactor that would change the API considerably and thus I didn't think that was appropriate.

Perhaps the approach that would be easiest for users of this library would be the one used in the FASwiftUI where the library opens up the icons.json file supplied as part of the Font Awesome download. For Pro icons this is a 14MB json file!

Using jq this file can be reduced down to 166KB as follows;

jq -c 'del(.[].changes, .[].ligatures, .[].search, .[].label, .[].voted, .[].svg, .[].free)' icons.json > icons-minified.json

However, note currently with the feature set of FASwiftUI it requires to include the search and label attributes in the JSON, which, when minified is 365K (not great, but much better than 14MB!).

Outside of the above, in order to offer Pro support a mechanism to allow users of this library to supply their own font files will need to be implemented because the Font Awesome 5 license won't allow the fonts to be shipped in this library. This appears to be trivial and will likely come down to instructions in the README, but really depends on the approach taken in any refactor.

@Gurupreet
Copy link
Owner

ahh bummer! is there a reason PRO icons are too large. I have updated to latest version for compose and kotlin as well. Not sure if that will be helpful.

@alexhayes
Copy link
Author

ahh bummer! is there a reason PRO icons are too large. I have updated to latest version for compose and kotlin as well. Not sure if that will be helpful.

The reason is there are so many icons that the class gets too large and can't be compiled - the issue is described here.

Unfortunately the version of Kotlin and Compose won't have any bearing on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants