diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-21 21:05:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-21 21:05:05 +0000 |
commit | 18c4b51ca1b98fb507d18afb9dbf02c3f0dd4baf (patch) | |
tree | 40df74fcad10980ff11a5c7a5dd2227af9ff7e2d /Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-otj.lua | |
parent | b1faafa7a3280da5554864dc3b75351f780b7c74 (diff) |
luaotfload (21may21)
git-svn-id: svn://tug.org/texlive/trunk@59293 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-otj.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-otj.lua | 115 |
1 files changed, 55 insertions, 60 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-otj.lua b/Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-otj.lua index bb02044dca6..c4ec9972cd4 100644 --- a/Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-otj.lua +++ b/Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-otj.lua @@ -90,6 +90,8 @@ local getoffsets = nuts.getoffsets local getboth = nuts.getboth local getdisc = nuts.getdisc local setdisc = nuts.setdisc +local getreplace = nuts.getreplace +local setreplace = nuts.setreplace local setoffsets = nuts.setoffsets local ischar = nuts.ischar local getkern = nuts.getkern @@ -98,13 +100,11 @@ local setlink = nuts.setlink local setwidth = nuts.setwidth local getwidth = nuts.getwidth ------ traverse_id = nuts.traverse_id ------ traverse_char = nuts.traverse_char local nextchar = nuts.traversers.char local nextglue = nuts.traversers.glue -local insert_node_before = nuts.insert_before -local insert_node_after = nuts.insert_after +local insertnodebefore = nuts.insertbefore +local insertnodeafter = nuts.insertafter local properties = nodes.properties.data @@ -124,7 +124,7 @@ if not fontkern then -- generic local thekern = nuts.new("kern",0) -- fontkern local setkern = nuts.setkern - local copy_node = nuts.copy_node + local copy_node = nuts.copy fontkern = function(k) local n = copy_node(thekern) @@ -138,7 +138,7 @@ if not italickern then -- generic local thekern = nuts.new("kern",3) -- italiccorrection local setkern = nuts.setkern - local copy_node = nuts.copy_node + local copy_node = nuts.copy italickern = function(k) local n = copy_node(thekern) @@ -667,12 +667,12 @@ local function inject_kerns_only(head,where) if leftkern and leftkern ~= 0 then if prev and getid(prev) == glue_code then if useitalickerns then - head = insert_node_before(head,current,italickern(leftkern)) + head = insertnodebefore(head,current,italickern(leftkern)) else setwidth(prev, getwidth(prev) + leftkern) end else - head = insert_node_before(head,current,fontkern(leftkern)) + head = insertnodebefore(head,current,fontkern(leftkern)) end end end @@ -731,7 +731,7 @@ local function inject_kerns_only(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - pre = insert_node_before(pre,n,fontkern(leftkern)) + pre = insertnodebefore(pre,n,fontkern(leftkern)) done = true end end @@ -747,7 +747,7 @@ local function inject_kerns_only(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - post = insert_node_before(post,n,fontkern(leftkern)) + post = insertnodebefore(post,n,fontkern(leftkern)) done = true end end @@ -763,7 +763,7 @@ local function inject_kerns_only(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - replace = insert_node_before(replace,n,fontkern(leftkern)) + replace = insertnodebefore(replace,n,fontkern(leftkern)) done = true end end @@ -830,39 +830,36 @@ local function inject_positions_only(head,where) rightkern = 0 elseif prev and getid(prev) == glue_code then if useitalickerns then - head = insert_node_before(head,current,italickern(leftkern)) + head = insertnodebefore(head,current,italickern(leftkern)) else setwidth(prev, getwidth(prev) + leftkern) end else - head = insert_node_before(head,current,fontkern(leftkern)) + head = insertnodebefore(head,current,fontkern(leftkern)) end end if rightkern and rightkern ~= 0 then if next and getid(next) == glue_code then if useitalickerns then - insert_node_after(head,current,italickern(rightkern)) + insertnodeafter(head,current,italickern(rightkern)) else setwidth(next, getwidth(next) + rightkern) end else - insert_node_after(head,current,fontkern(rightkern)) + insertnodeafter(head,current,fontkern(rightkern)) end end - else + elseif next then local i = p.emptyinjections if i then -- glyph|disc|glyph (special case) local rightkern = i.rightkern - if rightkern and rightkern ~= 0 then - if next and getid(next) == disc_code then - if replace then - -- error, we expect an empty one - else - -- KE setfield(next,"replace",fontkern(rightkern)) -- maybe also leftkern - replace = fontkern(rightkern) -- maybe also leftkern - done = true --KE - end + if rightkern and rightkern ~= 0 and getid(next) == disc_code then + local replace = getreplace(next) + if replace then + -- can't happen + else + setreplace(next,fontkern(rightkern)) end end end @@ -925,12 +922,12 @@ local function inject_positions_only(head,where) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - pre = insert_node_before(pre,n,fontkern(leftkern)) + pre = insertnodebefore(pre,n,fontkern(leftkern)) done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then - insert_node_after(pre,n,fontkern(rightkern)) + insertnodeafter(pre,n,fontkern(rightkern)) done = true end end @@ -950,12 +947,12 @@ local function inject_positions_only(head,where) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - post = insert_node_before(post,n,fontkern(leftkern)) + post = insertnodebefore(post,n,fontkern(leftkern)) done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then - insert_node_after(post,n,fontkern(rightkern)) + insertnodeafter(post,n,fontkern(rightkern)) done = true end end @@ -975,12 +972,12 @@ local function inject_positions_only(head,where) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - replace = insert_node_before(replace,n,fontkern(leftkern)) + replace = insertnodebefore(replace,n,fontkern(leftkern)) done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then - insert_node_after(replace,n,fontkern(rightkern)) + insertnodeafter(replace,n,fontkern(rightkern)) done = true end end @@ -996,7 +993,7 @@ local function inject_positions_only(head,where) -- glyph|pre glyphs local rightkern = i.rightkern if rightkern and rightkern ~= 0 then - pre = insert_node_before(pre,pre,fontkern(rightkern)) + pre = insertnodebefore(pre,pre,fontkern(rightkern)) done = true end end @@ -1010,7 +1007,7 @@ local function inject_positions_only(head,where) -- glyph|replace glyphs local rightkern = i.rightkern if rightkern and rightkern ~= 0 then - replace = insert_node_before(replace,replace,fontkern(rightkern)) + replace = insertnodebefore(replace,replace,fontkern(rightkern)) done = true end end @@ -1144,8 +1141,8 @@ local function inject_everything(head,where) -- -- todo: head and check for prev / next kern -- - insert_node_before(n,n,fontkern(-wn)) - insert_node_after(n,n,fontkern(-wn)) + insertnodebefore(n,n,fontkern(-wn)) + insertnodeafter(n,n,fontkern(-wn)) end end end @@ -1295,39 +1292,37 @@ local function inject_everything(head,where) rightkern = 0 elseif prev and getid(prev) == glue_code then if useitalickerns then - head = insert_node_before(head,current,italickern(leftkern)) + head = insertnodebefore(head,current,italickern(leftkern)) else setwidth(prev, getwidth(prev) + leftkern) end else - head = insert_node_before(head,current,fontkern(leftkern)) + head = insertnodebefore(head,current,fontkern(leftkern)) end end if rightkern and rightkern ~= 0 then if next and getid(next) == glue_code then if useitalickerns then - insert_node_after(head,current,italickern(rightkern)) + insertnodeafter(head,current,italickern(rightkern)) else setwidth(next, getwidth(next) + rightkern) end else - insert_node_after(head,current,fontkern(rightkern)) + insertnodeafter(head,current,fontkern(rightkern)) end end end - else + elseif next then local i = p.emptyinjections if i then -- glyph|disc|glyph (special case) local rightkern = i.rightkern - if rightkern and rightkern ~= 0 then - if next and getid(next) == disc_code then - if replace then - -- error, we expect an empty one - else - replace = fontkern(rightkern) - done = true - end + if rightkern and rightkern ~= 0 and getid(next) == disc_code then + local replace = getreplace(next) + if replace then + -- can't happen + else + setreplace(next,fontkern(rightkern)) end end end @@ -1406,12 +1401,12 @@ local function inject_everything(head,where) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - pre = insert_node_before(pre,n,fontkern(leftkern)) + pre = insertnodebefore(pre,n,fontkern(leftkern)) done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then - insert_node_after(pre,n,fontkern(rightkern)) + insertnodeafter(pre,n,fontkern(rightkern)) done = true end if hasmarks then @@ -1437,12 +1432,12 @@ local function inject_everything(head,where) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - post = insert_node_before(post,n,fontkern(leftkern)) + post = insertnodebefore(post,n,fontkern(leftkern)) done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then - insert_node_after(post,n,fontkern(rightkern)) + insertnodeafter(post,n,fontkern(rightkern)) done = true end if hasmarks then @@ -1468,12 +1463,12 @@ local function inject_everything(head,where) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - replace = insert_node_before(replace,n,fontkern(leftkern)) + replace = insertnodebefore(replace,n,fontkern(leftkern)) done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then - insert_node_after(replace,n,fontkern(rightkern)) + insertnodeafter(replace,n,fontkern(rightkern)) done = true end if hasmarks then @@ -1495,7 +1490,7 @@ local function inject_everything(head,where) -- glyph|pre glyphs local rightkern = i.rightkern if rightkern and rightkern ~= 0 then - pre = insert_node_before(pre,pre,fontkern(rightkern)) + pre = insertnodebefore(pre,pre,fontkern(rightkern)) done = true end end @@ -1509,7 +1504,7 @@ local function inject_everything(head,where) -- glyph|replace glyphs local rightkern = i.rightkern if rightkern and rightkern ~= 0 then - replace = insert_node_before(replace,replace,fontkern(rightkern)) + replace = insertnodebefore(replace,replace,fontkern(rightkern)) done = true end end @@ -1711,8 +1706,8 @@ local function injectspaces(head) if trace_spaces then report_spaces("%C [%p + %p + %p] %C",prevchar,lnew,old,rnew,nextchar) end - head = insert_node_before(head,n,italickern(lnew)) - insert_node_after(head,n,italickern(rnew)) + head = insertnodebefore(head,n,italickern(lnew)) + insertnodeafter(head,n,italickern(rnew)) else local new = old + (leftkern + rightkern) * factor if trace_spaces then @@ -1727,7 +1722,7 @@ local function injectspaces(head) if trace_spaces then report_spaces("%C [%p + %p]",prevchar,old,new) end - insert_node_after(head,n,italickern(new)) -- tricky with traverse but ok + insertnodeafter(head,n,italickern(new)) -- tricky with traverse but ok else local new = old + leftkern * factor if trace_spaces then @@ -1746,7 +1741,7 @@ local function injectspaces(head) if trace_spaces then report_spaces("[%p + %p] %C",old,new,nextchar) end - insert_node_after(head,n,italickern(new)) + insertnodeafter(head,n,italickern(new)) else local new = old + rightkern * factor if trace_spaces then |