MeVisLab Toolbox Reference
View2DFontFTGL Class Reference

Abstract GL font drawing using FTGL. More...

#include <View2DFontFTGL.h>

Inheritance diagram for View2DFontFTGL:
View2DFont

Public Member Functions

 View2DFontFTGL ()
 
 ~View2DFontFTGL () override
 
bool init (const char *fontname=nullptr) override
 init with given font (either just a font name without .ttf or an absolute path) requires a valid GL context!
 
int getFontHeight (float fontSize) const override
 get height of font (ascender + descender)
 
int getFontAscender (float fontSize) const override
 get ascender of font
 
int getFontDescender (float fontSize) const override
 get descender of font
 
int getStringWidth (float fontSize, const char *string, int len) const override
 get width of simple string
 
void drawString (float dx, float dy, float fontSize, const float *color, const char *string, int length, bool shadow=true, const float *shadowColor=nullptr, bool flipped=false) override
 draws a simple string with no linefeeds, the drawing starts at the top-left corner color needs to point to a float[4] array (RGBA) shadowColor is optional and needs to point to a float[3] array (RGB), alpha is taken from color.
 
- Public Member Functions inherited from View2DFont
 View2DFont ()
 
virtual ~View2DFont ()
 
void drawStringFlipped (float dx, float dy, float fontSize, const float *color, const char *string, int length, bool shadow=true, const float *shadowColor=nullptr)
 as above for drawing a string up-side down where you don't need to specify all parameters
 
virtual void getTextSize (float fontSize, const char *text, int &width, int &height, float lineSpacing=0.0f) const
 returns size of the box spanned by text box
 
virtual void drawText (float dx, float dy, float fontSize, const float *color, const char *text, AlignXMode mode, bool shadow=true, float lineSpacing=0.0f, const float *shadowColor=nullptr)
 draws a multi-line text, lines are separated by
, the drawing starts at the top-left corner.
 

Additional Inherited Members

- Public Types inherited from View2DFont
enum  AlignXMode { ALIGN_LEFT , ALIGN_RIGHT , ALIGN_CENTER }
 align mode of multi-line text More...
 
- Static Public Member Functions inherited from View2DFont
static View2DFontglobalFont ()
 get the global font used for annotations etc. (only call this within a valid GL context!)
 
static View2DFontcreateFont (const char *fontname=nullptr)
 create a new font object with the given font name (/see init).
 

Detailed Description

Abstract GL font drawing using FTGL.

FTGL based implementation of View2DFont

Definition at line 22 of file View2DFontFTGL.h.

Constructor & Destructor Documentation

◆ View2DFontFTGL()

View2DFontFTGL::View2DFontFTGL ( )

◆ ~View2DFontFTGL()

View2DFontFTGL::~View2DFontFTGL ( )
override

Member Function Documentation

◆ drawString()

void View2DFontFTGL::drawString ( float dx,
float dy,
float fontSize,
const float * color,
const char * string,
int length,
bool shadow = true,
const float * shadowColor = nullptr,
bool flipped = false )
overridevirtual

draws a simple string with no linefeeds, the drawing starts at the top-left corner color needs to point to a float[4] array (RGBA) shadowColor is optional and needs to point to a float[3] array (RGB), alpha is taken from color.

Implements View2DFont.

◆ getFontAscender()

int View2DFontFTGL::getFontAscender ( float fontSize) const
overridevirtual

get ascender of font

Implements View2DFont.

◆ getFontDescender()

int View2DFontFTGL::getFontDescender ( float fontSize) const
overridevirtual

get descender of font

Implements View2DFont.

◆ getFontHeight()

int View2DFontFTGL::getFontHeight ( float fontSize) const
overridevirtual

get height of font (ascender + descender)

Implements View2DFont.

◆ getStringWidth()

int View2DFontFTGL::getStringWidth ( float fontSize,
const char * string,
int len ) const
overridevirtual

get width of simple string

Implements View2DFont.

◆ init()

bool View2DFontFTGL::init ( const char * fontname = nullptr)
overridevirtual

init with given font (either just a font name without .ttf or an absolute path) requires a valid GL context!

Implements View2DFont.


The documentation for this class was generated from the following file: