62 virtual 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) = 0;
65 void drawStringFlipped(
float dx,
float dy,
float fontSize,
const float* color,
const char*
string,
int length,
bool shadow =
true,
const float* shadowColor =
nullptr)
67 drawString(
dx,
dy, fontSize, color,
string, length, shadow, shadowColor,
true);
71 virtual void getTextSize(
float fontSize,
const char* text,
int &width,
int &height,
float lineSpacing = 0.0f)
const;
76 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);
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
Abstract GL font drawing using FTGL.
virtual int getFontDescender(float fontSize) const =0
get descender of font
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 int getFontAscender(float fontSize) const =0
get ascender of font
static View2DFont * globalFont()
get the global font used for annotations etc. (only call this within a valid GL context!...
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.
virtual int getStringWidth(float fontSize, const char *string, int len) const =0
get width of simple string
virtual bool init(const char *fontname=nullptr)=0
init with given font (either just a font name without .ttf or an absolute path) requires a valid GL c...
virtual int getFontHeight(float fontSize) const =0
get height of font (ascender + descender)
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
static View2DFont * createFont(const char *fontname=nullptr)
create a new font object with the given font name (/see init).
AlignXMode
align mode of multi-line text
virtual 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)=0
draws a simple string with no linefeeds, the drawing starts at the top-left corner color needs to poi...
Target mlrange_cast(Source arg)
Generic version of checked ML casts.