-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add number type to fontWeight & fontWeightBold options #3062
Conversation
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.
Couple of questions
ada7aa9
to
3e0f033
Compare
As per first feedback I've changed return type of P.S. If function previously had return type P.P.S. Implementation of normalization here is different from one in VS Code. |
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.
If function previously had return type string but now it also has number in return type - can this change be counted as minor/feature change or it's major/breaking change?
Yes it is technically a breaking change but I'm fine with letting this one go into a minor patch as it's such a small thing that maybe no one would eve. I don't know when v5 will happen and we don't want to block the VS Code change until then. I checked a few apps that use xterm.js and saw Hyper uses getOption
only once for bellSound
.
@@ -56,6 +56,8 @@ export const DEFAULT_OPTIONS: ITerminalOptions = Object.freeze({ | |||
cancelEvents: false | |||
}); | |||
|
|||
const FONT_WEIGHT_OPTIONS: Extract<FontWeight, string>[] = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900']; |
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.
TIL
Fixes #3051
_sanitizeAndValidateOption
now implements custom normalization forfontWeight
&fontWeightBold
options that matches normalization from VSCode PR.This is needed because if invalid value (
7000
ornormal123
) is passes tofontWeight
when canvas or webgl rendenderer is used it will lead to really small characters.In browsers that don't support numeric values for
font-weight
property when values that doesn't match existing enum would be reset tonormal
/400
- this is current browser behavior forfont-weight
and no special logic added to handle this case. I assume that users of these browsers shouldn't won't use numeric values e.g. 350 because they don't work anyway for everything else.