3 ms·
Now I got curious, and there's also a 400 kB CSS file to go with it: https://purplesyringa.moe/fonts/webfont.css https://purplesyringa.moe/fonts/webfont.css I'
by lxgr 2y ago
Now I got curious, and there's also a 400 kB CSS file to go with it: https://purplesyringa.moe/fonts/webfont.css https://purplesyringa.moe/fonts/webfont.css
I'm not up to date on web/font development – does anybody know what that does?
- bobbylarrybobby 2y agoIt 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.
- lxgr 2y agoThat 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?
- lobsterthief 2y agoYep 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”.
- lifthrasiir 2y agoI think at least some recent tools will produce ligatures to turn a plain text into an icon to avoid this issue.
- alpaca128 2y agoAnother detail is that this feature breaks and makes some sites nearly unusable if the browser is set to ignore a website's custom fonts.
- yencabulator 2y agoMore 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.
- deleted 2y ago[deleted]