From fb2832c3edb7727a8f6e52f5918a5297d801a0bb Mon Sep 17 00:00:00 2001 From: "Marshall T. Vandegrift" Date: Sat, 10 Jan 2009 00:34:02 -0500 Subject: [PATCH] Fix glitch in HTML 3.2 font/@face -> CSS font-family conversion. --- src/calibre/ebooks/html.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/html.py b/src/calibre/ebooks/html.py index 84af7527bd..c938847051 100644 --- a/src/calibre/ebooks/html.py +++ b/src/calibre/ebooks/html.py @@ -796,7 +796,18 @@ class Processor(Parser): setting = '' face = font.attrib.pop('face', None) if face is not None: - setting += 'font-face:%s;'%face + faces = [] + for face in face.split(','): + if ' ' in face: + face = "%s" % face + faces.append(face) + for generic in ('serif', 'sans-serif', 'monospace'): + if generic in faces: + break + else: + faces.append('serif') + family = ', '.join(faces) + setting += 'font-family: %s;' % family color = font.attrib.pop('color', None) if color is not None: setting += 'color:%s'%color