[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Truncate string to a given width in proportional font
From: |
Stefan Monnier |
Subject: |
Re: Truncate string to a given width in proportional font |
Date: |
Sat, 31 Dec 2005 11:56:21 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> OK, thanks. I can get part way to what I want by truncating to N
> *characters*, which will definitely fit into a column aligned to N
> characters wide (as :align-to uses the maximum character width to
> convert, AFAICT). And with a bit of guesswork and approximation, I can
> get something good enough.
> I couldn't even find a way to check the rendered length of a string in
> a proportional font (in pixels or whatever). Is that right?
Yes, that's right.
There is a lot of missing functionality in this area.
In Emacs-22 you will be able to kludge some things up using posn-at-x-y and
posn-at-point which allows you to translate buffer positions into screen
positions and vice-versa (but only for displayed parts of the buffer).
I.e. for displayed text, you can sometimes compute its rendered length in
pixels (as long as it didn't get line-wrapped or something).
Stefan