Function: line-pixel-height

line-pixel-height is a function defined in xdisp.c.

Signature

(line-pixel-height)

Documentation

Return height in pixels of text line in the selected window.

Value is the height in pixels of the line at point.

View in manual

Source Code

// Defined in /usr/src/emacs/src/xdisp.c
{
  struct it it;
  struct text_pos pt;
  struct window *w = XWINDOW (selected_window);
  struct buffer *old_buffer = NULL;
  Lisp_Object result;

  if (XBUFFER (w->contents) != current_buffer)
    {
      old_buffer = current_buffer;
      set_buffer_internal_1 (XBUFFER (w->contents));
    }
  SET_TEXT_POS (pt, PT, PT_BYTE);
  void *itdata = bidi_shelve_cache ();
  start_display (&it, w, pt);
  /* Start from the beginning of the screen line, to make sure we
     traverse all of its display elements, and thus capture the
     correct metrics.  */
  move_it_by_lines (&it, 0);
  it.vpos = it.current_y = 0;
  last_height = 0;
  result = make_fixnum (line_bottom_y (&it));
  if (old_buffer)
    set_buffer_internal_1 (old_buffer);

  bidi_unshelve_cache (itdata, false);
  return result;
}