Fix cross macOS version building (bug#28222)

* src/macfont.h (CGContextSetFontSmoothingStyle): Function
declaration.
* src/macfont.m (macfont_draw): Limit new code to macOS 10.8 and up.
This commit is contained in:
Alan Third 2017-08-26 09:44:42 +01:00
parent 1b0d72244d
commit fdde98113c
2 changed files with 11 additions and 1 deletions

View file

@ -82,3 +82,10 @@ typedef const struct _EmacsScreenFont *ScreenFontRef; /* opaque */
extern void mac_register_font_driver (struct frame *f);
extern void *macfont_get_nsctfont (struct font *font);
extern void macfont_update_antialias_threshold (void);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
/* This is an undocumented function that is probably not available
pre-10.8. */
extern void CGContextSetFontSmoothingStyle(CGContextRef, int)
__attribute__((weak_import));
#endif

View file

@ -2888,11 +2888,14 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
if (no_antialias_p)
CGContextSetShouldAntialias (context, false);
if (!NILP (ns_use_thin_smoothing))
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
if (!NILP (ns_use_thin_smoothing)
&& CGContextSetFontSmoothingStyle != NULL)
{
CGContextSetShouldSmoothFonts(context, YES);
CGContextSetFontSmoothingStyle(context, 16);
}
#endif
CGContextSetTextMatrix (context, atfm);
CGContextSetTextPosition (context, text_position.x, text_position.y);