org.el: Fix XEmacs compatibility bug when creating images.

* org.el (org-create-formula-image, org-dvipng-color): Fix
XEmacs compatibility bug.

TINYCHANGE

Thanks to Uwe Brauer for this patch.
This commit is contained in:
Bastien Guerry 2012-03-16 18:55:41 +01:00
parent 0dcd83d3b2
commit 150e2db668

View file

@ -16988,7 +16988,7 @@ inspection."
(dvifile (concat texfilebase ".dvi"))
(pngfile (concat texfilebase ".png"))
(fnh (if (featurep 'xemacs)
(font-height (get-face-font 'default))
(font-height (face-font 'default))
(face-attribute 'default :height nil)))
(scale (or (plist-get options (if buffer :scale :html-scale)) 1.0))
(dpi (number-to-string (* scale (floor (* 0.9 (if buffer fnh 140.))))))
@ -17017,13 +17017,19 @@ inspection."
(if (not (file-exists-p dvifile))
(progn (message "Failed to create dvi file from %s" texfile) nil)
(condition-case nil
(call-process "dvipng" nil nil nil
(if (featurep 'xemacs)
(call-process "dvipng" nil nil nil
"-fg" fg "-bg" bg
"-D" dpi
;;"-x" scale "-y" scale
"-T" "tight"
"-o" pngfile
dvifile)
(call-process "dvipng" nil nil nil
"-fg" fg "-bg" bg
"-D" dpi
;;"-x" scale "-y" scale
"-T" "tight"
"-o" pngfile
dvifile))
(error nil))
(if (not (file-exists-p pngfile))
(if org-format-latex-signal-error
@ -17099,7 +17105,12 @@ SNIPPETS-P indicates if this is run to create snippet images for HTML."
"Return an rgb color specification for dvipng."
(apply 'format "rgb %s %s %s"
(mapcar 'org-normalize-color
(color-values (face-attribute 'default attr nil)))))
(if (featurep 'xemacs)
(color-rgb-components
(face-property 'default
(cond ((eq attr :foreground) 'foreground)
((eq attr :background) 'background))))
(color-values (face-attribute 'default attr nil))))))
(defun org-normalize-color (value)
"Return string to be used as color value for an RGB component."