[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>