From 99eecde875af1bd8df1037984c9ced2318070f3a Mon Sep 17 00:00:00 2001 From: Andrey Golovizin Date: Sat, 15 Nov 2014 12:22:47 +0100 Subject: [PATCH] Use setStringProperty method to set hyphenation dictionary. --- frontend/apps/reader/modules/readerhyphenation.lua | 4 ++-- frontend/document/credocument.lua | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/apps/reader/modules/readerhyphenation.lua b/frontend/apps/reader/modules/readerhyphenation.lua index 718993d87..13313a60b 100644 --- a/frontend/apps/reader/modules/readerhyphenation.lua +++ b/frontend/apps/reader/modules/readerhyphenation.lua @@ -32,7 +32,7 @@ function ReaderHyphenation:init() text = _("Change Hyphenation to ")..v, }) self:_changeSel(k) - cre.setHyphDictionary(v) + self.ui.document:setHyphDictionary(v) self.ui.toc:onUpdateToc() end }) @@ -43,7 +43,7 @@ end function ReaderHyphenation:onReadSettings(config) local hyph_alg = config:readSetting("hyph_alg") if hyph_alg then - cre.setHyphDictionary(hyph_alg) + self.ui.document:setHyphDictionary(hyph_alg) end self.hyph_alg = cre.getSelectedHyphDict() for k,v in ipairs(self.hyph_table) do diff --git a/frontend/document/credocument.lua b/frontend/document/credocument.lua index 4ddfc63d3..425a089ff 100644 --- a/frontend/document/credocument.lua +++ b/frontend/document/credocument.lua @@ -313,6 +313,13 @@ function CreDocument:setFontFace(new_font_face) end end +function CreDocument:setHyphDictionary(new_hyph_dictionary) + if new_hyph_dictionary then + DEBUG("CreDocument: set hyphenation dictionary", new_hyph_dictionary) + self._document:setStringProperty("crengine.hyphenation.directory", new_hyph_dictionary) + end +end + function CreDocument:clearSelection() DEBUG("clear selection") self._document:clearSelection()