Commit graph

486 commits

Author SHA1 Message Date
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
Fini Jastrow
3053972f86 font-patcher: Abort if fontforge did not generate patched font
[why]
Under certain circumjstances Fontforge can not create a font. As the API
does not give any feedback we trudge along afterwards giving confusing
messages.

One example is when the patched font contains too many glyphs.

[how]
Check if the patched font has indeed been generated and is not empty.

Fixes: #1342

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-09-23 11:25:11 +02:00
Fini Jastrow
f81564fadf font-patcher: Fix typo in logger output
Fixes: #1350

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-09-18 11:12:35 +02:00
Dennis Prazak
5d85a45a93 Add Intel One Mono 2023-07-26 15:02:27 +02:00
Fini Jastrow
12b51f51e2 font-patcher: Allow blanks in '--name'
[why]
If a user specified a name we should probably not camel-casify it.

Fixes (idea mentioned in): #1319

Suggested-by: HUMORCE
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-07-19 11:41:03 +02:00
Fini Jastrow
64cf3e9d93 font-patcher: Add option to select postscript name as name source
[why]
In the post we used these information sources to determine the name and
weights/styles of the to-be-patched font:
* The filename
* The fullname (ID 4)
* The postscriptname (ID 6)

Usually it is best to use the Fullname of a font to determine its real
name and styles/weights:

The Postscript name has the advantage to have a hyphen between name and
styles/weight; but as it can not contain blanks the correct name can not
be determined by this. To get the styles/weights back we use a list of
all possible (?!) weights and styles and sort all the string parts.

This works reasonably well and the fullname is usually best.

Not so with Input Mono Condensed. Here are its names:
ID4: "InputMonoCondensed LightIta"
IF6: "InputMonoConsensed-LightItalic"

[how]
Add option to select between fullname and postscriptname as font naming
source.

For special purposes, also allow a custom (arbitrary) name input.
If that is given the specified name will be used to name the patched
font without adding any suffix - the user has full control on the name.

Fixes: #1314

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-07-17 11:58:21 +02:00
Fini Jastrow
2f5c6ab6c6 font-patcher: Correct --makegroups help
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-07-17 11:58:21 +02:00
Fini Jastrow
98c14701b0 font-patcher: Fix command line argument specs
[why]
A lot arguments need one user supplied value, but that is not enforced.
For example
    font-patcher src/unpatched-fonts/Agave/Agave-Regular.ttf --out

results in a crash, because the needed output directory has not been
passed, but the default is also not used.

The problem is that the option is defined to take any amount of values,
includeing zero values (and more than one value).
That all does not make sense. The switch does need exactly one value.

[how]
Remove the wrong nargs specification. Instead use the default, which is
'expect one value' for the default action 'store'.

Instead of a crash the user is now presented with this output:
    font-patcher: error: argument -out/--outputdir: expected one argument

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-07-17 11:58:21 +02:00
Fini Jastrow
12bf79d5fe font-patcher: Fix unify logging calls [skip ci]
[why]
The debug messages appear two times.

[how]
Do not use the root logger as we can not get rid of it afterwards.
Instead set up a normal logger just for the startup and forget it after
we have a proper logger.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-06-14 08:39:14 +02:00
Fini Jastrow
df626d3440 font-patcher: Unify logging calls [skip ci]
[why]
Usually the variable `logger` holds the logger object and all logging
calls got through that.

But because we use the font filename as loggername that logger object
can only be set up after the arguments have been parsed. If some
messages are to be logged before the call needs to go to the root logger
called as `logging` class.

This means one needs to take `logger` or `logging` based on the time
when someting is to be logged. That can be confusing and is easily
wrong, especially if code is shifted.

[how]
Always use the `logger` variable and just let that point to the root
logger until we set up a concrete logger.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-06-06 08:31:57 +02:00
lolicon0930
d3856031c8 Fix typo in font-patcher. 2023-06-06 08:31:57 +02:00
Finii
ef6fe05754 [ci] Bump release version 2023-06-04 20:32:30 +00:00
Fini Jastrow
8fc3a7c15a font-patcher: Add option to suppress renaming
[why]
Sometimes a user might want to keep the original name.

This is escpecially true as Visual Studio seems to look at the font
names directly and enables special handling for 'Cascadia Code'.
Users might want to self-patch without renaming.

[how]
Add additional value to makegroups option.

That option should probably be renamed into 'naming scheme' or
something, as it is not really a fitting description of what it does.

Fixes: #1242 (some aspect of it)

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-06-04 13:24:52 +02:00
Fini Jastrow
decb6d0e3d font-patcher: Fix crash when no xavgwidth data available
[why]
When we did not collect xavgwidth data for some font and want to tweak
it the font-patcher crashes.

[how]
Check if we have a number before accessing it in the array.

[note]
This happens when font_patcher.patch() has not been called.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-06-04 13:24:52 +02:00
Fini Jastrow
7a31c67670 font-patcher: Fix wrong data source
[why]
For tweaking we use the self.sourceFont, but in the loop the real
correct value is the local sourceFont. Usually it's the same, but from a
logical standpoint this is wrong.

The name is a bit unfortunate and C++ would have generated a warning.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-06-04 13:24:52 +02:00