3 ms·
Although I agree with the conclusion entirely, a surprisingly large fraction of this article is unsound, incorrect or misleading. Here are most of my complaints
by chrismorgan 6y ago
Although I agree with the conclusion entirely, a surprisingly large fraction of this article is unsound, incorrect or misleading. Here are most of my complaints:
> Cannot provide metadata
That was never the responsibility of the icon font, it was the responsibility of the thing placing the icon. You can still put ARIA attributes on the element that says “put the icon here”. (And if it’s just an extra class on an existing independently-meaningful element that says “put an icon before it”, then that icon is decorative and shouldn’t be exposed in the accessibility tree anyway.) Also ::before and ::after are not the only way of doing an icon font; you can style normal text nodes if you want to—it’s just not the most common way of doing it.
> Size and Maintainability
This is somewhere between unfair and incorrect. Most or all alternatives will experience the same or similar issues. (This is a common theme—each technology has its own advantages and disadvantages, and the author is pointing out the disadvantages of one that don’t affect another, without considering the tradeoffs made and the similar disadvantages in that other.)
> Degraded Visual Quality
This is nonsense. Size your glyphs correctly and you’ll have no trouble. (Though I will admit user stylesheets can mess with this, but you should expect that they’d be messing with all alternatives in much the same way as well, so I deem the quibble invalid.)
> Difficult to Style/Position
The monochromacy can’t be overcome, but icon fonts aren’t difficult to position, you just need to exercise a modicum of caution. Other techniques require just as much caution, just in different places; e.g. I’m fed up with inline <svg> elements lacking width and height attributes so that they end up filling the viewport when the stylesheets fail to load, rather than being 16×16 or whatever.
> SVGs are straight up vector images. Anti-aliasing methods employed by your browser or operating system have no effect and your icons will be noticeably sharper.
I… what!? I’m going to say it straight, this guy doesn’t understand what he’s talking about.
> Additionally, SVGs are simply the size they are.
This is drivel. They may have an inherent size, but they’re the size the document tells them to be—just like text is the size the document tells it to be. I’d actually say my experience with SVG icon sizing is substantially worse than my experience with icon font sizing, to do with the missing width and height attributes mentioned above, when rendered sans CSS.
- lukevp 6y ago>> SVGs are straight up vector images. Anti-aliasing methods employed by your browser or operating system have no effect and your icons will be noticeably sharper. > I… what!? I’m going to say it straight, this guy doesn’t understand what he’s talking about. Perhaps I am misunderstanding too, but I think what GP is saying is that icon fonts render through the font engine and are subject to sub pixel rendering (such as Microsoft ClearType) where an SVG is not. Sub pixel realignment is meant to make text more readable and not to make images more accurate, so I can imagine an SVG would render with less artifacting. What do you think?
- chrismorgan 6y agoAt the very least, the author is conflating subpixel rendering and antialiasing in a way that shows a lack of understanding. Subpixel rendering may have been part of the topic of the “degraded visual quality”, but that’s easily disabled if desired. (Whether you should disable it or not is another question.) And it still sounds like he’s talking about antialiasing rather than subpixel rendering. Actually, this is now making me think of macOS’s glyph dilation. I suppose icon fonts will be degraded on most macOS devices (unless the user has turned off the misnamed “font smoothing” setting). Then in this section you’re citing, well, SVG is certainly subject to antialiasing; no sharpness arguments will be won here. Subpixel rendering probably won’t apply (and I say only probably—the browser is at liberty to do subpixel rendering on everything if it wants to, and people have toyed with doing subpixel rendering of more vector graphics than just fonts—in fact, in theory you have less control of this rendering than you do of text, as there’s no CSS property for it, unlike with text), but subpixel rendering is all about making things sharper anyway, so again SVG “loses”, if anything. Remember also that icon fonts are more or less constrained to monochromacy, and that’s where subpixel rendering excels, at increasing the effective resolution in one axis.