34 #include <Pt/Gfx/Api.h>
35 #include <Pt/System/Path.h>
36 #include <Pt/SmartPtr.h>
115 Font(
const std::string& family, std::size_t size,
116 const std::string& styleName,
117 Weight weight = Weight::Normal,
118 Slant slant = Slant::Normal,
119 Stretch stretch = Stretch::Normal);
123 Font(
const std::string& family, std::size_t size,
124 Weight weight = Weight::Normal,
125 Slant slant = Slant::Normal,
126 Stretch stretch = Stretch::Normal);
131 Weight weight = Weight::Normal,
132 Slant slant = Slant::Normal,
133 Stretch stretch = Stretch::Normal);
169 Font withSize(std::size_t size)
const;
317 , _weight(
Font::Weight::Normal)
318 , _slant(
Font::Slant::Normal)
319 , _stretch(
Font::Stretch::Normal)
320 , _category(
Font::Category::None)
324 FontData(
const std::string& family, std::size_t size,
328 const std::string& styleName = std::string())
331 , _styleName(styleName)
335 , _category(Font::Category::None)
349 , _category(category)
353 FontData(
const std::string& family,
const FontData& font)
356 , _styleName(font._styleName)
357 , _weight(font._weight)
358 , _slant(font._slant)
359 , _stretch(font._stretch)
360 , _category(font._category)
364 const std::string& family()
const
369 std::size_t size()
const
374 const std::string& styleName()
const
379 bool hasStyleName()
const
381 return ! _styleName.empty();
407 std::string _styleName;
Core module.
Definition: pt-gfx-images.dox:14
Category category() const
Returns the generic font category.
Slant slant() const
Returns the slant of the font request.
Slant
Describes the requested font slant.
Definition: Font.h:76
bool operator==(const Font &a, const Font &b)
Returns true if two font requests are equal.
Definition: Font.h:208
Stretch stretch() const
Returns the stretch of the font request.
Font()
Default constructor.
Weight weight() const
Returns the weight of the font request.
static bool addFont(const System::Path &path)
Adds one font file.
bool operator<(const Font &a, const Font &b)
Returns true if one font request sorts before another.
Definition: Font.h:238
Font withSize(std::size_t size) const
Returns a copy of this font with a different size.
Definition: Font.h:262
Weight
Describes the requested font weight.
Definition: Font.h:61
std::size_t size() const
Returns the size of the font.
static const std::vector< System::Path > & fontFiles()
Returns the registered font files.
const std::string & family() const
Returns the family of the font.
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.
const std::string & styleName() const
Returns the optional exact style name hint.
static void addFonts(const System::Path &path)
Adds all fonts found at the given path.
Category
Describes a generic fallback font category.
Definition: Font.h:100
Font request used for text drawing and measurement.
Definition: Font.h:56
Represents a path in the file-system.
Definition: Path.h:48
bool operator!=(const Font &a, const Font &b)
Returns true if two font requests are different.
Definition: Font.h:223
Font withSlant(Slant slant) const
Returns a copy of this font with a different slant.
Definition: Font.h:286
Font withWeight(Weight weight) const
Returns a copy of this font with a different weight.
Definition: Font.h:274
Font withStretch(Stretch stretch) const
Returns a copy of this font with a different stretch.
Definition: Font.h:298
static bool removeFont(const System::Path &path)
Removes one font file.
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.
Stretch
Describes the requested font stretch.
Definition: Font.h:85
bool hasStyleName() const
Returns true if an exact style name hint is set.
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.