From d4d8e47c42851d59fa0f8745508a2d663e6975c5 Mon Sep 17 00:00:00 2001 From: Leonard Hecker Date: Thu, 28 Oct 2021 14:48:29 +0200 Subject: [PATCH] Add noexcept to all FontInfo structs --- src/host/getset.cpp | 3 +- src/renderer/base/FontInfoBase.cpp | 68 +++++++++------------------ src/renderer/base/FontInfoDesired.cpp | 42 +++++++---------- src/renderer/base/fontinfo.cpp | 40 ++++------------ src/renderer/gdi/state.cpp | 2 +- src/renderer/inc/FontInfo.hpp | 33 +++---------- src/renderer/inc/FontInfoBase.hpp | 43 +++++------------ src/renderer/inc/FontInfoDesired.hpp | 17 ++----- src/types/IControlAccessibilityInfo.h | 10 ++-- src/types/TermControlUiaProvider.cpp | 8 ++-- src/types/TermControlUiaProvider.hpp | 8 ++-- src/types/TermControlUiaTextRange.cpp | 2 +- src/types/TermControlUiaTextRange.hpp | 2 +- src/types/UiaTextRangeBase.cpp | 2 +- src/types/UiaTextRangeBase.hpp | 2 +- 15 files changed, 93 insertions(+), 189 deletions(-) diff --git a/src/host/getset.cpp b/src/host/getset.cpp index 5ee114e6d821..6203aef0e54f 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 40891cf4940a..5abe478b8283 100644 --- a/src/renderer/base/FontInfoBase.cpp +++ b/src/renderer/base/FontInfoBase.cpp @@ -7,20 +7,7 @@ #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, - const unsigned char family, - const unsigned int weight, - const bool fSetDefaultRasterFont, - const unsigned int codePage) : +FontInfoBase::FontInfoBase(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const bool fSetDefaultRasterFont, const unsigned int codePage) noexcept : _faceName(faceName), _family(family), _weight(weight), @@ -30,20 +17,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 +34,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 +60,15 @@ 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, - const unsigned char family, - const unsigned int weight, - const bool fSetDefaultRasterFont) +void FontInfoBase::SetFromEngine(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const bool fSetDefaultRasterFont) noexcept { _faceName = faceName; _family = family; @@ -101,12 +78,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) @@ -115,8 +92,7 @@ void FontInfoBase::ValidateFont() if (_faceName == DEFAULT_TT_FONT_FACENAME) { std::wstring defaultFontFace; - if (SUCCEEDED(s_pFontDefaultList->RetrieveDefaultFontNameForCodepage(GetCodePage(), - defaultFontFace))) + if (SUCCEEDED(s_pFontDefaultList->RetrieveDefaultFontNameForCodepage(GetCodePage(), defaultFontFace))) { _faceName = defaultFontFace; @@ -128,14 +104,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 c293d141a400..027b68f2db96 100644 --- a/src/renderer/base/FontInfoDesired.cpp +++ b/src/renderer/base/FontInfoDesired.cpp @@ -5,13 +5,25 @@ #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) +{ +} + +FontInfoDesired::FontInfoDesired(const FontInfo& fiFont) noexcept : + FontInfoBase(fiFont), + _coordSizeDesired(fiFont.GetUnscaledSize()) +{ +} + +bool FontInfoDesired::operator==(const FontInfoDesired& other) noexcept { - return (static_cast(a) == static_cast(b) && - a._coordSizeDesired == b._coordSizeDesired); + return FontInfoBase::operator==(other) && + _coordSizeDesired == other._coordSizeDesired; } -COORD FontInfoDesired::GetEngineSize() const +COORD FontInfoDesired::GetEngineSize() const noexcept { COORD coordSize = _coordSizeDesired; if (IsTrueTypeFont()) @@ -22,30 +34,12 @@ COORD FontInfoDesired::GetEngineSize() const 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 // 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))); + return WasDefaultRasterSetFromEngine() || (GetFaceName().empty() && (_coordSizeDesired == COORD{ 0, 0 } || _coordSizeDesired == COORD{ 8, 12 })); } diff --git a/src/renderer/base/fontinfo.cpp b/src/renderer/base/fontinfo.cpp index ef3c37e8cda3..c7f5287e4085 100644 --- a/src/renderer/base/fontinfo.cpp +++ b/src/renderer/base/fontinfo.cpp @@ -5,19 +5,7 @@ #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, - const unsigned char family, - const unsigned int weight, - const COORD coordSize, - const unsigned int codePage, - const bool fSetDefaultRasterFont /* = false */) : +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) noexcept : FontInfoBase(faceName, family, weight, fSetDefaultRasterFont, codePage), _coordSize(coordSize), _coordSizeUnscaled(coordSize), @@ -26,38 +14,28 @@ 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, - const unsigned char family, - const unsigned int weight, - const bool fSetDefaultRasterFont, - const COORD coordSize, - const COORD coordSizeUnscaled) +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) noexcept { - FontInfoBase::SetFromEngine(faceName, - family, - weight, - fSetDefaultRasterFont); - + FontInfoBase::SetFromEngine(faceName, family, weight, fSetDefaultRasterFont); _coordSize = coordSize; _coordSizeUnscaled = coordSizeUnscaled; - _ValidateCoordSize(); } diff --git a/src/renderer/gdi/state.cpp b/src/renderer/gdi/state.cpp index 04a5df7d5cc3..722577c8ec0c 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 56065881e59a..bd3102fd2d94 100644 --- a/src/renderer/inc/FontInfo.hpp +++ b/src/renderer/inc/FontInfo.hpp @@ -28,40 +28,21 @@ Author(s): class FontInfo : public FontInfoBase { public: - 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); + 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) noexcept; - FontInfo(const FontInfo& fiFont); - - COORD GetSize() const; - COORD GetUnscaledSize() const; - - void SetFromEngine(const std::wstring_view faceName, - const unsigned char family, - const unsigned int weight, - const bool fSetDefaultRasterFont, - const COORD coordSize, - const COORD coordSizeUnscaled); + bool operator==(const FontInfo& other) noexcept; + 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) 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 aa9f3cddbb66..292b6d6f2f0f 100644 --- a/src/renderer/inc/FontInfoBase.hpp +++ b/src/renderer/inc/FontInfoBase.hpp @@ -26,40 +26,25 @@ static constexpr wchar_t DEFAULT_RASTER_FONT_FACENAME[]{ L"Terminal" }; class FontInfoBase { public: - FontInfoBase(const std::wstring_view faceName, - const unsigned char family, - const unsigned int weight, - const bool fSetDefaultRasterFont, - const unsigned int uiCodePage); + FontInfoBase(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const bool fSetDefaultRasterFont, 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, - const unsigned char family, - const unsigned int weight, - const bool fSetDefaultRasterFont); - - bool WasDefaultRasterSetFromEngine() const; - void ValidateFont(); + 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) 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 +53,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 a680f18561e9..2157162afc21 100644 --- a/src/renderer/inc/FontInfoDesired.hpp +++ b/src/renderer/inc/FontInfoDesired.hpp @@ -24,21 +24,14 @@ Author(s): class FontInfoDesired : public FontInfoBase { public: - FontInfoDesired(const std::wstring_view faceName, - const unsigned char family, - const unsigned int weight, - const COORD coordSizeDesired, - const unsigned int uiCodePage); + FontInfoDesired(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const COORD coordSizeDesired, 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 b20f965698f6..de3a3eeecf55 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 edcee5a15abf..2d96fa44b329 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 a7629ea08c49..4e2131267da9 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 5d95dbd88d04..97a5ca41f042 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 4ec34277af74..42afc210b775 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 c32a6a9003f3..2bc7411d9ddb 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 24756648fdd3..c9089438d1b2 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;