aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2024-08-15 19:02:46 +1000
committerNeil <nyamatongwe@gmail.com>2024-08-15 19:02:46 +1000
commitdcbc339899911e1a3a743de1c0c25d0c253dd39a (patch)
tree3d4fcd3405e7b4620476c36b0102031114bf65ad /cocoa
parent6f51f5975920272f5f691d690107d15291a335f2 (diff)
downloadscintilla-mirror-dcbc339899911e1a3a743de1c0c25d0c253dd39a.tar.gz
Add SCI_STYLESETSTRETCH to support condensed and expanded text styles.
Diffstat (limited to 'cocoa')
-rw-r--r--cocoa/PlatCocoa.mm2
-rw-r--r--cocoa/QuartzTextStyleAttribute.h11
2 files changed, 10 insertions, 3 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 6eb12f4ad..4753f6a5f 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -106,7 +106,7 @@ public:
FontQuartz(const FontParameters &fp) {
style = std::make_unique<QuartzTextStyle>();
// Create the font with attributes
- QuartzFont font(fp.faceName, strlen(fp.faceName), fp.size, fp.weight, fp.italic);
+ QuartzFont font(fp.faceName, strlen(fp.faceName), fp.size, fp.weight, fp.stretch, fp.italic);
CTFontRef fontRef = font.getFontID();
style->setFontRef(fontRef, fp.characterSet);
}
diff --git a/cocoa/QuartzTextStyleAttribute.h b/cocoa/QuartzTextStyleAttribute.h
index d9c0e5a15..22af29b4a 100644
--- a/cocoa/QuartzTextStyleAttribute.h
+++ b/cocoa/QuartzTextStyleAttribute.h
@@ -15,14 +15,14 @@
class QuartzFont {
public:
/** Create a font style from a name. */
- QuartzFont(const char *name, size_t length, float size, Scintilla::FontWeight weight, bool italic) {
+ QuartzFont(const char *name, size_t length, float size, Scintilla::FontWeight weight, Scintilla::FontStretch stretch, bool italic) {
assert(name != NULL && length > 0 && name[length] == '\0');
CFStringRef fontName = CFStringCreateWithCString(kCFAllocatorDefault, name, kCFStringEncodingMacRoman);
assert(fontName != NULL);
bool bold = weight > Scintilla::FontWeight::Normal;
- if (bold || italic) {
+ if (bold || italic || stretch != Scintilla::FontStretch::Normal) {
CTFontSymbolicTraits desiredTrait = 0;
CTFontSymbolicTraits traitMask = 0;
@@ -37,6 +37,13 @@ public:
desiredTrait |= kCTFontItalicTrait;
traitMask |= kCTFontItalicTrait;
}
+ if (stretch < Scintilla::FontStretch::Normal) {
+ desiredTrait |= kCTFontCondensedTrait;
+ traitMask |= kCTFontCondensedTrait;
+ } else if (stretch > Scintilla::FontStretch::Normal) {
+ desiredTrait |= kCTFontExpandedTrait;
+ traitMask |= kCTFontExpandedTrait;
+ }
// create a font and then a copy of it with the sym traits
CTFontRef iFont = ::CTFontCreateWithName(fontName, size, NULL);