Open CASCADE Technology
7.5.0
|
Collects and provides information about available fonts in system. More...
#include <Font_FontMgr.hxx>
Public Member Functions | |
void | AvailableFonts (Font_NListOfSystemFont &theList) const |
Return the list of available fonts. More... | |
Font_NListOfSystemFont | GetAvailableFonts () const |
Return the list of available fonts. More... | |
void | GetAvailableFontsNames (TColStd_SequenceOfHAsciiString &theFontsNames) const |
Returns sequence of available fonts names. More... | |
Handle< Font_SystemFont > | GetFont (const Handle< TCollection_HAsciiString > &theFontName, const Font_FontAspect theFontAspect, const Standard_Integer theFontSize) const |
Returns font that match given parameters. If theFontName is empty string returned font can have any FontName. If theFontAspect is Font_FA_Undefined returned font can have any FontAspect. If theFontSize is "-1" returned font can have any FontSize. More... | |
Handle< Font_SystemFont > | GetFont (const TCollection_AsciiString &theFontName) const |
Returns font that match given name or NULL if such font family is NOT registered. Note that unlike FindFont(), this method ignores font aliases and does not look for fall-back. More... | |
Handle< Font_SystemFont > | FindFont (const TCollection_AsciiString &theFontName, Font_StrictLevel theStrictLevel, Font_FontAspect &theFontAspect, Standard_Boolean theDoFailMsg=Standard_True) const |
Tries to find font by given parameters. If the specified font is not found tries to use font names mapping. If the requested family name not found -> search for any font family with given aspect and height. If the font is still not found, returns any font available in the system. Returns NULL in case when the fonts are not found in the system. More... | |
Handle< Font_SystemFont > | FindFont (const TCollection_AsciiString &theFontName, Font_FontAspect &theFontAspect) const |
Tries to find font by given parameters. More... | |
Handle< Font_SystemFont > | FindFallbackFont (Font_UnicodeSubset theSubset, Font_FontAspect theFontAspect) const |
Tries to find fallback font for specified Unicode subset. Returns NULL in case when fallback font is not found in the system. More... | |
Standard_Boolean | CheckFont (NCollection_Sequence< Handle< Font_SystemFont >> &theFonts, const TCollection_AsciiString &theFontPath) const |
Read font file and retrieve information from it (the list of font faces). More... | |
Handle< Font_SystemFont > | CheckFont (const Standard_CString theFontPath) const |
Read font file and retrieve information from it. More... | |
Standard_Boolean | RegisterFont (const Handle< Font_SystemFont > &theFont, const Standard_Boolean theToOverride) |
Register new font. If there is existing entity with the same name and properties but different path then font will be overridden or ignored depending on theToOverride flag. More... | |
Standard_Boolean | RegisterFonts (const NCollection_Sequence< Handle< Font_SystemFont >> &theFonts, const Standard_Boolean theToOverride) |
Register new fonts. More... | |
Standard_Boolean | ToTraceAliases () const |
Return flag for tracing font aliases usage via Message_Trace messages; TRUE by default. More... | |
void | SetTraceAliases (Standard_Boolean theToTrace) |
Set flag for tracing font alias usage; useful to trace which fonts are actually used. Can be disabled to avoid redundant messages with Message_Trace level. More... | |
void | GetAllAliases (TColStd_SequenceOfHAsciiString &theAliases) const |
Return font names with defined aliases. More... | |
void | GetFontAliases (TColStd_SequenceOfHAsciiString &theFontNames, const TCollection_AsciiString &theAliasName) const |
Return aliases to specified font name. More... | |
bool | AddFontAlias (const TCollection_AsciiString &theAliasName, const TCollection_AsciiString &theFontName) |
Register font alias. More... | |
bool | RemoveFontAlias (const TCollection_AsciiString &theAliasName, const TCollection_AsciiString &theFontName) |
Unregister font alias. More... | |
void | InitFontDataBase () |
Collects available fonts paths. More... | |
void | ClearFontDataBase () |
Clear registry. Can be used for testing purposes. More... | |
Public Member Functions inherited from Standard_Transient | |
Standard_Transient () | |
Empty constructor. More... | |
Standard_Transient (const Standard_Transient &) | |
Copy constructor – does nothing. More... | |
Standard_Transient & | operator= (const Standard_Transient &) |
Assignment operator, needed to avoid copying reference counter. More... | |
virtual | ~Standard_Transient () |
Destructor must be virtual. More... | |
virtual void | Delete () const |
Memory deallocator for transient classes. More... | |
virtual const opencascade::handle< Standard_Type > & | DynamicType () const |
Returns a type descriptor about this object. More... | |
Standard_Boolean | IsInstance (const opencascade::handle< Standard_Type > &theType) const |
Returns a true value if this is an instance of Type. More... | |
Standard_Boolean | IsInstance (const Standard_CString theTypeName) const |
Returns a true value if this is an instance of TypeName. More... | |
Standard_Boolean | IsKind (const opencascade::handle< Standard_Type > &theType) const |
Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More... | |
Standard_Boolean | IsKind (const Standard_CString theTypeName) const |
Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More... | |
Standard_Transient * | This () const |
Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. More... | |
Standard_Integer | GetRefCount () const |
Get the reference counter of this object. More... | |
void | IncrementRefCounter () const |
Increments the reference counter of this object. More... | |
Standard_Integer | DecrementRefCounter () const |
Decrements the reference counter of this object; returns the decremented value. More... | |
Static Public Member Functions | |
static Handle< Font_FontMgr > | GetInstance () |
Return global instance of font manager. More... | |
static const char * | FontAspectToString (Font_FontAspect theAspect) |
Return font aspect as string. More... | |
static Standard_Boolean & | ToUseUnicodeSubsetFallback () |
Return flag to use fallback fonts in case if used font does not include symbols from specific Unicode subset; TRUE by default. More... | |
static Handle< NCollection_Buffer > | EmbedFallbackFont () |
Return DejaVu font as embed a single fallback font. It can be used in cases when there is no own font file. Note: result buffer is readonly and should not be changed, any data modification can lead to unpredictable consequences. More... | |
Static Public Member Functions inherited from Standard_Transient | |
static const char * | get_type_name () |
Returns a type descriptor about this object. More... | |
static const opencascade::handle< Standard_Type > & | get_type_descriptor () |
Returns type descriptor of Standard_Transient class. More... | |
Additional Inherited Members | |
Public Types inherited from Standard_Transient | |
typedef void | base_type |
Returns a type descriptor about this object. More... | |
Collects and provides information about available fonts in system.
bool Font_FontMgr::AddFontAlias | ( | const TCollection_AsciiString & | theAliasName, |
const TCollection_AsciiString & | theFontName | ||
) |
Register font alias.
Font alias allows using predefined short-cuts like Font_NOF_MONOSPACE or Font_NOF_SANS_SERIF, and defining several fallback fonts like Font_NOF_CJK ("cjk") or "courier" for fonts, which availability depends on system.
By default, Font_FontMgr registers standard aliases, which could be extended or replaced by application basing on better knowledge of the system or basing on additional fonts packaged with application itself. Aliases are defined "in advance", so that they could point to non-existing fonts, and they are resolved dynamically on request - first existing font is returned in case of multiple aliases to the same name.
theAliasName | [in] alias name or name of another font to be used as alias |
theFontName | [in] font to be used as substitution for alias |
|
inline |
Return the list of available fonts.
Standard_Boolean Font_FontMgr::CheckFont | ( | NCollection_Sequence< Handle< Font_SystemFont >> & | theFonts, |
const TCollection_AsciiString & | theFontPath | ||
) | const |
Read font file and retrieve information from it (the list of font faces).
Handle< Font_SystemFont > Font_FontMgr::CheckFont | ( | const Standard_CString | theFontPath | ) | const |
Read font file and retrieve information from it.
void Font_FontMgr::ClearFontDataBase | ( | ) |
Clear registry. Can be used for testing purposes.
|
static |
Return DejaVu font as embed a single fallback font. It can be used in cases when there is no own font file. Note: result buffer is readonly and should not be changed, any data modification can lead to unpredictable consequences.
Handle< Font_SystemFont > Font_FontMgr::FindFallbackFont | ( | Font_UnicodeSubset | theSubset, |
Font_FontAspect | theFontAspect | ||
) | const |
Tries to find fallback font for specified Unicode subset. Returns NULL in case when fallback font is not found in the system.
theSubset | [in] Unicode subset |
theFontAspect | [in] font aspect to find |
Handle< Font_SystemFont > Font_FontMgr::FindFont | ( | const TCollection_AsciiString & | theFontName, |
Font_StrictLevel | theStrictLevel, | ||
Font_FontAspect & | theFontAspect, | ||
Standard_Boolean | theDoFailMsg = Standard_True |
||
) | const |
Tries to find font by given parameters. If the specified font is not found tries to use font names mapping. If the requested family name not found -> search for any font family with given aspect and height. If the font is still not found, returns any font available in the system. Returns NULL in case when the fonts are not found in the system.
theFontName | [in] font family to find or alias name |
theStrictLevel | [in] search strict level for using aliases and fallback |
theFontAspect | [in] [out] font aspect to find (considered only if family name is not found); can be modified if specified font alias refers to another style (compatibility with obsolete aliases) |
theDoFailMsg | [in] put error message on failure into default messenger |
|
inline |
Tries to find font by given parameters.
|
inlinestatic |
Return font aspect as string.
void Font_FontMgr::GetAllAliases | ( | TColStd_SequenceOfHAsciiString & | theAliases | ) | const |
Return font names with defined aliases.
theAliases | [out] alias names |
|
inline |
Return the list of available fonts.
void Font_FontMgr::GetAvailableFontsNames | ( | TColStd_SequenceOfHAsciiString & | theFontsNames | ) | const |
Returns sequence of available fonts names.
Handle< Font_SystemFont > Font_FontMgr::GetFont | ( | const Handle< TCollection_HAsciiString > & | theFontName, |
const Font_FontAspect | theFontAspect, | ||
const Standard_Integer | theFontSize | ||
) | const |
Returns font that match given parameters. If theFontName is empty string returned font can have any FontName. If theFontAspect is Font_FA_Undefined returned font can have any FontAspect. If theFontSize is "-1" returned font can have any FontSize.
Handle< Font_SystemFont > Font_FontMgr::GetFont | ( | const TCollection_AsciiString & | theFontName | ) | const |
Returns font that match given name or NULL if such font family is NOT registered. Note that unlike FindFont(), this method ignores font aliases and does not look for fall-back.
void Font_FontMgr::GetFontAliases | ( | TColStd_SequenceOfHAsciiString & | theFontNames, |
const TCollection_AsciiString & | theAliasName | ||
) | const |
Return aliases to specified font name.
theFontNames | [out] font names associated with alias name |
theAliasName | [in] alias name |
|
static |
Return global instance of font manager.
void Font_FontMgr::InitFontDataBase | ( | ) |
Collects available fonts paths.
Standard_Boolean Font_FontMgr::RegisterFont | ( | const Handle< Font_SystemFont > & | theFont, |
const Standard_Boolean | theToOverride | ||
) |
Register new font. If there is existing entity with the same name and properties but different path then font will be overridden or ignored depending on theToOverride flag.
|
inline |
Register new fonts.
bool Font_FontMgr::RemoveFontAlias | ( | const TCollection_AsciiString & | theAliasName, |
const TCollection_AsciiString & | theFontName | ||
) |
Unregister font alias.
theAliasName | [in] alias name or name of another font to be used as alias; all aliases will be removed in case of empty name |
theFontName | [in] font to be used as substitution for alias; all fonts will be removed in case of empty name |
|
inline |
Set flag for tracing font alias usage; useful to trace which fonts are actually used. Can be disabled to avoid redundant messages with Message_Trace level.
|
inline |
Return flag for tracing font aliases usage via Message_Trace messages; TRUE by default.
|
static |
Return flag to use fallback fonts in case if used font does not include symbols from specific Unicode subset; TRUE by default.