ADTF_DISPLAY_TOOLBOX  3.8.0 (ADTF 3.14.3)
cGLFont

OpenGL font. More...

Inheritance diagram for cGLFont:
[legend]

Public Member Functions

tResult Create (const cGLCanvas *pCanvas, const char *strFilename, tInt nHeight, tStyle eFontStyle)
 Creates a font based on the given parameters. More...
 
tResult CleanUp ()
 Clean up the font. More...
 
void Print (tInt x, tInt y, tFloat64 fAngle, const char *strFormat, va_list ArgList)
 Print a string onto the screen. More...
 
void Print (tFloat32 x, tFloat32 y, tFloat64 fAngle, const char *strFormat, va_list ArgList)
 Print a string onto the screen. More...
 
tVoid FlipTextHorizontally (tBool bOpposedYAxis)
 Set the text direction with or opposed the x-axis direction. More...
 
tVoid TextScaleWithCoordinateSystem (tBool bScaleWithCoordinateSystem)
 Set the text to scale with the coordinatesystem. More...
 
tVoid TextRotateWithCoordinateSystem (tBool bRotateWithCoordinateSystem)
 Set the text to rotate with the coordinatesystem. More...
 
tVoid TextBaselineOnTop (tBool bTextBaselineOnTop)
 Set the text baseline on the top of the text. More...
 
- Public Member Functions inherited from IFont
virtual ~IFont ()
 virtual destructor to ensure proper cleanup.
 
virtual tResult Release ()=0
 Releases the font. More...
 
virtual tInt GetHeight () const =0
 This function returns the height of the font in point. More...
 
virtual tBool MeasureText (const tChar *str, tInt &nWidth, tInt &nHeight) const =0
 The methods returns the measurement of the text in nWidth and nHeight. More...
 

Static Public Member Functions

static tResult Initialize ()
 Initialize the font. More...
 
static tResult Uninitialize ()
 Uninitialize the font. More...
 

Protected Member Functions

tResult BuildDisplayList (char ch, tStyle eFontStyle)
 Creates a display list for the given character. More...
 
void PrintImpl (tUInt32 ui32Flags, tFloat32 x, tFloat32 y, tFloat64 fAngle, const char *strFormat, va_list ArgList)
 Internal print implementation. More...
 

Protected Attributes

FT_Face m_hFace
 FreeType face.
 
GLuint * m_hTextures
 Texture array.
 
GLuint m_nTextureBase
 Base address of texture array.
 
tInt m_nHeight
 Font height.
 
tInt m_aCharWidth [256]
 Character width.
 

Static Protected Attributes

static constexpr tInt m_nTextureScale = 8
 Super sampling of internal texture.
 

Additional Inherited Members

- Public Types inherited from IFont
enum  tStyle { STYLE_Default , STYLE_Antialiased , STYLE_Mono }
 The enumeration marks the style of the font. More...
 

Detailed Description

OpenGL font.

Definition at line 43 of file glfont.h.

Member Function Documentation

◆ BuildDisplayList()

tResult BuildDisplayList ( char  ch,
tStyle  eFontStyle 
)
protected

Creates a display list for the given character.

Parameters
ch[in] Character for which the display list should be generated.
eFontStyle[in] Fontstyle.
Returns
Standard result code

◆ CleanUp()

tResult CleanUp ( )

Clean up the font.

Returns
Standard result code

◆ Create()

tResult Create ( const cGLCanvas *  pCanvas,
const char *  strFilename,
tInt  nHeight,
tStyle  eFontStyle 
)

Creates a font based on the given parameters.

Parameters
pCanvas[in] The drawing canvas.
strFilename[in] Filename of font.
nHeight[in] Desired height for the font.
eFontStyle[in] Fontstyle.
Returns
Standard result code

◆ FlipTextHorizontally()

tVoid FlipTextHorizontally ( tBool  bOpposedYAxis)

Set the text direction with or opposed the x-axis direction.

Parameters
[in]bOpposedYAxistFalse: with the x-axis direction tTrue: opposed the x-axis direction
Returns
void

◆ Initialize()

static tResult Initialize ( )
static

Initialize the font.

Returns
Standard result code

◆ Print() [1/2]

void Print ( tFloat32  x,
tFloat32  y,
tFloat64  fAngle,
const char *  strFormat,
va_list  ArgList 
)

Print a string onto the screen.

Parameters
x[in] Drawing position x coordinate (floating-point).
y[in] Drawing position y coordinate (floating-point).
fAngle[in] Drawing angle.
strFormat[in] Formatted string.
ArgList[in] Arguments for formatted string.

◆ Print() [2/2]

void Print ( tInt  x,
tInt  y,
tFloat64  fAngle,
const char *  strFormat,
va_list  ArgList 
)

Print a string onto the screen.

Parameters
x[in] Drawing position x coordinate (integer).
y[in] Drawing position y coordinate (integer).
fAngle[in] Drawing angle.
strFormat[in] Formatted string.
ArgList[in] Arguments for formatted string.

◆ PrintImpl()

void PrintImpl ( tUInt32  ui32Flags,
tFloat32  x,
tFloat32  y,
tFloat64  fAngle,
const char *  strFormat,
va_list  ArgList 
)
protected

Internal print implementation.

Parameters
ui32Flags[in] Flags.
x[in] Drawing position x coordinate (floating-point).
y[in] Drawing position y coordinate (floating-point).
fAngle[in] Drawing angle.
strFormat[in] Formatted string.
ArgList[in] Arguments for formatted string.

◆ TextBaselineOnTop()

tVoid TextBaselineOnTop ( tBool  bTextBaselineOnTop)

Set the text baseline on the top of the text.

Parameters
[in]bTextBaselineOnTopif true = top otherwise false = bottom
Returns
void

◆ TextRotateWithCoordinateSystem()

tVoid TextRotateWithCoordinateSystem ( tBool  bRotateWithCoordinateSystem)

Set the text to rotate with the coordinatesystem.

Parameters
[in]bRotateWithCoordinateSystemthe value to be set
Returns
void

◆ TextScaleWithCoordinateSystem()

tVoid TextScaleWithCoordinateSystem ( tBool  bScaleWithCoordinateSystem)

Set the text to scale with the coordinatesystem.

Parameters
[in]bScaleWithCoordinateSystemthe value to be set
Returns
void

◆ Uninitialize()

static tResult Uninitialize ( )
static

Uninitialize the font.

Returns
Standard result code