-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add support for numeric font weight
#6990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
37dee48
3212866
448eb80
3a3f458
15b25a5
be24a14
d8424a3
353efc4
abb3fc8
8266a6d
46e6b27
3e4942a
72044b5
4d52885
b92ef23
b125396
54005b9
09f4dd3
f67b40c
99162e5
990fa8d
f3c0356
a5cc7f8
63824c1
190aef1
091e7d3
82de3ff
59779f3
f6fcbd7
10f477f
82863fd
bff00ac
48d057f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -396,14 +396,14 @@ function getTextFont(trace) { | |
else if(weight > 250) str += ' Light'; | ||
else if(weight > 150) str += ' Extra Light'; | ||
else str += ' Thin'; | ||
} else if(parts[0] === 'Open' && parts[1] === 'Sans') { | ||
} else if(parts.slice(0, 2).join(' ') === 'Open Sans') { | ||
str = 'Open Sans'; | ||
if(weight > 750) str += ' Extrabold'; | ||
else if(weight > 650) str += ' Bold'; | ||
else if(weight > 550) str += ' Semibold'; | ||
else if(weight > 350) str += ' Regular'; | ||
else str += ' Light'; | ||
} else { // Other families | ||
} else if(parts.slice(0, 3).join(' ') === 'Klokantech Noto Sans') { | ||
str = 'Klokantech Noto Sans'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh I see, maybe not, because it has already passed through the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. No that shouldn't happen because further down we test and ensure the font is supported. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in bff00ac. |
||
if(parts[3] === 'CJK') str += ' CJK'; | ||
str += (weight > 500) ? ' Bold' : ' Regular'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Couldn't this be
family.startsWith('Open Sans')
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. That may break IE11 which is fine as of today :)