Skip to content

Commit ccfc67c

Browse files
committed
Recognize two-word weights with space
1 parent 0c02827 commit ccfc67c

File tree

4 files changed

+11907
-11
lines changed

4 files changed

+11907
-11
lines changed

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,13 @@ module.exports = function(fonts, size, lineHeight) {
5252
style = haveStyle ? style : parts[parts.length - 1].replace(maybeWeight, '');
5353
}
5454
for (var w in fontWeights) {
55-
if (maybeWeight == w || maybeWeight == w.replace('-', '') || maybeWeight == w.replace('-', sp)) {
55+
var previousPart = parts.length > 1 ? parts[parts.length - 2].toLowerCase() : '';
56+
if (maybeWeight == w || maybeWeight == w.replace('-', '') || previousPart + '-' + maybeWeight == w) {
5657
weight = haveWeight ? weight : fontWeights[w];
5758
parts.pop();
59+
if (previousPart && w.startsWith(previousPart)) {
60+
parts.pop();
61+
}
5862
break;
5963
}
6064
}

0 commit comments

Comments
 (0)