to compute the width of @var{string} (in pixels).
@end defun
-@defun window-char-pixel-width &optional window face
-Return the average character width for the font used by @var{face} in
-@var{window}. If @var{face} is @code{nil} or omitted, the
-@code{default} face is used. If @var{windows} is @code{nil} or
-omitted, the currently selected window is used.
-@end defun
-
-@defun window-char-pixel-height &optional window face
-Return the average character height for the font used by @var{face} in
-@var{window}. If @var{face} is @code{nil} or omitted, the
-@code{default} face is used. If @var{windows} is @code{nil} or
-omitted, the currently selected window is used.
-@end defun
-
@defun line-pixel-height
This function returns the height in pixels of the line at point in the
selected window. The value includes the line spacing of the line
argument @var{round} behaves as it does for @code{window-total-height}.
@end defun
-@defun window-max-characters-per-line &optional window face
-The maximum width of a line that can be displayed in a window (without
-breaking the line) depends on many things, like the font used on the
-line, and whether there are fringes around the window. This
-convenience function can be used to calculate that number. If
-@var{window} isn't given, this defaults to the currently selected
-window. if @var{var} isn't given, the @code{default} face is used.
-@end defun
-
@defun window-total-size &optional window horizontal round
This function returns either the total height in lines or the total
width in columns of the window @var{window}. If @var{horizontal} is
this for packages that don't use 'tooltip-show', but instead call the
lower level function directly.
-+++
-** New function 'window-max-characters-per-line'.
-
-+++
-** New function 'window-char-pixel-width'.
-
---
** New function 'current-cpu-time'.
It gives access to the CPU time used by the Emacs process, for
to zero) makes Emacs reserve one column of the window body to
display a line continuation marker. (This happens for both the
left and right fringe, since Emacs can display both left-to-right
-and right-to-left text.) You can use `window-max-characters-per-line'
+and right-to-left text.) You can use `window-max-chars-per-line'
to check the effective width.
Fringe widths set by `set-window-fringes' override the default
(put 'shrink-window-horizontally 'repeat-map 'resize-window-repeat-map)
(put 'shrink-window 'repeat-map 'resize-window-repeat-map)
-(defun window-char-pixel-width (&optional window face)
- "Return average character width for the font of FACE used in WINDOW.
-WINDOW must be a live window and defaults to the selected one.
-
-If FACE is nil or omitted, the default face is used. If FACE is
-remapped (see `face-remapping-alist'), the function returns the
-information for the remapped face."
- (with-selected-window (window-normalize-window window t)
- (let* ((info (font-info (face-font (or face 'default))))
- (width (aref info 11)))
- (if (> width 0)
- width
- (aref info 10)))))
-
-(defun window-char-pixel-height (&optional window face)
- "Return character height for the font of FACE used in WINDOW.
-WINDOW must be a live window and defaults to the selected one.
-
-If FACE is nil or omitted, the default face is used. If FACE is
-remapped (see `face-remapping-alist'), the function returns the
-information for the remapped face."
- (with-selected-window (window-normalize-window window t)
- (aref (font-info (face-font (or face 'default))) 3)))
-
-(defun window-max-characters-per-line (&optional window face)
- "Return the number of characters that can be displayed on one line in WINDOW.
-WINDOW must be a live window and defaults to the selected one.
-
-The character width of FACE is used for the calculation. If FACE
-is nil or omitted, the default face is used. If FACE is
-remapped (see `face-remapping-alist'), the function uses the
-remapped face.
-
-This function is different from `window-body-width' in two
-ways. First, it accounts for the portions of the line reserved
-for the continuation glyph. Second, it accounts for the size of
-the font, which may have been adjusted, e.g., using
-`text-scale-increase')."
- (with-selected-window (window-normalize-window window t)
- (let* ((window-width (window-body-width window t))
- (font-width (window-char-pixel-width window face))
- (ncols (/ window-width font-width)))
- (if (and (display-graphic-p)
- overflow-newline-into-fringe
- (/= (frame-parameter nil 'left-fringe) 0)
- (/= (frame-parameter nil 'right-fringe) 0))
- ncols
- (1- ncols)))))
-
(provide 'window)
;;; window.el ends here
Note that the returned value includes the column reserved for the
continuation glyph.
-Also see `window-max-characters-per-line'. */)
+Also see `window-max-chars-per-line'. */)
(Lisp_Object window, Lisp_Object pixelwise)
{
return make_fixnum (window_body_width (decode_live_window (window),