This commit is contained in:
Kovid Goyal 2016-11-14 14:02:14 +05:30
parent 6b694fe130
commit f4f6e5655a

View File

@ -167,10 +167,11 @@ class Fonts(object):
fonts = font_scanner.alt_fonts_for_family(ff) fonts = font_scanner.alt_fonts_for_family(ff)
except NoFonts: except NoFonts:
return return
font = get_best_font(fonts, css.get('font-style', 'normal'), css.get('font-stretch', 'normal')) if fonts:
if font is not None: font = get_best_font(fonts, css.get('font-style', 'normal'), css.get('font-stretch', 'normal'))
rest = ', '.join(css['font-family'].split(',')[1:]) if font is not None:
if rest: rest = ', '.join(css['font-family'].split(',')[1:])
rest = ', ' + rest if rest:
css['font-family'] = '"%s"' % font['font-family'].replace('"', '') + rest rest = ', ' + rest
css['font-weight'] = font['font-weight'] css['font-family'] = '"%s"' % font['font-family'].replace('"', '') + rest
css['font-weight'] = font['font-weight']