diff options
Diffstat (limited to 'tex/context/base/mkxl')
-rw-r--r-- | tex/context/base/mkxl/cont-new.mkxl | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/context.mkxl | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/core-uti.lmt (renamed from tex/context/base/mkxl/core-uti.lua) | 59 | ||||
-rw-r--r-- | tex/context/base/mkxl/meta-imp-kindergarten.mkxl | 118 | ||||
-rw-r--r-- | tex/context/base/mkxl/meta-imp-placeholders.mkxl | 83 | ||||
-rw-r--r-- | tex/context/base/mkxl/meta-imp-txt.lmt | 116 | ||||
-rw-r--r-- | tex/context/base/mkxl/mlib-pps.lmt | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/page-imp.mkxl | 9 | ||||
-rw-r--r-- | tex/context/base/mkxl/typo-bld.lmt | 2 |
9 files changed, 344 insertions, 49 deletions
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 70b47d75d..3fedf6b5b 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.07.21 19:51} +\newcontextversion{2021.07.22 19:11} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 67ecc671c..b517cf7b9 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2021.07.21 19:51} +\immutable\edef\contextversion{2021.07.22 19:11} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/core-uti.lua b/tex/context/base/mkxl/core-uti.lmt index 887ef9a75..1bb50060d 100644 --- a/tex/context/base/mkxl/core-uti.lua +++ b/tex/context/base/mkxl/core-uti.lmt @@ -348,30 +348,6 @@ function job.loadother(filename) statistics.stoptiming(_load_) end --- function job.keep(filename) --- local suffix = file.suffix(filename) --- local base = file.removesuffix(filename) --- if suffix == "" then --- suffix = "tuc" --- end --- for i=1,10 do --- local tmpname = format("%s-%s-%02d.tmp",base,suffix,i) --- if lfs.isfile(tmpname) then --- os.remove(tmpname) --- report_passes("removing %a",tmpname) --- end --- end --- if lfs.isfile(filename) then --- local tmpname = format("%s-%s-%02d.tmp",base,suffix,environment.currentrun or 1) --- report_passes("copying %a into %a",filename,tmpname) --- file.copy(filename,tmpname) --- else --- report_passes("no file %a, nothing kept",filename) --- end --- end - --- eventually this will end up in strc-ini - statistics.register("startup time", function() return statistics.elapsedseconds(statistics,"including runtime option file processing") end) @@ -393,17 +369,16 @@ statistics.register("jobdata time",function() end) statistics.register("callbacks", function() - local c_internal = status.callbacks or 0 - local c_file = status.indirect_callbacks or 0 - local c_direct = status.direct_callbacks or 0 - local c_late = backends.getcallbackstate().count - local c_function = status.function_callbacks or 0 - local c_total = c_internal + c_file + c_direct + c_late + c_function - local n_pages = structures.pages.nofpages or 0 - local c_average = n_pages > 0 and math.round(c_total/n_pages) or 0 - local result = format ( - "internal: %s, file: %s, direct: %s, late: %s, function %s, total: %s (%s per page)", - c_internal, c_file, c_direct, c_late, c_function, c_total, c_average + local backend = backends.getcallbackstate() + local frontend = status.getcallbackstate() + local pages = structures.pages.nofpages or 0 + local total = frontend.count + backend.count + local average = pages > 0 and math.round(total/pages) or 0 + local result = format ( + "file: %s, saved: %s, direct: %s, function: %s, value: %s, message: %s, bytecode: %s, late %s, total: %s (%s per page)", + frontend.file, frontend.saved, frontend.direct, frontend["function"], + frontend.value, frontend.message, frontend.bytecode, backend.count, + total, average ) statistics.callbacks = function() return result @@ -417,15 +392,6 @@ statistics.register("randomizer", function() end end) --- a sort of joke (for ctx meeting) - --- local kg_per_watt_per_second = 1 / 15000000 --- local watts_per_core = 50 --- local speedup_by_other_engine = 1.2 --- local used_wood_factor = watts_per_core * kg_per_watt_per_second / speedup_by_other_engine --- local used_wood_factor = (50 / 15000000) / 1.2 - - function statistics.formatruntime(runtime) if not environment.initex then -- else error when testing as not counters yet -- stoptiming(statistics) -- to be sure @@ -448,9 +414,10 @@ function statistics.formatruntime(runtime) end implement { - name = "savevariable", + name = "savecurrentvalue", + public = true, actions = job.variables.save, - arguments = "2 strings", + arguments = { "csname", "argument" }, } implement { diff --git a/tex/context/base/mkxl/meta-imp-kindergarten.mkxl b/tex/context/base/mkxl/meta-imp-kindergarten.mkxl new file mode 100644 index 000000000..6b2402bf0 --- /dev/null +++ b/tex/context/base/mkxl/meta-imp-kindergarten.mkxl @@ -0,0 +1,118 @@ +%D \module +%D [ file=meta-imp-kindergarten, +%D version=2020.00.00, +%D title=\METAPOST\ Graphics, +%D subtitle=Kindergarten Math, +%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. + +% \nopdfcompression + +%D For Arthur, who told me that about the urban legend that \CONTEXT\ can do only +%D kindergarten math. Somehow I'd forgotten top add this to the distribution + +\startMPcalculation{simplefun} + + pen KindergartenPen ; KindergartenPen := pencircle scaled 1 ; + + % 10 x 10 grid + + vardef KindergartenEqual = + draw image + ( + draw (2,6) -- (9,5) ; + draw (2,4) -- (8,3) ; + ) + shifted (0,-2) + withpen KindergartenPen + withcolor "KindergartenEqual" + enddef ; + vardef KindergartenPlus = + draw image + ( + draw (1,4) -- (9,5) ; + draw (4,1) -- (5,8) ; + ) + shifted (0,-2) + withpen KindergartenPen + withcolor "KindergartenPlus" + enddef ; + vardef KindergartenMinus = + draw image + ( + draw (1,5) -- (9,4) ; + ) + shifted (0,-2) + withpen KindergartenPen + withcolor "KindergartenMinus" + enddef ; + vardef KindergartenTimes = + draw image + ( + draw (2,1) -- (9,8) ; + draw (8,1) -- (2,8) ; + ) + shifted (0,-2) + withpen KindergartenPen + withcolor "KindergartenTimes" + enddef ; + vardef KindergartenDivided = + draw image + ( + draw (2,1) -- (8,9) ; + ) + shifted (0,-2) + withpen KindergartenPen + withcolor "KindergartenDivided" + enddef ; + + lmt_registerglyphs [ + name = "kindergarten", + units = 10, + % usecolor = true, + width = 10, + height = 8, + depth = 2, + ] ; + + lmt_registerglyph [ category = "kindergarten", unicode = "0x003D", + code = "KindergartenEqual" + ] ; + lmt_registerglyph [ category = "kindergarten", unicode = "0x002B", + code = "KindergartenPlus" + ] ; + lmt_registerglyph [ category = "kindergarten", unicode = "0x2212", + code = "KindergartenMinus" + ] ; + lmt_registerglyph [ category = "kindergarten", unicode = "0x00D7", + code = "KindergartenTimes" + ] ; + lmt_registerglyph [ category = "kindergarten", unicode = "0x002F", + code = "KindergartenDivided" + ] ; + +\stopMPcalculation + +\definecolor[KindergartenEqual] [darkgreen] +\definecolor[KindergartenPlus] [darkred] +\definecolor[KindergartenMinus] [darkred] +\definecolor[KindergartenTimes] [darkblue] +\definecolor[KindergartenDivided][darkblue] + +\continueifinputfile{meta-imp-kindergarten.mkxl} + +\definefontfeature + [mathextra] + [metapost=kindergarten] + +\setupbodyfont[dejavu] + +\startTEXpage[offset=10pt] + $ y = 2 \times x + a - b / 3 $ \par + \hfill \infofont{kindergarten math} +\stopTEXpage diff --git a/tex/context/base/mkxl/meta-imp-placeholders.mkxl b/tex/context/base/mkxl/meta-imp-placeholders.mkxl new file mode 100644 index 000000000..aa48b814c --- /dev/null +++ b/tex/context/base/mkxl/meta-imp-placeholders.mkxl @@ -0,0 +1,83 @@ +%D \module +%D [ file=meta-imp-placeholders, +%D version=2021.02.01, +%D title=\METAPOST\ Graphics, +%D subtitle=Missing Glyph Placeholders, +%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 a drop in for the already existing placeholder function. It could be made +%D more clever by hashing similar shapes but as this is mostly a diagnostic feature +%D we go a quick an ddirty two dimensional array. + +%D It is now mostly a file one can run to get an idea what the replace macro triggers +%D so I've added it to the distribution. + +% \startMPcalculation{simplefun} +% loadfile("mp-miss.mpxl") ; +% \stopMPcalculation +% +% \startluacode +% +% local chardata = characters.data +% local fontdata = fonts.hashes.identifiers +% local mapping = fonts.checkers.mapping +% +% function fonts.checkers.placeholder(font,char) +% local category = chardata[char].category or "lu" -- todo: unknown +% local fakedata = mapping[category] +% local tfmdata = fontdata[font] +% local units = tfmdata.parameters.units or 1000 +% local slant = (tfmdata.parameters.slant or 0)/65536 +% local scale = units/1000 +% local rawdata = tfmdata.shared and tfmdata.shared.rawdata +% local weight = (rawdata and rawdata.metadata and rawdata.metadata.pfmweight or 400)/400 +% local specification = { +% code = "MissingGlyph", +% scale = scale, +% slant = slant, +% weight = weight, +% namespace = font, +% shapes = { { shape = fakedata[1], color = fakedata[2] } }, +% } +% fonts.helpers.setmetaglyphs("missing", font, char, specification) +% end +% +% \stopluacode + +%D We enable the checker: + +% \enabletrackers[fonts.missing=replace] + +\replacemissingcharacters + +\continueifinputfile{meta-imp-placeholders.mkxl} + +% \enableexperiments[fonts.compact] + +% \showglyphs + +\startbuffer + \startlines[before=,after=] + \strut {\tf test \char 12345\ test \char 12346\ test} + \strut {\bf test \char 12345\ test \char 12346\ test} + \strut {\it test \char 12345\ test \char 12346\ test} + \strut {\bi test \char 12345\ test \char 12346\ test} + \strut {test ὀ ρ φ α ν ῖ ο ς test} + \stoplines +\stopbuffer + +\starttext + \startTEXpage[offset=2pt,strut=no] + \getbuffer + \switchtobodyfont[pagella] + \getbuffer + \switchtobodyfont[dejavu] + \getbuffer + \stopTEXpage +\stoptext diff --git a/tex/context/base/mkxl/meta-imp-txt.lmt b/tex/context/base/mkxl/meta-imp-txt.lmt new file mode 100644 index 000000000..e4b88bd36 --- /dev/null +++ b/tex/context/base/mkxl/meta-imp-txt.lmt @@ -0,0 +1,116 @@ +if not modules then modules = { } end modules ['meta-imp-txt'] = { + version = 1.001, + comment = "companion to meta-imp-txt.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local setmetatableindex = table.setmetatableindex + +local texset = tex.set + +local scan = mp.scan +local scannumeric = scan.numeric +local scaninteger = scan.integer +local scanboolean = scan.boolean +local scanstring = scan.string + +local expandmacro = token.expandmacro -- todo + +local bpfactor = number.dimenfactors.bp + +local metapost = metapost +metapost.parshapes = { } + +local parshapes = { } +local properties = { } + +-- initialize shapes to 0 hsize + +function metapost.parshapes.reset() + parshapes = { } + properties = { } +end + +function metapost.parshapes.next() + properties = { } + parshapes[#parshapes+1] = properties +end + +function metapost.parshapes.inspect() + inspect(parshapes) +end + +function metapost.parshapes.getshape(n) + return (parshapes and parshapes[n]) or parshapes or nil +end + +function metapost.parshapes.get(index,name) + local v = parshapes[index][name] + if type(v) == "boolean" then + context(v and 1 or 0) + else + context(v) + end +end + +function metapost.parshapes.wholeshape() -- maybe just collect them earlier + local t, n = { }, 0 + for i=1,#parshapes do + local s = parshapes[i].shape + if s then + for i=1,#s do + n = n + 1 + t[n] = s[i] + end + end + end + if n > 0 then + texset("parshape",t) + end +end + +metapost.registerscript("setparshapeproperty", function() + local k = scanstring() + if k == "line" then + local entry = properties.shape[scannumeric()] + local indent = scannumeric() / bpfactor + local width = scannumeric() / bpfactor + entry[1] = indent + entry[2] = width + elseif k == "lines" then + properties.lines = scaninteger() + properties.shape = setmetatableindex(function(t,k) + local v = { 0, properties.width or 0 } + t[k] = v + return v + end) + elseif k == "first" then + properties[k] = scanboolean() + elseif k == "inspect" then + inspect(properties) + else + properties[k] = scannumeric() / bpfactor + end +end) + +interfaces.implement { + name = "setparagraphmetashape", + public = true, + protected = true, + arguments = "optional", + actions = function(list) + if list and list ~= "" then + list = utilities.parsers.settings_to_array(list) + if #list > 0 then + metapost.parshapes.reset() + for i=1,#list do + metapost.parshapes.next() + expandmacro("spac_shapes_calculate","{"..list[i].."}") + end + metapost.parshapes.wholeshape() + end + end + end +} diff --git a/tex/context/base/mkxl/mlib-pps.lmt b/tex/context/base/mkxl/mlib-pps.lmt index cea8a179d..19535b070 100644 --- a/tex/context/base/mkxl/mlib-pps.lmt +++ b/tex/context/base/mkxl/mlib-pps.lmt @@ -1492,6 +1492,8 @@ local function tr_process(object,prescript,before,after) sp_specs = concat(sp_specs,",") definemultitonecolor(sp_name,sp_specs,"","") sp_type = "named" + elseif sp_type == "named" then + cs = { 1 } -- factor 1 end if sp_type == "named" then -- we might move this to another namespace .. also, named can be a spotcolor diff --git a/tex/context/base/mkxl/page-imp.mkxl b/tex/context/base/mkxl/page-imp.mkxl index 4ee7c159b..676313029 100644 --- a/tex/context/base/mkxl/page-imp.mkxl +++ b/tex/context/base/mkxl/page-imp.mkxl @@ -100,6 +100,15 @@ \installshipoutmethod \v!none {\page_shipouts_ignore} +% \setuppaper[method=rotate,rotation=15] \showframe +% \starttext \dorecurse{10}{\input knuth\endgraf} \stoptext + +\installshipoutmethod\v!rotate + {\page_shipouts_rotate} + +\protected\def\page_shipouts_rotate#1% + {\invokepagehandler\v!normal{\rotate[\c!rotation=\rootlayouttargetparameter\c!rotation]{#1}}} + % extension mechanism \newcount\c_page_boxes_flush_n % set at the lua end diff --git a/tex/context/base/mkxl/typo-bld.lmt b/tex/context/base/mkxl/typo-bld.lmt index 9bd5172e7..d9cd78385 100644 --- a/tex/context/base/mkxl/typo-bld.lmt +++ b/tex/context/base/mkxl/typo-bld.lmt @@ -176,7 +176,7 @@ local function processor(head,followed_by_display) -- todo: not again in otr so we need to flag if enabled then starttiming(parbuilders) - head = actions(head,followed_by_display) + head = tonode(actions(tonut(head),followed_by_display)) stoptiming(parbuilders) return head else |