unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* State of NS port
@ 2013-01-10 16:27 Adrian Robert
  2013-01-10 18:53 ` chad
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Adrian Robert @ 2013-01-10 16:27 UTC (permalink / raw)
  To: emacs-devel@gnu.org Development

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

Hi,

I built the NS port of emacs under Mac OS X 10.8 today from trunk.  I realize a tremendous amount of work over the years has been done to clean up various glitches in menus, rendering, event handling, etc., many caused by my own poor work, but I was really disappointed to see some big steps backwards in basics.  Here is a screenshot of the HELLO file from today on left, and a version from 3 years ago on the right.

I've stepped back my direct involvement in the port to find more time to focus on other things, and I appreciate the work of others who have taken up the slack.  But glaring issues like extra blank space in the window, nonconformance to the system standard edge-rounding, and poor text rendering in the prevailing Carbon port (at the time) were part of what led me originally to resurrect the NS port to begin with back in 2004.

I don't know if the current steps backwards are due to the lack of maintenance in keeping up with internal core changes, or due to inadvertent and/or accepted losses in the course of making port enhancements.  But I would request that when people make changes, they keep an eye out for regressions introduced by them, and refrain from committing improvements that introduce new (or old) problems.

All I can do is make this request humbly, and apologize for my own lack of involvement, which while it has surely led to improvement of the codebase overall, seems to have caused some penalty as well.

respectfully,
Adrian


[-- Attachment #2.1: Type: text/html, Size: 2011 bytes --]

[-- Attachment #2.2: Screen-Shot-2013-01-10-at-11.08s.png --]
[-- Type: image/png, Size: 215457 bytes --]

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

* Re: State of NS port
  2013-01-10 16:27 State of NS port Adrian Robert
@ 2013-01-10 18:53 ` chad
  2013-01-10 19:28 ` Stefan Monnier
  2013-01-12  3:49 ` Chris Zheng
  2 siblings, 0 replies; 18+ messages in thread
From: chad @ 2013-01-10 18:53 UTC (permalink / raw)
  To: Adrian Robert; +Cc: emacs-devel@gnu.org Development


On 10 Jan 2013, at 08:27, Adrian Robert <adrian.b.robert@gmail.com> wrote:

> Here is a screenshot of the HELLO file from today on left, and a version from 3 years ago on the right.

I've been playing around in my limited spare time with the `mac port' to see what things might be usable, but so far I haven't made much progress.  I wonder if you could add a comparison to the current mac port, and maybe even an X11 build under macosx.  I ask because I'm especially curious about the line-spacing, font handling, and color space issues; I expect all 4 versions to be different.

Thanks for all the work!
~Chad




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

* Re: State of NS port
  2013-01-10 16:27 State of NS port Adrian Robert
  2013-01-10 18:53 ` chad
@ 2013-01-10 19:28 ` Stefan Monnier
  2013-01-12  3:49 ` Chris Zheng
  2 siblings, 0 replies; 18+ messages in thread
From: Stefan Monnier @ 2013-01-10 19:28 UTC (permalink / raw)
  To: Adrian Robert; +Cc: emacs-devel@gnu.org Development

> I don't know if the current steps backwards are due to the lack of
> maintenance in keeping up with internal core changes, or due to inadvertent
> and/or accepted losses in the course of making port enhancements.

AFAICT, there have been very few enhancements, if any.  The lack of
manpower means that we can barely fix the bugs that are being reported,
and some of those fixes may indeed introduce regressions.

> All I can do is make this request humbly, and apologize for my own lack of
> involvement, which while it has surely led to improvement of the codebase
> overall, seems to have caused some penalty as well.

We dearly miss your help,


        Stefan



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

* Re: State of NS port
@ 2013-01-11  1:38 David Kanter
  2013-01-11 16:13 ` Jan Djärv
  0 siblings, 1 reply; 18+ messages in thread
From: David Kanter @ 2013-01-11  1:38 UTC (permalink / raw)
  To: emacs-devel

For what it's worth, I filed bug #12996 along these lines. However,
now both trunk and emacs-24 render fonts poorly when using the gui.

Dave



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

* Re: State of NS port
  2013-01-11  1:38 David Kanter
@ 2013-01-11 16:13 ` Jan Djärv
  0 siblings, 0 replies; 18+ messages in thread
From: Jan Djärv @ 2013-01-11 16:13 UTC (permalink / raw)
  To: David Kanter; +Cc: emacs-devel

Hello.

11 jan 2013 kl. 02:38 skrev David Kanter <kanterdj@gmail.com>:

> For what it's worth, I filed bug #12996 along these lines. However,
> now both trunk and emacs-24 render fonts poorly when using the gui.

There has been no font, drawing or other rendering-related changes to emacs-24 since you filed that bug report, so if emacs-24 looks different it has nothing to do with the NS port.

	Jan D.





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

* Re: State of NS port
  2013-01-10 16:27 State of NS port Adrian Robert
  2013-01-10 18:53 ` chad
  2013-01-10 19:28 ` Stefan Monnier
@ 2013-01-12  3:49 ` Chris Zheng
  2013-01-12 10:09   ` Jan Djärv
                     ` (2 more replies)
  2 siblings, 3 replies; 18+ messages in thread
From: Chris Zheng @ 2013-01-12  3:49 UTC (permalink / raw)
  To: Adrian Robert; +Cc: emacs-devel@gnu.org Development

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

I suffered this problem too, and it's because of two bug fixes after I dig it awhile. 

bug#11484: 23.4; Scrolling leaves traces of old text behind

http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-05/msg00383.html

LCD-smoothing was turned off to fix this bug,

and 

bug#11541: - Another reproduction - Emacs 24.2; Null pointer on OSX with

http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-09/msg01293.html

I simply revert these two fixes, and problem you mentioned is gone. 

So, maybe there are more deeper things around of these two bugs.

diff --git a/src/nsfont.m b/src/nsfont.m
index c0bea2e..a5fc570 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -560,10 +560,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
     if (isMatch)
  [fkeys removeObject: NSFontFamilyAttribute];
 
-    if ([fkeys count] > 0)
-      matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];
-    else
-      matchingDescs = [NSMutableArray array];
+    matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];
 
     if (NSFONT_TRACE)
  NSLog(@"Got desc %@ and found %d matching fonts from it: ", fdesc,
@@ -1240,7 +1237,6 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
     else
       CGContextSetShouldAntialias (gcontext, 1);
 
-    CGContextSetShouldSmoothFonts (gcontext, NO);
     CGContextSetTextMatrix (gcontext, fliptf);
 
     if (bgCol != nil)



-- 
Best regards,
Chris


On Friday, January 11, 2013 at 12:27 AM, Adrian Robert wrote:

> Hi,
> 
> I built the NS port of emacs under Mac OS X 10.8 today from trunk.  I realize a tremendous amount of work over the years has been done to clean up various glitches in menus, rendering, event handling, etc., many caused by my own poor work, but I was really disappointed to see some big steps backwards in basics.  Here is a screenshot of the HELLO file from today on left, and a version from 3 years ago on the right.
> 
> I've stepped back my direct involvement in the port to find more time to focus on other things, and I appreciate the work of others who have taken up the slack.  But glaring issues like extra blank space in the window, nonconformance to the system standard edge-rounding, and poor text rendering in the prevailing Carbon port (at the time) were part of what led me originally to resurrect the NS port to begin with back in 2004.
> 
> I don't know if the current steps backwards are due to the lack of maintenance in keeping up with internal core changes, or due to inadvertent and/or accepted losses in the course of making port enhancements.  But I would request that when people make changes, they keep an eye out for regressions introduced by them, and refrain from committing improvements that introduce new (or old) problems.
> 
> All I can do is make this request humbly, and apologize for my own lack of involvement, which while it has surely led to improvement of the codebase overall, seems to have caused some penalty as well.
> 
> respectfully,
> Adrian
> 


[-- Attachment #2.1: Type: text/html, Size: 4801 bytes --]

[-- Attachment #2.2: Screen-Shot-2013-01-10-at-11.08s.png --]
[-- Type: image/PNG, Size: 215457 bytes --]

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

* Re: State of NS port
  2013-01-12  3:49 ` Chris Zheng
@ 2013-01-12 10:09   ` Jan Djärv
  2013-01-14  2:44     ` Chris Zheng
  2013-01-12 14:58   ` Harald Hanche-Olsen
  2013-01-13  8:14   ` YAMAMOTO Mitsuharu
  2 siblings, 1 reply; 18+ messages in thread
From: Jan Djärv @ 2013-01-12 10:09 UTC (permalink / raw)
  To: Chris Zheng; +Cc: Adrian Robert, emacs-devel@gnu.org Development

Hello.

12 jan 2013 kl. 04:49 skrev Chris Zheng <chrisdcheng@gmail.com>:

> I suffered this problem too, and it's because of two bug fixes after I dig it awhile.
> 
> bug#11484: 23.4; Scrolling leaves traces of old text behind
> 
> http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-05/msg00383.html
> 
> LCD-smoothing was turned off to fix this bug,
> 
> and 
> 
> bug#11541: - Another reproduction - Emacs 24.2;	Null pointer on OSX with
> 
> http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-09/msg01293.html
> 
> I simply revert these two fixes, and problem you mentioned is gone. 
> 
> So, maybe there are more deeper things around of these two bugs.

Yes there are.  The first one is due to the fact that the font code miscalculates the font metrics when lcd-smoothing is on. It may be related to some premature optimizations such as caching of font metrics in the font code.

The second one is because the memory handling in the font code is incorrect and leads to crashes for some people (may depend on font and/or OS version and/or compiler version/settings).  The second one does not happen when run in gdb.  But when it does happen, as it does for me right now, Emacs crashes.

	Jan D.




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

* Re: State of NS port
  2013-01-12  3:49 ` Chris Zheng
  2013-01-12 10:09   ` Jan Djärv
@ 2013-01-12 14:58   ` Harald Hanche-Olsen
  2013-01-12 16:41     ` Jan Djärv
  2013-01-13  8:14   ` YAMAMOTO Mitsuharu
  2 siblings, 1 reply; 18+ messages in thread
From: Harald Hanche-Olsen @ 2013-01-12 14:58 UTC (permalink / raw)
  To: emacs-devel

[Chris Zheng <chrisdcheng@gmail.com> (2013-01-12 03:49:09 UTC)]

> I suffered this problem too, and it's because of two bug fixes after I dig it awhile. 
> 
> bug#11484: 23.4; Scrolling leaves traces of old text behind
> 
> http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-05/msg00383.html
> 
> LCD-smoothing was turned off to fix this bug,
> [...]
> I simply revert these two fixes, and problem you mentioned is gone. 

IIRC, while LCD-smoothing was on, the display was rather the opposite
of crisp. The fuzziness led to quite a bit of eye strain on my part,
and I was very happy when kLCD-smoothing was turned off.

I have some complaints about the NS port myself, but rendering issues
is not among them. (Though clearly, something must have happened in
the font department: There are many more glyphs displayed as boxes in
the HELLO file than there used to.)

- Harald



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

* Re: State of NS port
  2013-01-12 14:58   ` Harald Hanche-Olsen
@ 2013-01-12 16:41     ` Jan Djärv
  2013-01-15 17:57       ` Adrian Robert
  0 siblings, 1 reply; 18+ messages in thread
From: Jan Djärv @ 2013-01-12 16:41 UTC (permalink / raw)
  To: Harald Hanche-Olsen; +Cc: emacs-devel

Hello.

12 jan 2013 kl. 15:58 skrev Harald Hanche-Olsen <hanche@math.ntnu.no>:

> [Chris Zheng <chrisdcheng@gmail.com> (2013-01-12 03:49:09 UTC)]
> 
>> I suffered this problem too, and it's because of two bug fixes after I dig it awhile. 
>> 
>> bug#11484: 23.4; Scrolling leaves traces of old text behind
>> 
>> http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-05/msg00383.html
>> 
>> LCD-smoothing was turned off to fix this bug,
>> [...]
>> I simply revert these two fixes, and problem you mentioned is gone. 
> 
> IIRC, while LCD-smoothing was on, the display was rather the opposite
> of crisp. The fuzziness led to quite a bit of eye strain on my part,
> and I was very happy when kLCD-smoothing was turned off.
> 
> I have some complaints about the NS port myself, but rendering issues
> is not among them. (Though clearly, something must have happened in
> the font department: There are many more glyphs displayed as boxes in
> the HELLO file than there used to.)

I also prefer LCD-smoothing of, but I suspect it depends on the monitor also.  We can make off/on a user option.

	Jan D.





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

* Re: State of NS port
  2013-01-12  3:49 ` Chris Zheng
  2013-01-12 10:09   ` Jan Djärv
  2013-01-12 14:58   ` Harald Hanche-Olsen
@ 2013-01-13  8:14   ` YAMAMOTO Mitsuharu
  2013-01-13 12:23     ` Jan Djärv
  2013-01-13 14:09     ` Jan Djärv
  2 siblings, 2 replies; 18+ messages in thread
From: YAMAMOTO Mitsuharu @ 2013-01-13  8:14 UTC (permalink / raw)
  To: Chris Zheng; +Cc: emacs-devel

>>>>> On Sat, 12 Jan 2013 11:49:09 +0800, Chris Zheng <chrisdcheng@gmail.com> said:

> I suffered this problem too, and it's because of two bug fixes after I dig it awhile. 
> bug#11484: 23.4; Scrolling leaves traces of old text behind

> http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-05/msg00383.html

I could reproduce it with the *Mac port*, so the problem would be that
the reported metrics don't exactly reflect the actual display when LCD
font smoothing is turned on.  I think I will apply the following
workaround in the next release of the Mac port.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

=== modified file 'src/macfont.c'
*** src/macfont.c	2013-01-11 07:33:09 +0000
--- src/macfont.c	2013-01-13 07:24:32 +0000
***************
*** 483,488 ****
--- 483,489 ----
        METRICS_SET_VALUE (metrics, descent, status);} while (0)
  
  #define METRICS_NCOLS_PER_ROW	(128)
+ #define LCD_FONT_SMOOTHING_RIGHT_MARGIN	(0.396)
  
  static int
  macfont_glyph_extents (struct font *font, CGGlyph glyph,
***************
*** 579,584 ****
--- 580,587 ----
  				     / (CGFloat) WIDTH_FRAC_SCALE));
  	      break;
  	    }
+ 	  if (bounds.size.width > 0)
+ 	    bounds.size.width += LCD_FONT_SMOOTHING_RIGHT_MARGIN;
  	  bounds = CGRectIntegral (bounds);
  	  METRICS_SET_VALUE (cache, lbearing, CGRectGetMinX (bounds));
  	  METRICS_SET_VALUE (cache, rbearing, CGRectGetMaxX (bounds));




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

* Re: State of NS port
  2013-01-13  8:14   ` YAMAMOTO Mitsuharu
@ 2013-01-13 12:23     ` Jan Djärv
  2013-01-13 14:09     ` Jan Djärv
  1 sibling, 0 replies; 18+ messages in thread
From: Jan Djärv @ 2013-01-13 12:23 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: Chris Zheng, emacs-devel

Hej.

13 jan 2013 kl. 09:14 skrev YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>:

>>>>>> On Sat, 12 Jan 2013 11:49:09 +0800, Chris Zheng <chrisdcheng@gmail.com> said:
> 
>> I suffered this problem too, and it's because of two bug fixes after I dig it awhile. 
>> bug#11484: 23.4; Scrolling leaves traces of old text behind
> 
>> http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-05/msg00383.html
> 
> I could reproduce it with the *Mac port*, so the problem would be that
> the reported metrics don't exactly reflect the actual display when LCD
> font smoothing is turned on.  I think I will apply the following
> workaround in the next release of the Mac port.

It seems that you need to use a NSLayoutManager to handle this correctly.
I'll try your workoround in nsfont.m.

Thanks,

	Jan D.

> 
> 				     YAMAMOTO Mitsuharu
> 				mituharu@math.s.chiba-u.ac.jp
> 
> === modified file 'src/macfont.c'
> *** src/macfont.c	2013-01-11 07:33:09 +0000
> --- src/macfont.c	2013-01-13 07:24:32 +0000
> ***************
> *** 483,488 ****
> --- 483,489 ----
>        METRICS_SET_VALUE (metrics, descent, status);} while (0)
> 
>  #define METRICS_NCOLS_PER_ROW	(128)
> + #define LCD_FONT_SMOOTHING_RIGHT_MARGIN	(0.396)
> 
>  static int
>  macfont_glyph_extents (struct font *font, CGGlyph glyph,
> ***************
> *** 579,584 ****
> --- 580,587 ----
>  				     / (CGFloat) WIDTH_FRAC_SCALE));
>  	      break;
>  	    }
> + 	  if (bounds.size.width > 0)
> + 	    bounds.size.width += LCD_FONT_SMOOTHING_RIGHT_MARGIN;
>  	  bounds = CGRectIntegral (bounds);
>  	  METRICS_SET_VALUE (cache, lbearing, CGRectGetMinX (bounds));
>  	  METRICS_SET_VALUE (cache, rbearing, CGRectGetMaxX (bounds));
> 




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

* Re: State of NS port
  2013-01-13  8:14   ` YAMAMOTO Mitsuharu
  2013-01-13 12:23     ` Jan Djärv
@ 2013-01-13 14:09     ` Jan Djärv
  2013-01-14  3:07       ` YAMAMOTO Mitsuharu
  1 sibling, 1 reply; 18+ messages in thread
From: Jan Djärv @ 2013-01-13 14:09 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: Chris Zheng, emacs-devel

Hello.

A question, there might be smoothing on both left and right sides of a glyph, for instance Y may do this.  Don't you need to take the left side into account?

	Jan D.

13 jan 2013 kl. 09:14 skrev YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>:

>>>>>> On Sat, 12 Jan 2013 11:49:09 +0800, Chris Zheng <chrisdcheng@gmail.com> said:
> 
>> I suffered this problem too, and it's because of two bug fixes after I dig it awhile. 
>> bug#11484: 23.4; Scrolling leaves traces of old text behind
> 
>> http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-05/msg00383.html
> 
> I could reproduce it with the *Mac port*, so the problem would be that
> the reported metrics don't exactly reflect the actual display when LCD
> font smoothing is turned on.  I think I will apply the following
> workaround in the next release of the Mac port.
> 
> 				     YAMAMOTO Mitsuharu
> 				mituharu@math.s.chiba-u.ac.jp
> 
> === modified file 'src/macfont.c'
> *** src/macfont.c	2013-01-11 07:33:09 +0000
> --- src/macfont.c	2013-01-13 07:24:32 +0000
> ***************
> *** 483,488 ****
> --- 483,489 ----
>        METRICS_SET_VALUE (metrics, descent, status);} while (0)
> 
>  #define METRICS_NCOLS_PER_ROW	(128)
> + #define LCD_FONT_SMOOTHING_RIGHT_MARGIN	(0.396)
> 
>  static int
>  macfont_glyph_extents (struct font *font, CGGlyph glyph,
> ***************
> *** 579,584 ****
> --- 580,587 ----
>  				     / (CGFloat) WIDTH_FRAC_SCALE));
>  	      break;
>  	    }
> + 	  if (bounds.size.width > 0)
> + 	    bounds.size.width += LCD_FONT_SMOOTHING_RIGHT_MARGIN;
>  	  bounds = CGRectIntegral (bounds);
>  	  METRICS_SET_VALUE (cache, lbearing, CGRectGetMinX (bounds));
>  	  METRICS_SET_VALUE (cache, rbearing, CGRectGetMaxX (bounds));
> 




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

* Re: State of NS port
  2013-01-12 10:09   ` Jan Djärv
@ 2013-01-14  2:44     ` Chris Zheng
  2013-01-14  9:35       ` Jan Djärv
  0 siblings, 1 reply; 18+ messages in thread
From: Chris Zheng @ 2013-01-14  2:44 UTC (permalink / raw)
  To: Jan Djärv; +Cc: Adrian Robert, emacs-devel@gnu.org Development

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

But the second one (which seems a reasonable fix) makes Emacs unable to display any non-western characters.

-    if ([fkeys count] > 0)
-      matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];
-    else
-      matchingDescs = [NSMutableArray array];
+    matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];


--  
Best regards,
Chris


On Saturday, January 12, 2013 at 6:09 PM, Jan Djärv wrote:

> Hello.
>  
> 12 jan 2013 kl. 04:49 skrev Chris Zheng <chrisdcheng@gmail.com (mailto:chrisdcheng@gmail.com)>:
>  
> > I suffered this problem too, and it's because of two bug fixes after I dig it awhile.
> >  
> > bug#11484: 23.4; Scrolling leaves traces of old text behind
> >  
> > http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-05/msg00383.html
> >  
> > LCD-smoothing was turned off to fix this bug,
> >  
> > and  
> >  
> > bug#11541: - Another reproduction - Emacs 24.2; Null pointer on OSX with
> >  
> > http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-09/msg01293.html
> >  
> > I simply revert these two fixes, and problem you mentioned is gone.  
> >  
> > So, maybe there are more deeper things around of these two bugs.
>  
> Yes there are. The first one is due to the fact that the font code miscalculates the font metrics when lcd-smoothing is on. It may be related to some premature optimizations such as caching of font metrics in the font code.
>  
> The second one is because the memory handling in the font code is incorrect and leads to crashes for some people (may depend on font and/or OS version and/or compiler version/settings). The second one does not happen when run in gdb. But when it does happen, as it does for me right now, Emacs crashes.
>  
> Jan D.  


[-- Attachment #2: Type: text/html, Size: 2967 bytes --]

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

* Re: State of NS port
  2013-01-13 14:09     ` Jan Djärv
@ 2013-01-14  3:07       ` YAMAMOTO Mitsuharu
  0 siblings, 0 replies; 18+ messages in thread
From: YAMAMOTO Mitsuharu @ 2013-01-14  3:07 UTC (permalink / raw)
  To: Jan Djärv; +Cc: Chris Zheng, emacs-devel

>>>>> On Sun, 13 Jan 2013 15:09:25 +0100, Jan Djärv <jan.h.d@swipnet.se> said:

> A question, there might be smoothing on both left and right sides of
> a glyph, for instance Y may do this.  Don't you need to take the
> left side into account?

Yes, indeed.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

=== modified file 'src/macfont.c'
*** src/macfont.c	2013-01-11 07:33:09 +0000
--- src/macfont.c	2013-01-14 03:02:40 +0000
***************
*** 483,488 ****
--- 483,490 ----
        METRICS_SET_VALUE (metrics, descent, status);} while (0)
  
  #define METRICS_NCOLS_PER_ROW	(128)
+ #define LCD_FONT_SMOOTHING_LEFT_MARGIN	(0.396)
+ #define LCD_FONT_SMOOTHING_RIGHT_MARGIN	(0.396)
  
  static int
  macfont_glyph_extents (struct font *font, CGGlyph glyph,
***************
*** 579,584 ****
--- 581,592 ----
  				     / (CGFloat) WIDTH_FRAC_SCALE));
  	      break;
  	    }
+ 	  if (bounds.size.width > 0)
+ 	    {
+ 	      bounds.origin.x -= LCD_FONT_SMOOTHING_LEFT_MARGIN;
+ 	      bounds.size.width += (LCD_FONT_SMOOTHING_LEFT_MARGIN
+ 				    + LCD_FONT_SMOOTHING_RIGHT_MARGIN);
+ 	    }
  	  bounds = CGRectIntegral (bounds);
  	  METRICS_SET_VALUE (cache, lbearing, CGRectGetMinX (bounds));
  	  METRICS_SET_VALUE (cache, rbearing, CGRectGetMaxX (bounds));




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

* Re: State of NS port
  2013-01-14  2:44     ` Chris Zheng
@ 2013-01-14  9:35       ` Jan Djärv
  0 siblings, 0 replies; 18+ messages in thread
From: Jan Djärv @ 2013-01-14  9:35 UTC (permalink / raw)
  To: Chris Zheng; +Cc: Adrian Robert, emacs-devel@gnu.org Development

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

This is fixed in the trunk. 

    Jan D.

14 jan 2013 kl. 03:44 skrev Chris Zheng <chrisdcheng@gmail.com>:

> But the second one (which seems a reasonable fix) makes Emacs unable to display any non-western characters.
> 
> -    if ([fkeys count] > 0)
> -      matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];
> -    else
> -      matchingDescs = [NSMutableArray array];
> +    matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];
> 
> -- 
> Best regards,
> Chris
> 
> On Saturday, January 12, 2013 at 6:09 PM, Jan Djärv wrote:
> 
>> Hello.
>> 
>> 12 jan 2013 kl. 04:49 skrev Chris Zheng <chrisdcheng@gmail.com>:
>> 
>>> I suffered this problem too, and it's because of two bug fixes after I dig it awhile.
>>> 
>>> bug#11484: 23.4; Scrolling leaves traces of old text behind
>>> 
>>> http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-05/msg00383.html
>>> 
>>> LCD-smoothing was turned off to fix this bug,
>>> 
>>> and
>>> 
>>> bug#11541: - Another reproduction - Emacs 24.2;	Null pointer on OSX with
>>> 
>>> http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-09/msg01293.html
>>> 
>>> I simply revert these two fixes, and problem you mentioned is gone.
>>> 
>>> So, maybe there are more deeper things around of these two bugs.
>> 
>> Yes there are. The first one is due to the fact that the font code miscalculates the font metrics when lcd-smoothing is on. It may be related to some premature optimizations such as caching of font metrics in the font code.
>> 
>> The second one is because the memory handling in the font code is incorrect and leads to crashes for some people (may depend on font and/or OS version and/or compiler version/settings). The second one does not happen when run in gdb. But when it does happen, as it does for me right now, Emacs crashes.
>> 
>> Jan D.
> 

[-- Attachment #2: Type: text/html, Size: 3351 bytes --]

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

* Re: State of NS port
  2013-01-12 16:41     ` Jan Djärv
@ 2013-01-15 17:57       ` Adrian Robert
  2013-01-15 20:47         ` Jan Djärv
  0 siblings, 1 reply; 18+ messages in thread
From: Adrian Robert @ 2013-01-15 17:57 UTC (permalink / raw)
  To: emacs-devel

Jan Djärv <jan.h.d <at> swipnet.se> writes:

...
> I also prefer LCD-smoothing of, but I suspect it depends on the monitor also.
>  We can make off/on a user option.

I guess it should really be tied in to what the user selects at the system level.

But failing that, user-configurable would be nice.  We used to have
'ns-use-qd-smoothing' in the old days, which produced a look similar
to the Carbon port at the time.  Although it is probably relevant beyond
just ns -- I'm pretty sure both Windows and X provide a similar system-level
option (though hopefully it is already listened to there).









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

* Re: State of NS port
  2013-01-15 17:57       ` Adrian Robert
@ 2013-01-15 20:47         ` Jan Djärv
  2013-01-16 13:46           ` Adrian Robert
  0 siblings, 1 reply; 18+ messages in thread
From: Jan Djärv @ 2013-01-15 20:47 UTC (permalink / raw)
  To: Adrian Robert; +Cc: emacs-devel

Hello.

15 jan 2013 kl. 18:57 skrev Adrian Robert <adrian.b.robert@gmail.com>:

> Jan Djärv <jan.h.d <at> swipnet.se> writes:
> 
> ...
>> I also prefer LCD-smoothing of, but I suspect it depends on the monitor also.
>> We can make off/on a user option.
> 
> I guess it should really be tied in to what the user selects at the system level.

Well, if LCD-smoothing is turned off on a system level, it is turned off for Emacs also,
we don't do anything special.

> 
> But failing that, user-configurable would be nice.  We used to have
> 'ns-use-qd-smoothing' in the old days, which produced a look similar
> to the Carbon port at the time.  Although it is probably relevant beyond
> just ns -- I'm pretty sure both Windows and X provide a similar system-level
> option (though hopefully it is already listened to there).

I'm not sure X(ft) has LCD_smoothing like OSX has, it does have different antialias settings.  But Gnome 3 has removed the possibility for the user to change them easily...

	Jan D.




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

* Re: State of NS port
  2013-01-15 20:47         ` Jan Djärv
@ 2013-01-16 13:46           ` Adrian Robert
  0 siblings, 0 replies; 18+ messages in thread
From: Adrian Robert @ 2013-01-16 13:46 UTC (permalink / raw)
  To: Jan Djärv; +Cc: emacs-devel@gnu.org Development


On 2013/01/15, at 15:47, Jan Djärv <jan.h.d@swipnet.se> wrote:

> Hello.
> 
> 15 jan 2013 kl. 18:57 skrev Adrian Robert <adrian.b.robert@gmail.com>:
> 
>> Jan Djärv <jan.h.d <at> swipnet.se> writes:
>> 
>> ...
>>> I also prefer LCD-smoothing of, but I suspect it depends on the monitor also.
>>> We can make off/on a user option.
>> 
>> I guess it should really be tied in to what the user selects at the system level.
> 
> Well, if LCD-smoothing is turned off on a system level, it is turned off for Emacs also,
> we don't do anything special.


Yes, now that I try, it looks like it is followed.  Hopefully this can be the answer then for 
those who don't like the looks of LCD smoothing.  No need for a config option inside Emacs.





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

end of thread, other threads:[~2013-01-16 13:46 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-10 16:27 State of NS port Adrian Robert
2013-01-10 18:53 ` chad
2013-01-10 19:28 ` Stefan Monnier
2013-01-12  3:49 ` Chris Zheng
2013-01-12 10:09   ` Jan Djärv
2013-01-14  2:44     ` Chris Zheng
2013-01-14  9:35       ` Jan Djärv
2013-01-12 14:58   ` Harald Hanche-Olsen
2013-01-12 16:41     ` Jan Djärv
2013-01-15 17:57       ` Adrian Robert
2013-01-15 20:47         ` Jan Djärv
2013-01-16 13:46           ` Adrian Robert
2013-01-13  8:14   ` YAMAMOTO Mitsuharu
2013-01-13 12:23     ` Jan Djärv
2013-01-13 14:09     ` Jan Djärv
2013-01-14  3:07       ` YAMAMOTO Mitsuharu
  -- strict thread matches above, loose matches on Subject: below --
2013-01-11  1:38 David Kanter
2013-01-11 16:13 ` Jan Djärv

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).