From dd796b0b185b80cdeabf3ff229b2b92a00d5f41d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 2 Jun 2020 21:14:53 +0000 Subject: luavlna (2jun20) git-svn-id: svn://tug.org/texlive/trunk@55391 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/luatex/luavlna/luavlna.lua | 17 +++++++++++++---- Master/texmf-dist/tex/luatex/luavlna/luavlna.sty | 2 +- Master/texmf-dist/tex/luatex/luavlna/luavlna.tex | 12 ++++++------ 3 files changed, 20 insertions(+), 11 deletions(-) (limited to 'Master/texmf-dist/tex/luatex') diff --git a/Master/texmf-dist/tex/luatex/luavlna/luavlna.lua b/Master/texmf-dist/tex/luatex/luavlna/luavlna.lua index d1eaa6f0044..511ee859a1b 100644 --- a/Master/texmf-dist/tex/luatex/luavlna/luavlna.lua +++ b/Master/texmf-dist/tex/luatex/luavlna/luavlna.lua @@ -30,6 +30,15 @@ local singlechars = {} -- {a=true,i=true,z=true, v=true, u=true, o = true} local initials = {} +local getchar = function(n) + local real_char = n.char + -- test if char is valid utf8 value, return dummy value otherwise + if (real_char >= 57344 and real_char <= 63743) or (real_char >= 983040 and real_char <= 1048573) or real_char >= 1048576 then + return "a" + end + return utf_char(real_char) +end + local main_language = nil -- when main_language is set, we will not use lang info in the nodes, but @@ -267,9 +276,9 @@ local function prevent_single_letter (head) anchor = head word = "" init = is_initial " " -- reset initials - elseif space==true and id == glyph_id and is_alpha(utf_char(head.char)) then -- a letter + elseif space==true and id == glyph_id and is_alpha(getchar(head)) then -- a letter local lang = get_language(head.lang) - local char = utf_char(head.char) + local char = getchar(head) word = char init = is_initial(char,lang) local s = singlechars[lang] or {} -- load singlechars for node's lang @@ -289,7 +298,7 @@ local function prevent_single_letter (head) elseif no_initials~=true and init and head.id == glyph_id and head.char == period_char and nextn.id == glue_id and utf_len(word) == 1 then head = insert_penalty(head) elseif head.id == glyph_id then - local char = utf_char(head.char) + local char = getchar(head) word = word .. char init = is_initial(char, head.lang) -- hlist support @@ -300,7 +309,7 @@ local function prevent_single_letter (head) prevent_single_letter(head.head) end elseif id == glyph_id and in_math then - word = word .. utf_char(head.char) + word = word .. getchar(head) end head = head.next end diff --git a/Master/texmf-dist/tex/luatex/luavlna/luavlna.sty b/Master/texmf-dist/tex/luatex/luavlna/luavlna.sty index c620b670d10..aa6f623aa9c 100644 --- a/Master/texmf-dist/tex/luatex/luavlna/luavlna.sty +++ b/Master/texmf-dist/tex/luatex/luavlna/luavlna.sty @@ -23,7 +23,7 @@ \def\enablesplithyphens#1{% \ifcsname l@#1\endcsname% - \typeout{set lang #1, \the\csname l@#1\endcsname} + \typeout{set lang #1, \the\csname l@#1\endcsname}% \directlua{enable_split_hyphens("\the\csname l@#1\endcsname")}% \fi% } diff --git a/Master/texmf-dist/tex/luatex/luavlna/luavlna.tex b/Master/texmf-dist/tex/luatex/luavlna/luavlna.tex index ab47b8d6fcf..0b6540a5cc6 100644 --- a/Master/texmf-dist/tex/luatex/luavlna/luavlna.tex +++ b/Master/texmf-dist/tex/luatex/luavlna/luavlna.tex @@ -71,20 +71,20 @@ end % Set letters which are prevented from breaking \def\singlechars#1#2{% -\directlua{set_singlechars("#1","#2")} +\directlua{set_singlechars("#1","#2")}% } % Define compound initials \def\compoundinitials#1#2{% -\directlua{set_compounds("#1","#2")} +\directlua{set_compounds("#1","#2")}% } % Enable inserting of visual marks for debugging \def\preventsingledebugon{% -\directlua{luavlna.debug(true)} +\directlua{luavlna.debug(true)}% } \def\preventsinglelang#1{% - \directlua{set_main_language("#1")} + \directlua{set_main_language("#1")}% } %\newluatexattribute\preventsinglestatus @@ -94,12 +94,12 @@ end \preventsinglestatus=2 } -\def\preventsingleoff{ +\def\preventsingleoff{% \preventsinglestatus=1 } % Disable inserting of visual marks for dewbugging \def\preventsingledebugoff{% -\directlua{luavlna.debug(false)} +\directlua{luavlna.debug(false)}% } % enable/disable split hyphens for a language -- cgit v1.2.3