#include <Pt/Gfx/Font.h>
Font family, size and style. More...
Public Types | |
| enum class | Weight |
| Describes the requested font weight. | |
| enum class | Slant |
| Describes the requested font slant. | |
| enum class | Stretch |
| Describes the requested font stretch. | |
| enum class | Category |
| Describes a generic fallback font category. | |
Public Member Functions | |
| Font () | |
| Default constructor. | |
| Font (const std::string &family, std::size_t size, const std::string &styleName, Weight weight=Weight::Normal, Slant slant=Slant::Normal, Stretch stretch=Stretch::Normal) | |
| Construct a font with an exact style name hint. | |
| Font (const std::string &family, std::size_t size, Weight weight=Weight::Normal, Slant slant=Slant::Normal, Stretch stretch=Stretch::Normal) | |
| Construct a font with explicit weight and slant. | |
| Font (Category category, std::size_t size, Weight weight=Weight::Normal, Slant slant=Slant::Normal, Stretch stretch=Stretch::Normal) | |
| Construct a font from a generic category. | |
| const std::string & | family () const |
| Returns the family of the font. | |
| std::size_t | size () const |
| Returns the size of the font. | |
| const std::string & | styleName () const |
| Returns the optional exact style name hint. | |
| bool | hasStyleName () const |
| Returns true if an exact style name hint is set. | |
| Weight | weight () const |
| Returns the weight of the font request. | |
| Slant | slant () const |
| Returns the slant of the font request. | |
| Stretch | stretch () const |
| Returns the stretch of the font request. | |
| Category | category () const |
| Returns the generic font category. | |
| Font | withSize (std::size_t size) const |
| Returns a copy of this font with a different size. | |
| Font | withWeight (Weight weight) const |
| Returns a copy of this font with a different weight. | |
| Font | withSlant (Slant slant) const |
| Returns a copy of this font with a different slant. | |
| Font | withStretch (Stretch stretch) const |
| Returns a copy of this font with a different stretch. | |
Static Public Member Functions | |
| static void | addFonts (const System::Path &path) |
| Adds all fonts found at the given path. | |
| static bool | addFont (const System::Path &path) |
| Adds one font file. | |
| static bool | removeFont (const System::Path &path) |
| Removes one font file. | |
| static const std::vector< System::Path > & | fontFiles () |
| Returns the registered font files. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| bool | operator== (const Font &a, const Font &b) |
| Returns true if two font requests are equal. | |
| bool | operator!= (const Font &a, const Font &b) |
| Returns true if two font requests are different. | |
| bool | operator< (const Font &a, const Font &b) |
| Returns true if one font request sorts before another. | |
Font is a request, not a loaded face. A painter uses the same request to measure and to draw, so layout and rendering stay aligned. Family, size, Weight, Slant, and Stretch select a face. Category names a generic fallback when no family is set. withSize() and the other with...() helpers return a modified copy.
addFont() and addFonts() register font files for later requests. fontFiles() lists those paths. Bitmap lists the families and faces the backend can resolve.