mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user