1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2025-01-06 21:49:40 +02:00

name-parser: Fix unify_style_names()

[why]
The code is obviously wrong. No effect has been seen, though.

First we check if a certain string is a key in the dict.
If it is, we retrieve the value with the string lower-cased as key.

This does not make sense.

[how]
All the keys are lower case anyhow, so the code seems unneeded. Maybe it
is a leftover. The styles that go into it _and are in the dict_ all come
from a regex-enabled search and thus are lower-cased.

Whatever, to have the correct code we use the lower-cased string for
both, checking for existance and retrieving the value - this is the only
sane approach.
Also change to dict.get() method instead of a self made if code.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2023-05-26 07:57:05 +02:00 committed by Fini
parent b0e5a35477
commit f1c2eea937

View File

@ -71,9 +71,7 @@ class FontnameTools:
#'semibold': 'Demi',
'normal': 'Regular',
}
if style_name in known_names:
return known_names[style_name.lower()]
return style_name
return known_names.get(style_name.lower(), style_name)
@staticmethod
def find_in_dicts(key, dicts):