Function: preview-pdf-color-string

preview-pdf-color-string is a byte-compiled function defined in preview.el.

Signature

(preview-pdf-color-string COLORS)

Documentation

Return a string that patches PDF foreground color to work properly.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/preview.el
(defun preview-pdf-color-string (colors)
  "Return a string that patches PDF foreground color to work properly."
  (let ((fg (aref colors 1)))
    (if fg
        (cond ((eq preview-pdf-color-adjust-method t)
               ;; New code for gs > 9.27.
               ;; This assumes DELAYBIND feature, which is known to be
               ;; broken in gs 9.27 (and possibly, < 9.27).
               ;; <URL:https://lists.gnu.org/archive/html/auctex-devel/2019-07/msg00000.html>
               ;; DELAYBIND is sometimes mentioned in association with
               ;; security holes in the changelog of Ghostscript:
               ;; <URL:https://www.ghostscript.com/doc/9.27/History9.htm>
               ;; Thus we might have to be prepared for removal of this
               ;; feature in future Ghostscript.
               (concat
                "/initgraphics {
  //initgraphics
  /RG where {
    pop "
                (mapconcat #'preview-gs-color-value fg " ")
                " 3 copy rg RG
  } if
} bind def .bindnow "))
              ((eq preview-pdf-color-adjust-method 'compatible)
               ;; Traditional code for gs < 9.27.
               (concat
                "/GS_PDF_ProcSet GS_PDF_ProcSet dup maxlength dict copy dup begin\
/graphicsbeginpage{//graphicsbeginpage exec "
                (mapconcat #'preview-gs-color-value fg " ")
                " 3 copy rg RG}bind store end readonly store "))
              (;; Do nothing otherwise.
               t
               "")))))