mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2025-01-13 03:03:33 +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:
parent
89f1325205
commit
01569cad8e
@ -289,8 +289,9 @@ class FontnameTools:
|
|||||||
""" Convert a common string approximation to a PS/2 weight value """
|
""" Convert a common string approximation to a PS/2 weight value """
|
||||||
if not isinstance(w, str) or len(w) < 1:
|
if not isinstance(w, str) or len(w) < 1:
|
||||||
return 400
|
return 400
|
||||||
|
w = w.lower().replace('-', '').replace(' ', '')
|
||||||
for num, strs in FontnameTools.equivalent_weights.items():
|
for num, strs in FontnameTools.equivalent_weights.items():
|
||||||
if w.lower() in strs:
|
if w in strs:
|
||||||
return num
|
return num
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user