diff options
author | Neil <nyamatongwe@gmail.com> | 2024-08-15 19:02:46 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2024-08-15 19:02:46 +1000 |
commit | dcbc339899911e1a3a743de1c0c25d0c253dd39a (patch) | |
tree | 3d4fcd3405e7b4620476c36b0102031114bf65ad /cocoa/QuartzTextStyleAttribute.h | |
parent | 6f51f5975920272f5f691d690107d15291a335f2 (diff) | |
download | scintilla-mirror-dcbc339899911e1a3a743de1c0c25d0c253dd39a.tar.gz |
Add SCI_STYLESETSTRETCH to support condensed and expanded text styles.
Diffstat (limited to 'cocoa/QuartzTextStyleAttribute.h')
-rw-r--r-- | cocoa/QuartzTextStyleAttribute.h | 11 |
1 files changed, 9 insertions, 2 deletions
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); |