1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-05 18:16:23 +03:00

0030474: Visualization - fallback font is ignored for missing font alias within Font_FontMgr::FindFont()

This commit is contained in:
kgv 2019-02-04 14:04:21 +03:00
parent 99d9eb3933
commit d517575214

View File

@ -702,20 +702,25 @@ Handle(Font_SystemFont) Font_FontMgr::FindFont (const TCollection_AsciiString& t
} }
// Trying to use font names mapping // Trying to use font names mapping
for (int aPass = 0; aPass < 2; ++aPass)
{
Handle(Font_FontAliasSequence) anAliases; Handle(Font_FontAliasSequence) anAliases;
const Standard_Boolean hasAliases = myFontAliases.Find (aFontName, anAliases) if (aPass == 0)
&& !anAliases.IsNull() {
&& !anAliases->IsEmpty(); myFontAliases.Find (aFontName, anAliases);
if (!hasAliases }
&& aFont.IsNull()) else
{ {
anAliases = myFallbackAlias; anAliases = myFallbackAlias;
} }
bool isAliasUsed = false, isBestAlias = false; if (anAliases.IsNull()
if (!anAliases.IsNull() || anAliases->IsEmpty())
&& !anAliases->IsEmpty())
{ {
continue;
}
bool isAliasUsed = false, isBestAlias = false;
for (Font_FontAliasSequence::Iterator anAliasIter (*anAliases); anAliasIter.More(); anAliasIter.Next()) for (Font_FontAliasSequence::Iterator anAliasIter (*anAliases); anAliasIter.More(); anAliasIter.Next())
{ {
const Font_FontAlias& anAlias = anAliasIter.Value(); const Font_FontAlias& anAlias = anAliasIter.Value();
@ -744,7 +749,8 @@ Handle(Font_SystemFont) Font_FontMgr::FindFont (const TCollection_AsciiString& t
} }
} }
} }
if (hasAliases)
if (aPass == 0)
{ {
if (isAliasUsed && myToTraceAliases) if (isAliasUsed && myToTraceAliases)
{ {
@ -755,6 +761,10 @@ Handle(Font_SystemFont) Font_FontMgr::FindFont (const TCollection_AsciiString& t
{ {
return aFont; return aFont;
} }
else if (!aFont.IsNull())
{
break;
}
} }
} }