-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Spec for font configuration objects #10383
Conversation
@check-spelling-bot ReportUnrecognized words, please review:
Previously acknowledged words that are now absenthpcon serializers TlgTo accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands... in a clone of the [email protected]:microsoft/terminal.git repository
✏️ Contributor please read thisBy default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
If the listed items are:
See the 🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉 🗜️ If you see a bunch of garbageIf it relates to a ... well-formed patternSee if there's a pattern that would match it. If not, try writing one and adding it to a Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines. Note that patterns can't match multiline strings. binary-ish stringPlease add a file path to the File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
|
|
||
## Future considerations | ||
|
||
Similar to the discussion we had regarding appearance configurations, we will need to figure out how we want to deal with overlapping configurations. I.e. if font configurations are defined for both bold and italic, how should font that is both bold and italic be handled? |
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.
I am tempted to say that this issue is much more pressing when it comes to fonts than it was for appearance configurations, to the point where I wonder if we should decide not to proceed further with this until we figure this out
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.
Technically, text can't be both bold and italic, right? Because terminals would only say if text should be "more bright" or "more faint", I think? But I'm also confused because the API for TextAttribute
has IsBold
and IsFaint
as two separate variables, so theoretically somebody could call SetIsBold(true)
and SetIsFaint(true)
back to back, right?
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.
Dumb idea, if text is both "more bright" and "more faint", would that mean that it negates itself and you just see text at normal brightness? In other words, would IsBold() && IsFaint()
mean that we should just use the default font config?
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.
I think text can be both bold and italic, try doing:
echo ^[[1;3m
in command prompt, you get text that's both bold and italic
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.
Oof. We almost need people to be able to define a "BoldItalic" variant too.
Are you able to detect Stylistic Sets, and display buttons to toggle them on and off when they are detected in the chosen font? |
"boldFont": | ||
{ | ||
"fontFace": "Consolas", | ||
"fontWeight": "Extra-Bold" | ||
} |
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.
wait... we can will be able to do this? Use multiple fonts within the same text buffer? (important for me to know for my a11y text attributes PR haha)
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.
You know what, let me test that out and get back to you
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.
Tested it, and short answer: yes we can have multiple fonts in the same text buffer
Long answer: there's funky stuff that goes on because of the different fonts not necessarily having the same glyph size and so the spacing becomes weird - we should be able to do some creative scaling to avoid this problem though
|
||
## Future considerations | ||
|
||
Similar to the discussion we had regarding appearance configurations, we will need to figure out how we want to deal with overlapping configurations. I.e. if font configurations are defined for both bold and italic, how should font that is both bold and italic be handled? |
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.
Technically, text can't be both bold and italic, right? Because terminals would only say if text should be "more bright" or "more faint", I think? But I'm also confused because the API for TextAttribute
has IsBold
and IsFaint
as two separate variables, so theoretically somebody could call SetIsBold(true)
and SetIsFaint(true)
back to back, right?
"fontWeight": "Normal", | ||
"fontSize": 12 | ||
}, | ||
"boldFont": |
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.
Would it make more sense visually in the JSON to imply the hierarchy with something like:
"font":
{
"face" : "Cascadia Mono",
"weight" : "Normal",
"size" : 12,
"variants": [
"bold" : {
"face" : "Consolas",
"weight" : "Extra-Bold"
},
"italic" : {
"weight" : "Light"
}
]
}
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.
Hmmmmm very interesting. Would any key in font
be available to variants
? So somebody could set font:face:Cascadia font:variants:bold:face:Consolas
?
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.
I kinda like this
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.
Hmmmmm very interesting. Would any key in font be available to variants? So somebody could set font:face:Cascadia font:variants:bold:face:Consolas?
Of the 3 keys available now, weight
, face
, and size
, only size
will be disallowed to variants (we don't want weird resizing from different parts of the text being bold or something)
|
||
### Compatibility | ||
|
||
This feature changes the way we expect to parse font settings. However, we have to make sure we are still able to parse font settings the way they are currently, so as to not break functionality for legacy users. |
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.
Do we have precedent for a settings-file-rewriter that pre-passes legacy configs and just rewrites them into the current format? (Instead of leaving multiple parse-mechanisms in the current format loader?)
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.
We don't, but it is probably a good idea.
Update: for now we are going to move away from this design and focus on how users can configure feature flags (i.e. picking stylistic sets, whether ligatures are enabled etc) and axes for their fonts. |
Summary of the Pull Request
Spec for #6049
Keeping this in draft because there are issues that need to be figured out (noted in the comments)
PR Checklist
Detailed Description of the Pull Request / Additional comments
Read the spec!