Wt: Wt::WFont Class Reference

Wt 3.3.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions
Wt::WFont Class Reference
Style classes | Painting system

A value class that describes a font. More...

`#include <Wt/WFont>`

List of all members.

## 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.
bool | operator== (const WFont &other) const
| Comparison operator.
void | setFamily (GenericFamily genericFamily, const WString &specificFamilies=WString())
| Sets the font family.
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.
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)
void | setSize (Size size)
| Sets the font size.
void | setSize (const WLength &size)
Size | size (double mediumSize=16) const
| Returns the font size.
WLength | fixedSize () const
| Returns the font size as a numerical value (deprecated).
WLength | sizeLength (double mediumSize=16) const
| Returns the font size as a numerical value.

## Detailed Description

A value class that describes a font.

## Member Enumeration Documentation

enum Wt::WFont::GenericFamily

The generic font family.

Enumerator:

  Default | Browser-dependent default.
  Serif | for example: Times
  SansSerif | for example: Helvetica
  Cursive | for example: Zapf-Chancery
  Fantasy | for example: Western
  Monospace | for example: Courier

enum Wt::WFont::Size

The font size.

Enumerator:

  XXSmall | Extra Extra small.
  XSmall | Extra small.
  Small | Small.
  Medium | Medium, default.
  Large | Large.
  XLarge | Extra large.
  XXLarge | Extra Extra large.
  Smaller | Relatively smaller than the parent widget.
  Larger | Relatively larger than the parent widget.
  FixedSize | Explicit size, See also fontFixedSize()

enum Wt::WFont::Style

The font style.

Enumerator:

  NormalStyle | Normal (default)
  Italic | Italic.
  Oblique | Oblique.

enum Wt::WFont::Variant

The font variant.

Enumerator:

  NormalVariant | Normal (default)
  SmallCaps | Small Capitals.

enum Wt::WFont::Weight

The font weight.

Enumerator:

  NormalWeight | Normal (default) (Value == 400)
  Bold | Bold (Value == 700)
  Bolder | Bolder than the parent widget.
  Lighter | Lighter than the parent widget.
  Value | Specify a value (100 - 900)

## Constructor & Destructor Documentation

Wt::WFont::WFont | ( | GenericFamily | family | ) |

A font of a given family.

Creates a Medium font of the given family.

## Member Function Documentation

WLength Wt::WFont::fixedSize | ( |  | ) | const

Returns the font size as a numerical value (deprecated).

Deprecated:
  This method has been renamed to sizeLength()

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.

     WFont mono;
     mono.setFamily(WFont::Monospace, "'Courier New'");
     mono.setSize(18);

void Wt::WFont::setSize | ( | Size | size,
|  | const WLength & | length
| ) |  |

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.

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.

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator