diff options
| author | Khaled Hosny <khaledhosny@eglug.org> | 2009-11-27 13:47:48 +0200 | 
|---|---|---|
| committer | Khaled Hosny <khaledhosny@eglug.org> | 2009-11-27 13:47:48 +0200 | 
| commit | 2f7e5d92dd3653654bf4e42da9f883a16655037e (patch) | |
| tree | 594b18483753248c26768903a9c5d315c01eae71 | |
| parent | 78d506538016cd295d9a84ac62e3e036f23feffc (diff) | |
| download | luaotfload-2f7e5d92dd3653654bf4e42da9f883a16655037e.tar.gz | |
Updating to latest ConTeXt stable (2009.11.26)
See http://wiki.contextgarden.net/Context_2009.11.26 for list of
changes.
| -rw-r--r-- | otfl-data-con.lua | 2 | ||||
| -rw-r--r-- | otfl-font-cid.lua | 9 | ||||
| -rw-r--r-- | otfl-font-dum.lua | 28 | ||||
| -rw-r--r-- | otfl-font-otf.lua | 13 | ||||
| -rw-r--r-- | otfl-font-otn.lua | 127 | ||||
| -rw-r--r-- | otfl-font-tfm.lua | 38 | ||||
| -rw-r--r-- | otfl-node-res.lua | 48 | 
7 files changed, 181 insertions, 84 deletions
| diff --git a/otfl-data-con.lua b/otfl-data-con.lua index d35bc7a..f06dba5 100644 --- a/otfl-data-con.lua +++ b/otfl-data-con.lua @@ -11,8 +11,6 @@ local format, lower, gsub = string.format, string.lower, string.gsub  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 diff --git a/otfl-font-cid.lua b/otfl-font-cid.lua index 13e9cce..7165288 100644 --- a/otfl-font-cid.lua +++ b/otfl-font-cid.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['font-cid'] = {      license   = "see context related readme files"  } -local format, match = string.format, string.match +local format, match, lower = string.format, string.match, string.lower  local tonumber = tonumber  local trace_loading = false  trackers.register("otf.loading",      function(v) trace_loading      = v end) @@ -79,8 +79,9 @@ end  local template = "%s-%s-%s.cidmap"  local function locate(registry,ordering,supplement) -    local filename = string.lower(format(template,registry,ordering,supplement)) -    local cidmap = fonts.cid.map[filename] +    local filename = format(template,registry,ordering,supplement) +    local hashname = lower(filename) +    local cidmap = fonts.cid.map[hasnname]      if not cidmap then          if trace_loading then              logs.report("load otf","checking cidmap, registry: %s, ordering: %s, supplement: %s, filename: %s",registry,ordering,supplement,filename) @@ -92,7 +93,7 @@ local function locate(registry,ordering,supplement)                  if trace_loading then                      logs.report("load otf","using cidmap file %s",filename)                  end -                fonts.cid.map[filename] = cidmap +                fonts.cid.map[hashname] = cidmap                  cidmap.usedname = file.basename(filename)                  return cidmap              end diff --git a/otfl-font-dum.lua b/otfl-font-dum.lua index c585c18..e13f8a2 100644 --- a/otfl-font-dum.lua +++ b/otfl-font-dum.lua @@ -39,10 +39,15 @@ function fonts.logger.save()  end  -- names +-- +-- Watch out, the version number is the same as the one used in +-- the mtx-fonts.lua function scripts.fonts.names as we use a +-- simplified font database in the plain solution and by using +-- a different number we're less dependent on context.  fonts.names = fonts.names or { } -fonts.names.version    = 1.014 +fonts.names.version    = 1.001 -- not the same as in context  fonts.names.basename   = "luatex-fonts-names.lua"  fonts.names.new_to_old = { }  fonts.names.old_to_new = { } @@ -57,16 +62,6 @@ function fonts.names.resolve(name,sub)                  local foundname = resolvers.find_file(basename,format) or ""                  if foundname ~= "" then                      data = dofile(foundname) -                    if data then -                        local d = {  } -                        for k, v in pairs(data.mapping) do -                            local t = v[1] -                            if t == "ttf" or t == "otf" or t == "ttc" or t == "dfont" then -                                d[k] = v -                            end -                        end -                        data.mapping = d -                    end                      break                  end              end @@ -75,11 +70,14 @@ function fonts.names.resolve(name,sub)      end      if type(data) == "table" and data.version == fonts.names.version then          local condensed = string.gsub(string.lower(name),"[^%a%d]","") -        local found = data.mapping and data.mapping[condensed] +        local found = data.mappings and data.mappings[condensed]          if found then -            local filename, is_sub = found[3], found[4] -            if is_sub then is_sub = found[2] end -            return filename, is_sub +            local fontname, filename, subfont = found[1], found[2], found[3] +            if subfont then +                return filename, fontname +            else +                return filename, false +            end          else              return name, false -- fallback to filename          end diff --git a/otfl-font-otf.lua b/otfl-font-otf.lua index b5f7cb4..6900b84 100644 --- a/otfl-font-otf.lua +++ b/otfl-font-otf.lua @@ -83,7 +83,7 @@ otf.features.default = otf.features.default or { }  otf.enhancers        = otf.enhancers        or { }  otf.glists           = { "gsub", "gpos" } -otf.version          = 2.635 -- beware: also sync font-mis.lua +otf.version          = 2.636 -- beware: also sync font-mis.lua  otf.pack             = true  -- beware: also sync font-mis.lua  otf.syncspace        = true  otf.notdef           = false @@ -1479,6 +1479,7 @@ function otf.copy_to_tfm(data,cache_id) -- we can save a copy when we reorder th                                  end                              end                              c.vert_variants = m.vert_parts +                            c.vert_italic_correction = m.vert_italic_correction                          end                      end                      local kerns = m.kerns @@ -1497,8 +1498,9 @@ function otf.copy_to_tfm(data,cache_id) -- we can save a copy when we reorder th          tfm.units              = metadata.units_per_em or 1000          -- we need a runtime lookup because of running from cdrom or zip, brrr          tfm.filename           = resolvers.findbinfile(luatex.filename,"") or luatex.filename -        tfm.fullname           = metadata.fontname or metadata.fullname -        tfm.psname             = tfm.fullname +        tfm.fullname           = metadata.fullname +        tfm.fontname           = metadata.fontname +        tfm.psname             = tfm.fontname or tfm.fullname          tfm.encodingbytes      = 2          tfm.cidinfo            = data.cidinfo          tfm.cidinfo.registry   = tfm.cidinfo.registry or "" @@ -1622,7 +1624,8 @@ function tfm.read_from_open_type(specification)          if filename then              tfmtable.encodingbytes = 2              tfmtable.filename = resolvers.findbinfile(filename,"") or filename -            tfmtable.fullname = tfmtable.fullname or otfdata.metadata.fontname or otfdata.metadata.fullname +            tfmtable.fontname = tfmtable.fontname or otfdata.metadata.fontname +            tfmtable.fullname = tfmtable.fullname or otfdata.metadata.fullname or tfmtable.fontname              local order = otfdata and otfdata.metadata.order2              if order == 0 then                  tfmtable.format = 'opentype' @@ -1631,7 +1634,7 @@ function tfm.read_from_open_type(specification)              else                  tfmtable.format = specification.format              end -            tfmtable.name = tfmtable.filename or tfmtable.fullname +            tfmtable.name = tfmtable.filename or tfmtable.fullname or tfmtable.fontname          end          fonts.logger.save(tfmtable,file.extname(specification.filename),specification)      end diff --git a/otfl-font-otn.lua b/otfl-font-otn.lua index 77d67d4..fb04b36 100644 --- a/otfl-font-otn.lua +++ b/otfl-font-otn.lua @@ -117,7 +117,7 @@ results in different tables.</p>  -- remark: the 'not implemented yet' variants will be done when we have fonts that use them  -- remark: we need to check what to do with discretionaries -local concat = table.concat +local concat, insert, remove = table.concat, table.insert, table.remove  local format, gmatch, gsub, find, match, lower, strip = string.format, string.gmatch, string.gsub, string.find, string.match, string.lower, string.strip  local type, next, tonumber, tostring = type, next, tonumber, tostring @@ -139,6 +139,7 @@ local trace_details      = false  trackers.register("otf.details",      function  local trace_applied      = false  trackers.register("otf.applied",      function(v) trace_applied      = v end)  local trace_steps        = false  trackers.register("otf.steps",        function(v) trace_steps        = v end)  local trace_skips        = false  trackers.register("otf.skips",        function(v) trace_skips        = v end) +local trace_directions   = false  trackers.register("otf.directions",   function(v) trace_directions   = v end)  trackers.register("otf.verbose_chain", function(v) otf.setcontextchain(v and "verbose") end)  trackers.register("otf.normal_chain",  function(v) otf.setcontextchain(v and "normal")  end) @@ -743,7 +744,7 @@ function handlers.gpos_cursive(start,kind,lookupname,exitanchors,sequence) -- to                                          if exit then                                              local dx, dy, bound = set_cursive(start,nxt,tfmdata.factor,rlmode,exit,entry,characters[startchar],characters[nextchar])                                              if trace_cursive then -                                                logprocess("%s: moving %s to %s cursive (%s,%s) using anchor %s and bound %s",pref(kind,lookupname),gref(startchar),gref(nextchar),dx,dy,anchor,bound) +                                                logprocess("%s: moving %s to %s cursive (%s,%s) using anchor %s and bound %s in rlmode %s",pref(kind,lookupname),gref(startchar),gref(nextchar),dx,dy,anchor,bound,rlmode)                                              end                                              done = true                                              break @@ -1395,7 +1396,7 @@ function chainprocs.gpos_cursive(start,stop,kind,chainname,currentcontext,cache,                                              if exit then                                                  local dx, dy, bound = set_cursive(start,nxt,tfmdata.factor,rlmode,exit,entry,characters[startchar],characters[nextchar])                                                  if trace_cursive then -                                                    logprocess("%s: moving %s to %s cursive (%s,%s) using anchor %s and bound %s",pref(kind,lookupname),gref(startchar),gref(nextchar),dx,dy,anchor,bound) +                                                    logprocess("%s: moving %s to %s cursive (%s,%s) using anchor %s and bound %s in rlmode %s",pref(kind,lookupname),gref(startchar),gref(nextchar),dx,dy,anchor,bound,rlmode)                                                  end                                                  done = true                                                  break @@ -1832,6 +1833,9 @@ local resolved = { } -- we only resolve a font,script,language pair once  -- todo: pass all these 'locals' in a table +-- maybe some day i'll make an alternative that works on 'sub direction runs' which might be +-- more efficient for arabic but it has quite some consequences +  function fonts.methods.node.otf.features(head,font,attr)      if trace_steps then          checkstep(head) @@ -1875,6 +1879,7 @@ function fonts.methods.node.otf.features(head,font,attr)      local ra  = rl      [attr]     if ra == nil then ra  = { } rl      [attr]     = ra  end -- attr can be false      -- sequences always > 1 so no need for optimization      for s=1,#sequences do +    local pardir, txtdir = 0, { }          local success = false          local sequence = sequences[s]          local r = ra[s] -- cache @@ -1974,7 +1979,7 @@ function fonts.methods.node.otf.features(head,font,attr)                  local ns = #subtables                  local thecache = featuredata[typ] or { }                  start = head -- local ? -                rlmode = 0 +                rlmode = 0 -- to be checked ?                  if ns == 1 then                      local lookupname = subtables[1]                      local lookupcache = thecache[lookupname] @@ -2016,24 +2021,57 @@ function fonts.methods.node.otf.features(head,font,attr)                              --         start = start.next                              --     end                              elseif id == whatsit then +--~                             if subtype == 7 then +--~                                 local dir = start.dir +--~                                 if dir == "+TRT" then +--~                                     rlmode = -1 +--~                                 elseif dir == "+TLT" then +--~                                     rlmode = 1 +--~                                 else +--~                                     rlmode = 0 +--~                                 end +--~                             elseif subtype == 6 then +--~                                 local dir = start.dir +--~                                 if dir == "TRT" then +--~                                     rlmode = -1 +--~                                 elseif dir == "TLT" then +--~                                     rlmode = 1 +--~                                 else +--~                                     rlmode = 0 +--~                                 end +--~                             end                                  local subtype = start.subtype                                  if subtype == 7 then                                      local dir = start.dir -                                    if dir == "+TRT" then +                                    if     dir == "+TRT" or dir == "+TLT" then +                                        insert(txtdir,dir) +                                    elseif dir == "-TRT" or dir == "-TLT" then +                                        remove(txtdir) +                                    end +                                    local d = txtdir[#txtdir] +                                    if d == "+TRT" then                                          rlmode = -1 -                                    elseif dir == "+TLT" then +                                    elseif d == "+TLT" then                                          rlmode = 1                                      else -                                        rlmode = 0 +                                        rlmode = pardir +                                    end +                                    if trace_directions then +                                        logs.report("fonts","directions after textdir %s: pardir=%s, txtdir=%s:%s, rlmode=%s",dir,pardir,#txtdir,txtdir[#txtdir] or "unset",rlmode)                                      end                                  elseif subtype == 6 then                                      local dir = start.dir                                      if dir == "TRT" then -                                        rlmode = -1 +                                        pardir = -1                                      elseif dir == "TLT" then -                                        rlmode = 1 +                                        pardir = 1                                      else -                                        rlmode = 0 +                                        pardir = 0 +                                    end +                                    rlmode = pardir +                                --~ txtdir = { } +                                    if trace_directions then +                                        logs.report("fonts","directions after pardir %s: pardir=%s, txtdir=%s:%s, rlmode=%s",dir,pardir,#txtdir,txtdir[#txtdir] or "unset",rlmode)                                      end                                  end                                  start = start.next @@ -2041,7 +2079,6 @@ function fonts.methods.node.otf.features(head,font,attr)                                  start = start.next                              end                          end -                      end                  else                      while start do @@ -2088,25 +2125,59 @@ function fonts.methods.node.otf.features(head,font,attr)                          --     end                          elseif id == whatsit then                              local subtype = start.subtype -                            if subtype == 7 then -                                local dir = start.dir -                                if dir == "+TRT" then -                                    rlmode = -1 -                                elseif dir == "+TLT" then -                                    rlmode = 1 -                                else -                                    rlmode = 0 +--~                             if subtype == 7 then +--~                                 local dir = start.dir +--~                                 if dir == "+TRT" then +--~                                     rlmode = -1 +--~                                 elseif dir == "+TLT" then +--~                                     rlmode = 1 +--~                                 else +--~                                     rlmode = 0 +--~                                 end +--~                             elseif subtype == 6 then +--~                                 local dir = start.dir +--~                                 if dir == "TRT" then +--~                                     rlmode = -1 +--~                                 elseif dir == "TLT" then +--~                                     rlmode = 1 +--~                                 else +--~                                     rlmode = 0 +--~                                 end +--~                             end +                                local subtype = start.subtype +                                if subtype == 7 then +                                    local dir = start.dir +                                    if     dir == "+TRT" or dir == "+TLT" then +                                        insert(txtdir,dir) +                                    elseif dir == "-TRT" or dir == "-TLT" then +                                        remove(txtdir) +                                    end +                                    local d = txtdir[#txtdir] +                                    if d == "+TRT" then +                                        rlmode = -1 +                                    elseif d == "+TLT" then +                                        rlmode = 1 +                                    else +                                        rlmode = pardir +                                    end +                                    if trace_directions then +                                        logs.report("fonts","directions after textdir %s: pardir=%s, txtdir=%s:%s, rlmode=%s",dir,pardir,#txtdir,txtdir[#txtdir] or "unset",rlmode) +                                    end +                                elseif subtype == 6 then +                                    local dir = start.dir +                                    if dir == "TRT" then +                                        pardir = -1 +                                    elseif dir == "TLT" then +                                        pardir = 1 +                                    else +                                        pardir = 0 +                                    end +                                    rlmode = pardir +                                --~ txtdir = { } +                                if trace_directions then +                                    logs.report("fonts","directions after pardir %s: pardir=%s, txtdir=%s:%s, rlmode=%s",dir,pardir,#txtdir,txtdir[#txtdir] or "unset",rlmode)                                  end -                            elseif subtype == 6 then -                                local dir = start.dir -                                if dir == "TRT" then -                                    rlmode = -1 -                                elseif dir == "TLT" then -                                    rlmode = 1 -                                else -                                    rlmode = 0                                  end -                            end                              start = start.next                          else                              start = start.next diff --git a/otfl-font-tfm.lua b/otfl-font-tfm.lua index 5768293..efea9de 100644 --- a/otfl-font-tfm.lua +++ b/otfl-font-tfm.lua @@ -407,6 +407,11 @@ local private = fonts.private                          }                      end                      chr.vert_variants = t +--~ local ic = v.vert_italic_correction +--~ if ic then +--~     chr.italic = ic * delta +--~     print(format("0x%05X -> %s",k,chr.italic)) +--~ end                  else                      local hv = v.horiz_variants                      if hv then @@ -517,6 +522,9 @@ local private = fonts.private              end          end          tc[k] = chr +--~ if k == 0x222B then +--~     print(t.fontname,table.serialize(chr)) +--~ end      end      -- t.encodingbytes, t.filename, t.fullname, t.name: elsewhere      t.size = scaledpoints @@ -533,15 +541,15 @@ local private = fonts.private      end      -- needed for \high cum suis      local tpx = tp.x_height -if hasmath then -    if not tp[13] then tp[13] = .86*tpx end  -- mathsupdisplay -    if not tp[14] then tp[14] = .86*tpx end  -- mathsupnormal -    if not tp[15] then tp[15] = .86*tpx end  -- mathsupcramped -    if not tp[16] then tp[16] = .48*tpx end  -- mathsubnormal -    if not tp[17] then tp[17] = .48*tpx end  -- mathsubcombined -    if not tp[22] then tp[22] =   0     end  -- mathaxisheight -    if t.MathConstants then t.MathConstants.AccentBaseHeight = nil end -- safeguard -end +    if hasmath then +        if not tp[13] then tp[13] = .86*tpx end  -- mathsupdisplay +        if not tp[14] then tp[14] = .86*tpx end  -- mathsupnormal +        if not tp[15] then tp[15] = .86*tpx end  -- mathsupcramped +        if not tp[16] then tp[16] = .48*tpx end  -- mathsubnormal +        if not tp[17] then tp[17] = .48*tpx end  -- mathsubcombined +        if not tp[22] then tp[22] =   0     end  -- mathaxisheight +        if t.MathConstants then t.MathConstants.AccentBaseHeight = nil end -- safeguard +    end      t.tounicode = 1      t.cidinfo = tfmtable.cidinfo      -- we have t.name=metricfile and t.fullname=RealName and t.filename=diskfilename @@ -549,21 +557,23 @@ end      -- can have multiple subfonts      if hasmath then          if trace_defining then -            logs.report("define font","math enabled for: %s %s %s",t.name or "noname",t.fullname or "nofullname",t.filename or "nofilename") +            logs.report("define font","math enabled for: name '%s', fullname: '%s', filename: '%s'",t.name or "noname",t.fullname or "nofullname",t.filename or "nofilename")          end      else          if trace_defining then -            logs.report("define font","math disabled for: %s %s %s",t.name or "noname",t.fullname or "nofullname",t.filename or "nofilename") +            logs.report("define font","math disabled for: name '%s', fullname: '%s', filename: '%s'",t.name or "noname",t.fullname or "nofullname",t.filename or "nofilename")          end          t.nomath, t.MathConstants = true, nil      end -    -- fullname is used in the subsetting      if not t.psname then -        t.psname = t.fullname -- else bad luck +     -- name used in pdf file as well as for selecting subfont in ttc/dfont +        t.psname = t.fontname or (t.fullname and fonts.names.cleanname(t.fullname))      end      if trace_defining then -        logs.report("define font","used for subsetting: %s ",t.fullname or "nofullname") +        logs.report("define font","used for accesing subfont: '%s'",t.psname or "nopsname") +        logs.report("define font","used for subsetting: '%s'",t.fontname or "nofontname")      end +--~     print(t.fontname,table.serialize(t.MathConstants))      return t, delta  end diff --git a/otfl-node-res.lua b/otfl-node-res.lua index f147981..49a1297 100644 --- a/otfl-node-res.lua +++ b/otfl-node-res.lua @@ -60,8 +60,10 @@ local glyph      = nodes.register(new_node("glyph",0))  local textdir    = nodes.register(new_node("whatsit",7))  local rule       = nodes.register(new_node("rule"))  local latelua    = nodes.register(new_node("whatsit",35)) ---~ local user       = nodes.register(new_node("user_defined")) -local user       = nodes.register(new_node(44)) +local user_n     = nodes.register(new_node("whatsit",44)) user_n.type = 100 +local user_l     = nodes.register(new_node("whatsit",44)) user_l.type = 110 +local user_s     = nodes.register(new_node("whatsit",44)) user_s.type = 115 +local user_t     = nodes.register(new_node("whatsit",44)) user_t.type = 116  function nodes.glyph(fnt,chr)      local n = copy_node(glyph) @@ -111,27 +113,41 @@ function nodes.latelua(code)      return n  end +local cache = { } +  function nodes.usernumber(num) -    local n = copy_node(user) -    n.type = 100 -    if num then n.value = num end -    return n -end -function nodes.userstring(str) -    local n = copy_node(user) -    n.type = 115 -    if str then n.value = str end -    return n +    local n = cache[num] +    if n then +        return copy_node(n) +    else +        local n = copy_node(user_n) +        if num then n.value = num end +        return n +    end  end +  function nodes.userlist(list) -    local n = copy_node(user) -    n.type = 110 +    local n = copy_node(user_l)      if list then n.value = list end      return n  end + +local cache = { } -- we could use the same cache + +function nodes.userstring(str) +    local n = cache[str] +    if n then +        return copy_node(n) +    else +        local n = copy_node(user_s) +        n.type = 115 +        if str then n.value = str end +        return n +    end +end +  function nodes.usertokens(tokens) -    local n = copy_node(user) -    n.type = 116 +    local n = copy_node(user_t)      if tokens then n.value = tokens end      return n  end | 
