mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
E-book viewer: Disallow hyphenation in documents that use mathematical typesetting as the hyphenation breaks that typesetting
This commit is contained in:
parent
d9a5a328e2
commit
7f7a08f44b
@ -74,6 +74,7 @@ class MathJax
|
|||||||
if script != null or document.getElementsByTagName('math').length > 0
|
if script != null or document.getElementsByTagName('math').length > 0
|
||||||
this.math_present = true
|
this.math_present = true
|
||||||
this.load_mathjax(user_config)
|
this.load_mathjax(user_config)
|
||||||
|
return this.math_present
|
||||||
|
|
||||||
after_resize: () ->
|
after_resize: () ->
|
||||||
if not this.math_present or this.hub == null
|
if not this.math_present or this.hub == null
|
||||||
|
@ -108,6 +108,7 @@ class Document(QWebPage): # {{{
|
|||||||
self.js_loader = JavaScriptLoader(
|
self.js_loader = JavaScriptLoader(
|
||||||
dynamic_coffeescript=self.debug_javascript)
|
dynamic_coffeescript=self.debug_javascript)
|
||||||
self.in_fullscreen_mode = False
|
self.in_fullscreen_mode = False
|
||||||
|
self.math_present = False
|
||||||
|
|
||||||
self.setLinkDelegationPolicy(self.DelegateAllLinks)
|
self.setLinkDelegationPolicy(self.DelegateAllLinks)
|
||||||
self.scroll_marks = []
|
self.scroll_marks = []
|
||||||
@ -232,7 +233,7 @@ class Document(QWebPage): # {{{
|
|||||||
@property
|
@property
|
||||||
def hyphenatable(self):
|
def hyphenatable(self):
|
||||||
# Qt fails to render soft hyphens correctly on windows xp
|
# Qt fails to render soft hyphens correctly on windows xp
|
||||||
return not isxp and self.hyphenate and getattr(self, 'loaded_lang', '')
|
return not isxp and self.hyphenate and getattr(self, 'loaded_lang', '') and not self.math_present
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def init_hyphenate(self):
|
def init_hyphenate(self):
|
||||||
@ -257,6 +258,7 @@ class Document(QWebPage): # {{{
|
|||||||
self.javascript('window.paged_display.read_document_margins()')
|
self.javascript('window.paged_display.read_document_margins()')
|
||||||
self.set_bottom_padding(0)
|
self.set_bottom_padding(0)
|
||||||
self.fit_images()
|
self.fit_images()
|
||||||
|
self.math_present = self.javascript('window.mathjax.check_for_math()', bool)
|
||||||
self.init_hyphenate()
|
self.init_hyphenate()
|
||||||
self.javascript('full_screen.save_margins()')
|
self.javascript('full_screen.save_margins()')
|
||||||
if self.in_fullscreen_mode:
|
if self.in_fullscreen_mode:
|
||||||
@ -267,7 +269,6 @@ class Document(QWebPage): # {{{
|
|||||||
evaljs = self.mainFrame().evaluateJavaScript
|
evaljs = self.mainFrame().evaluateJavaScript
|
||||||
for pl in self.all_viewer_plugins:
|
for pl in self.all_viewer_plugins:
|
||||||
pl.run_javascript(evaljs)
|
pl.run_javascript(evaljs)
|
||||||
self.javascript('window.mathjax.check_for_math()')
|
|
||||||
self.first_load = False
|
self.first_load = False
|
||||||
|
|
||||||
def colors(self):
|
def colors(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user