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

Group font options in the json into a single object #10433

Merged
merged 14 commits into from
Jul 1, 2021

Conversation

PankajBhojwani
Copy link
Contributor

@PankajBhojwani PankajBhojwani commented Jun 15, 2021

Summary of the Pull Request

Introduces FontConfig, an object that isolates font-related settings in our profiles

Users can now define font settings in their json as so:

"font":{
    "face": "Consolas",
    "size": 12
}

Backwards compatible with the currently expected way of defining font settings in the json, note however that upon hitting 'Save' in the SUI, these settings will be rewritten to the font-object style in the json (as above).

References

#1790

PR Checklist

  • Closes #6049
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Documentation updated. If checked, please file a pull request on our docs repo and link it here: #xxx
  • Schema updated.
  • I work here

Validation Steps Performed

Existing functionality works, new functionality works

Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

This looks great! Really just want...

  • resolution on the "remove 'font' prefix" question
  • Testing: fix the roundtrip serialization test (I guarantee you that one is failing; It's a local test)
  • Testing: add a test for handling the legacy json format. Just to make sure nobody removes that code sometime in the future.

src/cascadia/TerminalSettingsModel/FontConfig.h Outdated Show resolved Hide resolved
src/cascadia/TerminalSettingsModel/FontConfig.cpp Outdated Show resolved Hide resolved
@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jun 16, 2021
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jun 17, 2021
@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jun 23, 2021
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jun 23, 2021
@PankajBhojwani PankajBhojwani removed their assignment Jun 23, 2021
src/cascadia/TerminalSettingsModel/FontConfig.h Outdated Show resolved Hide resolved
src/cascadia/TerminalSettingsModel/FontConfig.cpp Outdated Show resolved Hide resolved
@carlos-zamora carlos-zamora added the Needs-Second It's a PR that needs another sign-off label Jun 24, 2021
@ghost ghost requested review from zadjii-msft, miniksa, DHowett and leonMSFT June 24, 2021 17:31
@DHowett
Copy link
Member

DHowett commented Jun 24, 2021

block for spec review?

Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

Ah shoot! Don't forget to update the schema and docs!!

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jun 24, 2021
@carlos-zamora
Copy link
Member

block for spec review?

Wait... which spec? #10383 seems more relevant, but is closed. And #10457 seems to just build on it.

@PankajBhojwani
Copy link
Contributor Author

PankajBhojwani commented Jun 24, 2021

block for spec review?

I thought we agreed this doesn't need a spec since its just grouping our current font options together into 1 object and doesn't add/change any current functionality (if I'm mistaken I can add it to #10457).

@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jun 24, 2021
@PankajBhojwani
Copy link
Contributor Author

Ah shoot! Don't forget to update the schema and docs!!

Thanks for the reminder! Updated schema

doc/cascadia/profiles.schema.json Outdated Show resolved Hide resolved
src/cascadia/TerminalSettingsModel/FontConfig.cpp Outdated Show resolved Hide resolved
{
}

winrt::com_ptr<FontConfig> FontConfig::CopyFontInfo(const winrt::com_ptr<FontConfig> source, const winrt::weak_ref<Profile> sourceProfile)
Copy link
Member

Choose a reason for hiding this comment

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

Taking those arguments by value will force the reference count to be incremented for the duration of the call. It's probably a good idea to just take source as a pointer or reference as you aren't storing it elsewhere for later.
Especially because the code around winrt::com_ptr::copy_from feels a bit non-obvious / roundabout to me.

Copy link
Contributor Author

@PankajBhojwani PankajBhojwani Jun 30, 2021

Choose a reason for hiding this comment

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

So this was intentionally done this way to maintain consistency with Profile::CopySettings and AppearanceConfig::CopyAppearance and I'd like to keep it this way because of that

Copy link
Member

Choose a reason for hiding this comment

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

I'm convinced that we'll have to start to clean up such code in the future though.
Isn't it quite seldom that you touch all places simultaneously to clean something up? I don't believe there's (in a rhetoric sense) "any better time to do it than now", as such house-keeping tasks will always be unrelated to any actual task by their nature.

src/cascadia/TerminalSettingsModel/FontConfig.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalSettingsModel/FontConfig.cpp Outdated Show resolved Hide resolved
@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jun 30, 2021
@carlos-zamora
Copy link
Member

Don't forget to update the docs too!

@DHowett DHowett merged commit 9b9b073 into main Jul 1, 2021
@DHowett DHowett deleted the dev/pabhoj/font_config branch July 1, 2021 17:08
@ghost
Copy link

ghost commented Jul 14, 2021

🎉Windows Terminal Preview v1.10.1933.0 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Second It's a PR that needs another sign-off
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants