[why]
For some reason we work with strange paths like "root/a/b/../../c/d/e"
instead of "root/c/d/e".
[how]
Use dirname to go directories up.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
When running with --info on a completely empty patch-destination some
directories are missing and are never created. They would have been
created by the actual patching that is suppressed now.
[how]
Check and create the needed subdirs.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The info-only option broke with the latest changes.
[how]
Set something to the variable that determines the info only mode.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The messages from parallel font-patcher runs can be very confusing, so
it has been disabled some time ago (without a comment in that commit?!).
However, if someone wants to repatch multiple fonts on a local machine
it might be beneficial to run more than one process to have work on all
cores.
[how]
Add option to select multiple processes in parallel.
Limit the amout to 8, which might be a good value for typical end-user
machines with 4 cores and 8 threads.
Patching Cascadia Code (12 fonts) took these times on my machine:
1 job: 21m 55s
4 jobs: 6m 24s
8 jobs: 5m 14s (this runs 8 and then the remaining 4)
16 jobs: 4m 48s (this runs 12 in parallel)
Adding a proper `-j` that takes a numeric argument is rather too much
work for my taste, so we stick with 8 for now.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Running gotta-patch-em-all creates a lot of output that is most likely
not wanted.
[how]
Add --verbose option to gotta-patch-em-all.
Hide debugging information unless it is wanted by specifying this option.
Also change font-patcher to produce less verbose output and respect
--quite in more places.
This includes a change that we try to tweak the font flags only if
source and destination font are ttf or otf, because we can not read the
other raw font files anyhow.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
When working on the font-patcher the developer needs to test the changes
on a number of fonts. This is usually a manual call of `font-patcher`
and afterwards a 'diff' of the newly created font with the 'old' font in
the patched-fonts/ directory with fontforge (which has a font-compare
option).
If you run gotta-patch-em-all normally the newly generated font will
replace the existing font and git will ALWAYS show it as different. The
reason is that at least the timestamp in the generated font has changed.
Far more easy would be if the new gotta-patch-em-all run could keep the
previous timestamps, in that way one can immediately see that the old
and new fonts are bitwise equal (via git).
Furthermore if you expect a change and want to show the differences of
old and new font in fontforge you need both fonts in the filesystem.
But a normal gotta-patch-em-all run replaces the font. A different
destination folder would help here.
[how]
Introduce two new (independent) options to
a) keep the timestamp equal to previous patch run
b) generate the fonts in a different directory
While b) is straight forward, a) is a bit more complicated, esp because
filenames can change and so on. So the script examines just one (1)
random font in the specific font directory and uses its timestamp. In
most cases this is correct enough if the developer uses gotta-patch-em-all
consequently.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
All the fonts will have different timestamps, and within each font the
creation and modification date might also differ. That is quite
confusing and makes automated testing very complicated.
[how]
Use one date-time for ALL fonts and for creation and modification date
in the font file.
But do not change the date-time if we already set that somewhere before :-}
Also remove the 'special' properitary fontforge timestamp tables FFTM from
the patched fonts. This is only possible since FontForge 20th Anniversary
Edition.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Oh boy do I hate the boilerplate code needed with optargs, but without
it every parameter becomes a burden.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
When we want to patch all fonts by calling the script without any
options it fails.
[how]
Give the correct regex to find all directories.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Old (renamed) license files are not cleaned up automatically.
The new files will be put into the patched-fonts dir, but old ones not
removed.
[how]
With commit
afd7ba10 patch-em-all: Purge destination dirs if possible
the script purges old font files from the patched-fonts directory to get
rid of renamed font files. This has been deliberately limited to ttf and
otf files.
But as all license files are automatically copied over we can also
remove them.
This (finally) remove the possibility to manually put any files in those
directories. This can be good or bad.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Keeping the ligature removal tables up to date with source font updates
is quite a maintenance burden.
Usually if a terminal supports ligatures at all it has an option to
disable them.
Present ligatures do not prevent monospaced fonts and monospaced
detection.
It was only present in v2.0.0, and the code has been broken with v2.1.0.
[note]
Updated example ligature removal table to the one for Iosevka.
Left stubs in relevant code passages to facilitate finding this commit.
Fixes: #976Fixes: #975Fixes: #973
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
There is code that shall read the config file and act on
config_has_powerline.
Usually it is set to "1", but Ubuntu has this "0".
Regardless the content, if the variable has content the code assumes the
value is true. That is probably not wanted.
[how]
Use a numeric comparison.
[note]
```
git blame UbuntuMono/config.cfg
4abe6c77b0 Ubuntu/Bold-Italic/config.cfg (Ryan L McIntyre 2017-07-23 17:17:21 -0400 1) config_has_powerline=0
```
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
When the source font is proportional we can not really create a
monospaced (patched) font from it. The glyph width is for example very
small for 'i' but wide for 'W'.
The glyphs are all left aligned, leaving very strange separation between
smallish glyphs.
Even if we would center the glyphs, the look would be strange and
completely differenmt from the source font's look.
[how]
For proportional fonts do not allow to patch with `--mono`.
The fact if a source font is monospaced is determined by examining some
(very few) glyphs. But testing all our source fonts in the repo shows
that it is sufficient.
Furthermore the Panose flag is checked and differences between the flag
and what the glyph examination found are reported.
The user can enforce `Nerd Font Mono` generation with double specifying
the command line option `--mono --mono`. Still a warning will be issued.
[note]
Because `gotta-patch-em-all-font-patcher!.sh` does not really count the
variations but calculates them in a separate loop it does not know
anymore how many variations are created per family. The numbers are
wrong.
But probably we should count the result font files in the end anyhow.
Because the information is not needed (in an automated manner) this is
not corrected here.
It seems wrong anyhow:
total_variation_count=$((total_variation_count+combination_count))
total_count=$((total_count+complete_variations_per_family+combination_count))
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Does not calculate the number of files:
find: ‘/home/runner/work/nerd-fonts/nerd-fonts/../../patched-fonts/*’: No such file or directory
[how]
Use $sd instead of $PWD
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
All error stream outputs of `font-patcher` are suppressed, because they
are very noisy and usually are ignored.
But when the patching fails for some reason we do not know why.
Especially if that happens during CI runs.
[how]
Instead of dropping the stderr we store it in an envvar; and output it
to stdout if patching failed.
`printf` is needed because `echo` is lousy with multiple lines.
Redirection magic:
https://stackoverflow.com/questions/962255/how-to-store-standard-error-in-a-variablehttps://stackoverflow.com/a/56577569
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The CI runs takes hours... 4 to 5?
[how]
With the recent changes we can half the number of patcher runs, because
we can create a normal and a Windows Compatible font version from one
patching process.
The export is done twice still (just the actual patching is avoided),
so the reduction will be less. But still!
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The detection if all fonts of a given directory are to be processed is
broken if the font files contain blanks
(like 'Symbols-1000-em Nerd Font Complete Mono Windows Compatible.ttf')
[how]
Need to put name argument in quotes...
Also fix counting for sfd files (but we never generate them anyhow)
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The symbol only fonts Symbols-1000-em Nerd Font Complete.ttf
and 2048-em in `NerdFontsSymbolsOnly/` are generated from
some 'almost' empty source fonts, that are assumable in turn generated
from the sfd font descriptions in `src/glyphs/`?
The process is not documented and we have issues in the generated font
(for example the glyph for capital `E` is defined (and empty) #581#765).
[how]
Use the existing font definitions from `src/glyphs/*.sfd` directly as
source font. That needs a change in font-patcher because the empty
fonts have no glyphs that can be used to orient the scaling upon. In
that case scale on the source font definitions EM.
Then we need patch-em-all to also patch *.sfd fonts.
And finally we need patch-em-all to take a font specific command line
switch for font-patcher (compare 9e2bc9a26 of #723) to instruct it to
create a ttf rather than a sfd font file.
In the sfd file we additionally set the Panose type.
And the UnderlinePosition is adjusted to match the current patched font.
[note]
Also fix wrong glob pattern in patch-em-all `*.[o,t]tf`. The comma is
for sure some leftover from a '{}' shell pattern, that is not used
anymore. (This comment is probably outdated, due to rebasing.)
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
We want to patch some fonts with different font-patcher options.
[how]
Use the config.cfg file that each source font can have to specify one
arbitrary option to the font-patcher calls.
[note]
This is partially commit 9e2bc9a26 from #723.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The new 'pathname' pattern always added a '*' glob to the end.
So when we wanted to (just) recreate "Inconsolata" (by specifying
"/Inconsolata") that means "/Inconsolata*/*.[to]tf".
But that includes also "IncolsolataGo" and "InconsolataLCG" :-(
[how]
Just remove the globbing after the pathname. If a pathname is specified
it must be the correct pathname and no star is added per default.
Users could still specify "/Incon*" to get all Inconsolatas in the
pathname based filter mode.
[why]
It might be easier to use the precompiled application than to build it
ourselves.
[how]
The AppImage has the typical problem with relative paths, so we need to
change some small calls.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The find predicate (e.g. -iname) and predicate parameter (the actual
pattern) are in one variable and will be handed over to find as one
parameter instead of two.
How could this ever work?
[how]
Pass predicate mode and predicate parameter as two shell variables.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
When the file names of the source files change which happened for example
with these commits:
ac432eb20 Updated Inconsolata source to latest upstream version of 2.001 (WIP #289)
9c5ad2c78 Updated Inconsolata source to latest upstream version of 2.001 (WIP #289)
or the patched font files naming changes because of any other reason:
The patched-font directory will contain the new files along with the
unchanged old ones (because they where not overwritten).
Typically when manually updating the patched-fonts this is not a
problem, as the maintainer can clean this up by hand (if it is noticed).
But with a github action we might want to have that automatized.
To not deter the usability of the script for end-users or for patching
single fonts of a collection we do NOT want to purge 'all old files'
because we can not know if they are really old or not.
[how]
For each directory that we process from the source fonts we check if all
font files therein match our search criterion (pattern, $2). If we are
going to patch _all_ files that are in that source directory we delete all
font files in the destination directory; expecting that all files will
be recreated.
If we do _not_ patch _all_ files, we can do nothing, because we can not
decide if the existing files originate from one of the
not-to-be-processed source font files or are zombies.
Fixes: #786
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
We can limit the font files to patch with the gotta-patch-em-all script
to some specific file names; the case insensitive beginning of the
basename of the font file, to be specific.
Sometimes we do not know how the actual font files are named, we just
know the directory name.
[how]
The old filter checked for the beginning of a file name, so we keep this
behavior and allow to check for the beginning of a directory name.
As differentiator the first character of the passed filter is used. As a
slash is not allowed in the file name filters: If the first char is a
slash, we search for font files in a directory that begins with that
name. The file name is not considered in this case.
Examples:
gotta-patch-em-all-font-patcher!.sh Fira
Patches all font files that begin (case insensitive) with 'fira'.
It must be the basename of the font file, the path to the file is not
considered. (Old behavior.)
Translated to a glob this is roughly **/Fira*.[ot]tf
gotta-patch-em-all-font-patcher!.sh /Fira
Patches all font files that are in directories that begin (case
insensitive) with 'fira'. It can not be the beginning of the font
file basename.
Translated to a glob this is roughly **/Fira*/**/*.[ot]tf
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
When we do CI we probably want to raise an error if no font file could
be found.
[how]
Check how many font files have been generated and return with exit
code 1 if the number is zero.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
The script assumes that it's run from inside bin/scripts, by setting source and target directories according to the output of pwd. It doesn't perform any checks whether it's run from the right directory, so it just doesn't find the fonts if the working directory is different.
Now it sets the directories relative to the script directory.