diff options
50 files changed, 965 insertions, 404 deletions
diff --git a/doc/context/sources/general/manuals/workflows/workflows-injectors.tex b/doc/context/sources/general/manuals/workflows/workflows-injectors.tex index d2f837d82..daae11c82 100644 --- a/doc/context/sources/general/manuals/workflows/workflows-injectors.tex +++ b/doc/context/sources/general/manuals/workflows/workflows-injectors.tex @@ -84,3 +84,19 @@ and \stopchapter \stopcomponent + +% to be described: + +% \setinjector[register][3][\column] +% \setinjector[list] [2][{\blank[3*big]}] + +% \starttext +% \placelist[section][criterium=text] +% \blank[3*big] +% \placeregister[index][criterium=text] +% \page +% \startsection[title=Alpha] first \index{first} \stopsection +% \startsection[title=Beta] second \index{second} \stopsection +% \startsection[title=Gamma] third \index{third} \stopsection +% \startsection[title=Delta] fourth \index{fourth} \stopsection +% \stoptext diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua index 9bd181fd7..1d8946cbd 100644 --- a/tex/context/base/char-def.lua +++ b/tex/context/base/char-def.lua @@ -59323,6 +59323,8 @@ characters.data={ description="INVISIBLE SEPARATOR", direction="bn", linebreak="al", + mathclass="binary", + mathname="invisibletimes", unicodeslot=0x2063, }, [0x2064]={ diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 0d629b2fb..fc151a6e2 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2015.09.04 11:00} +\newcontextversion{2015.09.09 21:23} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-performance.tex b/tex/context/base/context-performance.tex new file mode 100644 index 000000000..c012c992c --- /dev/null +++ b/tex/context/base/context-performance.tex @@ -0,0 +1,51 @@ +% language=uk + +\usemodule[art-01,abr-01] + +\starttext + +If you use \PDFTEX, \XETEX\ and \LUATEX\ you will notice a difference in speed. +Don't draw conclusions too easily from simple tests like: + +\starttyping +\dorecurse{1000}{test\page} +\stoptyping + +or (also tests the file system): + +\starttyping +\dorecurse{1000}{\input tufte\blank} +\stoptyping + +The wide engines \XETEX\ and \LUATEX\ have more work to do than \PDFTEX, because +the input is \UTF\ and \UNICODE\ fonts are used. Of course running \PDFTEX\ on +extensive \UTF\ input will compensate it a bit. + +Comparing \XETEX\ and \PDFTEX\ (using \MKII) and \LUATEX\ (using \MKIV) is kind +of useless anyway because the \LUATEX\ with \MKIV\ combination is not only doing +more advanced things, which costs time, but at the other hand has more efficient +alternatives, like for instance using \MPLIB, which gains a lot. + +So, it's best to compare speeds with a mixed content document: multiple fonts, +text and math, images, \METAPOST\ graphics, structural components, tables, etc. + +On the average \PDFTEX\ is the fastest, but offering less functionality, while +\LUATEX\ with \MKIV\ is faster than \XETEX\ with \MKII. On complex products like +the \METAFUN\ manual or when processing complex \XML\ files a \LUATEX\ is much +faster than a \PDFTEX\ run. + +There is some startup time involved which is normally not that much, and initial +font loading is also not really a burden, but of course for a few page document +it brings down the number of pages processed per second. Normalizing the input +takes a bit but applying \OPENTYPE\ font features takes much more. If you find +unacceptable bottlenecks just let me know (but better first check performance in +the other engines). Of course inefficient coding of styles (massive font switches +where a simple one could do) are no reason for a complaint. + +A lot of time went into making sure that \CONTEXT\ runs efficiently on \LUATEX\ +and we keep improving the performance. This is not so much an engine issue but +more one of the macro package. Of course what is true for \CONTEXT\ \MKIV\ can be +different for other macro packages but comparing with them makes no sense because +the differences in functionality. + +\stoptext diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 5340fc16b..a05a27a7a 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 4a84d5af8..27fe29b27 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2015.09.04 11:00} +\edef\contextversion{2015.09.09 21:23} \edef\contextkind {beta} %D For those who want to use this: @@ -189,6 +189,11 @@ %loadmarkfile{spac-cha} % obsolete %loadmarkfile{supp-num} % obsolete +\loadmarkfile{core-uti} +\loadmkvifile{file-job} + +\loadmarkfile{anch-pos} + \loadmarkfile{typo-ini} \loadmarkfile{typo-lin} \loadmarkfile{typo-bld} % par builders @@ -212,7 +217,7 @@ \loadmarkfile{unic-ini} -\loadmarkfile{core-uti} +% \loadmarkfile{core-uti} \loadmarkfile{core-two} \loadmarkfile{core-dat} @@ -228,7 +233,7 @@ \loadmarkfile{lang-url} \loadmarkfile{lang-def} -\loadmkvifile{file-job} % why so late? +% \loadmkvifile{file-job} % why so late? \loadmarkfile{symb-ini} % brrr depends on fonts @@ -245,7 +250,7 @@ \loadmkvifile{typo-prc} -\loadmarkfile{anch-pos} +% \loadmarkfile{anch-pos} \loadmkvifile{strc-ini} \loadmarkfile{strc-tag} diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua index 8773d9224..58d7c9e02 100644 --- a/tex/context/base/core-con.lua +++ b/tex/context/base/core-con.lua @@ -1197,21 +1197,26 @@ implement { -- j and jj obsolete local function currentdate(str,currentlanguage) -- second argument false : no label - local list = utilities.parsers.settings_to_array(str) + local list = utilities.parsers.settings_to_array(str) local splitlabel = languages.labels.split or string.itself -- we need to get the loading order right - local year, month, day = tex.year, tex.month, tex.day - local auto = true + local year = tex.year + local month = tex.month + local day = tex.day + local auto = true if currentlanguage == "" then currentlanguage = false end for i=1,#list do local entry = list[i] local tag, plus = splitlabel(entry) - local ordinal, mnemonic, whatordinal = false, false, nil + local ordinal, mnemonic, whatordinal, highordinal = false, false, nil, false if not tag then tag = entry elseif plus == "+" or plus == "ord" then ordinal = true + elseif plus == "++" or plus == "highord" then + ordinal = true + highordinal = true elseif plus == "mnem" then mnemonic = true end @@ -1272,7 +1277,7 @@ local function currentdate(str,currentlanguage) -- second argument false : no la if currentlanguage == false then -- ignore else - context.highordinalstr(converters.ordinal(whatordinal,currentlanguage)) + context[highordinal and "highordinalstr" or "ordinalstr"](converters.ordinal(whatordinal,currentlanguage)) end end end diff --git a/tex/context/base/core-env.mkiv b/tex/context/base/core-env.mkiv index 5dc6f6902..6217bb3c3 100644 --- a/tex/context/base/core-env.mkiv +++ b/tex/context/base/core-env.mkiv @@ -473,8 +473,8 @@ % no checking and we assume it being defined: \def\fastsetup #1{\csname\??setup:#1\endcsname\empty} -\def\fastsetupwithargument #1#2{\csname\??setup:#1\endcsname{#2}} % swapped per 2015-08-30 -\def\fastsetupwithargumentswapped #1{\csname\??setup:#1\endcsname} +\def\fastsetupwithargument #1{\csname\??setup:#1\endcsname} % swapped per 2015-08-30 +\def\fastsetupwithargumentswapped#1#2{\csname\??setup:#2\endcsname{#1}}% swapped per 2015-09-05 % the next one is meant for \c!setups situations, hence the check for % a shortcut diff --git a/tex/context/base/font-odv.lua b/tex/context/base/font-odv.lua index 2ef1aabe7..c4707d173 100644 --- a/tex/context/base/font-odv.lua +++ b/tex/context/base/font-odv.lua @@ -638,8 +638,7 @@ local function deva_initialize(font,attr) -- deva vattu = true -- dev2 - -- local subtables = sequence.subtables -- dataset[5].subtables - local subtables = dataset[5].subtables + local subtables = dataset[3].subtables for i=1,#subtables do local lookupname = subtables[i] local lookupcache = lookuphash[lookupname] @@ -1317,8 +1316,7 @@ local function dev2_initialize(font,attr) local kind = dataset[4] if kind and valid[kind] then -- could become a function call - -- local subtables = sequence.subtables - local subtables = dataset[5].subtables + local subtables = dataset[3].subtables for i=1,#subtables do local lookupname = subtables[i] local lookupcache = lookuphash[lookupname] diff --git a/tex/context/base/font-osd.lua b/tex/context/base/font-osd.lua index 368588206..cf2835554 100644 --- a/tex/context/base/font-osd.lua +++ b/tex/context/base/font-osd.lua @@ -479,7 +479,7 @@ local both_joiners_true = { } local sequence_reorder_matras = { - chain = 0, + chain = 0, -- obsolete features = { dv01 = dev2_defaults }, flags = false_flags, name = "dv01_reorder_matras", @@ -487,12 +487,15 @@ local sequence_reorder_matras = { type = "devanagari_reorder_matras", nofsteps = 1, steps = { - { coverage = pre_mark } + { + osdstep = true, + coverage = pre_mark, + } } } local sequence_reorder_reph = { - chain = 0, + chain = 0, -- obsolete features = { dv02 = dev2_defaults }, flags = false_flags, name = "dv02_reorder_reph", @@ -500,12 +503,15 @@ local sequence_reorder_reph = { type = "devanagari_reorder_reph", nofsteps = 1, steps = { - { coverage = { } } + { + osdstep = true, + coverage = { }, + } } } local sequence_reorder_pre_base_reordering_consonants = { - chain = 0, + chain = 0, -- obsolete features = { dv03 = dev2_defaults }, flags = false_flags, name = "dv03_reorder_pre_base_reordering_consonants", @@ -513,12 +519,15 @@ local sequence_reorder_pre_base_reordering_consonants = { type = "devanagari_reorder_pre_base_reordering_consonants", nofsteps = 1, steps = { - { coverage = { } } + { + osdstep = true, + coverage = { }, + } } } local sequence_remove_joiners = { - chain = 0, + chain = 0, -- obsolete features = { dv04 = deva_defaults }, flags = false_flags, name = "dv04_remove_joiners", @@ -526,7 +535,9 @@ local sequence_remove_joiners = { type = "devanagari_remove_joiners", nofsteps = 1, steps = { - { coverage = both_joiners_true }, + { osdstep = true, + coverage = both_joiners_true, + }, } } @@ -650,11 +661,8 @@ local function initializedevanagi(tfmdata) local step = steps[i] local coverage = step.coverage if coverage then - local reph = false - local chain = dataset[3] - if chain ~= 0 then --rphf is result of of chain - -- rphf might be result of other handler/chainproc - else + local reph = false + if step.osdstep then -- rphf acts on consonant + halant for k, v in next, ra do local r = coverage[k] @@ -672,13 +680,15 @@ local function initializedevanagi(tfmdata) end end end + else + -- rphf might be result of other handler/chainproc end seqsubset[#seqsubset+1] = { kind, coverage, reph } end end end if kind == "pref" then - local sequence = dataset[5] + local sequence = dataset[3] -- was [5] local steps = sequence.steps local nofsteps = sequence.nofsteps for i=1,nofsteps do diff --git a/tex/context/base/font-otd.lua b/tex/context/base/font-otd.lua index a2354a0cc..f8119dcfc 100644 --- a/tex/context/base/font-otd.lua +++ b/tex/context/base/font-otd.lua @@ -183,12 +183,7 @@ local function initialize(sequence,script,language,s_enabled,a_enabled,font,attr end end end - -- { valid, attribute, chain, "generic", sequence } -- false anyway, could be flag instead of table - else - -- can't happen end - else - -- { false, false, chain, false, sequence } -- indirect lookup, part of chain (todo: make this a separate table) end end diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua index 9c09185a3..53850b50d 100644 --- a/tex/context/base/font-otn.lua +++ b/tex/context/base/font-otn.lua @@ -2184,6 +2184,7 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq if f == l then -- new, else last out of sync (f is > 1) -- match = true else + local discfound = nil local n = f + 1 last = getnext(last) while n <= l do @@ -2211,19 +2212,35 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq end n = n + 1 else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpre[discfound] + else + match = false + end break end else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpre[discfound] + else + match = false + end break end else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpre[discfound] + else + match = false + end break end elseif id == disc_code then diskseen = true + discfound = last notmatchpre[last] = nil notmatchpost[last] = true notmatchreplace[last] = nil @@ -2235,9 +2252,7 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq if seq[n][getchar(pre)] then n = n + 1 pre = getnext(pre) - if not pre then - break - elseif n > l then + if n > l then break end else @@ -2245,6 +2260,9 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq break end end + if n <= l then + notmatchpre[last] = true + end else notmatchpre[last] = true end @@ -2254,25 +2272,16 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq if seq[n][getchar(replace)] then n = n + 1 replace = getnext(replace) - if not replace then - break - elseif n > l then - -- match = false + if n > l then break end else notmatchreplace[last] = true - if notmatchpre[last] then - match = false - end + match = not notmatchpre[last] break end end - if not match then - break - end - else - notmatchreplace[last] = true + match = not notmatchpre[last] end last = getnext(last) else @@ -2295,7 +2304,8 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq -- sweeptype = nil end if prev then - local n = f-1 + local discfound = nil + local n = f - 1 while n >= 1 do if prev then local id = getid(prev) @@ -2313,20 +2323,36 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq elseif seq[n][char] then n = n -1 else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpost[discfound] + else + match = false + end break end else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpost[discfound] + else + match = false + end break end else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpost[discfound] + else + match = false + end break end elseif id == disc_code then -- the special case: f i where i becomes dottless i .. diskseen = true + discfound = prev notmatchpre[prev] = true notmatchpost[prev] = nil notmatchreplace[prev] = nil @@ -2336,44 +2362,46 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq if pre ~= start and post ~= start and replace ~= start then if post then local n = n - post = find_node_tail(post) - local finish = getprev(post) - while post do - if seq[n][getchar(post)] then + local posttail = find_node_tail(post) + while posttail do + if seq[n][getchar(posttail)] then n = n - 1 - post = getprev(post) - if not post or post == finish then - break - elseif n < 1 then + if posttail == post then break + else + posttail = getprev(posttail) + if n < 1 then + break + end end else notmatchpost[prev] = true break end end + if n >= 1 then + notmatchpost[prev] = true + end else notmatchpost[prev] = true end if replace then -- we seldom enter this branch (e.g. on brill efficient) - replace = find_node_tail(replace) - local finish = getprev(replace) - while replace do - if seq[n][getchar(replace)] then + local replacetail = find_node_tail(replace) + while replacetail do + if seq[n][getchar(replacetail)] then n = n - 1 - replace = getprev(replace) - if not replace or replace == finish then - break - elseif n < 1 then - -- match = false + if replacetail == replace then break + else + replacetail = getprev(replacetail) + if n < 1 then + break + end end else notmatchreplace[prev] = true - if notmatchpost[prev] then - match = false - end + match = not notmatchpost[prev] break end end @@ -2417,6 +2445,7 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq end end if current then + local discfound = nil -- removed optimization for s-l == 1, we have to deal with marks anyway local n = l + 1 while n <= s do @@ -2436,19 +2465,35 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq elseif seq[n][char] then n = n + 1 else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpre[discfound] + else + match = false + end break end else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpre[discfound] + else + match = false + end break end else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpre[discfound] + else + match = false + end break end elseif id == disc_code then diskseen = true + discfound = current notmatchpre[current] = nil notmatchpost[current] = true notmatchreplace[current] = nil @@ -2460,9 +2505,7 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq if seq[n][getchar(pre)] then n = n + 1 pre = getnext(pre) - if not pre then - break - elseif n > s then + if n > s then break end else @@ -2470,6 +2513,9 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq break end end + if n <= s then + notmatchpre[current] = true + end else notmatchpre[current] = true end @@ -2479,16 +2525,12 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq if seq[n][getchar(replace)] then n = n + 1 replace = getnext(replace) - if not replace then - break - elseif n > s then + if n > s then break end else notmatchreplace[current] = true - if notmatchpre[current] then - match = false - end + match = notmatchpre[current] break end end diff --git a/tex/context/base/font-ots.lua b/tex/context/base/font-ots.lua index 2204d1496..a5d4d3a5d 100644 --- a/tex/context/base/font-ots.lua +++ b/tex/context/base/font-ots.lua @@ -2165,6 +2165,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) if f == l then -- new, else last out of sync (f is > 1) -- match = true else + local discfound = nil local n = f + 1 last = getnext(last) while n <= l do @@ -2192,19 +2193,35 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) end n = n + 1 else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpre[discfound] + else + match = false + end break end else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpre[discfound] + else + match = false + end break end else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpre[discfound] + else + match = false + end break end elseif id == disc_code then diskseen = true + discfound = last notmatchpre[last] = nil notmatchpost[last] = true notmatchreplace[last] = nil @@ -2216,9 +2233,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) if seq[n][getchar(pre)] then n = n + 1 pre = getnext(pre) - if not pre then - break - elseif n > l then + if n > l then break end else @@ -2226,6 +2241,9 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) break end end + if n <= l then + notmatchpre[last] = true + end else notmatchpre[last] = true end @@ -2235,25 +2253,16 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) if seq[n][getchar(replace)] then n = n + 1 replace = getnext(replace) - if not replace then - break - elseif n > l then - -- match = false + if n > l then break end else notmatchreplace[last] = true - if notmatchpre[last] then - match = false - end + match = not notmatchpre[last] break end end - if not match then - break - end - else - notmatchreplace[last] = true + match = not notmatchpre[last] end last = getnext(last) else @@ -2276,7 +2285,8 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) -- sweeptype = nil end if prev then - local n = f-1 + local discfound = nil + local n = f - 1 while n >= 1 do if prev then local id = getid(prev) @@ -2294,20 +2304,36 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) elseif seq[n][char] then n = n -1 else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpost[discfound] + else + match = false + end break end else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpost[discfound] + else + match = false + end break end else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpost[discfound] + else + match = false + end break end elseif id == disc_code then -- the special case: f i where i becomes dottless i .. diskseen = true + discfound = prev notmatchpre[prev] = true notmatchpost[prev] = nil notmatchreplace[prev] = nil @@ -2317,44 +2343,46 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) if pre ~= start and post ~= start and replace ~= start then if post then local n = n - post = find_node_tail(post) - local finish = getprev(post) - while post do - if seq[n][getchar(post)] then + local posttail = find_node_tail(post) + while posttail do + if seq[n][getchar(posttail)] then n = n - 1 - post = getprev(post) - if not post or post == finish then - break - elseif n < 1 then + if posttail == post then break + else + posttail = getprev(posttail) + if n < 1 then + break + end end else notmatchpost[prev] = true break end end + if n >= 1 then + notmatchpost[prev] = true + end else notmatchpost[prev] = true end if replace then -- we seldom enter this branch (e.g. on brill efficient) - replace = find_node_tail(replace) - local finish = getprev(replace) - while replace do - if seq[n][getchar(replace)] then + local replacetail = find_node_tail(replace) + while replacetail do + if seq[n][getchar(replacetail)] then n = n - 1 - replace = getprev(replace) - if not replace or replace == finish then - break - elseif n < 1 then - -- match = false + if replacetail == replace then break + else + replacetail = getprev(replacetail) + if n < 1 then + break + end end else notmatchreplace[prev] = true - if notmatchpost[prev] then - match = false - end + match = not notmatchpost[prev] break end end @@ -2398,6 +2426,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) end end if current then + local discfound = nil -- removed optimization for s-l == 1, we have to deal with marks anyway local n = l + 1 while n <= s do @@ -2417,19 +2446,35 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) elseif seq[n][char] then n = n + 1 else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpre[discfound] + else + match = false + end break end else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpre[discfound] + else + match = false + end break end else - match = false + if discfound then + notmatchreplace[discfound] = true + match = not notmatchpre[discfound] + else + match = false + end break end elseif id == disc_code then diskseen = true + discfound = current notmatchpre[current] = nil notmatchpost[current] = true notmatchreplace[current] = nil @@ -2441,9 +2486,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) if seq[n][getchar(pre)] then n = n + 1 pre = getnext(pre) - if not pre then - break - elseif n > s then + if n > s then break end else @@ -2451,6 +2494,9 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) break end end + if n <= s then + notmatchpre[current] = true + end else notmatchpre[current] = true end @@ -2460,16 +2506,12 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) if seq[n][getchar(replace)] then n = n + 1 replace = getnext(replace) - if not replace then - break - elseif n > s then + if n > s then break end else notmatchreplace[current] = true - if notmatchpre[current] then - match = false - end + match = notmatchpre[current] break end end diff --git a/tex/context/base/lang-hyp.mkiv b/tex/context/base/lang-hyp.mkiv index 329837c76..e3f032c6b 100644 --- a/tex/context/base/lang-hyp.mkiv +++ b/tex/context/base/lang-hyp.mkiv @@ -167,10 +167,10 @@ \unexpanded\def\atleastoneword#1% {\begingroup - \starthyphenation[\c!method=traditional]% this might become default or a faster switch + \starthyphenation[traditional]% this might become default or a faster switch \sethyphenationfeatures[words]% #1\par - \stopthyphenation + \stophyphenation \endgroup} %D For me: diff --git a/tex/context/base/lang-ini.mkiv b/tex/context/base/lang-ini.mkiv index 335d6d1c9..fa3de9a9a 100644 --- a/tex/context/base/lang-ini.mkiv +++ b/tex/context/base/lang-ini.mkiv @@ -534,7 +534,7 @@ \appendtoks \edef\p_language_font{\languageparameter\s!font}% \ifx\p_language_font\v!auto - \feature\currentlanguage + \doaddfeature\currentlanguage \fi \to \everylanguage diff --git a/tex/context/base/lang-lab.lua b/tex/context/base/lang-lab.lua index e90bee017..f5ae6de5e 100644 --- a/tex/context/base/lang-lab.lua +++ b/tex/context/base/lang-lab.lua @@ -164,8 +164,8 @@ implement { { { "text" }, { "separators" }, - { "first" }, - { "second" }, + { "separator" }, + { "last" }, } } } diff --git a/tex/context/base/lang-lab.mkiv b/tex/context/base/lang-lab.mkiv index 1fdd52b4f..f615ad6a6 100644 --- a/tex/context/base/lang-lab.mkiv +++ b/tex/context/base/lang-lab.mkiv @@ -352,8 +352,8 @@ {\clf_concatcommalist text {#1}% separators {#2}% - first {\detokenize\expandafter{\normalexpanded{\labeltext{and-1}}}}% - second {\detokenize\expandafter{\normalexpanded{\labeltext{and-2}}}}% + separator {\detokenize\expandafter{\normalexpanded{\labeltext{and-1}}}}% + last {\detokenize\expandafter{\normalexpanded{\labeltext{and-2}}}}% \relax} \setuplabeltext [\s!nl] [and-1={{, }}, and-2={{ en }}] % 1, 2 en 3 diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index e3ff3c396..cf4db6f02 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -19,6 +19,12 @@ if not modules then modules = { } end modules ['math-noa'] = { -- 20D6 -> 2190 -- 20D7 -> 2192 +-- future luatex will return font for a math char too +-- +-- local function getfont(n) +-- return font_of_family(getfield(n,"fam")) +-- end + -- todo: most is math_char so we can have simple dedicated loops local utfchar, utfbyte = utf.char, utf.byte @@ -85,7 +91,7 @@ local setfield = nuts.setfield local getnext = nuts.getnext local getprev = nuts.getprev local getid = nuts.getid -local getfont = nuts.getfont +----- getfont = nuts.getfont local getsubtype = nuts.getsubtype local getchar = nuts.getchar local getattr = nuts.getattr diff --git a/tex/context/base/mult-de.mkii b/tex/context/base/mult-de.mkii index 213740179..bbfc317d5 100644 --- a/tex/context/base/mult-de.mkii +++ b/tex/context/base/mult-de.mkii @@ -976,6 +976,7 @@ \setinterfaceconstant{reset}{reset} \setinterfaceconstant{resetnumber}{resetnumber} \setinterfaceconstant{resolution}{aufloesung} +\setinterfaceconstant{reverse}{reverse} \setinterfaceconstant{right}{rechts} \setinterfaceconstant{rightcolor}{rechterfarbe} \setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua index 60ffe9ebb..679a48710 100644 --- a/tex/context/base/mult-def.lua +++ b/tex/context/base/mult-def.lua @@ -9823,6 +9823,16 @@ return { ["pe"]="کیفیت", ["ro"]="rezolutie", }, + ["reverse"]={ + ["cs"]="reverse", + ["de"]="reverse", + ["en"]="reverse", + ["fr"]="inverse", + ["it"]="invertito", + ["nl"]="omgekeerd", + ["pe"]="برعکس", + ["ro"]="reverse", + }, ["right"]={ ["cs"]="vpravo", ["de"]="rechts", diff --git a/tex/context/base/mult-en.mkii b/tex/context/base/mult-en.mkii index cf1b68017..fa1a353ce 100644 --- a/tex/context/base/mult-en.mkii +++ b/tex/context/base/mult-en.mkii @@ -976,6 +976,7 @@ \setinterfaceconstant{reset}{reset} \setinterfaceconstant{resetnumber}{resetnumber} \setinterfaceconstant{resolution}{resolution} +\setinterfaceconstant{reverse}{reverse} \setinterfaceconstant{right}{right} \setinterfaceconstant{rightcolor}{rightcolor} \setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} diff --git a/tex/context/base/mult-fr.mkii b/tex/context/base/mult-fr.mkii index 1f0b8558e..f04fdf98f 100644 --- a/tex/context/base/mult-fr.mkii +++ b/tex/context/base/mult-fr.mkii @@ -976,6 +976,7 @@ \setinterfaceconstant{reset}{reset} \setinterfaceconstant{resetnumber}{raznumero} \setinterfaceconstant{resolution}{resolution} +\setinterfaceconstant{reverse}{inverse} \setinterfaceconstant{right}{droite} \setinterfaceconstant{rightcolor}{couleurdroite} \setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} diff --git a/tex/context/base/mult-it.mkii b/tex/context/base/mult-it.mkii index 60de2b489..8dfc95609 100644 --- a/tex/context/base/mult-it.mkii +++ b/tex/context/base/mult-it.mkii @@ -976,6 +976,7 @@ \setinterfaceconstant{reset}{reset} \setinterfaceconstant{resetnumber}{resetnumber} \setinterfaceconstant{resolution}{risoluzione} +\setinterfaceconstant{reverse}{invertito} \setinterfaceconstant{right}{destra} \setinterfaceconstant{rightcolor}{coloredestra} \setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} diff --git a/tex/context/base/mult-nl.mkii b/tex/context/base/mult-nl.mkii index 4769a0f28..dd039e964 100644 --- a/tex/context/base/mult-nl.mkii +++ b/tex/context/base/mult-nl.mkii @@ -976,6 +976,7 @@ \setinterfaceconstant{reset}{reset} \setinterfaceconstant{resetnumber}{resetnummer} \setinterfaceconstant{resolution}{resolutie} +\setinterfaceconstant{reverse}{omgekeerd} \setinterfaceconstant{right}{rechts} \setinterfaceconstant{rightcolor}{rechterkleur} \setinterfaceconstant{rightcompoundhyphen}{rechterkoppelteken} diff --git a/tex/context/base/mult-pe.mkii b/tex/context/base/mult-pe.mkii index 79a696d45..59586deaa 100644 --- a/tex/context/base/mult-pe.mkii +++ b/tex/context/base/mult-pe.mkii @@ -976,6 +976,7 @@ \setinterfaceconstant{reset}{بازنشانی} \setinterfaceconstant{resetnumber}{بازنشانیشماره} \setinterfaceconstant{resolution}{کیفیت} +\setinterfaceconstant{reverse}{برعکس} \setinterfaceconstant{right}{راست} \setinterfaceconstant{rightcolor}{رنگراست} \setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} diff --git a/tex/context/base/mult-ro.mkii b/tex/context/base/mult-ro.mkii index a9d9f88ff..1d336d3f9 100644 --- a/tex/context/base/mult-ro.mkii +++ b/tex/context/base/mult-ro.mkii @@ -976,6 +976,7 @@ \setinterfaceconstant{reset}{reset} \setinterfaceconstant{resetnumber}{resetnumber} \setinterfaceconstant{resolution}{rezolutie} +\setinterfaceconstant{reverse}{reverse} \setinterfaceconstant{right}{dreapta} \setinterfaceconstant{rightcolor}{culoaredreapta} \setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} diff --git a/tex/context/base/node-aux.lua b/tex/context/base/node-aux.lua index f9b300d1e..d6f798083 100644 --- a/tex/context/base/node-aux.lua +++ b/tex/context/base/node-aux.lua @@ -36,6 +36,7 @@ local getfont = nuts.getfont local getchar = nuts.getchar local getattr = nuts.getattr local setfield = nuts.setfield +local getfield = nuts.getfield local setattr = nuts.setattr local traverse_nodes = nuts.traverse @@ -313,7 +314,7 @@ local function firstcharinbox(n) end nuts .firstcharinbox = firstcharinbox -nodes.firstcharinbox = firstcharinbox +nodes.firstcharinbox = firstcharinbox -- hm, ok ? nodes.firstcharacter = vianuts(firstcharacter) interfaces.implement { @@ -555,4 +556,19 @@ end -- end -- end +function nuts.effectiveglue(glue,parent) + local spec = getfield(glue,"spec") + local width = getfield(spec,"width") + local sign = getfield(parent,"glue_sign") + if sign == 1 then + if getfield(spec,"stretch_order") == getfield(parent,"glue_order") then + return width + getfield(spec,"stretch") * getfield(parent,"glue_set") + end + elseif sign == 2 then + if getfield(spec,"shrink_order") == getfield(parent,"glue_order") then + return width - getfield(spec,"shrink") * getfield(parent,"glue_set") + end + end + return width +end diff --git a/tex/context/base/node-tra.lua b/tex/context/base/node-tra.lua index a7ab7f77f..37e01782f 100644 --- a/tex/context/base/node-tra.lua +++ b/tex/context/base/node-tra.lua @@ -189,20 +189,29 @@ end function nodes.idstostring(head,tail) head = tonut(head) tail = tail and tonut(tail) - local t, last_id, last_n = { }, nil, 0 + local t = { } + local last_id = nil + local last_n = 0 for n in traverse_nodes(head,tail) do -- hm, does not stop at tail local id = getid(n) + if id == whatsit_code then + id = whatcodes[getsubtype(n)] + else + id = nodecodes[id] + end if not last_id then - last_id, last_n = id, 1 + last_id = id + last_n = 1 elseif last_id == id then last_n = last_n + 1 else if last_n > 1 then - t[#t+1] = formatters["[%s*%s]"](last_n,nodecodes[last_id] or "?") + t[#t+1] = formatters["[%s*%s]"](last_n,last_id) else - t[#t+1] = formatters["[%s]"](nodecodes[last_id] or "?") + t[#t+1] = formatters["[%s]"](last_id) end - last_id, last_n = id, 1 + last_id = id + last_n = 1 end if n == tail then break @@ -210,10 +219,12 @@ function nodes.idstostring(head,tail) end if not last_id then t[#t+1] = "no nodes" - elseif last_n > 1 then - t[#t+1] = formatters["[%s*%s]"](last_n,nodecodes[last_id] or "?") else - t[#t+1] = formatters["[%s]"](nodecodes[last_id] or "?") + if last_n > 1 then + t[#t+1] = formatters["[%s*%s]"](last_n,last_id) + else + t[#t+1] = formatters["[%s]"](last_id) + end end return concat(t," ") end diff --git a/tex/context/base/page-lin.lua b/tex/context/base/page-lin.lua index 788ca0a18..af6118b05 100644 --- a/tex/context/base/page-lin.lua +++ b/tex/context/base/page-lin.lua @@ -97,7 +97,10 @@ local new_kern = nodepool.kern local ctx_convertnumber = context.convertnumber local ctx_makelinenumber = context.makelinenumber -local addtoline = typesetters.paragraphs.addtoline +local paragraphs = typesetters.paragraphs +local addtoline = paragraphs.addtoline +local checkline = paragraphs.checkline +local moveinline = paragraphs.moveinline -- cross referencing @@ -244,7 +247,7 @@ local function check_number(n,a,skip,sameline) report_lines("skipping line number %s for setup %a: %s (%s)",#current_list,a,s,d.continue or v_no) end end - local p = getprop(n,"line") + local p = checkline(n) if p then ctx_makelinenumber(tag,skipflag,s,p.hsize,p.reverse and "TRT" or "TLT") else diff --git a/tex/context/base/page-lin.mkvi b/tex/context/base/page-lin.mkvi index 804667e5e..28c0b0bc5 100644 --- a/tex/context/base/page-lin.mkvi +++ b/tex/context/base/page-lin.mkvi @@ -326,7 +326,7 @@ \relax \egroup} -\def\page_lines_make_number#tag#mode#linenumber#width#dir% with hang and parindent and skips we have to compensatefor \hsize +\def\page_lines_make_number#tag#mode#linenumber#width#dir% with hang and parindent and skips we have to compensate for \hsize {\naturalhbox to \zeropoint \bgroup \ifcase#mode\relax % \settrue \c_page_lines_fake_number diff --git a/tex/context/base/page-set.mkiv b/tex/context/base/page-set.mkiv index 105fedb3e..51f990308 100644 --- a/tex/context/base/page-set.mkiv +++ b/tex/context/base/page-set.mkiv @@ -1495,7 +1495,7 @@ \unexpanded\def\page_set_setup_step##1% {\doifelse{##1}\v!each {\dorecurse{\namedcolumnsetparameter{#1}\c!n}{\page_set_setup_step\recurselevel}} - {\normalexpanded{\page_set_setup_saved[#1:\recurselevel]}[#3]}}% + {\normalexpanded{\page_set_setup_saved[#1:##1]}[#3]}}% \processcommalist[#2]\page_set_setup_step \else \page_set_setup_saved[#1][#2]% diff --git a/tex/context/base/phys-dim.mkiv b/tex/context/base/phys-dim.mkiv index b1bcb40c9..d25bef785 100644 --- a/tex/context/base/phys-dim.mkiv +++ b/tex/context/base/phys-dim.mkiv @@ -168,6 +168,7 @@ % \definesymbol[units][times][\times] % \definesymbol[units][times][\cdots] +% \definesymbol[units][times][\invisibletimes] % \definesymbol[units][times][\ifmmode\cdot\else\kern.2\emwidth\cdot\kern.2\emwidth\fi] \unexpanded\def\digitstextbinop#1% assumes preceding diff --git a/tex/context/base/spac-lin.mkiv b/tex/context/base/spac-lin.mkiv index 20fec5d45..c4c6eb6d9 100644 --- a/tex/context/base/spac-lin.mkiv +++ b/tex/context/base/spac-lin.mkiv @@ -137,8 +137,19 @@ \unexpanded\def\emptylines {\dosingleempty\spac_lines_empty} +% \def\spac_lines_empty[#1]% +% {\endgraf +% \dorecurse{\iffirstargument#1\else3\fi}\crlf} + \def\spac_lines_empty[#1]% - {\endgraf\dorecurse{\iffirstargument#1\else3\fi}\crlf} + {\endgraf + \begingroup + %\forgetall % debatable + \ifhmode + \crlf % finish the current line + \fi + \dorecurse{\iffirstargument#1\else3\fi}{\strut\crlf}% + \endgroup} \ifdefined\startlines \else \expandafter\let\expandafter\startlines\csname\e!start\v!lines\endcsname diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex b1f0fb99b..d2d2e91e2 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 0d09a329b..29d54f626 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua index fbef19380..d9b7798e4 100644 --- a/tex/context/base/strc-ref.lua +++ b/tex/context/base/strc-ref.lua @@ -197,7 +197,7 @@ local function initializer() -- can we use a tobesaved as metatable for collecte nofreferred = #referred end --- no longer fone this way +-- no longer done this way -- references.resolvers = references.resolvers or { } -- local resolvers = references.resolvers @@ -983,6 +983,9 @@ local function loadexternalreferences(name,utilitydata) local pages = struc.pages.collected -- pagenumber data -- a bit weird one, as we don't have the externals in the collected for prefix, set in next, external do +if prefix == "" then + prefix = name -- this can clash! +end for reference, data in next, set do if trace_importing then report_importing("registering %a reference, kind %a, name %a, prefix %a, reference %a", @@ -1010,6 +1013,9 @@ local function loadexternalreferences(name,utilitydata) if kind and realpage then references.pagedata = pages[realpage] local prefix = references.prefix or "" +if prefix == "" then + prefix = name -- this can clash! +end local target = external[prefix] if not target then target = { } diff --git a/tex/context/base/typo-bld.lua b/tex/context/base/typo-bld.lua index a9767981c..6e75b4a08 100644 --- a/tex/context/base/typo-bld.lua +++ b/tex/context/base/typo-bld.lua @@ -46,6 +46,12 @@ local hpack_node = nodes.hpack local starttiming = statistics.starttiming local stoptiming = statistics.stoptiming +local normalize_global = true +local normalize_local = true + +directives.register("paragraphs.normalize.global", function(v) normalize_global = v end) -- adds 2% runtime +directives.register("paragraphs.normalize.local", function(v) normalize_local = v end) -- adds 2% runtime + storage.register("builders/paragraphs/constructors/names", names, "builders.paragraphs.constructors.names") storage.register("builders/paragraphs/constructors/numbers", numbers, "builders.paragraphs.constructors.numbers") @@ -187,7 +193,9 @@ function builders.vpack_filter(head,groupcode,size,packtype,maxdepth,direction) local done = false if head then starttiming(builders) - normalize(head,true) -- a bit weird place + if normalize_local then + normalize(head,true) -- a bit weird place + end if trace_vpacking then local before = nodes.count(head) head, done = vboxactions(head,groupcode,size,packtype,maxdepth,direction) @@ -235,7 +243,7 @@ function builders.buildpage_filter(groupcode) -- the next check saves 1% runtime on 1000 tufte pages local head = texlists.contrib_head local done = false - if build_par_codes[groupcode] then + if normalize_global and build_par_codes[groupcode] then -- also called in vbox .. we really need another callback for these four normalize(head) -- a bit weird place end diff --git a/tex/context/base/typo-lin.lua b/tex/context/base/typo-lin.lua index 536252960..6327f8f23 100644 --- a/tex/context/base/typo-lin.lua +++ b/tex/context/base/typo-lin.lua @@ -6,106 +6,233 @@ if not modules then modules = { } end modules ['typo-lin'] = { license = "see context related readme files" } --- can become typo-par or so - -local trace_anchors = false trackers.register("paragraphs.anchors", function(v) trace_anchors = v end) - -local nuts = nodes.nuts -local nodecodes = nodes.nodecodes -local gluecodes = nodes.gluecodes -local listcodes = nodes.listcodes -local whatcodes = nodes.whatsitcodes - -local hlist_code = nodecodes.hlist -local glue_code = nodecodes.glue -local whatsit_code = nodecodes.whatsit -local line_code = listcodes.line -local leftskip_code = gluecodes.leftskip -local rightskip_code = gluecodes.rightskip -local textdir_code = whatcodes.textdir -local localpar_code = whatcodes.localpar - -local tonut = nodes.tonut -local tonode = nodes.tonode - -local traverse_id = nuts.traverse_id -local insert_before = nuts.insert_before -local insert_after = nuts.insert_after -local findtail = nuts.tail -local remove_node = nuts.remove -local hpack_nodes = nuts.hpack - -local getsubtype = nuts.getsubtype -local getlist = nuts.getlist -local getid = nuts.getid -local getnext = nuts.getnext -local getfield = nuts.getfield -local setfield = nuts.setfield - -local setprop = nuts.setprop -local getprop = nuts.getprop - -local nodepool = nuts.pool -local new_glue = nodepool.glue -local new_kern = nodepool.kern -local new_leftskip = nodepool.leftskip -local new_rightskip = nodepool.rightskip -local new_hlist = nodepool.hlist -local new_vlist = nodepool.vlist -local new_rule = nodepool.rule - -local texgetcount = tex.getcount - -local paragraphs = { } -typesetters.paragraphs = paragraphs - --- also strip disc - +-- This is experimental code. The idea is to create an anchor point in a line but there are +-- some considerations: +-- +-- * if we normalize in order to have more easy access later on, we need to normalize all +-- lines and we cannot catch all without losing efficiency +-- +-- * if we normalize too soon, we might have issues with changed properties later on +-- +-- * if we normalize too late, we have no knowledge of the current hsize +-- +-- * if we always create an anchor we also create unwanted overhead if it is not used later +-- on (more nodes) +-- +-- The question is: do we mind of at the first access an anchor is created? As we cannot know +-- that now, I choose some middle ground but this might change. if we don't assume direct +-- access but only helpers, we can decide later. +-- +-- Because of right2left mess it makes sense to use helpers so that we only need to deal with +-- this mess once, in helpers. The more abstraction there the better. And so, after a week of +-- experimenting, yet another abstraction was introduced. +-- +-- The danger of adding the anchor later is that we adapt the head and so the caller needs to +-- check that ... real messy. On the other hand, we soldom traverse the line. And other +-- mechanisms can push stuff in front too. Actually that alone can mess up analysis when we +-- delay too much. So in the end we need to accept the slow down. +-- -- We only need to normalize the left side because when we mess around -- we keep the page stream order (and adding content to the right of the -- line is a no-go for tagged etc. For the same reason we don't use two -- left anchors (each side fo leftskip) because there can be stretch. But, -- maybe there are good reasons for having just that anchor (mostly for -- educational purposes I guess.) - +-- -- At this stage the localpar node is no longer of any use so we remove -- it (each line has the direction attached). We might at some point also -- strip the disc nodes as they no longer serve a purpose but that can -- better be a helper. Anchoring left has advantage of keeping page stream. +-- +-- This looks a bit messy but we want to keep the box as it is so \showboxes still +-- visualizes as expected. Normally left and rightskips end up in the line while +-- hangindents become shifts and hsize corrections. We could normalize this to +-- a line with -- indent : hlist type 3 -- hangindent : shift and width --- new_glue(0,65536,65536,2,2) -- hss (or skip -width etc) +local type = type --- -- rightskip checking --- --- local tail = findtail(head) --- local rightskip = nil --- local right = new_hlist() --- local id = getid(tail) --- if id == glue_code then --- local subtype = getsubtype(tail) --- if subtype == rightskip_code then --- rightskip = tail --- end --- end --- if not rightskip then --- print("inserting rightskip") --- rightskip = new_rightskip() --- insert_after(head,tail,rightskip) --- tail = rightskip --- end --- insert_after(head,tail,right) --- --- tail = tail, --- right = { --- pack = right, --- head = nil, --- tail = nil, --- } +local trace_anchors = false trackers.register("paragraphs.anchors", function(v) trace_anchors = v end) + +local report = logs.reporter("anchors") + +local nuts = nodes.nuts +local nodecodes = nodes.nodecodes +local gluecodes = nodes.gluecodes +local listcodes = nodes.listcodes +local whatcodes = nodes.whatsitcodes + +local hlist_code = nodecodes.hlist +local glue_code = nodecodes.glue +local kern_code = nodecodes.kern +local whatsit_code = nodecodes.whatsit +local line_code = listcodes.line +local userskip_code = gluecodes.userskip +local leftskip_code = gluecodes.leftskip +local rightskip_code = gluecodes.rightskip +local parfillskip_code = gluecodes.parfillskip +local textdir_code = whatcodes.textdir +local localpar_code = whatcodes.localpar + +local tonut = nodes.tonut +local tonode = nodes.tonode + +local traverse_id = nuts.traverse_id +local insert_before = nuts.insert_before +local insert_after = nuts.insert_after +local findtail = nuts.tail +local remove_node = nuts.remove +local hpack_nodes = nuts.hpack +local copy_list = nuts.copy_list + +local getsubtype = nuts.getsubtype +local getlist = nuts.getlist +local getid = nuts.getid +local getnext = nuts.getnext +local getprev = nuts.getprev +local getfield = nuts.getfield +local setfield = nuts.setfield --- todo: see if we can hook into box in buildpagefilter .. saves traverse +local setprop = nuts.setprop +local getprop = nuts.getprop + +local nodepool = nuts.pool +local new_glue = nodepool.glue +local new_kern = nodepool.kern +local new_leftskip = nodepool.leftskip +local new_rightskip = nodepool.rightskip +local new_hlist = nodepool.hlist +local new_vlist = nodepool.vlist +local new_rule = nodepool.rule +local new_latelua = nodepool.latelua + +local texgetcount = tex.getcount +local setmetatableindex = table.setmetatableindex +local formatters = string.formatters + +local jobpositions = job.positions +local getposition = jobpositions.get +local getreserved = jobpositions.getreserved + +local paragraphs = { } +typesetters.paragraphs = paragraphs + +local addskips = false +local noflines = 0 + +-- This is the third version, a mix between immediate (prestice lines) and delayed +-- as we don't want anchors that are not used. + +local function finalize(prop,key) -- delayed calculations + local line = prop.line + local hsize = prop.hsize + local width = prop.width + local shift = getfield(line,"shift") -- dangerous as it can be vertical as well + local reverse = getfield(line,"dir") == "TRT" or false + local pack = new_hlist() + local head = getlist(line) + local delta = 0 + if reverse then + delta = - shift + (hsize - width) + else + delta = shift + end + -- if reverse then delta = - delta end + -- head = insert_before(head,head,nodepool.textdir("-TLT")) + head = insert_before(head,head,new_kern(delta)) + head = insert_before(head,head,pack) + head = insert_before(head,head,new_kern(-delta)) + -- head = insert_before(head,head,nodepool.textdir("TLT")) + setfield(line,"list",head) + local where = { + pack = pack, + head = nil, + tail = nil, + } + prop.anchor = where + prop.reverse = reverse + prop.shift = shift + setmetatableindex(prop,nil) + return prop[key] +end + +local function normalize(line,islocal) -- assumes prestine lines, nothing pre/appended + local oldhead = getlist(line) + local head = oldhead + local leftskip = nil + local rightskip = nil + local width = getfield(line,"width") + local hsize = islocal and width or tex.hsize + local lskip = 0 + local rskip = 0 + local pskip = 0 + local current = head + local id = getid(current) + if id == glue_code then + local subtype = getsubtype(head) + if subtype == leftskip_code then + local spec = getfield(head,"spec") + leftskip = head + lskip = getfield(spec,"width") + end + current = getnext(head) + id = getid(current) + end + if id == whatsit_code then + if getsubtype(head) == localpar_code then + head = remove_node(head,head,true) + end + end + local tail = findtail(head) + local current = tail + local id = getid(current) + if id == glue_code then + if getsubtype(current) == rightskip_code then + local spec = getfield(current,"spec") + rightskip = tail + rskip = getfield(spec,"width") + current = getprev(tail) + id = getid(current) + end + if id == glue_code then + if getsubtype(current) == parfillskip_code then + pskip = nuts.effectiveglue(current,line) + end + end + end + if addskips then + if rightskip and not leftskip then + leftskip = new_leftskip(lskip) + head = insert_before(head,head,leftskip) + end + if leftskip and not rightskip then + rightskip = new_rightskip(0) + head, tail = insert_after(head,tail,rightskip) + end + end + if head ~= oldhead then + setfield(line,"list",head) + end + noflines = noflines + 1 + local prop = { + width = width, + hsize = hsize, + leftskip = lskip, + rightskip = rskip, + parfillskip = pskip, + line = line, + number = noflines, + } + setmetatableindex(prop,finalize) + setprop(line,"line",prop) + return prop +end + +function paragraphs.checkline(n) + return getprop(n,"line") or normalize(n,true) +end function paragraphs.normalize(head,islocal) if texgetcount("pagebodymode") > 0 then @@ -114,79 +241,236 @@ function paragraphs.normalize(head,islocal) end for line in traverse_id(hlist_code,tonut(head)) do if getsubtype(line) == line_code and not getprop(line,"line") then - local head = getlist(line) - local leftskip = nil - local anchor = new_hlist() - local id = getid(head) - local shift = getfield(line,"shift") - local width = getfield(line,"width") - local hsize = islocal and width or tex.hsize - local reverse = getfield(line,"dir") == "TRT" or false - if id == glue_code then - local subtype = getsubtype(head) - if subtype == leftskip_code then - leftskip = head - end - local next = getnext(head) - if next and getsubtype(next) == localpar_code then - head = remove_node(head,next,true) - end - elseif id == whatsit_code then - if getsubtype(head) == localpar_code then - head = remove_node(head,head,true) - end - end - head = insert_before(head,head,anchor) - shift = shift + width - hsize - if reverse then - head = insert_before(head,head,new_kern(shift)) - insert_after(head,anchor,new_kern(-shift)) - else - head = insert_before(head,head,new_kern(-shift)) - end - if not leftskip then - head = insert_before(head,head,new_leftskip(0)) - end -setfield(anchor,"attr",getfield(line,"attr")) --- print(nodes.idstostring(head)) --- print("NORMALIZE",line) - setfield(line,"list",head) - setprop(line,"line",{ - reverse = reverse, - width = width, - hsize = hsize, - shift = shift, - head = head, - anchor = { - pack = anchor, - head = nil, - tail = nil, - }, - }) + normalize(line,islocal) end end return head, true end -function paragraphs.addtoline(n,list) +-- print(nodes.idstostring(head)) + +-- We do only basic positioning and leave compensation for directions and distances +-- to the caller as that one knows the circumstances better. + +-- todo: only in mvl or explicitly, e.g. framed or so, not in all lines + +function paragraphs.addtoline(n,list,option) local line = getprop(n,"line") + if not line then + line = normalize(n,true) + end if line then if trace_anchors and not line.traced then line.traced = true local rule = new_rule(2*65536,2*65536,1*65536) local list = insert_before(rule,rule,new_kern(-1*65536)) paragraphs.addtoline(n,list) + local rule = new_rule(2*65536,6*65536,-3*65536) + local list = insert_before(rule,rule,new_kern(-1*65536)) + paragraphs.addtoline(n,list,"internal") + else + line.traced = true + end + local list = tonut(list) + local where = line.anchor + local tail = where.tail + local head = where.head + local blob = new_hlist(list) + local delta = 0 + if option == "internal" then + if line.reverse then + delta = line.shift - line.leftskip - (line.hsize - line.width) + else + delta = line.shift + line.leftskip + end end - local list = tonut(list) - local what = line.anchor - local tail = what.tail - local blob = new_hlist(list) + -- always kerns, also when 0 so that we can adapt but we can optimize if needed + -- by keeping a hash as long as we use the shiftinline helper .. no need to + -- optimize now .. we can also decide to put each blob in a hlist + local kern = new_kern(delta) if tail then - insert_after(what.head,what.tail,blob) + head, tail = insert_after(head,tail,kern) else - setfield(what.pack,"list",blob) - what.head = blob + head, tail = kern, kern + setfield(where.pack,"list",head) + end + head, tail = insert_after(head,tail,blob) + local kern = new_kern(-delta) + head, tail = insert_after(head,tail,kern) + -- + where.head = head + where.tail = tail + return line, blob + else + -- report("unknown anchor") + end +end + +local function addanchortoline(n,anchor) + local line = type(n) ~= "table" and getprop(n,"line") or n + if not line then + line = normalize(n,true) + end + if line then + local anchor = tonut(anchor) + local where = line.anchor + local head = where.head + if trace_anchors then + local rule1 = new_rule(65536/2,4*65536,4*65536) + local rule2 = new_rule(8*65536,65536/4,65536/4) + local kern1 = new_kern(-65536/4) + local kern2 = new_kern(-65536/4-4*65536) + local list = new_hlist(nuts.link { anchor, kern1, rule1, kern2, rule2 }) + setfield(list,"width",0) + insert_before(head,head,list) + if not where.tail then + where.tail = list + + end + setfield(where.pack,"list",list) + where.head = list + else + insert_before(head,head,anchor) + if not where.tail then + where.tail = anchor + end + setfield(where.pack,"list",anchor) + where.head = anchor + end + return line, anchor + end +end + +paragraphs.addanchortoline = addanchortoline + +function paragraphs.moveinline(n,blob,dx,dy) + if not blob then + return + end + if not dx then + dx = 0 + end + if not dy then + dy = 0 + end + if dx ~= 0 or dy ~= 0 then + local line = type(n) ~= "table" and getprop(n,"line") or n + if line then + if dx ~= 0 then + local prev = getprev(blob) + local next = getnext(blob) + if prev and getid(prev) == kern_code then + setfield(prev,"kern",getfield(prev,"kern") + dx) + end + if next and getid(next) == kern_code then + setfield(next,"kern",getfield(next,"kern") - dx) + end + end + if dy ~= 0 then + if getid(blob) == hlist_code then + setfield(blob,"shift",getfield(blob,"shift") + dy) + end + end + else +-- report("no line") + end + end +end + +local f_anchor = formatters["_plib_.set('md:h',%i,{x=true,c=true})"] +local s_anchor = 'md:h' + +local function setanchor(h_anchor) + return new_latelua(f_anchor(h_anchor)) +end + +-- local t_anchor = { x = true, c = true } +-- +-- local function setanchor(h_anchor) +-- return lateluafunction(function() setposition("md:h",h_anchor,t_anchor) end) +-- end + +function paragraphs.calculatedelta(n,width,delta,atleft,islocal,followshape,area) + local line = type(n) ~= "table" and getprop(n,"line") or n + if not line then + line = normalize(n,true) + end + local hmove = 0 + if line then + local reverse = line.reverse + -- basic hsize based anchoring + if atleft then + if reverse then + -- delta = delta + else + delta = - delta - width + end + else + if reverse then + delta = - delta - width - line.hsize + else + delta = delta + line.hsize + end + end + if islocal then + -- relative to hsize with leftskip / rightskip compensation + if atleft then + if reverse then + delta = delta - line.leftskip + else + delta = delta + line.leftskip + end + else + if reverse then + delta = delta + line.rightskip + else + delta = delta - line.rightskip + end + end + if followshape then + -- shape compensation + if atleft then + if reverse then + delta = delta + line.shift - line.hsize + line.width + else + delta = delta + line.shift + end + else + if reverse then + delta = delta + line.shift + line.parfillskip + else + delta = delta + line.shift - line.hsize + line.width - line.parfillskip + end + end + end + end + if area then + local number = line.number + if not line.hanchor then + addanchortoline(line,setanchor(number)) + line.hanchor = true + end + local blob = getposition(s_anchor,number) + if blob then + local reference = getreserved(area,blob.c) + if reference then + hmove = (reference.x or 0) - (blob.x or 0) + if atleft then + if reverse then + hmove = hmove + (reference.w or 0) + else + -- hmove = hmove + end + else + if reverse then + hmove = hmove + line.hsize + else + hmove = hmove + (reference.w or 0) - line.hsize + end + end + end + end end - what.tail = blob end + return delta, hmove end diff --git a/tex/context/base/typo-mar.lua b/tex/context/base/typo-mar.lua index 832d29279..bb8452ac6 100644 --- a/tex/context/base/typo-mar.lua +++ b/tex/context/base/typo-mar.lua @@ -78,6 +78,7 @@ local insert, remove = table.insert, table.remove local setmetatable, next = setmetatable, next local formatters = string.formatters local toboolean = toboolean +local settings_to_hash = utilities.parsers.settings_to_hash local attributes, nodes, node, variables = attributes, nodes, node, variables @@ -115,8 +116,10 @@ local v_yes = variables.yes local v_continue = variables.continue local v_first = variables.first local v_text = variables.text +local v_paragraph = variables.paragraph local v_column = variables.column local v_line = variables.line +local v_hanging = variables.hanging local nuts = nodes.nuts local nodepool = nuts.pool @@ -157,8 +160,6 @@ local whatsit_code = nodecodes.whatsit local line_code = listcodes.line local cell_code = listcodes.cell local alignment_code = listcodes.alignment -local leftskip_code = gluecodes.leftskip -local rightskip_code = gluecodes.rightskip local userdefined_code = whatsitcodes.userdefined local dir_code = whatsitcodes.dir @@ -179,7 +180,11 @@ local texget = tex.get local isleftpage = layouts.status.isleftpage local registertogether = builders.paragraphs.registertogether -- tonode -local addtoline = typesetters.paragraphs.addtoline +local paragraphs = typesetters.paragraphs +local addtoline = paragraphs.addtoline +local addanchortoline = paragraphs.addanchortoline +local moveinline = paragraphs.moveinline +local calculatedelta = paragraphs.calculatedelta local a_margindata = attributes.private("margindata") local a_specialcontent = attributes.private("specialcontent") @@ -246,6 +251,7 @@ local defaults = { inline = false, leftskip = 0, rightskip = 0, + option = { } } } @@ -269,7 +275,13 @@ setattr(content,a_specialcontent,1) -- todo: a property local location = t.location local category = t.category local inline = t.inline - local scope = t.scope or v_global + local scope = t.scope + local name = t.name + local option = t.option + if option then + option = settings_to_hash(option) + t.option = option + end if not content then report_margindata("ignoring empty margin data %a",location or "unknown") return @@ -297,9 +309,8 @@ setattr(content,a_specialcontent,1) -- todo: a property elseif enableglobal and scope == v_global then enableglobal() end - nofsaved = nofsaved + 1 + nofsaved = nofsaved + 1 nofstored = nofstored + 1 - local name = t.name if trace_marginstack then showstore(store,"before",location) end @@ -326,18 +337,20 @@ setattr(content,a_specialcontent,1) -- todo: a property end end if t.number then + local leftmargindistance = texgetdimen("naturalleftmargindistance") + local rightmargindistance = texgetdimen("naturalrightmargindistance") + local strutbox = getbox("strutbox") -- better make a new table and make t entry in t t.box = copy_node_list(content) t.n = nofsaved -- used later (we will clean up this natural mess later) -- nice is to make a special status table mechanism - local leftmargindistance = texgetdimen("naturalleftmargindistance") - local rightmargindistance = texgetdimen("naturalrightmargindistance") - local strutbox = getbox("strutbox") t.strutdepth = getfield(strutbox,"depth") t.strutheight = getfield(strutbox,"height") + -- beware: can be different from the applied one t.leftskip = getfield(texget("leftskip"),"width") -- we're not in forgetall t.rightskip = getfield(texget("rightskip"),"width") -- we're not in forgetall + -- t.leftmargindistance = leftmargindistance -- todo:layoutstatus table t.rightmargindistance = rightmargindistance t.leftedgedistance = texgetdimen("naturalleftedgedistance") @@ -375,11 +388,12 @@ end local status, nofstatus = { }, 0 -local f_anchor = formatters["_plib_.set('md:h',%i,{x=true,c=true})"] - -local function setanchor(h_anchor) - return new_latelua(f_anchor(h_anchor)) -end +-- local f_anchor = formatters["_plib_.set('md:h',%i,{x=true,c=true})"] +-- local s_anchor = 'md:h' +-- +-- local function setanchor(h_anchor) +-- return new_latelua(f_anchor(h_anchor)) +-- end -- local t_anchor = { x = true, c = true } -- @@ -395,13 +409,25 @@ local function realign(current,candidate) local hsize = candidate.hsize local width = candidate.width local align = candidate.align + local inline = candidate.inline + local anchor = candidate.anchor + local hook = candidate.hook + local scope = candidate.scope + local option = candidate.option + local reverse = hook.reverse + local atleft = true + local hmove = 0 + local delta = 0 -- local realpageno = candidate.realpageno local leftpage = isleftpage(false,true) - local delta = 0 local leftdelta = 0 local rightdelta = 0 local leftdistance = distance local rightdistance = distance + -- + if not anchor or anchor == "" then + anchor = v_text + end if margin == v_normal then -- elseif margin == v_local then @@ -417,73 +443,48 @@ local function realign(current,candidate) if leftpage then leftdistance, rightdistance = rightdistance, leftdistance end - - if location == v_left then - delta = hoffset + width + leftdistance + leftdelta - elseif location == v_right then - delta = -hoffset - hsize - rightdistance + rightdelta + if location == v_right then + atleft = false elseif location == v_inner then if leftpage then - delta = -hoffset - hsize - rightdistance + rightdelta - else - delta = hoffset + width + leftdistance + leftdelta + atleft = false end elseif location == v_outer then - if leftpage then - delta = hoffset + width + leftdistance + leftdelta - else - delta = -hoffset - hsize - rightdistance + rightdelta + if not leftpage then + atleft = false end end - -- we assume that list is a hbox, otherwise we had to take the whole current - -- in order to get it right - - setfield(current,"width",0) - local anchornode, move_x + local islocal = scope == v_local + local area = (not islocal or option[v_text]) and anchor or nil - -- this mess is needed for alignments (combinations) so we use that - -- oportunity to add arbitrary anchoring - - -- always increment anchor is nicer for multipass when we add new .. - - local inline = candidate.inline - local anchor = candidate.anchor - if not anchor or anchor == "" then - anchor = v_text - end - if inline or anchor ~= v_text or candidate.psubtype == alignment_code then - -- the alignment_code check catches margintexts before a tabulate - h_anchors = h_anchors + 1 - anchornode = setanchor(h_anchors) - local blob = getposition('md:h',h_anchors) - if blob then - local reference = getreserved(anchor,blob.c) - if reference then - if location == v_left then - move_x = (reference.x or 0) - (blob.x or 0) - elseif location == v_right then - move_x = (reference.x or 0) - (blob.x or 0) + (reference.w or 0) - hsize - else - -- not yet done - end - end - end + if atleft then + delta = hoffset + leftdelta + leftdistance + else + delta = hoffset + rightdelta + rightdistance end - if move_x then - delta = delta - move_x + local delta, hmove = calculatedelta ( + hook, -- the line + width, -- width of object + delta, -- offset + atleft, + islocal, -- islocal + option[v_paragraph], -- followshape + area -- relative to area + ) + + if hmove ~= 0 then + delta = delta + hmove if trace_margindata then - report_margindata("realigned %a, location %a, margin %a, move %p",candidate.n,location,margin,move_x) + report_margindata("realigned %a, location %a, margin %a, move %p",candidate.n,location,margin,hmove) end else if trace_margindata then report_margindata("realigned %a, location %a, margin %a",candidate.n,location,margin) end end - local list = hpack_nodes(linked_nodes(anchornode,new_kern(-delta),getlist(current),new_kern(delta))) - setfield(current,"list",list) - setfield(current,"width",0) + moveinline(hook,candidate.node,delta) end local function realigned(current,a) @@ -524,6 +525,7 @@ end margins.ha = ha local f_anchor = formatters["typesetters.margins.ha(%s)"] + local function setanchor(v_anchor) return new_latelua(f_anchor(v_anchor)) end @@ -588,11 +590,6 @@ local function inject(parent,head,candidate) -- if baseline == true then baseline = false - -- hbox vtop ---~ for h in traverse_id(hlist_code,box.list.list) do ---~ baseline = h.height ---~ break ---~ end else baseline = tonumber(baseline) if not baseline or baseline <= 0 then @@ -609,7 +606,7 @@ local function inject(parent,head,candidate) if firstonstack then offset = 0 else --- offset = offset + height + -- offset = offset + height end if stack == v_yes then offset = offset + candidate.dy -- always @@ -683,21 +680,9 @@ local function inject(parent,head,candidate) end setfield(box,"shift",shift) setfield(box,"width",0) - -- if not head then - -- head = box - -- elseif getid(head) == whatsit_code and getsubtype(head) == localpar_code then - -- -- experimental - -- if getfield(head,"dir") == "TRT" then - -- local list = hpack_nodes(linked_nodes(new_kern(candidate.hsize),getlist(box),new_kern(-candidate.hsize))) - -- setfield(box,"list",list) - -- end - -- insert_node_after(head,head,box) - -- else - -- setfield(head,"prev",box) - -- setfield(box,"next",head) - -- head = box - -- end - addtoline(parent,box) + -- + candidate.hook, candidate.node = addtoline(parent,box) + -- setattr(box,a_margindata,nofstatus) if trace_margindata then report_margindata("injected, location %a, shift %p",location,shift) @@ -716,7 +701,7 @@ local function inject(parent,head,candidate) if trace_margindata then report_margindata("status, offset %s",offset) end - return head, room, stack == v_continue + return getlist(parent), room, stack == v_continue end local function flushinline(parent,head) @@ -825,6 +810,7 @@ local function handler(scope,head,group) if (id == vlist_code or id == hlist_code) and not getattr(current,a_margindata) then local don, continue = flushed(scope,current) if don then + done = true setattr(current,a_margindata,0) -- signal to prevent duplicate processing if continue then markovershoot(current) @@ -832,11 +818,17 @@ local function handler(scope,head,group) if nofstored <= 0 then break end - done = true end end current = getnext(current) end + if trace_margindata then + if done then + report_margindata("flushing stage one, done, %s left",nofstored) + else + report_margindata("flushing stage one, nothing done, %s left",nofstored) + end + end -- if done then resetstacked() -- why doesn't done work ok here? -- end @@ -846,7 +838,14 @@ local function handler(scope,head,group) end end +local trialtypesetting = context.trialtypesetting + function margins.localhandler(head,group) -- sometimes group is "" which is weird + +-- if trialtypesetting() then +-- return head, false +-- end + local inhibit = conditionals.inhibitmargindata if inhibit then if trace_margingroup then @@ -864,6 +863,11 @@ function margins.localhandler(head,group) -- sometimes group is "" which is weir end function margins.globalhandler(head,group) -- check group + +-- if trialtypesetting() then +-- return head, false +-- end + local inhibit = conditionals.inhibitmargindata if inhibit or nofstored == 0 then if trace_margingroup then @@ -892,9 +896,9 @@ local function finalhandler(head) if nofdelayed > 0 then local current = head local done = false - while current do + while current and nofdelayed > 0 do local id = getid(current) - if id == hlist_code then + if id == hlist_code then -- only lines? local a = getattr(current,a_margindata) if not a or a == 0 then finalhandler(getlist(current)) @@ -987,6 +991,7 @@ interfaces.implement { -- { "leftskip", "dimen" }, -- { "rightskip", "dimen" }, { "align" }, + { "option" }, { "line", "integer" }, { "stack" }, } diff --git a/tex/context/base/typo-mar.mkiv b/tex/context/base/typo-mar.mkiv index 4ca935ce2..4afa11b71 100644 --- a/tex/context/base/typo-mar.mkiv +++ b/tex/context/base/typo-mar.mkiv @@ -13,6 +13,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% maybe dontleavehmode when scope is local + % todo: tags % todo: force inline with option (saves pos) % todo: margintitle (also less position then) @@ -120,6 +122,7 @@ \c!scope=\v!global, \c!width=, % \c!stack=, + % \c!option=, % \v!paragraph (follow shape) \c!line=0, \c!anchor=\v!text, \c!bottomspace=\strutdepth, % slack used for keeptogether @@ -190,6 +193,10 @@ \unexpanded\def\typo_margins_data_nop_indeed[#dataparameters][#textparameters]#content% {} +% todo: naturalhbox + +\let\margindatahbox\naturalhbox % \hbox + \unexpanded\def\typo_margins_data_yes_indeed[#dataparameters][#textparameters]#content% {\iffirstargument \setupcurrentmargindata[#dataparameters]% @@ -203,7 +210,7 @@ \edef\currentmargindatastrut{\margindataparameter\c!strut}% \dostarttaggedchained\t!margintext\currentmargindata\??margindata \ifcsname\currentmarginframedhash\s!parent\endcsname - \setbox\nextbox\hbox \currentmarginreference \bgroup + \setbox\nextbox\margindatahbox \currentmarginreference \bgroup \the\everymargindatacontent \usemargindatastyleandcolor\c!style\c!color \setupcurrentmarginframed[\c!location=\v!normal,#textparameters]% @@ -222,7 +229,7 @@ \else \edef\currentmargindatawidth{\margindataparameter\c!width}% \ifx\currentmargindatawidth\empty - \setbox\nextbox\hbox \currentmarginreference \bgroup + \setbox\nextbox\margindatahbox \currentmarginreference \bgroup \typo_margins_data_synchronize \the\everymargindatacontent \usemargindatastyleandcolor\c!style\c!color @@ -236,7 +243,7 @@ \egroup \let\currentmarginfirstheight\empty \else - \setbox\nextbox\hbox \currentmarginreference \bgroup + \setbox\nextbox\margindatahbox \currentmarginreference \bgroup \typo_margins_data_synchronize \dosetraggedcommand{\margindataparameter\c!align}% \vtop \bgroup @@ -266,6 +273,7 @@ category {\margindataparameter\c!category}% name {\margindataparameter\c!name}% scope {\margindataparameter\c!scope}% + option {\margindataparameter\c!option}% number \nextbox margin {\margindataparameter\c!margin}% local normal margin edge distance \dimexpr\margindataparameter\c!distance\relax diff --git a/tex/context/base/x-asciimath.lua b/tex/context/base/x-asciimath.lua index e1a4e15a1..e0a4a714b 100644 --- a/tex/context/base/x-asciimath.lua +++ b/tex/context/base/x-asciimath.lua @@ -707,8 +707,19 @@ local reserved = { [">"] = { true, ">" }, ["<"] = { true, "<" }, + -- extra: + + -- also, invisible times + + ["dd"] = { false, "{\\tf d}" }, + ["ee"] = { false, "{\\tf e}" }, + ["xxx"] = { true, utfchar(0x2063) }, -- invisible times + } +-- a..z A..Z : allemaal op italic alphabet +-- en dan default naar upright "upr a" + for k, v in next, characters.data do local name = v.mathname if name and not reserved[name] then diff --git a/tex/context/interface/keys-cs.xml b/tex/context/interface/keys-cs.xml index 5acf71e88..41cd41494 100644 --- a/tex/context/interface/keys-cs.xml +++ b/tex/context/interface/keys-cs.xml @@ -982,6 +982,7 @@ <cd:constant name='reset' value='reset'/> <cd:constant name='resetnumber' value='resetnumber'/> <cd:constant name='resolution' value='rozliseni'/> + <cd:constant name='reverse' value='reverse'/> <cd:constant name='right' value='vpravo'/> <cd:constant name='rightcolor' value='barvavpravo'/> <cd:constant name='rightcompoundhyphen' value='rightcompoundhyphen'/> diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 6c3bd5363..2b37b979d 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -982,6 +982,7 @@ <cd:constant name='reset' value='reset'/> <cd:constant name='resetnumber' value='resetnumber'/> <cd:constant name='resolution' value='aufloesung'/> + <cd:constant name='reverse' value='reverse'/> <cd:constant name='right' value='rechts'/> <cd:constant name='rightcolor' value='rechterfarbe'/> <cd:constant name='rightcompoundhyphen' value='rightcompoundhyphen'/> diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index fe3d583b8..2432f7f7e 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -982,6 +982,7 @@ <cd:constant name='reset' value='reset'/> <cd:constant name='resetnumber' value='resetnumber'/> <cd:constant name='resolution' value='resolution'/> + <cd:constant name='reverse' value='reverse'/> <cd:constant name='right' value='right'/> <cd:constant name='rightcolor' value='rightcolor'/> <cd:constant name='rightcompoundhyphen' value='rightcompoundhyphen'/> diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index dbcb8ba47..ab7f6dec9 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -982,6 +982,7 @@ <cd:constant name='reset' value='reset'/> <cd:constant name='resetnumber' value='raznumero'/> <cd:constant name='resolution' value='resolution'/> + <cd:constant name='reverse' value='inverse'/> <cd:constant name='right' value='droite'/> <cd:constant name='rightcolor' value='couleurdroite'/> <cd:constant name='rightcompoundhyphen' value='rightcompoundhyphen'/> diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index bb719007b..ce4430852 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -982,6 +982,7 @@ <cd:constant name='reset' value='reset'/> <cd:constant name='resetnumber' value='resetnumber'/> <cd:constant name='resolution' value='risoluzione'/> + <cd:constant name='reverse' value='invertito'/> <cd:constant name='right' value='destra'/> <cd:constant name='rightcolor' value='coloredestra'/> <cd:constant name='rightcompoundhyphen' value='rightcompoundhyphen'/> diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index 9a9a1db39..86781b59e 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -982,6 +982,7 @@ <cd:constant name='reset' value='reset'/> <cd:constant name='resetnumber' value='resetnummer'/> <cd:constant name='resolution' value='resolutie'/> + <cd:constant name='reverse' value='omgekeerd'/> <cd:constant name='right' value='rechts'/> <cd:constant name='rightcolor' value='rechterkleur'/> <cd:constant name='rightcompoundhyphen' value='rechterkoppelteken'/> diff --git a/tex/context/interface/keys-pe.xml b/tex/context/interface/keys-pe.xml index 0891b475b..f7ec4de40 100644 --- a/tex/context/interface/keys-pe.xml +++ b/tex/context/interface/keys-pe.xml @@ -982,6 +982,7 @@ <cd:constant name='reset' value='بازنشانی'/> <cd:constant name='resetnumber' value='بازنشانیشماره'/> <cd:constant name='resolution' value='کیفیت'/> + <cd:constant name='reverse' value='برعکس'/> <cd:constant name='right' value='راست'/> <cd:constant name='rightcolor' value='رنگراست'/> <cd:constant name='rightcompoundhyphen' value='rightcompoundhyphen'/> diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index a4c6d8b1c..0441dd9af 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -982,6 +982,7 @@ <cd:constant name='reset' value='reset'/> <cd:constant name='resetnumber' value='resetnumber'/> <cd:constant name='resolution' value='rezolutie'/> + <cd:constant name='reverse' value='reverse'/> <cd:constant name='right' value='dreapta'/> <cd:constant name='rightcolor' value='culoaredreapta'/> <cd:constant name='rightcompoundhyphen' value='rightcompoundhyphen'/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 7d3e981fe..75788d408 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 : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 09/04/15 11:00:13 +-- merge date : 09/09/15 21:23:41 do -- begin closure to overcome local limits and interference |