summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-imp-dimensions.lua1
-rw-r--r--tex/context/base/mkiv/mult-prm.lua1
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin24772 -> 24780 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin256680 -> 257126 bytes
-rw-r--r--tex/context/base/mkiv/strc-mat.mkiv1
-rw-r--r--tex/context/base/mkiv/strc-ref.mkvi2
-rw-r--r--tex/context/base/mkxl/char-brl.lmt405
-rw-r--r--tex/context/base/mkxl/char-ini.mkxl1
-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/core-env.mkxl8
-rw-r--r--tex/context/base/mkxl/driv-shp.lmt125
-rw-r--r--tex/context/base/mkxl/font-con.lmt1
-rw-r--r--tex/context/base/mkxl/font-imp-braille.lmt130
-rw-r--r--tex/context/base/mkxl/font-vfc.lmt15
-rw-r--r--tex/context/base/mkxl/grph-fig.mkxl74
-rw-r--r--tex/context/base/mkxl/grph-inc.mkxl9
-rw-r--r--tex/context/base/mkxl/math-act.lmt11
-rw-r--r--tex/context/base/mkxl/math-fnt.lmt10
-rw-r--r--tex/context/base/mkxl/math-ini.mkxl1
-rw-r--r--tex/context/base/mkxl/math-pre.lmt123
-rw-r--r--tex/context/base/mkxl/node-nut.lmt1
-rw-r--r--tex/context/base/mkxl/node-res.lmt8
-rw-r--r--tex/context/base/mkxl/strc-mat.mkxl3
-rw-r--r--tex/context/base/mkxl/strc-ref.mklx2
-rw-r--r--tex/context/base/mkxl/syst-aux.mkxl33
-rw-r--r--tex/context/base/mkxl/trac-vis.lmt8
-rw-r--r--tex/context/base/mkxl/type-imp-braille.mkxl84
32 files changed, 943 insertions, 126 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 060f187b9..607ada2e8 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{2021.11.18 16:33}
+\newcontextversion{2021.11.22 22:27}
%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 48d7f3965..d57d70feb 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{2021.11.18 16:33}
+\edef\contextversion{2021.11.22 22:27}
%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 ea1e6836c..2f16ce08f 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{2021.11.18 16:33}
+\newcontextversion{2021.11.22 22:27}
%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 4138533e6..99f6ee104 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{2021.11.18 16:33}
+\edef\contextversion{2021.11.22 22:27}
%D Kind of special:
diff --git a/tex/context/base/mkiv/font-imp-dimensions.lua b/tex/context/base/mkiv/font-imp-dimensions.lua
index 66e218e0f..9e664a684 100644
--- a/tex/context/base/mkiv/font-imp-dimensions.lua
+++ b/tex/context/base/mkiv/font-imp-dimensions.lua
@@ -103,6 +103,7 @@ local function initialize(tfmdata,key,value)
character.height = height
character.depth = depth
if oldwidth ~= width then
+ -- todo: xoffset
local commands = character.commands
local hshift = rightcommand[newshift or ((width - oldwidth) / 2)]
if commands then
diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua
index 3bde86c49..d29f06934 100644
--- a/tex/context/base/mkiv/mult-prm.lua
+++ b/tex/context/base/mkiv/mult-prm.lua
@@ -526,6 +526,7 @@ return {
"tokspre",
"tolerant",
"tpack",
+ "tracingadjusts",
"tracingalignments",
"tracingexpressions",
"tracingfonts",
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 21b3cb86b..70dda4720 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index c4f320fb5..20e4c0345 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-mat.mkiv b/tex/context/base/mkiv/strc-mat.mkiv
index 976cb8c3a..d3f47adac 100644
--- a/tex/context/base/mkiv/strc-mat.mkiv
+++ b/tex/context/base/mkiv/strc-mat.mkiv
@@ -978,6 +978,7 @@
\rawprocesscommalist[\p_direct]\strc_formulas_option
\fi
% not : \def\strc_formulas_formula[##1]##2{\mathematics{##2}}%
+ \useformulastyleandcolor\c!style\c!color
\mathematics{#2}%
\endgroup}
diff --git a/tex/context/base/mkiv/strc-ref.mkvi b/tex/context/base/mkiv/strc-ref.mkvi
index 3bf339638..5032c20c4 100644
--- a/tex/context/base/mkiv/strc-ref.mkvi
+++ b/tex/context/base/mkiv/strc-ref.mkvi
@@ -1125,7 +1125,7 @@
\def\strc_references_handle_page_state_yes
{\markreferencepage
- \ifcase\referencepagedetail
+ \ifcase\referencepagedetail\relax
\expandafter\sixthofsixarguments \or
\expandafter\thirdofsixarguments \or
\expandafter\firstofsixarguments \or
diff --git a/tex/context/base/mkxl/char-brl.lmt b/tex/context/base/mkxl/char-brl.lmt
new file mode 100644
index 000000000..c9cdd3594
--- /dev/null
+++ b/tex/context/base/mkxl/char-brl.lmt
@@ -0,0 +1,405 @@
+if not modules then modules = { } end modules ['char-bri'] = {
+ version = 1.001,
+ comment = "companion to char-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- We use a somewhat indirect approach because we generated the database and
+-- have to do that again probably. At some point we can move some to char-def
+-- so the interfaces here are kind of private and can change.
+--
+-- This is just an experiment. The data is taken from Wikipedia and the nemeth
+-- sequences come from a 2021 blog by Murray Sargent (from Microsoft):
+--
+-- https://devblogs.microsoft.com/math-in-office/unicode-math-braille-sequences/
+
+local next = next
+local gsub = string.gsub
+local utfbyte, utfsplit = utf.byte, string.utfvaluetable
+local sortedkeys = table.sortedkeys
+
+local braille = { }
+characters.braille = braille
+
+local codepoints = {
+ digits = {
+ [48] = "⠚",
+ [49] = "⠁",
+ [50] = "⠃",
+ [51] = "⠉",
+ [52] = "⠙",
+ [53] = "⠑",
+ [54] = "⠋",
+ [55] = "⠛",
+ [56] = "⠓",
+ [57] = "⠊",
+ },
+ letters = {
+ [97] = "⠁",
+ [98] = "⠃",
+ [99] = "⠉",
+ [100] = "⠙",
+ [101] = "⠑",
+ [102] = "⠋",
+ [103] = "⠛",
+ [104] = "⠓",
+ [105] = "⠊",
+ [106] = "⠚",
+ [107] = "⠅",
+ [108] = "⠇",
+ [109] = "⠍",
+ [110] = "⠝",
+ [111] = "⠕",
+ [112] = "⠏",
+ [113] = "⠟",
+ [114] = "⠗",
+ [115] = "⠎",
+ [116] = "⠞",
+ [117] = "⠥",
+ [118] = "⠧",
+ [119] = "⠺",
+ [120] = "⠭",
+ [121] = "⠽",
+ [122] = "⠵",
+ },
+ punctuation = {
+ [33] = "⠖",
+ [34] = "⠸⠡",
+ [40] = "⠐⠣",
+ [41] = "⠐⠜",
+ [44] = "⠂",
+ [45] = "⠤",
+ [46] = "⠲",
+ [47] = "⠸⠌",
+ [58] = "⠒",
+ [59] = "⠆",
+ [63] = "⠦",
+ [8211] = "⠠⠤",
+ [8212] = "⠐⠠⠤",
+ [8216] = "⠄⠦",
+ [8217] = "⠄⠴",
+ [8220] = "⠘⠦",
+ [8221] = "⠘⠴",
+ },
+ ueb = {
+ [33] = "⠖",
+ [34] = "⠠⠶",
+ [35] = "⠸⠹",
+ [36] = "⠈⠎",
+ [37] = "⠨⠴",
+ [38] = "⠈⠯",
+ [39] = "⠄",
+ [40] = "⠐⠣",
+ [41] = "⠐⠜",
+ [42] = "⠐⠔",
+ [43] = "⠐⠖",
+ [44] = "⠂",
+ [45] = "⠤",
+ [46] = "⠼⠲",
+ [47] = "⠸⠌",
+ [58] = "⠒",
+ [59] = "⠆",
+ [60] = "⠈⠣",
+ [61] = "⠐⠶",
+ [62] = "⠈⠜",
+ [63] = "⠦",
+ [64] = "⠈⠁",
+ [91] = "⠨⠣",
+ [92] = "⠸⠡",
+ [93] = "⠨⠜",
+ [94] = "⠈⠢",
+ [95] = "⠨⠤",
+ [123] = "⠸⠣",
+ [124] = "⠸⠳",
+ [125] = "⠸⠜",
+ [126] = "⠈⠔",
+ [162] = "⠈⠉",
+ [163] = "⠈⠇",
+ [167] = "⠘⠎",
+ [169] = "⠘⠉",
+ [172] = "⠈⠹",
+ [174] = "⠘⠗",
+ [176] = "⠘⠚",
+ [177] = "⠸⠖",
+ [182] = "⠘⠏",
+ [215] = "⠐⠦",
+ [247] = "⠐⠌",
+ [913] = "⠠⠨⠁",
+ [914] = "⠠⠨⠃",
+ [915] = "⠠⠨⠛",
+ [916] = "⠠⠨⠙",
+ [917] = "⠠⠨⠑",
+ [918] = "⠠⠨⠵",
+ [919] = "⠠⠨⠱",
+ [920] = "⠠⠨⠹",
+ [921] = "⠠⠨⠊",
+ [922] = "⠠⠨⠅",
+ [923] = "⠠⠨⠇",
+ [924] = "⠠⠨⠍",
+ [925] = "⠠⠨⠝",
+ [926] = "⠠⠨⠭",
+ [927] = "⠠⠨⠕",
+ [928] = "⠠⠨⠏",
+ [929] = "⠠⠨⠗",
+ [931] = "⠠⠨⠎",
+ [932] = "⠠⠨⠞",
+ [933] = "⠠⠨⠥",
+ [934] = "⠠⠨⠋",
+ [935] = "⠠⠨⠯",
+ [936] = "⠠⠨⠽",
+ [937] = "⠠⠨⠺",
+ [945] = "⠨⠁",
+ [946] = "⠨⠃",
+ [947] = "⠨⠛",
+ [948] = "⠨⠙",
+ [949] = "⠨⠑",
+ [950] = "⠨⠵",
+ [951] = "⠨⠱",
+ [952] = "⠨⠹",
+ [953] = "⠨⠊",
+ [954] = "⠨⠅",
+ [955] = "⠨⠇",
+ [956] = "⠨⠍",
+ [957] = "⠨⠝",
+ [958] = "⠨⠭",
+ [959] = "⠨⠕",
+ [960] = "⠨⠏",
+ [961] = "⠨⠗",
+ [962] = "⠨⠎",
+ [963] = "⠨⠎",
+ [964] = "⠨⠞",
+ [965] = "⠨⠥",
+ [966] = "⠨⠋",
+ [967] = "⠨⠯",
+ [968] = "⠨⠽",
+ [969] = "⠨⠺",
+ [8212] = "⠠⠤",
+ [8213] = "⠐⠠⠤",
+ [8216] = "⠠⠦",
+ [8217] = "⠠⠴",
+ [8220] = "⠘⠦",
+ [8221] = "⠘⠴",
+ [8224] = "⠈⠠⠹",
+ [8225] = "⠈⠠⠻",
+ [8226] = "⠸⠲",
+ [8242] = "⠶",
+ [8243] = "⠶⠶",
+ [8592] = "⠳⠪",
+ [8593] = "⠳⠬",
+ [8594] = "⠳⠕",
+ [8595] = "⠳⠩",
+ [8596] = "⠰⠳⠺⠗⠕",
+ [8598] = "⠳⠱",
+ [8599] = "⠳⠎",
+ [8600] = "⠳⠣",
+ [8601] = "⠳⠜",
+ [8656] = "⠰⠳⠶⠶⠪",
+ [8657] = "⠰⠳⠶⠶⠬",
+ [8658] = "⠰⠳⠶⠶⠕",
+ [8659] = "⠰⠳⠶⠶⠩",
+ [8704] = "⠘⠁",
+ [8706] = "⠈⠙",
+ [8707] = "⠘⠢",
+ [8709] = "⠈⠚",
+ [8711] = "⠘⠙",
+ [8712] = "⠘⠑",
+ [8715] = "⠈⠘⠑",
+ [8722] = "⠐⠤",
+ [8723] = "⠸⠤",
+ [8728] = "⠐⠴",
+ [8730] = "⠐⠩",
+ [8733] = "⠸⠐⠶",
+ [8734] = "⠼⠿",
+ [8736] = "⠸⠪",
+ [8737] = "⠨⠸⠪",
+ [8741] = "⠼⠇",
+ [8743] = "⠈⠦",
+ [8744] = "⠈⠖",
+ [8745] = "⠨⠦",
+ [8746] = "⠨⠖",
+ [8747] = "⠮",
+ [8748] = "⠮⠮",
+ [8749] = "⠮⠮⠮",
+ [8750] = "⠈⠮",
+ [8756] = "⠠⠡",
+ [8757] = "⠈⠌",
+ [8758] = "⠒",
+ [8759] = "⠒⠒",
+ [8771] = "⠸⠔",
+ [8773] = "⠐⠸⠔",
+ [8776] = "⠘⠔",
+ [8783] = "⠘⠐⠶",
+ [8785] = "⠨⠐⠶",
+ [8800] = "⠐⠶⠈⠱",
+ [8801] = "⠸⠿",
+ [8804] = "⠸⠈⠣",
+ [8805] = "⠸⠈⠜",
+ [8810] = "⠨⠈⠣",
+ [8811] = "⠨⠈⠜",
+ [8834] = "⠘⠣",
+ [8835] = "⠘⠜",
+ [8838] = "⠸⠘⠣",
+ [8839] = "⠸⠘⠜",
+ [8842] = "⠨⠘⠣",
+ [8843] = "⠨⠘⠜",
+ [8853] = "⠰⠫⠿⠪⠐⠖⠱",
+ [8867] = "⠈⠸⠒",
+ [8869] = "⠼⠤",
+ [8870] = "⠸⠒",
+ [8872] = "⠘⠸⠒",
+ [8882] = "⠈⠸⠣",
+ [8883] = "⠈⠸⠜",
+ [8884] = "⠸⠸⠣",
+ [8885] = "⠸⠸⠜",
+ [8894] = "⠼⠸⠪",
+ [8901] = "⠐⠲",
+ [9675] = "⠿",
+ [10764] = "⠮⠮⠮⠮",
+ },
+ specials = {
+ uppercase = "⠠",
+ space = "⠀",
+ number = "⠼",
+ rule = "⠒",
+ },
+ alphabets = {
+ ["lowercasenormal"] = "⠰",
+ ["lowercasegreeknormal"] = "⠨",
+ ["lowercasegreekitalic"] = "⠨⠨",
+ ["lowercaseitalic"] = "⠨",
+ ["lowercasebold"] = "⠸",
+ ["lowercasebolditalic"] = "⠸⠨",
+ ["lowercasefraktur"] = "⠸",
+ ["lowercaseboldfraktur"] = "⠸⠸",
+ ["lowercasescript"] = "⠈",
+ ["lowercaseboldscript"] = "⠸⠈",
+ ["lowercasesansserifnormal"] = "⠠⠨",
+ ["lowercasesansserifitalic"] = "⠠⠨⠨",
+ ["lowercasesansserifbold"] = "⠠⠨⠸",
+ ["lowercasesansserifbolditalic"] = "⠠⠨⠸⠨",
+
+ ["uppercase"] = "⠠",
+
+ -- ["russian"] = "⠈⠈",
+ -- ["hebrew"] = "⠠⠠",
+ -- ["altgreek"] = "⠨⠈",
+
+ -- ["lowercasedoublestruck"] = ""
+ -- ["lowercasegreekbold"] = ""
+ -- ["lowercasegreekbolditalic"] = ""
+ -- ["lowercasegreeksansserifbold"] = ""
+ -- ["lowercasegreeksansserifbolditalic"] = ""
+ -- ["lowercasemonospace"] = ""
+ },
+}
+
+braille.codepoints = codepoints
+
+local textunicodes, mathunicodes, textstrings, mathstrings, textlist, mathlist, specials
+
+local function prepare()
+
+ local charblocks = characters.blocks
+ local uccodes = characters.uccodes
+
+ local letters = codepoints.letters
+ local cspecials = codepoints.specials
+ local uppercase = cspecials.uppercase
+ local number = cspecials.number
+ local space = cspecials.space
+ local rule = cspecials.rule
+
+ -- filtered from the mentioned blog webpage:
+
+ local nemeth = table.load(resolvers.find_file("math-brl.lua")).nemeth
+ codepoints.nemeth = nemeth
+
+ -- we let the tex math engine do the spacing but it can become an option:
+
+ for k, v in next, nemeth do
+ nemeth[k] = gsub(v,space,"")
+ end
+
+ textstrings = { }
+ mathstrings = { }
+ textunicodes = { }
+ mathunicodes = { }
+
+ for k, v in next, codepoints.letters do
+ textstrings[k] = v
+ mathstrings[k] = v
+ local K = uccodes[k]
+ if K then
+ local V = uppercase .. v
+ textstrings[K] = V
+ mathstrings[K] = V
+ end
+ end
+
+ for k, v in next, codepoints.digits do
+ local d = number .. v
+ textstrings[k] = v
+ mathstrings[k] = v
+ end
+
+ for k, v in next, codepoints.punctuation do
+ textstrings[k] = v
+ mathstrings[k] = v
+ end
+ -- overlaps with the above
+
+ for k, v in next, codepoints.ueb do
+ textstrings[k] = v
+ mathstrings[k] = v
+ end
+
+ for k, v in next, codepoints.nemeth do
+ mathstrings[k] = v
+ if not textstrings[k] then
+ textstrings[k] = v
+ end
+ end
+
+ for k, v in next, codepoints.alphabets do
+ local block = charblocks[k]
+ if block then
+ local c = utfbyte('a')
+ for i=block.first,block.last do
+ mathstrings[i] = v..letters[c]
+ if not textstrings[i] then
+ textstrings[i] = v .. letters[c]
+ end
+ c = c + 1
+ end
+ end
+ end
+
+ for k, v in next, textstrings do
+ textunicodes[k] = utfsplit(v)
+ end
+ for k, v in next, mathstrings do
+ mathunicodes[k] = utfsplit(v)
+ end
+
+ textlist = sortedkeys(textstrings)
+ mathlist = sortedkeys(mathstrings)
+
+ specials = {
+ uppercase = utfbyte(uppercase),
+ number = utfbyte(number),
+ space = utfbyte(space),
+ rule = utfbyte(rule)
+ }
+end
+
+-- maybe an iterator
+
+function braille.textlist () if not textlist then prepare() end return textlist end
+function braille.mathlist () if not mathlist then prepare() end return mathlist end
+function braille.textunicode(n) if not textunicodes then prepare() end return textunicodes[n] end
+function braille.mathunicode(n) if not mathunicodes then prepare() end return mathunicodes[n] end
+function braille.textstring (n) if not textstrings then prepare() end return textstrings [n] end
+function braille.mathstring (n) if not mathstrings then prepare() end return mathstrings [n] end
+function braille.special (n) if not specials then prepare() end return specials [n] end
diff --git a/tex/context/base/mkxl/char-ini.mkxl b/tex/context/base/mkxl/char-ini.mkxl
index f512e02bc..baa5426cc 100644
--- a/tex/context/base/mkxl/char-ini.mkxl
+++ b/tex/context/base/mkxl/char-ini.mkxl
@@ -18,6 +18,7 @@
\registerctxluafile{char-tex}{autosuffix}
\registerctxluafile{char-ent}{}
\registerctxluafile{char-scr}{}
+%registerctxluafile{char-brl}{}
\unprotect
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index 7ccad2f83..ce18d555f 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.11.18 16:33}
+\newcontextversion{2021.11.22 22:27}
%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 ba38b44c7..dd39ba19b 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.11.18 16:33}
+\immutable\edef\contextversion{2021.11.22 22:27}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
diff --git a/tex/context/base/mkxl/core-env.mkxl b/tex/context/base/mkxl/core-env.mkxl
index c0cc44e5b..6c347b0d5 100644
--- a/tex/context/base/mkxl/core-env.mkxl
+++ b/tex/context/base/mkxl/core-env.mkxl
@@ -580,11 +580,11 @@
\permanent\def\systemsetups#1{\syst_setups{\systemsetupsprefix#1}}
-\permanent\protected\def\resetsetups[#1]% see x-fo for usage
- {\ifcsname\??setup\ifgridsnapping\v!grid\fi:#1\endcsname
- \dodoglobal\undefinevalue{\??setup\ifgridsnapping\v!grid\fi:#1}%
+\permanent\tolerant\protected\def\resetsetups[#1]#;#2%
+ {\ifcsname\??setup\ifgridsnapping\v!grid\fi:#1#2\endcsname
+ \dodoglobal\undefinevalue{\??setup\ifgridsnapping\v!grid\fi:#1#2}%
\else
- \dodoglobal\undefinevalue{\??setup:#1}%
+ \dodoglobal\undefinevalue{\??setup:#1#2}%
\fi}
\permanent\tolerant\protected\def\copysetups[#1]#*[#2]%
diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt
index eb2ec63c9..3a3d3e6e7 100644
--- a/tex/context/base/mkxl/driv-shp.lmt
+++ b/tex/context/base/mkxl/driv-shp.lmt
@@ -223,9 +223,13 @@ local flush_character do
end
if csx then
csx = csx * sx
+else
+ csx = sx
end
if csy then
csy = csy * sy
+else
+ csy = sy
end
-- here no current!
return flush_character(false,fnt,chr,factor,nest,pos_h,pos_v,pos_r,csx,csy)
@@ -708,9 +712,10 @@ local hlist_out, vlist_out do
if subtype >= leaders_code then
local leader = getleader(current)
if leader then
- local width, height, depth = getwhd(leader)
- if getid(leader) == rule_code then
+ local id = getid(leader)
+ if id == rule_code then
if gluewidth > 0 then
+ local width, height, depth = getwhd(leader)
if height == runningrule then
height = boxheight
end
@@ -727,67 +732,73 @@ local hlist_out, vlist_out do
end
cur_h = cur_h + gluewidth
end
- elseif width > 0 and gluewidth > 0 then
- local boxdir = getdirection(leader) or lefttoright_code
- gluewidth = gluewidth + 10
- local edge = cur_h + gluewidth
- local lx = 0
- if subtype == gleaders_code then
- local save_h = cur_h
- if pos_r == righttoleft_code then
- cur_h = ref_h - shipbox_h + cur_h
+ elseif id == hlist_code or id == vlist_code and gluewidth > 0 then
+ local width, height, depth = getwhd(leader)
+ if width > 0 then
+ local boxdir = getdirection(leader) or lefttoright_code
+ gluewidth = gluewidth + 10
+ local edge = cur_h + gluewidth
+ local lx = 0
+ if subtype == gleaders_code then
+ local save_h = cur_h
+ if pos_r == righttoleft_code then
+ cur_h = ref_h - shipbox_h + cur_h
+ cur_h = width * (cur_h // width)
+ cur_h = ref_h - shipbox_h - cur_h
+ else
+ cur_h = ref_h - shipbox_h - cur_h
+ cur_h = width * (cur_h // width)
+ cur_h = ref_h - shipbox_h - cur_h
+ end
+ if cur_h < save_h then
+ cur_h = cur_h + width
+ end
+ elseif subtype == leaders_code then
+ local save_h = cur_h
cur_h = width * (cur_h // width)
- cur_h = ref_h - shipbox_h - cur_h
+ if cur_h < save_h then
+ cur_h = cur_h + width
+ end
else
- cur_h = ref_h - shipbox_h - cur_h
- cur_h = width * (cur_h // width)
- cur_h = ref_h - shipbox_h - cur_h
- end
- if cur_h < save_h then
- cur_h = cur_h + width
+ lq = gluewidth / width
+ lr = gluewidth % width
+ if subtype == cleaders_code then
+ cur_h = cur_h + lr // 2
+ else
+ lx = lr // (lq + 1)
+ cur_h = cur_h + (lr - (lq - 1) * lx) // 2
+ end
end
- elseif subtype == leaders_code then
- local save_h = cur_h
- cur_h = width * (cur_h // width)
- if cur_h < save_h then
- cur_h = cur_h + width
+ local shift = getshift(leader)
+ pushleaderlevel()
+ while cur_h + width <= edge do
+ local basepoint_h = 0
+ -- local basepoint_v = shift
+ if boxdir ~= pos_r then
+ basepoint_h = boxwidth
+ end
+ -- synch_pos_with_cur(ref_h,ref_v,cur_h + basepoint_h,shift)
+ if pos_r == righttoleft_code then
+ pos_h = ref_h - (cur_h + basepoint_h)
+ else
+ pos_h = ref_h + (cur_h + basepoint_h)
+ end
+ pos_v = ref_v - shift
+ -- synced
+ if getid(leader) == vlist_code then
+ vlist_out(leader,getlist(leader))
+ else
+ hlist_out(leader,getlist(leader))
+ end
+ cur_h = cur_h + width + lx
end
+ popleaderlevel()
+ cur_h = edge - 10
else
- lq = gluewidth / width
- lr = gluewidth % width
- if subtype == cleaders_code then
- cur_h = cur_h + lr // 2
- else
- lx = lr // (lq + 1)
- cur_h = cur_h + (lr - (lq - 1) * lx) // 2
- end
- end
- local shift = getshift(leader)
- pushleaderlevel()
- while cur_h + width <= edge do
- local basepoint_h = 0
- -- local basepoint_v = shift
- if boxdir ~= pos_r then
- basepoint_h = boxwidth
- end
- -- synch_pos_with_cur(ref_h,ref_v,cur_h + basepoint_h,shift)
- if pos_r == righttoleft_code then
- pos_h = ref_h - (cur_h + basepoint_h)
- else
- pos_h = ref_h + (cur_h + basepoint_h)
- end
- pos_v = ref_v - shift
- -- synced
- if getid(leader) == vlist_code then
- vlist_out(leader,getlist(leader))
- else
- hlist_out(leader,getlist(leader))
- end
- cur_h = cur_h + width + lx
+ cur_h = cur_h + gluewidth
end
- popleaderlevel()
- cur_h = edge - 10
else
+ -- maybe some day also glyphs
cur_h = cur_h + gluewidth
end
else
@@ -832,12 +843,14 @@ local hlist_out, vlist_out do
pos_h = ref_h + (cur_h + basepoint_h + xoffset)
end
pos_v = ref_v - (shift - yoffset)
+ -- pushorientation(orientation,pos_h,pos_v,pos_r)
-- synced
if id == vlist_code then
vlist_out(current,list)
else
hlist_out(current,list)
end
+ -- poporientation(orientation,pos_h,pos_v,pos_r)
else
local orientation, xoffset, yoffset, woffset, hoffset, doffset = getorientation(current)
local orientation, basepoint_h, basepoint_v = applyanchor(orientation,0,shift,width,height,depth,woffset,hoffset,doffset,xoffset,yoffset)
diff --git a/tex/context/base/mkxl/font-con.lmt b/tex/context/base/mkxl/font-con.lmt
index d1a15e92c..b452f5a12 100644
--- a/tex/context/base/mkxl/font-con.lmt
+++ b/tex/context/base/mkxl/font-con.lmt
@@ -797,6 +797,7 @@ function constructors.scale(tfmdata,specification)
end
end
end
+ -- only in old school fonts (otherwise we set commands later in context)
local vc = character.commands
if vc then
chr.commands = scalecommands(vc,hdelta,vdelta)
diff --git a/tex/context/base/mkxl/font-imp-braille.lmt b/tex/context/base/mkxl/font-imp-braille.lmt
new file mode 100644
index 000000000..2bbf0fd16
--- /dev/null
+++ b/tex/context/base/mkxl/font-imp-braille.lmt
@@ -0,0 +1,130 @@
+if not modules then modules = { } end modules ['font-imp-braille'] = {
+ version = 1.001,
+ comment = "companion to font-ini.mkiv",
+ author = "Hans Hagen, PRAGMA ADE",
+ copyright = "ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+if not context then return end
+
+-- require("char-brl.lmt") -- we delay this one
+
+-- we can omit spaces and tweak the math parameters instead
+
+-- callback.register("math_rule", function(kind,font,width,height,attr)
+-- return nodes.tonode(nodes.nuts.pool.rule(width,5*height,5*height))
+-- end)
+
+local braille = characters.braille -- so this one is nil
+
+local braille_math_rule do
+
+ local nuts = nodes.nuts
+ local tonut = nodes.tonut
+ local tonode = nodes.tonode
+ local nodepool = nuts.pool
+ local setattrlist = nuts.setattrlist
+ local hpack = nuts.hpack
+ -- local getwhd = nuts.getwhd
+ -- local setwhd = nuts.setwhd
+ -- local setoffsets = nuts.setoffsets
+ local newmathglyph = nuts.newmathglyph
+ local newleader = nodepool.leader
+
+ local braillerule
+
+ braille_math_rule = function(kind,font,width,height,attr)
+ if not braillerule then
+ braillerule = braille.special("rule")
+ end
+ local attlst = tonut(attr)
+ local glyph = newmathglyph(font,braillerule,attlst)
+ local box = hpack(glyph)
+ --
+ -- local w, h, d = getwhd(box)
+ -- local t = (h + d) / 2
+ -- setwhd(box,w,t,t)
+ -- setoffsets(glyph,0,-t) -- setting the offset of the box messes up (visual) things
+ --
+ local leader = newleader(width,box)
+ local result = hpack(leader,width,"exactly")
+ setattrlist(leader,attlst)
+ return tonode(result)
+ end
+
+end
+
+local setmetatableindex = table.setmetatableindex
+
+local cache = table.setmetatableindex(function(t,w)
+ local v = table.setmetatableindex(function(t,u)
+ local v = { "offset", w, 0, u }
+ t[u] = v
+ return v
+ end)
+ t[w] = v
+ return v
+end)
+
+local function initialize(tfmdata,value)
+ if value then
+ if not braille then
+ require("char-brl.lmt")
+ braille = characters.braille
+ end
+ callback.register("math_rule", braille_math_rule)
+ local characters = tfmdata.characters
+ local numberdata = characters[braille.special("number")]
+ if numberdata then
+ local ismath = value ~= "text" and (value == "math" or tfmdata.mathparameters)
+ local list = ismath and braille.mathlist() or braille.textlist()
+ local unicode = ismath and braille.mathunicode or braille.textunicode
+ local width = numberdata.width
+ local height = numberdata.height
+ local depth = numberdata.depth
+ for i=1,#list do
+ local u = list[i]
+ local t = unicode(u)
+ local d = characters[u]
+ local w = 0
+ local c = { }
+ local n = #t
+ for i=1,n do
+ local ub = t[i]
+ local db = characters[ub]
+ if db then
+ c[i] = cache[w][ub]
+ w = w + width
+ end
+ end
+ if d then
+ d.width = n * width
+ d.height = height
+ d.depth = depth
+ d.commands = c
+ else
+ characters[u] = {
+ width = n * width,
+ height = height,
+ depth = depth,
+ commands = c,
+ unicode = u,
+ }
+ end
+ end
+ characters[0xAD] = characters[45]
+ end
+ end
+end
+
+local specification = {
+ name = "braille",
+ description = "braille",
+ manipulators = {
+ base = initialize,
+ node = initialize,
+ }
+}
+
+fonts.handlers.otf.features.register(specification)
diff --git a/tex/context/base/mkxl/font-vfc.lmt b/tex/context/base/mkxl/font-vfc.lmt
index c28b8b988..57344d18e 100644
--- a/tex/context/base/mkxl/font-vfc.lmt
+++ b/tex/context/base/mkxl/font-vfc.lmt
@@ -169,22 +169,27 @@ local scaled = {
-- additional ones are never scaled (color etc)
}
+-- normally we don't have these, and if so, only in old school fonts
+-- in which case we don't have extensions so ...
+
function helpers.scalecommands(list,hdelta,vdelta)
local n = #list
for i=1,n do
- local key = list[i][1]
- if scaled[list[i][1]] then
+ local cmd = list[i]
+ if scaled[cmd[1]] then
local result = { }
for i=1,n do
local cmd = list[i]
- local key = ivc[1]
+ local key = cmd[1]
if key == "right" or key == "left" then
result[i] = { key, cmd[2]*hdelta }
elseif key == "down" or key == "up" then
result[i] = { key, cmd[2]*vdelta }
- elseif key == "offset" or key == "rule" then -- or key == "compose"
+ elseif key == "offset" then
+ result[i] = { key, cmd[2]*hdelta, cmd[3]*vdelta, cmd[4], cmd[5], cmd[6] }
+ elseif key == "rule" then
result[i] = { key, cmd[2]*hdelta, cmd[3]*vdelta }
- elseif key == "line" then -- or key == "compose"
+ elseif key == "line" then
result[i] = { key, cmd[2]*hdelta, cmd[3]*vdelta, cmd[4]*vdelta, cmd[5] }
-- elseif key == "frame" then
-- result[i] = cmd -- already scaled, for now
diff --git a/tex/context/base/mkxl/grph-fig.mkxl b/tex/context/base/mkxl/grph-fig.mkxl
index 4a717a8c9..9f16747e3 100644
--- a/tex/context/base/mkxl/grph-fig.mkxl
+++ b/tex/context/base/mkxl/grph-fig.mkxl
@@ -102,8 +102,16 @@
\endgroup}
%D Whatever ... hardly used ... but historic ... needs checking ... will probably
-%D become m-fig-nn.mkiv .. or I will extend it cq. clean it up when I needed it.
-%D After all, it's documented in old manuals.
+%D become m-fig-nn.mkiv .. or I will extend it cq. clean it up when I needed it;
+%D after all, it's documented in old manuals.
+%D
+%D \stoptyping
+%D \startfigure[mycow][t:/sources/cow.pdf][width=4cm]
+%D % one can also use layers
+%D \stopfigure
+%D
+%D \externalfigure[mycow]
+%D \stoptyping
\newcount\c_grph_steps_reference
\newdimen\d_grph_steps_x
@@ -115,32 +123,36 @@
\ifdefined\remark \else \mutable\let\remark \relax \fi
\ifdefined\colorbar \else \mutable\let\colorbar \relax \fi
-\tolerant\protected\def\grph_steps_place_figure#1#2#3#4[#5]%
- {\hpack
- {\setbox\scratchbox\hpack
- {\useexternalfigure[\s!dummy][#2][#3,#5]%
- \externalfigure[\s!dummy]}%
- \grph_steps_calculate
- \startpositioning
- \enforced\let\referring\grph_steps_one_referring
- \enforced\let\marking \grph_steps_one_marking
- \enforced\let\remark \grph_steps_one_remark
- \enforced\let\colorbar \grph_steps_one_colorbar
- \position(0,0){\box\scratchbox}%
- \linewidth\onepoint
- \setuppositioning
- [\c!unit=pt,%
- \c!xscale=\withoutpt\the\d_grph_steps_x,%
- \c!yscale=\withoutpt\the\d_grph_steps_y,%
- \c!factor=1]%
- \ignorespaces#4%
- \enforced\let\referring\grph_steps_two_referring
- \enforced\let\marking \grph_steps_two_marking
- \enforced\let\remark \grph_steps_two_remark
- \enforced\let\colorbar \grph_steps_two_colorbar
- \ignorespaces#4\removeunwantedspaces % or just grab #4 unspaced
- \stoppositioning
- \ifvoid\b_grph_steps_colorbar\else\box\b_grph_steps_colorbar\fi}} % not really needed
+\tolerant\protected\def\grph_steps_place_figure#1#2#3#4#5%
+ {\hbox\bgroup
+ \setbox\scratchbox\hbox % somehow a space creeps in
+ {% we can use \nospaces\plusone
+ \useexternalfigure[\s!dummy][#2][#3,#5]%
+ \externalfigure[\s!dummy]}%
+ \setbox\scratchbox\hbox
+ {\externalfigure[#2][#3,#5]}%
+ \grph_steps_calculate
+ \startpositioning
+ \enforced\let\referring\grph_steps_one_referring
+ \enforced\let\marking \grph_steps_one_marking
+ \enforced\let\remark \grph_steps_one_remark
+ \enforced\let\colorbar \grph_steps_one_colorbar
+ \position(0,0){\box\scratchbox}%
+ \linewidth\onepoint
+ \setuppositioning
+ [\c!unit=pt,%
+ \c!xscale=\withoutpt\the\d_grph_steps_x,%
+ \c!yscale=\withoutpt\the\d_grph_steps_y,%
+ \c!factor=1]%
+ \ignorespaces#4%
+ \enforced\let\referring\grph_steps_two_referring
+ \enforced\let\marking \grph_steps_two_marking
+ \enforced\let\remark \grph_steps_two_remark
+ \enforced\let\colorbar \grph_steps_two_colorbar
+ \ignorespaces#4\removeunwantedspaces % or just grab #4 unspaced
+ \stoppositioning
+ \ifvoid\b_grph_steps_colorbar\else\box\b_grph_steps_colorbar\fi
+ \egroup}
\protected\def\grph_steps_one_referring(#1,#2)#*(#3,#4)#*[#5]%
{\position(#1,#2){\grph_steps_goto(#3,#4){\externalfigureparameter\c!frames}[#5]}}
@@ -176,8 +188,10 @@
{\grph_steps_test_figure{#1}{#2}{#3}{#4}%
\letexternalfigureparameter\c!frames\v!on}%
{\letexternalfigureparameter\c!frames\v!off}%
- \setvalue{\??externalfigureinstance#1}%
- {\grph_steps_place_figure{#1}{#2}{#3}{#4}}}
+ \tolerant\defcsname\??externalfigureinstance#1\endcsname[##1]%
+ {\grph_steps_place_figure{#1}{#2}{#3}{#4}{##1}%
+ % this is a dirty hack but ok for an old macro
+ \enforced\let\figurestatus\plusone}}
\permanent\protected\lettonothing\stopfigure
diff --git a/tex/context/base/mkxl/grph-inc.mkxl b/tex/context/base/mkxl/grph-inc.mkxl
index ace3e581d..a4b42e009 100644
--- a/tex/context/base/mkxl/grph-inc.mkxl
+++ b/tex/context/base/mkxl/grph-inc.mkxl
@@ -211,7 +211,7 @@
\fi}
\def\grph_include_use_indeed#1#2#3#4%
- {\dodoglobal\setvalue{\??externalfigureinstance#1}{\grph_include_setup{#2}{#3}{#4}}%
+ {\dodoglobal\defcsname\??externalfigureinstance#1\endcsname{\grph_include_setup{#2}{#3}{#4}}%
\grph_include_analyze_collection[#2][#4]}
% inclusion
@@ -717,11 +717,8 @@
\mutable\let\feedbackexternalfigure\relax % hook
-\permanent\protected\def\getfiguredimensions
- {\dodoubleempty\grph_include_get_dimensions}
-
-\def\grph_include_get_dimensions[#1][#2]%
- {\startnointerference
+\permanent\tolerant\protected\def\getfiguredimensions[#1]#*[#2]%
+ {\startnointerference % we can use \nospaces\plusone
\settrue\c_grph_include_test_only
\externalfigure[#1][#2,\c!display=,\c!mask=,\c!object=\v!no]%
\stopnointerference}
diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt
index 374b5d73a..05df5eea6 100644
--- a/tex/context/base/mkxl/math-act.lmt
+++ b/tex/context/base/mkxl/math-act.lmt
@@ -587,17 +587,22 @@ end
do
+ local reported = { }
+
function mathtweaks.version(target,original,parameters)
local metadata = original.shared.rawdata.metadata
if metadata then
- local version = metadata.version
+ local version = string.strip(metadata.version or "") -- some have trailing spaces
if version then
local expected = parameters.expected
+ local fontname = metadata.fontname or false
-- version = tonumber(string.match(version,"%d+.%d+"))
- if version ~= expected then
+ if version ~= expected and not reported[fontname] then
report_tweak("version %a found, version %a expected",target,original,version,expected)
- reported[fontname] = true
+ elseif trace_tweaking then
+ report_tweak("version %a found",target,original,version)
end
+ reported[fontname] = true
end
end
end
diff --git a/tex/context/base/mkxl/math-fnt.lmt b/tex/context/base/mkxl/math-fnt.lmt
index a3ac1aea3..e6978d6cd 100644
--- a/tex/context/base/mkxl/math-fnt.lmt
+++ b/tex/context/base/mkxl/math-fnt.lmt
@@ -15,7 +15,8 @@ local vlist_code = nodes.nodecodes.vlist
local new_hlist = nodepool.hlist
local new_vlist = nodepool.vlist
-local new_glyph = nodepool.glyph
+----- new_glyph = nodepool.glyph
+local new_glyph = nuts.newmathglyph
local getattrlst = nuts.getattributelist
local setattrlst = nuts.setattributelist
@@ -25,6 +26,8 @@ local getid = nuts.getid
local chardata = fonts.hashes.characters
+-- not yet ok for compact fonts .. needs checking .. or just make this non-compact only
+
local function register_extensible(font,char,style,box)
local bx = tonut(box)
nodes.handlers.finalizelist(bx)
@@ -32,8 +35,9 @@ local function register_extensible(font,char,style,box)
local al = getattrlst(bx)
local wd, ht, dp = getwhd(bx)
local private = fonts.helpers.setboxdirectly(font,chardata[font][char].unicode or char,box)
- local g = new_glyph(font,private)
- setattrlst(g,al)
+ -- local g = new_glyph(font,private)
+ -- setattrlst(g,al)
+ local g = new_glyph(font,private,al)
local n = new_hlist(g)
setwhd(n,wd,ht,dp)
setattrlst(n,al)
diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl
index 74e438fc3..774a7ff28 100644
--- a/tex/context/base/mkxl/math-ini.mkxl
+++ b/tex/context/base/mkxl/math-ini.mkxl
@@ -78,6 +78,7 @@
\registerctxluafile{math-dir}{}
\registerctxluafile{math-spa}{}
\registerctxluafile{math-fnt}{autosuffix}
+\registerctxluafile{math-pre}{autosuffix}
%D A starter:
%D
diff --git a/tex/context/base/mkxl/math-pre.lmt b/tex/context/base/mkxl/math-pre.lmt
new file mode 100644
index 000000000..d10f80cfe
--- /dev/null
+++ b/tex/context/base/mkxl/math-pre.lmt
@@ -0,0 +1,123 @@
+if not modules then modules = { } end modules ['math-pre'] = {
+ version = 1.001,
+ optimize = true,
+ comment = "companion to math-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local type = type
+local gmatch = string.gmatch
+
+local h1 = table.swapped(tex.getmathparametervalues())
+local h2 = table.swapped(tex.getmathstylenamevalues())
+
+local axis = h1.axis
+
+local getmath = tex.getmath
+local setmath = tex.setmath
+
+function setmathparameters(t)
+ if t then
+ for i=1,#t do
+ local ti = t[i]
+ local list = ti.list
+ local factor = ti.factor or 1
+ local styles = ti.styles
+ local value = ti.value
+ local unit = ti.unit
+
+ local function set(li,si,value)
+ if value then
+ setmath(li,si,value)
+ elseif factor == 0 then
+ setmath(li,si,0)
+ elseif unit == "axis" then
+ setmath(li,si,factor * getmath(axis,i))
+ else
+ setmath(li,si,factor * getmath(li,i))
+ end
+ end
+
+ for i=1,#list do
+ local li = h1[list[i]]
+ if li then
+ if styles == "all" then
+ for si=0,7 do
+ set(li,si,value)
+ end
+ elseif type(styles) == "string" then
+ local si = h2[styles]
+ if si then
+ set(li,si,value)
+ end
+ else
+ for s=1,#styles do
+ local si = h2[styles[s]]
+ if si then
+ set(li,si,value)
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+end
+
+local stacklist = {
+ "fractionnumvgap",
+ "fractiondenomvgap",
+ "fractionnumup",
+ "fractiondenomdown",
+ "stackdenomdown",
+ "stacknumup",
+ "stackvgap",
+}
+
+local presets = {
+ less = {
+ {
+ factor = .5,
+ -- factor = 0,
+ -- value = 655360,
+ -- unit = "axis",
+ list = stacklist,
+ -- styles = { "display" },
+ -- styles = "display",
+ styles = "all"
+ },
+ },
+ more = {
+ {
+ factor = 2,
+ list = stacklist,
+ styles = "all"
+ },
+ },
+ zero = {
+ {
+ factor = 0,
+ list = stacklist,
+ styles = "all"
+ },
+ },
+}
+
+mathematics.presets = presets
+
+function mathematics.preset(list)
+ for s in gmatch(list,"[%S,]+") do
+ setmathparameters(presets[s])
+ end
+end
+
+interfaces.implement {
+ name = "presetmathematics",
+ public = true,
+ protected = true,
+ arguments = "optional",
+ actions = mathematics.preset,
+}
+
diff --git a/tex/context/base/mkxl/node-nut.lmt b/tex/context/base/mkxl/node-nut.lmt
index 8675ba05e..0cd6eb051 100644
--- a/tex/context/base/mkxl/node-nut.lmt
+++ b/tex/context/base/mkxl/node-nut.lmt
@@ -172,6 +172,7 @@ local nuts = {
naturalhsize = direct.naturalhsize,
naturalwidth = direct.naturalwidth,
new = direct.new,
+ newmathglyph = direct.newmathglyph,
protectglyph = direct.protectglyph,
protectglyphs = direct.protectglyphs,
protrusionskippable = direct.protrusionskippable,
diff --git a/tex/context/base/mkxl/node-res.lmt b/tex/context/base/mkxl/node-res.lmt
index 4c456b263..93dc65b7b 100644
--- a/tex/context/base/mkxl/node-res.lmt
+++ b/tex/context/base/mkxl/node-res.lmt
@@ -392,7 +392,7 @@ function nutpool.boxrule(width,height,depth) -- w/h/d == nil will let them adapt
return n
end
-function nutpool.leader(width,list)
+local function new_leader(width,list)
local n = copy_nut(cleader)
if width then
setwidth(n,width)
@@ -403,6 +403,12 @@ function nutpool.leader(width,list)
return n
end
+nutpool.leader = new_leader
+
+function nodepool.leader(width,list)
+ return tonode(new_leader(width,list and tonut(list)))
+end
+
function nutpool.leftmarginkern(glyph,width)
local n = copy_nut(left_margin_kern)
if not glyph then
diff --git a/tex/context/base/mkxl/strc-mat.mkxl b/tex/context/base/mkxl/strc-mat.mkxl
index 5f929b5db..74ca24f7b 100644
--- a/tex/context/base/mkxl/strc-mat.mkxl
+++ b/tex/context/base/mkxl/strc-mat.mkxl
@@ -978,11 +978,12 @@
% \protected\def\switchtoformulabodyfont
% {\switchtobodyfont}
-\tolerant\permanent\protected\def\formula[#1];#2% todo: tagged
+\tolerant\permanent\protected\def\formula[#1]#;#2% todo: tagged
{\begingroup
\ifparameters#1\else
\rawprocesscommacommand[#1]\strc_formulas_option
\fi
+ \useformulastyleandcolor\c!style\c!color
\mathematics{#2}%
\endgroup}
diff --git a/tex/context/base/mkxl/strc-ref.mklx b/tex/context/base/mkxl/strc-ref.mklx
index da1b6a42e..f335764bf 100644
--- a/tex/context/base/mkxl/strc-ref.mklx
+++ b/tex/context/base/mkxl/strc-ref.mklx
@@ -1134,7 +1134,7 @@
\def\strc_references_handle_page_state_yes
{\markreferencepage
- \ifcase\referencepagedetail
+ \ifcase\referencepagedetail\relax
\expandafter\sixthofsixarguments \or
\expandafter\thirdofsixarguments \or
\expandafter\firstofsixarguments \or
diff --git a/tex/context/base/mkxl/syst-aux.mkxl b/tex/context/base/mkxl/syst-aux.mkxl
index 2f7acdca0..aceb52aac 100644
--- a/tex/context/base/mkxl/syst-aux.mkxl
+++ b/tex/context/base/mkxl/syst-aux.mkxl
@@ -484,24 +484,41 @@
%D When we were developing the scientific units module, we encountered different
%D behavior in text and math mode, which was due to this grouping subtilities. We
%D therefore decided to use \type {\begingroup} instead of \type {\bgroup}.
+%D
+%D \stoptyping
+%D \doifelsealldefined {foo,ofo} {YES}{NOP}
+%D \doifelseallundefined{foo,ofo} {YES}{NOP}
+%D \doifelsealldefined {relax,ofo}{YES}{NOP}
+%D \doifelseallundefined{foo,relax}{YES}{NOP}
+%D \stoptyping
+
+\def\syst_helpers_do_if_all_defined_else#1%
+ {\ifcsname#1\endcsname\else
+ \donefalse
+ \expandafter\quitcommalist % added
+ \fi}
-\permanent\protected\def\doifelsealldefined#1%
+\def\syst_helpers_do_if_all_undefined_else#1%
+ {\ifcsname#1\endcsname
+ \donefalse
+ \expandafter\quitcommalist
+ \fi}
+
+\permanent\protected\def\syst_helpers_do_if_all_else#1#2%
{\begingroup
\donetrue % we could use a reserved one and avoid the group
- \processcommalist[#1]\syst_helpers_do_if_all_defined_else
+ \processcommalist[#2]#1%
\ifdone
\endgroup\expandafter\firstoftwoarguments
\else
\endgroup\expandafter\secondoftwoarguments
\fi}
-\aliased\let\doifalldefinedelse\doifelsealldefined
+\permanent\protected\def\doifelsealldefined {\syst_helpers_do_if_all_else\syst_helpers_do_if_all_defined_else}
+\permanent\protected\def\doifelseallundefined{\syst_helpers_do_if_all_else\syst_helpers_do_if_all_undefined_else}
-\def\syst_helpers_do_if_all_defined_else#1%
- {\ifcsname#1\endcsname\else
- \donefalse
- \expandafter\quitcommalist % added
- \fi}
+\aliased\let\doifalldefinedelse \doifelsealldefined
+\aliased\let\doifallundefinedelse\doifelseallundefined
%D \macros
%D {doif,doifelse,doifnot}
diff --git a/tex/context/base/mkxl/trac-vis.lmt b/tex/context/base/mkxl/trac-vis.lmt
index f8aecbf12..59d9a01f6 100644
--- a/tex/context/base/mkxl/trac-vis.lmt
+++ b/tex/context/base/mkxl/trac-vis.lmt
@@ -791,7 +791,9 @@ local ruledbox do
local b_cache = caches["box"]
local o_cache = caches["origin"]
- local getshift = nuts.getshift
+ local getshift = nuts.getshift
+ local getorientation = nuts.getorientation
+ local setorientation = nuts.setorientation
setmetatableindex(o_cache,function(t,size)
local rule = new_rule(2*size,size,size)
@@ -807,6 +809,7 @@ local ruledbox do
local wd, ht, dp = getwhd(current)
local force_origin = wd == 0 or (dp + ht) == 0
local shift = getshift(current)
+local orientation, xoffset, yoffset = getorientation(current)
local next = getnext(current)
local prev = previous
setboth(current)
@@ -882,6 +885,7 @@ local ruledbox do
end
info = new_hlist(info,wd,ht,dp,shift)
end
+-- setorientation(info,orientation,xoffset,yoffset)
if next then
setlink(info,next)
end
@@ -1359,6 +1363,7 @@ do
local setleader = nuts.setleader
local setdisc = nuts.setdisc
+ local hpack = nuts.hpack
-- local cache
@@ -1539,6 +1544,7 @@ do
::glue::
content = getleader(current)
if content then
+ -- setleader(current,hpack(visualize(content,false,nil,parent)))
setleader(current,visualize(content,false,nil,parent))
elseif trace_glue then
head, current = ruledglue(head,current,vertical,parent)
diff --git a/tex/context/base/mkxl/type-imp-braille.mkxl b/tex/context/base/mkxl/type-imp-braille.mkxl
new file mode 100644
index 000000000..738874ec8
--- /dev/null
+++ b/tex/context/base/mkxl/type-imp-braille.mkxl
@@ -0,0 +1,84 @@
+%D \module
+%D [ file=type-imp-vraille,
+%D version=2021.11.17,
+%D title=\CONTEXT\ Typescript Macros,
+%D subtitle=Braille (using Dejavu fonts),
+%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 There is no need to waste money on a commercial braille font if we have dejavu. After
+%D all it's just dots. We also don't need features.
+
+\registerctxluafile{font-imp-braille}{autosuffix}
+
+% todo : not fallback, just replace directly .. special case anyway .. now inefficient and slow
+
+\starttypescriptcollection[braille]
+
+ \doifunknownfontfeature {dejavu-math-bold} {\definefontfeature[dejavu-math-bold][boldened]}
+
+ \definefontfeature[brailletext] [braille=text] % no ligatures, no kerning etc
+ \definefontfeature[braillemath] [braille=math] % no ligatures, no kerning etc
+ \definefontfeature[serifbraille] [features=none] % no ligatures, no kerning etc
+ \definefontfeature[sansbraille] [features=none] % no ligatures, no kerning etc
+ \definefontfeature[monobraille] [features=none] % no ligatures, no kerning etc
+ \definefontfeature[mathbraille] [features=none] % [compactmath=yes] % no ssty so compact anyway
+
+ % Maybe some day sans and mono will also have braille but it doesn't really matter because we
+ % don't really need sans and for mono we only need the fixed spacing.
+
+ \definefontfallback[BrailleMono] [\s!name:dejavuserif*brailletext][0x0000-0x1FFFF][force=yes]
+ \definefontfallback[BrailleSerif][\s!name:dejavuserif*brailletext][0x0000-0x1FFFF][force=yes]
+ \definefontfallback[BrailleSans] [\s!name:dejavuserif*brailletext][0x0000-0x1FFFF][force=yes]
+ \definefontfallback[BrailleMath] [\s!name:dejavuserif*braillemath][0x0000-0x1FFFF][force=yes]
+
+ \definefontfallback[BrailleMonoBold] [\s!name:dejavuserifbold*brailletext][0x0000-0x1FFFF][force=yes]
+ \definefontfallback[BrailleSerifBold][\s!name:dejavuserifbold*brailletext][0x0000-0x1FFFF][force=yes]
+ \definefontfallback[BrailleSansBold] [\s!name:dejavuserifbold*brailletext][0x0000-0x1FFFF][force=yes]
+
+ \starttypescript [\s!serif] [braille] [\s!name]
+ \definefontsynonym [\s!Serif] [\s!name:dejavuserif] [\s!features=serifbraille,\s!fallbacks=BrailleSerif]
+ \definefontsynonym [\s!SerifBold] [\s!name:dejavuserifbold][\s!features=serifbraille,\s!fallbacks=BrailleSerifBold]
+ \definefontsynonym [\s!SerifItalic] [\s!Serif]
+ \definefontsynonym [\s!SerifBoldItalic] [\s!SerifBold]
+ \definefontsynonym [\s!SerifSlanted] [\s!Serif]
+ \definefontsynonym [\s!SerifBoldSlanted][\s!SerifBold]
+ \stoptypescript
+
+ \starttypescript [\s!sans] [braille] [\s!name]
+ \definefontsynonym [\s!Sans] [\s!name:dejavusans] [\s!features=sansbraille,\s!fallbacks=BrailleSans]
+ \definefontsynonym [\s!SansBold] [\s!name:dejavusansbold][\s!features=sansbraille,\s!fallbacks=BrailleSansBold]
+ \definefontsynonym [\s!SansItalic] [\s!Sans]
+ \definefontsynonym [\s!SansBoldItalic] [\s!SansBold]
+ \definefontsynonym [\s!SansSlanted] [\s!Sans]
+ \definefontsynonym [\s!SansBoldSlanted][\s!SansBold]
+ \stoptypescript
+
+ \starttypescript [\s!mono] [braille] [\s!name]
+ \definefontsynonym [\s!Mono] [\s!name:dejavusansmono] [\s!features=monobraille,\s!fallbacks=BrailleMono]
+ \definefontsynonym [\s!MonoBold] [\s!name:dejavusansmonobold][\s!features=monobraille,\s!fallbacks=BrailleMonoBold]
+ \definefontsynonym [\s!MonoItalic] [\s!Mono]
+ \definefontsynonym [\s!MonoBoldItalic] [\s!MonoBold]
+ \definefontsynonym [\s!MonoSlanted] [\s!Mono]
+ \definefontsynonym [\s!MonoBoldSlanted][\s!MonoBold]
+ \stoptypescript
+
+ \starttypescript [\s!math][braille] [\s!name]
+ \loadfontgoodies[dejavu-math]
+ \definefontsynonym[\s!MathRoman] [\s!file:texgyredejavu-math][\s!features={mathbraille,\s!math\mathsizesuffix},\s!fallbacks=BrailleMath]
+ \definefontsynonym[\s!MathRomanBold][\s!file:texgyredejavu-math][\s!features={mathbraille,\s!math\mathsizesuffix,dejavu-math-bold},\s!fallbacks=BrailleMath]
+ \stoptypescript
+
+ \starttypescript[braille]
+ \definetypeface [braille] [\s!rm] [\s!serif] [braille] [\s!default]
+ \definetypeface [braille] [\s!ss] [\s!sans] [braille] [\s!default]
+ \definetypeface [braille] [\s!tt] [\s!mono] [braille] [\s!default]
+ \definetypeface [braille] [\s!mm] [\s!math] [braille] [\s!default]
+ \stoptypescript
+
+\stoptypescriptcollection