1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-01 17:36:21 +03:00

Visualization - Add flag for font mgr to avoid error message (#392)

This commit is contained in:
sshutina 2025-02-27 11:38:09 +00:00 committed by GitHub
parent 95d8c85c2b
commit aa630b33b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -436,7 +436,8 @@ void Font_FontMgr::addFontAlias(const TCollection_AsciiString& theAliasNa
//=================================================================================================
Font_FontMgr::Font_FontMgr()
: myToTraceAliases(Standard_False)
: myToTraceAliases(Standard_False),
myToPrintErrors(Standard_True)
{
Handle(Font_FontAliasSequence) aMono = new Font_FontAliasSequence();
Handle(Font_FontAliasSequence) aSerif = new Font_FontAliasSequence();
@ -1090,7 +1091,7 @@ Handle(Font_SystemFont) Font_FontMgr::FindFont(const TCollection_AsciiString& th
}
if (aFont.IsNull())
{
if (theDoFailMsg)
if (theDoFailMsg && myToPrintErrors)
{
Message::SendFail("Font_FontMgr, error: unable to find any font!");
}

View File

@ -164,6 +164,13 @@ public:
//! Can be disabled to avoid redundant messages with Message_Trace level.
void SetTraceAliases(Standard_Boolean theToTrace) { myToTraceAliases = theToTrace; }
//! Return flag for printing error messages via Message_Fail messages; TRUE by default.
Standard_Boolean ToPrintErrors() const { return myToPrintErrors; }
//! Set flag for printing error messages.
//! Can be disabled to avoid error messages with Message_Fail level.
void SetPrintErrors(Standard_Boolean theToPrintErrors) { myToPrintErrors = theToPrintErrors; }
//! Return font names with defined aliases.
//! @param[out] theAliases alias names
Standard_EXPORT void GetAllAliases(TColStd_SequenceOfHAsciiString& theAliases) const;
@ -278,6 +285,7 @@ private:
NCollection_DataMap<TCollection_AsciiString, Handle(Font_FontAliasSequence)> myFontAliases;
Handle(Font_FontAliasSequence) myFallbackAlias;
Standard_Boolean myToTraceAliases;
Standard_Boolean myToPrintErrors;
};
#endif // _Font_FontMgr_HeaderFile