diff options
Diffstat (limited to 'cocoa')
-rw-r--r-- | cocoa/PlatCocoa.mm | 2 | ||||
-rw-r--r-- | cocoa/QuartzTextStyleAttribute.h | 11 |
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); |