From 9d2f853261ec886d14705e3121ed266c02fdb320 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 19 Jul 2023 19:22:26 +0300 Subject: [blog/iconfonts] Added completed blogpost --- src/blog.md | 3 + .../index.md | 112 +++++++++++++++++++++ src/blog/index.md | 3 + 3 files changed, 118 insertions(+) create mode 100644 src/blog/icon-fonts-arent-evil-you-just-have-to-care/index.md (limited to 'src') diff --git a/src/blog.md b/src/blog.md index dab17b6..1065fee 100644 --- a/src/blog.md +++ b/src/blog.md @@ -4,6 +4,9 @@ Articles detailing personal experiences or exploration of certain topics.
+&&gb 19 July   [Icon fonts aren't evil, you just have to care](/blog/icon-fonts-arent-evil-you-just-have-to-care) +: `Shallow dive` | `Web development` | `Icon font` `SVG` `Accessibility` `FontForge` + &&bg 14 July   [ФМИ и висшето образование в програмистката индустрия](/blog/fmi-i-vissheto-obrazovanie-v-programistkata-industriq) : `Deep dive` | `University` | `FMI` `Education` diff --git a/src/blog/icon-fonts-arent-evil-you-just-have-to-care/index.md b/src/blog/icon-fonts-arent-evil-you-just-have-to-care/index.md new file mode 100644 index 0000000..fe6c84d --- /dev/null +++ b/src/blog/icon-fonts-arent-evil-you-just-have-to-care/index.md @@ -0,0 +1,112 @@ +# Icon fonts aren't evil, you just have to care + +## Contents + +1. [The problem with SVGs](#the-problem-with-svgs) +2. [Icon fonts](#icon-fonts) + 1. [Text antialiasing: unavoidable](#text-antialiasing-unavoidable) + 2. [Better control over SVGs: not always needed](#better-control-over-svgs-not-always-needed) + 3. [Fetching failures and accessible fonts: fixable with care](#fetching-failures-and-accessible-fonts-fixable-with-care) + 4. [Screen reader accessibility: almost unavoidable](#screen-reader-accessibility-almost-unavoidable) + 5. [File size: fixable with care](#file-size-fixable-with-care) + +Recently I did a [whole bunch of changes to the way this website works](https://gitlab.com/Syndamia/syndamiadotcom/-/merge_requests/10) and one of them included replacing all SVG icons with an icon font. +While doing research, I found [Seren Davies' talk](https://www.youtube.com/watch?v=9xXBYcWgCHA) as well as [many](https://www.irigoyen.dev/blog/2021/02/17/stop-using-icon-fonts/) [other](http://technotes.iangreenleaf.com/posts/font-awesome-not-awesome.html) [posts](https://www.ianfeather.co.uk/ten-reasons-we-switched-from-an-icon-font-to-svg/) being against them. +A lot of these concerns and issues are valid and multiple times I stopped that rework, but in the end I believe, with enough care, you could make them work almost perfectly. + +## The problem with SVGs + +First, we have to get acquaintanced with why I wanted change: before the big rework, this website used SVG images for all icons. +For [quite a while](https://gitlab.com/Syndamia/syndamiadotcom/-/releases/v3.0) I've added support for an alternative light theme, but ever since the beginning icons have been an issue. + +How can you change the color, or more specifically, the internal styling of an SVG? +You have a [couple of options](https://stackoverflow.com/questions/22252472/how-can-i-change-the-color-of-an-svg-element), if you include it with a normal `` tag, as I was doing, you could do some [magic with filters](https://stackoverflow.com/a/53336754) to change the exact color, though this is kinda difficult and [browsers support filters since somewhat recently](https://caniuse.com/css-filters). +This is a deal-breaker, because I care about older browsers and without that CSS property, icons become very difficult to see on the light theme. + +Another option is to load it with an ``, `` or `