Closed ghost closed 10 years ago
Why not to use unicode symbols directly?
@keannan5390 Aliases will be supported in the next version, so I'm closing this issue. @naixx Because FontAwesome as a lot more icons than what you can find in the unicode symbols.
@JoanZapata i meant, that it would be better to use
<string name="icon_glass">\uf000</string>
instead of
<string name="icon_glass">{fa-glass}</string>
And what are aliases?
Yes it would be faster to use the unicode character directly. But anyway, this strings.xml
file will be useless in the next version because i'll support aliases. An alias in FontAwesome is another name for the same icon, for example fa_ruble
is an alias for fa_rub
.
@JoanZapata It seems to me, that such strings/xml would be useful not because of some kind of aliases, but for compile time validation of named characters like {fa-glass}
I see, you've got a point.
Unfortunately it also prevent the use of surrounding text like {fa-glass} Drink
, and forces the lib to be an Android Library instead of just being a simple JAR file. I'm not sure it's worth it. Maybe a gradle plugin could do the validation job… It would be interesting to dig into that!
Yep, it is rather narrow case, like Drawables or simple Image Buttons. Now, I understand, why you use resources instead of assets form fonts:) But this strings.xml could be optional and could be included as a separate file.
The other thing that I was looking for - is using custom fonts (mainly fontastic.me) as it is done in https://github.com/shamanland/fonticon. There is an additional project, that generates strings.xml based on the output of fontastic(like aliases). Of course one can use unicode characters, but using strings is rather helpful. fonticon
also lacks of convenience of using strings from the code, like it is done in your project IconValue.fa_android
So, if once you are to support custom fonts, it would be a great feature to have generated IconValue :)
There must be a clean way to do it. I just created issue #33 for further investigation. Thanks for the feedback. ;)
:+1: :)
I've created a string resource file that can be included in your android project to make the icon values easy to reference reference. I know you can use the enum within the library, but I needed an easy way to be able to alias the icon names.
https://gist.github.com/keannan5390/9487918
Then you can use it like this:
or this: