diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4107 -> 4111 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/font-otn.lua | 4 | ||||
-rw-r--r-- | tex/context/base/font-tra.mkiv | 1 | ||||
-rw-r--r-- | tex/context/base/l-unicode.lua | 322 | ||||
-rw-r--r-- | tex/context/base/math-fen.mkiv | 45 | ||||
-rw-r--r-- | tex/context/base/mult-low.lua | 9 | ||||
-rw-r--r-- | tex/context/base/node-inj.lua | 9 | ||||
-rw-r--r-- | tex/context/base/node-rul.lua | 2 | ||||
-rw-r--r-- | tex/context/base/pack-rul.mkiv | 7 | ||||
-rw-r--r-- | tex/context/base/page-lay.mkiv | 12 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24765 -> 24776 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.log | 2 | ||||
-rw-r--r-- | tex/context/base/trac-vis.lua | 26 | ||||
-rw-r--r-- | tex/context/base/x-mathml.mkiv | 88 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 22 |
17 files changed, 385 insertions, 168 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 21271c9b1..09003d7c1 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{2013.09.12 12:19} +\newcontextversion{2013.09.13 10:59} %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-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 6a3ae150a..b8d205086 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 64f75949b..70331891f 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.09.12 12:19} +\edef\contextversion{2013.09.13 10:59} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua index dbec53ca3..64323ddcf 100644 --- a/tex/context/base/font-otn.lua +++ b/tex/context/base/font-otn.lua @@ -796,7 +796,7 @@ function handlers.gpos_mark2mark(head,start,kind,lookupname,markanchors,sequence if al[anchor] then local ma = markanchors[anchor] if ma then - local dx, dy, bound = setmark(start,base,tfmdata.parameters.factor,rlmode,ba,ma) + local dx, dy, bound = setmark(start,base,tfmdata.parameters.factor,rlmode,ba,ma,true) if trace_marks then logprocess("%s, anchor %s, bound %s: anchoring mark %s to basemark %s => (%p,%p)", pref(kind,lookupname),anchor,bound,gref(markchar),gref(basechar),dx,dy) @@ -1438,7 +1438,7 @@ function chainprocs.gpos_mark2mark(head,start,stop,kind,chainname,currentcontext if al[anchor] then local ma = markanchors[anchor] if ma then - local dx, dy, bound = setmark(start,base,tfmdata.parameters.factor,rlmode,ba,ma) + local dx, dy, bound = setmark(start,base,tfmdata.parameters.factor,rlmode,ba,ma,true) if trace_marks then logprocess("%s, anchor %s, bound %s: anchoring mark %s to basemark %s => (%p,%p)", cref(kind,chainname,chainlookupname,lookupname),anchor,bound,gref(markchar),gref(basechar),dx,dy) diff --git a/tex/context/base/font-tra.mkiv b/tex/context/base/font-tra.mkiv index 1877c4904..45d8a7280 100644 --- a/tex/context/base/font-tra.mkiv +++ b/tex/context/base/font-tra.mkiv @@ -186,6 +186,7 @@ \forgetparindent \forgeteverypar \tt + \lefttoright \hbox to \hsize \bgroup \hbox to 6\emwidth{\bf font\hss}% \vtop \bgroup diff --git a/tex/context/base/l-unicode.lua b/tex/context/base/l-unicode.lua index 7c590330b..3ce5bd3a7 100644 --- a/tex/context/base/l-unicode.lua +++ b/tex/context/base/l-unicode.lua @@ -25,7 +25,7 @@ utf.values = utf.values or string.utfvalues -- string.bytepairs local type = type -local char, byte, format, sub = string.char, string.byte, string.format, string.sub +local char, byte, format, sub, gmatch = string.char, string.byte, string.format, string.sub, string.gmatch local concat = table.concat local P, C, R, Cs, Ct, Cmt, Cc, Carg, Cp = lpeg.P, lpeg.C, lpeg.R, lpeg.Cs, lpeg.Ct, lpeg.Cmt, lpeg.Cc, lpeg.Carg, lpeg.Cp local lpegmatch, patterns = lpeg.match, lpeg.patterns @@ -621,119 +621,273 @@ function utf.magic(f) -- not used return lpegmatch(p_utftype,str) end +local utf16_to_utf8_be, utf16_to_utf8_le +local utf32_to_utf8_be, utf32_to_utf8_le + local utf_16_be_linesplitter = patterns.utfbom_16_be^-1 * lpeg.tsplitat(patterns.utf_16_be_nl) local utf_16_le_linesplitter = patterns.utfbom_16_le^-1 * lpeg.tsplitat(patterns.utf_16_le_nl) -local function utf16_to_utf8_be(t) - if type(t) == "string" then - t = lpegmatch(utf_16_be_linesplitter,t) - end - local result = { } -- we reuse result - for i=1,#t do - local r, more = 0, 0 - for left, right in bytepairs(t[i]) do - if right then - local now = 256*left + right - if more > 0 then - now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 -- the 0x10000 smells wrong - more = 0 - r = r + 1 - result[r] = utfchar(now) - elseif now >= 0xD800 and now <= 0xDBFF then - more = now - else - r = r + 1 - result[r] = utfchar(now) +-- we have three possibilities: + +-- bytepairs: 0.048 +-- gmatch : 0.069 +-- lpeg : 0.089 (match time captures) + +if bytepairs then + + -- with a little bit more code we could include the linesplitter + + utf16_to_utf8_be = function(t) + if type(t) == "string" then + t = lpegmatch(utf_16_be_linesplitter,t) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in bytepairs(t[i]) do + if right then + local now = 256*left + right + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 -- the 0x10000 smells wrong + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end end end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t end - t[i] = concat(result,"",1,r) -- we reused tmp, hence t + return t end - return t -end -local function utf16_to_utf8_le(t) - if type(t) == "string" then - t = lpegmatch(utf_16_le_linesplitter,t) + utf16_to_utf8_le = function(t) + if type(t) == "string" then + t = lpegmatch(utf_16_le_linesplitter,t) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in bytepairs(t[i]) do + if right then + local now = 256*right + left + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 -- the 0x10000 smells wrong + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end + end + end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t + end + return t end - local result = { } -- we reuse result - for i=1,#t do - local r, more = 0, 0 - for left, right in bytepairs(t[i]) do - if right then - local now = 256*right + left - if more > 0 then - now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 -- the 0x10000 smells wrong - more = 0 - r = r + 1 - result[r] = utfchar(now) - elseif now >= 0xD800 and now <= 0xDBFF then - more = now + + utf32_to_utf8_be = function(t) + if type(t) == "string" then + t = lpegmatch(utflinesplitter,t) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, -1 + for a,b in bytepairs(t[i]) do + if a and b then + if more < 0 then + more = 256*256*256*a + 256*256*b + else + r = r + 1 + result[t] = utfchar(more + 256*a + b) + more = -1 + end else - r = r + 1 - result[r] = utfchar(now) + break end end + t[i] = concat(result,"",1,r) end - t[i] = concat(result,"",1,r) -- we reused tmp, hence t + return t end - return t -end -local function utf32_to_utf8_be(t) - if type(t) == "string" then - t = lpegmatch(utflinesplitter,t) - end - local result = { } -- we reuse result - for i=1,#t do - local r, more = 0, -1 - for a,b in bytepairs(t[i]) do - if a and b then - if more < 0 then - more = 256*256*256*a + 256*256*b + utf32_to_utf8_le = function(t) + if type(t) == "string" then + t = lpegmatch(utflinesplitter,t) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, -1 + for a,b in bytepairs(t[i]) do + if a and b then + if more < 0 then + more = 256*b + a + else + r = r + 1 + result[t] = utfchar(more + 256*256*256*b + 256*256*a) + more = -1 + end else - r = r + 1 - result[t] = utfchar(more + 256*a + b) - more = -1 + break end - else - break end + t[i] = concat(result,"",1,r) end - t[i] = concat(result,"",1,r) + return t end - return t -end -local function utf32_to_utf8_le(t) - if type(t) == "string" then - t = lpegmatch(utflinesplitter,t) +else + + utf16_to_utf8_be = function(t) + if type(t) == "string" then + t = lpegmatch(utf_16_be_linesplitter,t) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in gmatch(t[i],"(.)(.)") do + if left == "\000" then -- experiment + r = r + 1 + result[r] = utfchar(byte(right)) + elseif right then + local now = 256*byte(left) + byte(right) + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 -- the 0x10000 smells wrong + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end + end + end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t + end + return t end - local result = { } -- we reuse result - for i=1,#t do - local r, more = 0, -1 - for a,b in bytepairs(t[i]) do - if a and b then - if more < 0 then - more = 256*b + a - else + + utf16_to_utf8_le = function(t) + if type(t) == "string" then + t = lpegmatch(utf_16_le_linesplitter,t) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in gmatch(t[i],"(.)(.)") do + if right == "\000" then r = r + 1 - result[t] = utfchar(more + 256*256*256*b + 256*256*a) - more = -1 + result[r] = utfchar(byte(left)) + elseif right then + local now = 256*byte(right) + byte(left) + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 -- the 0x10000 smells wrong + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end end - else - break end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t end - t[i] = concat(result,"",1,r) + return t end - return t + + utf32_to_utf8_le = function() return { } end -- never used anyway + utf32_to_utf8_be = function() return { } end -- never used anyway + + -- the next one is slighty slower + + -- local result, lines, r, more = { }, { }, 0, 0 + -- + -- local simple = Cmt( + -- C(1) * C(1), function(str,p,left,right) + -- local now = 256*byte(left) + byte(right) + -- if more > 0 then + -- now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 -- the 0x10000 smells wrong + -- more = 0 + -- r = r + 1 + -- result[r] = utfchar(now) + -- elseif now >= 0xD800 and now <= 0xDBFF then + -- more = now + -- else + -- r = r + 1 + -- result[r] = utfchar(now) + -- end + -- return p + -- end + -- ) + -- + -- local complex = Cmt( + -- C(1) * C(1), function(str,p,left,right) + -- local now = 256*byte(left) + byte(right) + -- if more > 0 then + -- now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 -- the 0x10000 smells wrong + -- more = 0 + -- r = r + 1 + -- result[r] = utfchar(now) + -- elseif now >= 0xD800 and now <= 0xDBFF then + -- more = now + -- else + -- r = r + 1 + -- result[r] = utfchar(now) + -- end + -- return p + -- end + -- ) + -- + -- local lineend = Cmt ( + -- patterns.utf_16_be_nl, function(str,p) + -- lines[#lines+1] = concat(result,"",1,r) + -- r, more = 0, 0 + -- return p + -- end + -- ) + -- + -- local be_1 = patterns.utfbom_16_be^-1 * (simple + complex)^0 + -- local be_2 = patterns.utfbom_16_be^-1 * (lineend + simple + complex)^0 + -- + -- utf16_to_utf8_be = function(t) + -- if type(t) == "string" then + -- local s = t + -- lines, r, more = { }, 0, 0 + -- lpegmatch(be_2,s) + -- if r > 0 then + -- lines[#lines+1] = concat(result,"",1,r) + -- end + -- result = { } + -- return lines + -- else + -- for i=1,#t do + -- r, more = 0, 0 + -- lpegmatch(be_1,t[i]) + -- t[i] = concat(result,"",1,r) + -- end + -- result = { } + -- return t + -- end + -- end + end -utf.utf32_to_utf8_be = utf32_to_utf8_be -utf.utf32_to_utf8_le = utf32_to_utf8_le -utf.utf16_to_utf8_be = utf16_to_utf8_be utf.utf16_to_utf8_le = utf16_to_utf8_le +utf.utf16_to_utf8_be = utf16_to_utf8_be +utf.utf32_to_utf8_le = utf32_to_utf8_le +utf.utf32_to_utf8_be = utf32_to_utf8_be function utf.utf8_to_utf8(t) return type(t) == "string" and lpegmatch(utflinesplitter,t) or t diff --git a/tex/context/base/math-fen.mkiv b/tex/context/base/math-fen.mkiv index 00837a607..c1f1ac2ab 100644 --- a/tex/context/base/math-fen.mkiv +++ b/tex/context/base/math-fen.mkiv @@ -127,20 +127,22 @@ \definemathfence [brace] [\c!left="007B,\c!right="007D] \definemathfence [bar] [\c!left="007C,\c!right="007C] \definemathfence [doublebar] [\c!left="2016,\c!right="2016] -\definemathfence [angle] [\c!left="003C,\c!right="003E] +\definemathfence [angle] [\c!left="27E8,\c!right="27E9] +\definemathfence [doubleangle] [\c!left="27EA,\c!right="27EB] \definemathfence [solidus] [\c!left="2044,\c!right="2044] \definemathfence [nothing] %D A bonus: -\unexpanded\def\Lparent {\math_fenced_fenced_start{parenthesis}} \unexpanded\def\Rparent {\math_fenced_fenced_stop{parenthesis}} -\unexpanded\def\Lbracket {\math_fenced_fenced_start{bracket}} \unexpanded\def\Rbracket {\math_fenced_fenced_stop{bracket}} -\unexpanded\def\Lbrace {\math_fenced_fenced_start{brace}} \unexpanded\def\Rbrace {\math_fenced_fenced_stop{brace}} -\unexpanded\def\Langle {\math_fenced_fenced_start{angle}} \unexpanded\def\Rangle {\math_fenced_fenced_stop{angle}} -\unexpanded\def\Lbar {\math_fenced_fenced_start{bar}} \unexpanded\def\Rbar {\math_fenced_fenced_stop{bar}} -\unexpanded\def\Lsolidus {\math_fenced_fenced_start{solidus}} \unexpanded\def\Rsolidus {\math_fenced_fenced_stop{solidus}} -\unexpanded\def\Ldoublebar {\math_fenced_fenced_start{doublebar}} \unexpanded\def\Rdoublebar{\math_fenced_fenced_stop{doublebar}} -\unexpanded\def\Lnothing {\math_fenced_fenced_start{nothing}} \unexpanded\def\Rnothing {\math_fenced_fenced_stop{nothing}} +\unexpanded\def\Lparent {\math_fenced_fenced_start{parenthesis}} \unexpanded\def\Rparent {\math_fenced_fenced_stop{parenthesis}} +\unexpanded\def\Lbracket {\math_fenced_fenced_start{bracket}} \unexpanded\def\Rbracket {\math_fenced_fenced_stop{bracket}} +\unexpanded\def\Lbrace {\math_fenced_fenced_start{brace}} \unexpanded\def\Rbrace {\math_fenced_fenced_stop{brace}} +\unexpanded\def\Langle {\math_fenced_fenced_start{angle}} \unexpanded\def\Rangle {\math_fenced_fenced_stop{angle}} +\unexpanded\def\Ldoubleangle{\math_fenced_fenced_start{doubleangle}} \unexpanded\def\Rdoubleangle{\math_fenced_fenced_stop{doubleangle}} +\unexpanded\def\Lbar {\math_fenced_fenced_start{bar}} \unexpanded\def\Rbar {\math_fenced_fenced_stop{bar}} +\unexpanded\def\Lsolidus {\math_fenced_fenced_start{solidus}} \unexpanded\def\Rsolidus {\math_fenced_fenced_stop{solidus}} +\unexpanded\def\Ldoublebar {\math_fenced_fenced_start{doublebar}} \unexpanded\def\Rdoublebar {\math_fenced_fenced_stop{doublebar}} +\unexpanded\def\Lnothing {\math_fenced_fenced_start{nothing}} \unexpanded\def\Rnothing {\math_fenced_fenced_stop{nothing}} %D And another one: @@ -191,6 +193,8 @@ \expandafter\let\csname\??mathleft\meaning [\endcsname\Lbracket \expandafter\let\csname\??mathleft\meaning (\endcsname\Lparent \expandafter\let\csname\??mathleft\meaning <\endcsname\Langle +\expandafter\let\csname\??mathleft\meaning ⟨\endcsname\Langle +\expandafter\let\csname\??mathleft\meaning ⟪\endcsname\Ldoubleangle \expandafter\let\csname\??mathleft\meaning {\endcsname\Lbrace \expandafter\let\csname\??mathleft\meaning |\endcsname\Lbar \expandafter\let\csname\??mathleft\meaning /\endcsname\Lsolidus @@ -200,6 +204,8 @@ \expandafter\let\csname\??mathright\meaning ]\endcsname\Rbracket \expandafter\let\csname\??mathright\meaning )\endcsname\Rparent \expandafter\let\csname\??mathright\meaning >\endcsname\Rangle +\expandafter\let\csname\??mathright\meaning ⟩\endcsname\Rangle +\expandafter\let\csname\??mathright\meaning ⟫\endcsname\Rdoubleangle \expandafter\let\csname\??mathright\meaning }\endcsname\Rbrace \expandafter\let\csname\??mathright\meaning |\endcsname\Rbar \expandafter\let\csname\??mathright\meaning /\endcsname\Rsolidus @@ -336,34 +342,33 @@ \let\math_fences_saved_middle\middle \let\math_fences_saved_right \right +% \def\math_fences_traced#1{\ruledhbox{\ttx#1\low{\the\c_math_fenced_nesting}}} + \unexpanded\def\math_fences_checked_left - {\math_fences_saved_left} + {%\math_fences_traced L% + \math_fences_saved_left} \unexpanded\def\math_fences_checked_middle - {\ifcase\c_math_fenced_nesting + {%\math_fences_traced M% + \ifcase\c_math_fenced_nesting \expandafter\math_fences_saved_middle \else \expandafter\firstofoneargument \fi} \unexpanded\def\math_fences_checked_right - {\ifcase\c_math_fenced_nesting + {%\math_fences_traced R% + \ifcase\c_math_fenced_nesting \expandafter\firstofoneargument \else \expandafter\math_fences_saved_right \fi} -% \unexpanded\def\math_fences_checked_left_or_middle -% {\ifcase\c_math_fenced_nesting -% \expandafter\math_fences_saved_left -% \else -% \expandafter\math_fences_saved_middle -% \fi} - \newconditional\c_math_checked_done % only bars \unexpanded\def\math_fences_checked_left_or_right - {\ifcase\c_math_fenced_nesting + {%\math_fences_traced B% + \ifcase\c_math_fenced_nesting \settrue\c_math_checked_done \expandafter\math_fences_saved_left \else\ifconditional\c_math_checked_done diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua index 35c43fd83..14ab607c8 100644 --- a/tex/context/base/mult-low.lua +++ b/tex/context/base/mult-low.lua @@ -116,6 +116,14 @@ return { "continueifinputfile", -- "luastringsep", "!!bs", "!!es", + -- + "lefttorightmark", "righttoleftmark", + -- + "breakablethinspace", "nobreakspace", "narrownobreakspace", "zerowidthnobreakspace", + "ideographicspace", "ideographichalffillspace", + "twoperemspace", "threeperemspace", "fourperemspace", "fiveperemspace", "sixperemspace", + "figurespace", "punctuationspace", "hairspace", + "zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj", }, ["helpers"] = { -- @@ -351,6 +359,7 @@ return { "righttolefthbox", "lefttorighthbox", "righttoleftvbox", "lefttorightvbox", "righttoleftvtop", "lefttorightvtop", "rtlhbox", "ltrhbox", "rtlvbox", "ltrvbox", "rtlvtop", "ltrvtop", "autodirhbox", "autodirvbox", "autodirvtop", + "lefttoright", "righttoleft","synchronizelayoutdirection","synchronizedisplaydirection","synchronizeinlinedirection", -- "lesshyphens", "morehyphens", "nohyphens", "dohyphens", -- diff --git a/tex/context/base/node-inj.lua b/tex/context/base/node-inj.lua index abbe9b449..ae48150a6 100644 --- a/tex/context/base/node-inj.lua +++ b/tex/context/base/node-inj.lua @@ -108,7 +108,7 @@ function injections.setkern(current,factor,rlmode,x,tfmchr) end end -function injections.setmark(start,base,factor,rlmode,ba,ma,index) -- ba=baseanchor, ma=markanchor +function injections.setmark(start,base,factor,rlmode,ba,ma,index,baseismark) -- ba=baseanchor, ma=markanchor local dx, dy = factor*(ba[1]-ma[1]), factor*(ba[2]-ma[2]) -- the index argument is no longer used but when this local bound = base[a_markbase] -- fails again we should pass it local index = 1 @@ -131,7 +131,7 @@ function injections.setmark(start,base,factor,rlmode,ba,ma,index) -- ba=baseanch base[a_markbase] = bound start[a_markmark] = bound start[a_markdone] = index - marks[bound] = { [index] = { dx, dy, rlmode } } + marks[bound] = { [index] = { dx, dy, rlmode, baseismark } } return dx, dy, bound end @@ -385,6 +385,11 @@ function injections.handler(head,where,keep) else n.xoffset = p.xoffset - d[1] end + local w = n.width + if w ~= 0 then + insert_node_before(head,n,newkern(-w/2)) + insert_node_after(head,n,newkern(-w/2)) + end end -- -- if mk[p] then diff --git a/tex/context/base/node-rul.lua b/tex/context/base/node-rul.lua index 6fd0ad068..96d6bdf41 100644 --- a/tex/context/base/node-rul.lua +++ b/tex/context/base/node-rul.lua @@ -204,7 +204,7 @@ local function processwords(attribute,data,flush,head,parent) -- we have hlistdi elseif id == glue_code then -- catch \underbar{a} \underbar{a} (subtype test is needed) local subtype = n.subtype - if n[attribute] and (subtype == userskip_code or subtype == spaceskip_code or subskip == xspaceskip_code) then + if n[attribute] and (subtype == userskip_code or subtype == spaceskip_code or subtype == xspaceskip_code) then l = n else head, done = flush(head,f,l,d,level,parent,strip), true diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index a591e5576..d015dc0b3 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -1992,6 +1992,7 @@ \raggedcommand \pack_framed_do_top \bgroup +\synchronizeinlinedirection \localbegstrut \aftergroup\localendstrut \aftergroup\pack_framed_do_bottom @@ -2013,6 +2014,7 @@ \raggedcenter \vss \bgroup +\synchronizeinlinedirection \localbegstrut \aftergroup\localendstrut \aftergroup\vss @@ -2035,6 +2037,7 @@ \aftergroup\localendstrut \aftergroup\vss \aftergroup\egroup +\synchronizeinlinedirection \localbegstrut \doformatonelinerbox} @@ -2052,6 +2055,7 @@ \raggedcommand \pack_framed_do_top \bgroup +\synchronizeinlinedirection \localbegstrut \aftergroup\localendstrut \aftergroup\pack_framed_do_bottom @@ -2075,6 +2079,7 @@ \hbox \bgroup \aftergroup\egroup +\synchronizeinlinedirection \localstrut \doformatonelinerbox} @@ -2088,6 +2093,7 @@ \fi \pack_framed_do_setups \hss +\synchronizeinlinedirection \localstrut \bgroup \aftergroup\hss @@ -2102,6 +2108,7 @@ \fi \let\postprocessframebox\relax \pack_framed_do_setups +\synchronizeinlinedirection \localstrut \doformatonelinerbox} diff --git a/tex/context/base/page-lay.mkiv b/tex/context/base/page-lay.mkiv index 1ff837d5e..81eb0423c 100644 --- a/tex/context/base/page-lay.mkiv +++ b/tex/context/base/page-lay.mkiv @@ -987,14 +987,13 @@ \global\let\page_adepts_pop\page_adepts_pop_indeed} \def\page_adapts_check + {\csname\??pageadaptations\the\ifcsname\??pageadaptations\the\realpageno\endcsname\realpageno\else\zerocount\fi\endcsname} + +\def\page_adapts_reset {\ifcsname\??pageadaptations\the\realpageno\endcsname - \page_adapts_check_indeed + \global\undefinevalue{\??pageadaptations\the\realpageno}% \fi} -\def\page_adapts_check_indeed - {\getvalue{\??pageadaptations\the\realpageno}% - \letvalue{\??pageadaptations\the\realpageno}\relax} - \def\page_adepts_push_indeed {\global\d_page_adepts_pushed_text_height \textheight \global\d_page_adepts_pushed_footer_height\footerheight} @@ -1006,6 +1005,9 @@ \global\let\page_adepts_push\page_adepts_push_indeed \global\let\page_adepts_pop\relax} +\appendtoks \page_adapts_check \to \everystarttext +\appendtoks \page_adapts_reset \to \everyshipout + \let\page_adepts_pop \relax \let\page_adepts_push\page_adepts_push_indeed diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex c763d5c53..c54f68a15 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.log b/tex/context/base/status-lua.log index 612ec1bd2..814e5c99a 100644 --- a/tex/context/base/status-lua.log +++ b/tex/context/base/status-lua.log @@ -1,6 +1,6 @@ (cont-yes.mkiv -ConTeXt ver: 2013.09.12 12:19 MKIV beta fmt: 2013.9.12 int: english/english +ConTeXt ver: 2013.09.13 10:59 MKIV beta fmt: 2013.9.13 int: english/english system > 'cont-new.mkiv' loaded (cont-new.mkiv) diff --git a/tex/context/base/trac-vis.lua b/tex/context/base/trac-vis.lua index 4a24dacf4..20d08fcce 100644 --- a/tex/context/base/trac-vis.lua +++ b/tex/context/base/trac-vis.lua @@ -415,13 +415,13 @@ end local b_cache = { } -local function ruledbox(head,current,vertical,layer,what,simple) +local function ruledbox(head,current,vertical,layer,what,simple,previous) local wd = current.width if wd ~= 0 then local ht = current.height local dp = current.depth local next = current.next - local prev = current.prev + local prev = previous -- current.prev ... prev can be wrong in math mode current.next = nil current.prev = nil local linewidth = emwidth/10 @@ -516,13 +516,13 @@ local function ruledbox(head,current,vertical,layer,what,simple) end end -local function ruledglyph(head,current) +local function ruledglyph(head,current,previous) local wd = current.width if wd ~= 0 then local ht = current.height local dp = current.depth local next = current.next - local prev = current.prev + local prev = previous current.next = nil current.prev = nil local linewidth = emwidth/20 @@ -598,6 +598,8 @@ local tags = { -- false = "HS", } +-- we sometimes pass previous as we can have issues in math (not watertight for all) + local function ruledglue(head,current,vertical) local spec = current.spec local width = spec.width @@ -697,9 +699,10 @@ local function visualize(head,vertical) local trace_glyph = false local trace_simple = false local trace_user = false - local current = head + local current = head + local previous = nil + local attr = unsetvalue local prev_trace_fontkern = nil - local attr = unsetvalue while current do local id = current.id local a = current[a_visual] or unsetvalue @@ -738,7 +741,7 @@ local function visualize(head,vertical) current[a_layer] = l_strut elseif id == glyph_code then if trace_glyph then - head, current = ruledglyph(head,current) + head, current = ruledglyph(head,current,previous) end elseif id == disc_code then if trace_glyph then @@ -788,7 +791,7 @@ local function visualize(head,vertical) current.list = visualize(content,false) end if trace_hbox then - head, current = ruledbox(head,current,false,l_hbox,"H__",trace_simple) + head, current = ruledbox(head,current,false,l_hbox,"H__",trace_simple,previous) end elseif id == vlist_code then local content = current.list @@ -796,9 +799,9 @@ local function visualize(head,vertical) current.list = visualize(content,true) end if trace_vtop then - head, current = ruledbox(head,current,true,l_vtop,"_T_",trace_simple) + head, current = ruledbox(head,current,true,l_vtop,"_T_",trace_simple,previous) elseif trace_vbox then - head, current = ruledbox(head,current,true,l_vbox,"__V",trace_simple) + head, current = ruledbox(head,current,true,l_vbox,"__V",trace_simple,previous) end elseif id == whatsit_code then if trace_whatsit then @@ -809,7 +812,8 @@ local function visualize(head,vertical) head, current = user(head,current) end end - current = current.next + previous = current + current = current.next end return head end diff --git a/tex/context/base/x-mathml.mkiv b/tex/context/base/x-mathml.mkiv index 0a0489696..1a2099805 100644 --- a/tex/context/base/x-mathml.mkiv +++ b/tex/context/base/x-mathml.mkiv @@ -74,17 +74,30 @@ } } { - \MMLhack\xmlflush{#1} + \math_fences_checked_start + \MMLhack + \xmlflush{#1} + \math_fences_checked_stop } \endgroup \stopxmlsetups \startxmlsetups mml:imath - \inlinemathematics{\MMLhack\xmlflush{#1}} + \inlinemathematics { + \math_fences_checked_start + \MMLhack + \xmlflush{#1} + \math_fences_checked_stop + } \stopxmlsetups \startxmlsetups mml:dmath - \displaymathematics{\MMLhack\xmlflush{#1}} + \displaymathematics { + \math_fences_checked_start + \MMLhack + \xmlflush{#1} + \math_fences_checked_stop + } \stopxmlsetups %D First we define some general formula elements. @@ -96,34 +109,45 @@ \startformula\MMLhack\xmlfirst{#1}{/mml:math}\stopformula \stopxmlsetups -\setfalse\mmlignoredelimiter -\settrue \mmlsomeleftdelimiter - -\def\MMLleftorright - {\ifconditional\mmlsomeleftdelimiter - \setfalse\mmlsomeleftdelimiter\expandafter\MMLleft - \else - \settrue \mmlsomeleftdelimiter\expandafter\MMLright - \fi} - +% old delimiter hacks +% +% \setfalse\mmlignoredelimiter +% \settrue \mmlsomeleftdelimiter +% +% \def\MMLleftorright +% {\ifconditional\mmlsomeleftdelimiter +% \setfalse\mmlsomeleftdelimiter\expandafter\MMLleft +% \else +% \settrue \mmlsomeleftdelimiter\expandafter\MMLright +% \fi} +% % \ifx\MMLleft \undefined \let\MMLleft \firstofoneargument \fi % \ifx\MMLright \undefined \let\MMLright \firstofoneargument \fi % \ifx\MMLmiddle\undefined \let\MMLmiddle\firstofoneargument \fi - +% % \def\mmlleftdelimiter #1{\ifconditional\mmlignoredelimiter#1\else\normalordelimiter{#1}{\MMLleft #1}\fi} % \def\mmlrightdelimiter #1{\ifconditional\mmlignoredelimiter#1\else\normalordelimiter{#1}{\MMLright #1}\fi} % \def\mmlmiddledelimiter #1{\ifconditional\mmlignoredelimiter#1\else\normalordelimiter{#1}{\MMLmiddle #1}\fi} % \def\mmlleftorrightdelimiter#1{\ifconditional\mmlignoredelimiter#1\else\normalordelimiter{#1}{\MMLleftorright#1}\fi} -% assumes +% new delimiter hacks (assumes wrapping) % % \math_fences_checked_start % \math_fences_checked_stop +% +% \math_fences_checked_left +% \math_fences_checked_middle +% \math_fences_checked_right +% \math_fences_checked_left_or_right + +\setfalse\mmlignoredelimiter % alternatively we could turn it on/off inside the start/stop and ignore \left\right\middle otherwise -\let\mmlleftdelimiter \math_fences_checked_left -\let\mmlmiddledelimiter \math_fences_checked_middle -\let\mmlrightdelimiter \math_fences_checked_right -\let\mmlleftorrightdelimiter\math_fences_checked_left_or_right +\def\mmlleftdelimiter {\ifconditional\mmlignoredelimiter\else\expandafter\math_fences_checked_left \fi} +\def\mmlrightdelimiter {\ifconditional\mmlignoredelimiter\else\expandafter\math_fences_checked_right \fi} +\def\mmlmiddledelimiter {\ifconditional\mmlignoredelimiter\else\expandafter\math_fences_checked_middle \fi} +\def\mmlleftorrightdelimiter{\ifconditional\mmlignoredelimiter\else\expandafter\math_fences_checked_left_or_right\fi} + +% end of delimiter mess \def\mmlchar#1{\char#1 } % used in lua code @@ -231,19 +255,6 @@ } \stoptexdefinition -%D Special features: - - \newtoks \@@postponedMMLactions \setfalse \somepostponedMMLactions - - \def\postponeMMLactions#1% - {\global\settrue\somepostponedMMLactions - \global\@@postponedMMLactions\expandafter{\the\@@postponedMMLactions#1}} - - \def\postponedMMLactions - {\global\setfalse\somepostponedMMLactions - \@EA\global\@EA\@@postponedMMLactions\@EA\emptytoks - \the\@@postponedMMLactions} - %D A couple of lists: \convertargument @@ -315,6 +326,17 @@ \newcount\mmlapplydepth \def\MMLcreset{\mmlapplydepth\zerocount} +% \newtoks \@@postponedMMLactions \setfalse \somepostponedMMLactions +% +% \def\postponeMMLactions#1% +% {\global\settrue\somepostponedMMLactions +% \global\@@postponedMMLactions\expandafter{\the\@@postponedMMLactions#1}} +% +% \def\postponedMMLactions +% {\global\setfalse\somepostponedMMLactions +% \@EA\global\@EA\@@postponedMMLactions\@EA\emptytoks +% \the\@@postponedMMLactions} + \startxmlsetups mml:apply \MMLmathinner { \xmldoif {#1} {/(\MMLcmainresetlist\string|\MMLctempresetlist)} { @@ -2146,7 +2168,7 @@ \begingroup \xmldoifelse {#1} {/mml:mo[first() or last()]} {% we need a {} \math_fences_checked_start - \xmlflush{#1} + \xmlflush{#1} \math_fences_checked_stop } { \xmlflush{#1} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index d2034f231..3c63ba098 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/12/13 12:19:43 +-- merge date : 09/13/13 10:59:07 do -- begin closure to overcome local limits and interference @@ -8836,7 +8836,7 @@ function injections.setkern(current,factor,rlmode,x,tfmchr) return 0,0 end end -function injections.setmark(start,base,factor,rlmode,ba,ma,index) +function injections.setmark(start,base,factor,rlmode,ba,ma,index,baseismark) local dx,dy=factor*(ba[1]-ma[1]),factor*(ba[2]-ma[2]) local bound=getattr(base,a_markbase) local index=1 @@ -8857,7 +8857,7 @@ function injections.setmark(start,base,factor,rlmode,ba,ma,index) setattr(base,a_markbase,bound) setattr(start,a_markmark,bound) setattr(start,a_markdone,index) - marks[bound]={ [index]={ dx,dy,rlmode } } + marks[bound]={ [index]={ dx,dy,rlmode,baseismark } } return dx,dy,bound end local function dir(n) @@ -8978,7 +8978,7 @@ function injections.handler(head,where,keep) local f=getfont(n) if f~=nf then nf=f - tm=fontdata[nf].resources.marks + tm=fontdata[nf].resources.marks end if tm then mk[n]=tm[getchar(n)] @@ -9091,11 +9091,17 @@ function injections.handler(head,where,keep) end end else + local wp=getfield(p,"width") + local wn=getfield(n,"width") if rlmode and rlmode>=0 then - ox=px-getfield(p,"width")+d[1] + ox=px-wp+d[1] else ox=px-d[1] end + if wn~=0 then + insert_node_before(head,n,newkern(-wn/2)) + insert_node_after(head,n,newkern(-wn/2)) + end end setfield(n,"xoffset",ox) local py=getfield(p,"yoffset") @@ -9112,6 +9118,8 @@ function injections.handler(head,where,keep) nofmarks=nofmarks-1 end end + elseif not n_markmark then + break else end end @@ -10183,7 +10191,7 @@ function handlers.gpos_mark2mark(head,start,kind,lookupname,markanchors,sequence if al[anchor] then local ma=markanchors[anchor] if ma then - local dx,dy,bound=setmark(start,base,tfmdata.parameters.factor,rlmode,ba,ma) + local dx,dy,bound=setmark(start,base,tfmdata.parameters.factor,rlmode,ba,ma,true) if trace_marks then logprocess("%s, anchor %s, bound %s: anchoring mark %s to basemark %s => (%p,%p)", pref(kind,lookupname),anchor,bound,gref(markchar),gref(basechar),dx,dy) @@ -10724,7 +10732,7 @@ function chainprocs.gpos_mark2mark(head,start,stop,kind,chainname,currentcontext if al[anchor] then local ma=markanchors[anchor] if ma then - local dx,dy,bound=setmark(start,base,tfmdata.parameters.factor,rlmode,ba,ma) + local dx,dy,bound=setmark(start,base,tfmdata.parameters.factor,rlmode,ba,ma,true) if trace_marks then logprocess("%s, anchor %s, bound %s: anchoring mark %s to basemark %s => (%p,%p)", cref(kind,chainname,chainlookupname,lookupname),anchor,bound,gref(markchar),gref(basechar),dx,dy) |