diff --git a/defaults.lua b/defaults.lua index 227269562..7ede43242 100644 --- a/defaults.lua +++ b/defaults.lua @@ -96,8 +96,8 @@ DKOPTREADER_CONFIG_MAX_COLUMNS = 2 -- range from 1 to 4 DKOPTREADER_CONFIG_CONTRAST = 1.0 -- range from 0.2 to 2.0 -- word spacing for reflow -DKOPTREADER_CONFIG_WORD_SAPCINGS = {0.05, -1, 0.375} -- range from 0.05 to 0.5 -DKOPTREADER_CONFIG_DEFAULT_WORD_SAPCING = -1 -- range from 0.05 to 0.5 +DKOPTREADER_CONFIG_WORD_SPACINGS = {0.05, -0.2, 0.375} -- range from (+/-)0.05 to (+/-)0.5 +DKOPTREADER_CONFIG_DEFAULT_WORD_SPACING = -0.2 -- range from (+/-)0.05 to (+/-)0.5 -- document languages for OCR DKOPTREADER_CONFIG_DOC_LANGS_TEXT = {"English", "Chinese"} DKOPTREADER_CONFIG_DOC_LANGS_CODE = {"eng", "chi_sim"} -- language code, make sure you have corresponding training data diff --git a/frontend/apps/reader/modules/readerkoptlistener.lua b/frontend/apps/reader/modules/readerkoptlistener.lua index d7812e8b3..5b66b6e77 100644 --- a/frontend/apps/reader/modules/readerkoptlistener.lua +++ b/frontend/apps/reader/modules/readerkoptlistener.lua @@ -20,6 +20,11 @@ function ReaderKoptListener:onReadSettings(config) self.document.configurable.contrast = config:readSetting("kopt_contrast") or G_reader_settings:readSetting("kopt_contrast") or 1.0 self.ui:handleEvent(Event:new("GammaUpdate", 1/self.document.configurable.contrast)) + -- since K2pdfopt v2.21 negative value of word spacing is also used, for config + -- compatability we should manually change previous -1 to a more reasonable -0.2 + if self.document.configurable.word_spacing == -1 then + self.document.configurable.word_spacing = -0.2 + end end function ReaderKoptListener:onSaveSettings() diff --git a/frontend/ui/data/koptoptions.lua b/frontend/ui/data/koptoptions.lua index 8c1b36306..685611928 100644 --- a/frontend/ui/data/koptoptions.lua +++ b/frontend/ui/data/koptoptions.lua @@ -186,8 +186,8 @@ local KoptOptions = { name = "word_spacing", name_text = S.WORD_GAP, toggle = {S.SMALL, S.AUTO, S.LARGE}, - values = DKOPTREADER_CONFIG_WORD_SAPCINGS, - default_value = DKOPTREADER_CONFIG_DEFAULT_WORD_SAPCING, + values = DKOPTREADER_CONFIG_WORD_SPACINGS, + default_value = DKOPTREADER_CONFIG_DEFAULT_WORD_SPACING, }, { name = "writing_direction", diff --git a/koreader-base b/koreader-base index 3dc42b01b..32dae406a 160000 --- a/koreader-base +++ b/koreader-base @@ -1 +1 @@ -Subproject commit 3dc42b01bc52701dd3682f32b64d1498b28b895b +Subproject commit 32dae406abd6667e3ff0793c8d09584d21ca5693