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.

@font-face support

See original GitHub issue

First off, thanks for this great extension!

I’d find it to be super useful to have support for toggling @font-face rules to test fallback fonts in the order of variable fonts → web fonts → system fonts.

Cheers

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
keithclarkcommented, Jan 23, 2019

After digging deeper into this and talking to others it looks like css-tricks is using JavaScript to load the fonts using the Font Loading API, which is why they continue to render despite removing all font related CSS rules.

It looks like the workaround for this is to use document.fonts.clear(), which should clear out everything. Working out when to call that method is the next piece in the puzzle.

This looks like an edge case so, in the short term, I’m tempted to create a PR based on https://github.com/keithclark/css-feature-toggle-devtools-extension/issues/6#issuecomment-454378761 so @font-face toggling is possible in the majority of cases.

1reaction
keithclarkcommented, Jan 16, 2019

I’ve done investigation work…

The extension is behaving as it should. When disabling @font-face support, the style element that sets the font name in CSS Tricks looks like this (note the -disabled- prefix on the @font-face declaration):

screen shot 2019-01-16 at 00 03 35

… and when you re-enable support, the same block looks like this:

screen shot 2019-01-16 at 00 03 19

If you use the Elements tab to rename that font to Rubik2, Chrome will continue to use the old name and the new one. Therefore, anything using font-family: Rubik will still be rendered with a custom font, which I believe is a bug.

Also, if you remove that entire <style> block, the font is still applied. Again, I think that’s a bug.

My hunch is this is caused by <link rel="preload"> but more investigation is required:

<link rel="preload" href="https://css-tricks.com/wp-content/themes/CSS-Tricks-17/fonts/Rubik-Bold-kern-latin.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="https://css-tricks.com/wp-content/themes/CSS-Tricks-17/fonts/Rubik-Regular-kern-latin.woff2" as="font" type="font/woff2" crossorigin>
Read more comments on GitHub >

github_iconTop Results From Across the Web

font-face - CSS: Cascading Style Sheets - MDN Web Docs
Chrome Edge @font‑face Full support. Chrome1. Toggle history Full support... OpenType CBDT and CBLC rendering Full support. Chrome66. Toggle history Full support... OpenType COLRv0 rendering Full...
Read more >
@font-face Web fonts | Can I use... Support tables for HTML5 ...
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web ... @font-face Web fonts....
Read more >
How to use @font-face in CSS
The @font-face rule allows custom fonts to be loaded on a webpage. ... This browser support data is from Caniuse, which has more...
Read more >
CSS @font-face Rule - W3Schools
The @font-face rule is supported in Edge, Chrome, Firefox, Safari, and Opera. The numbers in the table specifies the first browser version that...
Read more >
How To Define Custom Fonts in CSS with @font-face and font ...
The font-display property will also help us manage how we load fonts for various users. Now unzip the downloaded contents to our ./fonts...
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