wxMaxima
|
Text Style Definition. More...
#include <TextStyle.h>
Public Types | |
using | did_change = bool |
Public Member Functions | |
Style (AFontSize fontSize) | |
Style (const Style &) | |
Style & | operator= (const Style &) |
bool | operator== (const Style &o) const |
Compares. | |
Style & | Read (wxConfigBase *config, const wxString &where) |
Read this style from a config source. | |
void | Write (wxConfigBase *config, const wxString &where) const |
Write this style to a config source. | |
wxFontFamily | GetFamily () const |
wxFontEncoding | GetEncoding () const |
wxFontWeight | GetWeight () const |
bool | IsBold () const |
bool | IsLight () const |
wxFontStyle | GetFontStyle () const |
bool | IsItalic () const |
bool | IsSlant () const |
bool | IsUnderlined () const |
bool | IsStrikethrough () const |
const wxString & | GetFontName () const |
AFontSize | GetFontSize () const |
The size of this style's font, asserted to be valid. | |
uint32_t | GetRGBColor () const |
wxColor | GetColor () const |
did_change | SetFamily (wxFontFamily family) |
did_change | SetEncoding (wxFontEncoding encoding) |
did_change | SetWeight (wxFontWeight weight) |
did_change | SetBold (bool bold=true) |
did_change | SetLight (bool light=true) |
did_change | SetFontStyle (wxFontStyle style) |
did_change | SetItalic (bool italic=true) |
did_change | SetSlant (bool slant=true) |
did_change | SetUnderlined (bool underlined=true) |
did_change | SetStrikethrough (bool strikethrough=true) |
did_change | SetFontName (wxString fontName) |
did_change | SetFontSize (AFontSize fontSize) |
did_change | SetRGBColor (uint32_t rgb) |
did_change | SetColor (const wxColor &color) |
did_change | SetColor (wxSystemColour sysColour) |
Style & | Family (wxFontFamily family) |
Style & | Encoding (wxFontEncoding encoding) |
Style & | Weight (wxFontWeight weight) |
Style & | FontStyle (wxFontStyle style) |
Style & | Bold (bool bold=true) |
Style & | Light (bool light=true) |
Style & | Italic (bool italic=true) |
Style & | Slant (bool slant=true) |
Style & | Underlined (bool underlined=true) |
Style & | Strikethrough (bool strikethrough=true) |
Style & | FontSize (float size) |
Style & | FontSize (AFontSize fontSize) |
Style & | RGBColor (uint32_t rgb) |
Style & | Color (const wxColor &color) |
Style & | Color (uint8_t r, uint8_t g, uint8_t b) |
Style & | Color (wxSystemColour sysColour) |
Style & | ChangeLightness (int alpha) |
bool | CantChangeFontName () const |
bool | CantChangeFontVariant () const |
void | CantChangeFontName (bool changeForbidden) |
void | CantChangeFontVariant (bool changeForbidden) |
wxFontInfo | GetAsFontInfo () const |
bool | IsFontOk () const |
const wxFont & | GetFont (AFontSize fontSize) const |
Returns the font associated with this style, but with the size fontSize. | |
const wxFont & | GetFont () const |
Returns the font associated with this style. | |
did_change | SetFromFont (const wxFont &) |
Sets all font-related properties based on another font. | |
did_change | SetFontFrom (const Style &) |
Sets all font-related properties based on another style, including size, font style and weight. | |
did_change | SetFontFaceFrom (const Style &) |
Sets font-face-only properties based on another style. | |
did_change | SetFontFaceAndSizeFrom (const Style &) |
Sets font-face and size only properties based on another style (not attributes like bold, etc.) | |
void | ClearCache () const |
Empties the font variant cache. | |
std::shared_ptr< FontVariantCache > | GetFontCache () const |
Static Public Member Functions | |
static const Style & | FromFont (const wxFont &font) |
Gets a style that represents a given font. The font gets cached. | |
static Style | FromStockFont (wxStockGDI::Item font) |
Gets a style that represents a stock font. The font is pre-cached. | |
static const wxColor & | Default_Color () |
static constexpr bool | IsFractionalFontSizeSupported () |
Old wxWidgets versions only support integers as font sizes. | |
static AFontSize | GetFontSize (const wxFont &) |
Returns the font size that this style has when not zoomed or being used as subscript/... | |
static void | SetFontSize (wxFont &, AFontSize fontSize) |
Sets the font size that this style has when not zoomed or being used as subscript/... | |
Static Public Attributes | |
static constexpr wxFontFamily | Default_Family {wxFONTFAMILY_DEFAULT} |
static constexpr wxFontEncoding | Default_Encoding {wxFONTENCODING_DEFAULT} |
static constexpr wxFontWeight | Default_Weight {wxFONTWEIGHT_NORMAL} |
static constexpr wxFontStyle | Default_FontStyle {wxFONTSTYLE_NORMAL} |
static constexpr bool | Default_Underlined {false} |
static constexpr bool | Default_Strikethrough {false} |
static constexpr AFontSize | Default_FontSize {10.0f} |
static constexpr uint32_t | Default_ColorRGB {MAKE_RGB(0, 0, 0)} |
Text Style Definition.
It is a well-performing replacement for wxFontInfo, with additional color attribute.
Since we only use a few handful text styles in a handful of sizes and since creating a wxFont object from a style definition is slow we employ a separate FontVariantCache that caches the wxFont objects we need for fonts with this font name.
Style & Style::Read | ( | wxConfigBase * | config, |
const wxString & | where | ||
) |
Read this style from a config source.
Only touches the attributes that were successfully read. Remaining attributes are unchanged.