From d49fab5ace7c4c8d33a3bbac55604b491852285b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 4 Nov 2017 05:11:49 +0530 Subject: [PATCH] Browser viewer: Restore the default font as sans-serif But it can now be easily overriden by either user-stylesheet or book style sheet --- src/pyj/read_book/footnotes.pyj | 1 + src/pyj/read_book/resources.pyj | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pyj/read_book/footnotes.pyj b/src/pyj/read_book/footnotes.pyj index 8726c8d51c..6d5c726cb3 100644 --- a/src/pyj/read_book/footnotes.pyj +++ b/src/pyj/read_book/footnotes.pyj @@ -198,6 +198,7 @@ class PopupIframeBoss: self.frag = data.frag for name in self.blob_url_map: window.URL.revokeObjectURL(self.blob_url_map[name]) + document.body.style.removeProperty('font-family') root_data, self.mathjax, self.blob_url_map = finalize_resources(self.book, data.name, data.resource_data) self.resource_urls = unserialize_html(root_data, self.content_loaded, self.show_only_footnote) update_settings(data.settings) diff --git a/src/pyj/read_book/resources.pyj b/src/pyj/read_book/resources.pyj index f38fde2098..d17e7512a7 100644 --- a/src/pyj/read_book/resources.pyj +++ b/src/pyj/read_book/resources.pyj @@ -2,9 +2,11 @@ # License: GPL v3 Copyright: 2016, Kovid Goyal from __python__ import hash_literals -from dom import clear +from elementmaker import E from encodings import base64decode, utf8_decode +from dom import clear + JSON_XHTML_MIMETYPE = 'application/calibre+xhtml+json' def decode_component(x): @@ -228,6 +230,7 @@ def unserialize_html(serialized_data, proceed, postprocess_dom): apply_attributes(html, document.documentElement, ns_map) head, body = tree[1], tree[2] # noqa: unused-local clear(document.head, document.body) + document.head.appendChild(E.style('html { font-family: sans-serif }')) resource_urls = {} load_required = set() proceeded = False