diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/babel-french/frenchb.lua')
-rw-r--r-- | Master/texmf-dist/tex/generic/babel-french/frenchb.lua | 71 |
1 files changed, 53 insertions, 18 deletions
diff --git a/Master/texmf-dist/tex/generic/babel-french/frenchb.lua b/Master/texmf-dist/tex/generic/babel-french/frenchb.lua index 3a4ba453dde..bbad9953a99 100644 --- a/Master/texmf-dist/tex/generic/babel-french/frenchb.lua +++ b/Master/texmf-dist/tex/generic/babel-french/frenchb.lua @@ -1,6 +1,6 @@ --[[ File `frenchb.lua’ generated from frenchb.dtx - [2017/07/08 v3.3b French support from the babel system] + [2017/09/07 v3.3c French support from the babel system] Copyright © 2014-2017 Daniel Flipo <daniel (dot) flipo (at) free (dot) fr> License LPPL: see french.ldf. @@ -47,23 +47,23 @@ local insert_node_after = node.insert_after local remove_node = node.remove local function get_glue(toks) local t = nil - local f = string.match(toks, "\092hskip%s*([%d%.]*)%s*\092fontdimen") + local f = string.match(toks, "\\hskip%s*([%d%.]*)%s*\\fontdimen 2") if f == "" then f = 1 end - if f then - t = {f, 0, 0} - f = string.match(toks, "plus%s*([%d%.]*)%s*\092fontdimen") + if tonumber(f) then + t = {tonumber(f), 0, 0} + f = string.match(toks, "plus%s*([%d%.]*)%s*\\fontdimen 3") if f == "" then f = 1 end - if f then - t[2] = f - f = string.match(toks, "minus%s*([%d%.]*)%s*\092fontdimen") + if tonumber(f) then + t[2] = tonumber(f) + f = string.match(toks, "minus%s*([%d%.]*)%s*\\fontdimen 4") if f == "" then f = 1 end - if f then - t[3] = f + if tonumber(f) then + t[3] = tonumber(f) end end - elseif string.match(toks, "\092F?B?thinspace") then + elseif string.match(toks, "\\F?B?thinspace") then t = {0.5, 0, 0} - elseif string.match(toks, "\092space") then + elseif string.match(toks, "\\space") then t = {1, 1, 1} end return t @@ -98,6 +98,7 @@ end local FBspacing = luatexbase.attributes['FB@spacing'] local addDPspace = luatexbase.attributes['FB@addDPspace'] local addGUILspace = luatexbase.attributes['FB@addGUILspace'] +local FBucsNBSP = luatexbase.attributes['FB@ucsNBSP'] local has_attribute = node.has_attribute local function french_punctuation (head) for item in node.traverse_id(GLYPH, head) do @@ -106,6 +107,25 @@ local function french_punctuation (head) local fid = item.font local FRspacing = has_attribute(item, FBspacing) FRspacing = FRspacing and FRspacing > 0 + local FRucsNBSP = has_attribute(item, FBucsNBSP) + FRucsNBSP = FRucsNBSP and FRucsNBSP > 0 + local NBthinspace = new_node("glyph") + NBthinspace.font = fid + NBthinspace.char = 0x202F + local NBcolnspace = new_node("glyph") + NBcolnspace.font = fid + if colngl[1] <= 0.5 then + NBcolnspace.char = 0x202F + else + NBcolnspace.char = 0xA0 + end + local NBguilspace = new_node("glyph") + NBguilspace.font = fid + if guilgl[1] <= 0.5 then + NBguilspace.char = 0x202F + else + NBguilspace.char = 0xA0 + end local SIG = has_attribute(item, addGUILspace) SIG = SIG and SIG >0 if lang == FR and FRspacing and @@ -137,17 +157,24 @@ local function french_punctuation (head) end end local fbglue + local nbspace if FB_punct_thick[char] then fbglue = new_glue_scaled(fid,colngl) + nbspace = NBcolnspace else fbglue = new_glue_scaled(fid,thingl) + nbspace = NBthinspace end if (realglue or auto) and fbglue then if realglue then head = remove_node(head,prev,true) end - insert_node_before(head, item, copy_node(nobreak)) - insert_node_before(head, item, copy_node(fbglue)) + if (FRucsNBSP) then + insert_node_before(head, item, copy_node(nbspace)) + else + insert_node_before(head, item, copy_node(nobreak)) + insert_node_before(head, item, copy_node(fbglue)) + end end elseif SIG then local addgl = (prev_char and not FB_guil_null[prev_char]) or @@ -163,8 +190,12 @@ local function french_punctuation (head) if is_glue then head = remove_node(head,prev,true) end - insert_node_before(head, item, copy_node(nobreak)) - insert_node_before(head, item, copy_node(fbglue)) + if (FRucsNBSP) then + insert_node_before(head, item, copy_node(NBguilspace)) + else + insert_node_before(head, item, copy_node(nobreak)) + insert_node_before(head, item, copy_node(fbglue)) + end end end end @@ -207,8 +238,12 @@ local function french_punctuation (head) if is_glue then head = remove_node(head,next,true) end - insert_node_after(head, item, copy_node(fbglue)) - insert_node_after(head, item, copy_node(nobreak)) + if (FRucsNBSP) then + insert_node_after(head, item, copy_node(NBguilspace)) + else + insert_node_after(head, item, copy_node(fbglue)) + insert_node_after(head, item, copy_node(nobreak)) + end end end end |