]> git.lyx.org Git - lyx.git/blobdiff - lib/scripts/lyxpreview2bitmap.py
Introduce inset parameters keepempty, freespacing, needprotect and rename verbatim...
[lyx.git] / lib / scripts / lyxpreview2bitmap.py
index 3d3569e59b499bbc15b6d36869e08783863a8753..b629b15231934dc0e582be6ca0d10e0d76906255 100755 (executable)
@@ -1,5 +1,5 @@
 #! /usr/bin/env python
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
 
 # file lyxpreview2bitmap.py
 # This file is part of LyX, the document processor.
@@ -8,7 +8,7 @@
 # author Angus Leeming
 # with much advice from members of the preview-latex project:
 # David Kastrup, dak@gnu.org and
-# Jan-Åke Larsson, jalar@mai.liu.se.
+# Jan-Åke Larsson, jalar@mai.liu.se.
 
 # Full author contact details are available in file CREDITS
 
@@ -103,12 +103,12 @@ def extract_metrics_info(dvipng_stdout, metrics_file):
         ascent  = string.atof(match.group(2))
 
         frac = 0.5
-        if ascent > 0 and descent > 0:
+        if ascent >= 0 or descent >= 0:
             if abs(ascent + descent) > 0.1:
                 frac = ascent / (ascent + descent)
 
-            # Sanity check
-            if frac < 0 or frac > 1:
+           # Sanity check
+            if frac < 0:
                 frac = 0.5
 
         metrics.write("Snippet %s %f\n" % (page, frac))
@@ -150,7 +150,7 @@ def main(argv):
 
     # External programs used by the script.
     path = string.split(os.environ["PATH"], os.pathsep)
-    latex = find_exe_or_terminate(["pplatex", "latex2e", "latex"], path)
+    latex = find_exe_or_terminate(["pplatex", "platex", "latex2e", "latex"], path)
 
     # This can go once dvipng becomes widespread.
     dvipng = find_exe(["dvipng"], path)