Specifies a font for drawing text.
More...
#include <Font.hpp>
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.
◆ 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
-
family | The font family name. |
size | The font size. |
bold | true if text should be rendered bold, and false otherwise. |
italic | true if text should be rendered italicized, and false otherwise. |
- Since
- 1.1
◆ setFamily()
void CDPL::Vis::Font::setFamily |
( |
const std::string & |
family | ) |
|
Sets the font family name.
- Parameters
-
family | The 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
-
◆ 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
-
flag | true 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
-
flag | true 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
-
flag | true 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
-
flag | true 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
-
flag | true 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
-
flag | true 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
-
font | The 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
-
font | The 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: