font-display is Incompatible with Icon Fonts

There are myriad problems with icon fonts. I won’t rehash those again here but I did a section on this specific topic in The Scoville Scale of Web Font Loading Opinions. A bunch of people have written about this before:

Delivering Octicons with SV…


This content originally appeared on Zach Leatherman and was authored by Zach Leatherman

There are myriad problems with icon fonts. I won’t rehash those again here but I did a section on this specific topic in The Scoville Scale of Web Font Loading Opinions. A bunch of people have written about this before:

The main point that I think hasn’t really been communicated enough is that icon fonts exist in a place that would seem to be outside of the web standards mainstream. Specifically, the font loading poster child—the font-display descriptor—has no valid value that is compatible with icon fonts.

When you load an icon font, you often never want the fallback text to render. It isn’t a typical Flash of Unstyled Text (FOUT) scenario. If the fallback text for an icon font renders, who knows what you might see.

If the icon font uses glyphs mapped to the Private Use Area, you may see emoji characters (this is a common failure scenario).

Screenshot of the Private Use Area (with emoji) on iOS

If the icon font uses ligatures, you could see the ligature text (which is better, but often also not handled very well).

Screenshot of the Ligature icon fallback of Google News (showing overlapping text with content)

Some browsers (Firefox) show a TOFU character as fallback.

Twitter Icon Font Fallback Screenshot

An astute web font loading reader might reach for the easiest tool in the toolbox to solve font loading issues: the font-display descriptor. However there are no good values for font-display that will offer invisible text. In fact, a few of the values will be quite bad.

  • Using font-display: optional on your icon font means that it will only render on repeat views and renders fallback text on empty cache views: Very Bad ?
  • Using font-display: swap on your icon font means that it will render fallback text immediately while waiting for the web font to finish loading: Bad ?
  • Using font-display: fallback will only render the icon font if it loads within a short (usually 3 second) time period: Not great ?
  • Using font-display: block is the default behavior and will use invisible text for up to 3 seconds and show fallback text until the web font load completes: The best option but still not good ?

To workaround these issues, you could use the CSS Font Loading API to force invisible text until the icon font has successfully loaded. Or, perhaps more in line with the web standards mainstream, you could make a better investment and convert your icons to use SVG instead.


This content originally appeared on Zach Leatherman and was authored by Zach Leatherman


Print Share Comment Cite Upload Translate Updates
APA

Zach Leatherman | Sciencx (2019-05-22T05:00:00+00:00) font-display is Incompatible with Icon Fonts. Retrieved from https://www.scien.cx/2019/05/22/font-display-is-incompatible-with-icon-fonts/

MLA
" » font-display is Incompatible with Icon Fonts." Zach Leatherman | Sciencx - Wednesday May 22, 2019, https://www.scien.cx/2019/05/22/font-display-is-incompatible-with-icon-fonts/
HARVARD
Zach Leatherman | Sciencx Wednesday May 22, 2019 » font-display is Incompatible with Icon Fonts., viewed ,<https://www.scien.cx/2019/05/22/font-display-is-incompatible-with-icon-fonts/>
VANCOUVER
Zach Leatherman | Sciencx - » font-display is Incompatible with Icon Fonts. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2019/05/22/font-display-is-incompatible-with-icon-fonts/
CHICAGO
" » font-display is Incompatible with Icon Fonts." Zach Leatherman | Sciencx - Accessed . https://www.scien.cx/2019/05/22/font-display-is-incompatible-with-icon-fonts/
IEEE
" » font-display is Incompatible with Icon Fonts." Zach Leatherman | Sciencx [Online]. Available: https://www.scien.cx/2019/05/22/font-display-is-incompatible-with-icon-fonts/. [Accessed: ]
rf:citation
» font-display is Incompatible with Icon Fonts | Zach Leatherman | Sciencx | https://www.scien.cx/2019/05/22/font-display-is-incompatible-with-icon-fonts/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.