Fix regression that caused rescaling of ont size in dropcaps generated

by the DOCX input plugin
This commit is contained in:
Kovid Goyal 2013-07-18 13:30:44 +05:30
parent 781191c21b
commit aefab3b47a

View File

@ -371,11 +371,13 @@ class CSSFlattener(object):
is_drop_cap = (cssdict.get('float', None) == 'left' and 'font-size' in is_drop_cap = (cssdict.get('float', None) == 'left' and 'font-size' in
cssdict and len(node) == 0 and node.text and cssdict and len(node) == 0 and node.text and
len(node.text) == 1) len(node.text) == 1)
is_drop_cap = is_drop_cap or ( # Detect drop caps generated by the docx input plugin
# The docx input plugin generates drop caps that look like this if (node.tag and node.tag.endswith('}p') and len(node) == 0 and node.text and len(node.text.strip()) == 1 and
len(node) == 1 and not node.text and len(node[0]) == 0 and not node.tail and 'line-height' in cssdict and 'font-size' in cssdict):
node[0].text and not node[0].tail and len(node[0].text) == 1 and dp = node.getparent()
'line-height' in cssdict and 'font-size' in cssdict) if dp.tag and dp.tag.endswith('}div') and len(dp) == 1 and not dp.text:
if stylizer.style(dp).cssdict().get('float', None) == 'left':
is_drop_cap = True
if not self.context.disable_font_rescaling and not is_drop_cap: if not self.context.disable_font_rescaling and not is_drop_cap:
_sbase = self.sbase if self.sbase is not None else \ _sbase = self.sbase if self.sbase is not None else \
self.context.source.fbase self.context.source.fbase