#! /usr/bin/env python
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
# file lyxpreview2bitmap.py
# This file is part of LyX, the document processor.
# 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
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))