changeset 413:368a86a179ff dev

The variable YaTeX::get-boundingbox-cmd added
author HIROSE Yuuji <yuuji@gentei.org>
date Wed, 08 Jul 2015 09:16:35 +0900
parents b899adfd0879
children 0863123199f0 1ab1b9ba8698
files yatexadd.el
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/yatexadd.el	Fri Feb 13 20:42:31 2015 +0900
+++ b/yatexadd.el	Wed Jul 08 09:16:35 2015 +0900
@@ -1,6 +1,6 @@
 ;;; yatexadd.el --- YaTeX add-in functions -*- coding: sjis -*-
 ;;; (c)1991-2015 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Fri Jan 16 14:57:59 2015 on firestorm
+;;; Last modified Wed Jul  8 09:15:15 2015 on firestorm
 ;;; $Id$
 
 ;;; Code:
@@ -1945,12 +1945,22 @@
     (if (string= "" str) ""
       (concat "[" str "]"))))
 
+(defvar YaTeX::get-boundingbox-cmd YaTeX-cmd-gs
+  "Command to get bounding box from PDF files.
+Possible values are `gs' and `extractbb'.")
+
 (defun YaTeX::get-boundingbox (file)
   "Return the bound box as a string
 This function relies on gs(ghostscript) command installed."
   (let ((str (YaTeX-command-to-string
-	      (format "%s -sDEVICE=bbox -dBATCH -dNOPAUSE %s"
-		      YaTeX-cmd-gs file))))
+	      (format
+	       (cond
+		((string-match "extractbb" YaTeX::get-boundingbox-cmd)
+		 "%s -O %s")
+		((string-match "gs" YaTeX::get-boundingbox-cmd)
+		 "%s -sDEVICE=bbox -dBATCH -dNOPAUSE %s")
+		(t "echo %s %s"))
+	       YaTeX::get-boundingbox-cmd file))))
     (if (string-match
 	 "%%BoundingBox:\\s \\([0-9]+\\s [0-9]+\\s [0-9]+\\s [0-9]+\\)"
 	 str)

yatex.org