mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-05 08:40:13 -04:00
Use the calibre user interface font family and size for viewer chrome
This commit is contained in:
parent
8901836673
commit
f069848639
@ -425,7 +425,10 @@ class WebView(RestartingWebEngineView):
|
||||
return self._page.bridge
|
||||
|
||||
def on_bridge_ready(self):
|
||||
self.bridge.create_view(vprefs['session_data'], QFontDatabase().families(), field_metadata.all_metadata())
|
||||
f = QApplication.instance().font()
|
||||
self.bridge.create_view(
|
||||
vprefs['session_data'], QFontDatabase().families(), field_metadata.all_metadata(),
|
||||
f.family(), f.pointSize())
|
||||
for func, args in iteritems(self.pending_bridge_ready_actions):
|
||||
getattr(self.bridge, func)(*args)
|
||||
|
||||
|
@ -10,7 +10,7 @@ import initialize # noqa: unused-import
|
||||
from ajax import ajax
|
||||
from book_list.globals import set_session_data
|
||||
from book_list.library_data import library_data
|
||||
from book_list.theme import get_color, get_font_family
|
||||
from book_list.theme import get_color
|
||||
from dom import get_widget_css, set_css
|
||||
from modals import create_modal_container, error_dialog
|
||||
from qt import from_python, to_python
|
||||
@ -188,10 +188,12 @@ def create_session_data(prefs):
|
||||
|
||||
|
||||
@from_python
|
||||
def create_view(prefs, all_font_families, field_metadata):
|
||||
def create_view(prefs, all_font_families, field_metadata, ui_font_family, ui_font_sz_in_pts):
|
||||
nonlocal view
|
||||
runtime.all_font_families = all_font_families
|
||||
library_data.field_metadata = field_metadata
|
||||
document.documentElement.style.fontFamily = f'"{ui_font_family}", sans-serif'
|
||||
document.documentElement.style.fontSize = f'{ui_font_sz_in_pts}pt'
|
||||
if view is None:
|
||||
create_session_data(prefs)
|
||||
view = View(document.getElementById('view'))
|
||||
@ -297,7 +299,6 @@ if window is window.top:
|
||||
document.body.appendChild(E.div(id='view'))
|
||||
window.onerror = onerror
|
||||
create_modal_container()
|
||||
document.body.style.fontFamily = get_font_family()
|
||||
document.head.appendChild(E.style(get_widget_css()))
|
||||
set_css(document.body, background_color=get_color('window-background'), color=get_color('window-foreground'))
|
||||
setTimeout(def():
|
||||
|
Loading…
x
Reference in New Issue
Block a user