[why]
Sometimes we set an empty string as SubFamily name. That ends up as
'Book' which is unexpected.
[how]
The translation from empty to "Book" is done by Fontforge, at least
with version 20220308.
Make sure we always have a SubFamily, and if we don't that must be a
'Regular'.
[note]
This was only a problem with the old naming engine. --makegroups got
this right always.
Fixes: #1046
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
When the source font is proportional we can not really create a
monospaced (patched) font from it. The glyph width is for example very
small for 'i' but wide for 'W'.
The glyphs are all left aligned, leaving very strange separation between
smallish glyphs.
Even if we would center the glyphs, the look would be strange and
completely differenmt from the source font's look.
[how]
For proportional fonts do not allow to patch with `--mono`.
The fact if a source font is monospaced is determined by examining some
(very few) glyphs. But testing all our source fonts in the repo shows
that it is sufficient.
Furthermore the Panose flag is checked and differences between the flag
and what the glyph examination found are reported.
The user can enforce `Nerd Font Mono` generation with double specifying
the command line option `--mono --mono`. Still a warning will be issued.
[note]
Because `gotta-patch-em-all-font-patcher!.sh` does not really count the
variations but calculates them in a separate loop it does not know
anymore how many variations are created per family. The numbers are
wrong.
But probably we should count the result font files in the end anyhow.
Because the information is not needed (in an automated manner) this is
not corrected here.
It seems wrong anyhow:
total_variation_count=$((total_variation_count+combination_count))
total_count=$((total_count+complete_variations_per_family+combination_count))
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
For some fonts with long names the fields are not long enough and for
example a 'Mono' can not be seen.
[how]
Use same field widths as `name_parser_test2`.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[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>
[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>
[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>
[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>
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>
[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>
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>