Detect two char dropcaps when the first char is punctuation

This commit is contained in:
Kovid Goyal 2016-10-30 08:10:10 +05:30
parent 6fe47ec867
commit a147d96b2f

View File

@ -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])