mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-07 09:01:38 -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
|
return self._page.bridge
|
||||||
|
|
||||||
def on_bridge_ready(self):
|
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):
|
for func, args in iteritems(self.pending_bridge_ready_actions):
|
||||||
getattr(self.bridge, func)(*args)
|
getattr(self.bridge, func)(*args)
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import initialize # noqa: unused-import
|
|||||||
from ajax import ajax
|
from ajax import ajax
|
||||||
from book_list.globals import set_session_data
|
from book_list.globals import set_session_data
|
||||||
from book_list.library_data import library_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 dom import get_widget_css, set_css
|
||||||
from modals import create_modal_container, error_dialog
|
from modals import create_modal_container, error_dialog
|
||||||
from qt import from_python, to_python
|
from qt import from_python, to_python
|
||||||
@ -188,10 +188,12 @@ def create_session_data(prefs):
|
|||||||
|
|
||||||
|
|
||||||
@from_python
|
@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
|
nonlocal view
|
||||||
runtime.all_font_families = all_font_families
|
runtime.all_font_families = all_font_families
|
||||||
library_data.field_metadata = field_metadata
|
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:
|
if view is None:
|
||||||
create_session_data(prefs)
|
create_session_data(prefs)
|
||||||
view = View(document.getElementById('view'))
|
view = View(document.getElementById('view'))
|
||||||
@ -297,7 +299,6 @@ if window is window.top:
|
|||||||
document.body.appendChild(E.div(id='view'))
|
document.body.appendChild(E.div(id='view'))
|
||||||
window.onerror = onerror
|
window.onerror = onerror
|
||||||
create_modal_container()
|
create_modal_container()
|
||||||
document.body.style.fontFamily = get_font_family()
|
|
||||||
document.head.appendChild(E.style(get_widget_css()))
|
document.head.appendChild(E.style(get_widget_css()))
|
||||||
set_css(document.body, background_color=get_color('window-background'), color=get_color('window-foreground'))
|
set_css(document.body, background_color=get_color('window-background'), color=get_color('window-foreground'))
|
||||||
setTimeout(def():
|
setTimeout(def():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user