Skip to content

Commit

Permalink
patch-em-all: Fix missing licenses
Browse files Browse the repository at this point in the history
[why]
If the license file is not in the same folder as the font file or its
parent directory it will not be copied.

Example:

├── AUTHORS.txt
├── config.cfg
├── copyall.sh
├── Ligatures
│   ├── Bold
│   │   └── JetBrainsMono-Bold.ttf
│   ├── BoldItalic
│   │   └── JetBrainsMono-BoldItalic.ttf
├── OFL.txt
└── README.md

When processing one font file (.ttf) the OFL.txt is neither in the same
nor in the parent directory (but rather in the parent's parent.

[how]
Collect all license-ish files for a complete font set and copy them all
over each other into all appropriate destinations in patched-fonts.o

Note that in situations like this:

├── fonts.dir
├── fonts.scale
├── L
│   ├── Bold
│   │   └── Meslo LG L Bold for Powerline.ttf
│   ├── config.cfg
│   └── LICENSE.txt
├── LICENSE.txt
└── README.rst

All LICENSE.txt files will be copied, but only the last one will 'win'.
So make sure all license files are identical.

Fixes: #1068

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
  • Loading branch information
Finii committed Jan 24, 2023
1 parent 0075243 commit 8a749ab
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions bin/scripts/gotta-patch-em-all-font-patcher!.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ function show_help {
echo " Process all font files that are in directory \"iosevka\""
}

function find_font_root {
# e.g. /a/b/c/nerd-fonts/src/unpatched-fonts/Meslo
sed -E "s|(${unpatched_parent_dir}/[^/]*).*|\1|" <<< "$1"
}

while getopts ":chijtv-:" option; do
case "${option}" in
c)
Expand Down Expand Up @@ -335,15 +340,10 @@ function generate_info {
generate_readme "$patched_font_dir" 0
echo "$LINE_PREFIX * Copying license files"

if [ $is_unpatched_fonts_root == "0" ];
then
# if we are not at the unpatched fonts root, copy all license from config parent dir
copy_license "$config_parent_dir" "$patched_font_dir"
else
# otherwise we nedd to copy files from the config dir itself
copy_license "$config_dir" "$patched_font_dir"
fi

# Copy 'all' license files found in the complete font's source tree
# into the destination. This will overwrite all same-names files
# so make sure all licenses of one fontface are identical
copy_license "$(find_font_root $config_dir)" "$patched_font_dir"

last_parent_dir=$config_parent_dir
total_variation_count=$((total_variation_count+combination_count))
Expand Down

0 comments on commit 8a749ab

Please sign in to comment.