Skip to content
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 workbench.fontAliasing configuration option #30628

Merged
merged 3 commits into from
Jul 18, 2017

Conversation

priithaamer
Copy link
Contributor

Adds new workbench.fontAliasing configuration option. This sets -webkit-font-smoothing: antialiased on entire workbench in order to improve font rendering on retina screens. See the discussion in #2577

Add simple boolean configuration option that controls how fonts are being rendered in workbench.

Enabling this option in configuration results with more native feel on macOS.
@msftclas
Copy link

@priithaamer,
Thanks for your contribution.
To ensure that the project team has proper rights to use your work, please complete the Contribution License Agreement at https://cla.microsoft.com.

It will cover your contributions to all Microsoft-managed open source projects.
Thanks,
Microsoft Pull Request Bot

@msftclas
Copy link

@priithaamer, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request.

Thanks, Microsoft Pull Request Bot

Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some feedback provided.

@@ -175,6 +175,11 @@ let workbenchProperties: { [path: string]: IJSONSchema; } = {
'type': 'boolean',
'description': nls.localize('closeOnFileDelete', "Controls if editors showing a file should close automatically when the file is deleted or renamed by some other process. Disabling this will keep the editor open as dirty on such an event. Note that deleting from within the application will always close the editor and that dirty files will never close to preserve your data."),
'default': true
},
'workbench.fontAliasing': {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this setting only seems to have an impact on macOS, you should check if your are on macOS and only contribute this setting on macOS (platform.isMacintosh).

Copy link
Contributor Author

@priithaamer priithaamer Jul 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As i am just learning the code base -- are plaform dependent configuration options common? This has one side effect when using settings-sync to syncronize configuration between mac and windows machines, it'll mark "unknown" configuration properties as invalid on another platform.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priithaamer I am still trying to understand if this CSS property does anything on other OS. When I tried on Windows and Linux (through VM) I could not see a visual difference.

@@ -175,6 +175,11 @@ let workbenchProperties: { [path: string]: IJSONSchema; } = {
'type': 'boolean',
'description': nls.localize('closeOnFileDelete', "Controls if editors showing a file should close automatically when the file is deleted or renamed by some other process. Disabling this will keep the editor open as dirty on such an event. Note that deleting from within the application will always close the editor and that dirty files will never close to preserve your data."),
'default': true
},
'workbench.fontAliasing': {
'type': 'boolean',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not make more sense to expose three options as enumeration here? none, subpixel-antialiased and antialiased? I find it a bit weird to say workbench.fontAliasing: true because this implies that by default there is no font smoothing happening, which is not true. The default in Chrome seems to be subpixel-antialiased

Copy link
Contributor Author

@priithaamer priithaamer Jul 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review! That makes sense. However, I'd hide this implementation detail (direct mapping to CSS property values) from the configuration. So it is just a matter of naming the values. I'll try to come up with the names!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that makes sense.

@@ -910,6 +916,11 @@ export class Workbench implements IPartService {
this.workbenchLayout.layout();
}

private setFontAliasing(enabled: boolean) {
this.fontAliasingEnabled = enabled;
this.workbench.style('-webkit-font-smoothing', enabled ? 'antialiased' : '');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to apply this on the <body> element to make sure that really everything is covered. E.g. there are things that can draw outside of the workbench (the tweet a smile feedback dialog for example).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the correct approach here -- should it access body element from the workbench class by going up the dom tree or should i move the logic entirely to another class? As said above, i'm just getting familiar with the code -- suggestions are welcome.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priithaamer I think it is OK to do document.body to access it.

@bpasero bpasero added this to the On Deck milestone Jul 14, 2017
Support both additional "antialiased" and "none" methods on font antialiasing. Leaving subpixel-antialiased as default

See microsoft#2577
Instead of using only workbench element, apply font aliasing setting globally on entire window.

See microsoft#2577
@@ -202,6 +204,7 @@ export class Workbench implements IPartService {
private editorsVisibleContext: IContextKey<boolean>;
private inZenMode: IContextKey<boolean>;
private hasFilesToCreateOpenOrDiff: boolean;
private fontAliasing: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can make this type: private fontAliasing: 'default' | 'antialiased' | 'none'

@bpasero bpasero modified the milestones: July 2017, On Deck Jul 15, 2017
@bpasero
Copy link
Member

bpasero commented Jul 18, 2017

LGTM, thanks 👍

@bpasero bpasero merged commit 7a78eee into microsoft:master Jul 18, 2017
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants