it contains.
@defun window-text-pixel-size &optional window from to x-limit y-limit mode-lines ignore-line-at-end
-This function returns the size of the text of @var{window}'s buffer in
+This function returns the dimensions of the text of @var{window}'s buffer in
pixels. @var{window} must be a live window and defaults to the
selected one. The return value is a cons of the maximum pixel-width
of any text line and the maximum pixel-height of all text lines. This
@defun string-pixel-width string
This is a convenience function that uses @code{window-text-pixel-size}
-to compute the width of @var{string} (in pixels).
+to compute the width of @var{string} (in pixels). Caveat: if you call
+this function to measure the width of a string with embedded newlines,
+it will then return the width of the widest substring that does not
+include newlines. The meaning of this result is the widest line taken
+by the string if inserted into a buffer.
@end defun
@defun line-pixel-height
;;;###autoload
(defun string-pixel-width (string)
- "Return the width of STRING in pixels."
+ "Return the width of STRING in pixels.
+
+If you call this function to measure pixel width of a string
+with embedded newlines, it returns the width of the widest
+substring that does not include newlines."
(declare (important-return-value t))
(if (zerop (length string))
0
}
DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_size, 0, 7, 0,
- doc: /* Return the size of the text of WINDOW's buffer in pixels.
+ doc: /* Return the dimensions of the text of WINDOW's buffer in pixels.
WINDOW must be a live window and defaults to the selected one. The
return value is a cons of the maximum pixel-width of any text line and
the pixel-height of all the text lines in the accessible portion of
}
DEFUN ("buffer-text-pixel-size", Fbuffer_text_pixel_size, Sbuffer_text_pixel_size, 0, 4, 0,
- doc: /* Return size of whole text of BUFFER-OR-NAME in WINDOW.
+ doc: /* Return the dimensions of whole text of BUFFER-OR-NAME in WINDOW.
BUFFER-OR-NAME must specify a live buffer or the name of a live buffer
and defaults to the current buffer. WINDOW must be a live window and
defaults to the selected one. The return value is a cons of the maximum