First of all, what are faux font styles? As I recently learned, when you use a web font and not all the special styles are available (such as bold and italic), the browser will just alter the normal version of the font to create the faux styles. As a side note, I also learned that faux has only been used in English by itself to mean "fake" since the 1980's. I am older than this usage.
So when a font has its own bold and italic styles available, you should probably use them. Typically, this is accomplished by specifying multiple @font-face directives in your CSS. Each should define font-weight and font-style appropriately.
@font-face { font-family: 'Whatnot'; src: url('/css/Whatnot-Regular.ttf'); font-weight: normal; font-style: normal; } @font-face { font-family: 'Whatnot'; src: url('/css/Whatnot-Bold.ttf'); font-weight: bold; font-style: normal; } @font-face { font-family: 'Whatnot'; src: url('/css/Whatnot-Italic.ttf'); font-weight: normal; font-style: italic; }
Like the above example, if you have multiple versions of the font you should use them. They'll probably look better than the faux versions made by the browser.
I use Sniglet as my standard font for the comics and it doesn't have an italic version. I have no choice but to settle for the faux version. It's not the end of the world, but I noticed a problem. When I made a comic that actually relied on bold italic text, the text was showing up as neither bold nor italic in the .png image generated by PhantomJS. Why?
After a bit of investigation, it would appear that PhantomJS can't make faux font styles out of SVG fonts. Any attempt to show bold or italic Sniglet was being ignored for as long as I've been making these comics. The solution? Switch to the True Type version of the font. It doesn't look that great when PhantomJS renders it but it's better than nothing.
Amphibian.com comic for 25 September 2015 |
No comments:
Post a Comment