From 06c7a7fdaac34512cdc3ff250dec5b1a7ab3052a Mon Sep 17 00:00:00 2001 From: Marius Date: Thu, 14 Jul 2011 13:40:13 +0300 Subject: beta 2011.07.14 12:19 --- scripts/context/lua/mtx-update.lua | 26 ++++-- tex/context/base/cldf-ini.lua | 24 +++--- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/core-two.lua | 90 ++++++++++++--------- tex/context/base/core-two.mkiv | 37 +++++---- tex/context/base/font-otb.lua | 2 +- tex/context/base/font-otn.lua | 35 +++++--- tex/context/base/luat-cod.mkiv | 14 ++-- tex/context/base/math-ini.mkiv | 26 ++---- tex/context/base/math-map.lua | 6 ++ tex/context/base/math-noa.lua | 4 + tex/context/base/math-vfu.lua | 12 +-- tex/context/base/s-fnt-21.mkiv | 2 +- tex/context/base/s-fnt-25.mkiv | 71 +++++++++++++++- tex/context/base/s-fnt-31.mkiv | 29 +++++-- tex/context/base/status-files.pdf | Bin 23763 -> 23753 bytes tex/context/base/status-lua.pdf | Bin 161767 -> 162055 bytes tex/context/base/strc-itm.lua | 21 ++++- tex/context/base/strc-itm.mkiv | 8 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 39 ++++++--- 23 files changed, 303 insertions(+), 151 deletions(-) diff --git a/scripts/context/lua/mtx-update.lua b/scripts/context/lua/mtx-update.lua index 099a7218f..937fed21b 100644 --- a/scripts/context/lua/mtx-update.lua +++ b/scripts/context/lua/mtx-update.lua @@ -542,18 +542,30 @@ if scripts.savestate then for r in gmatch(environment.argument("repository") or "current","([^, ]+)") do if valid[r] then states.set("repositories." .. r, true) end end + local valid = scripts.update.engines - for r in gmatch(environment.argument("engine") or "all","([^, ]+)") do - if r == "all" then - for k, v in next, valid do - if k ~= "all" then - states.set("engines." .. k, true) + local engine = environment.argument("engine") or "" + if engine == "" then + local e = states.get("engines") + if not e or not next(e) then + engine = "all" + end + end + if engine ~= "" then + for r in gmatch(engine,"([^, ]+)") do + if r == "all" then + for k, v in next, valid do + if k ~= "all" then + states.set("engines." .. k, true) + end end + break + elseif valid[r] then + states.set("engines." .. r, true) end - elseif valid[r] then - states.set("engines." .. r, true) end end + local valid = scripts.update.platforms for r in gmatch(environment.argument("platform") or os.platform,"([^, ]+)") do if valid[r] then states.set("platforms." .. r, true) end diff --git a/tex/context/base/cldf-ini.lua b/tex/context/base/cldf-ini.lua index 2544f0ded..624066784 100644 --- a/tex/context/base/cldf-ini.lua +++ b/tex/context/base/cldf-ini.lua @@ -6,22 +6,18 @@ if not modules then modules = { } end modules ['cldf-ini'] = { license = "see context related readme files" } --- This is an experiment: generating context code at the lua end. After all --- it is surprisingly simple to implement due to metatables. I was wondering --- if there was a more natural way to deal with commands at the lua end. --- Of course it's a bit slower but often more readable when mixed with lua --- code. It can also be handy when generating documents from databases or --- when constructing large tables or so. +-- This started as an experiment: generating context code at the lua end. After all +-- it is surprisingly simple to implement due to metatables. I was wondering if +-- there was a more natural way to deal with commands at the lua end. Of course it's +-- a bit slower but often more readable when mixed with lua code. It can also be handy +-- when generating documents from databases or when constructing large tables or so. -- --- Todo: optional checking against interface --- Todo: coroutine trickery --- Todo: maybe use txtcatcodes --- Todo: we could always use prtcatcodes (context.a_b_c) but then we loose protection - +-- maybe optional checking against interface +-- currently no coroutine trickery +-- we could always use prtcatcodes (context.a_b_c) but then we loose protection -- tflush needs checking ... sort of weird that it's not a table - -- __flushlines is an experiment and rather ugly so it will go away - +-- -- tex.print == line with endlinechar appended local tex = tex @@ -30,7 +26,7 @@ context = context or { } local context = context local format, find, gmatch, gsub = string.format, string.find, string.gmatch, string.gsub -local next, type, tostring, setmetatable = next, type, tostring, setmetatable +local next, type, tostring, tonumber, setmetatable = next, type, tostring, tonumber, setmetatable local insert, remove, concat = table.insert, table.remove, table.concat local lpegmatch, lpegC, lpegS, lpegP, lpegCc = lpeg.match, lpeg.C, lpeg.S, lpeg.P, lpeg.Cc diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index b26aabfdb..9380be7a6 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.07.13 20:14} +\newcontextversion{2011.07.14 12:19} %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/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 748e9a13b..2c8d13f13 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.07.13 20:14} +\newcontextversion{2011.07.14 12:19} %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.mkii b/tex/context/base/context.mkii index d9b8ec945..cef1fdf70 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.07.13 20:14} +\edef\contextversion{2011.07.14 12:19} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 129660060..dd3001f8f 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.07.13 20:14} +\edef\contextversion{2011.07.14 12:19} %D For those who want to use this: diff --git a/tex/context/base/core-two.lua b/tex/context/base/core-two.lua index 606030329..1c0680ad8 100644 --- a/tex/context/base/core-two.lua +++ b/tex/context/base/core-two.lua @@ -52,6 +52,19 @@ function jobpasses.savetagged(id,tag,str) jti[tag] = str end +function jobpasses.getdata(id,index,default) + local jti = collected[id] + local value = jit and jti[index] + return value ~= "" and value or default or "" +end + +function jobpasses.getfield(id,index,tag,default) + local jti = collected[id] + jti = jti and jti[index] + local value = jti and jti[tag] + return value ~= "" and value or default or "" +end + function jobpasses.getcollected(id) return collected[id] or { } end @@ -60,82 +73,85 @@ function jobpasses.gettobesaved(id) return allocate(id) end -function jobpasses.get(id) +local function get(id) local jti = collected[id] if jti and #jti > 0 then - context(remove(jti,1)) + return remove(jti,1) end end -function jobpasses.first(id) +local function first(id) local jti = collected[id] if jti and #jti > 0 then - context(jti[1]) + return jti[1] end end -function jobpasses.last(id) +local function last(id) local jti = collected[id] if jti and #jti > 0 then - context(jti[#jti]) + return jti[#jti] end end -jobpasses.check = jobpasses.first - -function jobpasses.find(id,n) +local function find(id,n) local jti = collected[id] if jti and jti[n] then - context(jti[n]) + return jti[n] end end -function jobpasses.count(id) +local function count(id) local jti = collected[id] - context((jti and #jti) or 0) + return jti and #jti or 0 end -function jobpasses.list(id) +local function list(id) local jti = collected[id] if jti then - context(concat(jti,',')) + return concat(jti,',') end end -function jobpasses.doifinlistelse(id,str) +local function inlist(id,str) local jti = collected[id] if jti then - local found = false for _, v in next, jti do if v == str then - found = true - break + return true end end - commands.testcase(found) - else - commands.testcase(false) end + return false end +local check = first + -- -function jobpasses.savedata(id,data) - local jti = allocate(id) - jti[#jti+1] = data - return #jti -end +jobpasses.get = get +jobpasses.first = first +jobpasses.last = last +jobpasses.find = find +jobpasses.list = list +jobpasses.count = count +jobpasses.check = check +jobpasses.inlist = inlist -function jobpasses.getdata(id,index,default) - local jti = collected[id] - local value = jit and jti[index] - context((value ~= "" and value) or default or "") -end +-- interface -function jobpasses.getfield(id,index,tag,default) - local jti = collected[id] - jti = jti and jti[index] - local value = jti and jti[tag] - context((value ~= "" and value) or default or "") -end +function commands.gettwopassdata (id) local r = get (id) if r then context(r) end end +function commands.getfirsttwopassdata(id) local r = first(id) if r then context(r) end end +function commands.getlasttwopassdata (id) local r = last (id) if r then context(r) end end +function commands.findtwopassdata (id) local r = find (id) if r then context(r) end end +function commands.gettwopassdatalist (id) local r = list (id) if r then context(r) end end +function commands.counttwopassdata (id) local r = count(id) if r then context(r) end end +function commands.checktwopassdata (id) local r = check(id) if r then context(r) end end + +commands.definetwopasslist = jobpasses.define +commands.savetwopassdata = jobpasses.save +commands.savetaggedtwopassdata = jobpasses.savetagged +function commands.doifelseintwopassdata(id,str) + commands.testcase(inlist(id,str)) +end diff --git a/tex/context/base/core-two.mkiv b/tex/context/base/core-two.mkiv index adea52f90..725573899 100644 --- a/tex/context/base/core-two.mkiv +++ b/tex/context/base/core-two.mkiv @@ -73,17 +73,18 @@ \let\twopassdatalist\empty -\newif\iftwopassdatafound +\newif\iftwopassdatafound %% will become conditional \registerctxluafile{core-two}{1.001} -%D I'm not that sure if this behaves exactly like mkii. This needs a cleanup. +%D I'm not that sure if this behaves exactly like mkii. This needs a cleanup. Is \type +%D {\normalexpanded} needed? -\def\immediatesavetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlua {job.passes.save('#1',"#3")}}} -\def\savetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlatelua{job.passes.save('#1',"#3")}}} -\def\lazysavetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlatelua{job.passes.save('#1',"#3")}}} -\def\savetaggedtwopassdata #1#2#3#4{\normalexpanded{\noexpand\ctxlua {job.passes.savetagged('#1','#3',"#4")}}} -\def\lazysavetaggedtwopassdata#1#2#3#4{\normalexpanded{\noexpand\ctxlatelua{job.passes.savetagged('#1','#3',"#4")}}} +\def\immediatesavetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxcommand {savetwopassdata('#1',"#3")}}} +\def\savetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlatecommand{savetwopassdata('#1',"#3")}}} +\def\lazysavetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlatecommand{savetwopassdata('#1',"#3")}}} +\def\savetaggedtwopassdata #1#2#3#4{\normalexpanded{\noexpand\ctxcommand {savetaggedtwopassdata('#1','#3',"#4")}}} +\def\lazysavetaggedtwopassdata#1#2#3#4{\normalexpanded{\noexpand\ctxlatecommand{savetaggedtwopassdata('#1','#3',"#4")}}} % temp hack: needs a proper \starteverytimeluacode @@ -91,16 +92,18 @@ % todo: move the edef to lua -\unexpanded\def\definetwopasslist #1{\ctxlua{job.passes.define('#1')}} -\def\gettwopassdata #1{\edef\twopassdata{\ctxlua{job.passes.get("#1")}}\testtwopassdata} -\def\checktwopassdata #1{\edef\twopassdata{\ctxlua{job.passes.check("#1")}}\testtwopassdata} -\def\findtwopassdata #1#2{\edef\twopassdata{\ctxlua{job.passes.find("#1","#2")}}\testtwopassdata} -\def\getfirsttwopassdata #1{\edef\twopassdata{\ctxlua{job.passes.first("#1")}}\testtwopassdata} -\def\getlasttwopassdata #1{\edef\twopassdata{\ctxlua{job.passes.last("#1")}}\edef\noftwopassitems{\ctxlua{job.passes.count("#1")}}\testtwopassdata} -\def\getnamedtwopassdatalist#1#2{\edef#1{\ctxlua{job.passes.list("#2")}}} -\def\gettwopassdatalist #1{\edef\twopassdatalist{\ctxlua{job.passes.list("#1")}}} -\def\doifelseintwopassdata #1#2{\ctxlua{job.passes.doifinlistelse("#1","#2")}} +\unexpanded\def\definetwopasslist #1{\ctxcommand{definetwopasslist('#1')}} + \def\gettwopassdata #1{\edef\twopassdata {\ctxcommand{gettwopassdata ("#1")}}\testtwopassdata} + \def\checktwopassdata #1{\edef\twopassdata {\ctxcommand{checktwopassdata ("#1")}}\testtwopassdata} + \def\findtwopassdata #1#2{\edef\twopassdata {\ctxcommand{findtwopassdata("#1","#2")}}\testtwopassdata} + \def\getfirsttwopassdata #1{\edef\twopassdata {\ctxcommand{getfirsttwopassdata ("#1")}}\testtwopassdata} + \def\getlasttwopassdata #1{\edef\twopassdata {\ctxcommand{getlasttwopassdata ("#1")}}% + \edef\noftwopassitems{\ctxcommand{counttwopassdata ("#1")}}\testtwopassdata} + \def\getnamedtwopassdatalist#1#2{\edef #1{\ctxcommand{gettwopassdatalist ("#2")}}} + \def\gettwopassdatalist #1{\edef\twopassdatalist{\ctxcommand{gettwopassdatalist ("#1")}}} -\let\getfromtwopassdata\findtwopassdata + \def\doifelseintwopassdata #1#2{\ctxcommand{doifelseintwopassdata("#1","#2")}} + + \let\getfromtwopassdata \findtwopassdata \protect \endinput diff --git a/tex/context/base/font-otb.lua b/tex/context/base/font-otb.lua index 1a812c328..b078ab3da 100644 --- a/tex/context/base/font-otb.lua +++ b/tex/context/base/font-otb.lua @@ -228,7 +228,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis substitution = function(lookupdata,lookupname,description,unicode) if trace_baseinit and trace_singles then report_prepare("%s: base substitution %s => %s",cref(feature,lookupname), - gref(descriptions,unicode),gref(descriptions,replacement)) + gref(descriptions,unicode),gref(descriptions,lookupdatat)) end changed[unicode] = lookupdata end, diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua index 0d11d3a8b..babf8b0d5 100644 --- a/tex/context/base/font-otn.lua +++ b/tex/context/base/font-otn.lua @@ -165,6 +165,7 @@ local copy_node = node.copy local find_node_tail = node.tail or node.slide local set_attribute = node.set_attribute local has_attribute = node.has_attribute +local flush_node_list = node.flush_list local setmetatableindex = table.setmetatableindex @@ -318,21 +319,35 @@ end local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- brr head if start == stop then start.char = char + return start elseif discfound then -- print("start->stop",nodes.tosequence(start,stop)) + local components = start.components + if components then + flush_node_list(components) + start.components = nil + end local lignode = copy_node(start) - lignode.font, lignode.char, lignode.subtype = start.font, char, ligature_code - local next, prev = stop.next, start.prev + lignode.font = start.font + lignode.char = char + lignode.subtype = ligature_code + local next = stop.next + local prev = start.prev stop.next = nil - lignode = node.do_ligature_n(start, stop, lignode) + start.prev = nil + lignode.components = start + -- print("lignode",nodes.tosequence(lignode)) + -- print("components",nodes.tosequence(lignode.components)) prev.next = lignode if next then next.prev = lignode end - lignode.next, lignode.prev = next, prev - start = lignode + lignode.next = next + lignode.prev = prev -- print("start->end",nodes.tosequence(start)) - else -- start is the ligature + return lignode + else + -- start is the ligature local deletemarks = markflag ~= "mark" local n = copy_node(start) local current @@ -342,8 +357,11 @@ local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- if snext then snext.prev = current end - start.prev, stop.next = nil, nil - current.char, current.subtype, current.components = char, ligature_code, start + start.prev = nil + stop.next = nil + current.char = char + current.subtype = ligature_code + current.components = start local head = current if deletemarks then if trace_marks then @@ -383,7 +401,6 @@ local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- end return head end - return start end function handlers.gsub_single(start,kind,lookupname,replacement) diff --git a/tex/context/base/luat-cod.mkiv b/tex/context/base/luat-cod.mkiv index fb659f2bb..6b1bc9267 100644 --- a/tex/context/base/luat-cod.mkiv +++ b/tex/context/base/luat-cod.mkiv @@ -45,12 +45,14 @@ % instead of \ctxwrite and \ctxprint, use \cldcontext -\def\ctxdirectlua{\directlua\zerocount} -\def\ctxlatelua {\latelua \zerocount} -\def\ctxsprint #1{\directlua\zerocount{tex.sprint(tex.ctxcatcodes,#1)}} % saves tokens -\def\ctxwrite #1{\directlua\zerocount{tex.write(#1)}} % saves tokens -\def\ctxcommand#1{\directlua\zerocount{commands.#1}} % saves tokens -\def\ctxreport #1{\directlua\zerocount{logs.writer[[#1]]}} +\def\ctxdirectlua {\directlua\zerocount} +\def\ctxlatelua {\latelua \zerocount} +\def\ctxsprint #1{\directlua\zerocount{tex.sprint(tex.ctxcatcodes,#1)}} % saves tokens +\def\ctxwrite #1{\directlua\zerocount{tex.write(#1)}} % saves tokens +\def\ctxcommand #1{\directlua\zerocount{commands.#1}} % saves tokens +\def\ctxdirectcommand#1{\directlua\zerocount{commands.#1}} % saves tokens +\def\ctxlatecommand #1{\latelua \zerocount{commands.#1}} % saves tokens +\def\ctxreport #1{\directlua\zerocount{logs.writer[[#1]]}} %D Take your choice \unknown diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index 54490b0a2..ccbe0b402 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -92,10 +92,10 @@ \let\mathgreeknormal\mathgreekupright \let\mathgreeknone \mathgreekdefault -\def\setmathattribute#1#2{\ifmmode\ctxlua{mathematics.syncboth ("#1","#2")}\fi} -\def\setmathalphabet #1{\ifmmode\ctxlua{mathematics.syncname ("#1")}\fi} -\def\setmathstyle #1{\ifmmode\ctxlua{mathematics.syncstyle("#1")}\fi} -\def\setmathalternate #1{\ifmmode\ctxlua{mathematics.setalternate(\number\defaultmathfamily,"#1")}\fi} +\def\setmathattribute#1#2{\ifmmode\ctxcommand{setmathattribute("#1","#2")}\fi} +\def\setmathalphabet #1{\ifmmode\ctxcommand{setmathalphabet("#1")}\fi} +\def\setmathstyle #1{\ifmmode\ctxcommand{setmathstyle("#1")}\fi} +\def\setmathalternate #1{\ifmmode\ctxcommand{setmathalternate(\number\defaultmathfamily,"#1")}\fi} \def\setmathstylealterternate#1% {\ifcsname\??mo:\c!alternative:\fontclass:#1\endcsname @@ -225,20 +225,6 @@ \def\utfmathcommand#1{\cldcontext{mathematics.utfmathcommand(\!!bs#1\!!es)}} \def\utfmathfiller #1{\cldcontext{mathematics.utfmathfiller (\!!bs#1\!!es)}} -% \def\utfmathclassdefault #1#2{\ctxlua{ -% cldcontext(mathematics.utfmathclass("#1","#2")) -% }} -% -% \def\utfmathcommanddefault#1#2#3{\ctxlua{ -% local cmd = mathematics.utfmathcommand("#1","") or "" -% if cmd == "" then -% commands.cs("#2","#3") -% else -% commands.cs(cmd) -% end}} - -% % % - \def\@@mathlimopcomm #1{\mathop{#1}} %no \limits \def\@@mathnolopcomm #1{\mathop{#1}\nolimits} \def\@@mathboxcomm #1{\dontleavehmode\hbox\Ustartmath\mathsurround\zeropoint#1\Ustopmath} @@ -660,8 +646,8 @@ \appendtoks \doifelse{\mathematicsparameter\c!compact}\v!yes - {\ctxlua{fonts.handlers.vf.math.optional=true}}% - {\ctxlua{fonts.handlers.vf.math.optional=false}}% + {\enabledirectives [math.virtual.optional]}% + {\disabledirectives[math.virtual.optional]}% \to \everysetupmathematics \setupmathematics diff --git a/tex/context/base/math-map.lua b/tex/context/base/math-map.lua index ec8b1ce8a..49bfa74e2 100644 --- a/tex/context/base/math-map.lua +++ b/tex/context/base/math-map.lua @@ -556,3 +556,9 @@ function mathematics.addfallbacks(main) checkedcopy(characters,regular.bi.ucgreek,regular.it.ucgreek) checkedcopy(characters,regular.bi.lcgreek,regular.it.lcgreek) end + +-- interface + +commands.setmathattribute = mathematics.syncboth +commands.setmathalphabet = mathematics.syncname +commands.setmathstyle = mathematics.syncstyle diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index e57f013ca..6aaeb902c 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -796,3 +796,7 @@ callbacks.register('mlist_to_hlist',processors.mlist_to_hlist,"preprocessing mat statistics.register("math processing time", function() return statistics.elapsedseconds(noads) end) + +-- interface + +commands.setmathalternate = mathematics.setalternate diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua index e78a6f895..e07ded43e 100644 --- a/tex/context/base/math-vfu.lua +++ b/tex/context/base/math-vfu.lua @@ -20,8 +20,10 @@ local format = string.format local fonts, nodes, mathematics = fonts, nodes, mathematics -local trace_virtual = false trackers.register("math.virtual", function(v) trace_virtual = v end) -local trace_timings = false trackers.register("math.timings", function(v) trace_timings = v end) +local trace_virtual = false trackers.register("math.virtual", function(v) trace_virtual = v end) +local trace_timings = false trackers.register("math.timings", function(v) trace_timings = v end) + +local add_optional = false directives.register("math.virtual.optional",function(v) add_optional = v end) local report_virtual = logs.reporter("fonts","virtual math") @@ -33,8 +35,6 @@ fonts.encodings.math = mathencodings -- better is then: fonts.encodings.vecto local vfmath = allocate() fonts.handlers.vf.math = vfmath -vfmath.optional = false - local shared = { } --~ local push, pop, back = { "push" }, { "pop" }, { "slot", 1, 0x2215 } @@ -403,7 +403,7 @@ function vfmath.define(specification,set,goodies) for s=1,#set do local ss = set[s] local ssname = ss.name - if ss.optional and vfmath.optional then + if add_optional and ss.optional then if trace_virtual then report_virtual("loading font %s subfont %s with name %s at %s is skipped",name,s,ssname,size) end @@ -529,7 +529,7 @@ function vfmath.define(specification,set,goodies) local ss, fs = okset[s], loaded[s] if not fs then -- skip, error - elseif ss.optional and vfmath.optional then + elseif add_optional and ss.optional then -- skip, redundant else local newparameters = fs.parameters diff --git a/tex/context/base/s-fnt-21.mkiv b/tex/context/base/s-fnt-21.mkiv index a48854679..3e1bf0ad3 100644 --- a/tex/context/base/s-fnt-21.mkiv +++ b/tex/context/base/s-fnt-21.mkiv @@ -1,4 +1,4 @@ -%D \module +D \module %D [ file=s-fnt-20, %D version=2009.01.10, %D title=\CONTEXT\ Style File, diff --git a/tex/context/base/s-fnt-25.mkiv b/tex/context/base/s-fnt-25.mkiv index a7a88ff14..ae19d2434 100644 --- a/tex/context/base/s-fnt-25.mkiv +++ b/tex/context/base/s-fnt-25.mkiv @@ -74,9 +74,19 @@ \def\mathfontlistentrysymbol#1#2% {mathsymbol: #1~\ruledhbox{\char#2}\par} +\def\startmathfontlookupvariants + {lookupvariants: } + +\def\stopmathfontlookupvariants + {\par} + +\def\mathfontlookupvariant#1#2% + {#1:~\char#2} + \startluacode local concat = table.concat local format, lower = string.format, string.lower +local utfchar = utf.char local fontdata = fonts.hashes.identifiers @@ -84,6 +94,9 @@ function document.showmathfont(id,slot) local data = characters.data local tfmdata = fontdata[id] local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local resources = tfmdata.resources + local lookuptypes = resources.lookuptypes local sorted = (slot and { slot }) or table.sortedkeys(characters) local virtual, names = tfmdata.properties.virtualized, { } if virtual then @@ -98,6 +111,7 @@ function document.showmathfont(id,slot) for _, s in next, sorted do if not limited or s < 0xF0000 then local char = characters[s] + local desc = descriptions[s] if char then local info = data[s] local cnext, cvert_variants, choriz_variants = char.next, char.vert_variants, char.horiz_variants @@ -175,6 +189,46 @@ function document.showmathfont(id,slot) context.mathfontlistentryvariantslist(concat(cvariants," ")) end end + local slookups = desc.slookups + local mlookups = desc.mlookups + if slookups or mlookups then + local variants = { } + if slookups then + for lookupname, lookupdata in next, slookups do + local lookuptype = lookuptypes[lookupname] + if lookuptype == "substitution" then + variants[lookupdata] = true + elseif lookuptype == "alternate" then + for i=1,#lookupdata do + variants[lookupdata[i]] = true + end + end + end + end + if mlookups then + for lookupname, lookuplist in next, mlookups do + local lookuptype = lookuptypes[lookupname] + for i=1,#lookuplist do + local lookupdata = lookuplist[i] + local lookuptype = lookuptypes[lookupname] + if lookuptype == "substitution" then + variants[lookupdata] = true + elseif lookuptype == "alternate" then + for i=1,#lookupdata do + variants[lookupdata[i]] = true + end + end + end + end + end + variants = table.sortedkeys(variants) + context.startmathfontlookupvariants() + for i=1,#variants do + local variant = variants[i] + context.mathfontlookupvariant(format("U+%05X",variant),variant) + end + context.stopmathfontlookupvariants() + end context.stopmathfontlistentry() end end @@ -182,17 +236,28 @@ function document.showmathfont(id,slot) end \stopluacode -\doifnotmode{demo}{\endinput} +\continueifinputfile{s-fnt-25.mkiv} % \doifnotmode{demo}\endinput + +\setuplayout + [width=middle, + height=middle, + topspace=15mm, + backspace=15mm, + bottomspace=15mm, + header=1cm, + headerdistance=0.5cm, + footer=0pt] \starttext - \setupbodyfont[cambria, 12pt] \showmathfontcharacters +% \setupbodyfont[cambria, 12pt] \showmathfontcharacters % \setupbodyfont[lmvirtual,12pt] \showmathfontcharacters % \setupbodyfont[pxvirtual,12pt] \showmathfontcharacters % \setupbodyfont[txvirtual,12pt] \showmathfontcharacters % \setupbodyfont[palatino, 10pt] \showmathfontcharacters % \setupbodyfont[mathtimes,12pt] \showmathfontcharacters % \setupbodyfont[stix, 12pt] \showmathfontcharacters -% \setupbodyfont[xits, 12pt] \showmathfontcharacters + \setupbodyfont[xits, 12pt] \showmathfontcharacters % \setupbodyfont[lucida, 12pt] \showmathfontcharacters +% \setupbodyfont[lucida-nova, 12pt] \showmathfontcharacters \stoptext diff --git a/tex/context/base/s-fnt-31.mkiv b/tex/context/base/s-fnt-31.mkiv index 88b5358c2..323d7c9a7 100644 --- a/tex/context/base/s-fnt-31.mkiv +++ b/tex/context/base/s-fnt-31.mkiv @@ -45,18 +45,25 @@ function fonts.tracers.coverage(fontfiles,pattern) -- todo: patterns names[i] = fontname end + local t = { } + context.starttabulate {"|Tr" .. string.rep("|l",#names) .. "|" } - for i=1,#names do + for i=1,#fontfiles do + local file = fontfiles[i] + t[#t+1] = i .. "=" .. file context.NC() context(i) context.NC() - -- context.getvalue(names[i]) - context.type(fontfiles[i]) + context.type(file) context.NC() context.NR() end context.stoptabulate() + context.setupfootertexts { + table.concat(t," ") + } + context.starttabulate {"|Tl" .. string.rep("|c",#names) .. "|Tl|" } context.NC() context.type("unicode") @@ -91,10 +98,13 @@ end \stopluacode -\doifnotmode{demo}{\endinput} +\continueifinputfile{s-fnt-31.mkiv} % \doifnotmode{demo}{\endinput} \setupbodyfont[10pt] +\setupfootertexts + [style=\ttx] + \setuplayout [backspace=1cm, topspace=1cm, @@ -150,15 +160,18 @@ end % } % \stopluacode -\loadfontgoodies[px-math] -\loadfontgoodies[lm-math] +% \loadfontgoodies[px-math] +% \loadfontgoodies[lm-math] \startluacode fonts.tracers.coverage { "cambria.ttc(Cambria Math)", "xits-math.otf", - "LMMath10-Regular@lmroman10-math", - "pxmath@px-math", + "lmmath-regular", + -- "LMMath10-Regular@lmroman10-math", + -- "pxmath@px-math", + "lucida-math.otf", + "lucida-math-demi.otf", -- "LinLibertine_Re-4.7.5.otf", } \stopluacode diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 656810cc2..8acece70b 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 552e2405f..640402f1d 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-itm.lua b/tex/context/base/strc-itm.lua index 1c7c2adb5..8a745f356 100644 --- a/tex/context/base/strc-itm.lua +++ b/tex/context/base/strc-itm.lua @@ -10,14 +10,29 @@ local structures = structures local itemgroups = structures.itemgroups local jobpasses = job.passes +local setfield = jobpasses.save +local getfield = jobpasses.getfield + function itemgroups.register(name,nofitems,maxwidth) - jobpasses.savedata("itemgroup", { nofitems, maxwidth }) + setfield("itemgroup", { nofitems, maxwidth }) end function itemgroups.nofitems(name,index) - jobpasses.getfield("itemgroup", index, 1, 0) + return getfield("itemgroup", index, 1, 0) end function itemgroups.maxwidth(name,index) - jobpasses.getfield("itemgroup", index, 2, 0) + return getfield("itemgroup", index, 2, 0) +end + +-- interface (might become counter/dimension) + +commands.registeritemgroup = itemgroups.register + +function commands.nofitems(name,index) + context(getfield("itemgroup", index, 1, 0)) +end + +function commands.maxitemwidth(name,index) + context(getfield("itemgroup", index, 2, 0)) end diff --git a/tex/context/base/strc-itm.mkiv b/tex/context/base/strc-itm.mkiv index c8044fbc2..1f582a6b4 100644 --- a/tex/context/base/strc-itm.mkiv +++ b/tex/context/base/strc-itm.mkiv @@ -62,12 +62,12 @@ \def\dolistreference {\iftrialtypesetting \else % no need for different treatment of \continuelistitems - \ctxlua{structures.itemgroups.register("\currentitemgroup",\number\noflistelements,"\getitemparameter\currentitemlevel\c!maxwidth")}% + \ctxcommand{registeritemgroup("\currentitemgroup",\number\noflistelements,"\getitemparameter\currentitemlevel\c!maxwidth")}% \fi} -\def\checkcurrentnofitems % we could do this at the lua end and save a call - {\edef\currentnofitems {\ctxlua{structures.itemgroups.nofitems("\currentitemgroup",\number\currentnoflists)}}% - \edef\currentitemmaxwidth{\ctxlua{structures.itemgroups.maxwidth("\currentitemgroup",\number\currentnoflists)}\scaledpoint}} +\def\checkcurrentnofitems % we could do this at the lua end and save a call (i.e. will be dimen and counter) + {\edef\currentnofitems {\ctxcommand{nofitems("\currentitemgroup",\number\currentnoflists)}}% + \edef\currentitemmaxwidth{\ctxcommand{maxitemwidth("\currentitemgroup",\number\currentnoflists)}\scaledpoint}} % todo: \dodosetreference -> \dostructurecountercomponent (to be checked) diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 679db7d2f..0bb0eb961 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 07/13/11 20:14:04 +-- merge date : 07/14/11 12:19:31 do -- begin closure to overcome local limits and interference @@ -7264,7 +7264,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis substitution = function(lookupdata,lookupname,description,unicode) if trace_baseinit and trace_singles then report_prepare("%s: base substitution %s => %s",cref(feature,lookupname), - gref(descriptions,unicode),gref(descriptions,replacement)) + gref(descriptions,unicode),gref(descriptions,lookupdatat)) end changed[unicode] = lookupdata end, @@ -8249,6 +8249,7 @@ local copy_node = node.copy local find_node_tail = node.tail or node.slide local set_attribute = node.set_attribute local has_attribute = node.has_attribute +local flush_node_list = node.flush_list local setmetatableindex = table.setmetatableindex @@ -8402,21 +8403,35 @@ end local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- brr head if start == stop then start.char = char + return start elseif discfound then -- print("start->stop",nodes.tosequence(start,stop)) + local components = start.components + if components then + flush_node_list(components) + start.components = nil + end local lignode = copy_node(start) - lignode.font, lignode.char, lignode.subtype = start.font, char, ligature_code - local next, prev = stop.next, start.prev + lignode.font = start.font + lignode.char = char + lignode.subtype = ligature_code + local next = stop.next + local prev = start.prev stop.next = nil - lignode = node.do_ligature_n(start, stop, lignode) + start.prev = nil + lignode.components = start + -- print("lignode",nodes.tosequence(lignode)) + -- print("components",nodes.tosequence(lignode.components)) prev.next = lignode if next then next.prev = lignode end - lignode.next, lignode.prev = next, prev - start = lignode + lignode.next = next + lignode.prev = prev -- print("start->end",nodes.tosequence(start)) - else -- start is the ligature + return lignode + else + -- start is the ligature local deletemarks = markflag ~= "mark" local n = copy_node(start) local current @@ -8426,8 +8441,11 @@ local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- if snext then snext.prev = current end - start.prev, stop.next = nil, nil - current.char, current.subtype, current.components = char, ligature_code, start + start.prev = nil + stop.next = nil + current.char = char + current.subtype = ligature_code + current.components = start local head = current if deletemarks then if trace_marks then @@ -8467,7 +8485,6 @@ local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- end return head end - return start end function handlers.gsub_single(start,kind,lookupname,replacement) -- cgit v1.2.3