FontOption Class Reference

#include <Pt/Forms/StyleOptions.h>

Stores a complete font or partial font overrides. More...

Inherits StyleOption.

Public Member Functions

 FontOption ()
 Constructs an empty font option.
 FontOption (const FontOption &o)
 Copies o.
FontOptionoperator= (const FontOption &o)
 Assigns o.
virtual StyleOptionclone () const
 Returns a copy of this option.
virtual const std::type_info & typeId () const
 Returns the option class used as the lookup key.
virtual const char * name () const override
 Returns the option name.
bool isSet () const
 Returns true if any font override is set.
const Gfx::Fontvalue () const
 Returns the effective font after bind().
void setFont (const Gfx::Font &font)
 Replaces the complete local font override.
void setSize (std::size_t size)
 Sets the local font size override.
void setWeight (Gfx::Font::Weight weight)
 Sets the local font weight override.
void setSlant (Gfx::Font::Slant slant)
 Sets the local font slant override.
virtual void bind (const StyleOptions *inherited)
 Merges this option with the inherited font from inherited.
Gfx::Font getFont (const Gfx::Font &baseFont) const
 Returns the local font overrides merged with baseFont.

Detailed Description

A FontOption can replace the whole font, or change only the size, weight, or slant. The remaining attributes then come from the application font. value() is the effective font after bind(). getFont() merges the local overrides with baseFont. Use StyleOptions::findLocal() to detect a local overlay, then getFont() to merge it with a base font.