1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2024-12-13 17:18:37 +02:00
Commit Graph

68 Commits

Author SHA1 Message Date
Fini Jastrow
d9a2f1ad28 gotta-patch-em-all: Simplify pathnames
[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>
2023-01-24 13:38:46 +01:00
Fini Jastrow
1bada00ed6 gotta-patch-em-all: Allow initial -i runs
[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>
2023-01-24 13:38:46 +01:00
Finii
62842ec851 [ci] Bump release version 2023-01-23 14:41:11 +00:00
Finii
1cc7631da3 [ci] Bump release version 2023-01-17 19:02:09 +00:00
Fini Jastrow
f922619734 gotta-patch-em-all: Drop explicit combinations list
[why]
The list is very long and has very little meaning.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-01-15 21:37:37 +01:00
Fini Jastrow
be04d53d85 gotta-patch-em-all: Fix --info
[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>
2023-01-15 21:22:14 +01:00
Fini Jastrow
8d78b63764 gotta-patch-em-all: Fix --help option
[why]
Somehow the option is mentioned but not implemented.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-01-12 16:33:37 +01:00
Fini Jastrow
129e114ddf gotta-patch-em-all: Reactivate parallel processing
[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>
2023-01-06 08:32:48 +01:00
Fini Jastrow
257d6882fa Make output less verbose (with option)
[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>
2023-01-06 08:32:48 +01:00
Fini Jastrow
3c4fa008c1 gotta-patch-em-all: Add options to simplify patcher testing
[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>
2023-01-06 08:32:48 +01:00
Fini Jastrow
40ded7c2f0 gotta-patch-em-all: Create all fonts with unified release timestamp
[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>
2023-01-06 08:32:48 +01:00
Fini Jastrow
a577d7261a gotta-patch-em-all: Switch to proper parameter handling
[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>
2023-01-05 20:02:18 +01:00
Fini Jastrow
f448eba396 gotta-patch-em-all: Fix unfiltered (all) patch run
[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>
2023-01-05 20:02:18 +01:00
Fini Jastrow
3d8d673cb5 patch-em-all: Purge old license files
[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>
2022-10-24 14:15:03 +02:00
Fini Jastrow
148b0c4455 Sunset ligature removal
[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: #976
Fixes: #975
Fixes: #973

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-10-20 08:44:55 +02:00
Fini Jastrow
4bca7849fe gotta-patch-em-all: Fix config_has_powerline
[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>
2022-10-12 10:01:06 +02:00
Finii
cdcf7a5a30 [ci] Bump release version 2022-10-07 11:55:35 +00:00
Fini Jastrow
feafa89bb3 font-patcher: Prevent --mono on proportional fonts
[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>
2022-09-24 16:56:30 +02:00
Fini Jastrow
92fbcdb143 Rename 'Font Linux' to 'Font Logos'
[why]
The glyphs set's name changed, we should reflect that.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-13 08:05:14 +02:00
Fini Jastrow
d58fa371fe patch-em-all: Fix counting font files
[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>
2022-09-07 13:39:10 +02:00
Fini Jastrow
26d656fcaa patch-em-all: Fix postprocess with AppImage-fontforge
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-07 13:27:18 +02:00
Fini Jastrow
ef1f35368e patch-em-all: Display error messages if patching fails
[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-variable
https://stackoverflow.com/a/56577569

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-07 13:08:07 +02:00
Finii
9c950dc385 [ci] Bump release version 2022-09-07 08:05:53 +00:00
Fini Jastrow
110d19853c CI: Reduce running time
[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>
2022-09-01 12:15:00 +02:00
Finii
aff362ab36 [ci] Bump release version 2022-08-26 22:15:32 +00:00
Finii
572221ec32 [ci] Bump release version 2022-08-26 16:44:55 +00:00
Fini Jastrow
953ec87918 patch-em-all: Fix purging for font names that have blanks
[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>
2022-08-20 19:33:29 +02:00
Fini Jastrow
821ac68173 Create symbols only font directly from sfd template
[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>
2022-08-20 19:33:29 +02:00
Fini Jastrow
5ceb1b2395 patch-em-all: Allow to specify font specific options
[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>
2022-08-20 19:33:29 +02:00
Fini Jastrow
47b0c083d5 gotta-patch-em-all: Fix filename parsing (part 2)
[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.
2022-08-19 13:24:39 +02:00
Fini Jastrow
5ff4f92a23 CI: Use fontforge March 2022 AppImage
[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>
2022-08-19 13:24:39 +02:00
Fini Jastrow
e957f9f217 gotta-patch-em-all: Fix filename parsing
[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>
2022-08-18 12:20:06 +02:00
Fini Jastrow
afd7ba1017 patch-em-all: Purge destination dirs if possible
[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>
2022-08-18 11:19:19 +02:00
Fini Jastrow
7bc729e27a gotta-patch-em-all: Allow to specify directory filter
[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>
2022-08-18 11:14:12 +02:00
Fini Jastrow
f287b97048 gotta-patch-em-all: Return error when no file patched
[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>
2022-08-18 11:14:12 +02:00
RL-S
f18c02f345 Allow running gotta-patch-em-all from any dir
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.
2022-07-26 15:40:45 +02:00
Ryan L McIntyre
97f28f4a17 Fix info and license generation going to incorrect files 2021-12-11 13:43:48 -08:00
Ryan L McIntyre
5f748cdb10 Updates regex for matching more license files (issue #463) 2020-04-13 14:52:33 -07:00
Ryan L McIntyre
85eb82d430 Adds license files to release archives 2020-04-13 02:41:52 -07:00
Ryan L McIntyre
9bbf817f77 Add license files to patched font directory and subdirectories as well as some clean-up and refactoring 2020-04-12 03:52:31 -07:00
Ryan L McIntyre
bc12c2281f Add support for generating info as well as specifying a like pattern (first param to script) 2020-04-12 03:51:29 -07:00
Ryan L McIntyre
8566c6539e Updates scripts in preparation for for v2.1.0 2019-11-03 09:08:39 -08:00
Andrew Newman
e8e191a1be Update bash shebangs 2018-07-09 18:18:12 +03:00
Ryan L McIntyre
84a6bc8419 Updates counts and missing combinations from generation 2018-03-18 18:00:26 -04:00
Ryan L McIntyre
916a3d0634 Fixes search to be case insensitive 2018-03-10 21:39:34 -05:00
Ryan L McIntyre
b7931da607 Updates version metadata consistency 2018-03-03 14:14:55 -05:00
Ryan L McIntyre
f8fda5c985 Version bumps in preparation for v2.0.0 release 2018-02-26 05:43:15 -05:00
Ryan L McIntyre
3c128eee3b Updates build patcher to use new flags/options 2018-02-25 21:52:36 -05:00
Ryan L McIntyre
338b0c6bdc ShellCheck fixes WIP (related to #120) 2018-01-12 22:20:52 -05:00
Ryan L McIntyre
a57f79c2c1 Bumps project version numbers of scripts for v1.2.0 release 2017-11-18 16:01:37 -05:00