summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2022-01-06 20:05:31 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2022-01-06 20:05:31 +0100
commit40c16033d164a969e06aacc991371592731baf2a (patch)
treed74d6ccd0713b41105b83b1410d27915c7b68649 /tex
parent9b1c3470a7a222ef9ae20106d750c4a0127819a7 (diff)
downloadcontext-40c16033d164a969e06aacc991371592731baf2a.tar.gz
2022-01-06 19:50:00
Diffstat (limited to 'tex')
-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/mkii/mult-de.mkii4
-rw-r--r--tex/context/base/mkiv/char-def.lua1
-rw-r--r--tex/context/base/mkiv/cldf-bas.lua1
-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-osd.lua473
-rw-r--r--tex/context/base/mkiv/node-bck.lua9
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin24764 -> 24763 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin257473 -> 257564 bytes
-rw-r--r--tex/context/base/mkiv/strc-mat.mkiv8
-rw-r--r--tex/context/base/mkiv/strc-ren.mkiv1
-rw-r--r--tex/context/base/mkxl/attr-ini.lmt5
-rw-r--r--tex/context/base/mkxl/buff-ini.lmt6
-rw-r--r--tex/context/base/mkxl/cldf-bas.lmt15
-rw-r--r--tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--tex/context/base/mkxl/context.mkxl3
-rw-r--r--tex/context/base/mkxl/driv-shp.lmt28
-rw-r--r--tex/context/base/mkxl/font-pre.mkxl7
-rw-r--r--tex/context/base/mkxl/lpdf-ini.lmt84
-rw-r--r--tex/context/base/mkxl/lpdf-pde.lmt1
-rw-r--r--tex/context/base/mkxl/lpdf-ren.lmt9
-rw-r--r--tex/context/base/mkxl/node-bck.lmt88
-rw-r--r--tex/context/base/mkxl/node-met.lmt20
-rw-r--r--tex/context/base/mkxl/node-nut.lmt1
-rw-r--r--tex/context/base/mkxl/node-rul.lmt1
-rw-r--r--tex/context/base/mkxl/pack-com.mkxl20
-rw-r--r--tex/context/base/mkxl/spac-ver.lmt2
-rw-r--r--tex/context/base/mkxl/strc-lnt.mklx11
-rw-r--r--tex/context/base/mkxl/strc-mat.mkxl8
-rw-r--r--tex/context/base/mkxl/task-ini.lmt2
-rw-r--r--tex/context/base/mkxl/typo-drp.lmt9
-rw-r--r--tex/context/base/mkxl/typo-drp.mkxl27
-rw-r--r--tex/context/base/mkxl/typo-syn.lmt435
-rw-r--r--tex/context/base/mkxl/typo-syn.mkxl108
-rw-r--r--tex/context/base/mkxl/util-fil.lmt18
-rw-r--r--tex/context/fonts/mkiv/type-imp-hcrfonts.mkiv141
-rw-r--r--tex/context/fonts/mkiv/type-imp-unfonts.mkiv4
-rw-r--r--tex/context/interface/mkii/keys-de.xml4
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua378
41 files changed, 1531 insertions, 411 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 907bf60cf..0b5ff689e 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.12.30 19:00}
+\newcontextversion{2022.01.06 19:47}
%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 6e89044ab..a76dea83f 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.12.30 19:00}
+\edef\contextversion{2022.01.06 19:47}
%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 43a265056..bca35a89f 100644
--- a/tex/context/base/mkii/mult-de.mkii
+++ b/tex/context/base/mkii/mult-de.mkii
@@ -300,6 +300,7 @@
\setinterfacevariable{july}{juli}
\setinterfacevariable{june}{juni}
\setinterfacevariable{keep}{behalte}
+\setinterfacevariable{keeptogether}{keeptogether}
\setinterfacevariable{kerncharacters}{kerncharacters}
\setinterfacevariable{knockout}{knockout}
\setinterfacevariable{label}{label}
@@ -1229,7 +1230,7 @@
\setinterfaceconstant{solution}{solution}
\setinterfaceconstant{sort}{sort}
\setinterfaceconstant{sorttype}{sorttype}
-\setinterfaceconstant{source}{quelle}
+\setinterfaceconstant{source}{source}
\setinterfaceconstant{space}{spatium}
\setinterfaceconstant{spaceafter}{nachspatium}
\setinterfaceconstant{spaceafterside}{spaceafterside}
@@ -1280,6 +1281,7 @@
\setinterfaceconstant{synonymcommand}{synonymbefehl}
\setinterfaceconstant{synonymstyle}{synonymstil}
\setinterfaceconstant{tab}{tab}
+\setinterfaceconstant{target}{target}
\setinterfaceconstant{text}{text}
\setinterfaceconstant{textalign}{textalign}
\setinterfaceconstant{textalternative}{textalternative}
diff --git a/tex/context/base/mkiv/char-def.lua b/tex/context/base/mkiv/char-def.lua
index 5ed2f0198..024002c07 100644
--- a/tex/context/base/mkiv/char-def.lua
+++ b/tex/context/base/mkiv/char-def.lua
@@ -28707,6 +28707,7 @@ characters.data={
direction="nsm",
indic="o",
indicclass="halant",
+ indicmark="r",
linebreak="cm",
synonyms={ "malayalam chandrakkala", "malayalam vowel half-u" },
unicodeslot=0xD4D,
diff --git a/tex/context/base/mkiv/cldf-bas.lua b/tex/context/base/mkiv/cldf-bas.lua
index ac17a9381..5853f8057 100644
--- a/tex/context/base/mkiv/cldf-bas.lua
+++ b/tex/context/base/mkiv/cldf-bas.lua
@@ -243,4 +243,3 @@ do
end
end
-
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index bdb0d03a6..2e2e914a1 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.12.30 19:00}
+\newcontextversion{2022.01.06 19:47}
%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 61f239979..5ca6fbb50 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.12.30 19:00}
+\edef\contextversion{2022.01.06 19:47}
%D Kind of special:
diff --git a/tex/context/base/mkiv/font-osd.lua b/tex/context/base/mkiv/font-osd.lua
index a4d408e13..1bdd20fd9 100644
--- a/tex/context/base/mkiv/font-osd.lua
+++ b/tex/context/base/mkiv/font-osd.lua
@@ -6,7 +6,6 @@ if not modules then modules = { } end modules ['font-osd'] = { -- script devanag
license = "see context related readme files"
}
-
-- we need to check nbsphash (context only)
-- A few remarks:
@@ -81,8 +80,10 @@ if not modules then modules = { } end modules ['font-osd'] = { -- script devanag
-- malayalam, oriya, tamil and tolugu but not all are checked. Also, some of the
-- code below might need to be adapted to the extra scripts.
-local insert, imerge, copy, tohash = table.insert, table.imerge, table.copy, table.tohash
-local next, type = next, type
+local insert, remove, imerge, copy, tohash = table.insert, table.remove, table.imerge, table.copy, table.tohash
+local next, type, rawget = next, type, rawget
+local formatters = string.formatters
+local settings_to_hash = utilities.parsers.settings_to_hash
local report = logs.reporter("otf","devanagari")
@@ -98,6 +99,8 @@ local methods = fonts.analyzers.methods
local otffeatures = fonts.constructors.features.otf
local registerotffeature = otffeatures.register
+local trace_steps = false
+
local nuts = nodes.nuts
local getnext = nuts.getnext
@@ -130,7 +133,7 @@ local unsetvalue = attributes.unsetvalue
local fontdata = fonts.hashes.identifiers
-local a_syllabe = "syllable" -- attributes.private('syllabe') -- can be just a property key
+local a_syllabe = "syllable" -- attributes.private('syllabe') -- can be just a property key
local a_reordered = "reordered" -- attributes.private('reordered') -- can be just a property key
local dotted_circle = 0x25CC
@@ -157,9 +160,14 @@ replace_all_nbsp = function(head) -- delayed definition
end
local processcharacters = nil
+local logprocess = nil
if context then
- local fontprocesses = fonts.hashes.processes
+
+ local fontprocesses = fonts.hashes.processes
+ local tracers = nodes.tracers
+ local registermessage = (tracers and tracers.steppers.message) or function() end
+
function processcharacters(head,font)
local processors = fontprocesses[font]
for i=1,#processors do
@@ -167,7 +175,24 @@ if context then
end
return head
end
+
+ -- When we'retrying to fix something it can be handy to have some more
+ -- details available.
+
+ trackers.register("otf.steps", function(v) trace_steps = v end)
+
+ logprocess = function(str)
+ if trace_steps then
+ registermessage("devanagari %s",str)
+ if trace_steps == "silent" then
+ return
+ end
+ end
+ report(str)
+ end
+
else
+
function processcharacters(head,font)
local processors = fontdata[font].shared.processes
for i=1,#processors do
@@ -175,6 +200,11 @@ else
end
return head
end
+
+ logprocess = function(str)
+ -- do nothing
+ end
+
end
-- We can assume that script are not mixed in the source but if that is the case
@@ -303,7 +333,7 @@ local after_subscript = indicgroups.after_subscript
local before_main = indicgroups.before_main
local after_main = indicgroups.after_main
-local mark_four = table.merged (
+local mark_pre_above_below_post = table.merged (
pre_mark,
above_mark,
below_mark,
@@ -316,6 +346,14 @@ local mark_above_below_post = table.merged (
post_mark
)
+-- Handy
+
+local devanagarihash = table.setmetatableindex(function(t,k)
+ local v = fontdata[k].resources.devanagari or false
+ t[k] = v
+ return v
+end)
+
-- We use some pseudo features as we need to manipulate the nodelist based
-- on information in the font as well as already applied features. We can
-- probably replace some of the code below by injecting 'real' features
@@ -461,7 +499,7 @@ local function initializedevanagi(tfmdata)
local devanagari = resources.devanagari
if not devanagari then
--
- report("adding devanagari features to font")
+ report("adding features to font")
--
local gsubfeatures = resources.features.gsub
local sequences = resources.sequences
@@ -492,7 +530,9 @@ local function initializedevanagi(tfmdata)
for k, v in next, pre_mark do
local locl = coverage[k]
if locl then
- if #locl > 0 then --contextchain; KE: is this right?
+ -- if #locl > 0 then we have a list otherwise a hash; we actually should
+ -- test properly for gsub_...
+ if #locl > 0 then
for j=1,#locl do
local ck = locl[j]
local f = ck[4]
@@ -513,6 +553,8 @@ local function initializedevanagi(tfmdata)
end
end
end
+ else
+ -- useless next if, because locl is a table
end
if locl then
reorder_matras.steps[1].coverage[locl] = true
@@ -525,7 +567,7 @@ local function initializedevanagi(tfmdata)
if basic_shaping_forms[k] then
lastmatch = lastmatch + 1
if s ~= lastmatch then
- table.insert(sequences, lastmatch, table.remove(sequences, s))
+ insert(sequences,lastmatch,remove(sequences,s))
end
end
end
@@ -546,9 +588,7 @@ local function initializedevanagi(tfmdata)
local vatucache = { }
local pstfcache = { }
local seqsubset = { }
- local rephstep = {
- coverage = { } -- will be adapted each work
- }
+ local rephstep = { coverage = { } } -- will be adapted each work
local devanagari = {
reph = false,
vattu = false,
@@ -578,7 +618,7 @@ local function initializedevanagi(tfmdata)
local has_pstf = features.pstf
if has_rphf and has_rphf[script] then
devanagari.reph = true
- elseif (has_blwf and has_blwf[script] ) or (has_vatu and has_vatu[script] ) then
+ elseif (has_blwf and has_blwf[script]) or (has_vatu and has_vatu[script]) then
devanagari.vattu = true
for i=1,nofsteps do
local step = steps[i]
@@ -586,10 +626,8 @@ local function initializedevanagi(tfmdata)
if coverage then
for k, v in next, coverage do
for h, w in next, halant do
- if v[h] then
- if not blwfcache[k] then
- blwfcache[k] = v
- end
+ if v[h] and not blwfcache[k] then
+ blwfcache[k] = v
end
if has_vatu and has_vatu[script] and not vatucache[k] then
vatucache[k] = v
@@ -611,35 +649,40 @@ local function initializedevanagi(tfmdata)
for k, v in next, ra do
local r = coverage[k]
if r then
+ -- if #r > 0 then we have a list otherwise a hash; we actually should
+ -- test properly for gsub_...
local found = false
- if #r > 0 then -- contextchain; KE: is this right?
+ if #r > 0 then
for j=1,#r do
- local ck = r[j]
- local f = ck[4]
+ local ck = r[j]
+ local f = ck[4]
local chainlookups = ck[6]
- if chainlookups and chainlookups[f] then --KE: why is check for chainlookups[f] necessacy???
+ if chainlookups then
local chainlookup = chainlookups[f]
- for j=1,#chainlookup do
- local chainstep = chainlookup[j]
- local steps = chainstep.steps
- local nofsteps = chainstep.nofsteps
- for i=1,nofsteps do
- local step = steps[i]
- local coverage = step.coverage
- if coverage then
- local h = coverage[k]
- if h then
- for k, v in next, h do
- -- found = v and v.ligature
- found = v and (tonumber(v) or v.ligature)
+ if chainlookup then
+ for j=1,#chainlookup do
+ local chainstep = chainlookup[j]
+ local steps = chainstep.steps
+ local nofsteps = chainstep.nofsteps
+ for i=1,nofsteps do
+ local step = steps[i]
+ local coverage = step.coverage
+ if coverage then
+ local h = coverage[k]
+ if h then
+ for k, v in next, h do
+ if v then
+ found = tonumber(v) or v.ligature
+ if found then
+ pre_base_reordering_consonants[found] = true
+ break
+ end
+ end
+ end
if found then
- pre_base_reordering_consonants[found] = true
break
end
end
- if found then
- break
- end
end
end
end
@@ -648,11 +691,12 @@ local function initializedevanagi(tfmdata)
end
else
for k, v in next, r do
- -- found = v and v.ligature
- found = v and (tonumber(v) or v.ligature)
- if found then
- pre_base_reordering_consonants[found] = true
- break
+ if v then
+ found = tonumber(v) or v.ligature
+ if found then
+ pre_base_reordering_consonants[found] = true
+ break
+ end
end
end
end
@@ -670,18 +714,21 @@ local function initializedevanagi(tfmdata)
local step = steps[i]
local coverage = step.coverage
if coverage then
- local reph, rephbase = false, false
+ local reph = false
+ local base = false
if kind == "rphf" then
-- rphf acts on consonant + halant
for k, v in next, ra do
local r = coverage[k]
if r then
- rephbase = k
+ -- if #r > 0 then we have a list otherwise a hash; we actually should
+ -- test properly for gsub_...
+ base = k
local h = false
- if #r > 0 then --contextchain; KE: is this right?
+ if #r > 0 then
for j=1,#r do
- local ck = r[j]
- local f = ck[4]
+ local ck = r[j]
+ local f = ck[4]
local chainlookups = ck[6]
if chainlookups then
local chainlookup = chainlookups[f]
@@ -698,7 +745,6 @@ local function initializedevanagi(tfmdata)
for k, v in next, halant do
local h = r[k]
if h then
- -- reph = h.ligature or false
reph = tonumber(h) or h.ligature or false
break
end
@@ -716,7 +762,6 @@ local function initializedevanagi(tfmdata)
for k, v in next, halant do
local h = r[k]
if h then
- -- reph = h.ligature or false
reph = tonumber(h) or h.ligature or false
break
end
@@ -728,7 +773,9 @@ local function initializedevanagi(tfmdata)
end
end
end
- seqsubset[#seqsubset+1] = { kind, coverage, reph, rephbase }
+-- if reph then
+ seqsubset[#seqsubset+1] = { kind, coverage, reph, base }
+-- end
end
end
end
@@ -742,18 +789,20 @@ local function initializedevanagi(tfmdata)
for k, v in next, halant do
local h = coverage[k]
if h then
+ -- if #h > 0 then we have a list otherwise a hash; we actually should
+ -- test properly for gsub_...
local found = false
- if #h > 0 then -- contextchain; KE: is this right?
+ if #h > 0 then
for j=1,#h do
- local ck = h[j]
- local f = ck[4]
+ local ck = h[j]
+ local f = ck[4]
local chainlookups = ck[6]
if chainlookups then
local chainlookup = chainlookups[f]
for j=1,#chainlookup do
local chainstep = chainlookup[j]
- local steps = chainstep.steps
- local nofsteps = chainstep.nofsteps
+ local steps = chainstep.steps
+ local nofsteps = chainstep.nofsteps
for i=1,nofsteps do
local step = steps[i]
local coverage = step.coverage
@@ -761,11 +810,12 @@ local function initializedevanagi(tfmdata)
local h = coverage[k]
if h then
for k, v in next, h do
- -- found = v and v.ligature
- found = v and (tonumber(v) or v.ligature)
- if found then
- pre_base_reordering_consonants[found] = true
- break
+ if v then
+ found = tonumber(v) or v.ligature
+ if found then
+ pre_base_reordering_consonants[found] = true
+ break
+ end
end
end
if found then
@@ -779,7 +829,6 @@ local function initializedevanagi(tfmdata)
end
else
for k, v in next, h do
- -- found = v and v.ligature
found = v and (tonumber(v) or v.ligature)
if found then
pre_base_reordering_consonants[found] = true
@@ -807,9 +856,9 @@ local function initializedevanagi(tfmdata)
sharedfeatures["dv03"] = true -- dv03_reorder_pre_base_reordering_consonants
sharedfeatures["dv04"] = true -- dv04_remove_joiners
end
- if script == "mlym" or script == "taml" then
- devanagari.left_matra_before_base = true
- end
+ -- if script == "mlym" or script == "taml" then
+ -- devanagari.movematra = "leftbeforebase"
+ -- end
end
end
end
@@ -823,6 +872,56 @@ registerotffeature {
},
}
+local function initializeconjuncts(tfmdata,value)
+ if value then
+ local resources = tfmdata.resources
+ local devanagari = resources.devanagari
+ if devanagari then
+ local conjuncts = "auto"
+ local conjuncts = "continue"
+ local movematra = "auto"
+ if type(value) == "string" and value ~= "auto" then
+ value = settings_to_hash(value)
+ conjuncts = rawget(value,"conjuncts") or conjuncts
+ movematra = rawget(value,"movematra") or movematra
+ end
+ if conjuncts == "auto" then
+ conjuncts = "continue"
+ -- maybe some day we can figure out bad-fonts logic
+ -- if script == "mlym" or script == "mlm2" or
+ -- script == "taml" or script == "tml2" then
+ -- conjuncts = "continue"
+ -- else
+ -- conjuncts = "quit"
+ -- end
+ end
+ if movematra == "auto" and
+ script == "mlym" or
+ script == "taml" then
+ movematra = "leftbeforebase"
+ else
+ movematra = "default"
+ end
+ devanagari.conjuncts = conjuncts
+ devanagari.movematra = movematra
+ --
+-- if trace_steps then
+ report("conjuncts %a, movematra %a",conjuncts,movematra)
+-- end
+ --
+ end
+ end
+end
+
+registerotffeature {
+ name = "indic",
+ description = "control indic",
+ default = "auto",
+ initializers = {
+ node = initializeconjuncts,
+ },
+}
+
local show_syntax_errors = false
local function inject_syntax_error(head,current,char)
@@ -883,7 +982,7 @@ end
-- HH: somehow we can get a non context here so for now we check for .n
-local function contextchain(contexts, n)
+local function contextchain(contexts,n)
local char = getchar(n)
if not contexts.n then
return contexts[char]
@@ -950,11 +1049,13 @@ local function order_matras(c)
end
end
+local swapped = table.swapped(states)
+
local function reorder_one(head,start,stop,font,attr,nbspaces)
local reph, vattu, blwfcache, vatucache, pstfcache = initialize_one(font,attr) -- todo: a hash[font]
- local devanagari = fontdata[font].resources.devanagari
+ -- local devanagari = devanagarihash[font]
local current = start
local n = getnext(start)
local base = nil
@@ -982,6 +1083,9 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
stop = getprev(stop)
head = remove_node(head,current)
flushnode(current)
+ if trace_steps then
+ logprocess("reorder one, remove nbsp")
+ end
return head, stop, nbspaces
else
nbspaces = nbspaces + 1
@@ -1025,6 +1129,9 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
stop = current
end
end
+ if trace_steps then
+ logprocess("reorder one, handle nbsp")
+ end
end
end
end
@@ -1086,6 +1193,9 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
if lastcons == stop then
stop = n
end
+ if trace_steps then
+ logprocess("reorder one, handle halant")
+ end
end
end
@@ -1115,6 +1225,9 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
if matra == stop then
stop = n
end
+ if trace_steps then
+ logprocess("reorder one, handle matra")
+ end
end
local current = start
@@ -1161,14 +1274,19 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
end
local tpm = twopart_mark[ch]
- while tpm do
- local extra = copy_node(n)
- copyinjection(extra,n)
- ch = tpm[1]
- setchar(n,ch)
- setchar(extra,tpm[2])
- head = insertnodeafter(head,current,extra)
- tpm = twopart_mark[ch]
+ if tpm then
+ while tpm do
+ local extra = copy_node(n)
+ copyinjection(extra,n)
+ ch = tpm[1]
+ setchar(n,ch)
+ setchar(extra,tpm[2])
+ head = insertnodeafter(head,current,extra)
+ tpm = twopart_mark[ch]
+ end
+ if trace_steps then
+ logprocess("reorder one, handle mark")
+ end
end
while c ~= stop and dependent_vowel[ch] do
c = n
@@ -1191,10 +1309,11 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
local bp = getprev(firstcons)
local cn = getnext(current)
local last = getnext(c)
+ local done = false
while cn ~= last do
-- move pre-base matras...
if pre_mark[getchar(cn)] then
- if devanagari.left_matra_before_base then
+ if devanagarihash[font].movematra == "leftbeforebase" then
local prev, next = getboth(cn)
setlink(prev,next)
if cn == stop then
@@ -1232,6 +1351,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
end
cn = next
end
+ done = true
elseif current ~= base and dependent_vowel[getchar(cn)] then
local prev, next = getboth(cn)
if next then
@@ -1244,6 +1364,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
setlink(b,cn,getnext(b))
order_matras(cn)
cn = next
+ done = true
elseif current == base and dependent_vowel[getchar(cn)] then
local cnn = getnext(cn)
order_matras(cn)
@@ -1257,10 +1378,15 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
end
allreordered = c == stop
current = getnext(c)
+ if done and trace_steps then
+ logprocess("reorder one, matra")
+ end
end
if reph or vattu then
- local current, cns = start, nil
+ local current = start
+ local cns = nil
+ local done = false
while current ~= stop do
local c = current
local n = getnext(current)
@@ -1293,6 +1419,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
local next = getnext(b)
setlink(c,next)
setlink(b,current)
+ done = true
end
elseif cns and getnext(cns) ~= current then -- todo: optimize next
-- position below-base Ra (vattu) following the consonants on which it is placed (either the base consonant or one of the pre-base consonants)
@@ -1301,6 +1428,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
setlink(cp,n)
setlink(cns,current) -- cns ?
setlink(c,cnsn)
+ done = true
if c == stop then
stop = cp
break
@@ -1340,6 +1468,9 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
end
current = getnext(current)
end
+ if done and trace_steps then
+ logprocess("reorder one, handle reph and vata") -- todo: boolean
+ end
end
if getchar(base) == c_nbsp then
@@ -1386,6 +1517,9 @@ function handlers.devanagari_reorder_matras(head,start) -- no leak
setlink(current,start)
-- setlink(current,start,next) -- maybe
start = startnext
+ if trace_steps then
+ logprocess("reorder matra")
+ end
break
-- elseif consonant[char] and (not getstate(current) or getstate(current,s_init) then
-- startnext = getnext(start)
@@ -1451,6 +1585,9 @@ function handlers.devanagari_reorder_reph(head,start)
local char = ischar(current,startfont)
if char and getprop(current,a_syllabe) == startattr then
if halant[char] then
+ if trace_steps then
+ logprocess("reorder reph, handling halant")
+ end
local next = getnext(current)
if next then
local nextchar = ischar(next,startfont)
@@ -1488,6 +1625,9 @@ function handlers.devanagari_reorder_reph(head,start)
local char = ischar(current,startfont)
if char and getprop(current,a_syllabe) == startattr then
if consonant[char] and not getstate(current,s_pref) then
+ if trace_steps then
+ logprocess("reorder reph, handling consonant")
+ end
startnext = getnext(start)
head = remove_node(head,start)
setlink(current,start)
@@ -1519,6 +1659,9 @@ function handlers.devanagari_reorder_reph(head,start)
local char = ischar(current,startfont)
if char and getprop(current,a_syllabe) == startattr then
if getstate(current,s_pstf) then -- post-base
+ if trace_steps then
+ logprocess("reorder reph, before postscript, post base")
+ end
startnext = getnext(start)
head = remove_node(head,start)
setlink(getprev(current),start)
@@ -1533,6 +1676,9 @@ function handlers.devanagari_reorder_reph(head,start)
current = getnext(current)
else
if c then
+ if trace_steps then
+ logprocess("reorder reph, before postscript")
+ end
startnext = getnext(start)
head = remove_node(head,start)
setlink(getprev(c),start)
@@ -1564,7 +1710,13 @@ function handlers.devanagari_reorder_reph(head,start)
local state = getstate(current)
if before_subscript[rephbase] and (state == s_blwf or state == s_pstf) then
c = current
+ if trace_steps then
+ logprocess("reorder reph, before subscript")
+ end
elseif after_subscript[rephbase] and (state == s_pstf) then
+ if trace_steps then
+ logprocess("reorder reph, after subscript")
+ end
c = current
end
current = getnext(current)
@@ -1602,6 +1754,9 @@ function handlers.devanagari_reorder_reph(head,start)
end
end
if start ~= current then
+ if trace_steps then
+ logprocess("reorder reph, to end")
+ end
startnext = getnext(start)
head = remove_node(head,start)
setlink(start,getnext(current))
@@ -1629,6 +1784,8 @@ end
-- return head, start, done
-- end
+-- todo: nodes -> table -> nodes
+
function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start)
if getprop(start,a_reordered) then
return head, start, true
@@ -1641,6 +1798,9 @@ function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start)
local next = getnext(current)
if char and getprop(current,a_syllabe) == startattr then
if halant[char] then -- state can also be init
+ if trace_steps then
+ logprocess("reorder pre base consonants, handle halant")
+ end
if next then
local char = ischar(next,startfont)
if char and zw_char[char] and getprop(next,a_syllabe) == startattr then
@@ -1681,6 +1841,9 @@ function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start)
while current and getprop(current,a_syllabe) == startattr do
local char = ischar(current)
if (not dependent_vowel[char] and (not getstate(current) or getstate(current,s_init))) then
+ if trace_steps then
+ logprocess("reorder pre base consonants, handle vowel or initial")
+ end
startnext = getnext(start)
head = remove_node(head,start)
if current == head then
@@ -1724,6 +1887,9 @@ function handlers.devanagari_remove_joiners(head,start,kind,lookupname,replaceme
head = stop
end
flushlist(start)
+ if trace_steps then
+ logprocess("remove joiners")
+ end
return head, stop, true
end
@@ -1750,8 +1916,8 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
local subpos = nil
local postpos = nil
- reorderreph.coverage = { }
- rephbase[font] = { }
+ reorderreph.coverage = { } -- use local
+ rephbase[font] = { } -- use local
for i=1,#seqsubset do
@@ -1761,8 +1927,12 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
local kind = subset[1]
local lookupcache = subset[2]
if kind == "rphf" then
- reorderreph.coverage[subset[3]] = true -- neat
- rephbase[font][subset[3]] = subset[4]
+ --
+ local reph = subset[3]
+ local base = subset[4]
+ reorderreph.coverage[reph] = true -- neat -- use local
+ rephbase[font][reph] = base -- use local
+ --
local current = start
local last = getnext(stop)
while current ~= last do
@@ -1771,16 +1941,15 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
local found = lookupcache[c]
if found then
local next = getnext(current)
- -- if found[getchar(next)] or contextchain(found, next) then --above-base: rphf Consonant + Halant
- if contextchain(found, next) then --above-base: rphf Consonant + Halant
+ if contextchain(found, next) then -- above-base: rphf Consonant + Halant
local afternext = next ~= stop and getnext(next)
if afternext and zw_char[getchar(afternext)] then -- ZWJ and ZWNJ prevent creation of reph
current = afternext -- getnext(next)
elseif current == start then
setstate(current,s_rphf)
- current = next
+ current = next -- later again next
else
- current = next
+ current = next -- later again next
end
end
end
@@ -1796,9 +1965,8 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
local found = lookupcache[c]
if found then -- pre-base: pref Halant + Consonant
local next = getnext(current)
- -- if found[getchar(next)] or contextchain(found, next) then
if contextchain(found, next) then
- if (not getstate(current) and not getstate(next)) then --KE: state can also be init...
+ if not getstate(current) and not getstate(next) then --KE: state can also be init...
setstate(current,s_pref)
setstate(next,s_pref)
current = next
@@ -1817,11 +1985,10 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
local found = lookupcache[c]
if found then
local next = getnext(current)
- -- if found[getchar(next)] or contextchain(found, next) then
if contextchain(found, next) then
if next ~= stop and getchar(getnext(next)) == c_zwnj then -- zwnj prevent creation of half
current = next
- elseif (not getstate(current)) then --KE: state can also be init...
+ elseif not getstate(current) then --KE: state can also be init...
setstate(current,s_half)
if not halfpos then
halfpos = current
@@ -1842,9 +2009,8 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
local found = lookupcache[c]
if found then
local next = getnext(current)
- -- if found[getchar(next)] or contextchain(found, next) then
if contextchain(found, next) then
- if (not getstate(current) and not getstate(next)) then --KE: state can also be init...
+ if not getstate(current) and not getstate(next) then --KE: state can also be init...
setstate(current,s_blwf)
setstate(next,s_blwf)
current = next
@@ -1864,9 +2030,8 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
local found = lookupcache[c]
if found then
local next = getnext(current)
- -- if found[getchar(next)] or contextchain(found, next) then
if contextchain(found, next) then
- if (not getstate(current) and not getstate(next)) then -- KE: state can also be init...
+ if not getstate(current) and not getstate(next) then -- KE: state can also be init...
setstate(current,s_pstf)
setstate(next,s_pstf)
current = next
@@ -1893,6 +2058,9 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
stop = getprev(stop)
head = remove_node(head,current)
flushnode(current)
+ if trace_steps then
+ logprocess("reorder two, remove nbsp")
+ end
return head, stop, nbspaces
else
nbspaces = nbspaces + 1
@@ -1933,6 +2101,9 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
end
end
end
+ if trace_steps then
+ logprocess("reorder two, handle nbsp")
+ end
end
else -- not Stand Alone cluster
local last = getnext(stop)
@@ -1989,14 +2160,19 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
local cn = getnext(current)
-- not so efficient (needed for malayalam)
local tpm = twopart_mark[char]
- while tpm do
- local extra = copy_node(current)
- copyinjection(extra,current)
- char = tpm[1]
- setchar(current,char)
- setchar(extra,tpm[2])
- head = insertnodeafter(head,current,extra)
- tpm = twopart_mark[char]
+ if tpm then
+ while tpm do
+ local extra = copy_node(current)
+ copyinjection(extra,current)
+ char = tpm[1]
+ setchar(current,char)
+ setchar(extra,tpm[2])
+ head = insertnodeafter(head,current,extra)
+ tpm = twopart_mark[char]
+ end
+ if tpm and trace_steps then
+ logprocess("reorder two, handle matra")
+ end
end
--
if not moved[current] and dependent_vowel[char] then
@@ -2047,6 +2223,9 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
setlink(getprev(pos),current)
setlink(current,pos)
-- setlink(getprev(pos),current,pos) -- maybe
+ if trace_steps then
+ logprocess("reorder two, handle pre mark")
+ end
elseif above_mark[char] then
-- after main consonant
target = basepos
@@ -2090,13 +2269,16 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
setlink(current,getnext(target))
setlink(target,current)
-- setlink(target,current,getnext(target)) -- maybe
+ if trace_steps then
+ logprocess("reorder two, handle mark")
+ end
end
end
end
current = cn
end
- -- reorder halant+Ra
+ -- reorder halant + Ra
local current = getnext(start)
local last = getnext(stop)
@@ -2120,6 +2302,9 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
stop = prev
end
cn = next
+ if trace_steps then
+ logprocess("reorder two, handle halant and ra")
+ end
end
end
-- after_postscript
@@ -2159,6 +2344,9 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
setprev(nextnextnext,current)
end
setlink(nextnext,c)
+ if trace_steps then
+ logprocess("reorder two, handle nukta")
+ end
end
if stop == current then break end
current = getnext(current)
@@ -2171,6 +2359,9 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
nbspaces = nbspaces - 1
head = remove_node(head, base)
flushnode(base)
+ if trace_steps then
+ logprocess("reorder two, handle nbsp")
+ end
end
return head, stop, nbspaces
@@ -2267,21 +2458,38 @@ local function analyze_next_chars_one(c,font,variant) -- skip one dependent vowe
local already_below_mark -- = false
local already_post_mark -- = false
while dependent_vowel[v] do
- local vowels = twopart_mark[v] or { v }
- for k, v in next, vowels do
- if pre_mark[v] and not already_pre_mark then
+ local vowels = twopart_mark[v]
+ if vowels then
+ for k=1,#vowels do
+ local v = vowels[k]
+ if pre_mark[v] and not already_pre_mark then
+ already_pre_mark = true
+ elseif above_mark[v] and not already_above_mark then
+ already_above_mark = true
+ elseif below_mark[v] and not already_below_mark then
+ already_below_mark = true
+ elseif post_mark[v] and not already_post_mark then
+ already_post_mark = true
+ elseif devanagarihash[font].conjuncts == "quit" then
+ return c
+ end
+ end
+ else
+ if devanagarihash[font].conjuncts == "quit" then
+ return c
+ elseif pre_mark[v] and not already_pre_mark then
already_pre_mark = true
- elseif above_mark[v] and not already_above_mark then
- already_above_mark = true
- elseif below_mark[v] and not already_below_mark then
- already_below_mark = true
elseif post_mark[v] and not already_post_mark then
already_post_mark = true
+ elseif below_mark[v] and not already_below_mark then
+ already_below_mark = true
+ elseif above_mark[v] and not already_above_mark then
+ already_above_mark = true
else
return c
end
end
- c = getnext(c)
+ c = n
n = getnext(c)
if not n then
return c
@@ -2292,7 +2500,7 @@ local function analyze_next_chars_one(c,font,variant) -- skip one dependent vowe
end
end
if nukta[v] then
- c = getnext(c)
+ c = n
n = getnext(c)
if not n then
return c
@@ -2303,7 +2511,7 @@ local function analyze_next_chars_one(c,font,variant) -- skip one dependent vowe
end
end
if halant[v] then
- c = getnext(c)
+ c = n
n = getnext(c)
if not n then
return c
@@ -2314,7 +2522,7 @@ local function analyze_next_chars_one(c,font,variant) -- skip one dependent vowe
end
end
if vowel_modifier[v] then
- c = getnext(c)
+ c = n
n = getnext(c)
if not n then
return c
@@ -2325,7 +2533,7 @@ local function analyze_next_chars_one(c,font,variant) -- skip one dependent vowe
end
end
if stress_tone_mark[v] then
- c = getnext(c)
+ c = n
n = getnext(c)
if not n then
return c
@@ -2456,17 +2664,35 @@ local function analyze_next_chars_two(c,font)
local already_above_mark -- = false
local already_below_mark -- = false
local already_post_mark -- = false
+ -- inefficient : too many tests but seldom more than one
while dependent_vowel[v] do
- local vowels = twopart_mark[v] or { v }
- for k, v in next, vowels do
- if pre_mark[v] and not already_pre_mark then
+ local vowels = twopart_mark[v]
+ if vowels then
+ for k=1,#vowels do
+ local v = vowels[k]
+ if pre_mark[v] and not already_pre_mark then
+ already_pre_mark = true
+ elseif above_mark[v] and not already_above_mark then
+ already_above_mark = true
+ elseif below_mark[v] and not already_below_mark then
+ already_below_mark = true
+ elseif post_mark[v] and not already_post_mark then
+ already_post_mark = true
+ elseif devanagarihash[font].conjuncts == "quit" then
+ return c
+ end
+ end
+ else
+ if devanagarihash[font].conjuncts == "quit" then
+ return c
+ elseif pre_mark[v] and not already_pre_mark then
already_pre_mark = true
- elseif above_mark[v] and not already_above_mark then
- already_above_mark = true
- elseif below_mark[v] and not already_below_mark then
- already_below_mark = true
elseif post_mark[v] and not already_post_mark then
already_post_mark = true
+ elseif below_mark[v] and not already_below_mark then
+ already_below_mark = true
+ elseif above_mark[v] and not already_above_mark then
+ already_above_mark = true
else
return c
end
@@ -2724,7 +2950,7 @@ local function method_one(head,font,attr)
end
else
if show_syntax_errors then
- local mark = mark_four[char]
+ local mark = mark_pre_above_below_post[char]
if mark then
head, current = inject_syntax_error(head,current,char)
end
@@ -2816,7 +3042,6 @@ local function method_two(head,font,attr)
syllableend = current
elseif consonant[getchar(current)] then
-- WHY current INSTEAD OF c ?
-
-- Consonant syllable: {C+[N]+<H+[<ZWNJ|ZWJ>]|<ZWNJ|ZWJ>+H>} + C+[N]+[A] + [< H+[<ZWNJ|ZWJ>] | {M}+[N]+[H]>]+[SM]+[(VD)]
current = analyze_next_chars_two(current,font) -- not c !
syllableend = current
@@ -2838,7 +3063,7 @@ local function method_two(head,font,attr)
if not syllableend and show_syntax_errors then
local char = ischar(current,font)
if char and not getstate(current) then -- state can also be init
- local mark = mark_four[char]
+ local mark = mark_pre_above_below_post[char]
if mark then
head, current = inject_syntax_error(head,current,char)
end
diff --git a/tex/context/base/mkiv/node-bck.lua b/tex/context/base/mkiv/node-bck.lua
index d81d2a27b..b2c36ea52 100644
--- a/tex/context/base/mkiv/node-bck.lua
+++ b/tex/context/base/mkiv/node-bck.lua
@@ -238,15 +238,6 @@ function nodes.handlers.backgroundsvbox(head,where)
return head
end
--- interfaces.implement {
--- name = "enablebackgroundboxes",
--- onlyonce = true,
--- actions = enableaction,
--- arguments = { "'shipouts'", "'nodes.handlers.backgrounds'" }
--- }
---
--- doing it in the shipout works as well but this is nicer
-
local function enable(alignmentstoo)
if not enabled then
enabled = true
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 5d46013f9..cda4f4219 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 03cb36fc9..e8b4cfefc 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 d3f47adac..d0d406652 100644
--- a/tex/context/base/mkiv/strc-mat.mkiv
+++ b/tex/context/base/mkiv/strc-mat.mkiv
@@ -623,7 +623,6 @@
\setvalue{\??mathdisplayspacemodel\v!after:1}% old
{\prevdepth .5\strutdp
- \edef\p_spaceafter{\formulaparameter\c!spaceafter}%
\ifx\p_spaceafter\v!none
% nothing
\else
@@ -640,7 +639,6 @@
\setvalue{\??mathdisplayspacemodel\v!after:2}% old
{\prevdepth\lineheight
- \edef\p_spaceafter{\formulaparameter\c!spaceafter}%
\ifx\p_spaceafter\v!none
% nothing
\else
@@ -671,11 +669,11 @@
\else\ifx\p_spacebefore\empty
\directvspacing\currentvspacing
\else
- \directvspacing{\p_spacebefore,\the\scratchdimen}%
+ \directvspacing\p_spacebefore
\fi\fi
\else
\ifx\p_spacebefore\v!none
- \directvspacing{\m_spacebefore}%
+ \directvspacing\m_spacebefore
\else\ifx\p_spacebefore\empty
\directvspacing{\m_spacebefore,\currentvspacing}%
\else
@@ -709,7 +707,7 @@
\else\ifx\p_spacebefore\empty
\directvspacing\currentvspacing
\else
- \directvspacing{\p_spacebefore,\the\scratchdimen}%
+ \directvspacing\p_spacebefore
\fi\fi
\fi
\else
diff --git a/tex/context/base/mkiv/strc-ren.mkiv b/tex/context/base/mkiv/strc-ren.mkiv
index 359bd6aec..8926dfe8d 100644
--- a/tex/context/base/mkiv/strc-ren.mkiv
+++ b/tex/context/base/mkiv/strc-ren.mkiv
@@ -381,6 +381,7 @@
\noindentation
\else
\ignoreparskip
+ \doindentation
\fi\fi}
% nice testcase
diff --git a/tex/context/base/mkxl/attr-ini.lmt b/tex/context/base/mkxl/attr-ini.lmt
index ca21365cb..2a4805a01 100644
--- a/tex/context/base/mkxl/attr-ini.lmt
+++ b/tex/context/base/mkxl/attr-ini.lmt
@@ -253,6 +253,11 @@ function attributes.hasvalues(index)
return list and next(list) and true or false
end
+function attributes.getvalues(index)
+ local list = values[index]
+ return list and next(list) and list or nil
+end
+
function attributes.setcleaner(index,cleaner)
cleaners[index] = cleaner
end
diff --git a/tex/context/base/mkxl/buff-ini.lmt b/tex/context/base/mkxl/buff-ini.lmt
index 2cde7c72b..a14056f7d 100644
--- a/tex/context/base/mkxl/buff-ini.lmt
+++ b/tex/context/base/mkxl/buff-ini.lmt
@@ -1017,7 +1017,8 @@ do
-- In the end we went for a somewhat hidden low level one (see low level math tests
-- for usage):
- local showbox = tex.showbox
+ local serialized = nodes.nuts.serialized
+ local getbox = nodes.nuts.getbox
implement {
name = "showboxinbuffer",
@@ -1025,7 +1026,8 @@ do
protected = true,
arguments = { "argument", "integer", "integer" },
actions = function(buffer, box, detail)
- assign(buffer or "",showbox(box, detail))
+ local box = getbox(box)
+ assign(buffer or "",box and serialized(box,detail))
end,
}
diff --git a/tex/context/base/mkxl/cldf-bas.lmt b/tex/context/base/mkxl/cldf-bas.lmt
index 6fc6e03a4..40b2b74a5 100644
--- a/tex/context/base/mkxl/cldf-bas.lmt
+++ b/tex/context/base/mkxl/cldf-bas.lmt
@@ -245,3 +245,18 @@ do
end
+-- for the moment here:
+
+do
+
+ local texset = tex.set
+ local maxdimen = tex.magicconstants.maxdimen
+
+ function tex.dontcomplain()
+ texset("hbadness",maxdimen)
+ texset("vbadness",maxdimen)
+ texset("hfuzz", maxdimen)
+ texset("vfuzz", maxdimen)
+ end
+
+end
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index 35e8bf03d..d9a326406 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.12.30 19:00}
+\newcontextversion{2022.01.06 19:47}
%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 385a2c13a..392895fe6 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.12.30 19:00}
+\immutable\edef\contextversion{2022.01.06 19:47}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
@@ -533,6 +533,7 @@
\loadmkxlfile{lang-hup}
\loadmkxlfile{typo-ovl} % fuzzy project (tracing) code
+\loadmkxlfile{typo-syn} % experiment
% old bibtex support: (will be m-oldbibtex.mkiv)
diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt
index 620c69484..2cb351880 100644
--- a/tex/context/base/mkxl/driv-shp.lmt
+++ b/tex/context/base/mkxl/driv-shp.lmt
@@ -1023,7 +1023,8 @@ local hlist_out, vlist_out do
-- pos_v = ref_v - (cur_v + basepoint_v)
pos_v = ref_v - basepoint_v
elseif hasoffset then
- local orientation, xoffset, yoffset = getorientation(current)
+-- local orientation, xoffset, yoffset = getorientation(current)
+ local xoffset, yoffset = getoffsets(current)
local basepoint_h = boxdir ~= pos_r and width or 0
local basepoint_v = shift
if target then
@@ -1398,7 +1399,8 @@ local hlist_out, vlist_out do
end
pos_v = ref_v - (cur_v + basepoint_v)
elseif hasoffset then
- local orientation, xoffset, yoffset = getorientation(current)
+-- local orientation, xoffset, yoffset = getorientation(current)
+ local xoffset, yoffset = getoffsets(current)
-- local basepoint_h = shift
-- local basepoint_v = height
if boxdir ~= pos_r then
@@ -1742,25 +1744,3 @@ do
end)
end
-
--- local function calculate_width_to_enddir(this_box,begindir) -- can be a helper
--- local dir_nest = 1
--- local enddir = begindir
--- for current, subtype in nextdir, getnext(begindir) do
--- if subtype == normaldir_code then -- todo
--- dir_nest = dir_nest + 1
--- else
--- dir_nest = dir_nest - 1
--- end
--- if dir_nest == 0 then -- does the type matter
--- enddir = current
--- local width = rangedimensions(this_box,begindir,enddir)
--- return enddir, width
--- end
--- end
--- if enddir == begindir then
--- local width = rangedimensions(this_box,begindir) -- ,enddir)
--- return enddir, width
--- end
--- return enddir, 0
--- end
diff --git a/tex/context/base/mkxl/font-pre.mkxl b/tex/context/base/mkxl/font-pre.mkxl
index ffad757a9..c8dac54e6 100644
--- a/tex/context/base/mkxl/font-pre.mkxl
+++ b/tex/context/base/mkxl/font-pre.mkxl
@@ -193,13 +193,18 @@
[semitic-simple]
[script=hebr]
-% indic
+% indic:
+%
+% conjuncts : auto | continue | quit (default)
+% movematra : auto | leftbeforebase | default
\definefontfeature
[indic-common]
[mode=node,
language=dflt,
% localized
+ % indic=auto,
+ % localized
locl=yes,
% positioning
kern=yes,
diff --git a/tex/context/base/mkxl/lpdf-ini.lmt b/tex/context/base/mkxl/lpdf-ini.lmt
index 9357ebe75..d4b0ccc64 100644
--- a/tex/context/base/mkxl/lpdf-ini.lmt
+++ b/tex/context/base/mkxl/lpdf-ini.lmt
@@ -354,22 +354,54 @@ do
end
+local pdfescaped do
+
+ local replacer = S("\0\t\n\r\f ()[]{}/%%#\\") / {
+ ["\00"]="#00",
+ ["\09"]="#09",
+ ["\10"]="#0a",
+ ["\12"]="#0c",
+ ["\13"]="#0d",
+ [ " " ]="#20",
+ [ "#" ]="#23",
+ [ "%" ]="#25",
+ [ "(" ]="#28",
+ [ ")" ]="#29",
+ [ "/" ]="#2f",
+ [ "[" ]="#5b",
+ [ "\\"]="#5c",
+ [ "]" ]="#5d",
+ [ "{" ]="#7b",
+ [ "}" ]="#7d",
+ } + P(1)
+
+ local p_escaped_1 = Cs(Cc("/") * replacer^0)
+ local p_escaped_2 = Cs( replacer^0)
+
+ pdfescaped = function(str,slash)
+ return lpegmatch(slash and p_escaped_1 or p_escaped_2,str) or str
+ end
+
+ lpdf.escaped = pdfescaped
+
+end
+
local tostring_a, tostring_d
do
- local f_key_null = formatters["/%s null"]
- local f_key_value = formatters["/%s %s"]
- -- local f_key_dictionary = formatters["/%s << % t >>"]
+ local f_key_null = formatters["%s null"]
+ local f_key_value = formatters["%s %s"]
+ -- local f_key_dictionary = formatters["%s << % t >>"]
-- local f_dictionary = formatters["<< % t >>"]
- local f_key_dictionary = formatters["/%s << %s >>"]
+ local f_key_dictionary = formatters["%s << %s >>"]
local f_dictionary = formatters["<< %s >>"]
- -- local f_key_array = formatters["/%s [ % t ]"]
+ -- local f_key_array = formatters["%s [ % t ]"]
-- local f_array = formatters["[ % t ]"]
- local f_key_array = formatters["/%s [ %s ]"]
+ local f_key_array = formatters["%s [ %s ]"]
local f_array = formatters["[ %s ]"]
- local f_key_number = formatters["/%s %N"] -- always with max 9 digits and integer is possible
- local f_tonumber = formatters["%N"] -- always with max 9 digits and integer is possible
+ local f_key_number = formatters["%s %N"] -- always with max 9 digits and integer is possible
+ local f_tonumber = formatters["%N"] -- always with max 9 digits and integer is possible
tostring_d = function(t,contentonly,key)
if next(t) then
@@ -394,6 +426,9 @@ do
local v = t[k]
local tv = type(v)
-- mostly tables
+ --
+ k = pdfescaped(k,true)
+ --
if tv == "table" then
-- local mv = getmetatable(v)
-- if mv and mv.__lpdftype then
@@ -424,7 +459,7 @@ do
if contentonly then
return r
elseif key then
- return f_key_dictionary(key,r)
+ return f_key_dictionary(pdfescaped(key,true),r)
else
return f_dictionary(r)
end
@@ -474,7 +509,7 @@ do
if contentonly then
return r
elseif key then
- return f_key_array(key,r)
+ return f_key_array(pdfescaped(key,true),r)
else
return f_array(r)
end
@@ -651,29 +686,10 @@ do
for i=-1,9 do cache[i] = pdfnumber(i) end
- local replacer = S("\0\t\n\r\f ()[]{}/%%#\\") / {
- ["\00"]="#00",
- ["\09"]="#09",
- ["\10"]="#0a",
- ["\12"]="#0c",
- ["\13"]="#0d",
- [ " " ]="#20",
- [ "#" ]="#23",
- [ "%" ]="#25",
- [ "(" ]="#28",
- [ ")" ]="#29",
- [ "/" ]="#2f",
- [ "[" ]="#5b",
- [ "\\"]="#5c",
- [ "]" ]="#5d",
- [ "{" ]="#7b",
- [ "}" ]="#7d",
- } + P(1)
-
- local escaped = Cs(Cc("/") * replacer^0)
+ local escaped = lpdf.escaped
local cache = table.setmetatableindex(function(t,k)
- local v = setmetatable({ lpegmatch(escaped,k) }, mt_c)
+ local v = setmetatable({ escaped(k,true) }, mt_c)
t[k] = v
return v
end)
@@ -685,12 +701,6 @@ do
return cache[str]
end
- local escaped = Cs(replacer^0)
-
- function lpdf.escaped(str)
- return lpegmatch(escaped,str) or str
- end
-
end
local pdfnull, pdfboolean, pdfreference, pdfverbose
diff --git a/tex/context/base/mkxl/lpdf-pde.lmt b/tex/context/base/mkxl/lpdf-pde.lmt
index bb5830735..68712d58d 100644
--- a/tex/context/base/mkxl/lpdf-pde.lmt
+++ b/tex/context/base/mkxl/lpdf-pde.lmt
@@ -1090,6 +1090,7 @@ if images then do
copydictionary = function (xref,copied,object)
local target = pdfdictionary()
local source = object.__raw__
+ -- hm .. no need to sort here as we create a hash
-- for key, value in next, source do
for key, value in sortedhash(source) do
if plugins then
diff --git a/tex/context/base/mkxl/lpdf-ren.lmt b/tex/context/base/mkxl/lpdf-ren.lmt
index 0343ab76a..ea34505fa 100644
--- a/tex/context/base/mkxl/lpdf-ren.lmt
+++ b/tex/context/base/mkxl/lpdf-ren.lmt
@@ -94,7 +94,8 @@ local pagelayers, pagelayersreference, cache = nil, nil, { }
local alphabetic = { }
local escapednames = table.setmetatableindex(function(t,k)
- local v = escaped(k)
+-- local v = escaped(k)
+ local v = escaped(k,true)
t[k] = v
return v
end)
@@ -151,7 +152,8 @@ local function useviewerlayer(name) -- move up so that we can use it as local
else
hidelayers[#hidelayers+1] = nr
end
- pagelayers[escapednames[tag]] = dr -- check
+ -- pagelayers[escapednames[tag]] = dr -- check
+ pagelayers[tag] = dr -- check
else
-- todo: message
end
@@ -241,7 +243,8 @@ function executers.togglelayer(arguments) return setlayer(pdf_toggle,arguments)
-- injection
-local f_bdc = formatters["/OC /%s BDC"]
+-- local f_bdc = formatters["/OC /%s BDC"]
+local f_bdc = formatters["/OC %s BDC"]
local s_emc = "EMC"
function codeinjections.startlayer(name) -- used in mp
diff --git a/tex/context/base/mkxl/node-bck.lmt b/tex/context/base/mkxl/node-bck.lmt
index ad8f8d59e..5d4694600 100644
--- a/tex/context/base/mkxl/node-bck.lmt
+++ b/tex/context/base/mkxl/node-bck.lmt
@@ -60,6 +60,9 @@ local new_hlist = nodepool.hlist
local privateattributes = attributes.private
local unsetvalue = attributes.unsetvalue
+local getvalue = attributes.getvalue
+local hasvalues = attributes.hasvalues
+
local linefillers = nodes.linefillers
local a_background = privateattributes("background")
@@ -83,7 +86,7 @@ trackers.register("backgrounds.alignments",function(v) trace_alignment = v end)
local overshoot = math.floor(65781/5) -- could be an option per table (just also store it)
-local function colored_a(current,list,template,id,data)
+local function colored_a(current,list,template,id)
local width, height, depth = getwhd(current)
local total = height + depth
if width > 0 and total > 0 then
@@ -91,7 +94,7 @@ local function colored_a(current,list,template,id,data)
--
local a = getattr(template,a_linefiller)
if a then
- local d = data[a]
+ local d = getvalue(a_linefiller,a)
if d then
rule = linefillers.filler(template,d,width,height,depth)
end
@@ -106,7 +109,7 @@ local function colored_a(current,list,template,id,data)
end
end
-local function colored_b(current,list,template,id,indent,data)
+local function colored_b(current,list,template,id,indent)
local width, height, depth = getwhd(current)
local total = height + depth
if width > 0 and total > 0 then
@@ -115,7 +118,7 @@ local function colored_b(current,list,template,id,indent,data)
--
local a = getattr(template,a_linefiller)
if a then
- local d = data[a]
+ local d = getvalue(a_linefiller,a)
if d then
rule = linefillers.filler(template,d,width-indent,height,depth)
end
@@ -140,43 +143,47 @@ local currentrow = 0
local enabled = false
local alignments = false
-local function add_alignbackgrounds(head,list,data)
+-- todo: more control over cell attributes
+
+local function add_alignbackgrounds(head,list)
for current, id, subtype, list in nextlist, list do
if list and id == hlist_code and subtype == celllist_code then
for template in nexthlist, list do
local background = getattr(template,a_alignbackground)
if background then
- local list = colored_a(current,list,template,id,data)
+ local list = colored_a(current,list,template,id)
if list then
setlist(current,list)
end
- setattr(template,a_alignbackground,unsetvalue) -- or property
+ -- not that efficient:
+ setattr(template,a_alignbackground,unsetvalue)
end
break
end
end
end
+ -- we can store this differently now
local template = getprop(head,"alignmentchecked")
if template then
- list = colored_b(head,list,template[1],hlist_code,template[2],data)
+ list = colored_b(head,list,template[1],hlist_code,template[2])
flushnodelist(template)
templates[currentrow] = false
return list
end
end
-local function add_backgrounds(head,id,list,data)
+local function add_backgrounds(head,id,list)
if list then
for current, id, subtype, list in nextlist, list do
if list then
- if data and alignments and subtype == alignmentlist_code then
- local l = add_alignbackgrounds(current,list,data)
+ if alignments and subtype == alignmentlist_code then
+ local l = add_alignbackgrounds(current,list)
if l then
list = l
setlist(current,list)
end
end
- local l = add_backgrounds(current,id,list,data)
+ local l = add_backgrounds(current,id,list)
if l then
list = l
setlist(current,l)
@@ -187,36 +194,30 @@ local function add_backgrounds(head,id,list,data)
if id == hlist_code or id == vlist_code then
local background = getattr(head,a_background)
if background then
- list = colored_a(head,list,head,id,data)
+ list = colored_a(head,list,head,id)
-- not needed
- setattr(head,a_background,unsetvalue) -- or property -- todo
+ setattr(head,a_background,unsetvalue) -- or property
return list
end
end
end
function nodes.handlers.backgrounds(head)
- local data = attributes.values[a_linefiller]
--- if data then
- add_backgrounds(head,getid(head),getlist(head),data)
--- end
+ add_backgrounds(head,getid(head),getlist(head))
return head
end
function nodes.handlers.backgroundspage(head,where)
- local data = attributes.values[a_linefiller]
- if data then
- if head and where == "alignment" then
- for n in nexthlist, head do
- local p = getprop(n,"alignmentchecked")
- if not p and getsubtype(n) == alignmentlist_code then
- currentrow = currentrow + 1
- local template = templates[currentrow]
- if trace_alignment then
- report_alignment("%03i %s %s",currentrow,"page",template and "+" or "-")
- end
- setprop(n,"alignmentchecked",template)
+ if head and where == "alignment" then
+ for n in nexthlist, head do
+ local p = getprop(n,"alignmentchecked")
+ if not p and getsubtype(n) == alignmentlist_code then
+ currentrow = currentrow + 1
+ local template = templates[currentrow]
+ if trace_alignment then
+ report_alignment("%03i %s %s",currentrow,"page",template and "+" or "-")
end
+ setprop(n,"alignmentchecked",template)
end
end
end
@@ -224,21 +225,18 @@ function nodes.handlers.backgroundspage(head,where)
end
function nodes.handlers.backgroundsvbox(head,where)
- local data = attributes.values[a_linefiller]
- if data then
- if head and where == "vbox" then
- local list = getlist(head)
- if list then
- for n in nexthlist, list do
- local p = getprop(n,"alignmentchecked")
- if not p and getsubtype(n) == alignmentlist_code then
- currentrow = currentrow + 1
- local template = templates[currentrow]
- if trace_alignment then
- report_alignment("%03i %s %s",currentrow,"vbox",template and "+" or "-")
- end
- setprop(n,"alignmentchecked",template)
+ if head and where == "vbox" then
+ local list = getlist(head)
+ if list then
+ for n in nexthlist, list do
+ local p = getprop(n,"alignmentchecked")
+ if not p and getsubtype(n) == alignmentlist_code then
+ currentrow = currentrow + 1
+ local template = templates[currentrow]
+ if trace_alignment then
+ report_alignment("%03i %s %s",currentrow,"vbox",template and "+" or "-")
end
+ setprop(n,"alignmentchecked",template)
end
end
end
@@ -265,7 +263,7 @@ interfaces.implement {
}
interfaces.implement {
- name = "enablebackgroundalign",
+ name = "enablebackgroundalign", --- move into next one
onlyonce = true,
actions = function()
enable(true)
diff --git a/tex/context/base/mkxl/node-met.lmt b/tex/context/base/mkxl/node-met.lmt
index 83712b5e7..81d5b5561 100644
--- a/tex/context/base/mkxl/node-met.lmt
+++ b/tex/context/base/mkxl/node-met.lmt
@@ -103,15 +103,17 @@ nodes.getpropertiestable = node.get_properties_table
nodes.getproperty = node.getproperty
nodes.setproperty = node.setproperty
--- nodes.usedlist",
--- nodes.inuse",
--- nodes.instock",
--- nodes.type",
--- nodes.types",
--- nodes.subtypes",
--- nodes.values",
--- nodes.id",
--- nodes.show",
+-----.show = node.show
+nodes.serialized = node.serialized
+
+-- nodes.usedlist
+-- nodes.inuse
+-- nodes.instock
+-- nodes.type
+-- nodes.types
+-- nodes.subtypes
+-- nodes.values
+-- nodes.id
-- nodes.tonode = function(n) return n end
-- nodes.tonut = function(n) return n end
diff --git a/tex/context/base/mkxl/node-nut.lmt b/tex/context/base/mkxl/node-nut.lmt
index fa98d26fe..957e937a0 100644
--- a/tex/context/base/mkxl/node-nut.lmt
+++ b/tex/context/base/mkxl/node-nut.lmt
@@ -244,6 +244,7 @@ local nuts = {
setwhd = direct.setwhd,
setwidth = direct.setwidth,
show = direct.show,
+ serialized = direct.serialized,
slide = d_slide,
startofpar = direct.startofpar,
tail = d_find_tail,
diff --git a/tex/context/base/mkxl/node-rul.lmt b/tex/context/base/mkxl/node-rul.lmt
index 3bf18ccf3..5155a9109 100644
--- a/tex/context/base/mkxl/node-rul.lmt
+++ b/tex/context/base/mkxl/node-rul.lmt
@@ -394,6 +394,7 @@ do
rules.handler = function(head)
local data = attributes.values[a_ruled]
+ --or-- local data = getvalues(a_ruled)
if data then
head = processwords(a_ruled,data,flush_ruled,head)
diff --git a/tex/context/base/mkxl/pack-com.mkxl b/tex/context/base/mkxl/pack-com.mkxl
index 1b932895e..ebae2fd4a 100644
--- a/tex/context/base/mkxl/pack-com.mkxl
+++ b/tex/context/base/mkxl/pack-com.mkxl
@@ -174,10 +174,10 @@
\settrue\c_strc_constructions_define_commands
\to \everydefinecombination
-\setvalue{\??combinationlocation\v!left }{\let\m_pack_combinations_leftfiller\relax}
-\setvalue{\??combinationlocation\v!right }{\let\m_pack_combinations_rightfiller\relax}
-\setvalue{\??combinationlocation\v!top }{\let\m_pack_combinations_valigner\depthonlybox}
-\setvalue{\??combinationlocation\v!middle}{\let\m_pack_combinations_valigner\halfwaybox}
+\defcsname\??combinationlocation\v!left \endcsname{\let\m_pack_combinations_leftfiller \relax}
+\defcsname\??combinationlocation\v!right \endcsname{\let\m_pack_combinations_rightfiller\relax}
+\defcsname\??combinationlocation\v!top \endcsname{\let\m_pack_combinations_valigner \depthonlybox}
+\defcsname\??combinationlocation\v!middle\endcsname{\let\m_pack_combinations_valigner \halfwaybox}
\def\pack_combinations_location_reset
{\let\m_pack_combinations_rightfiller\hfil
@@ -360,10 +360,10 @@
\dostarttagged\t!combinationcaption\empty
\expandnamespacemacro\??combinationalternative\p_pack_combinations_alternative\v!text}
-\setvalue{\??combinationalternative\v!text}%
+\defcsname\??combinationalternative\v!text\endcsname
{\expandafterpars\pack_combinations_alternative_text_indeed}
-\setvalue{\??combinationalternative\v!label}%
+\defcsname\??combinationalternative\v!label\endcsname
{\expandafterpars\pack_combinations_alternative_label_indeed}
\def\pack_combinations_alternative_text_indeed
@@ -714,10 +714,10 @@
\newdimen\s_pack_pairedboxes_size
\appendtoks
- \frozen\instance\setuevalue{\e!setup\currentpairedbox\e!endsetup}{\setuppairedbox [\currentpairedbox]}%
- \frozen\instance\setuevalue{\e!place\currentpairedbox }{\placepairedbox [\currentpairedbox]}% one argument is mandate anyway
- \frozen\instance\setuevalue{\e!start\e!place\currentpairedbox }{\startplacepairedbox[\currentpairedbox]}% one argument is mandate anyway
- \frozen\instance\setuevalue{\e!stop\e!place \currentpairedbox }{\stopplacepairedbox }%
+ \frozen\protected\instance\edefcsname\e!setup\currentpairedbox\e!endsetup\endcsname{\setuppairedbox [\currentpairedbox]}%
+ \frozen\protected\instance\edefcsname\e!place\currentpairedbox \endcsname{\placepairedbox [\currentpairedbox]}% one argument is mandate anyway
+ \frozen\protected\instance\edefcsname\e!start\e!place\currentpairedbox \endcsname{\startplacepairedbox[\currentpairedbox]}% one argument is mandate anyway
+ \frozen\protected\instance\edefcsname\e!stop\e!place \currentpairedbox \endcsname{\stopplacepairedbox }%
\to \everydefinepairedbox
\permanent\tolerant\protected\def\startplacepairedbox[#1]#*[#2]%
diff --git a/tex/context/base/mkxl/spac-ver.lmt b/tex/context/base/mkxl/spac-ver.lmt
index 9d58ff167..d41e3be18 100644
--- a/tex/context/base/mkxl/spac-ver.lmt
+++ b/tex/context/base/mkxl/spac-ver.lmt
@@ -1194,7 +1194,7 @@ do
end
local function trace_skip(str,sc,so,sp,data)
- trace_list[#trace_list+1] = { "skip", formatters["%s | %p | category %s | order %s | penalty %s"](str, getwidth(data), sc or "-", so or "-", sp or "-") }
+ trace_list[#trace_list+1] = { "skip", formatters["%s | %p | category %s | order %s | penalty %s | subtype %s"](str, getwidth(data), sc or "-", so or "-", sp or "-", gluecodes[getsubtype(data)]) }
tracing_info = true
end
diff --git a/tex/context/base/mkxl/strc-lnt.mklx b/tex/context/base/mkxl/strc-lnt.mklx
index f389442d8..d88227bc5 100644
--- a/tex/context/base/mkxl/strc-lnt.mklx
+++ b/tex/context/base/mkxl/strc-lnt.mklx
@@ -163,7 +163,7 @@
% compress=yes|no
% compressmethod=separator|stopper
-\setvalue{\??linenotescompressmethod\v!separator}%
+\defcsname\??linenotescompressmethod\v!separator\endcsname
{\edef\p_compressseparator{\noteparameter\c!compressseparator}%
\scratchskip\noteparameter\c!compressdistance\relax
\ifempty\p_compressseparator
@@ -174,7 +174,7 @@
\hskip.5\scratchskip
\fi}
-\setvalue{\??linenotescompressmethod\v!stopper}%
+\defcsname\??linenotescompressmethod\v!stopper\endcsname
{\edef\p_compressstopper{\noteparameter\c!compressstopper}%
\scratchskip\noteparameter\c!compressdistance\relax
\ifempty\p_compressstopper
@@ -184,7 +184,7 @@
\hskip.5\scratchskip
\fi}
-\setvalue{\??linenotescompressmethod\v!space}%
+\defcsname\??linenotescompressmethod\v!space\endcsname
{\hskip\noteparameter\c!compressdistance\relax}
\def\strc_linenotes_check_compression
@@ -200,7 +200,10 @@
\fi}
\def\strc_linenotes_inbetween % \ifcsname\??linenote\currentnote\expandafter\endcsname
- {\begincsname\??linenotescompressmethod\p_linenotes_compressmethod\endcsname}
+ {\begingroup
+ \strc_linenotes_check_compression
+ \begincsname\??linenotescompressmethod\p_linenotes_compressmethod\endcsname
+ \endgroup}
\def\strc_notes_compress_distance{\emwidth \s!plus .5\emwidth \s!minus .25\emwidth}
diff --git a/tex/context/base/mkxl/strc-mat.mkxl b/tex/context/base/mkxl/strc-mat.mkxl
index 74ca24f7b..39c70fe87 100644
--- a/tex/context/base/mkxl/strc-mat.mkxl
+++ b/tex/context/base/mkxl/strc-mat.mkxl
@@ -627,7 +627,6 @@
\defcsname\??mathdisplayspacemodel\v!after:1\endcsname % old
{\prevdepth .5\strutdp
- \edef\p_spaceafter{\formulaparameter\c!spaceafter}%
\ifx\p_spaceafter\v!none
% nothing
\else
@@ -644,7 +643,6 @@
\defcsname\??mathdisplayspacemodel\v!after:2\endcsname % old
{\prevdepth\lineheight
- \edef\p_spaceafter{\formulaparameter\c!spaceafter}%
\ifx\p_spaceafter\v!none
% nothing
\else
@@ -675,7 +673,8 @@
\orelse\ifempty\p_spacebefore
\directvspacing\currentvspacing
\else
- \directvspacing{\p_spacebefore,\the\scratchdimen}%
+% \directvspacing{\p_spacebefore,\the\scratchdimen}%
+ \directvspacing\p_spacebefore
\fi
\else
\ifx\p_spacebefore\v!none
@@ -713,7 +712,8 @@
\orelse\ifempty\p_spacebefore
\directvspacing\currentvspacing
\else
- \directvspacing{\p_spacebefore,\the\scratchdimen}%
+% \directvspacing{\p_spacebefore,\the\scratchdimen}%
+ \directvspacing\p_spacebefore
\fi
\fi
\else
diff --git a/tex/context/base/mkxl/task-ini.lmt b/tex/context/base/mkxl/task-ini.lmt
index 4af05b3cf..790b05442 100644
--- a/tex/context/base/mkxl/task-ini.lmt
+++ b/tex/context/base/mkxl/task-ini.lmt
@@ -141,6 +141,7 @@ appendaction("vboxbuilders", "normalizers", "nodes.handlers.backgroundsvbox",
appendaction("vboxbuilders", "normalizers", "builders.vspacing.vboxhandler", nil, "nut", "enabled" )
appendaction("vboxbuilders", "normalizers", "builders.profiling.vboxhandler", nil, "nut", "disabled" )
appendaction("vboxbuilders", "normalizers", "typesetters.checkers.handler", nil, "nut", "disabled" )
+appendaction("vboxbuilders", "normalizers", "typesetters.parallels.handler", nil, "nut", "disabled" )
appendaction("mvlbuilders", "normalizers", "nodes.handlers.backgroundspage", nil, "nut", "disabled" )
appendaction("mvlbuilders", "normalizers", "typesetters.margins.globalhandler", nil, "nut", "disabled" )
@@ -148,6 +149,7 @@ appendaction("mvlbuilders", "normalizers", "nodes.handlers.migrate",
appendaction("mvlbuilders", "normalizers", "builders.vspacing.pagehandler", nil, "nut", "enabled" )
appendaction("mvlbuilders", "normalizers", "builders.profiling.pagehandler", nil, "nut", "disabled" )
appendaction("mvlbuilders", "normalizers", "typesetters.checkers.handler", nil, "nut", "disabled" )
+appendaction("mvlbuilders", "normalizers", "typesetters.parallels.handler", nil, "nut", "disabled" )
appendaction("everypar", "normalizers", "nodes.handlers.checkparcounter", nil, "nut", "disabled" )
diff --git a/tex/context/base/mkxl/typo-drp.lmt b/tex/context/base/mkxl/typo-drp.lmt
index c62b5e718..1ea4f4715 100644
--- a/tex/context/base/mkxl/typo-drp.lmt
+++ b/tex/context/base/mkxl/typo-drp.lmt
@@ -18,7 +18,7 @@ local settings_to_hash = utilities.parsers.settings_to_hash
local trace_initials = false trackers.register("typesetters.initials", function(v) trace_initials = v end)
local report_initials = logs.reporter("nodes","initials")
-local initials = typesetters.paragraphs or { }
+local initials = typesetters.initials or { }
typesetters.initials = initials or { }
local nodes = nodes
@@ -44,7 +44,7 @@ local setlink = nuts.setlink
local setprev = nuts.setprev
local setnext = nuts.setnext
local setfont = nuts.setfont
-local setchar = nuts.setchar
+local setscale = nuts.setscale
local setwhd = nuts.setwhd
local setkern = nuts.setkern
local setoffsets = nuts.setoffsets
@@ -117,6 +117,7 @@ interfaces.implement {
{ "hoffset" ,"dimen" },
{ "voffset" ,"dimen" },
{ "font", "integer" },
+ { "glyphscale", "integer" },
{ "dynamic", "integer" },
{ "ca", "integer" },
{ "ma", "integer" },
@@ -157,6 +158,7 @@ actions[v_default] = function(head,setting)
local lines = tonumber(setting.n) or 0
local dynamic = setting.dynamic
local font = setting.font
+ local scale = setting.glyphscale
local method = settings_to_hash(setting.method)
local length = tonumber(setting.m) or 1
--
@@ -252,6 +254,9 @@ actions[v_default] = function(head,setting)
if font then
setfont(current,font)
end
+ if scale then
+ setscale(current,scale)
+ end
if dynamic > 0 then
setglyphdata(current,dynamic)
end
diff --git a/tex/context/base/mkxl/typo-drp.mkxl b/tex/context/base/mkxl/typo-drp.mkxl
index beed0f244..963edac18 100644
--- a/tex/context/base/mkxl/typo-drp.mkxl
+++ b/tex/context/base/mkxl/typo-drp.mkxl
@@ -113,19 +113,20 @@
\scratchcounter \initialparameter\c!n\relax
\scratchvoffset\dimexpr\ifx\p_voffset\v!line\scratchcounter\lineheight-\lineheight\else\p_voffset\fi\relax
\clf_setinitial
- location {\initialparameter\c!location}%
- enabled true\space
- n \scratchcounter
- m \numexpr\initialparameter\c!m\relax
- method {\initialparameter\c!method}%
- distance \dimexpr\initialparameter\c!distance\relax
- hoffset \dimexpr\initialparameter\c!hoffset\relax
- voffset \scratchvoffset
- ma \c_attr_colormodel
- ca \c_attr_color
- ta \c_attr_transparency
- font \fontid\font
- dynamic \font_dynamic_value % it's a bit over the top to support this here
+ location {\initialparameter\c!location}%
+ enabled true\space
+ n \scratchcounter
+ m \numexpr\initialparameter\c!m\relax
+ method {\initialparameter\c!method}%
+ distance \dimexpr\initialparameter\c!distance\relax
+ hoffset \dimexpr\initialparameter\c!hoffset\relax
+ voffset \scratchvoffset
+ ma \c_attr_colormodel
+ ca \c_attr_color
+ ta \c_attr_transparency
+ font \fontid\font
+ glyphscale \glyphscale
+ dynamic \font_dynamic_value % it's a bit over the top to support this here
\relax
\c_attr_initial\plusone
\initialparameter\c!text
diff --git a/tex/context/base/mkxl/typo-syn.lmt b/tex/context/base/mkxl/typo-syn.lmt
new file mode 100644
index 000000000..dbc5b27ff
--- /dev/null
+++ b/tex/context/base/mkxl/typo-syn.lmt
@@ -0,0 +1,435 @@
+if not modules then modules = { } end modules ['typo-syn'] = {
+ version = 1.000,
+ optimize = true,
+ comment = "companion to typo-syn.mkxl",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local nodes = nodes
+
+local tasks = nodes.tasks
+local enableaction = tasks.enableaction
+----- disableaction = tasks.disableaction
+
+local nuts = nodes.nuts
+local tonut = nodes.tonut
+
+local getnext = nuts.getnext
+local getprev = nuts.getprev
+local getid = nuts.getid
+local getsubtype = nuts.getsubtype
+local getattr = nuts.getattr
+local setattrlist = nuts.setattrlist
+local getattrlist = nuts.getattrlist
+
+local getprop = nuts.getprop
+local setprop = nuts.setprop
+
+local setlink = nuts.setlink
+local setprev = nuts.setprev
+local setnext = nuts.setnext
+local setoffsets = nuts.setoffsets
+
+local getwhd = nuts.getwhd
+
+local getwidth = nuts.getwidth
+local setwidth = nuts.setwidth
+local getdepth = nuts.getdepth
+local setdepth = nuts.setdepth
+local getheight = nuts.getheight
+local setheight = nuts.setheight
+local gettotal = nuts.gettotal
+local getlist = nuts.getlist
+local setlist = nuts.setlist
+local getdisc = nuts.getdisc
+local setdisc = nuts.setdisc
+
+local hpack = nuts.hpack
+local rangedimensions = nuts.rangedimensions
+local insertbefore = nuts.insertbefore
+local removenode = nuts.remove
+local flushnode = nuts.flush
+
+local traverselist = nuts.traverselist
+
+local nodecodes = nodes.nodecodes
+local glyph_code = nodecodes.glyph
+local rule_code = nodecodes.rule
+local disc_code = nodecodes.disc
+local hlist_code = nodecodes.hlist
+local vlist_code = nodecodes.vlist
+local glue_code = nodecodes.glue
+local kern_code = nodecodes.kern
+local penalty_code = nodecodes.penalty
+
+local line_code = nodes.listcodes.line
+local fontkern_code = nodes.kerncodes.fontkern
+local parfillrightskip_code = nodes.gluecodes.parfillrightskip
+local baselineskip_code = nodes.gluecodes.baselineskip
+
+-----------------
+
+local a_synchronize = attributes.private("synchronize")
+
+local parallels = typesetters.parallels or { }
+typesetters.parallels = parallels or { }
+
+local registervalue = attributes.registervalue
+local getvalue = attributes.getvalue
+local hasvalues = attributes.hasvalues
+
+local trace = false
+-- local trace = true
+local report = logs.reporter("parallel")
+
+local pushsavelevel = tex.pushsavelevel -- token.expandmacro("bgroup")
+local popsavelevel = tex.popsavelevel -- token.expandmacro("egroup")
+local dontcomplain = tex.dontcomplain
+
+local slack = 6553.6
+local index = 0
+local lastattr = nil
+local lastline = nil
+
+interfaces.implement {
+ name = "registersynchronize",
+ arguments = { "dimen", "dimen", "box" },
+ actions = function(ht,dp,box)
+ index = index + 1
+ box = tonut(box)
+ local t = {
+ index = index,
+ lineheight = ht,
+ linedepth = dp,
+ height = getheight(height),
+ depth = getheight(depth),
+ box = box,
+ }
+ local v = registervalue(a_synchronize,t)
+ tex.setattribute(a_synchronize,v)
+ if index > 0 then
+ enableaction("vboxbuilders", "typesetters.parallels.handler")
+ enableaction("mvlbuilders", "typesetters.parallels.handler")
+ end
+ end,
+
+}
+
+local function hsplit(box,width)
+ local first = getlist(box)
+ local last = first
+ local current = first
+ local previous = current
+ local sofar = 0
+ local lastdisc = nil
+ -- todo: option
+ width = width - slack
+ --
+ while true do
+ previous = current
+ local id = getid(current)
+ if id == glyph_code then
+ local wd = getwidth(current)
+ if sofar + wd > width then
+ break
+ else
+ sofar = sofar + wd
+ end
+ elseif id == kern_code then
+ if getsubtype(current) == fontkern_code then
+ -- assume sane kerns
+ local wd = getwidth(current)
+ sofar = sofar + wd
+ else
+ last = previous
+ local wd = getwidth(current)
+ if sofar + wd > width then
+ break
+ else
+ sofar = sofar + wd
+ end
+ lastdisc = nil
+ end
+ elseif id == disc_code then
+ -- move on / inject post if needed
+ local pre, post, replace = getdisc(current)
+ local wdr = replace and rangedimensions(box,replace) or 0
+ if sofar + wdr > width then
+ -- handle post and pre here
+ last = previous
+ break
+ end
+ local wdp = pre and rangedimensions(box,pre) or 0
+-- if sofar + wdp > width then
+-- last = previous
+--lastdisc = current
+-- break
+-- end
+ sofar = sofar + wdr
+ lastdisc = current
+ elseif id == glue_code then
+ last = previous
+ local wd = getwidth(current)
+ if sofar + wd > width then
+ break
+ else
+ sofar = sofar + wd
+ end
+ lastdisc = nil
+ elseif id == hlist_code or id == vlist_code then
+ last = previous
+ local wd = getwidth(current)
+ if sofar + wd > width then
+ break
+ else
+ sofar = sofar + wd
+ end
+ lastdisc = nil
+ elseif id == rule_code then
+ last = previous
+ local wd = getwidth(current)
+ if sofar + wd > width then
+ break
+ else
+ sofar = sofar + wd
+ end
+ lastdisc = nil
+ else
+ lastdisc = nil
+ end
+ local next = getnext(current)
+ if next then
+ current = next
+ else
+ last = previous
+ break
+ end
+ end
+ local next
+ if lastdisc then
+ local pre, post, replace = getdisc(lastdisc)
+ last = getprev(lastdisc)
+ --
+ next = getnext(lastdisc)
+ if next then
+ setprev(next)
+ end
+ --
+ setlink(last,pre)
+ if post then
+ setlink(post,next)
+ next = post
+ end
+ setdisc(lastdisc,nil,nil,replace)
+ flushnode(lastdisc)
+ else
+ next = getnext(last)
+ if next then
+ setprev(next)
+ end
+ setnext(last)
+ end
+ while last do
+ local id = getid(last)
+ if id == glue_code or id == penalty_code then
+ first, last = removenode(first,last,true)
+ else
+ break
+ end
+ end
+ if first then
+ pushsavelevel()
+ dontcomplain()
+ local result, badness = hpack(first,width,"exactly")
+ if badness > 200 then
+ result = hpack(first)
+ end
+ popsavelevel()
+ setattrlist(result,getattrlist(box)) -- useattrlist(result,box)
+ setheight(result,getheight(box))
+ setdepth(result,getdepth(box))
+ setlist(box,next)
+ setwidth(box,rangedimensions(box,next))
+ return result
+ end
+end
+
+local function getproperties(parent)
+ local props = getprop(parent,"parallel")
+ if not props then
+ local w, h, d = getwhd(parent)
+ props = {
+ width = w,
+ height = h,
+ depth = d,
+ }
+ setprop(parent,"parallel",props)
+ end
+ return props
+end
+
+local function setproperties(parent,data,result,level,ctotal)
+ local props = getproperties(parent)
+ local depth = props.depth
+ local height = props.height
+ local delta = data.linedepth - depth
+ if delta > 0 then
+ depth = data.linedepth
+ setdepth(parent,depth)
+ props.depth = depth
+ local n = getnext(parent)
+ if n and getid(n) == glue_code and getsubtype(n) == baselineskip_code then
+ setwidth(n,getwidth(n) - delta)
+ end
+ end
+-- if height < data.lineheight then
+-- height = data.lineheight
+-- setheight(parent,height)
+-- props.height = height
+-- end
+ local offset = level * ctotal
+ if props.depth + offset > depth then
+ setdepth(parent,props.depth+offset)
+ end
+ setoffsets(result,0,-offset)
+ setwidth(result,0)
+end
+
+local function flush(head,first,last,a,parent,nesting)
+ if first and nesting == 0 then
+ local data = getvalue(a_synchronize,a)
+ local upto = getnext(last)
+ if upto and getid(upto) == penalty_code then
+ upto = getnext(upto)
+ end
+ if upto and getid(upto) == glue_code and getsubtype(upto) == parfillrightskip_code then
+ upto = getnext(upto)
+ end
+ local props = getproperties(parent)
+ local width = rangedimensions(parent,first,upto)
+ if width > props.width then
+ width = props.width
+ end
+ local content = data.box
+ local index = data.index
+ if not content then
+ if trace then
+ report("index %i, verdict %a",index,"done")
+ end
+ else
+ local result = nil
+ local cwidth = getwidth(content)
+ local ctotal = gettotal(content)
+ if cwidth <= width then -- slack
+ if trace then
+ report("index %i, available %p, content %p, verdict %a",index,width,cwidth,"fit")
+ end
+ result = content
+ data.box = nil
+ elseif cwidth > width then
+ if trace then
+ report("index %i, available %p, content %p, verdict %a",index,width,cwidth,"overflow")
+ end
+ result = hsplit(content,width)
+ lastattr = a
+ lastline = parent
+ else
+ report("index %i, verdict %a",index,"weird")
+ end
+ if result then
+ setproperties(parent,data,result,1,ctotal)
+ head = insertbefore(head,first,result)
+ end
+ end
+ end
+ return head
+end
+
+local function lastflush(lastline,lastattr)
+ local data = getvalue(a_synchronize,lastattr)
+ if not data then
+ return
+ end
+ local content = data.box
+ if not content or getwidth(content) == 0 then
+ return
+ end
+ local head = getlist(lastline)
+ if not head then
+ return
+ end
+ local first = head
+ local last = nil
+ local props = getproperties(lastline)
+ local width = props.width
+ local height = props.height
+ local depth = props.depth
+ local level = 1
+ if depth < data.linedepth then
+ depth = data.linedepth
+ setdepth(lastline,depth)
+ end
+ if height < data.lineheight then
+ height = data.lineheight
+ setheight(lastline,height)
+ end
+ while true do
+ local content = data.box
+ local index = data.index
+ if content then
+ local result = nil
+ local total = 0
+ local cwidth = getwidth(content)
+ local ctotal = gettotal(content)
+ if cwidth <= width then -- slack
+ if trace then
+ report("index %i, available %p, content %p, verdict %a",index,width,cwidth,"fit")
+ end
+ result = content
+ data.box = nil
+ elseif cwidth > width then
+ if trace then
+ report("index %i, available %p, content %p, verdict %a",index,width,cwidth,"overflow")
+ end
+ result = hsplit(content,width)
+ else
+ report("index %i, verdict %a",index,"weird")
+ end
+ if result then
+ level = level + 1
+ setproperties(lastline,data,result,level,ctotal)
+ head = insertbefore(head,first,result)
+ setlist(lastline,head)
+ else
+ break
+ end
+ else
+ break
+ end
+ end
+end
+
+local processranges = nuts.processranges
+
+function parallels.handler(head,where)
+ if where == "hmodepar" and hasvalues(a_synchronize) then
+ lastattr = nil
+ lastline = nil
+ for n, id, subtype in traverselist(head) do
+ if subtype == line_code then
+ lastattr = nil
+ local list = getlist(n)
+ local head = processranges(a_synchronize,flush,list,n)
+ if head ~= list then
+ setlist(n,head)
+ end
+ end
+ end
+ if lastattr and lastline then
+ lastflush(lastline,lastattr)
+ end
+ end
+ return head
+end
diff --git a/tex/context/base/mkxl/typo-syn.mkxl b/tex/context/base/mkxl/typo-syn.mkxl
new file mode 100644
index 000000000..adb3603d5
--- /dev/null
+++ b/tex/context/base/mkxl/typo-syn.mkxl
@@ -0,0 +1,108 @@
+%D \module
+%D [ file=typo-syn,
+%D version=2022.01.06,
+%D title=\CONTEXT\ Typesetting Macros,
+%D subtitle=synchronizers,
+%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.
+
+% Musical timestamp: this code was written when I start relistening my whole
+% digitized cd collection with the (new) r2r soekris dac in my setup.
+
+
+%D Yet another experiment (triggered by a question / demand from Ton Otten.)
+%D
+%D \starttyping
+%D \setupsynchronize [paralleltext] [color=darkblue]
+%D % \setupsynchronize [paralleltext] [style=\tx,color=darkred]
+%D % \setupsynchronize [paralleltext] [style=\txx,color=darkgreen]
+%D
+%D \dorecurse{10}{%
+%D \paralleltext
+%D {[een allereerste zinnetje]}
+%D {[een tweede zinnetje]}%
+%D \space
+%D \paralleltext
+%D {[een derde zin]}
+%D {[een vierde zinnetje]}
+%D \space
+%D } \removeunwantedspaces
+%D \par test line \page
+%D
+%D \paralleltext
+%D {[\ignorespaces\samplefile{tufte}\removeunwantedspaces]}
+%D {[\samplefile{ward}\removeunwantedspaces]}%
+%D \par test line \page
+%D
+%D \paralleltext
+%D {[\ignorespaces\samplefile{tufte}\removeunwantedspaces]}
+%D {[\ignorespaces\samplefile{tufte}\removeunwantedspaces]}%
+%D \par test line \page
+%D
+%D \paralleltext
+%D {[\ignorespaces\samplefile{ward}\removeunwantedspaces]}%
+%D {[\ignorespaces\samplefile{tufte}\removeunwantedspaces]}
+%D \par test line \page
+%D \stoptyping
+
+\writestatus{loading}{ConTeXt Typesetting Macros / Synchronizers}
+
+\registerctxluafile{typo-syn}{autosuffix}
+
+\unprotect
+
+\definesystemattribute[synchronize][public]
+
+\installcorenamespace {synchronize}
+
+\installcommandhandler \??synchronize {synchronize} \??synchronize
+
+\tolerant\protected\def\typo_synchronize#1#*[#2]#:#3#4%
+ {\dontleavehmode
+ \begingroup
+ \def\currentsynchronize{#1}%
+ \setupcurrentsynchronize[#2]%
+ \dontcomplain
+ \setbox\scratchboxtwo\hbox\bgroup
+ \usesynchronizestyleandcolor\c!style\c!color
+ \setstrut
+ \strut
+ \ignorespaces#4\removeunwantedspaces
+ \egroup
+ \scratchdimentwo\wd\scratchboxtwo
+ \clf_registersynchronize
+ \strutht
+ \strutdp
+ \box\scratchboxtwo
+ \relax
+ \setbox\scratchboxone\hbox{#3}%
+ \scratchdimenone\wd\scratchboxone
+ \unhbox\scratchboxone
+ \advance\scratchdimentwo-\scratchdimenone
+ \ifdim\scratchdimentwo>\zeropoint
+ \wordboundary
+ \novrule
+ % \vrule
+ \s!width \scratchdimentwo
+ \s!height \exheight
+ \s!depth \zeropoint
+ \relax
+ \fi
+ \endgroup}
+
+\appendtoks
+ \protected\instance\edefcsname\currentsynchronize\endcsname{\typo_synchronize{\currentsynchronize}}%
+\to \everydefinesynchronize
+
+% \setupsynchronize
+% [\c!alternative=\v!horizontal]
+
+\definesynchronize
+ [paralleltext]
+
+\protect \endinput
diff --git a/tex/context/base/mkxl/util-fil.lmt b/tex/context/base/mkxl/util-fil.lmt
index 86200ebe5..b8d374755 100644
--- a/tex/context/base/mkxl/util-fil.lmt
+++ b/tex/context/base/mkxl/util-fil.lmt
@@ -27,15 +27,21 @@ function files.open(filename,zb)
end
function files.close(f)
- zerobased[f] = nil
- f:close()
+ if f then
+ zerobased[f] = nil
+ f:close()
+ end
end
function files.size(f)
- local current = f:seek()
- local size = f:seek("end")
- f:seek("set",current)
- return size
+ if f then
+ local current = f:seek()
+ local size = f:seek("end")
+ f:seek("set",current)
+ return size
+ else
+ return 0
+ end
end
files.getsize = files.size
diff --git a/tex/context/fonts/mkiv/type-imp-hcrfonts.mkiv b/tex/context/fonts/mkiv/type-imp-hcrfonts.mkiv
new file mode 100644
index 000000000..60ce20bf0
--- /dev/null
+++ b/tex/context/fonts/mkiv/type-imp-hcrfonts.mkiv
@@ -0,0 +1,141 @@
+%D \module
+%D [ file=type-imp-unfonts,
+%D version=2012.03.11,
+%D title=\CONTEXT\ Typescript Macros,
+%D subtitle=UnFonts,
+%D author=Dalyoung \& Hans,
+%D date=\currentdate,
+%D copyright=Dalyoung \& Hans]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% usage: \setupbodyfont[hcrfonts]
+
+\loadtypescriptfile[texgyre]
+
+\definefontfeature
+ [kr-default]
+ [mode=node,script=hang,lang=kor]
+
+\definefontfeature
+ [kr-slanted]
+ [mode=node,script=hang,lang=kor,slant=.2]
+
+\definefontfeature
+ [kr-latin-default]
+ [default]
+
+\definefontfeature
+ [kr-latin-slanted]
+ [krlatindefault]
+ [slant=.2]
+
+\definefontfeature
+ [kr-latin-slanted-mono]
+ [slant=.2]
+
+\definefontfeature
+ [kr-latin-smallcaps]
+ [krlatindefault]
+ [smcp=yes]
+
+\definefontfeature
+ [kr-latin-smallcaps-mono]
+ [cmcp=yes]
+
+\definefontfallback[kr-serif] [texgyrepagella-regular*kr-latin-default] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-serifbold] [texgyrepagella-bold*kr-latin-default] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-serifitalic] [texgyrepagella-italic*kr-latin-default] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-serifbolditalic] [texgyrepagella-bolditalic*kr-latin-default] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-serifslanted] [texgyrepagella-regular*kr-latin-slanted] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-serifboldslanted][texgyrepagella-bold*kr-latin-slanted] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-serifcaps] [texgyrepagella-regular*kr-latin-smallcaps] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-sans] [texgyreheros-regular*kr-latin-default] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-sansbold] [texgyreheros-bold*kr-latin-default] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-sansitalic] [texgyreheros-italic*kr-latin-default] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-sansbolditalic] [texgyreheros-bolditalic*kr-latin-default] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-sansslanted] [texgyreheros-regular*kr-latin-slanted] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-sansboldslanted] [texgyreheros-bold*kr-latin-slanted] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-sanscaps] [texgyreheros-regular*kr-latin-smallcaps] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-mono] [texgyrecursor-regular] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-monobold] [texgyrecursor-bold] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-monoitalic] [texgyrecursor-italic] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-monobolditalic] [texgyrecursor-bolditalic] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-monoslanted] [texgyrecursor-regular*kr-latin-slanted-mono] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-monoboldslanted] [texgyrecursor-bold*kr-latin-slanted-mono] [0x0000-0x0400][force=yes]
+\definefontfallback[kr-monocaps] [texgyrecursor-regular*kr-latin-smallcaps-mono][0x0000-0x0400][force=yes]
+
+\starttypescriptcollection[hcrLVT]
+
+ \starttypescript [\s!serif] [hcrBatang]
+ \definefontsynonym [hcrBatang] [\s!file:HanBatang-LVT.ttf] [\s!features=kr-default,\s!fallbacks=kr-serif]
+ \definefontsynonym [hcrBatangBold] [\s!file:HanBatangB-LVT.ttf][\s!features=kr-default,\s!fallbacks=kr-serifbold]
+ \definefontsynonym [hcrBatangItalic] [\s!file:HanBatang-LVT.ttf] [\s!features=kr-slanted,\s!fallbacks=kr-serifitalic]
+ \definefontsynonym [hcrBatangBolditalic] [\s!file:HanBatangB-LVT.ttf][\s!features=kr-slanted,\s!fallbacks=kr-serifbolditalic]
+ \definefontsynonym [hcrBatangSlanted] [\s!file:HanBatang-LVT.ttf] [\s!features=kr-slanted,\s!fallbacks=kr-serifslanted]
+ \definefontsynonym [hcrBatangBoldslanted][\s!file:HanBatangB-LVT.ttf][\s!features=kr-slanted,\s!fallbacks=kr-serifboldslanted]
+ \definefontsynonym [hcrBatangCaps] [\s!file:HanBatang-LVT.ttf] [\s!features=kr-default,\s!fallbacks=kr-serifcaps]
+ \stoptypescript
+
+ \starttypescript [\s!sans] [hcrDotum]
+ \definefontsynonym[hcrDotum] [\s!file:HanDotum-LVT.ttf] [\s!features=kr-default,\s!fallbacks=kr-sans]
+ \definefontsynonym[hcrDotumBold] [\s!file:HanDotumB-LVT.ttf] [\s!features=kr-default,\s!fallbacks=kr-sansbold]
+ \definefontsynonym[hcrDotumItalic] [\s!file:HanDotum-LVT.ttf] [\s!features=kr-slanted,\s!fallbacks=kr-sansitalic]
+ \definefontsynonym[hcrDotumBolditalic] [\s!file:HanDotumB-LVT.ttf] [\s!features=kr-slanted,\s!fallbacks=kr-sansbolditalic]
+ \definefontsynonym[hcrDotumSlanted] [\s!file:HanDotum-LVT.ttf] [\s!features=kr-slanted,\s!fallbacks=kr-sansslanted]
+ \definefontsynonym[hcrDotumBoldslanted] [\s!file:HanDotumB-LVT.ttf] [\s!features=kr-slanted,\s!fallbacks=kr-sansboldslanted]
+ \definefontsynonym[hcrDotumCaps] [\s!file:HanDotum-LVT.ttf] [\s!features=kr-default,\s!fallbacks=kr-sanscaps]
+ \stoptypescript
+
+ \starttypescript [\s!mono] [hcrType]
+ \definefontsynonym[hcrType] [\s!file:UnTaza.ttf] [\s!features=kr-default,\s!fallbacks=kr-mono]
+ \definefontsynonym[hcrTypeBold] [\s!file:UnTaza.ttf] [\s!features=kr-default,\s!fallbacks=kr-monobold]
+ \definefontsynonym[hcrTypeItalic] [\s!file:UnTaza.ttf] [\s!features=kr-slanted,\s!fallbacks=kr-monoitalic]
+ \definefontsynonym[hcrTypeBolditalic] [\s!file:UnTaza.ttf] [\s!features=kr-slanted,\s!fallbacks=kr-monobolditalic]
+ \definefontsynonym[hcrTypeSlanted] [\s!file:UnTaza.ttf] [\s!features=kr-slanted,\s!fallbacks=kr-monoslanted]
+ \definefontsynonym[hcrTypeBoldslanted] [\s!file:UnTaza.ttf] [\s!features=kr-slanted,\s!fallbacks=kr-monoboldslanted]
+ \definefontsynonym[hcrTypeCaps] [\s!file:UnTaza.ttf] [\s!features=kr-default,\s!fallbacks=kr-monocaps]
+ \stoptypescript
+
+ \starttypescript [\s!serif] [hcrBatang] [\s!name]
+ \definefontsynonym[\s!Serif] [hcrBatang]
+ \definefontsynonym[\s!SerifBold] [hcrBatangBold]
+ \definefontsynonym[\s!SerifItalic] [hcrBatangItalic]
+ \definefontsynonym[\s!SerifBoldItalic] [hcrBatangBolditalic]
+ \definefontsynonym[\s!SerifSlanted] [hcrBatangSlanted]
+ \definefontsynonym[\s!SerifBoldSlanted][hcrBatangBoldslanted]
+ \definefontsynonym[\s!SerifCaps] [hcrBatangCaps]
+ \stoptypescript
+
+ \starttypescript [\s!sans] [hcrDotum] [\s!name]
+ \definefontsynonym[\s!Sans] [hcrDotum]
+ \definefontsynonym[\s!SansBold] [hcrDotumBold]
+ \definefontsynonym[\s!SansItalic] [hcrDotumItalic]
+ \definefontsynonym[\s!SansBoldItalic] [hcrDotumBolditalic]
+ \definefontsynonym[\s!SansSlanted] [hcrDotumSlanted]
+ \definefontsynonym[\s!SansBoldSlanted] [hcrDotumBoldslanted]
+ \definefontsynonym[\s!SansCaps] [hcrDotumCaps]
+ \stoptypescript
+
+ \starttypescript [\s!mono] [hcrType] [\s!name]
+ \definefontsynonym[\s!Mono] [hcrType]
+ \definefontsynonym[\s!MonoBold] [hcrTypeBold]
+ \definefontsynonym[\s!MonoItalic] [hcrTypeItalic]
+ \definefontsynonym[\s!MonoBoldItalic] [hcrTypeBolditalic]
+ \definefontsynonym[\s!MonoSlanted] [hcrTypeSlanted]
+ \definefontsynonym[\s!MonoBoldSlanted] [hcrTypeBoldslanted]
+ \definefontsynonym[\s!MonoCaps] [hcrTypeCaps]
+ \stoptypescript
+
+ % xits might get replaced with a pagella once we have it
+
+ \starttypescript[hcrfonts]
+ \definetypeface [hcrfonts] [\s!rm] [\s!serif] [hcrBatang]
+ \definetypeface [hcrfonts] [\s!ss] [\s!sans] [hcrDotum]
+ \definetypeface [hcrfonts] [\s!tt] [\s!mono] [hcrType]
+ \definetypeface [hcrfonts] [\s!mm] [\s!math] [pagella]
+ \stoptypescript
+
+\stoptypescriptcollection \ No newline at end of file
diff --git a/tex/context/fonts/mkiv/type-imp-unfonts.mkiv b/tex/context/fonts/mkiv/type-imp-unfonts.mkiv
index 91ae3b230..1c8b2c3c5 100644
--- a/tex/context/fonts/mkiv/type-imp-unfonts.mkiv
+++ b/tex/context/fonts/mkiv/type-imp-unfonts.mkiv
@@ -14,7 +14,7 @@
% usage: \setupbodyfont[unfonts]
\loadtypescriptfile[texgyre]
-\loadtypescriptfile[xits]
+%\loadtypescriptfile[xits]
\definefontfeature
[kr-default]
@@ -136,7 +136,7 @@
\definetypeface [unfonts] [\s!rm] [\s!serif] [unbatang]
\definetypeface [unfonts] [\s!ss] [\s!sans] [undotum]
\definetypeface [unfonts] [\s!tt] [\s!mono] [untype]
- \definetypeface [unfonts] [\s!mm] [\s!math] [xits]
+ \definetypeface [unfonts] [\s!mm] [\s!math] [pagella]
\stoptypescript
\stoptypescriptcollection
diff --git a/tex/context/interface/mkii/keys-de.xml b/tex/context/interface/mkii/keys-de.xml
index 579cc352d..681e1282f 100644
--- a/tex/context/interface/mkii/keys-de.xml
+++ b/tex/context/interface/mkii/keys-de.xml
@@ -303,6 +303,7 @@
<cd:variable name='july' value='juli'/>
<cd:variable name='june' value='juni'/>
<cd:variable name='keep' value='behalte'/>
+ <cd:variable name='keeptogether' value='keeptogether'/>
<cd:variable name='kerncharacters' value='kerncharacters'/>
<cd:variable name='knockout' value='knockout'/>
<cd:variable name='label' value='label'/>
@@ -1235,7 +1236,7 @@
<cd:constant name='solution' value='solution'/>
<cd:constant name='sort' value='sort'/>
<cd:constant name='sorttype' value='sorttype'/>
- <cd:constant name='source' value='quelle'/>
+ <cd:constant name='source' value='source'/>
<cd:constant name='space' value='spatium'/>
<cd:constant name='spaceafter' value='nachspatium'/>
<cd:constant name='spaceafterside' value='spaceafterside'/>
@@ -1286,6 +1287,7 @@
<cd:constant name='synonymcommand' value='synonymbefehl'/>
<cd:constant name='synonymstyle' value='synonymstil'/>
<cd:constant name='tab' value='tab'/>
+ <cd:constant name='target' value='target'/>
<cd:constant name='text' value='text'/>
<cd:constant name='textalign' value='textalign'/>
<cd:constant name='textalternative' value='textalternative'/>
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index f4d50e351..fdfde314f 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 : 2021-12-30 19:00
+-- merge date : 2022-01-06 19:47
do -- begin closure to overcome local limits and interference
@@ -31585,8 +31585,10 @@ if not modules then modules={} end modules ['font-osd']={
copyright="TAT Zetwerk / PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
-local insert,imerge,copy,tohash=table.insert,table.imerge,table.copy,table.tohash
-local next,type=next,type
+local insert,remove,imerge,copy,tohash=table.insert,table.remove,table.imerge,table.copy,table.tohash
+local next,type,rawget=next,type,rawget
+local formatters=string.formatters
+local settings_to_hash=utilities.parsers.settings_to_hash
local report=logs.reporter("otf","devanagari")
fonts=fonts or {}
fonts.analyzers=fonts.analyzers or {}
@@ -31596,6 +31598,7 @@ local handlers=otf.handlers
local methods=fonts.analyzers.methods
local otffeatures=fonts.constructors.features.otf
local registerotffeature=otffeatures.register
+local trace_steps=false
local nuts=nodes.nuts
local getnext=nuts.getnext
local getprev=nuts.getprev
@@ -31642,6 +31645,7 @@ replace_all_nbsp=function(head)
return replace_all_nbsp(head)
end
local processcharacters=nil
+local logprocess=nil
if context then
--removed
@@ -31654,6 +31658,8 @@ else
end
return head
end
+ logprocess=function(str)
+ end
end
local indicgroups=characters and characters.indicgroups
if not indicgroups and characters then
@@ -31763,7 +31769,7 @@ local before_subscript=indicgroups.before_subscript
local after_subscript=indicgroups.after_subscript
local before_main=indicgroups.before_main
local after_main=indicgroups.after_main
-local mark_four=table.merged (
+local mark_pre_above_below_post=table.merged (
pre_mark,
above_mark,
below_mark,
@@ -31774,6 +31780,11 @@ local mark_above_below_post=table.merged (
below_mark,
post_mark
)
+local devanagarihash=table.setmetatableindex(function(t,k)
+ local v=fontdata[k].resources.devanagari or false
+ t[k]=v
+ return v
+end)
local zw_char={
[c_zwnj]=true,
[c_zwj ]=true,
@@ -31894,7 +31905,7 @@ local function initializedevanagi(tfmdata)
local resources=tfmdata.resources
local devanagari=resources.devanagari
if not devanagari then
- report("adding devanagari features to font")
+ report("adding features to font")
local gsubfeatures=resources.features.gsub
local sequences=resources.sequences
local sharedfeatures=tfmdata.shared.features
@@ -31921,7 +31932,7 @@ local function initializedevanagi(tfmdata)
for k,v in next,pre_mark do
local locl=coverage[k]
if locl then
- if #locl>0 then
+ if #locl>0 then
for j=1,#locl do
local ck=locl[j]
local f=ck[4]
@@ -31942,6 +31953,7 @@ local function initializedevanagi(tfmdata)
end
end
end
+ else
end
if locl then
reorder_matras.steps[1].coverage[locl]=true
@@ -31954,7 +31966,7 @@ local function initializedevanagi(tfmdata)
if basic_shaping_forms[k] then
lastmatch=lastmatch+1
if s~=lastmatch then
- table.insert(sequences,lastmatch,table.remove(sequences,s))
+ insert(sequences,lastmatch,remove(sequences,s))
end
end
end
@@ -31972,9 +31984,7 @@ local function initializedevanagi(tfmdata)
local vatucache={}
local pstfcache={}
local seqsubset={}
- local rephstep={
- coverage={}
- }
+ local rephstep={ coverage={} }
local devanagari={
reph=false,
vattu=false,
@@ -31999,7 +32009,7 @@ local function initializedevanagi(tfmdata)
local has_pstf=features.pstf
if has_rphf and has_rphf[script] then
devanagari.reph=true
- elseif (has_blwf and has_blwf[script] ) or (has_vatu and has_vatu[script] ) then
+ elseif (has_blwf and has_blwf[script]) or (has_vatu and has_vatu[script]) then
devanagari.vattu=true
for i=1,nofsteps do
local step=steps[i]
@@ -32007,10 +32017,8 @@ local function initializedevanagi(tfmdata)
if coverage then
for k,v in next,coverage do
for h,w in next,halant do
- if v[h] then
- if not blwfcache[k] then
- blwfcache[k]=v
- end
+ if v[h] and not blwfcache[k] then
+ blwfcache[k]=v
end
if has_vatu and has_vatu[script] and not vatucache[k] then
vatucache[k]=v
@@ -32033,33 +32041,37 @@ local function initializedevanagi(tfmdata)
local r=coverage[k]
if r then
local found=false
- if #r>0 then
+ if #r>0 then
for j=1,#r do
local ck=r[j]
local f=ck[4]
local chainlookups=ck[6]
- if chainlookups and chainlookups[f] then
+ if chainlookups then
local chainlookup=chainlookups[f]
- for j=1,#chainlookup do
- local chainstep=chainlookup[j]
- local steps=chainstep.steps
- local nofsteps=chainstep.nofsteps
- for i=1,nofsteps do
- local step=steps[i]
- local coverage=step.coverage
- if coverage then
- local h=coverage[k]
- if h then
- for k,v in next,h do
- found=v and (tonumber(v) or v.ligature)
+ if chainlookup then
+ for j=1,#chainlookup do
+ local chainstep=chainlookup[j]
+ local steps=chainstep.steps
+ local nofsteps=chainstep.nofsteps
+ for i=1,nofsteps do
+ local step=steps[i]
+ local coverage=step.coverage
+ if coverage then
+ local h=coverage[k]
+ if h then
+ for k,v in next,h do
+ if v then
+ found=tonumber(v) or v.ligature
+ if found then
+ pre_base_reordering_consonants[found]=true
+ break
+ end
+ end
+ end
if found then
- pre_base_reordering_consonants[found]=true
break
end
end
- if found then
- break
- end
end
end
end
@@ -32068,10 +32080,12 @@ local function initializedevanagi(tfmdata)
end
else
for k,v in next,r do
- found=v and (tonumber(v) or v.ligature)
- if found then
- pre_base_reordering_consonants[found]=true
- break
+ if v then
+ found=tonumber(v) or v.ligature
+ if found then
+ pre_base_reordering_consonants[found]=true
+ break
+ end
end
end
end
@@ -32089,14 +32103,15 @@ local function initializedevanagi(tfmdata)
local step=steps[i]
local coverage=step.coverage
if coverage then
- local reph,rephbase=false,false
+ local reph=false
+ local base=false
if kind=="rphf" then
for k,v in next,ra do
local r=coverage[k]
if r then
- rephbase=k
+ base=k
local h=false
- if #r>0 then
+ if #r>0 then
for j=1,#r do
local ck=r[j]
local f=ck[4]
@@ -32144,7 +32159,7 @@ local function initializedevanagi(tfmdata)
end
end
end
- seqsubset[#seqsubset+1]={ kind,coverage,reph,rephbase }
+ seqsubset[#seqsubset+1]={ kind,coverage,reph,base }
end
end
end
@@ -32159,7 +32174,7 @@ local function initializedevanagi(tfmdata)
local h=coverage[k]
if h then
local found=false
- if #h>0 then
+ if #h>0 then
for j=1,#h do
local ck=h[j]
local f=ck[4]
@@ -32177,10 +32192,12 @@ local function initializedevanagi(tfmdata)
local h=coverage[k]
if h then
for k,v in next,h do
- found=v and (tonumber(v) or v.ligature)
- if found then
- pre_base_reordering_consonants[found]=true
- break
+ if v then
+ found=tonumber(v) or v.ligature
+ if found then
+ pre_base_reordering_consonants[found]=true
+ break
+ end
end
end
if found then
@@ -32220,9 +32237,6 @@ local function initializedevanagi(tfmdata)
sharedfeatures["dv03"]=true
sharedfeatures["dv04"]=true
end
- if script=="mlym" or script=="taml" then
- devanagari.left_matra_before_base=true
- end
end
end
end
@@ -32234,6 +32248,43 @@ registerotffeature {
node=initializedevanagi,
},
}
+local function initializeconjuncts(tfmdata,value)
+ if value then
+ local resources=tfmdata.resources
+ local devanagari=resources.devanagari
+ if devanagari then
+ local conjuncts="auto"
+ local conjuncts="continue"
+ local movematra="auto"
+ if type(value)=="string" and value~="auto" then
+ value=settings_to_hash(value)
+ conjuncts=rawget(value,"conjuncts") or conjuncts
+ movematra=rawget(value,"movematra") or movematra
+ end
+ if conjuncts=="auto" then
+ conjuncts="continue"
+ end
+ if movematra=="auto" and
+ script=="mlym" or
+ script=="taml" then
+ movematra="leftbeforebase"
+ else
+ movematra="default"
+ end
+ devanagari.conjuncts=conjuncts
+ devanagari.movematra=movematra
+ report("conjuncts %a, movematra %a",conjuncts,movematra)
+ end
+ end
+end
+registerotffeature {
+ name="indic",
+ description="control indic",
+ default="auto",
+ initializers={
+ node=initializeconjuncts,
+ },
+}
local show_syntax_errors=false
local function inject_syntax_error(head,current,char)
local signal=copy_node(current)
@@ -32341,9 +32392,9 @@ local function order_matras(c)
char=getchar(cn)
end
end
+local swapped=table.swapped(states)
local function reorder_one(head,start,stop,font,attr,nbspaces)
- local reph,vattu,blwfcache,vatucache,pstfcache=initialize_one(font,attr)
- local devanagari=fontdata[font].resources.devanagari
+ local reph,vattu,blwfcache,vatucache,pstfcache=initialize_one(font,attr)
local current=start
local n=getnext(start)
local base=nil
@@ -32366,6 +32417,9 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
stop=getprev(stop)
head=remove_node(head,current)
flushnode(current)
+ if trace_steps then
+ logprocess("reorder one, remove nbsp")
+ end
return head,stop,nbspaces
else
nbspaces=nbspaces+1
@@ -32409,6 +32463,9 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
stop=current
end
end
+ if trace_steps then
+ logprocess("reorder one, handle nbsp")
+ end
end
end
end
@@ -32463,6 +32520,9 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
if lastcons==stop then
stop=n
end
+ if trace_steps then
+ logprocess("reorder one, handle halant")
+ end
end
end
n=getnext(start)
@@ -32487,6 +32547,9 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
if matra==stop then
stop=n
end
+ if trace_steps then
+ logprocess("reorder one, handle matra")
+ end
end
local current=start
while current~=stop do
@@ -32525,14 +32588,19 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
ch=getchar(n)
end
local tpm=twopart_mark[ch]
- while tpm do
- local extra=copy_node(n)
- copyinjection(extra,n)
- ch=tpm[1]
- setchar(n,ch)
- setchar(extra,tpm[2])
- head=insertnodeafter(head,current,extra)
- tpm=twopart_mark[ch]
+ if tpm then
+ while tpm do
+ local extra=copy_node(n)
+ copyinjection(extra,n)
+ ch=tpm[1]
+ setchar(n,ch)
+ setchar(extra,tpm[2])
+ head=insertnodeafter(head,current,extra)
+ tpm=twopart_mark[ch]
+ end
+ if trace_steps then
+ logprocess("reorder one, handle mark")
+ end
end
while c~=stop and dependent_vowel[ch] do
c=n
@@ -32555,9 +32623,10 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
local bp=getprev(firstcons)
local cn=getnext(current)
local last=getnext(c)
+ local done=false
while cn~=last do
if pre_mark[getchar(cn)] then
- if devanagari.left_matra_before_base then
+ if devanagarihash[font].movematra=="leftbeforebase" then
local prev,next=getboth(cn)
setlink(prev,next)
if cn==stop then
@@ -32594,6 +32663,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
end
cn=next
end
+ done=true
elseif current~=base and dependent_vowel[getchar(cn)] then
local prev,next=getboth(cn)
if next then
@@ -32606,6 +32676,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
setlink(b,cn,getnext(b))
order_matras(cn)
cn=next
+ done=true
elseif current==base and dependent_vowel[getchar(cn)] then
local cnn=getnext(cn)
order_matras(cn)
@@ -32619,9 +32690,14 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
end
allreordered=c==stop
current=getnext(c)
+ if done and trace_steps then
+ logprocess("reorder one, matra")
+ end
end
if reph or vattu then
- local current,cns=start,nil
+ local current=start
+ local cns=nil
+ local done=false
while current~=stop do
local c=current
local n=getnext(current)
@@ -32652,6 +32728,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
local next=getnext(b)
setlink(c,next)
setlink(b,current)
+ done=true
end
elseif cns and getnext(cns)~=current then
local cp=getprev(current)
@@ -32659,6 +32736,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
setlink(cp,n)
setlink(cns,current)
setlink(c,cnsn)
+ done=true
if c==stop then
stop=cp
break
@@ -32698,6 +32776,9 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
end
current=getnext(current)
end
+ if done and trace_steps then
+ logprocess("reorder one, handle reph and vata")
+ end
end
if getchar(base)==c_nbsp then
nbspaces=nbspaces-1
@@ -32730,6 +32811,9 @@ function handlers.devanagari_reorder_matras(head,start)
setlink(start,next)
setlink(current,start)
start=startnext
+ if trace_steps then
+ logprocess("reorder matra")
+ end
break
end
else
@@ -32758,6 +32842,9 @@ function handlers.devanagari_reorder_reph(head,start)
local char=ischar(current,startfont)
if char and getprop(current,a_syllabe)==startattr then
if halant[char] then
+ if trace_steps then
+ logprocess("reorder reph, handling halant")
+ end
local next=getnext(current)
if next then
local nextchar=ischar(next,startfont)
@@ -32788,6 +32875,9 @@ function handlers.devanagari_reorder_reph(head,start)
local char=ischar(current,startfont)
if char and getprop(current,a_syllabe)==startattr then
if consonant[char] and not getstate(current,s_pref) then
+ if trace_steps then
+ logprocess("reorder reph, handling consonant")
+ end
startnext=getnext(start)
head=remove_node(head,start)
setlink(current,start)
@@ -32812,6 +32902,9 @@ function handlers.devanagari_reorder_reph(head,start)
local char=ischar(current,startfont)
if char and getprop(current,a_syllabe)==startattr then
if getstate(current,s_pstf) then
+ if trace_steps then
+ logprocess("reorder reph, before postscript, post base")
+ end
startnext=getnext(start)
head=remove_node(head,start)
setlink(getprev(current),start)
@@ -32825,6 +32918,9 @@ function handlers.devanagari_reorder_reph(head,start)
current=getnext(current)
else
if c then
+ if trace_steps then
+ logprocess("reorder reph, before postscript")
+ end
startnext=getnext(start)
head=remove_node(head,start)
setlink(getprev(c),start)
@@ -32847,7 +32943,13 @@ function handlers.devanagari_reorder_reph(head,start)
local state=getstate(current)
if before_subscript[rephbase] and (state==s_blwf or state==s_pstf) then
c=current
+ if trace_steps then
+ logprocess("reorder reph, before subscript")
+ end
elseif after_subscript[rephbase] and (state==s_pstf) then
+ if trace_steps then
+ logprocess("reorder reph, after subscript")
+ end
c=current
end
current=getnext(current)
@@ -32878,6 +32980,9 @@ function handlers.devanagari_reorder_reph(head,start)
end
end
if start~=current then
+ if trace_steps then
+ logprocess("reorder reph, to end")
+ end
startnext=getnext(start)
head=remove_node(head,start)
setlink(start,getnext(current))
@@ -32899,6 +33004,9 @@ function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start)
local next=getnext(current)
if char and getprop(current,a_syllabe)==startattr then
if halant[char] then
+ if trace_steps then
+ logprocess("reorder pre base consonants, handle halant")
+ end
if next then
local char=ischar(next,startfont)
if char and zw_char[char] and getprop(next,a_syllabe)==startattr then
@@ -32924,6 +33032,9 @@ function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start)
while current and getprop(current,a_syllabe)==startattr do
local char=ischar(current)
if (not dependent_vowel[char] and (not getstate(current) or getstate(current,s_init))) then
+ if trace_steps then
+ logprocess("reorder pre base consonants, handle vowel or initial")
+ end
startnext=getnext(start)
head=remove_node(head,start)
if current==head then
@@ -32965,6 +33076,9 @@ function handlers.devanagari_remove_joiners(head,start,kind,lookupname,replaceme
head=stop
end
flushlist(start)
+ if trace_steps then
+ logprocess("remove joiners")
+ end
return head,stop,true
end
local function initialize_two(font,attr)
@@ -32981,15 +33095,17 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
local basepos=nil
local subpos=nil
local postpos=nil
- reorderreph.coverage={}
- rephbase[font]={}
+ reorderreph.coverage={}
+ rephbase[font]={}
for i=1,#seqsubset do
local subset=seqsubset[i]
local kind=subset[1]
local lookupcache=subset[2]
if kind=="rphf" then
- reorderreph.coverage[subset[3]]=true
- rephbase[font][subset[3]]=subset[4]
+ local reph=subset[3]
+ local base=subset[4]
+ reorderreph.coverage[reph]=true
+ rephbase[font][reph]=base
local current=start
local last=getnext(stop)
while current~=last do
@@ -33004,9 +33120,9 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
current=afternext
elseif current==start then
setstate(current,s_rphf)
- current=next
+ current=next
else
- current=next
+ current=next
end
end
end
@@ -33023,7 +33139,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
if found then
local next=getnext(current)
if contextchain(found,next) then
- if (not getstate(current) and not getstate(next)) then
+ if not getstate(current) and not getstate(next) then
setstate(current,s_pref)
setstate(next,s_pref)
current=next
@@ -33045,7 +33161,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
if contextchain(found,next) then
if next~=stop and getchar(getnext(next))==c_zwnj then
current=next
- elseif (not getstate(current)) then
+ elseif not getstate(current) then
setstate(current,s_half)
if not halfpos then
halfpos=current
@@ -33067,7 +33183,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
if found then
local next=getnext(current)
if contextchain(found,next) then
- if (not getstate(current) and not getstate(next)) then
+ if not getstate(current) and not getstate(next) then
setstate(current,s_blwf)
setstate(next,s_blwf)
current=next
@@ -33088,7 +33204,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
if found then
local next=getnext(current)
if contextchain(found,next) then
- if (not getstate(current) and not getstate(next)) then
+ if not getstate(current) and not getstate(next) then
setstate(current,s_pstf)
setstate(next,s_pstf)
current=next
@@ -33110,6 +33226,9 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
stop=getprev(stop)
head=remove_node(head,current)
flushnode(current)
+ if trace_steps then
+ logprocess("reorder two, remove nbsp")
+ end
return head,stop,nbspaces
else
nbspaces=nbspaces+1
@@ -33150,6 +33269,9 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
end
end
end
+ if trace_steps then
+ logprocess("reorder two, handle nbsp")
+ end
end
else
local last=getnext(stop)
@@ -33200,14 +33322,19 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
local target=nil
local cn=getnext(current)
local tpm=twopart_mark[char]
- while tpm do
- local extra=copy_node(current)
- copyinjection(extra,current)
- char=tpm[1]
- setchar(current,char)
- setchar(extra,tpm[2])
- head=insertnodeafter(head,current,extra)
- tpm=twopart_mark[char]
+ if tpm then
+ while tpm do
+ local extra=copy_node(current)
+ copyinjection(extra,current)
+ char=tpm[1]
+ setchar(current,char)
+ setchar(extra,tpm[2])
+ head=insertnodeafter(head,current,extra)
+ tpm=twopart_mark[char]
+ end
+ if tpm and trace_steps then
+ logprocess("reorder two, handle matra")
+ end
end
if not moved[current] and dependent_vowel[char] then
if pre_mark[char] then
@@ -33248,6 +33375,9 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
end
setlink(getprev(pos),current)
setlink(current,pos)
+ if trace_steps then
+ logprocess("reorder two, handle pre mark")
+ end
elseif above_mark[char] then
target=basepos
if subpos==basepos then
@@ -33287,6 +33417,9 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
end
setlink(current,getnext(target))
setlink(target,current)
+ if trace_steps then
+ logprocess("reorder two, handle mark")
+ end
end
end
end
@@ -33314,6 +33447,9 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
stop=prev
end
cn=next
+ if trace_steps then
+ logprocess("reorder two, handle halant and ra")
+ end
end
end
end
@@ -33346,6 +33482,9 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
setprev(nextnextnext,current)
end
setlink(nextnext,c)
+ if trace_steps then
+ logprocess("reorder two, handle nukta")
+ end
end
if stop==current then break end
current=getnext(current)
@@ -33357,6 +33496,9 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
nbspaces=nbspaces-1
head=remove_node(head,base)
flushnode(base)
+ if trace_steps then
+ logprocess("reorder two, handle nbsp")
+ end
end
return head,stop,nbspaces
end
@@ -33444,21 +33586,38 @@ local function analyze_next_chars_one(c,font,variant)
local already_below_mark
local already_post_mark
while dependent_vowel[v] do
- local vowels=twopart_mark[v] or { v }
- for k,v in next,vowels do
- if pre_mark[v] and not already_pre_mark then
+ local vowels=twopart_mark[v]
+ if vowels then
+ for k=1,#vowels do
+ local v=vowels[k]
+ if pre_mark[v] and not already_pre_mark then
+ already_pre_mark=true
+ elseif above_mark[v] and not already_above_mark then
+ already_above_mark=true
+ elseif below_mark[v] and not already_below_mark then
+ already_below_mark=true
+ elseif post_mark[v] and not already_post_mark then
+ already_post_mark=true
+ elseif devanagarihash[font].conjuncts=="quit" then
+ return c
+ end
+ end
+ else
+ if devanagarihash[font].conjuncts=="quit" then
+ return c
+ elseif pre_mark[v] and not already_pre_mark then
already_pre_mark=true
- elseif above_mark[v] and not already_above_mark then
- already_above_mark=true
- elseif below_mark[v] and not already_below_mark then
- already_below_mark=true
elseif post_mark[v] and not already_post_mark then
already_post_mark=true
+ elseif below_mark[v] and not already_below_mark then
+ already_below_mark=true
+ elseif above_mark[v] and not already_above_mark then
+ already_above_mark=true
else
return c
end
end
- c=getnext(c)
+ c=n
n=getnext(c)
if not n then
return c
@@ -33469,7 +33628,7 @@ local function analyze_next_chars_one(c,font,variant)
end
end
if nukta[v] then
- c=getnext(c)
+ c=n
n=getnext(c)
if not n then
return c
@@ -33480,7 +33639,7 @@ local function analyze_next_chars_one(c,font,variant)
end
end
if halant[v] then
- c=getnext(c)
+ c=n
n=getnext(c)
if not n then
return c
@@ -33491,7 +33650,7 @@ local function analyze_next_chars_one(c,font,variant)
end
end
if vowel_modifier[v] then
- c=getnext(c)
+ c=n
n=getnext(c)
if not n then
return c
@@ -33502,7 +33661,7 @@ local function analyze_next_chars_one(c,font,variant)
end
end
if stress_tone_mark[v] then
- c=getnext(c)
+ c=n
n=getnext(c)
if not n then
return c
@@ -33626,18 +33785,35 @@ local function analyze_next_chars_two(c,font)
local already_pre_mark
local already_above_mark
local already_below_mark
- local already_post_mark
+ local already_post_mark
while dependent_vowel[v] do
- local vowels=twopart_mark[v] or { v }
- for k,v in next,vowels do
- if pre_mark[v] and not already_pre_mark then
+ local vowels=twopart_mark[v]
+ if vowels then
+ for k=1,#vowels do
+ local v=vowels[k]
+ if pre_mark[v] and not already_pre_mark then
+ already_pre_mark=true
+ elseif above_mark[v] and not already_above_mark then
+ already_above_mark=true
+ elseif below_mark[v] and not already_below_mark then
+ already_below_mark=true
+ elseif post_mark[v] and not already_post_mark then
+ already_post_mark=true
+ elseif devanagarihash[font].conjuncts=="quit" then
+ return c
+ end
+ end
+ else
+ if devanagarihash[font].conjuncts=="quit" then
+ return c
+ elseif pre_mark[v] and not already_pre_mark then
already_pre_mark=true
- elseif above_mark[v] and not already_above_mark then
- already_above_mark=true
- elseif below_mark[v] and not already_below_mark then
- already_below_mark=true
elseif post_mark[v] and not already_post_mark then
already_post_mark=true
+ elseif below_mark[v] and not already_below_mark then
+ already_below_mark=true
+ elseif above_mark[v] and not already_above_mark then
+ already_above_mark=true
else
return c
end
@@ -33876,7 +34052,7 @@ local function method_one(head,font,attr)
end
else
if show_syntax_errors then
- local mark=mark_four[char]
+ local mark=mark_pre_above_below_post[char]
if mark then
head,current=inject_syntax_error(head,current,char)
end
@@ -33975,7 +34151,7 @@ local function method_two(head,font,attr)
if not syllableend and show_syntax_errors then
local char=ischar(current,font)
if char and not getstate(current) then
- local mark=mark_four[char]
+ local mark=mark_pre_above_below_post[char]
if mark then
head,current=inject_syntax_error(head,current,char)
end