Merge remote-tracking branch 'origin/main' into dev/migrie/oop/ragnarok
This commit is contained in:
commit
6da5d79d47
|
@ -97,6 +97,7 @@ namespace SettingsModelLocalTests
|
||||||
"confirmCloseAllTabs": true,
|
"confirmCloseAllTabs": true,
|
||||||
"largePasteWarning": true,
|
"largePasteWarning": true,
|
||||||
"multiLinePasteWarning": true,
|
"multiLinePasteWarning": true,
|
||||||
|
"trimPaste": true,
|
||||||
|
|
||||||
"experimental.input.forceVT": false,
|
"experimental.input.forceVT": false,
|
||||||
"experimental.rendering.forceFullRepaint": false,
|
"experimental.rendering.forceFullRepaint": false,
|
||||||
|
|
|
@ -977,7 +977,7 @@ void HwndTerminal::_StringPaste(const wchar_t* const pData) noexcept
|
||||||
CATCH_LOG();
|
CATCH_LOG();
|
||||||
}
|
}
|
||||||
|
|
||||||
COORD HwndTerminal::GetFontSize() const
|
COORD HwndTerminal::GetFontSize() const noexcept
|
||||||
{
|
{
|
||||||
return _actualFont.GetSize();
|
return _actualFont.GetSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ private:
|
||||||
void _SendCharEvent(wchar_t ch, WORD scanCode, WORD flags) noexcept;
|
void _SendCharEvent(wchar_t ch, WORD scanCode, WORD flags) noexcept;
|
||||||
|
|
||||||
// Inherited via IControlAccessibilityInfo
|
// Inherited via IControlAccessibilityInfo
|
||||||
COORD GetFontSize() const override;
|
COORD GetFontSize() const noexcept override;
|
||||||
RECT GetBounds() const noexcept override;
|
RECT GetBounds() const noexcept override;
|
||||||
double GetScaleFactor() const noexcept override;
|
double GetScaleFactor() const noexcept override;
|
||||||
void ChangeViewport(const SMALL_RECT NewWindow) override;
|
void ChangeViewport(const SMALL_RECT NewWindow) override;
|
||||||
|
|
|
@ -535,7 +535,7 @@ namespace winrt::TerminalApp::implementation
|
||||||
auto actions = winrt::single_threaded_vector<ActionAndArgs>(std::move(
|
auto actions = winrt::single_threaded_vector<ActionAndArgs>(std::move(
|
||||||
TerminalPage::ConvertExecuteCommandlineToActions(realArgs)));
|
TerminalPage::ConvertExecuteCommandlineToActions(realArgs)));
|
||||||
|
|
||||||
if (_startupActions.Size() != 0)
|
if (actions.Size() != 0)
|
||||||
{
|
{
|
||||||
actionArgs.Handled(true);
|
actionArgs.Handled(true);
|
||||||
ProcessStartupActions(actions, false);
|
ProcessStartupActions(actions, false);
|
||||||
|
|
|
@ -1597,7 +1597,10 @@ namespace winrt::TerminalApp::implementation
|
||||||
// the control here instead.
|
// the control here instead.
|
||||||
if (_startupState == StartupState::Initialized)
|
if (_startupState == StartupState::Initialized)
|
||||||
{
|
{
|
||||||
_GetActiveControl().Focus(FocusState::Programmatic);
|
if (const auto control = _GetActiveControl())
|
||||||
|
{
|
||||||
|
control.Focus(FocusState::Programmatic);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CATCH_LOG();
|
CATCH_LOG();
|
||||||
|
@ -1869,6 +1872,22 @@ namespace winrt::TerminalApp::implementation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_settings.GlobalSettings().TrimPaste())
|
||||||
|
{
|
||||||
|
std::wstring_view textView{ text };
|
||||||
|
const auto pos = textView.find_last_not_of(L"\t\n\v\f\r ");
|
||||||
|
if (pos == textView.npos)
|
||||||
|
{
|
||||||
|
// Text is all white space, nothing to paste
|
||||||
|
co_return;
|
||||||
|
}
|
||||||
|
else if (const auto toRemove = textView.size() - 1 - pos; toRemove > 0)
|
||||||
|
{
|
||||||
|
textView.remove_suffix(toRemove);
|
||||||
|
text = { textView };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool warnMultiLine = _settings.GlobalSettings().WarnAboutMultiLinePaste();
|
bool warnMultiLine = _settings.GlobalSettings().WarnAboutMultiLinePaste();
|
||||||
if (warnMultiLine)
|
if (warnMultiLine)
|
||||||
{
|
{
|
||||||
|
|
|
@ -141,12 +141,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region IControlAccessibilityInfo
|
#pragma region IControlAccessibilityInfo
|
||||||
COORD InteractivityAutomationPeer::GetFontSize() const
|
COORD InteractivityAutomationPeer::GetFontSize() const noexcept
|
||||||
{
|
{
|
||||||
return til::size{ til::math::rounding, _interactivity->Core().FontSize() };
|
return til::size{ til::math::rounding, _interactivity->Core().FontSize() };
|
||||||
}
|
}
|
||||||
|
|
||||||
RECT InteractivityAutomationPeer::GetBounds() const
|
RECT InteractivityAutomationPeer::GetBounds() const noexcept
|
||||||
{
|
{
|
||||||
return _controlBounds;
|
return _controlBounds;
|
||||||
}
|
}
|
||||||
|
@ -159,12 +159,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
RECT InteractivityAutomationPeer::GetPadding() const
|
RECT InteractivityAutomationPeer::GetPadding() const noexcept
|
||||||
{
|
{
|
||||||
return _controlPadding;
|
return _controlPadding;
|
||||||
}
|
}
|
||||||
|
|
||||||
double InteractivityAutomationPeer::GetScaleFactor() const
|
double InteractivityAutomationPeer::GetScaleFactor() const noexcept
|
||||||
{
|
{
|
||||||
return DisplayInformation::GetForCurrentView().RawPixelsPerViewPixel();
|
return DisplayInformation::GetForCurrentView().RawPixelsPerViewPixel();
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,10 +62,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
|
|
||||||
#pragma region IControlAccessibilityInfo Pattern
|
#pragma region IControlAccessibilityInfo Pattern
|
||||||
// Inherited via IControlAccessibilityInfo
|
// Inherited via IControlAccessibilityInfo
|
||||||
virtual COORD GetFontSize() const override;
|
virtual COORD GetFontSize() const noexcept override;
|
||||||
virtual RECT GetBounds() const override;
|
virtual RECT GetBounds() const noexcept override;
|
||||||
virtual RECT GetPadding() const override;
|
virtual RECT GetPadding() const noexcept override;
|
||||||
virtual double GetScaleFactor() const override;
|
virtual double GetScaleFactor() const noexcept override;
|
||||||
virtual void ChangeViewport(SMALL_RECT NewWindow) override;
|
virtual void ChangeViewport(SMALL_RECT NewWindow) override;
|
||||||
virtual HRESULT GetHostUiaProvider(IRawElementProviderSimple** provider) override;
|
virtual HRESULT GetHostUiaProvider(IRawElementProviderSimple** provider) override;
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
|
@ -45,6 +45,11 @@
|
||||||
<ToggleSwitch IsOn="{x:Bind State.Globals.TrimBlockSelection, Mode=TwoWay}" />
|
<ToggleSwitch IsOn="{x:Bind State.Globals.TrimBlockSelection, Mode=TwoWay}" />
|
||||||
</local:SettingContainer>
|
</local:SettingContainer>
|
||||||
|
|
||||||
|
<!-- Trim Paste -->
|
||||||
|
<local:SettingContainer x:Uid="Globals_TrimPaste">
|
||||||
|
<ToggleSwitch IsOn="{x:Bind State.Globals.TrimPaste, Mode=TwoWay}" />
|
||||||
|
</local:SettingContainer>
|
||||||
|
|
||||||
<!-- Word Delimiters -->
|
<!-- Word Delimiters -->
|
||||||
<local:SettingContainer x:Uid="Globals_WordDelimiters">
|
<local:SettingContainer x:Uid="Globals_WordDelimiters">
|
||||||
<TextBox IsSpellCheckEnabled="False"
|
<TextBox IsSpellCheckEnabled="False"
|
||||||
|
|
|
@ -33,7 +33,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||||
// only works on Win11. So we'll use that.
|
// only works on Win11. So we'll use that.
|
||||||
//
|
//
|
||||||
// Remove when we can remove the rest of GH#11285
|
// Remove when we can remove the rest of GH#11285
|
||||||
if (value < 100.0 && winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings::IsDefaultTerminalAvailable())
|
if (value < 100.0 &&
|
||||||
|
!winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings::IsDefaultTerminalAvailable())
|
||||||
{
|
{
|
||||||
UseAcrylic(true);
|
UseAcrylic(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
@ -247,6 +247,10 @@
|
||||||
<value>Remove trailing white-space in rectangular selection</value>
|
<value>Remove trailing white-space in rectangular selection</value>
|
||||||
<comment>Header for a control to toggle whether a text selected with block selection should be trimmed of white spaces when copied to the clipboard, or not.</comment>
|
<comment>Header for a control to toggle whether a text selected with block selection should be trimmed of white spaces when copied to the clipboard, or not.</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Globals_TrimPaste.Header" xml:space="preserve">
|
||||||
|
<value>Remove trailing white-space when pasting</value>
|
||||||
|
<comment>Header for a control to toggle whether pasted text should be trimmed of white spaces, or not.</comment>
|
||||||
|
</data>
|
||||||
<data name="Globals_KeybindingsDisclaimer.Text" xml:space="preserve">
|
<data name="Globals_KeybindingsDisclaimer.Text" xml:space="preserve">
|
||||||
<value>Below are the currently bound keys, which can be modified by editing the JSON settings file.</value>
|
<value>Below are the currently bound keys, which can be modified by editing the JSON settings file.</value>
|
||||||
<comment>A disclaimer located at the top of the actions page that presents the list of keybindings.</comment>
|
<comment>A disclaimer located at the top of the actions page that presents the list of keybindings.</comment>
|
||||||
|
|
|
@ -35,6 +35,7 @@ static constexpr std::string_view CopyOnSelectKey{ "copyOnSelect" };
|
||||||
static constexpr std::string_view CopyFormattingKey{ "copyFormatting" };
|
static constexpr std::string_view CopyFormattingKey{ "copyFormatting" };
|
||||||
static constexpr std::string_view WarnAboutLargePasteKey{ "largePasteWarning" };
|
static constexpr std::string_view WarnAboutLargePasteKey{ "largePasteWarning" };
|
||||||
static constexpr std::string_view WarnAboutMultiLinePasteKey{ "multiLinePasteWarning" };
|
static constexpr std::string_view WarnAboutMultiLinePasteKey{ "multiLinePasteWarning" };
|
||||||
|
static constexpr std::string_view TrimPasteKey{ "trimPaste" };
|
||||||
static constexpr std::string_view LaunchModeKey{ "launchMode" };
|
static constexpr std::string_view LaunchModeKey{ "launchMode" };
|
||||||
static constexpr std::string_view ConfirmCloseAllKey{ "confirmCloseAllTabs" };
|
static constexpr std::string_view ConfirmCloseAllKey{ "confirmCloseAllTabs" };
|
||||||
static constexpr std::string_view SnapToGridOnResizeKey{ "snapToGridOnResize" };
|
static constexpr std::string_view SnapToGridOnResizeKey{ "snapToGridOnResize" };
|
||||||
|
@ -101,6 +102,7 @@ winrt::com_ptr<GlobalAppSettings> GlobalAppSettings::Copy() const
|
||||||
globals->_CopyFormatting = _CopyFormatting;
|
globals->_CopyFormatting = _CopyFormatting;
|
||||||
globals->_WarnAboutLargePaste = _WarnAboutLargePaste;
|
globals->_WarnAboutLargePaste = _WarnAboutLargePaste;
|
||||||
globals->_WarnAboutMultiLinePaste = _WarnAboutMultiLinePaste;
|
globals->_WarnAboutMultiLinePaste = _WarnAboutMultiLinePaste;
|
||||||
|
globals->_TrimPaste = _TrimPaste;
|
||||||
globals->_InitialPosition = _InitialPosition;
|
globals->_InitialPosition = _InitialPosition;
|
||||||
globals->_CenterOnLaunch = _CenterOnLaunch;
|
globals->_CenterOnLaunch = _CenterOnLaunch;
|
||||||
globals->_LaunchMode = _LaunchMode;
|
globals->_LaunchMode = _LaunchMode;
|
||||||
|
@ -201,6 +203,7 @@ void GlobalAppSettings::LayerJson(const Json::Value& json)
|
||||||
JsonUtils::GetValueForKey(json, CopyFormattingKey, _CopyFormatting);
|
JsonUtils::GetValueForKey(json, CopyFormattingKey, _CopyFormatting);
|
||||||
JsonUtils::GetValueForKey(json, WarnAboutLargePasteKey, _WarnAboutLargePaste);
|
JsonUtils::GetValueForKey(json, WarnAboutLargePasteKey, _WarnAboutLargePaste);
|
||||||
JsonUtils::GetValueForKey(json, WarnAboutMultiLinePasteKey, _WarnAboutMultiLinePaste);
|
JsonUtils::GetValueForKey(json, WarnAboutMultiLinePasteKey, _WarnAboutMultiLinePaste);
|
||||||
|
JsonUtils::GetValueForKey(json, TrimPasteKey, _TrimPaste);
|
||||||
JsonUtils::GetValueForKey(json, FirstWindowPreferenceKey, _FirstWindowPreference);
|
JsonUtils::GetValueForKey(json, FirstWindowPreferenceKey, _FirstWindowPreference);
|
||||||
JsonUtils::GetValueForKey(json, LaunchModeKey, _LaunchMode);
|
JsonUtils::GetValueForKey(json, LaunchModeKey, _LaunchMode);
|
||||||
JsonUtils::GetValueForKey(json, LanguageKey, _Language);
|
JsonUtils::GetValueForKey(json, LanguageKey, _Language);
|
||||||
|
@ -306,6 +309,7 @@ Json::Value GlobalAppSettings::ToJson() const
|
||||||
JsonUtils::SetValueForKey(json, CopyFormattingKey, _CopyFormatting);
|
JsonUtils::SetValueForKey(json, CopyFormattingKey, _CopyFormatting);
|
||||||
JsonUtils::SetValueForKey(json, WarnAboutLargePasteKey, _WarnAboutLargePaste);
|
JsonUtils::SetValueForKey(json, WarnAboutLargePasteKey, _WarnAboutLargePaste);
|
||||||
JsonUtils::SetValueForKey(json, WarnAboutMultiLinePasteKey, _WarnAboutMultiLinePaste);
|
JsonUtils::SetValueForKey(json, WarnAboutMultiLinePasteKey, _WarnAboutMultiLinePaste);
|
||||||
|
JsonUtils::SetValueForKey(json, TrimPasteKey, _TrimPaste);
|
||||||
JsonUtils::SetValueForKey(json, FirstWindowPreferenceKey, _FirstWindowPreference);
|
JsonUtils::SetValueForKey(json, FirstWindowPreferenceKey, _FirstWindowPreference);
|
||||||
JsonUtils::SetValueForKey(json, LaunchModeKey, _LaunchMode);
|
JsonUtils::SetValueForKey(json, LaunchModeKey, _LaunchMode);
|
||||||
JsonUtils::SetValueForKey(json, LanguageKey, _Language);
|
JsonUtils::SetValueForKey(json, LanguageKey, _Language);
|
||||||
|
|
|
@ -77,6 +77,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||||
INHERITABLE_SETTING(Model::GlobalAppSettings, winrt::Microsoft::Terminal::Control::CopyFormat, CopyFormatting, 0);
|
INHERITABLE_SETTING(Model::GlobalAppSettings, winrt::Microsoft::Terminal::Control::CopyFormat, CopyFormatting, 0);
|
||||||
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, WarnAboutLargePaste, true);
|
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, WarnAboutLargePaste, true);
|
||||||
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, WarnAboutMultiLinePaste, true);
|
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, WarnAboutMultiLinePaste, true);
|
||||||
|
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, TrimPaste, true);
|
||||||
INHERITABLE_SETTING(Model::GlobalAppSettings, Model::LaunchPosition, InitialPosition, nullptr, nullptr);
|
INHERITABLE_SETTING(Model::GlobalAppSettings, Model::LaunchPosition, InitialPosition, nullptr, nullptr);
|
||||||
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, CenterOnLaunch, false);
|
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, CenterOnLaunch, false);
|
||||||
INHERITABLE_SETTING(Model::GlobalAppSettings, Model::FirstWindowPreference, FirstWindowPreference, FirstWindowPreference::DefaultProfile);
|
INHERITABLE_SETTING(Model::GlobalAppSettings, Model::FirstWindowPreference, FirstWindowPreference, FirstWindowPreference::DefaultProfile);
|
||||||
|
|
|
@ -63,6 +63,7 @@ namespace Microsoft.Terminal.Settings.Model
|
||||||
INHERITABLE_SETTING(Microsoft.Terminal.Control.CopyFormat, CopyFormatting);
|
INHERITABLE_SETTING(Microsoft.Terminal.Control.CopyFormat, CopyFormatting);
|
||||||
INHERITABLE_SETTING(Boolean, WarnAboutLargePaste);
|
INHERITABLE_SETTING(Boolean, WarnAboutLargePaste);
|
||||||
INHERITABLE_SETTING(Boolean, WarnAboutMultiLinePaste);
|
INHERITABLE_SETTING(Boolean, WarnAboutMultiLinePaste);
|
||||||
|
INHERITABLE_SETTING(Boolean, TrimPaste);
|
||||||
INHERITABLE_SETTING(LaunchPosition, InitialPosition);
|
INHERITABLE_SETTING(LaunchPosition, InitialPosition);
|
||||||
INHERITABLE_SETTING(Boolean, CenterOnLaunch);
|
INHERITABLE_SETTING(Boolean, CenterOnLaunch);
|
||||||
INHERITABLE_SETTING(FirstWindowPreference, FirstWindowPreference);
|
INHERITABLE_SETTING(FirstWindowPreference, FirstWindowPreference);
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
"copyOnSelect": false,
|
"copyOnSelect": false,
|
||||||
"copyFormatting": true,
|
"copyFormatting": true,
|
||||||
"trimBlockSelection": false,
|
"trimBlockSelection": false,
|
||||||
|
"trimPaste": true,
|
||||||
"wordDelimiters": " /\\()\"'-.,:;<>~!@#$%^&*|+=[]{}~?\u2502",
|
"wordDelimiters": " /\\()\"'-.,:;<>~!@#$%^&*|+=[]{}~?\u2502",
|
||||||
|
|
||||||
// Tab UI
|
// Tab UI
|
||||||
|
|
|
@ -274,8 +274,7 @@ void ApiRoutines::GetNumberOfConsoleMouseButtonsImpl(ULONG& buttons) noexcept
|
||||||
const FontInfo& fontInfo = activeScreenInfo.GetCurrentFont();
|
const FontInfo& fontInfo = activeScreenInfo.GetCurrentFont();
|
||||||
consoleFontInfoEx.FontFamily = fontInfo.GetFamily();
|
consoleFontInfoEx.FontFamily = fontInfo.GetFamily();
|
||||||
consoleFontInfoEx.FontWeight = fontInfo.GetWeight();
|
consoleFontInfoEx.FontWeight = fontInfo.GetWeight();
|
||||||
|
fontInfo.FillLegacyNameBuffer(consoleFontInfoEx.FaceName);
|
||||||
RETURN_IF_FAILED(fontInfo.FillLegacyNameBuffer(gsl::make_span(consoleFontInfoEx.FaceName)));
|
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,20 +7,11 @@
|
||||||
|
|
||||||
#include "../inc/FontInfoBase.hpp"
|
#include "../inc/FontInfoBase.hpp"
|
||||||
|
|
||||||
bool operator==(const FontInfoBase& a, const FontInfoBase& b)
|
FontInfoBase::FontInfoBase(const std::wstring_view& faceName,
|
||||||
{
|
|
||||||
return a._faceName == b._faceName &&
|
|
||||||
a._weight == b._weight &&
|
|
||||||
a._family == b._family &&
|
|
||||||
a._codePage == b._codePage &&
|
|
||||||
a._fDefaultRasterSetFromEngine == b._fDefaultRasterSetFromEngine;
|
|
||||||
}
|
|
||||||
|
|
||||||
FontInfoBase::FontInfoBase(const std::wstring_view faceName,
|
|
||||||
const unsigned char family,
|
const unsigned char family,
|
||||||
const unsigned int weight,
|
const unsigned int weight,
|
||||||
const bool fSetDefaultRasterFont,
|
const bool fSetDefaultRasterFont,
|
||||||
const unsigned int codePage) :
|
const unsigned int codePage) noexcept :
|
||||||
_faceName(faceName),
|
_faceName(faceName),
|
||||||
_family(family),
|
_family(family),
|
||||||
_weight(weight),
|
_weight(weight),
|
||||||
|
@ -30,20 +21,16 @@ FontInfoBase::FontInfoBase(const std::wstring_view faceName,
|
||||||
ValidateFont();
|
ValidateFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
FontInfoBase::FontInfoBase(const FontInfoBase& fibFont) :
|
bool FontInfoBase::operator==(const FontInfoBase& other) noexcept
|
||||||
FontInfoBase(fibFont.GetFaceName(),
|
|
||||||
fibFont.GetFamily(),
|
|
||||||
fibFont.GetWeight(),
|
|
||||||
fibFont.WasDefaultRasterSetFromEngine(),
|
|
||||||
fibFont.GetCodePage())
|
|
||||||
{
|
{
|
||||||
|
return _faceName == other._faceName &&
|
||||||
|
_weight == other._weight &&
|
||||||
|
_family == other._family &&
|
||||||
|
_codePage == other._codePage &&
|
||||||
|
_fDefaultRasterSetFromEngine == other._fDefaultRasterSetFromEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
FontInfoBase::~FontInfoBase()
|
unsigned char FontInfoBase::GetFamily() const noexcept
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char FontInfoBase::GetFamily() const
|
|
||||||
{
|
{
|
||||||
return _family;
|
return _family;
|
||||||
}
|
}
|
||||||
|
@ -51,22 +38,22 @@ unsigned char FontInfoBase::GetFamily() const
|
||||||
// When the default raster font is forced set from the engine, this is how we differentiate it from a simple apply.
|
// When the default raster font is forced set from the engine, this is how we differentiate it from a simple apply.
|
||||||
// Default raster font is internally represented as a blank face name and zeros for weight, family, and size. This is
|
// Default raster font is internally represented as a blank face name and zeros for weight, family, and size. This is
|
||||||
// the hint for the engine to use whatever comes back from GetStockObject(OEM_FIXED_FONT) (at least in the GDI world).
|
// the hint for the engine to use whatever comes back from GetStockObject(OEM_FIXED_FONT) (at least in the GDI world).
|
||||||
bool FontInfoBase::WasDefaultRasterSetFromEngine() const
|
bool FontInfoBase::WasDefaultRasterSetFromEngine() const noexcept
|
||||||
{
|
{
|
||||||
return _fDefaultRasterSetFromEngine;
|
return _fDefaultRasterSetFromEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int FontInfoBase::GetWeight() const
|
unsigned int FontInfoBase::GetWeight() const noexcept
|
||||||
{
|
{
|
||||||
return _weight;
|
return _weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::wstring_view FontInfoBase::GetFaceName() const noexcept
|
const std::wstring& FontInfoBase::GetFaceName() const noexcept
|
||||||
{
|
{
|
||||||
return _faceName;
|
return _faceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int FontInfoBase::GetCodePage() const
|
unsigned int FontInfoBase::GetCodePage() const noexcept
|
||||||
{
|
{
|
||||||
return _codePage;
|
return _codePage;
|
||||||
}
|
}
|
||||||
|
@ -77,21 +64,18 @@ unsigned int FontInfoBase::GetCodePage() const
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// - buffer: the buffer into which to copy characters
|
// - buffer: the buffer into which to copy characters
|
||||||
// - size: the size of buffer
|
// - size: the size of buffer
|
||||||
HRESULT FontInfoBase::FillLegacyNameBuffer(gsl::span<wchar_t> buffer) const
|
void FontInfoBase::FillLegacyNameBuffer(wchar_t (&buffer)[LF_FACESIZE]) const noexcept
|
||||||
try
|
|
||||||
{
|
{
|
||||||
auto toCopy = std::min<size_t>(buffer.size() - 1, _faceName.size());
|
const auto toCopy = std::min(std::size(buffer) - 1, _faceName.size());
|
||||||
auto last = std::copy(_faceName.cbegin(), _faceName.cbegin() + toCopy, buffer.begin());
|
const auto last = std::copy_n(_faceName.data(), toCopy, &buffer[0]);
|
||||||
std::fill(last, buffer.end(), L'\0');
|
*last = L'\0';
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
CATCH_RETURN();
|
|
||||||
|
|
||||||
// NOTE: this method is intended to only be used from the engine itself to respond what font it has chosen.
|
// NOTE: this method is intended to only be used from the engine itself to respond what font it has chosen.
|
||||||
void FontInfoBase::SetFromEngine(const std::wstring_view faceName,
|
void FontInfoBase::SetFromEngine(const std::wstring_view& faceName,
|
||||||
const unsigned char family,
|
const unsigned char family,
|
||||||
const unsigned int weight,
|
const unsigned int weight,
|
||||||
const bool fSetDefaultRasterFont)
|
const bool fSetDefaultRasterFont) noexcept
|
||||||
{
|
{
|
||||||
_faceName = faceName;
|
_faceName = faceName;
|
||||||
_family = family;
|
_family = family;
|
||||||
|
@ -101,12 +85,12 @@ void FontInfoBase::SetFromEngine(const std::wstring_view faceName,
|
||||||
|
|
||||||
// Internally, default raster font is represented by empty facename, and zeros for weight, family, and size. Since
|
// Internally, default raster font is represented by empty facename, and zeros for weight, family, and size. Since
|
||||||
// FontInfoBase doesn't have sizing information, this helper checks everything else.
|
// FontInfoBase doesn't have sizing information, this helper checks everything else.
|
||||||
bool FontInfoBase::IsDefaultRasterFontNoSize() const
|
bool FontInfoBase::IsDefaultRasterFontNoSize() const noexcept
|
||||||
{
|
{
|
||||||
return (_weight == 0 && _family == 0 && _faceName.empty());
|
return (_weight == 0 && _family == 0 && _faceName.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FontInfoBase::ValidateFont()
|
void FontInfoBase::ValidateFont() noexcept
|
||||||
{
|
{
|
||||||
// If we were given a blank name, it meant raster fonts, which to us is always Terminal.
|
// If we were given a blank name, it meant raster fonts, which to us is always Terminal.
|
||||||
if (!IsDefaultRasterFontNoSize() && s_pFontDefaultList != nullptr)
|
if (!IsDefaultRasterFontNoSize() && s_pFontDefaultList != nullptr)
|
||||||
|
@ -128,14 +112,14 @@ void FontInfoBase::ValidateFont()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FontInfoBase::IsTrueTypeFont() const
|
bool FontInfoBase::IsTrueTypeFont() const noexcept
|
||||||
{
|
{
|
||||||
return WI_IsFlagSet(_family, TMPF_TRUETYPE);
|
return WI_IsFlagSet(_family, TMPF_TRUETYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Microsoft::Console::Render::IFontDefaultList* FontInfoBase::s_pFontDefaultList;
|
Microsoft::Console::Render::IFontDefaultList* FontInfoBase::s_pFontDefaultList;
|
||||||
|
|
||||||
void FontInfoBase::s_SetFontDefaultList(_In_ Microsoft::Console::Render::IFontDefaultList* const pFontDefaultList)
|
void FontInfoBase::s_SetFontDefaultList(_In_ Microsoft::Console::Render::IFontDefaultList* const pFontDefaultList) noexcept
|
||||||
{
|
{
|
||||||
s_pFontDefaultList = pFontDefaultList;
|
s_pFontDefaultList = pFontDefaultList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,29 @@
|
||||||
|
|
||||||
#include "../inc/FontInfoDesired.hpp"
|
#include "../inc/FontInfoDesired.hpp"
|
||||||
|
|
||||||
bool operator==(const FontInfoDesired& a, const FontInfoDesired& b)
|
FontInfoDesired::FontInfoDesired(const std::wstring_view& faceName,
|
||||||
|
const unsigned char family,
|
||||||
|
const unsigned int weight,
|
||||||
|
const COORD coordSizeDesired,
|
||||||
|
const unsigned int codePage) noexcept :
|
||||||
|
FontInfoBase(faceName, family, weight, false, codePage),
|
||||||
|
_coordSizeDesired(coordSizeDesired)
|
||||||
{
|
{
|
||||||
return (static_cast<FontInfoBase>(a) == static_cast<FontInfoBase>(b) &&
|
|
||||||
a._coordSizeDesired == b._coordSizeDesired);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
COORD FontInfoDesired::GetEngineSize() const
|
FontInfoDesired::FontInfoDesired(const FontInfo& fiFont) noexcept :
|
||||||
|
FontInfoBase(fiFont),
|
||||||
|
_coordSizeDesired(fiFont.GetUnscaledSize())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FontInfoDesired::operator==(const FontInfoDesired& other) noexcept
|
||||||
|
{
|
||||||
|
return FontInfoBase::operator==(other) &&
|
||||||
|
_coordSizeDesired == other._coordSizeDesired;
|
||||||
|
}
|
||||||
|
|
||||||
|
COORD FontInfoDesired::GetEngineSize() const noexcept
|
||||||
{
|
{
|
||||||
COORD coordSize = _coordSizeDesired;
|
COORD coordSize = _coordSizeDesired;
|
||||||
if (IsTrueTypeFont())
|
if (IsTrueTypeFont())
|
||||||
|
@ -22,30 +38,14 @@ COORD FontInfoDesired::GetEngineSize() const
|
||||||
return coordSize;
|
return coordSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
FontInfoDesired::FontInfoDesired(const std::wstring_view faceName,
|
|
||||||
const unsigned char family,
|
|
||||||
const unsigned int weight,
|
|
||||||
const COORD coordSizeDesired,
|
|
||||||
const unsigned int codePage) :
|
|
||||||
FontInfoBase(faceName, family, weight, false, codePage),
|
|
||||||
_coordSizeDesired(coordSizeDesired)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
FontInfoDesired::FontInfoDesired(const FontInfo& fiFont) :
|
|
||||||
FontInfoBase(fiFont),
|
|
||||||
_coordSizeDesired(fiFont.GetUnscaledSize())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// This helper determines if this object represents the default raster font. This can either be because internally we're
|
// This helper determines if this object represents the default raster font. This can either be because internally we're
|
||||||
// using the empty facename and zeros for size, weight, and family, or it can be because we were given explicit
|
// using the empty facename and zeros for size, weight, and family, or it can be because we were given explicit
|
||||||
// dimensions from the engine that were the result of loading the default raster font. See GdiEngine::_GetProposedFont().
|
// dimensions from the engine that were the result of loading the default raster font. See GdiEngine::_GetProposedFont().
|
||||||
bool FontInfoDesired::IsDefaultRasterFont() const
|
bool FontInfoDesired::IsDefaultRasterFont() const noexcept
|
||||||
{
|
{
|
||||||
// Either the raster was set from the engine...
|
// Either the raster was set from the engine...
|
||||||
// OR the face name is empty with a size of 0x0 or 8x12.
|
// OR the face name is empty with a size of 0x0 or 8x12.
|
||||||
return WasDefaultRasterSetFromEngine() || (GetFaceName().empty() &&
|
return WasDefaultRasterSetFromEngine() || (GetFaceName().empty() &&
|
||||||
((_coordSizeDesired.X == 0 && _coordSizeDesired.Y == 0) ||
|
(_coordSizeDesired == COORD{ 0, 0 } ||
|
||||||
(_coordSizeDesired.X == 8 && _coordSizeDesired.Y == 12)));
|
_coordSizeDesired == COORD{ 8, 12 }));
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,19 +5,12 @@
|
||||||
|
|
||||||
#include "../inc/FontInfo.hpp"
|
#include "../inc/FontInfo.hpp"
|
||||||
|
|
||||||
bool operator==(const FontInfo& a, const FontInfo& b)
|
FontInfo::FontInfo(const std::wstring_view& faceName,
|
||||||
{
|
|
||||||
return (static_cast<FontInfoBase>(a) == static_cast<FontInfoBase>(b) &&
|
|
||||||
a._coordSize == b._coordSize &&
|
|
||||||
a._coordSizeUnscaled == b._coordSizeUnscaled);
|
|
||||||
}
|
|
||||||
|
|
||||||
FontInfo::FontInfo(const std::wstring_view faceName,
|
|
||||||
const unsigned char family,
|
const unsigned char family,
|
||||||
const unsigned int weight,
|
const unsigned int weight,
|
||||||
const COORD coordSize,
|
const COORD coordSize,
|
||||||
const unsigned int codePage,
|
const unsigned int codePage,
|
||||||
const bool fSetDefaultRasterFont /* = false */) :
|
const bool fSetDefaultRasterFont /* = false */) noexcept :
|
||||||
FontInfoBase(faceName, family, weight, fSetDefaultRasterFont, codePage),
|
FontInfoBase(faceName, family, weight, fSetDefaultRasterFont, codePage),
|
||||||
_coordSize(coordSize),
|
_coordSize(coordSize),
|
||||||
_coordSizeUnscaled(coordSize),
|
_coordSizeUnscaled(coordSize),
|
||||||
|
@ -26,38 +19,36 @@ FontInfo::FontInfo(const std::wstring_view faceName,
|
||||||
ValidateFont();
|
ValidateFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
FontInfo::FontInfo(const FontInfo& fiFont) :
|
bool FontInfo::operator==(const FontInfo& other) noexcept
|
||||||
FontInfoBase(fiFont),
|
|
||||||
_coordSize(fiFont.GetSize()),
|
|
||||||
_coordSizeUnscaled(fiFont.GetUnscaledSize())
|
|
||||||
{
|
{
|
||||||
|
return FontInfoBase::operator==(other) &&
|
||||||
|
_coordSize == other._coordSize &&
|
||||||
|
_coordSizeUnscaled == other._coordSizeUnscaled;
|
||||||
}
|
}
|
||||||
|
|
||||||
COORD FontInfo::GetUnscaledSize() const
|
COORD FontInfo::GetUnscaledSize() const noexcept
|
||||||
{
|
{
|
||||||
return _coordSizeUnscaled;
|
return _coordSizeUnscaled;
|
||||||
}
|
}
|
||||||
|
|
||||||
COORD FontInfo::GetSize() const
|
COORD FontInfo::GetSize() const noexcept
|
||||||
{
|
{
|
||||||
return _coordSize;
|
return _coordSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FontInfo::SetFromEngine(const std::wstring_view faceName,
|
void FontInfo::SetFromEngine(const std::wstring_view& faceName,
|
||||||
const unsigned char family,
|
const unsigned char family,
|
||||||
const unsigned int weight,
|
const unsigned int weight,
|
||||||
const bool fSetDefaultRasterFont,
|
const bool fSetDefaultRasterFont,
|
||||||
const COORD coordSize,
|
const COORD coordSize,
|
||||||
const COORD coordSizeUnscaled)
|
const COORD coordSizeUnscaled) noexcept
|
||||||
{
|
{
|
||||||
FontInfoBase::SetFromEngine(faceName,
|
FontInfoBase::SetFromEngine(faceName,
|
||||||
family,
|
family,
|
||||||
weight,
|
weight,
|
||||||
fSetDefaultRasterFont);
|
fSetDefaultRasterFont);
|
||||||
|
|
||||||
_coordSize = coordSize;
|
_coordSize = coordSize;
|
||||||
_coordSizeUnscaled = coordSizeUnscaled;
|
_coordSizeUnscaled = coordSizeUnscaled;
|
||||||
|
|
||||||
_ValidateCoordSize();
|
_ValidateCoordSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,12 +62,12 @@ void FontInfo::SetFallback(const bool didFallback) noexcept
|
||||||
_didFallback = didFallback;
|
_didFallback = didFallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FontInfo::ValidateFont()
|
void FontInfo::ValidateFont() noexcept
|
||||||
{
|
{
|
||||||
_ValidateCoordSize();
|
_ValidateCoordSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FontInfo::_ValidateCoordSize()
|
void FontInfo::_ValidateCoordSize() noexcept
|
||||||
{
|
{
|
||||||
// a (0,0) font is okay for the default raster font, as we will eventually set the dimensions based on the font GDI
|
// a (0,0) font is okay for the default raster font, as we will eventually set the dimensions based on the font GDI
|
||||||
// passes back to us.
|
// passes back to us.
|
||||||
|
|
|
@ -610,7 +610,7 @@ GdiEngine::~GdiEngine()
|
||||||
// NOTE: not using what GDI gave us because some fonts don't quite roundtrip (e.g. MS Gothic and VL Gothic)
|
// NOTE: not using what GDI gave us because some fonts don't quite roundtrip (e.g. MS Gothic and VL Gothic)
|
||||||
lf.lfPitchAndFamily = (FIXED_PITCH | FF_MODERN);
|
lf.lfPitchAndFamily = (FIXED_PITCH | FF_MODERN);
|
||||||
|
|
||||||
RETURN_IF_FAILED(FontDesired.FillLegacyNameBuffer(gsl::make_span(lf.lfFaceName)));
|
FontDesired.FillLegacyNameBuffer(lf.lfFaceName);
|
||||||
|
|
||||||
// Create font.
|
// Create font.
|
||||||
hFont.reset(CreateFontIndirectW(&lf));
|
hFont.reset(CreateFontIndirectW(&lf));
|
||||||
|
|
|
@ -28,40 +28,31 @@ Author(s):
|
||||||
class FontInfo : public FontInfoBase
|
class FontInfo : public FontInfoBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FontInfo(const std::wstring_view faceName,
|
FontInfo(const std::wstring_view& faceName,
|
||||||
const unsigned char family,
|
const unsigned char family,
|
||||||
const unsigned int weight,
|
const unsigned int weight,
|
||||||
const COORD coordSize,
|
const COORD coordSize,
|
||||||
const unsigned int codePage,
|
const unsigned int codePage,
|
||||||
const bool fSetDefaultRasterFont = false);
|
const bool fSetDefaultRasterFont = false) noexcept;
|
||||||
|
|
||||||
FontInfo(const FontInfo& fiFont);
|
bool operator==(const FontInfo& other) noexcept;
|
||||||
|
|
||||||
COORD GetSize() const;
|
COORD GetSize() const noexcept;
|
||||||
COORD GetUnscaledSize() const;
|
COORD GetUnscaledSize() const noexcept;
|
||||||
|
void SetFromEngine(const std::wstring_view& faceName,
|
||||||
void SetFromEngine(const std::wstring_view faceName,
|
|
||||||
const unsigned char family,
|
const unsigned char family,
|
||||||
const unsigned int weight,
|
const unsigned int weight,
|
||||||
const bool fSetDefaultRasterFont,
|
const bool fSetDefaultRasterFont,
|
||||||
const COORD coordSize,
|
const COORD coordSize,
|
||||||
const COORD coordSizeUnscaled);
|
const COORD coordSizeUnscaled) noexcept;
|
||||||
|
|
||||||
bool GetFallback() const noexcept;
|
bool GetFallback() const noexcept;
|
||||||
void SetFallback(const bool didFallback) noexcept;
|
void SetFallback(const bool didFallback) noexcept;
|
||||||
|
void ValidateFont() noexcept;
|
||||||
void ValidateFont();
|
|
||||||
|
|
||||||
friend bool operator==(const FontInfo& a, const FontInfo& b);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _ValidateCoordSize();
|
void _ValidateCoordSize() noexcept;
|
||||||
|
|
||||||
COORD _coordSize;
|
COORD _coordSize;
|
||||||
COORD _coordSizeUnscaled;
|
COORD _coordSizeUnscaled;
|
||||||
bool _didFallback;
|
bool _didFallback;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator==(const FontInfo& a, const FontInfo& b);
|
|
||||||
|
|
||||||
// SET AND UNSET CONSOLE_OEMFONT_DISPLAY unless we can get rid of the stupid recoding in the conhost side.
|
|
||||||
|
|
|
@ -26,40 +26,32 @@ static constexpr wchar_t DEFAULT_RASTER_FONT_FACENAME[]{ L"Terminal" };
|
||||||
class FontInfoBase
|
class FontInfoBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FontInfoBase(const std::wstring_view faceName,
|
FontInfoBase(const std::wstring_view& faceName,
|
||||||
const unsigned char family,
|
const unsigned char family,
|
||||||
const unsigned int weight,
|
const unsigned int weight,
|
||||||
const bool fSetDefaultRasterFont,
|
const bool fSetDefaultRasterFont,
|
||||||
const unsigned int uiCodePage);
|
const unsigned int uiCodePage) noexcept;
|
||||||
|
|
||||||
FontInfoBase(const FontInfoBase& fibFont);
|
bool operator==(const FontInfoBase& other) noexcept;
|
||||||
|
|
||||||
~FontInfoBase();
|
unsigned char GetFamily() const noexcept;
|
||||||
|
unsigned int GetWeight() const noexcept;
|
||||||
unsigned char GetFamily() const;
|
const std::wstring& GetFaceName() const noexcept;
|
||||||
unsigned int GetWeight() const;
|
unsigned int GetCodePage() const noexcept;
|
||||||
const std::wstring_view GetFaceName() const noexcept;
|
void FillLegacyNameBuffer(wchar_t (&buffer)[LF_FACESIZE]) const noexcept;
|
||||||
unsigned int GetCodePage() const;
|
bool IsTrueTypeFont() const noexcept;
|
||||||
|
void SetFromEngine(const std::wstring_view& faceName,
|
||||||
HRESULT FillLegacyNameBuffer(gsl::span<wchar_t> buffer) const;
|
|
||||||
|
|
||||||
bool IsTrueTypeFont() const;
|
|
||||||
|
|
||||||
void SetFromEngine(const std::wstring_view faceName,
|
|
||||||
const unsigned char family,
|
const unsigned char family,
|
||||||
const unsigned int weight,
|
const unsigned int weight,
|
||||||
const bool fSetDefaultRasterFont);
|
const bool fSetDefaultRasterFont) noexcept;
|
||||||
|
bool WasDefaultRasterSetFromEngine() const noexcept;
|
||||||
bool WasDefaultRasterSetFromEngine() const;
|
void ValidateFont() noexcept;
|
||||||
void ValidateFont();
|
|
||||||
|
|
||||||
static Microsoft::Console::Render::IFontDefaultList* s_pFontDefaultList;
|
static Microsoft::Console::Render::IFontDefaultList* s_pFontDefaultList;
|
||||||
static void s_SetFontDefaultList(_In_ Microsoft::Console::Render::IFontDefaultList* const pFontDefaultList);
|
static void s_SetFontDefaultList(_In_ Microsoft::Console::Render::IFontDefaultList* const pFontDefaultList) noexcept;
|
||||||
|
|
||||||
friend bool operator==(const FontInfoBase& a, const FontInfoBase& b);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool IsDefaultRasterFontNoSize() const;
|
bool IsDefaultRasterFontNoSize() const noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::wstring _faceName;
|
std::wstring _faceName;
|
||||||
|
@ -68,5 +60,3 @@ private:
|
||||||
unsigned int _codePage;
|
unsigned int _codePage;
|
||||||
bool _fDefaultRasterSetFromEngine;
|
bool _fDefaultRasterSetFromEngine;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator==(const FontInfoBase& a, const FontInfoBase& b);
|
|
||||||
|
|
|
@ -24,21 +24,18 @@ Author(s):
|
||||||
class FontInfoDesired : public FontInfoBase
|
class FontInfoDesired : public FontInfoBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FontInfoDesired(const std::wstring_view faceName,
|
FontInfoDesired(const std::wstring_view& faceName,
|
||||||
const unsigned char family,
|
const unsigned char family,
|
||||||
const unsigned int weight,
|
const unsigned int weight,
|
||||||
const COORD coordSizeDesired,
|
const COORD coordSizeDesired,
|
||||||
const unsigned int uiCodePage);
|
const unsigned int uiCodePage) noexcept;
|
||||||
|
FontInfoDesired(const FontInfo& fiFont) noexcept;
|
||||||
|
|
||||||
FontInfoDesired(const FontInfo& fiFont);
|
bool operator==(const FontInfoDesired& other) noexcept;
|
||||||
|
|
||||||
COORD GetEngineSize() const;
|
COORD GetEngineSize() const noexcept;
|
||||||
bool IsDefaultRasterFont() const;
|
bool IsDefaultRasterFont() const noexcept;
|
||||||
|
|
||||||
friend bool operator==(const FontInfoDesired& a, const FontInfoDesired& b);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
COORD _coordSizeDesired;
|
COORD _coordSizeDesired;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator==(const FontInfoDesired& a, const FontInfoDesired& b);
|
|
||||||
|
|
|
@ -24,10 +24,10 @@ namespace Microsoft::Console::Types
|
||||||
public:
|
public:
|
||||||
virtual ~IControlAccessibilityInfo() = 0;
|
virtual ~IControlAccessibilityInfo() = 0;
|
||||||
|
|
||||||
virtual COORD GetFontSize() const = 0;
|
virtual COORD GetFontSize() const noexcept = 0;
|
||||||
virtual RECT GetBounds() const = 0;
|
virtual RECT GetBounds() const noexcept = 0;
|
||||||
virtual RECT GetPadding() const = 0;
|
virtual RECT GetPadding() const noexcept = 0;
|
||||||
virtual double GetScaleFactor() const = 0;
|
virtual double GetScaleFactor() const noexcept = 0;
|
||||||
virtual void ChangeViewport(const SMALL_RECT NewWindow) = 0;
|
virtual void ChangeViewport(const SMALL_RECT NewWindow) = 0;
|
||||||
virtual HRESULT GetHostUiaProvider(IRawElementProviderSimple** provider) = 0;
|
virtual HRESULT GetHostUiaProvider(IRawElementProviderSimple** provider) = 0;
|
||||||
|
|
||||||
|
@ -40,4 +40,4 @@ namespace Microsoft::Console::Types
|
||||||
};
|
};
|
||||||
|
|
||||||
inline IControlAccessibilityInfo::~IControlAccessibilityInfo() {}
|
inline IControlAccessibilityInfo::~IControlAccessibilityInfo() {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ IFACEMETHODIMP TermControlUiaProvider::Navigate(_In_ NavigateDirection direction
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP TermControlUiaProvider::get_BoundingRectangle(_Out_ UiaRect* pRect)
|
IFACEMETHODIMP TermControlUiaProvider::get_BoundingRectangle(_Out_ UiaRect* pRect) noexcept
|
||||||
{
|
{
|
||||||
// TODO GitHub #1914: Re-attach Tracing to UIA Tree
|
// TODO GitHub #1914: Re-attach Tracing to UIA Tree
|
||||||
//Tracing::s_TraceUia(this, ApiCall::GetBoundingRectangle, nullptr);
|
//Tracing::s_TraceUia(this, ApiCall::GetBoundingRectangle, nullptr);
|
||||||
|
@ -89,17 +89,17 @@ IFACEMETHODIMP TermControlUiaProvider::get_FragmentRoot(_COM_Outptr_result_maybe
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
const COORD TermControlUiaProvider::GetFontSize() const
|
const COORD TermControlUiaProvider::GetFontSize() const noexcept
|
||||||
{
|
{
|
||||||
return _controlInfo->GetFontSize();
|
return _controlInfo->GetFontSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
const RECT TermControlUiaProvider::GetPadding() const
|
const RECT TermControlUiaProvider::GetPadding() const noexcept
|
||||||
{
|
{
|
||||||
return _controlInfo->GetPadding();
|
return _controlInfo->GetPadding();
|
||||||
}
|
}
|
||||||
|
|
||||||
const double TermControlUiaProvider::GetScaleFactor() const
|
const double TermControlUiaProvider::GetScaleFactor() const noexcept
|
||||||
{
|
{
|
||||||
return _controlInfo->GetScaleFactor();
|
return _controlInfo->GetScaleFactor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,12 +36,12 @@ namespace Microsoft::Terminal
|
||||||
IFACEMETHODIMP Navigate(_In_ NavigateDirection direction,
|
IFACEMETHODIMP Navigate(_In_ NavigateDirection direction,
|
||||||
_COM_Outptr_result_maybenull_ IRawElementProviderFragment** ppProvider) noexcept override;
|
_COM_Outptr_result_maybenull_ IRawElementProviderFragment** ppProvider) noexcept override;
|
||||||
IFACEMETHODIMP get_HostRawElementProvider(IRawElementProviderSimple** ppProvider) noexcept override;
|
IFACEMETHODIMP get_HostRawElementProvider(IRawElementProviderSimple** ppProvider) noexcept override;
|
||||||
IFACEMETHODIMP get_BoundingRectangle(_Out_ UiaRect* pRect) override;
|
IFACEMETHODIMP get_BoundingRectangle(_Out_ UiaRect* pRect) noexcept override;
|
||||||
IFACEMETHODIMP get_FragmentRoot(_COM_Outptr_result_maybenull_ IRawElementProviderFragmentRoot** ppProvider) noexcept override;
|
IFACEMETHODIMP get_FragmentRoot(_COM_Outptr_result_maybenull_ IRawElementProviderFragmentRoot** ppProvider) noexcept override;
|
||||||
|
|
||||||
const COORD GetFontSize() const;
|
const COORD GetFontSize() const noexcept;
|
||||||
const RECT GetPadding() const;
|
const RECT GetPadding() const noexcept;
|
||||||
const double GetScaleFactor() const;
|
const double GetScaleFactor() const noexcept;
|
||||||
void ChangeViewport(const SMALL_RECT NewWindow) override;
|
void ChangeViewport(const SMALL_RECT NewWindow) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -134,7 +134,7 @@ void TermControlUiaTextRange::_TranslatePointFromScreen(LPPOINT screenPoint) con
|
||||||
screenPoint->y = includeOffsets(screenPoint->y, boundingRect.top, padding.top, scaleFactor);
|
screenPoint->y = includeOffsets(screenPoint->y, boundingRect.top, padding.top, scaleFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
const COORD TermControlUiaTextRange::_getScreenFontSize() const
|
const COORD TermControlUiaTextRange::_getScreenFontSize() const noexcept
|
||||||
{
|
{
|
||||||
// Do NOT get the font info from IRenderData. It is a dummy font info.
|
// Do NOT get the font info from IRenderData. It is a dummy font info.
|
||||||
// Instead, the font info is saved in the TermControl. So we have to
|
// Instead, the font info is saved in the TermControl. So we have to
|
||||||
|
|
|
@ -57,6 +57,6 @@ namespace Microsoft::Terminal
|
||||||
protected:
|
protected:
|
||||||
void _TranslatePointToScreen(LPPOINT clientPoint) const override;
|
void _TranslatePointToScreen(LPPOINT clientPoint) const override;
|
||||||
void _TranslatePointFromScreen(LPPOINT screenPoint) const override;
|
void _TranslatePointFromScreen(LPPOINT screenPoint) const override;
|
||||||
const COORD _getScreenFontSize() const override;
|
const COORD _getScreenFontSize() const noexcept override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1313,7 +1313,7 @@ IFACEMETHODIMP UiaTextRangeBase::GetChildren(_Outptr_result_maybenull_ SAFEARRAY
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
const COORD UiaTextRangeBase::_getScreenFontSize() const
|
const COORD UiaTextRangeBase::_getScreenFontSize() const noexcept
|
||||||
{
|
{
|
||||||
COORD coordRet = _pData->GetFontInfo().GetSize();
|
COORD coordRet = _pData->GetFontInfo().GetSize();
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ namespace Microsoft::Console::Types
|
||||||
|
|
||||||
RECT _getTerminalRect() const;
|
RECT _getTerminalRect() const;
|
||||||
|
|
||||||
virtual const COORD _getScreenFontSize() const;
|
virtual const COORD _getScreenFontSize() const noexcept;
|
||||||
|
|
||||||
const unsigned int _getViewportHeight(const SMALL_RECT viewport) const noexcept;
|
const unsigned int _getViewportHeight(const SMALL_RECT viewport) const noexcept;
|
||||||
const Viewport _getOptimizedBufferSize() const noexcept;
|
const Viewport _getOptimizedBufferSize() const noexcept;
|
||||||
|
|
Loading…
Reference in a new issue