mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Better error message when user specifies embed font family that does not exist
This commit is contained in:
parent
f4f82d689a
commit
fb778e5a2d
@ -194,11 +194,18 @@ class CSSFlattener(object):
|
|||||||
body_font_family = None
|
body_font_family = None
|
||||||
if not family:
|
if not family:
|
||||||
return body_font_family, efi
|
return body_font_family, efi
|
||||||
from calibre.utils.fonts.scanner import font_scanner
|
from calibre.utils.fonts.scanner import font_scanner, NoFonts
|
||||||
from calibre.utils.fonts.utils import panose_to_css_generic_family
|
from calibre.utils.fonts.utils import panose_to_css_generic_family
|
||||||
faces = font_scanner.fonts_for_family(family)
|
try:
|
||||||
|
faces = font_scanner.fonts_for_family(family)
|
||||||
|
except NoFonts:
|
||||||
|
msg = (u'No embeddable fonts found for family: %r'%family)
|
||||||
|
if failure_critical:
|
||||||
|
raise ValueError(msg)
|
||||||
|
self.oeb.log.warn(msg)
|
||||||
|
return body_font_family, efi
|
||||||
if not faces:
|
if not faces:
|
||||||
msg = (u'No embeddable fonts found for family: %r'%self.opts.embed_font_family)
|
msg = (u'No embeddable fonts found for family: %r'%family)
|
||||||
if failure_critical:
|
if failure_critical:
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
self.oeb.log.warn(msg)
|
self.oeb.log.warn(msg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user