Fix font axes/features settings UI (#17164)

Due to #16821 everything about #16104 broke. This PR rights the wrongs
by rewriting all the `Font`-based code to not use `Font` at all.
Instead we split the font spec once into font families, do a lot of
complex logic to split font axes/features into used and unused ones
and construct all the UI elements. So. much. boilerplate. code.

Closes #16943

## Validation Steps Performed
There are more edge cases than I can list here... Some ideas:
* Edit the settings.json with invalid axis/feature keys 
* ...out of range values 
* Settings UI reloads when the settings.json changes 
* Adding axes/features works 
* Removing axes/features works 
* Resetting axes/features works 
* Axes/features apply in the renderer when saving 
This commit is contained in:
Leonard Hecker
2024-05-01 19:09:20 +02:00
committed by GitHub
parent 77087e6282
commit d3803943ca
22 changed files with 837 additions and 995 deletions

View File

@@ -349,7 +349,7 @@
"description": "Sets the DWrite font features for the given font. For example, { \"ss01\": 1, \"liga\":0 } will enable ss01 and disable ligatures.",
"type": "object",
"patternProperties": {
"^(([A-Za-z0-9]){4})$": {
"^[\\x20-\\x7E]{4}$": {
"type": "integer"
}
},
@@ -359,7 +359,7 @@
"description": "Sets the DWrite font axes for the given font. For example, { \"wght\": 200 } will set the font weight to 200.",
"type": "object",
"patternProperties": {
"^([A-Za-z]{4})$": {
"^[\\x20-\\x7E]{4}$": {
"type": "number"
}
},

View File

@@ -959,26 +959,23 @@ namespace winrt::Microsoft::Terminal::Control::implementation
if (_renderEngine)
{
std::unordered_map<std::wstring_view, uint32_t> featureMap;
if (const auto fontFeatures = _settings->FontFeatures())
{
featureMap.reserve(fontFeatures.Size());
for (const auto& [tag, param] : fontFeatures)
static constexpr auto cloneMap = [](const IFontFeatureMap& map) {
std::unordered_map<std::wstring_view, float> clone;
if (map)
{
featureMap.emplace(tag, param);
clone.reserve(map.Size());
for (const auto& [tag, param] : map)
{
clone.emplace(tag, param);
}
}
}
std::unordered_map<std::wstring_view, float> axesMap;
if (const auto fontAxes = _settings->FontAxes())
{
axesMap.reserve(fontAxes.Size());
return clone;
};
for (const auto& [axis, value] : fontAxes)
{
axesMap.emplace(axis, value);
}
}
const auto fontFeatures = _settings->FontFeatures();
const auto fontAxes = _settings->FontAxes();
const auto featureMap = cloneMap(fontFeatures);
const auto axesMap = cloneMap(fontAxes);
// TODO: MSFT:20895307 If the font doesn't exist, this doesn't
// actually fail. We need a way to gracefully fallback.

View File

@@ -10,7 +10,7 @@ Licensed under the MIT license.
#include <conattrs.hpp>
#include "ControlAppearance.h"
using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, uint32_t>;
using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, float>;
using IFontAxesMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, float>;
namespace winrt::Microsoft::Terminal::Control::implementation

View File

@@ -40,7 +40,7 @@ namespace Microsoft.Terminal.Control
Single FontSize { get; };
Windows.UI.Text.FontWeight FontWeight { get; };
String Padding { get; };
Windows.Foundation.Collections.IMap<String, UInt32> FontFeatures { get; };
Windows.Foundation.Collections.IMap<String, Single> FontFeatures { get; };
Windows.Foundation.Collections.IMap<String, Single> FontAxes { get; };
Boolean EnableBuiltinGlyphs { get; };
Boolean EnableColorGlyphs { get; };

File diff suppressed because it is too large Load Diff

View File

@@ -17,8 +17,7 @@ Author(s):
#pragma once
#include "Font.g.h"
#include "AxisKeyValuePair.g.h"
#include "FeatureKeyValuePair.g.h"
#include "FontKeyValuePair.g.h"
#include "Appearances.g.h"
#include "AppearanceViewModel.g.h"
#include "Utils.h"
@@ -28,81 +27,57 @@ Author(s):
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
struct AppearanceViewModel;
struct Font : FontT<Font>
{
public:
Font(winrt::hstring name, winrt::hstring localizedName, wil::com_ptr<IDWriteFontFamily> family) :
_Name{ std::move(name) },
_LocalizedName{ std::move(localizedName) },
_family{ std::move(family) }
{
}
hstring ToString() { return _LocalizedName; }
Windows::Foundation::Collections::IMap<winrt::hstring, winrt::hstring> FontAxesTagsAndNames();
Windows::Foundation::Collections::IMap<winrt::hstring, winrt::hstring> FontFeaturesTagsAndNames();
Font(winrt::hstring name, winrt::hstring localizedName);
WINRT_PROPERTY(hstring, Name);
WINRT_PROPERTY(hstring, LocalizedName);
private:
winrt::hstring _tagToString(DWRITE_FONT_AXIS_TAG tag);
winrt::hstring _tagToString(DWRITE_FONT_FEATURE_TAG tag);
Windows::Foundation::Collections::IMap<winrt::hstring, winrt::hstring> _fontAxesTagsAndNames;
Windows::Foundation::Collections::IMap<winrt::hstring, winrt::hstring> _fontFeaturesTagsAndNames;
wil::com_ptr<IDWriteFontFamily> _family;
};
struct AxisKeyValuePair : AxisKeyValuePairT<AxisKeyValuePair>, ViewModelHelper<AxisKeyValuePair>
struct FontKeyValuePair : FontKeyValuePairT<FontKeyValuePair>
{
AxisKeyValuePair(winrt::hstring axisKey, float axisValue, const Windows::Foundation::Collections::IMap<winrt::hstring, float>& baseMap, const Windows::Foundation::Collections::IMap<winrt::hstring, winrt::hstring>& tagToNameMap);
static bool SortAscending(const Editor::FontKeyValuePair& lhs, const Editor::FontKeyValuePair& rhs);
winrt::hstring AxisKey();
void AxisKey(winrt::hstring axisKey);
FontKeyValuePair(winrt::weak_ref<AppearanceViewModel> vm, winrt::hstring keyDisplayString, uint32_t key, float value, bool isFontFeature);
float AxisValue();
void AxisValue(float axisValue);
winrt::hstring KeyDisplayString();
const winrt::hstring& KeyDisplayStringRef();
uint32_t Key() const noexcept;
float Value() const noexcept;
void Value(float v);
int32_t AxisIndex();
void AxisIndex(int32_t axisIndex);
til::property_changed_event PropertyChanged;
void SetValueDirect(float v);
bool IsFontFeature() const noexcept;
private:
winrt::hstring _AxisKey;
float _AxisValue;
int32_t _AxisIndex;
Windows::Foundation::Collections::IMap<winrt::hstring, float> _baseMap{ nullptr };
Windows::Foundation::Collections::IMap<winrt::hstring, winrt::hstring> _tagToNameMap{ nullptr };
};
struct FeatureKeyValuePair : FeatureKeyValuePairT<FeatureKeyValuePair>, ViewModelHelper<FeatureKeyValuePair>
{
FeatureKeyValuePair(winrt::hstring featureKey, uint32_t featureValue, const Windows::Foundation::Collections::IMap<winrt::hstring, uint32_t>& baseMap, const Windows::Foundation::Collections::IMap<winrt::hstring, winrt::hstring>& tagToNameMap);
winrt::hstring FeatureKey();
void FeatureKey(winrt::hstring featureKey);
uint32_t FeatureValue();
void FeatureValue(uint32_t featureValue);
int32_t FeatureIndex();
void FeatureIndex(int32_t featureIndex);
til::property_changed_event PropertyChanged;
private:
winrt::hstring _FeatureKey;
uint32_t _FeatureValue;
int32_t _FeatureIndex;
Windows::Foundation::Collections::IMap<winrt::hstring, uint32_t> _baseMap{ nullptr };
Windows::Foundation::Collections::IMap<winrt::hstring, winrt::hstring> _tagToNameMap{ nullptr };
winrt::weak_ref<AppearanceViewModel> _vm;
winrt::hstring _keyDisplayString;
uint32_t _key;
float _value;
bool _isFontFeature;
};
struct AppearanceViewModel : AppearanceViewModelT<AppearanceViewModel>, ViewModelHelper<AppearanceViewModel>
{
public:
enum FontSettingIndex
{
FontAxesIndex,
FontFeaturesIndex,
};
struct FontFaceDependentsData
{
winrt::hstring missingFontFaces;
winrt::hstring proportionalFontFaces;
bool hasPowerlineCharacters = false;
std::array<Windows::Foundation::Collections::IObservableVector<Editor::FontKeyValuePair>, 2> fontSettingsUsed;
std::array<std::vector<Windows::UI::Xaml::Controls::MenuFlyoutItemBase>, 2> fontSettingsUnused;
};
AppearanceViewModel(const Model::AppearanceConfig& appearance);
winrt::hstring FontFace() const;
@@ -118,32 +93,46 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
Model::FontConfig LineHeightOverrideSource() const;
void SetFontWeightFromDouble(double fontWeight);
void SetBackgroundImageOpacityFromPercentageValue(double percentageValue);
void SetBackgroundImagePath(winrt::hstring path);
const FontFaceDependentsData& FontFaceDependents()
{
if (!_fontFaceDependents)
{
_refreshFontFaceDependents();
}
return *_fontFaceDependents;
}
winrt::hstring MissingFontFaces() { return FontFaceDependents().missingFontFaces; }
winrt::hstring ProportionalFontFaces() { return FontFaceDependents().proportionalFontFaces; }
bool HasPowerlineCharacters() { return FontFaceDependents().hasPowerlineCharacters; }
Windows::Foundation::Collections::IObservableVector<Editor::FontKeyValuePair> FontAxes();
bool HasFontAxes() const;
void ClearFontAxes();
Model::FontConfig FontAxesOverrideSource() const;
Windows::Foundation::Collections::IObservableVector<Editor::FontKeyValuePair> FontFeatures();
bool HasFontFeatures() const;
void ClearFontFeatures();
Model::FontConfig FontFeaturesOverrideSource() const;
void AddFontKeyValuePair(const IInspectable& sender, const Editor::FontKeyValuePair& kv);
void DeleteFontKeyValuePair(const Editor::FontKeyValuePair& kv);
void UpdateFontSetting(const FontKeyValuePair* kv);
// background image
bool UseDesktopBGImage();
void UseDesktopBGImage(const bool useDesktop);
bool BackgroundImageSettingsVisible();
void SetBackgroundImageOpacityFromPercentageValue(double percentageValue);
void SetBackgroundImagePath(winrt::hstring path);
void ClearColorScheme();
Editor::ColorSchemeViewModel CurrentColorScheme();
void CurrentColorScheme(const Editor::ColorSchemeViewModel& val);
void AddNewAxisKeyValuePair();
void DeleteAxisKeyValuePair(winrt::hstring key);
void InitializeFontAxesVector();
bool AreFontAxesAvailable();
bool CanFontAxesBeAdded();
void AddNewFeatureKeyValuePair();
void DeleteFeatureKeyValuePair(winrt::hstring key);
void InitializeFontFeaturesVector();
bool AreFontFeaturesAvailable();
bool CanFontFeaturesBeAdded();
WINRT_PROPERTY(bool, IsDefault, false);
WINRT_PROPERTY(bool, HasPowerlineCharacters, false);
// These settings are not defined in AppearanceConfig, so we grab them
// from the source profile itself. The reason we still want them in the
@@ -152,8 +141,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
// are defined in AppearanceConfig and some that are not.
OBSERVABLE_PROJECTED_SETTING(_appearance.SourceProfile().FontInfo(), FontSize);
OBSERVABLE_PROJECTED_SETTING(_appearance.SourceProfile().FontInfo(), FontWeight);
OBSERVABLE_PROJECTED_SETTING(_appearance.SourceProfile().FontInfo(), FontAxes);
OBSERVABLE_PROJECTED_SETTING(_appearance.SourceProfile().FontInfo(), FontFeatures);
OBSERVABLE_PROJECTED_SETTING(_appearance.SourceProfile().FontInfo(), EnableBuiltinGlyphs);
OBSERVABLE_PROJECTED_SETTING(_appearance.SourceProfile().FontInfo(), EnableColorGlyphs);
@@ -169,28 +156,24 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
OBSERVABLE_PROJECTED_SETTING(_appearance, IntenseTextStyle);
OBSERVABLE_PROJECTED_SETTING(_appearance, AdjustIndistinguishableColors);
WINRT_OBSERVABLE_PROPERTY(Windows::Foundation::Collections::IObservableVector<Editor::ColorSchemeViewModel>, SchemesList, _propertyChangedHandlers, nullptr);
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, MissingFontFaces, _propertyChangedHandlers);
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, ProportionalFontFaces, _propertyChangedHandlers);
WINRT_OBSERVABLE_PROPERTY(Windows::Foundation::Collections::IObservableVector<Editor::AxisKeyValuePair>, FontAxesVector, _propertyChangedHandlers, nullptr);
WINRT_OBSERVABLE_PROPERTY(Windows::Foundation::Collections::IObservableVector<Editor::FeatureKeyValuePair>, FontFeaturesVector, _propertyChangedHandlers, nullptr);
private:
void _invalidateFontFaceDependents() { _fontFaceDependents.reset(); }
void _refreshFontFaceDependents();
Editor::AxisKeyValuePair _CreateAxisKeyValuePairHelper(winrt::hstring axisKey, float axisValue, const Windows::Foundation::Collections::IMap<winrt::hstring, float>& baseMap, const Windows::Foundation::Collections::IMap<winrt::hstring, winrt::hstring>& tagToNameMap);
Editor::FeatureKeyValuePair _CreateFeatureKeyValuePairHelper(winrt::hstring axisKey, uint32_t axisValue, const Windows::Foundation::Collections::IMap<winrt::hstring, uint32_t>& baseMap, const Windows::Foundation::Collections::IMap<winrt::hstring, winrt::hstring>& tagToNameMap);
bool _IsDefaultFeature(winrt::hstring featureTag);
static std::pair<std::vector<Editor::FontKeyValuePair>::const_iterator, bool> _fontSettingSortedByKeyInsertPosition(const std::vector<Editor::FontKeyValuePair>& vec, uint32_t key);
void _generateFontAxes(IDWriteFontFace* fontFace, const wchar_t* localeName, std::vector<Editor::FontKeyValuePair>& list);
void _generateFontFeatures(IDWriteFontFace* fontFace, std::vector<Editor::FontKeyValuePair>& list);
Windows::UI::Xaml::Controls::MenuFlyoutItemBase _createFontSettingMenuItem(const Editor::FontKeyValuePair& kv);
void _notifyChangesForFontSettings();
void _deleteAllFontSettings(FontSettingIndex index);
Model::AppearanceConfig _appearance;
winrt::hstring _lastBgImagePath;
std::wstring _primaryFontName;
std::optional<FontFaceDependentsData> _fontFaceDependents;
};
struct Appearances : AppearancesT<Appearances>
{
public:
static winrt::hstring FontAxisName(const winrt::hstring& key);
static winrt::hstring FontFeatureName(const winrt::hstring& key);
Appearances();
// CursorShape visibility logic
@@ -204,12 +187,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void FontFaceBox_LostFocus(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
void FontFaceBox_SuggestionChosen(const winrt::Windows::UI::Xaml::Controls::AutoSuggestBox&, const winrt::Windows::UI::Xaml::Controls::AutoSuggestBoxSuggestionChosenEventArgs&);
void FontFaceBox_TextChanged(const winrt::Windows::UI::Xaml::Controls::AutoSuggestBox&, const winrt::Windows::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs&);
void DeleteFontKeyValuePair_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
fire_and_forget BackgroundImage_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
void BIAlignment_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
void DeleteAxisKeyValuePair_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
void AddNewAxisKeyValuePair_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
void DeleteFeatureKeyValuePair_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
void AddNewFeatureKeyValuePair_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
// manually bind FontWeight
Windows::Foundation::IInspectable CurrentFontWeight() const;
@@ -253,6 +233,4 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation
{
BASIC_FACTORY(Appearances);
BASIC_FACTORY(AxisKeyValuePair);
BASIC_FACTORY(FeatureKeyValuePair);
}

View File

@@ -17,30 +17,17 @@ import "ColorSchemesPageViewModel.idl";
namespace Microsoft.Terminal.Settings.Editor
{
runtimeclass Font : Windows.Foundation.IStringable
runtimeclass Font
{
String Name { get; };
String LocalizedName { get; };
Windows.Foundation.Collections.IMap<String, String> FontAxesTagsAndNames { get; };
Windows.Foundation.Collections.IMap<String, String> FontFeaturesTagsAndNames { get; };
}
// We have to make this because we cannot bind an IObservableMap to a ListView in XAML (in c++)
// So instead we make an IObservableVector of these AxisKeyValuePair objects
runtimeclass AxisKeyValuePair : Windows.UI.Xaml.Data.INotifyPropertyChanged
runtimeclass FontKeyValuePair
{
AxisKeyValuePair(String axisKey, Single axisValue, Windows.Foundation.Collections.IMap<String, Single> baseMap, Windows.Foundation.Collections.IMap<String, String> tagToNameMap);
String AxisKey;
Single AxisValue;
Int32 AxisIndex;
}
runtimeclass FeatureKeyValuePair : Windows.UI.Xaml.Data.INotifyPropertyChanged
{
FeatureKeyValuePair(String featureKey, UInt32 featureValue, Windows.Foundation.Collections.IMap<String, UInt32> baseMap, Windows.Foundation.Collections.IMap<String, String> tagToNameMap);
String FeatureKey;
UInt32 FeatureValue;
Int32 FeatureIndex;
UInt32 Key { get; };
String KeyDisplayString { get; };
Single Value;
}
runtimeclass AppearanceViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
@@ -56,27 +43,21 @@ namespace Microsoft.Terminal.Settings.Editor
void ClearColorScheme();
ColorSchemeViewModel CurrentColorScheme;
Windows.Foundation.Collections.IObservableVector<ColorSchemeViewModel> SchemesList;
IObservableVector<ColorSchemeViewModel> SchemesList;
String MissingFontFaces { get; };
String ProportionalFontFaces { get; };
Boolean HasPowerlineCharacters { get; };
void AddNewAxisKeyValuePair();
void DeleteAxisKeyValuePair(String key);
void InitializeFontAxesVector();
Boolean AreFontAxesAvailable { get; };
Boolean CanFontAxesBeAdded { get; };
Windows.Foundation.Collections.IObservableVector<AxisKeyValuePair> FontAxesVector;
OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Windows.Foundation.Collections.IMap<String COMMA Single>, FontAxes);
IObservableVector<FontKeyValuePair> FontAxes { get; };
Boolean HasFontAxes { get; };
void ClearFontAxes();
Object FontAxesOverrideSource { get; };
void AddNewFeatureKeyValuePair();
void DeleteFeatureKeyValuePair(String key);
void InitializeFontFeaturesVector();
Boolean AreFontFeaturesAvailable { get; };
Boolean CanFontFeaturesBeAdded { get; };
Windows.Foundation.Collections.IObservableVector<FeatureKeyValuePair> FontFeaturesVector;
OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Windows.Foundation.Collections.IMap<String COMMA UInt32>, FontFeatures);
IObservableVector<FontKeyValuePair> FontFeatures { get; };
Boolean HasFontFeatures { get; };
void ClearFontFeatures();
Object FontFeaturesOverrideSource { get; };
OBSERVABLE_PROJECTED_APPEARANCE_SETTING(String, FontFace);
OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Single, FontSize);
@@ -106,24 +87,24 @@ namespace Microsoft.Terminal.Settings.Editor
IHostedInWindow WindowRoot;
static Windows.UI.Xaml.DependencyProperty AppearanceProperty { get; };
Windows.Foundation.Collections.IObservableVector<Font> FilteredFontList { get; };
IObservableVector<Font> FilteredFontList { get; };
Boolean ShowAllFonts;
IInspectable CurrentCursorShape;
Boolean IsVintageCursor { get; };
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> CursorShapeList { get; };
IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> CursorShapeList { get; };
IInspectable CurrentAdjustIndistinguishableColors;
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> AdjustIndistinguishableColorsList { get; };
IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> AdjustIndistinguishableColorsList { get; };
IInspectable CurrentBackgroundImageStretchMode;
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> BackgroundImageStretchModeList { get; };
IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> BackgroundImageStretchModeList { get; };
IInspectable CurrentFontWeight;
Boolean IsCustomFontWeight { get; };
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> FontWeightList { get; };
IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> FontWeightList { get; };
IInspectable CurrentIntenseTextStyle;
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> IntenseTextStyleList { get; };
IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> IntenseTextStyleList { get; };
}
}

View File

@@ -38,10 +38,29 @@
Background="{x:Bind mtu:Converters.ColorToBrush(Color)}"
CornerRadius="1" />
</DataTemplate>
<CollectionViewSource x:Key="FontAxesCVS"
x:Name="FontAxesCVS" />
<CollectionViewSource x:Key="FontFeaturesCVS"
x:Name="FontFeaturesCVS" />
<DataTemplate x:Key="FontKeyValuePairTemplate"
x:DataType="local:FontKeyValuePair">
<Grid ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind KeyDisplayString}" />
<muxc:NumberBox Grid.Column="1"
Value="{x:Bind Value, Mode=TwoWay}" />
<Button Grid.Column="2"
Click="DeleteFontKeyValuePair_Click"
Style="{StaticResource DeleteButtonStyle}"
Tag="{x:Bind (local:FontKeyValuePair)}">
<FontIcon FontSize="{StaticResource StandardIconSize}"
Glyph="&#xE74D;" />
</Button>
</Grid>
</DataTemplate>
</ResourceDictionary>
</UserControl.Resources>
@@ -190,8 +209,7 @@
Visibility="{x:Bind Appearance.IsDefault, Mode=OneWay}">
<StackPanel Margin="0,8,0,0">
<AutoSuggestBox x:Name="_fontFaceBox"
x:Uid="Profile_FontFaceBox"
<AutoSuggestBox x:Uid="Profile_FontFaceBox"
GotFocus="FontFaceBox_GotFocus"
ItemTemplate="{StaticResource FontFaceComboBoxItemTemplate}"
ItemsSource="{x:Bind FilteredFontList, Mode=OneWay}"
@@ -247,8 +265,7 @@
</local:SettingContainer>
<!-- Font Weight -->
<local:SettingContainer x:Name="FontWeightContainer"
x:Uid="Profile_FontWeight"
<local:SettingContainer x:Uid="Profile_FontWeight"
ClearSettingValue="{x:Bind Appearance.ClearFontWeight}"
HasSettingValue="{x:Bind Appearance.HasFontWeight, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.FontWeightOverrideSource, Mode=OneWay}"
@@ -284,56 +301,19 @@
</Grid>
</StackPanel>
</local:SettingContainer>
<local:SettingContainer x:Name="FontAxesContainer"
x:Uid="Profile_FontAxes"
<local:SettingContainer x:Uid="Profile_FontAxes"
ClearSettingValue="{x:Bind Appearance.ClearFontAxes}"
HasSettingValue="{x:Bind Appearance.HasFontAxes, Mode=OneWay}"
IsEnabled="{x:Bind Appearance.AreFontAxesAvailable, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.FontAxesOverrideSource, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
<StackPanel Spacing="16">
<ListView IsItemClickEnabled="False"
ItemsSource="{Binding Source={StaticResource FontAxesCVS}}"
SelectionMode="None">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0" />
</Style>
</ListView.ItemContainerStyle>
<ListView.Resources>
<CollectionViewSource x:Key="FontAxesNamesCVS"
x:Name="FontAxesNamesCVS" />
</ListView.Resources>
<ListView.ItemTemplate>
<DataTemplate x:DataType="local:AxisKeyValuePair">
<Grid ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ComboBox Grid.Column="0"
IsSynchronizedWithCurrentItem="False"
ItemsSource="{Binding Source={StaticResource FontAxesNamesCVS}}"
SelectedIndex="{x:Bind AxisIndex, Mode=TwoWay}" />
<muxc:NumberBox Grid.Column="1"
Value="{x:Bind AxisValue, Mode=TwoWay}" />
<Button Grid.Column="2"
HorizontalAlignment="Right"
Click="DeleteAxisKeyValuePair_Click"
Style="{StaticResource DeleteButtonStyle}"
Tag="{x:Bind AxisKey, Mode=OneWay}">
<FontIcon FontSize="{StaticResource StandardIconSize}"
Glyph="&#xE74D;" />
</Button>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Button Click="AddNewAxisKeyValuePair_Click"
IsEnabled="{x:Bind Appearance.CanFontAxesBeAdded, Mode=OneWay}">
<Button.Content>
ItemTemplate="{StaticResource FontKeyValuePairTemplate}"
ItemsSource="{x:Bind Appearance.FontAxes}"
SelectionMode="None" />
<muxc:DropDownButton x:Name="AddFontAxisButton"
x:Uid="Profile_AddFontAxisButton">
<muxc:DropDownButton.Content>
<StackPanel Orientation="Horizontal">
<FontIcon VerticalAlignment="Bottom"
FontSize="{StaticResource StandardIconSize}"
@@ -341,60 +321,26 @@
<TextBlock x:Uid="Profile_AddNewFontAxis"
Style="{StaticResource IconButtonTextBlockStyle}" />
</StackPanel>
</Button.Content>
</Button>
</muxc:DropDownButton.Content>
<muxc:DropDownButton.Flyout>
<MenuFlyout />
</muxc:DropDownButton.Flyout>
</muxc:DropDownButton>
</StackPanel>
</local:SettingContainer>
<local:SettingContainer x:Name="FontFeaturesContainer"
x:Uid="Profile_FontFeatures"
<local:SettingContainer x:Uid="Profile_FontFeatures"
ClearSettingValue="{x:Bind Appearance.ClearFontFeatures}"
HasSettingValue="{x:Bind Appearance.HasFontFeatures, Mode=OneWay}"
IsEnabled="{x:Bind Appearance.AreFontFeaturesAvailable, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.FontFeaturesOverrideSource, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
<StackPanel Spacing="16">
<ListView IsItemClickEnabled="False"
ItemsSource="{Binding Source={StaticResource FontFeaturesCVS}}"
SelectionMode="None">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0" />
</Style>
</ListView.ItemContainerStyle>
<ListView.Resources>
<CollectionViewSource x:Key="FontFeaturesNamesCVS"
x:Name="FontFeaturesNamesCVS" />
</ListView.Resources>
<ListView.ItemTemplate>
<DataTemplate x:DataType="local:FeatureKeyValuePair">
<Grid ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ComboBox Grid.Column="0"
IsSynchronizedWithCurrentItem="False"
ItemsSource="{Binding Source={StaticResource FontFeaturesNamesCVS}}"
SelectedIndex="{x:Bind FeatureIndex, Mode=TwoWay}" />
<muxc:NumberBox Grid.Column="1"
Value="{x:Bind FeatureValue, Mode=TwoWay}" />
<Button Grid.Column="2"
HorizontalAlignment="Right"
Click="DeleteFeatureKeyValuePair_Click"
Style="{StaticResource DeleteButtonStyle}"
Tag="{x:Bind FeatureKey, Mode=OneWay}">
<FontIcon FontSize="{StaticResource StandardIconSize}"
Glyph="&#xE74D;" />
</Button>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Button Click="AddNewFeatureKeyValuePair_Click"
IsEnabled="{x:Bind Appearance.CanFontFeaturesBeAdded, Mode=OneWay}">
<Button.Content>
ItemTemplate="{StaticResource FontKeyValuePairTemplate}"
ItemsSource="{x:Bind Appearance.FontFeatures}"
SelectionMode="None" />
<muxc:DropDownButton x:Name="AddFontFeatureButton"
x:Uid="Profile_AddFontFeatureButton">
<muxc:DropDownButton.Content>
<StackPanel Orientation="Horizontal">
<FontIcon VerticalAlignment="Bottom"
FontSize="{StaticResource StandardIconSize}"
@@ -402,8 +348,11 @@
<TextBlock x:Uid="Profile_AddNewFontFeature"
Style="{StaticResource IconButtonTextBlockStyle}" />
</StackPanel>
</Button.Content>
</Button>
</muxc:DropDownButton.Content>
<muxc:DropDownButton.Flyout>
<MenuFlyout />
</muxc:DropDownButton.Flyout>
</muxc:DropDownButton>
</StackPanel>
</local:SettingContainer>
@@ -721,8 +670,7 @@
</local:SettingContainer>
<!-- Background Image Opacity -->
<local:SettingContainer x:Name="BackgroundImageOpacityContainer"
x:Uid="Profile_BackgroundImageOpacity"
<local:SettingContainer x:Uid="Profile_BackgroundImageOpacity"
ClearSettingValue="{x:Bind Appearance.ClearBackgroundImageOpacity}"
HasSettingValue="{x:Bind Appearance.HasBackgroundImageOpacity, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.BackgroundImageOpacityOverrideSource, Mode=OneWay}"

View File

@@ -176,36 +176,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
CATCH_LOG();
Editor::Font ProfileViewModel::FindFontWithLocalizedName(const winrt::hstring& name) noexcept
{
// look for the current font in our shown list of fonts
Editor::Font fallbackFont{ nullptr };
try
{
if (!CompleteFontList())
{
UpdateFontList();
}
const auto& currentFontList{ CompleteFontList() };
fallbackFont = currentFontList.First().Current();
for (const auto& font : currentFontList)
{
if (font.LocalizedName() == name)
{
return font;
}
else if (font.LocalizedName() == L"Cascadia Mono")
{
fallbackFont = font;
}
}
}
CATCH_LOG();
// we couldn't find the desired font, set to "Cascadia Mono" if we found that since it ships by default
return fallbackFont;
}
static winrt::hstring getLocalizedStringByIndex(IDWriteLocalizedStrings* strings, UINT32 index)
{
UINT32 length = 0;
@@ -234,7 +204,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
THROW_IF_FAILED(family->GetFamilyNames(familyNames.addressof()));
// If en-us is missing we fall back to whatever is at index 0.
const auto ci = getLocalizedStringIndex(familyNames.get(), L"en-us", 0);
const auto ci = getLocalizedStringIndex(familyNames.get(), L"en-US", 0);
// If our locale is missing we fall back to en-us.
const auto li = getLocalizedStringIndex(familyNames.get(), locale, ci);
@@ -242,7 +212,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
// If the canonical/localized indices are the same, there's no need to get the other string.
auto localized = ci == li ? canonical : getLocalizedStringByIndex(familyNames.get(), li);
return make<Font>(std::move(canonical), std::move(localized), family);
return make<Font>(std::move(canonical), std::move(localized));
}
winrt::guid ProfileViewModel::OriginalProfileGuid() const noexcept

View File

@@ -33,7 +33,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
static void UpdateFontList() noexcept;
static Windows::Foundation::Collections::IObservableVector<Editor::Font> CompleteFontList() noexcept { return _FontList; };
static Windows::Foundation::Collections::IObservableVector<Editor::Font> MonospaceFontList() noexcept { return _MonospaceFontList; };
static Editor::Font FindFontWithLocalizedName(winrt::hstring const& name) noexcept;
ProfileViewModel(const Model::Profile& profile, const Model::CascadiaSettings& settings);
Model::TerminalSettings TermSettings() const;
@@ -156,9 +155,3 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
guid _ProfileGuid{};
};
};
namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation
{
// Since we have static functions, we need a factory.
BASIC_FACTORY(ProfileViewModel);
}

View File

@@ -34,10 +34,6 @@ namespace Microsoft.Terminal.Settings.Editor
runtimeclass ProfileViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
{
static Windows.Foundation.Collections.IObservableVector<Font> CompleteFontList { get; };
static Windows.Foundation.Collections.IObservableVector<Font> MonospaceFontList { get; };
static Font FindFontWithLocalizedName(String name);
Microsoft.Terminal.Settings.Model.TerminalSettings TermSettings { get; };
event Windows.Foundation.TypedEventHandler<ProfileViewModel, DeleteProfileEventArgs> DeleteProfileRequested;

View File

@@ -733,10 +733,16 @@
<value>Browse...</value>
<comment>Button label that opens a file picker in a new window. The "..." is standard to mean it will open a new window.</comment>
</data>
<data name="Profile_AddFontAxisButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Add new font axis</value>
</data>
<data name="Profile_AddNewFontAxis.Text" xml:space="preserve">
<value>Add new</value>
<comment>Button label that adds a new font axis for the current font.</comment>
</data>
<data name="Profile_AddFontFeatureButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Add new font feature</value>
</data>
<data name="Profile_AddNewFontFeature.Text" xml:space="preserve">
<value>Add new</value>
<comment>Button label that adds a new font feature for the current font.</comment>

View File

@@ -32,24 +32,21 @@ winrt::com_ptr<FontConfig> FontConfig::CopyFontInfo(const FontConfig* source, wi
// We cannot simply copy the font axes and features with `fontInfo->_FontAxes = source->_FontAxes;`
// since that'll just create a reference; we have to manually copy the values.
static constexpr auto cloneFontMap = [](const IFontFeatureMap& map) {
std::map<winrt::hstring, float> fontAxes;
for (const auto& [k, v] : map)
{
fontAxes.emplace(k, v);
}
return winrt::single_threaded_map(std::move(fontAxes));
};
if (source->_FontAxes)
{
std::map<winrt::hstring, float> fontAxes;
for (const auto keyValuePair : source->_FontAxes.value())
{
fontAxes.insert(std::pair<winrt::hstring, float>(keyValuePair.Key(), keyValuePair.Value()));
}
fontInfo->_FontAxes = winrt::single_threaded_map(std::move(fontAxes));
fontInfo->_FontAxes = cloneFontMap(*source->_FontAxes);
}
if (source->_FontFeatures)
{
std::map<winrt::hstring, uint32_t> fontFeatures;
for (const auto keyValuePair : source->_FontFeatures.value())
{
fontFeatures.insert(std::pair<winrt::hstring, uint32_t>(keyValuePair.Key(), keyValuePair.Value()));
}
fontInfo->_FontFeatures = winrt::single_threaded_map(std::move(fontFeatures));
fontInfo->_FontFeatures = cloneFontMap(*source->_FontFeatures);
}
return fontInfo;

View File

@@ -24,7 +24,7 @@ Author(s):
#include <DefaultSettings.h>
using IFontAxesMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, float>;
using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, uint32_t>;
using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, float>;
namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{

View File

@@ -18,7 +18,7 @@ namespace Microsoft.Terminal.Settings.Model
INHERITABLE_FONT_SETTING(String, FontFace);
INHERITABLE_FONT_SETTING(Single, FontSize);
INHERITABLE_FONT_SETTING(Windows.UI.Text.FontWeight, FontWeight);
INHERITABLE_FONT_SETTING(Windows.Foundation.Collections.IMap<String COMMA UInt32>, FontFeatures);
INHERITABLE_FONT_SETTING(Windows.Foundation.Collections.IMap<String COMMA Single>, FontFeatures);
INHERITABLE_FONT_SETTING(Windows.Foundation.Collections.IMap<String COMMA Single>, FontAxes);
INHERITABLE_FONT_SETTING(Boolean, EnableBuiltinGlyphs);
INHERITABLE_FONT_SETTING(Boolean, EnableColorGlyphs);

View File

@@ -731,6 +731,16 @@ namespace Microsoft::Terminal::Settings::Model::JsonUtils
Json::Value ToJson(const float val)
{
// Convert floats that are almost integers to proper integers, because that looks way neater in JSON.
if (val >= static_cast<float>(Json::Value::minInt) && val <= static_cast<float>(Json::Value::maxInt))
{
const auto i = static_cast<Json::Value::Int>(std::lround(val));
const auto f = static_cast<float>(i);
if (std::fabs(f - val) < 1e-6f)
{
return i;
}
}
return val;
}
@@ -755,6 +765,16 @@ namespace Microsoft::Terminal::Settings::Model::JsonUtils
Json::Value ToJson(const double val)
{
// Convert floats that are almost integers to proper integers, because that looks way neater in JSON.
if (val >= static_cast<double>(Json::Value::minInt) && val <= static_cast<double>(Json::Value::maxInt))
{
const auto i = static_cast<Json::Value::Int>(std::lround(val));
const auto f = static_cast<double>(i);
if (std::fabs(f - val) < 1e-6)
{
return i;
}
}
return val;
}

View File

@@ -21,7 +21,7 @@ Author(s):
#include <conattrs.hpp>
using IFontAxesMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, float>;
using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, uint32_t>;
using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, float>;
using IEnvironmentVariableMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::hstring>;
// fwdecl unittest classes

View File

@@ -8,7 +8,7 @@ Licensed under the MIT license.
#include <conattrs.hpp>
#include "../../inc/ControlProperties.h"
using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, uint32_t>;
using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, float>;
using IFontAxesMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, float>;
namespace ControlUnitTests

View File

@@ -151,7 +151,7 @@ namespace SettingsModelUnitTests
"font": {
"face": "Cascadia Mono",
"size": 12.0,
"size": 12,
"weight": "normal"
},
"padding": "8, 8, 8, 8",
@@ -175,7 +175,7 @@ namespace SettingsModelUnitTests
"backgroundImage": "made_you_look.jpeg",
"backgroundImageStretchMode": "uniformToFill",
"backgroundImageAlignment": "center",
"backgroundImageOpacity": 1.0,
"backgroundImageOpacity": 1,
"scrollbarState": "visible",
"snapOnInput": true,
@@ -298,8 +298,8 @@ namespace SettingsModelUnitTests
// complex command with key chords
static constexpr std::string_view actionsString4A{ R"([
{ "command": { "action": "adjustFontSize", "delta": 1.0 }, "keys": "ctrl+c" },
{ "command": { "action": "adjustFontSize", "delta": 1.0 }, "keys": "ctrl+d" }
{ "command": { "action": "adjustFontSize", "delta": 1 }, "keys": "ctrl+c" },
{ "command": { "action": "adjustFontSize", "delta": 1 }, "keys": "ctrl+d" }
])" };
// command with name and icon and multiple key chords
@@ -323,8 +323,8 @@ namespace SettingsModelUnitTests
{
"name": "Change font size...",
"commands": [
{ "command": { "action": "adjustFontSize", "delta": 1.0 } },
{ "command": { "action": "adjustFontSize", "delta": -1.0 } },
{ "command": { "action": "adjustFontSize", "delta": 1 } },
{ "command": { "action": "adjustFontSize", "delta": -1 } },
{ "command": "resetFontSize" },
]
}
@@ -523,7 +523,7 @@ namespace SettingsModelUnitTests
"name": "Profile with legacy font settings",
"fontFace": "Cascadia Mono",
"fontSize": 12.0,
"fontSize": 12,
"fontWeight": "normal"
})" };
@@ -533,7 +533,7 @@ namespace SettingsModelUnitTests
"font": {
"face": "Cascadia Mono",
"size": 12.0,
"size": 12,
"weight": "normal"
}
})" };
@@ -1007,8 +1007,8 @@ namespace SettingsModelUnitTests
{
"name": "Change font size...",
"commands": [
{ "command": { "action": "adjustFontSize", "delta": 1.0 } },
{ "command": { "action": "adjustFontSize", "delta": -1.0 } },
{ "command": { "action": "adjustFontSize", "delta": 1 } },
{ "command": { "action": "adjustFontSize", "delta": -1 } },
{ "command": "resetFontSize" },
]
}

View File

@@ -354,16 +354,16 @@ namespace TerminalAppUnitTests
TryBasicType(int{ -1024 }, -1024);
TryBasicType(std::numeric_limits<unsigned int>::max(), std::numeric_limits<unsigned int>::max());
TryBasicType(false, false);
TryBasicType(1.0f, 1.0f);
TryBasicType(1.1f, 1.1f);
// string -> wstring
TryBasicType(std::wstring{ L"hello" }, "hello");
// float -> double
TryBasicType(1.0, 1.0f);
TryBasicType(static_cast<double>(1.1f), 1.1f);
// double -> float
TryBasicType(1.0f, 1.0);
TryBasicType(1.1f, static_cast<double>(1.1f));
TryBasicType(til::color{ 0xab, 0xcd, 0xef }, "#ABCDEF");
TryBasicType(til::color{ 0xcc, 0xcc, 0xcc }, "#CCC", "#CCCCCC");

View File

@@ -493,7 +493,7 @@ void AtlasEngine::SetWarningCallback(std::function<void(HRESULT, wil::zwstring_v
return S_OK;
}
[[nodiscard]] HRESULT AtlasEngine::UpdateFont(const FontInfoDesired& fontInfoDesired, FontInfo& fontInfo, const std::unordered_map<std::wstring_view, uint32_t>& features, const std::unordered_map<std::wstring_view, float>& axes) noexcept
[[nodiscard]] HRESULT AtlasEngine::UpdateFont(const FontInfoDesired& fontInfoDesired, FontInfo& fontInfo, const std::unordered_map<std::wstring_view, float>& features, const std::unordered_map<std::wstring_view, float>& axes) noexcept
{
// We're currently faced with a font caching bug that we're unable to reproduce locally. See GH#9375.
// But it occurs often enough and has no proper workarounds, so we're forced to fix it.
@@ -544,7 +544,7 @@ void AtlasEngine::_resolveTransparencySettings() noexcept
}
}
[[nodiscard]] HRESULT AtlasEngine::_updateFont(const FontInfoDesired& fontInfoDesired, FontInfo& fontInfo, const std::unordered_map<std::wstring_view, uint32_t>& features, const std::unordered_map<std::wstring_view, float>& axes) noexcept
[[nodiscard]] HRESULT AtlasEngine::_updateFont(const FontInfoDesired& fontInfoDesired, FontInfo& fontInfo, const std::unordered_map<std::wstring_view, float>& features, const std::unordered_map<std::wstring_view, float>& axes) noexcept
try
{
std::vector<DWRITE_FONT_FEATURE> fontFeatures;
@@ -567,19 +567,20 @@ try
if (p.first.size() == 4)
{
const auto s = p.first.data();
const auto v = static_cast<UINT32>(std::max(0l, lrintf(p.second)));
switch (const auto tag = DWRITE_MAKE_FONT_FEATURE_TAG(s[0], s[1], s[2], s[3]))
{
case DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES:
fontFeatures[0].parameter = p.second;
fontFeatures[0].parameter = v;
break;
case DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES:
fontFeatures[1].parameter = p.second;
fontFeatures[1].parameter = v;
break;
case DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES:
fontFeatures[2].parameter = p.second;
fontFeatures[2].parameter = v;
break;
default:
fontFeatures.emplace_back(tag, p.second);
fontFeatures.emplace_back(tag, v);
break;
}
}

View File

@@ -78,7 +78,7 @@ namespace Microsoft::Console::Render::Atlas
void SetGraphicsAPI(GraphicsAPI graphicsAPI) noexcept;
void SetWarningCallback(std::function<void(HRESULT, wil::zwstring_view)> pfn) noexcept;
[[nodiscard]] HRESULT SetWindowSize(til::size pixels) noexcept;
[[nodiscard]] HRESULT UpdateFont(const FontInfoDesired& pfiFontInfoDesired, FontInfo& fiFontInfo, const std::unordered_map<std::wstring_view, uint32_t>& features, const std::unordered_map<std::wstring_view, float>& axes) noexcept;
[[nodiscard]] HRESULT UpdateFont(const FontInfoDesired& pfiFontInfoDesired, FontInfo& fiFontInfo, const std::unordered_map<std::wstring_view, float>& features, const std::unordered_map<std::wstring_view, float>& axes) noexcept;
private:
// AtlasEngine.cpp
@@ -96,7 +96,7 @@ namespace Microsoft::Console::Render::Atlas
// AtlasEngine.api.cpp
void _resolveTransparencySettings() noexcept;
[[nodiscard]] HRESULT _updateFont(const FontInfoDesired& fontInfoDesired, FontInfo& fontInfo, const std::unordered_map<std::wstring_view, uint32_t>& features, const std::unordered_map<std::wstring_view, float>& axes) noexcept;
[[nodiscard]] HRESULT _updateFont(const FontInfoDesired& fontInfoDesired, FontInfo& fontInfo, const std::unordered_map<std::wstring_view, float>& features, const std::unordered_map<std::wstring_view, float>& axes) noexcept;
void _resolveFontMetrics(const FontInfoDesired& fontInfoDesired, FontInfo& fontInfo, FontSettings* fontMetrics = nullptr);
[[nodiscard]] bool _updateWithNearbyFontCollection() noexcept;