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
|
||||
this.math_present = true
|
||||
this.load_mathjax(user_config)
|
||||
return this.math_present
|
||||
|
||||
after_resize: () ->
|
||||
if not this.math_present or this.hub == null
|
||||
|
@ -108,6 +108,7 @@ class Document(QWebPage): # {{{
|
||||
self.js_loader = JavaScriptLoader(
|
||||
dynamic_coffeescript=self.debug_javascript)
|
||||
self.in_fullscreen_mode = False
|
||||
self.math_present = False
|
||||
|
||||
self.setLinkDelegationPolicy(self.DelegateAllLinks)
|
||||
self.scroll_marks = []
|
||||
@ -232,7 +233,7 @@ class Document(QWebPage): # {{{
|
||||
@property
|
||||
def hyphenatable(self):
|
||||
# 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()
|
||||
def init_hyphenate(self):
|
||||
@ -257,6 +258,7 @@ class Document(QWebPage): # {{{
|
||||
self.javascript('window.paged_display.read_document_margins()')
|
||||
self.set_bottom_padding(0)
|
||||
self.fit_images()
|
||||
self.math_present = self.javascript('window.mathjax.check_for_math()', bool)
|
||||
self.init_hyphenate()
|
||||
self.javascript('full_screen.save_margins()')
|
||||
if self.in_fullscreen_mode:
|
||||
@ -267,7 +269,6 @@ class Document(QWebPage): # {{{
|
||||
evaljs = self.mainFrame().evaluateJavaScript
|
||||
for pl in self.all_viewer_plugins:
|
||||
pl.run_javascript(evaljs)
|
||||
self.javascript('window.mathjax.check_for_math()')
|
||||
self.first_load = False
|
||||
|
||||
def colors(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user