Fixed loading of undocumented symbols. Now we're making progress! And what's more, fvar support is working! But not perfectly — everything seems to be hitting extremes...
This commit is contained in:
parent
e0b584082d
commit
ad34745327
|
@ -44,6 +44,7 @@ list(APPEND _LIBUI_SOURCES
|
|||
darwin/stddialogs.m
|
||||
darwin/tab.m
|
||||
darwin/text.m
|
||||
darwin/undocumented.m
|
||||
darwin/util.m
|
||||
darwin/window.m
|
||||
darwin/winmoveresize.m
|
||||
|
|
|
@ -26,10 +26,6 @@
|
|||
// because the descriptors returned by Core Text's own font
|
||||
// matching won't have any.
|
||||
|
||||
// TODO explicitly mark these as undocumented
|
||||
extern const CFStringRef kCTFontPreferredSubFamilyNameKey;
|
||||
extern const CFStringRef kCTFontPreferredFamilyNameKey;
|
||||
|
||||
@implementation fontStyleData
|
||||
|
||||
- (id)initWithFont:(CTFontRef)f
|
||||
|
@ -246,7 +242,7 @@ extern const CFStringRef kCTFontPreferredFamilyNameKey;
|
|||
FONTNAME(preferredSubFamilyName,
|
||||
self->didPreferredSubFamilyName,
|
||||
self->preferredSubFamilyName,
|
||||
kCTFontPreferredSubFamilyNameKey)
|
||||
UNDOC_kCTFontPreferredSubFamilyNameKey)
|
||||
FONTNAME(subFamilyName,
|
||||
self->didSubFamilyName,
|
||||
self->subFamilyName,
|
||||
|
@ -258,7 +254,7 @@ FONTNAME(fullName,
|
|||
FONTNAME(preferredFamilyName,
|
||||
self->didPreferredFamilyName,
|
||||
self->preferredFamilyName,
|
||||
kCTFontPreferredFamilyNameKey)
|
||||
UNDOC_kCTFontPreferredFamilyNameKey)
|
||||
FONTNAME(familyName,
|
||||
self->didFamilyName,
|
||||
self->familyName,
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
// functions and constants FROM THE FUTURE!
|
||||
// note: for constants, dlsym() returns the address of the constant itself, as if we had done &constantName
|
||||
|
||||
// TODO add weight constants here?
|
||||
|
||||
// added in OS X 10.10; we need 10.8
|
||||
CFStringRef *FUTURE_kCTFontOpenTypeFeatureTag = NULL;
|
||||
CFStringRef *FUTURE_kCTFontOpenTypeFeatureValue = NULL;
|
||||
|
|
|
@ -120,6 +120,7 @@ const char *uiInit(uiInitOptions *o)
|
|||
|
||||
initAlloc();
|
||||
loadFutures();
|
||||
loadUndocumented();
|
||||
|
||||
// always do this so we always have an application menu
|
||||
appDelegate().menuManager = [[menuManager new] autorelease];
|
||||
|
|
|
@ -174,3 +174,8 @@ extern CFStringRef *FUTURE_kCTFontOpenTypeFeatureValue;
|
|||
extern void loadFutures(void);
|
||||
extern void FUTURE_NSLayoutConstraint_setIdentifier(NSLayoutConstraint *constraint, NSString *identifier);
|
||||
extern BOOL FUTURE_NSWindow_performWindowDragWithEvent(NSWindow *w, NSEvent *initialEvent);
|
||||
|
||||
// undocumented.m
|
||||
extern CFStringRef UNDOC_kCTFontPreferredSubFamilyNameKey;
|
||||
extern CFStringRef UNDOC_kCTFontPreferredFamilyNameKey;
|
||||
extern void loadUndocumented(void);
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
// 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
|
||||
CFStringRef UNDOC_kCTFontPreferredSubFamilyNameKey = CFSTR("CTFontPreferredSubFamilyName");
|
||||
CFStringRef UNDOC_kCTFontPreferredFamilyNameKey = CFSTR("CTFontPreferredFamilyName");
|
||||
|
||||
// note that we treat any error as "the symbols aren't there" (and don't care if dlclose() failed)
|
||||
void loadUndocumented(void)
|
||||
{
|
||||
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)
|
||||
UNDOC_kCTFontPreferredSubFamilyNameKey = *str;
|
||||
GET(str, kCTFontPreferredFamilyNameKey);
|
||||
if (str != NULL)
|
||||
UNDOC_kCTFontPreferredFamilyNameKey = *str;
|
||||
dlclose(handle);
|
||||
}
|
Loading…
Reference in New Issue