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: Tom Tromey
Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048).
Date: Fri, 04 Mar 2011 10:49:43 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

>>>>> "martin" == martin rudalics <address@hidden> writes:

>> Would it help to have a primitive that returns the width in pixels
>> that a given buffer substring would take on the screen?

martin> Not really.  But in general, a primitive that returned the displayed
martin> pixel height/width of a substring of any buffer line for some given
martin> window would be great.  Actually, it would be nice if redisplay could
martin> cache these values on demand for each line it (virtually) displayed.

FWIW, for my scenario it would be sufficient if this was doable in a
display property.

For my presentation program, I would like to be able to center some
text.  I'd like to do this in the display spec, so that I don't have to
write code to do anything special if, say, the user changes the font or
the text, or resizes the frame, during the presentation.

I don't think this is doable today.  One way would be to allow a string
in a pixel specification, and take that to mean the pixel width of the
string using the font/etc of the propertized character.

That is:

    (insert (propertize " " 'display '(space (- center (0.5 . "the text"))))
            "the text")

Tom



reply via email to

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