Commit graph

56 commits

Author SHA1 Message Date
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
Ryan L McIntyre
ccd0e7421a Fixes 'font typefaces count' in script 2017-08-20 13:56:05 -04:00
Ryan L McIntyre
6af2fdc8d7 Bumps project version numbers of scripts for v1.1.0 release 2017-07-30 18:02:58 -04:00
Ryan L McIntyre
785d2839aa Adds example of rebuilding only the readme files 2017-07-29 21:21:11 -04:00
Ryan L McIntyre
50a0e91bd8 Clean-up 2017-07-29 13:50:37 -04:00
reujab
3a2cc32662 fixed links 2017-07-28 16:29:44 -04:00
Ryan L McIntyre
b3329db297 Fixes for generating readmes (#136) 2017-07-23 21:26:35 -04:00
Ryan L McIntyre
432671a75e Improvements to font readme generation (fixes #136)
- fixes missing readme at root dir of each font
- adds addendum clarifying reserved font names
- adds readme even if source font folder has none
- fixes parent directory re-build
2017-07-23 11:32:46 -04:00
morrme
0077f2c2f5 replace hard coded prefix with constant 2017-05-19 03:17:45 -05:00
morrme
7b41e7b298 add [Nerd Fonts] prefix to output 2017-05-13 17:02:53 -05:00
Ryan L McIntyre
097977e892 Fixes statistic calculations and formatting 2016-12-15 00:07:04 -05:00
Ryan L McIntyre
62fbb28cc3 Updates batch font script and fixes issues with postprocessing Hack (completes fixes #70) 2016-12-14 21:50:36 -05:00
Ryan L McIntyre
17f9ee5db6 Updates versioning info for v1.0.0 2016-12-14 20:22:26 -05:00