From 776071a1ec8278bcd8cbcf92cb1e5507bcac14d2 Mon Sep 17 00:00:00 2001 From: Marius Date: Wed, 15 Jun 2011 13:00:13 +0300 Subject: beta 2011.06.15 11:49 --- tex/context/base/back-exp.lua | 69 ++++++++++++--------- tex/context/base/back-exp.mkiv | 9 +-- tex/context/base/blob-ini.lua | 65 +++++++++++++++----- tex/context/base/blob-ini.mkiv | 18 +++++- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 6 +- tex/context/base/core-mis.mkiv | 91 ++++++++++++++-------------- tex/context/base/core-var.mkiv | 4 +- tex/context/base/m-units.mkiv | 11 ++++ tex/context/base/math-ali.mkiv | 4 +- tex/context/base/math-noa.lua | 54 +++++++++++------ tex/context/base/math-vfu.lua | 1 + tex/context/base/node-ini.mkiv | 1 - tex/context/base/node-ser.lua | 2 +- tex/context/base/node-typ.lua | 42 +++++++++---- tex/context/base/pack-box.mkiv | 2 +- tex/context/base/spac-ali.lua | 1 + tex/context/base/spac-ali.mkiv | 2 + tex/context/base/spac-chr.lua | 18 ++++-- tex/context/base/spac-ver.mkiv | 2 + tex/context/base/status-files.pdf | Bin 23623 -> 23613 bytes tex/context/base/status-lua.pdf | Bin 155784 -> 155954 bytes tex/context/base/strc-ren.mkiv | 2 +- tex/context/base/strc-syn.mkiv | 18 +++--- tex/context/base/strc-tag.lua | 3 +- tex/context/base/strc-tag.mkiv | 7 ++- tex/context/base/typo-mar.lua | 2 +- tex/context/base/x-set-11.mkiv | 3 +- tex/generic/context/luatex-basics-gen.lua | 2 +- tex/generic/context/luatex-fonts-merged.lua | 4 +- 32 files changed, 284 insertions(+), 165 deletions(-) (limited to 'tex') diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 01bf5dea4..47d6c0037 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -60,7 +60,6 @@ local utfvalues = string.utfvalues local trace_export = false trackers.register ("structures.export", function(v) trace_export = v end) local less_state = false directives.register("structures.export.lessstate", function(v) less_state = v end) -local page_breaks = false directives.register("structures.export.pagebreaks", function(v) page_breaks = v end) local show_comment = true directives.register("structures.export.comment", function(v) show_comment = v end) local report_export = logs.reporter("backend","export") @@ -290,7 +289,7 @@ function structurestags.setattributehash(fulltag,key,value) end properties.vspace = { export = "break", nature = "display" } -properties.pbreak = { export = "pagebreak", nature = "display" } +----------------- = { export = "pagebreak", nature = "display" } local function makebreaklist(list) nofbreaks = nofbreaks + 1 @@ -909,7 +908,7 @@ function checks.math(di) } -- can be option if needed: if mode == "inline" then - di.nature = "mixed" -- "inline" + di.nature = "mixed" -- else spacing problem (maybe inline) else di.nature = "display" end @@ -1246,7 +1245,7 @@ local function flushtree(result,data,nature,depth) linedone = false elseif not di.collapsed then -- ignore collapsed data (is appended, reconstructed par) local element = di.element - if element == "break" or element == "pagebreak" then + if element == "break" then -- or element == "pagebreak" emptytag(result,element,nature,depth) elseif element == "" or di.skip == "ignore" then -- skip @@ -1262,9 +1261,6 @@ local function flushtree(result,data,nature,depth) begintag(result,element,natu,depth,di,skip) flushtree(result,di.data,natu,depth) endtag(result,element,natu,depth,skip) - -- if pdone then - -- etag(result,"p","display",depth) - -- end if di.after then flushtree(result,di.after,nature,depth) end @@ -1273,25 +1269,41 @@ local function flushtree(result,data,nature,depth) end end -local function breaktree(tree) ---~ local data = tree.data ---~ local parnumber = tree.parnumber ---~ local nofdata = #data ---~ for i=1,nofdata do ---~ local di = data[i] ---~ if di and type(di) == "table" and not di.collapsed then ---~ local element = di.element ---~ if element == "break" or element == "pagebreak" or element == "" or di.skip == "ignore" then ---~ -- do nothing ---~ else ---~ local pn = di.parnumber ---~ if parnumber and pn and di.nature == "inline" and parnumber ~= pn then ---~ di.breaknode = true ---~ end ---~ breaktree(di) ---~ end ---~ end ---~ end +-- way too fragile + +local function breaktree(tree,parent,parentelement) -- also removes double breaks + local data = tree.data + if data then + local nofdata = #data + local prevelement + for i=1,nofdata do + local di = data[i] + if not di then + -- skip + elseif type(di) == "string" then + prevelement = nil + elseif not di.collapsed then + local element = di.element + if element == "break" then -- or element == "pagebreak" + if prevelement == "break" then + di.element = "" + end + prevelement = element + elseif element == "" or di.skip == "ignore" then + -- skip + else +--~ if element == "p" and di.nature ~= "display" then +--~ di = di.data +--~ data[i] = di +--~ breaktree(di,tree,element) +--~ else + prevelement = element + breaktree(di,tree,element) +--~ end + end + end + end + end end -- finalizers @@ -1683,6 +1695,8 @@ local function finishexport() end end +-- whatsit_code localpar_code + local function collectresults(head,list) local p for n in traverse_nodes(head) do @@ -1727,7 +1741,6 @@ local function collectresults(head,list) elseif last then local at = has_attribute(n,a_taggedpar) if at ~= currentparagraph then - -- inject break pushcontent(true) -- add break pushentry(currentnesting) currentattribute = last @@ -1868,7 +1881,6 @@ local function collectresults(head,list) end end end ---~ end elseif subtype == spaceskip_code or subtype == xspaceskip_code then if not somespace[currentcontent[nofcurrentcontent]] then if trace_export then @@ -1932,6 +1944,7 @@ local function collectresults(head,list) end end end + -- elseif id == whatsit_code and n.subtype == localpar_code then end p = n end diff --git a/tex/context/base/back-exp.mkiv b/tex/context/base/back-exp.mkiv index c15f4c96d..d6fb74a97 100644 --- a/tex/context/base/back-exp.mkiv +++ b/tex/context/base/back-exp.mkiv @@ -123,16 +123,9 @@ {\enabledirectives[backend.export.css={\backendparameter\c!css}]}% \to \everysetupbackend -%D The zero char signal is needed in order to make sure that paragraphs with only -%D elements get seen as new ones. This is a kludge but after a day of experimenting -%D I could not figure out a cleaner way. All kind of analysis afterwards interferes. -%D -%D Todo: play with a user node. - \appendtoks \doifsomething{\backendparameter\c!export} - {\appendtoks \char\zerocount \to \everypar - \setupstructure + {\setupstructure [\c!state=\v!start]% \enabledirectives [backend.export=\backendparameter\c!export]}% diff --git a/tex/context/base/blob-ini.lua b/tex/context/base/blob-ini.lua index 48cf4e393..b97485b1b 100644 --- a/tex/context/base/blob-ini.lua +++ b/tex/context/base/blob-ini.lua @@ -28,28 +28,19 @@ if not modules then modules = { } end modules ['blob-ini'] = { -- blob.paragraph -- blob.page -local type = type +local type, tostring = type, tostring local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns local report_blobs = logs.reporter("blobs") -local fontdata = fonts.hashes.identifiers +local t_tonodes = typesetters.tonodes +local t_hpack = typesetters.hpack -local nodepool = nodes.pool - -local new_glyph = nodepool.glyph -local new_glue = nodepool.glue - -local copy_node = node.copy -local copy_node_list = node.copy_list -local insert_node_after = node.insert_after local flush_node_list = node.flush_list local hpack_node_list = node.hpack local vpack_node_list = node.vpack local write_node = node.write -local current_font = font.current - blobs = blobs or { } local newline = lpegpatterns.newline @@ -57,7 +48,7 @@ local space = lpegpatterns.spacer local spacing = newline * space^0 local content = (space^1)/" " + (1-spacing) -local ctxtextcapture = lpeg.Ct ( ( +local ctxtextcapture = lpeg.Ct ( ( -- needs checking (see elsewhere) space^0 * ( newline^2 * space^0 * lpeg.Cc("") + newline * space^0 * lpeg.Cc(" ") @@ -71,6 +62,18 @@ function blobs.new() } end +function blobs.dispose(t) + local list = t.list + for i=1,#list do + local li = list[i] + local pack = li.pack + if pack then + flush_node_list(pack) + li.pack = nil + end + end +end + function blobs.append(t,str) -- will be link nodes.link local typ = type(str) local dummy = nil @@ -94,7 +97,7 @@ function blobs.append(t,str) -- will be link nodes.link noflist = noflist + 1 list[noflist] = l end - local head, tail = tonodes(str,nil,nil) + local head, tail = t_tonodes(str,nil,nil) if head then if l.head then l.tail.next = head @@ -129,13 +132,26 @@ end function blobs.write(t) local list = t.list for i=1,#list do - local pack = list[i].pack + local li = list[i] + local pack = li.pack if pack then write_node(pack) + flush_node_list(pack) + li.pack = nil end end end +function blobs.dimensions(t) + local list = t.list + local first = list and list[1] + if first then + local pack = first.pack + return pack.width, pack.height, pack.depth + else + return 0, 0, 0 + end +end -- blob.char -- blob.line: head, tail @@ -157,3 +173,22 @@ end --~ pack = false, --~ properties = { }, --~ end + +-- for the moment here: + +function commands.widthofstring(str) + local l = t_hpack(str) + context(number.todimen(l.width)) + flush_node_list(l) +end + +-- less efficient: +-- +-- function commands.widthof(str) +-- local b = blobs.new() +-- blobs.append(b,str) +-- blobs.pack(b) +-- local w = blobs.dimensions(b) +-- context(number.todimen(w)) +-- blobs.dispose(b) +-- end diff --git a/tex/context/base/blob-ini.mkiv b/tex/context/base/blob-ini.mkiv index eaaae844c..4fdb9e4b6 100644 --- a/tex/context/base/blob-ini.mkiv +++ b/tex/context/base/blob-ini.mkiv @@ -18,9 +18,25 @@ %D down the road (close to version 1.00 of \LUATEX). Typesetting in %D pure \LUA\ sometimes makes sense. +\registerctxluafile{node-typ}{1.001} % experimental \registerctxluafile{blob-ini}{1.001} -\endinput +%D For the moment here: + +\unprotect + +% this one takes simple (utf) strings + +\def\widthofstring#1{\ctxcommand{widthofstring(\!!bs#1\!!es)}} + +% this one takes anything that can be typeset + +\unexpanded\def\setwidthof#1\to#2% + {\bgroup + \setbox\scratchbox\hbox{#1}% + \expanded{\egroup\def\noexpand#2{\the\wd\scratchbox}}} + +\protect \endinput % \starttext % diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 845dd7d30..690d597db 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.06.13 23:08} +\newcontextversion{2011.06.15 11:49} %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/cont-new.mkiv b/tex/context/base/cont-new.mkiv index ffe6a39f9..5a21fec55 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{2011.06.13 23:08} +\newcontextversion{2011.06.15 11:49} %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/context.mkii b/tex/context/base/context.mkii index a04470313..cf8fd7b67 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.06.13 23:08} +\edef\contextversion{2011.06.15 11:49} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 653ee6c64..9f86a94fd 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.06.13 23:08} +\edef\contextversion{2011.06.15 11:49} %D For those who want to use this: @@ -295,8 +295,8 @@ \loadmkvifile{scrn-fld} \loadmkvifile{scrn-hlp} -\loadmarkfile{char-enc} -\loadmarkfile{font-ini} +\loadmarkfile{char-enc} % will move up +\loadmarkfile{font-ini} % will move up \loadmarkfile{font-unk} \loadmarkfile{font-tra} \loadmarkfile{font-uni} diff --git a/tex/context/base/core-mis.mkiv b/tex/context/base/core-mis.mkiv index 417ea4c3d..19e904e41 100644 --- a/tex/context/base/core-mis.mkiv +++ b/tex/context/base/core-mis.mkiv @@ -1975,45 +1975,21 @@ % We can completely do this in lua .. when 'I'm bored ... -% \def\dododorotatenextbox -% {\setbox\nextbox\vbox to \@@layerysiz -% {\vfill -% \hbox to \@@layerxsiz -% {\dostartrotation\@@rorotation -% \nextboxwd\zeropoint -% \nextboxht\zeropoint -% \flushnextbox -% \dostoprotation -% \hfill}% -% \kern\@@layerypos}% -% \setbox\nextbox\hbox -% {\kern\@@layerxpos -% \kern\@@layerxoff -% \lower\@@layeryoff\flushnextbox}} - -\def\dorotatenextbox#1#2% - {\hbox\bgroup - \edef\@@rorotation{#1}% - \ifx\@@rorotation\empty - \else - \ifx\@@rorotation\v!left - \doifoddpageelse{\edef\@@rorotation{90}}{\edef\@@rorotation{270}}% - \else\ifx\@@rorotation\v!right - \doifoddpageelse{\edef\@@rorotation{270}}{\edef\@@rorotation{90}}% - \else\ifx\@@rorotation\v!outer - \signalrightpage - \doifrightpageelse{\edef\@@rorotation{270}}{\edef\@@rorotation{90}}% - \else\ifx\@@rorotation\v!inner - \signalrightpage - \doifrightpageelse{\edef\@@rorotation{90}}{\edef\@@rorotation{270}}% - \else - \edef\@@rorotation{\realnumber{\@@rorotation}}% get rid of leading zeros and spaces - \fi\fi\fi\fi - \setbox\nextbox\vbox{\flushnextbox}% not really needed - \dodorotatenextbox\@@rorotation#2% - \fi - \boxcursor\flushnextbox - \egroup} +\def\dododorotatenextbox + {\setbox\nextbox\vbox to \@@layerysiz + {\vfill + \hbox to \@@layerxsiz + {\dostartrotation\@@rorotation + \nextboxwd\zeropoint + \nextboxht\zeropoint + \flushnextbox + \dostoprotation + \hfill}% + \kern\@@layerypos}% + \setbox\nextbox\hbox + {\kern\@@layerxpos + \kern\@@layerxoff + \lower\@@layeryoff\flushnextbox}} \def\dodorotatenextbox#1#2% quite some trial and error -) {\dontshowcomposition @@ -2136,12 +2112,39 @@ \nextboxdp\!!depthb \fi} +% \def\dorotatenextbox#1#2% +% {\doifsomething{#1} +% {\edef\@@rorotation{\realnumber{#1}}% get rid of leading zeros and spaces +% \setbox\nextbox\vbox{\flushnextbox}% not really needed +% \dodorotatenextbox\@@rorotation#2}% +% \hbox{\boxcursor\flushnextbox}} + +% \rotate[rotation=left]{\externalfigure[cow.pdf]} + \def\dorotatenextbox#1#2% - {\doifsomething{#1} - {\edef\@@rorotation{\realnumber{#1}}% get rid of leading zeros and spaces - \setbox\nextbox\vbox{\flushnextbox}% not really needed - \dodorotatenextbox\@@rorotation#2}% - \hbox{\boxcursor\flushnextbox}} + {\hbox\bgroup + \edef\@@rorotation{#1}% + \ifx\@@rorotation\empty + \else + \ifx\@@rorotation\v!left + \doifoddpageelse{\edef\@@rorotation{90}}{\edef\@@rorotation{270}}% + \else\ifx\@@rorotation\v!right + \doifoddpageelse{\edef\@@rorotation{270}}{\edef\@@rorotation{90}}% + \else\ifx\@@rorotation\v!inner + \signalrightpage + \doifrightpageelse{\edef\@@rorotation{270}}{\edef\@@rorotation{90}}% + \else\ifx\@@rorotation\v!outer + \signalrightpage + \doifrightpageelse{\edef\@@rorotation{90}}{\edef\@@rorotation{270}}% + \else + \edef\@@rorotation{\realnumber{\@@rorotation}}% get rid of leading zeros and spaces + \fi\fi\fi\fi + \setbox\nextbox\vbox{\flushnextbox}% not really needed + \dodorotatenextbox\@@rorotation#2% + \fi + \boxcursor\flushnextbox + \egroup} + \def\dodorotatebox#1% {angle} \hbox/\vbox/\vtop {\bgroup\hbox\bgroup % compatibility hack diff --git a/tex/context/base/core-var.mkiv b/tex/context/base/core-var.mkiv index 30ec91616..bcad4abba 100644 --- a/tex/context/base/core-var.mkiv +++ b/tex/context/base/core-var.mkiv @@ -86,8 +86,8 @@ \newtoks \everyendofpar %newtoks \everyparflush -\def\bpar{\the\everybeginofpar\ignorespaces} % may interfere with \everypar -\def\epar{\ifhmode\removeunwantedspaces\the\everyendofpar\fi} % test prevents problems with \bpar\epar +\def\bpar{\dostarttagged\t!paragraph\empty\the\everybeginofpar\ignorespaces} % may interfere with \everypar +\def\epar{\ifhmode\removeunwantedspaces\the\everyendofpar\fi\dostoptagged } % test prevents problems with \bpar\epar %D Lists: diff --git a/tex/context/base/m-units.mkiv b/tex/context/base/m-units.mkiv index 23aecaaa4..433963d62 100644 --- a/tex/context/base/m-units.mkiv +++ b/tex/context/base/m-units.mkiv @@ -68,6 +68,17 @@ \unprotect +\let\unit\undefined + +\definesynonyms + [\v!unit] + [\v!units] + [\unitmeaning] + +\setupsynonyms + [\v!unit] + [\c!synonymcommand=\dimension] + \startmodule[units] %D This runtime loadable module implements a way of defining diff --git a/tex/context/base/math-ali.mkiv b/tex/context/base/math-ali.mkiv index b00618785..5a80d340d 100644 --- a/tex/context/base/math-ali.mkiv +++ b/tex/context/base/math-ali.mkiv @@ -259,7 +259,7 @@ \setupmathalignment[\currentmathalignment][#1]% \fi \the\everymathalignment - \eqaligncolumn\zerocount + \eqaligncolumn\zerocount % LOCAL HERE? \processcommacommand [\mathalignmentparameter\c!align] {\advance\eqaligncolumn\plusone\doseteqaligncolumn}% takes argument @@ -787,7 +787,7 @@ \mathsurround\zeropoint \everycr\emptytoks \tabskip\zeropoint - \eqaligncolumn\zerocount % could be \scratchcounter + \eqaligncolumn\zerocount % could be \scratchcounter LOCAL HERE? \processcommacommand[\mathmatrixparameter\c!align]{\advance\eqaligncolumn\plusone\dosetmatrixcolumn}% \scratchcounter=\ifnum\eqaligncolumn>\zerocount \eqaligncolumn \else \plusone \fi \global\eqaligncolumn\plusone diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index 5c4bb6f19..36922b60a 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -102,9 +102,13 @@ local function process(start,what,n,parent) end local proc = what[id] if proc then - local done, newstart = proc(start,what,n,parent or start.prev) + -- report_processing("start processing") + local done, newstart = proc(start,what,n,parent) -- prev is bugged: or start.prev if newstart then start = newstart + -- report_processing("stop processing (new start)") + else + -- report_processing("stop processing") end elseif id == math_char or id == math_textchar or id == math_delim then break @@ -115,7 +119,8 @@ local function process(start,what,n,parent) noad = start.sup if noad then process(noad,what,n,start) end -- list noad = start.sub if noad then process(noad,what,n,start) end -- list elseif id == math_box or id == math_sub then - local noad = start.list if noad then process(noad,what,n,start) end -- list + -- local noad = start.list if noad then process(noad,what,n,start) end -- list + local noad = start.head if noad then process(noad,what,n,start) end -- list elseif id == math_fraction then local noad = start.num if noad then process(noad,what,n,start) end -- list noad = start.denom if noad then process(noad,what,n,start) end -- list @@ -147,7 +152,17 @@ local function process(start,what,n,parent) end end -noads.process = process +local function processnoads(head,actions,banner) + if trace_processing then + report_processing("start '%s'",banner) + process(head,actions) + report_processing("stop '%s'",banner) + else + process(head,actions) + end +end + +noads.process = processnoads -- character remapping @@ -241,7 +256,7 @@ processors.relocate[math_delim] = function(pointer) end function handlers.relocate(head,style,penalties) - process(head,processors.relocate) + processnoads(head,processors.relocate,"relocate") return true end @@ -275,7 +290,7 @@ processors.render[math_char] = function(pointer) end function handlers.render(head,style,penalties) - process(head,processors.render) + processnoads(head,processors.render,"render") return true end @@ -310,7 +325,7 @@ resize[math_fence] = function(pointer) end function handlers.resize(head,style,penalties) - process(head,resize) + processnoads(head,resize,"resize") return true end @@ -324,8 +339,9 @@ local chardata = characters.data -- only [nd,ll,ul][po][nd,ll,ul] -respace[math_noad] = function(pointer) - if pointer.subtype == noad_ord then +respace[math_char] = function(pointer,what,n,parent) -- not math_noad .. math_char ... and then parent + pointer = parent + if pointer and pointer.subtype == noad_ord then local a = has_attribute(pointer,mathpunctuation) if a and a > 0 then set_attribute(pointer,mathpunctuation,0) @@ -372,7 +388,7 @@ respace[math_noad] = function(pointer) end function handlers.respace(head,style,penalties) - process(head,respace) + processnoads(head,respace,"respace") return true end @@ -386,8 +402,9 @@ local collapse = { } processors.collapse = collapse local mathpairs = characters.mathpairs -collapse[math_noad] = function(pointer) - if pointer.subtype == noad_rel then +collapse[math_char] = function(pointer,what,n,parent) + pointer = parent + if pointer and pointer.subtype == noad_rel then local current_nucleus = pointer.nucleus if current_nucleus.id == math_char then local current_char = current_nucleus.char @@ -424,7 +441,7 @@ collapse[math_noad] = function(pointer) end function noads.handlers.collapse(head,style,penalties) - process(head,collapse) + processnoads(head,collapse,"collapse") return true end @@ -437,7 +454,8 @@ local subscripts = characters.subscripts local replaced = { } -local function replace(pointer) +local function replace(pointer,what,n,parent) + pointer = parent -- we're following the parent list (chars trigger this) local next = pointer.next local start_super, stop_super, start_sub, stop_sub local mode = "unset" @@ -510,15 +528,13 @@ local function replace(pointer) end stop_sub.next = nil end + -- we could return stop end - unscript[math_noad] = replace --- unscript[math_accent] = replace --- unscript[math_radical] = replace --- unscript[math_fraction] = replace +unscript[math_char] = replace -- not noads as we need to recurse function handlers.unscript(head,style,penalties) - process(head,unscript) + processnoads(head,unscript,"unscript") return true end @@ -605,7 +621,7 @@ alternate[math_char] = function(pointer) end function handlers.check(head,style,penalties) - process(head,alternate) + processnoads(head,alternate,"check") return true end diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua index 49bf00ffe..a5c9f68aa 100644 --- a/tex/context/base/math-vfu.lua +++ b/tex/context/base/math-vfu.lua @@ -340,6 +340,7 @@ function vfmath.addmissing(main,id,size) jointwo (main,characters,id,size,0x27FA,0x021D0,joinrelfactor,0x021D2) -- \Leftarrow\joinrel\Rightarrow jointhree(main,characters,id,size,0x27FB,0x02190,joinrelfactor,0x0002D,0,0xFE324) -- \leftarrow\joinrel\relbar\mapsfromchar jointhree(main,characters,id,size,0x27FC,0xFE321,0,0x0002D,joinrelfactor,0x02192) -- \mapstochar\relbar\joinrel\rightarrow + jointwo (main,characters,id,size,0x2254,0x03A,0,0x03D) -- := (≔) end local unique = 0 -- testcase: \startTEXpage \math{!\text{-}\text{-}\text{-}} \stopTEXpage diff --git a/tex/context/base/node-ini.mkiv b/tex/context/base/node-ini.mkiv index 9924a092a..f14672557 100644 --- a/tex/context/base/node-ini.mkiv +++ b/tex/context/base/node-ini.mkiv @@ -30,7 +30,6 @@ \registerctxluafile{node-ser}{1.001} \registerctxluafile{node-ext}{1.001} %registerctxluafile{node-inj}{1.001} % we might split it off -\registerctxluafile{node-typ}{1.001} % experimental \registerctxluafile{node-acc}{1.001} % experimental \newcount\shownodescounter diff --git a/tex/context/base/node-ser.lua b/tex/context/base/node-ser.lua index a460a0953..17d222633 100644 --- a/tex/context/base/node-ser.lua +++ b/tex/context/base/node-ser.lua @@ -94,7 +94,7 @@ end -- under construction: -local function totable(n,flat,verbose) +local function totable(n,flat,verbose) -- todo: no attributes -- todo: no local function local function to_table(n,flat,verbose) local f = nodefields(n) diff --git a/tex/context/base/node-typ.lua b/tex/context/base/node-typ.lua index 684fc94ba..5f8df2b44 100644 --- a/tex/context/base/node-typ.lua +++ b/tex/context/base/node-typ.lua @@ -6,28 +6,44 @@ if not modules then modules = { } end modules ['node-typ'] = { license = "see context related readme files" } --- this will be replaced by blob-ini cum suis so typesetters will go away +local utfvalues = string.utfvalues -local utfvalues = string.utfvalues +local currentfont = font.current +local fontparameters = fonts.hashes.parameters -local hpack = node.hpack -local vpack = node.vpack +local hpack = node.hpack +local vpack = node.vpack -local nodepool = nodes.pool +local nodepool = nodes.pool -local new_glyph = nodepool.glyph -local new_glue = nodepool.glue +local newglyph = nodepool.glyph +local newglue = nodepool.glue typesetters = typesetters or { } -local function tonodes(str,fontid,spacing) -- don't use this +local function tonodes(str,fontid,spacing) -- quick and dirty local head, prev = nil, nil - for s in utfvalues(str) do + if not fontid then + fontid = currentfont() + end + local fp = fontparameters[fontid] + local s, p, m + if spacing then + s, p, m = spacing, 0, 0 + else + s, p, m = fp.space, fp.space_stretch, fp,space_shrink + end + local spacedone = false + for c in utfvalues(str) do local next - if spacing and s == 32 then - next = newglue(spacing or 64*1024*10) + if c == 32 then + if not spacedone then + next = newglue(s,p,m) + spacedone = true + end else - next = newglyph(fontid or 1,s) + next = newglyph(fontid or 1,c) + spacedone = false end if not head then head = next @@ -43,7 +59,7 @@ end typesetters.tonodes = tonodes function typesetters.hpack(str,fontid,spacing) - return hpack(tonodes(str,fontid,spacing)) + return hpack(tonodes(str,fontid,spacing),"exactly") end function typesetters.vpack(str,fontid,spacing) diff --git a/tex/context/base/pack-box.mkiv b/tex/context/base/pack-box.mkiv index 5bd617b1b..b51a20448 100644 --- a/tex/context/base/pack-box.mkiv +++ b/tex/context/base/pack-box.mkiv @@ -63,7 +63,7 @@ {\ifcsname\??an#1\endcsname\@EA\nonoanchor\else\@EA\dodoanchor\fi[#1]} \def\nonoanchor[#1]% - {} + {\csname\??an#1\endcsname} \def\dodoanchor[#1]% {\dotripleempty\dododoanchor[#1]} diff --git a/tex/context/base/spac-ali.lua b/tex/context/base/spac-ali.lua index dfe8016ed..effd26fe4 100644 --- a/tex/context/base/spac-ali.lua +++ b/tex/context/base/spac-ali.lua @@ -40,6 +40,7 @@ local texcount = tex.count local isleftpage = layouts.status.isleftpage +typesetters = typesetters or { } local alignments = { } typesetters.alignments = alignments diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv index dacb3a314..2901ad127 100644 --- a/tex/context/base/spac-ali.mkiv +++ b/tex/context/base/spac-ali.mkiv @@ -613,6 +613,7 @@ \def\leftaligned {\doalignline \relax \hss } \def\midaligned {\doalignline \hss \hss } \def\rightaligned{\doalignline \hss \relax} +\def\maxaligned {\doalignline \relax \relax} \let\centeraligned\midaligned @@ -626,6 +627,7 @@ \letvalue{\s!do\v!line\v!flushleft }\rightaligned \letvalue{\s!do\v!line\v!flushright}\leftaligned \letvalue{\s!do\v!line\v!center }\midaligned +\letvalue{\s!do\v!line\v!max }\maxaligned \def\doalignedline#1{\resetrealignsignal\csname\s!do\v!line#1\endcsname} diff --git a/tex/context/base/spac-chr.lua b/tex/context/base/spac-chr.lua index 601b90645..9771ad2e8 100644 --- a/tex/context/base/spac-chr.lua +++ b/tex/context/base/spac-chr.lua @@ -6,11 +6,11 @@ if not modules then modules = { } end modules ['spac-chr'] = { license = "see context related readme files" } -local byte = string.byte +local byte, lower = string.byte, string.lower ------ trace_characters = false trackers.register("typesetters.characters", function(v) trace_characters = v end) ------ ------ report_characters = logs.reporter("typesetting","characters") +trace_characters = false trackers.register("typesetters.characters", function(v) trace_characters = v end) + +report_characters = logs.reporter("typesetting","characters") local nodes, node = nodes, node @@ -27,6 +27,8 @@ local new_glue = nodepool.glue local nodecodes = nodes.nodecodes local glyph_code = nodecodes.glyph +local chardata = characters.data + local typesetters = typesetters local characters = { } @@ -62,10 +64,10 @@ end local function inject_nobreak_space(unicode,head,current,space,spacestretch,spaceshrink) local attr = current.attr + head, current = insert_node_after(head,current,new_penalty(10000)) head, current = insert_node_after(head,current,new_glue(space,spacestretch,spaceshrink)) current.attr = attr set_attribute(current,a_character,unicode) - head, current = insert_node_after(head,current,new_penalty(10000)) return head, current end @@ -144,8 +146,12 @@ function characters.handler(head) while current do local next = current.next if current.id == glyph_code then - local method = methods[current.char] + local char = current.char + local method = methods[char] if method then + if trace_characters then + report_characters("replacing character U+%04X (%s)",char,lower(chardata[char].description)) + end head = method(head,current) head = remove_node(head,current,true) done = true diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index 8bb83bdc0..4602b2d7f 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -1307,6 +1307,8 @@ \definegridsnapping[\v!max] [\v!maxdepth,\v!maxheight,\v!strut] \definegridsnapping[\v!min] [\v!mindepth,\v!minheight,\v!strut] +\definegridsnapping[\v!middle] [\v!maxheight,\v!maxdepth] % used in placement + \newtoks\everysetupgridsnapping % this only happens at the setuplayout level \def\dosetupgridsnapping{\the\everysetupgridsnapping} % not used ! diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 732fb6c7c..950214b82 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 6cd2ece6f..f7c9125f0 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-ren.mkiv b/tex/context/base/strc-ren.mkiv index 462e47b08..f2f056033 100644 --- a/tex/context/base/strc-ren.mkiv +++ b/tex/context/base/strc-ren.mkiv @@ -100,7 +100,7 @@ \setupheadcomponentfont\c!numberstyle\c!numbercolor \placeheadmargintexts \ifcsname\??nh\currenthead\c!deepnumbercommand\endcsname - \expandafter\let\expandafter\deepstructurenumbercommand\csname\??nh\currenthead\c!deeptextcommand\endcsname + \expandafter\let\expandafter\deepstructurenumbercommand\csname\??nh\currenthead\c!deepnumbercommand\endcsname \fi \ifconditional\headisdisplay % \ifdisplaysectionhead % can be nilled with \setnostrut diff --git a/tex/context/base/strc-syn.mkiv b/tex/context/base/strc-syn.mkiv index 7d9ef17b4..1cf0f7a04 100644 --- a/tex/context/base/strc-syn.mkiv +++ b/tex/context/base/strc-syn.mkiv @@ -437,17 +437,15 @@ [\v!logos] % no [\logogram] -\definesynonyms - [\v!unit] - [\v!units] - [\unitmeaning] - +% As we now have \unit in the core, this now happens in m-units: +% +% \definesynonyms +% [\v!unit] +% [\v!units] +% [\unitmeaning] +% % \setupsynonyms % [\v!unit] -% [\c!textstyle=\dimension] - -\setupsynonyms - [\v!unit] - [\c!synonymcommand=\dimension] +% [\c!synonymcommand=\dimension] \protect \endinput diff --git a/tex/context/base/strc-tag.lua b/tex/context/base/strc-tag.lua index c44c758f3..544dceef9 100644 --- a/tex/context/base/strc-tag.lua +++ b/tex/context/base/strc-tag.lua @@ -48,6 +48,7 @@ local properties = allocate { division = { pdf = "Div", nature = "display" }, paragraph = { pdf = "P", nature = "mixed" }, + p = { pdf = "P", nature = "mixed" }, construct = { pdf = "Span", nature = "inline" }, section = { pdf = "Sect", nature = "display" }, @@ -131,7 +132,7 @@ local properties = allocate { margintextblock = { pdf = "Span", nature = "inline" }, margintext = { pdf = "Span", nature = "inline" }, - math = { pdf = "Div", nature = "display" }, + math = { pdf = "Div", nature = "inline" }, -- no display mn = { pdf = "Span", nature = "mixed" }, mi = { pdf = "Span", nature = "mixed" }, mo = { pdf = "Span", nature = "mixed" }, diff --git a/tex/context/base/strc-tag.mkiv b/tex/context/base/strc-tag.mkiv index 558541f62..51a1d7154 100644 --- a/tex/context/base/strc-tag.mkiv +++ b/tex/context/base/strc-tag.mkiv @@ -25,6 +25,7 @@ \def\t!division {division} % Div \def\t!paragraph {paragraph} % P +\def\t!p {p} % P \def\t!construct {construct} % Span \def\t!section {section} % Sect @@ -222,9 +223,13 @@ {\dostarttagged\t!paragraph\empty} \unexpanded\def\stopparagraph - {\dostoptagged + {% \removeunwantedspaces % yes or no + \dostoptagged \par} +\let\startpar\startparagraph +\let\stoppar \stopparagraph + \appendtoks \dostarttagged\t!document\empty \to \everystarttext diff --git a/tex/context/base/typo-mar.lua b/tex/context/base/typo-mar.lua index 3b7e0317e..9f28c4dbc 100644 --- a/tex/context/base/typo-mar.lua +++ b/tex/context/base/typo-mar.lua @@ -56,7 +56,7 @@ local copy_node_list = node.copy_list local slide_nodes = node.slide local hpack_nodes = node.hpack -- nodes.fasthpack not really faster here local traverse_id = node.traverse_id -local free_node_list = node.free_list +local free_node_list = node.flush_list local link_nodes = nodes.link diff --git a/tex/context/base/x-set-11.mkiv b/tex/context/base/x-set-11.mkiv index c4b5b3db2..5a14b5ebd 100644 --- a/tex/context/base/x-set-11.mkiv +++ b/tex/context/base/x-set-11.mkiv @@ -513,7 +513,8 @@ \bgroup \enablemode[setups-pass-two] \doglobal\newcounter\currentSETUPargument - \blank[\v!line] + %\blank[\v!line] % packed mode (we could do \startunpacked ...) + \godown[.75\lineheight] \switchtobodyfont[small] \ignorespaces\xmlfilter{#1}{/arguments/text()}\endgraf \egroup diff --git a/tex/generic/context/luatex-basics-gen.lua b/tex/generic/context/luatex-basics-gen.lua index 602601d5c..a0368c13a 100644 --- a/tex/generic/context/luatex-basics-gen.lua +++ b/tex/generic/context/luatex-basics-gen.lua @@ -221,6 +221,6 @@ end -- -local table.setmetatableindex(t,f) +function table.setmetatableindex(t,f) setmetatable(t,{ __index = f }) end diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 02177a09a..a33c517e0 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 06/13/11 23:08:53 +-- merge date : 06/15/11 11:49:24 do -- begin closure to overcome local limits and interference @@ -2715,7 +2715,7 @@ end -- -local table.setmetatableindex(t,f) +function table.setmetatableindex(t,f) setmetatable(t,{ __index = f }) end -- cgit v1.2.3