diff options
Diffstat (limited to 'src/Style.h')
-rw-r--r-- | src/Style.h | 61 |
1 files changed, 44 insertions, 17 deletions
diff --git a/src/Style.h b/src/Style.h index c1f87e1b3..460dad490 100644 --- a/src/Style.h +++ b/src/Style.h @@ -12,18 +12,53 @@ namespace Scintilla { #endif +struct FontSpecification { + const char *fontName; + bool bold; + bool italic; + int size; + int characterSet; + int extraFontFlag; + FontSpecification() : + fontName(0), + bold(false), + italic(false), + size(10), + characterSet(0), + extraFontFlag(0) { + } + bool EqualTo(const FontSpecification &other) const; +}; + +// Just like Font but only has a copy of the FontID so should not delete it +class FontAlias : public Font { + // Private so FontAlias objects can not be copied + FontAlias(const FontAlias &); + FontAlias &operator=(const FontAlias &); +public: + FontAlias(); + virtual ~FontAlias(); + void ClearFont(); +}; + +struct FontMeasurements { + unsigned int lineHeight; + unsigned int ascent; + unsigned int descent; + unsigned int externalLeading; + unsigned int aveCharWidth; + unsigned int spaceWidth; + int sizeZoomed; + FontMeasurements(); + void Clear(); +}; + /** */ -class Style { +class Style : public FontSpecification, public FontMeasurements { public: ColourPair fore; ColourPair back; - bool aliasOfDefaultFont; - bool bold; - bool italic; - int size; - const char *fontName; - int characterSet; bool eolFilled; bool underline; enum ecaseForced {caseMixed, caseUpper, caseLower}; @@ -32,14 +67,7 @@ public: bool changeable; bool hotspot; - Font font; - int sizeZoomed; - unsigned int lineHeight; - unsigned int ascent; - unsigned int descent; - unsigned int externalLeading; - unsigned int aveCharWidth; - unsigned int spaceWidth; + FontAlias font; Style(); Style(const Style &source); @@ -52,8 +80,7 @@ public: bool underline_, ecaseForced caseForce_, bool visible_, bool changeable_, bool hotspot_); void ClearTo(const Style &source); - bool EquivalentFontTo(const Style *other) const; - void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0, int extraFontFlag = 0); + void Copy(Font &font_, const FontMeasurements &fm_); bool IsProtected() const { return !(changeable && visible);} }; |