Variable fonts and italics across browsers

I’m a big fan of Atkinson Hyperlegible Next and Berkeley Mono (TX-02). It is my opinion that they both look great, unique, and provide valuable legibility features.

I recently refactored this site to use the variable, web versions of these fonts. I was happy that I now had only a single @font-face definition, not a handful, and went on my way. (I had haphazardly picked up these parameters on the Internet somewhere.)

@font-face {
    font-family: 'Berkeley Mono';
    src: url('../fonts/Berkeley Mono Variable.woff2') format('woff2');
    font-stretch: 60 100;
    font-weight: 100 900;
    font-style: oblique -16deg 0deg;
    font-feature-settings: calt;
    font-variant-ligatures: contextual;
}

@font-face {
    font-family: 'Atkinson Hyperlegible Next';
    src: url('../fonts/AtkinsonHyperlegibleNextVF-Variable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: oblique -16deg 0deg;
}

Then, just recently, I realized that my italics were broken on this site for weeks! They worked on Chrome as I had it configured. They did not work on Firefox.

I tried a few things.

First, I tried duplicating the @font-face definition, but with font-style: italic. This made it work on Firefox, but broke Chrome.

I then found there is a new way to specify italics for variable web fonts, specifically (assuming it is supported by the font): font-variation-settings. In the case of Atkinson Hyperlegible Next, I could get my italics looking right on both Firefox and Chrome by adding the following CSS.

em {
  font-variation-settings: "ital" 1;
  font-synthesis: none;
}

But, this didn’t work for Berkeley Mono.

I also tried things like using woff2-variations in my @font-face definitions and other little tweaks to no avail.

Finally, after more experimentation, I was pleasantly surprised that I could get everything working just by simplifying.

@font-face {
    font-family: 'Berkeley Mono';
    src: url('../fonts/Berkeley Mono Variable.woff2') format('woff2');
    font-stretch: 60 100;
    font-weight: 100 900;
    font-feature-settings: calt;
    font-variant-ligatures: contextual;
}

@font-face {
    font-family: 'Atkinson Hyperlegible Next';
    src: url('../fonts/AtkinsonHyperlegibleNextVF-Variable.woff2') format('woff2');
    font-weight: 100 900;
}

I dropped the (likely incorrect) font-style attribute. No need for the em class override, now, either.

With that, I have italics, both for my normal font, and for my monospace font that work on both Firefox and Chrome. All I needed to do was delete the right two lines.

Posts from blogs I follow

The Past, Present, and Future of Digital Storytelling with Ramy Katrib

Ramy Katrib has been at the forefront of digital storytelling for over 25 years, with his post-production company, DigitalFilm Tree, earning a reputation as one of Hollywood's most technically adventurous post-production houses. He joined Bryan and Adam to explore the past, prese…

via Oxide and Friends July 23, 2026

On AI

In 2019, I started watching Andreas Kling's programming videos, many of which were live-coding sessions writing his new operating system Serenity OS. He was always pretty fast at writing code, especially since his IDE, Qt Creator, had knowledge of all his C++ code and could auto-…

via joshua stein July 23, 2026

Hardening Rust Code For Production

We talked about patterns for defensive programming in Rust before, in which implicit invariants that aren’t enforced by the compiler lead to utter misery. But being careful isn’t enough! Even valid code can fail at runtime in ways that are hard to predict and control. That’s what…

via Corrode Rust Consulting July 23, 2026

Generated by openring-rs from my blogroll.