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.

Support for font-display

See original GitHub issue

Google Fonts is adding support for font-display. It would be great to add support to Typography.js.

More info: https://www.zachleat.com/web/google-fonts-display/

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:15
  • Comments:16

github_iconTop GitHub Comments

9reactions
dakeblcommented, May 21, 2019

Hello, I’ve added fontDisplay as a valid option for the config object in this PR: #212

For example:

{
  fontDisplay: 'swap',
  googleFonts: [
    {
      name: "Noto Sans JP",
      styles: ["300", "400", "500", "700"]
    },
    {
      name: "Roboto Condensed",
      styles: ["700"]
    }
  ]
}

Which would generate a url of: http://fonts.googleapis.com/css?family=Noto+Sans+JP:300,400,500,700|Roboto+Condensed:700&display=swap

9reactions
gbreuxcommented, May 20, 2019

Agreed 😃

Although you can already achieve that in an ugly way by setting the &display=swap query param at the last item of the styles array of the googleFonts props.

googleFonts: [
    {
      name: "Noto Sans JP",
      styles: ["300", "400", "500", "700"]
    },
    {
      name: "Roboto Condensed",
      styles: ["700&display=swap"]
    }
  ]

will be rendered as: http://fonts.googleapis.com/css?family=Noto+Sans+JP:300,400,500,700|Roboto+Condensed:700&display=swap

Read more comments on GitHub >

github_iconTop Results From Across the Web

"font-display" | Can I use... Support tables for HTML5, CSS3, etc
CSS font-display. - WD. @font-face descriptor font-display that allows control over how a downloadable font renders before it is fully loaded. Usage %...
Read more >
font-display - CSS: Cascading Style Sheets - MDN Web Docs
The font-display descriptor determines how a font face is displayed based on whether and when it is downloaded and ready to use.
Read more >
font-display | CSS-Tricks
The font-display property defines how font files are loaded and displayed by the browser. It is applied to the @font-face rule which defines ......
Read more >
Controlling Font Performance with font-display
Deciding the behavior for a web font as it is loading can be an important performance tuning technique. The new font-display descriptor for ......
Read more >
A New Way To Reduce Font Loading Impact: CSS Font ...
Web fonts are often terrible for web performance and none of the font loading strategies are particularly effective to address that.
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