emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list


From: Eli Zaretskii
Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048).
Date: Wed, 02 Mar 2011 20:51:08 +0200

> From: Stefan Monnier <address@hidden>
> Cc: address@hidden,  address@hidden
> Date: Wed, 02 Mar 2011 12:03:18 -0500
> 
> > Would it help to have a primitive that returns the width in pixels
> > that a given buffer substring would take on the screen?
> 
> Not if we want it to work without knowing the window (and hence
> terminal) on which the buffer is going to be displayed (i.e. the
> computation should be done by the redisplay, the buffer data needs to be
> agnostic to the font used).

Sorry, I'm not following.

On a TTY, each character is a single pixel and all characters have the
same width.  So calculating this for a TTY display is trivial.

On a GUI display, the calculation cannot be easily done in Lisp,
without actually displaying the text, but should be fairly easy to
implement in C, using the move_it_* family of functions; they are
already used internally by redisplay, precisely for these purposes: to
traverse glyphs generated for display without actually displaying
them.  Font information (and everything else that is pertinent to
displaying text) is already present in the buffer and the associated
data structures (faces, text properties, overlays, etc.).  What the
window's got to do with this, I'm unclear; perhaps I'm missing
something.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]