Chemical Data Processing Library C++ API - Version 1.1.1
Public Member Functions | List of all members
CDPL::Vis::Font Class Reference

Specifies a font for drawing text. More...

#include <Font.hpp>

Public Member Functions

 Font ()
 Constructs a font object with an unspecified family name and a font size of 12.0. More...
 
 Font (const std::string &family, double size=12.0, bool bold=false, bool italic=false)
 Constructs a font object with the specified font family name and font size. More...
 
void setFamily (const std::string &family)
 Sets the font family name. More...
 
const std::string & getFamily () const
 Returns the font family name. More...
 
void setSize (double size)
 Sets the font size. More...
 
double getSize () const
 Returns the font size. More...
 
void setBold (bool flag)
 Sets or clears the flag specifying whether text should be rendered bold. More...
 
bool isBold () const
 Returns the flag specifying whether text is rendered bold. More...
 
void setItalic (bool flag)
 Sets or clears the flag specifying whether text should be rendered italicized. More...
 
bool isItalic () const
 Returns the flag specifying whether text is rendered italicized. More...
 
void setUnderlined (bool flag)
 Sets or clears the flag specifying whether text should be rendered underlined. More...
 
bool isUnderlined () const
 Returns the flag specifying whether text is rendered underlined. More...
 
void setOverlined (bool flag)
 Sets or clears the flag specifying whether text should be rendered overlined. More...
 
bool isOverlined () const
 Returns the flag specifying whether text is rendered overlined. More...
 
void setStrikedOut (bool flag)
 Sets or clears the flag specifying whether text should be rendered striked-out. More...
 
bool isStrikedOut () const
 Returns the flag specifying whether text is rendered striked-out. More...
 
void setFixedPitch (bool flag)
 Sets or clears the fixed pitch flag. More...
 
bool hasFixedPitch () const
 Returns the fixed pitch flag. More...
 
bool operator== (const Font &font) const
 Equality comparison operator. More...
 
bool operator!= (const Font &font) const
 Inequality comparison operator. More...
 

Detailed Description

Specifies a font for drawing text.

On creation of a Font object one can specify various attributes the font should have. The attributes set in the constructor can also be set later, e.g. setFamily() and setSize(). The remaining attributes must be set after construction, e.g. setBold(), setItalic(), setUnderlined(), setOverlined(), setStrikedOut() and setFixedPitch(). The corresponding getter methods like getFamily() and getSize() return the values that were set, even though the values used may differ. Renderer2D implementations generally will use the font with the specified attributes, or if no exactly matching font exists, they will take the closest matching available font.

Constructor & Destructor Documentation

◆ Font() [1/2]

CDPL::Vis::Font::Font ( )

Constructs a font object with an unspecified family name and a font size of 12.0.

◆ Font() [2/2]

CDPL::Vis::Font::Font ( const std::string &  family,
double  size = 12.0,
bool  bold = false,
bool  italic = false 
)

Constructs a font object with the specified font family name and font size.

If size is negative, the font size is set to zero.

Parameters
familyThe font family name.
sizeThe font size.
boldtrue if text should be rendered bold, and false otherwise.
italictrue if text should be rendered italicized, and false otherwise.
Since
1.1

Member Function Documentation

◆ setFamily()

void CDPL::Vis::Font::setFamily ( const std::string &  family)

Sets the font family name.

Parameters
familyThe font family name.

◆ getFamily()

const std::string& CDPL::Vis::Font::getFamily ( ) const

Returns the font family name.

Returns
The font family name.

◆ setSize()

void CDPL::Vis::Font::setSize ( double  size)

Sets the font size.

If size is negative, the font size is set to zero.

Parameters
sizeThe font size.

◆ getSize()

double CDPL::Vis::Font::getSize ( ) const

Returns the font size.

Returns
The font size.

◆ setBold()

void CDPL::Vis::Font::setBold ( bool  flag)

Sets or clears the flag specifying whether text should be rendered bold.

Parameters
flagtrue if text should be rendered bold, and false otherwise.

◆ isBold()

bool CDPL::Vis::Font::isBold ( ) const

Returns the flag specifying whether text is rendered bold.

Returns
true if text is rendered bold, and false otherwise.

◆ setItalic()

void CDPL::Vis::Font::setItalic ( bool  flag)

Sets or clears the flag specifying whether text should be rendered italicized.

Parameters
flagtrue if text should be rendered italicized, and false otherwise.

◆ isItalic()

bool CDPL::Vis::Font::isItalic ( ) const

Returns the flag specifying whether text is rendered italicized.

Returns
true if text is rendered italicized, and false otherwise.

◆ setUnderlined()

void CDPL::Vis::Font::setUnderlined ( bool  flag)

Sets or clears the flag specifying whether text should be rendered underlined.

Parameters
flagtrue if text should be rendered underlined, and false otherwise.

◆ isUnderlined()

bool CDPL::Vis::Font::isUnderlined ( ) const

Returns the flag specifying whether text is rendered underlined.

Returns
true if text is rendered underlined, and false otherwise.

◆ setOverlined()

void CDPL::Vis::Font::setOverlined ( bool  flag)

Sets or clears the flag specifying whether text should be rendered overlined.

Parameters
flagtrue if text should be rendered overlined, and false otherwise.

◆ isOverlined()

bool CDPL::Vis::Font::isOverlined ( ) const

Returns the flag specifying whether text is rendered overlined.

Returns
true if text is rendered overlined, and false otherwise.

◆ setStrikedOut()

void CDPL::Vis::Font::setStrikedOut ( bool  flag)

Sets or clears the flag specifying whether text should be rendered striked-out.

Parameters
flagtrue if text should be rendered striked-out, and false otherwise.

◆ isStrikedOut()

bool CDPL::Vis::Font::isStrikedOut ( ) const

Returns the flag specifying whether text is rendered striked-out.

Returns
true if text is rendered striked-out, and false otherwise.

◆ setFixedPitch()

void CDPL::Vis::Font::setFixedPitch ( bool  flag)

Sets or clears the fixed pitch flag.

Parameters
flagtrue if the font has a fixed pitch, and false otherwise.

◆ hasFixedPitch()

bool CDPL::Vis::Font::hasFixedPitch ( ) const

Returns the fixed pitch flag.

Returns
true if the font has a fixed pitch, and false otherwise.

◆ operator==()

bool CDPL::Vis::Font::operator== ( const Font font) const

Equality comparison operator.

Parameters
fontThe other Font object to be compared with.
Returns
true if all font attributes compare equal, and false otherwise.

◆ operator!=()

bool CDPL::Vis::Font::operator!= ( const Font font) const

Inequality comparison operator.

The result is equivalent to !(*this == font).

Parameters
fontThe other Font object to be compared with.
Returns
true if one of the font attributes compares non-equal, and false otherwise.

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