nerd-fonts/.github/workflows/packsvgs.yml
Fini Jastrow 73ae4a96b4 CI: Optimize original glyph svgs
[why]
Often the SVGs are rather detailed and result in a big
original-source.otf, which then again results in bigger than needed
patched fonts.

[how]
Typically people suggest using svgo to make SVGs smaller, but that just
tackles the representation of the icon, i.e. the actual svg file. That
does not help us at all. We do not need small svg files, we need simple
icons with few points and lines. svgo does not have that capability.

Instead Inkscape's 'Simplify' is used. Repeated use can destroy a glyph,
so we need a scale down margin to stop 'over-simplification'.

The values given for the margin at the moment are purely empirical, the
current glyphs survive repeated use of the new simplification script and
still look good.

The resultant original-source.otf file size is approximately similar to
the previously achieved by Ryan's manual work.

[note]
We need a newer Inkscape, thus update to Ubuntu 22.04

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-19 16:08:22 +02:00

48 lines
1.4 KiB
YAML

name: PackSVGs
on:
push:
paths:
- 'src/svgs/*'
- 'bin/scripts/generate-original-source.py'
workflow_dispatch:
jobs:
create-symbols-font:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Fetch dependencies
run: |
sudo apt update -y -q
sudo apt install python3-fontforge inkscape dc -y -q
- name: Simplify the SVGs
run: |
cd bin/scripts
./optimize-original-source.sh doit
- name: Commit simplified SVGs back to repo
uses: EndBug/add-and-commit@v9
with:
fetch: false
add: 'src/svgs'
message: "[ci] Simplify original-source source glyphs"
committer_name: GitHub Actions
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
- name: Create Seti and original symbols font
run: |
cd bin/scripts
ls -l ../../src/glyphs/original-source.otf
./generate-original-source.py
ls -l ../../src/glyphs/original-source.otf
- name: Commit patched fonts back to repo
uses: EndBug/add-and-commit@v9
with:
fetch: false
add: 'src/glyphs/original-source.otf'
message: "[ci] Rebuild original-source font"
committer_name: GitHub Actions
committer_email: 41898282+github-actions[bot]@users.noreply.github.com