Wrapper over FreeType font. Notice that this class uses internal buffers for loaded glyphs and it is absolutely UNSAFE to load/read glyph from concurrent threads! More...
#include <Font_FTFont.hxx>

Public Member Functions | |
| Font_FTFont (const Handle< Font_FTLibrary > &theFTLib=Handle< Font_FTLibrary >()) | |
| Create uninitialized instance. | |
| virtual | ~Font_FTFont () |
| Destructor. | |
| bool | IsValid () const |
| const Image_PixMap & | GlyphImage () const |
| bool | Init (const TCollection_AsciiString &theFontPath, const Font_FTFontParams &theParams, const Standard_Integer theFaceId=0) |
| Initialize the font from the given file path. | |
| bool | Init (const Handle< NCollection_Buffer > &theData, const TCollection_AsciiString &theFileName, const Font_FTFontParams &theParams, const Standard_Integer theFaceId=0) |
| Initialize the font from the given file path or memory buffer. | |
| bool | FindAndInit (const TCollection_AsciiString &theFontName, Font_FontAspect theFontAspect, const Font_FTFontParams &theParams, Font_StrictLevel theStrictLevel=Font_StrictLevel_Any) |
| Find (using Font_FontMgr) and initialize the font from the given name. | |
| Standard_Boolean | ToUseUnicodeSubsetFallback () const |
| Return flag to use fallback fonts in case if used font does not include symbols from specific Unicode subset; TRUE by default. | |
| void | SetUseUnicodeSubsetFallback (Standard_Boolean theToFallback) |
| Set if fallback fonts should be used in case if used font does not include symbols from specific Unicode subset. | |
| bool | IsSingleStrokeFont () const |
| Return TRUE if this is single-stroke (one-line) font, FALSE by default. Such fonts define single-line glyphs instead of closed contours, so that they are rendered incorrectly by normal software. | |
| void | SetSingleStrokeFont (bool theIsSingleLine) |
| Set if this font should be rendered as single-stroke (one-line). | |
| bool | ToSynthesizeItalic () const |
| Return TRUE if italic style should be synthesized; FALSE by default. | |
| virtual void | Release () |
| Release currently loaded font. | |
| bool | RenderGlyph (const Standard_Utf32Char theChar) |
| Render specified glyph into internal buffer (bitmap). | |
| unsigned int | GlyphMaxSizeX (bool theToIncludeFallback=false) const |
| unsigned int | GlyphMaxSizeY (bool theToIncludeFallback=false) const |
| float | Ascender () const |
| float | Descender () const |
| float | LineSpacing () const |
| unsigned int | PointSize () const |
| Configured point size. | |
| float | WidthScaling () const |
| Return glyph scaling along X-axis. | |
| void | SetWidthScaling (const float theScaleFactor) |
| Setup glyph scaling along X-axis. By default glyphs are not scaled (scaling factor = 1.0) | |
| bool | HasSymbol (Standard_Utf32Char theUChar) const |
| Return TRUE if font contains specified symbol (excluding fallback list). | |
| float | AdvanceX (Standard_Utf32Char theUCharNext) const |
| Compute horizontal advance to the next character with kerning applied when applicable. Assuming text rendered horizontally. | |
| float | AdvanceX (Standard_Utf32Char theUChar, Standard_Utf32Char theUCharNext) |
| Compute horizontal advance to the next character with kerning applied when applicable. Assuming text rendered horizontally. | |
| float | AdvanceY (Standard_Utf32Char theUCharNext) const |
| Compute vertical advance to the next character with kerning applied when applicable. Assuming text rendered vertically. | |
| float | AdvanceY (Standard_Utf32Char theUChar, Standard_Utf32Char theUCharNext) |
| Compute vertical advance to the next character with kerning applied when applicable. Assuming text rendered vertically. | |
| Standard_Integer | GlyphsNumber (bool theToIncludeFallback=false) const |
| Return glyphs number in this font. | |
| void | GlyphRect (Font_Rect &theRect) const |
| Retrieve glyph bitmap rectangle. | |
| Font_Rect | BoundingBox (const NCollection_String &theString, const Graphic3d_HorizontalTextAlignment theAlignX, const Graphic3d_VerticalTextAlignment theAlignY) |
| Computes bounding box of the given text using plain-text formatter (Font_TextFormatter). Note that bounding box takes into account the text alignment options. Its corners are relative to the text alignment anchor point, their coordinates can be negative. | |
| const FT_Outline * | renderGlyphOutline (const Standard_Utf32Char theChar) |
| Computes outline contour for the symbol. | |
| parameters bool | Init (const NCollection_String &theFontPath, unsigned int thePointSize, unsigned int theResolution) |
| Initialize the font. | |
| parameters bool | Init (const NCollection_String &theFontName, Font_FontAspect theFontAspect, unsigned int thePointSize, unsigned int theResolution) |
| Initialize the font. | |
Public Member Functions inherited from Standard_Transient | |
| Standard_Transient () | |
| Empty constructor. | |
| Standard_Transient (const Standard_Transient &) | |
| Copy constructor – does nothing. | |
| Standard_Transient & | operator= (const Standard_Transient &) |
| Assignment operator, needed to avoid copying reference counter. | |
| virtual | ~Standard_Transient () |
| Destructor must be virtual. | |
| virtual const opencascade::handle< Standard_Type > & | DynamicType () const |
| Returns a type descriptor about this object. | |
| Standard_Boolean | IsInstance (const opencascade::handle< Standard_Type > &theType) const |
| Returns a true value if this is an instance of Type. | |
| Standard_Boolean | IsInstance (const Standard_CString theTypeName) const |
| Returns a true value if this is an instance of TypeName. | |
| 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. | |
| 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. | |
| 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. | |
| Standard_Integer | GetRefCount () const noexcept |
| Get the reference counter of this object. | |
| void | IncrementRefCounter () noexcept |
| Increments the reference counter of this object. | |
| Standard_Integer | DecrementRefCounter () noexcept |
| Decrements the reference counter of this object; returns the decremented value. | |
| virtual void | Delete () const |
| Memory deallocator for transient classes. | |
Static Public Member Functions | |
| static Handle< Font_FTFont > | FindAndCreate (const TCollection_AsciiString &theFontName, const Font_FontAspect theFontAspect, const Font_FTFontParams &theParams, const Font_StrictLevel theStrictLevel=Font_StrictLevel_Any) |
| Find the font Initialize the font. | |
| static bool | IsCharFromCJK (Standard_Utf32Char theUChar) |
| Return TRUE if specified character is within subset of modern CJK characters. | |
| static bool | IsCharFromHiragana (Standard_Utf32Char theUChar) |
| Return TRUE if specified character is within subset of Hiragana (Japanese). | |
| static bool | IsCharFromKatakana (Standard_Utf32Char theUChar) |
| Return TRUE if specified character is within subset of Katakana (Japanese). | |
| static bool | IsCharFromKorean (Standard_Utf32Char theUChar) |
| Return TRUE if specified character is within subset of modern Korean characters (Hangul). | |
| static bool | IsCharFromArabic (Standard_Utf32Char theUChar) |
| Return TRUE if specified character is within subset of Arabic characters. | |
| static bool | IsCharRightToLeft (Standard_Utf32Char theUChar) |
| Return TRUE if specified character should be displayed in Right-to-Left order. | |
| static Font_UnicodeSubset | CharSubset (Standard_Utf32Char theUChar) |
| Determine Unicode subset for specified character. | |
| static constexpr const char * | get_type_name () |
| Returns a type descriptor about this object. | |
| static const opencascade::handle< Standard_Type > & | get_type_descriptor () |
| Returns type descriptor of Standard_Transient class. | |
Protected Member Functions | |
| template<typename theInput_t> | |
| int32_t | toFTPoints (const theInput_t thePointSize) const |
| Convert value to 26.6 fixed-point format for FT library API. | |
| template<typename theReturn_t, typename theFTUnits_t> | |
| theReturn_t | fromFTPoints (const theFTUnits_t theFTUnits) const |
| Convert value from 26.6 fixed-point format for FT library API. | |
| bool | loadGlyph (const Standard_Utf32Char theUChar) |
| Load glyph without rendering it. | |
| bool | getKerning (FT_Vector &theKern, Standard_Utf32Char theUCharCurr, Standard_Utf32Char theUCharNext) const |
| Wrapper for FT_Get_Kerning - retrieve kerning values. | |
| bool | findAndInitFallback (Font_UnicodeSubset theSubset) |
| Initialize fallback font. | |
| void | setLoadFlag (int32_t theFlag, bool theToEnable) |
| Enable/disable load flag. | |
Protected Attributes | |
| Handle< Font_FTLibrary > | myFTLib |
| handle to the FT library object | |
| Handle< NCollection_Buffer > | myBuffer |
| memory buffer | |
| Handle< Font_FTFont > | myFallbackFaces [Font_UnicodeSubset_NB] |
| fallback fonts | |
| FT_Face | myFTFace |
| FT face object. | |
| FT_Face | myActiveFTFace |
| active FT face object (the main of fallback) | |
| TCollection_AsciiString | myFontPath |
| font path | |
| Font_FTFontParams | myFontParams |
| font initialization parameters | |
| Font_FontAspect | myFontAspect |
| font initialization aspect | |
| float | myWidthScaling |
| scale glyphs along X-axis | |
| int32_t | myLoadFlags |
| default load flags | |
| Image_PixMap | myGlyphImg |
| cached glyph plane | |
| Standard_Utf32Char | myUChar |
| currently loaded unicode character | |
| Standard_Boolean | myToUseUnicodeSubsetFallback |
| use default fallback fonts for extended Unicode sub-sets (Korean, CJK, etc.) | |
Additional Inherited Members | |
| typedef void | base_type |
| Returns a type descriptor about this object. | |
Wrapper over FreeType font. Notice that this class uses internal buffers for loaded glyphs and it is absolutely UNSAFE to load/read glyph from concurrent threads!
| Font_FTFont::Font_FTFont | ( | const Handle< Font_FTLibrary > & | theFTLib = Handle< Font_FTLibrary >() | ) |
Create uninitialized instance.
|
virtual |
Destructor.
| float Font_FTFont::AdvanceX | ( | Standard_Utf32Char | theUChar, |
| Standard_Utf32Char | theUCharNext ) |
Compute horizontal advance to the next character with kerning applied when applicable. Assuming text rendered horizontally.
| theUChar | the character to be loaded as current one |
| theUCharNext | the next character to compute advance from current one |
| float Font_FTFont::AdvanceX | ( | Standard_Utf32Char | theUCharNext | ) | const |
Compute horizontal advance to the next character with kerning applied when applicable. Assuming text rendered horizontally.
| theUCharNext | the next character to compute advance from current one |
| float Font_FTFont::AdvanceY | ( | Standard_Utf32Char | theUChar, |
| Standard_Utf32Char | theUCharNext ) |
Compute vertical advance to the next character with kerning applied when applicable. Assuming text rendered vertically.
| theUChar | the character to be loaded as current one |
| theUCharNext | the next character to compute advance from current one |
| float Font_FTFont::AdvanceY | ( | Standard_Utf32Char | theUCharNext | ) | const |
Compute vertical advance to the next character with kerning applied when applicable. Assuming text rendered vertically.
| theUCharNext | the next character to compute advance from current one |
| float Font_FTFont::Ascender | ( | ) | const |
| Font_Rect Font_FTFont::BoundingBox | ( | const NCollection_String & | theString, |
| const Graphic3d_HorizontalTextAlignment | theAlignX, | ||
| const Graphic3d_VerticalTextAlignment | theAlignY ) |
Computes bounding box of the given text using plain-text formatter (Font_TextFormatter). Note that bounding box takes into account the text alignment options. Its corners are relative to the text alignment anchor point, their coordinates can be negative.
|
inlinestatic |
Determine Unicode subset for specified character.
| float Font_FTFont::Descender | ( | ) | const |
|
static |
Find the font Initialize the font.
| theFontName | the font name |
| theFontAspect | the font style |
| theParams | initialization parameters |
| theStrictLevel | search strict level for using aliases and fallback |
| bool Font_FTFont::FindAndInit | ( | const TCollection_AsciiString & | theFontName, |
| Font_FontAspect | theFontAspect, | ||
| const Font_FTFontParams & | theParams, | ||
| Font_StrictLevel | theStrictLevel = Font_StrictLevel_Any ) |
Find (using Font_FontMgr) and initialize the font from the given name.
| theFontName | the font name |
| theFontAspect | the font style |
| theParams | initialization parameters |
| theStrictLevel | search strict level for using aliases and fallback |
|
protected |
Initialize fallback font.
|
inlineprotected |
Convert value from 26.6 fixed-point format for FT library API.
|
protected |
Wrapper for FT_Get_Kerning - retrieve kerning values.
|
inline |
| unsigned int Font_FTFont::GlyphMaxSizeX | ( | bool | theToIncludeFallback = false | ) | const |
| unsigned int Font_FTFont::GlyphMaxSizeY | ( | bool | theToIncludeFallback = false | ) | const |
| void Font_FTFont::GlyphRect | ( | Font_Rect & | theRect | ) | const |
Retrieve glyph bitmap rectangle.
| Standard_Integer Font_FTFont::GlyphsNumber | ( | bool | theToIncludeFallback = false | ) | const |
Return glyphs number in this font.
| theToIncludeFallback | if TRUE then the number will include fallback list |
| bool Font_FTFont::HasSymbol | ( | Standard_Utf32Char | theUChar | ) | const |
Return TRUE if font contains specified symbol (excluding fallback list).
| bool Font_FTFont::Init | ( | const Handle< NCollection_Buffer > & | theData, |
| const TCollection_AsciiString & | theFileName, | ||
| const Font_FTFontParams & | theParams, | ||
| const Standard_Integer | theFaceId = 0 ) |
Initialize the font from the given file path or memory buffer.
| theData | memory to read from, should NOT be freed after initialization! when NULL, function will attempt to open theFileName file |
| theFileName | optional path to the font |
| theParams | initialization parameters |
| theFaceId | face id within the file (0 by default) |
|
inline |
Initialize the font.
| theFontName | the font name |
| theFontAspect | the font style |
| thePointSize | the face size in points (1/72 inch) |
| theResolution | the resolution of the target device in dpi |
|
inline |
Initialize the font.
| theFontPath | path to the font |
| thePointSize | the face size in points (1/72 inch) |
| theResolution | the resolution of the target device in dpi |
|
inline |
Initialize the font from the given file path.
| theFontPath | path to the font |
| theParams | initialization parameters |
| theFaceId | face id within the file (0 by default) |
|
inlinestatic |
Return TRUE if specified character is within subset of Arabic characters.
|
inlinestatic |
Return TRUE if specified character is within subset of modern CJK characters.
|
inlinestatic |
Return TRUE if specified character is within subset of Hiragana (Japanese).
|
inlinestatic |
Return TRUE if specified character is within subset of Katakana (Japanese).
|
inlinestatic |
Return TRUE if specified character is within subset of modern Korean characters (Hangul).
|
inlinestatic |
Return TRUE if specified character should be displayed in Right-to-Left order.
|
inline |
Return TRUE if this is single-stroke (one-line) font, FALSE by default. Such fonts define single-line glyphs instead of closed contours, so that they are rendered incorrectly by normal software.
|
inline |
| float Font_FTFont::LineSpacing | ( | ) | const |
|
protected |
Load glyph without rendering it.
|
inline |
Configured point size.
|
virtual |
Release currently loaded font.
| bool Font_FTFont::RenderGlyph | ( | const Standard_Utf32Char | theChar | ) |
Render specified glyph into internal buffer (bitmap).
| const FT_Outline * Font_FTFont::renderGlyphOutline | ( | const Standard_Utf32Char | theChar | ) |
Computes outline contour for the symbol.
| [in] | theUChar | the character to be loaded as current one |
| [out] | theOutline | outline contour |
|
inlineprotected |
Enable/disable load flag.
|
inline |
Set if this font should be rendered as single-stroke (one-line).
|
inline |
Set if fallback fonts should be used in case if used font does not include symbols from specific Unicode subset.
|
inline |
Setup glyph scaling along X-axis. By default glyphs are not scaled (scaling factor = 1.0)
|
inlineprotected |
Convert value to 26.6 fixed-point format for FT library API.
|
inline |
Return TRUE if italic style should be synthesized; FALSE by default.
|
inline |
Return flag to use fallback fonts in case if used font does not include symbols from specific Unicode subset; TRUE by default.
|
inline |
Return glyph scaling along X-axis.
|
protected |
active FT face object (the main of fallback)
|
protected |
memory buffer
|
protected |
fallback fonts
|
protected |
font initialization aspect
|
protected |
font initialization parameters
|
protected |
font path
|
protected |
FT face object.
|
protected |
handle to the FT library object
|
protected |
cached glyph plane
|
protected |
default load flags
|
protected |
use default fallback fonts for extended Unicode sub-sets (Korean, CJK, etc.)
|
protected |
currently loaded unicode character
|
protected |
scale glyphs along X-axis