Hyphenation: add custom hyphenation rules (#7746)

The hyphenation of a word can be changed from its default
by long pressing for 3 seconds and selecting 'Hyphenate'.
These overrides are stored in a per-language file, i.e:
koreader/settings/user-German.hyph.
This commit is contained in:
zwim
2021-05-31 20:34:26 +02:00
committed by GitHub
parent b30e366ccd
commit f25da5d0d5
39 changed files with 355 additions and 256 deletions

View File

@@ -980,6 +980,25 @@ function CreDocument:setTextHyphenationSoftHyphensOnly(toggle)
self._document:setStringProperty("crengine.textlang.hyphenation.soft.hyphens.only", toggle and 1 or 0)
end
function CreDocument:setUserHyphenationDict(dict, reload)
logger.dbg("CreDocument: set textlang hyphenation dict", dict or "none")
return self._document:setUserHyphenationDict(dict or "", reload or false)
end
function CreDocument:getHyphenationForWord(word)
if word then
return self._document:getHyphenationForWord(word)
end
return word
end
function CreDocument:getLowercasedWord(word)
if word then
return self._document:getLowercasedWord(word)
end
return word
end
function CreDocument:setTextHyphenationForceAlgorithmic(toggle)
logger.dbg("CreDocument: set textlang hyphenation force algorithmic", toggle)
self._document:setStringProperty("crengine.textlang.hyphenation.force.algorithmic", toggle and 1 or 0)