1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2025-01-06 21:49:40 +02:00
nerd-fonts/bin/scripts/archive-font-patcher.sh
Fini Jastrow 662a61440f font-patcher: Rename glyphs to our ID / Class name
[why]
The glyphnames in the font files are sometimes off. We take them from
the symbol source/font and ofter they are empty or even plain wrong (esp
if we move to other codepoints).

[how]
We have the list of all glyphnames that is generated by collecting all
data from the i_*.sh files. When patching we take this information now
and use it if appropriate.

Make sure the glyphname.json file is included in our zip patcher release
and also in the Docker image. It will run as before if the file can not
be found or is invalid etc.

Suggested-by: Ulices <hasecilu@tuta.io>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-11-13 16:51:19 +01:00

49 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Nerd Fonts Version: 3.2.1
# Script Version: 1.1.0
# Archives the font patcher script and the required source files
# If some (any) argument is given this is though of as intermediate version
# used for debugging
# set -x
# LINE_PREFIX="# [Nerd Fonts]"
scripts_root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/"
parent_dir="${PWD}/../../"
outputdir=$scripts_root_dir../../archives
mkdir -p "$outputdir"
# create a mini readme with basic info on Nerd Fonts project
touch "$outputdir/readme.md"
mini_readme="$outputdir/readme.md"
cat "$parent_dir/src/archive-font-patcher-readme.md" >> "$mini_readme"
if [ $# -ge 1 ]; then
echo "Intemediate version, adding git version"
echo -e "\n## Version\nThis archive is created from\n" >> "$mini_readme"
git log --pretty=medium --no-decorate --no-abbrev -n 1 HEAD | sed 's/^/ /' >> "$mini_readme"
fi
# clear out the directory zips
find "${outputdir:?}" -name "FontPatcher.zip" -type f -delete
cd -- "$scripts_root_dir/../../" || exit 1
find "src/glyphs" | zip -9 "$outputdir/FontPatcher" -@
find "bin/scripts/name_parser" -name "Fontname*.py" | zip -9 "$outputdir/FontPatcher" -@
find "glyphnames.json" | zip -9 "$outputdir/FontPatcher" -@
find "font-patcher" | zip -9 "$outputdir/FontPatcher" -@
# add mini readme file
zip -9 "$outputdir/FontPatcher" -rj "$mini_readme" -q
rm -f "$mini_readme"
# @TODO check zip status
# zipStatus=$?
# if [ "$zipStatus" != "0" ]
# then
# echo "$LINE_PREFIX error, font-patcher archive not created"
# exit 1
# else
# echo "$LINE_PREFIX font-patcher archive created successfully"
# fi;