After thinking about it, I am wondering if the current behavior of 'window-lines-pixel-dimensions' is correct ?
As user of the function I do not expect the function to count glyphs that are inserted by redisplay only "for its own purpose",
glyphs that are invisible and non-existent for the end user.
IMHO, for an empty line, 'window-lines-pixel-dimensions' should return the width 0.
A line with X characters should have the width of all thoses characters.
I see that 'window-largest-empty-rectangle' uses this function, the widths of the rectangles it returns are smaller than they really are.
I think it makes sense to change this behavior and make 'window-lines-pixel-dimensions' not counting these "redisplay only" glyphs.
Thus, there would be no need for a new argument to the function.
> Agreed. Sébastien can you try to show "that using the glyph matrices
> is much faster"?
I tested the following code:
(defmacro time (&rest forms)
(let ((t1 (make-symbol "t1")))
(setq ,t1 (current-time))
(float-time (time-since ,t1)))))
(defun test1 nil
(window-lines-pixel-dimensions nil nil nil t))
(defun test2 nil
(let ((index 1)
(while (<= index height)
(window-text-pixel-size nil (line-beginning-position index) (line-end-position index))
(setq index (1+ index))
`(time (test1))` returns 0.000004869
`(time (test2))` returns 0.00376