From 1b0d72244d5df61d9fbe10808808b3c045a3382b Mon Sep 17 00:00:00 2001 From: Ben Bonfil Date: Sat, 26 Aug 2017 09:41:41 +0100 Subject: [PATCH] Enable thin font smoothing in macOS (bug#28222) * src/nsterm.m (syms_of_nsterm): Define var ns-use-thin-smoothing. * src/macfont.m (macfont_draw): Use font smoothing. Copyright-paperwork-exempt: yes --- src/macfont.m | 6 ++++++ src/nsterm.m | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/macfont.m b/src/macfont.m index 19145f92c0a..59891353cd3 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -2888,6 +2888,12 @@ 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)) + { + CGContextSetShouldSmoothFonts(context, YES); + CGContextSetFontSmoothingStyle(context, 16); + } + CGContextSetTextMatrix (context, atfm); CGContextSetTextPosition (context, text_position.x, text_position.y); diff --git a/src/nsterm.m b/src/nsterm.m index 22f8efd6b96..ff3329d1cee 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -9133,6 +9133,10 @@ allowing it to be used at a lower level for accented character entry."); "Non-nil (the default) means to render text antialiased."); ns_antialias_text = Qt; + DEFVAR_LISP ("ns-use-thin-smoothing", ns_use_thin_smoothing, + "Non-nil turns on a font smoothing method that produces thinner strokes."); + ns_use_thin_smoothing = Qnil; + DEFVAR_LISP ("ns-confirm-quit", ns_confirm_quit, "Whether to confirm application quit using dialog."); ns_confirm_quit = Qnil; -- 2.39.2