From a147d96b2fa516a3eb88041719bd516c3b6c4970 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 30 Oct 2016 08:10:10 +0530 Subject: [PATCH] Detect two char dropcaps when the first char is punctuation --- src/calibre/ebooks/oeb/transforms/flatcss.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/calibre/ebooks/oeb/transforms/flatcss.py b/src/calibre/ebooks/oeb/transforms/flatcss.py index 4b51154414..3f1b87c48a 100644 --- a/src/calibre/ebooks/oeb/transforms/flatcss.py +++ b/src/calibre/ebooks/oeb/transforms/flatcss.py @@ -426,7 +426,7 @@ class CSSFlattener(object): fsize = font_size is_drop_cap = (cssdict.get('float', None) == 'left' and 'font-size' in cssdict and len(node) == 0 and node.text and - len(node.text) == 1) + (len(node.text) == 1 or (len(node.text) == 2 and 0x2000 <= ord(node.text[0]) <= 0x206f))) # Detect drop caps generated by the docx input plugin if (node.tag and node.tag.endswith('}p') and len(node) == 0 and node.text and len(node.text.strip()) == 1 and not node.tail and 'line-height' in cssdict and 'font-size' in cssdict): @@ -660,4 +660,3 @@ class CSSFlattener(object): for item in self.oeb.spine: stylizer = self.stylizers[item] self.flatten_head(item, href, global_css[item]) -