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

name_parser: Fix weight_string_to_number()

[why]
Some PS weights have a dash in the weight, like 'Extra-Light' in
Iosevka. The parser can not parse it because it expects 'ExtraLight'.

[how]
Filter out all '-' and ' ' from the PS weight string before actually
parsing the string.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2023-10-07 12:44:35 +02:00 committed by Fini
parent 89f1325205
commit 01569cad8e

View File

@ -289,8 +289,9 @@ class FontnameTools:
""" Convert a common string approximation to a PS/2 weight value """
if not isinstance(w, str) or len(w) < 1:
return 400
w = w.lower().replace('-', '').replace(' ', '')
for num, strs in FontnameTools.equivalent_weights.items():
if w.lower() in strs:
if w in strs:
return num
return None