1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 18:40:39 -08:00

Add new function buffer-text-pixel-size

* doc/lispref/display.texi (Size of Displayed Text): Document it.

* lisp/emacs-lisp/subr-x.el (string-pixel-width): Use
buffer-text-pixel-size (bug#51995).

* src/xdisp.c (window_text_pixel_size): Factor out from
Fwindow_text_pixel_size.
(Fbuffer_text_pixel_size): New function.
This commit is contained in:
martin rudalics 2021-11-22 12:02:35 +01:00 committed by Lars Ingebrigtsen
parent c7699b9702
commit 61c254cafc
4 changed files with 152 additions and 70 deletions

View file

@ -446,8 +446,7 @@ is inserted before adjusting the number of empty lines."
"Return the width of STRING in pixels."
(with-temp-buffer
(insert string)
(car (window-text-pixel-size
(current-buffer) (point-min) (point)))))
(car (buffer-text-pixel-size nil nil t))))
;;;###autoload
(defun string-glyph-split (string)