[NTG-context] font pathes with colons

Ulrike Fischer news3 at nililand.de
Mon Jun 11 18:35:22 CEST 2018


Am Sun, 10 Jun 2018 13:24:40 +0200 schrieb Hans Hagen:

> i changed the parser for generic a bit so you need to check careful next 
> beta as i'm only testing some basic plain loading

It broke ;-(

luaotfload complained about a missing registersplit,
then about a missing addspecifier, so I reinserted from the previous
version (from UF to /UF) (around line 32865)

local resolvefile=fontgoodies and fontgoodies.filenames and
fontgoodies.filenames.resolve or function(s) return s end
-- UF
local splitter,splitspecifiers=nil,""
local P,C,S,Cc,Cs=lpeg.P,lpeg.C,lpeg.S,lpeg.Cc,lpeg.Cs
local left=P("(")
local right=P(")")
local colon=P(":")
local space=P(" ")
local lbrace=P("{")
local rbrace=P("}")
definers.defaultlookup="file"
local prefixpattern=P(false)
local function addspecifier(symbol)
  splitspecifiers=splitspecifiers..symbol
  local method=S(splitspecifiers)
  local lookup=C(prefixpattern)*colon
  local sub=left*C(P(1-left-right-method)^1)*right
  local specification=C(method)*C(P(1)^1)
  local
name=Cs((lbrace/"")*(1-rbrace)^1*(rbrace/"")+(1-sub-specification)^1)

splitter=P((lookup+Cc(""))*name*(sub+Cc(""))*(specification+Cc("")))
end
local function addlookup(str,default)
  prefixpattern=prefixpattern+P(str)
end
definers.addlookup=addlookup
addlookup("file")
addlookup("name")
addlookup("spec")
local function getspecification(str)
  return lpegmatch(splitter,str or "")
end
definers.getspecification=getspecification
function definers.registersplit(symbol,action,verbosename)
  addspecifier(symbol)
  variants[symbol]=action
  if verbosename then
    variants[verbosename]=action
  end
end
-- /UF


Then it complained about a missing upvalue getthreshold so I
reinserted:

local getthreshold
--UF
injections.threshold=0
getthreshold=function(font)
    local p=fontdata[font].parameters
    local f=p.factor
    local s=p.spacing
    local t=injections.threshold*(s and s.width or p.space or 0)-2
    return t>0 and t or 0,f
end
--/UF


Now it works again and also the "unknown option" warning is gone. 


> i have no clue how otfload locates files but maybe you need to add an 
> entry to
> 
> local remapper = {
>      otf    = "opentype fonts",
>      ttf    = "truetype fonts",
>      ttc    = "truetype fonts",
>      cid    = "cid maps",
>      cidmap = "cid maps",
>   -- fea    = "font feature files", -- no longer supported
>      pfb    = "type1 fonts",        -- needed for vector loading
>      afm    = "afm",
>      enc    = "enc files",
>      lua    = "tex", -- LIKE THIS
> }

     lua    = "misc fonts", 
would be better (then one can put the fonts in fonts/misc. 

But it doesn't help with the main problem that luaotfload calls
resolvers.findfile first for "basename + otf, tfm, ofm", then
triggers a rebuild of the database and only then calls
resolvers.findfile again with the fullname.

Also I really want to avoid to patch the merged code. I'm regularly
getting the newest version from context and try out if it still
works and prefer if I can use them unchanged.  

-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/



More information about the ntg-context mailing list