diff options
| -rw-r--r-- | cocoa/PlatCocoa.mm | 3 | ||||
| -rw-r--r-- | cocoa/QuartzTextStyle.h | 12 | 
2 files changed, 14 insertions, 1 deletions
| diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index 5c1213d72..fc7d7c222 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -1604,10 +1604,11 @@ void ListBoxImpl::Create(Window& /*parent*/, int /*ctrlID*/, Scintilla::Point pt  void ListBoxImpl::SetFont(Font& font_)  { -  font.SetID(font_.GetID());    // NSCell setFont takes an NSFont* rather than a CTFontRef but they    // are the same thing toll-free bridged.    QuartzTextStyle* style = reinterpret_cast<QuartzTextStyle*>(font_.GetID()); +  font.Release(); +  font.SetID(new QuartzTextStyle(*style));    NSFont *pfont = (NSFont *)style->getFontRef();    [[colText dataCell] setFont: pfont];    CGFloat itemHeight = lround([pfont ascender] - [pfont descender]); diff --git a/cocoa/QuartzTextStyle.h b/cocoa/QuartzTextStyle.h index 51d03cf91..faffe7616 100644 --- a/cocoa/QuartzTextStyle.h +++ b/cocoa/QuartzTextStyle.h @@ -23,6 +23,18 @@ public:  		characterSet = 0;      } +    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) | 
