Commit graph

1412 commits

Author SHA1 Message Date
Fini Jastrow
50657caa63 CI: Do not fetch on add-and-commit
[why]
The add-and-commit steps are so unbelievable slow.

[how]
We do not need the other tags, so we do not need a fetch before adding.
See comments on the action's homepage.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-11 16:41:12 +02:00
Fini Jastrow
134c518892 CI: Generate CSS and push to repo and gh-pages
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-11 16:41:12 +02:00
Fini Jastrow
41e0b16a4d generate-css: Do not rely on external minimalizer
[why]
The generated file `nerd-fonts-generated.css` is made smaller with an
external service as manual step...

  # [Nerd Fonts]  The following is generated from the build script, then through https://www.minifier.org/

We do not want any manual steps.

[how]
Luckily the difference is just to remove whitespaces and unneeded
semicoli. We can do the same while generating.

[note]
At first I tried to postprocess the generated file with sed, but of
course the strings that have blanks in them made that rather
complicated.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-11 16:41:12 +02:00
Fini Jastrow
61f59453f6 generate-css: Prepare for CI usage
[why]
The file that would be created in temp/ is probably not needed
There is a lot out noise

[how]
Create the txt file only if we already have a temp/ dir.
Make that clear in the final output message.
Remove debugging outputs.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-11 16:41:12 +02:00
Fini Jastrow
ef8c12e285 Document and update cheat sheet data
[why]
Codicons is completely missing...

[how]
After creating a stub file for Codicons, use _their_ definition file:

curl -O https://raw.githubusercontent.com/microsoft/vscode-codicons/main/dist/codicon.csv
cat codicon.csv | tail -n +2 | sort -k 3 -t ',' | sed -E "s/([^,]*),([^,]*),(.*)/i='\2' i_cod_\1=\$i/" | tr '-' '_' >> i_cod.sh

Because they have new additional icons remove some lines in the bottom.
And add the final `unset i`.

I still have not figured out how the cheat sheet works and how we get
the data into that... There is a `generate-css.sh`. Hmm.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-11 16:41:12 +02:00
Fini Jastrow
76cb86f66f Add query_mono debugging script
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-11 16:41:12 +02:00
Fini Jastrow
983226a70e font-patcher: Fix scaleGlyph related rounding error
[why]
Sometimes the patched-in symbols are slightly too big, which shows up in
Nerd Font Mono fonts where the destination size is specified exactly.

That issues a warning like:
  Warning: Scaled glyph U+F077 wider than one monospace width

[how]
For the scaleGlyph groups we need to combine the bounding boxes of
several symbol glyphs to determine the 'combined' scale we need.
Unfortunately when the concrete glyph is finally copied over its size
can change minimally.

So we need to measure the glyphs in the scaleGroup _after_ they have
been copied to the to-be-patched font. This is a bit complicated,
because we need to know some glyph slot we can use for that.

[note]
See also commit
  e805b879  font-patcher: Resolve rounding error when rescaling

Fixes: #917

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-08 20:08:44 +02:00
Fini Jastrow
67aa453436 Update fontconfig
[why]
Has not been updated in the last release CI run.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-08 15:44:32 +02:00
Fini Jastrow
487fc793bc CI: Fix fontconfig creation
[why]
Despite the fact that the workflow generates a new fontconfig, it is
never committed back to the repo.

[how]
As usual people rely on $PWD, which is not set in CI runs.
Use the subshell call $(pwd) instead, as that works always.

Reported-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-08 15:44:32 +02:00
Fini Jastrow
bdc28aa88f generate-fontconfig: Create entries for all encountered families
[why]
Some (the most basic) Families are not added.

[how]
The used shell array search is string based and can/will fail when we
search for a short string that is present in a array entry as substring.

Use explicit search instead.

[note]
Also remove some debugging output.

Fixes: #918

Reported-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-08 15:44:32 +02:00
Fini Jastrow
629b29507d generate-fontconfig: Fix sorted config
[why]
Table is still unsorted.

[how]
First we ran on '.', which includes all fonts, and then the font
directories one by one, but we have traversed them already ...

Do not run on '.' :-}

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-08 15:44:32 +02:00
Finii
5454877c01 [ci] Rebuilds patched fonts 2022-09-07 15:57:31 +00: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
aaf2dafda4 [ci] Rebuilds patched fonts 2022-09-07 08:09:42 +00:00
Finii
9c950dc385 [ci] Bump release version 2022-09-07 08:05:53 +00:00
Fini Jastrow
a6e6ee26d8 font-patcher: Correct Family for Mono Windows
[why]
Windows Compatible fonts have the same Family name, regardless if they
are "Nerd Font" or "Nerd Font Mono".

This creates problems for appliations that sort and select fonts by
Family name.

[how]
Just like "Nerd Font" is abbreviated as "NF" in the Windows Family names
(to keep it short because of the 31 character length limit), the
"Nerd Font Mono" are now called "NFM" instead of just (also) "NF".

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-07 06:58:21 +02:00
Fini Jastrow
ec4c341a9a Trigger Release 2.2.2
Another bugfix release to fix the regression introduced with 2.2.0
that is fixed by #764. Also note #900.

Some other smaller PRs also pulled.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-07 06:41:55 +02:00
Fini
5226e04be1
Merge pull request #862 from ryanoasis/feature/add-kotlin-icon
Add Kotlin icon
2022-09-07 06:26:30 +02:00
Fini Jastrow
604c41253a Add Kotlin icon to Seti & Custom
[why]
It's not available anywhere else (it seems).

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-07 06:15:30 +02:00
Fini
86c2247ee2
Merge pull request #833 from ashfinal/icon-emacs
Add icons for Emacs and Orgmode
2022-09-07 05:48:55 +02:00
Fini Jastrow
0e45cd66d6 font-patcher: Allow glyphs with altuni for exactEncoding
[why]
Some symbol fonts might come with glyphs that have multiple codepoints.

When we want to patch them with `'Exact': true` (i.e. at their 'original'
codepoints) we want to patch them into the codepoint that has been used
in the selection process. That means between SymStart and SymEnd.

But this is not the case. We patch them in into their 'main' codepoint,
which can be outside the expected range of points.

This came up when patching with FontAwesome V6. It has for example these
glyphs:

Glyph 'music' has a main codepoint 0x1F3B5, but it is present in the
font also on codepoint 0xF001.

Glyph 'heard' has a main codepoint 0x1F9E1, but it is present in the
font also on codepoints 0x2665, 0x2764, 0xF004, 0xF08A, 0x1F499, ...

When doing a `'Exact': true` patch (i.e. exactEncoding = true) the
glyphs is patched into the target font at its (the glyph's) main
codepoint, regardless of our patch-codepoint-range.

[how]
We examine all codepoints that a glyph occupies in the symbol font. From
all these codepoints we take the nearest to the last glyph be patched
in. Nearest means from the possible codepoints the lowest that come
after the previous used codepoint.

For example the 'heard':

Last patched in codepoint was 0xF003.
Main codepoint: 0x1F9E1
Alternate codepoints: 0x2665, 0x2764, 0xF004, 0xF08A, 0x1F499, ...
-=> 0xF004

Later in the patching process we might encounter the same glyph again,
but this time the previous codepoint was 0xF089, so we need to take
0xF08A.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-07 05:42:02 +02:00
Fini Jastrow
f97d729b34 font-patcher: Check if glyph source is available
[why]
When users just download the script (and not the source glyphs) the
script fails with an obscure error message.

[how]
Check if the glyphdir exists at all. If not give a hint to download the
glyphs.

Check if the individual glyph font exists and is readable. Bail out if
not.

[note]
Cherry picked, was part of #741

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-07 05:37:33 +02:00
Fini Jastrow
7cda326515 font-patcher: Allow to specify custom symbolfont with absolute path
[why]
When one wants to use a custom symbol font and specifies it with an
absolute path, the glyphdir is still prepended.

That means that the argument to `--custom` is always used as relative
path (to `--glyphdir`), even when it starts with `/`. That is somehow
unexpected or at least inconvenient.

Example:
fontforge font-patcher --custom ~/Downloads/fa6.otf Inconsolata-Regular.otf

fa6.otf is searched for in ./src/glyphs/home/username/Downloads

[how]
Use Python function that handles joining path fragments. If a component is
an absolute path, all previous components are thrown away.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-07 05:19:17 +02:00
Fini Jastrow
64d53b8247 font-patcher: Fix Python problem
[why]
I'm not sure why, but maybe the CI's Python is another version where the
syntax is not supported.

This has been introduced with commit
  4a61afc83  font-patcher: Do not overwrite glyphs that are needed for basic glyphs

[how]
Use less sophisticated syntax.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-06 16:49:29 +02:00
Fini Jastrow
b2fa537e7f font-patcher: Correct mono scaling of thin glyphs
[why]
Some glyphs that are tall and thin, are too big in the resulting patched
font, i.e. are higher than our 'line'.

At least for --mono fonts. The non-mono fonts do not rescale the
inserted glyphs at all, so there is no definition of 'too tall/wide'.

[how]
We want all glyphs to fit into the box defined by *_dim['height'] and
*_dim['widths'], as it also defines our powerline-glyph scaling and
horizontal and vertical advance widths.

So we need to take that value (instead of EM) for the scaling
calculation. The history of the use of EM here is a bit obscure, more
explanations in the PR.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-06 15:40:25 +02:00
Fini Jastrow
4a61afc83a font-patcher: Do not overwrite glyphs that are needed for basic glyphs
[why]
Sometimes the basic glyphs ([a-zA-Z] etc) are constructed in the font
from other glyphs via references. To keep those basic glyphs intact we
must not touch the referenced glyphs.

[how]
Crate a list of all glyphs referenced by the basic glyphs.
When patching in some new symbol - if that codepoint is in the list do
not overwrite it. Overwriting would break a basic glyph.

The user does not get the glyph that we would have patched in, but that
can not be helped if we want to keep the basic glyphs intact and not
'redesign' the complete font.

Fixes: #400

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-06 15:30:58 +02:00
Fini Jastrow
ac60053b3a font-patcher: Correct python module missing message
[why]
When the fontforge python bindings are not installed we fail while
importing psMat. The message suggests that fontforge itself is not
installed - which is not the real reason. One can use the libfontforfge
with the python-fontforge without having the GUI program fontforge.

Furthermore we link to outdated installation instructions.

[how]
We already check and report correctly what needs to be done with the
fontforge module import. As both modules are often in the same package
we should probably report the same message. That message holds correct
hints for Debian/Ubuntu. It does not have a link to fontforge, though.

[note]
Also update Debian package name.

Fixes: #725

Reported-by: Aniket Teredesai <a@aniketteredesai.com>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-06 15:28:05 +02:00
Fini
6564e71fce
Merge pull request #764 from ryanoasis/bugfix/Make-NerdFonts-Monospaced-Again
font-patcher: Make Nerd Fonts Monospaced Again
2022-09-06 15:22:11 +02:00
Fini Jastrow
f67de4d7b0 font-patcher: Fix glyphs with overlap
[why]
For some powerline symbols we add a certain amount of overlap into the
previous or next character to cover up a small gap between the symbols
that otherwise can show up as ugly thin (usually colored) line.

But after we carefully design that glyph with a bit overlap (over-sized
and having negative bearings) we remove all bearings. That breaks of
course the glyph and no actual overlap on the left side happens.

[how]
Just do not remove negative bearings on overlap-enabled glyphs. As they
are rescaled in both directions anyhow all bearings are wanted and must
be kept.

Reported-by: Mihail Ivanchev <@MIvanchev>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-06 14:39:20 +02:00
Fini Jastrow
8f8776cf30 font-patcher: Make patch_set[attributes][params] a dict
[why]
The params are half way handled as dict, but if unset it is an empty
string. That makes accessing it needlessly complicated.

[how]
With no functional change the params becomes now a dict, also when it
does not contain any particular information.

At the moment that seems not nessecary, as it can only contain one key:
'overlap'. We could also rename 'params' to 'overlap' and just store the
value.

But we keep the generic params dictionary as it might come in handy some
time in the far future when more parameters are added.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-06 14:39:20 +02:00
Jason Chen
30605d4d49 Add chezbgone as contributor for docs 2022-09-05 13:25:08 +02:00
Jason Chen
4414bd4b24 Update readme for Hasklig to reflect current version 2022-09-05 13:25:08 +02:00
Fini Jastrow
f4d96f2258 Update readme files
Reported-by: Saumyajyoti Mukherjee <saumyajyoti>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-01 12:43:36 +02:00
Fini Jastrow
b83d1cfacb Create NerdFontsSymbolsOnly with proportional widths
[why]
The commit
  59c45ba4e  Remove negative bearings on 2048-em glyphs
has been introduced to fix some problems with the symbols only font, at
least from the commit message.

That font is intended to be used in font-fallback situations, and so we
do not know the advance width of the current font anyhow. It does not
make sense to enforce an advance width with these.

[how]
Create the NerdFontsSymbolsOnly as if 59c45ba4e would be still in
effect, i.e. with variable advance width.

[note]
There have been a lot discussions about the reverted commit, some can be
found here:
* #900
* #764
* #731

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-01 12:36:51 +02:00
Fini Jastrow
63db683b1a font-patcher: Add possibility to generate proportional font
[why]
Theoretically we can produce 3 types on fonts:
* A: Strictly monospaced font
* B: Allow bigger symbols, but advance width still monospaced
* C: Allow bigger symbols, advance width will vary

All have their uses.

Historically Nerd Fonts produced A and B.
Then we had kind of a breaking change with 2.2.0 that it produces
now A and C.

The commit
  b9b7a5080  Revert "Remove negative bearings on 2048-em glyphs"
restores the old (pre 2.2.0) behavior. But the type C fonts can be
useful, so maybe we can have them as option?

[how]
Add commandline option to be able to create all fonts types:
* A: specify -s or --mono or --use-single-width-glyphs
* B: specify nothing
* C: specify --variable-width-glyphs

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-01 12:36:32 +02:00
Fini Jastrow
1bb174e6bd Revert "Remove negative bearings on 2048-em glyphs"
This reverts commit 59c45ba4ef.

[why]
The commit breaks the non-mono Nerd Fonts for a lot of people.
The issue was not very good documented and investigation can not be
seen.

For the TITLE it should have affected only the 2048-em Symbols only
font, but in fact all patched fonts were changed. Maybe that was
intended, maybe not.

[how]
This will make the advance width again equal for all glyphs.
This enables the use of the non-mono variant in more terminals.
For wider symbols a space is now (again) needed after the symbol.
That is expected by a lot applications.

[note]
See Pull Request 764 for more details.

See next commits for alternative solution for original problem.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-01 12:32:09 +02: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
Fini Jastrow
df5702427a Update all readme files
[why]
The options in the translations are rather old for some.

[how]
Reorder stuff, and add new items with english description, because,
well, I can not translate. But better to have it in english there then
to miss it.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-01 12:15:00 +02:00
Fini Jastrow
98b28c8f3d font-patcher: Add possibility to generate normal and Windows font in one go
[why]
The normal and the Windows Compatible fonts differ just in the naming.
The patching is all the same.

For the CI we patch the original font for each output font. That is not
needed if we just want to create two differently named exports.

Skipping the patching where it is possible would save some time. Not
half the time, but the patching process itself is not too quick either.

[how]
Backup the original font names (as we need them again to deduce the new
Windows Compatible names).

Then do the patching once and the export twice, if parameter is given.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-01 12:15:00 +02:00
Fini Jastrow
3c3e2a49a7 font-patcher: Split code into more functions
[why]
The patch() function also does the font generation. This makes it
impossible to generate two fonts from one patch run.
(Will be needed in next commit).

The name setup could be done later.

[note]
This is no functional change, just reordering.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-01 12:15:00 +02:00
Fini Jastrow
35d3cfeff5 font-patcher: Fix generated font name output
[why]
After generating the patched font only a shortened name is displayed.

[how]
Obviously the two output lines were swapped...

If the fullname is None, and then output the fullname? :-}

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-01 12:15:00 +02:00
Fini Jastrow
51b99e0a7a CI: Disable cask creation (for now) [skip ci]
[why]
After discussion with
https://github.com/Homebrew/homebrew-cask-fonts/pull/6167#issuecomment-1229152446
I assume we would never use this in CI.

It can be helpful for new fonts, but even then they suggest using the
tools provided (i.e.`font-casker`):
https://github.com/Homebrew/homebrew-cask-fonts/blob/master/CONTRIBUTING.md#automatic-generation

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-30 10:57:44 +02:00
Fini Jastrow
6c2d3ec752 CI: Fix cask artifact upload
[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>
2022-08-30 10:46:51 +02:00
Finii
de9bb5b9bf [ci] Rebuilds patched fonts 2022-08-26 22:19:18 +00:00
Finii
aff362ab36 [ci] Bump release version 2022-08-26 22:15:32 +00:00
Fini Jastrow
b772df2c7f Trigger Release 2.2.1
This is a hotfix for #895, which broke all `Mono` fonts.

Sorry :-(

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-26 19:31:48 +02:00
Fini Jastrow
b71a9e474b Fix: Monospaced fonts wrong width
[why]
With commit
  821ac6817  Create symbols only font directly from sfd template

we have a default width for source fonts without a width (i.e. empty
fonts).

Unfortunately the detection for 'empty font' is wrong.

[how]
Reorder the commands such that we have a meaningful calculation.

Maybe this has been broken by too many (manual) rebases.

Fixes: #895

Reported-by: redactedscribe
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-26 19:31:48 +02:00
Mickaël Bourgier
a334db4180 Add nerd-fonts-hack AUR package to readme 2022-08-26 19:31:48 +02:00