libcvd
Enumerations | Functions
Collaboration diagram for OpenGL text rendering:

Enumerations

enum  CVD::TEXT_STYLE {
  CVD::FILL = 0, CVD::OUTLINE = 1, CVD::NICE = 2, CVD::FILL = 0,
  CVD::OUTLINE = 1, CVD::NICE = 2
}
 different style for font rendering More...
 
enum  CVD::TEXT_STYLE {
  CVD::FILL = 0, CVD::OUTLINE = 1, CVD::NICE = 2, CVD::FILL = 0,
  CVD::OUTLINE = 1, CVD::NICE = 2
}
 different style for font rendering More...
 

Functions

void CVD::glSetFont (const std::string &fontname)
 sets the font to use for future font rendering commands. More...
 
const std::string & CVD::glGetFont ()
 returns the name of the currently active font
 
std::pair< double, double > CVD::glDrawText (const std::string &text, enum TEXT_STYLE style=NICE, double spacing=1.5, double kerning=0.1)
 renders a string in GL using the current settings. More...
 
std::pair< double, double > CVD::glGetExtends (const std::string &text, double spacing=1.5, double kerning=0.1)
 returns the size of the bounding box of a text to be rendered, similar to glDrawText but without any visual output
 

Detailed Description

Enumeration Type Documentation

◆ TEXT_STYLE [1/2]

different style for font rendering

Enumerator
FILL 

renders glyphs as filled polygons

OUTLINE 

renders glyphs as outlines with GL_LINES

NICE 

renders glyphs filled with antialiased outlines

FILL 

renders glyphs as filled polygons

OUTLINE 

renders glyphs as outlines with GL_LINES

NICE 

renders glyphs filled with antialiased outlines

◆ TEXT_STYLE [2/2]

different style for font rendering

Enumerator
FILL 

renders glyphs as filled polygons

OUTLINE 

renders glyphs as outlines with GL_LINES

NICE 

renders glyphs filled with antialiased outlines

FILL 

renders glyphs as filled polygons

OUTLINE 

renders glyphs as outlines with GL_LINES

NICE 

renders glyphs filled with antialiased outlines

Function Documentation

◆ glDrawText()

std::pair< double, double > CVD::glDrawText ( const std::string &  text,
enum TEXT_STYLE  style = NICE,
double  spacing = 1.5,
double  kerning = 0.1 
)

renders a string in GL using the current settings.

Font coordinates are +X along the line and +Y along the up direction of glyphs. The origin is at the top baseline at the left of the first character. Characters have a maximum size of 1. linefeed is interpreted as a new line and the start is offset in -Y direction by spacing . Individual characters are separated by kerning + plus their individual with.

Parameters
textstring to be rendered, unknown characters are replaced with '?'
stylerendering style
spacingdistance between individual text lines
kerningdistance between characters

◆ glSetFont()

void CVD::glSetFont ( const std::string &  fontname)

sets the font to use for future font rendering commands.

currently sans, serif and mono are available.

Parameters
fontnamestring containing font name