Font.hpp

Maintains basic information about a font to be used in HTML.

class Font
#include <Font.hpp>

Maintain information about an HTML font.

Public Functions

Font(const Font&) = default
Font(Font&&) = default
inline Font(const std::string &_family = "Helvetica", int _size = 15, const std::string &_color = "black", bool _bold = false, bool _italic = false)
inline Font(int _size, const std::string &_color = "black", bool _bold = false, bool _italic = false)
inline ~Font()
Font &operator=(const Font&) = default
Font &operator=(Font&&) = default
inline const std::string &GetFamily() const
Returns:

font family

inline int GetSize() const
Returns:

font size (in pixels)

inline const std::string &GetColor() const
Returns:

font color

inline const std::string &GetLineColor() const
Returns:

color of lines through text (underline or strikethrough)

inline bool IsBold() const
Returns:

boolean indicating whether font is bold

inline bool IsItalic() const
Returns:

boolean indicating whether font is italic

inline bool IsSmallcaps() const
Returns:

boolean indicating whether font is in small caps

inline bool IsUnderlined() const
Returns:

boolean indicating whether font is underlined

inline bool IsOverlined() const
Returns:

boolean indicating whether font is overlined

inline bool IsStrikethrough() const
Returns:

boolean indicating whether font is strikethrough

inline bool IsWavyLine() const
Returns:

boolean indicating whether font is wavy line

inline bool HasLine() const
Returns:

boolean indicating whether font has any kind of line (underline, overline, or strikethrough)

inline Font &SetFamily(const std::string &_family)

Sets font family to specified value

Returns:

reference to this font for easy chaining

inline Font &SetSize(int _size)

Sets font size to specified value

Returns:

reference to this font for easy chaining

inline Font &SetColor(const std::string &_color)

Sets font color to specified value

Returns:

reference to this font for easy chaining

inline Font &SetLineColor(const std::string &_color)

Sets color of any lines through, under, or over this font

Returns:

reference to this font for easy chaining

inline Font &SetBold(bool _in = true)

Sets whether font is bold

Returns:

reference to this font for easy chaining

inline Font &SetItalic(bool _in = true)

Sets whether font is italic

Returns:

reference to this font for easy chaining

inline Font &SetSmallcaps(bool _in = true)

Sets whether font is small caps

Returns:

reference to this font for easy chaining

inline Font &SetUnderlined(bool _in = true)

Sets whether font is underlined

Returns:

reference to this font for easy chaining

inline Font &SetOverlined(bool _in = true)

Sets whether font is overlined

Returns:

reference to this font for easy chaining

inline Font &SetStrikethrough(bool _in = true)

Sets whether font is strikethrough-ed

Returns:

reference to this font for easy chaining

inline Font &SetWavyLine(bool _in = true)

Sets whether font is wavy line

Returns:

reference to this font for easy chaining

inline void ConfigStyle(Style &style) const

Take a Style object an fill it out based on this font information.

inline Style AsStyle() const
Returns:

a style object filled out according to this font information

inline std::string GetHTMLStart()
Returns:

a string containing the html necessary to open a span element using this font.

inline std::string GetHTMLEnd()
Returns:

a string containing the html necessary to close a span element created by GetHTMLStart()

inline bool operator==(const Font &_in) const

Fonts will evaluate to equal if all of their properties are the same.

inline bool operator!=(const Font &_in) const

Fonts will evaluate to equal if all of their properties are the same.

Protected Attributes

std::string family

Font family to use.

int size

Font size (in px) to use.

std::string color

Font color.

std::string line_color

Color of lines through the text (underline, linethrough, etc.)

bool is_bold

Is this font bold?

bool is_italic

Is this font italic?

bool is_smallcaps

Should this text be in small caps?

bool is_underlined

Should this text be underlined?

bool is_overlined

Should this text have a line above it?

bool is_linethrough

Should this text have a line through it?

bool is_wavy_line

Should lines be made wavy?