Web fonts and how they affect RWD
Web fonts are almost mandatory to use nowadays, and I say almost because we need to be mindful of the implications they bring to our projects, and if necessary, we may actually not use them at all.
Before we get into the nitty gritty of how to work with web fonts, here are a few web font resources that may be helpful for many of you:
Now, let's see the pros and cons of using web fonts:
The advantages are:
- They help accentuate the brand and create consistency across different media.
- When used correctly, they make designs look more appealing.
- There is no need to use image replacement techniques anymore.
- This keeps the text as HTML making the content more accessible and indexable.
- Legacy browsers support web fonts.
- Great resources for free fonts.
- All these in turn help keep the markup cleaner.
The disadvantages are:
- They slow down the website/app due to HTTP requests or their dependency on third-party servers.
- Not all web fonts are legible at small and/or large sizes.
- If legacy browsers are required to support, there are more files to manage.
- Licensing the use of a font requires some sort of payment: monthly, per font family, per font style, and so on.
- Some free fonts are not well built.
- There are rendering side effects:
- Flash Of Unstyled Text (FOUT): On modern browsers, when the page loads, the text is first rendered on the screen with a system font, and then a second later it's swapped and styled with the web font.
- Flash Of Invisible Text (FOIT): On legacy browsers, when the page loads, the text is not visible but a second later it's rendered with the web font.
There are others not worth getting into, such as Flash Of Fallback Text and
Flash Of Faux Text (FOFT).
How to tackle all the "flash-of-whatever-texts" is not part of the scope of this section. However, I encourage you to read about Font Load Events in Zach Leatherman's article on the Opera blog called Better @font-face with Font Load Events (https://dev.opera.com/articles/better-font-face/).