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'
|
' of stretching it to fill the full first page of the'
|
||||||
' generated pdf.')),
|
' generated pdf.')),
|
||||||
OptionRecommendation(name='pdf_serif_family',
|
OptionRecommendation(name='pdf_serif_family',
|
||||||
recommended_value='Liberation Serif', help=_(
|
recommended_value='Times', help=_(
|
||||||
'The font family used to render serif fonts')),
|
'The font family used to render serif fonts. Will work only if the font is available system-wide.')),
|
||||||
OptionRecommendation(name='pdf_sans_family',
|
OptionRecommendation(name='pdf_sans_family',
|
||||||
recommended_value='Liberation Sans', help=_(
|
recommended_value='Helvetica', help=_(
|
||||||
'The font family used to render sans-serif fonts')),
|
'The font family used to render sans-serif fonts. Will work only if the font is available system-wide.')),
|
||||||
OptionRecommendation(name='pdf_mono_family',
|
OptionRecommendation(name='pdf_mono_family',
|
||||||
recommended_value='Liberation Mono', help=_(
|
recommended_value='Courier', help=_(
|
||||||
'The font family used to render monospace fonts')),
|
'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'],
|
OptionRecommendation(name='pdf_standard_font', choices=ui_data['font_types'],
|
||||||
recommended_value='serif', help=_(
|
recommended_value='serif', help=_(
|
||||||
'The font family used to render monospace fonts')),
|
'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
|
# that hopefully no Qt application has been constructed as yet
|
||||||
from PyQt5.QtWebEngineCore import QWebEngineUrlScheme
|
from PyQt5.QtWebEngineCore import QWebEngineUrlScheme
|
||||||
from PyQt5.QtWebEngineWidgets import QWebEnginePage # noqa
|
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
|
from calibre.constants import FAKE_PROTOCOL
|
||||||
scheme = QWebEngineUrlScheme(FAKE_PROTOCOL.encode('ascii'))
|
scheme = QWebEngineUrlScheme(FAKE_PROTOCOL.encode('ascii'))
|
||||||
scheme.setSyntax(QWebEngineUrlScheme.Syntax.Host)
|
scheme.setSyntax(QWebEngineUrlScheme.Syntax.Host)
|
||||||
scheme.setFlags(QWebEngineUrlScheme.SecureScheme)
|
scheme.setFlags(QWebEngineUrlScheme.SecureScheme)
|
||||||
QWebEngineUrlScheme.registerScheme(scheme)
|
QWebEngineUrlScheme.registerScheme(scheme)
|
||||||
must_use_qt()
|
must_use_qt()
|
||||||
load_builtin_fonts()
|
|
||||||
self.input_fmt = input_fmt
|
self.input_fmt = input_fmt
|
||||||
|
|
||||||
if opts.pdf_use_document_margins:
|
if opts.pdf_use_document_margins:
|
||||||
|
@ -747,22 +747,22 @@ class Translator(QTranslator):
|
|||||||
|
|
||||||
|
|
||||||
gui_thread = None
|
gui_thread = None
|
||||||
|
|
||||||
qt_app = 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():
|
def load_builtin_fonts():
|
||||||
global _rating_font, builtin_fonts_loaded
|
global _rating_font, builtin_fonts_loaded
|
||||||
# Load the builtin fonts and any fonts added to calibre by the user to
|
# Load the builtin fonts and any fonts added to calibre by the user to
|
||||||
# Qt
|
# Qt
|
||||||
if builtin_fonts_loaded:
|
if hasattr(load_builtin_fonts, 'done'):
|
||||||
return
|
return
|
||||||
builtin_fonts_loaded = True
|
load_builtin_fonts.done = True
|
||||||
for ff in glob.glob(P('fonts/liberation/*.?tf')) + \
|
for ff in calibre_font_files():
|
||||||
[P('fonts/calibreSymbols.otf')] + \
|
|
||||||
glob.glob(os.path.join(config_dir, 'fonts', '*.?tf')):
|
|
||||||
if ff.rpartition('.')[-1].lower() in {'ttf', 'otf'}:
|
if ff.rpartition('.')[-1].lower() in {'ttf', 'otf'}:
|
||||||
with open(ff, 'rb') as s:
|
with open(ff, 'rb') as s:
|
||||||
# Windows requires font files to be executable for them to be
|
# Windows requires font files to be executable for them to be
|
||||||
|
Loading…
x
Reference in New Issue
Block a user