1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-25 05:52:42 -08:00

; calc: Improve alignment for Unicode strings

With higher values of 'calc-string-maximum-character' the
string length can differ from the displayed width.  Calculate
alignment offsets based on the the display width, rounded up to
the nearest integer.  Refines feature introduced in bug#78528.
* lisp/calc/calccomp.el (math-comp-width): Replace 'length' with
a ratio of 'string-pixel-width's.
This commit is contained in:
Jacob S. Gordon 2026-01-09 16:21:00 -05:00 committed by Eli Zaretskii
parent bd96450a09
commit b233ca80e9

View file

@ -1656,7 +1656,11 @@ Not all brackets have midpieces.")
((memq (car c) '(set break)) t)))
(defun math-comp-width (c)
(cond ((not (consp c)) (length c))
(cond ((not (consp c))
(or (and (stringp c)
(ceiling (string-pixel-width c)
(string-pixel-width "-")))
(length c)))
((memq (car c) '(horiz subscr supscr))
(let ((accum 0))
(while (setq c (cdr c))