diff options
| author | Alan Third | 2017-08-26 09:44:42 +0100 |
|---|---|---|
| committer | Alan Third | 2017-08-29 17:19:05 +0100 |
| commit | fdde98113c5d1c2d4eb5c25fa750c976d90f8555 (patch) | |
| tree | 5b3fe85fda709b328edb78eec1cf8b1a16882a09 | |
| parent | 1b0d72244d5df61d9fbe10808808b3c045a3382b (diff) | |
| download | emacs-fdde98113c5d1c2d4eb5c25fa750c976d90f8555.tar.gz emacs-fdde98113c5d1c2d4eb5c25fa750c976d90f8555.zip | |
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.
| -rw-r--r-- | src/macfont.h | 7 | ||||
| -rw-r--r-- | src/macfont.m | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/macfont.h b/src/macfont.h index 32899908be9..3a66d2d005a 100644 --- a/src/macfont.h +++ b/src/macfont.h | |||
| @@ -82,3 +82,10 @@ typedef const struct _EmacsScreenFont *ScreenFontRef; /* opaque */ | |||
| 82 | extern void mac_register_font_driver (struct frame *f); | 82 | extern void mac_register_font_driver (struct frame *f); |
| 83 | extern void *macfont_get_nsctfont (struct font *font); | 83 | extern void *macfont_get_nsctfont (struct font *font); |
| 84 | extern void macfont_update_antialias_threshold (void); | 84 | extern void macfont_update_antialias_threshold (void); |
| 85 | |||
| 86 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 | ||
| 87 | /* This is an undocumented function that is probably not available | ||
| 88 | pre-10.8. */ | ||
| 89 | extern void CGContextSetFontSmoothingStyle(CGContextRef, int) | ||
| 90 | __attribute__((weak_import)); | ||
| 91 | #endif | ||
diff --git a/src/macfont.m b/src/macfont.m index 59891353cd3..33c28f7349a 100644 --- a/src/macfont.m +++ b/src/macfont.m | |||
| @@ -2888,11 +2888,14 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 2888 | if (no_antialias_p) | 2888 | if (no_antialias_p) |
| 2889 | CGContextSetShouldAntialias (context, false); | 2889 | CGContextSetShouldAntialias (context, false); |
| 2890 | 2890 | ||
| 2891 | if (!NILP (ns_use_thin_smoothing)) | 2891 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 |
| 2892 | if (!NILP (ns_use_thin_smoothing) | ||
| 2893 | && CGContextSetFontSmoothingStyle != NULL) | ||
| 2892 | { | 2894 | { |
| 2893 | CGContextSetShouldSmoothFonts(context, YES); | 2895 | CGContextSetShouldSmoothFonts(context, YES); |
| 2894 | CGContextSetFontSmoothingStyle(context, 16); | 2896 | CGContextSetFontSmoothingStyle(context, 16); |
| 2895 | } | 2897 | } |
| 2898 | #endif | ||
| 2896 | 2899 | ||
| 2897 | CGContextSetTextMatrix (context, atfm); | 2900 | CGContextSetTextMatrix (context, atfm); |
| 2898 | CGContextSetTextPosition (context, text_position.x, text_position.y); | 2901 | CGContextSetTextPosition (context, text_position.x, text_position.y); |