News for hackers. Stuff that matters.
Re:WebP: The WebPage Compression Format by edflsafoiewq on Saturday September 07, 2024 @03:29PM (#41475879)
Well, that, and there's an 850K Symbols-2048-em%20Nerd%20Font%20Complete.woff2 file that sort of drowns out the difference, at least if it's not in cache.
Re:WebP: The WebPage Compression Format by lxgr on Saturday September 07, 2024 @05:12PM (#41476495)
Now I got curious, and there's also a 400 kB CSS file to go with it: https://purplesyringa.moe/fonts/webfont.css

I'm not up to date on web/font development – does anybody know what that does?

Re:WebP: The WebPage Compression Format by bobbylarrybobby on Saturday September 07, 2024 @05:24PM (#41476572)
It adds unicode characters before elements with the given class. Then it's up to the font to display those Unicode characters — in this case, based on the class names, one can infer that the font assigns an icon to each character used.
Re:WebP: The WebPage Compression Format by lxgr on Saturday September 07, 2024 @05:31PM (#41476606)
That makes sense, thank you!

So the purpose is effectively to have human-readable CSS class names to refer to given glyphs in the font, rather than having stray private use Unicode characters in the HTML?

Re:WebP: The WebPage Compression Format by lobsterthief on Saturday September 07, 2024 @05:41PM (#41476646)
Yep

This is a reasonable approach if you have a large number of icons across large parts of the site, but you should always compile the CSS/icon set down to only those used.

If only a few icons, and the icons are small, then inlining the SVG is a better option. But if you have too many SVGs directly embedded on the site, the page size itself will suffer.

As always with website optimization, whether something is a good option always “depends”.

Re:WebP: The WebPage Compression Format by lifthrasiir on Sunday September 08, 2024 @12:02AM (#41478127)
I think at least some recent tools will produce ligatures to turn a plain text into an icon to avoid this issue.
Re:WebP: The WebPage Compression Format by alpaca128 on Sunday September 08, 2024 @08:12AM (#41479944)
Another detail is that this feature breaks and makes some sites nearly unusable if the browser is set to ignore a website's custom fonts.
Re:WebP: The WebPage Compression Format by yencabulator on Sunday September 08, 2024 @10:46AM (#41480713)
More reasonable than this class+CSS would be e.g. a React/static-website-template/etc custom element that outputs the correct glyph. The output doesn't need to contain this indirection, and all of the possibilities.
Re:WebP: The WebPage Compression Format by marcellus23 on Saturday September 07, 2024 @05:28PM (#41476594)
Wow, yeah. That kind of discredits the blog author a bit.
Re:WebP: The WebPage Compression Format by edflsafoiewq on Saturday September 07, 2024 @05:38PM (#41476635)
I mean, it's all just for fun of course.
Re:WebP: The WebPage Compression Format by purplesyringa on Sunday September 08, 2024 @04:10AM (#41478951)
It's cached. Not ideal, sure, and I'll get rid of that bloat someday, but that file is not mission-critical and the cost is amortized between visits. I admit my fault though.
Re:WebP: The WebPage Compression Format by marcellus23 on Sunday September 08, 2024 @11:24AM (#41480935)
Definitely fair and I was a bit harsh. It just seemed a bit nonsensical to go through such efforts to get rid of a few kilobytes while serving a massive font file. But I also understand that it's mostly for fun :)
Re:WebP: The WebPage Compression Format by Modified3019 on Sunday September 08, 2024 @09:53PM (#41484844)
As usual, the quickest way to optimize a webpage is to show HN how you tried to do so lol

Definitely a fascinating post though, there were things I’ve not encountered before.

Re:WebP: The WebPage Compression Format by account42 on Monday September 09, 2024 @05:21AM (#41486760)
> It's cached.

For who? Not for 99.9% of the people clicking the link here on HN. Even regular visitors of a blog will likely no longer have things in cache for their next visit.

Re:WebP: The WebPage Compression Format by est on Saturday September 07, 2024 @11:23PM (#41477978)
seriously, why can't modern browsers turn off features like remote fonts, webrtc, etc. in settings. I hate when reading a bit then the font changes. Not to say fingerprinting risks.
Re:WebP: The WebPage Compression Format by BugsJustFindMe on Sunday September 08, 2024 @12:54AM (#41478286)
You can, and then when someone uses an icon font instead of graphics their page breaks.
Re:WebP: The WebPage Compression Format by Dalewyn on Sunday September 08, 2024 @01:19AM (#41478348)
Skill issue.

Pictures are pictures, text is text. <img> tag exists for a reason.

Re:WebP: The WebPage Compression Format by lenkite on Sunday September 08, 2024 @04:09AM (#41478948)
Its a convenience packaging issue. An icon font is simply more convenient to handle. <img> tags for a hundred images requires more work.

Icon fonts are used all over the place - look at the terminal nowadays. Most TUI's require an icon font to be installed.

Re:WebP: The WebPage Compression Format by Dalewyn on Sunday September 08, 2024 @01:47PM (#41481849)
><img> tags for a hundred images requires more work.

So it's a skill issue.

Re:WebP: The WebPage Compression Format by est on Sunday September 08, 2024 @07:40AM (#41479811)
I believe many Web APIs can be enabled/disabled on a website basis, no?
Re:WebP: The WebPage Compression Format by collinmanderson on Sunday September 08, 2024 @09:01AM (#41480153)
iPhone lock down mode turns off remote fonts (including breaking font icons as sibling says)
Re:WebP: The WebPage Compression Format by Aloisius on Sunday September 08, 2024 @07:43PM (#41484240)
Even the gzipped page itself could be shrunk by 40-50% by optimizing the inline SVGs.

Just removing the inline duplicated SVGs used for light/dark mode and using styles instead would bring it down 30%. Replacing the paths used to write text (!) with <text> and making most of the overly complicated paths into simple rect patterns would take care of the rest.