class Font : private AssignValueTypeNo <Font, FONT_V, Moveable<Font> >
Font is a concrete class that describes the appearance of text. It is Moveable, has cheap copy operation and is Value convertible with rich-Value abilities.
It is storing several attributes to describe the text. The corresponding system font is stored in the form of face index - each system font has specific index value. There are some predefined indexes for common fonts:
|
Font::STDFONT
|
Standard GUI font defined by platform. Can be altered by Draw::SetStdFont.
|
Font::ROMAN
|
Standard serif font.
|
Font::ARIAL
|
Standard sans-serif font.
|
Font::COURIER
|
Standard monospaced font.
|
Font::SYMBOL
|
Standard symbol font.
|
|
|
Text metrics for Font instance can be obtained by Info method in the form of FontInfo value.
static int GetFaceCount()
Returns the number of face-names available.
static String GetFaceName(int index)
Returns the name of face index.
static int FindFaceNameIndex(const char *name)
Finds the face index of face-name.
static dword GetFaceInfo(int index)
Returns the information about face index as combination of binary flags:
|
Font::FIXEDPITCH
|
Font-face is monospaced.
|
Font::SCALEABLE
|
Font-face is freely scalable (it is in vector format, e.g. Truetype).
|
Font::SYMBOLTYPE
|
Font contains symbols instead of letters.
|
Font::COMPOSED
|
U++ uses special code to compose missing Latin characters by combining existing characters.
|
|
|
int GetFace() const
Face index of Font.
int GetHeight() const
Returns the height of font.
int GetWidth() const
Return the width of font or 0 for default width.
String GetFaceName() const
Returns the face-name text for current instance.
dword GetFaceInfo() const
Same as GetFaceInfo(GetFace()).
FontInfo Info() const
Returns the object providing complete information about font metrics.
Font& Face(int n)
Sets the face index.
Font& Height(int n)
Sets the font height (in pixels/dots).
Font& Width(int n)
Sets the font width. Use 0 for default width (in pixels/dots).
Font& Bold()
Font& NoBold()
Font& Bold(bool b)
Font& Italic()
Font& NoItalic()
Font& Italic(bool b)
Font& Underline()
Font& NoUnderline()
Font& Underline(bool b)
Font& Strikeout()
Font& NoStrikeout()
Font& Strikeout(bool b)
Sets or unsets bold/italic/undeline/strikeout modes.
Font& NonAntiAliased()
Font& NoNonAntiAliased()
Font& NonAntiAliased(bool b)
Sets/unsets non-anti-aliased flag. This indicates that anti-aliasing should not be used when painting the font.
bool IsBold() const
bool IsItalic() const
bool IsUnderline() const
bool IsStrikeout() const
Tests whether bold/italic/underline/strikeout is active.
bool IsNonAntiAliased() const
True if NonAntiAliased is active.
Font& FaceName(const String & name)
Sets the face to name. If name is not valid face-name, Font is set to Null.
Font operator()() const
Returns a copy of Font. Useful to simplify notation when altering existing Font values.
Font operator()(int n) const
Returns a copy of Font, with height changed to n.
void Serialize(Stream & s)
Serializes the font value (face index is stored as face-name text).
bool operator==(Font f) const
bool operator!=(Font f) const
Compares two Font instances.
dword GetHashValue() const
Returns the font hash value.
bool IsNull() const
True if Font is Null.
Font()
Initializes Font to STDFONT, default height, all attributes not active.
Font(int face, int height)
Initializes font to face index and height.
Font(const Nuller &)
Sets the font Null.
operator Value() const
Converts the Font to the Value (font is rich Value).
Font(const Value & q)
Converts the Value to the Font.
|