summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4208 -> 4203 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/font-dsp.lua118
-rw-r--r--tex/context/base/font-mps.lua98
-rw-r--r--tex/context/base/font-otr.lua33
-rw-r--r--tex/context/base/math-ali.mkiv21
-rw-r--r--tex/context/base/math-ini.mkiv23
-rw-r--r--tex/context/base/math-noa.lua55
-rw-r--r--tex/context/base/mtx-context-arrange.tex1
-rw-r--r--tex/context/base/publ-ini.lua2
-rw-r--r--tex/context/base/spac-ver.lua7
-rw-r--r--tex/context/base/status-files.pdfbin24384 -> 24381 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin254535 -> 254620 bytes
-rw-r--r--tex/context/base/strc-pag.mkiv2
-rw-r--r--tex/context/base/supp-box.lua135
-rw-r--r--tex/context/base/supp-box.mkiv19
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
18 files changed, 325 insertions, 195 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 3218ee57e..a21e4b61d 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.07.14 10:37}
+\newcontextversion{2015.07.16 13:30}
%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
index d2aec8d30..59cfa7455 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index aed7f884c..82f556b11 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.07.14 10:37}
+\edef\contextversion{2015.07.16 13:30}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/font-dsp.lua b/tex/context/base/font-dsp.lua
index 28e4aad6c..768ea92b3 100644
--- a/tex/context/base/font-dsp.lua
+++ b/tex/context/base/font-dsp.lua
@@ -1676,67 +1676,75 @@ do
end
local function checkkerns(f,fontdata,specification)
+ local datatable = fontdata.tables.kern
+ if not datatable then
+ return -- no kerns
+ end
local features = fontdata.features
local gposfeatures = features and features.gpos
+ local name
if not gposfeatures or not gposfeatures.kern then
- local datatable = fontdata.tables.kern
- if datatable then
- report("adding global kern table as gpos feature")
- setposition(f,datatable.offset)
- local version = readushort(f)
- local noftables = readushort(f)
- local kerns = setmetatableindex("table")
- for i=1,noftables do
- local version = readushort(f)
- local length = readushort(f)
- local coverage = readushort(f)
- -- bit 8-15 of coverage: format 0 or 2
- local format = bit32.rshift(coverage,8) -- is this ok?
- if format == 0 then
- local nofpairs = readushort(f)
- local searchrange = readushort(f)
- local entryselector = readushort(f)
- local rangeshift = readushort(f)
- for i=1,nofpairs do
- kerns[readushort(f)][readushort(f)] = readfword(f)
- end
- elseif format == 2 then
- -- apple specific so let's ignore it
- else
- -- not supported by ms
- end
- end
- local feature = { dflt = { dflt = true } }
- if not features then
- fontdata.features = { gpos = { kern = feature } }
- elseif not gposfeatures then
- fontdata.features.gpos = { kern = feature }
- else
- gposfeatures.kern = feature
- end
- local sequences = fontdata.sequences
- if not sequences then
- sequences = { }
- fontdata.sequences = sequences
+ name = "kern"
+ elseif specification.globalkerns then
+ name = "globalkern"
+ else
+ report("ignoring global kern table using gpos kern feature")
+ return
+ end
+ report("adding global kern table as gpos feature %a",name)
+ setposition(f,datatable.offset)
+ local version = readushort(f)
+ local noftables = readushort(f)
+ local kerns = setmetatableindex("table")
+ for i=1,noftables do
+ local version = readushort(f)
+ local length = readushort(f)
+ local coverage = readushort(f)
+ -- bit 8-15 of coverage: format 0 or 2
+ local format = bit32.rshift(coverage,8) -- is this ok?
+ if format == 0 then
+ local nofpairs = readushort(f)
+ local searchrange = readushort(f)
+ local entryselector = readushort(f)
+ local rangeshift = readushort(f)
+ for i=1,nofpairs do
+ kerns[readushort(f)][readushort(f)] = readfword(f)
end
- local nofsequences = #sequences + 1
- sequences[nofsequences] = {
- index = nofsequences,
- name = "kern",
- steps = {
- {
- coverage = kerns,
- format = "kern",
- },
- },
- nofsteps = 1,
- type = "gpos_pair",
- flags = { false, false, false, false },
- order = { "kern" },
- features = { kern = feature },
- }
+ elseif format == 2 then
+ -- apple specific so let's ignore it
+ else
+ -- not supported by ms
end
end
+ local feature = { dflt = { dflt = true } }
+ if not features then
+ fontdata.features = { gpos = { [name] = feature } }
+ elseif not gposfeatures then
+ fontdata.features.gpos = { [name] = feature }
+ else
+ gposfeatures[name] = feature
+ end
+ local sequences = fontdata.sequences
+ if not sequences then
+ sequences = { }
+ fontdata.sequences = sequences
+ end
+ local nofsequences = #sequences + 1
+ sequences[nofsequences] = {
+ index = nofsequences,
+ name = name,
+ steps = {
+ {
+ coverage = kerns,
+ format = "kern",
+ },
+ },
+ nofsteps = 1,
+ type = "gpos_pair",
+ flags = { false, false, false, false },
+ order = { name },
+ features = { [name] = feature },
+ }
end
function readers.gsub(f,fontdata,specification)
diff --git a/tex/context/base/font-mps.lua b/tex/context/base/font-mps.lua
index 478f29813..5095c4f79 100644
--- a/tex/context/base/font-mps.lua
+++ b/tex/context/base/font-mps.lua
@@ -64,13 +64,14 @@ function metapost.zeroline(d,factor)
return f_vertical(0,lly,0,ury)
end
-function metapost.paths(d,factor)
+function metapost.paths(d,xfactor,yfactor)
local sequence = d.sequence
local segments = d.segments
local list = { }
local path = { } -- recycled
local size = 0
- local factor = factor or 1
+ local xfactor = xfactor or 1
+ local yfactor = yfactor or xfactor
if sequence then
local i = 1
local n = #sequence
@@ -85,22 +86,22 @@ function metapost.paths(d,factor)
else
size = size + 1
end
- path[size] = f_moveto(factor*sequence[i+1],factor*sequence[i+2])
+ path[size] = f_moveto(xfactor*sequence[i+1],yfactor*sequence[i+2])
i = i + 3
elseif operator == "l" then -- "lineto"
size = size + 1
- path[size] = f_lineto(factor*sequence[i+1],factor*sequence[i+2])
+ path[size] = f_lineto(xfactor*sequence[i+1],yfactor*sequence[i+2])
i = i + 3
elseif operator == "c" then -- "curveto"
size = size + 1
- path[size] = f_curveto(factor*sequence[i+1],factor*sequence[i+2],factor*sequence[i+3],factor*sequence[i+4],factor*sequence[i+5],factor*sequence[i+6])
+ path[size] = f_curveto(xfactor*sequence[i+1],yfactor*sequence[i+2],xfactor*sequence[i+3],yfactor*sequence[i+4],xfactor*sequence[i+5],yfactor*sequence[i+6])
i = i + 7
elseif operator =="q" then -- "quadraticto"
size = size + 1
-- first is always a moveto
- local l_x, l_y = factor*sequence[i-2], factor*sequence[i-1]
- local m_x, m_y = factor*sequence[i+1], factor*sequence[i+2]
- local r_x, r_y = factor*sequence[i+3], factor*sequence[i+4]
+ local l_x, l_y = xfactor*sequence[i-2], yfactor*sequence[i-1]
+ local m_x, m_y = xfactor*sequence[i+1], yfactor*sequence[i+2]
+ local r_x, r_y = xfactor*sequence[i+3], yfactor*sequence[i+4]
path[size] = f_curveto (
l_x + 2/3 * (m_x-l_x),
l_y + 2/3 * (m_y-l_y),
@@ -127,20 +128,20 @@ function metapost.paths(d,factor)
else
size = size + 1
end
- path[size] = f_moveto(factor*segment[1],factor*segment[2])
+ path[size] = f_moveto(xfactor*segment[1],yfactor*segment[2])
elseif operator == "l" then -- "lineto"
size = size + 1
- path[size] = f_lineto(factor*segment[1],factor*segment[2])
+ path[size] = f_lineto(xfactor*segment[1],yfactor*segment[2])
elseif operator == "c" then -- "curveto"
size = size + 1
- path[size] = f_curveto(factor*segment[1],factor*segment[2],factor*segment[3],factor*segment[4],factor*segment[5],factor*segment[6])
+ path[size] = f_curveto(xfactor*segment[1],yfactor*segment[2],xfactor*segment[3],yfactor*segment[4],xfactor*segment[5],yfactor*segment[6])
elseif operator =="q" then -- "quadraticto"
size = size + 1
-- first is always a moveto
local prev = segments[i-1]
- local l_x, l_y = factor*prev[#prev-2], factor*prev[#prev-1]
- local m_x, m_y = factor*segment[1], factor*segment[2]
- local r_x, r_y = factor*segment[3], factor*segment[4]
+ local l_x, l_y = xfactor*prev[#prev-2], yfactor*prev[#prev-1]
+ local m_x, m_y = xfactor*segment[1], yfactor*segment[2]
+ local r_x, r_y = xfactor*segment[3], yfactor*segment[4]
path[size] = f_curveto (
l_x + 2/3 * (m_x-l_x),
l_y + 2/3 * (m_y-l_y),
@@ -256,18 +257,24 @@ local find_tail = nodes.tail
----- metapost = fonts.glyphs.metapost
local characters = fonts.hashes.characters
+local quaddata = fonts.hashes.emwidths
local shapes = fonts.hashes.shapes
-local topaths = fonts.metapost.paths
+local topaths = metapost.paths
local f_code = formatters["mfun_do_outline_text_flush(%q,%i,%.4F,%.4F)(%,t);"]
local s_nothing = "(origin scaled 10)"
+local f_trace_rule = formatters["draw rule(%6F,%6F,%6F) shifted (%6F,%6F) withcolor .5white;"]
+local f_strut = formatters["strut(%6F,%6F);"]
+local f_hrule = formatters["draw rule(%6F,%6F,%6F);"]
+local f_vrule = formatters["draw rule(%6F,%6F,%6F) shifted (%6F,%6F);"]
+local f_bounds = formatters["checkbounds(%6F,%6F,%6F,%6F);"]
local sc = 10
local fc = number.dimenfactors.bp * sc / 10
-- todo: make the next more efficient:
-function metapost.output(kind,font,char,advance,shift)
+function metapost.output(kind,font,char,advance,shift,ex)
local character = characters[font][char]
if char then
local index = character.index
@@ -277,14 +284,20 @@ function metapost.output(kind,font,char,advance,shift)
if glyphs then
local glyf = data.glyphs[index]
if glyf then
- local units = data.fontheader and data.fontheader.units or data.units or 1000
- local factor = sc/units
- local shift = shift or 0
- local advance = advance or 0
- local paths = topaths(glyf,factor)
- local code = f_code(kind,#paths,advance,shift,paths)
- -- return code, glyf.width * factor
- return code, character.width * fc
+ local units = data.fontheader and data.fontheader.units or data.units or 1000
+ local yfactor = sc/units
+ local xfactor = yfactor
+ local shift = shift or 0
+ local advance = advance or 0
+ local exfactor = ex or 0
+ local wfactor = 1
+ if exfactor ~= 0 then
+ wfactor = (1+(ex/units)/1000)
+ xfactor = xfactor * wfactor
+ end
+ local paths = topaths(glyf,xfactor,yfactor)
+ local code = f_code(kind,#paths,advance,shift,paths)
+ return code, character.width * fc * wfactor
end
end
end
@@ -292,7 +305,7 @@ function metapost.output(kind,font,char,advance,shift)
return s_nothing, 10 * sc/1000
end
--- shifted hboxes
+-- not ok yet: leftoffset in framed not handled well
local signal = -0x3FFFFFFF - 1
@@ -311,7 +324,7 @@ function fonts.metapost.boxtomp(n,kind)
while current do
local id = current.id
if id == glyph_code then
- local code, width = metapost.output(kind,current.font,current.char,advance,-shift*fc)
+ local code, width = metapost.output(kind,current.font,current.char,advance,-shift*fc,current.expansion_factor)
result[#result+1] = code
advance = advance + width
elseif id == disc_code then
@@ -321,8 +334,8 @@ function fonts.metapost.boxtomp(n,kind)
end
elseif id == kern_code then
local kern = current.kern * fc
- if trace_skips then -- todo: shift
- result[#result+1] = formatters["draw rule(%3F,%3F,%3F) shifted (%3F,%3F) withcolor .5white;"](kern,0.8*ht*fc,0.8*dp*fc,advance,-shift*fc)
+ if trace_skips then
+ result[#result+1] = f_trace_rule(kern,0.8*ht*fc,0.8*dp*fc,advance,-shift*fc)
end
advance = advance + kern
elseif id == glue_code then
@@ -343,8 +356,8 @@ function fonts.metapost.boxtomp(n,kind)
else
width = width * fc
end
- if trace_skips then -- todo: shift
- result[#result+1] = formatters["draw rule(%3F,%3F,%3F) shifted (%3F,%3F) withcolor .5white;"](width,0.1*ht*fc,0.1*dp*fc,advance,-shift*fc)
+ if trace_skips then
+ result[#result+1] = f_trace_rule(width,0.1*ht*fc,0.1*dp*fc,advance,-shift*fc)
end
advance = advance + width
elseif id == hlist_code then
@@ -353,6 +366,7 @@ function fonts.metapost.boxtomp(n,kind)
advance = a + current.width * fc
elseif id == vlist_code then
boxtomp(current) -- ,distance + shift,current.glue_set*current.glue_sign)
+ advance = advance + current.width * fc
elseif id == rule_code then
local wd = current.width
local ht = current.height
@@ -361,13 +375,14 @@ function fonts.metapost.boxtomp(n,kind)
ht = ht - shift
dp = dp - shift
if wd == 0 then
- result[#result+1] = formatters["strut(%3F,%3F);"](ht*fc,-dp*fc)
+ result[#result+1] = f_strut(ht*fc,-dp*fc)
else
- result[#result+1] = formatters["draw rule(%3F,%3F,%3F);"](wd*fc,ht*fc,-dp*fc)
+ result[#result+1] = f_hrule(wd*fc,ht*fc,-dp*fc)
end
end
- else
- -- print("horizontal >>>",nodecodes[id])
+ if wd ~= signal then
+ advance = advance + wd * fc
+ end
end
current = current.next
end
@@ -390,6 +405,19 @@ function fonts.metapost.boxtomp(n,kind)
elseif id == glue_code then
distance = distance - current.spec.width
advance = 0
+ elseif id == rule_code then
+ local wd = current.width
+ local ht = current.height
+ local dp = current.depth
+ if not (ht == signal or dp == signal or wd == signal) then
+ distance = distance - dp
+ if wd == 0 then
+ result[#result+1] = f_strut(ht*fc,-dp*fc)
+ else
+ result[#result+1] = f_vrule(wd*fc,ht*fc,-dp*fc,0,distance+shift)
+ end
+ distance = distance - ht
+ end
end
current = current.prev
end
@@ -415,7 +443,7 @@ function fonts.metapost.boxtomp(n,kind)
local dp = box.depth
local sh = box.shift
- result[#result+1] = formatters["checkbounds(%3F,%3F,%3F,%3F);"](0,-dp*fc,wd*fc,ht*fc)
+ result[#result+1] = f_bounds(0,-dp*fc,wd*fc,ht*fc)
return concat(result)
diff --git a/tex/context/base/font-otr.lua b/tex/context/base/font-otr.lua
index d8bd1219d..eb012f1d5 100644
--- a/tex/context/base/font-otr.lua
+++ b/tex/context/base/font-otr.lua
@@ -1826,16 +1826,17 @@ end
local function loadfont(specification,n)
if type(specification) == "string" then
specification = {
- filename = specification,
- info = true, -- always true (for now)
- details = true,
- glyphs = true,
- shapes = true,
- kerns = true,
- lookups = true,
+ filename = specification,
+ info = true, -- always true (for now)
+ details = true,
+ glyphs = true,
+ shapes = true,
+ kerns = true,
+ globalkerns = true,
+ lookups = true,
-- true or number:
- subfont = n or true,
- tounicode = false,
+ subfont = n or true,
+ tounicode = false,
}
end
-- if shapes only then
@@ -1881,14 +1882,14 @@ end
function readers.loadfont(filename,n)
local fontdata = loadfont {
- filename = filename,
- glyphs = true,
- shapes = false,
- lookups = true,
- -- kerns = true,
- subfont = n,
+ filename = filename,
+ glyphs = true,
+ shapes = false,
+ lookups = true,
+ -- kerns = true,
+ -- globalkerns = true, -- only for testing, e.g. cambria has different gpos and kern
+ subfont = n,
}
-print(fontdata.subfonts)
if fontdata then
--
return {
diff --git a/tex/context/base/math-ali.mkiv b/tex/context/base/math-ali.mkiv
index bba55ba72..da748bd1a 100644
--- a/tex/context/base/math-ali.mkiv
+++ b/tex/context/base/math-ali.mkiv
@@ -83,6 +83,8 @@
% use zeroskipplusfill
+% i really need to redo this eqno mess ... in lua
+
\def\math_prepare_r_eqalign_no
{\c_math_align_a{\strut\math_first_in_eqalign\hfil\math_left_of_equalign\span\math_math_in_eqalign{\alignmark\alignmark}\math_right_of_eqalign\tabskip\zeropoint}%
\c_math_align_b{\aligntab\math_next_in_eqalign\math_left_of_equalign\span\math_math_in_eqalign{\alignmark\alignmark}\math_right_of_eqalign\tabskip\zeropoint}%
@@ -98,7 +100,7 @@
\the\mathdisplayaligntweaks
\tabskip\centering}
-\def\math_prepare_l_eqalign_no
+\def\math_prepare_l_eqalign_no % \checkeddisplaymath
{\c_math_align_a{\strut\math_first_in_eqalign\hfil\math_left_of_equalign\span\math_math_in_eqalign{\alignmark\alignmark}\math_right_of_eqalign\tabskip\zeropoint}%
\c_math_align_b{\aligntab\math_next_in_eqalign\math_left_of_equalign\span\math_math_in_eqalign{\alignmark\alignmark}\math_right_of_eqalign\tabskip\zeropoint}%
% problem: number is handled after rest and so ends up in the margin
@@ -123,7 +125,7 @@
\let\math_finish_eqalign_no\relax
\fi
#1%
- \halign \ifcase\eqalignmode \or to \displaywidth \fi \expandafter {\the\scratchtoks\crcr#2\crcr}%
+ \halign \ifcase\eqalignmode \or to \checkeddisplaywidth \fi \expandafter {\the\scratchtoks\crcr#2\crcr}%
\math_finish_eqalign_no}
\def\math_both_eqalign_no_aligned#1%
@@ -139,7 +141,7 @@
\fi
\fi
#1%
- \halign \ifcase\eqalignmode \or to \displaywidth \fi \expandafter \bgroup\the\scratchtoks\crcr}
+ \halign \ifcase\eqalignmode \or to \checkeddisplaywidth \fi \expandafter \bgroup\the\scratchtoks\crcr}
\def\math_rlap#1%
{\setbox\scratchbox\hbox{#1}%
@@ -202,7 +204,7 @@
\def\math_alignment_start_indeed[#1]%
{% \begingroup not permitted ($$...assignments...\halign... )
\iffirstargument
- \setupmathalignment[\currentmathalignment][#1]%
+ \setupmathalignment[\currentmathalignment][#1]% bad! ungrouped
\fi
\the\everymathalignment
\c_math_eqalign_column\zerocount
@@ -1034,7 +1036,7 @@
\let\math_the_l_eq_no\empty
\unexpanded\def\startmathbox#1%
- {\hsize\displaywidth
+ {\hsize\displaywidth % \checkeddisplaymath
\global\mathnumberstatus\plusone
\mathraggedstatus#1\relax
\let\mathnumbercorrection\!!zeropoint
@@ -1049,7 +1051,7 @@
\let\normaleqno \eqno
% added
\strc_formulas_place_number
- \setbox\scratchbox\math_hbox to \displaywidth\bgroup
+ \setbox\scratchbox\math_hbox to \displaywidth\bgroup % \checkeddisplaymath
\mathinnerstrut
\startforceddisplaymath
\ifcase\mathraggedstatus\or\hfill\or\hfill\fi}
@@ -1078,7 +1080,8 @@
\egroup
\setbox0\hbox{\unhcopy\scratchbox}%
\scratchdimen\wd0
- \ifdim\scratchdimen>\displaywidth
+ % to be tested: \scratchdimen\naturalwd\scratchbox
+ \ifdim\scratchdimen>\displaywidth % \checkeddisplaymath
\donetrue
\else
\donefalse
@@ -1092,14 +1095,14 @@
\box\scratchbox
\else
\ifdone
- \vbox{\box\scratchbox\hbox to \displaywidth{\hss\math_box_llapped_math_no}}%
+ \vbox{\box\scratchbox\hbox to \displaywidth{\hss\math_box_llapped_math_no}}% \checkeddisplaymath
\else
\hss\box\scratchbox\math_box_llapped_math_no % hss makes room for number
\fi
\fi
\else
\ifdone
- \vbox{\hbox to \displaywidth{\math_box_rlapped_math_no\hss}\box\scratchbox}%
+ \vbox{\hbox to \displaywidth{\math_box_rlapped_math_no\hss}\box\scratchbox}% \checkeddisplaymath
\else
\math_box_rlapped_math_no\box\scratchbox\hss % hss makes room for number
\fi
diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv
index c431cd383..93eafac23 100644
--- a/tex/context/base/math-ini.mkiv
+++ b/tex/context/base/math-ini.mkiv
@@ -2274,6 +2274,29 @@
\unexpanded\def\mathplus {+}
\unexpanded\def\mathminus{\ifmmode –\else\iffontchar\font`−−\else –\fi\fi}
+%D The \type {\displaywidth} is only known inside a display formula, so we need to catch
+%D it when still zero.
+
+\def\checkeddisplaywidth % hsize if zero
+ {\dimexpr
+ \ifdim\displaywidth=\zeropoint
+ \hsize
+ \else
+ \displaywidth
+ \fi
+ \relax}
+
+\def\maximizeddisplaywidth % larger than zero but within hsize
+ {\dimexpr
+ \ifdim\displaywidth=\zeropoint
+ \hsize
+ \else\ifdim\displaywidth>\hsize
+ \hsize
+ \else
+ \displaywidth
+ \fi\fi
+ \relax}
+
\protect \endinput
% % not used (yet)
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index 09188a4fd..b911935de 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -47,6 +47,7 @@ local trace_variants = false registertracker("math.variants", function(
local trace_alternates = false registertracker("math.alternates", function(v) trace_alternates = v end)
local trace_italics = false registertracker("math.italics", function(v) trace_italics = v end)
local trace_families = false registertracker("math.families", function(v) trace_families = v end)
+local trace_fences = false registertracker("math.fences", function(v) trace_fences = v end)
local check_coverage = true registerdirective("math.checkcoverage", function(v) check_coverage = v end)
@@ -60,6 +61,7 @@ local report_variants = logreporter("mathematics","variants")
local report_alternates = logreporter("mathematics","alternates")
local report_italics = logreporter("mathematics","italics")
local report_families = logreporter("mathematics","families")
+local report_fences = logreporter("mathematics","fences")
local a_mathrendering = privateattribute("mathrendering")
local a_exportstatus = privateattribute("exportstatus")
@@ -246,7 +248,7 @@ local function process(start,what,n,parent)
end
end
-local function processnested(current,what)
+local function processnested(current,what,n)
local noad = nil
local id = getid(current)
if id == math_noad then
@@ -665,13 +667,15 @@ local function makelist(noad,f_o,o_next,c_prev,f_c,middle)
local prev = f_o
local current = o_next
while current ~= f_c do
- if middle[current] then
+ local m = middle[current]
+ if m then
local next = getnext(current)
local fence = makefence(middle_fence_code,current)
setfield(current,"nucleus",nil)
free_node(current)
middle[current] = nil
-- replace_node
+-- print(">>>",prev,m) -- weird, can differ
setfield(prev,"next",fence)
setfield(fence,"prev",prev)
setfield(next,"prev",fence)
@@ -726,6 +730,8 @@ local function convert_close(close,first,middle)
return close
end
+local stacks = table.setmetatableindex("table")
+
autofences[math_noad] = function(pointer,what,n,parent)
-- can we do a fast check?
local current = pointer
@@ -741,30 +747,39 @@ autofences[math_noad] = function(pointer,what,n,parent)
if id == math_noad then
local a = getattr(current,a_autofence)
if a and a > 0 then
+ local stack = stacks[n]
setattr(current,a_autofence,0)
if a == 1 or (a == 4 and (not stack or #stack == 0)) then
- if stack then
- insert(stack,current)
- else
- stack = { current }
+ if trace_fences then
+ report_fences("%2i: pushing open on stack",n)
end
+ insert(stack,current)
elseif a == 2 or a == 4 then
- local open = stack and remove(stack)
+ local open = remove(stack)
if open then
+ if trace_fences then
+ report_fences("%2i: handling %s, stack depth %i",n,"both",#stack)
+ end
current = convert_both(open,current,middle)
elseif current == start then
-- skip
else
+ if trace_fences then
+ report_fences("%2i: handling %s, stack depth %i",n,"close",#stack)
+ end
current = convert_close(current,initial,middle)
if not parent then
initial = current
end
end
elseif a == 3 then
+ if trace_fences then
+ report_fences("%2i: registering middle",n)
+ end
if middle then
- middle[current] = true
+ middle[current] = last
else
- middle = { [current] = true }
+ middle = { [current] = last }
end
end
done = true
@@ -775,18 +790,25 @@ autofences[math_noad] = function(pointer,what,n,parent)
noad = getfield(current,"sub") if noad then process(noad,what,n,current) end -- list
end
else
- process(current,autofences)
+ -- next at current level
+ process(current,autofences,n-1)
end
last = current
current = getnext(current)
end
if done then
- if stack then
- local n = #stack
- if n > 0 then
- for i=1,n do
- last = convert_open(remove(stack),last,middle)
+ local stack = stacks[n]
+ local s = #stack
+ if s > 0 then
+ if trace_fences then
+ report_fences("%2i: handling %s stack levels",n,s)
+ end
+ for i=1,s do
+ local open = remove(stack)
+ if trace_fences then
+ report_fences("%2i: handling %s, stack depth %i",n,"open",#stack)
end
+ last = convert_open(open,last,middle)
end
end
if not parent then
@@ -800,8 +822,9 @@ end
function handlers.autofences(head,style,penalties)
-- if tex.modes.c_math_fences_auto then
+-- inspect(nodes.totree(head))
local h, d = processnoads(head,autofences,"autofence")
- -- inspect(nodes.totree(h))
+-- inspect(nodes.totree(h))
return h or head, d
-- else
-- return head, false
diff --git a/tex/context/base/mtx-context-arrange.tex b/tex/context/base/mtx-context-arrange.tex
index fb53406d8..a3e6e9db3 100644
--- a/tex/context/base/mtx-context-arrange.tex
+++ b/tex/context/base/mtx-context-arrange.tex
@@ -31,7 +31,6 @@
%
% end help
-
\input mtx-context-common.tex
\doifdocumentargument {paperoffset} {
diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua
index 368b8c6ff..9db8e8505 100644
--- a/tex/context/base/publ-ini.lua
+++ b/tex/context/base/publ-ini.lua
@@ -1163,7 +1163,7 @@ do
local entry = luadata[tag]
local year = entry.year
detail[key] = hash
- if year ~= lastyear then
+ if not year or year ~= lastyear then
lastyear = year
suffix = 1
else
diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua
index 18b04f3fc..038bfc9f6 100644
--- a/tex/context/base/spac-ver.lua
+++ b/tex/context/base/spac-ver.lua
@@ -310,11 +310,8 @@ end
-- check variables.none etc
local function fixedprofile(current)
- if builders.profiling then
- return builders.profiling.fixedprofile(current)
- else
- return false
- end
+ local profiling = builders.profiling
+ return profiling and profiling.fixedprofile(current)
end
local function snap_hlist(where,current,method,height,depth) -- method.strut is default
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 71aec6f9b..2c2252dcd 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index a200aa55e..18fe9f5f3 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-pag.mkiv b/tex/context/base/strc-pag.mkiv
index 72f0cf32a..bc4ec8888 100644
--- a/tex/context/base/strc-pag.mkiv
+++ b/tex/context/base/strc-pag.mkiv
@@ -329,7 +329,7 @@
{\edef\p_strc_pagenumbers_page{\directpagenumberingparameter\c!page}%
\ifx\p_strc_pagenumbers_page\empty \else
\ifx\p_strc_pagenumbers_page\v!no \else
- \page[\p_strc_pagenumbers_page]
+ \page[\p_strc_pagenumbers_page]%
\fi
\fi}
diff --git a/tex/context/base/supp-box.lua b/tex/context/base/supp-box.lua
index 7cc71a891..edbbe4841 100644
--- a/tex/context/base/supp-box.lua
+++ b/tex/context/base/supp-box.lua
@@ -12,59 +12,61 @@ local lpegmatch = lpeg.match
local report_hyphenation = logs.reporter("languages","hyphenation")
-local tex = tex
-local context = context
-local nodes = nodes
-
-local implement = interfaces.implement
-
-local splitstring = string.split
-
-local nodecodes = nodes.nodecodes
-
-local disc_code = nodecodes.disc
-local hlist_code = nodecodes.hlist
-local vlist_code = nodecodes.vlist
-local glue_code = nodecodes.glue
-local kern_code = nodecodes.kern
-local glyph_code = nodecodes.glyph
-
-local nuts = nodes.nuts
-local tonut = nuts.tonut
-local tonode = nuts.tonode
-
-local getfield = nuts.getfield
-local getnext = nuts.getnext
-local getprev = nuts.getprev
-local getid = nuts.getid
-local getlist = nuts.getlist
-local getattribute = nuts.getattribute
-local getbox = nuts.getbox
-
-local setfield = nuts.setfield
-local setbox = nuts.setbox
-
-local free_node = nuts.free
-local flush_list = nuts.flush_list
-local copy_node = nuts.copy
-local copy_list = nuts.copy_list
-local find_tail = nuts.tail
-local traverse_id = nuts.traverse_id
-local link_nodes = nuts.linked
-
-local listtoutf = nodes.listtoutf
-
-local nodepool = nuts.pool
-local new_penalty = nodepool.penalty
-local new_hlist = nodepool.hlist
-local new_glue = nodepool.glue
-local new_rule = nodepool.rule
-local new_kern = nodepool.kern
-
-local setlistcolor = nodes.tracers.colors.setlist
-
-local texget = tex.get
-local texgetbox = tex.getbox
+local tex = tex
+local context = context
+local nodes = nodes
+
+local implement = interfaces.implement
+
+local splitstring = string.split
+
+local nodecodes = nodes.nodecodes
+
+local disc_code = nodecodes.disc
+local hlist_code = nodecodes.hlist
+local vlist_code = nodecodes.vlist
+local glue_code = nodecodes.glue
+local kern_code = nodecodes.kern
+local glyph_code = nodecodes.glyph
+
+local nuts = nodes.nuts
+local tonut = nuts.tonut
+local tonode = nuts.tonode
+
+local getfield = nuts.getfield
+local getnext = nuts.getnext
+local getprev = nuts.getprev
+local getid = nuts.getid
+local getlist = nuts.getlist
+local getattribute = nuts.getattribute
+local getbox = nuts.getbox
+
+local setfield = nuts.setfield
+local setbox = nuts.setbox
+
+local free_node = nuts.free
+local flush_list = nuts.flush_list
+local copy_node = nuts.copy
+local copy_list = nuts.copy_list
+local find_tail = nuts.tail
+local traverse_id = nuts.traverse_id
+local link_nodes = nuts.linked
+local dimensions = nuts.dimensions
+
+local listtoutf = nodes.listtoutf
+
+local nodepool = nuts.pool
+local new_penalty = nodepool.penalty
+local new_hlist = nodepool.hlist
+local new_glue = nodepool.glue
+local new_rule = nodepool.rule
+local new_kern = nodepool.kern
+
+local setlistcolor = nodes.tracers.colors.setlist
+
+local texget = tex.get
+local texgetbox = tex.getbox
+local texsetdimen = tex.setdimen
local function hyphenatedlist(head,usecolor)
local current = head and tonut(head)
@@ -368,3 +370,30 @@ implement {
context.puretext(nodes.toutf(texgetbox(n).list)) -- helper is defined later
end
}
+
+local function getnaturaldimensions(n)
+ local w, h, d = 0, 0, 0
+ local l = getlist(getbox(n))
+ if l then
+ w, h, d = dimensions(l)
+ end
+ texsetdimen("lastnaturalboxwd",w)
+ texsetdimen("lastnaturalboxht",h)
+ texsetdimen("lastnaturalboxdp",d)
+ return w, h, d
+end
+
+interfaces.implement {
+ name = "getnaturaldimensions",
+ arguments = "integer",
+ actions = getnaturaldimensions
+}
+
+interfaces.implement {
+ name = "naturalwd",
+ arguments = "integer",
+ actions = function(n)
+ getnaturaldimensions(n)
+ context.lastnaturalboxwd(false)
+ end
+}
diff --git a/tex/context/base/supp-box.mkiv b/tex/context/base/supp-box.mkiv
index 54b0e2860..28dc81bff 100644
--- a/tex/context/base/supp-box.mkiv
+++ b/tex/context/base/supp-box.mkiv
@@ -2854,6 +2854,25 @@
\let\hyphenatedhbox\hbox
+%D We can do this:
+%D
+%D \starttyping
+%D \setbox0\hbox to 10cm{foo} \setbox2\hbox{\unhbox0} \the\wd2
+%D \stoptyping
+%D
+%D But this saves a copy (and hpack pass):
+%D
+%D \starttyping
+%D \setbox0\hbox to 10cm{foo} \the\naturalwd0
+%D \stoptyping
+
+\newdimen\lastnaturalboxwd
+\newdimen\lastnaturalboxht
+\newdimen\lastnaturalboxdp
+
+\let\getnaturaldimensions\clf_getnaturaldimensions % sets three dimensions
+\let\naturalwd \clf_naturalwd % calculates and returns wd
+
\protect \endinput
% a bit of test code:
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 5bd8eecf3..06de50fd0 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 : 07/14/15 10:37:12
+-- merge date : 07/16/15 13:30:20
do -- begin closure to overcome local limits and interference