[why]
I'm not sure why it has been in the code like this, and I removed these
strange globs already before in some places [1].
find -name "*.[o,t]tf"
actually allows
*.otf
*.ttf
*.,tf
[how]
Remove spurious comma in all `find` calls.
Systematically.
[note]
Just some commits mentioned here:
2ace3de8e7722458821ac6817bc729e2
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Normally the release zip files have a flat directory structure, i.e. all
files are in the base directory and there are no subdirs. The existing
subdirectory structure is removed on zip creation via `archive-fonts.sh`.
If the patch results have two fonts with identical name these flat
archives can not be generated. The `archive-fonts.sh` reports:
Could not create archive with the path junked (-j option) - likely
same font names for different paths, zip status: $zipStatus
Retrying with full path
But now the problem is only delayed. When the font file has the name
name the Family and SubFamily are most likely also the same for both
font files. If we install both the user (and the system) can not really
distinguish the font files anymore.
This turned up with [1] when doing a `brew style *nerd-font*` that
complains in fact about duplicate fonts to install. At that point we had
the additional problem that the subdir-path had been missing in the cask
files. So I'm not sure if it would work from a Cask standpoint (i.e.
font files are installed in subdirs).
Anyhow, this will fail when the user wants to select the font files,
because normally this is done on a Family-name basis. And identical file
name usually means identical Family-SubFamily.
Note that this ONLY happens with GohuFont, which has these subdirs:
11/complete
14/complete
uni-11/complete
uni-14/complete
The font has embedded bitmaps, but only one size. The "11" ones have
11px bitmap fonts and the "14" ones 14px bitmaps.
The "uni-" variant has much more glyphs.
Otherwise the differences are slim. From the font creation date the
"uni-" ones are newer.
[how]
Each font filename added to a cask is memorized. When the next fontfile
is to be added to the cask it is checked if we already have that
filename installed. Duplicates are then skipped.
If we have a deep archive, the fonts are added to the cask with full
relative path.
In case of Gohu that means the 11/complete variant is added (because all
files are alphabetically sorted before adding). By chance this is the
same variant that has historically been in the Cask, so no change here.
Fixes:
https://github.com/ryanoasis/nerd-fonts/pull/1008#issuecomment-1351170552https://github.com/Homebrew/homebrew-cask-fonts/pull/6758#issuecomment-1350791208
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
It does not really make sense to couple the casks, which checksums are
based on the zip files in the archive directory to files currently
existing in the repo. They could be different from the archived ones.
[how]
Use solely the archives. For this they must be unpacked temporarely so
that the fonts can be examined for family names.
We do not try to automatically determine the release tag of the archive
files. They could in principle we different for each. Instead it usually
has to be specified on the command line.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The json file is transported to jq via pipe AND as file.
That is not needed of course.
[how]
Just use the filename.
[note]
Also some whitespace changes.
Also remove debug output.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
ProFontWindows is missing from the cask, just ProFontIIx is included.
According to their documentation ProFontWindows has been created
specifically for MS Windows, but it can also be useful on Linux or
MacOS. [1]
[how]
Make the filter more strict, so that we only filter out our own Windows
versions and not all fonts that contain "Windows" in the name.
[note]
I'm not sure this ProFontWindows font is useful at all ;-}
[1] https://tobiasjung.name/profont/ paragraph "ProFont for Windows"
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The symbols only font has two entries in the fonts.json and that breaks
generation of the cask.
[how]
Do the queries on a 'first wins' strategy; ignore further entries in the
fonts.json.
[note]
I guess we should remove one of the two instances of Symbols Only from
the database; I have still not figured out why there are two distinct
entries.
And why there are two fonts at all 😬
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Sometimes the shortest Family is not a meaningful name, for example
iMWritingDuo
iMWritingDuospace
iMWritingMono
iMWritingQuattro
Obviously the shortest name is not adequate.
[how]
Instead we find the shortest word stem of the name. The common beginning
of all names. In the example above that is `iMWriting`.
If we have such a case we show in the name that there are multiple
families in the cask, by adding "families" to the name.
[note]
Also always capitalize the font name. Some fonts have a
all-small-letters name, but that seems a bit out of place and has been
changed with the manual naming (previously) already to Capitalized Name.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Some fonts have different and not consistent Family names set,
especially (only) if the `--makegroups` option has not been used for
patching.
Example:
$ fc-query --format='%{family}\n' patched-fonts/Hasklig/Black/complete/Hasklug\ Black\ Nerd\ Font\ Complete.otf
Hasklug Nerd Font,Hasklig Black
See also previous commit's message, bottom.
[how]
We want to use only one of the Family names (fc-query reports all as
csv, unless we specify an index), so query one by one.
Check that it is 'our' name (that contains "Nerd") and not a leftover
from uncomplete patching.
[note]
Also whitespace change: One tab to spaces.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The code takes the FamilyName out of the first patched font file and
puts that into the cask name field.
This has two problems:
After we joined Mono and non-Mono fonts into one cask the first font
might be a "Nerd Font Complete Mono" and we certainly do not want that
FamilyName in a cask that also contains the non-Mono variants.
We have some fonts with more than one Family, for example
CaskaydiaCove Nerd Font SemiLight
CaskaydiaCove Nerd Font Light
CaskaydiaCove Nerd Font
CaskaydiaCove Nerd Font ExtraLight
Taking the first encountered Family name is most certainly not want we
want.
[how]
Examine all patched fonts and collect their FamilyName and use the
shortest of them, as that usually is the base stem.
This still fails for somem fonts, like Hasklug
Hasklig Black
Hasklig ExtraLight
Hasklig Light
Hasklig Medium
Hasklig Semibold
Hasklug Nerd Font
But that font's FamilyName is broken anyhow, note that the RFN renaming
does not really work consistently. It would be fixed by using
`font-patcher` with option `--makegroups`, which should become the
default soon.
This will be tackled by the next commit.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
We want to replace the existing casks. But they do not have a consistent
way to name the casks. Sometimes blanks are preserved (as dashes):
"unpatchedName": "DejaVu Sans Mono",
"patchedName": "DejaVuSansMono",
"caskName": "dejavu-sans-mono",
The above looks like cask-name == unpatched-name.
Here they introduce blanks out of thin air (the original name does not
have blanks):
"unpatchedName": "DaddyTimeMono",
"patchedName": "DaddyTimeMono",
"caskName": "daddy-time-mono",
Here they add something to the name??!:
"unpatchedName": "Gohu",
"patchedName": "Gohu",
"caskName": "gohufont",
Here the cask-name follows the RFN renaming:
"unpatchedName": "Hasklig",
"patchedName": "Hasklug",
"caskName": "hasklug",
Here they do not follow the RFN renaming:
"unpatchedName": "Liberation",
"patchedName": "LiterationMono",
"caskName": "liberation",
And there are a lot more ... strangenesses.
I guess the casks have been created by different people following
different ideas.
[how]
All these inconsistencies makes setting up rules how to determine the
cask name from the other names very complicated and brittle.
If we want to preserve the existing cask names the simplest and most
stable approach is to explicitely specify them in the fonts.json
database:
Introduce a new data field "caskName", like shown above.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The existing Casks _all_ contain both the Mono and non-Mono variants.
I believe splitting would be a good idea, but that would break existing
uses.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[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>
* Remove appcast
* Process fonts in alphabetical order
* Skip fonts where no checksum can be determined
* Add livecheck
* Add description
* Fail generation on any error in the script
[notes]
* The code to work without checksum (:no_check) did not work anyhow
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Several different indentations methods used here. That confuses me and I
want to edit this file.
[how]
Unify to '4 blanks' as used in other (recently edited) files.
Unify if-then and while-do syntax.
Also replace single quotes with double quite in the cask file.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The casks-artifact is empty.
[how]
Supply the correct path for the upload.
For this the generator script prints the output pathname(s),
which in turn are used in the CI.
Also drop unneeded '/' from path end.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The filter expects 'Mono' to be the last part of the font filename. With
font-patcher's --makegroups that is not the case anymore, because in
fact 'Mono' is part of the font name and the font filename ends in the
style (i.e. 'Italic').
[how]
Because we do only create 'Complete' fonts, and 'Mono' is always after
'Complete' (i.e. 'Complete Mono') for both veriants created by the
font-patcher, we can use that to select mono fonts.
[note]
Also bump script version after several changes.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The script shows
# [Nerd Fonts] Generating cask for: .
for any font it processes.
[how]
Well, the variable naming is a bit strange, maybe that is the reason for
the bug? We already have the font name in another variable, use that.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The CI uses the script with the font-matrix name, to regenerate the cask
of just one font. But the script is ignoring the parmeter and generates
all casks.
[how]
Allow to specify a regex pattern as first parameter and limit the
processing to that font(s), as done in archive-fonts.sh
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
When run on more than one font the mini-readme is only added to the
first created archive.
[how]
Remove the readme file only after all archives have been generated.
[note]
Also rewrite `find` command, to actually do some work. The formulation
was rather odd, using a shell glob to find the directories and `find` to
select one.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>