aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx18
-rw-r--r--src/Style.cxx20
-rw-r--r--src/Style.h8
-rw-r--r--src/ViewStyle.cxx12
4 files changed, 36 insertions, 22 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index f44279bbd..7261ac7d2 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -6981,7 +6981,10 @@ void Editor::StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam
vs.styles[wParam].back.desired = ColourDesired(lParam);
break;
case SCI_STYLESETBOLD:
- vs.styles[wParam].bold = lParam != 0;
+ vs.styles[wParam].weight = lParam != 0 ? SC_WEIGHT_BOLD : SC_WEIGHT_NORMAL;
+ break;
+ case SCI_STYLESETWEIGHT:
+ vs.styles[wParam].weight = lParam;
break;
case SCI_STYLESETITALIC:
vs.styles[wParam].italic = lParam != 0;
@@ -6990,6 +6993,9 @@ void Editor::StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam
vs.styles[wParam].eolFilled = lParam != 0;
break;
case SCI_STYLESETSIZE:
+ vs.styles[wParam].size = lParam * SC_FONT_SIZE_MULTIPLIER;
+ break;
+ case SCI_STYLESETSIZEFRACTIONAL:
vs.styles[wParam].size = lParam;
break;
case SCI_STYLESETFONT:
@@ -7027,12 +7033,16 @@ sptr_t Editor::StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lPar
case SCI_STYLEGETBACK:
return vs.styles[wParam].back.desired.AsLong();
case SCI_STYLEGETBOLD:
- return vs.styles[wParam].bold ? 1 : 0;
+ return vs.styles[wParam].weight > SC_WEIGHT_NORMAL;
+ case SCI_STYLEGETWEIGHT:
+ return vs.styles[wParam].weight;
case SCI_STYLEGETITALIC:
return vs.styles[wParam].italic ? 1 : 0;
case SCI_STYLEGETEOLFILLED:
return vs.styles[wParam].eolFilled ? 1 : 0;
case SCI_STYLEGETSIZE:
+ return vs.styles[wParam].size / SC_FONT_SIZE_MULTIPLIER;
+ case SCI_STYLEGETSIZEFRACTIONAL:
return vs.styles[wParam].size;
case SCI_STYLEGETFONT:
if (!vs.styles[wParam].fontName)
@@ -8150,9 +8160,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_STYLESETFORE:
case SCI_STYLESETBACK:
case SCI_STYLESETBOLD:
+ case SCI_STYLESETWEIGHT:
case SCI_STYLESETITALIC:
case SCI_STYLESETEOLFILLED:
case SCI_STYLESETSIZE:
+ case SCI_STYLESETSIZEFRACTIONAL:
case SCI_STYLESETFONT:
case SCI_STYLESETUNDERLINE:
case SCI_STYLESETCASE:
@@ -8166,9 +8178,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_STYLEGETFORE:
case SCI_STYLEGETBACK:
case SCI_STYLEGETBOLD:
+ case SCI_STYLEGETWEIGHT:
case SCI_STYLEGETITALIC:
case SCI_STYLEGETEOLFILLED:
case SCI_STYLEGETSIZE:
+ case SCI_STYLEGETSIZEFRACTIONAL:
case SCI_STYLEGETFONT:
case SCI_STYLEGETUNDERLINE:
case SCI_STYLEGETCASE:
diff --git a/src/Style.cxx b/src/Style.cxx
index fc250f0bc..0a38cd6a5 100644
--- a/src/Style.cxx
+++ b/src/Style.cxx
@@ -33,7 +33,7 @@ void FontAlias::ClearFont() {
}
bool FontSpecification::EqualTo(const FontSpecification &other) const {
- return bold == other.bold &&
+ return weight == other.weight &&
italic == other.italic &&
size == other.size &&
characterSet == other.characterSet &&
@@ -56,18 +56,18 @@ void FontMeasurements::Clear() {
Style::Style() : FontSpecification() {
Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),
- Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT,
- false, false, false, false, caseMixed, true, true, false);
+ Platform::DefaultFontSize() * SC_FONT_SIZE_MULTIPLIER, 0, SC_CHARSET_DEFAULT,
+ SC_WEIGHT_NORMAL, false, false, false, caseMixed, true, true, false);
}
Style::Style(const Style &source) : FontSpecification(), FontMeasurements() {
Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),
0, 0, 0,
- false, false, false, false, caseMixed, true, true, false);
+ SC_WEIGHT_NORMAL, false, false, false, caseMixed, true, true, false);
fore.desired = source.fore.desired;
back.desired = source.back.desired;
characterSet = source.characterSet;
- bold = source.bold;
+ weight = source.weight;
italic = source.italic;
size = source.size;
eolFilled = source.eolFilled;
@@ -86,11 +86,11 @@ Style &Style::operator=(const Style &source) {
return * this;
Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),
0, 0, SC_CHARSET_DEFAULT,
- false, false, false, false, caseMixed, true, true, false);
+ SC_WEIGHT_NORMAL, false, false, false, caseMixed, true, true, false);
fore.desired = source.fore.desired;
back.desired = source.back.desired;
characterSet = source.characterSet;
- bold = source.bold;
+ weight = source.weight;
italic = source.italic;
size = source.size;
eolFilled = source.eolFilled;
@@ -103,13 +103,13 @@ Style &Style::operator=(const Style &source) {
void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_,
const char *fontName_, int characterSet_,
- bool bold_, bool italic_, bool eolFilled_,
+ int weight_, bool italic_, bool eolFilled_,
bool underline_, ecaseForced caseForce_,
bool visible_, bool changeable_, bool hotspot_) {
fore.desired = fore_;
back.desired = back_;
characterSet = characterSet_;
- bold = bold_;
+ weight = weight_;
italic = italic_;
size = size_;
fontName = fontName_;
@@ -130,7 +130,7 @@ void Style::ClearTo(const Style &source) {
source.size,
source.fontName,
source.characterSet,
- source.bold,
+ source.weight,
source.italic,
source.eolFilled,
source.underline,
diff --git a/src/Style.h b/src/Style.h
index 29122b0a4..0e706d322 100644
--- a/src/Style.h
+++ b/src/Style.h
@@ -14,16 +14,16 @@ namespace Scintilla {
struct FontSpecification {
const char *fontName;
- bool bold;
+ int weight;
bool italic;
int size;
int characterSet;
int extraFontFlag;
FontSpecification() :
fontName(0),
- bold(false),
+ weight(SC_WEIGHT_NORMAL),
italic(false),
- size(10),
+ size(10 * SC_FONT_SIZE_MULTIPLIER),
characterSet(0),
extraFontFlag(0) {
}
@@ -77,7 +77,7 @@ public:
void Clear(ColourDesired fore_, ColourDesired back_,
int size_,
const char *fontName_, int characterSet_,
- bool bold_, bool italic_, bool eolFilled_,
+ int weight_, bool italic_, bool eolFilled_,
bool underline_, ecaseForced caseForce_,
bool visible_, bool changeable_, bool hotspot_);
void ClearTo(const Style &source);
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 9ba69b1ce..b46cd9eb4 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -88,12 +88,12 @@ FontRealised::~FontRealised() {
void FontRealised::Realise(Surface &surface, int zoomLevel) {
PLATFORM_ASSERT(fontName);
- sizeZoomed = size + zoomLevel;
- if (sizeZoomed <= 2) // Hangs if sizeZoomed <= 1
- sizeZoomed = 2;
+ sizeZoomed = size + zoomLevel * SC_FONT_SIZE_MULTIPLIER;
+ if (sizeZoomed <= 2 * SC_FONT_SIZE_MULTIPLIER) // Hangs if sizeZoomed <= 1
+ sizeZoomed = 2 * SC_FONT_SIZE_MULTIPLIER;
int deviceHeight = surface.DeviceHeightFont(sizeZoomed);
- font.Create(fontName, characterSet, deviceHeight, bold, italic, extraFontFlag);
+ font.Create(fontName, characterSet, deviceHeight, weight, italic, extraFontFlag);
ascent = surface.Ascent(font);
descent = surface.Descent(font);
@@ -457,9 +457,9 @@ void ViewStyle::EnsureStyle(size_t index) {
void ViewStyle::ResetDefaultStyle() {
styles[STYLE_DEFAULT].Clear(ColourDesired(0,0,0),
ColourDesired(0xff,0xff,0xff),
- Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()),
+ Platform::DefaultFontSize() * SC_FONT_SIZE_MULTIPLIER, fontNames.Save(Platform::DefaultFont()),
SC_CHARSET_DEFAULT,
- false, false, false, false, Style::caseMixed, true, true, false);
+ SC_WEIGHT_NORMAL, false, false, false, Style::caseMixed, true, true, false);
}
void ViewStyle::ClearStyles() {