Search code examples
cssfontswebfontstypography

CSS - font-family - fallback with webfont-service?


For one of my projects I use a font hosted by a webfont-service. Without any fallback, the code looks like this: font-family:'Amasis MT W01 italic'; You see, the fontstyle (italic) is already included because that's what the client pays for. When I add a fallback to this, it works of course, but the fallback font is not italic which results in a drastic change in the look of the page. Is there any fix for this? Setting Amasis MT W01 italic' to italic resulst in a "double italic" font, so that's not an option.

Actually I need something like "if Amasis is not available use Helvetica in italic" only using CSS. I guess that won't be possible? Any alternatives?


Solution

  • If the actual font is italic, you should declare font-style: italic in the @font-face rule for it as well as in normal CSS code that uses the font, e.g.

    font-family: 'Amasis MT W01 italic', Helvetica;
    font-style: italic;
    

    (It’s illogical to have the word italic in the name of a font family, but it’s just a name; you could just as well use foobar there, as long as you use the name consistently.)

    I wonder, though, why Helvetica, the proverbial sans-serif font (which gets replaced by Arial in the vast majority of computers), would be a suitable substitute for a font in the Amasis family, which has strong serifs.