Use custom text bg color for HighSierra+

This commit is contained in:
Niklas Mischkulnig 2018-07-31 14:52:47 +02:00
parent ac52fc19f7
commit 4f9d5c47a0
1 changed files with 5 additions and 1 deletions

View File

@ -11,6 +11,8 @@ CFStringRef *uiprivFUTURE_kCTFontOpenTypeFeatureValue = NULL;
// added in OS X 10.12; we need 10.8
CFStringRef *uiprivFUTURE_kCTBackgroundColorAttributeName = NULL;
NSOperatingSystemVersion HIGH_SIERRA_VERSION = { .majorVersion = 10, .minorVersion = 13, .patchVersion = 0 };
// note that we treat any error as "the symbols aren't there" (and don't care if dlclose() failed)
void uiprivLoadFutures(void)
{
@ -23,7 +25,9 @@ void uiprivLoadFutures(void)
#define GET(var, fn) *((void **) (&var)) = dlsym(handle, #fn)
GET(uiprivFUTURE_kCTFontOpenTypeFeatureTag, kCTFontOpenTypeFeatureTag);
GET(uiprivFUTURE_kCTFontOpenTypeFeatureValue, kCTFontOpenTypeFeatureValue);
GET(uiprivFUTURE_kCTBackgroundColorAttributeName, kCTBackgroundColorAttributeName);
if (![NSProcessInfo.processInfo isOperatingSystemAtLeastVersion:HIGH_SIERRA_VERSION])
GET(uiprivFUTURE_kCTBackgroundColorAttributeName, kCTBackgroundColorAttributeName);
dlclose(handle);
}