News for hackers. Stuff that matters.
Re:A 14kb page can load much faster than a 15kb page by philliphaydon on Thursday August 25, 2022 @12:47AM (#32589605)
Omg just disabling custom fonts in Firefox speeds up the internet so much!
Re:A 14kb page can load much faster than a 15kb page by blep_ on Thursday August 25, 2022 @01:02AM (#32589712)
I wish I could do this without breaking all the obnoxious sites that use fonts for icons.

Someone should invent an HTML tag for putting images on a page.

Re:A 14kb page can load much faster than a 15kb page by cuu508 on Thursday August 25, 2022 @02:28AM (#32590294)
I'm using icon font to show a grid of icons, where each icon can be clicked to toggle it "on" or "off". Example: https://i.imgur.com/EHYHVDw.png

When I was implementing this, I initially experimented with the img tags – easy to implement, easy to have multi-color icons. But the grid can potentially have 100s of rows, potentially resulting in 1000+ of img tags. When testing with img tags, my site became noticeably sluggish (on a quick desktop PC). With icon fonts, the icon grid is basically lines of text, and the browser can render it with no noticeable performance impact.

Re:A 14kb page can load much faster than a 15kb page by 8n4vidtmkvmk on Thursday August 25, 2022 @02:53AM (#32590457)
i too use an icon font, but if you want images you should use a spritemap. it shouldn't be sluggish.
Re:A 14kb page can load much faster than a 15kb page by EGreg on Thursday August 25, 2022 @07:39AM (#32592337)
I write a framework, not an app. In any event, I need to allow others to style my icons with their own colors. Hence I use a font. Is there a way to use SVG sprites or something, while also letting people control the stroke color with css? Seems yes: dont put CSS in the svg. But why not just use a font?

https://stackoverflow.com/questions/37940282/changing-the-st...

Re:A 14kb page can load much faster than a 15kb page by 8n4vidtmkvmk on Thursday August 25, 2022 @09:22PM (#32602239)
Yes, you can even put `color: currentColor` in your SVG file and then color it exactly the same way as your fonts (it'll use the current text color).

Why not? I don't know, you're asking the wrong person, I use a CSS font too. My reasons are (a) last time I looked into putting SVGs into a sprite-map to avoid 1000 HTTP requests it was a shitshow (not well supported), and (b) Chrome and other browsers would sometimes align the SVG on a half-pixel causes the edges to be a little blurry, whereas fonts get special treatment to ensure they are crisp. That was years ago tho.

Re:A 14kb page can load much faster than a 15kb page by kroltan on Thursday August 25, 2022 @08:16AM (#32592669)
If you can create a customized font file that is tiny and only has the icons you actually use, sure.

But the "wrong tool for the job" point still stands, users with custom fonts disabled (for performance or accessibility reasons) will not be able to see your icons.

Re:A 14kb page can load much faster than a 15kb page by easrng on Thursday August 25, 2022 @09:45AM (#32593624)
SVG with <use> tags should work perfectly.
Re:A 14kb page can load much faster than a 15kb page by tastemykungfu on Thursday August 25, 2022 @01:06AM (#32589738)
A lot of icon frameworks are moving to SVG embedded on the page. Better usability - compared to the lazy fontawesomes out there.
Re:A 14kb page can load much faster than a 15kb page by manmal on Thursday August 25, 2022 @02:22AM (#32590251)
Fontawesome is also available as SVG.
Re:A 14kb page can load much faster than a 15kb page by philliphaydon on Thursday August 25, 2022 @02:37AM (#32590351)
I just accept some things break for icons, but hovering over usually shows what the button is.

The only annoying thing about turning off fonts is the weird settings ProtonMail and GitHub use.

https://prnt.sc/zoPQiiPKIeZy

Re:A 14kb page can load much faster than a 15kb page by hiyer on Thursday August 25, 2022 @02:16AM (#32590214)
Thanks for the tip! For others wondering how you can do this, go to Settings -> Fonts -> Advanced, and uncheck "Allow pages to choose their own fonts...".
Re:A 14kb page can load much faster than a 15kb page by xigoi on Thursday August 25, 2022 @07:21AM (#32592198)
Or use uBlock Origin, which will allow you to re-enable fonts if disabling them breaks a site.
Re:A 14kb page can load much faster than a 15kb page by markdog12 on Thursday August 25, 2022 @04:25PM (#32599522)
I wish you could do this with Brave (without uBlock Origin).
Re:A 14kb page can load much faster than a 15kb page by UI_at_80x24 on Thursday August 25, 2022 @10:52AM (#32594429)
After reading this fine tip, I did the same thing. Thank-you for the suggestion.

For others wondering how:

about:config

gfx.downloadable_fonts.enabled (set to to FALSE)

Re:A 14kb page can load much faster than a 15kb page by throwaway563 on Thursday August 25, 2022 @02:10AM (#32590175)
how do you disable fonts? Plugins?
Re:A 14kb page can load much faster than a 15kb page by philliphaydon on Thursday August 25, 2022 @02:38AM (#32590358)
Can check the comment from hiyer, that's all I did. Just be aware sites that use fonts for icons will look a bit weird.
Re:A 14kb page can load much faster than a 15kb page by soperj on Thursday August 25, 2022 @02:30AM (#32590308)
uBlock Origin has that option.
Re:A 14kb page can load much faster than a 15kb page by UI_at_80x24 on Thursday August 25, 2022 @10:54AM (#32594456)
about:config gfx.downloadable_fonts.enabled (set to false)