From ed00de3b23cd986b3f8ed4d651448d89987f6298 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 24 Nov 2023 08:04:20 +0530 Subject: [PATCH] Fix #2044408 [Fallo al convertir a LRF desde docx en version 7](https://bugs.launchpad.net/calibre/+bug/2044408) --- src/calibre/ebooks/lrf/html/convert_from.py | 2 +- src/calibre/ebooks/lrf/html/table.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/lrf/html/convert_from.py b/src/calibre/ebooks/lrf/html/convert_from.py index 589ba395ec..c81d1dcdd4 100644 --- a/src/calibre/ebooks/lrf/html/convert_from.py +++ b/src/calibre/ebooks/lrf/html/convert_from.py @@ -1809,7 +1809,7 @@ def process_file(path, options, logger): cim.convert('RGB').save(cf.name) options.cover = cf.name - tim = im.resize((int(0.75*th), th), PILImage.ANTIALIAS).convert('RGB') + tim = im.resize((int(0.75*th), th), PILImage.Resampling.LANCZOS).convert('RGB') tf = PersistentTemporaryFile(prefix=__appname__+'_', suffix=".jpg") tf.close() tim.save(tf.name) diff --git a/src/calibre/ebooks/lrf/html/table.py b/src/calibre/ebooks/lrf/html/table.py index 956eabe14b..de8c483830 100644 --- a/src/calibre/ebooks/lrf/html/table.py +++ b/src/calibre/ebooks/lrf/html/table.py @@ -145,7 +145,8 @@ class Cell: continue word = token.split() word = word[0] if word else "" - width = font.getsize(word)[0] + fl, ft, fr, fb = font.getbbox(word) + width = fr - fl if width > mwidth: mwidth = width return parindent + mwidth + 2 @@ -191,7 +192,8 @@ class Cell: if (ff, fs) != (ts['fontfacename'], ts['fontsize']): font = get_font(ff, self.pts_to_pixels(fs)) for word in token.split(): - width, height = font.getsize(word) + fl, ft, fr, fb = font.getbbox(word) + width, height = fr - fl, abs(fb - ft) left, right, top, bottom = add_word(width, height, left, right, top, bottom, ls, ws) return right+3+max(parindent, 10), bottom