summaryrefslogtreecommitdiff
path: root/tex/context
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-08-01 11:38:58 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-08-01 11:38:58 +0200
commit665f9095475ffcd1c8750546727c75e5486a266f (patch)
tree347186e688c8435eed7fcdff0052e6ae1272964d /tex/context
parent5135aef167bec739fe429e1aa987671768b237bc (diff)
downloadcontext-665f9095475ffcd1c8750546727c75e5486a266f.tar.gz
2016-08-01 10:54:00
Diffstat (limited to 'tex/context')
-rw-r--r--tex/context/base/context-version.pdfbin4253 -> 4262 bytes
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-mps.lua230
-rw-r--r--tex/context/base/mkiv/grph-con.lua5
-rw-r--r--tex/context/base/mkiv/meta-imp-outlines.mkiv56
-rw-r--r--tex/context/base/mkiv/mult-fun.lua2
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin9238 -> 9127 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin368500 -> 368501 bytes
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin774744 -> 774404 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60787 -> 60792 bytes
11 files changed, 156 insertions, 141 deletions
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index f97738e16..0c4892500 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 5e4e0bb15..4c8aa9228 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2016.07.30 00:26}
+\newcontextversion{2016.08.01 10:49}
%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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 6b102e801..d0d438996 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -39,7 +39,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2016.07.30 00:26}
+\edef\contextversion{2016.08.01 10:49}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-mps.lua b/tex/context/base/mkiv/font-mps.lua
index 42e8e704b..d56c25731 100644
--- a/tex/context/base/mkiv/font-mps.lua
+++ b/tex/context/base/mkiv/font-mps.lua
@@ -21,8 +21,6 @@ fonts = fonts or { }
local metapost = fonts.metapost or { }
fonts.metapost = metapost
-local trace_skips = false trackers.register("metapost.outlines.skips",function(v) trace_skips = v end)
-
local f_moveto = formatters["(%F,%F)"]
local f_lineto = formatters["--(%F,%F)"]
local f_curveto = formatters["..controls(%F,%F)and(%F,%F)..(%F,%F)"]
@@ -238,38 +236,46 @@ function metapost.maxbounds(data,index,factor)
)
end
------ formatters = string.formatters
------ concat = table.concat
+-- This is a nice example of tex, metapost and lua working in tandem. Each kicks in at the
+-- right time. It's probably why I like watching https://www.youtube.com/watch?v=c5FqpddnJmc
+-- so much: precisely (and perfectly) timed too.
+
+local nodecodes = nodes.nodecodes -- no nuts yet
-local nodecodes = nodes.nodecodes -- no nuts yet
+local glyph_code = nodecodes.glyph
+local disc_code = nodecodes.disc
+local kern_code = nodecodes.kern
+local glue_code = nodecodes.glue
+local hlist_code = nodecodes.hlist
+local vlist_code = nodecodes.vlist
+local rule_code = nodecodes.rule
-local glyph_code = nodecodes.glyph
-local disc_code = nodecodes.disc
-local kern_code = nodecodes.kern
-local glue_code = nodecodes.glue
-local hlist_code = nodecodes.hlist
-local vlist_code = nodecodes.vlist
-local rule_code = nodecodes.rule
+local normal_rule = nodes.rulecodes.normal
-local find_tail = nodes.tail
+local nuts = nodes.nuts
+local getnext = nuts.getnext
+local getid = nuts.getid
+local getlist = nuts.getlist
+local getchar = nuts.getchar
+local getfont = nuts.getfont
+local getsubtype = nuts.getsubtype
+local getfield = nuts.getfield
+local getbox = nuts.getbox
------ metapost = fonts.glyphs.metapost
+local effective_glue = nuts.effective_glue
-local characters = fonts.hashes.characters
-local parameters = fonts.hashes.parameters
-local shapes = fonts.hashes.shapes
-local topaths = metapost.paths
+local characters = fonts.hashes.characters
+local parameters = fonts.hashes.parameters
+local shapes = fonts.hashes.shapes
+local topaths = metapost.paths
-local f_code = formatters["mfun_do_outline_text_flush(%q,%i,%F,%F)(%,t);"]
-local s_nothing = "(origin scaled 10)"
-local f_trace_rule = formatters["draw rule(%F,%F,%F) shifted (%F,%F) withcolor .5white;"]
-local f_strut = formatters["strut(%F,%F);"]
-local f_hrule = formatters["draw rule(%F,%F,%F);"]
-local f_vrule = formatters["draw rule(%F,%F,%F) shifted (%F,%F);"]
-local f_bounds = formatters["checkbounds(%F,%F,%F,%F);"]
+local f_code = formatters["mfun_do_outline_text_flush(%q,%i,%F,%F)(%,t);"]
+local f_rule = formatters["mfun_do_outline_rule_flush(%q,%F,%F,%F,%F);"]
+local f_bounds = formatters["checkbounds(%F,%F,%F,%F);"]
+local s_nothing = "(origin scaled 10)"
-local sc = 10
-local fc = number.dimenfactors.bp * sc / 10
+local sc = 10
+local fc = number.dimenfactors.bp * sc / 10
-- todo: make the next more efficient:
@@ -284,8 +290,7 @@ function metapost.output(kind,font,char,advance,shift,ex)
local glyf = glyphs[index]
if glyf then
local units = shapedata.units or 1000
- local yfactor = sc/units
-yfactor = yfactor * parameters[font].factor / 655.36
+ local yfactor = (sc/units) * parameters[font].factor / 655.36
local xfactor = yfactor
local shift = shift or 0
local advance = advance or 0
@@ -317,131 +322,114 @@ function fonts.metapost.boxtomp(n,kind)
local llx, lly, urx, ury = 0, 0, 0, 0
- local boxtomp
+ local horizontal, vertical
- local function horizontal(current,shift,glue_sign,glue_set,glue_order,ht,dp)
- shift = shift or 0
+ horizontal = function(parent,current,xoffset,yoffset)
+ local dx = 0
while current do
- local id = current.id
+ local id = getid(current)
if id == glyph_code then
- local code, width = metapost.output(kind,current.font,current.char,advance,-shift*fc,current.expansion_factor)
+ local code, width = metapost.output(kind,getfont(current),getchar(current),xoffset+dx,yoffset,getfield(current,"expansion_factor"))
result[#result+1] = code
- advance = advance + width
+ dx = dx + width
elseif id == disc_code then
- local replace = current.replace
+ local replace = getfield(current,"replace")
if replace then
- horizontal(replace,shift,glue_sign,glue_set,glue_order,ht,dp)
+ dx = dx + horizontal(parent,replace,xoffset+dx,yoffset)
end
elseif id == kern_code then
- local kern = current.kern * 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
+ dx = dx + getfield(current,"kern") * fc
elseif id == glue_code then
- local width = current.width
- if glue_sign == 1 then
- if current.stretch_order == glue_order then
- width = (width + current.stretch * glue_set) * fc
- else
- width = width * fc
- end
- elseif glue_sign == 2 then
- if current.shrink_order == glue_order then
- width = (width - current.shrink * glue_set) * fc
- else
- width = width * fc
- end
- else
- width = width * fc
- end
- 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
+ dx = dx + effective_glue(current,parent) * fc
elseif id == hlist_code then
- local a = advance
- boxtomp(current,shift+current.shift,current.glue_sign,current.glue_set,current.glue_order)
- advance = a + current.width * fc
+ local list = getlist(current)
+ if list then
+ horizontal(current,list,xoffset+dx,yoffset-getfield(current,"shift")*fc)
+ end
+ dx = dx + getfield(current,"width") * fc
elseif id == vlist_code then
- boxtomp(current) -- ,distance + shift,current.glue_set*current.glue_sign)
- advance = advance + current.width * fc
+ local list = getlist(current)
+ if list then
+ vertical(current,list,xoffset+dx,yoffset-getfield(current,"shift")*fc)
+ end
+ dx = dx + getfield(current,"width") * fc
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
- ht = ht - shift
- dp = dp - shift
- if wd == 0 then
- result[#result+1] = f_strut(ht*fc,-dp*fc)
- else
- result[#result+1] = f_hrule(wd*fc,ht*fc,-dp*fc)
+ local wd = getfield(current,"width") * fc
+ if wd ~= 0 then
+ local ht = getfield(current,"height")
+ local dp = getfield(current,"depth")
+ if ht == signal then
+ ht = getfield(parent,"height")
end
- end
- if wd ~= signal then
- advance = advance + wd * fc
+ if dp == signal then
+ dp = getfield(parent,"depth")
+ end
+ local hd = (ht + dp) * fc
+ if hd ~= 0 and getsubtype(current) == normal_rule then
+ result[#result+1] = f_rule(kind,xoffset+dx+wd/2,yoffset+hd/2,wd,hd)
+ end
+ dx = dx + wd
end
end
- current = current.next
+ current = getnext(current)
end
+ return dx
end
- local function vertical(current,shift)
- shift = shift or 0
- current = find_tail(current) -- otherwise bad bbox
+ vertical = function(parent,current,xoffset,yoffset)
+ local dy = getfield(parent,"height") * fc
while current do
- local id = current.id
+ local id = getid(current)
if id == hlist_code then
- distance = distance - current.depth
- boxtomp(current,distance + shift,current.glue_set*current.glue_sign)
- distance = distance - current.height
+ dy = dy - getfield(current,"height") * fc
+ local list = getlist(current)
+ if list then
+ horizontal(current,list,xoffset+getfield(current,"shift")*fc,yoffset+dy)
+ end
+ dy = dy - getfield(current,"depth") * fc
elseif id == vlist_code then
- print("vertical >>>")
- vertical(current.list,0)
+ dy = dy - getfield(current,"height") * fc
+ local list = getlist(current)
+ if list then
+ vertical(current,list,xoffset+getfield(current,"shift")*fc,yoffset+dy)
+ end
+ dy = dy - getfield(current,"depth") * fc
elseif id == kern_code then
- distance = distance - current.kern
- advance = 0
+ dy = dy - getfield(current,"kern") * fc
elseif id == glue_code then
- distance = distance - current.width
- advance = 0
+ dy = dy - effective_glue(current,parent) * fc
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)
+ local ht = getfield(current,"height")
+ local dp = getfield(current,"depth")
+ local hd = (ht + dp) * fc
+ if hd ~= 0 then
+ local wd = getfield(current,"width")
+ if wd == signal then
+ wd = getfield(parent,"width") * fc
else
- result[#result+1] = f_vrule(wd*fc,ht*fc,-dp*fc,0,distance+shift)
+ wd = wd * fc
end
- distance = distance - ht
+ dy = dy - ht * fc
+ if wd ~= 0 and getsubtype(current) == 0 then
+ result[#result+1] = f_rule(kind,xoffset+wd/2,yoffset+dy+hd/2,wd,hd)
+ end
+ dy = dy - dp * fc
end
end
- current = current.prev
+ current = getnext(current)
end
+ return dy
end
- boxtomp = function(list,shift)
- local current = list.list
- if current then
- if list.id == hlist_code then
- horizontal(current,shift,list.glue_sign,list.glue_set,list.glue_order,list.height,list.depth)
- else
- vertical(current,shift)
- end
- end
+ local box = getbox(n)
+ local list = box and getlist(box)
+ if list then
+ (getid(box) == hlist_code and horizontal or vertical)(box,list,0,0)
end
- local box = tex.box[n]
-
- boxtomp(box,box.shift,box.glue_sign,box.glue_set,box.glue_order)
-
- local wd = box.width
- local ht = box.height
- local dp = box.depth
- local sh = box.shift
+ local wd = getfield(box,"width")
+ local ht = getfield(box,"height")
+ local dp = getfield(box,"depth")
result[#result+1] = f_bounds(0,-dp*fc,wd*fc,ht*fc)
diff --git a/tex/context/base/mkiv/grph-con.lua b/tex/context/base/mkiv/grph-con.lua
index 7cff26d10..380f56b14 100644
--- a/tex/context/base/mkiv/grph-con.lua
+++ b/tex/context/base/mkiv/grph-con.lua
@@ -173,14 +173,15 @@ do -- svg
local svgconverter = converters.svg
converters.svgz = svgconverter
- -- inkscape on windows only works with complete paths .. did the command line arguments change again?
+ -- inkscape on windows only works with complete paths .. did the command line
+ -- arguments change again? Ok, it's weirder, with -A then it's a name only when
+ -- not . (current)
programs.inkscape = {
command = "inkscape",
pdfargument = longtostring [[
"%oldname%"
--export-dpi=600
- -A
--export-pdf="%newname%"
]],
pngargument = longtostring [[
diff --git a/tex/context/base/mkiv/meta-imp-outlines.mkiv b/tex/context/base/mkiv/meta-imp-outlines.mkiv
index 7d7495037..ab6fcdd3d 100644
--- a/tex/context/base/mkiv/meta-imp-outlines.mkiv
+++ b/tex/context/base/mkiv/meta-imp-outlines.mkiv
@@ -18,8 +18,8 @@ local formatters = string.formatters
local validstring = string.valid
local f_setbounds = formatters["setbounds currentpicture to (%s) enlarged %.4G;"]
-local f_index = formatters['draw anchored.bot(textext("\\tttf\\setstrut\\strut index %i") ysized 2bp ,.5[llcorner currentpicture,lrcorner currentpicture] shifted (0,%.4G));']
-local f_unicode = formatters['draw anchored.bot(textext("\\tttf\\setstrut\\strut unicode %05X") ysized 2bp ,.5[llcorner currentpicture,lrcorner currentpicture] shifted (0,%.4G));']
+local f_index = formatters['draw anchored.bot(textext("\\tttf\\setstrut\\strut index %i") ysized 10bp ,.5[llcorner currentpicture,lrcorner currentpicture] shifted (0,%.4G));']
+local f_unicode = formatters['draw anchored.bot(textext("\\tttf\\setstrut\\strut unicode %05X") ysized 10bp ,.5[llcorner currentpicture,lrcorner currentpicture] shifted (0,%.4G));']
local f_in_red = formatters["draw %s withpen pencircle scaled .15 withcolor .5red;"]
local f_in_green = formatters["draw %s withpen pencircle scaled .15 withcolor .5green;"]
@@ -43,6 +43,12 @@ local v_all = variables.all
local v_page = variables.page
local v_text = variables.text
local v_command = variables.command
+local v_box = variables.box
+local v_width = variables.width
+local v_min = variables.min
+local v_max = variables.max
+local v_comment = variables.comment
+local v_simple = variables.simple
function metapost.showglyph(specification)
local fontid = font.current()
@@ -53,7 +59,8 @@ function metapost.showglyph(specification)
local index = validstring(specification.index)
local alternative = validstring(specification.alternative)
local command = validstring(specification.command)
-
+ local options = utilities.parsers.settings_to_set(specification.option)
+ local all = not next(options) and not options[v_simple] or options[v_all]
local function shape(index,what,f_comment)
if not index then
return
@@ -63,15 +70,15 @@ function metapost.showglyph(specification)
local units = data.fontheader and data.fontheader.emsize or 1000
local factor = 100/units
local paths = metapost.paths(glyph,factor)
- if #paths > 0 then
+ if #paths > 0 and glyph.boundingbox and glyph.width then
local graphic = f_glyph(concat{
- f_in_gray(metapost.fill(paths)),
- metapost.draw(paths,true), -- true triggers trace
- f_in_red(metapost.boundingbox(glyph,factor)),
- f_in_green(metapost.widthline(glyph,factor)),
- f_in_blue(metapost.zeroline(glyph,factor)),
- f_setbounds(metapost.maxbounds(data,index,factor),offset or 1),
- f_comment(what,1)
+ f_in_gray (metapost.fill(paths)),
+ metapost.draw(paths,true), -- true triggers trace
+ (all or options[v_box]) and f_in_red (metapost.boundingbox(glyph,factor)) or "",
+ (all or options[v_width]) and f_in_green (metapost.widthline(glyph,factor)) or "",
+ (all or options[v_min]) and f_in_blue (metapost.zeroline(glyph,factor)) or "",
+ (all or options[v_max]) and f_setbounds(metapost.maxbounds(data,index,factor),offset or 1) or "",
+ (all or options[v_comment]) and f_comment (what,1) or "",
})
if alternative == v_page then
context.startMPpage()
@@ -110,7 +117,7 @@ function metapost.showglyph(specification)
end
local first, last
if type(index) == "string" then
- first, last = string.match(index,"^(.-):(.*)$")
+ first, last = string.split(index,":")
if first and last then
first = tonumber(first)
last = tonumber(last)
@@ -137,17 +144,25 @@ end
\unprotect
+% option: box|width|min|max|comment
+
\unexpanded\def\showshape
{\dosingleargument\meta_shapes_show}
\def\meta_shapes_show[#1]%
{\begingroup
- \getdummyparameters[\c!alternative=\v!text,#1]%
+ \letdummyparameter\c!index\empty
+ \letdummyparameter\c!character\empty
+ \letdummyparameter\c!alternative\v!text
+ \letdummyparameter\c!command\empty
+ \letdummyparameter\c!option\v!all
+ \getdummyparameters[#1]%
\ctxlua{fonts.metapost.showglyph{
character = "\dummyparameter\c!character",
index = "\dummyparameter\c!index",
alternative = "\dummyparameter\c!alternative",
command = "\dummyparameter\c!command",
+ option = "\dummyparameter\c!option",
}}%
\endgroup}
@@ -164,8 +179,19 @@ end
% \setupbodyfont[pagella]
% \showshape[character=all,alternative=page]
-\setupbodyfont[dejavu]
-\showshape[character=P,alternative=text]
+\usemodule[art-01]
+
+\startcombination[3*1]
+ {\ruledhbox{\startMPcode draw textext("\showshape[character=a]") ; \stopMPcode}} {}
+ {\ruledhbox{\startMPcode draw textext("\showshape[character=x]") ; \stopMPcode}} {}
+ {\ruledhbox{\showshape[character=P,alternative=text]}} {}
+\stopcombination
+
+\startcombination[3*1]
+ {\ruledhbox{\startMPcode draw textext("\showshape[character=a,option={simple}]") ; \stopMPcode}} {}
+ {\ruledhbox{\startMPcode draw textext("\showshape[character=x,option={simple}]") ; \stopMPcode}} {}
+ {\ruledhbox{\showshape[character=P,alternative=text,option=simple]}} {}
+\stopcombination
% \definedfont[almfixed]
% \showshape[character=all,alternative=page]
diff --git a/tex/context/base/mkiv/mult-fun.lua b/tex/context/base/mkiv/mult-fun.lua
index 1a083e366..c6d321949 100644
--- a/tex/context/base/mkiv/mult-fun.lua
+++ b/tex/context/base/mkiv/mult-fun.lua
@@ -30,7 +30,7 @@ return {
"tcircle", "bcircle", "lcircle", "rcircle",
"lltriangle", "lrtriangle", "urtriangle", "ultriangle",
"uptriangle", "downtriangle", "lefttriangle", "righttriangle", "triangle",
- "smoothed", "cornered", "superellipsed", "randomized", "squeezed", "enlonged", "shortened",
+ "smoothed", "cornered", "superellipsed", "randomized", "randomizedcontrols", "squeezed", "enlonged", "shortened",
"punked", "curved", "unspiked", "simplified", "blownup", "stretched",
"enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged",
"crossed", "laddered", "randomshifted", "interpolated", "paralleled", "cutends", "peepholed",
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 88085d831..6df820770 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index a5db281ed..879c87379 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index 73add297a..9b63690fc 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index a3c7158cb..c08e5822a 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ