* lib/scripts/lyxpreview2bitmap.py: fix frac calculation (bug 2391).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13511 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2006-03-28 10:18:02 +00:00
parent b7d59d8ce6
commit eedb4c6821

View File

@ -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:
if frac < 0:
frac = 0.5
metrics.write("Snippet %s %f\n" % (page, frac))