all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Mouse highlighting and fonts
@ 2008-05-23 15:09 Chong Yidong
  2008-05-23 19:53 ` Chong Yidong
  0 siblings, 1 reply; 9+ messages in thread
From: Chong Yidong @ 2008-05-23 15:09 UTC (permalink / raw)
  To: emacs-devel

With the current CVS code, the mouse highlight preserves the size of the
underlying face, which avoids the meta-stability problem I mentioned a
few weeks ago.  However, mouse highlighting of the glyph background
still doesn't work right when the underlying font size varies across the
highlighted region.  A test case:

(progn
  (switch-to-buffer "*Test*")
  (erase-buffer)
  (insert "aaaaaaaaaaaaaaaa")
  (put-text-property 1 6
		     'face (list :foreground "cyan"
				 :background "dark blue"
				 :height 2.5))
  (put-text-property 6 (point-max)
		     'face (list :foreground "violet"
				 :background "dark red"))
  (put-text-property 3 8
		     'mouse-face (list :background "green")))




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

* Re: Mouse highlighting and fonts
  2008-05-23 15:09 Mouse highlighting and fonts Chong Yidong
@ 2008-05-23 19:53 ` Chong Yidong
  2008-05-24 23:02   ` Stephen Berman
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Chong Yidong @ 2008-05-23 19:53 UTC (permalink / raw)
  To: emacs-devel

Chong Yidong <cyd@stupidchicken.com> writes:

> With the current CVS code, the mouse highlight preserves the size of the
> underlying face, which avoids the meta-stability problem I mentioned a
> few weeks ago.  However, mouse highlighting of the glyph background
> still doesn't work right when the underlying font size varies across the
> highlighted region.

BTW, another mouse-highlighting bug I reported earlier is still present.
Under certain circumstances, the area to the left and/or right of the
physical cursor doesn't acquire the proper mouse-face.

This appears to be a long-standing bug, but one that didn't show up
until the new font code.  That's because it arises as follows: when the
cursor glyph has a nonzero lbearing or rbearing (i.e., it overlaps with
its neighbors), the neighboring glyphs are redrawn, and this can
overwrite the mouse-face highlight.  See xdisp.c:19934.  This didn't
show up because previously, overlapping glyphs were generally not
encountered.

I'll try to fix this once I get the time, unless someone else fixes it
first.




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

* Re: Mouse highlighting and fonts
  2008-05-23 19:53 ` Chong Yidong
@ 2008-05-24 23:02   ` Stephen Berman
  2008-05-25  2:01   ` Chong Yidong
  2008-05-27  3:26   ` Chong Yidong
  2 siblings, 0 replies; 9+ messages in thread
From: Stephen Berman @ 2008-05-24 23:02 UTC (permalink / raw)
  To: emacs-devel

On Fri, 23 May 2008 15:53:54 -0400 Chong Yidong <cyd@stupidchicken.com> wrote:

> Chong Yidong <cyd@stupidchicken.com> writes:
>
>> With the current CVS code, the mouse highlight preserves the size of the
>> underlying face, which avoids the meta-stability problem I mentioned a
>> few weeks ago.  However, mouse highlighting of the glyph background
>> still doesn't work right when the underlying font size varies across the
>> highlighted region.
>
> BTW, another mouse-highlighting bug I reported earlier is still present.
> Under certain circumstances, the area to the left and/or right of the
> physical cursor doesn't acquire the proper mouse-face.

This also sound like the bug I reported in
<http://permalink.gmane.org/gmane.emacs.devel/88763>.

> This appears to be a long-standing bug, but one that didn't show up
> until the new font code.  That's because it arises as follows: when the
> cursor glyph has a nonzero lbearing or rbearing (i.e., it overlaps with
> its neighbors), the neighboring glyphs are redrawn, and this can
> overwrite the mouse-face highlight.  See xdisp.c:19934.  This didn't
> show up because previously, overlapping glyphs were generally not
> encountered.
>
> I'll try to fix this once I get the time, unless someone else fixes it
> first.

I wish I knew how to fix it; in lieu of that, I look forward to testing
your patch!

Steve Berman





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

* Re: Mouse highlighting and fonts
  2008-05-23 19:53 ` Chong Yidong
  2008-05-24 23:02   ` Stephen Berman
@ 2008-05-25  2:01   ` Chong Yidong
  2008-05-25  4:46     ` YAMAMOTO Mitsuharu
  2008-05-27  8:58     ` Johan Bockgård
  2008-05-27  3:26   ` Chong Yidong
  2 siblings, 2 replies; 9+ messages in thread
From: Chong Yidong @ 2008-05-25  2:01 UTC (permalink / raw)
  To: gerd, emacs-devel

Chong Yidong <cyd@stupidchicken.com> writes:

> Under certain circumstances, the area to the left and/or right of the
> physical cursor doesn't acquire the proper mouse-face.
>
> This appears to be a long-standing bug, but one that didn't show up
> until the new font code.  That's because it arises as follows: when the
> cursor glyph has a nonzero lbearing or rbearing (i.e., it overlaps with
> its neighbors), the neighboring glyphs are redrawn, and this can
> overwrite the mouse-face highlight.  See xdisp.c:19934. 

According to the comments, this code is supposed to redraw glyphs that
are overwritten because of the left/right overhang of the specified
glyph string.  But I've never noticed overlapping glyphs in Emacs.
Under what circumstances can overlapping glyphs occur?

In other words, would there be any effect from simply turning off the
overlap-compensation code, as indicated?  Anyone know?

(Gerd, do you recall why you wrote this code?)

*** trunk/src/xdisp.c.~1.1213.~	2008-05-24 18:34:24.000000000 -0400
--- trunk/src/xdisp.c	2008-05-24 21:25:06.000000000 -0400
***************
*** 19928,19933 ****
--- 19928,19934 ----
    else
      x_reached = x;
  
+ #if 0
    /* If there are any glyphs with lbearing < 0 or rbearing > width in
       the row, redraw some glyphs in front or following the glyph
       strings built above.  */
***************
*** 20015,20020 ****
--- 20016,20022 ----
  	    s->clip_tail = clip_tail;
  	  }
      }
+ #endif
  
    /* Draw all strings.  */
    for (s = head; s; s = s->next)




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

* Re: Mouse highlighting and fonts
  2008-05-25  2:01   ` Chong Yidong
@ 2008-05-25  4:46     ` YAMAMOTO Mitsuharu
  2008-05-25  8:21       ` Gerd Möllmann
  2008-05-27  8:58     ` Johan Bockgård
  1 sibling, 1 reply; 9+ messages in thread
From: YAMAMOTO Mitsuharu @ 2008-05-25  4:46 UTC (permalink / raw)
  To: Chong Yidong; +Cc: gerd, emacs-devel

>>>>> On Sat, 24 May 2008 22:01:21 -0400, Chong Yidong <cyd@stupidchicken.com> said:

> According to the comments, this code is supposed to redraw glyphs
> that are overwritten because of the left/right overhang of the
> specified glyph string.  But I've never noticed overlapping glyphs
> in Emacs.  Under what circumstances can overlapping glyphs occur?

An italic glyph usually overlaps with the next one.

> In other words, would there be any effect from simply turning off
> the overlap-compensation code, as indicated?  Anyone know?

It is the very most essential part to display italic glyphs without
chipping.  You can try M-x list-faces-display RET and move the cursor
on the characters in italic face.

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




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

* Re: Mouse highlighting and fonts
  2008-05-25  4:46     ` YAMAMOTO Mitsuharu
@ 2008-05-25  8:21       ` Gerd Möllmann
  0 siblings, 0 replies; 9+ messages in thread
From: Gerd Möllmann @ 2008-05-25  8:21 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: Chong Yidong, gerd, emacs-devel

> It is the very most essential part to display italic glyphs without
> chipping.

Yes, that's correct.

If you check Emacs versions < 21, you'll find that
text using slanted fonts was effectively impossible to edit because
overlapping parts of slanted characters were clipped und the
display was effectively garbled after a few such operations.




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

* Re: Mouse highlighting and fonts
  2008-05-23 19:53 ` Chong Yidong
  2008-05-24 23:02   ` Stephen Berman
  2008-05-25  2:01   ` Chong Yidong
@ 2008-05-27  3:26   ` Chong Yidong
  2008-05-27 13:24     ` Stephen Berman
  2 siblings, 1 reply; 9+ messages in thread
From: Chong Yidong @ 2008-05-27  3:26 UTC (permalink / raw)
  To: emacs-devel

Chong Yidong <cyd@stupidchicken.com> writes:

> BTW, another mouse-highlighting bug I reported earlier is still present.
> Under certain circumstances, the area to the left and/or right of the
> physical cursor doesn't acquire the proper mouse-face.
>
> This appears to be a long-standing bug, but one that didn't show up
> until the new font code.  That's because it arises as follows: when the
> cursor glyph has a nonzero lbearing or rbearing (i.e., it overlaps with
> its neighbors), the neighboring glyphs are redrawn, and this can
> overwrite the mouse-face highlight.  See xdisp.c:19934.  This didn't
> show up because previously, overlapping glyphs were generally not
> encountered.
>
> I'll try to fix this once I get the time, unless someone else fixes it
> first.

I've checked in a rough fix into CVS.  It turns out that fixing this
properly is non-trivial, due to limitations in the way the glyph-drawing
code.  I think the fix handles most (all?)  situations likely to happen
in practice.  It might lead to incorrect highlighting if a glyph's
overhang is large enough to overlap two or more neighboring glyphs, and
not all those glyphs are mouse-highlighted, but I can't find a test-case
that demonstrates this.

There is a remaining related bug: when the cursor falls inside a
mouse-highlighted block, its foreground is sometimes drawn incorrectly.
I think this is a bug elsewhere in the code, possibly related to the
incorrect drawing of glyphs that I've noticed in other contexts
unrelated to mouse highlighting.  Currently I have no idea what causes
this.

Other than that, if anyone still has problems with mouse highlighting,
please holler.




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

* Re: Mouse highlighting and fonts
  2008-05-25  2:01   ` Chong Yidong
  2008-05-25  4:46     ` YAMAMOTO Mitsuharu
@ 2008-05-27  8:58     ` Johan Bockgård
  1 sibling, 0 replies; 9+ messages in thread
From: Johan Bockgård @ 2008-05-27  8:58 UTC (permalink / raw)
  To: emacs-devel

Chong Yidong <cyd@stupidchicken.com> writes:

> Chong Yidong <cyd@stupidchicken.com> writes:
>
>> when the cursor glyph has a nonzero lbearing or rbearing (i.e., it
>> overlaps with its neighbors), the neighboring glyphs are redrawn, and
>> this can overwrite the mouse-face highlight.  See xdisp.c:19934.
>
> According to the comments, this code is supposed to redraw glyphs that
> are overwritten because of the left/right overhang of the specified
> glyph string.  But I've never noticed overlapping glyphs in Emacs.
> Under what circumstances can overlapping glyphs occur?

See the thread pointed to by Stephen,

http://thread.gmane.org/gmane.emacs.devel/88763

> In other words, would there be any effect from simply turning off the
> overlap-compensation code, as indicated?  Anyone know?

I had quite good results from adding `&& hl == DRAW_NORMAL_TEXT' to the
conditional.

-- 
Johan Bockgård





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

* Re: Mouse highlighting and fonts
  2008-05-27  3:26   ` Chong Yidong
@ 2008-05-27 13:24     ` Stephen Berman
  0 siblings, 0 replies; 9+ messages in thread
From: Stephen Berman @ 2008-05-27 13:24 UTC (permalink / raw)
  To: emacs-devel

On Mon, 26 May 2008 23:26:56 -0400 Chong Yidong <cyd@stupidchicken.com> wrote:

> Chong Yidong <cyd@stupidchicken.com> writes:
>
>> BTW, another mouse-highlighting bug I reported earlier is still present.
>> Under certain circumstances, the area to the left and/or right of the
>> physical cursor doesn't acquire the proper mouse-face.
>>
>> This appears to be a long-standing bug, but one that didn't show up
>> until the new font code.  That's because it arises as follows: when the
>> cursor glyph has a nonzero lbearing or rbearing (i.e., it overlaps with
>> its neighbors), the neighboring glyphs are redrawn, and this can
>> overwrite the mouse-face highlight.  See xdisp.c:19934.  This didn't
>> show up because previously, overlapping glyphs were generally not
>> encountered.
>>
>> I'll try to fix this once I get the time, unless someone else fixes it
>> first.
>
> I've checked in a rough fix into CVS.

This fixes the bugs I reported, referenced in this thread.  Thanks!

Steve Berman





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

end of thread, other threads:[~2008-05-27 13:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-23 15:09 Mouse highlighting and fonts Chong Yidong
2008-05-23 19:53 ` Chong Yidong
2008-05-24 23:02   ` Stephen Berman
2008-05-25  2:01   ` Chong Yidong
2008-05-25  4:46     ` YAMAMOTO Mitsuharu
2008-05-25  8:21       ` Gerd Möllmann
2008-05-27  8:58     ` Johan Bockgård
2008-05-27  3:26   ` Chong Yidong
2008-05-27 13:24     ` Stephen Berman

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.