-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Detect likely Powerline fonts, add a special powerline preview #15365
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
fbf78ca
Detect Powerline fonts, and add a powerline preview?
DHowett 1c89407
Update src/cascadia/TerminalSettingsEditor/PreviewConnection.cpp
DHowett e38c09e
Add powerline to spellbot?
DHowett 3b7808c
Update src/cascadia/TerminalSettingsEditor/Profiles_Appearance.cpp
DHowett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,8 @@ ok'd | |
overlined | ||
pipeline | ||
postmodern | ||
Powerline | ||
powerline | ||
ptys | ||
qof | ||
qps | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It's worth noting that you aren't really checking for PowerLine glyphs here. This is a Private Use Area, and this particular range has been used for Cirth characters in the ConScript Unicode Registry for the past couple of decades. Admittedly there probably aren't a lot of terminal users with Cirth fonts, but it would be nice if there was a safer way to detect PowerLine fonts specifically. Could you not guesstimate that from the name or something?
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.
That was my first approach! Man, the code was a lot shorter then.
I profiled a bunch of fonts and found that there's:
I know that it'll always be "best effort", and that powerline has coöpted part of the PUA that has already been used, but... it sucks all-up no matter how you slice it.
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.
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.
My thinking was that it wouldn't matter that much if you failed to detect some nerd fonts, because they'd just get the regular preview, which isn't the end of the world. Showing the nerd font preview to someone that's using another glyph set seems like a bigger deal.
That said, I've just been looking for a Cirth font to test with, and I couldn't find any monospace variants that could reasonably be used in a terminal (I'm sure I had one in the past, but I might be misremembering that). So feel free to leave it as is. I just wanted to make sure we at least considered other options here.
Edit: @zadjii-msft I just saw your Cirth screenshot now, but I'm assuming that's not a "standard" CSUR font - it's just remapping ASCII characters as Cirth glyphs. I suspect the monospace fonts I remember using in the past were probably doing the same thing.
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 personally think the codepoint check is more robust, because that's how most terminals detect powerline glyphs anyways. VS Code for instance checks these codepoints to determine if it should increase the contrast of text or not (it won't change the colors for powerline glyphs). Basically, I believe that it's somewhat unlikely for a user to use a Cirth font and much more likely for them to use a powerline font.
Edit: And it will still work correctly for the real terminal after all. This only changes the behavior for the settings preview.