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.

modernise and refactor font fallbacks

See original GitHub issue

There is currently some inconsistency in our font fallbacks.

kz-typography-xxxx mixins have "#{$kz-typography-xxx}, Helvetica, Arial, sans-serif", but ca-type-inter (although this is a legacy var) doesn’t have any.

It feels like we could standardise and have tokens for font fallbacks.Helvetica, Arial, sans-serif seems outdated. The Apple system font is now “SF Pro” (I believe), so Apple products will default to Helvetica which could look quite ugly in 2020 depending on how sensitive you are to typography 😆 . I think the current best practise is to just use "Font Name", sans-serif. In the past I think you need to add Arial and Helvetica because some browsers would default to a serif font even if you specified sans-serif.

I think there should be a design token for fallback fonts, but I don’t think there just just be one. Perhaps it should be heading style dependent. Maybe even it should be baked into every design token… wait… it is! (https://github.com/cultureamp/kaizen-design-system/blob/master/packages/design-tokens/tokens/typography.json#L5). I think that was added later. Still, my point on Helvetica stands!

Maybe we could get fancy and find the closest Apple system font to Greycliff for example (Avenir perhaps?), and then whatever the closest Microsoft font is (?) These are just some quick thoughts - I think this could do with some research.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ActuallyACatcommented, Oct 23, 2020

Just adding historical context / conversations to this issue.

This has been discussed as the fallback in the internal DST chats and a few other places.


We need the intended font family (Inter/Greycliff), Noto Sans as our fallback for any non-Latin characters e.g. CJK languages, then any installed or system fonts that would look sensible if the fonts are blocked or don’t load for some reason. As a first cut:

"Greycliff", "Noto Sans", Helvetica, Arial, sans-serif;
"Inter", "Noto Sans", Helvetica, Arial, sans-serif;

Since it’s relevant to this discussion, here’s the Noto Sans exploration that @katsambarcus looked into: Noto Sans Exploration


There’s also this PR here that adds those fallbacks to our design tokens: https://github.com/cultureamp/kaizen-design-system/pull/558/files

This has yet to propogate through the whole system though, and as you have seen we still have plenty of variables kicking about with insufficient fallbacks.

0reactions
github-actions[bot]commented, Nov 4, 2021

This issue was closed due to 2 months of inactivity. Feel free to reopen it if still relevant.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fallback Font Stacks for More Robust Web Typography
The whole idea here is fallbacks. The browser will try to use the font you specified first (Lato, in this case), but if...
Read more >
danielroe/fontaine: Automatic font fallback based ...
Features · 💪 Reduces CLS by using local font fallbacks with crafted font metrics. · ✨ Generates font metrics and overrides automatically. ·...
Read more >
CSS Font Fallbacks
Below are some commonly used font fallbacks, organized by the 5 generic font families: Serif; Sans-serif; Monospace; Cursive; Fantasy ...
Read more >
Refactoring CSS: Strategy, Regression Testing And ...
In this article, we'll take a deep dive into the refactoring process itself, and cover incremental refactoring strategy, visual regression ...
Read more >
Font Asset and Editor | Unreal Engine 4.27 Documentation
Fonts in a Sub-Font Family are preferably chosen by name match, as in the case of Regular, Bold, and Light, however they can...
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