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

FontAwesome +allIcons mapping #19

Closed
zliw opened this issue May 22, 2014 · 6 comments
Closed

FontAwesome +allIcons mapping #19

zliw opened this issue May 22, 2014 · 6 comments

Comments

@zliw
Copy link

zliw commented May 22, 2014

I'm currently playing around with FontAwesomeKit (see here for first impressions) and noticed, that the allIcons - Method returns a mapping of unicode values to icon names in camel case. Wouldn't this mapping make much more sense the other way around?

This way you could lookup icons by their name as given by the Font Awesome project itself and you would be able to support name aliases:

@{
    @"automobile": @"\uf1b9",
    @"car": @"\uf1b9"
};

Martin
p.S.: Do you need help to upgrade to font version 4.1?

@koraktor
Copy link

👍

@PrideChung
Copy link
Owner

I've been a little bit busy on my daily job lately and didn't notice the Font-Awesome's new release. It would be nice if you can upgrade the font to 4.1 for us.
As for those icon names, I planed to provide the ability to create an icon from NSString through NSInvocation, so we can load icons from configuration files. Then I made the icon names in this way, append IconWithSize: to an icon name and I can get the correct selector name. Maybe we can discuss this more thoroughly later?

@zliw
Copy link
Author

zliw commented May 25, 2014

I'll look into upgrading the font later on with the generators (will take probably a little while, as I have no previous experience with Ruby yet) and will probably through in some proposals for utility methods.

I've also thought a little bit about dynamically creating methods inside the objective-c runtime. Unfortunately this won't give us that much benefits, as you have to declare the methods in the header files anyway and I think we can generate code and avoid repetition of the data in the code without having to do invocation voodoo.

I'll get back to you, when I've toyed a little bit more with the generators. That won't be before this evening - most probably tomorrow.

@zliw
Copy link
Author

zliw commented May 27, 2014

The update to version 4.1 of font awesome is done.

As I made quite a lot of changes in the generator (and don't know much about ruby), you will probably want to have a look at it and add your thoughts. Some things to consider:

  • the changes should not break the other generators, but I did not test it...
  • to avoid duplication of glyphs, I created a static NSString object for each. As the symbols should get
    stripped on shipping the app, that should be reasonable overhead. We could also declare these Symbols in the header file, if you want to.
  • FAKFontAwesome class has now the reverse mapping I spoke about. I jumped through some loops in the generator to preserve the original naming convention.
  • I changed the base FAKIcon class to include an internal name property, which is used, if initialized by name. This is a first step for handling of aliases.

I'll initiate a pull request once we reach a point, where you are satisfied with the changes.

@PrideChung
Copy link
Owner

Looks cool! 👍

@zliw
Copy link
Author

zliw commented May 28, 2014

I close this ticket, since the pull request has created a new one (#21)

@zliw zliw closed this as completed May 28, 2014
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

3 participants