]>
git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/src/Style.cxx
1 // Scintilla source code edit control
3 ** Defines the font and colour style for a class of text.
5 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
12 #include "Scintilla.h"
16 using namespace Scintilla
;
19 FontAlias::FontAlias() {
22 FontAlias::~FontAlias() {
24 // ~Font will not release the actual font resource sine it is now 0
27 void FontAlias::MakeAlias(Font
&fontOrigin
) {
28 SetID(fontOrigin
.GetID());
31 void FontAlias::ClearFont() {
35 bool FontSpecification::EqualTo(const FontSpecification
&other
) const {
36 return weight
== other
.weight
&&
37 italic
== other
.italic
&&
39 characterSet
== other
.characterSet
&&
40 fontName
== other
.fontName
;
43 FontMeasurements::FontMeasurements() {
47 void FontMeasurements::Clear() {
55 Style::Style() : FontSpecification() {
56 Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),
57 Platform::DefaultFontSize() * SC_FONT_SIZE_MULTIPLIER
, 0, SC_CHARSET_DEFAULT
,
58 SC_WEIGHT_NORMAL
, false, false, false, caseMixed
, true, true, false);
61 Style::Style(const Style
&source
) : FontSpecification(), FontMeasurements() {
62 Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),
64 SC_WEIGHT_NORMAL
, false, false, false, caseMixed
, true, true, false);
67 characterSet
= source
.characterSet
;
68 weight
= source
.weight
;
69 italic
= source
.italic
;
71 eolFilled
= source
.eolFilled
;
72 underline
= source
.underline
;
73 caseForce
= source
.caseForce
;
74 visible
= source
.visible
;
75 changeable
= source
.changeable
;
76 hotspot
= source
.hotspot
;
82 Style
&Style::operator=(const Style
&source
) {
85 Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),
86 0, 0, SC_CHARSET_DEFAULT
,
87 SC_WEIGHT_NORMAL
, false, false, false, caseMixed
, true, true, false);
90 characterSet
= source
.characterSet
;
91 weight
= source
.weight
;
92 italic
= source
.italic
;
94 eolFilled
= source
.eolFilled
;
95 underline
= source
.underline
;
96 caseForce
= source
.caseForce
;
97 visible
= source
.visible
;
98 changeable
= source
.changeable
;
102 void Style::Clear(ColourDesired fore_
, ColourDesired back_
, int size_
,
103 const char *fontName_
, int characterSet_
,
104 int weight_
, bool italic_
, bool eolFilled_
,
105 bool underline_
, ecaseForced caseForce_
,
106 bool visible_
, bool changeable_
, bool hotspot_
) {
109 characterSet
= characterSet_
;
113 fontName
= fontName_
;
114 eolFilled
= eolFilled_
;
115 underline
= underline_
;
116 caseForce
= caseForce_
;
118 changeable
= changeable_
;
121 FontMeasurements::Clear();
124 void Style::ClearTo(const Style
&source
) {
141 void Style::Copy(Font
&font_
, const FontMeasurements
&fm_
) {
142 font
.MakeAlias(font_
);
144 font
.SetAscent(fm_
.ascent
);
146 (FontMeasurements
&)(*this) = fm_
;