summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-08-01 02:40:38 +0300
committerMarius <mariausol@gmail.com>2013-08-01 02:40:38 +0300
commitba8b379386b98e715a7ec8b6f2d0c6f31ea446c5 (patch)
tree5d17ceabf84101d686d99b24d241fad267a33743
parent9bdf7ef9d9811adeab13e76766e170ca932fd7f2 (diff)
downloadcontext-ba8b379386b98e715a7ec8b6f2d0c6f31ea446c5.tar.gz
beta 2013.08.01 01:31
-rw-r--r--tex/context/base/back-ini.lua9
-rw-r--r--tex/context/base/back-pdf.lua69
-rw-r--r--tex/context/base/back-pdf.mkiv72
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4104 -> 4104 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/math-noa.lua45
-rw-r--r--tex/context/base/math-rad.mkvi8
-rw-r--r--tex/context/base/s-inf-03.pdfbin1977 -> 1981 bytes
-rw-r--r--tex/context/base/spac-ver.lua23
-rw-r--r--tex/context/base/status-files.pdfbin24653 -> 24688 bytes
-rw-r--r--tex/context/base/status-lua.log4
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
13 files changed, 202 insertions, 34 deletions
diff --git a/tex/context/base/back-ini.lua b/tex/context/base/back-ini.lua
index bdd931abd..6f58b3262 100644
--- a/tex/context/base/back-ini.lua
+++ b/tex/context/base/back-ini.lua
@@ -8,7 +8,6 @@ if not modules then modules = { } end modules ['back-ini'] = {
local next, type = next, type
local format = string.format
-local sind, cosd = math.sind, math.cosd
backends = backends or { }
local backends = backends
@@ -96,11 +95,3 @@ tables.vfspecials = allocate {
startslant = comment,
stopslant = comment,
}
-
--- experimental code --
-
-function commands.pdfrotation(a) -- somewhat weird here
- local s, c = sind(a), cosd(a)
- context("%0.6f %0.6f %0.6f %0.6f",c,s,-s,c)
-end
-
diff --git a/tex/context/base/back-pdf.lua b/tex/context/base/back-pdf.lua
index 63261aa3b..f9115375c 100644
--- a/tex/context/base/back-pdf.lua
+++ b/tex/context/base/back-pdf.lua
@@ -18,3 +18,72 @@ function codeinjections.getoutputfilename()
end
backends.install("pdf")
+
+-- experimental code (somewhat weird here) .. todo: nodeinjections
+
+local context = context
+
+local sind, cosd = math.sind, math.cosd
+local insert, remove = table.insert, table.remove
+
+-- function commands.pdfrotation(a) -- somewhat weird here
+-- local s, c = sind(a), cosd(a)
+-- context("%0.6f %0.6f %0.6f %0.6f",c,s,-s,c)
+-- end
+
+local stack = { }
+local f_rotation = string.formatters["%0.8f %0.8f %0.8f %0.8f"]
+local f_scaling = string.formatters["%0.8f 0 0 %0.8f"]
+local s_mirroring = "-1 0 0 1"
+local f_matrix = string.formatters["%0.8f %0.8f %0.8f %0.8f"]
+
+local pdfsetmatrix = nodes.pool.pdfsetmatrix
+
+local function pop()
+ local top = remove(stack)
+ if top then
+ context(pdfsetmatrix(top))
+ end
+end
+
+function commands.pdfstartrotation(a)
+ if a == 0 then
+ insert(stack,false)
+ else
+ local s, c = sind(a), cosd(a)
+ context(pdfsetmatrix(f_rotation(c,s,-s,c)))
+ insert(stack,f_rotation(-c,-s,s,-c))
+ end
+end
+
+function commands.pdfstartscaling(sx,sy)
+ if sx == 1 and sy == 1 then
+ insert(stack,false)
+ else
+ if sx == 0 then sx = 0.0001 end -- prevent acrobat crash
+ if sy == 0 then sy = 0.0001 end -- prevent acrobat crash
+ context(pdfsetmatrix(f_scaling(sx,sy)))
+ insert(stack,f_scaling(1/sx,1/sy))
+ end
+end
+
+function commands.pdfstartmirroring(sx,sy)
+ context(pdfsetmatrix(s_mirroring))
+ insert(stack,s_mirroring)
+end
+
+function commands.pdfstartmatrix(sx,rx,ry,sy)
+ if sx ==1 and rx == 0 and ry == 0 and sy == 1 then
+ insert(stack,false)
+ else
+ if sx == 0 then sx = 0.0001 end -- prevent acrobat crash
+ if sy == 0 then sy = 0.0001 end -- prevent acrobat crash
+ context(pdfsetmatrix(f_matrix(rx,sx,sy,ry)))
+ insert(stack,f_matrix(-rx,-sx,-sy,-ry))
+ end
+end
+
+commands.pdfstoprotation = pop
+commands.pdfstopscaling = pop
+commands.pdfstopmirroring = pop
+commands.pdfstopmatrix = pop
diff --git a/tex/context/base/back-pdf.mkiv b/tex/context/base/back-pdf.mkiv
index 3be1c4ec1..39d9e114a 100644
--- a/tex/context/base/back-pdf.mkiv
+++ b/tex/context/base/back-pdf.mkiv
@@ -149,50 +149,90 @@
% todo: inject at the lua end cq. deal with #5 and #6 too
+% \unexpanded\def\dostartrotation#1% grouped
+% {\forcecolorhack % maybe use signal instead
+% \advance\backendtransformlevel\plusone
+% \pdfsave
+% \pdfsetmatrix{\ctxcommand{pdfrotation(#1)}}}
+%
+% \unexpanded\def\dostoprotation
+% {\pdfrestore
+% \advance\backendtransformlevel\minusone}
+
\unexpanded\def\dostartrotation#1% grouped
{\forcecolorhack % maybe use signal instead
\advance\backendtransformlevel\plusone
- \pdfsave
- \pdfsetmatrix{\ctxcommand{pdfrotation(#1)}}}
+ \ctxcommand{pdfstartrotation(#1)}}
\unexpanded\def\dostoprotation
- {\pdfrestore
+ {\ctxcommand{pdfstoprotation()}%
\advance\backendtransformlevel\minusone}
+% \unexpanded\def\dostartscaling#1#2% the test is needed because acrobat is bugged!
+% {\forcecolorhack % maybe use signal instead
+% \advance\backendtransformlevel\plusone
+% \pdfsave
+% \pdfsetmatrix
+% {\ifdim#1\points=\zeropoint.0001\else#1\fi\space 0 0
+% \ifdim#2\points=\zeropoint.0001\else#2\fi\space}}% 0 0
+%
+% \unexpanded\def\dostopscaling
+% {\pdfrestore
+% \advance\backendtransformlevel\minusone}
+
\unexpanded\def\dostartscaling#1#2% the test is needed because acrobat is bugged!
{\forcecolorhack % maybe use signal instead
\advance\backendtransformlevel\plusone
- \pdfsave
- \pdfsetmatrix
- {\ifdim#1\points=\zeropoint.0001\else#1\fi\space 0 0
- \ifdim#2\points=\zeropoint.0001\else#2\fi\space}}% 0 0
+ \ctxcommand{pdfstartscaling(#1,#2)}}
\unexpanded\def\dostopscaling
- {\pdfrestore
+ {\ctxcommand{pdfstopscaling()}%
\advance\backendtransformlevel\minusone}
+% \unexpanded\def\dostartmirroring
+% {\advance\backendtransformlevel\plusone
+% \pdfsave
+% \pdfsetmatrix{-1 0 0 1}} % 0 0
+
+% \unexpanded\def\dostopmirroring
+% {\pdfrestore
+% \advance\backendtransformlevel\minusone}
+
\unexpanded\def\dostartmirroring
{\advance\backendtransformlevel\plusone
- \pdfsave
- \pdfsetmatrix{-1 0 0 1}} % 0 0
+ \ctxcommand{pdfstartmirroring()}}
\unexpanded\def\dostopmirroring
- {\pdfrestore
+ {\ctxcommand{pdfstopmirroring()}%
\advance\backendtransformlevel\minusone}
+% \unexpanded\def\dotransformnextbox#1#2#3#4#5#6% sx rx ry sy tx ty (will change) / basepoints !
+% {\advance\backendtransformlevel\plusone
+% % fixing ht/dp/wd should happen elsewhere
+% \dowithnextbox{\dodotransformnextbox{#5}{#6}{#1 #2 #3 #4}}}
+%
+% \unexpanded\def\dodotransformnextbox#1#2#3%
+% {\hbox
+% {\kern#1\onebasepoint
+% \raise#2\onebasepoint\hbox
+% {\pdfsave
+% \pdfsetmatrix{#3}% 0 0 (no #5 #6 yet)
+% \box\nextbox
+% \pdfrestore
+% \advance\backendtransformlevel\minusone}}}
+
\unexpanded\def\dotransformnextbox#1#2#3#4#5#6% sx rx ry sy tx ty (will change) / basepoints !
{\advance\backendtransformlevel\plusone
% fixing ht/dp/wd should happen elsewhere
- \dowithnextbox{\dodotransformnextbox{#5}{#6}{#1 #2 #3 #4}}}
+ \dowithnextbox{\dodotransformnextbox{#5}{#6}{#1}{#2}{#3}{#4}}}
-\unexpanded\def\dodotransformnextbox#1#2#3%
+\unexpanded\def\dodotransformnextbox#1#2#3#4#5#6%
{\hbox
{\kern#1\onebasepoint
\raise#2\onebasepoint\hbox
- {\pdfsave
- \pdfsetmatrix{#3}% 0 0 (no #5 #6 yet)
+ {\ctxcommand{pdfstartmatrix(#3,#4,#5,#6)}
\box\nextbox
- \pdfrestore
+ \ctxcommand{pdfstopmatrix()}
\advance\backendtransformlevel\minusone}}}
\unexpanded\def\dostartclipping#1#2#3% we can move this to lua and only set a box here
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 2453d4f0b..62db62acc 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.07.31 20:23}
+\newcontextversion{2013.08.01 01:31}
%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 82afc8c2b..040863fbb 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 381d2a258..62a65a81c 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.07.31 20:23}
+\edef\contextversion{2013.08.01 01:31}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index 903c91f34..22b92c38a 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -20,6 +20,7 @@ if not modules then modules = { } end modules ['math-noa'] = {
local utfchar, utfbyte = utf.char, utf.byte
local formatters = string.formatters
+local div = math.div
local fonts, nodes, node, mathematics = fonts, nodes, node, mathematics
@@ -818,6 +819,7 @@ trackers.register("math.italics", function(v)
if k > 0 then
return setcolor(new_rule(k,ex,ex),c_positive_d)
else
+ -- influences un*
return old_kern(k) .. setcolor(new_rule(-k,ex,ex),c_negative_d) .. old_kern(k)
end
end
@@ -1001,6 +1003,49 @@ function handlers.variants(head,style,penalties)
return true
end
+-- for manuals
+
+local classes = { }
+
+local colors = {
+ [noadcodes.rel] = "trace:dr",
+ [noadcodes.ord] = "trace:db",
+ [noadcodes.bin] = "trace:dg",
+ [noadcodes.open] = "trace:dm",
+ [noadcodes.close] = "trace:dm",
+ [noadcodes.punct] = "trace:dc",
+ -- [noadcodes.opdisplaylimits] = "",
+ -- [noadcodes.oplimits] = "",
+ -- [noadcodes.opnolimits] = "",
+ -- [noadcodes.inner = "",
+ -- [noadcodes.under = "",
+ -- [noadcodes.over = "",
+ -- [noadcodes.vcenter = "",
+}
+
+classes[math_char] = function(pointer,what,n,parent)
+ local color = colors[getsubtype(parent)]
+ if color then
+ setcolor(pointer,color)
+ else
+ resetcolor(pointer)
+ end
+end
+
+function handlers.classes(head,style,penalties)
+ processnoads(head,classes,"classes")
+ return true
+end
+
+trackers.register("math.classes",function(v)
+ if v then
+ tasks.enableaction("math", "noads.handlers.classes")
+ else
+ tasks.disableaction("math", "noads.handlers.classes")
+ end
+end)
+
+
-- the normal builder
function builders.kernel.mlist_to_hlist(head,style,penalties)
diff --git a/tex/context/base/math-rad.mkvi b/tex/context/base/math-rad.mkvi
index 386b1deaf..b9d4021c3 100644
--- a/tex/context/base/math-rad.mkvi
+++ b/tex/context/base/math-rad.mkvi
@@ -222,11 +222,12 @@
\edef\overlaylinewidth{\the\linewidth}%
\edef\overlaylinecolor{\mathornamentparameter\c!color}%
\edef\p_mp{\mathornamentparameter\c!mp}%
+ % thw width of the graphic determines the width of the final result
\setbox\scratchbox\hbox{\uniqueMPgraphic{\p_mp}}% todo: add code key + tag
\scratchdimen \wd\scratchbox
- \scratchtopoffset \dimexpr\scratchoffset+\dp\nextbox\relax
- \scratchbottomoffset\dimexpr\scratchoffset+\ht\nextbox/2\relax
- \hbox to \scratchdimen{\hss\box\nextbox\hskip\scratchoffset}%
+ % \scratchtopoffset \dimexpr\scratchoffset+\dp\nextbox\relax
+ % \scratchbottomoffset\dimexpr\scratchoffset+\ht\nextbox/2\relax
+ \hbox to \scratchdimen{\hss\box\nextbox\hss}%
\hskip-\scratchdimen
\box\scratchbox
\endgroup}
@@ -261,6 +262,7 @@
% rotated 30
% withcolor
% OverlayLineColor ;
+% draw boundingbox currentpicture;
% \stopuniqueMPgraphic
%
% \definemathornament [mathhat] [mp=math:ornament:hat]
diff --git a/tex/context/base/s-inf-03.pdf b/tex/context/base/s-inf-03.pdf
index b0aaf6733..d4a4816b9 100644
--- a/tex/context/base/s-inf-03.pdf
+++ b/tex/context/base/s-inf-03.pdf
Binary files differ
diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua
index de3a1f1e8..7bca7e8a1 100644
--- a/tex/context/base/spac-ver.lua
+++ b/tex/context/base/spac-ver.lua
@@ -95,6 +95,7 @@ local hlist_code = nodecodes.hlist
local vlist_code = nodecodes.vlist
local whatsit_code = nodecodes.whatsit
+local texnest = tex.nest
local vspacing = builders.vspacing or { }
builders.vspacing = vspacing
@@ -785,8 +786,17 @@ function vspacing.snapbox(n,how)
end
end
+-- I need to figure out how to deal with the prevdepth that crosses pages. In fact,
+-- prevdepth is often quite interfering (even over a next paragraph) so I need to
+-- figure out a trick.
+
local function forced_skip(head,current,width,where,trace)
- if where == "after" then
+ if head == current and head.subtype == baselineskip_code then
+ width = width - head.spec.width
+ end
+ if width == 0 then
+ -- do nothing
+ elseif where == "after" then
head, current = insert_node_after(head,current,new_rule(0,0,0))
head, current = insert_node_after(head,current,new_kern(width))
head, current = insert_node_after(head,current,new_rule(0,0,0))
@@ -1176,6 +1186,7 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also
else
head, tail = insert_node_after(head,tail,glue_data)
end
+texnest[texnest.ptr].prevdepth = 0 -- appending to the list bypasses tex's prevdepth handler
end
if trace then
if glue_data or penalty_data then
@@ -1282,6 +1293,15 @@ function vspacing.collapsevbox(n) -- for boxes but using global a_snapmethod
end
end
+-- This one is needed to prevent bleeding of prevdepth to the next page
+-- which doesn't work well with forced skips.
+
+local outer = texnest[0]
+
+function vspacing.resetprevdepth()
+ outer.prevdepth = 0
+end
+
-- interface
commands.vspacing = vspacing.analyze
@@ -1289,3 +1309,4 @@ commands.vspacingsetamount = vspacing.setskip
commands.vspacingdefine = vspacing.setmap
commands.vspacingcollapse = vspacing.collapsevbox
commands.vspacingsnap = vspacing.snapbox
+commands.resetprevdepth = vspacing.resetprevdepth
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 035c411ba..92672c688 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.log b/tex/context/base/status-lua.log
index 3ad484d9b..f1172b533 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.07.31 20:23 MKIV beta fmt: 2013.7.31 int: english/english
+ConTeXt ver: 2013.08.01 01:31 MKIV beta fmt: 2013.8.1 int: english/english
system > 'cont-new.mkiv' loaded
(cont-new.mkiv)
@@ -75,4 +75,4 @@ references > unknown reference '[][mathematics]'
references > unknown reference '[][mbox]'
references > unknown reference '[][md5]'
references > unknown reference '[][metapost]'
-references > unknown reference '[][mime]' \ No newline at end of file
+references > unknown reference '[][mime]'
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 621b9ae0b..146ba3655 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/31/13 20:23:22
+-- merge date : 08/01/13 01:31:02
do -- begin closure to overcome local limits and interference