From 6f2d249bfb4ead58ed709e59c403df9457f51982 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 4 Oct 2019 18:59:44 +0200 Subject: 2019-10-04 17:52:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkii/mult-de.mkii | 1 + tex/context/base/mkii/mult-nl.mkii | 1 + tex/context/base/mkii/mult-pe.mkii | 9 + tex/context/base/mkiv/colo-ini.lua | 2 - tex/context/base/mkiv/colo-ini.mkiv | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/context.mkxl | 2 +- tex/context/base/mkiv/font-ctx.lua | 69 ++++++-- tex/context/base/mkiv/font-ogr.lua | 192 +++++++++++++++++++-- tex/context/base/mkiv/lpdf-emb.lua | 11 +- tex/context/base/mkiv/lxml-lpt.lua | 45 +++-- tex/context/base/mkiv/lxml-tex.lua | 2 +- tex/context/base/mkiv/meta-imp-symbols.mkxl | 99 +++++++++++ tex/context/base/mkiv/meta-ini.mkxl | 2 + tex/context/base/mkiv/mlib-lmp.lua | 16 ++ tex/context/base/mkiv/mlib-lua.lua | 1 + tex/context/base/mkiv/mlib-run.lua | 8 +- tex/context/base/mkiv/status-files.pdf | Bin 26630 -> 26660 bytes tex/context/base/mkiv/status-lua.pdf | Bin 268646 -> 268380 bytes tex/context/fonts/mkiv/type-imp-cambria.mkiv | 2 +- tex/context/fonts/mkiv/type-imp-dejavu.mkiv | 4 +- tex/context/fonts/mkiv/type-imp-texgyre.mkiv | 8 +- tex/context/interface/mkii/keys-de.xml | 1 + tex/context/interface/mkii/keys-nl.xml | 1 + tex/context/interface/mkii/keys-pe.xml | 9 + tex/context/interface/mkiv/i-context.pdf | Bin 893298 -> 893187 bytes tex/context/interface/mkiv/i-readme.pdf | Bin 61165 -> 61165 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 31 files changed, 428 insertions(+), 69 deletions(-) create mode 100644 tex/context/base/mkiv/meta-imp-symbols.mkxl (limited to 'tex') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 296525c5c..bed8b96fc 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2019.10.02 12:43} +\newcontextversion{2019.10.04 17:44} %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/mkii/context.mkii b/tex/context/base/mkii/context.mkii index ed7ade881..b042613af 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2019.10.02 12:43} +\edef\contextversion{2019.10.04 17:44} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-de.mkii b/tex/context/base/mkii/mult-de.mkii index a957e8f17..9632dc07e 100644 --- a/tex/context/base/mkii/mult-de.mkii +++ b/tex/context/base/mkii/mult-de.mkii @@ -234,6 +234,7 @@ \setinterfacevariable{hanging}{haengend} \setinterfacevariable{head}{kopf} \setinterfacevariable{header}{kopfzeile} +\setinterfacevariable{headintext}{headintext} \setinterfacevariable{height}{hoehe} \setinterfacevariable{helptext}{hilfetext} \setinterfacevariable{hencefore}{vorher} diff --git a/tex/context/base/mkii/mult-nl.mkii b/tex/context/base/mkii/mult-nl.mkii index aebf9a898..ce86f1edd 100644 --- a/tex/context/base/mkii/mult-nl.mkii +++ b/tex/context/base/mkii/mult-nl.mkii @@ -234,6 +234,7 @@ \setinterfacevariable{hanging}{hangend} \setinterfacevariable{head}{kop} \setinterfacevariable{header}{hoofd} +\setinterfacevariable{headintext}{kopintekst} \setinterfacevariable{height}{hoogte} \setinterfacevariable{helptext}{helptekst} \setinterfacevariable{hencefore}{hierboven} diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii index d07d9dbdd..eb5c6d3b8 100644 --- a/tex/context/base/mkii/mult-pe.mkii +++ b/tex/context/base/mkii/mult-pe.mkii @@ -234,6 +234,7 @@ \setinterfacevariable{hanging}{آویزان} \setinterfacevariable{head}{سر} \setinterfacevariable{header}{سربرگ} +\setinterfacevariable{headintext}{headintext} \setinterfacevariable{height}{ارتفاع} \setinterfacevariable{helptext}{متن‌کمکی} \setinterfacevariable{hencefore}{hencefore} @@ -637,6 +638,7 @@ \setinterfaceconstant{aligntitle}{عنوان‌تنظیم} \setinterfaceconstant{alternative}{جایگزین} \setinterfaceconstant{anchor}{anchor} +\setinterfaceconstant{anchoring}{anchoring} \setinterfaceconstant{andtext}{andtext} \setinterfaceconstant{apa}{apa} \setinterfaceconstant{arguments}{arguments} @@ -866,6 +868,7 @@ \setinterfaceconstant{hfil}{پرکردن‌ارتفاع} \setinterfaceconstant{hidenumber}{hidenumber} \setinterfaceconstant{hoffset}{آفست‌ا} +\setinterfaceconstant{horizontal}{افقی} \setinterfaceconstant{horoffset}{آفست‌افق} \setinterfaceconstant{hyphen}{شکستن} \setinterfaceconstant{hyphens}{hyphens} @@ -966,9 +969,12 @@ \setinterfaceconstant{menu}{منو} \setinterfaceconstant{method}{روش} \setinterfaceconstant{middle}{میان} +\setinterfaceconstant{middlecolor}{middlecolor} \setinterfaceconstant{middlecommand}{middlecommand} \setinterfaceconstant{middlespeech}{سخنرانی‌میانی} +\setinterfaceconstant{middlestyle}{middlestyle} \setinterfaceconstant{middletext}{متن‌میانی} +\setinterfaceconstant{middlewidth}{middlewidth} \setinterfaceconstant{midsentence}{جمله‌میانی} \setinterfaceconstant{min}{کمترین} \setinterfaceconstant{mindepth}{کمترین‌عمق} @@ -1286,6 +1292,7 @@ \setinterfaceconstant{vcompact}{vcompact} \setinterfaceconstant{vector}{vector} \setinterfaceconstant{veroffset}{آفست‌عم} +\setinterfaceconstant{vertical}{عمودی} \setinterfaceconstant{vfactor}{vfactor} \setinterfaceconstant{vfil}{vfil} \setinterfaceconstant{viewerprefix}{viewerprefix} @@ -1296,6 +1303,7 @@ \setinterfaceconstant{white}{سفید} \setinterfaceconstant{width}{عرض} \setinterfaceconstant{words}{words} +\setinterfaceconstant{xanchor}{xanchor} \setinterfaceconstant{xfactor}{فاکتورایکس} \setinterfaceconstant{xhtml}{xhtml} \setinterfaceconstant{xmax}{xmax} @@ -1303,6 +1311,7 @@ \setinterfaceconstant{xoffset}{آفست‌ایکس} \setinterfaceconstant{xscale}{مقیاس‌ایکس} \setinterfaceconstant{xstep}{گام‌ایکس} +\setinterfaceconstant{yanchor}{yanchor} \setinterfaceconstant{yfactor}{فاکتوروای} \setinterfaceconstant{ymax}{ymax} \setinterfaceconstant{yoffset}{آفست‌وای} diff --git a/tex/context/base/mkiv/colo-ini.lua b/tex/context/base/mkiv/colo-ini.lua index d865668a5..cd2c19a75 100644 --- a/tex/context/base/mkiv/colo-ini.lua +++ b/tex/context/base/mkiv/colo-ini.lua @@ -571,7 +571,6 @@ colors.isblack = isblack -- if c and c > 1 then -- 1 is black -- local v = attributes.colors.values[c] - local function definespotcolor(name,parent,str,global) if parent == "" or find(parent,"=",1,true) then colors.registerspotcolor(name, parent) -- does that work? no attr @@ -830,7 +829,6 @@ colors.mpoptions = mpoptions -- mpprint(mpnamedcolor(str)) -- end - -- local function formatcolor(ca,separator) -- local cv = colorvalues[ca] -- if cv then diff --git a/tex/context/base/mkiv/colo-ini.mkiv b/tex/context/base/mkiv/colo-ini.mkiv index 7b649c174..fc456e824 100644 --- a/tex/context/base/mkiv/colo-ini.mkiv +++ b/tex/context/base/mkiv/colo-ini.mkiv @@ -859,7 +859,7 @@ % \let\colo_basics_synchronize\gobbleoneargument % used in mp interface % \let\colo_basics_inherit \gobbletwoarguments % used in mp interface -\def\colo_basics_allocate#1% +\def\colo_basics_allocate#1% todo: use a chardef instead {\expandafter\newcount\csname\??colornumber#1\endcsname \clf_synccolorcount{#1}\c_syst_last_allocated_count} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 2236514eb..1b4a8b805 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2019.10.02 12:43} +\newcontextversion{2019.10.04 17:44} %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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 87efea55e..cc542ec68 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.10.02 12:43} +\edef\contextversion{2019.10.04 17:44} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl index c3552f09f..6158184ee 100644 --- a/tex/context/base/mkiv/context.mkxl +++ b/tex/context/base/mkiv/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.10.02 12:43} +\edef\contextversion{2019.10.04 17:44} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua index 02cf6093c..0a492b119 100644 --- a/tex/context/base/mkiv/font-ctx.lua +++ b/tex/context/base/mkiv/font-ctx.lua @@ -179,7 +179,7 @@ do local hashes = { } local nofinstances = 0 - local instances = table.setmetatableindex(function(t,k) + local instances = setmetatableindex(function(t,k) nofinstances = nofinstances + 1 t[k] = nofinstances return nofinstances @@ -570,6 +570,21 @@ end -- \definefontfeature[demo][a={b,c}] -- \definefontfeature[demo][a={b=12,c={34,35}}] +local h = setmetatableindex(function(t,k) + local v = "," .. k .. "," + t[k] = v + return v +end) + +-- local function removefromhash(hash,key) +-- local pattern = h[key] +-- for k in next, hash do +-- if k ~= key and find(h[k],pattern) then -- if find(k,",") and ... +-- hash[k] = nil +-- end +-- end +-- end + local function presetcontext(name,parent,features) -- will go to con and shared if features == "" and find(parent,"=",1,true) then features = parent @@ -635,14 +650,23 @@ local function presetcontext(name,parent,features) -- will go to con and shared -- if v then t[k] = v end t[k] = v end - -- needed for dynamic features - -- maybe number should always be renewed as we can redefine features - local number = setups[name] and setups[name].number or 0 -- hm, numbers[name] + -- the number is needed for dynamic features; maybe number should always be + -- renewed as we can redefine features ... i need a test + local number = setups[name] and setups[name].number or 0 if number == 0 then number = #numbers + 1 numbers[number] = name end + -- t.number = number + -- there is the special case of combined features as we have in math but maybe + -- this has to change some day ... otherwise we mess up dynamics (ok, we could + -- impose a limit there: no combined features) + -- + -- done elsewhere (!) + -- + -- removefromhash(setups,name) -- can have changed (like foo,extramath) + -- setups[name] = t return number, t end @@ -913,14 +937,37 @@ end -- return fastcopy(setups[features] or (presetcontext(features,"","") and setups[features])) -- end +-- local function splitcontext(features) -- presetcontext creates dummy here +-- local sf = setups[features] +-- if not sf then +-- local n -- number +-- if find(features,",") then +-- -- let's assume a combination which is not yet defined but just specified (as in math) +-- n, sf = presetcontext(features,features,"") +-- else +-- -- we've run into an unknown feature and or a direct spec so we create a dummy +-- n, sf = presetcontext(features,"","") +-- end +-- end +-- return fastcopy(sf) +-- end + local function splitcontext(features) -- presetcontext creates dummy here - local sf = setups[features] - if not sf then - local n -- number - if find(features,",",a,true) then - -- let's assume a combination which is not yet defined but just specified (as in math) - n, sf = presetcontext(features,features,"") - else + local n, sf + if find(features,",") then + -- + -- from elsewhere (!) + -- + -- this will become: + -- + -- if find(features,"^reset," then + setups[features] = nil + -- end + -- let's assume a combination which is not yet defined but just specified (as in math) + n, sf = presetcontext(features,features,"") + else + sf = setups[features] + if not sf then -- we've run into an unknown feature and or a direct spec so we create a dummy n, sf = presetcontext(features,"","") end diff --git a/tex/context/base/mkiv/font-ogr.lua b/tex/context/base/mkiv/font-ogr.lua index a2e5d2e82..ed5bc709b 100644 --- a/tex/context/base/mkiv/font-ogr.lua +++ b/tex/context/base/mkiv/font-ogr.lua @@ -15,10 +15,12 @@ elseif CONTEXTLMTXMODE == 0 then return end -local tostring, tonumber, next = tostring, tonumber, next -local round, max, mod, div = math.round, math.round, math.mod, math.div -local concat, setmetatableindex = table.concat, table.setmetatableindex +local tostring, tonumber, next, type = tostring, tonumber, next, type +local round, max, mod, div = math.round, math.max, math.mod, math.div +local concat, setmetatableindex, sortedhash = table.concat, table.setmetatableindex, table.sortedhash +local utfbyte = utf.byte local formatters = string.formatters +local settings_to_hash_strict, settings_to_array = utilities.parsers.settings_to_hash_strict, utilities.parsers.settings_to_array local otf = fonts.handlers.otf local otfregister = otf.features.register @@ -51,8 +53,10 @@ do return droppedin end + -- todo: pass specification table instead + function dropins.provide(method,t_tfmdata,indexdata,...) - droppedin = dropins.nextid() + local droppedin = dropins.nextid() local t_characters = t_tfmdata.characters local t_descriptions = t_tfmdata.descriptions local t_properties = t_tfmdata.properties @@ -76,14 +80,13 @@ do return slot, droppedin, d_tfmdata, d_properties end - function dropins.clone(method,tfmdata,shapes,...) + function dropins.clone(method,tfmdata,shapes,...) -- by index if method and shapes then local characters = tfmdata.characters local descriptions = tfmdata.descriptions local droppedin, tfmdrop, dropchars, dropdescs, colrshapes local idx = 255 local slot = 0 - -- for k, v in next, characters do local index = v.index if index then @@ -93,7 +96,13 @@ do if shape then if idx >= 255 then idx = 1 - colrshapes = { filename = shapes.filename, fixdepth = shapes.fixdepth } -- not needed + colrshapes = { -- or use metatable + filename = shapes.filename, + fixdepth = shapes.fixdepth, + units = shapes.units, + usecolor = shapes.usecolor, + -- instance = shapes.instance, + } slot, droppedin, tfmdrop = dropins.provide(method,tfmdata,colrshapes) dropchars = tfmdrop.characters dropdescs = tfmdrop.descriptions @@ -101,10 +110,7 @@ do idx = idx + 1 end colrshapes[idx] = shape -- so not: description - -- --- local helpers = fonts.helpers --- local prependcommands = helpers.prependcommands --- print(v.commands) + -- todo: prepend v.commands = { { "slot", slot, idx } } -- hack to prevent that type 3 also gets 'use' flags .. todo local c = { commands = false, index = idx, dropin = tfmdata } @@ -122,6 +128,170 @@ do end end + function dropins.swap(method,tfmdata,shapes,...) -- by unicode + if method and shapes then + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local droppedin, tfmdrop, dropchars, dropdescs, colrshapes + local idx = 255 + local slot = 0 + -- we can have a variant where shaped are by unicode and not by index + for k, v in next, characters do + local description = descriptions[k] + if description then + local shape = shapes[k] + if shape then + if idx >= 255 then + idx = 1 + colrshapes = { -- or use metatable + filename = shapes.filename, + fixdepth = shapes.fixdepth, + units = shapes.units, + usecolor = shapes.usecolor, + -- instance = shapes.instance, + } + slot, droppedin, tfmdrop = dropins.provide(method,tfmdata,colrshapes) + dropchars = tfmdrop.characters + dropdescs = tfmdrop.descriptions + else + idx = idx + 1 + end + colrshapes[idx] = shape -- so not: description + -- todo: prepend + v.commands = { { "slot", slot, idx } } + -- hack to prevent that type 3 also gets 'use' flags .. todo + local c = { commands = false, index = idx, dropin = tfmdata } + local d = { index = idx, dropin = tfmdata } + setmetatableindex(c,v) + setmetatableindex(d,description) + dropchars[idx] = c + dropdescs[idx] = d + end + end + end + else + -- error + end + end + +end + +do + + local dropins = fonts.dropins + + local shapes = setmetatableindex(function(t,k) + local v = { + glyphs = { }, + parameters = { + units = 1000 + }, + } + t[k] = v + return v + end) + + function dropins.registerglyphs(parameters) + local category = parameters.name + local target = shapes[category].parameters + for k, v in next, parameters do + if k ~= "glyphs" then + target[k] = v + end + end + end + + function dropins.registerglyph(parameters) + local category = parameters.category + local unicode = parameters.unicode + local unitype = type(unicode) + if unitype == "string" then + local uninumber = tonumber(unicode) + if uninumber then + unicode = round(uninumber) + else + unicode = utfbyte(unicode) + end + elseif unitype == "number" then + unicode = round(unicode) + end + parameters.unicode = unicode + -- print(category,unicode) + shapes[category].glyphs[unicode] = parameters + end + + local function initializemps(tfmdata,kind,value) + if value then + local spec = settings_to_hash_strict(value) + if not spec or not next(spec) then + spec = { category = value } + end + -- todo: multiple categories but then mayb also different + -- clones because of the units .. fot now we assume the same + -- units + local category = spec.category + if category and category ~= "" then + local categories = settings_to_array(category) + local usedshapes = nil + local index = 0 + for i=1,#categories do + local category = categories[i] + local mpsshapes = shapes[category] + if mpsshapes then + local properties = tfmdata.properties + local parameters = tfmdata.parameters + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local mpsparameters = mpsshapes.parameters + local units = mpsparameters.units or 1000 + local defaultwidth = mpsparameters.width or 0 + local defaultheight = mpsparameters.height or 0 + local defaultdepth = mpsparameters.depth or 0 + local defaultcode = mpsparameters.code or "" + local scale = parameters.size / units + usedshapes = usedshapes or { + instance = "simplefun", + units = units, + usecolor = mpsparameters.usecolor, + } + -- todo: deal with extensibles and more properties + for unicode, shape in sortedhash(mpsshapes.glyphs) do + -- local oldc = characters[unicode] + -- if oldc then + index = index + 1 + local newc = { + index = index, -- into usedshapes + width = scale * (shape.width or defaultwidth), + height = scale * (shape.height or defaultheight), + depth = scale * (shape.depth or defaultdepth), + } + -- + characters [unicode] = newc + descriptions[unicode] = newc + -- + usedshapes[unicode] = shape.code or defaultcode + -- end + end + end + end + if usedshapes then + -- todo: different font when units and usecolor changes, maybe move into loop + -- above + dropins.swap("mps",tfmdata,usedshapes) + end + end + end + end + + otfregister { + name = "metapost", + description = "metapost glyphs", + manipulators = { + base = initializemps, + node = initializemps, + } + } + end -- This sits here for historcal reasons so for now we keep it here. diff --git a/tex/context/base/mkiv/lpdf-emb.lua b/tex/context/base/mkiv/lpdf-emb.lua index eace34ca1..28ff6ceaf 100644 --- a/tex/context/base/mkiv/lpdf-emb.lua +++ b/tex/context/base/mkiv/lpdf-emb.lua @@ -1532,6 +1532,7 @@ do local f_image = formatters["%.6N 0 d0 /%s Do"] local f_image_d = formatters["%.6N 0 d0 1 0 0 1 0 %.3N cm /%s Do"] local f_stream = formatters["%.6N 0 d0 %s"] + local f_stream_c = formatters["%.6N 0 0 0 0 0 d1 %s"] local f_stream_d = formatters["%.6N 0 d0 1 0 0 1 0 %.3N cm %s"] -- A type 3 font has at most 256 characters and Acrobat also wants a zero slot @@ -1617,17 +1618,21 @@ do local mpshapes = properties.indexdata[1] if mpshapes then local scale = 10 * details.parameters.size/details.parameters.designsize - local units = details.parameters.units + local units = mpshapes.units or details.parameters.units local factor = units * bpfactor / scale local fixdepth = mpshapes.fixdepth + local usecolor = mpshapes.usecolor + -- todo: each mp a table with properties (like using d0 / d1) local function mpstopdf(mp,data) local width = data.width if decompress then mp = decompress(mp) end - local pdf = metapost.simple("metafun",mp,true) -- can be sped up, minifun + local pdf = metapost.simple(mpshapes.instance,mp,true) -- can be sped up, minifun local width = width * factor - if fixdepth then + if usecolor then + return f_stream_c(width,pdf), width + elseif fixdepth then local depth = data.depth or 0 local height = data.height or 0 if depth ~= 0 or height ~= 0 then diff --git a/tex/context/base/mkiv/lxml-lpt.lua b/tex/context/base/mkiv/lxml-lpt.lua index 392c1a401..5bcdfbabc 100644 --- a/tex/context/base/mkiv/lxml-lpt.lua +++ b/tex/context/base/mkiv/lxml-lpt.lua @@ -614,27 +614,6 @@ local lp_doequal = P("=") / "==" local lp_or = P("|") / " or " local lp_and = P("&") / " and " --- local lp_builtin = ( --- P("text") / "(ll.dt[1] or '')" + -- fragile --- P("content") / "ll.dt" + --- P("name") / "((ll.ns~='' and ll.ns..':'..ll.tg) or ll.tg)" + --- P("tag") / "ll.tg" + --- P("position") / "l" + -- is element in finalizer --- P("firstindex") / "1" + --- P("lastindex") / "(#ll.__p__.dt or 1)" + --- P("firstelement") / "1" + --- P("lastelement") / "(ll.__p__.en or 1)" + --- P("first") / "1" + --- P("last") / "#list" + --- P("rootposition") / "order" + --- P("order") / "order" + --- P("element") / "(ll.ei or 1)" + --- P("index") / "(ll.ni or 1)" + --- P("match") / "(ll.mi or 1)" + --- P("namespace") / "ll.ns" + --- P("ns") / "ll.ns" --- ) * ((spaces * P("(") * spaces * P(")"))/"") - local builtin = { text = "(ll.dt[1] or '')", -- fragile content = "ll.dt", @@ -647,6 +626,8 @@ local builtin = { lastindex = "(#ll.__p__.dt or 1)", lastelement = "(ll.__p__.en or 1)", last = "#list", + list = "list", + self = "ll", rootposition = "order", order = "order", element = "(ll.ei or 1)", @@ -654,6 +635,7 @@ local builtin = { match = "(ll.mi or 1)", namespace = "ll.ns", ns = "ll.ns", + } local lp_builtin = lpeg.utfchartabletopattern(builtin)/builtin * ((spaces * P("(") * spaces * P(")"))/"") @@ -806,7 +788,9 @@ end local function register_expression(expression) local converted = lpegmatch(converter,expression) - local runner = load(format(template_e,converted)) + local wrapped = format(template_e,converted) + local runner = load(wrapped) + -- print(wrapped) runner = (runner and runner()) or function() errorrunner_e(expression,converted) end return { kind = "expression", expression = expression, converted = converted, evaluator = runner } end @@ -1306,6 +1290,21 @@ expressions.count = function(e,pattern) -- what if pattern == empty or nil return pattern and (collected and #collected) or 0 end +expressions.attribute = function(e,name,value) + if type(e) == "table" and name then + local a = e.at + if a then + local v = a[name] + if value then + return v == value + else + return v + end + end + end + return nil +end + -- external -- expressions.oneof = function(s,...) @@ -1371,7 +1370,7 @@ function expressions.contains(str,pattern) return false end -function xml.expressions.idstring(str) +function expressions.idstring(str) return type(str) == "string" and gsub(str,"^#","") or "" end diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua index 6a9e3c2cc..9ab8cafc6 100644 --- a/tex/context/base/mkiv/lxml-tex.lua +++ b/tex/context/base/mkiv/lxml-tex.lua @@ -337,7 +337,7 @@ do noferrors = noferrors + 1 errors[filename] = errors[filename] + 1 end - errorhandler(filename) + errorhandler(message) -- (filename) end logs.registerfinalactions(function() diff --git a/tex/context/base/mkiv/meta-imp-symbols.mkxl b/tex/context/base/mkiv/meta-imp-symbols.mkxl new file mode 100644 index 000000000..7d4cb4005 --- /dev/null +++ b/tex/context/base/mkiv/meta-imp-symbols.mkxl @@ -0,0 +1,99 @@ +%D \module +%D [ file=meta-imp-symbols, +%D version=2019.10.01, +%D title=\METAPOST\ Graphics, +%D subtitle=Symbols, +%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. + +%D This is an (experimental) prelude to more. + +\startMPcalculation{simplefun} + + pen SymbolPen ; SymbolPen := pencircle scaled 1/4 ; + + vardef SymbolBullet = fill unitcircle scaled 3 shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x2022 • + vardef SymbolDash = draw (origin--right) scaled 3 shifted (1.5,3.0) withpen SymbolPen scaled 2 enddef ; % 0x2013 – + vardef SymbolTriangle = draw unittriangle scaled 3 shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x25B6 ⊳ + vardef SymbolCircle = fill unitcircle scaled 3 shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x2218 ∘ + vardef SymbolSquare = draw unitsquare scaled (3-1/16) shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x25A1 □ + vardef SymbolDiamond = draw unitdiamond scaled 3 shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x22C4 ⋄ + vardef SymbolBlackTriangle = fillup unittriangle scaled (3-1/16) shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x25B6 ▶ + vardef SymbolBlackSquare = fillup unitsquare scaled (3-1/16) shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x25A0 ■ + vardef SymbolBlackDiamond = fillup unitdiamond scaled (3-1/16) shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x25C6 ◆ + + vardef SymbolNotDef = + draw center unitcircle + scaled 3 + shifted (1.5,1.5) + withpen SymbolPen scaled 4 + enddef ; + + vardef SymbolStar = % 0x22C6 % ⋆ + SymbolNotDef + enddef ; + + vardef SymbolCheckmark = % 0x2713 ✓ + SymbolNotDef + enddef ; + + vardef SymbolAsterisk = % 0x2217 ∗ + SymbolNotDef + enddef ; + + % We could set code directly to the meaning of the macro. + + lmt_registerglyphs [ + name = "symbols", + units = 10, + usecolor = true, + width = 6, + height = 6, + depth = 0, + code = "SymbolNotDef ;", + ] ; + + lmt_registerglyph [ category = "symbols", unicode = "0x2022", code = "SymbolBullet ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x2013", code = "SymbolDash ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x22C6" ] ; % , code = "SymbolStar ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x22B3", code = "SymbolTriangle ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x2218", code = "SymbolCircle ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x25A1", code = "SymbolSquare ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x22C4", code = "SymbolDiamond ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x2713" ] ; % , code = "SymbolCheckmark ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x2217" ] ; % , code = "SymbolAsterisk ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x25B6", code = "SymbolBlackTriangle ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x25A0", code = "SymbolBlackSquare ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x25C6", code = "SymbolBlackDiamond ;" ] ; + +\stopMPcalculation + +\continueifinputfile{meta-imp-symbols.mkxl} + +\usemodule[article-basic] \setupbodyfont[pagella] + +\starttext + +\definefontfeature[metasymbols][mps=symbols] + +\definefont[MyFont] [Serif*default,metasymbols sa 1] + +Some metasymbols: + +\startitem {\MyFont • □ ◆}\quad Regular rendering. \stopitem +\startitem {\MyFont\red • □ ◆}\quad Rendering with color. \stopitem +\startitem {\MyFont\blue\showglyphs • □ ◆}\quad Idem but with boundingboxes shown. \stopitem + +And some more: + +\startlines + • – ⋆ ⊳ ∘ □ ⋄ ✓ ∗ ▶ ■ ◆ + {\MyFont • – ⋆ ⊳ ∘ □ ⋄ ✓ ∗ ▶ ■ ◆} +\stoplines + +\stoptext diff --git a/tex/context/base/mkiv/meta-ini.mkxl b/tex/context/base/mkiv/meta-ini.mkxl index 745bd9268..e08aa560a 100644 --- a/tex/context/base/mkiv/meta-ini.mkxl +++ b/tex/context/base/mkiv/meta-ini.mkxl @@ -225,6 +225,8 @@ \defineMPinstance[binarypost] [\s!format=mpost,\c!method=\s!binary] \defineMPinstance[decimalpost][\s!format=mpost,\c!method=\s!decimal] +\defineMPinstance[simplefun] [\s!format=metafun,\c!method=\s!double] % maybe use minifun + %defineMPinstance[megapost] [\s!format=mpost,\c!method=\s!decimal] \newconditional\c_meta_include_initializations diff --git a/tex/context/base/mkiv/mlib-lmp.lua b/tex/context/base/mkiv/mlib-lmp.lua index dc130c2fd..e72ddd03c 100644 --- a/tex/context/base/mkiv/mlib-lmp.lua +++ b/tex/context/base/mkiv/mlib-lmp.lua @@ -154,3 +154,19 @@ function mp.lmt_svg_include() mpdirect(metacode) end end + +if CONTEXTLMTXMODE > 0 then + + local dropins = fonts.dropins + local registerglyphs = dropins.registerglyphs + local registerglyph = dropins.registerglyph + + function mp.lmt_register_glyph() + registerglyph(metapost.getparameterset("mpsglyph")) + end + + function mp.lmt_register_glyphs() + registerglyphs(metapost.getparameterset("mpsglyphs")) + end + +end diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua index 29ef334f1..5af1ccb68 100644 --- a/tex/context/base/mkiv/mlib-lua.lua +++ b/tex/context/base/mkiv/mlib-lua.lua @@ -771,6 +771,7 @@ do metapost.registerscript("namedcolor",function() mpprint(mpnamedcolor(scanstring())) +-- test: return mpnamedcolor(scanstring()) end) end diff --git a/tex/context/base/mkiv/mlib-run.lua b/tex/context/base/mkiv/mlib-run.lua index bf7c8a796..e9d460472 100644 --- a/tex/context/base/mkiv/mlib-run.lua +++ b/tex/context/base/mkiv/mlib-run.lua @@ -518,6 +518,7 @@ function metapost.pushformat(specification,f,m) -- was: instance, name, method local usedinstance = instance .. ":" .. nofformats local mpx = mpxformats [usedinstance] local mpp = mpxpreambles[instance] or "" + -- report_metapost("push instance %a (%S)",usedinstance,mpx) if preamble then preamble = prepareddata(preamble) mpp = mpp .. "\n" .. preamble @@ -851,10 +852,11 @@ do end, } - function metapost.simple(format,code,useextensions) + function metapost.simple(instance,code,useextensions) + -- can we pickup the instance ? local mpx = metapost.pushformat { - instance = "simplefun", - format = "metafun", + instance = instance or "simplefun", + format = "metafun", -- or: minifun method = "double", } metapost.process { diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index e62e508a4..0d100562d 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index b84c61b2e..41c98c12c 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/fonts/mkiv/type-imp-cambria.mkiv b/tex/context/fonts/mkiv/type-imp-cambria.mkiv index 06781a8d0..0ccb4409e 100644 --- a/tex/context/fonts/mkiv/type-imp-cambria.mkiv +++ b/tex/context/fonts/mkiv/type-imp-cambria.mkiv @@ -39,7 +39,7 @@ \stoptypescript % We load a goodies file that will apply a patch to the font. As a demonstration - % we apply the patch when caching as as when scaling which is why we also specify + % we apply the patch when caching and when scaling which is why we also specify % the goodies file with the name. \starttypescript [\s!math] [cambria,cambria-m,cambria-a] [\s!name] diff --git a/tex/context/fonts/mkiv/type-imp-dejavu.mkiv b/tex/context/fonts/mkiv/type-imp-dejavu.mkiv index 3af9d2d17..ee1e9f383 100644 --- a/tex/context/fonts/mkiv/type-imp-dejavu.mkiv +++ b/tex/context/fonts/mkiv/type-imp-dejavu.mkiv @@ -43,8 +43,8 @@ \starttypescript [\s!math][dejavu][\s!name] \loadfontgoodies[dejavu-math] - \definefontsynonym[\s!MathRoman] [file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=dejavu-math] - \definefontsynonym[\s!MathRomanBold][file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,dejavu-math-bold,mathextra},\s!goodies=schola-math] + \definefontsynonym[\s!MathRoman] [\s!file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=dejavu-math] + \definefontsynonym[\s!MathRomanBold][\s!file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,dejavu-math-bold,mathextra},\s!goodies=dejavu-math] \stoptypescript \starttypescript[dejavu] diff --git a/tex/context/fonts/mkiv/type-imp-texgyre.mkiv b/tex/context/fonts/mkiv/type-imp-texgyre.mkiv index 583da77c1..72d3b3588 100644 --- a/tex/context/fonts/mkiv/type-imp-texgyre.mkiv +++ b/tex/context/fonts/mkiv/type-imp-texgyre.mkiv @@ -248,7 +248,7 @@ % \loadfontgoodies[texgyre] % \definefontsynonym[\s!MathRoman][file:texgyre-termes-math-regular.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=texgyre] \definefontsynonym[\s!MathRoman] [file:texgyretermes-math.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=termes-math] - \definefontsynonym[\s!MathRomanBold][file:texgyretermes-math.otf][\s!features={\s!math\mathsizesuffix,termes-math-bold,mathextra},\s!goodies=schola-math] + \definefontsynonym[\s!MathRomanBold][file:texgyretermes-math.otf][\s!features={\s!math\mathsizesuffix,termes-math-bold,mathextra},\s!goodies=termes-math] \stoptypescript \stoptypescriptcollection @@ -277,7 +277,7 @@ % \loadfontgoodies[texgyre] % \definefontsynonym[\s!MathRoman][file:texgyre-pagella-math-regular.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=texgyre] \definefontsynonym[\s!MathRoman] [file:texgyrepagella-math.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=pagella-math] - \definefontsynonym[\s!MathRomanBold][file:texgyrepagella-math.otf][\s!features={\s!math\mathsizesuffix,pagella-math-bold,mathextra},\s!goodies=schola-math] + \definefontsynonym[\s!MathRomanBold][file:texgyrepagella-math.otf][\s!features={\s!math\mathsizesuffix,pagella-math-bold,mathextra},\s!goodies=pagella-math] \stoptypescript \stoptypescriptcollection @@ -290,7 +290,7 @@ % \loadfontgoodies[texgyre] % \definefontsynonym[\s!MathRoman][file:texgyre-bonum-math-regular.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=texgyre] \definefontsynonym[\s!MathRoman] [file:texgyrebonum-math.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=bonum-math] - \definefontsynonym[\s!MathRomanBold][file:texgyrebonum-math.otf][\s!features={\s!math\mathsizesuffix,bonum-math-bold,mathextra},\s!goodies=schola-math] + \definefontsynonym[\s!MathRomanBold][file:texgyrebonum-math.otf][\s!features={\s!math\mathsizesuffix,bonum-math-bold,mathextra},\s!goodies=bonum-math] \stoptypescript \stoptypescriptcollection @@ -305,5 +305,3 @@ \stoptypescript \stoptypescriptcollection - - diff --git a/tex/context/interface/mkii/keys-de.xml b/tex/context/interface/mkii/keys-de.xml index b9cd9cc05..5d1009959 100644 --- a/tex/context/interface/mkii/keys-de.xml +++ b/tex/context/interface/mkii/keys-de.xml @@ -237,6 +237,7 @@ + diff --git a/tex/context/interface/mkii/keys-nl.xml b/tex/context/interface/mkii/keys-nl.xml index 55e0ff335..cb6ebc68d 100644 --- a/tex/context/interface/mkii/keys-nl.xml +++ b/tex/context/interface/mkii/keys-nl.xml @@ -237,6 +237,7 @@ + diff --git a/tex/context/interface/mkii/keys-pe.xml b/tex/context/interface/mkii/keys-pe.xml index 86f8f49c9..2fcb76c9f 100644 --- a/tex/context/interface/mkii/keys-pe.xml +++ b/tex/context/interface/mkii/keys-pe.xml @@ -237,6 +237,7 @@ + @@ -643,6 +644,7 @@ + @@ -872,6 +874,7 @@ + @@ -972,9 +975,12 @@ + + + @@ -1292,6 +1298,7 @@ + @@ -1302,6 +1309,7 @@ + @@ -1309,6 +1317,7 @@ + diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf index 8471d15b4..51102b6e7 100644 Binary files a/tex/context/interface/mkiv/i-context.pdf and b/tex/context/interface/mkiv/i-context.pdf differ diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf index 87356b5f9..41e4b2392 100644 Binary files a/tex/context/interface/mkiv/i-readme.pdf and b/tex/context/interface/mkiv/i-readme.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 9e38b5e5c..9d036f3ec 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 10/02/19 12:43:06 +-- merge date : 10/04/19 17:44:12 do -- begin closure to overcome local limits and interference -- cgit v1.2.3