The CI first builds the fonts and THEN calls `generate-css`.
Which was ok, previously.
But now we store the glyphnames in the font files, and they are taken
from `glyphnames.json`, and THAT is only updated with the CSS file.
So the font files will get OLD names, if the symbol fonts got updated.
For now I just manually run the `glyphnames.json` update
(`generate-css.sh`) manually now, with this commit.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The EE00 and EE03 glyphs are aligned too far to the left.
[how]
Affected are only right aligned glyphs with (negative) overlap, that
have an advance width (i.e. are member of a scale group).
Extract a new condition as variable as we need it in several places.
Use that condition also for the right alignment applicability check.
Related: #1733
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Glyphs that shall end up in two cells with xy scaling and overlap (for
example E0C0, E0C2) end up being a bit too wide.
In fact the width is the 2 cell width and 2 overlap width.
[how]
Apply the overlap (which is 'percent' factor) not on the concrete glyph
width, which is 2*cellwidth in these cases, but base it on the
one-cell-width instead.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
All the glyphs have overlap (negative bearings). That in itself is ok,
altough it (the glyph width for example) is not consistent for all
subsets.
The overlaps can interact strangely with the overlap given by the
font-patcher script.
[how]
It seems better to remove the negative bearings.
Also some glyph width are corrected (unified).
The font is then stored uncompressed now.
[note]
The script used to modify the font:
import fontforge, psMat
font = fontforge.open('src/glyphs/extraglyphs_orig.sfd')
font.encoding = 'UnicodeFull'
def adjust(f, rang, left, width):
for c in rang:
g = f[c]
if c in range(0x2599, 0x259f + 1):
plus = 0
g.transform(psMat.scale(1233/1234, 1))
if c == 0x259D or c == 0x2595:
g.width = width
g.right_side_bearing = 0
else:
g.left_side_bearing = int(g.left_side_bearing + left)
g.width = width
print('{:X} {} {} {} {}'.format(c, g.boundingBox(), g.left_side_bearing, g.width, g.right_side_bearing))
adjust(font,
[*range(0x2500, 0x2570 + 1), *range(0x2574, 0x257f + 1)],
20, 1233 + 40)
adjust(font,
range(0x2571, 0x2573 + 1),
87, 1280+127)
adjust(font,
range(0x2580, 0x259f + 1),
0, 1233)
font.generate('TEST.sfd')
font.generate('TEST.ttf')
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
It can be confusing what is or is not synced when scaling-shifting.
[how]
Add text from commit:
90bde735f font-patcher: Use ScaleGlyph BB to align glyph
Also add a new (documentary) property for the tables that can be checked
so that nothing unexpected will happen.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[note]
Glyphs taken from FiraCode; remove negative bearings and add a helper
glyphs for vertical alignment that is used for the combined boundingbox
calculation but not patched in.
Fixes: #1345
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Some glyphs in the (patched) E7B0-E7CF region seem to be too big.
[how]
The codepoints in the symbol font are 0x0100 less.
These are the "small things" that had a specific scale rule, which is
not needed anymore after we dropped these small icons and filled those
codepoints with new and bigger icons.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
$ ./generate
Program root: /usr
Reading mapping file
Found 496 entries
Unpacking Devicons archive
Mixing Vorillaz Devicons and possible fixes in
Found 1688 svgs
Bad RGB color spec: rgb(0%,0%,0%)
Bad RGB color spec: rgb(0%,0%,0%)
Bad RGB color spec: rgb(0%,0%,0%)
Bad RGB color spec: rgb(0%,0%,0%)
Using fixed svg for angularjs-plain.svg
Using fixed svg for awk-plain.svg
Bad RGB color spec: rgb(0%,0%,0%)
Using fixed svg for bash-plain.svg
Bad RGB color spec: rgb(25.882353%,12.156863%,37.254902%)
Using fixed svg for llvm-plain.svg
Bad RGB color spec: rgb(9.411765%,71.372549%,96.470588%)
Generating devicons.ttf with 496 glyphs
Generating GlyphInfo i_dev.sh
Finished
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The glyphnames in the font files are sometimes off. We take them from
the symbol source/font and ofter they are empty or even plain wrong (esp
if we move to other codepoints).
[how]
We have the list of all glyphnames that is generated by collecting all
data from the i_*.sh files. When patching we take this information now
and use it if appropriate.
Make sure the glyphname.json file is included in our zip patcher release
and also in the Docker image. It will run as before if the file can not
be found or is invalid etc.
Suggested-by: Ulices <hasecilu@tuta.io>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The right align check does produce wrong results if a proportional font
is generated.
[how]
Just skip the aspect ratio alignment re-check and leave the work to the
proportional font shifting that is done afterwards anyhow.
Fixes: #1695
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
A lot of icons that do not represent a 'weather state' but rather a
'weather event' are in the 'weather state' scaling group which scales
the icons waaaay down. This makes those icons almost unusable in stand
alone use cases.
[how]
Put all the extra icons into a new scaling group that is defined before
the weather state scaling group and thus takes precedence.
Split the final scaling group to have some icons on individual scale.
Fixes: #1708
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
There are still the annoying vertical colored lines sometimes that turn
up due to subpixel rendering.
[how]
Add "landing platforms" to the big triangular glyphs (E0B8, E0BA, E0BC,
E0BE) and flames (E0C0, E0C2).
The landing platform is approx 7% wide (based on one-cell width, assuming
the glyphs are all rendered 2 cells wide for the "xy2" ones).
Increase the overlap width for patching to 5%.
See also:
Merge request #1551
Merge request #1419
Commit 5e285867
Commit a8b9e1da
Fixes: #1629 (well, not the top problem which is unfixable)
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
After we added the possibility to process font archives (.ttc) we lost
the ability to process woff and woff2 fonts.
It seems woff(2) files show no font names in fontforge, see
https://github.com/fontforge/fontforge/issues/1964
[how]
Open woff(2) files differently.
Fixes: #1647 (further down)
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[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>
[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>
[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>
[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>
[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: #1291Fixes: #1609
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[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>
[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>
[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>
[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>
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>
[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>
[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: a8b9e1da06e5729923dabbfaea93ffff69abd067
Related: #1245Fixes: #1547
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[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>
[why]
Forgot to increase with commit 136a84bc0387406aa.
Now we also have different original icons, lets have a new number.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[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>
[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>
[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>