diff --git a/src/calibre/ebooks/docx/char_styles.py b/src/calibre/ebooks/docx/char_styles.py index 025a080f11..a651b4349c 100644 --- a/src/calibre/ebooks/docx/char_styles.py +++ b/src/calibre/ebooks/docx/char_styles.py @@ -109,7 +109,18 @@ def read_underline(parent, dest, XPath, get): for col in XPath('./w:u[@w:val]')(parent): val = get(col, 'w:val') if val: - ans = val if val == 'none' else 'underline' + style = { + 'dotted': 'dotted', 'dash': 'dashed', 'dashDotDotHeavy': 'dotted', 'dashDotHeavy': 'dashed', 'dashedHeavy': 'dashed', + 'dashLong': 'dashed', 'dashLongHeavy': 'dashed', 'dotDash': 'dotted', 'dotDotDash': 'dotted', 'dottedHeavy': 'dotted', + 'double': 'double', 'none': 'none', 'single': 'solid', 'thick': 'solid', 'wave': 'wavy', 'wavyDouble': 'wavy', + 'wavyHeavy': 'wavy', 'words': 'solid'}.get(val, 'solid') + if style == 'none': + ans = 'none' + else: + ans = 'underline ' + style + color = get(col, 'w:color') + if color and color != 'auto': + ans += ' #' + color setattr(dest, 'text_decoration', ans)