summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkxl')
-rw-r--r--tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--tex/context/base/mkxl/context.mkxl2
-rw-r--r--tex/context/base/mkxl/driv-shp.lmt36
-rw-r--r--tex/context/base/mkxl/font-mat.mklx30
-rw-r--r--tex/context/base/mkxl/font-pre.mkxl16
-rw-r--r--tex/context/base/mkxl/math-act.lmt35
-rw-r--r--tex/context/base/mkxl/page-imp.mkxl13
-rw-r--r--tex/context/base/mkxl/spac-chr.lmt63
-rw-r--r--tex/context/base/mkxl/trac-vis.lmt4
9 files changed, 111 insertions, 90 deletions
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index 48532ede6..2d953077e 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{2022.11.14 22:54}
+\newcontextversion{2022.11.18 13:15}
%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 d111761b0..47a9ffb4b 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{2022.11.14 22:54}
+\immutable\edef\contextversion{2022.11.18 13:15}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt
index 1dfb73f17..941365f59 100644
--- a/tex/context/base/mkxl/driv-shp.lmt
+++ b/tex/context/base/mkxl/driv-shp.lmt
@@ -640,11 +640,7 @@ interfaces.implement {
arguments = { "integer", "integer", "box" },
actions = function(anchor,where,box)
box = tonut(box)
- if where < 0 then
- insert(befores[anchor],box)
- else
- insert(afters[anchor],box)
- end
+ insert(where < 0 and befores[anchor] or afters[anchor],box)
stored = true
end
}
@@ -655,31 +651,25 @@ local hlist_out, vlist_out do
local flushnode = nuts.flushnode
local function flushstored(current,source,before)
- local s = nil
- if before then
- s = rawget(befores,source)
- else
- s = rawget(afters,source)
- end
+ local t = before and befores or afters
+ local s = rawget(t,source)
if s then
for i=1,#s do
local si = s[i]
if si then
- finalize(si) -- tricky: we might need to group
- if getid(si) == vlist_code then
- vlist_out(current,si)
+ local box = si -- si[1]
+ finalize(box) -- tricky: we might need to group
+-- print(getanchors(box))
+ if getid(box) == vlist_code then
+ vlist_out(current,box)
else
- hlist_out(current,si)
+ hlist_out(current,box)
end
- flushnode(si)
+ flushnode(box)
s[i] = false
end
end
- if before then
- rawset(befores,source,nil)
- else
- rawset(afters,source,nil)
- end
+ rawset(t,source,nil)
end
end
@@ -834,8 +824,8 @@ local hlist_out, vlist_out do
-- cur_h = cur_h + wd - right -- hm, no left here?
cur_h = cur_h + wd -- see new tabulate alignment code
elseif id == glue_code then
--- local gluewidth = effectiveglue(current,this_box)
-local gluewidth = effectiveglue(current,this_box,true)
+ -- local gluewidth = effectiveglue(current,this_box)
+ local gluewidth = effectiveglue(current,this_box,true)
if gluewidth ~= 0 then
if subtype >= leaders_code then
local leader = getleader(current)
diff --git a/tex/context/base/mkxl/font-mat.mklx b/tex/context/base/mkxl/font-mat.mklx
index d9337d1b0..39ed13069 100644
--- a/tex/context/base/mkxl/font-mat.mklx
+++ b/tex/context/base/mkxl/font-mat.mklx
@@ -47,7 +47,8 @@
\ifdefined\??fontinstancebasic \else \installcorenamespace{fontinstancebasic} \fi
\ifdefined\??fontinstanceclass \else \installcorenamespace{fontinstanceclass} \fi
-%D The order 3 2 1 of size matters: needed for math-fbk relative size storage!
+%D The order 3 2 1 of size matters is historic and was needed for math-fbk relative
+%D size storage! It is no longer relevant.
%D \macros
%D {textonly}
@@ -124,13 +125,11 @@
\mutable\let\fontfamily\relax % for now public but it is a helper
-%newconditional\c_math_last_family_set
\newcount \c_math_last_family_used
\def\font_helpers_set_math_family_indeed_normal#mrtag#family% \fontface etc are also used later on
{\let\savedfontbody\fontbody
\let\fontfamily#family%
-% \settrue\c_math_last_family_set
\c_math_last_family_used\zerocount
% the order is important as we depend on known id's when completing fonts
% enabling is needed when we have fallbacks which spoils the families; per
@@ -163,7 +162,6 @@
\def\font_helpers_set_math_family_indeed_compact#mrtag#family% \fontface etc are also used later on
{\let\savedfontbody\fontbody
\let\fontfamily#family%
-% \settrue\c_math_last_family_set
\c_math_last_family_used\zerocount
\font_helpers_set_math_family_set_scales_compact
% the order is important as we depend on known id's when completing fonts
@@ -189,7 +187,6 @@
\let\defaultfontclass\fontclass % else truefontname falls back on the wrong one
\let\savedfontbody\fontbody
\let\fontfamily#familytag%
-% \settrue\c_math_last_family_set
\c_math_last_family_used\zerocount
\font_helpers_set_math_family_set_scales_normal
\let\mathsizesuffix\mathscriptscriptsuffix\let\fontface\!!plusthree
@@ -211,11 +208,10 @@
\let\defaultfontclass\fontclass % else truefontname falls back on the wrong one
\let\savedfontbody\fontbody
\let\fontfamily#familytag%
-% \settrue\c_math_last_family_set
\c_math_last_family_used\zerocount
\let\mathsizesuffix\mathtextsuffix \let\fontface\!!plusone
\font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% defines
-% \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% enables / still needed ?
+ \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% enables / still needed ?
\scriptfont #mbfam\textfont#mbfam% reuses
\scriptscriptfont#mbfam\textfont#mbfam% reuses
\let\mathsizesuffix\empty \let\fontface\!!zerocount
@@ -480,14 +476,6 @@
\mutable\let\bigmathfontsize\empty
-% \permanent\protected\def\synchronizebigmath
-% {\ifx\bigmathfontsize\fontsize
-% % already in sync
-% \else
-% \let\bigmathfontsize\fontsize
-% \font_helpers_synchronize_math
-% \fi}
-
\permanent\protected\def\synchronizebigmath
{\ifconditional\c_font_compact
% no need
@@ -517,18 +505,6 @@
%D This is nasty, as the engine only stores the last set family parameters (per style) which
%D in our case can be bold.
-% \def\font_helpers_synchronize_math_parameters
-% {\textfont \zerocount\textfont \zerocount
-% \scriptfont \zerocount\scriptfont \zerocount
-% \scriptscriptfont\zerocount\scriptscriptfont\zerocount
-% \setfalse\c_math_last_family_set}
-%
-% \appendtoks
-% \ifconditional\c_math_last_family_set
-% \font_helpers_synchronize_math_parameters
-% \fi
-% \to\everybodyfont
-
\def\font_helpers_synchronize_math_parameters
{\c_math_last_family_used\mathstylefontid\textstyle\zerocount
\textfont \zerocount\textfont \zerocount
diff --git a/tex/context/base/mkxl/font-pre.mkxl b/tex/context/base/mkxl/font-pre.mkxl
index 2918a7e8c..2fc0aef26 100644
--- a/tex/context/base/mkxl/font-pre.mkxl
+++ b/tex/context/base/mkxl/font-pre.mkxl
@@ -433,6 +433,10 @@
\mathnolimitsmode\plusone % font driven (only opentype)
\fi
+% \ifdefined\variablefam
+% \variablefam 63
+% \fi
+
% \adaptfontfeature[*math*][mathnolimitsmode=1000] % only subscript
\definefontfeature
@@ -456,9 +460,13 @@
% \definefontfeature[virtualmath-l2r] [mathematics-l2r] % obsolete
% \definefontfeature[virtualmath-r2l] [mathematics-r2l] % obsolete
-\definefontfeature[math-text] [mathematics] % [ssty=no]
-\definefontfeature[math-script] [mathematics] [ssty=1,mathsize=yes]
-\definefontfeature[math-scriptscript] [mathematics] [ssty=2,mathsize=yes]
+\definefontfeature[math-text] [mathematics] [ssty=no]
+\definefontfeature[math-script] [mathematics] [ssty=1]
+\definefontfeature[math-scriptscript] [mathematics] [ssty=2]
+
+% \definefontfeature[math-text] [mathematics] [ssty=no]
+% \definefontfeature[math-script] [mathematics] [ssty=1,mathsize=yes]
+% \definefontfeature[math-scriptscript] [mathematics] [ssty=2,mathsize=yes]
% \definefontfeature[math-text-l2r] [mathematics-l2r] [ssty=no] % obsolete
% \definefontfeature[math-script-l2r] [mathematics-l2r] [ssty=1,mathsize=yes] % obsolete
@@ -516,7 +524,7 @@
%D \stoptext
%D \stoptyping
-\definefontfeature[primes] [primes=yes]
+\definefontfeature[primes] [primes=yes] % text
\definefontfeature[uppercasing][uppercasing=yes]
\definefontfeature[lowercasing][lowercasing=yes]
\definefontfeature[camelcasing][camelcasing=yes]
diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt
index c18dcda29..2df708806 100644
--- a/tex/context/base/mkxl/math-act.lmt
+++ b/tex/context/base/mkxl/math-act.lmt
@@ -1453,6 +1453,7 @@ do
local kerns = parameters.list
if kerns then
local characters = target.characters
+ local done = false
local function setone(uc,data)
local function set(unicode)
unicode = mathgaps[unicode] or unicode
@@ -1463,6 +1464,13 @@ do
local k = data.topright ; if k and k ~= 0 then chardata.topright = k * width end
local k = data.bottomleft ; if k and k ~= 0 then chardata.bottomleft = k * width end
local k = data.bottomright ; if k and k ~= 0 then chardata.bottomright = k * width end
+ if not trace_tweaking then
+ done = true
+ elseif done then
+ done[unicode] = true
+ else
+ done = { [unicode] = true }
+ end
end
end
local unicode = detail(characters,uc)
@@ -1478,6 +1486,7 @@ do
setone(unicode,data) -- withscriptcode(tfmdata,unicode,data,kernone)
-- also smaller
end
+ feedback_tweak("kerns",target,original,done)
end
end
@@ -1489,8 +1498,10 @@ do
local margins = parameters.list
if margins then
local characters = target.characters
+ local done = false
local function setone(unicode,data)
- local chardata = characters[mathgaps[unicode] or unicode]
+ unicode = mathgaps[unicode] or unicode
+ local chardata = characters[unicode]
if chardata then
local width = chardata.width or 0
local total = (chardata.height or 0) + (chardata.depth or 0)
@@ -1498,12 +1509,20 @@ do
local k = data.right ; if k and k ~= 0 then chardata.rightmargin = k * width end
local k = data.top ; if k and k ~= 0 then chardata.topmargin = k * total end
local k = data.bottom ; if k and k ~= 0 then chardata.bottommargin = k * total end
+ if not trace_tweaking then
+ done = true
+ elseif done then
+ done[unicode] = true
+ else
+ done = { [unicode] = true }
+ end
end
end
for unicode, data in next, margins do
setone(unicode,data) -- withscriptcode(tfmdata,unicode,data,kernone)
-- also smaller
end
+ feedback_tweak("margins",target,original,done)
end
end
@@ -2874,6 +2893,8 @@ do
{ 0x208B, 0x2212, false },
}
+ datasets.addscripts = list
+
local function add(target,original,characters,unicode,template,super,baseheight,scale)
if not characters[unicode] then
local origdata = characters[template]
@@ -3178,6 +3199,7 @@ do
if list then
local characters = target.characters
local emwidth = target.parameters.quad
+ local done = false
for i=1,#list do
local entry = list[i]
local target = entry.target
@@ -3194,14 +3216,19 @@ do
local data = characters[unicode]
if data then
data.topovershoot = top * (quad or data.width or 0)
+ if not trace_tweaking then
+ done = true
+ elseif done then
+ done[r] = true
+ else
+ done = { [r] = true }
+ end
end
end
- if trace_tweaking then
- report_mathtweak("setting overshoots for %a",target)
- end
end
end
end
+ feedback_tweak("setovershoots",target,original,done)
end
end
diff --git a/tex/context/base/mkxl/page-imp.mkxl b/tex/context/base/mkxl/page-imp.mkxl
index 4ef318985..5846fb22a 100644
--- a/tex/context/base/mkxl/page-imp.mkxl
+++ b/tex/context/base/mkxl/page-imp.mkxl
@@ -109,6 +109,19 @@
\protected\def\page_shipouts_rotate#1%
{\invokepagehandler\v!normal{\rotate[\c!rotation=\rootlayouttargetparameter\c!rotation]{#1}}}
+% inject an empty page after each page
+
+\def\page_shipouts_double#1%
+ {\page_shipouts_normal{#1}%
+ \page_shipouts_normal{\null}}
+
+\installshipoutmethod \v!doublesided
+ {\ifarrangingpages
+ \expandafter\page_shipouts_arrange
+ \else
+ \expandafter\page_shipouts_double
+ \fi}
+
% extension mechanism
\newcount\c_page_boxes_flush_n % set at the lua end
diff --git a/tex/context/base/mkxl/spac-chr.lmt b/tex/context/base/mkxl/spac-chr.lmt
index a71c4a0e1..7c8e02fb6 100644
--- a/tex/context/base/mkxl/spac-chr.lmt
+++ b/tex/context/base/mkxl/spac-chr.lmt
@@ -114,6 +114,7 @@ local function inject_nobreak_space(unicode,head,current,space,spacestretch,spac
local glue = new_glue(space,spacestretch,spaceshrink)
local penalty = new_penalty(10000)
setattrlist(glue,current)
+ setattrlist(penalty,current)
setattrlist(current) -- why reset all
setattr(glue,a_character,unicode) -- bombs
head, current = insertnodeafter(head,current,penalty)
@@ -149,6 +150,7 @@ function characters.replacenbsp(head,original)
end
function characters.replacenbspaces(head)
+ -- todo: wiping as in characters.handler(head)
local wipe = false
for current, char, font in nextglyph, head do -- can be anytime so no traversechar
if char == 0x00A0 then
@@ -186,9 +188,10 @@ local methods = {
-- maybe also 0x0008 : backspace
+ -- Watch out: a return value means "remove"!
+
[0x001E] = function(head,current) -- kind of special
local next = getnext(current)
- head, current = remove_node(head,current,true)
if next and getid(next) == glue_code and getsubtype(next) == spaceskip_code then
local nextnext = getnext(next)
if nextnext then
@@ -198,18 +201,19 @@ local methods = {
end
end
end
+ return head, current
end,
[0x001F] = function(head,current) -- kind of special
local next = getnext(current)
if next then
local char, font = isglyph(next)
- head, current = remove_node(head,current,true)
if char and not ispunctuation[char] then
local p = fontparameters[font]
head, current = insertnodebefore(head,current,new_glue(p.space,p.spacestretch,p.spaceshrink))
end
end
+ return head, current
end,
[0x00A0] = function(head,current) -- nbsp
@@ -309,34 +313,6 @@ local methods = {
characters.methods = methods
--- function characters.handler(head) -- todo: use traverseid
--- local current = head
--- while current do
--- local char, id = isglyph(current)
--- if char then
--- local next = getnext(current)
--- local method = methods[char]
--- if method then
--- if trace_characters then
--- report_characters("replacing character %C, description %a",char,lower(chardata[char].description))
--- end
--- local h = method(head,current)
--- if h then
--- head = remove_node(h,current,true)
--- end
--- end
--- current = next
--- else
--- current = getnext(current)
--- end
--- end
--- return head
--- end
-
--- this also works ok in math as we run over glyphs and these stay glyphs ... not sure
--- about scripts and such but that is not important anyway ... some day we can consider
--- special definitions in math
-
function characters.handler(head)
local wipe = false
for current, char in nextchar, head do
@@ -360,3 +336,30 @@ function characters.handler(head)
end
return head
end
+
+-- function characters.handler(head)
+-- local wiped = false
+-- for current, char in nextchar, head do
+-- local method = methods[char]
+-- if method then
+-- if wiped then
+-- wiped[#wiped+1] = current
+-- else
+-- wiped = { current }
+-- end
+-- if trace_characters then
+-- report_characters("replacing character %C, description %a",char,lower(chardata[char].description))
+-- end
+-- local h = method(head,current)
+-- if h then
+-- head = h
+-- end
+-- end
+-- end
+-- if wiped then
+-- for i=1,#wiped do
+-- head = remove_node(head,wiped[i],true)
+-- end
+-- end
+-- return head
+-- end
diff --git a/tex/context/base/mkxl/trac-vis.lmt b/tex/context/base/mkxl/trac-vis.lmt
index 09c0e020c..2b209e748 100644
--- a/tex/context/base/mkxl/trac-vis.lmt
+++ b/tex/context/base/mkxl/trac-vis.lmt
@@ -937,6 +937,10 @@ local ruledglyph do
-- line = linewidth,
-- type = "box",
-- },new_kern(-wd))
+-- if ht == 0 and dp == 0 then
+-- ht = linewidth/2
+-- dp = ht
+-- end
local info = (dp == 0 and outlinerule and outlinerule(wd,ht,dp,linewidth)) or userrule {
width = wd,
height = ht,