]>
git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/src/Style.cxx
56312314ffc2457d6c4a8e059325ea9629527820
1 // Scintilla source code edit control
2 // Style.cxx - defines the font and colour style for a class of text
3 // Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
4 // The License.txt file describes the conditions under which this software may be distributed.
20 Style
&Style::operator=(const Style
&source
) {
24 fore
.desired
= source
.fore
.desired
;
25 back
.desired
= source
.back
.desired
;
27 italic
= source
.italic
;
29 strcpy(fontName
, source
.fontName
);
30 eolFilled
= source
.eolFilled
;
34 void Style::Clear(Colour fore_
, Colour back_
, int size_
, const char *fontName_
,
35 bool bold_
, bool italic_
, bool eolFilled_
) {
41 strcpy(fontName
, fontName_
);
42 eolFilled
= eolFilled_
;
46 void Style::Realise(Surface
&surface
, int zoomLevel
) {
47 int sizeZoomed
= size
+ zoomLevel
;
48 if (sizeZoomed
<= 2) // Hangs if sizeZoomed <= 1
51 int deviceHeight
= (sizeZoomed
* surface
.LogPixelsY()) / 72;
52 font
.Create(fontName
, deviceHeight
, bold
, italic
);
54 ascent
= surface
.Ascent(font
);
55 descent
= surface
.Descent(font
);
56 // Probably more typographically correct to include leading
57 // but that means more complex drawing as leading must be erased
58 //lineHeight = surface.ExternalLeading() + surface.Height();
59 externalLeading
= surface
.ExternalLeading(font
);
60 lineHeight
= surface
.Height(font
);
61 aveCharWidth
= surface
.AverageCharWidth(font
);
62 spaceWidth
= surface
.WidthChar(font
, ' ');