emacs-devel
[Top][All Lists]
Advanced

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

Re: Need `truncate-string-to-pixel-width` and `glyph-pixel-width` functi


From: Eli Zaretskii
Subject: Re: Need `truncate-string-to-pixel-width` and `glyph-pixel-width` functions in C
Date: Thu, 24 Oct 2024 17:39:57 +0300

> From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
> Date: Thu, 24 Oct 2024 15:26:46 +0100
> Cc: emacs-devel@gnu.org
> 
>  If the above is what you want, and since the popup is actually a
>  frame, my first suggestion would be to use :align-to display property
>  on the whitespace between the <candidate>s and the <Type>s.  Did you
>  try that?
> 
>  The advantage of :align-to is that you don't have to measure the
>  pixel-width of the candidate names, only the pixel-width of each
>  <Type> string (to correctly set up the offset from the right edge of
>  the text area) -- the rest will be done by the display engine.  And
>  the display engine always does everything in pixel resolution.
> 
> The current implementation wraps every line with some additional margin and a 
> custom thin scrollbar after
> formatting, both are propertized strings with a display space property, 
> before giving the final result to a buffer
> and then the child frame. Letting the windowing system to do truncation will 
> truncate off the custom scrollbar
> and margin first, in addition to breaking an existing API that downstream 
> extension packages rely on and
> being a much larger refactoring that will bring forth the much thicker and 
> intrusive default Emacs scroll bars.
> Otherwise, this will work.

If the scroll bar and the margin are generated programmatically, then
presumably the program which creates them knows their width, or can
calculate that?  If so, the :align-to value should take that into
consideration.

(Assuming I understood what you were describing.)



reply via email to

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