mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Dont load calibre fonts since webengine does not use them anyway
This commit is contained in:
parent
6caf7cf77a
commit
4a362c31b0
@ -56,14 +56,14 @@ class PDFOutput(OutputFormatPlugin):
|
||||
' of stretching it to fill the full first page of the'
|
||||
' generated pdf.')),
|
||||
OptionRecommendation(name='pdf_serif_family',
|
||||
recommended_value='Liberation Serif', help=_(
|
||||
'The font family used to render serif fonts')),
|
||||
recommended_value='Times', help=_(
|
||||
'The font family used to render serif fonts. Will work only if the font is available system-wide.')),
|
||||
OptionRecommendation(name='pdf_sans_family',
|
||||
recommended_value='Liberation Sans', help=_(
|
||||
'The font family used to render sans-serif fonts')),
|
||||
recommended_value='Helvetica', help=_(
|
||||
'The font family used to render sans-serif fonts. Will work only if the font is available system-wide.')),
|
||||
OptionRecommendation(name='pdf_mono_family',
|
||||
recommended_value='Liberation Mono', help=_(
|
||||
'The font family used to render monospace fonts')),
|
||||
recommended_value='Courier', help=_(
|
||||
'The font family used to render monospace fonts. Will work only if the font is available system-wide.')),
|
||||
OptionRecommendation(name='pdf_standard_font', choices=ui_data['font_types'],
|
||||
recommended_value='serif', help=_(
|
||||
'The font family used to render monospace fonts')),
|
||||
@ -134,14 +134,13 @@ class PDFOutput(OutputFormatPlugin):
|
||||
# that hopefully no Qt application has been constructed as yet
|
||||
from PyQt5.QtWebEngineCore import QWebEngineUrlScheme
|
||||
from PyQt5.QtWebEngineWidgets import QWebEnginePage # noqa
|
||||
from calibre.gui2 import must_use_qt, load_builtin_fonts
|
||||
from calibre.gui2 import must_use_qt
|
||||
from calibre.constants import FAKE_PROTOCOL
|
||||
scheme = QWebEngineUrlScheme(FAKE_PROTOCOL.encode('ascii'))
|
||||
scheme.setSyntax(QWebEngineUrlScheme.Syntax.Host)
|
||||
scheme.setFlags(QWebEngineUrlScheme.SecureScheme)
|
||||
QWebEngineUrlScheme.registerScheme(scheme)
|
||||
must_use_qt()
|
||||
load_builtin_fonts()
|
||||
self.input_fmt = input_fmt
|
||||
|
||||
if opts.pdf_use_document_margins:
|
||||
|
@ -747,22 +747,22 @@ class Translator(QTranslator):
|
||||
|
||||
|
||||
gui_thread = None
|
||||
|
||||
qt_app = None
|
||||
|
||||
builtin_fonts_loaded = False
|
||||
|
||||
def calibre_font_files():
|
||||
return glob.glob(P('fonts/liberation/*.?tf')) + [P('fonts/calibreSymbols.otf')] + \
|
||||
glob.glob(os.path.join(config_dir, 'fonts', '*.?tf'))
|
||||
|
||||
|
||||
def load_builtin_fonts():
|
||||
global _rating_font, builtin_fonts_loaded
|
||||
# Load the builtin fonts and any fonts added to calibre by the user to
|
||||
# Qt
|
||||
if builtin_fonts_loaded:
|
||||
if hasattr(load_builtin_fonts, 'done'):
|
||||
return
|
||||
builtin_fonts_loaded = True
|
||||
for ff in glob.glob(P('fonts/liberation/*.?tf')) + \
|
||||
[P('fonts/calibreSymbols.otf')] + \
|
||||
glob.glob(os.path.join(config_dir, 'fonts', '*.?tf')):
|
||||
load_builtin_fonts.done = True
|
||||
for ff in calibre_font_files():
|
||||
if ff.rpartition('.')[-1].lower() in {'ttf', 'otf'}:
|
||||
with open(ff, 'rb') as s:
|
||||
# Windows requires font files to be executable for them to be
|
||||
|
Loading…
x
Reference in New Issue
Block a user