1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2024-12-13 17:18:37 +02:00
Commit Graph

217 Commits

Author SHA1 Message Date
Fini Jastrow
328b8a2d22 Add original-source.otf generator script
[why]
When we add a custom glyph (or want to update Seti) the process is
rather laborious and we are needed to change the font and the
accompanying `i_seti.sh` in sync.

[how]
We use a data file to map icon (svg) filenames to codepoints and
readable names.

That file is parsed and the font and info file is created (overwritten
in the repo); and could then be easily committed. This can be a CI
workflow.

Having a dedicated mapping file (`icons.tsv`) enables us to have stable
codepoints for the same symbol over time. Changes in codepoint
allocation can be checked in git.

Having the font autogenerated help guarantee that the icons are all
likely scaled. We rescale them all to the same size and mid-position.
That is not needed for font-patcher, because it rescales and shifts
again based on to-be-patched font metrics. But it certainly is better
for a view into the original-source font.

Sizes and position are still roughly equivalent to the hand positioned
glyphs.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-19 12:02:24 +02:00
Fini Jastrow
5a9b44749f Add documentation to bin/scripts/ directory
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-16 11:18:48 +02:00
Fini Jastrow
993730682a Fix i_cod.sh docu
[why]
With commits

  ef8c12e28 Document and update cheat sheet data
  bcef53dad Update cheat sheet

the README has not been updated, and i_cod.sh is still
listed as 'not existing'.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-16 10:57:58 +02:00
Fini Jastrow
3444b5755f generate-font-image-previews: Fix and Refactor [skip-ci]
[why]
The script is not running with current (i.e. year 2022) release versions
of Inkscape.

The script does not warn if a font is not installed (and creates a
garbage preview instead).

[how]
Rewrite the script that is uses Inkscape actions instead of verbs. Verbs
are already removed in Inkscape HEAD.

Check if needed font is indeed installed.

Do not generate useless Symbols Only font preview (it needs a specific
different one, I suppose).

Disable `svgo`. Maybe we should generate PNGs instead?

Change path for created images, so that it is already correct for the
gh-pages and we could use the github-pages-deploy-action to publish them.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-13 12:13:16 +02:00
Fini Jastrow
92fbcdb143 Rename 'Font Linux' to 'Font Logos'
[why]
The glyphs set's name changed, we should reflect that.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-13 08:05:14 +02:00
Fini
d45a9b29c2
Correct sankey instructions formatting 2022-09-12 17:43:00 +02:00
Fini Jastrow
6a8dc7d50a Update sankey diagram
Some icons where added to Seti (number change).
Some numbers numbers where wrong.
Add new Codicons section.

Also add new instructions how to create.

Fixes: #846

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-12 17:06:02 +02:00
Fini Jastrow
a67edd47dd generate-css: Generate full cheat sheet file [skip ci]
[why]
The script just creates the 'database' or the cheat sheet, but the
surrounding elements have to be added manually.

We do not like 'manually'.

[how]
Take the current cheat sheet code and rip top and bottom off, to glue it
to the generated 'database'.

Also change the filename like the final file would be named.

Well this is still not automated, but at least this is the first step in
that direction.

On the GH pages, there release and everyting is manual at the moment.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-11 19:56:37 +02:00
Fini Jastrow
018f006a6d generate-css: Move data files into subdir
[why]
We already have 2 data files to assemble the css file, and that clutters
the scripts/ directory; and there will come more for the cheat sheet.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-11 18:23:02 +02:00
Fini Jastrow
27225ac14a generate-css: Fix font name
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-11 17:46:18 +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
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
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
9c950dc385 [ci] Bump release version 2022-09-07 08:05:53 +00: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
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
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
aff362ab36 [ci] Bump release version 2022-08-26 22:15:32 +00:00
Finii
572221ec32 [ci] Bump release version 2022-08-26 16:44:55 +00:00
Fini Jastrow
c292e7e8c6 generate-fontconfig: Create sorted config
[why]
Even when the logical content does not change we will get a new commit
on recreation because the order can/will be different.

[how]
Put the fonts in alphabetical order in the config file.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-26 09:32:26 +02:00
Fini Jastrow
4c69402911 generate-casks: Fix separation of non-mono and mono fonts
[why]
The filter expects 'Mono' to be the last part of the font filename. With
font-patcher's --makegroups that is not the case anymore, because in
fact 'Mono' is part of the font name and the font filename ends in the
style (i.e. 'Italic').

[how]
Because we do only create 'Complete' fonts, and 'Mono' is always after
'Complete' (i.e. 'Complete Mono') for both veriants created by the
font-patcher, we can use that to select mono fonts.

[note]
Also bump script version after several changes.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-26 09:32:26 +02:00
Fini Jastrow
e188061e04 generate-casks: Fix display of currently processed font
[why]
The script shows
  # [Nerd Fonts]  Generating cask for: .
for any font it processes.

[how]
Well, the variable naming is a bit strange, maybe that is the reason for
the bug? We already have the font name in another variable, use that.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-26 09:32:26 +02:00
Fini Jastrow
e7af933fdf generate-casks: Allow to specify pattern
[why]
The CI uses the script with the font-matrix name, to regenerate the cask
of just one font. But the script is ignoring the parmeter and generates
all casks.

[how]
Allow to specify a regex pattern as first parameter and limit the
processing to that font(s), as done in archive-fonts.sh

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-26 09:32:26 +02:00
Fini Jastrow
e7722458fc archive-fonts: Fix missing readme in archive
[why]
When run on more than one font the mini-readme is only added to the
first created archive.

[how]
Remove the readme file only after all archives have been generated.

[note]
Also rewrite `find` command, to actually do some work. The formulation
was rather odd, using a shell glob to find the directories and `find` to
select one.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-26 09:32:26 +02:00
Fini Jastrow
7b81d7c84a CI: Fix version bump
[why]
This can not work.

Issue 1:
It is unspecified in which order the font matrix jobs run, so the
version number changes somewhen.

The changed (version-bumped) files are never committed and written back,
so this would have to be done manually anyhow.

The version-bump script itself has issues because the regexes for the
change are a bit too loose and other version like strings are changes
also (like the Script Version).

Issue 2:
The script changed versions that should not be changed like the script version
in the scripts (rather than the NF release version).

In bin/scripts/generate-glyph-info-from-set.py pumping has been
forgotten/omitted completely.

[how]
In the version-bump script:
* Use more modern regex
* Instead of copying the code use a loop

Create a commit with the bumped version information in all scripts.
This can only be done with the final job, because we have a problem to
checkout the modified version with actions/checkout.

We need to bump the version on every patch job, because we need the correct
information already in the script when we patch.

[note]
This does not prevent to have multiple commits attempts that change to the same
version. But if the change is empty, no commit will be added and the
step is silently ignored.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-24 10:50:06 +02:00
Fini Jastrow
d2b94f557b CI: Use GH action to upload release files
[why]
The self-written upload-archives script is some issues, for example it
does not replace preexisting release files with new ones when a release
is re-triggered. The error messages are rudimentary at best.

[how]
Use https://github.com/softprops/action-gh-release instead.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-24 10:50:06 +02:00
Fini Jastrow
1f971c7661 name-parser: Update test results
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-22 10:53:05 +02:00
Fini Jastrow
080a86e966 name-parser: Fix Python2 compatibility
[why]
The naming has bizarre blanks strewn in sometimes,
or is all caps. For example
`C a s k a y d i a   C o v e` or
`CASKAYDIACOVE-Regular`

[how]
When run under Python2 all strings are unicode strings because
`unicode_literals` is imported by `font-patcher`.
Unfortunately the code checks for type str; but that will all become
type unicode with the import.

One check is suboptimal anyhow and can be dropped, while the other is
turned around.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-22 10:53:05 +02:00
Fini Jastrow
c92396150d font-patcher: Add FontnameParser to font-patcher.zip
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-22 10:53:05 +02:00
Fini Jastrow
20609652ea name-parser: Specify python version
[why]
Sometimes scripts can not be run.

[how]
Depending on installed python versions and 'alternatives' setup the
script's shebang needs to point to python3 of course.

Also the files need the executable bit set.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-22 10:53:05 +02:00
Fini Jastrow
49d99fe883 name-parser: Rename font-patcher option
[why]
The option `--parser` instructs `font-patcher` to come up with the font
naming by utilizing the FontnameParser object.

This sounds logical from a programmers perspective, but the option name
is not descriptive for end users of `font-patcher`

[how]
As usual naming is hard. A short but maybe more descriptive name for the
option can be `--makegroups`; as it describes what the option means for
the end user: functioning font grouping.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-22 10:53:05 +02:00
Fini Jastrow
f2e9ef6541 name-parser: Fix doc
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-22 10:53:05 +02:00
Fini Jastrow
6be4335a59 name-parser: Create more usable short (Windows) names
[why]
The fontname for Windows can be quite unusable, for example
  `CaskaydiaCoveNerdFontCompleteM-`
for several different fonts, as this is the maximum allowed length of 31
characters that is enforced.

The style/weight is completely lost.

[how]
Split the name into base and style (at a dash `-`) and just shrink the
base name. Result for example:
  `CaskaydiaCoveN-ExtraLightItalic`

Use equal approach for the PostScriptName (although it is less likely
that length limit is ever met).

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-22 10:53:05 +02:00
Fini Jastrow
cc099ec965 font-patcher: Finally set fsSelection
fontforge has an undocumented call to set the fsSelection bits.
Never rely on documentation :-(

Found this here:
https://github.com/fontforge/fontforge/issues/3174

And the readback values are actually not read from the source font, so
we do not use them.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-22 10:53:05 +02:00
Fini Jastrow
263b1693c9 font-patcher: Remove WWS names
[why]
Under certain circumstances the WWS names (Family and Subfamily) are
used to identify a font. We do not touch these SFNT table entries, so
when the font is renamed these are wrong (have the original name).
Font-grouping will go wrong then.

[how]
The typographic ('Preferred') Family and Styles are set correctly
already and they follow the WWS pattern, so the WWS fields can be (and
should) be empty. They exist to allow font grouping in the case where
the typographic names do not follow that pattern.

Remove preexisting WWS entries (because they are not needed anymore,
otherwise we would need to write the corrected new names there).

We already set the WWS bit in fsSelection that is needed:
    def fs_selection(self, fs):
        """Modify a given fsSelection value for current name, bits 0, 5, 6, 8, 9 touched"""
        [...]
        b |= WWS # We assert this by our naming process
        return b

Unfortunately we have no way (jet) to set fsSelection.

This is only the case for Iosevka for all fonts in src/unpatched-fonts.

Reported-by: Rui Ming (Max) Xiong <xsrvmy>
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
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
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
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
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