From f0302311dd47bf250c0e2b5f8be46f21437f43d8 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 28 Jan 2008 21:28:00 +0100 Subject: stable 2008.01.28 21:28 --- tex/context/base/cont-new.tex | 2 +- tex/context/base/context.tex | 2 +- tex/context/base/core-job.lua | 56 ++++++++++++------ tex/context/base/core-job.mkiv | 6 +- tex/context/base/font-otf.lua | 118 +++++++++++++++++++++----------------- tex/context/base/l-os.lua | 12 ++-- tex/context/base/l-utils.lua | 4 +- tex/context/base/luat-crl.lua | 2 +- tex/context/base/luat-lmx.lua | 4 +- tex/context/base/page-flt.tex | 5 +- tex/context/interface/keys-cz.xml | 2 +- tex/context/interface/keys-de.xml | 2 +- tex/context/interface/keys-en.xml | 2 +- tex/context/interface/keys-fr.xml | 2 +- tex/context/interface/keys-it.xml | 2 +- tex/context/interface/keys-nl.xml | 2 +- tex/context/interface/keys-ro.xml | 2 +- 17 files changed, 126 insertions(+), 99 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 09a7a2887..eff20a6e8 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2008.01.26 02:30} +\newcontextversion{2008.01.28 21:28} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index d0291934f..449d667f4 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -42,7 +42,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2008.01.26 02:30} +\edef\contextversion{2008.01.28 21:28} %D For those who want to use this: diff --git a/tex/context/base/core-job.lua b/tex/context/base/core-job.lua index ce2952ff6..aa3ff9a0e 100644 --- a/tex/context/base/core-job.lua +++ b/tex/context/base/core-job.lua @@ -29,27 +29,47 @@ cs.testcase = commands.doifelse -- main code -function commands.processfile(name) - name = input.find_file(texmf.instance,name) or "" - if name ~= "" then - tex.sprint(tex.ctxcatcodes,string.format("\\input %s\\relax",name)) +do + + local function find(name,maxreadlevel) + local n = "./" .. name + if io.exists(n) then + return n + else + n = file.addsuffix(name,'tex') + for i=1,maxreadlevel or 0 do + n = "../" .. n + if io.exists(n) then + return n + end + end + end + return input.find_file(texmf.instance,name) or "" end -end -function commands.doifinputfileelse(name) - commands.doifelse((input.find_file(texmf.instance,name) or "") ~= "") -end + function commands.processfile(name,maxreadlevel) + name = find(name,maxreadlevel) + if name ~= "" then + tex.sprint(tex.ctxcatcodes,string.format("\\input %s\\relax",name)) + end + end -function commands.locatefilepath(name) - tex.sprint(tex.texcatcodes,file.dirname(input.find_file(texmf.instance,name) or "")) -end + function commands.doifinputfileelse(name,maxreadlevel) + commands.doifelse(find(name,maxreadlevel) ~= "") + end -function commands.usepath(paths) - input.register_extra_path(texmf.instance,paths) - tex.sprint(tex.texcatcodes,table.concat(texmf.instance.extra_paths or {}, "")) -end + function commands.locatefilepath(name,maxreadlevel) + tex.sprint(tex.texcatcodes,file.dirname(find(name,maxreadlevel))) + end + + function commands.usepath(paths,maxreadlevel) + input.register_extra_path(texmf.instance,paths) + tex.sprint(tex.texcatcodes,table.concat(texmf.instance.extra_paths or {}, "")) + end + + function commands.usesubpath(subpaths,maxreadlevel) + input.register_extra_path(texmf.instance,nil,subpaths) + tex.sprint(tex.texcatcodes,table.concat(texmf.instance.extra_paths or {}, "")) + end -function commands.usesubpath(subpaths) - input.register_extra_path(texmf.instance,nil,subpaths) - tex.sprint(tex.texcatcodes,table.concat(texmf.instance.extra_paths or {}, "")) end diff --git a/tex/context/base/core-job.mkiv b/tex/context/base/core-job.mkiv index d9cc308f1..82ee878aa 100644 --- a/tex/context/base/core-job.mkiv +++ b/tex/context/base/core-job.mkiv @@ -13,9 +13,9 @@ \registerctxluafile{core-job}{1.001} -\def\processfile #1{\ctxlua{commands.processfile("#1")}} -\def\doifinputfileelse#1{\ctxlua{commands.doifinputfileelse("#1")}} -\def\locatefilepath #1{\edef\locatedfilepath{\ctxlua{commands.locatefilepath("#1")}}} +\def\processfile #1{\ctxlua{commands.processfile("#1",\number\maxreadlevel)}} +\def\doifinputfileelse#1{\ctxlua{commands.doifinputfileelse("#1",\number\maxreadlevel)}} +\def\locatefilepath #1{\edef\locatedfilepath{\ctxlua{commands.locatefilepath("#1",\number\maxreadlevel)}}} \def\usepath [#1]{\edef\allinputpaths{\ctxlua{commands.usepath("#1")}}} \def\usesubpath [#1]{\edef\allinputpaths{\ctxlua{commands.usesubpath("#1")}}} diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index 58edc4ea2..d283c5543 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -16,7 +16,7 @@ if not modules then modules = { } end modules ['font-otf'] = { -- todo: dependents etc resolve too, maybe even reorder glyphs to unicode -- todo: pack ignoreflags --- abvf abvs blwf blwm blws dist falt half halt jalt lfbd ljmo +-- abvf abvs blwf blws dist falt half halt jalt lfbd ljmo -- mset opbd palt pwid qwid rand rtbd rtla ruby size tjmo twid valt vatu vert -- vhal vjmo vkna vkrn vpal vrt2 @@ -1042,37 +1042,7 @@ do end fonts.otf.cidmaps = { } - ---~ function fonts.otf.cidmap(registry,ordering,supplement) ---~ local template = "%s-%s-%s.cidmap" ---~ local filename = string.format(template,registry,ordering,supplement) ---~ local supplement = tonumber(supplement) ---~ local cidmap = fonts.otf.cidmaps[filename] ---~ if not cidmap then ---~ for i=supplement,0,-1 do ---~ logs.report("load otf",string.format("checking cidmap, registry: %s, ordering: %s, supplement: %s",registry,ordering,i)) ---~ filename = string.format(template,registry,ordering,i) ---~ local fullname = input.find_file(texmf.instance,filename,'cid') or "" ---~ if fullname ~= "" then ---~ cidmap = fonts.otf.load_cidmap(fullname) ---~ if cidmap then ---~ logs.report("load otf",string.format("using cidmap file %s",filename)) ---~ fonts.otf.cidmaps[filename] = cidmap ---~ if i < supplement then ---~ for j=i+1,supplement do ---~ filename = string.format(template,registry,ordering,j) ---~ fonts.otf.cidmaps[filename] = cidmap -- copy of ref ---~ end ---~ end ---~ return cidmap ---~ end ---~ end ---~ end ---~ end ---~ return cidmap ---~ end - -fonts.otf.cidmax = 10 +fonts.otf.cidmax = 10 function fonts.otf.cidmap(registry,ordering,supplement) -- cf Arthur R. we can safely scan upwards since cids are downward compatible @@ -1184,8 +1154,8 @@ function fonts.otf.enhance.before(data,filename) end end if data.map then - local uni_to_int = data.map.map - local int_to_uni = data.map.backmap + local uni_to_int = data.map.map -- [unic] = slot + local int_to_uni = data.map.backmap -- { [0|1] = unic, ... } for index, glyph in pairs(data.glyphs) do if glyph.name then local unic = glyph.unicode or glyph.unicodeenc or -1 @@ -1321,10 +1291,6 @@ function fonts.otf.enhance.after(data,filename) -- to be split end function fonts.otf.enhance.strip(data) ---~ if data.map then ---~ data.map.enc = nil -- not needed ---~ end ---~ data.map = { map = {}, backmap = {} } for k, v in pairs(data.glyphs) do local d = v.dependents if d then v.dependents = nil end @@ -1484,13 +1450,19 @@ function fonts.otf.analyze_subtables(data) script = script:lower() script = script:strip() sft = subtables[ft] - sft[script] = sft[script] or { } local sfts = sft[script] + if not sfts then + sfts = { } + sft[script] = sfts + end for _, language in ipairs(languages) do language = language:lower() language = language:strip() - sfts[language] = sfts[language] or { } local sftsl = sfts[language] + if not sftsl then + sftsl = sfts[language] or { } + sfts[language] = sftsl + end local lookups, valid = sftsl.lookups or { }, sftsl.valid or { } for n, subtable in ipairs(v.subtables) do local stl = subtable.name @@ -1980,6 +1952,19 @@ end fonts.otf.default_language = 'latn' fonts.otf.default_script = 'dflt' +--~ function fonts.otf.valid_feature(otfdata,kind,script,language) -- return hash is faster +--~ if otfdata.luatex.ctx_always[kind] then +--~ script, language = 'dflt', 'dflt' +--~ else +--~ script = script or fonts.otf.default_script +--~ language = language or fonts.otf.default_language +--~ end +--~ script, language = script:lower(), language:lower() -- will go away, we will lowercase values +--~ local ft = otfdata.luatex.subtables[kind] +--~ local st = ft[script] +--~ return false, otfdata.luatex.always_valid, st and st[language] and st[language].valid +--~ end + function fonts.otf.valid_feature(otfdata,kind,script,language) -- return hash is faster if otfdata.luatex.ctx_always[kind] then script, language = 'dflt', 'dflt' @@ -1989,10 +1974,27 @@ function fonts.otf.valid_feature(otfdata,kind,script,language) -- return hash is end script, language = script:lower(), language:lower() -- will go away, we will lowercase values local ft = otfdata.luatex.subtables[kind] - local st = ft[script] - return false, otfdata.luatex.always_valid, st and st[language] and st[language].valid + local st = ft[script] or ft.dflt + local lt = st and (st[language] or st.dflt) + return false, otfdata.luatex.always_valid, lt.valid end +--~ function fonts.otf.some_valid_feature(otfdata,kind,script,language) +--~ if otfdata.luatex.ctx_always[kind] then +--~ script, language = 'dflt', 'dflt' +--~ else +--~ script = script or fonts.otf.default_script +--~ language = language or fonts.otf.default_language +--~ script, language = script:lower(), language:lower() -- will go away, we will lowercase values +--~ end +--~ local t = otfdata.luatex.subtables[kind] +--~ if t and t[script] and t[script][language] and t[script][language].valid then +--~ return t[script][language].valid +--~ else +--~ return { } +--~ end +--~ end + function fonts.otf.some_valid_feature(otfdata,kind,script,language) if otfdata.luatex.ctx_always[kind] then script, language = 'dflt', 'dflt' @@ -2002,11 +2004,14 @@ function fonts.otf.some_valid_feature(otfdata,kind,script,language) script, language = script:lower(), language:lower() -- will go away, we will lowercase values end local t = otfdata.luatex.subtables[kind] - if t and t[script] and t[script][language] and t[script][language].valid then - return t[script][language].valid - else - return { } + if t then + local ts = t[script] or t.dflt + if ts then + local tsl = ts[language] or ts.dflt + return (tsl and tsl.valid) or { } + end end + return { } end function fonts.otf.features.aux.resolve_ligatures(tfmdata,ligatures,kind) @@ -2633,8 +2638,10 @@ do local prepare = fonts.otf.features.prepare.feature function fonts.initializers.node.otf.aalt(tfm,value) return prepare(tfm,'aalt',value) end + function fonts.initializers.node.otf.abvm(tfm,value) return prepare(tfm,'abvm',value) end function fonts.initializers.node.otf.afrc(tfm,value) return prepare(tfm,'afrc',value) end function fonts.initializers.node.otf.akhn(tfm,value) return prepare(tfm,'akhn',value) end + function fonts.initializers.node.otf.blwm(tfm,value) return prepare(tfm,'blwm',value) end function fonts.initializers.node.otf.c2pc(tfm,value) return prepare(tfm,'c2pc',value) end function fonts.initializers.node.otf.c2sc(tfm,value) return prepare(tfm,'c2sc',value) end function fonts.initializers.node.otf.calt(tfm,value) return prepare(tfm,'calt',value) end @@ -2950,7 +2957,7 @@ do if replacements then start.char = replacements if fonts.otf.trace_replacements then - report("process otf",format("%s:%s replacing %s by %s",kind,lookupname,start.char,replacements)) + report("otf process",format("%s:%s replacing %s by %s",kind,lookupname,start.char,replacements)) end return start, true else @@ -2962,7 +2969,7 @@ do if alternatives then start.char = alternatives[1] -- will be preference if fonts.otf.trace_replacements then - report("process otf",format("%s:%s alternative %s => %s",kind,lookupname,start.char,table.concat(alternatives,"|"))) + report("otf process",format("%s:%s alternative %s => %s",kind,lookupname,start.char,table.concat(alternatives,"|"))) end return start, true else @@ -2988,7 +2995,7 @@ do end end if fonts.otf.trace_replacements then - report("process otf",format("%s:%s alternative %s => %s",kind,lookupname,start.char,table.concat(multiples," "))) + report("otf process",format("%s:%s alternative %s => %s",kind,lookupname,start.char,table.concat(multiples," "))) end return start, true else @@ -3027,7 +3034,7 @@ do if stop and ligatures[2] then start = toligature(start,stop,ligatures[2],flags[1],discfound) if fonts.otf.trace_ligatures then - report("process otf",format("%s: inserting ligature %s (%s)",kind,start.char,utf.char(start.char))) + report("otf process",format("%s: inserting ligature %s (%s)",kind,start.char,utf.char(start.char))) end return start, true end @@ -3057,7 +3064,7 @@ do component.xoffset = start.xoffset - dx component.yoffset = start.yoffset + dy if trace then - report("process otf",format("%s: anchoring mark %s to basechar %s => (%s,%s) => (%s,%s)",kind,component.char,start.char,dx,dy,component.xoffset,component.yoffset)) + report("otf process",format("%s: anchoring mark %s to basechar %s => (%s,%s) => (%s,%s)",kind,component.char,start.char,dx,dy,component.xoffset,component.yoffset)) end done = true break @@ -3106,7 +3113,7 @@ do component.xoffset = start.xoffset - dx component.yoffset = start.yoffset + dy if trace then - report("process otf",format("%s:%s:%s anchoring mark %s to baselig %s => (%s,%s) => (%s,%s)",kind,anchor,n,component.char,start.char,dx,dy,component.xoffset,component.yoffset)) + report("otf process",format("%s:%s:%s anchoring mark %s to baselig %s => (%s,%s) => (%s,%s)",kind,anchor,n,component.char,start.char,dx,dy,component.xoffset,component.yoffset)) end done = true break @@ -3157,7 +3164,7 @@ do component.xoffset = start.xoffset - dx component.yoffset = start.yoffset + dy if trace then - report("process otf",format("%s:%s:%s anchoring mark %s to basemark %s => (%s,%s) => (%s,%s)",kind,anchor,markattr,start.char,component.char,dx,dy,component.xoffset,component.yoffset)) + report("otf process",format("%s:%s:%s anchoring mark %s to basemark %s => (%s,%s) => (%s,%s)",kind,anchor,markattr,start.char,component.char,dx,dy,component.xoffset,component.yoffset)) end done = true break @@ -3280,6 +3287,9 @@ do end else -- todo, just start, next = node.insert_before(head,next,nodes.kern(scale(kern,factor))) + if fonts.otf.trace_kerns then + report("otf process",format("%s: inserting kern %s between %s and %s",kind,krn,prev.char,next.char)) + end local k = nodes.kern(scale(krn,factor)) k.next = next k.prev = prev @@ -3841,8 +3851,10 @@ do local process = fonts.otf.features.process.feature function fonts.methods.node.otf.aalt(head,font,attr) return process(head,font,attr,'aalt') end + function fonts.methods.node.otf.abvm(head,font,attr) return process(head,font,attr,'abvm') end function fonts.methods.node.otf.afrc(head,font,attr) return process(head,font,attr,'afrc') end function fonts.methods.node.otf.akhn(head,font,attr) return process(head,font,attr,'akhn') end + function fonts.methods.node.otf.blwm(head,font,attr) return process(head,font,attr,'blwm') end function fonts.methods.node.otf.c2pc(head,font,attr) return process(head,font,attr,'c2pc') end function fonts.methods.node.otf.c2sc(head,font,attr) return process(head,font,attr,'c2sc') end function fonts.methods.node.otf.calt(head,font,attr) return process(head,font,attr,'calt') end diff --git a/tex/context/base/l-os.lua b/tex/context/base/l-os.lua index 298dfa757..26303ea95 100644 --- a/tex/context/base/l-os.lua +++ b/tex/context/base/l-os.lua @@ -10,18 +10,14 @@ function os.resultof(command) return io.popen(command,"r"):read("*all") end -if not os.exec then -- still not ok - os.exec = os.execute -end -if not os.spawn then -- still not ok - os.spawn = os.execute -end +if not os.exec then os.exec = os.execute end +if not os.spawn then os.spawn = os.execute end function os.launch(str) if os.platform == "windows" then - os.execute("start " .. str) + os.execute("start " .. str) -- os.spawn ? else - os.execute(str .. " &") + os.execute(str .. " &") -- os.spawn ? end end diff --git a/tex/context/base/l-utils.lua b/tex/context/base/l-utils.lua index c4676a83d..fbc05a26a 100644 --- a/tex/context/base/l-utils.lua +++ b/tex/context/base/l-utils.lua @@ -122,9 +122,9 @@ function utils.lua.compile(luafile, lucfile) if utils.lua.compile_strip then command = "-s " .. command end - if os.execute("texluac " .. command) == 0 then + if os.spawn("texluac " .. command) == 0 then return true - elseif os.execute("luac " .. command) == 0 then + elseif os.spawn("luac " .. command) == 0 then return true else return false diff --git a/tex/context/base/luat-crl.lua b/tex/context/base/luat-crl.lua index 129832765..973655999 100644 --- a/tex/context/base/luat-crl.lua +++ b/tex/context/base/luat-crl.lua @@ -18,7 +18,7 @@ function curl.fetch(protocol, name) if not io.exists(cachename) then curl.cached[name] = cachename local command = "curl --silent --create-dirs --output " .. cachename .. " " .. protocol .. "://" .. name - os.execute(command) + os.spawn(command) end if io.exists(cachename) then curl.cached[name] = cachename diff --git a/tex/context/base/luat-lmx.lua b/tex/context/base/luat-lmx.lua index 75a7098c1..65434668a 100644 --- a/tex/context/base/luat-lmx.lua +++ b/tex/context/base/luat-lmx.lua @@ -94,9 +94,9 @@ lmx.lmxfile = function(filename) return filename end lmx.htmfile = function(filename) return filename end if environment.platform == "windows" then - lmx.popupfile = function(filename) os.execute("start " .. filename) end + lmx.popupfile = function(filename) os.spawn("start " .. filename) end else - lmx.popupfile = function(filename) os.execute(filename) end + lmx.popupfile = function(filename) os.spawn(filename) end end function lmx.show(name) diff --git a/tex/context/base/page-flt.tex b/tex/context/base/page-flt.tex index 0aa8deb45..73410380a 100644 --- a/tex/context/base/page-flt.tex +++ b/tex/context/base/page-flt.tex @@ -2290,7 +2290,7 @@ \fi} \def\flushrestfloats - {\doif\@@bkcache\v!no\doflushfloats} + {\doif\@@bkcache\v!no\doflushsavedfloats} \def\dopostponeblock {\bgroup % new may 2004 @@ -2340,8 +2340,7 @@ {\realfolio}{\nofpostponedpageblocks}\to\postponedpageblocks \egroup \showmessage\m!layouts3\nofpostponedpageblocks - \dostartbuffer[rbuf-\nofpostponedpageblocks]% - [\e!start\v!postponing][\e!stop\v!postponing]} + \dostartbuffer[rbuf-\nofpostponedpageblocks][\e!start\v!postponing][\e!stop\v!postponing]} \def\dodostartpostponing {\doglobal\increment\nofpostponedblocks diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml index 9825860cb..73e54d41b 100644 --- a/tex/context/interface/keys-cz.xml +++ b/tex/context/interface/keys-cz.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 3e6509f3d..05c52afd5 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index 54f807058..d17639592 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index 08ad77896..66aefca53 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 5199ba474..0273a0f65 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index 5a8574699..08d0f48d0 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index fd4eee379..a4b84829e 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -1,6 +1,6 @@ - + -- cgit v1.2.3