class CCL::Font
Overview
#include <font.h> class Font: protected CCL::PlainFont { public: // enums enum CollectFontFlags; enum Defaults; enum SmoothingMode; enum Styles; enum TrimMode; // fields size; Size kBold; Size isBold kUnderline; Size isBold isUnderline StyleName spacing; // construction Font (); Font ( StringRef _face, float _size = kDefaultSize, int _style = kNormal, int _mode = kDefault ); Font (FontRef other); // methods PROPERTY_STRING_METHODS (face, Face); Size PROPERTY_BY_VALUE (int, style, Style); Size isBold PROPERTY_FLAG (style, kItalic, isItalic); Size isBold isUnderline PROPERTY_FLAG (style, kStrikeout, isStrikeout); Size isBold isUnderline StyleName PROPERTY_BY_VALUE (int, mode, Mode); Size isBold isUnderline StyleName Spacing PROPERTY_BY_VALUE ( float, lineSpacing, LineSpacing ); bool isEqual (FontRef font) const; Font& zoom (float zoomFactor); static const Font& getDefaultFont (); static int getStringWidth (StringRef text, FontRef font); static CoordF getStringWidthF (StringRef text, FontRef font); static void measureString ( Rect& size, StringRef text, FontRef font, int flags = 0 ); static void measureString ( RectF& size, StringRef text, FontRef font, int flags = 0 ); static void measureStringImage ( RectF& size, StringRef text, FontRef font, bool shiftToBaseline ); static void measureText ( Rect& size, Coord lineWidth, StringRef text, FontRef font, TextFormatRef format = TextFormat (Alignment::kLeftTop, TextFormat::kWordBreak) ); static void measureText ( RectF& size, CoordF lineWidth, StringRef text, FontRef font, TextFormatRef format = TextFormat (Alignment::kLeftTop, TextFormat::kWordBreak) ); static void collapseString ( String& string, Coord maxWidth, FontRef font, int trimMode = kTrimModeDefault, bool exact = false ); static void collapseString ( String& string, CoordF maxWidth, FontRef font, int trimMode = kTrimModeDefault, bool exact = false ); static IFontTable* collectFonts (int flags = kCollectAppFonts); };
Inherited Members
public: // fields String face; float size = 0.f; int style = 0; String styleName; int mode = 0; float spacing = 0.f; float lineSpacing = 1.f;
Detailed Documentation
Font definition.
Methods
Size isBold isUnderline StyleName PROPERTY_BY_VALUE (int, mode, Mode)
< style name overwrites style flags
Size isBold isUnderline StyleName Spacing PROPERTY_BY_VALUE ( float, lineSpacing, LineSpacing )
< additional character spacing in points
static const Font& getDefaultFont ()
Get default font.
static int getStringWidth (StringRef text, FontRef font)
Get width of Unicode string.
static void measureString ( Rect& size, StringRef text, FontRef font, int flags = 0 )
Get extent of Unicode string.
static void measureStringImage ( RectF& size, StringRef text, FontRef font, bool shiftToBaseline )
Get extent of a Unicode string’s glyphs without typographical spacing.
static void measureText ( Rect& size, Coord lineWidth, StringRef text, FontRef font, TextFormatRef format = TextFormat (Alignment::kLeftTop, TextFormat::kWordBreak) )
Get extent of a multiline text area.
static void collapseString ( String& string, Coord maxWidth, FontRef font, int trimMode = kTrimModeDefault, bool exact = false )
Collapse string to fit into given width (replacing characters with “..”).
static IFontTable* collectFonts (int flags = kCollectAppFonts)
Create list of fonts.