MeVisLab Toolbox Reference
View2DFontQt.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 
20 #include <QFont>
21 
22 class View2DShader;
23 
26 {
27 public:
29  ~View2DFontQt() override;
30 
33  bool init(const char* fontname = nullptr) override;
34 
36  int getFontHeight(float fontSize) const override;
37 
39  int getFontAscender(float fontSize) const override;
40 
42  int getFontDescender(float fontSize) const override;
43 
45  int getStringWidth(float fontSize, const char* string, int len) const override;
46 
50  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;
51 
52 private:
53  static int fontSizeToPixelSize(float fontSize);
54 
55  QFont _baseFont;
56  View2DShader* _haloShader;
57 };
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
Qt based implementation of View2DFont.
Definition: View2DFontQt.h:26
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 getFontDescender(float fontSize) const override
get descender of font
~View2DFontQt() override
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 line feeds, the drawing starts at the top-left corner color needs to po...
int getFontHeight(float fontSize) const override
get height of font (ascender + descender)
int getStringWidth(float fontSize, const char *string, int len) const override
get width of simple string
int getFontAscender(float fontSize) const override
get ascender of font
Abstract GL font drawing using FTGL.
Definition: View2DFont.h:30
base class for hardware shaders that can be used on a View2DTexture
Definition: View2DShader.h:34