From d27b4b74c1a3aac8857364f8ab5854c5204ae411 Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 17 Sep 2013 16:00:26 +0300 Subject: beta 2013.09.17 14:39 --- scripts/context/lua/mtxrun.lua | 30 +- scripts/context/stubs/mswin/mtxrun.lua | 30 +- scripts/context/stubs/unix/mtxrun | 30 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4115 -> 4113 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/font-ext.lua | 2 + tex/context/base/font-pre.mkiv | 1 + tex/context/base/font-sym.mkvi | 4 + tex/context/base/font-syn.lua | 1 + tex/context/base/l-package.lua | 24 +- tex/context/base/math-fbk.lua | 59 +++- tex/context/base/math-ini.mkiv | 7 +- tex/context/base/math-noa.lua | 124 +++++--- tex/context/base/mult-def.mkiv | 1 + tex/context/base/s-abr-01.tex | 2 + tex/context/base/s-abr-04.tex | 324 --------------------- tex/context/base/status-files.pdf | Bin 24762 -> 24711 bytes tex/context/base/status-lua.log | 2 +- tex/context/base/typo-cap.lua | 207 +++++++------ tex/context/base/typo-cap.mkiv | 117 +++++--- tex/context/base/util-env.lua | 1 + tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 23 files changed, 461 insertions(+), 511 deletions(-) delete mode 100644 tex/context/base/s-abr-04.tex diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 08f69d695..c3c0e976b 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -144,7 +144,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-package"] = package.loaded["l-package"] or true --- original size: 9893, stripped down to: 7253 +-- original size: 10594, stripped down to: 7819 if not modules then modules={} end modules ['l-package']={ version=1.001, @@ -154,7 +154,7 @@ if not modules then modules={} end modules ['l-package']={ license="see context related readme files" } local type=type -local gsub,format=string.gsub,string.format +local gsub,format,find=string.gsub,string.format,string.find local P,S,Cs,lpegmatch=lpeg.P,lpeg.S,lpeg.Cs,lpeg.match local package=package local searchers=package.searchers or package.loaders @@ -184,6 +184,7 @@ local helpers=package.helpers or { sequence={ "already loaded", "preload table", + "qualified path", "lua extra list", "lib extra list", "path specification", @@ -329,12 +330,30 @@ local function loadedbypath(name,rawname,paths,islib,what) end end helpers.loadedbypath=loadedbypath +local function loadedbyname(name,rawname) + if find(name,"^/") or find(name,"^[a-zA-Z]:/") then + local trace=helpers.trace + if trace then + helpers.report("qualified name, identifying '%s'",what,name) + end + if isreadable(name) then + if trace then + helpers.report("qualified name, '%s' found",what,name) + end + return loadfile(name) + end + end +end +helpers.loadedbyname=loadedbyname methods["already loaded"]=function(name) return package.loaded[name] end methods["preload table"]=function(name) return builtin["preload table"](name) end +methods["qualified path"]=function(name) + return loadedbyname(addsuffix(lualibfile(name),"lua"),name) +end methods["lua extra list"]=function(name) return loadedbypath(addsuffix(lualibfile(name),"lua" ),name,getextraluapaths(),false,"lua") end @@ -8305,7 +8324,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-env"] = package.loaded["util-env"] or true --- original size: 8722, stripped down to: 5050 +-- original size: 8761, stripped down to: 5085 if not modules then modules={} end modules ['util-env']={ version=1.001, @@ -8341,6 +8360,7 @@ local luaengines=allocate { environment.validengines=validengines environment.basicengines=basicengines if not arg then + environment.used_as_library=true elseif luaengines[file.removesuffix(arg[-1])] then elseif validengines[file.removesuffix(arg[0])] then if arg[1]=="--luaonly" then @@ -16449,8 +16469,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 675096 --- stripped bytes : 238858 +-- original bytes : 675836 +-- stripped bytes : 238997 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 08f69d695..c3c0e976b 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -144,7 +144,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-package"] = package.loaded["l-package"] or true --- original size: 9893, stripped down to: 7253 +-- original size: 10594, stripped down to: 7819 if not modules then modules={} end modules ['l-package']={ version=1.001, @@ -154,7 +154,7 @@ if not modules then modules={} end modules ['l-package']={ license="see context related readme files" } local type=type -local gsub,format=string.gsub,string.format +local gsub,format,find=string.gsub,string.format,string.find local P,S,Cs,lpegmatch=lpeg.P,lpeg.S,lpeg.Cs,lpeg.match local package=package local searchers=package.searchers or package.loaders @@ -184,6 +184,7 @@ local helpers=package.helpers or { sequence={ "already loaded", "preload table", + "qualified path", "lua extra list", "lib extra list", "path specification", @@ -329,12 +330,30 @@ local function loadedbypath(name,rawname,paths,islib,what) end end helpers.loadedbypath=loadedbypath +local function loadedbyname(name,rawname) + if find(name,"^/") or find(name,"^[a-zA-Z]:/") then + local trace=helpers.trace + if trace then + helpers.report("qualified name, identifying '%s'",what,name) + end + if isreadable(name) then + if trace then + helpers.report("qualified name, '%s' found",what,name) + end + return loadfile(name) + end + end +end +helpers.loadedbyname=loadedbyname methods["already loaded"]=function(name) return package.loaded[name] end methods["preload table"]=function(name) return builtin["preload table"](name) end +methods["qualified path"]=function(name) + return loadedbyname(addsuffix(lualibfile(name),"lua"),name) +end methods["lua extra list"]=function(name) return loadedbypath(addsuffix(lualibfile(name),"lua" ),name,getextraluapaths(),false,"lua") end @@ -8305,7 +8324,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-env"] = package.loaded["util-env"] or true --- original size: 8722, stripped down to: 5050 +-- original size: 8761, stripped down to: 5085 if not modules then modules={} end modules ['util-env']={ version=1.001, @@ -8341,6 +8360,7 @@ local luaengines=allocate { environment.validengines=validengines environment.basicengines=basicengines if not arg then + environment.used_as_library=true elseif luaengines[file.removesuffix(arg[-1])] then elseif validengines[file.removesuffix(arg[0])] then if arg[1]=="--luaonly" then @@ -16449,8 +16469,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 675096 --- stripped bytes : 238858 +-- original bytes : 675836 +-- stripped bytes : 238997 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 08f69d695..c3c0e976b 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -144,7 +144,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-package"] = package.loaded["l-package"] or true --- original size: 9893, stripped down to: 7253 +-- original size: 10594, stripped down to: 7819 if not modules then modules={} end modules ['l-package']={ version=1.001, @@ -154,7 +154,7 @@ if not modules then modules={} end modules ['l-package']={ license="see context related readme files" } local type=type -local gsub,format=string.gsub,string.format +local gsub,format,find=string.gsub,string.format,string.find local P,S,Cs,lpegmatch=lpeg.P,lpeg.S,lpeg.Cs,lpeg.match local package=package local searchers=package.searchers or package.loaders @@ -184,6 +184,7 @@ local helpers=package.helpers or { sequence={ "already loaded", "preload table", + "qualified path", "lua extra list", "lib extra list", "path specification", @@ -329,12 +330,30 @@ local function loadedbypath(name,rawname,paths,islib,what) end end helpers.loadedbypath=loadedbypath +local function loadedbyname(name,rawname) + if find(name,"^/") or find(name,"^[a-zA-Z]:/") then + local trace=helpers.trace + if trace then + helpers.report("qualified name, identifying '%s'",what,name) + end + if isreadable(name) then + if trace then + helpers.report("qualified name, '%s' found",what,name) + end + return loadfile(name) + end + end +end +helpers.loadedbyname=loadedbyname methods["already loaded"]=function(name) return package.loaded[name] end methods["preload table"]=function(name) return builtin["preload table"](name) end +methods["qualified path"]=function(name) + return loadedbyname(addsuffix(lualibfile(name),"lua"),name) +end methods["lua extra list"]=function(name) return loadedbypath(addsuffix(lualibfile(name),"lua" ),name,getextraluapaths(),false,"lua") end @@ -8305,7 +8324,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-env"] = package.loaded["util-env"] or true --- original size: 8722, stripped down to: 5050 +-- original size: 8761, stripped down to: 5085 if not modules then modules={} end modules ['util-env']={ version=1.001, @@ -8341,6 +8360,7 @@ local luaengines=allocate { environment.validengines=validengines environment.basicengines=basicengines if not arg then + environment.used_as_library=true elseif luaengines[file.removesuffix(arg[-1])] then elseif validengines[file.removesuffix(arg[0])] then if arg[1]=="--luaonly" then @@ -16449,8 +16469,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 675096 --- stripped bytes : 238858 +-- original bytes : 675836 +-- stripped bytes : 238997 -- end library merge diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index f2d638b7c..fa34f5791 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{2013.09.14 14:39} +\newcontextversion{2013.09.17 14:39} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 24d7d0328..44005a184 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 4955d4b11..68dc5e261 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.09.14 14:39} +\edef\contextversion{2013.09.17 14:39} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-ext.lua b/tex/context/base/font-ext.lua index 3d78b0a3c..ede2151d6 100644 --- a/tex/context/base/font-ext.lua +++ b/tex/context/base/font-ext.lua @@ -728,6 +728,8 @@ registerotffeature { -- local gray = { "special", "pdf: /Tr1 gs .75 g" } -- local black = { "special", "pdf: /Tr0 gs 0 g" } +-- sort of obsolete as we now have \showglyphs + local push = { "push" } local pop = { "pop" } local gray = { "special", "pdf: .75 g" } diff --git a/tex/context/base/font-pre.mkiv b/tex/context/base/font-pre.mkiv index 659c4840e..e58a3d1f5 100644 --- a/tex/context/base/font-pre.mkiv +++ b/tex/context/base/font-pre.mkiv @@ -523,6 +523,7 @@ \definealternativestyle [\v!Words] [{\setcharactercasing[\v!Words ]}] [{\setcharactercasing[\v!Words ]}] \definealternativestyle [\v!capital] [{\setcharactercasing[\v!capital]}] [{\setcharactercasing[\v!capital]}] \definealternativestyle [\v!Capital] [{\setcharactercasing[\v!Capital]}] [{\setcharactercasing[\v!Capital]}] +\definealternativestyle [\v!mixed] [{\setcharactercasing[\v!mixed ]}] [{\setcharactercasing[\v!mixed ]}] \definealternativestyle [\v!cap] [{\setcharactercasing[\v!cap ]}] [{\setcharactercasing[\v!cap ]}] \definealternativestyle [\v!Cap] [{\setcharactercasing[\v!Cap ]}] [{\setcharactercasing[\v!Cap ]}] diff --git a/tex/context/base/font-sym.mkvi b/tex/context/base/font-sym.mkvi index e1d5332c4..c8ca49f74 100644 --- a/tex/context/base/font-sym.mkvi +++ b/tex/context/base/font-sym.mkvi @@ -52,6 +52,10 @@ \let\v_font_string_d\s!Serif % default fontstyle (will be redefined in type-ini) +\definefontsynonym + [CurrentFont] + [\noexpand\v_font_string_a\noexpand\v_font_string_c] + % potential generalization: % % \letvalue{\??fontfile:t:\s!rm}\s!Serif diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua index f676b5952..55c767745 100644 --- a/tex/context/base/font-syn.lua +++ b/tex/context/base/font-syn.lua @@ -271,6 +271,7 @@ function fontloader.fullinfo(...) -- check with taco what we get / could get end filters.otf = fontloader.fullinfo +filters.ttf = fontloader.fullinfo function filters.afm(name) -- we could parse the afm file as well, and then report an error but diff --git a/tex/context/base/l-package.lua b/tex/context/base/l-package.lua index 579fd3941..0dbff7c57 100644 --- a/tex/context/base/l-package.lua +++ b/tex/context/base/l-package.lua @@ -17,7 +17,7 @@ if not modules then modules = { } end modules ['l-package'] = { -- -- local mysql = require("luasql.mysql") local type = type -local gsub, format = string.gsub, string.format +local gsub, format, find = string.gsub, string.format, string.find local P, S, Cs, lpegmatch = lpeg.P, lpeg.S, lpeg.Cs, lpeg.match @@ -68,6 +68,7 @@ local helpers = package.helpers or { sequence = { "already loaded", "preload table", + "qualified path", -- beware, lua itself doesn't handle qualified paths (prepends ./) "lua extra list", "lib extra list", "path specification", @@ -243,6 +244,23 @@ end helpers.loadedbypath = loadedbypath +local function loadedbyname(name,rawname) + if find(name,"^/") or find(name,"^[a-zA-Z]:/") then + local trace=helpers.trace + if trace then + helpers.report("qualified name, identifying '%s'",what,name) + end + if isreadable(name) then + if trace then + helpers.report("qualified name, '%s' found",what,name) + end + return loadfile(name) + end + end +end + +helpers.loadedbyname = loadedbyname + methods["already loaded"] = function(name) return package.loaded[name] end @@ -251,6 +269,10 @@ methods["preload table"] = function(name) return builtin["preload table"](name) end +methods["qualified path"]=function(name) + return loadedbyname(addsuffix(lualibfile(name),"lua"),name) +end + methods["lua extra list"] = function(name) return loadedbypath(addsuffix(lualibfile(name),"lua" ),name,getextraluapaths(),false,"lua") end diff --git a/tex/context/base/math-fbk.lua b/tex/context/base/math-fbk.lua index 68cab22d3..ce31a9982 100644 --- a/tex/context/base/math-fbk.lua +++ b/tex/context/base/math-fbk.lua @@ -28,6 +28,11 @@ local lastmathids = fonts.hashes.lastmathids -- -- todo: use index 'true when luatex provides that feature (on the agenda) +-- to be considered: +-- +-- in luatex provide reserve_id (and pass id as field of tfmdata) +-- in context define three sizes but pass them later i.e. do virtualize afterwards + function fallbacks.apply(target,original) local mathparameters = target.mathparameters -- why not hasmath if mathparameters then @@ -70,7 +75,8 @@ function fallbacks.apply(target,original) if textid then textindex = #usedfonts + 1 usedfonts[textindex] = { id = textid } - textdata = identifiers[textid] +-- textdata = identifiers[textid] or target + textdata = target else textdata = target end @@ -98,6 +104,9 @@ function fallbacks.apply(target,original) textindex = textindex, scriptindex = scriptindex, scriptscriptindex = scriptscriptindex, + textid = textid, + scriptid = scriptid, + scriptscriptid = scriptscriptid, characters = characters, unicode = k, target = target, @@ -105,16 +114,23 @@ function fallbacks.apply(target,original) size = size, mathsize = mathsize, } + target.mathrelation = data -- inspect(usedfonts) for k, v in next, virtualcharacters do if not characters[k] then local tv = type(v) + local cd = nil if tv == "table" then - characters[k] = v + cd = v elseif tv == "number" then - characters[k] = characters[v] + cd = characters[v] elseif tv == "function" then - characters[k] = v(data) + cd = v(data) + end + if cd then + characters[k] = cd + else + -- something else end if trace_fallbacks then if characters[k] then @@ -123,6 +139,7 @@ function fallbacks.apply(target,original) end end end + data.unicode = nil end end @@ -446,3 +463,37 @@ end virtualcharacters[0xFE302] = function(data) return smashed(data,0x0302,0xFE302) end virtualcharacters[0xFE303] = function(data) return smashed(data,0x0303,0xFE303) end + +-- another crazy hack .. doesn't work as we define scrscr first .. we now have smaller +-- primes so we have smaller primes for the moment, big ones will become an option + +local function smashed(data,unicode) + local oldchar = data.characters[unicode] + local height = 1.2 * data.target.parameters.xheight + local newchar = { + commands = { + { "down", oldchar.height - height }, + { "char", unicode }, + }, + height = height, + width = oldchar.width, + } + return newchar +end + +addextra(0xFE932, { description="SMASHED PRIME 0x02032", unicodeslot=0xFE932 } ) +addextra(0xFE933, { description="SMASHED PRIME 0x02033", unicodeslot=0xFE933 } ) +addextra(0xFE934, { description="SMASHED PRIME 0x02034", unicodeslot=0xFE934 } ) +addextra(0xFE935, { description="SMASHED PRIME 0x02035", unicodeslot=0xFE935 } ) +addextra(0xFE936, { description="SMASHED PRIME 0x02036", unicodeslot=0xFE936 } ) +addextra(0xFE937, { description="SMASHED PRIME 0x02037", unicodeslot=0xFE937 } ) +addextra(0xFE957, { description="SMASHED PRIME 0x02057", unicodeslot=0xFE957 } ) + +virtualcharacters[0xFE932] = function(data) return smashed(data,0x02032) end +virtualcharacters[0xFE933] = function(data) return smashed(data,0x02033) end +virtualcharacters[0xFE934] = function(data) return smashed(data,0x02034) end +virtualcharacters[0xFE935] = function(data) return smashed(data,0x02035) end +virtualcharacters[0xFE936] = function(data) return smashed(data,0x02036) end +virtualcharacters[0xFE937] = function(data) return smashed(data,0x02037) end +virtualcharacters[0xFE957] = function(data) return smashed(data,0x02057) end + diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index ead95e630..bbec7d77d 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -553,13 +553,13 @@ \def\activatemathcharacters {\the\activatedmathcharacters} -% \setnewconstant\primeasciicode 39 % ' +% beware, not runtime, so has to happen at format generation \activatemathcharacter\circumflexasciicode \activatemathcharacter\underscoreasciicode \activatemathcharacter\ampersandasciicode -%activatemathcharacter\primeasciicode +% \activatemathcharacter\primeasciicode % not used: % @@ -1077,6 +1077,9 @@ % \global\mathcode\c_math_period\c_math_special % \to \everyjob +% \activatemathcharacter\c_math_comma +% \activatemathcharacter\c_math_period + \appendtoks \mathcode\c_math_comma \c_math_special \mathcode\c_math_period\c_math_special diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index 87c6ca8b5..cd0115c47 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -60,6 +60,7 @@ local insert_node_after = node.insert_after local insert_node_before = node.insert_before local free_node = node.free local new_node = node.new -- todo: pool: math_noad math_sub +local copy_node = node.copy local new_kern = nodes.pool.kern local new_rule = nodes.pool.rule @@ -150,6 +151,10 @@ local function process(start,what,n,parent) elseif id == math_char or id == math_textchar or id == math_delim then break elseif id == math_noad then +if prev then + -- we have no proper prev in math nodes yet + start.prev = prev +end local noad = start.nucleus if noad then process(noad,what,n,start) end -- list noad = start.sup if noad then process(noad,what,n,start) end -- list noad = start.sub if noad then process(noad,what,n,start) end -- list @@ -185,6 +190,7 @@ local function process(start,what,n,parent) else -- glue, penalty, etc end +prev = start start = start.next end end @@ -497,13 +503,30 @@ local collapse = { } processors.collapse = collapse local mathpairs = characters.mathpairs -mathpairs[0x2032] = { [0x2032] = 0x2033, [0x2033] = 0x2034 } -- (prime,prime) (prime,doubleprime) -mathpairs[0x2033] = { [0x2032] = 0x2034 } -- (doubleprime,prime) +mathpairs[0x2032] = { [0x2032] = 0x2033, [0x2033] = 0x2034, [0x2034] = 0x2057 } -- (prime,prime) (prime,doubleprime) (prime,tripleprime) +mathpairs[0x2033] = { [0x2032] = 0x2034, [0x2033] = 0x2057 } -- (doubleprime,prime) (doubleprime,doubleprime) +mathpairs[0x2034] = { [0x2032] = 0x2057 } -- (tripleprime,prime) + +mathpairs[0x2035] = { [0x2035] = 0x2036, [0x2036] = 0x2037 } -- (reversedprime,reversedprime) (reversedprime,doublereversedprime) +mathpairs[0x2036] = { [0x2035] = 0x2037 } -- (doublereversedprime,reversedprime) mathpairs[0x222B] = { [0x222B] = 0x222C, [0x222C] = 0x222D } mathpairs[0x222C] = { [0x222B] = 0x222D } -mathpairs[0x007C] = { [0x007C] = 0x2016 } -- double bars +mathpairs[0x007C] = { [0x007C] = 0x2016, [0x2016] = 0x2980 } -- bar+bar=double bar+double=triple +mathpairs[0x2016] = { [0x007C] = 0x2980 } -- double+bar=triple + +local movesub = { + -- primes + [0x2032] = 0xFE932, + [0x2033] = 0xFE933, + [0x2034] = 0xFE934, + [0x2057] = 0xFE957, + -- reverse primes + [0x2035] = 0xFE935, + [0x2036] = 0xFE936, + [0x2037] = 0xFE937, +} local validpair = { [noad_rel] = true, @@ -513,48 +536,79 @@ local validpair = { [noad_opnolimits] = true, } -local function collapsepair(pointer,what,n,parent) -- todo: switch to turn in on and off +local function movesubscript(parent,current_nucleus,current_char) + local prev = parent.prev + if prev and prev.id == math_noad then + if not prev.sup and not prev.sub then + current_nucleus.char = movesub[current_char or current_nucleus.char] + -- {f} {'}_n => f_n^' + local nucleus = parent.nucleus + local sub = parent.sub + local sup = parent.sup + prev.sup = nucleus + prev.sub = sub + local dummy = copy_node(nucleus) + dummy.char = 0 + parent.nucleus = dummy + parent.sub = nil + if trace_collapsing then + report_collapsing("fixing subscript") + end + end + end +end + +local function collapsepair(pointer,what,n,parent,nested) -- todo: switch to turn in on and off if parent then if validpair[parent.subtype] then local current_nucleus = parent.nucleus - if not parent.sub and not parent.sup and current_nucleus.id == math_char then + if current_nucleus.id == math_char then local current_char = current_nucleus.char - local mathpair = mathpairs[current_char] - if mathpair then - local next_noad = parent.next - if next_noad and next_noad.id == math_noad then - if validpair[next_noad.subtype] then - local next_nucleus = next_noad.nucleus - if next_nucleus.id == math_char then - local next_char = next_nucleus.char - local newchar = mathpair[next_char] - if newchar then - local fam = current_nucleus.fam - local id = font_of_family(fam) - local characters = fontcharacters[id] - if characters and characters[newchar] then - if trace_collapsing then - report_collapsing("%U + %U => %U",current_char,next_char,newchar) - end - current_nucleus.char = newchar - local next_next_noad = next_noad.next - if next_next_noad then - parent.next = next_next_noad - next_next_noad.prev = parent - else - parent.next = nil + if not parent.sub and not parent.sup then + local mathpair = mathpairs[current_char] + if mathpair then + local next_noad = parent.next + if next_noad and next_noad.id == math_noad then + if validpair[next_noad.subtype] then + local next_nucleus = next_noad.nucleus + if next_nucleus.id == math_char then + local next_char = next_nucleus.char + local newchar = mathpair[next_char] + if newchar then + local fam = current_nucleus.fam + local id = font_of_family(fam) + local characters = fontcharacters[id] + if characters and characters[newchar] then + if trace_collapsing then + report_collapsing("%U + %U => %U",current_char,next_char,newchar) + end + current_nucleus.char = newchar + local next_next_noad = next_noad.next + if next_next_noad then + parent.next = next_next_noad + next_next_noad.prev = parent + else + parent.next = nil + end + parent.sup = next_noad.sup + parent.sub = next_noad.sub + next_noad.sup = nil + next_noad.sub = nil + free_node(next_noad) + collapsepair(pointer,what,n,parent,true) + if not nested and movesub[current_char] then + movesubscript(parent,current_nucleus) + end end - parent.sup = next_noad.sup - parent.sub = next_noad.sub - next_noad.sup = nil - next_noad.sub = nil - free_node(next_noad) - collapsepair(pointer,what,n,parent) end end end end + elseif not nested and movesub[current_char] then + movesubscript(parent,current_nucleus,current_char) end + elseif not nested and movesub[current_char] then + movesubscript(parent,current_nucleus,current_char) end end end diff --git a/tex/context/base/mult-def.mkiv b/tex/context/base/mult-def.mkiv index 21ed8cb87..fc17ee475 100644 --- a/tex/context/base/mult-def.mkiv +++ b/tex/context/base/mult-def.mkiv @@ -74,6 +74,7 @@ \def\v!words {words} \def\v!combination {combination} \def\v!norepeat {norepeat} +\def\v!mixed {mixed} \def\s!lcgreek {lcgreek} \def\s!ucgreek {ucgreek} diff --git a/tex/context/base/s-abr-01.tex b/tex/context/base/s-abr-01.tex index 026f2ea09..7d8064b29 100644 --- a/tex/context/base/s-abr-01.tex +++ b/tex/context/base/s-abr-01.tex @@ -232,6 +232,7 @@ \logo [SQL] {sql} \logo [SSD] {ssd} \logo [SVG] {svg} +\logo [STIX] {Stix} \logo [SWIG] {swig} \logo [SWIGLIB] {SwigLib} \logo [TABLE] {\TaBlE} @@ -299,6 +300,7 @@ \logo [XFDF] {xfdf} \logo [XHTML] {xhtml} \logo [XINDY] {Xindy} +\logo [XITS] {Xits} \logo [XML] {xml} \logo [XPATH] {xpath} \logo [XMLTOOLS] {xmltools} diff --git a/tex/context/base/s-abr-04.tex b/tex/context/base/s-abr-04.tex deleted file mode 100644 index dcd93c6f1..000000000 --- a/tex/context/base/s-abr-04.tex +++ /dev/null @@ -1,324 +0,0 @@ -%D \module -%D [ file=s-abr-01, -%D version=1996.01.01, -%D title=\CONTEXT\ Style File, -%D subtitle=General Abbreviations 1, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\unprotect - -% \setupsorting[logo][\c!style=\v!capital] - -% \setupcapitals[\c!title=\v!no] - -\protect - -\logo [MKI] {MkI} -\logo [MKII] {MkII} -\logo [MKIII] {MkIII} -\logo [MKIV] {MkIV} - -%logo [FGA] {fga} -%logo [FGBBS] {fgbbs} -\logo [ACROBAT] {Acro\-bat} -\logo [AFM] {afm} -\logo [API] {api} -\logo [ALEPH] {Aleph} % {\mathematics{\aleph}} -\logo [ALGOL] {ALGOL} -\logo [AMS] {ams} -\logo [AMSLATEX] {AmS\LATEX} -\logo [AMSTEX] {AmS\TeX} -\logo [ANSI] {ansi} -\logo [ARABTEX] {Arab\TeX} -\logo [ASCII] {ascii} -\logo [ASCIITEX] {ascii\TeX} -\logo [BACHOTEX] {Bacho\TeX} -\logo [BIBTEX] {bib\TeX} -\logo [BLUESKY] {BlueSky} -\logo [BMP] {bmp} -\logo [BSD] {bsd} -\logo [CCODE] {c} -\logo [CALCMATH] {CalcMath} -\logo [CD] {cd} -\logo [CLD] {cld} -\logo [CPU] {cpu} -\logo [CDROM] {cdrom} -\logo [CID] {cid} -\logo [CJK] {cjk} -\logo [CMR] {cmr} -\logo [CMYK] {cmyk} -\logo [CODHOST] {CodHost} -\logo [CONTEXT] {Con{\TeX}t} -\logo [CSS] {css} -\logo [CTAN] {ctan} -\logo [CTXTOOLS] {ctxtools} -\logo [CWEB] {cweb} -\logo [DANTE] {Dante} -\logo [DISTILLER] {distiller} -\logo [DRATEX] {Dra\TeX} -\logo [DSC] {dsc} -\logo [DTD] {dtd} -\logo [DTK] {dtk} -\logo [DTP] {dtp} -\logo [DVD] {dvd} -\logo [DVI] {dvi} -\logo [DVIPDFM] {dvipdfm} -\logo [DVIPDFMX] {dvipdfmx} -\logo [DVIPOS] {dvipos} -\logo [DVIPS] {dvips} -\logo [DVIPSONE] {dvipsone} -\logo [DVISCR] {dviscr} -\logo [DVIWINDO] {dviwindo} -\logo [EC] {ec} -\logo [EIFFEL] {Eiffel} -\logo [EMACS] {emacs} -\logo [EMTEX] {em\TeX} -\logo [ENCODING] {enc} -\logo [ENCTEX] {enc\TeX} -\logo [EPS] {eps} -\logo [ETEX] {\eTeX} -\logo [EUROBACHOTEX] {EuroBacho\TeX} -\logo [EUROMATH] {EuroMath} -\logo [EUROTEX] {Euro\TeX} -\logo [EXAMPLE] {eXaMpLe} -\logo [EXAMPLED] {exampled} -\logo [EXAMPLEQ] {exampleq} -\logo [EXAMPLER] {exampler} -\logo [EXAMPLET] {examplet} -\logo [EXAMPLEX] {examplex} -\logo [EXIMPLE] {eXiMpLe} -\logo [FAQ] {faq} -\logo [FDF] {fdf} -\logo [FONTFORGE] {FontForge} -\logo [FOXET] {foXet} -\logo [FPTEX] {fp\TeX} -\logo [FREEBSD] {FreeBSD} -\logo [FTP] {ftp} -\logo [GHOSTSCRIPT]{Ghost\-script} -\logo [GHOSTVIEW] {Ghost\-view} -\logo [GIF] {gif} -\logo [GNU] {gnu} -\logo [GNUPLOT] {gnuplot} -\logo [GS] {Ghost\-Script} -\logo [GUST] {Gust} -\logo [GWTEX] {gw\TeX} -\logo [HSB] {hsb} -\logo [HTML] {html} -\logo [HTTP] {http} -\logo [HZ] {hz} -\logo [IBM] {ibm} -\logo [IMAGEMAGICK]{ImageMagick} -\logo [INITEX] {ini\TeX} -\logo [INRSTEX] {inrs\TeX} -\logo [IO] {io} -\logo [IRCNET] {IRCnet} -\logo [ISO] {iso} -\logo [JAVA] {Java} -\logo [JAVASCRIPT] {Java\-Script} -\logo [JPEG] {jpeg} -\logo [JPG] {jpg} -\logo [JBIG] {jbig} -\logo [KPATHSEA] {kpathsea} -\logo [KPSE] {kpse} -\logo [KPSEWHICH] {kpsewhich} -\logo [MKTEXLSR] {mktexlsr} -\logo [LAMSTEX] {LamS\TeX} -\logo [LATEX] {La\TeX} -\logo [LATEXTE] {La\TeX2e} -\logo [LATEXTN] {La\TeX2.09} -\logo [LINUX] {linux} -\logo [LISP] {Lisp} -\logo [LPEG] {lpeg} -\logo [LUA] {Lua} -\logo [LUAJIT] {LuaJIT} -\logo [LUATEX] {Lua\TeX} -\logo [LUAJITTEX] {Luajit\TeX} -\logo [LUATOOLS] {luatools} -\logo [MACOSX] {MacOSX} -\logo [MACROTEX] {Macro\TeX} -\logo [MAKEMPY] {MakeMPY} -\logo [MAPPING] {map} -\logo [MAPS] {Maps} -\logo [MATHML] {MathML} -\logo [METAFONT] {MetaFont} -\logo [METAPOST] {MetaPost} -\logo [METATEX] {Meta\TeX} -\logo [MIKTEX] {Mik\TeX} -\logo [MLTEX] {ml\TeX} -\logo [METATYPE] {MetaType1} -\logo [MODULA] {Modula} -\logo [MOV] {mov} -\logo [MPS] {mps} -\logo [MPTOPDF] {mptopdf} -\logo [MPLIB] {MPlib} -\logo [MSDOS] {msdos} -\logo [MSWINDOWS] {MS~Windows} -\logo [MTXRUN] {mtxrun} -\logo [MTXTOOLS] {mtxtools} -\logo [NETPBM] {NetPBM} -\logo [NTG] {ntg} -\logo [NTS] {nts} -\logo [OFM] {ofm} -\logo [OMEGA] {Omega} -\logo [OPENMATH] {OpenMath} -\logo [OPENTYPE] {OpenType} -\logo [OPI] {opi} -\logo [OTF] {otf} -\logo [OTP] {otp} -\logo [OVF] {ovf} -\logo [PASCAL] {Pascal} -\logo [PCTEX] {pc\TeX} -\logo [PDF] {pdf} -\logo [PDFETEX] {pdfe\TeX} -\logo [PDFTEX] {pdf\TeX} -\logo [PDFTOOLS] {pdftools} -\logo [PDFTOPS] {pdftops} -\logo [PERL] {Perl} -\logo [PERLTK] {Perl/Tk} -\logo [PICTEX] {\PiCTeX} -\logo [PK] {pk} -\logo [PLAIN] {Plain} -\logo [PNG] {png} -\logo [POSIX] {posix} -\logo [POSTSCRIPT] {Post\-Script} -\logo [PPCHTEX] {\PPCHTeX} -\logo [PRAGMA] {Pragma ADE} -\logo [PRESS] {press} -\logo [PRIFIL] {prifil} -\logo [PS] {Post\-Script} -\logo [PSCHECK] {pscheck} -\logo [PSTOEDIT] {pstoedit} -\logo [PSTOPAGE] {pstopage} -\logo [PSTOPDF] {pstopdf} -\logo [PSTRICKS] {pstricks} -\logo [RAM] {ram} -\logo [READER] {Acro\-bat Reader} -\logo [RELAXNG] {Relax\kern.125emNG} -\logo [RGB] {rgb} -\logo [RLXTOOLS] {rlxtools} -\logo [RUBY] {Ruby} -\logo [SCITE] {SciTE} -\logo [SGML] {sgml} -\logo [SI] {si} -\logo [SQL] {sql} -\logo [TABLE] {\TaBlE} -\logo [TCPIP] {tcp/ip} -\logo [TDS] {tds} % no sc te -\logo [TETEX] {te\TeX} % no sc te -\logo [TEX] {\TeX} -\logo [TEXADRES] {\TeX adress} -\logo [TEXBASE] {\TeX base} -\logo [TEXEDIT] {\TeX edit} -\logo [TEXEXEC] {\TeX exec} -\logo [TEXFONT] {\TeX font} -\logo [TEXFORM] {\TeX form} -\logo [TEXLIVE] {\TeX Live} -\logo [TEXLUA] {\TeX Lua} -\logo [TEXMF] {texmf} -\logo [TEXMFSTART] {texmfstart} -\logo [TEXNL] {tex-nl} -\logo [TEXSHOW] {\TeX show} -\logo [TEXSPELL] {\TeX spell} -\logo [TEXGYRE] {\TeX\ Gyre} -\logo [TEXSYNC] {texsync} -\logo [TEXTMATE] {TextMate} -\logo [TEXTOOLS] {\TeX tools} -\logo [TEXUTIL] {\TeX util} -\logo [TEXWORK] {\TeX work} -\logo [TEXXET] {\TeX\XeT} \def\XeT{XeT} -\logo [TFM] {tfm} -\logo [TIF] {tif} -\logo [TIFF] {tiff} -\logo [TIFFINFO] {tiffinfo} -\logo [TIFFTAGS] {tifftags} -\logo [TMFTOOLS] {tmftools} -\logo [TPIC] {tpic} -\logo [TPM] {tpm} -\logo [TRUETYPE] {TrueType} -\logo [TTF] {ttf} -\logo [TUG] {tug} -\logo [TUGBOAT] {Tug\-Boat} -\logo [TUGNEWS] {Tug\-News} -\logo [TYPEONE] {Type1} -\logo [UCS] {ucs} -\logo [UNICODE] {Uni\-code} -\logo [UNIX] {Unix} -\logo [URI] {uri} -\logo [URL] {url} -\logo [USA] {usa} -\logo [USENET] {usenet} -\logo [UTF] {utf} -\logo [UTF] {utf} -\logo [VF] {vf} -\logo [WDT] {wdt} -\logo [WEB] {web} -\logo [WEBC] {web2c} -\logo [WIKI] {Wiki} -\logo [WINDOWS] {Windows} -\logo [WINNT] {WinNT} -\logo [WINNX] {Win9x} -\logo [WWW] {www} -\logo [WYSIWYG] {wysiwyg} -\logo [XDVI] {Xdvi} -\logo [XETEX] {\XeTeX} -\logo [XFDF] {xfdf} -\logo [XHTML] {xhtml} -\logo [XINDY] {Xindy} -\logo [XML] {xml} -\logo [XPATH] {xpath} -\logo [XMLTOOLS] {xmltools} -\logo [XPDFETEX] {xpdfe\TeX} -\logo [XSL] {xsl} -\logo [XSLFO] {xsl-fo} -\logo [XSLT] {xslt} -\logo [XSLTPROC] {xsltproc} -\logo [XYPIC] {XYPIC} % wrong logo -\logo [YandY] {y\&y} -\logo [ZIP] {zip} - -\def\METAFUN {\MetaFun} - -\logo [METAFUN] {\MetaFun} - -\def\SystemSpecialA#1{$\langle\it#1\rangle$} -\def\SystemSpecialB#1{{\tttf<#1>}} - -\def\CATCODE {\SystemSpecialA{catcode}} -\def\CATCODES {\SystemSpecialA{catcodes}} -\def\DIMENSION {\SystemSpecialA{dimension}} -\def\DIMENSIONS {\SystemSpecialA{dimensions}} -\def\COUNTER {\SystemSpecialA{counter}} -\def\COUNTERS {\SystemSpecialA{counters}} -\def\HBOX {\SystemSpecialA{hbox}} -\def\HBOXES {\SystemSpecialA{hboxes}} -\def\VBOX {\SystemSpecialA{vbox}} -\def\VBOXES {\SystemSpecialA{vboxes}} -\def\BOX {\SystemSpecialA{box}} -\def\BOXES {\SystemSpecialA{boxes}} -\def\TOKENLIST {\SystemSpecialA{token list}} -\def\TOKENLISTS {\SystemSpecialA{token lists}} -\def\NEWLINE {\SystemSpecialA{newline}} -\def\SKIP {\SystemSpecialA{skip}} -\def\SKIPS {\SystemSpecialA{skips}} -\def\MUSKIP {\SystemSpecialA{muskip}} -\def\MUSKIPS {\SystemSpecialA{muskips}} -\def\MARK {\SystemSpecialA{mark}} -\def\MARKS {\SystemSpecialA{marks}} - -\def\SPACE {\SystemSpecialB{space}} -\def\EOF {\SystemSpecialB{eof}} -\def\TAB {\SystemSpecialB{tab}} -\def\NEWPAGE {\SystemSpecialB{newpage}} -\def\NEWLINE {\SystemSpecialB{newline}} - -\def\THANH {H\`an Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh} - -\def\THANH {H\`an Th\ecircumflexacute\ Th\`anh} - -\endinput diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index d0ee6749a..3240ced55 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.log b/tex/context/base/status-lua.log index 9db6975f0..0eb35b36b 100644 --- a/tex/context/base/status-lua.log +++ b/tex/context/base/status-lua.log @@ -1,6 +1,6 @@ (cont-yes.mkiv -ConTeXt ver: 2013.09.14 14:39 MKIV beta fmt: 2013.9.14 int: english/english +ConTeXt ver: 2013.09.17 14:39 MKIV beta fmt: 2013.9.17 int: english/english system > 'cont-new.mkiv' loaded (cont-new.mkiv) diff --git a/tex/context/base/typo-cap.lua b/tex/context/base/typo-cap.lua index a2678ed79..70a0e08e9 100644 --- a/tex/context/base/typo-cap.lua +++ b/tex/context/base/typo-cap.lua @@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['typo-cap'] = { local next, type = next, type local format, insert = string.format, table.insert -local div = math.div +local div, randomnumber = math.div, math.random local trace_casing = false trackers.register("typesetters.casing", function(v) trace_casing = v end) @@ -16,12 +16,11 @@ local report_casing = logs.reporter("typesetting","casing") local nodes, node = nodes, node -local traverse_id = node.traverse_id -local copy_node = node.copy -local end_of_math = node.end_of_math - -local texsetattribute = tex.setattribute -local unsetvalue = attributes.unsetvalue +local traverse_id = nodes.traverse_id +local copy_node = nodes.copy +local end_of_math = nodes.end_of_math +local free_node = nodes.free +local remove_node = nodes.remove local nodecodes = nodes.nodecodes local skipcodes = nodes.skipcodes @@ -44,6 +43,8 @@ local variables = interfaces.variables local v_reset = variables.reset local chardata = characters.data +local texsetattribute = tex.setattribute +local unsetvalue = attributes.unsetvalue typesetters = typesetters or { } local typesetters = typesetters @@ -55,8 +56,6 @@ cases.actions = { } local actions = cases.actions local a_cases = attributes.private("case") -local lastfont = nil - -- we use char(0) as placeholder for the larger font, so we need to remove it -- before it can do further harm -- @@ -70,66 +69,89 @@ local lastfont = nil local uccodes = characters.uccodes local lccodes = characters.lccodes -local function helper(start, codes, special, once) +-- true false true == mixed + +local function helper(head,start,attr,lastfont,codes,special,once,keepother) local char = start.char local dc = codes[char] if dc then local fnt = start.font if special then -- will become function - if start.char == 0 then - lastfont = fnt - local prev, next = start.prev, start.next - prev.next = next - if next then - next.prev = prev - end - return prev, true - elseif lastfont and start.prev.id ~= glyph_code then - fnt = lastfont - start.font = lastfont + if char == 0 then + lastfont[attr] = fnt + head, start = remove_node(head,start,true) + return head, start and start.prev or head, true + elseif lastfont[attr] and start.prev.id ~= glyph_code then + fnt = lastfont[attr] + start.font = fnt end + elseif char == 0 then + -- print("removing",char) + -- head, start = remove_node(head,start,true) + -- return head, start and getprev(start) or head, true end - local ifc = fontchar[fnt] - if type(dc) == "table" then - local ok = true - for i=1,#dc do - ok = ok and ifc[dc[i]] + if keepother and dc == char then + if lastfont[attr] then + start.font = lastfont[attr] + return head, start, true + else + return head, start, false end - if ok then - -- tood; use generic injector - local prev, original = start, start + else + local ifc = fontchar[fnt] + if type(dc) == "table" then + local ok = true for i=1,#dc do - local chr = dc[i] - prev = start - if i == 1 then - start.char = chr - else - local g = copy_node(original) - g.char = chr - local next = start.next - g.prev = start - if next then - g.next = next - start.next = g - next.prev = g + -- could be cached in font + if not ifc[dc[i]] then + ok = false + break + end + end + if ok then + -- todo: use generic injector + local prev, original = start, start + for i=1,#dc do + local chr = dc[i] + prev = start + if i == 1 then + start.char = chr + else + local g = copy_node(original) + g.char = chr + local next = start.next + g.prev = start + if next then + g.next = next + start.next = g + next.prev = g + end + start = g end - start = g end + if once then + lastfont[attr] = nil + end + return head, prev, true + end + if once then + lastfont[attr] = nil + end + return head, start, false + elseif ifc[dc] then + start.char = dc + if once then + lastfont[attr] = nil end - if once then lastfont = nil end - return prev, true + return head, start, true end - if once then lastfont = nil end - return start, false - elseif ifc[dc] then - start.char = dc - if once then lastfont = nil end - return start, true end end - if once then lastfont = nil end - return start, false + if once then + lastfont[attr] = nil + end + return head, start, false end local registered, n = { }, 0 @@ -149,18 +171,18 @@ end cases.register = register -local function WORD(start) - lastfont = nil - return helper(start,uccodes) +local function WORD(head,start,attr,lastfont) + lastfont[attr] = nil + return helper(head,start,attr,lastfont,uccodes) end -local function word(start) - lastfont = nil - return helper(start,lccodes) +local function word(head,start,attr,lastfont) + lastfont[attr] = nil + return helper(head,start,attr,lastfont,lccodes) end -local function Word(start,attr) - lastfont = nil +local function Word(head,start,attr,lastfont) + lastfont[attr] = nil local prev = start.prev if prev and prev.id == kern_code and prev.subtype == kerning_code then prev = prev.prev @@ -176,67 +198,69 @@ local function Word(start,attr) end -- we could return the last in the range and save some scanning -- but why bother - return helper(start,uccodes) + return helper(head,start,attr,lastfont,uccodes) else - return start, false + return head, start, false end end -local function Words(start) - lastfont = nil +local function Words(head,start,attr,lastfont) + lastfont[attr] = nil local prev = start.prev if prev and prev.id == kern_code and prev.subtype == kerning_code then prev = prev.prev end if not prev or prev.id ~= glyph_code then - return helper(start,uccodes) + return helper(head,start,attr,lastfont,uccodes) else - return start, false + return head, start, false end end -local function capital(start) -- 3 - return helper(start,uccodes,true,true) +local function capital(head,start,attr,lastfont) -- 3 + return helper(head,start,attr,lastfont,uccodes,true,true) +end + +local function Capital(head,start,attr,lastfont) -- 4 + return helper(head,start,attr,lastfont,uccodes,true,false) end -local function Capital(start) -- 4 - return helper(start,uccodes,true,false) +local function mixed(head,start,attr,lastfont) + return helper(head,start,attr,lastfont,uccodes,true,false,true) end -local function none(start) - return start, false +local function none(head,start,attr,lastfont) + return head, start, false end -local function random(start) - lastfont = nil - local ch = start.char - local mr = math.random - -- local tfm = fontdata[start.font].characters +local function random(head,start,attr,lastfont) + lastfont[attr] = nil + local ch = start.char local tfm = fontchar[start.font] if lccodes[ch] then while true do - local d = chardata[mr(1,0xFFFF)] + local d = chardata[randomnumber(1,0xFFFF)] if d then local uc = uccodes[d] if uc and tfm[uc] then -- this also intercepts tables start.char = uc - return start, true + return head, start, true end end end elseif uccodes[ch] then while true do - local d = chardata[mr(1,0xFFFF)] + local d = chardata[randomnumber(1,0xFFFF)] if d then local lc = lccodes[d] if lc and tfm[lc] then -- this also intercepts tables start.char = lc - return start, true + return head, start, true end end end end - return start, false + return head, start, false end register(variables.WORD, WORD) -- 1 @@ -247,31 +271,31 @@ register(variables.capital, capital) -- 5 register(variables.Capital, Capital) -- 6 register(variables.none, none) -- 7 (dummy) register(variables.random, random) -- 8 +register(variables.mixed, mixed) -- 9 register(variables.cap, variables.capital) -- clone register(variables.Cap, variables.Capital) -- clone --- node.traverse_id_attr - function cases.handler(head) -- not real fast but also not used on much data - lastfont = nil + local lastfont = { } local lastattr = nil - local done = false - local start = head + local done = false + local start = head while start do -- while because start can jump ahead local id = start.id if id == glyph_code then local attr = start[a_cases] if attr and attr > 0 then if attr ~= lastattr then - lastfont = nil lastattr = attr end start[a_cases] = unsetvalue local action = actions[attr%100] -- map back to low number if action then - start, ok = action(start,attr) - done = done and ok + head, start, ok = action(head,start,attr,lastfont) + if ok then + done = true + end if trace_casing then report_casing("case trigger %a, instance %a, result %a",attr%100,div(attr,100),ok) end @@ -286,7 +310,6 @@ function cases.handler(head) -- not real fast but also not used on much data start = start.next end end - lastfont = nil return head, done end diff --git a/tex/context/base/typo-cap.mkiv b/tex/context/base/typo-cap.mkiv index d2f1dc0e0..8f859a4e6 100644 --- a/tex/context/base/typo-cap.mkiv +++ b/tex/context/base/typo-cap.mkiv @@ -22,6 +22,28 @@ \definesystemattribute[case][public] +%D \macros +%D {setupcapitals} +%D +%D By default we use pseudo small caps in titles. This can be +%D set up with: +%D +%D \showsetup{setupcapitals} + +\installcorenamespace{capitals} + +\installcommandhandler \??capitals {capitals} \??capitals + +%D Beware, these are not really defines (yet). + +\definecapitals[\v!WORD ] % all upper +\definecapitals[\v!capital] % one upper + font +\definecapitals[\v!Capital] % some upper + font +\definecapitals[\v!mixed ] % UpperCase +\definecapitals[\v!WORD ] % all lower +\definecapitals[\v!Word ] % one upper + font +\definecapitals[\v!Words ] % some upper + %D \macros %D {Word, Words, WORD, WORDS} %D @@ -141,21 +163,36 @@ % % here we keep the \groupedcommand -\unexpanded\def\pseudosmallcapped{\groupedcommand{\setcharactercasing [\v!WORD ]\signalcharacter\tx}{}} % all upper -\unexpanded\def\pseudoSmallcapped{\groupedcommand{\setcharactercasing [\v!capital]\signalcharacter\tx}{}} % one upper + font -\unexpanded\def\pseudoSmallCapped{\groupedcommand{\setcharactercasing [\v!Capital]\signalcharacter\tx}{}} % some upper + font - -\unexpanded\def\realsmallcapped {\groupedcommand{\sc\setcharactercasing[\v!WORD ]}{}} % all lower -\unexpanded\def\realSmallcapped {\groupedcommand{\sc\setcharactercasing[\v!Word ]}{}} % one upper + font -\unexpanded\def\realSmallCapped {\groupedcommand{\sc\setcharactercasing[\v!Words ]}{}} % some upper - -\unexpanded\def\font_style_pseudosmallcapped{\setcharactercasing [\v!WORD ]\signalcharacter\tx} % all upper -\unexpanded\def\font_style_pseudoSmallcapped{\setcharactercasing [\v!capital]\signalcharacter\tx} % one upper + font -\unexpanded\def\font_style_pseudoSmallCapped{\setcharactercasing [\v!Capital]\signalcharacter\tx} % some upper + font - -\unexpanded\def\font_style_realsmallcapped {\sc\setcharactercasing[\v!WORD ]} % all lower -\unexpanded\def\font_style_realSmallcapped {\sc\setcharactercasing[\v!Word ]} % one upper + font -\unexpanded\def\font_style_realSmallCapped {\sc\setcharactercasing[\v!Words ]} % some upper +\def\typo_capitals_set_fake#1% + {\edef\currentcapitals{#1}% + %\setcharactercasing[\currentcapitals]% + \ctxcommand{setcharactercasing("\currentcapitals")}% + \signalcharacter % retain current style + \usecapitalsstyleparameter\c!style} + +\def\typo_capitals_set_real#1% + {\edef\currentcapitals{#1}% + \sc + %\setcharactercasing[\currentcapitals]} + \ctxcommand{setcharactercasing("\currentcapitals")}} + +\unexpanded\def\pseudosmallcapped{\groupedcommand{\typo_capitals_set_fake\v!WORD }\donothing} % all upper +\unexpanded\def\pseudoSmallcapped{\groupedcommand{\typo_capitals_set_fake\v!capital}\donothing} % one upper + font +\unexpanded\def\pseudoSmallCapped{\groupedcommand{\typo_capitals_set_fake\v!Capital}\donothing} % some upper + font +\unexpanded\def\pseudoMixedCapped{\groupedcommand{\typo_capitals_set_fake\v!mixed }\donothing} % UpperCase + +\unexpanded\def\realsmallcapped {\groupedcommand{\typo_capitals_set_real\v!WORD }\donothing} % all lower +\unexpanded\def\realSmallcapped {\groupedcommand{\typo_capitals_set_real\v!Word }\donothing} % one upper + font +\unexpanded\def\realSmallCapped {\groupedcommand{\typo_capitals_set_real\v!Words }\donothing} % some upper + +\unexpanded\def\font_style_pseudosmallcapped{\typo_capitals_set_fake\v!WORD } % all upper +\unexpanded\def\font_style_pseudoSmallcapped{\typo_capitals_set_fake\v!capital} % one upper + font +\unexpanded\def\font_style_pseudoSmallCapped{\typo_capitals_set_fake\v!Capital} % some upper + font +\unexpanded\def\font_style_pseudoMixedCapped{\typo_capitals_set_fake\v!mixed } + +\unexpanded\def\font_style_realsmallcapped {\typo_capitals_set_real\v!WORD } % all lower +\unexpanded\def\font_style_realSmallcapped {\typo_capitals_set_real\v!Word } % one upper + font +\unexpanded\def\font_style_realSmallCapped {\typo_capitals_set_real\v!Words } % some upper \unexpanded\def\typo_capitals_smallcaps {\ifconditional\c_typo_capitals_pseudo @@ -182,6 +219,8 @@ \let\kap\cap % for old times sake \let\Caps\SmallCapped % for old times sake +\let\mixedcaps\pseudoMixedCapped + \let\normalsmallcapped\smallcapped \let\normalWORD \WORD \let\normalword \word @@ -194,29 +233,21 @@ \unexpanded\def\notsmallcapped{\groupedcommand{\setcharactercasing[\v!word]\signalcharacter}{}} -%D \macros -%D {setupcapitals} -%D -%D By default we use pseudo small caps in titles. This can be -%D set up with: -%D -%D \showsetup{setupcapitals} - -\installcorenamespace{capitals} - -\installsetuponlycommandhandler \??capitals {capitals} +%D Further tweaks \let\normalsmallcapped\smallcapped \appendtoks - \doifelse{\directcapitalsparameter\c!title}\v!yes - {\definealternativestyle[\v!capital ][\font_style_normalsmallcapped][\font_style_normalsmallcapped]% - \definealternativestyle[\v!smallcaps][\setsmallcaps][\setsmallcaps]} - {\definealternativestyle[\v!capital ][\font_style_normalsmallcapped][\font_style_normalWORD]% - \definealternativestyle[\v!smallcaps][\setsmallcaps][\font_style_normalWORD]}% - \doifelse{\directcapitalsparameter\s!sc}\v!yes - \userealcaps - \usepseudocaps + \ifx\currentcapitals\empty + \doifelse{\directcapitalsparameter\c!title}\v!yes + {\definealternativestyle[\v!capital ][\font_style_normalsmallcapped][\font_style_normalsmallcapped]% + \definealternativestyle[\v!smallcaps][\setsmallcaps][\setsmallcaps]} + {\definealternativestyle[\v!capital ][\font_style_normalsmallcapped][\font_style_normalWORD]% + \definealternativestyle[\v!smallcaps][\setsmallcaps][\font_style_normalWORD]}% + \doifelse{\directcapitalsparameter\s!sc}\v!yes + \userealcaps + \usepseudocaps + \fi \to \everysetupcapitals \let\uppercased\normalWORD @@ -224,8 +255,26 @@ \setupcapitals [\c!title=\v!yes, + \c!style=\tx, \s!sc=\v!no] % no \c!sc any longer +% \definefont +% [MixedCaps] +% [\v_font_string_a\v_font_string_c*default cp \the\exheight] +% +% \definefont +% [MixedCaps] +% [MixedCaps*default cp \the\exheight] + +\definefont + [MixedCaps] + [CurrentFont*default cp \the\exheight] + +\setupcapitals + [\v!mixed] + [\c!style=MixedCaps] + + % \definestartstop is not yet in available at core-spa time % % \startrandomized \input tufte \stoprandomized diff --git a/tex/context/base/util-env.lua b/tex/context/base/util-env.lua index f4f3ef69f..1184c1d5b 100644 --- a/tex/context/base/util-env.lua +++ b/tex/context/base/util-env.lua @@ -57,6 +57,7 @@ environment.basicengines = basicengines -- instead we could set ranges if not arg then + environment.used_as_library = true -- used as library elseif luaengines[file.removesuffix(arg[-1])] then -- arg[-1] = arg[0] diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index e6cd36b17..5f83c76cb 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 : 09/14/13 14:39:53 +-- merge date : 09/17/13 14:39:47 do -- begin closure to overcome local limits and interference -- cgit v1.2.3