From 403ae5fa1e01874b9a5abad25cdbafa81e10b85a Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 10 Jul 2023 11:14:26 +0300 Subject: (font) Added a FontForge script to generate my font and added font to styles Icons on website will be Unicode characters. They will be the same as before, aka tabler icons, but rather than including the thousands that come with it, I'm including only the ones I need, thanks to FontForge. --- FontForge-helper.ff | 35 +++++++++++++++++++++++++++++++++++ src/font/tabler-icons-subset.ttf | Bin 0 -> 6596 bytes src/styles.css | 12 ++++++++---- 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100755 FontForge-helper.ff create mode 100644 src/font/tabler-icons-subset.ttf diff --git a/FontForge-helper.ff b/FontForge-helper.ff new file mode 100755 index 0000000..d32a868 --- /dev/null +++ b/FontForge-helper.ff @@ -0,0 +1,35 @@ +#!/usr/bin/fontforge +# Updates ./src/font/tabler-icons-subset.ttf font file +# Requires one argument - filepath to complete tabler-icons.ttf file +# Must be ran from the root of the repository (i.e. from the location of the script) + +# Icons on my website are just characters inside a special font. +# That font is a subset of the "Tabler Icons" font, version 2.10.0, containing only the glyphs I use +# https://github.com/tabler/tabler-icons +# The way I do it is oystersauce's idea +# https://stackoverflow.com/a/35754448/12036073 +# Basically I select the icons I want, invert selection, then detach and remove +# all other icons. +# This is a FontForge script which automates the whole process. + +Open($1) + + Select("uea19") # arrow-left +SelectMore("uea1c") # arrow-right +SelectMore("uf1e2") # article +SelectMore("uea66") # chevrons-up +SelectMore("ueaa2") # file-text +SelectMore("ued4e") # file-zip +SelectMore("ueaaa") # folder-minus +SelectMore("ueaab") # folder-plus +SelectMore("ueaad") # folder +SelectMore("ueade") # link +SelectMore("ueade") # markdown +SelectMore("ueafa") # movie +SelectMore("ueb0a") # photo +SelectMore("ueb70") # presentation +SelectMore("ueb0e") # printer + +SelectInvert() +DetachAndRemoveGlyphs() +Generate("./src/font/tabler-icons-subset.ttf") diff --git a/src/font/tabler-icons-subset.ttf b/src/font/tabler-icons-subset.ttf new file mode 100644 index 0000000..1f9865c Binary files /dev/null and b/src/font/tabler-icons-subset.ttf differ diff --git a/src/styles.css b/src/styles.css index d9e9ac8..531cad5 100644 --- a/src/styles.css +++ b/src/styles.css @@ -109,14 +109,19 @@ /* Global */ +@font-face { + font-family: 'Tabler'; + src: url('/font/tabler-icons-subset.ttf') format('truetype'); +} + body { background-color: var(--body-bg); border-color: var(--border-color); color: var(--fg-color); min-height: calc(100vh - 16px); } - nav, article { background-color: var(--bg-color); } - body, td, th { font: 18px sans-serif; } + nav, article { background-color: var(--bg-color); } + body, td, th { font-size: 18px; font-family: 'Tabler', sans-serif; } * { line-height: 1.3em; } img { @@ -311,7 +316,6 @@ dt, dd { #sidebar > :not(:first-child) { margin-top: 1.5rem; } #sidebar a { border: none; } - #header, #footer { font-family: Arial; } #header { border-right: none; font-size: 1.5em; @@ -333,7 +337,7 @@ dt, dd { display: inline-block; line-height: 1em; border: 1px solid var(--border-color); - padding: 0.2em 0.3em; + padding: 0.2em 0.3em 0.4em; /* Thanks https://stackoverflow.com/a/4407335/12036073 */ -webkit-touch-callout: none; /* iOS Safari */ -webkit-user-select: none; /* Safari */ -- cgit v1.3.1-26-gb76a