diff --git a/src/calibre/ebooks/oeb/transforms/flatcss.py b/src/calibre/ebooks/oeb/transforms/flatcss.py index 9c8442d391..c3b7f6f625 100644 --- a/src/calibre/ebooks/oeb/transforms/flatcss.py +++ b/src/calibre/ebooks/oeb/transforms/flatcss.py @@ -410,7 +410,10 @@ class CSSFlattener(object): if cssdict: for x in self.filter_css: - cssdict.pop(x, None) + popval = cssdict.pop(x, None) + if (self.body_font_family and popval and x == 'font-family' and + popval.partition(',')[0][1:-1] == self.body_font_family.partition(',')[0][1:-1]): + cssdict[x] = popval if cssdict: if self.lineh and self.fbase and tag != 'body':