aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2000-03-17 06:08:26 +0000
committernyamatongwe <devnull@localhost>2000-03-17 06:08:26 +0000
commit7b70e3bbae20c56dc616cef89dea715e81fafd78 (patch)
treece923196bbe375fb792c12c19b4f477d3b95008f
parent01cd695dc8d693c39500f24adf689d08d77d39da (diff)
downloadscintilla-mirror-7b70e3bbae20c56dc616cef89dea715e81fafd78.tar.gz
Fixed bug in releasing font which was an alias of default font.
-rw-r--r--src/LexHTML.cxx2
-rw-r--r--src/Style.cxx19
2 files changed, 14 insertions, 7 deletions
diff --git a/src/LexHTML.cxx b/src/LexHTML.cxx
index fa88ab6ac..ae2de8ff2 100644
--- a/src/LexHTML.cxx
+++ b/src/LexHTML.cxx
@@ -25,7 +25,7 @@ static int segIsScriptingIndicator(StylingContext &styler, unsigned int start, u
s[i] = tolower(styler[start + i]);
s[i + 1] = '\0';
}
-Platform::DebugPrintf("Scripting indicator [%s]\n", s);
+//Platform::DebugPrintf("Scripting indicator [%s]\n", s);
if (strstr(s, "vbs"))
return eScriptVBS;
if (strstr(s, "pyth"))
diff --git a/src/Style.cxx b/src/Style.cxx
index 75dc6eb93..3faca473f 100644
--- a/src/Style.cxx
+++ b/src/Style.cxx
@@ -10,14 +10,16 @@
#include "Style.h"
Style::Style() {
- aliasOfDefaultFont = false;
+ aliasOfDefaultFont = true;
Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
Platform::DefaultFontSize(), 0,
false, false, false);
}
Style::~Style() {
- if (!aliasOfDefaultFont)
+ if (aliasOfDefaultFont)
+ font.SetID(0);
+ else
font.Release();
aliasOfDefaultFont = false;
}
@@ -46,10 +48,10 @@ void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,
size = size_;
fontName = fontName_;
eolFilled = eolFilled_;
- if (!aliasOfDefaultFont)
- font.Release();
- else
+ if (aliasOfDefaultFont)
font.SetID(0);
+ else
+ font.Release();
aliasOfDefaultFont = false;
}
@@ -72,13 +74,18 @@ void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
if (sizeZoomed <= 2) // Hangs if sizeZoomed <= 1
sizeZoomed = 2;
- font.Release();
+ if (aliasOfDefaultFont)
+ font.SetID(0);
+ else
+ font.Release();
int deviceHeight = (sizeZoomed * surface.LogPixelsY()) / 72;
aliasOfDefaultFont = defaultStyle && EquivalentFontTo(defaultStyle);
if (aliasOfDefaultFont) {
font.SetID(defaultStyle->font.GetID());
} else if (fontName) {
font.Create(fontName, deviceHeight, bold, italic);
+ } else {
+ font.SetID(0);
}
ascent = surface.Ascent(font);