2017-11-03 20:55:43 -05:00
|
|
|
// 3 november 2017
|
|
|
|
#import "uipriv_darwin.h"
|
|
|
|
|
|
|
|
// functions and constants FROM THE DEPTHS BELOW!
|
|
|
|
// note: for constants, dlsym() returns the address of the constant itself, as if we had done &constantName
|
|
|
|
// we also provide default values just in case
|
|
|
|
|
|
|
|
// these values come from 10.12.6
|
2018-05-05 21:02:25 -05:00
|
|
|
CFStringRef uiprivUNDOC_kCTFontPreferredSubFamilyNameKey = CFSTR("CTFontPreferredSubFamilyName");
|
|
|
|
CFStringRef uiprivUNDOC_kCTFontPreferredFamilyNameKey = CFSTR("CTFontPreferredFamilyName");
|
2017-11-03 20:55:43 -05:00
|
|
|
|
|
|
|
// note that we treat any error as "the symbols aren't there" (and don't care if dlclose() failed)
|
2018-05-05 21:02:25 -05:00
|
|
|
void uiprivLoadUndocumented(void)
|
2017-11-03 20:55:43 -05:00
|
|
|
{
|
|
|
|
void *handle;
|
|
|
|
CFStringRef *str;
|
|
|
|
|
|
|
|
// dlsym() walks the dependency chain, so opening the current process should be sufficient
|
|
|
|
handle = dlopen(NULL, RTLD_LAZY);
|
|
|
|
if (handle == NULL)
|
|
|
|
return;
|
|
|
|
#define GET(var, fn) *((void **) (&var)) = dlsym(handle, #fn)
|
|
|
|
GET(str, kCTFontPreferredSubFamilyNameKey);
|
|
|
|
NSLog(@"get %p", str);
|
|
|
|
if (str != NULL)
|
2018-05-05 21:02:25 -05:00
|
|
|
uiprivUNDOC_kCTFontPreferredSubFamilyNameKey = *str;
|
2017-11-03 20:55:43 -05:00
|
|
|
GET(str, kCTFontPreferredFamilyNameKey);
|
|
|
|
if (str != NULL)
|
2018-05-05 21:02:25 -05:00
|
|
|
uiprivUNDOC_kCTFontPreferredFamilyNameKey = *str;
|
2017-11-03 20:55:43 -05:00
|
|
|
dlclose(handle);
|
|
|
|
}
|