From c2fda456f975562068e66deb9905a9721af82ddf Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 7 Aug 2009 11:22:00 +0200 Subject: beta 2009.08.07 11:22 --- metapost/context/base/mp-spec.mp | 2 +- scripts/context/lua/mtx-server-ctx-fonttest.lua | 4 +-- scripts/context/lua/mtxrun.lua | 24 ++++++++++++--- scripts/context/stubs/mswin/mtxrun.lua | 24 ++++++++++++--- scripts/context/stubs/unix/mtxrun | 24 ++++++++++++--- tex/context/base/cont-new.tex | 2 +- tex/context/base/context.tex | 2 +- tex/context/base/font-def.lua | 20 +++++------- tex/context/base/font-dum.lua | 2 +- tex/context/base/font-ini.lua | 5 +++ tex/context/base/font-ini.mkiv | 8 +++++ tex/context/base/font-ott.lua | 10 ++++++ tex/context/base/font-xtx.lua | 2 +- tex/context/base/math-noa.lua | 2 +- tex/context/base/mlib-pps.lua | 2 +- tex/context/base/pack-lyr.mkiv | 2 +- tex/context/base/syst-aux.mkiv | 6 ++++ tex/generic/context/luatex-fonts-merged.lua | 41 ++++++++++++++++--------- 18 files changed, 133 insertions(+), 49 deletions(-) diff --git a/metapost/context/base/mp-spec.mp b/metapost/context/base/mp-spec.mp index 21e5e4e1c..9125b4b8b 100644 --- a/metapost/context/base/mp-spec.mp +++ b/metapost/context/base/mp-spec.mp @@ -260,7 +260,7 @@ vardef define_linear_shade (expr a, b, ca, cb) = elseif (mp_shade_version > 1) and _is_spot_(ca) and _is_spot_(cb) : flush_special(34, 17, "0 1 " & decimal shadefactor & " " & spotcolorpattern[bluepart ca] & " " & ddecimal (a shifted shadeoffset) & " " & - cmykcolorpattern[bluepart cb] & " " & ddecimal (b shifted shadeoffset) ) ; + spotcolorpattern[bluepart cb] & " " & ddecimal (b shifted shadeoffset) ) ; else : flush_special(30, 15, "0 1 " & decimal shadefactor & " " & dddecimal ca & " " & ddecimal (a shifted shadeoffset) & " " & diff --git a/scripts/context/lua/mtx-server-ctx-fonttest.lua b/scripts/context/lua/mtx-server-ctx-fonttest.lua index efaae66e3..f593c2e35 100644 --- a/scripts/context/lua/mtx-server-ctx-fonttest.lua +++ b/scripts/context/lua/mtx-server-ctx-fonttest.lua @@ -153,7 +153,7 @@ local function showfeatures(f) if not features then logs.simple("building cache for '%s'",f) io.savedata(file.join(temppath,file.addsuffix(tempname,"tex")),format(process_templates.cache,f,f)) - os.execute(format("mtxrun --path=%s --script context --once --batchmode --mode=*nofonts %s",temppath,tempname)) + os.execute(format("mtxrun --path=%s --script context --once --batchmode %s",temppath,tempname)) features = fonts.get_features(f) end cache[f] = features or false @@ -332,7 +332,7 @@ local function process_font(currentfont,detail) -- maybe just fontname if sample == "" then sample = sample_line end logs.simple("sample text: %s",sample) io.savedata(file.join(temppath,file.addsuffix(tempname,"tex")),format(variant,concat(features,","),currentfont,sample)) - os.execute(format("mtxrun --path=%s --script context --once --batchmode --mode=*nofonts %s",temppath,tempname)) + os.execute(format("mtxrun --path=%s --script context --once --batchmode %s",temppath,tempname)) return edit_font(currentfont,detail,tempname) end diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index d30350ea5..aba22a16e 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -10058,13 +10058,29 @@ function runners.execute_ctx_script(filename,arguments) end else logs.setverbose(true) - filename = file.addsuffix(filename,"lua") if filename == "" then logs.simple("unknown script, no name given") - elseif file.is_qualified_path(filename) then - logs.simple("unknown script '%s'",filename) + local context = resolvers.find_file("mtx-context.lua") + if context ~= "" then + local result = dir.glob((string.gsub(context,"mtx%-context","mtx-*"))) -- () needed + local valid = { } + for _, scriptname in ipairs(result) do + scriptname = string.match(scriptname,".*mtx%-([^%-]-)%.lua") + if scriptname then + valid[#valid+1] = scriptname + end + end + if #valid > 0 then + logs.simple("known scripts: %s",table.concat(valid,", ")) + end + end else - logs.simple("unknown script '%s' or 'mtx-%s'",filename,filename) + filename = file.addsuffix(filename,"lua") + if file.is_qualified_path(filename) then + logs.simple("unknown script '%s'",filename) + else + logs.simple("unknown script '%s' or 'mtx-%s'",filename,filename) + end end return false end diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index d30350ea5..aba22a16e 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -10058,13 +10058,29 @@ function runners.execute_ctx_script(filename,arguments) end else logs.setverbose(true) - filename = file.addsuffix(filename,"lua") if filename == "" then logs.simple("unknown script, no name given") - elseif file.is_qualified_path(filename) then - logs.simple("unknown script '%s'",filename) + local context = resolvers.find_file("mtx-context.lua") + if context ~= "" then + local result = dir.glob((string.gsub(context,"mtx%-context","mtx-*"))) -- () needed + local valid = { } + for _, scriptname in ipairs(result) do + scriptname = string.match(scriptname,".*mtx%-([^%-]-)%.lua") + if scriptname then + valid[#valid+1] = scriptname + end + end + if #valid > 0 then + logs.simple("known scripts: %s",table.concat(valid,", ")) + end + end else - logs.simple("unknown script '%s' or 'mtx-%s'",filename,filename) + filename = file.addsuffix(filename,"lua") + if file.is_qualified_path(filename) then + logs.simple("unknown script '%s'",filename) + else + logs.simple("unknown script '%s' or 'mtx-%s'",filename,filename) + end end return false end diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index d30350ea5..aba22a16e 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -10058,13 +10058,29 @@ function runners.execute_ctx_script(filename,arguments) end else logs.setverbose(true) - filename = file.addsuffix(filename,"lua") if filename == "" then logs.simple("unknown script, no name given") - elseif file.is_qualified_path(filename) then - logs.simple("unknown script '%s'",filename) + local context = resolvers.find_file("mtx-context.lua") + if context ~= "" then + local result = dir.glob((string.gsub(context,"mtx%-context","mtx-*"))) -- () needed + local valid = { } + for _, scriptname in ipairs(result) do + scriptname = string.match(scriptname,".*mtx%-([^%-]-)%.lua") + if scriptname then + valid[#valid+1] = scriptname + end + end + if #valid > 0 then + logs.simple("known scripts: %s",table.concat(valid,", ")) + end + end else - logs.simple("unknown script '%s' or 'mtx-%s'",filename,filename) + filename = file.addsuffix(filename,"lua") + if file.is_qualified_path(filename) then + logs.simple("unknown script '%s'",filename) + else + logs.simple("unknown script '%s' or 'mtx-%s'",filename,filename) + end end return false end diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 777401a8d..857d90dd6 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{2009.07.23 20:11} +\newcontextversion{2009.08.07 11:22} %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 6a5612f5a..90ab3117d 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2009.07.23 20:11} +\edef\contextversion{2009.08.07 11:22} %D For those who want to use this: diff --git a/tex/context/base/font-def.lua b/tex/context/base/font-def.lua index eca631184..c4b72194c 100644 --- a/tex/context/base/font-def.lua +++ b/tex/context/base/font-def.lua @@ -328,22 +328,18 @@ evolved. Each one has its own way of dealing with its format.

--ldx]]-- local function check_tfm(specification,fullname) - -- ofm directive blocks local path search unless set - fullname = resolvers.findbinfile(fullname, 'tfm') or "" -- just to be sure - if fullname ~= "" then - specification.filename, specification.format = fullname, "ofm" + -- ofm directive blocks local path search unless set; btw, in context we + -- don't support ofm files anyway as this format is obsolete + local foundname = resolvers.findbinfile(fullname, 'tfm') or "" -- just to be sure + if foundname == "" then + foundname = resolvers.findbinfile(fullname, 'ofm') or "" -- bonus for usage outside context + end + if foundname ~= "" then + specification.filename, specification.format = foundname, "ofm" return tfm.read_from_tfm(specification) end end ---~ local function check_afm(specification,fullname) ---~ fullname = resolvers.findbinfile(fullname, 'afm') or "" -- just to be sure ---~ if fullname ~= "" then ---~ specification.filename, specification.format = fullname, "afm" ---~ return tfm.read_from_afm(specification) ---~ end ---~ end - local function check_afm(specification,fullname) local foundname = resolvers.findbinfile(fullname, 'afm') or "" -- just to be sure if foundname == "" and tfm.auto_afm then diff --git a/tex/context/base/font-dum.lua b/tex/context/base/font-dum.lua index 5ae53d0f4..1421b3045 100644 --- a/tex/context/base/font-dum.lua +++ b/tex/context/base/font-dum.lua @@ -73,7 +73,7 @@ function fonts.names.resolve(name,sub) loaded = true end if type(data) == "table" and data.version == 1.08 then - local condensed = string.gsub(name,"[^%a%d]","") + local condensed = string.gsub(string.lower(name),"[^%a%d]","") local found = data.mapping and data.mapping[condensed] if found then local filename, is_sub = found[3], found[4] diff --git a/tex/context/base/font-ini.lua b/tex/context/base/font-ini.lua index 248a2baca..4005726a5 100644 --- a/tex/context/base/font-ini.lua +++ b/tex/context/base/font-ini.lua @@ -27,6 +27,11 @@ fonts.mode = 'base' fonts.private = 0xF0000 -- 0x10FFFF fonts.verbose = false -- more verbose cache tables +fonts.ids[0] = { -- nullfont + characters = { }, + descriptions = { }, +} + fonts.methods = fonts.methods or { base = { tfm = { }, afm = { }, otf = { }, vtf = { }, fix = { } }, node = { tfm = { }, afm = { }, otf = { }, vtf = { }, fix = { } }, diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv index 06884bb12..a31ed6e66 100644 --- a/tex/context/base/font-ini.mkiv +++ b/tex/context/base/font-ini.mkiv @@ -16,6 +16,14 @@ % todo: always fontclass, then less testing +% \definefontfeature[smallcaps][smcp=yes,script=latn] +% \definefontfeature[smallcaps][SmallCapitals=yes,script=latn] +% \definefontfeature[smallcaps][Small Capitals=yes,script=latn] +% \definefontfeature[smallcaps][small capitals=yes,script=latn] +% \definefontfeature[smallcaps][smallcapitals=yes,script=latn] +% +% \definedfont[cambria*smallcaps] test + % \starttext % \definefontfeature[basekerned][default][mode=base] % \definefontfeature[nodekerned][default][mode=node] diff --git a/tex/context/base/font-ott.lua b/tex/context/base/font-ott.lua index 6676ff64b..47c2e0e9f 100644 --- a/tex/context/base/font-ott.lua +++ b/tex/context/base/font-ott.lua @@ -671,6 +671,16 @@ local to_scripts = otf.tables.to_scripts local to_languages = otf.tables.to_languages local to_features = otf.tables.to_features +for k, v in pairs(to_features) do + local stripped = gsub(k,"%-"," ") + to_features[stripped] = v + local stripped = gsub(k,"[^a-zA-Z0-9]","") + to_features[stripped] = v +end +for k, v in pairs(to_features) do + to_features[lower(k)] = v +end + function otf.meanings.normalize(features) local h = { } for k,v in next, features do diff --git a/tex/context/base/font-xtx.lua b/tex/context/base/font-xtx.lua index 63e421fa4..7b3f1ec81 100644 --- a/tex/context/base/font-xtx.lua +++ b/tex/context/base/font-xtx.lua @@ -72,7 +72,7 @@ local function isfalse(s) list[s] = 'no' end local function iskey (k,v) list[k] = v end local spaces = lpeg.P(" ")^0 -local namespec = (1-lpeg.S("/: ("))^0 +local namespec = (1-lpeg.S("/:("))^0 -- was: (1-lpeg.S("/: ("))^0 local crapspec = spaces * lpeg.P("/") * (((1-lpeg.P(":"))^0)/iscrap) * spaces local filename = (lpeg.P("file:")/isfile * (namespec/thename)) + (lpeg.P("[") * lpeg.P(true)/isname * (((1-lpeg.P("]"))^0)/thename) * lpeg.P("]")) local fontname = (lpeg.P("name:")/isname * (namespec/thename)) + lpeg.P(true)/issome * (namespec/thename) diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index 7985834f2..db1a5b638 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -315,7 +315,7 @@ local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming function nodes.processors.mlist_to_hlist(head,style,penalties) starttiming(noads) - local head, done = actions(head,nil,style,penalties) + local head, done = actions(head,style,penalties) stoptiming(noads) return head, done end diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua index a2313f405..ec91c7d66 100644 --- a/tex/context/base/mlib-pps.lua +++ b/tex/context/base/mlib-pps.lua @@ -356,7 +356,7 @@ function metapost.specials.ls(specification,object,result,flusher) if round(cb[1]*10000) == 123 then cb = metapost.colorspec(cb) end local name = format("MpSh%s",nofshades) local domain = { tonumber(t[1]), tonumber(t[2]) } - local coordinates = { tonumber(t[5]), tonumber(t[6]), tonumber(t[7]), tonumber(t[9]) } + local coordinates = { tonumber(t[5]), tonumber(t[6]), tonumber(t[8]), tonumber(t[9]) } if type(ca) == "string" then -- backend specific (will be renamed) lpdf.linearshade(name,domain,{ 0 },{ 1 },1,"DeviceGray",coordinates) diff --git a/tex/context/base/pack-lyr.mkiv b/tex/context/base/pack-lyr.mkiv index fc1ea91c3..dc01f7f24 100644 --- a/tex/context/base/pack-lyr.mkiv +++ b/tex/context/base/pack-lyr.mkiv @@ -498,7 +498,7 @@ \!!donectrue \ifcase#1\else \edef\@@currentlayerposition{\csname\??ll\currentlayer\c!position\endcsname}% - \ifx\@@currentlayerposition\v!yes + \ifx\@@currentlayerposition\v!yes \else \edef\@@currentlayerrepeat{\csname\??ll\currentlayer\c!repeat\endcsname}% % \edef\@@currentlayerstate {\csname\??ll\currentlayer\c!state\endcsname}% actually this is already set \ifx\@@currentlayerrepeat\v!yes diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index 5952cbfd2..9a32ce58a 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -2895,6 +2895,12 @@ %D \bagger [a] {b} %D \stoptyping +% \starttexdefinition test {} +% oeps +% \stoptexdefinition +% +% [\test] + \bgroup \obeylines \gdef\starttexdefinition% diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 03eeed936..0b29a8c39 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua --- merge date : 07/23/09 20:13:36 +-- merge date : 08/07/09 11:24:12 do -- begin closure to overcome local limits and interference @@ -2967,6 +2967,11 @@ fonts.mode = 'base' fonts.private = 0xF0000 -- 0x10FFFF fonts.verbose = false -- more verbose cache tables +fonts.ids[0] = { -- nullfont + characters = { }, + descriptions = { }, +} + fonts.methods = fonts.methods or { base = { tfm = { }, afm = { }, otf = { }, vtf = { }, fix = { } }, node = { tfm = { }, afm = { }, otf = { }, vtf = { }, fix = { } }, @@ -4693,6 +4698,16 @@ local to_scripts = otf.tables.to_scripts local to_languages = otf.tables.to_languages local to_features = otf.tables.to_features +for k, v in pairs(to_features) do + local stripped = gsub(k,"%-"," ") + to_features[stripped] = v + local stripped = gsub(k,"[^a-zA-Z0-9]","") + to_features[stripped] = v +end +for k, v in pairs(to_features) do + to_features[lower(k)] = v +end + function otf.meanings.normalize(features) local h = { } for k,v in next, features do @@ -10490,22 +10505,18 @@ evolved. Each one has its own way of dealing with its format.

--ldx]]-- local function check_tfm(specification,fullname) - -- ofm directive blocks local path search unless set - fullname = resolvers.findbinfile(fullname, 'tfm') or "" -- just to be sure - if fullname ~= "" then - specification.filename, specification.format = fullname, "ofm" + -- ofm directive blocks local path search unless set; btw, in context we + -- don't support ofm files anyway as this format is obsolete + local foundname = resolvers.findbinfile(fullname, 'tfm') or "" -- just to be sure + if foundname == "" then + foundname = resolvers.findbinfile(fullname, 'ofm') or "" -- bonus for usage outside context + end + if foundname ~= "" then + specification.filename, specification.format = foundname, "ofm" return tfm.read_from_tfm(specification) end end ---~ local function check_afm(specification,fullname) ---~ fullname = resolvers.findbinfile(fullname, 'afm') or "" -- just to be sure ---~ if fullname ~= "" then ---~ specification.filename, specification.format = fullname, "afm" ---~ return tfm.read_from_afm(specification) ---~ end ---~ end - local function check_afm(specification,fullname) local foundname = resolvers.findbinfile(fullname, 'afm') or "" -- just to be sure if foundname == "" and tfm.auto_afm then @@ -10837,7 +10848,7 @@ local function isfalse(s) list[s] = 'no' end local function iskey (k,v) list[k] = v end local spaces = lpeg.P(" ")^0 -local namespec = (1-lpeg.S("/: ("))^0 +local namespec = (1-lpeg.S("/:("))^0 -- was: (1-lpeg.S("/: ("))^0 local crapspec = spaces * lpeg.P("/") * (((1-lpeg.P(":"))^0)/iscrap) * spaces local filename = (lpeg.P("file:")/isfile * (namespec/thename)) + (lpeg.P("[") * lpeg.P(true)/isname * (((1-lpeg.P("]"))^0)/thename) * lpeg.P("]")) local fontname = (lpeg.P("name:")/isname * (namespec/thename)) + lpeg.P(true)/issome * (namespec/thename) @@ -11181,7 +11192,7 @@ function fonts.names.resolve(name,sub) loaded = true end if type(data) == "table" and data.version == 1.08 then - local condensed = string.gsub(name,"[^%a%d]","") + local condensed = string.gsub(string.lower(name),"[^%a%d]","") local found = data.mapping and data.mapping[condensed] if found then local filename, is_sub = found[3], found[4] -- cgit v1.2.3