aboutsummaryrefslogtreecommitdiffstats
path: root/clock/mkicons.sh
blob: 7825e80d04e0aedffb008463daec647dcf6d3102 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
# mkicons.sh - build the weather icon subset font for the KWGT clock
# Copyright (C) 2026 Danilo M. <danix@danix.xyz>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

# Build the weather icon font: Material Symbols Rounded (Apache-2.0), outline
# style at weight 400, cut down to the glyphs the preset's weather formula uses.
# Needs fontTools (build-time only).
#
# usage: mkicons.sh <MaterialSymbolsRounded[FILL,GRAD,opsz,wght].ttf> <out.ttf>
#
# Codepoints: sunny clear_night partly_cloudy_day partly_cloudy_night cloud
# foggy air rainy_light rainy thunderstorm weather_mix weather_snowy
# weather_hail tornado.
set -e
tmp=$(mktemp)
trap 'rm -f "$tmp"' EXIT
fonttools varLib.instancer "$1" FILL=0 GRAD=0 opsz=24 wght=400 -o "$tmp"
pyftsubset "$tmp" --output-file="$2" --layout-features='' --name-IDs='*' \
  --unicodes=e81a,f159,f172,f174,f15c,e818,efd8,f61e,f176,ebdb,f60b,e2cd,f67f,e199