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
Support public Unicode codepoints where possible #222
Comments
I was about to ask for the same feature. It also comes in handy, when for one or the other reason the font can't be loaded. Some interesting mappings:
and so on. I guess, far more than 80% of the icons can be mapped reasonably to existing Unicode codepoints. As far as I know, the font file sizes should not increase much, since the codepoints can be simply mapped in TTF and Woff. (In SVG, too, if the converter supports it.) |
Found this project, because I also like the idea of using symbol-characters. Many symbols are still assigned in Unicode, but some are not. See the free font http://users.teilar.gr/~g1951d/Symbola706.zip (but this font is very large). |
There is a small problem with using Emoji codepoints exclusively in FontAwesome. On mobile devices the icon is replaced with a multi-colored image. Therefore I suggest (as above) to have both codepoints, the current Private Use and the "semantically correct" Emoji, mapped to the glyph icon. This way the author can decide. |
Proposed remappings to standard Unicode symbol code points. Lines starting with
|
...and an attempt at a patch is at |
@davegandy take a look at this before: twbs/bootstrap#10106 |
@tagliala hence my comment above! It adds virtually nothing to Font Awesome's file size, if the icons are mapped to both positions but gives authors the option to choose. |
Yep. They're experiencing exactly what I predicted above:
Again, mapping both codepoints, the current Private Use and the canonical Symbol, to a glyph would give the best of both worlds to the author. |
@Boldewyn what is the best practice to map both codepoints to one glyph? I understand that Dave should map them in font files. What about the stylesheet? We need to mantain 2 versions of fontawesome? |
The mapping can appear in just one font file, the one that gets distributed. Basically, in the definition of the font you say, that both codepoints should point to the same glyph. An extreme case is how BLOKK does it: They point almost every codepoint to a rectangular shape. In the CSS nothing has to change: Still use the private codepoints as always. But if you happen to have Emojis or Symbols already in the markup or care to mark up the icons as text in the HTML, FontAwesome would Just Work™, those characters would be displayed not as the “glyph not found” placeholders but as FontAwesome icons. Another benefit would be interoperability. When all icon providers, who have a lemon icon, provide it at Unicode position U+1F34B LEMON, you could swap icon fonts any way you like. |
Sorry but I would like to properly understand. Let's say the new syntax for icon-music will be <span class="fa-icon fa-music"></span> So... css is the same but if you provide <span class="fa-icon">♫</span> you will obtain the same result as above Am I right? |
Basically, yes. That would be the beauty of this solution. Another great advantage: If the client has any font installed to display these codepoints, she will see the icons (the gist of them, that is), even if FontAwesome doesn’t load for whatever reason (or until it loads, e.g. on slow connections). So for a lemon icon, a lemon will be displayed, just not the FontAwesome-shaped one. |
@Boldewyn ok now I got it, thanks. In this case, the issue with glyphicons is not a problem at all. |
Yeah, that was my intention. I use noscript and it's pretty jarring (and ugly) to visit a new site with an icon font and see a vast sprinkling of little missing-glyph legos for all the private use glyphs, even though most of them are for characters that already have public assignments. :) Much easier to read source at a glance when it uses public glyphs, too. |
It occurs to me that if the font only contains PUA and decorative glyphs, and you stick
|
+1 for that comment. That'd be equal to the “Ampersand Font” solution. |
I'm digging into this in full force tonight. This is a big one I want to get in 4.0. |
@davegandy please remember to map both codepoints and leave the codes in the css untouched because otherwise we will experience issues in some mobile browsers |
I came up with some more mappings to approved-but-not-yet-released Unicode glyphs (that also exist in Symbola), but apparently I can't include astral plane glyphs in GitHub comments, so here's a gist instead. |
Dug into this quite a bit tonight, and it is a rats nest. I'm going to push this out to the next version, sadly. I won't consider this to be breaking backwards compatibility for that version, as these should be essentially transparent to the end user. |
Kicking this out to version 5. Browsers would override with their own unicode for these codepoints ignoring my font-face declaration. |
It would be fantastic if I could use codepoints for which appropriate icons already exist, e.g., "★" for the solid star.
A hypothetical screenreader could even then announce the name of the glyph.
The text was updated successfully, but these errors were encountered: