Function: preview-ascent-from-bb

preview-ascent-from-bb is a byte-compiled function defined in preview.el.

Signature

(preview-ascent-from-bb BB)

Documentation

This calculates the image ascent from its bounding box.

The bounding box BB needs to be a 4-component vector of numbers (can be float if available).

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/preview.el
(defun preview-ascent-from-bb (bb)
  "This calculates the image ascent from its bounding box.
The bounding box BB needs to be a 4-component vector of
numbers (can be float if available)."
  ;; baseline is at 1in from the top of letter paper (11in), so it is
  ;; at 10in from the bottom precisely, which is 720 in PostScript
  ;; coordinates.  If our bounding box has its bottom not above this
  ;; line, and its top above, we can calculate a useful ascent value.
  ;; If not, something is amiss.  We just use 100 in that case.

  (let ((bottom (aref bb 1))
        (top (aref bb 3)))
    (if (and (<= bottom 720)
             (> top 720))
        (round (* 100.0 (/ (- top 720.0) (- top bottom))))
      100)))