diff options
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/autotype/autotype.lua')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/autotype/autotype.lua | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/lualatex/autotype/autotype.lua b/Master/texmf-dist/tex/lualatex/autotype/autotype.lua index b75bc26b64c..e7ea16404d6 100644 --- a/Master/texmf-dist/tex/lualatex/autotype/autotype.lua +++ b/Master/texmf-dist/tex/lualatex/autotype/autotype.lua @@ -1,5 +1,5 @@ -- autotype.lua --- Copyright 2020-2023 Stephan Hennig and Keno Wehr +-- Copyright 2020-2024 Stephan Hennig and Keno Wehr --[[ This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 @@ -14,8 +14,8 @@ version 2005/12/01 or later. luatexbase.provides_module({ name = "autotype", - version = "0.4", - date = "2023-10-30", + version = "0.5", + date = "2024-01-05", description = "automatic language-specific typography" }) @@ -52,7 +52,7 @@ local final_round_s_codepoint = {} local function normalize_font(TeX_font_name) -- We have to do some normalization of the name of the current font. -- Examples: The yfrak font at 11pt is called "yfrak at 10.95pt" by TeX, but we need only "yfrak". - -- The yfrak font becomes something like "yfont+100ls" if it is letterspaced (e.g. with microtype's \textls commmand), + -- The yfrak font becomes something like "yfrak+100ls" if it is letterspaced (e.g. with microtype's \textls commmand), -- but again, we only need "yfrak". return string.gsub(TeX_font_name, "[ :%+].*", "") end @@ -159,11 +159,13 @@ end local function insert_tertiary_hyphenation_points(head, original_word, start_number, end_number, scan_node_list) local node_list = NLcopy(original_word.nodes[start_number], original_word.nodes[end_number].next) local words = scan_node_list(node_list) - for i, level in ipairs(words[1].levels) do - local j = start_number + i - 1 - -- Spot with surrounding top-level nodes? - if (level % 2 == 1) and not original_word.parents[j-1] and not original_word.parents[j] then - insert_discretionary(head, original_word.nodes[j-1], original_word.nodes[j], PENALTY_III, HYPHEN) + if #words > 0 then + for i, level in ipairs(words[1].levels) do + local j = start_number + i - 1 + -- Spot with surrounding top-level nodes? + if (level % 2 == 1) and not original_word.parents[j-1] and not original_word.parents[j] then + insert_discretionary(head, original_word.nodes[j-1], original_word.nodes[j], PENALTY_III, HYPHEN) + end end end end @@ -264,7 +266,13 @@ local function mark_hyphenation_points(head, lang_name) else local n = node.new("whatsit", "pdf_literal") n.mode = 0 - n.data = "q "..colour.." RG 0.7 w 0 2 m 0 8 l S Q" + if current.penalty == PENALTY_I then + n.data = "q "..colour.." RG 0.7 w 0 -1 m 0 8 l S Q" + elseif current.penalty == PENALTY_II then + n.data = "q "..colour.." RG 0.7 w 0 -1 m 0 3 l S Q" + else + n.data = "q "..colour.." RG 0.7 w 0 4 m 0 8 l S Q" + end n.next = current.next current.next.prev = n n.prev = current |