From dcbc339899911e1a3a743de1c0c25d0c253dd39a Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 15 Aug 2024 19:02:46 +1000 Subject: Add SCI_STYLESETSTRETCH to support condensed and expanded text styles. --- cocoa/QuartzTextStyleAttribute.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'cocoa/QuartzTextStyleAttribute.h') 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); -- cgit v1.2.3