Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do icon fonts always use the PUA?

Sorry if this question is phrased awkwardly (or doesn't even make sense). I am struggling to understand a bit more of fonts and unicode but I am sort of lost. This question uses the Awesome font as an example because I assume it is well known, but the question applies to other icon fonts as well.

Unicode has many symbol characters. I can do ☼ and (if all goes well) the user will see: ☼

In case that did not render properly in your browser: it is a sun. The ☼ HTML entity corresponds to unicode point U+263c.

Now consider the famous Awesome font. It also has a sun. You render it by using a <i> element and setting this element's class to fa fa-sun-o. This class is defined in the stylesheet as:

.fa-sun-o:before {
  content: "\f185";
}

From what I understand, the \f thingy refers to unicode point U+f185, which is in the PUA, which basically means that font designers can use it for whatever they like.

Now, I can understand that the PUA points are used for symbols that simply aren't in the unicode specification. But that doesn't apply to the sun icon. Why didn't they just use \263c?

like image 865
Pixelkracht Avatar asked Nov 28 '25 09:11

Pixelkracht


1 Answers

Icon fonts do not always use the PUA. For example, the Wingdings font uses the range U+0021...U00FF. This means that icon glyphs are assigned to code positions that are reserved for something else in Unicode, so this approach has obvious disadvantages (and some advantages).

When an icon has not been encoded as a character in Unicode, the only feasible way to include it in a font is to use the PUA. The PUA is meant to be used by private agreements in such cases. In effect, an icon font design constitutes an agreement as soon as you knowingly decide to use the font, hopefully understanding the implications.

There can be issues with symbols that might or might not be interpreted as already encoded in Unicode. A font designer may find it simpler to allocate all icons in the font to PUA codepoints.

In particular, U+263C WHITE SUN WITH RAYS “☼”, although it is more or less iconic in nature, is still encoded as a character. This means that it may vary, and is expected to vary, across fonts. In fact, it varies considerably. Although the basic shape tends to be the same, the size (relative to font size), stroke width, lengths of rays, etc. vary.

A pure icon, in constrast, is just a specific shape. It may look similar to, or even identical to, the glyph of some character in some font, but it’s still regarded as a standalone symbol. This may change (it may become a character), if the icons are coded as characters later.

And, in practice, the fa-sun-o icon, although it could conceivable be used a a glyph for U+263C, differs from most glyphs for it (by having rather short rays). If Font Awesome glyphs will be encoded a characters some day, it is quite possible that fa-sun-o will not be unified with U+263C, but a new character will be allocated.

like image 170
Jukka K. Korpela Avatar answered Nov 29 '25 22:11

Jukka K. Korpela



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!