diff options
| -rw-r--r-- | luaotfload-database.lua | 102 | ||||
| -rw-r--r-- | luaotfload.dtx | 14 | 
2 files changed, 59 insertions, 57 deletions
| diff --git a/luaotfload-database.lua b/luaotfload-database.lua index f78cc67..aaba55a 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -337,13 +337,6 @@ crude_file_lookup_verbose = function (filename)              filename, found[1])          return found      end ---  found = data.fullnames[filename] ---  if found and mappings[found] then ---      found = mappings[found].filename[1] ---          "crude file lookup: req=%s; hit=bare; ret=%s", ---          filename, found[1]) ---      return found ---  end      found = data.basenames[filename]      if found and mappings[found] then          found = mappings[found].filename @@ -369,7 +362,6 @@ crude_file_lookup = function (filename)      local data      = names.data      local mappings  = data.mappings      local found = data.barenames[filename] ---             or data.fullnames[filename]                 or data.basenames[filename]      if found then          found = data.mappings[found] @@ -477,6 +469,27 @@ resolve_cached = function (_, _, specification)      return filename, subfont, true  end +--- this used to be inlined; with the lookup cache we don’t +--- have to be parsimonious wrt function calls anymore +--- “found” is the match accumulator +local add_to_match = function ( +    found,   optsize, dsnsize, size, +    minsize, maxsize, face) +    local continue = true +    if optsize then +        if dsnsize == size or (size > minsize and size <= maxsize) then +            found[1] = face +            continue = false ---> break +        else +            found[#found+1] = face +        end +    else +        found[1] = face +        continue = false ---> break +    end +    return found, continue +end +  --[[doc--  Luatex-fonts, the font-loader package luaotfload imports, comes with @@ -585,54 +598,43 @@ resolve = function (_,_,specification) -- the 1st two parameters are used by Con          if name == family then              if subfamily == style then -                if optsize then -                    if dsnsize == size -                    or (size > minsize and size <= maxsize) then -                        found[1] = face -                        break -                    else -                        found[#found+1] = face -                    end -                else -                    found[1] = face -                    break -                end +                local continue +                found, continue = add_to_match( +                    found,   optsize, dsnsize, size, +                    minsize, maxsize, face) +                if continue == false then break end              elseif synonym_set[style] and                     synonym_set[style][subfamily]              then -                if optsize then -                    if dsnsize == size -                    or (size > minsize and size <= maxsize) then -                        found[1] = face -                        break -                    else -                        found[#found+1] = face -                    end -                else -                    found[1] = face -                    break -                end +                local continue +                found, continue = add_to_match( +                    found,   optsize, dsnsize, size, +                    minsize, maxsize, face) +                if continue == false then break end              elseif subfamily == "regular" or -                    synonym_set.regular[subfamily] then +                   synonym_set.regular[subfamily] then                  found.fallback = face +            elseif name == fullname +                or name == pfullname +                or name == fontname +                or name == psname +            then +                local continue +                found, continue = add_to_match( +                    found,   optsize, dsnsize, size, +                    minsize, maxsize, face) +                if continue == false then break end              end -        end - -        if name == fullname -        or name == pfullname -        or name == fontname -        or name == psname then -            if optsize then -                if dsnsize == size -                or (size > minsize and size <= maxsize) then -                    found[1] = face -                    break -                else -                    found[#found+1] = face -                end -            else -                found[1] = face -                break +        else +            if name == fullname +            or name == pfullname +            or name == fontname +            or name == psname then +                local continue +                found, continue = add_to_match( +                    found,   optsize, dsnsize, size, +                    minsize, maxsize, face) +                if continue == false then break end              end          end      end diff --git a/luaotfload.dtx b/luaotfload.dtx index 8f7c8a1..dd43990 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -296,7 +296,7 @@ and the derived files  %  %       <path lookup>      ::= \{ {\sc all_characters} - `]' \} ;  % -%       <modifier>         ::= `/', (`i' | `b' | `bi' | `ib') ; +%       <modifier>         ::= `/', (`I' | `B' | `BI' | `IB') ;  %  %       <subfont no>       ::= `(', \{ {\sc digit} \}, `)' ;  % @@ -410,9 +410,9 @@ and the derived files  %  % \noindent  % Currently, four style modifiers are supported: -%   \verb|i| for italic shape, -%   \verb|b| for bold   weight, -%   \verb|bi| or \verb|ib| for the combination of both. +%   \verb|I| for italic shape, +%   \verb|B| for bold   weight, +%   \verb|BI| or \verb|IB| for the combination of both.  % Other “slashed” modifiers are too specific to the \XETEX engine and  % have no meaning in \LUATEX.  % @@ -510,9 +510,9 @@ and the derived files  %  % \begin{quote}  %   \begin{verbatim} -%   \font\iwonaitalic    =Iwona/i    at 20pt -%   \font\iwonabold      =Iwona/b    at 20pt -%   \font\iwonabolditalic=Iwona/bi   at 20pt +%   \font\iwonaitalic    =Iwona/I    at 20pt +%   \font\iwonabold      =Iwona/B    at 20pt +%   \font\iwonabolditalic=Iwona/BI   at 20pt  %   \end{verbatim}  % \end{quote}  % | 
