diff options
author | Hans Hagen <pragma@wxs.nl> | 2023-05-27 23:41:49 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2023-05-27 23:41:49 +0200 |
commit | ca9e3e4bd07d6d644818ffcfe746030923031afd (patch) | |
tree | 2999b914eeb660af4b55156604419fe0bf37ad6a /tex | |
parent | 32381f97e98465953bfde24b4436093e70fbe70f (diff) | |
download | context-ca9e3e4bd07d6d644818ffcfe746030923031afd.tar.gz |
2023-05-27 23:25:00
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/mkii/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkii/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/status-files.pdf | bin | 24659 -> 24658 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/status-lua.pdf | bin | 270690 -> 270731 bytes | |||
-rw-r--r-- | tex/context/base/mkxl/cont-new.mkxl | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/context.mkxl | 4 | ||||
-rw-r--r-- | tex/context/base/mkxl/spac-brk.lmt | 235 | ||||
-rw-r--r-- | tex/context/base/mkxl/spac-brk.mkxl | 43 | ||||
-rw-r--r-- | tex/context/base/mkxl/toks-aux.lmt | 9 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
12 files changed, 292 insertions, 11 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 35e9fb615..e2f277db9 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{2023.05.27 12:11} +\newcontextversion{2023.05.27 23:23} %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 8737d7c70..459078b2f 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{2023.05.27 12:11} +\edef\contextversion{2023.05.27 23:23} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 596dd0299..b3ef836ce 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{2023.05.27 12:11} +\newcontextversion{2023.05.27 23:23} %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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index c5be65048..c564ee74c 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -49,7 +49,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2023.05.27 12:11} +\edef\contextversion{2023.05.27 23:23} %D Kind of special: diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex dff0084d6..a3b95216b 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 3c16a859d..85a68d14d 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index fb9c31af8..81d56e507 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{2023.05.27 12:11} +\newcontextversion{2023.05.27 23:23} %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 73864fbe6..74f8b3bfc 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{2023.05.27 12:11} +\immutable\edef\contextversion{2023.05.27 23:23} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error @@ -448,6 +448,8 @@ \loadmklxfile{type-ini} \loadmkxlfile{type-set} +\loadmkxlfile{spac-brk} + \loadmkxlfile{scrp-ini} \loadmkxlfile{symb-emj} diff --git a/tex/context/base/mkxl/spac-brk.lmt b/tex/context/base/mkxl/spac-brk.lmt new file mode 100644 index 000000000..e534faa0e --- /dev/null +++ b/tex/context/base/mkxl/spac-brk.lmt @@ -0,0 +1,235 @@ +if not modules then modules = { } end modules ['spac-brk'] = { + version = 1.001, + comment = "companion to spac-brk.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local next, type, tonumber, tostring = next, type, tonumber, tostring + +local settings_to_array = utilities.parsers.settings_to_array +local settings_to_hash = utilities.parsers.settings_to_hash + +local nuts = nodes.nuts +local tonut = nodes.tonut + +local newrule = nuts.pool.virtualrule +local insertbefore = nuts.insertbefore +local insertafter = nuts.insertafter +local hpack_string = nuts.typesetters.tohpack +local getwidth = nuts.getwidth +local getid = nuts.getid +local getprev = nuts.getprev +local getnext = nuts.getnext +local setwhd = nuts.setwhd +local getlist = nuts.getlist +local setoffsets = nuts.setoffsets + +local setcolor = nodes.tracers.colors.set +local settransparency = nodes.tracers.transparencies.set + +local texgetnest = tex.getnest +local texgetcount = tex.getcount + +local nodecodes = nodes.nodecodes + +local penalty_code = nodecodes.penalty +local glue_code = nodecodes.glue +local disc_code = nodecodes.disc +local math_code = nodecodes.math + +local breakcodes = tex.breakcodes + +local registercallback = callback.register + +local c_tracinglousiness = tex.iscount("tracinglousiness") + +local alignments = { } +typesetters.alignments = alignments + +typesetters = typesetters or { } +local breakpoints = typesetters.breakpoints or { } +typesetters.breakpoints = breakpoints + +local width = 65536 / 2 +local height = 9 * 65536 +local depth = 3 * 65536 +local xoffset = 1 * 65536 +local yoffset = -3 * 65536 + +local serial = false +local usedfont = false +local nestlevel = false +local overload = false +local order = 0 + +local report = logs.reporter("linebreaks") + +local actions = { + [breakcodes.initialize] = function() + if texgetnest("ptr") == nestlevel then + usedfont = nodes.visualizers.getusedfont() + serial = false + order = order + 1 + end + end, + [breakcodes.start] = function(pass) + if texgetnest("ptr") == nestlevel then + if pass == 2 then + serial = { } + end + end + end, + [breakcodes.report] = function(pass,currentserial,previousserial,line,kind,class,demerits,breakpoint,short,glue) + if serial and breakpoint and texgetnest("ptr") == nestlevel then + local s = { + serial = currentserial, + demerits = demerits, + breakpoint = breakpoint, + } + serial[currentserial] = s + local found = overload and overload[currentserial] + if found then + report("pass %i, overloading serial %i.%i demerits from %i to %i",2,order,currentserial,demerits,found) + return found + end + end + return demerits + end, + [breakcodes.collect] = function() + if serial and texgetnest("ptr") == nestlevel and texgetcount(c_tracinglousiness) >= 1 then + for currentserial=1,#serial do + local data = serial[currentserial] + local breakpoint = data.breakpoint + local current = tonut(breakpoint) + while current do + local id = getid(current) + if id == penalty_code or id == glue_code or id == kern_code or id == math_code then + current = getprev(current) + else + break + end + end + if current then + local rule = newrule(width,height,depth,currentserial) + data.rule = rule + insertafter(current,current,rule) + end + end + end + end, + [breakcodes.wrapup] = function() + if serial and texgetnest("ptr") == nestlevel then + local n = #serial + local trace = texgetcount(c_tracinglousiness) + if trace >= 2 then + report("%i demerits in set %i",n,order) + end + for currentserial=1,n do + local data = serial[currentserial] + local demerits = data.demerits + if trace >= 1 then + local rule = data.rule + if rule then + local tag = tostring(order).."."..tostring(currentserial) + local text = hpack_string(tag,usedfont) + local size = getwidth(text) + setwhd(text,0,0,0) + setoffsets(text,-size-xoffset,yoffset) + insertafter(rule,rule,text) + end + end + serial[currentserial] = demerits + if trace >= 2 then + report("% 4i : %8i",currentserial,demerits) + end + end + overload = false + registercallback("show_break") + end + end, +} + +local function action(what,...) + local action = actions[what] + if action then + return action(...) + end +end + +local function show(str) + nestlevel = texgetnest("ptr") + if str and str ~= "" then + if type(str) == "table" then + overload = str + else + overload = settings_to_hash(str) + for k, v in next, overload do + overload[tonumber(k)] = tonumber(v) or -1 + end + end + else + overload = false + end + registercallback("show_break", action) +end + +local function last() + return serial or { } +end + +typesetters.breakpoints.show = show +typesetters.breakpoints.last = last + +-- interface + +local context = context +local scaninteger = tokens.scanners.integer + +local function feedback() + local l = last() + local n = #l + if n > 0 then + local t = { n } + local m = 1 + for i=1,#l do + m = m + 1 ; t[m] = i + m = m + 1 ; t[m] = l[i] + end + context("% t",t) + end +end + +interfaces.implement { + name = "lousiness", + public = true, + protected = true, + usage = "value", + actions = function(what) + if what == "value" then + feedback() + else + local n = scaninteger() + local t = { } + for i=1,n do + t[scaninteger()] = scaninteger() + end + show(t) + end + end, +} + +interfaces.implement { + name = "silliness", + public = true, + protected = true, + usage = "value", + actions = function(what) + if what == "value" then + feedback() + else + show { [scaninteger()] = 0 } + end + end, +} diff --git a/tex/context/base/mkxl/spac-brk.mkxl b/tex/context/base/mkxl/spac-brk.mkxl new file mode 100644 index 000000000..8926e1b4d --- /dev/null +++ b/tex/context/base/mkxl/spac-brk.mkxl @@ -0,0 +1,43 @@ +%D \module +%D [ file=spac-brk, +%D version=2023.05.23, +%D title=\CONTEXT\ Spacing Macros, +%D subtitle=Breaking lines, +%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. + +\ifdefined\tracinglousiness \endinput \fi + +\writestatus{loading}{ConTeXt Spacing Macros / Breakpoints} + +\newcount\tracinglousiness + +\registerctxluafile{spac-brk}{} + +%D This is a very experimental feature and a by product of improving inline math +%D crossing lines. As it might evolve: use with care. + +% \setuplayout[width=8cm] +% \starttext +% \setupalign[verytolerant] +% \tracinglousiness1 +% % \tracinglousiness2 +% \samplefile{ward} \blank +% % \ctxlua{typesetters.breakpoints.show("11=0")} \samplefile{ward} \blank +% % \ctxlua{typesetters.breakpoints.show{ [11] = 0 }} \samplefile{ward} \blank +% \lousiness 1 11 0 \samplefile{ward} \blank +% \silliness 11 \samplefile{ward} \blank +% {\tt \the\lousiness} +% \stoptext + + +\unprotect + +% nothing hereyet + +\protect \endinput diff --git a/tex/context/base/mkxl/toks-aux.lmt b/tex/context/base/mkxl/toks-aux.lmt index d9adb1d67..d2b47ba27 100644 --- a/tex/context/base/mkxl/toks-aux.lmt +++ b/tex/context/base/mkxl/toks-aux.lmt @@ -197,10 +197,11 @@ tex.listanchorcodes = getthem(tex.getlistanchorvalues, "listanchorco tex.listsigncodes = getthem(tex.getlistsignvalues, "listsigncode") tex.classoptioncodes = getthem(tex.getmathclassoptionvalues, "classoptioncode") ---.alignmentcontextcodes = getthem(tex.getalignmentcontextvalues ) -- only at lua end -tex.specialmathclasscodes = getthem(tex.getspecialmathclassvalues ) -- only at lua end -tex.directioncodes = getthem(tex.getdirectionvalues ) -- only at lua end (todo tex) -tex.fillcodes = getthem(tex.getfillvalues ) -- only at lua end (todo tex) -tex.mathparametercodes = getthem(tex.getmathparametervalues ) -- only at lua end (todo tex) +tex.specialmathclasscodes = getthem(tex.getspecialmathclassvalues ) -- idem +tex.directioncodes = getthem(tex.getdirectionvalues ) -- idem +tex.fillcodes = getthem(tex.getfillvalues ) -- idem +tex.mathparametercodes = getthem(tex.getmathparametervalues ) -- idem +tex.breakcodes = getthem(tex.getbreakcontextvalues ) -- idem function tex.stringtocodesbitmap(str,codes) local bitmap = 0 diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 29ab7c585..3dfd09687 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 : 2023-05-27 12:11 +-- merge date : 2023-05-27 23:23 do -- begin closure to overcome local limits and interference |