emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master fdde981 2/3: Fix cross macOS version building (bug#


From: Alan Third
Subject: [Emacs-diffs] master fdde981 2/3: Fix cross macOS version building (bug#28222)
Date: Tue, 29 Aug 2017 12:23:31 -0400 (EDT)

branch: master
commit fdde98113c5d1c2d4eb5c25fa750c976d90f8555
Author: Alan Third <address@hidden>
Commit: Alan Third <address@hidden>

    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.
---
 src/macfont.h | 7 +++++++
 src/macfont.m | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/macfont.h b/src/macfont.h
index 3289990..3a66d2d 100644
--- a/src/macfont.h
+++ b/src/macfont.h
@@ -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
diff --git a/src/macfont.m b/src/macfont.m
index 5989135..33c28f7 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,
       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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]