Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 14d8904

Browse files
committed
Merge pull request #4617 from mdehoon/fixForIssue4609
Fix: text background color on OSX + py3k
2 parents 8befb06 + 4da7ab5 commit 14d8904

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/_macosx.m

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2648,7 +2648,6 @@ static CGFloat _get_device_scale(CGContextRef cr)
26482648
const char* italic;
26492649
float angle;
26502650
CTFontRef font;
2651-
CGColorRef color;
26522651
CGFloat descent;
26532652
#if PY33
26542653
const char* text;
@@ -2697,22 +2696,16 @@ static CGFloat _get_device_scale(CGContextRef cr)
26972696
return NULL;
26982697
}
26992698

2700-
color = CGColorCreateGenericRGB(self->color[0],
2701-
self->color[1],
2702-
self->color[2],
2703-
self->color[3]);
2704-
27052699
keys[0] = kCTFontAttributeName;
2706-
keys[1] = kCTForegroundColorAttributeName;
2700+
keys[1] = kCTForegroundColorFromContextAttributeName;
27072701
values[0] = font;
2708-
values[1] = color;
2702+
values[1] = kCFBooleanTrue;
27092703
CFDictionaryRef attributes = CFDictionaryCreate(kCFAllocatorDefault,
27102704
(const void**)&keys,
27112705
(const void**)&values,
27122706
2,
27132707
&kCFTypeDictionaryKeyCallBacks,
27142708
&kCFTypeDictionaryValueCallBacks);
2715-
CGColorRelease(color);
27162709
CFRelease(font);
27172710

27182711
CFAttributedStringRef string = CFAttributedStringCreate(kCFAllocatorDefault,

0 commit comments

Comments
 (0)