For reasons I am sure I will never fathom, browsers on mobile provide all the same settings options, and religiously ignore them.
Nowadays, what I do (and recommend to others) is to set Firefox to never send a referer cross-origin, so google fonts and similar don't get to see what website I'm on. I've found that very few websites break with this.
While it's not svg or on the open web, I have a particular hate for sborn.jpeg in ebooks, as I read my ebooks in dark mode at night and having occasional section break symbols (ornaments) white on black is particularly irritating. Other unnecessary images often found in ebooks include bullets, chapter titles flourishes, letters with accents, and even the chapter title itself.
svg { fill: currentColor; }
.parent { color: var(--text-color); }
When you use dark-mode the color of the svg path should change with the text as long as the author changes --text-color in a dark-mode media query. @media (prefers-color-scheme: dark) {
--text-color: wheat;
}
I don’t know about the size, but I suspect that if any the difference is negligible. Most of my icons are a few hundred bytes uncompressed. And I usually put them in a sprite which is usually well under 50 KiB uncompressed. I don’t know how large font icon files are, but I suspect they are not that much smaller that it makes a difference.Subsetting is where SVG shines, though.
For icon fonts, you can much more easily subset SVG icons than a font file. Font file subsetting needs dedicated tools like font editors (with Icomoon being a common choice these days) and often manual maintenance/upkeep, whereas SVG tree shaking is a natural part of any web bundler (webpack, etc) and automatically adapts to your icon usage and tools in your web bundler such as bundle splitting/lazy loading.
The Fort Awesome JS libraries behind Font Awesome's SVG icon fonts reduce things further from SVG XML files to tree-shakeable ESM files [EcmaScript Modules] that include just a few pieces of metadata and the lone important path text (sticking to a single SVG path per icon), then build the SVG DOM at runtime (as VDOM in the case of the React library), including making sure it follows fill: currentColor to pick up the text color. Minified and tree-shaken by most web bundlers the ESM files are very competitive with any other font format and the convenience wins of automatic subsetting by web bundler are hard to match.
I've never used webpack or any other bundler on any personal website I've written, nor have I ever used react or other heavy frameworks (I used jQuery when I was in school). Perhaps these are useful on larger websites, but I prefer to avoid scripts in general, with the sole exception being scripts that parse a data source to generate a page client-side (most pages on my system are static, so I don't even have php or such installed). To me, automation means I make changes to the html on my server and reload the page.
You aren't going to get easier subsetting in a modern browser than a folder full of SVGs and the browser only pulling the URLs it needs as it needs them rather than an entire bloated icon font format all at once up front. No need to double check that Calibre has got the right font subset from your CSS or to open Calibre at all, just upload the folder of SVGs and let the browser "subset" it, in the classic ways of HTML going back to its origins. Even less "automation" than Calibre.
You can use @media (prefers-color-scheme: dark) { ... } in the style inside the .svg and browsers render it accordingly in dark/light mode. But yes, not being able to set the color from the page CSS is annoying.
<svg><use href="/path/to/sprite.svg#my-icon" /></svg>
Good SVG icons are a single <path> which can be colored in your CSS with svg { fill: currentColor; }
Then it will take which ever font color it inherits.Off course I usually wrap this in a component and only write <app-icon icon="my-icon"></app-icon>.
The best solution here is to use standard fonts that are available in all browsers, of course.
Privacy killed the shared cache.
I never quite understood the debate around fonts. You could use the CSS/Link import that Google provides, but that's never the optimal solution. Like you I always download the fonts and use them directly via @font-face.
The only advantage I see to using Google Fonts / some privacy respecting font service like this one, is when you are first prototyping an app and want to either test fonts, or want to move quickly and not worry about setting up fonts properly. We also used in a places like Storybook where having correctly set fonts is not as important.
But even if you did use it in prototyping, it's best practice to pull down those fonts and store them locally before going to production (at least in my mind).
Am I missing something?