diff --git a/src/libprs500/__init__.py b/src/libprs500/__init__.py
index 98fcddd6dd..422cc78cfa 100644
--- a/src/libprs500/__init__.py
+++ b/src/libprs500/__init__.py
@@ -33,7 +33,7 @@ You may have to adjust the GROUP and the location of the rules file to
suit your distribution.
"""
-__version__ = "0.3.41"
+__version__ = "0.3.42"
__docformat__ = "epytext"
__author__ = "Kovid Goyal "
diff --git a/src/libprs500/ebooks/lrf/html/convert_from.py b/src/libprs500/ebooks/lrf/html/convert_from.py
index 0e4fe87d63..2f7cb6464f 100644
--- a/src/libprs500/ebooks/lrf/html/convert_from.py
+++ b/src/libprs500/ebooks/lrf/html/convert_from.py
@@ -209,6 +209,8 @@ class Span(_Span):
if fs.lower() == 'italic':
src = Italic(src)
attrs = Span.translate_attrs(css, font_delta=font_delta, memory=memory)
+ if 'fontsize' in attrs.keys():
+ attrs['baselineskip'] = int(attrs['fontsize']) + 20
_Span.__init__(self, text=src, **attrs)
diff --git a/src/libprs500/ebooks/lrf/html/demo/demo.html b/src/libprs500/ebooks/lrf/html/demo/demo.html
index 56f165a2c0..b48c2f3acc 100644
--- a/src/libprs500/ebooks/lrf/html/demo/demo.html
+++ b/src/libprs500/ebooks/lrf/html/demo/demo.html
@@ -44,9 +44,6 @@
@@ -62,7 +59,7 @@
- Not that if you have custom fonts on your reader, the table may not be properly aligned. Also html2lrf does not support nested tables.
+ Note that if you have custom fonts on your reader, the table may not be properly aligned. Also html2lrf does not support nested tables.
diff --git a/src/libprs500/ebooks/lrf/html/table.py b/src/libprs500/ebooks/lrf/html/table.py
index b8be13ba35..23450de888 100644
--- a/src/libprs500/ebooks/lrf/html/table.py
+++ b/src/libprs500/ebooks/lrf/html/table.py
@@ -163,10 +163,9 @@ class Cell(object):
ts = tb.textStyle.attrs
default_font = get_font(ts['fontfacename'], self.pts_to_pixels(ts['fontsize']))
parindent = self.pts_to_pixels(ts['parindent'])
- ls, ws = self.pts_to_pixels(ts['baselineskip']) + self.pts_to_pixels(ts['linespace']), self.pts_to_pixels(ts['wordspace'])
top, bottom, left, right = 0, 0, parindent, parindent
- def add_word(width, height, left, right, top, bottom):
+ def add_word(width, height, left, right, top, bottom, ls, ws):
if left + width > maxwidth:
left = width + ws
top += ls
@@ -178,14 +177,19 @@ class Cell(object):
return left, right, top, bottom
for token, attrs in tokens(tb):
+ if attrs == None:
+ attrs = {}
font = default_font
+ ls = self.pts_to_pixels(attrs.get('baselineskip', ts['baselineskip']))+\
+ self.pts_to_pixels(attrs.get('linespace', ts['linespace']))
+ ws = self.pts_to_pixels(attrs.get('wordspace', ts['wordspace']))
if isinstance(token, int): # Handle para and line breaks
top = bottom
left = parindent if int == 1 else 0
continue
if isinstance(token, Plot):
width, height = self.pts_to_pixels(token.xsize), self.pts_to_pixels(token.ysize)
- left, right, top, bottom = add_word(width, height, left, right, top, bottom)
+ left, right, top, bottom = add_word(width, height, left, right, top, bottom, ls, ws)
continue
ff = attrs.get('fontfacename', ts['fontfacename'])
fs = attrs.get('fontsize', ts['fontsize'])
@@ -193,7 +197,7 @@ class Cell(object):
font = get_font(ff, self.pts_to_pixels(fs))
for word in token.split():
width, height = font.getsize(word)
- left, right, top, bottom = add_word(width, height, left, right, top, bottom)
+ left, right, top, bottom = add_word(width, height, left, right, top, bottom, ls, ws)
return right+3, bottom
def text_block_preferred_width(self, tb, debug=False):