[why]
It's not nessecary to shorten the PSname so much when no shortening is
in place otherwise. This has been thought of as a good idea, because
noone really cares about the PSname and we can avoid any problems. But
checking with the current set of sourcefonts and using the current
shortening options, keeping it longer is never a problem.
It would be a problem for the Fullname ID4 before, and so we always
shorten more.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The systematic evaluation of all fonts is finished and we do not need
any comparison with the old naming anymore.
This can partially replaced by something like
NERDFONTS='--debug --dry --makegroups 1' ./gotta-patch-em-all-font-patcher\!.sh -cv /iA-Writer | grep '==='
[note]
Also update query_names helper to what I used recently with length
indicators.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
We have both
iA Writer Duospace
iA Writer Duo S
These are the same fonts, Duospace is just the former name of Duo S.
Duospace is version 1.005
Duo S (and Mono and Quattro) is version 2.000
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
It is hard to grep for all naming related errors, because there is no
common format.
[how]
Make them also visually similar and error cases easily spotted.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
After skipping the creation of 'Windows Compatible' fonts we have room
to finally add 'Nerd Font Propo' to the release patch sets as first
class citizen.
[note]
Also add undocumented feature that environment variable $NERDFONTS can be
used to supply additional or differing options (last option wins).
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The fonts generated with --makegroups work on all platforms, so there is
no need for options --windows and --also-windows anymore.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Some fonts have so long base names that we can not, even very
abbreviated as 'NF', add the Nerd Font designator anymore.
In this case we need to rename the font even if it has no RFN just to
make it shorter.
[note]
As '(TTF)' is dropped now from Terminus we do not need to handle it
specifically anymore.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
If the font name is changed in a way where it now ends in a blank (for
example because 'Name Momo' got 'Momo' dropped: 'Name '), that blank is
not removed immediately.
Well, it is later on, but anyhow.
This can only happen on malformed SIL entries. But we want to have a
correct replacement anyhow.
[how]
Remove trailing whitespace after replacements.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
CodeClimate does not allow 'complicated' functions. In a previous commit
we added more if-s to a function that afterwards was rejected by
CodeClimate. To fix that the if-s have been replaced with arithmetic.
That is
a) less readable than if-s
b) has a bug
[how]
Change the code back to if-s but put them into yet another function.
Hopefully we do not blow up CodeClimate's maximum number of functions
per file limit now...
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The shortened name is not as expected "BigBlueTerminal437 Nerd Font"
but some obscure "c7 Nerd Font".
[how]
The backreference marker `\1` is directly in front of the string `437`
which yields the replacement `\1437`. Python is not smart enough to
correctly handle that (but 'sed' for example is).
Instead use a named backreference which does not clash with the
following digits.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
When we have a weight/width that can take a modifier, and a modifier is
present we always take the shortest form of the weight/width.
This is not how it is customarily done.
Experienced:
ExtraCondensed ExtraBold -> ExtCd ExtBd
Expected:
ExtraCondensed ExtraBold -> ExtCond ExtBd
[how]
In case a modifier is present:
Use the shortest form for weights.
Use the longer short form for widths.
[note]
Also circumvent CodeClimate issue by replacing if-s with formulas.
And adding one nonsense entry to the data tables, because they were
too 'similar' :rolleyes:
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
We want to keep "Nerd Font" in the font name if possible and instead
shorten the weight part with accepted abbreviations. But these abbrevs
are hard to read and sometimes a more mild abbreviating might be
sufficient to get the desired name length.
[how]
Introduce a new shortening method for the weight parts of a family name.
It takes a longer word (often un-shortened) when a weight stands on its
own, but when a modifier is used together with the weight the more
aggressive two-letter abbreviations are used.
That new shortening method becomes the default and all the functions get
a new parameter to enforce completely aggressive shortening, i.e. always
use the shortest possible form.
The new way to shorten is exposed all the way out to the font-patcher
user who can select the shortening method as parameter to the
--makegroups option. That option is undocumented because I expect some
changes later on, still.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Some name parts occur in several fonts but they take too much length
that we need to add 'Nerd Font' to the font name.
This can be handled as 'generic' SIL table parts, but the algorithm
stops searching for replacements one it has found one.
[how]
Always evaluate all rules of the SIL table.
Add entries for generics to the SIL table.
Add rule for BigBlueTerminal (437TT).
Also fix rule for MPlus that underwent a naming change with its update.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
In a lot fonts when Oblique is moved to the base part of the name the
family gets too long. Since the base part is never shortened it will
stay there and make some fonts will end up with too ong bas families:
DejaVuSansMonoOblique
IosevkaTermOblique
OpenDyslexicOblique
ProggyCleanOblique
[how]
If the name is shortened, take the short form of oblique and add that to
the base name.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The name parts of a font are rather restricted in length. Most
systems/applications do not have any problems with long strings, but
some will complain or ignore such fonts.
At the moment each font needs to be checked individually manually after
patching for length violations, which is hard.
[how]
Issue a message if one name in longer than endorsed.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The outputs while patching are very ad-hoc and not grouped
systematically.
If run via gotta-patch-em the output is hard to process afterwards
automatically.
[how]
Use the logging module which outputs the messages and also writes a
run-log with all vital information.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Cognitive burden of shorten_style_name() is 13 (allowed 9).
Duplicate code
if self.use_short_families[1]:
weights = FontnameTools.short_styles(weights)
styles = FontnameTools.short_styles(styles)
[how]
I do not really buy the duplicate code issue (but circumvent it anyway).
shorten_style_name() was really hard to grasp, maybe use of a helper
function makes it more readable.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The old naming is the reason for a lot problems. It creates a lot of
duplicate names and breaks bigger font families.
[how]
After introducing --makegroups we now enable it for all fonts.
Remove special cases from config.cfg files.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
We created two fonts, one 'normal' and one 'Windows Compatible'. The
later one used shorter names because there are some Microsoft
applications that can not work with long (family-) names.
But it would be better to have universally usable fonts, like all our
sourcefonts. It would reduce confusion and also reduce the size of
installation packages.
[how]
ID 1 (Family) family()
Unchanged
Take the short form font name. Appends depending on mode short or long
weight.
ID 2 (SubFamily) subfamily()
Unchanged
Transmogifies Oblique to Italic.
Returns long form styles (i.e. RIBBI)
ID 4 (Fullname) CFF.Fullname fullname()
Take the short form font name (instead of long).
Depending on mode take short or long styles.
This is now in line with ID 4 = ID 1 + ID 2
ID 6 (PS Fullname) CFF.FontName psname()
We limited the length to 31 characters, which is sometimes too short
to have different names for fonts of one same family.
Now we take the short forms of name suffix and styles, for example
VictorMonoNFM-BdIt
ID 16 (Typogr. Family) preferred_family()
The name itself is unchanged (short form name plus verbose suffix),
but the suppression check has been fixed to really compare the
resulting name with the ID 1 name.
ID 17 (Typogr. Subfamily) preferred_styles()
This is unchanged (long form styles) but the suppression check has been
fixed to really compare the resulting string with ID 2.
CFF.Familyname ps_familyname()
Uses ID 16 now and ID 1 as fallback. Was always ID 1 before, which is
wrong.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Specifying an empty string as prefix unexpectedly does not enable short
family names for all fonts - but for no font at all.
Usually an empty prefix matches all strings (font names).
This makes it hard to enable short families for all fonts no matter
what.
[how]
Fix detection if the prefix is False or a string.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
This just drops the 'windows compatibility' options in association with
the name parser (i.e. --makegroups') as we want to always create fonts
that work on any platform.
Note that the fonts prodused right now are NOT windows compat anymore
and you can not specify the flag. Violating 'git rules' this commit is
not working correctly. But it is easier to do this in smaller steps.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The postscript font name length limit of 31 is only present in very old
post script printers. And even then it depends on the printing method.
Some of our well knows source fonts have longer PS names (Noto etc).
And the limit exists regardless of windows or not.
[how]
Let limit depend on PS name part (font name or family name).
Remove reference to windows compat mode.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Some styles can not take modifiers. We handle the shortening as if they
can. That is not a problem but mighht be unexpected.
Do detect weights we have a fixed list, but that is missing a lot
weights that we would be able to shorten.
The shortening does not work for 'Retina', which is imho a more recent
'invention' (after the paper of the previous commit has been written).
[how]
Separate known weights and make them accessible from other functions.
Use these data tables also for weight detection.
Introduce 'Retina' in the weights table.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
We really struggle to keep the font names below the length limits. To
achieve this some styles are abbreviated. The abbreviations have been
taken from Noto and were initially used to mimic Noto's naming scheme.
But a bit shorter names would help in some instances to produce short
enough name entries. Also some styles that are used by fonts other than
Noto are not abbreviated at all.
[how]
In document [1] Adobe gives examples of very short style abbreviations.
We just implement all these.
Example: 'ExtraCondensed' now becomes 'XCn' instead of the more readable
but longer 'ExtCond' that Noto uses.
[1] https://adobe-type-tools.github.io/font-tech-notes/pdfs/5088.FontNames.pdf
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
There are some more name entries that we should rename or remove.
None of the fonts in the src/unpatched-fonts/ has these set; but in
principle a font could have it set and then we would need to handle
that.
[how]
Just remove the entries if they are existing.
Note that we do not handle NameID 25.
Also add some more comments.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
When we rename a font we should always also change the unique ID.
[how]
Take the fullname and the Nerd Font version number. In general we do not
have the version number in the NameParser object; but we have the
'Version' name and we loot the last word (which we have set to the Nerd
Font version already in the patcher) as version descriptor.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Some glyph names in the CSS/cheat-sheet/json database are wrong.
[how]
For the wheather icons: Check against the glyph names in the original
repo's CSS.
For the Octicons: Check against glyph name in the symbolfont.
Did not check all glyphs, just the two reported ones.
Fixes: #1146
Reported-by: page-down
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Somebody might want to have a file where all symbols we add are listed.
At the moment there are only the i_*.sh scripts and the CSS files. Both
are rather unwieldy.
[how]
Just create a json file with all symbol names, like the CSS file.
Fixes: #448
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The last missing powerline-extra glyphs should also be in this set.
The intermediate line's color is not visible in some terminals.
[note]
Also fix that E0CF is shown twice.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
When testing 'Nerd Font' fonts (i.e. symbols may be 2 cells wide),
the output does not take that into account and does not insert
the needed blanks.
[how]
Because the actual width can not be easily determined add a
parameter (just add anything as parameter) to switch some glyphs
to two cell mode. These glyphs are in a list, i.e. hardcoded.
If the widths in non-Mono fonts is ever changed this script needs
to be adapted.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
On MacOS Ventura the unicode codepoints are shown instead of the actual
glyphs.
[how]
On that OS the bash is rather old and does not have the unicode escape
sequence \u. As it is rather hard to convert it to octal UTF8 we instead
embed simply the concrete characters, as done in the i_*.sh scripts.
Note: zsh on that OS does have it, though.
[note]
I'm no Mac expert, just trying to get this working.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The left side wave is also used on the right side.
The right side wave is never shown.
[how]
Well,...
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
In the CI we have only a shallow clone of the repo, so access to tags is
not possible. Instead of resulting in a nice message like '2.3.3-35' we
get an empty string.
[how]
As we have no tags we can only write the commit hash and other
information given in the only existing (i.e. last) commit:
date, author, title
It's a bit more cumbersome but one can still see from which point in the
repo the archive has been created.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
If we create the zip file not only on releases we need some better
version information inside.
We can not use the same approach with real releases, because we add the
tag at a later stage in the workflow.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
We print two times the name of the output font, and never the name of
the input font...
[how]
*cough*
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
We have an automation for adding glyphs to the original set.
If someone throws in the svg file and adds the glyph to the icons.tsv a
new original-source font is generated.
But the added glyphs are not patched in, because that would need a
change at font-patcher (adjust the end codepoint).
This can be forgotten easily.
[how]
The maximum codepoint of our own (original + seti) set is 0xE6FF. At
0xE700 the Devicons start.
The original-source generation script now checks the offset, they may
not be negative and on the positive end we may not leave our set-range.
If that happens the script fails thus the workflow fails.
Also increate the patch range in font-patcher. If there are no icons to
patch in the symbol font the codepoints are just ignored.
[note]
See also PR #1119
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The heavy angle brackets (276E and 276F) are used for a lot of prompts,
but we do not yet patch them in and a lot of fonts do not bring them
themselves.
[how]
One time rip the glyphs out from Hack and patch them in always, but
careful (do not replace existing glyph).
We take the whole set 276C - 2771.
[note]
Usually we should never again need to run the generate-extraglyphs
script, we rip them out now and they look good. Whatever Hack does with
new versions we can follow but that is optional.
Related: #1110
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The (old) Material Design Icons are to be removed.
We should communicate that on the Cheat Sheet.
[how]
See commit
4452ceee5 Add possibility to add "obsolete" to glyphs
that implements the CSS stuff to display an 'obsolete' marker.
Change the cheat-sheet generatot to actually insert the markers for the
appropriate codepoints. That is, the codepoints are not checked but the
ID.
Fixes: #1096
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Some font previews in the gh-pages are obviously wrong (showing some
fallback font).
[how]
Recreate all image previes from current master branch.
To make this more easy:
- Add commented out code that displays command to install just the
needed fonts but all the needed fonts
- Add commented out code that displays the family names of the needed
fonts - these have to be in sync with the fonts.json database
Fixes: #489
Reported-by: CosmosAtlas
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
It's a pain to have the addition of contributors automated via
all-contributors bot, but then it does not end up on the webpage.
[how]
I'm not sure it will automatically be triggered (pretty sure it will
not), but at least one can clickstart manually the workflow.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The script is not a 'proper' script with shebang.
The CONTRIBUTORS.md format changed.
We want to incorporate this as CI workflow.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
JetBrains Mono is patched without `--makegroups`, although it is
specified in the `config.cfg`.
[how]
As with the licenses the code expects a specific font directory depth.
That is violated with some fonts, for example JetBrains Mono.
The config is never found.
Compare commit
8a749ab21 patch-em-all: Fix missing licenses
Fixes: #1081
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
I'm not sure why it has been in the code like this, and I removed these
strange globs already before in some places [1].
find -name "*.[o,t]tf"
actually allows
*.otf
*.ttf
*.,tf
[how]
Remove spurious comma in all `find` calls.
Systematically.
[note]
Just some commits mentioned here:
2ace3de8e7722458821ac6817bc729e2
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>