Wt  3.3.9
Public Types | Public Member Functions | List of all members
Wt::WFont Class Reference

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

#include <Wt/WFont>

Public Types

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 WStringspecificFamilies () 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...
 

Detailed Description

A value class that describes a font.

Member Enumeration Documentation

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

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()

The font style.

Enumerator
NormalStyle 

Normal (default)

Italic 

Italic.

Oblique 

Oblique.

The font variant.

Enumerator
NormalVariant 

Normal (default)

SmallCaps 

Small Capitals.

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.

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.


Generated on Tue Nov 21 2017 for the C++ Web Toolkit (Wt) by doxygen 1.8.11