standardize: Use fonts.json as RFN info source

[why]
When creating the readmes the config.cfg are checked for details on a
possible RFN renaming. There are specific variables that need to be
filled in these cases: config_rfn and config_rfn_substitue.

The same RFN information is already stored in the fonts.json database.
Having the information stored in two locations is always problematic and
can easily lead to inconsistencies.

[how]
Remove information from config.cfg file and use data stored in
fonts.json instead.

Drop config.cfg files that are empty afterwards.

Also fix some patchedName in fonts.json en passant.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2023-04-25 11:51:26 +02:00
parent 4be86d4d60
commit 850b8b422f
12 changed files with 17 additions and 30 deletions

View file

@ -23,7 +23,7 @@
{ {
"unpatchedName": "Anonymous Pro", "unpatchedName": "Anonymous Pro",
"RFN": true, "RFN": true,
"patchedName": "Anonymice", "patchedName": "AnonymicePro",
"folderName": "AnonymousPro", "folderName": "AnonymousPro",
"imagePreviewFont": "Anonymice Nerd Font", "imagePreviewFont": "Anonymice Nerd Font",
"linkPreviewFont": false, "linkPreviewFont": false,
@ -73,7 +73,7 @@
{ {
"unpatchedName": "Cascadia Code", "unpatchedName": "Cascadia Code",
"RFN": true, "RFN": true,
"patchedName": "Caskaydia Cove", "patchedName": "CaskaydiaCove",
"folderName": "CascadiaCode", "folderName": "CascadiaCode",
"imagePreviewFont": "Caskaydia Cove Nerd Font", "imagePreviewFont": "Caskaydia Cove Nerd Font",
"linkPreviewFont": "cascadia-code", "linkPreviewFont": "cascadia-code",
@ -83,7 +83,7 @@
{ {
"unpatchedName": "IBM Plex Mono", "unpatchedName": "IBM Plex Mono",
"RFN": true, "RFN": true,
"patchedName": "Blex Mono", "patchedName": "BlexMono",
"folderName": "IBMPlexMono", "folderName": "IBMPlexMono",
"imagePreviewFont": "BlexMono Nerd Font", "imagePreviewFont": "BlexMono Nerd Font",
"linkPreviewFont": false, "linkPreviewFont": false,
@ -173,7 +173,7 @@
{ {
"unpatchedName": "Go Mono", "unpatchedName": "Go Mono",
"RFN": false, "RFN": false,
"patchedName": "Go-Mono", "patchedName": "GoMono",
"folderName": "Go-Mono", "folderName": "Go-Mono",
"imagePreviewFont": "GoMono Nerd Font", "imagePreviewFont": "GoMono Nerd Font",
"linkPreviewFont": "go-mono", "linkPreviewFont": "go-mono",
@ -233,7 +233,7 @@
{ {
"unpatchedName": "iA Writer", "unpatchedName": "iA Writer",
"RFN": true, "RFN": true,
"patchedName": "iM Writing", "patchedName": "iMWriting",
"folderName": "iA-Writer", "folderName": "iA-Writer",
"imagePreviewFont": "iMWritingMonoS Nerd Font", "imagePreviewFont": "iMWritingMonoS Nerd Font",
"linkPreviewFont": "ia-writer-mono", "linkPreviewFont": "ia-writer-mono",
@ -311,7 +311,7 @@
"description": "Very light and thin characters, sharp m's, `0` and `O` very similar" "description": "Very light and thin characters, sharp m's, `0` and `O` very similar"
}, },
{ {
"unpatchedName": "Liberation", "unpatchedName": "Liberation Mono",
"RFN": true, "RFN": true,
"patchedName": "LiterationMono", "patchedName": "LiterationMono",
"folderName": "LiberationMono", "folderName": "LiberationMono",

View file

@ -9,6 +9,7 @@ infofilename="font-info.md"
unpatched_parent_dir="src/unpatched-fonts" unpatched_parent_dir="src/unpatched-fonts"
patched_parent_dir="patched-fonts" patched_parent_dir="patched-fonts"
LINE_PREFIX="# [Nerd Fonts] " LINE_PREFIX="# [Nerd Fonts] "
fonts_info="../../bin/scripts/lib/fonts.json"
cd ../../src/unpatched-fonts/ || { cd ../../src/unpatched-fonts/ || {
echo >&2 "$LINE_PREFIX Could not find source fonts directory" echo >&2 "$LINE_PREFIX Could not find source fonts directory"
@ -68,14 +69,20 @@ do
then then
searchdir=$dirname searchdir=$dirname
else else
# source the font config file if exists:
# reset the variables # reset the variables
unset config_rfn unset config_rfn
unset config_rfn_substitue unset config_rfn_substitue
if [ -f "$searchdir/config.cfg" ] fontdata=$(cat ${fonts_info} | jq ".fonts[] | select(.folderName == \"${base_directory}\")")
if [ "$(echo $fontdata | jq .RFN)" = "true" ]
then then
# shellcheck source=/dev/null config_rfn=$(echo $fontdata | jq -r .unpatchedName)
source "$searchdir/config.cfg" config_rfn_substitue=$(echo $fontdata | jq -r .patchedName)
if [ "${config_rfn}" = "${config_rfn_substitue}" ]
then
# Only the case with Mononoki which is RFN but we do not rename (we got the permission to keep the name)
unset config_rfn
unset config_rfn_substitue
fi
fi fi
fi fi

View file

@ -1,2 +0,0 @@
config_rfn="Anonymous Pro"
config_rfn_substitue="Anonymice Pro"

View file

@ -1,3 +1 @@
config_rfn="Cascadia Code"
config_rfn_substitue="Caskaydia Cove"
config_patch_flags="--makegroups 4" config_patch_flags="--makegroups 4"

View file

@ -1,4 +1,2 @@
config_has_powerline=1 config_has_powerline=1
config_rfn=Hasklig
config_rfn_substitue=Hasklug
config_patch_flags="--makegroups 2" config_patch_flags="--makegroups 2"

View file

@ -1,3 +1 @@
config_has_powerline=1 config_has_powerline=1
config_rfn=Hermit
config_rfn_substitue=Hurmit

View file

@ -1,3 +1 @@
#config_has_powerline=1 #config_has_powerline=1
config_rfn="IBM Plex"
config_rfn_substitue=Blex

View file

@ -1,2 +0,0 @@
config_rfn=Liberation
config_rfn_substitue=Literation

View file

@ -1,2 +0,0 @@
config_rfn=Share
config_rfn_substitue=Shure

View file

@ -1,4 +1,2 @@
config_has_powerline=1 config_has_powerline=1
config_rfn=Source
config_rfn_substitue=Sauce
config_patch_flags="--makegroups 4" config_patch_flags="--makegroups 4"

View file

@ -1,2 +0,0 @@
config_rfn=Terminus
config_rfn_substitue=Terminess

View file

@ -1,2 +0,0 @@
config_rfn="iA Writer"
config_rfn_substitue="iM Writing"