From 5943156eaa6f13199192867cf3f80ca486d1edf6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 30 Nov 2011 18:04:28 +0530 Subject: [PATCH 1/2] Fix #898123 (Support for new Android device Samsung Galaxy GIO S5660) --- src/calibre/devices/android/driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/devices/android/driver.py b/src/calibre/devices/android/driver.py index d478f47cea..8f5395b514 100644 --- a/src/calibre/devices/android/driver.py +++ b/src/calibre/devices/android/driver.py @@ -167,7 +167,7 @@ class ANDROID(USBMS): 'MB525', 'ANDROID2.3', 'SGH-I997', 'GT-I5800_CARD', 'MB612', 'GT-S5830_CARD', 'GT-S5570_CARD', 'MB870', 'MID7015A', 'ALPANDIGITAL', 'ANDROID_MID', 'VTAB1008', 'EMX51_BBG_ANDROI', - 'UMS', '.K080', 'P990', 'LTE', 'MB853'] + 'UMS', '.K080', 'P990', 'LTE', 'MB853', 'GT-S5660_CARD'] WINDOWS_CARD_A_MEM = ['ANDROID_PHONE', 'GT-I9000_CARD', 'SGH-I897', 'FILE-STOR_GADGET', 'SGH-T959', 'SAMSUNG_ANDROID', 'GT-P1000_CARD', 'A70S', 'A101IT', '7', 'INCREDIBLE', 'A7EB', 'SGH-T849_CARD', From b2bea092fc5641f057c0964b7a47a55f58ab9c90 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 30 Nov 2011 21:33:00 +0530 Subject: [PATCH 2/2] Conversion pipeline: Do not error out on books that set font size to zero. Fixes #898194 (Private bug) --- src/calibre/ebooks/oeb/stylizer.py | 3 ++- src/calibre/ebooks/oeb/transforms/flatcss.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/oeb/stylizer.py b/src/calibre/ebooks/oeb/stylizer.py index adef0f1bfb..20be750925 100644 --- a/src/calibre/ebooks/oeb/stylizer.py +++ b/src/calibre/ebooks/oeb/stylizer.py @@ -539,7 +539,8 @@ class Style(object): 'Return value in pts' if base is None: base = self.width - font = font or self.fontSize + if not font and font != 0: + font = self.fontSize return unit_convert(value, base, font, self._profile.dpi) def pt_to_px(self, value): diff --git a/src/calibre/ebooks/oeb/transforms/flatcss.py b/src/calibre/ebooks/oeb/transforms/flatcss.py index ba90a31632..489498d90c 100644 --- a/src/calibre/ebooks/oeb/transforms/flatcss.py +++ b/src/calibre/ebooks/oeb/transforms/flatcss.py @@ -283,7 +283,10 @@ class CSSFlattener(object): psize = fsize elif 'font-size' in cssdict or tag == 'body': fsize = self.fmap[font_size] - cssdict['font-size'] = "%0.5fem" % (fsize / psize) + try: + cssdict['font-size'] = "%0.5fem" % (fsize / psize) + except ZeroDivisionError: + cssdict['font-size'] = '%.1fpt'%fsize psize = fsize try: