From 875af72918c71871e17897b5e8d13e556f6ddf17 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 25 Apr 2017 18:46:56 +0530 Subject: [PATCH] Ensure primary-writing-mode is set when page-progression-direction is rtl --- src/calibre/ebooks/mobi/writer8/mobi.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/ebooks/mobi/writer8/mobi.py b/src/calibre/ebooks/mobi/writer8/mobi.py index 1ce2e5105f..3aa535424a 100644 --- a/src/calibre/ebooks/mobi/writer8/mobi.py +++ b/src/calibre/ebooks/mobi/writer8/mobi.py @@ -225,6 +225,10 @@ class KF8Book(object): self.used_images = writer.used_images self.page_progression_direction = writer.oeb.spine.page_progression_direction self.primary_writing_mode = writer.oeb.metadata.primary_writing_mode + if self.page_progression_direction == 'rtl' and not self.primary_writing_mode: + # Without this the Kindle renderer does not respect + # page_progression_direction + self.primary_writing_mode = 'horizontal-rl' def build_records(self, writer, for_joint): metadata = writer.oeb.metadata