mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-31 01:34:58 +02:00
Update with https://www.scintilla.org/scintilla521.zip https://www.scintilla.org/lexilla515.zip - fix setting to bring Scintilla::PositionCR from ScintillaStructures.h inline with Sci_Position.h Sci_PositionCR - add workaround to enable lexer for searchResult commented out SCI_SETILEXER call on searchResult to get one result which is correctly handled by the lexer, added comment about the current problem with property @MarkingsStruct which seems to disappear after call to SCI_SETILEXER or CreateLexer - corrected usage of ObjC lexer - removed unnecessary filter stuff - use own sections for scintilla and lexilla build targets and allow parallel builds - as libscilex is no longer existing, changed to libscintilla - adapt makefiles and cmake - use VS2019 - started simple changes for createlexer adaptations, nullpointercheck missing on return of lexer name from deprecated LexerNameFromID -> undefined behaviour - movement from id -> lexer name, mostly done via LexerNameFromID + switching off corresponding compiler warning - changed to SCI_SETILEXER from SCI_SETLEXER, SCI_SETLEXERLANGUAGE needs to be corrected, see Scintilla5Migration.html - just commented out: SCI_LOADLEXERLIBRARY Fix #10504, close #11419
96 lines
2.2 KiB
C++
96 lines
2.2 KiB
C++
/*
|
|
* QuartzTextStyle.h
|
|
*
|
|
* Created by Evan Jones on Wed Oct 02 2002.
|
|
*
|
|
*/
|
|
|
|
#ifndef QUARTZTEXTSTYLE_H
|
|
#define QUARTZTEXTSTYLE_H
|
|
|
|
#include "QuartzTextStyleAttribute.h"
|
|
|
|
class QuartzTextStyle {
|
|
public:
|
|
QuartzTextStyle() {
|
|
fontRef = NULL;
|
|
styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,
|
|
&kCFTypeDictionaryKeyCallBacks,
|
|
&kCFTypeDictionaryValueCallBacks);
|
|
|
|
characterSet = Scintilla::CharacterSet::Ansi;
|
|
}
|
|
|
|
QuartzTextStyle(const QuartzTextStyle *other) {
|
|
// Does not copy font colour attribute
|
|
fontRef = static_cast<CTFontRef>(CFRetain(other->fontRef));
|
|
styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,
|
|
&kCFTypeDictionaryKeyCallBacks,
|
|
&kCFTypeDictionaryValueCallBacks);
|
|
CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef);
|
|
characterSet = other->characterSet;
|
|
}
|
|
|
|
~QuartzTextStyle() {
|
|
if (styleDict != NULL) {
|
|
CFRelease(styleDict);
|
|
styleDict = NULL;
|
|
}
|
|
|
|
if (fontRef) {
|
|
CFRelease(fontRef);
|
|
fontRef = NULL;
|
|
}
|
|
}
|
|
|
|
CFMutableDictionaryRef getCTStyle() const {
|
|
return styleDict;
|
|
}
|
|
|
|
void setCTStyleColour(CGColor *inColour) {
|
|
CFDictionarySetValue(styleDict, kCTForegroundColorAttributeName, inColour);
|
|
}
|
|
|
|
float getAscent() const {
|
|
return static_cast<float>(::CTFontGetAscent(fontRef));
|
|
}
|
|
|
|
float getDescent() const {
|
|
return static_cast<float>(::CTFontGetDescent(fontRef));
|
|
}
|
|
|
|
float getLeading() const {
|
|
return static_cast<float>(::CTFontGetLeading(fontRef));
|
|
}
|
|
|
|
void setFontRef(CTFontRef inRef, Scintilla::CharacterSet characterSet_) {
|
|
fontRef = inRef;
|
|
characterSet = characterSet_;
|
|
|
|
if (styleDict != NULL)
|
|
CFRelease(styleDict);
|
|
|
|
styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,
|
|
&kCFTypeDictionaryKeyCallBacks,
|
|
&kCFTypeDictionaryValueCallBacks);
|
|
|
|
CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef);
|
|
}
|
|
|
|
CTFontRef getFontRef() const noexcept {
|
|
return fontRef;
|
|
}
|
|
|
|
Scintilla::CharacterSet getCharacterSet() const noexcept {
|
|
return characterSet;
|
|
}
|
|
|
|
private:
|
|
CFMutableDictionaryRef styleDict;
|
|
CTFontRef fontRef;
|
|
Scintilla::CharacterSet characterSet;
|
|
};
|
|
|
|
#endif
|
|
|