Repository: microsoft/terminal
File: src/cascadia/TerminalSettingsEditor/Appearances.cpp (C++)

Code before:
        if (!Appearance().AreFontAxesAvailable())
        {
            // if the previous font had available font axes and the expander was expanded,
            // at this point the expander would be set to disabled so manually collapse it
            FontAxesContainer().SetExpanded(false);
            FontAxesContainer().HelpText(RS_(L"Profile_FontAxesUnavailable/Text"));
        }
        else
        {
            FontAxesContainer().HelpText(RS_(L"Profile_FontAxesAvailable/Text"));
        }
    }

    void Appearances::_ViewModelChanged(const DependencyObject& d, const DependencyPropertyChangedEventArgs& /*args*/)
    {
        const auto& obj{ d.as<Editor::Appearances>() };
        get_self<Appearances>(obj)->_UpdateWithNewViewModel();
    }

    void Appearances::_UpdateWithNewViewModel()
    {
        if (Appearance())
        {
            const auto& biAlignmentVal{ static_cast<int32_t>(Appearance().BackgroundImageAlignment()) };
            for (const auto& biButton : _BIAlignmentButtons)
            {
                biButton.IsChecked(biButton.Tag().as<int32_t>() == biAlignmentVal);
            }

            FontAxesCVS().Source(Appearance().FontAxesVector());
            Appearance().AreFontAxesAvailable() ? FontAxesContainer().HelpText(RS_(L"Profile_FontAxesAvailable/Text")) : FontAxesContainer().HelpText(RS_(L"Profile_FontAxesUnavailable/Text"));

            _ViewModelChangedRevoker = Appearance().PropertyChanged(winrt::auto_revoke, [=](auto&&, const PropertyChangedEventArgs& args) {
                const auto settingName{ args.PropertyName() };
                if (settingName == L"CursorShape")
                {
                    _PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"CurrentCursorShape" });
                    _PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"IsVintageCursor" });
                }
                else if (settingName == L"DarkColorSchemeName" || settingName == L"LightColorSchemeName")
                {
                    _PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"CurrentColorScheme" });
                }
                else if (settingName == L"BackgroundImageStretchMode")
                {
                    _PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"CurrentBackgroundImageStretchMode" });
                }
                else if (settingName == L"BackgroundImageAlignment")
                {
                    _UpdateBIAlignmentControl(static_cast<int32_t>(Appearance().BackgroundImageAlignment()));
                }

Review comment (suggestion):
This was something extra I added - we could just set the entire expander to invisible if the font does not support font axes, but I figured it would be more consistent for the user if we still show the expander and just set it to disabled instead. If we feel like this is more trouble than its worth I'm happy to switch to the invisible implementation instead.

Code after:
        else
        {
            ShowProportionalFontWarning(false);
        }

        _FontAxesNames.Clear();
        const auto axesTagsAndNames = newFontFace.FontAxesTagsAndNames();
        for (const auto tagAndName : axesTagsAndNames)
        {
            _FontAxesNames.Append(tagAndName.Value());
        }

        // when the font face changes, we have to tell the view model to update the font axes vector
        // since the new font may not have the same possible axes as the previous one
        Appearance().InitializeFontAxesVector();
        if (!Appearance().AreFontAxesAvailable())
        {
            // if the previous font had available font axes and the expander was expanded,
            // at this point the expander would be set to disabled so manually collapse it
            FontAxesContainer().SetExpanded(false);
            FontAxesContainer().HelpText(RS_(L"Profile_FontAxesUnavailable/Text"));
        }
        else
        {
            FontAxesContainer().HelpText(RS_(L"Profile_FontAxesAvailable/Text"));
        }
    }

    void Appearances::_ViewModelChanged(const DependencyObject& d, const DependencyPropertyChangedEventArgs& /*args*/)
    {
        const auto& obj{ d.as<Editor::Appearances>() };
        get_self<Appearances>(obj)->_UpdateWithNewViewModel();
    }

    void Appearances::_UpdateWithNewViewModel()
    {
        if (Appearance())
        {
            const auto& biAlignmentVal{ static_cast<int32_t>(Appearance().BackgroundImageAlignment()) };
            for (const auto& biButton : _BIAlignmentButtons)
            {
                biButton.IsChecked(biButton.Tag().as<int32_t>() == biAlignmentVal);
            }

            FontAxesCVS().Source(Appearance().FontAxesVector());
            Appearance().AreFontAxesAvailable() ? FontAxesContainer().HelpText(RS_(L"Profile_FontAxesAvailable/Text")) : FontAxesContainer().HelpText(RS_(L"Profile_FontAxesUnavailable/Text"));

            _ViewModelChangedRevoker = Appearance().PropertyChanged(winrt::auto_revoke, [=](auto&&, const PropertyChangedEventArgs& args) {
                const auto settingName{ args.PropertyName() };
                if (settingName == L"CursorShape")
                {