From 2a419b2a2f39853601f3bc6072e2cf2ed7f79ef4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 25 Feb 2013 17:47:26 +0530 Subject: [PATCH] E-book viewer: Fix rendering of pages for right-to-left text in paged mode is reversed. Fixes #1132626 (Ebook Viewer - Reversed paging in 'page mode' for RTL epubs) --- resources/compiled_coffeescript.zip | Bin 67342 -> 67910 bytes src/calibre/ebooks/oeb/display/paged.coffee | 8 ++++++++ 2 files changed, 8 insertions(+) diff --git a/resources/compiled_coffeescript.zip b/resources/compiled_coffeescript.zip index 7edbd43dc949175cf277bdbc8334c8b2f00910f5..c9ed50891303fb20e5c16b5295525d5a516a0a94 100644 GIT binary patch delta 526 zcmeC{V>vd7MLNKnnMH&F1oC?$omO!l5*7+&U;tt1$#V5#n-z7c_{=jB^HOqB$iKVZPW%G<*&ODoaL$}NGWu@6VRljO%yA{O1a4TpsU%li;!z#YbI|clhHX917 zIBjMroz^=2HX9??ktbbd}o<>@Nyj2cXiJd+)>MJLyUa!=1=XVhYnRs!;s zr|)HFU|7h)2;>0(_s&0< diff --git a/src/calibre/ebooks/oeb/display/paged.coffee b/src/calibre/ebooks/oeb/display/paged.coffee index aae9aeddd2..2f698966dd 100644 --- a/src/calibre/ebooks/oeb/display/paged.coffee +++ b/src/calibre/ebooks/oeb/display/paged.coffee @@ -75,6 +75,13 @@ class PagedDisplay this.margin_side = margin_side this.margin_bottom = margin_bottom + handle_rtl_body: (body_style) -> + if body_style.direction == "rtl" + for node in document.body.childNodes + if node.nodeType == node.ELEMENT_NODE and window.getComputedStyle(node).direction == "rtl" + node.style.setProperty("direction", "rtl") + document.body.style.direction = "ltr" + layout: (is_single_page=false) -> # start_time = new Date().getTime() body_style = window.getComputedStyle(document.body) @@ -84,6 +91,7 @@ class PagedDisplay # Check if the current document is a full screen layout like # cover, if so we treat it specially. single_screen = (document.body.scrollHeight < window.innerHeight + 75) + this.handle_rtl_body(body_style) first_layout = true ww = window.innerWidth