#include <cascade/graphics/CascadeFont.h>
Inheritance diagram for CascadeFont:
Public Types | |
typedef bool() | EnumProc (const Attributes &attributes, void *pClientData) |
enum | WeightFlags { kNormal = 0, kBold = (1 << 0), kItalic = (1 << 1) } |
enum | { kMaxFaceName = 48, kMaxFaceNameLen = kMaxFaceName - 1 } |
enum | TruncationType { kTruncateRight = 0, kTruncateLeft = 1, kTruncateCenter = 2 } |
Public Member Functions | |
CascadeFont () | |
CascadeFont (const CascadeFont &font) | |
virtual | ~CascadeFont () |
bool | operator== (const CascadeFont &that) const |
bool | operator!= (const CascadeFont &that) const |
void | GetAttributes (Attributes &attributesToSet) |
bool | SetAttributes (const Attributes &attributes) |
bool | EnumFonts (EnumProc *pEnumProc, void *pClientData) |
CascadeDims | GetTextExtent (const CascadeString &string) |
void | GetFontMetrics (Metrics &metricsToSet) |
bool | TruncateText (const CascadeString &text, const CascadeString &ellipsis, const CascadeDims &dims, CascadeString &truncatedTextToSet, TruncationType truncationType=kTruncateRight) |
Friends | |
class | CascadeBitmap |
true if it successfully truncated the string, false otherwise | |
class | CascadeScreen |
Classes | |
class | Attributes |
Attributes describes a font's attributes. More... | |
class | Metrics |
Metrics describes a font's metrics. More... |
CascadeFont houses a lightweight representation of a font. CascadeFonts are arguments to the text drawing functions in CascadeBitmap.
CascadeFonts are specified using CascadeFont::Attributes. Metric information about a font is specified using CascadeFont::Metrics.
|
Callback function for enumerating available fonts in the system Clients provide their own EnumProc to the EnumFonts() function. Your custom EnumProc will get called back by the EnumFonts() function, one for each font available in the system.
|
|
|
|
|
|
represents a combination of font weights WeightFlags is used to specify the font weight in a set of font Attributes.
|
|
default constructor The default constructor initializes the CascadeFont to refer to the default system font. |
|
copy constructor This copy constructor copies the font from the font passed in.
|
|
destructor The CascadeFont destructor is lightweight. |
|
enumerates the fonts in the system EnumFonts() calls (*pEnumProc) once for each font in the system that can be described by the value of the attributes passed into (*pEnumProc). EnumFonts() returns true if enumeration completed successfully, false if enumeration was aborted due to a (*pEnumProc) invocation returning false.
|
|
gets the attributes for the font GetAttributes() fills attributesToSet with the attributes of the font.
|
|
gets the font metrics GetFontMetrics() sets metricsToSet with the font metrics.
|
|
measures the pixel dimensions of a string in this font call GetTextExtent() to get the dimensions of a string (in pixels).
|
|
comparison operator This comparison operator tests for inequality. |
|
comparison operator This comparison operator tests for equality. |
|
sets the attributes for the font call SetAttributes() to set the attributes of the font to those specified by attributes. SetAttributes() returns true if successful, false if no font exists for the specified attributes (Use EnumFonts to discover valid values for attributes). The CascadeFont will only be valid if the most recent call to SetAttributes has returned true, otherwise the font will represent the default system font (on failure).
|
|
truncates a string to fit in specified dimensions TruncateText() truncates a string if it is longer than the width of the specified dimensions. TruncationType can be specified at the left, center |
|
true if it successfully truncated the string, false otherwise
|
|
|