diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/AutoComplete.cxx | 4 | ||||
-rw-r--r-- | src/AutoComplete.h | 2 | ||||
-rw-r--r-- | src/CallTip.cxx | 8 | ||||
-rw-r--r-- | src/CallTip.h | 2 | ||||
-rw-r--r-- | src/Editor.cxx | 106 | ||||
-rw-r--r-- | src/Editor.h | 8 | ||||
-rw-r--r-- | src/FontQuality.h | 3 | ||||
-rw-r--r-- | src/PositionCache.cxx | 14 | ||||
-rw-r--r-- | src/PositionCache.h | 10 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 3 | ||||
-rw-r--r-- | src/Style.cxx | 20 | ||||
-rw-r--r-- | src/Style.h | 8 | ||||
-rw-r--r-- | src/ViewStyle.cxx | 22 | ||||
-rw-r--r-- | src/ViewStyle.h | 3 |
14 files changed, 138 insertions, 75 deletions
diff --git a/src/AutoComplete.cxx b/src/AutoComplete.cxx index f6a291fe9..2752ef0c9 100644 --- a/src/AutoComplete.cxx +++ b/src/AutoComplete.cxx @@ -50,11 +50,11 @@ bool AutoComplete::Active() const { void AutoComplete::Start(Window &parent, int ctrlID, int position, Point location, int startLen_, - int lineHeight, bool unicodeMode) { + int lineHeight, bool unicodeMode, int technology) { if (active) { Cancel(); } - lb->Create(parent, ctrlID, location, lineHeight, unicodeMode); + lb->Create(parent, ctrlID, location, lineHeight, unicodeMode, technology); lb->Clear(); active = true; startLen = startLen_; diff --git a/src/AutoComplete.h b/src/AutoComplete.h index f48cb0551..aefab120a 100644 --- a/src/AutoComplete.h +++ b/src/AutoComplete.h @@ -40,7 +40,7 @@ public: /// Display the auto completion list positioned to be near a character position void Start(Window &parent, int ctrlID, int position, Point location, - int startLen_, int lineHeight, bool unicodeMode); + int startLen_, int lineHeight, bool unicodeMode, int technology); /// The stop chars are characters which, when typed, cause the auto completion list to disappear void SetStopChars(const char *stopChars_); diff --git a/src/CallTip.cxx b/src/CallTip.cxx index cdc30fcbc..0e1e80cc1 100644 --- a/src/CallTip.cxx +++ b/src/CallTip.cxx @@ -255,14 +255,15 @@ void CallTip::MouseClick(Point pt) { PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn, const char *faceName, int size, - int codePage_, int characterSet, Window &wParent) { + int codePage_, int characterSet, + int technology, Window &wParent) { clickPlace = 0; delete []val; val = 0; val = new char[strlen(defn) + 1]; strcpy(val, defn); codePage = codePage_; - Surface *surfaceMeasure = Surface::Allocate(); + Surface *surfaceMeasure = Surface::Allocate(technology); if (!surfaceMeasure) return PRectangle(); surfaceMeasure->Init(wParent.GetID()); @@ -273,7 +274,8 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn, inCallTipMode = true; posStartCallTip = pos; int deviceHeight = surfaceMeasure->DeviceHeightFont(size); - font.Create(faceName, characterSet, deviceHeight, false, false); + FontParameters fp(faceName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, SC_WEIGHT_NORMAL, false, 0, technology, characterSet); + font.Create(fp); // Look for multiple lines in the text // Only support \n here - simply means container must avoid \r! int numLines = 1; diff --git a/src/CallTip.h b/src/CallTip.h index a9ba82eb8..e437f3309 100644 --- a/src/CallTip.h +++ b/src/CallTip.h @@ -62,7 +62,7 @@ public: /// Setup the calltip and return a rectangle of the area required. PRectangle CallTipStart(int pos, Point pt, const char *defn, const char *faceName, int size, int codePage_, - int characterSet, Window &wParent); + int characterSet, int technology, Window &wParent); void CallTipCancel(); diff --git a/src/Editor.cxx b/src/Editor.cxx index 2e4d724e5..507ae60a1 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -102,7 +102,8 @@ Editor::Editor() { ctrlID = 0; stylesValid = false; - + technology = SC_TECHNOLOGY_DEFAULT; + printMagnification = 0; printColourMode = SC_PRINT_NORMAL; printWrapState = eWrapWord; @@ -168,11 +169,11 @@ Editor::Editor() { additionalCaretsVisible = true; virtualSpaceOptions = SCVS_NONE; - pixmapLine = Surface::Allocate(); - pixmapSelMargin = Surface::Allocate(); - pixmapSelPattern = Surface::Allocate(); - pixmapIndentGuide = Surface::Allocate(); - pixmapIndentGuideHighlight = Surface::Allocate(); + pixmapLine = 0; + pixmapSelMargin = 0; + pixmapSelPattern = 0; + pixmapIndentGuide = 0; + pixmapIndentGuideHighlight = 0; targetStart = 0; targetEnd = 0; @@ -227,12 +228,7 @@ Editor::~Editor() { pdoc->RemoveWatcher(this, 0); pdoc->Release(); pdoc = 0; - DropGraphics(); - delete pixmapLine; - delete pixmapSelMargin; - delete pixmapSelPattern; - delete pixmapIndentGuide; - delete pixmapIndentGuideHighlight; + DropGraphics(true); } void Editor::Finalise() { @@ -240,17 +236,50 @@ void Editor::Finalise() { CancelModes(); } -void Editor::DropGraphics() { - pixmapLine->Release(); - pixmapSelMargin->Release(); - pixmapSelPattern->Release(); - pixmapIndentGuide->Release(); - pixmapIndentGuideHighlight->Release(); +void Editor::DropGraphics(bool freeObjects) { + if (freeObjects) { + delete pixmapLine; + pixmapLine = 0; + delete pixmapSelMargin; + pixmapSelMargin = 0; + delete pixmapSelPattern; + pixmapSelPattern = 0; + delete pixmapIndentGuide; + pixmapIndentGuide = 0; + delete pixmapIndentGuideHighlight; + pixmapIndentGuideHighlight = 0; + } else { + if (pixmapLine) + pixmapLine->Release(); + if (pixmapSelMargin) + pixmapSelMargin->Release(); + if (pixmapSelPattern) + pixmapSelPattern->Release(); + if (pixmapIndentGuide) + pixmapIndentGuide->Release(); + if (pixmapIndentGuideHighlight) + pixmapIndentGuideHighlight->Release(); + } +} + +void Editor::AllocateGraphics() { + if (!pixmapLine) + pixmapLine = Surface::Allocate(technology); + if (!pixmapSelMargin) + pixmapSelMargin = Surface::Allocate(technology); + if (!pixmapSelPattern) + pixmapSelPattern = Surface::Allocate(technology); + if (!pixmapIndentGuide) + pixmapIndentGuide = Surface::Allocate(technology); + if (!pixmapIndentGuideHighlight) + pixmapIndentGuideHighlight = Surface::Allocate(technology); } void Editor::InvalidateStyleData() { stylesValid = false; - DropGraphics(); + vs.technology = technology; + DropGraphics(false); + AllocateGraphics(); palette.Release(); llc.Invalidate(LineLayout::llInvalid); posCache.Clear(); @@ -2220,7 +2249,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou // Layout the line, determining the position of each character, // with an extra element at the end for the end of the line. int startseg = 0; // Start of the current segment, in char. number - int startsegx = 0; // Start of the current segment, in pixels + XYACCUMULATOR startsegx = 0; // Start of the current segment, in pixels ll->positions[0] = 0; unsigned int tabWidth = vstyle.spaceWidth * pdoc->tabInChars; bool lastSegItalics = false; @@ -2241,7 +2270,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou if (vstyle.styles[ll->styles[charInLine]].visible) { if (isControl) { if (ll->chars[charInLine] == '\t') { - ll->positions[charInLine + 1] = ((((startsegx + 2) / + ll->positions[charInLine + 1] = ((((static_cast<int>(startsegx) + 2) / tabWidth) + 1) * tabWidth) - startsegx; } else if (controlCharSymbol < 32) { if (ctrlCharWidth[ll->chars[charInLine]] == 0) { @@ -2906,8 +2935,10 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis // draw strings that are completely past the right side of the window. if ((rcSegment.left <= rcLine.right) && (rcSegment.right >= rcLine.left)) { // Clip to line rectangle, since may have a huge position which will not work with some platforms - rcSegment.left = Platform::Maximum(rcSegment.left, rcLine.left); - rcSegment.right = Platform::Minimum(rcSegment.right, rcLine.right); + if (rcSegment.left < rcLine.left) + rcSegment.left = rcLine.left; + if (rcSegment.right > rcLine.right) + rcSegment.right = rcLine.right; int styleMain = ll->styles[i]; const int inSelection = hideSelection ? 0 : sel.CharacterInSelection(iDoc); @@ -3383,7 +3414,7 @@ void Editor::DrawCarets(Surface *surface, ViewStyle &vsDraw, int lineDoc, int xS const int spaceWidth = static_cast<int>(vsDraw.styles[ll->EndLineStyle()].spaceWidth); const int virtualOffset = posCaret.VirtualSpace() * spaceWidth; if (ll->InLine(offset, subLine) && offset <= ll->numCharsBeforeEOL) { - int xposCaret = ll->positions[offset] + virtualOffset - ll->positions[ll->LineStart(subLine)]; + XYPOSITION xposCaret = ll->positions[offset] + virtualOffset - ll->positions[ll->LineStart(subLine)]; if (ll->wrapIndent != 0) { int lineStart = ll->LineStart(subLine); if (lineStart != 0) // Wrapped @@ -3928,7 +3959,7 @@ void Editor::SetScrollBars() { } void Editor::ChangeSize() { - DropGraphics(); + DropGraphics(false); SetScrollBars(); if (wrapState != eWrapNone) { PRectangle rcTextArea = GetClientRectangle(); @@ -6983,7 +7014,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; @@ -6992,6 +7026,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: @@ -7029,12 +7066,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) @@ -8146,9 +8187,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: @@ -8162,9 +8205,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: @@ -9203,6 +9248,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETIDENTIFIER: return GetCtrlID(); + case SCI_SETTECHNOLOGY: + // No action by default + break; + + case SCI_GETTECHNOLOGY: + return technology; + default: return DefWndProc(iMessage, wParam, lParam); } diff --git a/src/Editor.h b/src/Editor.h index cd5695c09..06b905961 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -131,6 +131,7 @@ protected: // ScintillaBase subclass needs access to much of Editor * When a style attribute is changed, this cache is flushed. */ bool stylesValid; ViewStyle vs; + int technology; Point sizeRGBAImage; Palette palette; @@ -280,7 +281,8 @@ protected: // ScintillaBase subclass needs access to much of Editor void InvalidateStyleRedraw(); virtual void RefreshColourPalette(Palette &pal, bool want); void RefreshStyleData(); - void DropGraphics(); + void DropGraphics(bool freeObjects); + void AllocateGraphics(); virtual PRectangle GetClientRectangle(); PRectangle GetTextRectangle(); @@ -575,7 +577,7 @@ private: public: AutoSurface(Editor *ed) : surf(0) { if (ed->wMain.GetID()) { - surf = Surface::Allocate(); + surf = Surface::Allocate(ed->technology); if (surf) { surf->Init(ed->wMain.GetID()); surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage()); @@ -585,7 +587,7 @@ public: } AutoSurface(SurfaceID sid, Editor *ed) : surf(0) { if (ed->wMain.GetID()) { - surf = Surface::Allocate(); + surf = Surface::Allocate(ed->technology); if (surf) { surf->Init(sid, ed->wMain.GetID()); surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage()); diff --git a/src/FontQuality.h b/src/FontQuality.h index 2c8d548a8..45600c35e 100644 --- a/src/FontQuality.h +++ b/src/FontQuality.h @@ -10,3 +10,6 @@ #define SC_EFF_QUALITY_NON_ANTIALIASED 1 #define SC_EFF_QUALITY_ANTIALIASED 2 #define SC_EFF_QUALITY_LCD_OPTIMIZED 3 + +#define SCWIN_TECH_GDI 0 +#define SCWIN_TECH_DIRECTWRITE 1 diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 2105c292f..614e6b8bf 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -86,7 +86,7 @@ void LineLayout::Resize(int maxLineLength_) { indicators = new char[maxLineLength_ + 1]; // Extra position allocated as sometimes the Windows // GetTextExtentExPoint API writes an extra element. - positions = new int[maxLineLength_ + 1 + 1]; + positions = new XYPOSITION[maxLineLength_ + 1 + 1]; maxLineLength = maxLineLength_; } } @@ -503,15 +503,15 @@ PositionCacheEntry::PositionCacheEntry() : } void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_, - unsigned int len_, int *positions_, unsigned int clock_) { + unsigned int len_, XYPOSITION *positions_, unsigned int clock_) { Clear(); styleNumber = styleNumber_; len = len_; clock = clock_; if (s_ && positions_) { - positions = new short[len + (len + 1) / 2]; + positions = new XYPOSITION[len + (len + 1) / 2]; for (unsigned int i=0; i<len; i++) { - positions[i] = static_cast<short>(positions_[i]); + positions[i] = static_cast<XYPOSITION>(positions_[i]); } memcpy(reinterpret_cast<char *>(positions + len), s_, len); } @@ -530,7 +530,7 @@ void PositionCacheEntry::Clear() { } bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_, - unsigned int len_, int *positions_) const { + unsigned int len_, XYPOSITION *positions_) const { if ((styleNumber == styleNumber_) && (len == len_) && (memcmp(reinterpret_cast<char *>(positions + len), s_, len)== 0)) { for (unsigned int i=0; i<len; i++) { @@ -595,7 +595,7 @@ void PositionCache::SetSize(size_t size_) { } void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber, - const char *s, unsigned int len, int *positions, Document *pdoc) { + const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc) { allClear = false; int probe = -1; @@ -621,7 +621,7 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned if (len > BreakFinder::lengthStartSubdivision) { // Break up into segments unsigned int startSegment = 0; - int xStartSegment = 0; + XYPOSITION xStartSegment = 0; while (startSegment < len) { unsigned int lenSegment = pdoc->SafeSegment(s + startSegment, len - startSegment, BreakFinder::lengthEachSubdivision); surface->MeasureWidths(vstyle.styles[styleNumber].font, s + startSegment, lenSegment, positions + startSegment); diff --git a/src/PositionCache.h b/src/PositionCache.h index c6076ea20..280446627 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -41,7 +41,7 @@ public: unsigned char *styles; int styleBitsSet; char *indicators; - int *positions; + XYPOSITION *positions; char bracePreviousStyles[2]; // Hotspot support @@ -103,13 +103,13 @@ class PositionCacheEntry { unsigned int styleNumber:8; unsigned int len:8; unsigned int clock:16; - short *positions; + XYPOSITION *positions; public: PositionCacheEntry(); ~PositionCacheEntry(); - void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_, unsigned int clock); + void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_, unsigned int clock); void Clear(); - bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_) const; + bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_) const; static int Hash(unsigned int styleNumber_, const char *s, unsigned int len); bool NewerThan(const PositionCacheEntry &other) const; void ResetClock(); @@ -155,7 +155,7 @@ public: void SetSize(size_t size_); size_t GetSize() const { return size; } void MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber, - const char *s, unsigned int len, int *positions, Document *pdoc); + const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc); }; inline bool IsSpaceOrTab(int ch) { diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index da6b03e0d..247f34c4e 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -222,7 +222,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { } } ac.Start(wMain, idAutoComplete, sel.MainCaret(), PointMainCaret(), - lenEntered, vs.lineHeight, IsUnicodeMode()); + lenEntered, vs.lineHeight, IsUnicodeMode(), technology); PRectangle rcClient = GetClientRectangle(); Point pt = LocationFromPosition(sel.MainCaret() - lenEntered); @@ -419,6 +419,7 @@ void ScintillaBase::CallTipShow(Point pt, const char *defn) { vs.styles[ctStyle].sizeZoomed, CodePage(), vs.styles[ctStyle].characterSet, + vs.technology, wMain); // If the call-tip window would be out of the client // space, adjust so it displays above the text. 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..08164f648 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -86,14 +86,15 @@ FontRealised::~FontRealised() { frNext = 0; } -void FontRealised::Realise(Surface &surface, int zoomLevel) { +void FontRealised::Realise(Surface &surface, int zoomLevel, int technology) { 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); + float deviceHeight = surface.DeviceHeightFont(sizeZoomed); + FontParameters fp(fontName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, weight, italic, extraFontFlag, technology, characterSet); + font.Create(fp); ascent = surface.Ascent(font); descent = surface.Descent(font); @@ -102,7 +103,7 @@ void FontRealised::Realise(Surface &surface, int zoomLevel) { aveCharWidth = surface.AverageCharWidth(font); spaceWidth = surface.WidthChar(font, ' '); if (frNext) { - frNext->Realise(surface, zoomLevel); + frNext->Realise(surface, zoomLevel, technology); } } @@ -239,6 +240,7 @@ void ViewStyle::Init(size_t stylesSize_) { indicators[2].under = false; indicators[2].fore = ColourDesired(0xff, 0, 0); + technology = SC_TECHNOLOGY_DEFAULT; lineHeight = 1; maxAscent = 1; maxDescent = 1; @@ -388,7 +390,7 @@ void ViewStyle::Refresh(Surface &surface) { CreateFont(styles[j]); } - frFirst->Realise(surface, zoomLevel); + frFirst->Realise(surface, zoomLevel, technology); for (unsigned int k=0; k<stylesSize; k++) { FontRealised *fr = frFirst->Find(styles[k]); @@ -457,9 +459,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() { diff --git a/src/ViewStyle.h b/src/ViewStyle.h index b038a9b54..b15b9163c 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -48,7 +48,7 @@ public: FontRealised *frNext; FontRealised(const FontSpecification &fs); virtual ~FontRealised(); - void Realise(Surface &surface, int zoomLevel); + void Realise(Surface &surface, int zoomLevel, int technology); FontRealised *Find(const FontSpecification &fs); void FindMaxAscentDescent(unsigned int &maxAscent, unsigned int &maxDescent); }; @@ -67,6 +67,7 @@ public: Style *styles; LineMarker markers[MARKER_MAX + 1]; Indicator indicators[INDIC_MAX + 1]; + int technology; int lineHeight; unsigned int maxAscent; unsigned int maxDescent; |