1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2024-12-19 20:12:52 +02:00
Commit Graph

500 Commits

Author SHA1 Message Date
Fini Jastrow
b95c671ccb font-patcher: Fix behavior when trying to patch non-font files
[why]
When the file specified to be patched is not a font file the patcher run
errors out with an out of index runtime error:

Traceback (most recent call last):
  File "/home/fini/extra/git/nerd-fonts/font-patcher", line 2155, in <module>
    main()
  File "/home/fini/extra/git/nerd-fonts/font-patcher", line 2147, in main
    patcher.generate(sourceFonts)
  File "/home/fini/extra/git/nerd-fonts/font-patcher", line 415, in generate
    sourceFont = sourceFonts[0]
                 ~~~~~~~~~~~^^^
IndexError: list index out of range

[how]
Do not assume that the specified file will be a font file but rather
check if fontforge detects a font in the file and error out if there is
no font found.

Fixes: #1647

Reported-by: Kristopher James Kent <kris@kjkent.dev>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-06-02 08:48:31 +02:00
Fini Jastrow
cb0c9ed1e7 font-patcher: Fix escaping warnings
[why]
Some strings have broken format, because the string should contain a
verbatim backslash.

It seems this is a new warning for Python 3.12

[how]
Use raw strings or escape the escape character via '\\'

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-05-06 22:13:25 +02:00
Fini Jastrow
f3949ee393 font-patcher: Increase version after icon shape change
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-26 12:59:04 +02:00
Fini Jastrow
9e0ca39200 font-patcher: Increase version after change
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-23 09:43:48 +02:00
Gibson Fahnestock
961fa8f8c1 font-patcher: don't double-shrink heavy angle brackets
Fixes: https://github.com/ryanoasis/nerd-fonts/issues/1611

Co-Authored-By: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-23 09:43:48 +02:00
Fini Jastrow
e5f63a3d7a font-patcher: Improve logging while setup options
[why]
The logging to files does not work correctly for the messages given
while the options themselves are parsed.

[how]
As soon as we have enough information (after the first argument parsing)
we set the logger up. When processing the config file arguments we have
a full functioning logger now.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-22 14:08:28 +02:00
Fini Jastrow
6c6177d6a5 font-patcher: Do not rely on args.configfile
[why]
We now have two places where we can detect if a config file is given.
This should be unified.

Also handling of missing (?) sections in the config file is not always
handled gracefully.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-22 14:08:28 +02:00
Fini Jastrow
098fa410a6 font-patcher: Load config file only once
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-22 14:08:28 +02:00
Fini Jastrow
378d97cf1b font-patcher: Allow to rehint some Cascadia glyphs
[why]
Some Caskaydia Cove glyphs that are used in ligatures (to create endless
arrows for example) show uneven line thickness on some platforms.

The reason is the not-matching hinting of glyphs that are places next
to each other and so minuscule differences are quite visible.

Note that the 'original' hinting is generated by VTT on the static
Cascadia Code instances, which upstream just have ttfautohint hints that
are different from the hints in the variable fonts and people complained
that the look is different.

[how]
Add a new field to the config.cfg file that holds regexes of glyph
names for glyphs that should be re-hinted by fontforge on patching time.

In principle we could also implement that as an additional pre-step that
needs to be manually done after running VTT on the static font files.

I'm not sure which is better.

Note that fontforge generates a lot of debug output because the hinting
is not ideal - the global tables are kept and probably less compatible
to fontforge's own hinting... But the results are good.

Fixes: #1291
Fixes: #1609

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-22 14:08:28 +02:00
Fini Jastrow
88d63ff827 gotta-patch-em: Correct file type of config files
[why]
The config files are called `config.json` while the contents is
INI-like. The usual extension would be `.cfg`.

[how]
We use `.cfg` already for the shell variable configuration.

Combine both config file variants into one (real) cfg file, that is
directly read by the font-patcher and no shell variables files are used
anymore.

This needs some rewrite in gotta-patch-em to get the quoting right.
To make this simpler we remove the `--debug 1` option from the variable
and insert it directly (as it is applied always anyhow).

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-22 14:08:28 +02:00
Fini Jastrow
b984447921 font-patcher: Allow to specify more options in config file
[why]
At the moment we have two different config files:

config.cfg:
Is read by gotta-patch-em and allows to specify some needed
commandline options for a font-patcher run

config.json:
Is read by font-patcher and can contain ligature table removal
instructions

It would be nice to combine/unify them.

[how]
Add the possibility to add commandline options in the config.cfg
file. Of course we need commandline options to specify the config
file first, so the options are parsed in two steps.

The config.file takes precedence (if possible) over directly specified
options.

This is how the new section in the config file can look like:

[Config]
commandline: --powerlineextra --mono

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-19 14:41:48 +02:00
Finii
6fa413d6bc [ci] Bump release version 2024-04-12 14:31:51 +00:00
Fini Jastrow
ce9910a3fb Attach license to old MaterialDesignIcons font file
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-12 08:47:03 +02:00
Fini Jastrow
c90f4ef058 Add Pomicons license
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-12 08:47:03 +02:00
Fini Jastrow
066d36514c font-patcher: Correct essential glyph detection
[why]
We have two ranges of glyphs to examine:
 1. `0x0000`-`0x017f` is the Latin Extended-A range
 2. `0xfb00`-`0xfb06` are 'fi' and other ligatures

Both ranges are added to the essential glyphs (with their
sub-references, and with other glyphs that are referenced through
possub rules).

That is correct for range 1, but range 2 - the ligature glyphs - should
only become essential if they are indeed used for ligatures by some
rule.

For example with the UbuntuMono font, that does not have any fi ligature
natively, but it DOES have a filled `0xFB01` glyph, we would protect
that glyph and its subreferences (i.e. `0xF001`) - needlessly breaking
the Font Awesome icons in that font.

[how]
Add all glyphs of range 1 to the essential glyphs, but add glyphs of
range 2 only if they have a possub rule attached.

Reported-by: Eli Array Minkoff <eli@planetminkoff.com>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-10 08:07:03 +02:00
Fini Jastrow
84140625a3 font-patcher: Correct essential ligatures
[why]
The essential glyphs are partially based on which substitution rules
the font has.

And the config.json configuration is able to remove some substitution
rules.

So we must first possibly remove rules and then examine them, not the
other way around, because now we detect 'essential glyphs' for rules
that we later remove.

[how]
Correct order of operation.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-10 08:07:03 +02:00
Finii
1895050935 [ci] Bump release version 2024-04-04 07:53:24 +00:00
Fini Jastrow
92c5b0f3e0 Update Font Logos to 1.2.0
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-02 20:38:36 +02:00
Fini Jastrow
f089ee8a6e Font Awesome: Update to 6.5.1
This does not pull in all icons of 6.5.1, but only of
'Region A' and 'Region B', see script `remix` and
PR #1563.

It keeps the codepoints constant for existing icons.

Fixes: #1550

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-02 18:24:46 +02:00
Fini Jastrow
09c6c8988c Add Ubuntu Sans
Prevent the "SansMono" becomes "SansM" rule for UbuntuSansMono.

Fixes: #1435

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-02 18:21:29 +02:00
Fini
f81f17af0d
Merge pull request #1558 from landfillbaby/master
update Intel One Mono to 1.3.0
2024-03-30 13:28:01 +01:00
Fini Jastrow
7543e4a3a8 Add inverse powerline arrow heads
Fixes: #1451

See also (merged but not released):
eb6b9721a8

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-03-29 14:10:31 +01:00
Fini Jastrow
5a958b3e96 font-patcher: Prevent excessively tall icons in mono fonts
[why]
Very slender and tall icons will be scaled huge compared to their fatter
neighbors. This happens for example to the chess pieces (E25F ff) or
text style icons like italic (EB0D).

[how]
When a monospaced font is created use a slightly less tall cell height
for all icons (except icons that have to match the actual line height).

This can be prevented by the new scale control character `^` that
symbolizes maximized vertical size (height) within the real cell.

The smaller cell (now called icon cell) is less tall than the line
height, but higher than the cap height of the font; to prevent people
complaining that the icons shrunk too much.
It is about 1/3 higher than the cap height compared to the line height.

This is NOT applied to the other Nerd Fonts fonts variants (i.e. Regular
and Propo) because all icons are generally a bit bigger than the cap
height (no scaling down to fit into one advance width) and as the
scaling is far less pronounced the slender-and-tall icons scale
comparably and do not look out off place there.

Suggested-by: Aaron Bell @aaronbell
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-03-29 13:28:05 +01:00
Lucy Phipps
0c2a028715
update Intel One Mono to 1.3.0 2024-03-25 15:35:08 +00:00
Fini Jastrow
5e2858670e Increase Powerline overlap (only rounded)
[why]
We still fight with the faint lines on the big side of the powerline
glyphs. They come from the LCD antialiasing mode that has problems with
the borders.

Other fonts use far more overlap. We use only a modest amount of overlap
(1% of the width).

[how]
As the other fonts do, increase the overlap (to 6% now).

Add full-hight 'landing platforms' on the outsides of the glyphs,
which are 7% wide.

Related: a8b9e1da06
Related: #1245

Fixes: #1547

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-03-20 16:39:03 +01:00
Fini Jastrow
cd9f49041f Move PowerlineExtra into subdirectory
And add meta information.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-03-20 16:38:44 +01:00
Fini Jastrow
50eae52aea Devicons: Add proper attribution
[why]
The font file is not changed, it is still the 9 year old file.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-03-19 00:45:01 +01:00
Fini Jastrow
a0b080abaf name_parser: Fill short and long name as TypoFamily
[why]
This sets out to circumvent a problem with VisualStudio 2022. That
application seems to have problems with fonts when the ID16 is not a
prefix in ID1.

We have this when --makegroups >= 4, because

ID1  has the short name suffix 'NF'
ID16 has the long suffix 'Nerd Font'

These fonts can be selected in VisualStudio 2022, and the preview works
ok, but once active some replacement default font is used instead.

The problem vanishes if ID16 and ID1 have the same stem, or rather ID1
has someting added on top of ID16; but ID16 is a substring of ID1.

See more discussions in #1442

[how]
Write both forms in ID16 fields, 'NF' and 'Nerd Font' suffixes. This
works as long as the application considers all languages equal.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-03-17 20:36:52 +01:00
Fini Jastrow
d907552970 font-patcher: Include new codicons and scale group icons
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-03-16 10:26:40 +01:00
Fini Jastrow
d45ff3da75 font-patcher: Increase version
[why]
Forgot to increase with commit 136a84bc03.

Now we also have different original icons, lets have a new number.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-03-16 02:04:45 +01:00
Fini Jastrow
136a84bc03 font-patcher: Fix Octicon scaling groups
[why]
The Octicon scaling group has two errors, one is a typo (the first digit
of a number is missing), and the second is off by one for some reason.

Reported-by: @aaronbell
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-03-14 08:01:20 +01:00
Fini Jastrow
393c66684b font-patcher: Fix debug format string
[why]
The format string is invalid and results in a runtime error if that
particular warning is issued (which is only the case for Terminus).

[how]
A verbatim percent sign must be encoded as '%%'.

[note]
This has already been fixed before with commit
  f81564fad  font-patcher: Fix typo in logger output

but the change has been lost by rebasing :-(

See also #1350

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-01-15 18:31:06 +01:00
Fini Jastrow
da4fb70b7e font-patcher: Break alternative unicode links before patching
[why]
The D2Coding font has a lot of glyphs shared between multiple unicode
codepoints.
Usually we just want to change the glyph on one particular codepoint
and not on all linked ones; which will affect codepoints not in our
patching ranges.

For example the glyph FULL BLOCK is used by codepoint 2588 and E286. In
the Exxx range they have a lot of icons, and also a full block.

[how]
Remove all links on glyphs that we are about to patch over, so that we
really just patch the codepoint we want to patch (and have no hidden
'links').

[note]
This could in principle break alts or ligs if they rely on another
codepoint that we removed. But breaking ligs is always a possibility
when patching over existing glyphs.

[note]
I checked several (not all) fonts in our repertoire, and only D2coding
is massively affected.

The only other fonts are these with 2 codepoints each:
heavy_data.ttf Removing alternate unicode on F001 (FB01)
heavy_data.ttf Removing alternate unicode on F002 (FB02)
Tinos-Regular.ttf Removing alternate unicode on F001 (FB01)
Tinos-Regular.ttf Removing alternate unicode on F002 (FB02)

Fixes: 1454

Reported-by: @hdd1013
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-01-15 18:31:06 +01:00
Fini Jastrow
19c4162241 font-patcher: Fix crash if no roman characters
[why]
When we can not detect the cell width, for example because there are no
glyphs in the range of extrended-roman that we examine, the width will
be zero and that will result in a crash later on (on rescaling).

[how]
Just abort if height or width are zero or negative.

Related: #1460

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-12-18 15:30:24 +01:00
Finii
b16e67d625 [ci] Bump release version 2023-11-26 17:49:56 +00:00
Fini Jastrow
0e30425dc6 Revert "name-parser: Revert file name change"
This reverts commit 784e892575.
2023-11-26 16:02:57 +01:00
Fini Jastrow
b0b4c34524 Monaspace: Fix naming
[why]
When shortening the rare gases names to the element symbol
Radon is named 'Rd' while it should be 'Rn'.
Atomic number 86 on the periodic table.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-11-21 11:55:54 +01:00
Finii
298f0b53ad [ci] Bump release version 2023-11-21 10:23:08 +00:00
Fini Jastrow
3146f080ec font-patcher: Increase version after new glyphs added
* Font Logos update
* Core set got two more

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-11-21 07:59:37 +01:00
hasecilu
7940f26928 Update Font Logos to 1.1.1
[why]
The font-logos project has been updated including 67 new icons, in which
are included GNU/Linux distributions, desktop environments, window
managers, desktop applications, some organizations and more.

Now the used range is F300-F372, 115 available logos.
2023-11-21 06:58:45 +01:00
Fini Jastrow
a8b9e1da06 Increase Powerline overlap (only triangle)
[why]
We still fight with the faint lines on the big side of the powerline
glyphs. They come from the LCD antialiasing mode that has problems with
the borders.

Other fonts use far more overlap. We use only a modest amount of overlap
(2% of the width).

[how]
As the other fonts do, increase the overlap (to 7% now). We could not do
that before, because we had no full-hight 'landing platforms' on the
outsides and so the triangle would look cut off at not 100% hight.

Now with the landing platforms we can increase the overlap and still
have nice looking triangles that visibly reach the top and bottom of the
line.

Implement this only for the filled triangles to see how it goes.

Related: #1245

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-11-16 18:35:53 +01:00
Fini Jastrow
784e892575 name-parser: Revert file name change
[why]
It is better to have a not-abbreviated file name so that one can make
sense out of the name parts, especially when doing a partial patch.
With the previous commit we ended up with all abbreviated names.

The filename length is hopefully not limited, at least not as severe as
the SFNT table entries.

[how]
We need to store the answers somewhere because the naming is only
understood by the FontnameParser object which we throw away soon.
As fallback we still can parse the SFNT table, for example when the old
renaming is used.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-11-11 23:59:59 +01:00
Fini Jastrow
178cda0629 font-patcher: Allow filename as naming source
[why]
With Martian Mono we have a font that uses aggressive abbreviation for
the weights and styles (two letters mostly) in all name fields. That is
very hard to parse.

[how]
Adding rules that detect these very short abbreviations might trigger in
a lot wrong places. As this is the only font that uses that we do not
want to risk that.

Instead we rewrite the filenames of the source font (Martian Mono) such
that it contains all the necessary information and add a new flag to the
patcher that allows it to use the filename as naming source.
Yes, as in days long past ;-)

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-11-11 23:57:02 +01:00
Fini Jastrow
5615d5e120 font-patcher: Increase after new core icon
[why]
After a new icon has been added to the core set we want to make that
visible via a new version number.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-10-23 13:29:40 +02:00
Fini Jastrow
99f3b20ecf font-patcher: Drop some option alternatives
[why]
It is rather confusing to have so many aliases.

[how]
Remove some long forms and some alternatives, to make the help page
easier to read.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-10-13 12:42:46 +02:00
Fini Jastrow
9bfe6d165a font-patcher: Sort and regroup help message
[why]
It can be hard to find the 'usual' options in between all the expert
options.

[how]
Regroup the options and sort them alphabetically (most of the time).
Not sure if this helps, but in my personal view this makes it easier.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-10-13 12:32:12 +02:00
Fini Jastrow
c7b7cc97bb font-patcher: Add option to force patching in box drawing glyphs
[why]
When the original font designer's idea of cell height differs from the
height we deduce the box drawing glyphs come out with the wrong size (if
we do not touch them, for example because the font already has a
complete set).

[how]
Add option that enforces patch-in of the box set.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-10-13 11:52:27 +02:00
Fini Jastrow
72fb7fb814 font-patcher: Add option to select metrics source
[why]
If the font has contradicting baseline to baseline metrics the patcher
tries to find a sane value and use that. That automatism gets it right
in most cases, but there might be fonts where the user wants a different
metric to be used.

At the moment the use would need to use `font-line` to adjust the
metrics, which is not very convenient.

[how]
Add option to select one of the metricses.
Use that metrics when setting up the patched font.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-10-13 11:52:27 +02:00
Fini Jastrow
809101da32 font-patcher: Improve weight checking
[why]
When the font does not have a PSweight string the font-patcher bugs.

[how]
Rewrite the code to be more robust against unexpected weight values.
Also make detected problems non-fatal.

Reported-by: František Hanzlík <frantisek_hanzlik@protonmail.com>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-10-07 13:02:20 +02:00
Fini Jastrow
99688c40c7 font-patcher: Introduce weight check
[why]
Windows seems to construct the font names including the PS weight.
We have some sourcefonts that are broken (i.e. have in fact different
weights but have the same PS weight and/or OS2 weight.

That raises problems with the fonts on Windows.

[how]
Check and compare all weight metadata (except CID) and issue a warning
if they differ too much. That might fail with unusual weight names,
though.

See Issue #1333 and PR #1358.

Reported-by: LeoniePhiline
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-09-27 05:46:33 +02:00