* bug#28222: [PATCH] Use thin font smoothing in macOS
@ 2017-08-24 11:20 Ben Bonfil
2017-08-25 2:44 ` Richard Stallman
2017-08-25 16:13 ` Alan Third
0 siblings, 2 replies; 10+ messages in thread
From: Ben Bonfil @ 2017-08-24 11:20 UTC (permalink / raw)
To: 28222
[-- Attachment #1.1: Type: text/plain, Size: 212 bytes --]
Hello,
Attached is a small patch that enables thin font smoothing on macOS, just
like in iTerm2.
It is toggled by a new variable called ns-use-thin-smoothing.
Tested only on macOS Sierra (10.12.6)
Thanks,
Ben
[-- Attachment #1.2: Type: text/html, Size: 347 bytes --]
[-- Attachment #2: 0001-Enable-thin-font-smoothing-in-macOS.patch --]
[-- Type: application/octet-stream, Size: 1644 bytes --]
From ba01cb956284193d41b9cf6b3a260385fa367039 Mon Sep 17 00:00:00 2001
From: Ben Bonfil <bonfil@gmail.com>
Date: Thu, 24 Aug 2017 12:59:50 +0200
Subject: [PATCH] Enable thin font smoothing in macOS
* src/nsterm.m (syms_of_nsterm): Define var ns-use-thin-smoothing.
* src/macfont.m (macfont_draw): Use font smoothing.
---
src/macfont.m | 5 +++++
src/nsterm.m | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/src/macfont.m b/src/macfont.m
index 19145f92c0..8a4d0fa481 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -2888,6 +2888,11 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
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 22f8efd6b9..ff3329d1ce 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -9133,6 +9133,10 @@ Convert an X font name (XLFD) to an NS font name.
"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.11.0 (Apple Git-81)
^ permalink raw reply related [flat|nested] 10+ messages in thread
* bug#28222: [PATCH] Use thin font smoothing in macOS
2017-08-24 11:20 bug#28222: [PATCH] Use thin font smoothing in macOS Ben Bonfil
@ 2017-08-25 2:44 ` Richard Stallman
2017-08-25 7:29 ` Alan Third
2017-08-25 16:13 ` Alan Third
1 sibling, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2017-08-25 2:44 UTC (permalink / raw)
To: Ben Bonfil; +Cc: 28222
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> Attached is a small patch that enables thin font smoothing on macOS, just
> like in iTerm2.
Does Emacs support this on GNU/Linux? Our motto is, "It runs best on
GNU/Linux".
--
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#28222: [PATCH] Use thin font smoothing in macOS
2017-08-25 2:44 ` Richard Stallman
@ 2017-08-25 7:29 ` Alan Third
2017-08-25 19:09 ` Richard Stallman
0 siblings, 1 reply; 10+ messages in thread
From: Alan Third @ 2017-08-25 7:29 UTC (permalink / raw)
To: Richard Stallman; +Cc: Ben Bonfil, 28222
On Thu, Aug 24, 2017 at 10:44:23PM -0400, Richard Stallman wrote:
> [[[ To any NSA and FBI agents reading my email: please consider ]]]
> [[[ whether defending the US Constitution against all enemies, ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
> > Attached is a small patch that enables thin font smoothing on macOS, just
> > like in iTerm2.
>
> Does Emacs support this on GNU/Linux? Our motto is, "It runs best on
> GNU/Linux".
This looks like it’s equivalent to changing freetype settings.
--
Alan Third
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#28222: [PATCH] Use thin font smoothing in macOS
2017-08-24 11:20 bug#28222: [PATCH] Use thin font smoothing in macOS Ben Bonfil
2017-08-25 2:44 ` Richard Stallman
@ 2017-08-25 16:13 ` Alan Third
2017-08-25 16:58 ` Ben Bonfil
1 sibling, 1 reply; 10+ messages in thread
From: Alan Third @ 2017-08-25 16:13 UTC (permalink / raw)
To: Ben Bonfil; +Cc: 28222
On Thu, Aug 24, 2017 at 01:20:26PM +0200, Ben Bonfil wrote:
> Attached is a small patch that enables thin font smoothing on macOS, just
> like in iTerm2.
> It is toggled by a new variable called ns-use-thin-smoothing.
>
> Tested only on macOS Sierra (10.12.6)
Hi, is there any reason this needs to be done within Emacs? As far as
I can tell you should be able to set thin anti‐aliasing without
needing a setting in Emacs.
--
Alan Third
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#28222: [PATCH] Use thin font smoothing in macOS
2017-08-25 16:13 ` Alan Third
@ 2017-08-25 16:58 ` Ben Bonfil
2017-08-25 20:02 ` Alan Third
0 siblings, 1 reply; 10+ messages in thread
From: Ben Bonfil @ 2017-08-25 16:58 UTC (permalink / raw)
To: Alan Third; +Cc: 28222
[-- Attachment #1: Type: text/plain, Size: 1308 bytes --]
Hi Alan,
Thanks for taking the time to look at this.
The way I see it, this is analogous to the existing ns-antialias-text flag,
which is another rendering preference that can be changed system-wide, yet
is available within Emacs.
I would say that the use of these options is sometimes beneficial, based on
one's choice of fonts.
For example, if you use a bitmap font in Emacs, you would likely disable
anti-aliasing, but you wouldn't necessarily do it system-wide.
(I don't really know how to turn on thin smoothing system-wide, but that's
not the main argument)
As for Dr. Stallman's question: fortunately this is not necessary in
GNU/Linux, but on macOS with a non-HiDPI display I personally find the
difference significant.
Ben
On Fri, Aug 25, 2017 at 6:13 PM, Alan Third <alan@idiocy.org> wrote:
> On Thu, Aug 24, 2017 at 01:20:26PM +0200, Ben Bonfil wrote:
> > Attached is a small patch that enables thin font smoothing on macOS, just
> > like in iTerm2.
> > It is toggled by a new variable called ns-use-thin-smoothing.
> >
> > Tested only on macOS Sierra (10.12.6)
>
> Hi, is there any reason this needs to be done within Emacs? As far as
> I can tell you should be able to set thin anti‐aliasing without
> needing a setting in Emacs.
> --
> Alan Third
>
[-- Attachment #2: Type: text/html, Size: 1854 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#28222: [PATCH] Use thin font smoothing in macOS
2017-08-25 7:29 ` Alan Third
@ 2017-08-25 19:09 ` Richard Stallman
0 siblings, 0 replies; 10+ messages in thread
From: Richard Stallman @ 2017-08-25 19:09 UTC (permalink / raw)
To: Alan Third; +Cc: bonfil, 28222
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> > Does Emacs support this on GNU/Linux? Our motto is, "It runs best on
> > GNU/Linux".
> This looks like it’s equivalent to changing freetype settings.
That is reassuring.
--
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#28222: [PATCH] Use thin font smoothing in macOS
2017-08-25 16:58 ` Ben Bonfil
@ 2017-08-25 20:02 ` Alan Third
2017-08-26 7:27 ` Eli Zaretskii
2017-08-29 10:09 ` Ben Bonfil
0 siblings, 2 replies; 10+ messages in thread
From: Alan Third @ 2017-08-25 20:02 UTC (permalink / raw)
To: Ben Bonfil; +Cc: 28222
On Fri, Aug 25, 2017 at 06:58:51PM +0200, Ben Bonfil wrote:
> The way I see it, this is analogous to the existing ns-antialias-text flag,
> which is another rendering preference that can be changed system-wide, yet
> is available within Emacs.
> I would say that the use of these options is sometimes beneficial, based on
> one's choice of fonts.
> For example, if you use a bitmap font in Emacs, you would likely disable
> anti-aliasing, but you wouldn't necessarily do it system-wide.
>
> (I don't really know how to turn on thin smoothing system-wide, but that's
> not the main argument)
After a deal of messing about I’ve found that while you can set
‘smoothing’ options system wide, they seem to be slightly different
from what we’re looking at here.
Have you submitted code to Emacs before?
Can someone advise: I’ve added a few bits and pieces of boilerplate to
make this patch build on all supported macOS versions, but it’s
pushing it up to 15 lines. Is that going to be a problem?
--
Alan Third
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#28222: [PATCH] Use thin font smoothing in macOS
2017-08-25 20:02 ` Alan Third
@ 2017-08-26 7:27 ` Eli Zaretskii
2017-08-29 10:09 ` Ben Bonfil
1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2017-08-26 7:27 UTC (permalink / raw)
To: Alan Third; +Cc: bonfil, 28222
> Date: Fri, 25 Aug 2017 21:02:22 +0100
> From: Alan Third <alan@idiocy.org>
> Cc: 28222@debbugs.gnu.org
>
> Can someone advise: I’ve added a few bits and pieces of boilerplate to
> make this patch build on all supported macOS versions, but it’s
> pushing it up to 15 lines. Is that going to be a problem?
The original patch is small enough to not require paperwork. You can
push that one alone in author's name, then follow it by your own
changes to improve it.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#28222: [PATCH] Use thin font smoothing in macOS
2017-08-25 20:02 ` Alan Third
2017-08-26 7:27 ` Eli Zaretskii
@ 2017-08-29 10:09 ` Ben Bonfil
2017-08-29 16:27 ` Alan Third
1 sibling, 1 reply; 10+ messages in thread
From: Ben Bonfil @ 2017-08-29 10:09 UTC (permalink / raw)
To: Alan Third; +Cc: 28222
[-- Attachment #1: Type: text/plain, Size: 1321 bytes --]
> Have you submitted code to Emacs before?
I haven't, but I don't mind signing the relevant documents, if you conclude
that it is necessary.
On Fri, Aug 25, 2017 at 10:02 PM, Alan Third <alan@idiocy.org> wrote:
> On Fri, Aug 25, 2017 at 06:58:51PM +0200, Ben Bonfil wrote:
> > The way I see it, this is analogous to the existing ns-antialias-text
> flag,
> > which is another rendering preference that can be changed system-wide,
> yet
> > is available within Emacs.
> > I would say that the use of these options is sometimes beneficial, based
> on
> > one's choice of fonts.
> > For example, if you use a bitmap font in Emacs, you would likely disable
> > anti-aliasing, but you wouldn't necessarily do it system-wide.
> >
> > (I don't really know how to turn on thin smoothing system-wide, but
> that's
> > not the main argument)
>
> After a deal of messing about I’ve found that while you can set
> ‘smoothing’ options system wide, they seem to be slightly different
> from what we’re looking at here.
>
> Have you submitted code to Emacs before?
>
> Can someone advise: I’ve added a few bits and pieces of boilerplate to
> make this patch build on all supported macOS versions, but it’s
> pushing it up to 15 lines. Is that going to be a problem?
> --
> Alan Third
>
[-- Attachment #2: Type: text/html, Size: 1795 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#28222: [PATCH] Use thin font smoothing in macOS
2017-08-29 10:09 ` Ben Bonfil
@ 2017-08-29 16:27 ` Alan Third
0 siblings, 0 replies; 10+ messages in thread
From: Alan Third @ 2017-08-29 16:27 UTC (permalink / raw)
To: Ben Bonfil; +Cc: 28222-done
On Tue, Aug 29, 2017 at 12:09:11PM +0200, Ben Bonfil wrote:
> > Have you submitted code to Emacs before?
>
> I haven't, but I don't mind signing the relevant documents, if you conclude
> that it is necessary.
No, that’s fine. Small patches don’t require copyright assignment, but
if your total contributions go over about 15 lines then it is
required. I just wanted to double check you weren’t going over that
limit.
If you think you’ll be contributing any more to Emacs it’s probably
worth your while getting started with the assignment process, though.
Anyway, I’ve pushed the change to master. Thanks.
--
Alan Third
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-08-29 16:27 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-24 11:20 bug#28222: [PATCH] Use thin font smoothing in macOS Ben Bonfil
2017-08-25 2:44 ` Richard Stallman
2017-08-25 7:29 ` Alan Third
2017-08-25 19:09 ` Richard Stallman
2017-08-25 16:13 ` Alan Third
2017-08-25 16:58 ` Ben Bonfil
2017-08-25 20:02 ` Alan Third
2017-08-26 7:27 ` Eli Zaretskii
2017-08-29 10:09 ` Ben Bonfil
2017-08-29 16:27 ` Alan Third
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.