COPASI API
4.16.103
|
#include <CQFontRenderer.h>
Public Member Functions | |
CQFontRenderer () | |
virtual std::pair< double, double > | getTextureSize (const CLFontSpec &spec, const std::string &text) |
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) |
virtual | ~CQFontRenderer () |
![]() | |
virtual | ~CLFontRendererBase () |
Static Public Member Functions | |
static std::pair < CLTextTextureSpec *, GLubyte * > | createTexture (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) |
Protected Member Functions | |
void | findSimilarFamily (const std::string &name, std::set< std::string > &families) const |
void | getFamilyList (const std::string &family, std::list< std::string > &list) const |
QFont | getFont (const CLFontSpec &spec) |
std::pair< CLTextTextureSpec *, GLubyte * > | getTexture (QFont &font, const std::string &text, double zoomFactor) |
std::pair< double, double > | getTextureSize (const QFont &font, const std::string &text) |
void | orderFamilies (const std::string &name, const std::set< std::string > &familySet, std::list< std::string > &familyList) const |
Protected Attributes | |
std::map< CLFontSpec, QFont > | mFontMap |
QFontDatabase * | mpFontDatabase |
Static Protected Attributes | |
static CQFontRenderer | FONT_RENDERER |
Definition at line 23 of file CQFontRenderer.h.
CQFontRenderer::CQFontRenderer | ( | ) |
|
virtual |
|
static |
static method that creates a texture with a static FontRenderer object. This method can be used as a callback.
Definition at line 456 of file CQFontRenderer.cpp.
References FONT_RENDERER.
|
protected |
Finds the font families that fit the given family name. A family fits if the name is exactly the same or if the name is contained in the family name. For generic names like sans, serif or monospaced the algorithm tries to find a suitable font family.
Definition at line 401 of file CQFontRenderer.cpp.
References mpFontDatabase.
Referenced by getFamilyList().
|
protected |
Definition at line 441 of file CQFontRenderer.cpp.
References findSimilarFamily(), and orderFamilies().
Referenced by getFont().
|
protected |
Returns the font that matches the given FontSpc.
Returns the font that matches the given FontSpec.
Definition at line 80 of file CQFontRenderer.cpp.
References getFamilyList(), CLFontSpec::mFamily, mFontMap, mpFontDatabase, CLFontSpec::mSize, CLFontSpec::mStyle, CLFontSpec::mWeight, CLText::STYLE_ITALIC, CLText::STYLE_NORMAL, and CLText::WEIGHT_BOLD.
Referenced by getTextureSize(), and operator()().
|
protected |
Creates a texture for the given text using the given font object. The caller has to free the memory for the TextureSpec object and the pData in the TextureSpec object.
zoomFactor
zoomFactor
Definition at line 317 of file CQFontRenderer.cpp.
References getTextureSize(), CLTextTextureSpec::mAscent, CLTextTextureSpec::mMaxScale, CLTextureSpec::mNumComponents, CLTextTextureSpec::mScale, CLTextureSpec::mTextHeight, CLTextureSpec::mTextureHeight, CLTextureSpec::mTextureName, CLTextureSpec::mTextureWidth, and CLTextureSpec::mTextWidth.
Referenced by operator()().
|
virtual |
Returns the size for a font given a font, a text and a zoom factor.
Implements CLFontRendererBase.
Definition at line 306 of file CQFontRenderer.cpp.
References getFont().
Referenced by getTexture().
|
protected |
Returns the size for a font given a font specification, a text and a zoom factor.
Definition at line 295 of file CQFontRenderer.cpp.
|
virtual |
Functor that returns a TextureSpec objct with a texture for the given font family, font size font weight, font style and text. The caller is responsible to free the memory of the TextureSpec object and of the pData in the TextureSpec.
Functor that returns a TextureSpec object with a texture for the given font family, font size font weight, font style and text. The caller is responsible to free the memory of the TextureSpec object and of the pData in the TextureSpec.
Implements CLFontRendererBase.
Definition at line 66 of file CQFontRenderer.cpp.
References getFont(), getTexture(), CLFontSpec::mFamily, CLFontSpec::mSize, CLFontSpec::mStyle, and CLFontSpec::mWeight.
|
protected |
Given a certain name and a set of font family names, the algorithm tries to put them in an order from best match to worst match.
Definition at line 420 of file CQFontRenderer.cpp.
Referenced by getFamilyList().
|
staticprotected |
Static instance of CQFontRenderer for use in a static function that can be used as a callback.
Definition at line 102 of file CQFontRenderer.h.
Referenced by createTexture().
|
protected |
A map that stores the font that matches a given spec the best.
Definition at line 100 of file CQFontRenderer.h.
Referenced by getFont().
|
protected |
An instance of the font database. It has to be a pointer since there seems to be a problem under linux if an instance of QFontDatabase is created before some other things have been instanciated. At least the application crashed when I made this an object instead of a pointer.
Definition at line 95 of file CQFontRenderer.h.
Referenced by findSimilarFamily(), getFont(), and ~CQFontRenderer().