mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 16:43:40 +02:00
Better error message when user specifies embed font family that does not exist
This commit is contained in:
parent
f4f82d689a
commit
fb778e5a2d
1 changed files with 10 additions and 3 deletions
|
|
@ -194,11 +194,18 @@ def get_embed_font_info(self, family, failure_critical=True):
|
|||
body_font_family = None
|
||||
if not family:
|
||||
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
|
||||
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:
|
||||
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:
|
||||
raise ValueError(msg)
|
||||
self.oeb.log.warn(msg)
|
||||
|
|
|
|||
Loading…
Reference in a new issue