casks: Add unpatched fontname in cask description

[why]
People might want to know how the original/unpatched font really is
called. This is done for most current casks.

[how]
Utilize jq and the fonts.json database to retrieve the name (which is
stored nowhere else). Put it in the parens in the name field.

Update some `unpatchedName`s.

[note]
Examples from current casks:

homebrew-cask-fonts/Casks$ find . -name '*nerd-font*' -exec grep " name" {} \; | sort
  name "3270 Nerd Font (3270)"
  name "Agave Nerd Font (Agave)"
  name "Anonymice Nerd Font (Anonymous Pro)"
  name "Arimo Nerd Font (Arimo)"
  name "AurulentSansMono Nerd Font (Aurulent Sans Mono)"
  name "BigBlue_Terminal Nerd Font families (BigBlue Terminal)"
  name "BitstreamVeraSansMono Nerd Font (Bitstream Vera Sans Mono)"
  name "BlexMono Nerd Font (IBM Plex Mono)"
  name "CaskaydiaCove Nerd Font (Caskaydia code)"
  name "CodeNewRoman Nerd Font (Code New Roman)"
  name "Cousine Nerd Font (Cousine)"
  name "DaddyTimeMono Nerd Font (DaddyTimeMono)"
  name "DejaVuSansMono Nerd Font (DejaVu Sans Mono)"
  name "DroidSansMono Nerd Font (Droid Sans Mono)"
  name "FantasqueSansMono Nerd Font (Fantasque Sans Mono)"
  name "FiraCode Nerd Font (Fira Code)"
  name "FiraMono Nerd Font (Fira)"
  name "GohuFont Nerd Font (Gohu)"
  name "GoMono Nerd Font (Go)"
  name "Hack Nerd Font (Hack)"
  name "Hasklug Nerd Font (Hasklig)"
  name "HeavyData Nerd Font (Heavy Data)"
  name "Hurmit Nerd Font (Hermit)"
  name "iMWriting Nerd Font families (iA Writer)"
  name "InconsolataGo Nerd Font (Inconsolata Go)"
  name "InconsolataLGC Nerd Font (Inconsolata LGC)"
  name "Inconsolata Nerd Font (Inconsolata)"
  name "Iosevka Nerd Font (Iosevka)"
  name "JetBrainsMono Nerd Font (JetBrains Mono)"
  name "Lekton Nerd Font (Lekton)"
  name "Literation Nerd Font families (Liberation)"
  name "MesloLG Nerd Font families (Meslo LG)"
  name "Monofur Nerd Font (Monofur)"
  name "Monoid Nerd Font (Monoid)"
  name "Mononoki Nerd Font (Mononoki)"
  name "mplus Nerd Font (M+)"
  name "Nerd Font Symbols Template (Symbols Only)"
  name "Noto Nerd Font families (Noto)"
  name "OpenDyslexic Nerd Font families (OpenDyslexic)"
  name "Overpass Nerd Font (Overpass)"
  name "ProFont Nerd Font families (ProFont)"
  name "ProggyCleanTT Nerd Font families (ProggyCleanTT)"
  name "RobotoMono Nerd Font (RobotoMono)"
  name "SauceCodePro Nerd Font (Source Code Pro)"
  name "ShureTechMono Nerd Font (Share Tech Mono)"
  name "SpaceMono Nerd Font (Space Mono)"
  name "TerminessTTF Nerd Font (Terminus)"
  name "Tinos Nerd Font (Tinos)"
  name "UbuntuMono Nerd Font (Ubuntu Mono)"
  name "Ubuntu Nerd Font (Ubuntu)"
  name "VictorMono Nerd Font (Victor Mono)"

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2022-11-25 16:47:12 +01:00 committed by Fini
parent 659fe757c5
commit 7acade38e1
2 changed files with 19 additions and 11 deletions

View file

@ -9,10 +9,11 @@
set -e
version="2.3.0-RC"
patched_parent_dir="../../patched-fonts/"
homepage="https://github.com/ryanoasis/nerd-fonts"
downloadarchive="https://github.com/ryanoasis/nerd-fonts/releases/download/v#{version}/"
LINE_PREFIX="# [Nerd Fonts] "
scripts_root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/"
patched_parent_dir="${scripts_root_dir}/../../patched-fonts/"
cd $patched_parent_dir || {
echo >&2 "$LINE_PREFIX Could not find patched fonts directory"
@ -38,8 +39,9 @@ function write_header {
}
function write_body {
local outputfile=$1
shift;
local unpatchedname=$1
local outputfile=$2
shift; shift;
local fonts=("$@")
if [ "${fonts[0]}" ]; then
@ -61,7 +63,7 @@ function write_body {
if [ "$i" == 0 ]; then
familyname=$(fc-query --format='%{family}' "${fonts[$i]}")
{
printf " name \"%s (%s)\"\\n" "$familyname" "$basename"
printf " name \"%s (%s)\"\\n" "$familyname" "$unpatchedname"
printf " desc \"Developer targeted fonts with a high number of glyphs\"\\n"
printf " homepage \"%s\"" "$homepage"
printf "\\n\\n"
@ -107,6 +109,12 @@ while read -r filename; do
sha256sum=$(sha256sum "../archives/${basename}.zip" | head -c 64)
searchdir=$filename
originalname=$(cat "${scripts_root_dir}/lib/fonts.json" | jq -r ".fonts[] | select(.folderName == "\"${basename}\"") | .unpatchedName" "${scripts_root_dir}/lib/fonts.json")
if [ -z "$originalname" ]; then
echo "${LINE_PREFIX} Can not find ${basename} in fonts.json, skipping..."
continue
fi
MONOFONTS=()
while IFS= read -d $'\0' -r file; do
MONOFONTS=("${MONOFONTS[@]}" "$file")
@ -136,8 +144,8 @@ while read -r filename; do
clear_file "$to_mono"
write_header "$to_mono" "$caskname_mono"
write_body "$to" "${FONTS[@]}"
write_body "$to_mono" "${MONOFONTS[@]}"
write_body "$originalname" "$to" "${FONTS[@]}"
write_body "$originalname" "$to_mono" "${MONOFONTS[@]}"
write_footer "$to"
write_footer "$to_mono"

View file

@ -145,7 +145,7 @@
"description": "Programming ligatures, extension of Fira Mono font, enlarged operators"
},
{
"unpatchedName": "Fira Mono",
"unpatchedName": "Fira",
"RFN": false,
"patchedName": "FiraMono",
"folderName": "FiraMono",
@ -271,7 +271,7 @@
"description": "Very light and thin characters, sharp m's, `0` and `O` very similar"
},
{
"unpatchedName": "Liberation Mono",
"unpatchedName": "Liberation",
"RFN": true,
"patchedName": "LiterationMono",
"folderName": "LiberationMono",
@ -352,7 +352,7 @@
"description": "Looks best with anti-aliasing turned off, squared off character corners, vertically tight small `s`"
},
{
"unpatchedName": "ProggyClean",
"unpatchedName": "ProggyCleanTT",
"RFN": false,
"patchedName": "ProggyClean",
"folderName": "ProggyClean",
@ -415,7 +415,7 @@
"description": "Squarish character lines, dotted zero, aggressive parethesis"
},
{
"unpatchedName": "Symbols Template 1000 EM",
"unpatchedName": "Symbols Only",
"RFN": false,
"patchedName": "Symbols-1000-em Nerd Font Complete",
"folderName": "NerdFontsSymbolsOnly",
@ -424,7 +424,7 @@
"description": "Just the Nerd Font Icons. I.e Symbol font only. 1000 EM size"
},
{
"unpatchedName": "Symbols Template 2048 EM",
"unpatchedName": "Symbols Only",
"RFN": false,
"patchedName": "Symbols-2048-em Nerd Font Complete",
"folderName": "NerdFontsSymbolsOnly",