mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-09-19 09:51:48 +02:00
name-parser: Sort Widths before Weights
[why] Usually we want the width before the weight: ZedMono Nerd Font Extended ExtraBold Italic but we get: ZedMono Nerd Font ExtraBold Extended Italic The reason is that we do not sort widths and weights and handle them as one list, keeping the original order. All fonts but Zed have the width before the weight and it never turned up [how] Handle widths and weights on their own and only afterwards concattenate width (first) to weights (second). Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
f2862d4475
commit
3d7aa9298c
1 changed files with 7 additions and 1 deletions
|
@ -393,8 +393,12 @@ class FontnameTools:
|
||||||
# Weights end up as Typographic Family parts ('after the dash')
|
# Weights end up as Typographic Family parts ('after the dash')
|
||||||
# Styles end up as Family parts (for classic grouping of four)
|
# Styles end up as Family parts (for classic grouping of four)
|
||||||
# Others also end up in Typographic Family ('before the dash')
|
# Others also end up in Typographic Family ('before the dash')
|
||||||
|
widths = [ m + s
|
||||||
|
for s in list(FontnameTools.known_widths)
|
||||||
|
for m in list(FontnameTools.known_modifiers) + ['']
|
||||||
|
]
|
||||||
weights = [ m + s
|
weights = [ m + s
|
||||||
for s in list(FontnameTools.known_weights2) + list(FontnameTools.known_widths)
|
for s in list(FontnameTools.known_weights2)
|
||||||
for m in list(FontnameTools.known_modifiers) + [''] if m != s
|
for m in list(FontnameTools.known_modifiers) + [''] if m != s
|
||||||
] + list(FontnameTools.known_weights1) + list(FontnameTools.known_slopes)
|
] + list(FontnameTools.known_weights1) + list(FontnameTools.known_slopes)
|
||||||
weights = [ w for w in weights if w not in FontnameTools.known_styles ]
|
weights = [ w for w in weights if w not in FontnameTools.known_styles ]
|
||||||
|
@ -408,9 +412,11 @@ class FontnameTools:
|
||||||
r'(?:uni-)?1[14]', # GohuFont uni
|
r'(?:uni-)?1[14]', # GohuFont uni
|
||||||
]
|
]
|
||||||
|
|
||||||
|
( style, width_token ) = FontnameTools.get_name_token(style, widths)
|
||||||
( style, weight_token ) = FontnameTools.get_name_token(style, weights)
|
( style, weight_token ) = FontnameTools.get_name_token(style, weights)
|
||||||
( style, style_token ) = FontnameTools.get_name_token(style, FontnameTools.known_styles)
|
( style, style_token ) = FontnameTools.get_name_token(style, FontnameTools.known_styles)
|
||||||
( style, other_token ) = FontnameTools.get_name_token(style, other)
|
( style, other_token ) = FontnameTools.get_name_token(style, other)
|
||||||
|
weight_token = width_token + weight_token
|
||||||
while 'Regular' in style_token and len(style_token) > 1:
|
while 'Regular' in style_token and len(style_token) > 1:
|
||||||
# Correct situation where "Regular" and something else is given
|
# Correct situation where "Regular" and something else is given
|
||||||
style_token.remove('Regular')
|
style_token.remove('Regular')
|
||||||
|
|
Loading…
Reference in a new issue