Commit graph

1308 commits

Author SHA1 Message Date
Fini Jastrow
abf3016dcf font-patcher: Allow to patch fonts without Fullname
[why]
Some CJK fonts seem to have no Fullname.

[how]
But they have a Postscript name. Use that for parsing the names.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-22 10:53:05 +02:00
Fini Jastrow
6d86114a38 Draft: Introduce a file name parser
DO NOT MERGE

[why]
A lot of the fonts have incorrect naming after patching. A completely
different approach can help to come up with a consistent naming scheme.

[how]
See bin/scripts/name-parser/README.md

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-22 10:53:05 +02:00
Fini Jastrow
d939fd4f56 Add codeclimate config
[why]
Code Climate configuration for Python is per default rather restrictive
and would force us to split all stuff into too many files.

[how]
Have some faith in the cognitive capabilities of people.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-22 10:53:05 +02: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
80568d957c Remove obsolete symbol only fonts
[why]
Not sure why they are here, all patched fonts reside now in the
`patched-fonts/` folder.

So we have two times two different symbols only font sets?

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
c5878d44db font-patcher: Ignore PPEM for non ttf/otf fonts
[why]
When the source font does not have a HEAD table (i.e. is not a ttf/otf
font but for example a sfd) we can not copy the PPEM and flag values.
The patcher crashes.

[how]
Just put the code into a try block. We could check the signature
instead, but this would add more and complex code.

Reported-by: Jakub Jirutka <jakub@jirutka.cz>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-20 18:29:13 +02:00
Fini Jastrow
189bc8673f CI: Check file checksum and lowestRecPPEM on sample patched font
[why]
We 'manually' patch the font file after `fontforge` created it. This can
go wrong, for example we fail to create a correct new checksum.
Or we fail to patch the correct font property.

[how]
Also build `showttf` from the `fontforge` package and use it to extract
some font properties:
* Check the example patched font file checksum
* Compare the `lowestRecPPEM` of source to patched font file

[note]
`fontforge` set `lowestRecPPEM` always to 8 in generated fonts.
Hack has a value of 6.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-20 18:29:13 +02:00
Fini Jastrow
40138bee9f font-patcher: Handle lowestRecPPEM
[why]
Some fonts set specific lower resolutions and handle the small rendering
very nicely. But fontforge does not copy that information when it opens
a font; rather some default values are always written. That can destroy
the small font rendering.

The responsible settings are the 'ppem_to_int' flag and the
'lowestRecPPEM' setting, both in the HEAD table.

[how]
After successfully patching and generating the new font we copy that
settings over from the source font.

Instead of using fontTools (and thereby requiring all users to pull that
dependency) we handle the raw font file changes ourselves.

Fixes: 612

Reported-by: nojus297
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-20 18:29:13 +02:00
Fini Jastrow
85324cc59a font-patcher: Fix wrong argument for postprocess
[why]
When the patched font does not have a fullname (which can never happen)
the postprocess is called with a wrong filename.

[note]
Also output the file name of the patched font, for easier access by the user.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-20 18:29:13 +02:00
Fini Jastrow
89907120d9 CI: Add Lilex to release
[why]
Lilex is missing from the 2.2.0 RC and is not automagically patched.

[how]
Add Lilex to the font metadata database :->

[note]
Lilex's licence has no RFN given.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-20 18:28:04 +02:00
Finii
efca3b7ff3 Rebuilds patched fonts 2022-08-19 16:52:56 +00: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
2050b4dc16 CI: Fix patch-em-all: Purge destination dirs if possible
[why]
The purged (obsolete) files are still existing after release.

[how]
We restore the deleted files before it adds the new ones.
Just delete all font files and then download all the release files (all
newly created fonts).

`git add` on a directory will remove all missing files.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-19 13:24:39 +02:00
Fini Jastrow
6e392c0b35 CI: Cache self-built fontforge for all steps
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-19 13:24:39 +02:00
Fini Jastrow
d43e6ea267 CI: Update action/checkout to v3
[why]
* Automatically does a shallow checkout, what we want anyhow
* Keep up to date

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-19 13:24:39 +02:00
Fini Jastrow
f4f890960d CI: Use fontforge March 2022 to create patched fonts
[why]
Fontforge 2020 March or 20th Anniversary have problems to generate fonts
with a lot of table entries. This is for example the massive entries for
ligatures in Iosevka. We can not generate valid font files with that
fontforge versions. We can not even detect (from Python side) if
fontforge had problems.

[how]
We fixed fontforge itself upstream with
  https://github.com/fontforge/fontforge/pull/4883

That fix became available first with Fontforge March 2022 Release.

We could use the AppImage or build from scratch, because no package is
available on Ubuntu 20.04 or 22.04.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-19 13:24:39 +02:00
Finii
4e00c14343 Rebuilds patched fonts 2022-08-18 15:21:07 +00:00
Frank Hinek
7c5c4d7eea Install fontforge pkg from community branch
The Alpine Linux package repository no longer contains the `fontforge` package for x86 and ARM architectures in the `edge/testing` branch.

This commit updates the Dockerfile to install the `fontforge` package from the `edge/community` branch to resolve the failing Docker builds.
2022-08-18 12:49:45 +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
fbe07b8abb Fix Noto too wide
[why]
The 'monospace' width is determined by examining all the 'normal' glyphs
and taking the widest one.

'Normal' means 0x00-0x17f: the Latin Extended-A range.

Unfortunately Noto has the '1/2', '1/4', '3/4' that are all wider then the
normal (i.e. letter) glyphs.

[how]
Exclude a small sub-range from the 'find the widest glyph' that contain
no glyphs one would call 'letter'.

Fixes: #610

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-18 11:20:19 +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
34fda84b2d Update Font Logos to 1.0.1
[why]
That release contains a bugfix:
https://github.com/lukas-w/font-logos/issues/82

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-18 11:16:44 +02:00
Fini Jastrow
f9f3612e80 Update Font Logos to 1.0.0
[why]
Before Font Logos 1.0.0 there was no stable-codepoint guarantee, and the
later revisions (0.18) reassigned the codepoints. That makes updating
for us very hard, because we would have to resort the icons or follow
the codepoint changes.

With 1.0.0 this changed. That new major release introduced not only a
codepoint guarantee, but it also shifted the codepoints from the F100
region to the F300 region, where we put them anyhow (in most cases).
That is one subset less with 'dynamic base codepoint'.

The reassignment of codepoints in Font Logos kept the codepoints stable
for the icons we already have in release 2.1.0. But at the moment the
2.2.0 Release Candidate (which updated Font Logos with commit 557b8da)
have added glyphs, which are on different points as compared with the
Font Logos 1.0.0 release.

What I want to say, we need to get this straight, before our 2.2.0 RC
turns into a Release 2.2.0.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-18 11:16:44 +02:00
Fini Jastrow
6e37782fcf CI: Correct release script call to patch-em-all
[why]
The font matix contains the directory names of the font files. The
directory names are taken from
  bin/scripts/lib/fonts.json
and specifically extracted with
  bin/scripts/get-font-names-from-json.sho

That script returns the .folderNames

Later in the release script we use the folder name to limit the fonts
that patch-em-all shall process. Unfortunately patch-em-all could (until
the previous commit) just work with font-filenames and not with
directory names. But the matrix gives us just directory names.

This is for example a problem with this fonts:
$ ll src/unpatched-fonts/BigBlueTerminal
-rw-rw-r-- 1 fini fini 25632 Jan  1 14:03 BigBlue_Terminal_437TT.TTF
-rw-rw-r-- 1 fini fini 69964 Jan  1 14:03 BigBlue_TerminalPlus.TTF

The *directory* of that fonts is correctly noted in fonts.json as
"BigBlueTerminal" but the font files do not begin with that!

[how]
Now, that patch-em-all can also filter on the directory name, we just
need to utilized that in the workflow run. If the filter shall work on
directory names the first character needs to be a slash, so we just
prepend it to name we got from the matix.

Fixes: #824

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-18 11:14:12 +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
Fini Jastrow
3234fe0caf patcher: Fix grave (backtick) zero width
[why]
In ligature-enabled environments the accent grave will be rendered as
zero width, thus overlapping with the next character (in some source
fonts).

The problem is, that the glyph type in the sourcefonts is set to 'auto',
and fontforge exports these as 'mark' - the patched font will be broken.

[how]
There is no way we can get that glyph to be 'auto', but we can force it
to be an ordinary 'baseglyph' instead, and that will be respected on
export.

Maybe I should raise an Issue at fontforge... maybe later.

Fixes: #858
Fixes: #582

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-18 11:09:25 +02:00
Finii
131cbb71c4 Rebuilds patched fonts 2022-07-26 16:33:13 +00: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
PoolOfDeath20
66b41ac750
fix(jetbrain-mono-font): installation guide (#867)
* fix(jetbrain-mono-font): installation guide

* fix(patched-fonts): moved fix to `patched`
2022-07-20 00:01:10 +02:00
Eugene Chulkov
196f78789a Fixes grammar mistakes in readme_uk.md
Fixes a big number of imprecision and grammar mistakes in current Ukrainian translation
2022-06-29 07:23:31 +02:00
Fini Jastrow
fef67f39a6 doc: Correct example patch call through fontforge [skip ci]
[why]
The readme states that one should call `fontforge` with `./fortforge`.
That means that no PATH is used, and will usually fail, because the user
is in our repo and not in the directory where the fontforge binary
resides in. And even if ... then the `font-patcher` script would be
somewhere else. That makes no sense.

[how]
Drop the `./` prefix of the `fontforge` call.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-04-27 16:23:06 +02:00
John Yeates
aabed73fdd Fix wiki link in feature request template [skip ci]
This was pointing to the vim-devicons repo.
2022-04-09 00:20:22 +02:00
John Yeates
aac427775c Point to correct wiki in bug report template [skip ci]
The Wiki link in the bug report template points to
https://github.com/ryanoasis/vim-devicons/wiki rather than the
nerd-fonts wiki. I suspect that's not intended :-)
2022-04-09 00:19:00 +02:00
moritzdietz
df6d602440 Rebuilds patched fonts 2022-02-24 10:52:57 +00:00
Moritz Dietz
58898d3587
Merge pull request #776 from moritzdietz/moritzdietz/JetBrainsMono-2.251 2022-02-24 08:42:17 +01:00
Fini
f16d5dde1b
Update issue templates (#782)
A lot of issues do not have screenshots and which glyphs are the problem has to be asked and or guessed.

Also change to newer github issue template method.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-02-18 18:22:37 -08:00
ryanoasis
c98cb457d4 Rebuilds patched fonts 2022-02-05 20:29:43 +00:00
Ryan L McIntyre
2ca9c163e2
Merge pull request #732 from ryanoasis/bugfix/monospaced-glyph-scaling
Bugfix monospaced glyph scaling
2022-02-05 09:44:12 -08:00
moritzdietz
dd5274002d
JetBrains Mono v2.251: Add unpatched fonts
Signed-off-by: moritzdietz <moritzdietz@users.noreply.github.com>
2022-02-02 18:52:06 +00:00
Ryan L McIntyre
877887cac2
Merge pull request #752 from ryanoasis/bugfix/try-to-save-ttc [skip ci]
Handle TTCs gracefully
2022-01-09 11:19:38 -08:00
Ryan L McIntyre
d2cd41e4c5 Stop gap fix for #753 [skip ci]
* set a width on the control characters for 1000-em and 2048-em so width works properly with --mono flag
* also fixes the naming
2022-01-09 03:15:45 -08:00
Ryan L McIntyre
5306b26822
Update backers.md 2022-01-05 21:23:43 -08:00
Fini Jastrow
702e4be813 font-patcher: Handle TTCs gracefully
[why]
When a True Type Collection file (.ttc) is used as font source this is
not handled and just the first file in the collection is processed and
saved. But the user is not informed.

When the target file format is True Type Collection, no file at all is
written.

These are two distinct cases, because you can in fact open a .ttc and
save the first font (patched) when specifying a different extension via
`-ext`. Or open a normal font and specify `ttc` as extension i.e. target
file format.

[how]
Check if a collection is to be opened. As we currently have no code to
loop through all fonts (and just the first font is processed) a message
is issued and we exit. Typically a user would want all the fonts and
would have to 'explode' the collection into multiple single font files
beforehand.

Prevent the target to be ttc, as that is not handled in fontforge at
all. To save TTCs a different API function is to be used. Unfortunately
fontforge does not care and just does nothing.

font.generateTtc() would have to be used with ttc extensions...

Anyhow. As the looping through all fonts is missing anyhow, and I feel
the usefulness is very slim, we just prevent silent failures with this
commit.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-01-05 16:55:52 +01:00
ryanoasis
704336735f Rebuilds patched fonts 2022-01-04 05:43:04 +00:00
Ryan L McIntyre
d702344b51 Removes unnecessary Noto fonts that also cause long patching process and high size usage 2022-01-03 09:28:34 -08:00
Ryan L McIntyre
d2aa06473e RC: use all fonts for matrix 2022-01-03 05:50:16 -08:00