diff --git a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp index 02025be813e..6a1a8282cb5 100644 --- a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp +++ b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp @@ -977,7 +977,7 @@ void HwndTerminal::_StringPaste(const wchar_t* const pData) noexcept CATCH_LOG(); } -COORD HwndTerminal::GetFontSize() const +COORD HwndTerminal::GetFontSize() const noexcept { return _actualFont.GetSize(); } diff --git a/src/cascadia/PublicTerminalCore/HwndTerminal.hpp b/src/cascadia/PublicTerminalCore/HwndTerminal.hpp index bc9c8ba4a55..0510675efc0 100644 --- a/src/cascadia/PublicTerminalCore/HwndTerminal.hpp +++ b/src/cascadia/PublicTerminalCore/HwndTerminal.hpp @@ -128,7 +128,7 @@ struct HwndTerminal : ::Microsoft::Console::Types::IControlAccessibilityInfo void _SendCharEvent(wchar_t ch, WORD scanCode, WORD flags) noexcept; // Inherited via IControlAccessibilityInfo - COORD GetFontSize() const override; + COORD GetFontSize() const noexcept override; RECT GetBounds() const noexcept override; double GetScaleFactor() const noexcept override; void ChangeViewport(const SMALL_RECT NewWindow) override; diff --git a/src/cascadia/TerminalControl/InteractivityAutomationPeer.cpp b/src/cascadia/TerminalControl/InteractivityAutomationPeer.cpp index e34811e73c7..570cfd67ec6 100644 --- a/src/cascadia/TerminalControl/InteractivityAutomationPeer.cpp +++ b/src/cascadia/TerminalControl/InteractivityAutomationPeer.cpp @@ -141,12 +141,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation #pragma endregion #pragma region IControlAccessibilityInfo - COORD InteractivityAutomationPeer::GetFontSize() const + COORD InteractivityAutomationPeer::GetFontSize() const noexcept { return til::size{ til::math::rounding, _interactivity->Core().FontSize() }; } - RECT InteractivityAutomationPeer::GetBounds() const + RECT InteractivityAutomationPeer::GetBounds() const noexcept { return _controlBounds; } @@ -159,12 +159,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation return S_OK; } - RECT InteractivityAutomationPeer::GetPadding() const + RECT InteractivityAutomationPeer::GetPadding() const noexcept { return _controlPadding; } - double InteractivityAutomationPeer::GetScaleFactor() const + double InteractivityAutomationPeer::GetScaleFactor() const noexcept { return DisplayInformation::GetForCurrentView().RawPixelsPerViewPixel(); } diff --git a/src/cascadia/TerminalControl/InteractivityAutomationPeer.h b/src/cascadia/TerminalControl/InteractivityAutomationPeer.h index 144ea20ef3f..bd95c54047b 100644 --- a/src/cascadia/TerminalControl/InteractivityAutomationPeer.h +++ b/src/cascadia/TerminalControl/InteractivityAutomationPeer.h @@ -62,10 +62,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation #pragma region IControlAccessibilityInfo Pattern // Inherited via IControlAccessibilityInfo - virtual COORD GetFontSize() const override; - virtual RECT GetBounds() const override; - virtual RECT GetPadding() const override; - virtual double GetScaleFactor() const override; + virtual COORD GetFontSize() const noexcept override; + virtual RECT GetBounds() const noexcept override; + virtual RECT GetPadding() const noexcept override; + virtual double GetScaleFactor() const noexcept override; virtual void ChangeViewport(SMALL_RECT NewWindow) override; virtual HRESULT GetHostUiaProvider(IRawElementProviderSimple** provider) override; #pragma endregion diff --git a/src/host/getset.cpp b/src/host/getset.cpp index 5ee114e6d82..6203aef0e54 100644 --- a/src/host/getset.cpp +++ b/src/host/getset.cpp @@ -274,8 +274,7 @@ void ApiRoutines::GetNumberOfConsoleMouseButtonsImpl(ULONG& buttons) noexcept const FontInfo& fontInfo = activeScreenInfo.GetCurrentFont(); consoleFontInfoEx.FontFamily = fontInfo.GetFamily(); consoleFontInfoEx.FontWeight = fontInfo.GetWeight(); - - RETURN_IF_FAILED(fontInfo.FillLegacyNameBuffer(gsl::make_span(consoleFontInfoEx.FaceName))); + fontInfo.FillLegacyNameBuffer(consoleFontInfoEx.FaceName); return S_OK; } diff --git a/src/renderer/base/FontInfoBase.cpp b/src/renderer/base/FontInfoBase.cpp index 40891cf4940..c95abf08dea 100644 --- a/src/renderer/base/FontInfoBase.cpp +++ b/src/renderer/base/FontInfoBase.cpp @@ -7,20 +7,11 @@ #include "../inc/FontInfoBase.hpp" -bool operator==(const FontInfoBase& a, const FontInfoBase& b) -{ - 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, +FontInfoBase::FontInfoBase(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const bool fSetDefaultRasterFont, - const unsigned int codePage) : + const unsigned int codePage) noexcept : _faceName(faceName), _family(family), _weight(weight), @@ -30,20 +21,16 @@ FontInfoBase::FontInfoBase(const std::wstring_view faceName, ValidateFont(); } -FontInfoBase::FontInfoBase(const FontInfoBase& fibFont) : - FontInfoBase(fibFont.GetFaceName(), - fibFont.GetFamily(), - fibFont.GetWeight(), - fibFont.WasDefaultRasterSetFromEngine(), - fibFont.GetCodePage()) -{ -} - -FontInfoBase::~FontInfoBase() +bool FontInfoBase::operator==(const FontInfoBase& other) noexcept { + return _faceName == other._faceName && + _weight == other._weight && + _family == other._family && + _codePage == other._codePage && + _fDefaultRasterSetFromEngine == other._fDefaultRasterSetFromEngine; } -unsigned char FontInfoBase::GetFamily() const +unsigned char FontInfoBase::GetFamily() const noexcept { 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. // 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). -bool FontInfoBase::WasDefaultRasterSetFromEngine() const +bool FontInfoBase::WasDefaultRasterSetFromEngine() const noexcept { return _fDefaultRasterSetFromEngine; } -unsigned int FontInfoBase::GetWeight() const +unsigned int FontInfoBase::GetWeight() const noexcept { return _weight; } -const std::wstring_view FontInfoBase::GetFaceName() const noexcept +const std::wstring& FontInfoBase::GetFaceName() const noexcept { return _faceName; } -unsigned int FontInfoBase::GetCodePage() const +unsigned int FontInfoBase::GetCodePage() const noexcept { return _codePage; } @@ -77,21 +64,18 @@ unsigned int FontInfoBase::GetCodePage() const // Arguments: // - buffer: the buffer into which to copy characters // - size: the size of buffer -HRESULT FontInfoBase::FillLegacyNameBuffer(gsl::span buffer) const -try +void FontInfoBase::FillLegacyNameBuffer(wchar_t (&buffer)[LF_FACESIZE]) const noexcept { - auto toCopy = std::min(buffer.size() - 1, _faceName.size()); - auto last = std::copy(_faceName.cbegin(), _faceName.cbegin() + toCopy, buffer.begin()); - std::fill(last, buffer.end(), L'\0'); - return S_OK; + const auto toCopy = std::min(std::size(buffer) - 1, _faceName.size()); + const auto last = std::copy_n(_faceName.data(), toCopy, &buffer[0]); + *last = L'\0'; } -CATCH_RETURN(); // 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 int weight, - const bool fSetDefaultRasterFont) + const bool fSetDefaultRasterFont) noexcept { _faceName = faceName; _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 // 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()); } -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 (!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); } 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; } diff --git a/src/renderer/base/FontInfoDesired.cpp b/src/renderer/base/FontInfoDesired.cpp index c293d141a40..900648ad69b 100644 --- a/src/renderer/base/FontInfoDesired.cpp +++ b/src/renderer/base/FontInfoDesired.cpp @@ -5,47 +5,47 @@ #include "../inc/FontInfoDesired.hpp" -bool operator==(const FontInfoDesired& a, const FontInfoDesired& b) -{ - return (static_cast(a) == static_cast(b) && - a._coordSizeDesired == b._coordSizeDesired); -} - -COORD FontInfoDesired::GetEngineSize() const -{ - COORD coordSize = _coordSizeDesired; - if (IsTrueTypeFont()) - { - coordSize.X = 0; // Don't tell the engine about the width for a TrueType font. It makes a mess. - } - - return coordSize; -} - -FontInfoDesired::FontInfoDesired(const std::wstring_view faceName, +FontInfoDesired::FontInfoDesired(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const COORD coordSizeDesired, - const unsigned int codePage) : + const unsigned int codePage) noexcept : FontInfoBase(faceName, family, weight, false, codePage), _coordSizeDesired(coordSizeDesired) { } -FontInfoDesired::FontInfoDesired(const FontInfo& fiFont) : +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; + if (IsTrueTypeFont()) + { + coordSize.X = 0; // Don't tell the engine about the width for a TrueType font. It makes a mess. + } + + return coordSize; +} + // 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 // 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... // OR the face name is empty with a size of 0x0 or 8x12. return WasDefaultRasterSetFromEngine() || (GetFaceName().empty() && - ((_coordSizeDesired.X == 0 && _coordSizeDesired.Y == 0) || - (_coordSizeDesired.X == 8 && _coordSizeDesired.Y == 12))); + (_coordSizeDesired == COORD{ 0, 0 } || + _coordSizeDesired == COORD{ 8, 12 })); } diff --git a/src/renderer/base/fontinfo.cpp b/src/renderer/base/fontinfo.cpp index ef3c37e8cda..c73326c0852 100644 --- a/src/renderer/base/fontinfo.cpp +++ b/src/renderer/base/fontinfo.cpp @@ -5,19 +5,12 @@ #include "../inc/FontInfo.hpp" -bool operator==(const FontInfo& a, const FontInfo& b) -{ - return (static_cast(a) == static_cast(b) && - a._coordSize == b._coordSize && - a._coordSizeUnscaled == b._coordSizeUnscaled); -} - -FontInfo::FontInfo(const std::wstring_view faceName, +FontInfo::FontInfo(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const COORD coordSize, const unsigned int codePage, - const bool fSetDefaultRasterFont /* = false */) : + const bool fSetDefaultRasterFont /* = false */) noexcept : FontInfoBase(faceName, family, weight, fSetDefaultRasterFont, codePage), _coordSize(coordSize), _coordSizeUnscaled(coordSize), @@ -26,38 +19,36 @@ FontInfo::FontInfo(const std::wstring_view faceName, ValidateFont(); } -FontInfo::FontInfo(const FontInfo& fiFont) : - FontInfoBase(fiFont), - _coordSize(fiFont.GetSize()), - _coordSizeUnscaled(fiFont.GetUnscaledSize()) +bool FontInfo::operator==(const FontInfo& other) noexcept { + return FontInfoBase::operator==(other) && + _coordSize == other._coordSize && + _coordSizeUnscaled == other._coordSizeUnscaled; } -COORD FontInfo::GetUnscaledSize() const +COORD FontInfo::GetUnscaledSize() const noexcept { return _coordSizeUnscaled; } -COORD FontInfo::GetSize() const +COORD FontInfo::GetSize() const noexcept { return _coordSize; } -void FontInfo::SetFromEngine(const std::wstring_view faceName, +void FontInfo::SetFromEngine(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const bool fSetDefaultRasterFont, const COORD coordSize, - const COORD coordSizeUnscaled) + const COORD coordSizeUnscaled) noexcept { FontInfoBase::SetFromEngine(faceName, family, weight, fSetDefaultRasterFont); - _coordSize = coordSize; _coordSizeUnscaled = coordSizeUnscaled; - _ValidateCoordSize(); } @@ -71,12 +62,12 @@ void FontInfo::SetFallback(const bool didFallback) noexcept _didFallback = didFallback; } -void FontInfo::ValidateFont() +void FontInfo::ValidateFont() noexcept { _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 // passes back to us. diff --git a/src/renderer/gdi/state.cpp b/src/renderer/gdi/state.cpp index 04a5df7d5cc..722577c8ec0 100644 --- a/src/renderer/gdi/state.cpp +++ b/src/renderer/gdi/state.cpp @@ -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) lf.lfPitchAndFamily = (FIXED_PITCH | FF_MODERN); - RETURN_IF_FAILED(FontDesired.FillLegacyNameBuffer(gsl::make_span(lf.lfFaceName))); + FontDesired.FillLegacyNameBuffer(lf.lfFaceName); // Create font. hFont.reset(CreateFontIndirectW(&lf)); diff --git a/src/renderer/inc/FontInfo.hpp b/src/renderer/inc/FontInfo.hpp index 56065881e59..2b5ee35640a 100644 --- a/src/renderer/inc/FontInfo.hpp +++ b/src/renderer/inc/FontInfo.hpp @@ -28,40 +28,31 @@ Author(s): class FontInfo : public FontInfoBase { public: - FontInfo(const std::wstring_view faceName, + FontInfo(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const COORD coordSize, 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 GetUnscaledSize() const; - - void SetFromEngine(const std::wstring_view faceName, + COORD GetSize() const noexcept; + COORD GetUnscaledSize() const noexcept; + void SetFromEngine(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const bool fSetDefaultRasterFont, const COORD coordSize, - const COORD coordSizeUnscaled); - + const COORD coordSizeUnscaled) noexcept; bool GetFallback() const noexcept; void SetFallback(const bool didFallback) noexcept; - - void ValidateFont(); - - friend bool operator==(const FontInfo& a, const FontInfo& b); + void ValidateFont() noexcept; private: - void _ValidateCoordSize(); + void _ValidateCoordSize() noexcept; COORD _coordSize; COORD _coordSizeUnscaled; 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. diff --git a/src/renderer/inc/FontInfoBase.hpp b/src/renderer/inc/FontInfoBase.hpp index aa9f3cddbb6..2ef5478f84d 100644 --- a/src/renderer/inc/FontInfoBase.hpp +++ b/src/renderer/inc/FontInfoBase.hpp @@ -26,40 +26,32 @@ static constexpr wchar_t DEFAULT_RASTER_FONT_FACENAME[]{ L"Terminal" }; class FontInfoBase { public: - FontInfoBase(const std::wstring_view faceName, + FontInfoBase(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, 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; - unsigned int GetWeight() const; - const std::wstring_view GetFaceName() const noexcept; - unsigned int GetCodePage() const; - - HRESULT FillLegacyNameBuffer(gsl::span buffer) const; - - bool IsTrueTypeFont() const; - - void SetFromEngine(const std::wstring_view faceName, + unsigned char GetFamily() const noexcept; + unsigned int GetWeight() const noexcept; + const std::wstring& GetFaceName() const noexcept; + unsigned int GetCodePage() const noexcept; + void FillLegacyNameBuffer(wchar_t (&buffer)[LF_FACESIZE]) const noexcept; + bool IsTrueTypeFont() const noexcept; + void SetFromEngine(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, - const bool fSetDefaultRasterFont); - - bool WasDefaultRasterSetFromEngine() const; - void ValidateFont(); + const bool fSetDefaultRasterFont) noexcept; + bool WasDefaultRasterSetFromEngine() const noexcept; + void ValidateFont() noexcept; static Microsoft::Console::Render::IFontDefaultList* s_pFontDefaultList; - static void s_SetFontDefaultList(_In_ Microsoft::Console::Render::IFontDefaultList* const pFontDefaultList); - - friend bool operator==(const FontInfoBase& a, const FontInfoBase& b); + static void s_SetFontDefaultList(_In_ Microsoft::Console::Render::IFontDefaultList* const pFontDefaultList) noexcept; protected: - bool IsDefaultRasterFontNoSize() const; + bool IsDefaultRasterFontNoSize() const noexcept; private: std::wstring _faceName; @@ -68,5 +60,3 @@ class FontInfoBase unsigned int _codePage; bool _fDefaultRasterSetFromEngine; }; - -bool operator==(const FontInfoBase& a, const FontInfoBase& b); diff --git a/src/renderer/inc/FontInfoDesired.hpp b/src/renderer/inc/FontInfoDesired.hpp index a680f18561e..44e5858192e 100644 --- a/src/renderer/inc/FontInfoDesired.hpp +++ b/src/renderer/inc/FontInfoDesired.hpp @@ -24,21 +24,18 @@ Author(s): class FontInfoDesired : public FontInfoBase { public: - FontInfoDesired(const std::wstring_view faceName, + FontInfoDesired(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, 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; - bool IsDefaultRasterFont() const; - - friend bool operator==(const FontInfoDesired& a, const FontInfoDesired& b); + COORD GetEngineSize() const noexcept; + bool IsDefaultRasterFont() const noexcept; private: COORD _coordSizeDesired; }; - -bool operator==(const FontInfoDesired& a, const FontInfoDesired& b); diff --git a/src/types/IControlAccessibilityInfo.h b/src/types/IControlAccessibilityInfo.h index b20f965698f..de3a3eeecf5 100644 --- a/src/types/IControlAccessibilityInfo.h +++ b/src/types/IControlAccessibilityInfo.h @@ -24,10 +24,10 @@ namespace Microsoft::Console::Types public: virtual ~IControlAccessibilityInfo() = 0; - virtual COORD GetFontSize() const = 0; - virtual RECT GetBounds() const = 0; - virtual RECT GetPadding() const = 0; - virtual double GetScaleFactor() const = 0; + virtual COORD GetFontSize() const noexcept = 0; + virtual RECT GetBounds() const noexcept = 0; + virtual RECT GetPadding() const noexcept = 0; + virtual double GetScaleFactor() const noexcept = 0; virtual void ChangeViewport(const SMALL_RECT NewWindow) = 0; virtual HRESULT GetHostUiaProvider(IRawElementProviderSimple** provider) = 0; @@ -40,4 +40,4 @@ namespace Microsoft::Console::Types }; inline IControlAccessibilityInfo::~IControlAccessibilityInfo() {} -} \ No newline at end of file +} diff --git a/src/types/TermControlUiaProvider.cpp b/src/types/TermControlUiaProvider.cpp index edcee5a15ab..2d96fa44b32 100644 --- a/src/types/TermControlUiaProvider.cpp +++ b/src/types/TermControlUiaProvider.cpp @@ -44,7 +44,7 @@ IFACEMETHODIMP TermControlUiaProvider::Navigate(_In_ NavigateDirection direction 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 //Tracing::s_TraceUia(this, ApiCall::GetBoundingRectangle, nullptr); @@ -89,17 +89,17 @@ IFACEMETHODIMP TermControlUiaProvider::get_FragmentRoot(_COM_Outptr_result_maybe return S_OK; } -const COORD TermControlUiaProvider::GetFontSize() const +const COORD TermControlUiaProvider::GetFontSize() const noexcept { return _controlInfo->GetFontSize(); } -const RECT TermControlUiaProvider::GetPadding() const +const RECT TermControlUiaProvider::GetPadding() const noexcept { return _controlInfo->GetPadding(); } -const double TermControlUiaProvider::GetScaleFactor() const +const double TermControlUiaProvider::GetScaleFactor() const noexcept { return _controlInfo->GetScaleFactor(); } diff --git a/src/types/TermControlUiaProvider.hpp b/src/types/TermControlUiaProvider.hpp index a7629ea08c4..4e2131267da 100644 --- a/src/types/TermControlUiaProvider.hpp +++ b/src/types/TermControlUiaProvider.hpp @@ -36,12 +36,12 @@ namespace Microsoft::Terminal IFACEMETHODIMP Navigate(_In_ NavigateDirection direction, _COM_Outptr_result_maybenull_ IRawElementProviderFragment** 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; - const COORD GetFontSize() const; - const RECT GetPadding() const; - const double GetScaleFactor() const; + const COORD GetFontSize() const noexcept; + const RECT GetPadding() const noexcept; + const double GetScaleFactor() const noexcept; void ChangeViewport(const SMALL_RECT NewWindow) override; protected: diff --git a/src/types/TermControlUiaTextRange.cpp b/src/types/TermControlUiaTextRange.cpp index 5d95dbd88d0..97a5ca41f04 100644 --- a/src/types/TermControlUiaTextRange.cpp +++ b/src/types/TermControlUiaTextRange.cpp @@ -134,7 +134,7 @@ void TermControlUiaTextRange::_TranslatePointFromScreen(LPPOINT screenPoint) con 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. // Instead, the font info is saved in the TermControl. So we have to diff --git a/src/types/TermControlUiaTextRange.hpp b/src/types/TermControlUiaTextRange.hpp index 4ec34277af7..42afc210b77 100644 --- a/src/types/TermControlUiaTextRange.hpp +++ b/src/types/TermControlUiaTextRange.hpp @@ -57,6 +57,6 @@ namespace Microsoft::Terminal protected: void _TranslatePointToScreen(LPPOINT clientPoint) const override; void _TranslatePointFromScreen(LPPOINT screenPoint) const override; - const COORD _getScreenFontSize() const override; + const COORD _getScreenFontSize() const noexcept override; }; } diff --git a/src/types/UiaTextRangeBase.cpp b/src/types/UiaTextRangeBase.cpp index c32a6a9003f..2bc7411d9dd 100644 --- a/src/types/UiaTextRangeBase.cpp +++ b/src/types/UiaTextRangeBase.cpp @@ -1313,7 +1313,7 @@ IFACEMETHODIMP UiaTextRangeBase::GetChildren(_Outptr_result_maybenull_ SAFEARRAY #pragma endregion -const COORD UiaTextRangeBase::_getScreenFontSize() const +const COORD UiaTextRangeBase::_getScreenFontSize() const noexcept { COORD coordRet = _pData->GetFontInfo().GetSize(); diff --git a/src/types/UiaTextRangeBase.hpp b/src/types/UiaTextRangeBase.hpp index 24756648fdd..c9089438d1b 100644 --- a/src/types/UiaTextRangeBase.hpp +++ b/src/types/UiaTextRangeBase.hpp @@ -146,7 +146,7 @@ namespace Microsoft::Console::Types 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 Viewport _getOptimizedBufferSize() const noexcept;