From 1c0849446b89957cde0622645b48005349c47156 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Oct 2013 09:07:15 +0530 Subject: [PATCH] Conversion: Handle embed font family and filter css conflict Conversion: If both embed font family and the filter css option to remove fonts are set, do not remove the font specified by the embed font family option. --- src/calibre/ebooks/oeb/transforms/flatcss.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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':