Commit graph

42 commits

Author SHA1 Message Date
Fini Jastrow
51d698cc53 Revert "name-parser: Remove superfluous Regular from ID17"
Hmm, this is probably not what we want, but I would like to keep the
commit for future reference.

This reverts commit ecca0a4f35.
2024-04-03 16:18:46 +02:00
Fini Jastrow
7d3c59b072 name-parser: Remove superfluous Regular from ID17
We do not need "Condensed Regular" as ID17, a simple "Condensed" is
enough.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-03 16:18:46 +02:00
Fini Jastrow
8b69828c97 name-parser: Fix keep-regular rule
[why]
The keep-regular rule should add 'Regular' as weight if there is no
weight (e.g. Bold) or style (e.g. Italic).

But when a font does have neither but has a widths specifier it is also
not added.

[how]
Check for some conrete weight and not only any entry in the weight
token, because we - unfortunately - mix weights and widths in that token
set.

We do not need to check the styles because it is technically impossible
for it to comtain Regular and something else.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-03 16:18:46 +02:00
Fini Jastrow
be48f93710 name-parser: Fix style names two-language-mode
[why]
The code needlessly create two language ID17 even if ID16 is only one
entry / one languange. ID17 is always the same for both languages.

This is an example for the wrong way:

======== BlexMonoNerdFont-Text.ttf ========
SFNT Fullname      ID 4     BlexMono Nerd Font Text
SFNT Family        ID 1     BlexMono Nerd Font Text
SFNT SubFamily     ID 2     Regular
SFNT Pref Family   ID 16    BlexMono Nerd Font
SFNT Pref Styles   ID 17    ('Text', 'Text')
SFNT PS Name       ID 6     BlexMonoNF-Text
SFNT Compatible    ID 18    -
SFNT CID findfont  ID 20    -
SFNT WWS Family    ID 21    -
SFNT WWS SubFamily ID 22    -
PS fontname                 BlexMonoNF-Text
PS fullname                 BlexMono Nerd Font Text
PS familyname               BlexMono Nerd Font Text
fondname                    None

This is an example for the correct way (two ID17 when we have two ID16):

======== NotoSerifCondensedNerdFont-BlackItalic.ttf ========
SFNT Fullname      ID 4     NotoSerif Condensed NF Black Italic
SFNT Family        ID 1     NotoSerif Cond NF Black
SFNT SubFamily     ID 2     Italic
SFNT Pref Family   ID 16    ('NotoSerif Condensed Nerd Font', 'NotoSerif Cond NF')
SFNT Pref Styles   ID 17    ('Black Italic', 'Black Italic')
SFNT PS Name       ID 6     NotoSerifCondensedNF-BlackItalic
SFNT Compatible    ID 18    -
SFNT CID findfont  ID 20    -
SFNT WWS Family    ID 21    -
SFNT WWS SubFamily ID 22    -
PS fontname                 NotoSerifCondensedNF-BlackItalic
PS fullname                 NotoSerif Condensed NF Black Italic
PS familyname               NotoSerif Cond NF Black
fondname                    None

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-04-03 16:18:46 +02:00
Fini Jastrow
f9e1116859 name-parser: Simplify code
[why]
The code is rather convoluted and one can not follow what is done.

[how]
Add function that abstracts some steps away.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-03-17 20:36:52 +01:00
Fini Jastrow
a0b080abaf name_parser: Fill short and long name as TypoFamily
[why]
This sets out to circumvent a problem with VisualStudio 2022. That
application seems to have problems with fonts when the ID16 is not a
prefix in ID1.

We have this when --makegroups >= 4, because

ID1  has the short name suffix 'NF'
ID16 has the long suffix 'Nerd Font'

These fonts can be selected in VisualStudio 2022, and the preview works
ok, but once active some replacement default font is used instead.

The problem vanishes if ID16 and ID1 have the same stem, or rather ID1
has someting added on top of ID16; but ID16 is a substring of ID1.

See more discussions in #1442

[how]
Write both forms in ID16 fields, 'NF' and 'Nerd Font' suffixes. This
works as long as the application considers all languages equal.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-03-17 20:36:52 +01:00
Fini Jastrow
a5abd847e5 name_parser: Do remove non-US SFNT entries
[why]
Albeight documented in the comment not all non English-US entries are
removed but just al TO_DEL ones.

[how]
Put the conditional in the right position.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2024-03-17 20:36:52 +01:00
Fini Jastrow
1211904df1 Revert "name-parser: Unify abbreviations in family names"
This reverts commit d3ee35db8e.

The font name helper tools is kept.
2023-11-26 16:02:57 +01:00
Fini Jastrow
0e30425dc6 Revert "name-parser: Revert file name change"
This reverts commit 784e892575.
2023-11-26 16:02:57 +01:00
Fini Jastrow
784e892575 name-parser: Revert file name change
[why]
It is better to have a not-abbreviated file name so that one can make
sense out of the name parts, especially when doing a partial patch.
With the previous commit we ended up with all abbreviated names.

The filename length is hopefully not limited, at least not as severe as
the SFNT table entries.

[how]
We need to store the answers somewhere because the naming is only
understood by the FontnameParser object which we throw away soon.
As fallback we still can parse the SFNT table, for example when the old
renaming is used.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-11-11 23:59:59 +01:00
Fini Jastrow
d3ee35db8e name-parser: Unify abbreviations in family names
[why]
Because the newer Preferred/Typographic names ID 16 and ID 17 have not
a very demanding length limit we add the long form of the name
addendum (i.e. Nerd Font, Nerd Font Mono, Nerd Font Propo).

In the more restricted old names ID 1 and ID 2 we use the short forms
(i.e. NF, NFM, NFP).

This seems to be problematic with Visual Studio (Community) 2022 and the
fonts can be selected but are not really used.

The Postscript family name is never shortened which seems to be of no
consequence, but still is different than the other.

[how]
When creating the Preferred/Typographic Family (ID 16) we check the
shortening mode first and abbreviate the parts as needed and alike ID 1.

This will also change the filenames, because they base on the SFNT
table. We can not change that without changing the whole mechanism.

[note]
Also add new tool that lists all names of fonts, including the
Postscript ones.

Fixes: #1242

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-11-11 23:59:07 +01:00
Fini Jastrow
89f1325205 name_parser: Correct output on weight check
[why]
When the weight check fails for some input the reason is not shown
correctly (i.e. not the string that actually failed).

[how]
Display exactly the failed string in the warning.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-10-07 13:02:20 +02:00
Fini Jastrow
809101da32 font-patcher: Improve weight checking
[why]
When the font does not have a PSweight string the font-patcher bugs.

[how]
Rewrite the code to be more robust against unexpected weight values.
Also make detected problems non-fatal.

Reported-by: František Hanzlík <frantisek_hanzlik@protonmail.com>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-10-07 13:02:20 +02:00
Fini Jastrow
99688c40c7 font-patcher: Introduce weight check
[why]
Windows seems to construct the font names including the PS weight.
We have some sourcefonts that are broken (i.e. have in fact different
weights but have the same PS weight and/or OS2 weight.

That raises problems with the fonts on Windows.

[how]
Check and compare all weight metadata (except CID) and issue a warning
if they differ too much. That might fail with unusual weight names,
though.

See Issue #1333 and PR #1358.

Reported-by: LeoniePhiline
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-09-27 05:46:33 +02:00
Fini Jastrow
b0e5a35477 name-parser: Remove filename parsing code
[why]
Patching CartographCF-Bold.ttf creates this naming:

    Family (ID 1)      : CartographF Nerd Font Condensed
    SubFamily (ID 2)   : Bold
    Fullname (ID 4)    : CartographF Nerd Font Condensed Bold
    PSN (ID 6)         : CartographFNF-CondensedBold
    PrefFamily (ID 16) : CartographF Nerd Font
    PrefStyles (ID 17) : Condensed Bold

    CartographF Nerd Font Condensed Bold
    \===> 'CartographFNerdFont-CondensedBold.ttf'

[how]
The font-patcher historically used the file name of the to-be-patched
font to come up with the new name. When the FontnameParser has been
developed that mechanics has been copied at least for fallback. The
earliest tests compared old and new naming with all the filenames.

Later, when the FontnameParser has been used to really apply name
changes it has always based the parsing on the Fullname or the PSname,
because they really hold the information (or at least should hold);
while the filename might be completely random.

Still code the dealt with specific problems in FILEnames prevailed. The
Ubuntu font for example has a file name like 'Ubuntu-C.ttf', and we
needed to convert the C to Condensed.

As that requirement vanished we can drop all the code that has been
added specifically only for parsing the Ubuntu font filenames.

Side note: USUALLY font filenames should be roughly equal to the PSname.

Fixes: #1258

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-05-26 13:01:58 +02:00
Fini Jastrow
438843d57a FontnameParser: Fix fsSelection for --has-no-italic
[why]
For fonts that have no Italic but an Oblique - i.e. when Oblique shall
replace the Italic role in RIBBI font grouping (classic group of 4) -
that grouping fails.

This affects DejaVu on Putty.

[how]
For RIBBI grouping only the classic bits are considered. That means that
for fonts that have Oblique instead of Italic (and not additionally) we
need to set the ITALIC bit and the OBLIQUE bit. This has been
overlooked.

Cite from the specs:

> This bit, unlike the ITALIC bit (bit 0), is not related to style-linking
> in applications that assume a four-member font-family model comprised
> of regular, italic, bold and bold italic. It may be set or unset
> independently of the ITALIC bit. In most cases, if OBLIQUE is set, then
> ITALIC will also be set, though this is not required.

[note]
Also increase font-patcher version.

Fixes: #1249

Reported-by: Huifeng Shen <liaoya@gmail.com>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-05-22 13:32:11 +02:00
negset
9f6f89ae41 name-parser: Fix REGULAR bit of fsSelection
Set bit 6 (REGULAR) of fsSelection only when bit 0 (ITALIC), bit 5 (BOLD), and bit 9 (OBLIQUE) are clear.
2023-05-10 16:50:50 +09:00
Fini Jastrow
a96006a681 font-patcher: Add option to allow italic-less fonts with oblique
[why]
Because we do not know if a complete family of fonts has an italic face
we must always assume it does. To get clean RIBBI families in ID1/2 we
create a different family for the oblique slant.
But that is not needed if the font does not have an italic slant, but
just an oblique one (like Bitstream Vera and descendants).

[how]
Add new command line option for font-patcher that specifies if the
family of fonts should be patched under the assumption that there might
be an italic face (default), or if we are sure there is none (and we can
leave oblique in the RIBBI group).

This is then applied to the config.cfg files.

Note that this does not take into account any other of the known_slants.
But they are not encountered in any of our prepatched fonts.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-04-24 19:52:27 +02:00
Fini Jastrow
f603633536 name-parser: Fix Oblique handling
[why]
Oblique is not detected correctly anymore.

[how]
With commit
  ae656bad8 name-parser: Further formalize style handling

'Oblique' has been taken out of the direct 'known_names' which has been
replaced by a more detailed list of known name parts. It ended up in
known_slopes.

But known_sloped is not taken into consideration as 'weight' when parsing
the font name - no it ends up in 'rest'.

This has been obviously overlooked.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-04-24 19:52:27 +02:00
Fini Jastrow
2af746a135 name-parser: Do not shorten PS-name more than PS-family-name
[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>
2023-04-24 13:01:27 +02:00
Fini Jastrow
921fadaad9 name-parser: Unify name related error message format
[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>
2023-04-21 19:55:57 +02:00
Fini Jastrow
848ed2500a name-parser: Fix SIL replacements
[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>
2023-04-20 15:52:19 +02:00
Fini Jastrow
0265034054 name-parser: Tweak mild name shortening
[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>
2023-04-19 18:19:54 +02:00
Fini Jastrow
9be4835c29 font-patcher: Introduce less severe family name shortening
[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>
2023-04-19 15:57:50 +02:00
Fini Jastrow
725df33434 name-parser: Allow generic renaming parts
[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>
2023-04-15 21:14:00 +02:00
Fini Jastrow
909a54ab5a name-parser: Shorten 'Oblique' to 'Obl'
[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>
2023-04-15 20:57:08 +02:00
Fini Jastrow
22e7056a35 name-parser: Check font name lengths
[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>
2023-04-15 20:57:08 +02:00
Fini Jastrow
40f2f74e87 font-patcher: Use Python logging module
[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>
2023-04-15 20:57:08 +02:00
Fini Jastrow
0558b14525 CI: Fix codeclimate issues
[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>
2023-04-15 20:57:08 +02:00
Fini Jastrow
b40995275e name-parser: Rename parameters
[why]
The variables' names are not really fitting (anymore).

[how]
No functional change.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-04-15 20:57:08 +02:00
Fini Jastrow
4394824977 name-parser: Change naming behavior
[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>
2023-04-15 20:57:08 +02:00
Fini Jastrow
f99e108273 name-parser: Fix enable_short_families() with empty prefix
[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>
2023-04-15 20:57:07 +02:00
Fini Jastrow
037ab03f16 name-parser: Drop special handling for 'Windows Compatible'
[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>
2023-04-15 20:57:07 +02:00
Fini Jastrow
619214c9ee name-parser: Make PS length limit more lenient
[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>
2023-04-15 20:57:07 +02:00
Fini Jastrow
68405398bc name-parser: Remove more names
[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>
2023-04-14 08:01:12 +02:00
Fini Jastrow
784bd422d6 name-parser: Set UniqueID
[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>
2023-04-14 08:01:12 +02:00
Fini Jastrow
e97e7959d6 font-patcher: Fix unexpected 'Book' SubFamily
[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>
2023-01-13 08:41:47 +01: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
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