GNU bug report logs - #4736
23.1; ns-antialias-text set to nil has no effect

Previous Next

Packages: ns, emacs;

Reported by: John Whitley <whitley <at> acm.org>

Date: Fri, 16 Oct 2009 04:05:05 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 4736 in the body.
You can then email your comments to 4736 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4736; Package emacs. (Fri, 16 Oct 2009 04:05:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to John Whitley <whitley <at> acm.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 16 Oct 2009 04:05:06 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: John Whitley <whitley <at> acm.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1; ns-antialias-text set to nil has no effect
Date: Thu, 15 Oct 2009 20:59:19 -0700
Repro steps:
1) set ns-antialias-text to nil (via the usual means: setq, set- 
variable, customize, etc.)

Expected results:
Text is no longer antialiased.

Actual results:
Text remains antialiased no matter the setting of ns-antialias-text.


In GNU Emacs 23.1.1 (i386-apple-darwin10.0.0, NS apple-appkit-1038.11)
of 2009-10-11 on kuroneko.local
Windowing system distributor `Apple', version 10.3.1038
configured using `configure  '--prefix=/opt/local' '--with-ns' '-- 
without-x' 'CC=/usr/bin/gcc-4.2' 'CFLAGS=-O2 -arch x86_64' 'LDFLAGS=-L/ 
opt/local/lib' 'CPPFLAGS=-I/opt/local/include''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  delete-selection-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<wheel-down> <double-wheel-down> <triple-wheel-down>
<triple-wheel-down> <triple-wheel-up> <triple-wheel-up>
<triple-wheel-up> <triple-wheel-down> <triple-wheel-down>
<wheel-down> <double-wheel-down> <triple-wheel-down>
<triple-wheel-up> <triple-wheel-down> <triple-wheel-down>
<triple-wheel-down> <triple-wheel-up> <triple-wheel-up>
<triple-wheel-up> <triple-wheel-up> <triple-wheel-up>
<triple-wheel-down> <triple-wheel-down> <triple-wheel-down>
<triple-wheel-down> <down-mouse-1> <mouse-movement>
<mouse-movement> <drag-mouse-1> <down-mouse-1> <mouse-1>
<menu-bar> <help-menu> <send-emacs-bug-report>

Recent messages:
Ido mode enabled
Loading grep...done
For information about GNU Emacs and the GNU system, type C-h C-a.
byte-code: End of buffer [4 times]
byte-code: Beginning of buffer [3 times]
byte-code: End of buffer [5 times]
byte-code: Beginning of buffer
byte-code: End of buffer [3 times]
byte-code: Beginning of buffer [5 times]
byte-code: End of buffer [3 times]
byte-code: End of buffer




bug reassigned from package 'emacs' to 'emacs,ns'. Request was from Juanma Barranquero <lekktu <at> gmail.com> to control <at> emacsbugs.donarmstrong.com. (Fri, 16 Oct 2009 07:30:05 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, owner <at> emacsbugs.donarmstrong.com:
bug#4736; Package emacs,ns. (Sat, 17 Oct 2009 12:25:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Adrian Robert <adrian.b.robert <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, owner <at> emacsbugs.donarmstrong.com. (Sat, 17 Oct 2009 12:25:05 GMT) Full text and rfc822 format available.

Message #12 received at 4736 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Adrian Robert <adrian.b.robert <at> gmail.com>
To: 4736 <at> debbugs.gnu.org
Cc: John Whitley <whitley <at> acm.org>
Subject: Re: 23.1; ns-antialias-text set to nil has no effect
Date: Sat, 17 Oct 2009 08:16:24 -0400
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4736

I cannot reproduce this.  You must make a new frame or otherwise  
trigger full redrawing, but it works here.  Please experiment a  
little, and if you can narrow down the conditions that cause failure,  
please report back.




Added tag(s) unreproducible and moreinfo. Request was from Juanma Barranquero <lekktu <at> gmail.com> to control <at> emacsbugs.donarmstrong.com. (Thu, 22 Oct 2009 09:40:13 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4736; Package emacs,ns. (Fri, 08 Jan 2010 15:24:02 GMT) Full text and rfc822 format available.

Message #17 received at 4736 <at> debbugs.gnu.org (full text, mbox):

From: John Whitley <whitley <at> acm.org>
To: 4736 <at> debbugs.gnu.org
Subject: Re: 23.1; ns-antialias-text set to nil has no effect 
Date: Fri, 8 Jan 2010 07:18:38 -0800
Apologies for the immensely delayed response.  I still and have always had this problem since the initial report.

Repro steps:
1) Build Emacs bzr trunk (I used revno 99272), configured with: ./configure --with-ns --enable-ns-self-contained
2) Ensure that no emacs init files are in the current working environment.
3) 'open nextstep/Emacs.app'
4) M-X set-variable ns-antialias-text nil <RET>
5) Open a new frame

Expected results:
New frame opens with non-antialiased text.

Actual results:
Text is always antialiased regardless of the value of ns-antialias-text.

General notes:
My ultimate goal is to set ns-antialias-text in .emacs and have it take effect on the initial frame.

System notes:
MacOS X: 10.6.2 (Snow Leopard)
GCC: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) (dot 1)
XCode version: 3.2.1





Removed tag(s) unreproducible moreinfo. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 27 Jan 2010 22:45:02 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4736; Package emacs,ns. (Sun, 14 Feb 2010 14:14:01 GMT) Full text and rfc822 format available.

Message #22 received at 4736 <at> debbugs.gnu.org (full text, mbox):

From: Francis Devereux <francis <at> devrx.org>
To: Adrian Robert <adrian.b.robert <at> gmail.com>
Cc: John Whitley <whitley <at> acm.org>, 4736 <at> debbugs.gnu.org,
	emacs-devel <at> gnu.org
Subject: Re: 23.1; ns-antialias-text set to nil has no effect
Date: Sun, 14 Feb 2010 13:31:19 +0000
On 17 Oct 2009, at 13:16, Adrian Robert wrote:

> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4736
> 
> I cannot reproduce this.  You must make a new frame or otherwise trigger full redrawing, but it works here.  Please experiment a little, and if you can narrow down the conditions that cause failure, please report back.


I can reproduce this.  If I build Emacs on Mac OS X 10.6 then ns-antialias-text has no effect - text is always anti-aliased (as John reports).  However, if I build Emacs on OS X 10.5 and then copy Emacs.app to my 10.6 machine, then setting ns-antialias-text to nil works as expected (i.e. it disables anti aliasing).

John, are you using 10.5 or 10.6?

I've also discovered that if I build Emacs as a 32 bit binary on 10.6 (the default is 64 bit on 10.6) with the following command then ns-antialias-text works.  The commands I used to build are:
LDFLAGS="-arch i386" CFLAGS="-g -O2 -arch i386 -march=core2" ../trunk/configure --build=i386-apple-darwin10.2.0 --with-ns && make -j2 && make install

I added some logging and built in 64 bit mode.  The output is interesting, it looks like the test ns_antialias_text == Qnil is returning false because ns_antialias_text is corrupt.  I'm not really sure what is happening though - I have next to no knowledge of Emacs internals.

Changes:
--- src/nsfont.m	2010-02-08 23:39:01 +0000
+++ src/nsfont.m	2010-02-14 09:07:25 +0000
@@ -1232,9 +1232,17 @@
     CGContextSetFont (gcontext, font->cgfont);
     CGContextSetFontSize (gcontext, font->size);
     if (ns_antialias_text == Qnil || font->size <= ns_antialias_threshold)
+    {
       CGContextSetShouldAntialias (gcontext, 0);
+      fprintf (stderr, "*** Disabled anti aliasing\n");
+      safe_debug_print (ns_antialias_text);
+    }
     else
+    {
       CGContextSetShouldAntialias (gcontext, 1);
+      fprintf (stderr, "*** Enabled anti aliasing, BITS_PER_EMACS_INT=%d\n", BITS_PER_EMACS_INT);
+      safe_debug_print (ns_antialias_text);
+    }
 
     CGContextSetTextMatrix (gcontext, fliptf);

Output from 64-bit Emacs (the following is repeated many times):
*** Enabled anti aliasing, BITS_PER_EMACS_INT=64
#<INVALID_LISP_OBJECT 0x0180006a>

Francis





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4736; Package emacs,ns. (Sun, 14 Feb 2010 15:39:02 GMT) Full text and rfc822 format available.

Message #25 received at 4736 <at> debbugs.gnu.org (full text, mbox):

From: David Reitter <david.reitter <at> gmail.com>
To: Francis Devereux <francis <at> devrx.org>
Cc: Adrian Robert <adrian.b.robert <at> gmail.com>, 4736 <at> debbugs.gnu.org,
	John Whitley <whitley <at> acm.org>, emacs-devel <at> gnu.org
Subject: Re: 23.1; ns-antialias-text set to nil has no effect
Date: Sun, 14 Feb 2010 10:38:38 -0500
[Message part 1 (text/plain, inline)]
On Feb 14, 2010, at 8:31 AM, Francis Devereux wrote:

> On 17 Oct 2009, at 13:16, Adrian Robert wrote:
> 
>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4736
> 
> I've also discovered that if I build Emacs as a 32 bit binary on 10.6 (the default is 64 bit on 10.6) with the following command then ns-antialias-text works.  The commands I used to build are:
> LDFLAGS="-arch i386" CFLAGS="-g -O2 -arch i386 -march=core2" ../trunk/configure --build=i386-apple-darwin10.2.0 --with-ns && make -j2 && make install


ns_antialias_text is wrongly declared as an int instead of Lisp_Object, and the nonstandard pointer comparison to Qnil helped cover it up, I suppose.  That also explains why it happened to work on 32bit.   Try the patch below.



diff --git a/src/nsfont.m b/src/nsfont.m
index 934fefa..1b157ce 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -50,7 +50,7 @@ extern Lisp_Object Qnormal, Qbold, Qitalic, Qcondensed, Qexpanded;
 static Lisp_Object Vns_reg_to_script;
 static Lisp_Object Qapple, Qroman, Qmedium;
 extern Lisp_Object Qappend;
-extern int ns_antialias_text;
+extern Lisp_Object ns_antialias_text;
 extern float ns_antialias_threshold;
 extern int ns_tmp_flags;
 extern struct nsfont_info *ns_tmp_font;
@@ -1243,7 +1245,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
 
     CGContextSetFont (gcontext, font->cgfont);
     CGContextSetFontSize (gcontext, font->size);
-    if (ns_antialias_text == Qnil || font->size <= ns_antialias_threshold)
+    if (NILP (ns_antialias_text) || font->size <= ns_antialias_threshold)
       CGContextSetShouldAntialias (gcontext, 0);
     else
       CGContextSetShouldAntialias (gcontext, 1);

[PGP.sig (application/pgp-signature, inline)]

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4736; Package emacs,ns. (Sun, 14 Feb 2010 16:06:02 GMT) Full text and rfc822 format available.

Message #28 received at 4736 <at> debbugs.gnu.org (full text, mbox):

From: Francis Devereux <francis <at> devrx.org>
To: David Reitter <david.reitter <at> gmail.com>
Cc: Adrian Robert <adrian.b.robert <at> gmail.com>, 4736 <at> debbugs.gnu.org,
	John Whitley <whitley <at> acm.org>, emacs-devel <at> gnu.org
Subject: Re: 23.1; ns-antialias-text set to nil has no effect
Date: Sun, 14 Feb 2010 16:01:55 +0000
On 14 Feb 2010, at 15:38, David Reitter wrote:

> On Feb 14, 2010, at 8:31 AM, Francis Devereux wrote:
> 
>> On 17 Oct 2009, at 13:16, Adrian Robert wrote:
>> 
>>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4736
>> 
>> I've also discovered that if I build Emacs as a 32 bit binary on 10.6 (the default is 64 bit on 10.6) with the following command then ns-antialias-text works.  The commands I used to build are:
>> LDFLAGS="-arch i386" CFLAGS="-g -O2 -arch i386 -march=core2" ../trunk/configure --build=i386-apple-darwin10.2.0 --with-ns && make -j2 && make install
> 
> 
> ns_antialias_text is wrongly declared as an int instead of Lisp_Object, and the nonstandard pointer comparison to Qnil helped cover it up, I suppose.  That also explains why it happened to work on 32bit.   Try the patch below.

Thanks David, works when compiled as 64 bit on OS X 10.6.2.

Francis





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4736; Package emacs,ns. (Tue, 16 Feb 2010 02:44:01 GMT) Full text and rfc822 format available.

Message #31 received at 4736 <at> debbugs.gnu.org (full text, mbox):

From: John Whitley <whitley <at> acm.org>
To: Francis Devereux <francis <at> devrx.org>
Cc: David Reitter <david.reitter <at> gmail.com>,
	Adrian Robert <adrian.b.robert <at> gmail.com>,
	4736 <at> debbugs.gnu.org, emacs-devel <at> gnu.org
Subject: Re: 23.1; ns-antialias-text set to nil has no effect
Date: Mon, 15 Feb 2010 15:36:47 -0800
On Feb 14, 2010, at 8:01 AM, Francis Devereux wrote:
> On 14 Feb 2010, at 15:38, David Reitter wrote:
>> ns_antialias_text is wrongly declared as an int instead of Lisp_Object, and the nonstandard pointer comparison to Qnil helped cover it up, I suppose.  That also explains why it happened to work on 32bit.   Try the patch below.
> 
> Thanks David, works when compiled as 64 bit on OS X 10.6.2.

Second confirmation.  I built Emacs.app as 64 bit with David's patch against bzr revno 99498; the setting ns-antialias-text is now correctly observed.

Thanks Francis and David!

-- John






Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4736; Package emacs,ns. (Thu, 25 Feb 2010 20:41:01 GMT) Full text and rfc822 format available.

Message #34 received at 4736 <at> debbugs.gnu.org (full text, mbox):

From: Francis Devereux <francis <at> devrx.org>
To: emacs-devel <at> gnu.org
Cc: David Reitter <david.reitter <at> gmail.com>,
	Adrian Robert <adrian.b.robert <at> gmail.com>,
	4736 <at> debbugs.gnu.org, John Whitley <whitley <at> acm.org>
Subject: Re: 23.1; ns-antialias-text set to nil has no effect
Date: Thu, 25 Feb 2010 20:40:12 +0000
On 15 Feb 2010, at 23:36, John Whitley wrote:

> 
> On Feb 14, 2010, at 8:01 AM, Francis Devereux wrote:
>> On 14 Feb 2010, at 15:38, David Reitter wrote:
>>> ns_antialias_text is wrongly declared as an int instead of Lisp_Object, and the nonstandard pointer comparison to Qnil helped cover it up, I suppose.  That also explains why it happened to work on 32bit.   Try the patch below.
>> 
>> Thanks David, works when compiled as 64 bit on OS X 10.6.2.
> 
> Second confirmation.  I built Emacs.app as 64 bit with David's patch against bzr revno 99498; the setting ns-antialias-text is now correctly observed.

David's patch fixes the problem for both John and I, would it be possible for someone to commit it?

Francis





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4736; Package emacs,ns. (Fri, 26 Feb 2010 00:50:03 GMT) Full text and rfc822 format available.

Message #37 received at 4736 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Francis Devereux <francis <at> devrx.org>
Cc: David Reitter <david.reitter <at> gmail.com>,
	Adrian Robert <adrian.b.robert <at> gmail.com>,
	John Whitley <whitley <at> acm.org>, 4736 <at> debbugs.gnu.org, emacs-devel <at> gnu.org
Subject: Re: 23.1; ns-antialias-text set to nil has no effect
Date: Thu, 25 Feb 2010 19:49:24 -0500
Francis Devereux <francis <at> devrx.org> writes:

> David's patch fixes the problem for both John and I, would it be
> possible for someone to commit it?

Done.




bug closed, send any further explanations to John Whitley <whitley <at> acm.org> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Fri, 26 Feb 2010 00:50:05 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4736; Package emacs,ns. (Sat, 27 Feb 2010 20:43:02 GMT) Full text and rfc822 format available.

Message #42 received at 4736 <at> debbugs.gnu.org (full text, mbox):

From: Francis Devereux <francis <at> devrx.org>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: David Reitter <david.reitter <at> gmail.com>,
	Adrian Robert <adrian.b.robert <at> gmail.com>, 4736 <at> debbugs.gnu.org,
	John Whitley <whitley <at> acm.org>, emacs-devel <at> gnu.org
Subject: Re: 23.1; ns-antialias-text set to nil has no effect
Date: Sat, 27 Feb 2010 20:42:32 +0000
On 26 Feb 2010, at 00:49, Chong Yidong wrote:

> Francis Devereux <francis <at> devrx.org> writes:
> 
>> David's patch fixes the problem for both John and I, would it be
>> possible for someone to commit it?
> 
> Done.

Thanks, the bug is fixed in bzr r99572 (I've tested a 64 bit build of it on OS X 10.6.2).

Francis





bug archived. Request was from Debbugs Internal Request <bug-gnu-emacs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 28 Mar 2010 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 88 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.