diff options
| -rw-r--r-- | luaotfload-auxiliary.lua | 43 | ||||
| -rw-r--r-- | luaotfload-database.lua | 59 | ||||
| -rw-r--r-- | luaotfload-merged.lua | 51 | ||||
| -rw-r--r-- | luaotfload-override.lua | 48 | ||||
| -rwxr-xr-x | luaotfload-tool.lua | 178 | ||||
| -rw-r--r-- | luaotfload-tool.rst | 25 | ||||
| -rw-r--r-- | luaotfload.dtx | 44 | 
7 files changed, 341 insertions, 107 deletions
| diff --git a/luaotfload-auxiliary.lua b/luaotfload-auxiliary.lua index 2d459d0..c08f775 100644 --- a/luaotfload-auxiliary.lua +++ b/luaotfload-auxiliary.lua @@ -20,6 +20,7 @@ config.luaotfload           = config.luaotfload or { }  local aux           = luaotfload.aux  local log           = luaotfload.log +local warning       = luaotfload.log  local identifiers   = fonts.hashes.identifiers  local fontid        = font.id @@ -60,28 +61,50 @@ local add_fontdata_fallbacks = function (fontdata)        --- bother to do any checks, will access        --- fontdata.shared no matter what ...        fontdata.units = fontdata.units_per_em +      else --- otf        metadata = fontdata.shared.rawdata.metadata -      fontdata.units   = fontparameters.units +      fontdata.units   = fontdata.units_per_em        local resources  = fontdata.resources -      fontdata.size    = fontparameters.size * fontdata.units / 1000 +      --- the next line is a hack that fixes scaling of fonts with +      --- non-standard em-sizes (most ms fonts have 2048, others +      --- come with 256) +      --fontdata.size    = fontparameters.size * fontdata.units / 1000        --- for legacy fontspec.lua and unicode-math.lua -      fontdata.shared.otfdata          = metadata -      fontdata.shared.otfdata.metadata = metadata --- brr, that’s meta indeed -      --- for microtype.lua +      fontdata.shared.otfdata          = { +        pfminfo   = { os2_capheight = metadata.pfminfo.os2_capheight }, +        metadata  = { ascent = metadata.ascent }, +      } +      --fontdata.shared.otfdata.metadata = metadata --- brr, that’s meta indeed +      --- for microtype and fontspec +      local fake_features = { } -- wrong: table.copy(resources.features) +      setmetatable(fake_features, { __index = function (tab, idx) +        warning("some package (probably fontspec) is outdated") +        warning( +          "attempt to index " .. +          "tfmdata.shared.otfdata.luatex.features (%s)", +          idx) +        --os.exit(1) +        return nil --- empty anyways +      end})        fontdata.shared.otfdata.luatex = {          unicodes = resources.unicodes, -        features = resources.features, +        features = fake_features,        }      end    end    return fontdata  end -luatexbase.add_to_callback( -  "luaotfload.patch_font", -  add_fontdata_fallbacks, -  "luaotfload.fontdata_fallbacks") +--if config.luaotfload.compatibility == true then +if true then +  --- this will cause the output pdf to be garbled +  --- in pdf.js +  luatexbase.add_to_callback( +    "luaotfload.patch_font", +    add_fontdata_fallbacks, +    "luaotfload.fontdata_fallbacks") +end  --[[doc-- diff --git a/luaotfload-database.lua b/luaotfload-database.lua index 576341f..224fa61 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -71,7 +71,7 @@ fonts.definers       = fonts.definers or { }  local names          = fonts.names -names.version        = 2.203 +names.version        = 2.204  names.data           = nil      --- contains the loaded database  names.lookups        = nil      --- contains the lookup cache  names.path           = { @@ -146,10 +146,11 @@ This is a sketch of the luaotfload db:              psname     : string;              subfamily  : string;          } -        size        : int list; -        slant       : int; -        weight      : int; -        width       : int; +        size         : int list; +        slant        : int; +        weight       : int; +        width        : int; +        units_per_em : int;                      // mainly 1000, but also 2048 or 256      }      and filestatus = (fullname, { index : int list; timestamp : int }) dict @@ -316,7 +317,7 @@ end  local type1_formats = { "tfm", "ofm", } ---- string -> (string * bool | int) +--- string -> string  crude_file_lookup_verbose = function (filename)      if not names.data then names.data = load_names() end      local data      = names.data @@ -326,18 +327,18 @@ crude_file_lookup_verbose = function (filename)      --- look up in db first ...      found = data.barenames[filename]      if found and mappings[found] then -        found = mappings[found].filename +        found = mappings[found].filename[1]          report("info", 0, "db",              "crude file lookup: req=%s; hit=bare; ret=%s", -            filename, found[1]) +            filename, found)          return found      end      found = data.basenames[filename]      if found and mappings[found] then -        found = mappings[found].filename +        found = mappings[found].filename[1]          report("info", 0, "db",              "crude file lookup: req=%s; hit=base; ret=%s", -            filename, found[1]) +            filename, found)          return found      end @@ -345,13 +346,13 @@ crude_file_lookup_verbose = function (filename)      for i=1, #type1_formats do          local format = type1_formats[i]          if resolvers.findfile(filename, format) then -            return { file.addsuffix(filename, format), false }, format +            return file.addsuffix(filename, format), format          end      end -    return { filename, false }, nil +    return filename, nil  end ---- string -> (string * bool | int) +--- string -> string  crude_file_lookup = function (filename)      if not names.data then names.data = load_names() end      local data      = names.data @@ -360,15 +361,15 @@ crude_file_lookup = function (filename)                 or data.basenames[filename]      if found then          found = data.mappings[found] -        if found then return found.filename end +        if found then return found.filename[1] end      end      for i=1, #type1_formats do          local format = type1_formats[i]          if resolvers.findfile(filename, format) then -            return { file.addsuffix(filename, format), false }, format +            return file.addsuffix(filename, format), format          end      end -    return { filename, false }, nil +    return filename, nil  end  --[[doc-- @@ -836,13 +837,16 @@ font_fullinfo = function (filename, subfont)          report("log", 1, "db", "broken font rejected", "%s", basefile)          return      end -    tfmdata.fontname    = metadata.fontname -    tfmdata.fullname    = metadata.fullname -    tfmdata.familyname  = metadata.familyname -    tfmdata.filename    = { filename, subfont } -- always store full path -    tfmdata.weight      = metadata.pfminfo.weight -    tfmdata.width       = metadata.pfminfo.width -    tfmdata.slant       = metadata.italicangle +    tfmdata.fontname      = metadata.fontname +    tfmdata.fullname      = metadata.fullname +    tfmdata.familyname    = metadata.familyname +    tfmdata.filename      = { filename, subfont } -- always store full path +    tfmdata.weight        = metadata.pfminfo.weight +    tfmdata.width         = metadata.pfminfo.width +    tfmdata.slant         = metadata.italicangle +    --- this is for querying +    tfmdata.units_per_em  = metadata.units_per_em +    tfmdata.version       = metadata.version      -- don't waste the space with zero values      tfmdata.size = {          metadata.design_size         ~= 0 and metadata.design_size         or nil, @@ -1067,25 +1071,25 @@ local scan_dir = function (dirname, fontnames, newfontnames)      - texmf used to be a boolean saying if we are scanning a texmf directory      ]]      local n_scanned, n_new = 0, 0   --- total of fonts collected -    report("log", 2, "db", "scanning", "%s", dirname) +    report("both", 2, "db", "scanning directory %s", dirname)      for _,i in next, font_extensions do          for _,ext in next, { i, stringupper(i) } do              local found = dirglob(stringformat("%s/**.%s$", dirname, ext))              local n_found = #found              --- note that glob fails silently on broken symlinks, which              --- happens sometimes in TeX Live. -            report("log", 2, "db", "%s '%s' fonts found", n_found, ext) +            report("both", 4, "db", "%s '%s' fonts found", n_found, ext)              n_scanned = n_scanned + n_found              for j=1, n_found do                  local fullname = found[j]                  fullname = path_normalize(fullname) -                report("log", 2, "db", "loading font “%s”", fullname) +                report("both", 4, "db", "loading font “%s”", fullname)                  local new = load_font(fullname, fontnames, newfontnames)                  if new then n_new = n_new + 1 end              end          end      end -    report("log", 2, "db", "%d fonts found in '%s'", n_scanned, dirname) +    report("both", 4, "db", "%d fonts found in '%s'", n_scanned, dirname)      return n_scanned, n_new  end @@ -1104,6 +1108,7 @@ local function scan_texmf_fonts(fontnames, newfontnames)      fontdirs       = fontdirs .. stringgsub(kpseexpand_path("$TTFONTS"), "^%.", "")      if not stringis_empty(fontdirs) then          for _,d in next, filesplitpath(fontdirs) do +            report("info", 4, "db", "Entering directory %s", d)              local found, new = scan_dir(d, fontnames, newfontnames)              n_scanned = n_scanned + found              n_new     = n_new     + new diff --git a/luaotfload-merged.lua b/luaotfload-merged.lua index bf22bac..a0a58cc 100644 --- a/luaotfload-merged.lua +++ b/luaotfload-merged.lua @@ -1,6 +1,6 @@  -- merged file : luatex-fonts-merged.lua  -- parent file : luatex-fonts.lua --- merge date  : 04/29/13 20:30:03 +-- merge date  : 05/09/13 15:23:31  do -- begin closure to overcome local limits and interference @@ -4586,7 +4586,7 @@ local floor=math.floor  local trace_loading=false trackers.register("fonts.loading",function(v) trace_loading=v end)  local trace_mapping=false trackers.register("fonts.mapping",function(v) trace_unimapping=v end)  local report_fonts=logs.reporter("fonts","loading")  -local fonts=fonts +local fonts=fonts or {}  local mappings=fonts.mappings or {}  fonts.mappings=mappings  local function loadlumtable(filename)  @@ -4602,7 +4602,7 @@ local function loadlumtable(filename)  end  local hex=R("AF","09")  local hexfour=(hex*hex*hex*hex)/function(s) return tonumber(s,16) end -local hexsix=(hex^1)/function(s) return tonumber(s,16) end +local hexsix=(hex*hex*hex*hex*hex*hex)/function(s) return tonumber(s,16) end  local dec=(R("09")^1)/tonumber  local period=P(".")  local unicode=P("uni")*(hexfour*(period+P(-1))*Cc(false)+Ct(hexfour^1)*Cc(true)) @@ -4622,16 +4622,16 @@ local function makenameparser(str)      return p    end  end -local function tounicode16(unicode) +local function tounicode16(unicode,name)    if unicode<0x10000 then      return format("%04X",unicode)    elseif unicode<0x1FFFFFFFFF then      return format("%04X%04X",floor(unicode/1024),unicode%1024+0xDC00)    else -    report_fonts("can't convert %a into tounicode",unicode) +    report_fonts("can't convert %a in %a into tounicode",unicode,name)    end  end -local function tounicode16sequence(unicodes) +local function tounicode16sequence(unicodes,name)    local t={}    for l=1,#unicodes do      local unicode=unicodes[l] @@ -4640,7 +4640,7 @@ local function tounicode16sequence(unicodes)      elseif unicode<0x1FFFFFFFFF then        t[l]=format("%04X%04X",floor(unicode/1024),unicode%1024+0xDC00)      else -      report_fonts ("can't convert %a into tounicode",unicode) +      report_fonts ("can't convert %a in %a into tounicode",unicode,name)      end    end    return concat(t) @@ -4702,7 +4702,7 @@ function mappings.addtounicode(data,filename)        local unicode=lumunic and lumunic[name] or unicodevector[name]        if unicode then          originals[index]=unicode -        tounicode[index]=tounicode16(unicode) +        tounicode[index]=tounicode16(unicode,name)          ns=ns+1        end        if (not unicode) and usedmap then @@ -4711,7 +4711,7 @@ function mappings.addtounicode(data,filename)            unicode=cidcodes[foundindex]             if unicode then              originals[index]=unicode -            tounicode[index]=tounicode16(unicode) +            tounicode[index]=tounicode16(unicode,name)              ns=ns+1            else              local reference=cidnames[foundindex]  @@ -4721,11 +4721,11 @@ function mappings.addtounicode(data,filename)                  unicode=cidcodes[foundindex]                  if unicode then                    originals[index]=unicode -                  tounicode[index]=tounicode16(unicode) +                  tounicode[index]=tounicode16(unicode,name)                    ns=ns+1                  end                end -              if not unicode then +              if not unicode or unicode=="" then                  local foundcodes,multiple=lpegmatch(uparser,reference)                  if foundcodes then                    originals[index]=foundcodes @@ -4734,7 +4734,7 @@ function mappings.addtounicode(data,filename)                      nl=nl+1                      unicode=true                    else -                    tounicode[index]=tounicode16(foundcodes) +                    tounicode[index]=tounicode16(foundcodes,name)                      ns=ns+1                      unicode=foundcodes                    end @@ -4744,7 +4744,7 @@ function mappings.addtounicode(data,filename)            end          end        end -      if not unicode then +      if not unicode or unicode=="" then          local split=lpegmatch(ligsplitter,name)          local nplit=split and #split or 0          if nplit>=2 then @@ -4765,7 +4765,7 @@ function mappings.addtounicode(data,filename)            if n==0 then            elseif n==1 then              originals[index]=t[1] -            tounicode[index]=tounicode16(t[1]) +            tounicode[index]=tounicode16(t[1],name)            else              originals[index]=t              tounicode[index]=tounicode16sequence(t) @@ -4775,17 +4775,17 @@ function mappings.addtounicode(data,filename)          else          end        end -      if not unicode then +      if not unicode or unicode=="" then          local foundcodes,multiple=lpegmatch(uparser,name)          if foundcodes then            if multiple then              originals[index]=foundcodes -            tounicode[index]=tounicode16sequence(foundcodes) +            tounicode[index]=tounicode16sequence(foundcodes,name)              nl=nl+1              unicode=true            else              originals[index]=foundcodes -            tounicode[index]=tounicode16(foundcodes) +            tounicode[index]=tounicode16(foundcodes,name)              ns=ns+1              unicode=foundcodes            end @@ -8484,6 +8484,19 @@ local function toligature(kind,lookupname,head,start,stop,char,markflag,discfoun        end        start=start.next      end +    local start=base.next +    while start and start.id==glyph_code do  +      local char=start.char +      if marks[char] then +        start[a_ligacomp]=baseindex+(start[a_ligacomp] or componentindex) +        if trace_marks then +          logwarning("%s: find mark %s, gets index %s",pref(kind,lookupname),gref(char),start[a_ligacomp]) +        end +      else +        break +      end +      start=start.next +    end    end    return head,base  end @@ -8751,6 +8764,10 @@ function handlers.gpos_mark2ligature(head,start,kind,lookupname,markanchors,sequ                          pref(kind,lookupname),anchor,index,bound,gref(markchar),gref(basechar),index,dx,dy)                      end                      return head,start,true +                  else +                    if trace_bugs then +                      logwarning("%s: no matching anchors for mark %s and baselig %s with index %a",pref(kind,lookupname),gref(markchar),gref(basechar),index) +                    end                    end                  end                end diff --git a/luaotfload-override.lua b/luaotfload-override.lua index c047dad..f143009 100644 --- a/luaotfload-override.lua +++ b/luaotfload-override.lua @@ -101,32 +101,34 @@ logs.names_report = names_report  --doc]]-- -if next(fonts.encodings.agl) then -    print(next, fonts.encodings.agl) -    --- unnecessary because the file shouldn’t be loaded at this time -    --- but we’re just making sure -    fonts.encodings.agl = nil -    collectgarbage"collect" -end - +if fonts then --- need to be running TeX +    if next(fonts.encodings.agl) then +        print(next, fonts.encodings.agl) +        --- unnecessary because the file shouldn’t be loaded at this time +        --- but we’re just making sure +        fonts.encodings.agl = nil +        collectgarbage"collect" +    end -fonts.encodings.agl = { } -setmetatable(fonts.encodings.agl, { __index = function (t, k) -    if k == "unicodes" then -        local glyphlist = resolvers.findfile"luaotfload-glyphlist.lua" -        if glyphlist then -            names_report("both", 0, "load", "loading the Adobe glyph list") +    fonts.encodings.agl = { } + +    setmetatable(fonts.encodings.agl, { __index = function (t, k) +        if k == "unicodes" then +            local glyphlist = resolvers.findfile"luaotfload-glyphlist.lua" +            if glyphlist then +                names_report("both", 0, "load", "loading the Adobe glyph list") +            else +                glyphlist = resolvers.findfile"font-age.lua" +                names_report("both", 0, "load", "loading the extended glyph list from ConTeXt") +            end +            local unicodes      = dofile(glyphlist) +            fonts.encodings.agl = { unicodes = unicodes } +            return unicodes          else -            glyphlist = resolvers.findfile"font-age.lua" -            names_report("both", 0, "load", "loading the extended glyph list from ConTeXt") +            return nil          end -        local unicodes      = dofile(glyphlist) -        fonts.encodings.agl = { unicodes = unicodes } -        return unicodes -    else -        return nil -    end -end }) +    end }) +end  -- vim:tw=71:sw=4:ts=4:expandtab diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua index 0cd19b1..0d3b229 100755 --- a/luaotfload-tool.lua +++ b/luaotfload-tool.lua @@ -32,6 +32,8 @@ local stringformat    = string.format  local texiowrite_nl   = texio.write_nl  local stringlower     = string.lower +local C, Ct, P     = lpeg.C, lpeg.Ct, lpeg.P +local lpegmatch    = lpeg.match  local loader_file = "luatexbase.loader.lua"  local loader_path = assert(kpse.find_file(loader_file, "lua"), @@ -64,8 +66,6 @@ local config        = config  config.luaotfload   = config.luaotfload or { }  do -- we don’t have file.basename and the likes yet, so inline parser ftw -    local C, P         = lpeg.C, lpeg.P -    local lpegmatch    = lpeg.match      local slash        = P"/"      local dot          = P"."      local noslash      = 1 - slash @@ -129,11 +129,14 @@ This tool is part of the luaotfload package. Valid options are:    -v --verbose=LEVEL           be more verbose (print the searched directories)    -vv                          print the loaded fonts    -vvv                         print all steps of directory searching +  --log=stdout                 redirect log output to stdout +    -V --version                 print version and exit    -h --help                    print this message    --alias=<name>               force behavior of “luaotfload-tool” or legacy                                 “mkluatexfontdb” +  -------------------------------------------------------------------------------                                     DATABASE @@ -147,7 +150,9 @@ This tool is part of the luaotfload package. Valid options are:                                 (default: n = 1)    -i --info                    display font metadata -  --log=stdout                 redirect log output to stdout +  --list=<criterion>           output list of entries by field <criterion> +  --list=<criterion>:<value>   restrict to entries with <criterion>=<value> +  --fields=<f1>,<f2>,…,<fn>    which fields <f> to print with --list  The font database will be saved to     %s @@ -158,7 +163,7 @@ The font database will be saved to  Usage: %s [OPTION]... -Rebuild the LuaTeX font database. +Rebuild or update the LuaTeX font database.  Valid options:    -f --force                   force re-indexing all fonts @@ -228,7 +233,7 @@ set.  --]]--  local action_sequence = { -    "loglevel", "help", "version", "flush", "generate", "query" +    "loglevel", "help", "version", "flush", "generate", "list", "query"  }  local action_pending  = table.tohash(action_sequence, false) @@ -286,7 +291,7 @@ actions.query = function (job)          lookup        = "name",          specification = "name:" .. query,          optsize       = 0, -    } +   }      local foundname, subfont, success =          fonts.names.resolve(nil, nil, tmpspec) @@ -317,6 +322,158 @@ actions.query = function (job)      return true, true  end +---         --list=<criterion> +---         --list=<criterion>:<value> +--- +---         --list=<criterion>          --fields=<f1>,<f2>,<f3>,...<fn> + +local get_fields get_fields = function (entry, fields, acc, n) +    if not acc then +        return get_fields(entry, fields, { }, 1) +    end + +    local field = fields[n] +    if field then +        local value = entry[field] +        acc[#acc+1] = value or false +        return get_fields(entry, fields, acc, n+1) +    end +    return acc +end + +local comma       = P"," +local noncomma    = 1-comma +local split_comma = Ct((C(noncomma^1) + comma)^1) + +local texiowrite_nl     = texio.write_nl +local tableconcat       = table.concat +local stringexplode     = string.explode + +local separator = "\t" --- could be “,” for csv + +local format_fields format_fields = function (fields, acc, n) +    if not acc then +        return format_fields(fields, { }, 1) +    end + +    local field = fields[n] +    if field ~= nil then +        if field == false then +            acc[#acc+1] = "<none>" +        else +            acc[#acc+1] = tostring(field) +        end +        return format_fields(fields, acc, n+1) +    end +    return tableconcat(acc, separator) +end + +local set_primary_field +set_primary_field = function (fields, addme, acc, n) +    if not acc then +        return set_primary_field(fields, addme, { addme }, 1) +    end + +    local field = fields[n] +    if field then +        if field ~= addme then +            acc[#acc+1] = field +        end +        return set_primary_field(fields, addme, acc, n+1) +    end +    return acc +end + +actions.list = function (job) +    local criterion     = job.criterion + +    local asked_fields  = job.asked_fields +    if asked_fields then +        asked_fields = lpegmatch(split_comma, asked_fields) +    else +        --- some defaults +        asked_fields = { "fullname", "version", } +    end + +    if not names.data then +        names.data = names.load() +    end + +    local mappings  = names.data.mappings +    local nmappings = #mappings + +    if criterion == "*" then +        logs.names_report(false, 1, "list", "all %d entries", nmappings) +        for i=1, nmappings do +            local entry     = mappings[i] +            local fields    = get_fields(entry, asked_fields) +            --- we could collect these instead ... +            local formatted = format_fields(fields) +            texiowrite_nl(formatted) +        end + +    else +        criterion = stringexplode(criterion, ":") --> { field, value } +        local asked_value  = criterion[2] +        criterion          = criterion[1] +        asked_fields       = set_primary_field(asked_fields, criterion) + +        logs.names_report(false, 1, "list", "by %s", criterion) + +        --- firstly, build a list of fonts to operate on +        local targets = { } +        if asked_value then --- only those whose value matches +            logs.names_report(false, 2, "list", "restricting to value %s", asked_value) +            for i=1, nmappings do +                local entry = mappings[i] +                if  entry[criterion] +                and tostring(entry[criterion]) == asked_value +                then +                    targets[#targets+1] = entry +                end +            end + +        else --- whichever have the field, sorted +            local categories, by_category = { }, { } +            for i=1, nmappings do +                local entry = mappings[i] +                local value = entry[criterion] +                if value then +                    --value = tostring(value) +                    local entries = by_category[value] +                    if not entries then +                        entries = { entry } +                        categories[#categories+1] = value +                    else +                        entries[#entries+1] = entry +                    end +                    by_category[value] = entries +                end +            end +            table.sort(categories) + +            for i=1, #categories do +                local entries = by_category[categories[i]] +                for j=1, #entries do +                    targets[#targets+1] = entries[j] +                end +            end +        end +        local ntargets = #targets +        logs.names_report(false, 2, "list", "%d entries", ntargets) + +        --- now, output the collection +        for i=1, ntargets do +            local entry         = targets[i] +            local fields        = get_fields(entry, asked_fields) +            local formatted     = format_fields(fields) +            texiowrite_nl(formatted) +        end +    end + +    return true, true +end +  --[[--  Command-line processing.  mkluatexfontdb.lua relies on the script alt_getopt to process argv and @@ -330,6 +487,7 @@ alt_getopt.  local process_cmdline = function ( ) -- unit -> jobspec      local result = { -- jobspec          force_reload = nil, +        criterion    = "",          query        = "",          log_level    = 1, --- 2 is approx. the old behavior      } @@ -337,12 +495,14 @@ local process_cmdline = function ( ) -- unit -> jobspec      local long_options = {          alias            = 1,          ["flush-cache"]  = "c", +        fields           = 1,          find             = 1,          force            = "f",          fuzzy            = "F",          help             = "h",          info             = "i",          limit            = 1, +        list             = 1,          log              = 1,          quiet            = "q",          update           = "u", @@ -401,12 +561,18 @@ local process_cmdline = function ( ) -- unit -> jobspec              config.luaotfload.self = optarg[n]          elseif v == "c" then              action_pending["flush"] = true +        elseif v == "list" then +            action_pending["list"] = true +            result.criterion = optarg[n] +        elseif v == "fields" then +            result.asked_fields = optarg[n]          end      end      if config.luaotfload.self == "mkluatexfontdb" then          action_pending["generate"] = true          result.log_level = math.max(2, result.log_level) +        logs.set_logout"stdout"      end      return result  end diff --git a/luaotfload-tool.rst b/luaotfload-tool.rst index cd42606..6fc6138 100644 --- a/luaotfload-tool.rst +++ b/luaotfload-tool.rst @@ -19,10 +19,12 @@ SYNOPSIS  **luaotfload** --update [ --force ] [ --quiet ] [ --verbose ] -**luaotfload** --find=filename [ --fuzzy ] [ --info ] +**luaotfload** --find=FONTNAME [ --fuzzy ] [ --info ]  **luaotfload** --flush-cache +**luaotfload** --list=CRITERION[:VALUE] [ --fields=F1,F2,...,Fn ] +  **luaotfload** --help  **luaotfload** --version @@ -54,13 +56,28 @@ update mode  query mode  ----------------------------------------------------------------------- ---find=<name>           Resolve a font name; this looks up <name> in +--find=NAME             Resolve a font name; this looks up <name> in                          the database and prints the file name it is                          mapped to.  --fuzzy, -F             Show approximate matches to the file name if -                        the lookup was unsuccessful (requires ``--find``). +                        the lookup was unsuccessful (requires +                        ``--find``).  --info, -i              Display basic information to a resolved font                          file (requires ``--find``). +--list=CRITERION        Show entries, where *CRITERION* is one of the +                        following: + +                        1) the character ``*``, selecting all entries; +                        2) a field of a database entry, for instance +                           *fullname* or *units_per_em*, according to +                           which the output will be sorted; or +                        3) an expression of the form ``field:value`` to +                           limit the output to entries whose ``field`` +                           matches ``value``. + +--fields=FIELDS         Comma-separated list of fields that should be +                        printed.  The default is *fullname,version*. +                        (Only meaningful with ``--list``.)  lookup cache  ----------------------------------------------------------------------- @@ -68,7 +85,7 @@ lookup cache  miscellaneous  ----------------------------------------------------------------------- ---verbose=<n>, -v       Set verbosity level to *n* or the number of +--verbose=N, -v         Set verbosity level to *n* or the number of                          repetitions of ``-v``.  --quiet                 No verbose output (log level set to zero).  --log=stdout            Redirect log output to terminal (for database diff --git a/luaotfload.dtx b/luaotfload.dtx index 6c88e37..daaa48c 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -947,6 +947,11 @@ and the derived files  %  % \verb|luaotfload-tool --help| will list the available command line  % switches, including some not discussed in detail here. +% For a full documentation of \identifier{luaotfload-tool} and its +% capabilities refer to the manpage +% (\verb|man 1 luaotfload-tool|).\footnote{% +%   Or see \verb|luaotfload-tool.rst| in the source directory. +% }  %  % \subsection{Blacklisting Fonts}  % \label{font-blacklist} @@ -1219,11 +1224,12 @@ local luaotfload            = luaotfload  config                            = config or { }  config.luaotfload                 = config.luaotfload or { } -------.luaotfload.resolver        = config.luaotfload.resolver  or "normal" -config.luaotfload.resolver        = config.luaotfload.resolver  or "cached" -config.luaotfload.definer         = config.luaotfload.definer   or "patch" +------.luaotfload.resolver        = config.luaotfload.resolver         or "normal" +config.luaotfload.resolver        = config.luaotfload.resolver         or "cached" +config.luaotfload.definer         = config.luaotfload.definer          or "patch" +config.luaotfload.compatibility   = config.luaotfload.compatibility    or false  config.luaotfload.loglevel        = config.luaotfload.loglevel  or 1 -config.luaotfload.color_callback  = config.luaotfload.color_callback  or "pre_linebreak_filter" +config.luaotfload.color_callback  = config.luaotfload.color_callback   or "pre_linebreak_filter"  --luaotfload.prefer_merge     = config.luaotfload.prefer_merge or true  luaotfload.module = { @@ -1254,17 +1260,6 @@ local reset_callback, call_callback =  local dummy_function = function () end -%    \end{macrocode} -% No final decision has been made on how to handle font definition.  At -% the moment, there are three candidates: The \identifier{generic} -% callback as hard-coded in the font loader, the \identifier{old} -% wrapper, and a simplified version of the latter (\identifier{patch}) -% that does nothing besides applying font patches. -% -%    \begin{macrocode} - -luaotfload.font_definer = "patch" --- | “generic” | “old” -  local error, warning, info, log =      luatexbase.provides_module(luaotfload.module) @@ -1606,13 +1601,22 @@ formats.ofm               = "type1"  % most cases when looking up font files, only when generating the database.  %  %    \begin{macrocode} -request_resolvers.file = function (specification) -    local found = fonts.names.crude_file_lookup(specification.name) -    --local found = fonts.names.crude_file_lookup_verbose(specification.name) -    specification.name = found[1] -    --if format then specification.forced = format end + +local resolvefile = fonts.names.crude_file_lookup +--local resolvefile = fonts.names.crude_file_lookup_verbose + +function request_resolvers.file(specification) +  local name=resolvefile(specification.name) +  local suffix=file.suffix(name) +  if formats[suffix] then +    specification.forced=suffix +    specification.name=file.removesuffix(name) +  else +    specification.name=name +  end  end +  %    \end{macrocode}  % We classify as \verb|anon:| those requests that have neither a  % prefix nor brackets. According to Khaled\footnote{% | 
