diff --git a/Changelog.yaml b/Changelog.yaml index 87a03a470e..f2eee7dbef 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -39,6 +39,12 @@ - title: "calibredb with output format stanza once again escapes URLs" tickets: [4084] + - title: Implement work around for a CSS bug in Adobe Digital Editions that causes it to crash + description: > + If the CSS contains the declaration font-size: medium instead of font-size: normal + Adobe Digital Editions will crash. calibre will now automatically replace medium with + normal. + - title: "PML Output: Only create \\a and \\U tags for supported characters." - title: "PML Input: Allow for images in top-level bookname_image and images directories" diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 20c8a3429f..b37f51c6b5 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -780,6 +780,8 @@ class Manifest(object): # In particular, it causes tostring to insert xmlns # declarations, which messes up the coercing logic idx = data.find(' -1: pre = data[:idx] data = data[idx:] diff --git a/src/calibre/ebooks/oeb/transforms/flatcss.py b/src/calibre/ebooks/oeb/transforms/flatcss.py index fb32a1ccf9..4d21c33c83 100644 --- a/src/calibre/ebooks/oeb/transforms/flatcss.py +++ b/src/calibre/ebooks/oeb/transforms/flatcss.py @@ -229,6 +229,8 @@ class CSSFlattener(object): if 'bgcolor' in node.attrib: cssdict['background-color'] = node.attrib['bgcolor'] del node.attrib['bgcolor'] + if cssdict.get('font-weight', '').lower() == 'medium': + cssdict['font-weight'] = 'normal' # ADE chokes on font-weight medium if not self.context.disable_font_rescaling: _sbase = self.sbase if self.sbase is not None else \ self.context.source.fbase