MeVisLab Toolbox Reference
View2DFontFTGL.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2012, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13
15
16#pragma once
17
18#include "View2DFont.h"
19#include "mlGL2DFont.h"
20
23{
24public:
26 ~View2DFontFTGL() override;
27
30 bool init(const char* fontname = nullptr) override;
31
33 int getFontHeight(float fontSize) const override;
34
36 int getFontAscender(float fontSize) const override;
37
39 int getFontDescender(float fontSize) const override;
40
42 int getStringWidth(float fontSize, const char* string, int len) const override;
43
47 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;
48
49private:
50 ML_OPENGL_NAMESPACE::GL2DFont *_font;
51};
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
Abstract GL font drawing using FTGL.
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 c...
int getFontHeight(float fontSize) const override
get height of font (ascender + descender)
~View2DFontFTGL() override
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 poi...
int getFontAscender(float fontSize) const override
get ascender of font
int getFontDescender(float fontSize) const override
get descender of font
Abstract GL font drawing using FTGL.
Definition View2DFont.h:30
Target mlrange_cast(Source arg)
Generic version of checked ML casts.