unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: 23.1; ns-antialias-text set to nil has no effect
       [not found] <3D80FB40-724F-4789-8807-E1C8A8A40375@gmail.com>
@ 2010-02-14 13:31 ` Francis Devereux
  2010-02-14 15:38   ` David Reitter
  0 siblings, 1 reply; 7+ messages in thread
From: Francis Devereux @ 2010-02-14 13:31 UTC (permalink / raw)
  To: Adrian Robert; +Cc: John Whitley, 4736, emacs-devel

On 17 Oct 2009, at 13:16, Adrian Robert wrote:

> http://emacsbugs.donarmstrong.com/cgi-bin/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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 23.1; ns-antialias-text set to nil has no effect
  2010-02-14 13:31 ` 23.1; ns-antialias-text set to nil has no effect Francis Devereux
@ 2010-02-14 15:38   ` David Reitter
  2010-02-14 16:01     ` Francis Devereux
  0 siblings, 1 reply; 7+ messages in thread
From: David Reitter @ 2010-02-14 15:38 UTC (permalink / raw)
  To: Francis Devereux; +Cc: Adrian Robert, 4736, John Whitley, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1729 bytes --]

On Feb 14, 2010, at 8:31 AM, Francis Devereux wrote:

> On 17 Oct 2009, at 13:16, Adrian Robert wrote:
> 
>> http://emacsbugs.donarmstrong.com/cgi-bin/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);


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 203 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: 23.1; ns-antialias-text set to nil has no effect
  2010-02-14 15:38   ` David Reitter
@ 2010-02-14 16:01     ` Francis Devereux
  2010-02-15 23:36       ` John Whitley
  0 siblings, 1 reply; 7+ messages in thread
From: Francis Devereux @ 2010-02-14 16:01 UTC (permalink / raw)
  To: David Reitter; +Cc: Adrian Robert, 4736, John Whitley, emacs-devel

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://emacsbugs.donarmstrong.com/cgi-bin/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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 23.1; ns-antialias-text set to nil has no effect
  2010-02-14 16:01     ` Francis Devereux
@ 2010-02-15 23:36       ` John Whitley
  2010-02-25 20:40         ` Francis Devereux
  0 siblings, 1 reply; 7+ messages in thread
From: John Whitley @ 2010-02-15 23:36 UTC (permalink / raw)
  To: Francis Devereux; +Cc: David Reitter, Adrian Robert, 4736, emacs-devel


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






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 23.1; ns-antialias-text set to nil has no effect
  2010-02-15 23:36       ` John Whitley
@ 2010-02-25 20:40         ` Francis Devereux
  2010-02-26  0:49           ` Chong Yidong
  0 siblings, 1 reply; 7+ messages in thread
From: Francis Devereux @ 2010-02-25 20:40 UTC (permalink / raw)
  To: emacs-devel; +Cc: David Reitter, Adrian Robert, 4736, John Whitley

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 23.1; ns-antialias-text set to nil has no effect
  2010-02-25 20:40         ` Francis Devereux
@ 2010-02-26  0:49           ` Chong Yidong
  2010-02-27 20:42             ` Francis Devereux
  0 siblings, 1 reply; 7+ messages in thread
From: Chong Yidong @ 2010-02-26  0:49 UTC (permalink / raw)
  To: Francis Devereux
  Cc: David Reitter, Adrian Robert, John Whitley, 4736, emacs-devel

Francis Devereux <francis@devrx.org> writes:

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

Done.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 23.1; ns-antialias-text set to nil has no effect
  2010-02-26  0:49           ` Chong Yidong
@ 2010-02-27 20:42             ` Francis Devereux
  0 siblings, 0 replies; 7+ messages in thread
From: Francis Devereux @ 2010-02-27 20:42 UTC (permalink / raw)
  To: Chong Yidong
  Cc: David Reitter, Adrian Robert, 4736, John Whitley, emacs-devel

On 26 Feb 2010, at 00:49, Chong Yidong wrote:

> Francis Devereux <francis@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-02-27 20:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <3D80FB40-724F-4789-8807-E1C8A8A40375@gmail.com>
2010-02-14 13:31 ` 23.1; ns-antialias-text set to nil has no effect Francis Devereux
2010-02-14 15:38   ` David Reitter
2010-02-14 16:01     ` Francis Devereux
2010-02-15 23:36       ` John Whitley
2010-02-25 20:40         ` Francis Devereux
2010-02-26  0:49           ` Chong Yidong
2010-02-27 20:42             ` Francis Devereux

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).