unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#1254: 23.0.60; linum-mode display problem with variable-pitch font
@ 2008-10-25 19:33 Stephen Berman
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Berman @ 2008-10-25 19:33 UTC (permalink / raw)
  To: emacs-pretest-bug

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

1. emacs -Q
2. C-SPC M-< M-w C-y C-y C-y (copy the *scratch* text so the buffer has
more than ten lines)
3. M-x variable-pitch-mode
4. M-x linum-mode

=> The rightmost digits in the double digit line numbers are partly cut
off and the single digit line numbers do not align with the rightmost
digit of the double digit numbers (as they do with monospaced fonts),
but are aligned between the two digits, see the attached image.

When I start Emacs with -Q and invoke variable-pitch-mode, the font used
is this: 
xft:-monotype-Albany AMT-normal-normal-normal-*-16-*-*-*-*-0-iso10646-1 (#x45)

In GNU Emacs 23.0.60.12 (i686-pc-linux-gnu, GTK+ Version 2.12.9) of
2008-10-25 on escher.

Steve Berman


[-- Attachment #2: variable-pitch line numbers --]
[-- Type: image/png, Size: 2219 bytes --]

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

* bug#1254: 23.0.60; linum-mode display problem with variable-pitch font
@ 2008-10-27 21:58 Chong Yidong
  2008-10-28 12:30 ` Markus Triska
  0 siblings, 1 reply; 8+ messages in thread
From: Chong Yidong @ 2008-10-27 21:58 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 1254, Markus Triska

> 1. emacs -Q
> 2. C-SPC M-< M-w C-y C-y C-y (copy the *scratch* text so the buffer has
> more than ten lines)
> 3. M-x variable-pitch-mode
> 4. M-x linum-mode
>
> The rightmost digits in the double digit line numbers are partly cut off

Currently, Emacs assumes that the pixel width of the left margin is
simply the width of the left margin, in character glyphs, times the
default width of a glyph in pixels.  This assumption obviously runs into
problems if you display a variable-width font in the left margin.

Fixing this in redisplay is not easy, and at this stage of the release
process I'd prefer not to touch that part of the code.  (For instance,
we can't just let the left margin have an arbitrary pixel width, because
window resizing assumes otherwise.)

I suggest a workaround: make the `linum' face inherit the face
"fixed-pitch".  Markus, WDYT?






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

* bug#1254: 23.0.60; linum-mode display problem with variable-pitch font
  2008-10-27 21:58 bug#1254: 23.0.60; linum-mode display problem with variable-pitch font Chong Yidong
@ 2008-10-28 12:30 ` Markus Triska
  2008-10-28 14:38   ` Stefan Monnier
       [not found]   ` <mailman.2269.1225205413.25473.bug-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Markus Triska @ 2008-10-28 12:30 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 1254, Stephen Berman

Chong Yidong <cyd@stupidchicken.com> writes:

> I suggest a workaround: make the `linum' face inherit the face
> "fixed-pitch".  Markus, WDYT?

I cannot reproduce the problem with X11 on OSX and thus cannot test
this. Would it work to interpret the margin width in terms of the
broadest glyph in a font, so other packages would benefit too?






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

* bug#1254: 23.0.60; linum-mode display problem with variable-pitch font
  2008-10-28 12:30 ` Markus Triska
@ 2008-10-28 14:38   ` Stefan Monnier
  2008-10-28 17:29     ` Chong Yidong
       [not found]   ` <mailman.2269.1225205413.25473.bug-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2008-10-28 14:38 UTC (permalink / raw)
  To: Markus Triska; +Cc: 1254, Chong Yidong, Stephen Berman

> I cannot reproduce the problem with X11 on OSX and thus cannot test
> this. Would it work to interpret the margin width in terms of the
> broadest glyph in a font, so other packages would benefit too?

Not only that's not really possible with the current code's limitations,
but it would also be a bad idea: in most fonts the widest glyph is
pretty hideously wide, so you'd end up with margins that are much
too wide.


        Stefan







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

* bug#1254: 23.0.60; linum-mode display problem with variable-pitch font
       [not found]   ` <mailman.2269.1225205413.25473.bug-gnu-emacs@gnu.org>
@ 2008-10-28 15:45     ` Markus Triska
  0 siblings, 0 replies; 8+ messages in thread
From: Markus Triska @ 2008-10-28 15:45 UTC (permalink / raw)
  To: gnu-emacs-bug

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> in most fonts the widest glyph is pretty hideously wide, so you'd end
> up with margins that are much too wide.

I see; if all text displayed in the margins need to use fixed-width
fonts currently to guarantee that all glyphs are still visible, it seems
it can be done by the engine instead of changing all affected packages.







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

* bug#1254: 23.0.60; linum-mode display problem with variable-pitch font
  2008-10-28 14:38   ` Stefan Monnier
@ 2008-10-28 17:29     ` Chong Yidong
  2008-10-28 17:35       ` Markus Triska
  2008-10-28 19:19       ` Stefan Monnier
  0 siblings, 2 replies; 8+ messages in thread
From: Chong Yidong @ 2008-10-28 17:29 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 1254, Stephen Berman, Markus Triska

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I cannot reproduce the problem with X11 on OSX and thus cannot test
>> this. Would it work to interpret the margin width in terms of the
>> broadest glyph in a font, so other packages would benefit too?
>
> Not only that's not really possible with the current code's limitations,
> but it would also be a bad idea: in most fonts the widest glyph is
> pretty hideously wide, so you'd end up with margins that are much
> too wide.

I looked at this some more.  Apparently, the workaround of making the
linum face fixed pitch doesn't work, because the margin width always
uses the default glyph width.  Apparently, the default glyph width is
too narrow when using some variable-pitch fonts (in my case, DejaVu
Sans).

I don't know any completely satisfactory way to resolve this.  One
possible workaround is for linume.el to provide an option to add an
extra column to the margin width.






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

* bug#1254: 23.0.60; linum-mode display problem with variable-pitch font
  2008-10-28 17:29     ` Chong Yidong
@ 2008-10-28 17:35       ` Markus Triska
  2008-10-28 19:19       ` Stefan Monnier
  1 sibling, 0 replies; 8+ messages in thread
From: Markus Triska @ 2008-10-28 17:35 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 1254, Stephen Berman

Chong Yidong <cyd@stupidchicken.com> writes:

> I don't know any completely satisfactory way to resolve this.  One
> possible workaround is for linume.el to provide an option to add an
> extra column to the margin width.

I think that's not necessary: You can get almost the same effect with:

   (setq linum-format "%d ")






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

* bug#1254: 23.0.60; linum-mode display problem with variable-pitch font
  2008-10-28 17:29     ` Chong Yidong
  2008-10-28 17:35       ` Markus Triska
@ 2008-10-28 19:19       ` Stefan Monnier
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2008-10-28 19:19 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 1254, Stephen Berman, Markus Triska

> I don't know any completely satisfactory way to resolve this.  One
> possible workaround is for linume.el to provide an option to add an
> extra column to the margin width.

Maybe the margin size could be set to `auto' in which case the size is
dynamically auto-adjusted during redisplay so that the text displayed in
the margin fits.  It sounds difficult, tho.


        Stefan






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

end of thread, other threads:[~2008-10-28 19:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-27 21:58 bug#1254: 23.0.60; linum-mode display problem with variable-pitch font Chong Yidong
2008-10-28 12:30 ` Markus Triska
2008-10-28 14:38   ` Stefan Monnier
2008-10-28 17:29     ` Chong Yidong
2008-10-28 17:35       ` Markus Triska
2008-10-28 19:19       ` Stefan Monnier
     [not found]   ` <mailman.2269.1225205413.25473.bug-gnu-emacs@gnu.org>
2008-10-28 15:45     ` Markus Triska
  -- strict thread matches above, loose matches on Subject: below --
2008-10-25 19:33 Stephen Berman

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