Version: 9.12.0
GLViewer_TexFont Class Reference

#include <GLViewer_Drawer.h>

Public Member Functions

 GLViewer_TexFont ()
 A default constructor. More...
 
 GLViewer_TexFont (QFont *theFont, int theSeparator=2, bool theIsResizeable=false, GLuint theMinMagFilter=GL_LINEAR)
 A constructor. More...
 
 ~GLViewer_TexFont ()
 A destructor. More...
 
bool generateTexture ()
 Generating font texture. More...
 
void drawString (QString theStr, GLdouble theX=0.0, GLdouble theY=0.0, GLfloat theScale=1.0)
 Drawing string theStr in point with coords theX and theY. More...
 
int getSeparator ()
 Returns separator between letters. More...
 
void setSeparator (int theSeparator)
 Installing separator between letters. More...
 
int getStringWidth (QString theString)
 Returns width of string in pixels. More...
 
int getStringHeight ()
 Returns height of string in pixels. More...
 

Static Public Member Functions

static void clearTextBases ()
 Clears all generated fonts. More...
 

Static Public Attributes

static QMap< GLViewer_TexFindId, GLViewer_TexIdStoredTexFontBase
 Map for strorage generated texture fonts. More...
 
static QMap< GLViewer_TexFindId, GLuint > BitmapFontCache
 Map for strorage generated bitmaps fonts. More...
 

Private Member Functions

void init ()
 Initializes font parameters. More...
 

Private Attributes

int myNbSymbols
 Number of characters in the font texture. More...
 
int * myWidths
 Array of letter width. More...
 
int * myPositions
 Array of letter positions in texture. More...
 
QFont myQFont
 Pointer to base font. More...
 
GLuint myTexFont
 Font texture ID. More...
 
int myTexFontWidth
 Font texture width. More...
 
int myTexFontHeight
 Font texture height. More...
 
int mySeparator
 Separator between letters. More...
 
bool myIsResizeable
 Flag controlling scalability of this texmapped font. More...
 
GLuint myMinMagFilter
 Min/mag filter. More...
 
int myFontHeight
 Font height. More...
 
int myMaxRowWidth
 Diagnostic information. More...
 

Detailed Description

Font for GLViewer_Drawer, Drawing bitmap and texture fonts in GLViewer

Constructor & Destructor Documentation

◆ GLViewer_TexFont() [1/2]

GLViewer_TexFont::GLViewer_TexFont ( )

A default constructor.

Default constructor

References init(), myIsResizeable, myMinMagFilter, myQFont, and mySeparator.

◆ GLViewer_TexFont() [2/2]

GLViewer_TexFont::GLViewer_TexFont ( QFont *  theFont,
int  theSeparator = 2,
bool  theIsResizeable = false,
GLuint  theMinMagFilter = GL_LINEAR 
)

A constructor.

Constructor

Parameters
theFont- a base font
theSeparator- separator between letters
theIsResizeable- specifies whether text drawn by this object can be scaled along with the scene
theMinMagFilter- min/mag filter, affects text sharpness

References init(), myIsResizeable, myMinMagFilter, myQFont, and mySeparator.

◆ ~GLViewer_TexFont()

GLViewer_TexFont::~GLViewer_TexFont ( )

A destructor.

Destructor

References myPositions, and myWidths.

Member Function Documentation

◆ clearTextBases()

void GLViewer_TexFont::clearTextBases ( )
static

Clears all generated fonts.

Clears all generated fonts

References BitmapFontCache, and TexFontBase.

◆ drawString()

void GLViewer_TexFont::drawString ( QString  theStr,
GLdouble  theX = 0.0,
GLdouble  theY = 0.0,
GLfloat  theScale = 1.0 
)

Drawing string theStr in point with coords theX and theY.

Drawing string in viewer

Parameters
theStr- string to be drawn
theX- X position
theY- Y position
theScale- scale coefficient

References FirstSymbolNumber, modelMatrix, myFontHeight, myIsResizeable, myPositions, mySeparator, myTexFont, myTexFontHeight, myTexFontWidth, myWidths, TEX_ROW_GAP, TEX_ROW_LEN, and theScale.

◆ generateTexture()

◆ getSeparator()

int GLViewer_TexFont::getSeparator ( )
inline

Returns separator between letters.

◆ getStringHeight()

int GLViewer_TexFont::getStringHeight ( )

Returns height of string in pixels.

Returns
height of string in pixels

References myQFont.

◆ getStringWidth()

int GLViewer_TexFont::getStringWidth ( QString  theStr)

Returns width of string in pixels.

Returns
width of string in pixels

References FirstSymbolNumber, mySeparator, and myWidths.

◆ init()

void GLViewer_TexFont::init ( )
private

Initializes font parameters.

Initializes font parameters

References FirstSymbolNumber, LastSymbolNumber, myFontHeight, myMaxRowWidth, myNbSymbols, myPositions, myQFont, myTexFontHeight, myTexFontWidth, myWidths, and TEX_ROW_LEN.

◆ setSeparator()

void GLViewer_TexFont::setSeparator ( int  theSeparator)
inline

Installing separator between letters.

Member Data Documentation

◆ BitmapFontCache

QMap< GLViewer_TexFindId, GLuint > GLViewer_TexFont::BitmapFontCache
static

Map for strorage generated bitmaps fonts.

◆ myFontHeight

int GLViewer_TexFont::myFontHeight
private

Font height.

◆ myIsResizeable

bool GLViewer_TexFont::myIsResizeable
private

Flag controlling scalability of this texmapped font.

◆ myMaxRowWidth

int GLViewer_TexFont::myMaxRowWidth
private

Diagnostic information.

◆ myMinMagFilter

GLuint GLViewer_TexFont::myMinMagFilter
private

Min/mag filter.

◆ myNbSymbols

int GLViewer_TexFont::myNbSymbols
private

Number of characters in the font texture.

◆ myPositions

int* GLViewer_TexFont::myPositions
private

Array of letter positions in texture.

◆ myQFont

QFont GLViewer_TexFont::myQFont
private

Pointer to base font.

◆ mySeparator

int GLViewer_TexFont::mySeparator
private

Separator between letters.

◆ myTexFont

GLuint GLViewer_TexFont::myTexFont
private

Font texture ID.

◆ myTexFontHeight

int GLViewer_TexFont::myTexFontHeight
private

Font texture height.

◆ myTexFontWidth

int GLViewer_TexFont::myTexFontWidth
private

Font texture width.

◆ myWidths

int* GLViewer_TexFont::myWidths
private

Array of letter width.

◆ TexFontBase

QMap< GLViewer_TexFindId, GLViewer_TexIdStored > GLViewer_TexFont::TexFontBase
static

Map for strorage generated texture fonts.


The documentation for this class was generated from the following files: