diff options
| author | Elie Roux <elie.roux@telecom-bretagne.eu> | 2009-04-23 15:22:25 +0200 | 
|---|---|---|
| committer | Elie Roux <elie.roux@telecom-bretagne.eu> | 2009-04-23 15:22:25 +0200 | 
| commit | 190afdecb3f4d133e472fd17a140c57100219b7b (patch) | |
| tree | c4dce7c6e609147c6709581bf52f6443b10b95ad | |
| parent | fed311d67f0258a26530e04c43acf3d0261a25ce (diff) | |
| download | luaotfload-190afdecb3f4d133e472fd17a140c57100219b7b.tar.gz | |
sync with the latest ConTeXt beta, and using luaotfload in DVI mode too (for dvipdfmx)
| -rw-r--r-- | luaotfload.dtx | 23 | ||||
| -rw-r--r-- | otfl-data-con.lua (renamed from otfl-luat-con.lua) | 14 | ||||
| -rw-r--r-- | otfl-font-cid.lua | 2 | ||||
| -rw-r--r-- | otfl-font-def.lua | 15 | ||||
| -rw-r--r-- | otfl-font-dum.lua | 2 | ||||
| -rw-r--r-- | otfl-font-ota.lua | 47 | ||||
| -rw-r--r-- | otfl-font-otf.lua | 27 | ||||
| -rw-r--r-- | otfl-font-otn.lua | 14 | ||||
| -rw-r--r-- | otfl-font-tfm.lua | 152 | ||||
| -rw-r--r-- | otfl-luat-dum.lua | 11 | ||||
| -rw-r--r-- | otfl-node-inj.lua | 2 | 
11 files changed, 157 insertions, 152 deletions
| diff --git a/luaotfload.dtx b/luaotfload.dtx index 7422158..ab04b2c 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -4,7 +4,7 @@  %  % This work is under the CC0 license.  % -% This work consists of the main source file luamcallbacks.dtx +% This work consists of the main source file luaotfload.dtx  % and the derived files  %    luaotfload.sty, luaotfload.lua  % @@ -49,7 +49,7 @@ Copyright (C) 2009 by Elie Roux <elie.roux@telecom-bretagne.eu>  This work is under the CC0 license. -This work consists of the main source file luainputenc.dtx +This work consists of the main source file luaotfload.dtx  and the derived files      luaotfload.sty, luaotfload.lua @@ -278,7 +278,7 @@ end  %    \begin{macrocode}  luaotfload.loadmodule('luat-dum.lua') -- not used in context at all -luaotfload.loadmodule('luat-con.lua') -- maybe some day we don't need this one +luaotfload.loadmodule('data-con.lua') -- maybe some day we don't need this one  %    \end{macrocode}  % @@ -308,6 +308,7 @@ end  %  %    \begin{macrocode} +luaotfload.loadmodule('node-res.lua')  luaotfload.loadmodule('node-inj.lua')  luaotfload.loadmodule('node-fnt.lua')  luaotfload.loadmodule('node-dum.lua') @@ -395,22 +396,6 @@ end    \RequirePackage{luatextra}  \fi -%    \end{macrocode} -% -% We print a warning if we are not in PDF mode. -% -%    \begin{macrocode} - -\ifnum\pdfoutput<1 -  \expandafter\ifx\csname PackageWarning\endcsname\relax -    \write16{} -    \write16{Warning: luaotfload only works in PDF mode, otf fonts won't work.} -    \write16{} -  \else -    \PackageWarning{luaotfload}{luaotfload only works in PDF mode, otf fonts won't work.} -  \fi -\fi -  \expandafter\edef\csname otfl@AtEnd\endcsname{%    \catcode64 \the\catcode64\relax  } diff --git a/otfl-luat-con.lua b/otfl-data-con.lua index e93e920..ec146f0 100644 --- a/otfl-luat-con.lua +++ b/otfl-data-con.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['luat-loc'] = { +if not modules then modules = { } end modules ['data-con'] = {      version   = 1.001,      comment   = "companion to luat-lib.tex",      author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -8,11 +8,11 @@ if not modules then modules = { } end modules ['luat-loc'] = {  local format, lower, gsub = string.format, string.lower, string.gsub -local trace_cache      = false  trackers.register("input.cache",      function(v) trace_cache      = v end) -local trace_containers = false  trackers.register("input.containers", function(v) trace_containers = v end) -local trace_storage    = false  trackers.register("input.storage",    function(v) trace_storage    = v end) -local trace_verbose    = false  trackers.register("input.verbose",    function(v) trace_verbose    = v end) -local trace_locating   = false  trackers.register("input.locating",   function(v) trace_locating   = v trace_verbose = v end) +local trace_cache      = false  trackers.register("resolvers.cache",      function(v) trace_cache      = v end) +local trace_containers = false  trackers.register("resolvers.containers", function(v) trace_containers = v end) +local trace_storage    = false  trackers.register("resolvers.storage",    function(v) trace_storage    = v end) +local trace_verbose    = false  trackers.register("resolvers.verbose",    function(v) trace_verbose    = v end) +local trace_locating   = false  trackers.register("resolvers.locating",   function(v) trace_locating   = v trackers.enable("resolvers.verbose") end)  --[[ldx--  <p>Once we found ourselves defining similar cache constructs @@ -70,7 +70,7 @@ function containers.define(category, subcategory, version, enabled)  end  function containers.is_usable(container, name) -    return container.enabled and caches and caches.is_writable(container.path, name) +    return container.enabled and caches and caches.iswritable(container.path, name)  end  function containers.is_valid(container, name) diff --git a/otfl-font-cid.lua b/otfl-font-cid.lua index 88de5fd..b1ddaae 100644 --- a/otfl-font-cid.lua +++ b/otfl-font-cid.lua @@ -85,7 +85,7 @@ local function locate(registry,ordering,supplement)          if trace_loading then              logs.report("load otf","checking cidmap, registry: %s, ordering: %s, supplement: %s, filename: %s",registry,ordering,supplement,filename)          end -        local fullname = input.find_file(filename,'cid') or "" +        local fullname = resolvers.find_file(filename,'cid') or ""          if fullname ~= "" then              cidmap = fonts.cid.load(fullname)              if cidmap then diff --git a/otfl-font-def.lua b/otfl-font-def.lua index f6bcb54..284f8ef 100644 --- a/otfl-font-def.lua +++ b/otfl-font-def.lua @@ -323,7 +323,7 @@ evolved. Each one has its own way of dealing with its format.</p>  local function check_tfm(specification,fullname)      -- ofm directive blocks local path search unless set -    fullname = input.findbinfile(fullname, 'tfm') or "" -- just to be sure +    fullname = resolvers.findbinfile(fullname, 'tfm') or "" -- just to be sure      if fullname ~= "" then          specification.filename, specification.format = fullname, "ofm"          return tfm.read_from_tfm(specification) @@ -331,7 +331,7 @@ local function check_tfm(specification,fullname)  end  local function check_afm(specification,fullname) -    fullname = input.findbinfile(fullname, 'afm') or "" -- just to be sure +    fullname = resolvers.findbinfile(fullname, 'afm') or "" -- just to be sure      if fullname ~= "" then          specification.filename, specification.format = fullname, "afm"          return tfm.read_from_afm(specification) @@ -380,17 +380,17 @@ function readers.afm(specification,method)  end  local function check_otf(specification,suffix,what) -    local fullname, tfmtable = input.findbinfile(specification.name,suffix) or "", nil +    local fullname, tfmtable = resolvers.findbinfile(specification.name,suffix) or "", nil      if fullname == "" then          local fb = fonts.names.old_to_new[specification.name]          if fb then -            fullname = input.findbinfile(fb,suffix) or "" +            fullname = resolvers.findbinfile(fb,suffix) or ""          end      end      if fullname == "" then          local fb = fonts.names.new_to_old[specification.name]          if fb then -            fullname = input.findbinfile(fb,suffix) or "" +            fullname = resolvers.findbinfile(fb,suffix) or ""          end      end      if fullname ~= "" then @@ -515,6 +515,7 @@ function define.read(specification,size,id) -- id can be optional, name can alre          end          if fontdata then              fontdata.hash = hash +            fontdata.cache = "no"              if id then                  define.register(fontdata,id)              end @@ -546,7 +547,7 @@ function vf.find(name)              if trace_defining then                  logs.report("define font","locating vf for %s",name)              end -            return input.findbinfile(name,"ovf") +            return resolvers.findbinfile(name,"ovf")          else              if trace_defining then                  logs.report("define font","vf for %s is already taken care of",name) @@ -557,7 +558,7 @@ function vf.find(name)          if trace_defining then              logs.report("define font","locating vf for %s",name)          end -        return input.findbinfile(name,"ovf") +        return resolvers.findbinfile(name,"ovf")      end  end diff --git a/otfl-font-dum.lua b/otfl-font-dum.lua index f364152..0dedc85 100644 --- a/otfl-font-dum.lua +++ b/otfl-font-dum.lua @@ -53,7 +53,7 @@ function fonts.names.resolve(name,sub)          local basename = fonts.names.basename          if basename and basename ~= "" then              for _, format in ipairs { "lua", "tex", "other text files" } do -                local foundname = input.find_file(basename,format) or "" +                local foundname = resolvers.find_file(basename,format) or ""                  if foundname ~= "" then                      data = dofile(foundname)                      if data then diff --git a/otfl-font-ota.lua b/otfl-font-ota.lua index c6a5b29..72e7414 100644 --- a/otfl-font-ota.lua +++ b/otfl-font-ota.lua @@ -32,10 +32,14 @@ local glyph   = node.id('glyph')  local glue    = node.id('glue')  local penalty = node.id('penalty') -local set_attribute = node.set_attribute -local has_attribute = node.has_attribute -local traverse_id   = node.traverse_id -local remove_node   = nodes.remove +local set_attribute      = node.set_attribute +local has_attribute      = node.has_attribute +local traverse_id        = node.traverse_id +local delete_node        = nodes.delete +local replace_node       = nodes.replace +local insert_node_after  = node.insert_after +local insert_node_before = node.insert_before +local traverse_node_list = node.traverse  local fontdata = fonts.ids  local state    = attributes.private('state') @@ -46,12 +50,6 @@ local fcr = (fonts.color and fonts.color.reset) or function() end  local a_to_script   = otf.a_to_script  local a_to_language = otf.a_to_language -local remove_node        = node.remove -local delete_node        = nodes.delete -local insert_node_after  = node.insert_after -local insert_node_before = node.insert_before -local traverse_node_list = node.traverse -  -- in the future we will use language/script attributes instead of the  -- font related value, but then we also need dynamic features which is  -- somewhat slower; and .. we need a chain of them @@ -239,17 +237,23 @@ end  function fonts.analyzers.methods.arab(head,font,attr) -- maybe make a special version with no trace      local tfmdata = fontdata[font] ---~     local marks = tfmdata.shared.otfdata.luatex.marks      local marks = tfmdata.marks      local first, last, current, done = nil, nil, head, false -    local removejoiners = otf.remove_joiners -    local joiners = { } +    local joiners, nonjoiners +    local removejoiners = tfmdata.remove_joiners -- or otf.remove_joiners +    if removejoiners then +        joiners, nonjoiners = { }, { } +    end      while current do          if current.id == glyph and current.subtype<256 and current.font == font and not has_attribute(current,state) then              done = true              local char = current.char -            if removejoiners and char == zwj or char == zwnj then -                joiners[#joiners+1] = current +            if removejoiners then +                if char == zwj then +                    joiners[#joiners+1] = current +                elseif char == zwnj then +                    nonjoiners[#nonjoiners+1] = current +                end              end              if marks[char] then                  set_attribute(current,state,5) -- mark @@ -298,8 +302,19 @@ function fonts.analyzers.methods.arab(head,font,attr) -- maybe make a special ve      first, last = finish(first,last)      if removejoiners then          for i=1,#joiners do -            head = delete_node(head,joiners[i]) -- was remove so no free +            head = delete_node(head,joiners[i]) +        end +        for i=1,#nonjoiners do +            head = replace_node(head,nonjoiners[i],nodes.glue(0)) -- or maybe a kern          end      end      return head, done  end + +table.insert(fonts.manipulators,"joiners") + +function fonts.initializers.node.otf.joiners(tfmdata,value) +    if value == "strip" then +        tfmdata.remove_joiners = true +    end +end diff --git a/otfl-font-otf.lua b/otfl-font-otf.lua index 9c1e6f0..a63b9e3 100644 --- a/otfl-font-otf.lua +++ b/otfl-font-otf.lua @@ -79,9 +79,8 @@ otf.features.default = otf.features.default or { }  otf.enhancers        = otf.enhancers        or { } -otf.version          = 2.617 +otf.version          = 2.619  otf.pack             = true -otf.enhance_data     = false  otf.syncspace        = true  otf.notdef           = false  otf.cache            = containers.define("fonts", "otf", otf.version, true) @@ -173,7 +172,7 @@ otf.tables.valid_fields = {  local function load_featurefile(ff,featurefile)      if featurefile then -        featurefile = input.find_file(file.addsuffix(featurefile,'fea')) -- "FONTFEATURES" +        featurefile = resolvers.find_file(file.addsuffix(featurefile,'fea')) -- "FONTFEATURES"          if featurefile and featurefile ~= "" then              if trace_loading then                  logs.report("load otf", "featurefile: %s", featurefile) @@ -1203,6 +1202,7 @@ function otf.otf_to_tfm(specification)      local features = specification.features.normal      local cache_id = specification.hash      local tfmdata  = containers.read(tfm.cache(),cache_id) +--~ print(cache_id)      if not tfmdata then          local otfdata = otf.load(filename,format,sub,features and features.featurefile)          if not table.is_empty(otfdata) then @@ -1211,7 +1211,7 @@ function otf.otf_to_tfm(specification)                  anchorhash  = { },                  initialized = false,              } -            tfmdata = otf.copy_to_tfm(otfdata) +            tfmdata = otf.copy_to_tfm(otfdata,cache_id)              if not table.is_empty(tfmdata) then                  tfmdata.unique = tfmdata.unique or { }                  tfmdata.shared = tfmdata.shared or { } -- combine @@ -1261,7 +1261,10 @@ end  -- the first version made a top/mid/not extensible table, now we just pass on the variants data  -- and deal with it in the tfm scaler (there is no longer an extensible table anyway) -function otf.copy_to_tfm(data) -- we can save a copy when we reorder the tma to unicode (nasty due to one->many) +-- we cannot share descriptions as virtual fonts might extend them (ok, we could +-- use a cache with a hash + +function otf.copy_to_tfm(data,cache_id) -- we can save a copy when we reorder the tma to unicode (nasty due to one->many)      if data then          local glyphs, pfminfo, metadata = data.glyphs or { }, data.pfminfo or { }, data.metadata or { }          local luatex = data.luatex @@ -1278,9 +1281,8 @@ function otf.copy_to_tfm(data) -- we can save a copy when we reorder the tma to          }          -- indices maps from unicodes to indices          for u, i in next, indices do -            local d = glyphs[i]              characters[u] = { } -- we need this because for instance we add protruding info -            descriptions[u] = d +            descriptions[u] = glyphs[i]          end          -- math          if metadata.math then @@ -1292,7 +1294,8 @@ function otf.copy_to_tfm(data) -- we can save a copy when we reorder the tma to              for u, char in next, characters do                  local d = descriptions[u]                  local m = d.math -                -- we could prepare the variants +                -- we have them shared because that packs nicer +                -- we could prepare the variants and keep 'm in descriptions                  if m then                      local variants = m.horiz_variants                      if variants then @@ -1319,6 +1322,10 @@ function otf.copy_to_tfm(data) -- we can save a copy when we reorder the tma to                              c.vert_variants = m.vert_parts                          end                      end +                    local kerns = m.kerns +                    if kerns then +                        char.mathkerns = kerns +                    end                  end              end          end @@ -1330,7 +1337,7 @@ function otf.copy_to_tfm(data) -- we can save a copy when we reorder the tma to          local spaceunits = 500          tfm.units              = metadata.units_per_em or 1000          -- we need a runtime lookup because of running from cdrom or zip, brrr -        tfm.filename           = input.findbinfile(luatex.filename,"") or luatex.filename +        tfm.filename           = resolvers.findbinfile(luatex.filename,"") or luatex.filename          tfm.fullname           = metadata.fontname or metadata.fullname          tfm.encodingbytes      = 2          tfm.cidinfo            = data.cidinfo @@ -1456,7 +1463,7 @@ function tfm.read_from_open_type(specification)          end          if filename then              tfmtable.encodingbytes = 2 -            tfmtable.filename = input.findbinfile(filename,"") or filename +            tfmtable.filename = resolvers.findbinfile(filename,"") or filename              tfmtable.fullname = otfdata.metadata.fontname or otfdata.metadata.fullname              local order = otfdata and otfdata.metadata.order2              if order == 0 then diff --git a/otfl-font-otn.lua b/otfl-font-otn.lua index 91deb87..c4c42fa 100644 --- a/otfl-font-otn.lua +++ b/otfl-font-otn.lua @@ -752,9 +752,6 @@ end  function handlers.gpos_pair(start,kind,lookupname,kerns,sequence)      -- todo: kerns in disc nodes: pre, post, replace -> loop over disc too      -- todo: kerns in components of ligatures ---~ local alreadydone = cursonce and has_attribute(start,curscurs) -local alreadydone = false -if not alreadydone then      local snext = start.next      if not snext then          return start, false @@ -763,7 +760,8 @@ if not alreadydone then          local factor = tfmdata.factor          while snext and snext.id == glyph and snext.subtype<256 and snext.font == currentfont do              local nextchar = snext.char -            if marks[nextchar] then +local krn = kerns[nextchar] +            if not krn and marks[nextchar] then                  prev = snext                  snext = snext.next              else @@ -813,9 +811,6 @@ if not alreadydone then          end          return start, done      end -else -return start, false -end  end  --[[ldx-- @@ -1428,11 +1423,12 @@ function chainprocs.gpos_pair(start,stop,kind,chainname,currentcontext,cache,cur                  local factor = tfmdata.factor                  while snext and snext.id == glyph and snext.subtype<256 and snext.font == currentfont do                      local nextchar = snext.char -                    if marks[nextchar] then +local krn = kerns[nextchar] +                    if not krn and marks[nextchar] then                          prev = snext                          snext = snext.next                      else -                        local krn = kerns[nextchar] +--~                         local krn = kerns[nextchar]                          if not krn then                              -- skip                          elseif type(krn) == "table" then diff --git a/otfl-font-tfm.lua b/otfl-font-tfm.lua index 1d81602..ab8a4db 100644 --- a/otfl-font-tfm.lua +++ b/otfl-font-tfm.lua @@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['font-tfm'] = {  local utf = unicode.utf8  local next, format, match, lower = next, string.format, string.match, string.lower -local concat, sortedkeys, utfbyte = table.concat, table.sortedkeys, utf.byte +local concat, sortedkeys, utfbyte, serialize = table.concat, table.sortedkeys, utf.byte, table.serialize  local trace_defining = false  trackers.register("fonts.defining", function(v) trace_defining = v end)  local trace_scaling  = false  trackers.register("fonts.scaling" , function(v) trace_scaling  = v end) @@ -25,7 +25,7 @@ local trace_scaling  = false  trackers.register("fonts.scaling" , function(v) tr  fonts     = fonts     or { }  fonts.tfm = fonts.tfm or { } -fonts.ids = fonts.ids  or { } +fonts.ids = fonts.ids or { }  local tfm = fonts.tfm @@ -86,7 +86,7 @@ function tfm.read_from_tfm(specification)              tfmdata.descriptions = tfmdata.descriptions or { }              if tfm.resolve_vf then                  fonts.logger.save(tfmdata,file.extname(fname),specification) -- strange, why here -                fname = input.findbinfile(specification.name, 'ovf') +                fname = resolvers.findbinfile(specification.name, 'ovf')                  if fname and fname ~= "" then                      local vfdata = font.read_vf(fname,specification.size) -- not cached, fast enough                      if vfdata then @@ -219,6 +219,13 @@ function tfm.prepare_base_kerns(tfmdata)      end  end +-- we can have cache scaled characters when we are in node mode and don't have +-- protruding and expansion: hash == fullname @ size @ protruding @ expansion +-- but in practice (except from mk) the otf hash will be enough already so it +-- makes no sense to mess  up the code now + +local charactercache = { } +  function tfm.do_scale(tfmtable, scaledpoints)      tfm.prepare_base_kerns(tfmtable) -- optimalization      if scaledpoints < 0 then @@ -263,14 +270,6 @@ function tfm.do_scale(tfmtable, scaledpoints)      tp.x_height      = (tfmp.x_height      or tfmp[5] or 0)*delta      tp.quad          = (tfmp.quad          or tfmp[6] or 0)*delta      tp.extra_space   = (tfmp.extra_space   or tfmp[7] or 0)*delta ---~ texio.write_nl("START") ---~ texio.write_nl(tfmtable.designsize) ---~ texio.write_nl(scaledpoints) ---~ texio.write_nl(tfmtable.units) ---~ texio.write_nl(delta) ---~ texio.write_nl(tfmtable.math_parameters.AxisHeight or "?") ---  t.MathConstants = tfm.scaled_math_parameters(tfmtable.math_parameters,delta) ---~ texio.write_nl(t.MathConstants.AxisHeight or "?")      local protrusionfactor = (tp.quad ~= 0 and 1000/tp.quad) or 0      local tc = t.characters      local characters = tfmtable.characters @@ -361,7 +360,7 @@ function tfm.do_scale(tfmtable, scaledpoints)          if hasquality then              local ve = v.expansion_factor              if ve then -                chr.expansion_factor = ve*1000 -- expansionfactor +                chr.expansion_factor = ve*1000 -- expansionfactor, hm, can happen elsewhere              end              local vl = v.left_protruding              if vl then @@ -378,77 +377,76 @@ function tfm.do_scale(tfmtable, scaledpoints)              chr.italic = vi*delta          end          -- to be tested -if hasmath then - -        -- todo, just operate on descriptions.math -        local vn = v.next -        if vn then -            chr.next = vn -        else -            local vv = v.vert_variants -            if vv then -                local t = { } -                for i=1,#vv do -                    local vvi = vv[i] -                    t[i] = { -                        ["start"]    = (vvi["start"]   or 0)*delta, -                        ["end"]      = (vvi["end"]     or 0)*delta, -                        ["advance"]  = (vvi["advance"] or 0)*delta, -                        ["extender"] =  vvi["extender"], -                        ["glyph"]    =  vvi["glyph"], -                    } -                end -                chr.vert_variants = t +        if hasmath then +            -- todo, just operate on descriptions.math +            local vn = v.next +            if vn then +                chr.next = vn              else -                local hv = v.horiz_variants -                if hv then +                local vv = v.vert_variants +                if vv then                      local t = { } -                    for i=1,#hv do -                        local hvi = hv[i] +                    for i=1,#vv do +                        local vvi = vv[i]                          t[i] = { -                            ["start"]    = (hvi["start"]   or 0)*delta, -                            ["end"]      = (hvi["end"]     or 0)*delta, -                            ["advance"]  = (hvi["advance"] or 0)*delta, -                            ["extender"] =  hvi["extender"], -                            ["glyph"]    =  hvi["glyph"], +                            ["start"]    = (vvi["start"]   or 0)*delta, +                            ["end"]      = (vvi["end"]     or 0)*delta, +                            ["advance"]  = (vvi["advance"] or 0)*delta, +                            ["extender"] =  vvi["extender"], +                            ["glyph"]    =  vvi["glyph"],                          }                      end -                    chr.horiz_variants = t +                    chr.vert_variants = t +                else +                    local hv = v.horiz_variants +                    if hv then +                        local t = { } +                        for i=1,#hv do +                            local hvi = hv[i] +                            t[i] = { +                                ["start"]    = (hvi["start"]   or 0)*delta, +                                ["end"]      = (hvi["end"]     or 0)*delta, +                                ["advance"]  = (hvi["advance"] or 0)*delta, +                                ["extender"] =  hvi["extender"], +                                ["glyph"]    =  hvi["glyph"], +                            } +                        end +                        chr.horiz_variants = t +                    end                  end              end -        end -        local vt = description.top_accent -        if vt then -            chr.top_accent = delta*vt -        end -        if stackmath then -            local mk = v.mathkerns -            if mk then -                local kerns = { } -             -- for k, v in next, mk do -             --     local kk = { } -              --     for i=1,#v do -             --         local vi = v[i] -             --         kk[i] = { height = delta*vi.height, kern = delta*vi.kern } -             --     end -             --     kerns[k] = kk -             -- end -                local v = mk.top_right    if v then local k = { } for i=1,#v do local vi = v[i] -                    k[i] = { height = delta*vi.height, kern = delta*vi.kern } -                end     kerns.top_right    = k end -                local v = mk.top_left     if v then local k = { } for i=1,#v do local vi = v[i] -                    k[i] = { height = delta*vi.height, kern = delta*vi.kern } -                end     kerns.top_left     = k end -                local v = mk.bottom_left  if v then local k = { } for i=1,#v do local vi = v[i] -                    k[i] = { height = delta*vi.height, kern = delta*vi.kern } -                end     kerns.bottom_left  = k end -                local v = mk.bottom_right if v then local k = { } for i=1,#v do local vi = v[i] -                    k[i] = { height = delta*vi.height, kern = delta*vi.kern } -                end     kerns.bottom_right = k end -                chr.mathkern = kerns -- singular +            local vt = description.top_accent +            if vt then +                chr.top_accent = delta*vt +            end +            if stackmath then +                local mk = v.mathkerns +                if mk then +                    local kerns = { } +                 -- for k, v in next, mk do +                 --     local kk = { } +                  --     for i=1,#v do +                 --         local vi = v[i] +                 --         kk[i] = { height = delta*vi.height, kern = delta*vi.kern } +                 --     end +                 --     kerns[k] = kk +                 -- end +                    local v = mk.top_right    if v then local k = { } for i=1,#v do local vi = v[i] +                        k[i] = { height = delta*vi.height, kern = delta*vi.kern } +                    end     kerns.top_right    = k end +                    local v = mk.top_left     if v then local k = { } for i=1,#v do local vi = v[i] +                        k[i] = { height = delta*vi.height, kern = delta*vi.kern } +                    end     kerns.top_left     = k end +                    local v = mk.bottom_left  if v then local k = { } for i=1,#v do local vi = v[i] +                        k[i] = { height = delta*vi.height, kern = delta*vi.kern } +                    end     kerns.bottom_left  = k end +                    local v = mk.bottom_right if v then local k = { } for i=1,#v do local vi = v[i] +                        k[i] = { height = delta*vi.height, kern = delta*vi.kern } +                    end     kerns.bottom_right = k end +                    chr.mathkern = kerns -- singular +                end              end          end -end          if not nodemode then              local vk = v.kerns              if vk then @@ -558,7 +556,7 @@ local lastfont = nil  -- base mode) but it complicates vf building where the new characters  -- demand this data ---~ for id, f in pairs(fonts.ids) do +--~ for id, f in pairs(fonts.ids) do -- or font.fonts  --~     local ffi = font.fonts[id]  --~     f.characters = ffi.characters  --~     f.kerns = ffi.kerns @@ -809,5 +807,7 @@ fonts.initializers.node.tfm.remap = tfm.remap  -- status info  statistics.register("fonts load time", function() -    return format("%s seconds",statistics.elapsedtime(fonts)) +    if statistics.elapsedindeed(fonts) then +        return format("%s seconds",statistics.elapsedtime(fonts)) +    end  end) diff --git a/otfl-luat-dum.lua b/otfl-luat-dum.lua index 5c53115..4d7d9c5 100644 --- a/otfl-luat-dum.lua +++ b/otfl-luat-dum.lua @@ -32,12 +32,11 @@ tasks = {      prependaction = dummyfunction,  } -  -- we need to cheat a bit here  texconfig.kpse_init = true -input = { } -- no fancy file helpers used +resolvers = resolvers or { } -- no fancy file helpers used  local remapper = {      otf = "opentype fonts", @@ -45,14 +44,14 @@ local remapper = {      ttc = "truetype fonts"  } -function input.find_file(name,kind) -    name = name:gsub("\\","\/") +function resolvers.find_file(name,kind) +    name = string.gsub(name,"\\","\/")      return kpse.find_file(name,(kind ~= "" and kind) or "tex")  end -function input.findbinfile(name,kind) +function resolvers.findbinfile(name,kind)      if not kind or kind == "" then          kind = file.extname(name) -- string.match(name,"%.([^%.]-)$")      end -    return input.find_file(name,(kind and remapper[kind]) or kind) +    return resolvers.find_file(name,(kind and remapper[kind]) or kind)  end diff --git a/otfl-node-inj.lua b/otfl-node-inj.lua index 6fd93fa..6ba21b3 100644 --- a/otfl-node-inj.lua +++ b/otfl-node-inj.lua @@ -166,6 +166,8 @@ function nodes.trace_injection(head)      report("end run")  end +-- todo: reuse tables (i.e. no collection), but will be extra fields anyway +  function nodes.inject_kerns(head,tail,keep)      if trace_injections then          nodes.trace_injection(head) | 
