xlnt - community edition
Public Types | Public Member Functions | Friends | List of all members
xlnt::font Class Reference

Describes the font style of a particular cell. More...

#include <font.hpp>

Public Types

enum  underline_style {
  none, double_, double_accounting, single,
  single_accounting
}
 Text can be underlined in the enumerated ways More...
 

Public Member Functions

 font ()
 Constructs a default font. Calibri, size 12 More...
 
font & bold (bool bold)
 Sets the bold state of the font to bold and returns a reference to the font. More...
 
bool bold () const
 Returns the bold state of the font. More...
 
font & subscript (bool value)
 Sets the vertical alignment of the font to subscript and returns a reference to the font. More...
 
bool subscript () const
 Returns true if this font has a vertical alignment of subscript. More...
 
font & superscript (bool value)
 Sets the vertical alignment of the font to superscript and returns a reference to the font. More...
 
bool superscript () const
 Returns true if this font has a vertical alignment of superscript. More...
 
font & italic (bool italic)
 Sets the bold state of the font to bold and returns a reference to the font. More...
 
bool italic () const
 Returns true if this font has italics applied. More...
 
font & strikethrough (bool strikethrough)
 Sets the bold state of the font to bold and returns a reference to the font. More...
 
bool strikethrough () const
 Returns true if this font has a strikethrough applied. More...
 
font & outline (bool outline)
 Sets the bold state of the font to bold and returns a reference to the font. More...
 
bool outline () const
 Returns true if this font has an outline applied. More...
 
font & shadow (bool shadow)
 Sets the shadow state of the font to shadow and returns a reference to the font. More...
 
bool shadow () const
 Returns true if this font has a shadow applied. More...
 
font & underline (underline_style new_underline)
 Sets the underline state of the font to new_underline and returns a reference to the font. More...
 
bool underlined () const
 Returns true if this font has any type of underline applied. More...
 
underline_style underline () const
 Returns the particular style of underline this font has applied. More...
 
bool has_size () const
 Returns true if this font has a defined size. More...
 
font & size (double size)
 Sets the size of the font to size and returns a reference to the font. More...
 
double size () const
 Returns the size of the font. More...
 
bool has_name () const
 Returns true if this font has a particular face applied (e.g. "Comic Sans"). More...
 
font & name (const std::string &name)
 Sets the font face to name and returns a reference to the font. More...
 
const std::string & name () const
 Returns the name of the font face. More...
 
bool has_color () const
 Returns true if this font has a color applied. More...
 
font & color (const color &c)
 Sets the color of the font to c and returns a reference to the font. More...
 
xlnt::color color () const
 Returns the color that this font is using. Assumes that this font has a color (please call has_color() to check). If this font does not have a color, an xlnt::invalid_attribute exception will be thrown. More...
 
bool has_family () const
 Returns true if this font has a family defined. More...
 
font & family (std::size_t family)
 Sets the family index of the font to family and returns a reference to the font. More...
 
std::size_t family () const
 Returns the family index for the font. Assumes that this font has a family (please call has_family() to check). If this font does not have a family, an xlnt::invalid_attribute exception will be thrown. More...
 
bool has_charset () const
 Returns true if this font has a charset defined. More...
 
font & charset (std::size_t charset)
 Sets the charset of the font to charset and returns a reference to the font. More...
 
std::size_t charset () const
 Returns the charset of the font. Assumes that this font has a charset (please call has_charset() to check). If this font does not have a charset, an xlnt::invalid_attribute exception will be thrown. More...
 
bool has_scheme () const
 Returns true if this font has a scheme. More...
 
font & scheme (const std::string &scheme)
 Sets the scheme of the font to scheme and returns a reference to the font. More...
 
const std::string & scheme () const
 Returns the scheme of this font. Assumes that this font has a scheme (please call has_scheme() to check). If this font does not have a scheme, an xlnt::invalid_attribute exception will be thrown. More...
 
bool operator== (const font &other) const
 Returns true if left is exactly equal to right. More...
 
bool operator!= (const font &other) const
 Returns true if left is not exactly equal to right. More...
 

Friends

class style
 

Detailed Description

Describes the font style of a particular cell.

Member Enumeration Documentation

◆ underline_style

Text can be underlined in the enumerated ways

Constructor & Destructor Documentation

◆ font()

xlnt::font::font ( )

Constructs a default font. Calibri, size 12

Member Function Documentation

◆ bold() [1/2]

font& xlnt::font::bold ( bool  bold)

Sets the bold state of the font to bold and returns a reference to the font.

◆ bold() [2/2]

bool xlnt::font::bold ( ) const

Returns the bold state of the font.

◆ charset() [1/2]

font& xlnt::font::charset ( std::size_t  charset)

Sets the charset of the font to charset and returns a reference to the font.

◆ charset() [2/2]

std::size_t xlnt::font::charset ( ) const

Returns the charset of the font. Assumes that this font has a charset (please call has_charset() to check). If this font does not have a charset, an xlnt::invalid_attribute exception will be thrown.

◆ color() [1/2]

font& xlnt::font::color ( const color &  c)

Sets the color of the font to c and returns a reference to the font.

◆ color() [2/2]

xlnt::color xlnt::font::color ( ) const

Returns the color that this font is using. Assumes that this font has a color (please call has_color() to check). If this font does not have a color, an xlnt::invalid_attribute exception will be thrown.

◆ family() [1/2]

font& xlnt::font::family ( std::size_t  family)

Sets the family index of the font to family and returns a reference to the font.

◆ family() [2/2]

std::size_t xlnt::font::family ( ) const

Returns the family index for the font. Assumes that this font has a family (please call has_family() to check). If this font does not have a family, an xlnt::invalid_attribute exception will be thrown.

◆ has_charset()

bool xlnt::font::has_charset ( ) const

Returns true if this font has a charset defined.

◆ has_color()

bool xlnt::font::has_color ( ) const

Returns true if this font has a color applied.

◆ has_family()

bool xlnt::font::has_family ( ) const

Returns true if this font has a family defined.

◆ has_name()

bool xlnt::font::has_name ( ) const

Returns true if this font has a particular face applied (e.g. "Comic Sans").

◆ has_scheme()

bool xlnt::font::has_scheme ( ) const

Returns true if this font has a scheme.

◆ has_size()

bool xlnt::font::has_size ( ) const

Returns true if this font has a defined size.

◆ italic() [1/2]

font& xlnt::font::italic ( bool  italic)

Sets the bold state of the font to bold and returns a reference to the font.

◆ italic() [2/2]

bool xlnt::font::italic ( ) const

Returns true if this font has italics applied.

◆ name() [1/2]

font& xlnt::font::name ( const std::string &  name)

Sets the font face to name and returns a reference to the font.

◆ name() [2/2]

const std::string& xlnt::font::name ( ) const

Returns the name of the font face.

◆ operator!=()

bool xlnt::font::operator!= ( const font &  other) const
inline

Returns true if left is not exactly equal to right.

◆ operator==()

bool xlnt::font::operator== ( const font &  other) const

Returns true if left is exactly equal to right.

◆ outline() [1/2]

font& xlnt::font::outline ( bool  outline)

Sets the bold state of the font to bold and returns a reference to the font.

◆ outline() [2/2]

bool xlnt::font::outline ( ) const

Returns true if this font has an outline applied.

◆ scheme() [1/2]

font& xlnt::font::scheme ( const std::string &  scheme)

Sets the scheme of the font to scheme and returns a reference to the font.

◆ scheme() [2/2]

const std::string& xlnt::font::scheme ( ) const

Returns the scheme of this font. Assumes that this font has a scheme (please call has_scheme() to check). If this font does not have a scheme, an xlnt::invalid_attribute exception will be thrown.

◆ shadow() [1/2]

font& xlnt::font::shadow ( bool  shadow)

Sets the shadow state of the font to shadow and returns a reference to the font.

◆ shadow() [2/2]

bool xlnt::font::shadow ( ) const

Returns true if this font has a shadow applied.

◆ size() [1/2]

font& xlnt::font::size ( double  size)

Sets the size of the font to size and returns a reference to the font.

◆ size() [2/2]

double xlnt::font::size ( ) const

Returns the size of the font.

◆ strikethrough() [1/2]

font& xlnt::font::strikethrough ( bool  strikethrough)

Sets the bold state of the font to bold and returns a reference to the font.

◆ strikethrough() [2/2]

bool xlnt::font::strikethrough ( ) const

Returns true if this font has a strikethrough applied.

◆ subscript() [1/2]

font& xlnt::font::subscript ( bool  value)

Sets the vertical alignment of the font to subscript and returns a reference to the font.

◆ subscript() [2/2]

bool xlnt::font::subscript ( ) const

Returns true if this font has a vertical alignment of subscript.

◆ superscript() [1/2]

font& xlnt::font::superscript ( bool  value)

Sets the vertical alignment of the font to superscript and returns a reference to the font.

◆ superscript() [2/2]

bool xlnt::font::superscript ( ) const

Returns true if this font has a vertical alignment of superscript.

◆ underline() [1/2]

font& xlnt::font::underline ( underline_style  new_underline)

Sets the underline state of the font to new_underline and returns a reference to the font.

◆ underline() [2/2]

underline_style xlnt::font::underline ( ) const

Returns the particular style of underline this font has applied.

◆ underlined()

bool xlnt::font::underlined ( ) const

Returns true if this font has any type of underline applied.


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