From f2bb2e6badf65b67b3713ecf3e977836266555a3 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 2 Jun 2013 19:25:35 +0200 Subject: update NEWS; bump version --- NEWS | 9 +++++++++ luaotfload-auxiliary.lua | 4 ++-- luaotfload-colors.lua | 2 +- luaotfload-extralibs.lua | 2 +- luaotfload-features.lua | 2 +- luaotfload-letterspace.lua | 2 +- luaotfload-loaders.lua | 2 +- luaotfload-tool.lua | 6 +++--- luaotfload-tool.rst | 4 ++-- luaotfload.dtx | 4 ++-- mkglyphlist | 2 +- 11 files changed, 24 insertions(+), 15 deletions(-) diff --git a/NEWS b/NEWS index 192bd48..b504b9b 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,15 @@ Change History -------------- +2013/xx/xx, luaotfload v2.3: + * New experimental lookups: ``kpse`` (kpathsea), ``my`` (callback) + * Precedence of texmf over system fonts can be requested + using the ``--prefer-texmf`` option of luaotfload-tool + * Resolve file names to full paths at later stage + * Rewrite the output of ``\fontname`` via ``patch_font`` callback + * Allow blacklisting directories + * Drop compatibility layer + 2013/05/20, luaotfload v2.2: * There is now a central, non-personal dev repo on github: https://github.com/lualatex/luaotfload diff --git a/luaotfload-auxiliary.lua b/luaotfload-auxiliary.lua index 3597683..f310f1c 100644 --- a/luaotfload-auxiliary.lua +++ b/luaotfload-auxiliary.lua @@ -2,9 +2,9 @@ ----------------------------------------------------------------------- -- FILE: luaotfload-auxiliary.lua -- DESCRIPTION: part of luaotfload --- REQUIREMENTS: luaotfload 2.2 +-- REQUIREMENTS: luaotfload 2.3 -- AUTHOR: Khaled Hosny, Élie Roux, Philipp Gesang --- VERSION: 2.2 +-- VERSION: 2.3 -- CREATED: 2013-05-01 14:40:50+0200 ----------------------------------------------------------------------- -- diff --git a/luaotfload-colors.lua b/luaotfload-colors.lua index 7bd5c1f..d3e77b0 100644 --- a/luaotfload-colors.lua +++ b/luaotfload-colors.lua @@ -1,5 +1,5 @@ if not modules then modules = { } end modules ['luaotfload-colors'] = { - version = 2.200, + version = 2.3, comment = "companion to luaotfload.lua (font color)", author = "Khaled Hosny, Elie Roux, Philipp Gesang", copyright = "Luaotfload Development Team", diff --git a/luaotfload-extralibs.lua b/luaotfload-extralibs.lua index 84819f4..90dbf09 100644 --- a/luaotfload-extralibs.lua +++ b/luaotfload-extralibs.lua @@ -1,5 +1,5 @@ if not modules then modules = { } end modules ["extralibs"] = { - version = 2.201, + version = 2.3, comment = "companion to luaotfload.lua", author = "Hans Hagen, Philipp Gesang", copyright = "PRAGMA ADE / ConTeXt Development Team", diff --git a/luaotfload-features.lua b/luaotfload-features.lua index a70dace..81d1437 100644 --- a/luaotfload-features.lua +++ b/luaotfload-features.lua @@ -1,5 +1,5 @@ if not modules then modules = { } end modules ["features"] = { - version = 2.201, + version = 2.3, comment = "companion to luaotfload.lua", author = "Hans Hagen, Khaled Hosny, Elie Roux, Philipp Gesang", copyright = "PRAGMA ADE / ConTeXt Development Team", diff --git a/luaotfload-letterspace.lua b/luaotfload-letterspace.lua index 8711646..e4ebf0b 100644 --- a/luaotfload-letterspace.lua +++ b/luaotfload-letterspace.lua @@ -1,5 +1,5 @@ if not modules then modules = { } end modules ['letterspace'] = { - version = 2.201, + version = 2.3, comment = "companion to luaotfload.lua", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL; adapted by Philipp Gesang", copyright = "PRAGMA ADE / ConTeXt Development Team", diff --git a/luaotfload-loaders.lua b/luaotfload-loaders.lua index b4ce0b2..0ab1505 100644 --- a/luaotfload-loaders.lua +++ b/luaotfload-loaders.lua @@ -1,5 +1,5 @@ if not modules then modules = { } end modules ["loaders"] = { - version = 2.200, + version = 2.3, comment = "companion to luaotfload.lua", author = "Hans Hagen, Khaled Hosny, Elie Roux, Philipp Gesang", copyright = "PRAGMA ADE / ConTeXt Development Team", diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua index e3f5a93..3eef577 100755 --- a/luaotfload-tool.lua +++ b/luaotfload-tool.lua @@ -4,9 +4,9 @@ -- DESCRIPTION: database functionality -- REQUIREMENTS: luaotfload 2.2 -- AUTHOR: Khaled Hosny, Élie Roux, Philipp Gesang --- VERSION: 2.2 +-- VERSION: 2.3 -- LICENSE: GPL v2 --- CREATED: 2013-05-06 13:37:12+0200 +-- MODIFIED: 2013-06-02 19:23:54+0200 ----------------------------------------------------------------------- --[[doc-- @@ -135,7 +135,7 @@ require"luaotfload-override.lua" --- this populates the logs.* namespace require"luaotfload-database" require"alt_getopt" -local version = "2.2" -- same version number as luaotfload +local version = "2.3" -- same version number as luaotfload local names = fonts.names local db_src_out = names.path.dir.."/"..names.path.basename diff --git a/luaotfload-tool.rst b/luaotfload-tool.rst index 06ab1cc..9b03b37 100644 --- a/luaotfload-tool.rst +++ b/luaotfload-tool.rst @@ -6,9 +6,9 @@ generate and query the Luaotfload font names database ----------------------------------------------------------------------- -:Date: 2013-05-06 +:Date: 2013-06-02 :Copyright: GPL v2.0 -:Version: 2.2 +:Version: 2.3 :Manual section: 1 :Manual group: text processing diff --git a/luaotfload.dtx b/luaotfload.dtx index 095ac23..70edf8c 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -1444,8 +1444,8 @@ config.luaotfload.prioritize = config.luaotfload.prioritize or "sys" luaotfload.module = { name = "luaotfload", - version = 2.2, - date = "2013/05/23", + version = 2.3, + date = "2013/06/02", description = "OpenType layout system.", author = "Elie Roux & Hans Hagen", copyright = "Elie Roux", diff --git a/mkglyphlist b/mkglyphlist index 94aac39..8b89935 100755 --- a/mkglyphlist +++ b/mkglyphlist @@ -96,7 +96,7 @@ end local file_header = [==[ if not modules then modules = { } end modules ["font-age"] = { - version = 2.200, + version = 2.300, comment = "part of the luaotfload package", author = "luaotfload team / mkglyphlist", copyright = "derived from %s", -- cgit v1.2.3 From addc387d2a46040506cc5178367fb4045b671d58 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 4 Jun 2013 22:31:27 +0200 Subject: sync with Context as of 2013-06-04 --- luaotfload-merged.lua | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/luaotfload-merged.lua b/luaotfload-merged.lua index 8a9e5fc..0c51568 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 : 05/27/13 11:01:26 +-- merge date : 06/04/13 21:26:55 do -- begin closure to overcome local limits and interference @@ -197,7 +197,7 @@ patterns.unspacer=((patterns.spacer^1)/"")^0 patterns.singlequoted=squote*patterns.nosquote*squote patterns.doublequoted=dquote*patterns.nodquote*dquote patterns.quoted=patterns.doublequoted+patterns.singlequoted -patterns.propername=R("AZ","az","__")*R("09","AZ","az","__")^0*P(-1) +patterns.propername=R("AZ","az","__")*R("09","AZ","az","__")^0*endofstring patterns.somecontent=(anything-newline-space)^1 patterns.beginline=#(1-newline) patterns.longtostring=Cs(whitespace^0/""*nonwhitespace^0*((whitespace^0/" "*(patterns.quoted+nonwhitespace)^1)^0)) @@ -372,7 +372,7 @@ function lpeg.replacer(one,two,makefunction,isutf) return pattern end end -function lpeg.finder(lst,makefunction) +function lpeg.finder(lst,makefunction) local pattern if type(lst)=="table" then pattern=P(false) @@ -401,8 +401,8 @@ local splitters_f,splitters_s={},{} function lpeg.firstofsplit(separator) local splitter=splitters_f[separator] if not splitter then - separator=P(separator) - splitter=C((1-separator)^0) + local pattern=P(separator) + splitter=C((1-pattern)^0) splitters_f[separator]=splitter end return splitter @@ -410,12 +410,31 @@ end function lpeg.secondofsplit(separator) local splitter=splitters_s[separator] if not splitter then - separator=P(separator) - splitter=(1-separator)^0*separator*C(anything^0) + local pattern=P(separator) + splitter=(1-pattern)^0*pattern*C(anything^0) + splitters_s[separator]=splitter + end + return splitter +end +local splitters_s,splitters_p={},{} +function lpeg.beforesuffix(separator) + local splitter=splitters_s[separator] + if not splitter then + local pattern=P(separator) + splitter=C((1-pattern)^0)*pattern*endofstring splitters_s[separator]=splitter end return splitter end +function lpeg.afterprefix(separator) + local splitter=splitters_p[separator] + if not splitter then + local pattern=P(separator) + splitter=pattern*C(anything^0) + splitters_p[separator]=splitter + end + return splitter +end function lpeg.balancer(left,right) left,right=P(left),P(right) return P { left*((1-left-right)+V(1))^0*right } @@ -2851,7 +2870,7 @@ local builder=Cs { "start", ["W"]=(prefix_any*P("W"))/format_W, ["a"]=(prefix_any*P("a"))/format_a, ["A"]=(prefix_any*P("A"))/format_A, - ["*"]=Cs(((1-P("%"))^1+P("%%")/"%%%%")^1)/format_rest, + ["*"]=Cs(((1-P("%"))^1+P("%%")/"%%")^1)/format_rest, ["!"]=Carg(2)*prefix_any*P("!")*C((1-P("!"))^1)*P("!")/format_extension, } local direct=Cs ( @@ -6718,8 +6737,9 @@ local function copytotfm(data,cache_id) local fullname=metadata.fullname or fontname local units=metadata.units_per_em or 1000 if units==0 then - units=1000 + units=1000 metadata.units_per_em=1000 + report_otf("changing %a units to %a",0,units) end parameters.slant=0 parameters.space=spaceunits -- cgit v1.2.3 From 76d3bf5ef8dd97dbaadaf814f2a428ba84fde222 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 9 Jun 2013 11:36:21 +0200 Subject: sync with Context as of 2013-06-09 --- luaotfload-merged.lua | 454 ++++++++++++++++++++++++++------------------------ 1 file changed, 232 insertions(+), 222 deletions(-) diff --git a/luaotfload-merged.lua b/luaotfload-merged.lua index 0c51568..3f3294c 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 : 06/04/13 21:26:55 +-- merge date : 06/07/13 12:25:27 do -- begin closure to overcome local limits and interference @@ -110,13 +110,22 @@ patterns.anything=anything patterns.endofstring=endofstring patterns.beginofstring=alwaysmatched patterns.alwaysmatched=alwaysmatched -local digit,sign=R('09'),S('+-') +local sign=S('+-') +local zero=P('0') +local digit=R('09') +local octdigit=R("07") +local lowercase=R("az") +local uppercase=R("AZ") +local underscore=P("_") +local hexdigit=digit+lowercase+uppercase local cr,lf,crlf=P("\r"),P("\n"),P("\r\n") local newline=crlf+S("\r\n") local escaped=P("\\")*anything local squote=P("'") local dquote=P('"') local space=P(" ") +local period=P(".") +local comma=P(",") local utfbom_32_be=P('\000\000\254\255') local utfbom_32_le=P('\255\254\000\000') local utfbom_16_be=P('\255\254') @@ -155,23 +164,8 @@ local stripper=spacer^0*C((spacer^0*nonspacer^1)^0) local collapser=Cs(spacer^0/""*nonspacer^0*((spacer^0/" "*nonspacer^1)^0)) patterns.stripper=stripper patterns.collapser=collapser -patterns.digit=digit -patterns.sign=sign -patterns.cardinal=sign^0*digit^1 -patterns.integer=sign^0*digit^1 -patterns.unsigned=digit^0*P('.')*digit^1 -patterns.float=sign^0*patterns.unsigned -patterns.cunsigned=digit^0*P(',')*digit^1 -patterns.cfloat=sign^0*patterns.cunsigned -patterns.number=patterns.float+patterns.integer -patterns.cnumber=patterns.cfloat+patterns.integer -patterns.oct=P("0")*R("07")^1 -patterns.octal=patterns.oct -patterns.HEX=P("0x")*R("09","AF")^1 -patterns.hex=P("0x")*R("09","af")^1 -patterns.hexadecimal=P("0x")*R("09","AF","af")^1 -patterns.lowercase=R("az") -patterns.uppercase=R("AZ") +patterns.lowercase=lowercase +patterns.uppercase=uppercase patterns.letter=patterns.lowercase+patterns.uppercase patterns.space=space patterns.tab=P("\t") @@ -179,12 +173,12 @@ patterns.spaceortab=patterns.space+patterns.tab patterns.newline=newline patterns.emptyline=newline^1 patterns.equal=P("=") -patterns.comma=P(",") -patterns.commaspacer=P(",")*spacer^0 -patterns.period=P(".") +patterns.comma=comma +patterns.commaspacer=comma*spacer^0 +patterns.period=period patterns.colon=P(":") patterns.semicolon=P(";") -patterns.underscore=P("_") +patterns.underscore=underscore patterns.escaped=escaped patterns.squote=squote patterns.dquote=dquote @@ -197,7 +191,26 @@ patterns.unspacer=((patterns.spacer^1)/"")^0 patterns.singlequoted=squote*patterns.nosquote*squote patterns.doublequoted=dquote*patterns.nodquote*dquote patterns.quoted=patterns.doublequoted+patterns.singlequoted -patterns.propername=R("AZ","az","__")*R("09","AZ","az","__")^0*endofstring +patterns.digit=digit +patterns.octdigit=octdigit +patterns.hexdigit=hexdigit +patterns.sign=sign +patterns.cardinal=digit^1 +patterns.integer=sign^-1*digit^1 +patterns.unsigned=digit^0*period*digit^1 +patterns.float=sign^-1*patterns.unsigned +patterns.cunsigned=digit^0*comma*digit^1 +patterns.cfloat=sign^-1*patterns.cunsigned +patterns.number=patterns.float+patterns.integer +patterns.cnumber=patterns.cfloat+patterns.integer +patterns.oct=zero*octdigit^1 +patterns.octal=patterns.oct +patterns.HEX=zero*P("X")*(digit+uppercase)^1 +patterns.hex=zero*P("x")*(digit+lowercase)^1 +patterns.hexadecimal=zero*S("xX")*hexdigit^1 +patterns.hexafloat=sign^-1*zero*S("xX")*(hexdigit^0*period*hexdigit^1+hexdigit^1*period*hexdigit^0+hexdigit^1)*(S("pP")*sign^-1*hexdigit^1)^-1 +patterns.decafloat=sign^-1*(digit^0*period*digit^1+digit^1*period*digit^0+digit^1)*S("eE")*sign^-1*digit^1 +patterns.propername=(uppercase+lowercase+underscore)*(uppercase+lowercase+underscore+digit)^0*endofstring patterns.somecontent=(anything-newline-space)^1 patterns.beginline=#(1-newline) patterns.longtostring=Cs(whitespace^0/""*nonwhitespace^0*((whitespace^0/" "*(patterns.quoted+nonwhitespace)^1)^0)) @@ -666,9 +679,6 @@ end function lpeg.times(pattern,n) return P(nextstep(n,2^16,{ "start",["1"]=pattern })) end -local digit=R("09") -local period=P(".") -local zero=P("0") local trailingzeros=zero^0*-digit local case_1=period*trailingzeros/"" local case_2=period*(digit-trailingzeros)^1*(trailingzeros/"") @@ -1168,7 +1178,7 @@ local function do_serialize(root,name,depth,level,indexed) handle(format("%s %s,",depth,tostring(v))) elseif t=="function" then if functions then - handle(format('%s load(%q),',depth,dump(v))) + handle(format('%s load(%q),',depth,dump(v))) else handle(format('%s "function",',depth)) end @@ -2613,7 +2623,7 @@ setmetatable(arguments,{ __index=function(t,k) end }) local prefix_any=C((S("+- .")+R("09"))^0) -local prefix_tab=C((1-R("az","AZ","09","%%"))^0) +local prefix_tab=P("{")*C((1-P("}"))^0)*P("}")+C((1-R("az","AZ","09","%%"))^0) local format_s=function(f) n=n+1 if f and f~="" then @@ -2863,8 +2873,8 @@ local builder=Cs { "start", ["b"]=(prefix_any*P("b"))/format_b, ["t"]=(prefix_tab*P("t"))/format_t, ["T"]=(prefix_tab*P("T"))/format_T, - ["l"]=(prefix_tab*P("l"))/format_l, - ["L"]=(prefix_tab*P("L"))/format_L, + ["l"]=(prefix_any*P("l"))/format_l, + ["L"]=(prefix_any*P("L"))/format_L, ["I"]=(prefix_any*P("I"))/format_I, ["w"]=(prefix_any*P("w"))/format_w, ["W"]=(prefix_any*P("W"))/format_W, @@ -10005,227 +10015,227 @@ local function featuresprocessor(head,font,attr) local done=false local datasets=otf.dataset(tfmdata,font,attr) local dirstack={} -for s=1,#datasets do - local dataset=datasets[s] - featurevalue=dataset[1] - local sequence=dataset[5] - local rlparmode=0 - local topstack=0 - local success=false - local attribute=dataset[2] - local chain=dataset[3] - local typ=sequence.type - local subtables=sequence.subtables - if chain<0 then - local handler=handlers[typ] - local start=find_node_tail(head) + for s=1,#datasets do + local dataset=datasets[s] + featurevalue=dataset[1] + local sequence=dataset[5] + local rlparmode=0 + local topstack=0 + local success=false + local attribute=dataset[2] + local chain=dataset[3] + local typ=sequence.type + local subtables=sequence.subtables + if chain<0 then + local handler=handlers[typ] + local start=find_node_tail(head) + while start do + local id=start.id + if id==glyph_code then + if start.font==font and start.subtype<256 then + local a=start[0] + if a then + a=a==attr + else + a=true + end + if a then + for i=1,#subtables do + local lookupname=subtables[i] + local lookupcache=lookuphash[lookupname] + if lookupcache then + local lookupmatch=lookupcache[start.char] + if lookupmatch then + head,start,success=handler(head,start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,i) + if success then + break + end + end + else + report_missing_cache(typ,lookupname) + end + end + if start then start=start.prev end + else + start=start.prev + end + else + start=start.prev + end + else + start=start.prev + end + end + else + local handler=handlers[typ] + local ns=#subtables + local start=head + rlmode=0 + if ns==1 then + local lookupname=subtables[1] + local lookupcache=lookuphash[lookupname] + if not lookupcache then + report_missing_cache(typ,lookupname) + else while start do local id=start.id if id==glyph_code then if start.font==font and start.subtype<256 then local a=start[0] if a then - a=a==attr + a=(a==attr) and (not attribute or start[a_state]==attribute) else - a=true + a=not attribute or start[a_state]==attribute end if a then - for i=1,#subtables do - local lookupname=subtables[i] - local lookupcache=lookuphash[lookupname] - if lookupcache then - local lookupmatch=lookupcache[start.char] - if lookupmatch then - head,start,success=handler(head,start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,i) - if success then - break - end - end - else - report_missing_cache(typ,lookupname) + local lookupmatch=lookupcache[start.char] + if lookupmatch then + local ok + head,start,ok=handler(head,start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,1) + if ok then + success=true end end - if start then start=start.prev end + if start then start=start.next end else - start=start.prev + start=start.next end + elseif id==math_code then + start=end_of_math(start).next else - start=start.prev + start=start.next end - else - start=start.prev - end - end - else - local handler=handlers[typ] - local ns=#subtables - local start=head - rlmode=0 - if ns==1 then - local lookupname=subtables[1] - local lookupcache=lookuphash[lookupname] - if not lookupcache then - report_missing_cache(typ,lookupname) - else - while start do - local id=start.id - if id==glyph_code then - if start.font==font and start.subtype<256 then - local a=start[0] - if a then - a=(a==attr) and (not attribute or start[a_state]==attribute) - else - a=not attribute or start[a_state]==attribute - end - if a then - local lookupmatch=lookupcache[start.char] - if lookupmatch then - local ok - head,start,ok=handler(head,start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,1) - if ok then - success=true - end - end - if start then start=start.next end - else - start=start.next - end - elseif id==math_code then - start=end_of_math(start).next - else - start=start.next - end - elseif id==whatsit_code then - local subtype=start.subtype - if subtype==dir_code then - local dir=start.dir - if dir=="+TRT" or dir=="+TLT" then - topstack=topstack+1 - dirstack[topstack]=dir - elseif dir=="-TRT" or dir=="-TLT" then - topstack=topstack-1 - end - local newdir=dirstack[topstack] - if newdir=="+TRT" then - rlmode=-1 - elseif newdir=="+TLT" then - rlmode=1 - else - rlmode=rlparmode - end - if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir) - end - elseif subtype==localpar_code then - local dir=start.dir - if dir=="TRT" then - rlparmode=-1 - elseif dir=="TLT" then - rlparmode=1 - else - rlparmode=0 - end - rlmode=rlparmode - if trace_directions then - report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode) - end - end - start=start.next - elseif id==math_code then - start=end_of_math(start).next + elseif id==whatsit_code then + local subtype=start.subtype + if subtype==dir_code then + local dir=start.dir + if dir=="+TRT" or dir=="+TLT" then + topstack=topstack+1 + dirstack[topstack]=dir + elseif dir=="-TRT" or dir=="-TLT" then + topstack=topstack-1 + end + local newdir=dirstack[topstack] + if newdir=="+TRT" then + rlmode=-1 + elseif newdir=="+TLT" then + rlmode=1 else - start=start.next + rlmode=rlparmode + end + if trace_directions then + report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir) + end + elseif subtype==localpar_code then + local dir=start.dir + if dir=="TRT" then + rlparmode=-1 + elseif dir=="TLT" then + rlparmode=1 + else + rlparmode=0 + end + rlmode=rlparmode + if trace_directions then + report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode) end end + start=start.next + elseif id==math_code then + start=end_of_math(start).next + else + start=start.next end - else - while start do - local id=start.id - if id==glyph_code then - if start.font==font and start.subtype<256 then - local a=start[0] - if a then - a=(a==attr) and (not attribute or start[a_state]==attribute) - else - a=not attribute or start[a_state]==attribute - end - if a then - for i=1,ns do - local lookupname=subtables[i] - local lookupcache=lookuphash[lookupname] - if lookupcache then - local lookupmatch=lookupcache[start.char] - if lookupmatch then - local ok - head,start,ok=handler(head,start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,i) - if ok then - success=true - break - elseif not start then - break - end - end - else - report_missing_cache(typ,lookupname) + end + end + else + while start do + local id=start.id + if id==glyph_code then + if start.font==font and start.subtype<256 then + local a=start[0] + if a then + a=(a==attr) and (not attribute or start[a_state]==attribute) + else + a=not attribute or start[a_state]==attribute + end + if a then + for i=1,ns do + local lookupname=subtables[i] + local lookupcache=lookuphash[lookupname] + if lookupcache then + local lookupmatch=lookupcache[start.char] + if lookupmatch then + local ok + head,start,ok=handler(head,start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,i) + if ok then + success=true + break + elseif not start then + break end end - if start then start=start.next end - else - start=start.next - end - else - start=start.next - end - elseif id==whatsit_code then - local subtype=start.subtype - if subtype==dir_code then - local dir=start.dir - if dir=="+TRT" or dir=="+TLT" then - topstack=topstack+1 - dirstack[topstack]=dir - elseif dir=="-TRT" or dir=="-TLT" then - topstack=topstack-1 - end - local newdir=dirstack[topstack] - if newdir=="+TRT" then - rlmode=-1 - elseif newdir=="+TLT" then - rlmode=1 - else - rlmode=rlparmode - end - if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir) - end - elseif subtype==localpar_code then - local dir=start.dir - if dir=="TRT" then - rlparmode=-1 - elseif dir=="TLT" then - rlparmode=1 else - rlparmode=0 - end - rlmode=rlparmode - if trace_directions then - report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode) + report_missing_cache(typ,lookupname) end end - start=start.next - elseif id==math_code then - start=end_of_math(start).next + if start then start=start.next end else start=start.next end + else + start=start.next + end + elseif id==whatsit_code then + local subtype=start.subtype + if subtype==dir_code then + local dir=start.dir + if dir=="+TRT" or dir=="+TLT" then + topstack=topstack+1 + dirstack[topstack]=dir + elseif dir=="-TRT" or dir=="-TLT" then + topstack=topstack-1 + end + local newdir=dirstack[topstack] + if newdir=="+TRT" then + rlmode=-1 + elseif newdir=="+TLT" then + rlmode=1 + else + rlmode=rlparmode + end + if trace_directions then + report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir) + end + elseif subtype==localpar_code then + local dir=start.dir + if dir=="TRT" then + rlparmode=-1 + elseif dir=="TLT" then + rlparmode=1 + else + rlparmode=0 + end + rlmode=rlparmode + if trace_directions then + report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode) + end end + start=start.next + elseif id==math_code then + start=end_of_math(start).next + else + start=start.next end end - if success then - done=true - end - if trace_steps then - registerstep(head) - end + end + end + if success then + done=true + end + if trace_steps then + registerstep(head) + end end return head,done end -- cgit v1.2.3