|
Open CASCADE Technology 6.6.0
|
Texture font.
#include <OpenGl_Font.hxx>

Data Structures | |
| struct | RectI |
| struct | Tile |
| Simple structure stores tile rectangle. More... | |
Public Member Functions | |
| OpenGl_Font (const Handle< Font_FTFont > &theFont, const TCollection_AsciiString &theKey="") | |
| Main constructor. | |
| virtual | ~OpenGl_Font () |
| Destroy object. | |
| virtual void | Release (const OpenGl_Context *theCtx) |
| Destroy object - will release GPU memory if any. | |
| const TCollection_AsciiString & | ResourceKey () const |
| const Handle< Font_FTFont > & | FTFont () const |
| bool | IsValid () const |
| bool | WasInitialized () const |
| Notice that this method doesn't return initialization success state. Use IsValid() instead. | |
| bool | Init (const Handle< OpenGl_Context > &theCtx) |
| Initialize GL resources. FreeType font instance should be already initialized! | |
| 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 | Ascender () const |
| float | Descender () const |
| float | LineSpacing () const |
| void | RenderGlyph (const Handle< OpenGl_Context > &theCtx, const Standard_Utf32Char theUChar, const Standard_Utf32Char theUCharNext, Tile &theGlyph, OpenGl_Vec2 &thePen) |
| Compute glyph rectangle at specified pen position (on baseline) and render it to texture if not already. | |
Protected Member Functions | |
| bool | renderGlyph (const Handle< OpenGl_Context > &theCtx, const Standard_Utf32Char theChar) |
| Render new glyph to the texture. | |
| bool | createTexture (const Handle< OpenGl_Context > &theCtx) |
| Allocate new texture. | |
Protected Attributes | |
| TCollection_AsciiString | myKey |
| key of shared resource | |
| Handle< Font_FTFont > | myFont |
| FreeType font instance. | |
| Standard_ShortReal | myAscender |
| ascender provided my FT font | |
| Standard_ShortReal | myDescender |
| descender provided my FT font | |
| Standard_ShortReal | myLineSpacing |
| line spacing provided my FT font | |
| Standard_Integer | myTileSizeX |
| tile width | |
| Standard_Integer | myTileSizeY |
| tile height | |
| Standard_Integer | myLastTileId |
| id of last tile | |
| RectI | myLastTilePx |
| Standard_Integer | myTextureFormat |
| texture format | |
| NCollection_Vector< Handle < OpenGl_Texture > > | myTextures |
| array of textures | |
| NCollection_Vector< Tile > | myTiles |
| array of loaded tiles | |
| NCollection_DataMap < Standard_Utf32Char, Standard_Integer > | myGlyphMap |
| OpenGl_Font::OpenGl_Font | ( | const Handle< Font_FTFont > & | theFont, |
| const TCollection_AsciiString & | theKey = "" |
||
| ) |
| virtual OpenGl_Font::~OpenGl_Font | ( | ) | [virtual] |
| float OpenGl_Font::AdvanceX | ( | const Standard_Utf32Char | theUChar, |
| const Standard_Utf32Char | theUCharNext | ||
| ) | [inline] |
| float OpenGl_Font::Ascender | ( | ) | const [inline] |
| bool OpenGl_Font::createTexture | ( | const Handle< OpenGl_Context > & | theCtx | ) | [protected] |
| float OpenGl_Font::Descender | ( | ) | const [inline] |
| const Handle< Font_FTFont >& OpenGl_Font::FTFont | ( | ) | const [inline] |
| bool OpenGl_Font::Init | ( | const Handle< OpenGl_Context > & | theCtx | ) |
| bool OpenGl_Font::IsValid | ( | ) | const [inline] |
| float OpenGl_Font::LineSpacing | ( | ) | const [inline] |
| virtual void OpenGl_Font::Release | ( | const OpenGl_Context * | theCtx | ) | [virtual] |
Implements OpenGl_Resource.
| bool OpenGl_Font::renderGlyph | ( | const Handle< OpenGl_Context > & | theCtx, |
| const Standard_Utf32Char | theChar | ||
| ) | [protected] |
| void OpenGl_Font::RenderGlyph | ( | const Handle< OpenGl_Context > & | theCtx, |
| const Standard_Utf32Char | theUChar, | ||
| const Standard_Utf32Char | theUCharNext, | ||
| Tile & | theGlyph, | ||
| OpenGl_Vec2 & | thePen | ||
| ) |
| theCtx | active context |
| theUChar | unicode symbol to render |
| theUCharNext | next symbol to compute advance with kerning when available |
| theGlyph | computed glyph position rectangle, texture ID and UV coordinates |
| thePen | pen position on baseline to place new glyph |
| const TCollection_AsciiString& OpenGl_Font::ResourceKey | ( | ) | const [inline] |
| bool OpenGl_Font::WasInitialized | ( | ) | const [inline] |
Standard_ShortReal OpenGl_Font::myAscender [protected] |
Standard_ShortReal OpenGl_Font::myDescender [protected] |
Handle< Font_FTFont > OpenGl_Font::myFont [protected] |
TCollection_AsciiString OpenGl_Font::myKey [protected] |
Standard_Integer OpenGl_Font::myLastTileId [protected] |
RectI OpenGl_Font::myLastTilePx [protected] |
Standard_ShortReal OpenGl_Font::myLineSpacing [protected] |
Standard_Integer OpenGl_Font::myTextureFormat [protected] |
NCollection_Vector<Handle< OpenGl_Texture > > OpenGl_Font::myTextures [protected] |
NCollection_Vector<Tile> OpenGl_Font::myTiles [protected] |
Standard_Integer OpenGl_Font::myTileSizeX [protected] |
Standard_Integer OpenGl_Font::myTileSizeY [protected] |
1.7.4