1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2025-01-25 03:32:02 +02:00

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>
This commit is contained in:
Fini Jastrow 2022-02-06 20:58:01 +01:00 committed by Fini
parent c92396150d
commit 080a86e966
2 changed files with 2 additions and 2 deletions

View File

@ -95,7 +95,7 @@ class FontnameParser:
"""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 type(prefix) == str:
if prefix:
prefix = self._basename.startswith(prefix)
self.use_short_families = ( camelcase_name, prefix )
return self

View File

@ -52,7 +52,7 @@ class FontnameTools:
"""Flatten list of (strings or lists of strings) to a blank-separated string"""
all = []
for thing in all_things:
if type(thing) == str:
if type(thing) is not list:
all.append(thing)
else:
all += thing