Open CASCADE Technology 6.6.0
|
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!
#include <Font_FTFont.hxx>
Data Structures | |
struct | Rect |
Auxiliary structure - rectangle definition. More... | |
Public Member Functions | |
Font_FTFont (const Handle< Font_FTLibrary > &theFTLib=NULL) | |
Create uninitialized instance. | |
virtual | ~Font_FTFont () |
Destructor. | |
bool | IsValid () const |
const Image_PixMap & | GlyphImage () const |
bool | Init (const NCollection_String &theFontPath, const unsigned int thePointSize, const unsigned int theResolution=72) |
Initialize the font. | |
void | Release () |
Release currently loaded font. | |
bool | RenderGlyph (const Standard_Utf32Char theChar) |
Render specified glyph into internal buffer (bitmap). | |
unsigned int | GlyphMaxSizeX () const |
unsigned int | GlyphMaxSizeY () const |
float | Ascender () const |
float | Descender () const |
float | LineSpacing () const |
unsigned int | PointSize () const |
Configured point size. | |
float | AdvanceX (const Standard_Utf32Char theUCharNext) |
Compute advance to the next character with kerning applied when applicable. Assuming text rendered horizontally. | |
float | AdvanceX (const Standard_Utf32Char theUChar, const Standard_Utf32Char theUCharNext) |
Compute advance to the next character with kerning applied when applicable. Assuming text rendered horizontally. | |
float | AdvanceY (const Standard_Utf32Char theUCharNext) |
Compute advance to the next character with kerning applied when applicable. Assuming text rendered vertically. | |
float | AdvanceY (const Standard_Utf32Char theUChar, const Standard_Utf32Char theUCharNext) |
Compute advance to the next character with kerning applied when applicable. Assuming text rendered vertically. | |
Standard_Integer | GlyphsNumber () const |
void | GlyphRect (Font_FTFont::Rect &theRect) const |
Retrieve glyph bitmap rectangle. | |
Protected Member Functions | |
template<typename theInput_t > | |
FT_F26Dot6 | 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. | |
Protected Attributes | |
Handle< Font_FTLibrary > | myFTLib |
handle to the FT library object | |
FT_Face | myFTFace |
FT face object. | |
NCollection_String | myFontPath |
font path | |
unsigned int | myPointSize |
point size set by FT_Set_Char_Size | |
Image_PixMap | myGlyphImg |
cached glyph plane | |
FT_Vector | myKernAdvance |
buffer variable | |
Standard_Utf32Char | myUChar |
currently loaded unicode character |
Font_FTFont::Font_FTFont | ( | const Handle< Font_FTLibrary > & | theFTLib = NULL | ) |
virtual Font_FTFont::~Font_FTFont | ( | ) | [virtual] |
float Font_FTFont::AdvanceX | ( | const Standard_Utf32Char | theUCharNext | ) |
float Font_FTFont::AdvanceX | ( | const Standard_Utf32Char | theUChar, |
const Standard_Utf32Char | theUCharNext | ||
) |
float Font_FTFont::AdvanceY | ( | const Standard_Utf32Char | theUCharNext | ) |
float Font_FTFont::AdvanceY | ( | const Standard_Utf32Char | theUChar, |
const Standard_Utf32Char | theUCharNext | ||
) |
float Font_FTFont::Ascender | ( | ) | const [inline] |
float Font_FTFont::Descender | ( | ) | const [inline] |
theReturn_t Font_FTFont::fromFTPoints | ( | const theFTUnits_t | theFTUnits | ) | const [inline, protected] |
const Image_PixMap& Font_FTFont::GlyphImage | ( | ) | const [inline] |
unsigned int Font_FTFont::GlyphMaxSizeX | ( | ) | const |
unsigned int Font_FTFont::GlyphMaxSizeY | ( | ) | const |
void Font_FTFont::GlyphRect | ( | Font_FTFont::Rect & | theRect | ) | const [inline] |
Standard_Integer Font_FTFont::GlyphsNumber | ( | ) | const [inline] |
bool Font_FTFont::Init | ( | const NCollection_String & | theFontPath, |
const unsigned int | thePointSize, | ||
const unsigned int | theResolution = 72 |
||
) |
theFontPath | path to the font |
thePointSize | the face size in points (1/72 inch) |
theResolution | the resolution of the target device in dpi |
bool Font_FTFont::IsValid | ( | ) | const [inline] |
float Font_FTFont::LineSpacing | ( | ) | const [inline] |
bool Font_FTFont::loadGlyph | ( | const Standard_Utf32Char | theUChar | ) | [protected] |
unsigned int Font_FTFont::PointSize | ( | ) | const [inline] |
void Font_FTFont::Release | ( | ) |
bool Font_FTFont::RenderGlyph | ( | const Standard_Utf32Char | theChar | ) |
FT_F26Dot6 Font_FTFont::toFTPoints | ( | const theInput_t | thePointSize | ) | const [inline, protected] |
NCollection_String Font_FTFont::myFontPath [protected] |
FT_Face Font_FTFont::myFTFace [protected] |
Handle< Font_FTLibrary > Font_FTFont::myFTLib [protected] |
Image_PixMap Font_FTFont::myGlyphImg [protected] |
FT_Vector Font_FTFont::myKernAdvance [protected] |
unsigned int Font_FTFont::myPointSize [protected] |
Standard_Utf32Char Font_FTFont::myUChar [protected] |