So let me see if I understand the issue. You want to create in a
child frame a display such as below:
<icon1><candidate1> <Type1>
<icon2><longer-name-candidate> <AnotherType>
...
And you want to do it in a way that all the "Type"s are aligned to the
right (i.e. end at the right edge of the frame), no matter what is
shown in the <icon>s and in the <candidate>s, which could be of
different width and could include characters of different fonts and
even images/emoji. Is that correct, or is there something else?
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.