Wt
3.7.1
|
A value class that describes a font. More...
#include <Wt/WFont>
Public Types | |
enum | GenericFamily { Default, Serif, SansSerif, Cursive, Fantasy, Monospace } |
The generic font family. More... | |
enum | Style { NormalStyle, Italic, Oblique } |
The font style. More... | |
enum | Variant { NormalVariant, SmallCaps } |
The font variant. More... | |
enum | Weight { NormalWeight, Bold, Bolder, Lighter, Value } |
The font weight. More... | |
enum | Size { XXSmall, XSmall, Small, Medium, Large, XLarge, XXLarge, Smaller, Larger, FixedSize } |
The font size. More... | |
Public Member Functions | |
WFont () | |
A default font (dependent on the user agent). | |
WFont (GenericFamily family) | |
A font of a given family. More... | |
bool | operator== (const WFont &other) const |
Comparison operator. | |
void | setFamily (GenericFamily genericFamily, const WString &specificFamilies=WString()) |
Sets the font family. More... | |
GenericFamily | genericFamily () const |
Returns the font generic family. | |
const WString & | specificFamilies () const |
Returns the font specific family names. | |
void | setStyle (Style style) |
Sets the font style. | |
Style | style () const |
Returns the font style. | |
void | setVariant (Variant variant) |
Sets the font variant. | |
Variant | variant () const |
Returns the font variant. | |
void | setWeight (Weight weight, int value=400) |
Sets the font weight. More... | |
Weight | weight () const |
Returns the font weight. | |
int | weightValue () const |
Returns the font weight value. | |
void | setSize (Size size, const WLength &length) |
Sets the font size (deprecated) More... | |
void | setSize (Size size) |
Sets the font size. More... | |
void | setSize (const WLength &size) |
Sets the font size. More... | |
Size | size (double mediumSize=16) const |
Returns the font size. | |
WLength | fixedSize () const |
Returns the font size as a numerical value (deprecated). More... | |
WLength | sizeLength (double mediumSize=16) const |
Returns the font size as a numerical value. More... | |
A value class that describes a font.
enum Wt::WFont::Size |
The font size.
enum Wt::WFont::Style |
enum Wt::WFont::Variant |
enum Wt::WFont::Weight |
Wt::WFont::WFont | ( | GenericFamily | family | ) |
A font of a given family.
Creates a Medium font of the given family.
WLength Wt::WFont::fixedSize | ( | ) | const |
Returns the font size as a numerical value (deprecated).
void Wt::WFont::setFamily | ( | GenericFamily | genericFamily, |
const WString & | specificFamilies = WString() |
||
) |
Sets the font family.
The font family is specified using a generic family name, in addition to a comma-seperated list of specific font choices.
The first specific font that can be matched will be used, otherwise a generic font will be used.
Careful, for a font family name that contains a space, you need to add quotes, to WFont::setFamily(), e.g.
Sets the font size (deprecated)
Use setSize(Size) or setSize(const WLength&) instead.
void Wt::WFont::setSize | ( | Size | size | ) |
Sets the font size.
Sets the font size using a predefined CSS size.
void Wt::WFont::setSize | ( | const WLength & | size | ) |
Sets the font size.
Sets the font size.
void Wt::WFont::setWeight | ( | Weight | weight, |
int | value = 400 |
||
) |
Sets the font weight.
When setting weight == Value, you may specify a value.
Valid values are between 100 and 900, and are rounded to multiples of 100.
WLength Wt::WFont::sizeLength | ( | double | mediumSize = 16 | ) | const |
Returns the font size as a numerical value.
Absolute size enumerations are converted to a length assuming a Medium font size of 16 px.