COPASI API  4.16.103
CLFontRendererBase.h
Go to the documentation of this file.
1 // Copyright (C) 2015 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 #ifndef CLFontRendererBase_H__
7 #define CLFontRendererBase_H__
8 
9 #include <string>
10 #include <utility>
11 
12 // opengl includes
13 #ifdef WIN32
14 # define WIN32_LEAN_AND_MEAN 1
15 # include <windows.h>
16 #endif // WIN32
17 
18 #ifdef __APPLE__
19 #include <OpenGL/gl.h>
20 #include <OpenGL/glu.h>
21 #else
22 #include <GL/gl.h>
23 #include <GL/glu.h>
24 # include <GL/glext.h>
25 #endif // __APPLE__
26 
27 #include "copasi/layout/CLText.h"
28 
29 struct CLTextTextureSpec;
30 struct CLFontSpec;
31 
32 /**
33  * A static abstract class that is the base class for a font renderer implementation.
34  */
36 {
37 public:
38  /**
39  * Destructor
40  */
41  virtual ~CLFontRendererBase() {};
42 
43  /**
44  * Functor that returns a TextureSpec object with a texture
45  * for the given font family, font size font weight, font style and text.
46  * The caller is responsible to free the memory of the TextureSpec object
47  * and of the pData in the TextureSpec.
48  */
49  virtual std::pair<CLTextTextureSpec*, GLubyte*> operator()(const std::string& family, double fontSize, const std::string& text, CLText::FONT_WEIGHT weight = CLText::WEIGHT_NORMAL, CLText::FONT_STYLE style = CLText::STYLE_NORMAL, double zoomFactor = 1.0) = 0;
50 
51  /**
52  * Returns the size for a font given a font, a text and a zoom factor.
53  */
54  virtual std::pair<double, double> getTextureSize(const CLFontSpec& spec, const std::string& text) = 0;
55 };
56 
57 #endif /* CLFontRendererBase_H__ */
virtual std::pair< double, double > getTextureSize(const CLFontSpec &spec, const std::string &text)=0
virtual std::pair< CLTextTextureSpec *, GLubyte * > operator()(const std::string &family, double fontSize, const std::string &text, CLText::FONT_WEIGHT weight=CLText::WEIGHT_NORMAL, CLText::FONT_STYLE style=CLText::STYLE_NORMAL, double zoomFactor=1.0)=0
FONT_STYLE
Definition: CLText.h:41
FONT_WEIGHT
Definition: CLText.h:34