emacs-devel
[Top][All Lists]
Advanced

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

Re: on helm substantial differences


From: Juri Linkov
Subject: Re: on helm substantial differences
Date: Sun, 22 Nov 2020 22:11:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> 𒐫    CUNEIFORM NUMERIC SIGN NINE SHAR2
>
> On GUI frames, this depends on the font in use.  You cannot really
> rely on char-width to solve this.
>
>> Maybe there is another function that could return the real number of
>> tab columns a character takes on the screen?
>
> There is: font-get-glyphs.  But I'd recommend to just use a TAB of a
> suitable width instead of dealing with the complexity that
> font-get-glyphs requires.

I can't find a suitable width for TAB: 5 makes a too wide gap between
a character and its name, and with 4 some characters are misaligned.

But despite the complexity of font-get-glyphs, is it reasonably fast?

I tried to rely on next-line that moves to the beginning of the line
on the character wider that a previous character on the previous line,
and keep increasing the current column while moving over all character lines:

(with-temp-buffer
  (dotimes (c (max-char))
    (insert c ?\n))
  (insert "1234567890\n")
  (goto-char (point-min))
  (dotimes (c (max-char))
    (when (bolp) (forward-char))
    (next-line))
  (current-column))

But it takes too much time on all characters.



reply via email to

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