1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2024-12-19 20:12:52 +02:00

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>
This commit is contained in:
Fini Jastrow 2023-04-07 14:30:21 +02:00
parent 037ab03f16
commit f99e108273

View File

@ -66,8 +66,8 @@ class FontnameParser:
def enable_short_families(self, camelcase_name, prefix):
"""Enable short styles in Family when (original) font name starts with prefix; enable CamelCase basename in (Typog.) Family"""
# camelcase_name is boolean
# prefix is either a string or False
if prefix:
# prefix is either a string or False/True
if isinstance(prefix, str):
prefix = self._basename.startswith(prefix)
self.use_short_families = ( camelcase_name, prefix )
return self