mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0030439: Visualization - extend fonts search within Font_FontMgr::FindFont() on Linux
Font_FontMgr has been redesigned to: - Store fonts in a map instead a list. - Allow mapping multiple fonts to a single alias. - Log informative message about usage of non-requested font (fallback). - Register all font files within standard folders on Linux when "fonts.dir" is not found. - Prefer specific alias ("serif") as default fallback font instead of arbitrary one in a system. A couple of obsolete and broken font aliases have been removed; instead, new aliases of fonts popular on Linux platform have been added. Font_NameOfFont.hxx has been extended with more neutral aliases "monospace", "serif", "sans-serif", "cjk" and "korean". Font_FontAspect enumeration values have been renamed Font_FA_ -> Font_FontAspect_ with old values preserved as alias. Font_SystemFont has been extended with a list of paths to Font_FontAspect styles, so that entire Font Family is now defined within a single Font_SystemFont instance. Non-resizable fonts are now ignored by Font Manager.
This commit is contained in:
@@ -117,11 +117,12 @@ bool Font_FTFont::Init (const NCollection_String& theFontName,
|
||||
const unsigned int theResolution)
|
||||
{
|
||||
Handle(Font_FontMgr) aFontMgr = Font_FontMgr::GetInstance();
|
||||
const Handle(TCollection_HAsciiString) aFontName = new TCollection_HAsciiString (theFontName.ToCString());
|
||||
if (Handle(Font_SystemFont) aRequestedFont = aFontMgr->FindFont (aFontName, theFontAspect, thePointSize))
|
||||
const TCollection_AsciiString aFontName (theFontName.ToCString());
|
||||
Font_FontAspect aFontAspect = theFontAspect;
|
||||
if (Handle(Font_SystemFont) aRequestedFont = aFontMgr->FindFont (aFontName, aFontAspect))
|
||||
{
|
||||
myIsSingleLine = aRequestedFont->IsSingleStrokeFont();
|
||||
return Font_FTFont::Init (aRequestedFont->FontPath()->ToCString(), thePointSize, theResolution);
|
||||
return Font_FTFont::Init (aRequestedFont->FontPathAny (aFontAspect).ToCString(), thePointSize, theResolution);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user