diff options
Diffstat (limited to 'macros/luatex/generic/luavlna/luavlna.tex')
-rw-r--r-- | macros/luatex/generic/luavlna/luavlna.tex | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/macros/luatex/generic/luavlna/luavlna.tex b/macros/luatex/generic/luavlna/luavlna.tex index f3c44f1b69..a0fb9e515e 100644 --- a/macros/luatex/generic/luavlna/luavlna.tex +++ b/macros/luatex/generic/luavlna/luavlna.tex @@ -5,6 +5,7 @@ langno = require "luavlna-langno" require "ltluatex" luatexbase.add_to_callback("pre_linebreak_filter", luavlna.preventsingle,"LuaVlna") +luatexbase.add_to_callback("hyphenate", luavlna.split_hyphens, "allow hyphen breaks") % -- define the attribute number luavlna.preventsingleid = math.random(2^16) @@ -54,6 +55,18 @@ set_main_language = function(lang) if not langid then return nil, "Cannot find language number for: "..lang end luavlna.set_main_language(langid) end + +enable_split_hyphens = function(lang) + local langid = languages:get_number(lang) + if not langid then return nil, "Cannot find language number for: "..lang end + luavlna.split_hyphen_langs[langid] = true +end + +disable_split_hyphens = function(lang) + local langid = languages:get_number(lang) + if not langid then return nil, "Cannot find language number for: "..lang end + luavlna.split_hyphen_langs[langid] = nil +end } % Set letters which are prevented from breaking @@ -89,6 +102,11 @@ end \directlua{luavlna.debug(false)} } +% enable/disable split hyphens for a language + +\def\enablesplithyphens#1{\directlua{enable_split_hyphens("#1")}} +\def\disablesplithyphens#1{\directlua{disable_split_hyphens("#1")}} + % disable processing of units or degrees \def\nopredegrees{\directlua{luavlna.no_predegrees = true}} @@ -99,5 +117,6 @@ end \singlechars{czech}{AIiVvOoUuSsZzKk} \singlechars{slovak}{AIiVvOoUuSsZzKk} \compoundinitials{czech}{Ch,CH} + \enablesplithyphens{czech} \fi |