question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Default `font-family` (no custom fonts) on linux (Ubuntu/Kubuntu) does not render properly font weights

See original GitHub issue

What version of Tailwind CSS are you using?

v3.0.24

What build tool (or framework if it abstracts the build tool) are you using?

svelte-kit@latest

What version of Node.js are you using?

v16

What browser are you using?

Chrome

What operating system are you using?

linux@ubuntu/kubuntu

Describe your issue

I’ve always used Windows and Mac. Lately I’ve been forced to use linux (both Ubuntu and Kubuntu 22.04).

To my surprise the fonts on the site do not match those on Windows and Mac and a lot of the graphics work is spoiled by this “idiosyncrasy”.

In the following screenshots you can see the tailwind website on Chrome v100 before and after changing the font-family (manually in the dev-tools panel).

As you can see, when the “Inter” font is removed (ie when we developers decide NOT to use custom fonts) the browser chooses to display everything with the “Noto Sans” font which does not distinguish between font-light, font-normal and font-medium and then between font-semibold and font-bold.

Expected

Can we change the default font-family in a smarter way that takes into account the default fonts on all the most used operating systems?

Screens

  • with Inter font:

    image

  • without Inter font:

    image

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
adamwathancommented, May 11, 2022

We spent some more time looking into this just to be sure we understood exactly what was going on and the answer here is really just that on those OSes, system-ui maps to Cantarell and the version of Cantarell that ships with those OSes only supports a limited number of weights.

You can see on the Wikipedia page that the non-variable version of the font only includes four weights:

https://en.wikipedia.org/wiki/Cantarell_(typeface)

This means that of course certain Tailwind font-weight utilities will look the same, since there’s no dedicated weight to actually render.

This is true of other system fonts as well, for example Segoe UI on Windows only includes 6 weights, when Tailwind includes 9 font-weight utilities.

Going to close this as just something we don’t intend to take any action on — our default font stack intentionally uses the system font and like you’ve discovered that means there will be inconsistencies between different operating systems. We are comfortable with that trade-off because it means that at least out of the box Tailwind matches the look of the OS that user is on, and that there is no performance penalty for loading a custom font, but if it’s important for your project that things look exactly the same in every browser then we recommend using a custom font. This is what we do for our own sites for example 👍

0reactions
frederikhorscommented, May 10, 2022

@thecrypticace I tried with Kubuntu too (that was the screen). Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add "Ubuntu Font Family" to my site using CSS?
This example code will make the Ubuntu font the default font for every text in your entire web page unless it is overriden...
Read more >
How do I install fonts? - Ask Ubuntu
Many fonts are packaged for Ubuntu and available via the "Fonts" category of the Ubuntu Software Center. If you prefer apt-get , search...
Read more >
Best practices for fonts - web.dev
This article discusses performance best practices for fonts. There are a variety of ways in which web fonts impact performance: Delayed text ......
Read more >
How To Load and Use Custom Fonts with CSS | DigitalOcean
A font family consists of all the weight and style variations of a given font. Families can include many additional weight and styles...
Read more >
Custom fonts - Expo Documentation
Learn about using custom fonts, supported font formats for each platform and ... trying to render a font format that a platform doesn't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found