summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/modules/mkiv')
-rw-r--r--tex/context/modules/mkiv/m-asymptote.lua2
-rw-r--r--tex/context/modules/mkiv/m-asymptote.mkiv58
-rw-r--r--tex/context/modules/mkiv/m-chart.lua17
-rw-r--r--tex/context/modules/mkiv/m-chart.mkvi7
-rw-r--r--tex/context/modules/mkiv/m-format.mkiv4
-rw-r--r--tex/context/modules/mkiv/m-matrix.mkiv153
-rw-r--r--tex/context/modules/mkiv/m-maybe.mkiv57
-rw-r--r--tex/context/modules/mkiv/m-old-columnsets.mkiv7
-rw-r--r--tex/context/modules/mkiv/m-old-multicolumns.mkiv7
-rw-r--r--tex/context/modules/mkiv/m-oldfun.mkiv4
-rw-r--r--tex/context/modules/mkiv/m-oldnum.mkiv25
-rw-r--r--tex/context/modules/mkiv/m-punk.mkiv27
-rw-r--r--tex/context/modules/mkiv/m-scite.mkiv36
-rw-r--r--tex/context/modules/mkiv/m-units.mkiv14
-rw-r--r--tex/context/modules/mkiv/ppchtex.mkiv8
-rw-r--r--tex/context/modules/mkiv/s-article-basic.mkiv19
-rw-r--r--tex/context/modules/mkiv/s-article-titlepage.mkiv65
-rw-r--r--tex/context/modules/mkiv/s-article-titletop.mkiv68
-rw-r--r--tex/context/modules/mkiv/s-cgj.mkiv714
-rw-r--r--tex/context/modules/mkiv/s-evohome.mkiv16
-rw-r--r--tex/context/modules/mkiv/s-fonts-basics.mkiv2
-rw-r--r--tex/context/modules/mkiv/s-fonts-charts.mkiv70
-rw-r--r--tex/context/modules/mkiv/s-fonts-complete.mkiv119
-rw-r--r--tex/context/modules/mkiv/s-fonts-effects.mkiv59
-rw-r--r--tex/context/modules/mkiv/s-fonts-features.lua173
-rw-r--r--tex/context/modules/mkiv/s-fonts-features.mkiv1
-rw-r--r--tex/context/modules/mkiv/s-fonts-shapes.lua380
-rw-r--r--tex/context/modules/mkiv/s-fonts-shapes.mkiv21
-rw-r--r--tex/context/modules/mkiv/s-fonts-statistics.mkiv80
-rw-r--r--tex/context/modules/mkiv/s-fonts-system.lua274
-rw-r--r--tex/context/modules/mkiv/s-fonts-system.mkiv17
-rw-r--r--tex/context/modules/mkiv/s-fonts-tables.lua655
-rw-r--r--tex/context/modules/mkiv/s-fonts-tables.mkiv22
-rw-r--r--tex/context/modules/mkiv/s-fonts-variable.mkiv30
-rw-r--r--tex/context/modules/mkiv/s-languages-hyphenation.lua7
-rw-r--r--tex/context/modules/mkiv/s-languages-system.lua2
-rw-r--r--tex/context/modules/mkiv/s-maps.mkiv8
-rw-r--r--tex/context/modules/mkiv/s-present-dark.mkiv357
-rw-r--r--tex/context/modules/mkiv/s-present-steps.mkiv177
-rw-r--r--tex/context/modules/mkiv/s-references-identify.mkiv69
-rw-r--r--tex/context/modules/mkiv/s-xml-analyzers.lua6
-rw-r--r--tex/context/modules/mkiv/s-youless.mkiv60
-rw-r--r--tex/context/modules/mkiv/x-asciimath.lua24
-rw-r--r--tex/context/modules/mkiv/x-mathml.mkiv2
-rw-r--r--tex/context/modules/mkiv/x-setups-basics.mkiv19
-rw-r--r--tex/context/modules/mkiv/x-setups-overview.mkiv9
46 files changed, 3309 insertions, 642 deletions
diff --git a/tex/context/modules/mkiv/m-asymptote.lua b/tex/context/modules/mkiv/m-asymptote.lua
index de8d032c8..39a0d987b 100644
--- a/tex/context/modules/mkiv/m-asymptote.lua
+++ b/tex/context/modules/mkiv/m-asymptote.lua
@@ -1,6 +1,6 @@
if not modules then modules = { } end modules ['m-asymptote'] = {
version = 1.001,
- comment = "companion to m-pstricks.mkiv",
+ comment = "companion to m-asymptote.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
diff --git a/tex/context/modules/mkiv/m-asymptote.mkiv b/tex/context/modules/mkiv/m-asymptote.mkiv
index c236ceee5..9cd4037fb 100644
--- a/tex/context/modules/mkiv/m-asymptote.mkiv
+++ b/tex/context/modules/mkiv/m-asymptote.mkiv
@@ -76,51 +76,51 @@
\starttext
\startasymptote[demo-1]
-settings.prc=true;
+settings.prc = true ;
-import graph3;
-import palette;
+import graph3 ;
+import palette ;
-size(6cm,6cm);
-size3(5cm,0);
+size(6cm,6cm) ;
+size3(5cm,0) ;
-currentprojection=orthographic(3,-6,12);
-currentlight=light(8,10,2);
+currentprojection = orthographic(3,-6,12) ;
+currentlight = light(8,10,2) ;
-real g(pair z) {return 1-z.x^2-z.y^2;}
-real f(pair z) {return -2z.x+2;}
+real g(pair z) { return 1-z.x^2-z.y^2 ; }
+real f(pair z) { return -2z.x+2 ; }
-real x(real t) {return t;}
-real y(real t) {return 0;}
-real z(real t) {return 1-t^2;}
-real a(real t) {return 1;}
-real b(real t) {return t;}
-real c(real t) {return -t^2;}
+real x(real t) { return t ; }
+real y(real t) { return 0 ; }
+real z(real t) { return 1-t^2 ; }
+real a(real t) { return 1 ; }
+real b(real t) { return t ; }
+real c(real t) { return -t^2 ; }
-path3 p=graph(x,y,z,-2,2,operator ..);
-path3 o=graph(a,b,c,-2,2,operator ..);
+path3 p=graph(x,y,z,-2,2,operator ..) ;
+path3 o=graph(a,b,c,-2,2,operator ..) ;
-surface r=surface(f,(0,-1),(2,1),nx=3,Spline);
-surface s=surface(g,(-2,-2),(2,2),nx=5,Spline);
+surface r = surface(f, (0,-1), (2,1), nx = 3, Spline) ;
+surface s = surface(g, (-2,-2), (2,2), nx = 5, Spline) ;
-path3 q=(-2,-2,-7)--(2,-2,-7)--(2,2,-7)--(-2,2,-7)--cycle;
+path3 q = (-2,-2,-7) -- (2,-2,-7) -- (2,2,-7) -- (-2,2,-7) -- cycle ;
-draw(q);
+draw(q) ;
-draw(p,blue+thick(),Arrow3);
-draw(o,blue+thick(),Arrow3);
+draw(p, blue+thick(), Arrow3) ;
+draw(o, blue+thick(), Arrow3) ;
-draw(s,lightgray+opacity(0.8),nolight,meshpen=black+thick());
-draw(r,lightgray+opacity(0.8),nolight,meshpen=black+thick());
+draw(s, lightgray + opacity(0.8), nolight, meshpen = black + thick()) ;
+draw(r, lightgray + opacity(0.8), nolight, meshpen = black + thick()) ;
-draw((1,0,0)--(2,0,-2),black,Arrow3);
-draw((1,0,0)--(1,1,0),black,Arrow3);
+draw((1,0,0) -- (2,0,-2), black, Arrow3) ;
+draw((1,0,0) -- (1,1,0), black, Arrow3) ;
\stopasymptote
\startasymptote[demo-2]
-size(6cm,6cm);
+size(6cm,6cm) ;
-fill((1cm,2cm)--(3cm,3cm)--(4cm,0cm)--cycle);
+fill((1cm,2cm) -- (3cm,3cm) -- (4cm,0cm) -- cycle);
\stopasymptote
% see end of grph-inc.mkiv for some more options:
diff --git a/tex/context/modules/mkiv/m-chart.lua b/tex/context/modules/mkiv/m-chart.lua
index bcf80bdfc..cde563fb3 100644
--- a/tex/context/modules/mkiv/m-chart.lua
+++ b/tex/context/modules/mkiv/m-chart.lua
@@ -926,18 +926,16 @@ local function getchart(settings,forced_x,forced_y,forced_nx,forced_ny)
return chart
end
-local function makechart(chart)
+local function makechart_indeed(chart)
local settings = chart.settings
local chartsettings = settings.chart
--
- context.begingroup()
- context.forgetall()
- --
local g = ctx_startgraphic {
instance = "metafun",
format = "metafun",
method = "scaled",
definitions = "",
+ wrapped = true,
}
--
ctx_tographic(g,"if unknown context_flow : input mp-char.mpiv ; fi ;")
@@ -1012,7 +1010,16 @@ local function makechart(chart)
ctx_tographic(g,"flow_end_chart ;")
ctx_stopgraphic(g)
--
- context.endgroup()
+end
+
+-- We need to wrap because of tex.runtoks!
+
+local function makechart(chart)
+ context.hbox()
+ context.bgroup()
+ context.forgetall()
+ context(function() makechart_indeed(chart) end)
+ context.egroup()
end
local function splitchart(chart)
diff --git a/tex/context/modules/mkiv/m-chart.mkvi b/tex/context/modules/mkiv/m-chart.mkvi
index 0463e4acd..4c5ea7e02 100644
--- a/tex/context/modules/mkiv/m-chart.mkvi
+++ b/tex/context/modules/mkiv/m-chart.mkvi
@@ -185,11 +185,14 @@
{\dodoubleempty\module_charts_process}
\def\module_charts_process[#name][#settings]%
- {\bgroup % \vbox removed
+% {\hpack\bgroup % \vbox removed, \hpack prevents issues with tex.runtoks
+ {\bgroup % \vbox removed, \hpack prevents issues with tex.runtoks
\insidefloattrue
\dontcomplain
\setupFLOWchart[#settings]%
\usebodyfontparameter\FLOWchartparameter
+% \meta_process_graphic_start
+% \meta_start_current_graphic
\clf_flow_make_chart
chart {
name {#name}
@@ -248,6 +251,8 @@
after {}
}
\relax
+% \meta_stop_current_graphic
+% \meta_process_graphic_stop
\egroup}
\unexpanded\def\FLOWcharts
diff --git a/tex/context/modules/mkiv/m-format.mkiv b/tex/context/modules/mkiv/m-format.mkiv
index f9dd348a4..3a0a5bebd 100644
--- a/tex/context/modules/mkiv/m-format.mkiv
+++ b/tex/context/modules/mkiv/m-format.mkiv
@@ -217,7 +217,7 @@
\doglobal\newcounter\formatlinesubcounter
\reshapebox
{\doglobal\increment\formatlinesubcounter}
- \global\let\formatlinemaxcounter\formatlinesubcounter
+ \glet\formatlinemaxcounter\formatlinesubcounter
\reshapebox
{\doglobal\decrement\formatlinesubcounter
\ifnum\formatlinesubcounter=\zerocount
@@ -303,7 +303,7 @@
\doglobal\newcounter\formatlinesubcounter
\reshapebox
{\doglobal\increment\formatlinesubcounter}%
- \global\let\formatlinemaxcounter\formatlinesubcounter
+ \glet\formatlinemaxcounter\formatlinesubcounter
\reshapebox
{\doglobal\decrement\formatlinesubcounter
\ifnum\formatlinesubcounter=\zerocount
diff --git a/tex/context/modules/mkiv/m-matrix.mkiv b/tex/context/modules/mkiv/m-matrix.mkiv
index 9cac69672..4a0bd712d 100644
--- a/tex/context/modules/mkiv/m-matrix.mkiv
+++ b/tex/context/modules/mkiv/m-matrix.mkiv
@@ -23,6 +23,8 @@
\startluacode
+local tonumber, type = tonumber, type
+
local settings_to_hash = utilities.parsers.settings_to_hash
local formatters = string.formatters
local copy = table.copy
@@ -114,7 +116,7 @@ function matrix.typeset(m,options)
if type(m[1]) ~= "table" then
m = { copy(m) }
end
- for i=1, #m do
+ for i=1,#m do
local mi = m[i]
for j=1,#mi do
context.NC()
@@ -164,9 +166,11 @@ function matrix.swapcolumns(t, i, j)
return t
end
-matrix.swapC = matrix.swapcolumns
-matrix.swapR = matrix.swaprows
-matrix.swap = matrix.swaprows
+matrix.swapC = matrix.swapcolumns
+matrix.swapR = matrix.swaprows
+matrix.swapcolumns = matrix.swapcolumns
+matrix.swaprows = matrix.swaprows
+matrix.swap = matrix.swaprows
-- replace i-th row with factor * (i-th row)
@@ -299,7 +303,7 @@ local function determinant(m)
end
return s*d
else
- return "error: not a square matrix" -- not context(..)
+ return "error: not a square matrix"
end
end
@@ -371,7 +375,7 @@ matrix.rowEchelon = rowechelon
-- make matrices until its determinant is not 0
-function matrix.make(m,n,low,high) -- m and n swapped
+local function make(m,n,low,high) -- m and n swapped
if not n then
n = 10
end
@@ -401,6 +405,9 @@ function matrix.make(m,n,low,high) -- m and n swapped
end
end
+matrix.make = make
+matrix.makeR = matrix.make
+
-- extract submatrix by using
local function submatrix(t,i,j)
@@ -420,10 +427,11 @@ local function submatrix(t,i,j)
end
matrix.submatrix = submatrix
+matrix.subMatrix = submatrix
-- calculating determinant using Laplace Expansion
-function matrix.laplace(t) -- not sure if this is the most effient but
+local function laplace(t) -- not sure if this is the most effient but
local factors = { 1 } -- it's not used for number crunching anyway
local data = copy(t)
local det = 0
@@ -461,6 +469,8 @@ function matrix.laplace(t) -- not sure if this is the most effient but
return det
end
+matrix.laplace = laplace
+
-- solve the linear equation m X = c
local function solve(m,c)
@@ -518,6 +528,74 @@ end
matrix.inverse = inverse
+-- create zero and identity matrix
+
+local function makeM(k,v)
+ local tt = { }
+ for i=1,k do
+ local temp = { }
+ for j=1,k do
+ temp[j] = 0
+ end
+ tt[i] = temp
+ end
+ if v and v > 0 then
+ for i=1,k do
+ tt[i][i] = 1
+ end
+ end
+ return tt
+end
+
+matrix.makeM = makeM
+matrix.makeidentity = makeM
+matrix.makezero = makeM
+
+-- append the rows of the second matrix to the bottom of the first matrix
+
+local function joinrows(t1, t2)
+ local nt1 = #t1
+ local nt2 = #t2
+ if (nt1*nt2 > 0) and (#t1[1] ~= #t2[1]) then
+ return "error: different number of columns"
+ else
+ for i=1,nt2 do
+ t1[nt1+i] = t2[i]
+ end
+ return t1
+ end
+end
+
+matrix.joinrows = joinrows
+matrix.joinRows = joinrows
+
+-- append the columns of the second matrix to the right of the first matrix
+
+local function joincolumns(t1, t2)
+ local nt1 = #t1
+ local nt2 = #t2
+ if nt1 == 0 then
+ return t2
+ end
+ if nt2 == 0 then
+ return t1
+ end
+ if nt1 ~= nt2 then
+ return "error: different number of rows"
+ end
+ nt3 = #t2[1]
+ for i=1,nt1 do
+ local temp = t2[i]
+ for j= 1, nt3 do
+ insert(t1[i],temp[j])
+ end
+ end
+ return t1
+end
+
+matrix.joincolumns = joincolumns
+matrix.joinColumns = joincolumns
+
\stopluacode
\stopmodule
@@ -570,6 +648,7 @@ document.DemoMatrixC = {
\startbuffer
\ctxmodulematrix{typeset(moduledata.matrix.symbolic("a", "m", "n"))}
+$\qquad\qquad$
\ctxmodulematrix{typeset(moduledata.matrix.symbolic("a", "m", "n", 4, 8))}
\stopbuffer
@@ -581,9 +660,10 @@ document.DemoMatrixC = {
\startbuffer
\startluacode
- moduledata.matrix.typeset(moduledata.matrix.make(4,3, 0,5))
+ moduledata.matrix.typeset(moduledata.matrix.makeR(4,3, 0,5))
context.qquad()
- moduledata.matrix.typeset(moduledata.matrix.make(5,5,-1,5))
+ context("\\qquad")
+ moduledata.matrix.typeset(moduledata.matrix.makeR(5,5,-1,5))
\stopluacode
\stopbuffer
@@ -591,7 +671,7 @@ document.DemoMatrixC = {
\stopsubject
-\startsubject[title={Swap two rows (2 and 4)}]
+\startsubject[title={Swap two rows (ex: 2 and 4)}]
\startbuffer
\startluacode
@@ -605,13 +685,13 @@ document.DemoMatrixC = {
\stopsubject
-\startsubject[title={Swap two columns (2 and 4)}]
+\startsubject[title={Swap two columns (ex: 1 and 3)}]
\startbuffer
\startluacode
moduledata.matrix.typeset(document.DemoMatrixA)
context("$\\qquad \\Rightarrow \\qquad$")
- moduledata.matrix.typeset(moduledata.matrix.swapcolumns(document.DemoMatrixA,2, 4))
+ moduledata.matrix.typeset(moduledata.matrix.swapcolumns(document.DemoMatrixA,1, 3))
\stopluacode
\stopbuffer
@@ -726,7 +806,7 @@ context(moduledata.matrix.inner({ 1, 2, 3 }, { 3, 1, 2, 4 }))
}
moduledata.matrix.typeset(m, {fences="bars"})
context("$\\qquad = \\qquad$")
- moduledata.matrix.determinant(m)
+ context(moduledata.matrix.determinant(m))
\stopluacode
\stopbuffer
@@ -864,4 +944,51 @@ context(moduledata.matrix.inner({ 1, 2, 3 }, { 3, 1, 2, 4 }))
\stopsubject
+\startsubject[title={make matrices(zero, identiry, random}]
+
+\startbuffer
+\startluacode
+ moduledata.matrix.typeset(moduledata.matrix.makeM(3, 0))
+ context.qquad()
+ moduledata.matrix.typeset(moduledata.matrix.makeM(3, 1))
+ context.qquad()
+ moduledata.matrix.typeset(moduledata.matrix.makeR(4,3))
+\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
+
+\stopsubject
+
+\startsubject[title={join rows, join columns}]
+
+\startbuffer
+\startluacode
+ local mat1 = moduledata.matrix.makeR(3, 4)
+ local mat2 = moduledata.matrix.makeR(4, 3)
+
+ context("Appending as columns: ")
+ context.blank()
+ moduledata.matrix.typeset(mat1)
+ context("$\\&$")
+ moduledata.matrix.typeset(mat1)
+ context("\\quad $\\Rightarrow$ \\quad")
+ moduledata.matrix.joinColumns(mat1, mat1)
+ moduledata.matrix.typeset(mat1)
+ context.blank()
+ context("Appending as rows: ")
+ context.blank()
+ moduledata.matrix.typeset(mat2)
+ context("$\\&$")
+ moduledata.matrix.typeset(mat2)
+ context("\\quad $\\Rightarrow$ \\quad")
+ moduledata.matrix.joinRows(mat2, mat2)
+ moduledata.matrix.typeset(mat2)
+\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
+
+\stopsubject
+
\stoptext
diff --git a/tex/context/modules/mkiv/m-maybe.mkiv b/tex/context/modules/mkiv/m-maybe.mkiv
new file mode 100644
index 000000000..d019828f5
--- /dev/null
+++ b/tex/context/modules/mkiv/m-maybe.mkiv
@@ -0,0 +1,57 @@
+%D \module
+%D [ file=m-maybe,
+%D version=2018.07.26,
+%D title=\CONTEXT\ Extra Modules,
+%D subtitle=Maybe some day,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D The code here is not in the core and might never be as it's probably not
+%D of much use and|/|or can interfere.
+
+\unprotect
+
+% \showframe
+% \starttext
+% \tweakpagegoal[-\lineheight]
+% \dorecurse{40}{\inleftmargin{!}\input ward\par}
+% \stoptext
+
+\def\page_scale_text_box_indeed#1%
+ {\scratchheight\ht#1\relax
+ \scratchwidth \wd#1\relax
+ \setbox#1\vpack\bgroup
+ \hpack\bgroup
+ \scale
+ [\c!height=\dimexpr\textheight-\d_page_adapts_delta\relax,
+ \c!width=\scratchwidth]
+ {\box#1}%
+ \egroup
+ \egroup
+ \global\d_page_adapts_delta\zeropoint
+ \glet\page_scale_text_box\gobbleoneargument
+ \ht#1\scratchheight
+ \wd#1\scratchwidth}
+
+\unexpanded\def\tweakpagegoal[#1]%
+ {\ifx\currentoutputroutine\s!singlecolumn
+ \global\d_page_adapts_delta\dimexpr#1\relax
+ \ifdim\d_page_adapts_delta=\zeropoint
+ \glet\page_scale_text_box\gobbleoneargument
+ \else
+ \glet\page_scale_text_box\page_scale_text_box_indeed
+ \fi
+ \else
+ \global\d_page_adapts_delta\zeropoint
+ \glet\page_scale_text_box\gobbleoneargument
+ \fi
+ \page_otr_command_set_vsize}
+
+\protect
+
+\endinput
diff --git a/tex/context/modules/mkiv/m-old-columnsets.mkiv b/tex/context/modules/mkiv/m-old-columnsets.mkiv
new file mode 100644
index 000000000..d840cbc91
--- /dev/null
+++ b/tex/context/modules/mkiv/m-old-columnsets.mkiv
@@ -0,0 +1,7 @@
+\writeline
+\writestatus{system}{Using old columnset mechanism.}
+\writeline
+
+\input page-set.mkiv
+
+\endinput
diff --git a/tex/context/modules/mkiv/m-old-multicolumns.mkiv b/tex/context/modules/mkiv/m-old-multicolumns.mkiv
new file mode 100644
index 000000000..a2fb1503b
--- /dev/null
+++ b/tex/context/modules/mkiv/m-old-multicolumns.mkiv
@@ -0,0 +1,7 @@
+\writeline
+\writestatus{system}{Using old multicolumn mechanism.}
+\writeline
+
+\input page-mul.mkiv
+
+\endinput
diff --git a/tex/context/modules/mkiv/m-oldfun.mkiv b/tex/context/modules/mkiv/m-oldfun.mkiv
index 3f2ec0263..7ec779c41 100644
--- a/tex/context/modules/mkiv/m-oldfun.mkiv
+++ b/tex/context/modules/mkiv/m-oldfun.mkiv
@@ -355,14 +355,14 @@
\ifdim\wd2=\zeropoint
\setbox0\emptybox
\setbox2\emptybox
- \@EA\grabfirstline
+ \expandafter\grabfirstline
\else\ifdim\wd2>\hsize
\hbox to \hsize{\strut\unhbox0}#2\egroup
\break##1\
\egroup
\else
\setbox0\box2
- \@EAEAEA\grabfirstline
+ \doubleexpandafter\grabfirstline
\fi\fi}%
\grabfirstline}
diff --git a/tex/context/modules/mkiv/m-oldnum.mkiv b/tex/context/modules/mkiv/m-oldnum.mkiv
index 382c56eb6..a240cdb58 100644
--- a/tex/context/modules/mkiv/m-oldnum.mkiv
+++ b/tex/context/modules/mkiv/m-oldnum.mkiv
@@ -189,28 +189,15 @@
%D Although we could do with one pass, a second pass for
%D handling the stored sequence is more readable.
-\ifnum\texengine=\luatexengine
+\def\dohandledigits
+ {\mathcode`\,="002C \mathcode`\.="002E % pretty hard coded
+ \expandafter\handletokens\collecteddigits\with\scandigits
+ \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi}
- \def\dohandledigits
- {\mathcode`\,="002C \mathcode`\.="002E % pretty hard coded
- \expandafter\handletokens\collecteddigits\with\scandigits
- \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi}
-
- \chardef\mathaxisfontid\zerocount
-
-\else
-
- \def\dohandledigits
- {\mathcode`\,="013B \mathcode`\.="013A % pretty hard coded
- \expandafter\handletokens\collecteddigits\with\scandigits
- \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi}
-
- \chardef\mathaxisfontid\plustwo
-
-\fi
+\chardef\mathaxisfontid\zerocount
\def\doscandigit#1%
- {\ifcase\skipdigit\@EA\hbox\else\@EA\hphantom\fi\bgroup
+ {\ifcase\skipdigit\expandafter\hbox\else\expandafter\hphantom\fi\bgroup
\mathematics % brr, needed because of stored punctuation
{\ifnum\digitinputmode=#1\relax
\ifcase\digitoutputmode
diff --git a/tex/context/modules/mkiv/m-punk.mkiv b/tex/context/modules/mkiv/m-punk.mkiv
index 08a066359..29a6d8cca 100644
--- a/tex/context/modules/mkiv/m-punk.mkiv
+++ b/tex/context/modules/mkiv/m-punk.mkiv
@@ -104,19 +104,20 @@ function metapost.characters.process(mpxformat, name, instances, scalefactor)
for i=1,instances do
characters = { }
descriptions = { }
- metapost.process(
- mpxformat,
- {
+ metapost.process {
+ mpx = mpxformat,
+ -- trialrun = false,
+ flusher = flusher,
+ -- multipass = false,
+ -- isextrapass = false,
+ askedfig = "all",
+ -- incontext = false,
+ data = {
"randomseed := " .. i*10 .. ";",
"scale_factor := " .. scalefactor .. " ;",
data
},
- false,
- flusher,
- false,
- false,
- "all"
- )
+ }
lists[i] = {
characters = characters,
descriptions = descriptions,
@@ -210,18 +211,18 @@ metapost.characters.flusher = flusher
statistics.register("metapost font generation", function()
local time = statistics.elapsedtime(flusher)
if total > 0 then
- return string.format("%i glyphs, %.3f seconds runtime, %0.3f glyphs/second", total, time, total/time)
+ return string.format("%i glyphs, %s seconds runtime, %0.3f glyphs/second", total, time, total/tonumber(time))
else
- return string.format("%i glyphs, %.3f seconds runtime", total, time)
+ return string.format("%i glyphs, %s seconds runtime", total, time)
end
end)
statistics.register("metapost font loading",function()
local time = statistics.elapsedtime(metapost.characters)
if variants > 0 then
- return string.format("%.3f seconds, %i instances, %0.3f instances/second", time, variants, variants/time)
+ return string.format("%s seconds, %i instances, %0.3f instances/second", time, variants, variants/tonumber(time))
else
- return string.format("%.3f seconds, %i instances", time, variants)
+ return string.format("%s seconds, %i instances", time, variants)
end
end)
\stopluacode
diff --git a/tex/context/modules/mkiv/m-scite.mkiv b/tex/context/modules/mkiv/m-scite.mkiv
index 48f1022ad..9182fa2ec 100644
--- a/tex/context/modules/mkiv/m-scite.mkiv
+++ b/tex/context/modules/mkiv/m-scite.mkiv
@@ -102,7 +102,8 @@ local function exportcolors()
local function black(f)
return (f[1] == f[2]) and (f[2] == f[3]) and (f[3] == 0)
end
- local result, r = { f_mapping }, 1
+-- local result, r = { f_mapping }, 1
+local result, r = { }, 0
for k, v in table.sortedhash(lexer.context.styles) do
local fore = v.fore
if fore and not black(fore) then
@@ -226,7 +227,7 @@ local function lexdata(data,lexname)
end
data = indent(data)
end
-io.savedata("temp.logs ",data)
+ -- io.savedata("temp.log",data)
assignbuffer("lex",data)
end
@@ -288,6 +289,7 @@ visualizers.register("cld", visualizer)
visualizers.register("tex", visualizer)
visualizers.register("lua", visualizer)
visualizers.register("mps", visualizer)
+visualizers.register("pdf", visualizer)
visualizers.register("xml", visualizer)
visualizers.register("bibtex",visualizer)
visualizers.register("btx", visualizer)
@@ -296,6 +298,7 @@ visualizers.register("cpp", visualizer)
visualizers.register("txt", visualizer)
visualizers.register("bnf", visualizer)
visualizers.register("sql", visualizer)
+visualizers.register("json", visualizer)
\stopluacode
@@ -304,11 +307,13 @@ visualizers.register("sql", visualizer)
\definetyping[BTX] [option=bibtex]
\definetyping[MPS] [option=mps]
\definetyping[MP] [option=mps]
+\definetyping[PDF] [option=pdf]
\definetyping[CPP] [option=web]
\definetyping[WEB] [option=web]
\definetyping[TXT] [option=txt]
\definetyping[BNF] [option=bnf] % I might use this in the metafun manual.
\definetyping[SQL] [option=sql] % To be tested in an upcoming manual.
+\definetyping[JSON][option=json] % To be tested in an upcoming manual.
\definetyping[NONE][option=none]
% This is a preliminary interface.
@@ -319,11 +324,11 @@ visualizers.register("sql", visualizer)
\unexpanded\def\buff_scite_slxb#1%
{\hangindent\numexpr#1+2\relax\scitespaceskip
- \hskip#1\scitespaceskip
+ \begstrut\hskip#1\scitespaceskip
\hangafter 1\relax}
\unexpanded\def\buff_scite_slxe
- {\par}
+ {\endstrut\par}
\unexpanded\def\buff_scite_slxs {\hskip\scitespaceskip\relax}
\unexpanded\def\buff_scite_slxf#1{\hskip#1\scitespaceskip\relax}
@@ -332,6 +337,7 @@ visualizers.register("sql", visualizer)
{\scitespaceskip\interwordspace % \fontcharwd\font`0\relax % brrrrr
\let\slxb\gobbleoneargument
\let\slxe\space
+ \let\slxbreak\relax
\let\installscitecommandsinline\relax}
\unexpanded\def\installscitecommandsdisplay
@@ -342,10 +348,24 @@ visualizers.register("sql", visualizer)
\clf_sciteinstallcommands
-\installscitecommandsinline
-
-\let\slxS\buff_scite_slxs
-\let\slxF\buff_scite_slxf
+\let\slxb \gobbleoneargument
+\let\slxe \space
+\let\slxbreak\relax
+
+\let\slxL \letterleftbrace
+\let\slxR \letterrightbrace
+\let\slxM \letterdollar
+\let\slxV \letterbar
+\let\slxU \letterhat
+\let\slxD \letterunderscore
+\let\slxH \letterhash
+\let\slxB \letterbackslash
+\let\slxP \letterpercent
+\let\slxT \lettertilde
+\let\slxS \fixedspace
+
+\let\slxS \buff_scite_slxs
+\let\slxF \buff_scite_slxf
\def\module_scite_inherit_typing
{\buff_verbatim_initialize_typing_one
diff --git a/tex/context/modules/mkiv/m-units.mkiv b/tex/context/modules/mkiv/m-units.mkiv
index f85a8ba8a..4f25fffc6 100644
--- a/tex/context/modules/mkiv/m-units.mkiv
+++ b/tex/context/modules/mkiv/m-units.mkiv
@@ -212,7 +212,7 @@
\setbox2\hbox{m}%
\ifdim\wd0=\wd2
\endgroup
- \@EAEAEA\gobbleoneargument
+ \doubleexpandafter\gobbleoneargument
\else
\endgroup
\fi
@@ -220,8 +220,8 @@
\unexpanded\def\dimension#1%
{\begingroup
- \global\let\savedthedimensionprefix\thedimensionprefix
- \global\let\savedthedimensionpower\thedimensionpower
+ \glet\savedthedimensionprefix\thedimensionprefix
+ \glet\savedthedimensionpower\thedimensionpower
\unexpanded\def\dimension##1{\global\nesteddimensiontrue}%
\let\dimensionprefix\dimension
\let\dimensionmidfix\dimension
@@ -229,8 +229,8 @@
\let\dimensionpower \dimension
\global\nesteddimensionfalse
\setbox\scratchbox\hbox{\ustartmathmode#1\ustopmathmode}% pre-roll
- \global\let\thedimensionprefix\savedthedimensionprefix
- \global\let\thedimensionpower \savedthedimensionpower
+ \glet\thedimensionprefix\savedthedimensionprefix
+ \glet\thedimensionpower \savedthedimensionpower
\endgroup
\ifnesteddimension#1\else\dodimension{#1}\fi}
@@ -278,8 +278,8 @@
\else
\hskip\dimensionpowersignal
\fi
- \global\let\thedimensionprefix\empty
- \global\let\thedimensionpower\empty}
+ \glet\thedimensionprefix\empty
+ \glet\thedimensionpower\empty}
%D \macros
%D {dontbreakdimension,
diff --git a/tex/context/modules/mkiv/ppchtex.mkiv b/tex/context/modules/mkiv/ppchtex.mkiv
index d1167d414..5348d2e1a 100644
--- a/tex/context/modules/mkiv/ppchtex.mkiv
+++ b/tex/context/modules/mkiv/ppchtex.mkiv
@@ -1747,7 +1747,7 @@
\def\dosimplechemicalA#1#2#3% % evt: {#1,\relax}
{\let\chemicalspace=\relax
- \@EA\dosimplechemical\@EA{\@@chemicalchemicaloffset,#1}{#2}{#3}%
+ \expandafter\dosimplechemical\expandafter{\@@chemicalchemicaloffset,#1}{#2}{#3}%
\egroup}
\def\dosimplechemicalB#1#2#3%
@@ -1849,9 +1849,9 @@
\setevalue{\??chemical\c!text\the\levchemical}{\the\txtchemical}%
\txtchemical=0
\dodochemical[#1][#2]%
- % \@EA\txtchemical\@EA\csname\??chemical\c!text\the\levchemical\endcsname
+ % \expandafter\txtchemical\expandafter\csname\??chemical\c!text\the\levchemical\endcsname
\txtchemical\csname\??chemical\c!text\the\levchemical\endcsname
- \@EA\let\@EA\unknownchemical\csname\??chemical\s!unknown\the\levchemical\endcsname
+ \expandafter\let\expandafter\unknownchemical\csname\??chemical\s!unknown\the\levchemical\endcsname
\advance\levchemical -1
%\egroup
\ignorespaces}
@@ -2099,7 +2099,7 @@
\verchemical=\getvalue{\s!chemical y1}\relax
\else
\restorechemicalvalues{\getvalue{\s!chemical n\the\chemicalstack}}%
- %\@EA\let\@EA\@@chemicalpostponed\@EA=\csname\s!chemical p\the\chemicalstack\endcsname
+ %\expandafter\let\expandafter\@@chemicalpostponed\expandafter=\csname\s!chemical p\the\chemicalstack\endcsname
\let\@@chemicalpostponed=\relax
\horchemical=\getvalue{\s!chemical x\the\chemicalstack}\relax
\verchemical=\getvalue{\s!chemical y\the\chemicalstack}\relax
diff --git a/tex/context/modules/mkiv/s-article-basic.mkiv b/tex/context/modules/mkiv/s-article-basic.mkiv
index 69a577961..677867381 100644
--- a/tex/context/modules/mkiv/s-article-basic.mkiv
+++ b/tex/context/modules/mkiv/s-article-basic.mkiv
@@ -11,6 +11,21 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+
+% \usemodule[article-basic,article-titletop]
+% \usemodule[article-basic,article-titlepage]
+%
+% \startdocument
+% [title={Some title},
+% subject={Some Subject},
+% author={Hans \& Ton},
+% affiliation={PRAGMA ADE},
+% date=\currentdate]
+%
+% \samplefile{ward}
+%
+% \stopdocument
+
\startmodule[article-basic]
\unprotect
@@ -70,6 +85,10 @@
\setuplist
[\c!interaction=\v!all]
+\setupdocument
+ [\c!before=\directsetup{document:titlepage}]
+
\protect
\stopmodule
+
diff --git a/tex/context/modules/mkiv/s-article-titlepage.mkiv b/tex/context/modules/mkiv/s-article-titlepage.mkiv
new file mode 100644
index 000000000..abfb957c2
--- /dev/null
+++ b/tex/context/modules/mkiv/s-article-titlepage.mkiv
@@ -0,0 +1,65 @@
+%D \module
+%D [ file=s-article-titlepage,
+%D version=2018.05.20,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Article Title Page,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[article-titlepage]
+
+\unprotect
+
+% \startalignment[middle]
+% \let\\=\par
+% \bfb
+% \setupinterlinespace
+% \documentvariable {subject}
+% \par
+% \stopalignment
+
+\defineframed
+ [titlepageframed]
+ [\c!frame=\v!off,
+ \c!align=\v!middle]
+
+\startsetups document:titlepage
+ \startstandardmakeup[\c!align=\v!middle]
+ \doifdocumentvariable {title} {
+ \dontleavehmode \titlepageframed
+ [\c!foregroundstyle=\bfd\setupinterlinespace]
+ {\documentvariable {title}}
+ }
+ \doifdocumentvariable {subject} {
+ \blank[2*\v!big]
+ \dontleavehmode \titlepageframed
+ [\c!foregroundstyle=\bfb\setupinterlinespace]
+ {\documentvariable {subject}}
+ }
+ \doifdocumentvariable {author} {
+ \blank[4*\v!big]
+ \dontleavehmode \titlepageframed
+ [\c!foregroundstyle=\bfa\setupinterlinespace]
+ {\documentvariable {author}}
+ }
+ \vfill
+ \doifdocumentvariable {affiliation} {
+ \dontleavehmode \titlepageframed
+ [\c!foregroundstyle=\bfa\setupinterlinespace]
+ {\documentvariable {affiliation}}
+ }
+ \doifdocumentvariable {date} {
+ \blank[\v!big]
+ \dontleavehmode \titlepageframed
+ [\c!foregroundstyle=\bfa\setupinterlinespace]
+ {\documentvariable {date}}
+ }
+ \stopstandardmakeup
+\stopsetups
+
+\stopmodule
diff --git a/tex/context/modules/mkiv/s-article-titletop.mkiv b/tex/context/modules/mkiv/s-article-titletop.mkiv
new file mode 100644
index 000000000..e68bed79b
--- /dev/null
+++ b/tex/context/modules/mkiv/s-article-titletop.mkiv
@@ -0,0 +1,68 @@
+%D \module
+%D [ file=s-article-titletop,
+%D version=2018.05.20,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Article Top Title,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[article-titletop]
+
+\unprotect
+
+\defineframed
+ [titlepageframed]
+ [\c!frame=\v!off,
+ \c!align=\v!middle]
+
+\startsetups document:titlepage
+ \setupheader[\c!state=\v!high]
+ \start
+ \forgetall
+ \startalignment[\v!middle]
+ \doifdocumentvariable {title} {
+ \dontleavehmode \titlepageframed
+ [\c!foregroundstyle=\bfd\setupinterlinespace]
+ {\documentvariable {title}}
+ \par
+ }
+ \doifdocumentvariable {subject} {
+ \dontleavehmode \titlepageframed
+ [\c!foregroundstyle=\bfb\setupinterlinespace]
+ {\documentvariable {subject}}
+ \par
+ }
+ \doifdocumentvariable {author} {
+ \dontleavehmode \titlepageframed
+ [\c!foregroundstyle=\bfa\setupinterlinespace]
+ {\documentvariable {author}}
+ \par
+ }
+ \doifdocumentvariable {affiliation} {
+ \dontleavehmode \titlepageframed
+ [\c!foregroundstyle=\bfa\setupinterlinespace]
+ {\documentvariable {affiliation}}
+ \par
+ }
+ \doifdocumentvariable {date} {
+ \dontleavehmode \titlepageframed
+ [\c!foregroundstyle=\bfa\setupinterlinespace]
+ {\documentvariable {date}}
+ \par
+ }
+ \blank[3*\v!big]
+ \stopalignment
+ \stop
+\stopsetups
+
+\setupdocument
+ [\c!before=\directsetup{document:titlepage}]
+
+\protect
+
+\stopmodule
diff --git a/tex/context/modules/mkiv/s-cgj.mkiv b/tex/context/modules/mkiv/s-cgj.mkiv
new file mode 100644
index 000000000..2950a799d
--- /dev/null
+++ b/tex/context/modules/mkiv/s-cgj.mkiv
@@ -0,0 +1,714 @@
+%D \module
+%D [file=s-cgj.mkiv,
+%D version=2018.09.28,
+%D title=Context group style file,
+%D subtitle=CG-journal base style,
+%D author={Adrian Egger, W. Egger, Taco Hoekwater},
+%D date=\currentdate,
+%D copyright={Context Group}]
+
+%D \type {\enablemode[draft]} has to come before loading the style. Maybe some
+%D day I'll make something more official and then some \type {everydraft} or so.
+
+% Fixme and todo ...
+
+\startmodule[cgj]
+
+\definecolor[NoteColor][g=1,r=.25,b=.25]
+\definecolor[WarnColor][r=1,g=.25,b=.25]
+
+\unexpanded\def\todo#1%
+ {\startframedtext[background=color,backgroundcolor=NoteColor]
+ \dontleavehmode\start\bf TODO:\stop~~#1\par
+ \stopframedtext}
+
+\unexpanded\def\fixme#1%
+ {\startframedtext[background=color,backgroundcolor=WarnColor]
+ \dontleavehmode\start\bf FIXME:\stop~~#1\par
+ \stopframedtext }
+
+%D Base set of variables. The actual values are set in the file
+%D CG-journal.
+
+\setvariables
+ [CG-Journal]
+ [Title={Journal},
+ RunningTitle={Journal},
+ SubTitle={From the base set of variables},
+ Version=1.0,
+ NOFColumns=2]
+
+\startmode[onecolumn,fullwidth]
+ \setvariables
+ [CG-Journal]
+ [NOFColumns=1]
+\stopmode
+
+% Fonts setup.
+
+\usetypescriptfile[plex]
+
+\starttypescript [cgj]
+ \definetypeface [cgj] [rm] [serif][ibmplex-light] [default]
+ \definetypeface [cgj] [ss] [sans] [ibmplex-light] [default]
+ \definetypeface [cgj] [mm] [math] [palatino] [default]
+ \definetypeface [cgj] [tt] [mono] [ibmplex] [default][rscale=0.9]
+\stoptypescript
+
+\starttypescript [cgj-light]
+ \definetypeface [cgj-light] [rm] [serif][ibmplex-extralight] [default]
+ \definetypeface [cgj-light] [ss] [sans] [ibmplex-extralight] [default]
+ \definetypeface [cgj-light] [mm] [math] [palatino] [default]
+ \definetypeface [cgj-light] [tt] [mono] [ibmplex-extralight] [default][rscale=0.9]
+\stoptypescript
+
+\starttypescript [cgj-extralight]
+ \definetypeface [cgj-extralight] [rm] [serif][ibmplex-thin] [default]
+ \definetypeface [cgj-extralight] [ss] [sans] [ibmplex-thin] [default]
+ \definetypeface [cgj-extralight] [mm] [math] [palatino] [default]
+ \definetypeface [cgj-extralight] [tt] [mono] [ibmplex-thin] [default][rscale=0.9]
+\stoptypescript
+
+\usebodyfont
+ [cgj-light,cgj-extralight]
+
+\setupbodyfont
+ [cgj,ss,10pt]
+
+\definebodyfontenvironment[10pt][interlinespace=13pt]
+\definebodyfontenvironment[12pt][interlinespace=16pt]
+\definebodyfontenvironment[16pt][interlinespace=20pt]
+
+\setupinterlinespace
+ [line=13pt]
+
+\let\sl\it
+
+%D Path to the logos
+
+\setupexternalfigures
+ [directory=./Logos,
+ location={global,local,default}]
+
+%D Logos: black logo only.
+
+\useexternalfigure
+ [Logo]
+ [cg_corp_logo_loop_black_cmyk]
+ [width=30mm,
+ height=19mm]
+
+%D Black logo with text
+
+\useexternalfigure
+ [LogoText]
+ [cg_corp_logo_text_black_cmyk]
+ [width=50mm,
+ height=35.2mm]
+
+%D Colors
+
+\definecolor[CGlightblue][c=1,m=.15,y=0,k=0]
+\definecolor[CGdeepblue] [c=1,m=.8,y=0,k=.3]
+\definecolor[CGgray] [c=0,m=0,y=0,k=.1]
+
+%D Article styles
+
+\definealternativestyle
+ [Articleheading]
+ [{\switchtobodyfont[16pt,ss]\bf}]
+
+\definealternativestyle
+ [Articlesubheading]
+ [{\switchtobodyfont[16pt,ss]\tf}]
+
+\definealternativestyle
+ [Authorname]
+ [{\switchtobodyfont[12pt,ss]\it}]
+
+\definealternativestyle
+ [Sectionheading]
+ [{\switchtobodyfont[12pt,ss]\bf\setupinterlinespace[line=12pt]}]
+
+\definealternativestyle
+ [Subsectionheading]
+ [{\switchtobodyfont[cgj-light,10pt,ss]\bf\setupinterlinespace[line=10pt]}]
+
+\definealternativestyle
+ [IntroCopy]
+ [{\switchtobodyfont[12pt,ss]\tf}]
+
+\definealternativestyle
+ [PagenumberStyle]
+ [{\switchtobodyfont[cgj-light,10pt,ss]\bf}]
+
+%D Headerstyles:Breadcrumbs
+
+\definealternativestyle
+ [BreadcrumbMd]
+ [{\switchtobodyfont[cgj-light,10pt,ss]\bf}]
+
+\definealternativestyle
+ [BreadcrumbRg]
+ [{\switchtobodyfont[cgj,10pt,ss]}]
+
+\definealternativestyle
+ [BreadcrumbLt]
+ [{\switchtobodyfont[10pt,ss]\tf}]
+
+\definealternativestyle
+ [BreadcrumbTh]
+ [{\switchtobodyfont[cgj-light,10pt,ss]\tf}]
+
+%D Captionstyles
+
+\definealternativestyle
+ [Captionheading]
+ [{\switchtobodyfont[8pt,ss]\bf\setupinterlinespace[line=8pt]}]
+
+\definealternativestyle
+ [Captiontext]
+ [{\switchtobodyfont[8pt,ss]\tf\setupinterlinespace[line=8pt]}]
+
+%D Article signature
+
+\definealternativestyle
+ [Signaturestyle]
+ [{\switchtobodyfont[10pt,ss]\it}]
+
+%D Article footnotes
+
+\definealternativestyle
+ [Articlefootnotes]
+ [{\switchtobodyfont[8pt,ss]\tf}]
+
+%D Index and TOC styles
+
+\definealternativestyle
+ [IndexContents]
+ [{\switchtobodyfont[16pt,ss]\bf\setupinterlinespace[line=18pt]}]
+
+\definealternativestyle
+ [IndexArticleTitle]
+ [{\switchtobodyfont[12pt,ss]\tf\setupinterlinespace[line=20pt]}]
+
+\definealternativestyle
+ [IndexNumber]
+ [{\switchtobodyfont[12pt,ss]\bf\setupinterlinespace[line=20pt]}]
+
+\definealternativestyle
+ [IndexAuthor]
+ [{\switchtobodyfont[12pt,ss]\it\setupinterlinespace[line=20pt]}]
+
+%D Math: still missing.
+
+%D Verbatim
+
+\definealternativestyle
+ [DisplayMonospaced]
+ [\tt]
+
+\definealternativestyle
+ [DisplayMonospacedX]
+ [{\switchtobodyfont[8pt,tt]}]
+
+\definealternativestyle
+ [DisplayMonospacedS]
+ [{\switchtobodyfont[9pt,tt]\setupinterlinespace[line=10pt]}]
+
+%D Blank adjustment
+
+\defineblank[CGblank] [6pt]
+\defineblank[BigCGblank] [24pt]
+\defineblank[MediumCGblank][12pt]
+
+%D Paper definition
+
+\definepapersize
+ [Journal]
+ [width=210mm,
+ height=266mm]
+
+\setuppapersize
+ [Journal]
+ [Journal]
+
+%D General layout
+
+\definelayout
+ [General]
+ [topspace=18mm,
+ backspace=28mm,
+ header=5mm,
+ headerdistance=7mm,
+ footer=5mm,
+ footerdistance=5mm,
+ width=157mm,
+ height=224mm,
+ marking=on]
+
+\definelayout
+ [Content]
+ [topspace=18mm,
+ backspace=28mm,
+ header=5mm,
+ headerdistance=7mm,
+ footer=0mm,
+ footerdistance=0mm,
+ width=157mm,
+ height=224mm,
+ margindistance=4mm,
+ rightmargin=21mm,
+ leftmargin=21mm,
+ marking=on]
+
+\definelayout
+ [Imprint]
+ [topspace=18mm,
+ backspace=28mm,
+ header=5mm,
+ headerdistance=7mm,
+ footer=5mm,
+ footerdistance=5mm,
+ width=107mm,
+ height=224mm,
+ margindistance=4mm,
+ rightmargin=45.3mm,
+ leftmargin=21mm,
+ marking=on]
+
+\definelayout
+ [SingleColumn]
+ [topspace=18mm,
+ backspace=55mm,
+ header=5mm,
+ headerdistance=7mm,
+ footer=5mm,
+ footerdistance=5mm,
+ width=130mm,
+ height=224mm,
+ margindistance=4mm,
+ leftmargin=48mm,
+ rightmargin=21mm,
+ marking=on]
+
+%D Pagenumbering: Pagenumber is set in the footer
+
+\setuppagenumbering
+ [location=,
+ alternative=doublesided]
+
+%D Head-definitions
+
+\setuphead
+ [title]
+ [style=Articleheading,
+ after={\blank[BigCGblank]},
+ page=yes]
+
+\setuphead
+ [part]
+ [placehead=no,
+ after=,
+ before=,
+ page=no,
+ numbercommand=,
+ expansion=yes]
+
+\setuphead
+ [section]
+ [style=Sectionheading,
+ before={\blank[BigCGblank]},
+ after={\blank[CGblank]},
+ sectionstopper={.},
+ distance=4pt,
+ align={flushleft,nothyphenated},
+ resetnumber=yes,
+ continue=yes]
+
+\setuphead
+ [subsection]
+ [style=Subsectionheading,
+ before={\blank[CGblank]},
+ after={\blank[CGblank]},
+ sectionstopper=,
+ distance=4pt,
+ align={flushleft,nothyphenated},
+ resetnumber=yes,
+ continue=yes]
+
+\setuphead
+ [subject]
+ [style=Sectionheading,
+ before={\blank[BigCGblank]},
+ after=]
+
+\setuphead
+ [subsubject]
+ [style=Subsectionheading,
+ before={\blank[CGblank]},
+ after={\blank[CGblank]},
+ sectionstopper=]
+
+%D A special head for the footnote section in multicolumn mode excuse the low-level
+%D rule, I wanted it to look like the start of footnotes in single column mode. (TH)
+
+\definehead
+ [footnotesubject]
+ [subject]
+
+\setuphead
+ [footnotesubject]
+ [style=Sectionheading,
+ before={\kern -13pt},
+ after={\smash{\lower 13pt\hbox{\vrule width 2.5cm height 1pt depth 0pt}}}]
+
+
+%D The setup of the columns is done at the moment columns are started (see end
+%D of file)
+
+%D Index/TOC page setups
+
+\definelistalternative
+ [CGJ:Index]
+ [renderingsetup=CGJ:Indexheading]
+
+\definelistalternative
+ [CGJ:Index:Chapter]
+ [renderingsetup=CGJ:Indexheading:Chapter]
+
+\startsetups[CGJ:Indexheading:Chapter]
+ \listparameter{before}
+ \vbox \listboxproperties{all} {
+ \forgetall
+ \dontleavehmode
+ \listrenderingsynchronize
+ \hbox to 15mm{
+ \bgroup
+ \useliststyleandcolor{numberstyle}{numbercolor}
+ \currentlistentrypagenumber
+ \egroup}
+ \bgroup
+ \useliststyleandcolor{textstyle}{textcolor}
+ \smash{\currentlistentrytitle}%
+ \egroup
+ }
+ \par
+ \listparameter{after}
+\stopsetups
+
+\startsetups[CGJ:Indexheading]
+ \listparameter{before}
+ \vbox \listboxproperties{all} {
+ \forgetall
+ \dontleavehmode
+ \listrenderingsynchronize
+ \hbox to 15mm{
+ \bgroup
+ \useliststyleandcolor{numberstyle}{numbercolor}
+ \currentlistentrypagenumber
+ \egroup}
+ \bgroup
+ \useliststyleandcolor{textstyle}{textcolor}
+ \currentlistentrytitle
+ \egroup
+ \par
+ }
+ \par
+ \listparameter{after}
+\stopsetups
+
+\setuplist
+ [part]
+ [before={\blank[CGblank]},
+ after=,
+ style=IndexContents,
+ numberstyle=\IndexNumber,
+ textstyle=\IndexArticleTitle,
+ prefix=no,
+ alternative=CGJ:Index:Chapter]
+
+%D Captions
+
+\setupcaptions
+ [suffix={.},
+ headstyle=\Captionheading,
+ style=\Captiontext,
+ distance=6pt]
+
+\setupcaption[figure][way=bypart]
+\setupcaption[table] [way=bypart]
+
+%D Datacollection: article parameters (other fields and defaults)
+
+\unexpanded\def\CGJBibData[#1]%
+ {\getparameters
+ [CGJ]
+ [SubTitle=,
+ RunningAuthor=,
+ RunningTitle=Example,
+ Email=,
+ Address=,
+ Page=1,
+ Title={My Article},
+ Author={Example Author},
+ Period=,
+ Number=,
+ Year=,
+ TocAuthor=,
+ TocTitle=,
+ #1]%
+ \doifnothing
+ {\CGJRunningTitle}
+ {\let\CGJRunningTitle\CGJTitle}%
+ \doifnothing
+ {\CGJRunningAuthor}
+ {\let\CGJRunningAuthor\CGJAuthor}%
+ \doifnothing
+ {\CGJTocAuthor}
+ {\let\CGJTocAuthor\CGJAuthor}%
+ \doifnothing
+ {\CGJTocTitle}
+ {\let\CGJTocTitle\CGJTitle}%
+ \setvariables
+ [CGJToc]
+ [Author=\CGJTocAuthor,
+ Title=\CGJTocTitle]% for TOC
+ }
+
+\unexpanded\def\dostartArticle[#1]
+ {\CGJBibData[#1]
+ \doifelse
+ {\getvariable{CG-Journal}{NOFColumns}}
+ {1}
+ {\doifmodeelse{fullwidth}
+ {\setuplayout[General]}
+ {\setuplayout[SingleColumn]}}
+ {\setupnotes[location=none]
+ \setuplayout[General]}%
+ \bgroup
+ {\switchtobodyfont[16pt]\Articleheading\CGJTitle\par}
+ {\doifsomething{\CGJSubTitle}
+ {\switchtobodyfont[16pt]\Articlesubheading\CGJSubTitle\par}}
+ {\doifsomething{\CGJAuthor}
+ {\switchtobodyfont[12pt]\Authorname \CGJAuthor}\par}
+ \part
+ {\getvariable{CGJToc}{Title}%
+ \doifsomething{\getvariable{CGJToc}{Author}}{ \emdash\ }%
+ \IndexAuthor\getvariable{CGJToc}{Author}}
+ \godown[13pt]%
+ \egroup
+ \par
+ \hyphenpenalty1000\relax}
+
+\unexpanded\def\startArticle
+ {\dosingleempty\dostartArticle}
+
+\def\signArticle
+ {}
+
+%D In multicolumn mode, footnotes come are at the end of the article:
+
+\startsetups article:after
+ \startfootnotesubject[title=]
+ \placefootnotes
+ \stopfootnotesubject
+\stopsetups
+
+\unexpanded\def\stopArticle
+ {\doifelse{\getvariable{CG-Journal}{NOFColumns}}{1}
+ {\par
+ \signArticle}
+ {\setups{article:after}
+ \par
+ \signArticle
+ \stoppagecolumns}
+ \page}
+
+\unexpanded\def\startAbstract
+ {\bgroup
+ \switchtobodyfont[12pt]
+ \IntroCopy}
+
+\unexpanded\def\stopAbstract
+ {\par
+ \egroup
+ \finishAbstract}
+
+\unexpanded\def\finishAbstract
+ {\doifelse {\getvariable{CG-Journal}{NOFColumns}} {1}
+ {\blank[BigCGblank]}
+ {\vbox{\blank[BigCGblank]}%
+ \par
+ \startpagecolumns[balance=yes,distance=12pt,page=no,n=\getvariable{CG-Journal}{NOFColumns}]
+ \setupitemgroup[itemize][packed]
+ \setuplayout[grid=yes]} % grid mode only in columns
+ }
+
+
+\unexpanded\def\noAbstract
+ {\kern -24pt
+ \finishAbstract}
+
+%D Headertexts
+
+\startsetups[Header:texts]
+ \setupheadertexts
+ [] [{{\BreadcrumbLt\CGJRunningTitle}{\BreadcrumbTh\doifsomething{\CGJRunningAuthor}{\ > }\CGJRunningAuthor}}] %odd
+ [{\BreadcrumbMd contextgroup}{\BreadcrumbRg\ > \getvariable{CG-Journal}{RunningTitle}}] [] %even
+\stopsetups
+
+%D Footertexts
+
+\startsetups[Footer:texts]
+ \setupfootertexts
+ [] [\PagenumberStyle\pagenumber]
+ [\PagenumberStyle\pagenumber] []
+\stopsetups
+
+%D Setup tolerance, stretch.
+
+\setuptolerance
+ [tolerant,stretch]
+
+%D Setting up footnotes.
+
+\setupnotation
+ [footnote]
+ [way=bypart,
+ rule=on]
+
+%D Adjustments to the container containing the footnotes.
+
+\setupnote
+ [footnote]
+ [frame=off,
+ topframe=off ,
+ framecolor=black,
+ background=,
+ rulecolor=black, %% the line above the inserts
+ rulethickness=1pt,
+ next={ },
+ split=verystrict,
+ scope=page,
+ style=Articlefootnotes]
+
+\doifmodeelse {draft} {\setupnote[footnote][frame=on]}
+
+% Setup typing.
+
+\setupnarrower
+ [middle=3mm,
+ left=5mm]
+
+\definetextbackground
+ [verbatim]
+ [frame=off,
+ background=color,
+ backgroundcolor=CGgray,
+ leftoffset=2mm,rightoffset=2mm,
+ topoffset=2mm,bottomoffset=2mm,
+ location=paragraph,
+ align=flushleft]
+
+\doifmodeelse {draft} {\definetextbackground[verbatim][frame=on]}
+
+\definetextbackground
+ [verbatimitem]
+ [verbatim]
+
+\setuptextbackground
+ [verbatimitem]
+ [before=,
+ after=,
+ width=\the\dimexpr\hsize-10.5mm\relax]
+
+\startsetups typing:before
+ \blank[MediumCGblank]
+ \starttextbackground[verbatim]
+\stopsetups
+
+\startsetups typing:before:small
+ \blank[MediumCGblank]
+ \starttextbackground[verbatim]
+\stopsetups
+
+\startsetups typing:after
+ \stoptextbackground
+ \blank[MediumCGblank]
+\stopsetups
+
+\startsetups typing:before:item
+ \starttextbackground[verbatimitem]
+\stopsetups
+
+\startsetups typing:after:item
+ \stoptextbackground
+\stopsetups
+
+\setuptyping
+ [typing]
+ [style=DisplayMonospaced,
+ before=\setups{typing:before},
+ after=\setups{typing:after}]
+
+\setuptype
+ [style=DisplayMonospaced]
+
+%D When verbatim becomes too large:
+
+\definetyping
+ [smalltyping]
+
+\setuptyping
+ [smalltyping]
+ [style=DisplayMonospacedX,
+ before=\setups{typing:before:small},
+ after=\setups{typing:after}]
+
+\unexpanded\def\smalltypefile{\typefile[smalltyping][]}
+
+%D Bullet lists.
+
+\setupitemgroup
+ [itemize]
+ [each]
+ []
+ [symbol=1,
+ indentnext=no,
+ align=right,
+ before={\blank[MediumCGblank]\startnarrower[left]},
+ after={\stopnarrower\blank[MediumCGblank]},
+ inbetween={\blank[CGblank]}]
+
+\definedescription
+ [description]
+ [location=hanging,
+ width=broad,
+ before={\blank},
+ after={\blank}]
+
+\setupformula
+ [align=flushleft,
+ margin=5mm]
+
+\setupquotation
+ [before={\blank[CGblank]\switchtobodyfont[10pt]},
+ after={\blank[CGblank]}]
+
+\setupwhitespace
+ [medium]
+
+\usemodule[abr-02,abr-03,abr-04]
+
+\unexpanded\def\Href#1{\underbar{\hyphenatedurl{#1}}}
+\unexpanded\def\CG {\ConTeXt\ group}
+
+\setnewconstant\kindofpagetextareas\plusone % partial page. HH: low level, no high level switch (yet)
+
+%D There is a draft mode, which enables all frames:
+
+\doifmode {draft} {\showframe}
+
+\stopmodule
+
diff --git a/tex/context/modules/mkiv/s-evohome.mkiv b/tex/context/modules/mkiv/s-evohome.mkiv
index 1577517e5..06fd6fb76 100644
--- a/tex/context/modules/mkiv/s-evohome.mkiv
+++ b/tex/context/modules/mkiv/s-evohome.mkiv
@@ -198,13 +198,19 @@ function moduledata.evohome.history(specification)
local m = 0
for minute, d in next, hour do
local v = d[where]
- a = a + v
- n = n + 1
- if v > m then
- m = v
+ if v then
+ a = a + v
+ n = n + 1
+ if v > m then
+ m = v
+ end
end
end
- a = a / n
+ if n > 0 then
+ a = a / n
+ else
+ a = 0
+ end
local dx = xoffset + h
local dy = a/scale
local dm = m/scale
diff --git a/tex/context/modules/mkiv/s-fonts-basics.mkiv b/tex/context/modules/mkiv/s-fonts-basics.mkiv
index e9d0a21a2..370be3598 100644
--- a/tex/context/modules/mkiv/s-fonts-basics.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-basics.mkiv
@@ -1,5 +1,5 @@
%D \module
-%D [ file=s-fnt-01,
+%D [ file=s-fonts-basics, % was s-fnt-01,
%D version=2006.10.10, % guess
%D title=\CONTEXT\ Style File,
%D subtitle=Listing Glyphs in Large Fonts,
diff --git a/tex/context/modules/mkiv/s-fonts-charts.mkiv b/tex/context/modules/mkiv/s-fonts-charts.mkiv
index e94b52a2e..3123cc0d0 100644
--- a/tex/context/modules/mkiv/s-fonts-charts.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-charts.mkiv
@@ -15,7 +15,7 @@
%
% title : show unicode blocks
%
-% comment : show charts of a given fgont
+% comment : show charts of a given font
%
% end info
@@ -87,7 +87,7 @@
local settings = utilities.parsers.settings_to_hash(settings)
- local filename = settings.filename or ""
+ local filename = settings.filename or settings.name or ""
local fontid = true
local newpage = settings.page == interfaces.variables.yes
@@ -169,36 +169,40 @@
\starttext
- \showfontchart[filename=LucidaBrightOT.otf,page=yes]
- \showfontchart[filename=LucidaBrightOT-Demi.otf,page=yes]
- \showfontchart[filename=LucidaBrightOT-DemiItalic.otf,page=yes]
- \showfontchart[filename=LucidaBrightOT-Italic.otf,page=yes]
-
- \showfontchart[filename=LucidaSansOT.otf,page=yes]
- \showfontchart[filename=LucidaSansOT-Demi.otf,page=yes]
- \showfontchart[filename=LucidaSansOT-DemiItalic.otf,page=yes]
- \showfontchart[filename=LucidaSansOT-Italic.otf,page=yes]
-
- \showfontchart[filename=LucidaSansTypewriterOT.otf,page=yes]
- \showfontchart[filename=LucidaSansTypewriterOT-Bold.otf,page=yes]
- \showfontchart[filename=LucidaSansTypewriterOT-BoldOblique.otf,page=yes]
- \showfontchart[filename=LucidaSansTypewriterOT-Oblique.otf,page=yes]
-
- \showfontchart[filename=LucidaConsoleDK.otf,page=yes]
- \showfontchart[filename=LucidaConsoleDK-Bold.otf,page=yes]
- \showfontchart[filename=LucidaConsoleDK-BoldItalic.otf,page=yes]
- \showfontchart[filename=LucidaConsoleDK-Italic.otf,page=yes]
-
- \showfontchart[filename=LucidaGrandeMonoDK.otf,page=yes]
- \showfontchart[filename=LucidaGrandeMonoDK-Bold.otf,page=yes]
- \showfontchart[filename=LucidaGrandeMonoDK-BoldItalic.otf,page=yes]
- \showfontchart[filename=LucidaGrandeMonoDK-Italic.otf,page=yes]
-
- \showfontchart[filename=LucidaBrightMathOT.otf,page=yes]
- \showfontchart[filename=LucidaBrightMathOT-Demi.otf,page=yes]
-
- \showfontchart[filename=LucidaBlackletterOT.otf,page=yes]
- \showfontchart[filename=LucidaCalligraphyOT.otf,page=yes]
- \showfontchart[filename=LucidaHandwritingOT.otf,page=yes]
+ \showfontchart[filename=aegean,page=yes]
+% \showfontchart[filename=veramono.ttf,page=yes]
+% \showfontchart[filename=CoelacanthSubhdHeavy.otf,page=yes]
+
+% \showfontchart[filename=LucidaBrightOT.otf,page=yes]
+% \showfontchart[filename=LucidaBrightOT-Demi.otf,page=yes]
+% \showfontchart[filename=LucidaBrightOT-DemiItalic.otf,page=yes]
+% \showfontchart[filename=LucidaBrightOT-Italic.otf,page=yes]
+
+% \showfontchart[filename=LucidaSansOT.otf,page=yes]
+% \showfontchart[filename=LucidaSansOT-Demi.otf,page=yes]
+% \showfontchart[filename=LucidaSansOT-DemiItalic.otf,page=yes]
+% \showfontchart[filename=LucidaSansOT-Italic.otf,page=yes]
+
+% \showfontchart[filename=LucidaSansTypewriterOT.otf,page=yes]
+% \showfontchart[filename=LucidaSansTypewriterOT-Bold.otf,page=yes]
+% \showfontchart[filename=LucidaSansTypewriterOT-BoldOblique.otf,page=yes]
+% \showfontchart[filename=LucidaSansTypewriterOT-Oblique.otf,page=yes]
+
+% \showfontchart[filename=LucidaConsoleDK.otf,page=yes]
+% \showfontchart[filename=LucidaConsoleDK-Bold.otf,page=yes]
+% \showfontchart[filename=LucidaConsoleDK-BoldItalic.otf,page=yes]
+% \showfontchart[filename=LucidaConsoleDK-Italic.otf,page=yes]
+
+% \showfontchart[filename=LucidaGrandeMonoDK.otf,page=yes]
+% \showfontchart[filename=LucidaGrandeMonoDK-Bold.otf,page=yes]
+% \showfontchart[filename=LucidaGrandeMonoDK-BoldItalic.otf,page=yes]
+% \showfontchart[filename=LucidaGrandeMonoDK-Italic.otf,page=yes]
+
+% \showfontchart[filename=LucidaBrightMathOT.otf,page=yes]
+% \showfontchart[filename=LucidaBrightMathOT-Demi.otf,page=yes]
+
+% \showfontchart[filename=LucidaBlackletterOT.otf,page=yes]
+% \showfontchart[filename=LucidaCalligraphyOT.otf,page=yes]
+% \showfontchart[filename=LucidaHandwritingOT.otf,page=yes]
\stoptext
diff --git a/tex/context/modules/mkiv/s-fonts-complete.mkiv b/tex/context/modules/mkiv/s-fonts-complete.mkiv
index afdd79b4c..83aa708df 100644
--- a/tex/context/modules/mkiv/s-fonts-complete.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-complete.mkiv
@@ -29,23 +29,36 @@
local descriptions = tfmdata.descriptions or { }
local data = characters.data
-- context.setuptabulate { header = "repeat" }
- context.starttabulatehead()
- NC() bold("unicode")
- NC() bold("visual")
- NC() bold("index")
- NC() bold("glyph")
- NC() bold("adobe")
- NC() bold("context")
- NC() NR()
- context.stoptabulatehead()
- context.starttabulate { "|l|c|l|p|p|p|" }
+ -- context.starttabulatehead()
+ -- NC() bold("unicode")
+ -- NC() bold("visual")
+ -- NC() bold("index")
+ -- NC() bold("tounicode")
+ -- NC() bold("unicodes")
+ -- NC() bold("glyph")
+ -- NC() bold("adobe")
+ -- NC() bold("context")
+ -- NC() NR()
+ -- context.stoptabulatehead()
+ context.starttabulate { "|l|c|p(8em)|l|l|p|p|p|" }
+ NC() bold("unicode")
+ NC() bold("visual")
+ NC() bold("unicodes")
+ NC() bold("tounicode")
+ NC() bold("index")
+ NC() bold("glyph")
+ NC() bold("adobe")
+ NC() bold("context")
+ NC() NR()
for unicode, chr in fonts.iterators.characters(tfmdata) do
local des, dat = descriptions[unicode], data[unicode]
- local index = chr.index or 0
- local cname = (dat and dat.contextname) or ""
- local aname = (dat and dat.adobename) or ""
- local gname = (des and des.name) or ""
- local mname = dat and dat.mathname
+ local index = chr.index or 0
+ local tounicode = chr.tounicode
+ local isunicode = chr.unicode
+ local cname = (dat and dat.contextname) or ""
+ local aname = (dat and dat.adobename) or ""
+ local gname = (des and des.name) or ""
+ local mname = dat and dat.mathname
if type(mname) ~= "string" then
mname = ""
end
@@ -70,12 +83,52 @@
cname = mname
end
end
- NC() tttf() context("U+%05X",unicode)
- NC() char(unicode)
- NC() tttf() context("%05X",index)
- NC() if gname ~= "" then tttf() escaped(gname) end
- NC() if aname ~= "" then tttf() context(aname) end
- NC() if cname ~= "" then tttf() context(cname) end
+ NC()
+ tttf()
+ context("%05X",unicode)
+ NC()
+ char(unicode)
+ NC()
+ if isunicode then
+ tttf()
+ if type(isunicode) == "table" then
+ for i=1,#isunicode do
+ if i > 1 then
+ if i % 2 ~= 0 then
+ context.crlf()
+ else
+ context.space()
+ end
+ end
+ context("%05X",isunicode[i])
+ end
+ else
+ context("%05X",isunicode)
+ end
+ end
+ NC()
+ if tounicode then
+ tttf()
+ context(tounicode)
+ end
+ NC()
+ tttf()
+ context("%05X",index)
+ NC()
+ if gname ~= "" then
+ tttf()
+ escaped(gname)
+ end
+ NC()
+ if aname ~= "" then
+ tttf()
+ context(aname)
+ end
+ NC()
+ if cname ~= "" then
+ tttf()
+ context(cname)
+ end
NC() NR()
end
context.stoptabulate()
@@ -100,14 +153,13 @@
\font\TestFont=#1 at #2
\setuplayout[style=\TestFont]
\setupheadertexts[]
- \setupfootertexts[#1 -- \pagenumber]
- \setupfootertexts[pagenumber]
+ \setupfootertexts[#1\space\endash\space\pagenumber]
\setuplayout[width=middle,height=middle,topspace=1cm,backspace=1cm]
\TestFont
\nonknuthmode
\startcolumns[n=#3]
- \TestFont
- \ctxlua { moduledata.fonts.complete.all() }
+ \TestFont
+ \ctxlua { moduledata.fonts.complete.all() }
\stopcolumns
\page
\endgroup}
@@ -125,14 +177,16 @@
\TestFontB \setupinterlinespace[line=1.2\dimexpr#2\relax] \raggedcenter
\nonknuthmode
\startcolumns[n=#3]
- \TestFontB
- \ctxlua { moduledata.fonts.complete.glyphs() }
+ \TestFontB
+ \ctxlua { moduledata.fonts.complete.glyphs() }
\stopcolumns
\page
\endgroup}
\continueifinputfile{s-fonts-complete.mkiv}
+\usemodule[art-01] \setuplayout[overview] \setupbodyfont[8pt]
+
\starttext
% \ShowCompleteFont{name:dejavusansmono}{10pt}{1}
@@ -140,7 +194,7 @@
% \ShowCompleteFont{name:officinasansbookitcregular}{10pt}{2}
% \ShowCompleteFont{name:officinaserifbookitcregular}{10pt}{2}
% \ShowCompleteFont{name:serpentineserifeflight}{10pt}{2}
-\ShowCompleteFont{name:lmroman10-regular}{10pt}{1}
+% \ShowCompleteFont{name:lmroman10-regular}{10pt}{1}
% \ShowCompleteFont{name:lmtypewriter10-regular}{10pt}{2}
% \ShowCompleteFont{lt55485}{10pt}{2}
% \ShowCompleteFont{lmr10}{10pt}{2}
@@ -157,4 +211,13 @@
% \ShowCompleteFont{name:palatinonovaregular}{11pt}{2}
% \ShowCompleteFont{pirat.ttf}{12pt}{1}
+\setuplayout[overview][footer=1cm] \setuplayout[overview]% \setupheadertexts[aegean.ttf]
+
+\ShowCompleteFont{file:aegean} {8pt}{1}
+% \ShowCompleteFont{file:tsukurimashouminchops}{8pt}{1}
+% \ShowCompleteFont{file:tsukurimashoumincho} {8pt}{1}
+% \ShowCompleteFont{file:tsukurimashoukakups} {8pt}{1}
+% \ShowCompleteFont{file:tsukurimashoukaku} {8pt}{1}
+% \ShowCompleteFont{file:akkadian} {8pt}{1}
+
\stoptext
diff --git a/tex/context/modules/mkiv/s-fonts-effects.mkiv b/tex/context/modules/mkiv/s-fonts-effects.mkiv
new file mode 100644
index 000000000..9b712938b
--- /dev/null
+++ b/tex/context/modules/mkiv/s-fonts-effects.mkiv
@@ -0,0 +1,59 @@
+%D \module
+%D [ file=s-fonts-basics, % was s-fnt-01,
+%D version=2006.10.10, % guess
+%D title=\CONTEXT\ Style File,
+%D subtitle=Listing Glyphs in Large Fonts,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This module is just a check for \type {luatex-basics-prepare}.
+
+\startmodule[fonts-effects]
+
+\startluacode
+moduledata.fonts = moduledata.fonts or { }
+moduledata.fonts.effects = moduledata.fonts.effects or { }
+
+function moduledata.fonts.effects.showfonteffect()
+ local effect = fonts.hashes.properties[true].effect
+ if effect then
+ local context = context
+ local BC, NC, EQ, NR = context.BC, context.NC, context.EQ, context.NR
+ context.starttabulate { "||||||||" }
+ BC() context("id") EQ() context(font.current())
+ BC() context("factor") EQ() context(effect.factor)
+ BC() context("wdelta") EQ() context(effect.wdelta)
+ NC() NR()
+ BC() context("effect") EQ() context(effect.effect)
+ BC() context("hfactor") EQ() context(effect.hfactor)
+ BC() context("hdelta") EQ() context(effect.hdelta)
+ NC() NR()
+ BC() context("width") EQ() context(effect.width)
+ BC() context("vfactor") EQ() context(effect.vfactor)
+ BC() context("ddelta") EQ() context(effect.ddelta)
+ NC() NR()
+ context.stoptabulate()
+ end
+end
+\stopluacode
+
+\installmodulecommandluasingle \showfonteffect {moduledata.fonts.effects.showfonteffect}
+
+\stopmodule
+
+\continueifinputfile{s-fonts-effects.mkiv}
+
+\usemodule[art-01]
+
+\starttext
+
+ \definedfont[Serif*default,boldened] An example.
+
+ \showfonteffect
+
+\stopmodule
diff --git a/tex/context/modules/mkiv/s-fonts-features.lua b/tex/context/modules/mkiv/s-fonts-features.lua
index 6f4032948..6c676ce2d 100644
--- a/tex/context/modules/mkiv/s-fonts-features.lua
+++ b/tex/context/modules/mkiv/s-fonts-features.lua
@@ -11,7 +11,7 @@ moduledata.fonts.features = moduledata.fonts.features or { }
-- for the moment only otf
-local sortedhash = table.sortedhash
+local insert, remove, sortedhash = table.insert, table.remove, table.sortedhash
local v_yes = interfaces.variables.yes
local v_no = interfaces.variables.no
@@ -87,66 +87,35 @@ local function collectkerns(tfmdata,feature)
local lookuphash = resources.lookuphash
local feature = feature or "kern"
if sequences then
-
- if true then
-
- for i=1,#sequences do
- local sequence = sequences[i]
- if sequence.features and sequence.features[feature] then
- local steps = sequence.steps
- for i=1,#steps do
- local step = steps[i]
- local format = step.format
- for unicode, hash in table.sortedhash(step.coverage) do
- local kerns = combinations[unicode]
- if not kerns then
- kerns = { }
- combinations[unicode] = kerns
- end
- for otherunicode, kern in table.sortedhash(hash) do
- if format == "pair" then
- local f = kern[1]
- local s = kern[2]
- if f then
- if s then
- -- todo
- else
- if not kerns[otherunicode] and f[3] ~= 0 then
- kerns[otherunicode] = f[3]
- end
- end
- elseif s then
- -- todo
- end
- elseif format == "kern" then
- if not kerns[otherunicode] and kern ~= 0 then
- kerns[otherunicode] = kern
- end
- end
- end
- end
- end
- end
- end
- end
-
- else -- old loader
-
for i=1,#sequences do
local sequence = sequences[i]
if sequence.features and sequence.features[feature] then
- local lookuplist = sequence.subtables
- if lookuplist then
- for l=1,#lookuplist do
- local lookupname = lookuplist[l]
- local lookupdata = lookuphash[lookupname]
- for unicode, data in next, lookupdata do
- local kerns = combinations[unicode]
- if not kerns then
- kerns = { }
- combinations[unicode] = kerns
- end
- for otherunicode, kern in next, data do
+ local steps = sequence.steps
+ for i=1,#steps do
+ local step = steps[i]
+ local format = step.format
+ for unicode, hash in table.sortedhash(step.coverage) do
+ local kerns = combinations[unicode]
+ if not kerns then
+ kerns = { }
+ combinations[unicode] = kerns
+ end
+ for otherunicode, kern in table.sortedhash(hash) do
+ if format == "pair" then
+ local f = kern[1]
+ local s = kern[2]
+ if f then
+ if s then
+ -- todo
+ else
+ if not kerns[otherunicode] and f[3] ~= 0 then
+ kerns[otherunicode] = f[3]
+ end
+ end
+ elseif s then
+ -- todo
+ end
+ elseif format == "kern" then
if not kerns[otherunicode] and kern ~= 0 then
kerns[otherunicode] = kern
end
@@ -156,7 +125,6 @@ local function collectkerns(tfmdata,feature)
end
end
end
-
end
return combinations
@@ -230,3 +198,90 @@ function moduledata.fonts.features.showfeatureset(specification)
end
end
end
+
+local function collectligatures(tfmdata)
+ local sequences = tfmdata.resources.sequences
+
+ if not sequences then
+ return
+ end
+
+ local series = { }
+ local stack = { }
+ local max = 0
+
+ local function make(tree)
+ for k, v in sortedhash(tree) do
+ if k == "ligature" then
+ local n = #stack
+ if n > max then
+ max = n
+ end
+ series[#series+1] = { v, unpack(stack) }
+ else
+ insert(stack,k)
+ make(v)
+ remove(stack)
+ end
+ end
+ end
+
+ for i=1,#sequences do
+ local sequence = sequences[i]
+ if sequence.type == "gsub_ligature" then
+ local steps = sequence.steps
+ for i=1,#steps do
+ local step = steps[i]
+ local coverage = step.coverage
+ if coverage then
+ make(coverage)
+ end
+ end
+ end
+ end
+
+ return series, max
+end
+
+function moduledata.fonts.features.showallligatures(specification)
+ specification = interfaces.checkedspecification(specification)
+ local id, cs = fonts.definers.internal(specification,"<module:fonts:features:font>")
+ local tfmdata = fonts.hashes.identifiers[id]
+ local allligatures,
+ max = collectligatures(tfmdata)
+ local characters = tfmdata.characters
+ local descriptions = tfmdata.descriptions
+ if #allligatures > 0 then
+ context.starttabulate { "|T|" .. string.rep("|",max) .. "|T|T|" }
+ for i=1,#allligatures do
+ local s = allligatures[i]
+ local n = #s
+ local u = s[1]
+ local c = characters[u]
+ local d = descriptions[u]
+ NC()
+ context("%U",u)
+ NC()
+ context("\\setfontid%i\\relax",id)
+ context.char(u)
+ NC()
+ context("\\setfontid%i\\relax",id)
+ for i=2,n do
+ context.char(s[i])
+ NC()
+ end
+ for i=n+1,max do
+ NC()
+ end
+ context(d.name)
+ NC()
+ context(c.tounicode)
+ NC()
+ NR()
+ end
+ context.stoptabulate()
+ else
+ context("no ligatures found")
+ context.par()
+ end
+end
diff --git a/tex/context/modules/mkiv/s-fonts-features.mkiv b/tex/context/modules/mkiv/s-fonts-features.mkiv
index 2dca059ff..2390c44df 100644
--- a/tex/context/modules/mkiv/s-fonts-features.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-features.mkiv
@@ -18,6 +18,7 @@
\installmodulecommandluasingle \showusedfeatures {moduledata.fonts.features.showused}
\installmodulecommandluasingle \showallkerns {moduledata.fonts.features.showallkerns}
\installmodulecommandluasingle \showbasekerns {moduledata.fonts.features.showbasekerns}
+\installmodulecommandluasingle \showallligatures {moduledata.fonts.features.showallligatures}
\installmodulecommandluasingle \showfeatureset {moduledata.fonts.features.showfeatureset}
\def\kernpairheight{.8\strutht}
diff --git a/tex/context/modules/mkiv/s-fonts-shapes.lua b/tex/context/modules/mkiv/s-fonts-shapes.lua
index 748c5a92a..868c22da1 100644
--- a/tex/context/modules/mkiv/s-fonts-shapes.lua
+++ b/tex/context/modules/mkiv/s-fonts-shapes.lua
@@ -58,39 +58,6 @@ function moduledata.fonts.shapes.showlist(specification) -- todo: ranges
for k, v in next, characters.data do
if chrs[k] then
NC() context("0x%05X",k)
- NC() char(id,k) -- getvalue(cs) context.char(k)
- NC() char(id,v.shcode)
- NC() char(id,v.lccode or k)
- NC() char(id,v.uccode or k)
- NC() special(id,v.specials)
- NC() context.tx(v.description)
- NC() NR()
- end
- end
- context.stoptabulate()
- context.endgroup()
-end
-
-function moduledata.fonts.shapes.showlist(specification) -- todo: ranges
- specification = interfaces.checkedspecification(specification)
- local id, cs = fonts.definers.internal(specification,"<module:fonts:shapes:font>")
- local chrs = fontdata[id].characters
- context.begingroup()
- context.tt()
- context.starttabulate { "|l|c|c|c|c|l|l|" }
- context.FL()
- NC() context.bold("unicode")
- NC() context.bold("glyph")
- NC() context.bold("shape")
- NC() context.bold("lower")
- NC() context.bold("upper")
- NC() context.bold("specials")
- NC() context.bold("description")
- NC() NR()
- context.TL()
- for k, v in next, characters.data do
- if chrs[k] then
- NC() context("0x%05X",k)
NC() char(id,k)
NC() char(id,v.shcode)
NC() char(id,v.lccode or k)
@@ -107,220 +74,177 @@ end
local descriptions = nil
local characters = nil
+
local function showglyphshape(specification)
- specification = interfaces.checkedspecification(specification)
- local id, cs = fonts.definers.internal(specification,"<module:fonts:shapes:font>")
- local tfmdata = fontdata[id]
- local charnum = tonumber(specification.character) or fonts.helpers.nametoslot(specification.character)
- local characters = tfmdata.characters
- local descriptions = tfmdata.descriptions
- local parameters = tfmdata.parameters
- local c = characters[charnum]
- local d = descriptions[charnum]
- if d then
- local factor = (parameters.size/parameters.units)*((7200/7227)/65536)
- local llx, lly, urx, ury = unpack(d.boundingbox)
- llx, lly, urx, ury = llx*factor, lly*factor, urx*factor, ury*factor
- local width, italic = (d.width or 0)*factor, (d.italic or 0)*factor
- local top_accent, bot_accent = (d.top_accent or 0)*factor, (d.bot_accent or 0)*factor
- local anchors, math = d.anchors, d.math
- context.start()
- context.dontleavehmode()
- context.obeyMPboxdepth()
- context.startMPcode()
- context("numeric lw ; lw := .125bp ;")
- context("pickup pencircle scaled lw ;")
- if width < 0.01 then
- -- catches zero width marks
- context('picture p ; p := textext.drt("\\hskip5sp\\getuvalue{%s}\\gray\\char%s"); draw p ;',cs,charnum)
- else
- context('picture p ; p := textext.drt("\\getuvalue{%s}\\gray\\char%s"); draw p ;',cs,charnum)
- end
- context('draw (%s,%s)--(%s,%s)--(%s,%s)--(%s,%s)--cycle withcolor green ;',llx,lly,urx,lly,urx,ury,llx,ury)
- context('draw (%s,%s)--(%s,%s) withcolor green ;',llx,0,urx,0)
- context('draw boundingbox p withcolor .2white withpen pencircle scaled .065bp ;')
- context("defaultscale := 0.05 ; ")
- -- inefficient but non critical
- local slant = {
- function(v,dx,dy,txt,xsign,ysign,loc,labloc)
- local n = #v
- if n > 0 then
- local l = { }
- for i=1,n do
- local c = v[i]
- local h = c.height or 0
- local k = c.kern or 0
- l[i] = formatters["((%s,%s) shifted (%s,%s))"](xsign*k*factor,ysign*h*factor,dx,dy)
- end
- context("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled 1/16) withcolor .5white;", xsign*v[1].kern*factor,lly,dx,dy,l[1])
--- context("draw laddered (%s) withcolor .5white ;",table.concat(l,".."))
- context("draw laddered (%..t) withcolor .5white ;",l)
- context("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled 1/16) withcolor .5white;", xsign*v[#v].kern*factor,ury,dx,dy,l[#l])
- for i=1,n do
- context("draw %s withcolor blue withpen pencircle scaled 2lw ;",l[i])
- end
- end
- end,
- function(v,dx,dy,txt,xsign,ysign,loc,labloc)
- local n = #v
- if n > 0 then
- local l = { }
- for i=1,n do
- local c = v[i]
- local h = c.height or 0
- local k = c.kern or 0
- l[i] = formatters["((%s,%s) shifted (%s,%s))"](xsign*k*factor,ysign*h*factor,dx,dy)
- end
- if loc == "top" then
- context('label.%s("\\type{%s}",%s shifted (0,-1bp)) ;',loc,txt,l[n])
- else
- context('label.%s("\\type{%s}",%s shifted (0,2bp)) ;',loc,txt,l[1])
+ --
+ local specification = interfaces.checkedspecification(specification)
+ local id, cs = fonts.definers.internal(specification,"<module:fonts:shapes:font>")
+ local tfmdata = fontdata[id]
+ local characters = tfmdata.characters
+ local descriptions = tfmdata.descriptions
+ local parameters = tfmdata.parameters
+ local anchors = fonts.helpers.collectanchors(tfmdata)
+
+ local function showonecharacter(unicode)
+ local c = characters [unicode]
+ local d = descriptions[unicode]
+ if c and d then
+ local factor = (parameters.size/parameters.units)*((7200/7227)/65536)
+ local llx, lly, urx, ury = unpack(d.boundingbox)
+ llx, lly, urx, ury = llx*factor, lly*factor, urx*factor, ury*factor
+ local width = (d.width or 0)*factor
+ context.start()
+ context.dontleavehmode()
+ context.obeyMPboxdepth()
+ context.startMPcode()
+ context("numeric lw ; lw := .125bp ;")
+ context("pickup pencircle scaled lw ;")
+ if width < 0.01 then
+ -- catches zero width marks
+ context('picture p ; p := textext.drt("\\hskip5sp\\getuvalue{%s}\\gray\\char%s"); draw p ;',cs,unicode)
+ else
+ context('picture p ; p := textext.drt("\\getuvalue{%s}\\gray\\char%s"); draw p ;',cs,unicode)
+ end
+ context('draw (%s,%s)--(%s,%s)--(%s,%s)--(%s,%s)--cycle withcolor green ;',llx,lly,urx,lly,urx,ury,llx,ury)
+ context('draw (%s,%s)--(%s,%s) withcolor green ;',llx,0,urx,0)
+ context('draw boundingbox p withcolor .2white withpen pencircle scaled .065bp ;')
+ context("defaultscale := 0.05 ; ")
+ -- inefficient but non critical
+ local slant = {
+ function(v,dx,dy,txt,xsign,ysign,loc,labloc)
+ local n = #v
+ if n > 0 then
+ local l = { }
+ for i=1,n do
+ local c = v[i]
+ local h = c.height or 0
+ local k = c.kern or 0
+ l[i] = formatters["((%s,%s) shifted (%s,%s))"](xsign*k*factor,ysign*h*factor,dx,dy)
+ end
+ context("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled 1/16) withcolor .5white;", xsign*v[1].kern*factor,lly,dx,dy,l[1])
+ context("draw laddered (%..t) withcolor .5white ;",l) -- why not "--"
+ context("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled 1/16) withcolor .5white;", xsign*v[#v].kern*factor,ury,dx,dy,l[#l])
+ for i=1,n do
+ context("draw %s withcolor blue withpen pencircle scaled 2lw ;",l[i])
+ end
end
- for i=1,n do
- local c = v[i]
- local h = c.height or 0
- local k = c.kern or 0
- context('label.top("(%s,%s)",%s shifted (0,-2bp));',k,h,l[i])
+ end,
+ function(v,dx,dy,txt,xsign,ysign,loc,labloc)
+ local n = #v
+ if n > 0 then
+ local l = { }
+ for i=1,n do
+ local c = v[i]
+ local h = c.height or 0
+ local k = c.kern or 0
+ l[i] = formatters["((%s,%s) shifted (%s,%s))"](xsign*k*factor,ysign*h*factor,dx,dy)
+ end
+ if loc == "top" then
+ context('label.%s("\\type{%s}",%s shifted (0,-1bp)) ;',loc,txt,l[n])
+ else
+ context('label.%s("\\type{%s}",%s shifted (0,2bp)) ;',loc,txt,l[1])
+ end
+ for i=1,n do
+ local c = v[i]
+ local h = c.height or 0
+ local k = c.kern or 0
+ context('label.top("(%s,%s)",%s shifted (0,-2bp));',k,h,l[i])
+ end
end
- end
- end,
- }
- if math then
- local kerns = math.kerns
- if kerns then
- for i=1,#slant do
- local s = slant[i]
- for k, v in next, kerns do
- if k == "topright" then
- s(v,width+italic,0,k,1,1,"top","ulft")
- elseif k == "bottomright" then
- s(v,width,0,k,1,1,"bot","lrt")
- elseif k == "topleft" then
- s(v,0,0,k,-1,1,"top","ulft")
- elseif k == "bottomleft" then
- s(v,0,0,k,-1,1,"bot","lrt")
+ end,
+ }
+ --
+ local math = d.math
+ if math then
+ local kerns = math.kerns
+ if kerns then
+ for i=1,#slant do
+ local s = slant[i]
+ for k, v in next, kerns do
+ if k == "topright" then
+ -- s(v,width+italic,0,k,1,1,"top","ulft")
+ s(v,width,0,k,1,1,"top","ulft")
+ elseif k == "bottomright" then
+ s(v,width,0,k,1,1,"bot","lrt")
+ elseif k == "topleft" then
+ s(v,0,0,k,-1,1,"top","ulft")
+ elseif k == "bottomleft" then
+ s(v,0,0,k,-1,1,"bot","lrt")
+ end
end
end
end
- end
- end
- local function show(x,y,txt)
- local xx, yy = x*factor, y*factor
- context("draw (%s,%s) withcolor blue withpen pencircle scaled 2lw ;",xx,yy)
- context('label.top("\\type{%s}",(%s,%s-2bp)) ;',txt,xx,yy)
- context('label.bot("(%s,%s)",(%s,%s+2bp)) ;',x,y,xx,yy)
- end
- if anchors then
- local a = anchors.baselig
- if a then
- for k, v in next, a do
- for i=1,#v do
- local p = v[i]
- show(p[1],p[2],k .. ":" .. i)
- end
+ local accent = math.accent
+ if accent and accent ~= 0 then
+ local a = accent * factor
+ context('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',a,ury,a,ury)
+ context('label.bot("\\type{%s}",(%s,%s+1bp));',"accent",a,ury)
+ context('label.top("%s",(%s,%s-1bp));',math.accent,a,ury)
end
end
- local a = anchors.mark
- if a then
- for k, v in next, a do
- show(v[1],v[2],k)
- end
- end
- local a = anchors.basechar
- if a then
- for k, v in next, a do
- show(v[1],v[2],k)
+ --
+ local anchordata = anchors[unicode]
+ if anchordata then
+ local function show(txt,list)
+ if list then
+ for i=1,#list do
+ local li = list[i]
+ local x, y = li[1], li[2]
+ local xx, yy = x*factor, y*factor
+ context("draw (%s,%s) withcolor blue withpen pencircle scaled 2lw ;",xx,yy)
+ context('label.top("\\infofont %s",(%s,%s-2.75bp)) ;',txt .. i,xx,yy)
+ context('label.bot("\\infofont (%s,%s)",(%s,%s+2.75bp)) ;',x,y,xx,yy)
+ end
+ end
end
+ --
+ show("b",anchordata.base)
+ show("m",anchordata.mark)
+ show("l",anchordata.ligature)
+ show("e",anchordata.entry)
+ show("x",anchordata.exit)
end
- local ba = anchors.centry
- if a then
- for k, v in next, a do
- show(v[1],v[2],k)
- end
+ --
+ local italic = d.italic
+ if italic and italic ~= 0 then
+ local i = italic * factor
+ context('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue ;',width,ury,width,ury)
+ context('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue ;',width+i,ury,width+i,ury)
+ context('draw (%s,%s-1bp)--(%s,%s-1bp) withcolor blue ;',width,ury,width+i,ury)
+ context('label.lft("\\type{%s}",(%s+2bp,%s-1bp));',"italic",width,ury)
+ context('label.rt("%s",(%s-2bp,%s-1bp));',italic,width+i,ury)
end
- local a = anchors.cexit
- if a then
- for k, v in next, a do
- show(v[1],v[2],k)
- end
- end
- end
- if italic ~= 0 then
- context('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue ;',width,ury,width,ury)
- context('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue ;',width+italic,ury,width+italic,ury)
- context('draw (%s,%s-1bp)--(%s,%s-1bp) withcolor blue ;',width,ury,width+italic,ury)
- context('label.lft("\\type{%s}",(%s+2bp,%s-1bp));',"italic",width,ury)
- context('label.rt("%s",(%s-2bp,%s-1bp));',d.italic,width+italic,ury)
- end
- if top_accent ~= 0 then
- context('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',top_accent,ury,top_accent,ury)
- context('label.bot("\\type{%s}",(%s,%s+1bp));',"top_accent",top_accent,ury)
- context('label.top("%s",(%s,%s-1bp));',d.top_accent,top_accent,ury)
- end
- if bot_accent ~= 0 then
- context('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',bot_accent,lly,bot_accent,lly)
- context('label.top("\\type{%s}",(%s,%s-1bp));',"bot_accent",top_accent,ury)
- context('label.bot("%s",(%s,%s+1bp));',d.bot_accent,bot_accent,lly)
+ context('draw origin withcolor red withpen pencircle scaled 2lw;')
+ context("setbounds currentpicture to boundingbox currentpicture enlarged 1bp ;")
+ context("currentpicture := currentpicture scaled 8 ;")
+ context.stopMPcode()
+ context.stop()
end
- context('draw origin withcolor red withpen pencircle scaled 2lw;')
- context("setbounds currentpicture to boundingbox currentpicture enlarged 1bp ;")
- context("currentpicture := currentpicture scaled 8 ;")
- context.stopMPcode()
- context.stop()
- -- elseif c then
- -- lastdata, lastunicode = nil, nil
- -- local factor = (7200/7227)/65536
- -- context.startMPcode()
- -- context("pickup pencircle scaled .25bp ; ")
- -- context('picture p ; p := image(draw textext.drt("\\gray\\char%s");); draw p ;',charnum)
- -- context('draw boundingbox p withcolor .2white withpen pencircle scaled .065bp ;')
- -- context("defaultscale := 0.05 ; ")
- -- local italic, top_accent, bot_accent = (c.italic or 0)*factor, (c.top_accent or 0)*factor, (c.bot_accent or 0)*factor
- -- local width, height, depth = (c.width or 0)*factor, (c.height or 0)*factor, (c.depth or 0)*factor
- -- local ury = height
- -- if italic ~= 0 then
- -- context('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width,ury,width,ury)
- -- context('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width+italic,ury,width+italic,ury)
- -- context('draw (%s,%s-1bp)--(%s,%s-1bp) withcolor blue;',width,ury,width+italic,height)
- -- context('label.lft("\\type{%s}",(%s+2bp,%s-1bp));',"italic",width,height)
- -- context('label.rt("%6.3f bp",(%s-2bp,%s-1bp));',italic,width+italic,height)
- -- end
- -- if top_accent ~= 0 then
- -- context('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',top_accent,ury,top_accent,height)
- -- context('label.bot("\\type{%s}",(%s,%s+1bp));',"top_accent",top_accent,height)
- -- context('label.top("%6.3f bp",(%s,%s-1bp));',top_accent,top_accent,height)
- -- end
- -- if bot_accent ~= 0 then
- -- context('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',bot_accent,lly,bot_accent,height)
- -- context('label.top("\\type{%s}",(%s,%s-1bp));',"bot_accent",top_accent,height)
- -- context('label.bot("%6.3f bp",(%s,%s+1bp));',bot_accent,bot_accent,height)
- -- end
- -- context('draw origin withcolor red withpen pencircle scaled 1bp;')
- -- context("setbounds currentpicture to boundingbox currentpicture enlarged 1bp ;")
- -- context("currentpicture := currentpicture scaled 8 ;")
- -- context.stopMPcode()
- else
- -- lastdata, lastunicode = nil, nil
- -- context("no such shape: 0x%05X",charnum)
end
-end
-moduledata.fonts.shapes.showglyphshape = showglyphshape
+ local unicode = tonumber(specification.character) or
+ fonts.helpers.nametoslot(specification.character)
-function moduledata.fonts.shapes.showallglypshapes(specification)
- specification = interfaces.checkedspecification(specification)
- local id, cs = fonts.definers.internal(specification,"<module:fonts:shapes:font>")
- local descriptions = fontdata[id].descriptions
- for unicode, description in fonts.iterators.descriptions(tfmdata) do
- if unicode >= 0x110000 then
- break
+ if unicode then
+ showonecharacter(unicode)
+ else
+ context.modulefontsstartshowglyphshapes()
+ for unicode, description in fonts.iterators.descriptions(tfmdata) do
+ if unicode >= 0x110000 then
+ break
+ end
+ context.modulefontsstartshowglyphshape(unicode,description.name or "",description.index or 0)
+ showonecharacter(unicode)
+ context.modulefontsstopshowglyphshape()
end
- context.modulefontsstartshowglyphshape(unicode,description.name or "",description.index or 0)
- showglyphshape { number = id, character = unicode }
- context.modulefontsstopshowglyphshape()
+ context.modulefontsstopshowglyphshapes()
end
+
end
+moduledata.fonts.shapes.showglyphshape = showglyphshape
+moduledata.fonts.shapes.showallglypshapes = showglyphshape
+
function moduledata.fonts.shapes.showlastglyphshapefield(unicode,name)
if not descriptions then
-- bad news
diff --git a/tex/context/modules/mkiv/s-fonts-shapes.mkiv b/tex/context/modules/mkiv/s-fonts-shapes.mkiv
index 53ed1b426..90b9c1f64 100644
--- a/tex/context/modules/mkiv/s-fonts-shapes.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-shapes.mkiv
@@ -30,7 +30,7 @@
\startsetups module:showallglyphshapes:start
\unexpanded\def\modulefontsstartshowglyphshape##1##2##3{
- \startTEXpage[\c!offset=\exheight]
+ \startTEXpage[\c!offset=\exheight] % ,\c!frame=\v!on]
\edef\lastshownglyphshapefieldunicode{##1}%
\edef\lastshownglyphshapefieldname {##2}%
\edef\lastshownglyphshapefieldindex {##3}%
@@ -58,6 +58,15 @@
\stopsetups
+\startsetups module:showallglyphshapes:stop
+
+ % nothing
+
+\stopsetups
+
+\unexpanded\def\modulefontsstartshowglyphshapes{\setups[module:showallglyphshapes:start]}
+\unexpanded\def\modulefontsstopshowglyphshapes {\setups[module:showallglyphshapes:stop]}
+
\protect
% downward compatibility:
@@ -97,6 +106,9 @@
% \startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{0xF0299} \stopTEXpage
% \startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{NameMe.1190} \stopTEXpage
+ \startTEXpage[offset=0pt]\ShowGlyphShape{file:stix2math.otf}{20bp}{0x1D44A}\stopTEXpage
+ \startTEXpage[offset=0pt]\ShowGlyphShape{file:stix2math.otf}{20bp}{0x1D44C}\stopTEXpage
+
% \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{20bp}{0x00066}\stopTEXpage
% \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{20bp}{0x1D453}\stopTEXpage
% \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{20bp}{0x1D43F}\stopTEXpage
@@ -109,10 +121,13 @@
% \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{50bp}{0x1D45D}\stopTEXpage
% \page
-\startTEXpage[offset=0pt]\ShowGlyphShape{file:husayninotebold.ttf}{50bp}{0xF034A}\stopTEXpage
-\startTEXpage[offset=0pt]\ShowGlyphShape{file:husayninotebold.ttf}{50bp}{0x006DD}\stopTEXpage
+% \startTEXpage[offset=0pt]\ShowGlyphShape{file:husayninotebold.ttf}{50bp}{0xF034A}\stopTEXpage
+% \startTEXpage[offset=0pt]\ShowGlyphShape{file:husayninotebold.ttf}{50bp}{0x006DD}\stopTEXpage
+% \startTEXpage[offset=0pt]\ShowGlyphShape{file:husayninotebold.ttf}{50bp}{0x006DD}\stopTEXpage
+% \startTEXpage[offset=0pt]\ShowGlyphShape{file:arabtype.ttf}{50bp}{0x0FCA1}\stopTEXpage
% \showallglyphshapes[name=name:cambria-math,size=100bp]
+% \showallglyphshapes[name=name:arabtype,size=100bp]
% \showallglyphshapes[name=file:husayninotebold.ttf,size=100bp]
% \showallglyphshapes[name=name:dejavuserif,size=100bp]
diff --git a/tex/context/modules/mkiv/s-fonts-statistics.mkiv b/tex/context/modules/mkiv/s-fonts-statistics.mkiv
new file mode 100644
index 000000000..3b5cddd3c
--- /dev/null
+++ b/tex/context/modules/mkiv/s-fonts-statistics.mkiv
@@ -0,0 +1,80 @@
+%D \module
+%D [ file=s-fonts-statistics,
+%D version=2018.03.21, % guess
+%D title=\CONTEXT\ Style File,
+%D subtitle=Listing font statistics,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[fonts-statistics]
+
+\startluacode
+
+moduledata.fonts = moduledata.fonts or { }
+moduledata.fonts.statistics = moduledata.fonts.statistics or { }
+
+local context = context
+local ctx_NC, ctx_BC, ctx_NR = context.NC, context.BC, context.NR
+
+function moduledata.fonts.statistics.showusage()
+ local t = table.load(tex.jobname.."-fonts-usage.lua")
+ if t then
+ local totalinstances = 0
+ local totalfilesize = 0
+ local totalfilenames = #t
+ if totalfilenames > 0 then
+ context.starttabulate { "|r|r|c||" }
+ context.FL()
+ ctx_BC() context("used")
+ ctx_BC() context("filesize")
+ ctx_BC() context("version")
+ ctx_BC() context("filename")
+ ctx_NR()
+ context.ML()
+ for i=1,#t do
+ local ti = t[i]
+ local version = tonumber(string.match(ti.version or "","^.-([%d%.]+)"))
+ local instances = ti.instances or 1
+ local filename = file.basename(ti.filename) or "unknown"
+ local filesize = ti.size or 0
+ totalinstances = totalinstances + instances
+ totalfilesize = totalfilesize + filesize
+ ctx_NC() context(instances)
+ ctx_NC() context("%0m",filesize)
+ ctx_NC() if version then context("%0.3f",version) end
+ ctx_NC() context.type(filename)
+ ctx_NR()
+ end
+ context.LL()
+ ctx_BC() context(totalinstances)
+ ctx_BC() context("%0m",totalfilesize)
+ ctx_BC() context()
+ ctx_BC() context("%i files loaded",totalfilenames)
+ ctx_NR()
+ context.stoptabulate()
+ end
+ end
+end
+
+\stopluacode
+
+\installmodulecommandluasingle \showfontusage {moduledata.fonts.statistics.showusage}
+
+\stopmodule
+
+\continueifinputfile{s-fonts-statistics.mkiv}
+
+\enabletrackers[fonts.usage]
+
+\starttext
+
+ \input klein
+
+ \showfontusage
+
+\stoptext
diff --git a/tex/context/modules/mkiv/s-fonts-system.lua b/tex/context/modules/mkiv/s-fonts-system.lua
index 5b58a4a53..dc0f2e6a3 100644
--- a/tex/context/modules/mkiv/s-fonts-system.lua
+++ b/tex/context/modules/mkiv/s-fonts-system.lua
@@ -30,14 +30,19 @@ if not modules then modules = { } end modules ['s-fonts-system'] = {
moduledata.fonts = moduledata.fonts or { }
moduledata.fonts.system = moduledata.fonts.system or { }
-local lower = string.lower
-
local context = context
local NC, NR, HL = context.NC, context.NR, context.HL
-local bold = context.bold
+local ctx_bold = context.bold
+local ctx_verbatim = context.verbatim
+local lpegmatch = lpeg.match
+local sortedhash = table.sortedhash
+local formatters = string.formatters
+local concat = table.concat
+local lower = string.lower
+local gsub = string.gsub
+local find = string.find
-function moduledata.fonts.system.showinstalled(specification)
- specification = interfaces.checkedspecification(specification)
+local function allfiles(specification)
local pattern = lower(specification.pattern or "")
local list = fonts.names.list(pattern,false,true)
if list then
@@ -45,14 +50,22 @@ function moduledata.fonts.system.showinstalled(specification)
for k, v in next, list do
files[file.basename(string.lower(v.filename))] = v
end
+ return files
+ end
+end
+
+function moduledata.fonts.system.showinstalled(specification)
+ specification = interfaces.checkedspecification(specification)
+ local files = allfiles(specification)
+ if files then
context.starttabulate { "|Tl|Tl|Tl|Tl|Tl|Tl|" }
HL()
- NC() bold("filename")
- NC() bold("fontname")
- NC() bold("subfamily")
- NC() bold("variant")
- NC() bold("weight")
- NC() bold("width")
+ NC() ctx_bold("filename")
+ NC() ctx_bold("fontname")
+ NC() ctx_bold("subfamily")
+ NC() ctx_bold("variant")
+ NC() ctx_bold("weight")
+ NC() ctx_bold("width")
NC() NR()
HL()
for filename, data in table.sortedpairs(files) do
@@ -67,3 +80,242 @@ function moduledata.fonts.system.showinstalled(specification)
context.stoptabulate()
end
end
+
+function moduledata.fonts.system.cacheinstalled(specification)
+ specification = interfaces.checkedspecification(specification)
+ local files = allfiles(specification)
+ if files then
+ local threshold = tonumber(specification.threshold)
+ local suffixes = specification.suffixes
+ if suffixes then
+ suffixes = utilities.parsers.settings_to_set(suffixes)
+ else
+ suffixes = { otf = true, ttf = true }
+ end
+ for filename, data in table.sortedpairs(files) do
+ if string.find(filename," ") then
+ -- skip this one
+ elseif suffixes[file.suffix(filename)] then
+ local fullname = resolvers.findfile(filename)
+ context.start()
+ context.type(fullname)
+ context.par()
+ if threshold and file.size(fullname) > threshold then
+ logs.report("fonts","ignoring : %s",fullname)
+ else
+ logs.report("fonts","caching : %s",fullname)
+ context.definedfont { filename }
+ end
+ context.stop()
+ end
+ end
+ end
+end
+
+local splitter = lpeg.splitat(lpeg.S("._"),true)
+
+local method = 4
+
+function moduledata.fonts.system.showinstalledglyphnames(specification)
+ specification = interfaces.checkedspecification(specification)
+ local paths = caches.getreadablepaths()
+ local files = { }
+ local names = table.setmetatableindex("table")
+ local f_u = formatters["%04X"]
+ for i=1,#paths do
+ local list = dir.glob(paths[i].."/fonts/o*/**.tmc")
+ for i=1,#list do
+ files[list[i]] = true
+ end
+ end
+ for filename in table.sortedhash(files) do
+ local fontname = file.nameonly(filename)
+ logs.report("system","fontfile: %s",fontname)
+ local data = table.load(filename)
+ if data then
+ if method == 1 then
+ local unicodes = data.resources.unicodes
+ if unicodes then
+ for n, u in sortedhash(unicodes) do
+ if u >= 0xF0000 or (u >= 0xE000 and u <= 0xF8FF) then
+ -- skip
+ else
+ local f = lpegmatch(splitter,n) or n
+ if #f > 0 then
+ local t = names[f]
+ t[u] = (t[u] or 0) + 1
+ end
+ end
+ end
+ end
+ elseif method == 2 then
+ local unicodes = data.resources.unicodes
+ if unicodes then
+ for n, u in sortedhash(unicodes) do
+ if u >= 0xF0000 or (u >= 0xE000 and u <= 0xF8FF) then
+ -- skip
+ else
+ local t = names[n]
+ t[u] = (t[u] or 0) + 1
+ end
+ end
+ end
+ elseif method == 3 then
+ local descriptions = data.descriptions
+ if descriptions then
+ for u, d in sortedhash(descriptions) do
+ local n = d.name
+ local u = d.unicode
+ if n and u then
+ if type(u) == "table" then
+ local t = { }
+ for i=1,#u do
+ t[i] = f_u(u[i])
+ end
+ u = concat(t," ")
+ end
+ local t = names[n]
+ t[u] = (t[u] or 0) + 1
+ end
+ end
+ end
+ elseif method == 4 then
+ local descriptions = data.descriptions
+ if descriptions then
+ for u, d in sortedhash(descriptions) do
+ local n = d.name
+ local u = d.unicode
+ if n and not u and not find(n,"^%.") then
+ local n = names[n]
+ n[#n+1] = fontname
+ end
+ end
+ end
+ else
+ -- nothing
+ end
+ end
+ end
+ -- names[".notdef"] = nil
+ -- names[".null"] = nil
+ if method == 4 then
+ if next(names) then
+ context.starttabulate { "|l|pl|" }
+ local f_u = formatters["%04X~(%i)"]
+ local f_s = formatters["%s~(%i)"]
+ for k, v in sortedhash(names) do
+ NC() ctx_verbatim(k)
+ NC() context("% t",v)
+ NC() NR()
+ end
+ context.stoptabulate()
+ end
+ table.save("s-fonts-system-glyph-unknowns.lua",names)
+ else
+ if next(names) then
+ context.starttabulate { "|l|pl|" }
+ local f_u = formatters["%04X~(%i)"]
+ local f_s = formatters["%s~(%i)"]
+ for k, v in sortedhash(names) do
+ local t = { }
+ for k, v in sortedhash(v) do
+ if type(k) == "string" then
+ t[#t+1] = f_s(k,v)
+ else
+ t[#t+1] = f_u(k,v)
+ end
+ end
+ NC() ctx_verbatim(k)
+ NC() context("%, t",t)
+ NC() NR()
+ end
+ context.stoptabulate()
+ end
+ table.save("s-fonts-system-glyph-names.lua",names)
+ end
+end
+
+-- -- --
+
+-- local skip = {
+-- "adobeblank",
+-- "veramo",
+-- "unitedstates",
+-- "tirek",
+-- "svbasicmanual",
+-- "sahel",
+-- "prsprorg",
+-- "piratdia",
+-- "notoserifthai",
+-- "coelacanthsubhdheavy",
+-- }
+
+-- local function bad(name)
+-- name = lower(name)
+-- for i=1,#skip do
+-- if find(name,skip[i]) then
+-- return true
+-- end
+-- end
+-- end
+
+-- function moduledata.fonts.system.showprivateglyphnames(specification)
+-- specification = interfaces.checkedspecification(specification)
+-- local paths = caches.getreadablepaths()
+-- local files = { }
+-- local names = table.setmetatableindex("table")
+-- local f_u = formatters["%04X"]
+-- for i=1,#paths do
+-- local list = dir.glob(paths[i].."/fonts/o*/**.tmc")
+-- for i=1,#list do
+-- files[list[i]] = true
+-- end
+-- end
+-- for filename in table.sortedhash(files) do
+-- logs.report("system","fontfile: %s",file.nameonly(filename))
+-- local data = table.load(filename)
+-- if data and data.format == "truetype" or data.format == "opentype" then
+-- local basename = file.basename(data.resources.filename)
+-- local cleanname = gsub(basename," ","")
+-- if not bad(cleanname) then
+-- local descriptions = data.descriptions
+-- if descriptions then
+-- local done = 0
+-- for u, d in sortedhash(descriptions) do
+-- local dn = d.name
+-- local du = d.unicode
+-- if dn and du and (u >= 0xF0000 or (u >= 0xE000 and u <= 0xF8FF)) and not find(dn,"notdef") then
+-- if type(du) == "table" then
+-- local t = { }
+-- for i=1,#du do
+-- t[i] = f_u(du[i])
+-- end
+-- du = concat(t," ")
+-- end
+-- if done == 0 then
+-- logs.report("system","basename: %s",basename)
+-- context.starttitle { title = basename }
+-- context.start()
+-- context.definefont( { "tempfont" }, { "file:" .. cleanname })
+-- context.starttabulate { "|T||T|T|" }
+-- end
+-- NC() context("%U",u)
+-- NC() context.tempfont() context.char(u) -- could be getglyph
+-- NC() ctx_verbatim(dn)
+-- NC() context(du)
+-- NC() NR()
+-- done = done + 1
+-- end
+-- end
+-- if done > 0 then
+-- logs.report("system","privates: %i",done)
+-- context.stoptabulate()
+-- context.stop()
+-- context.stoptitle()
+-- end
+-- end
+-- end
+-- end
+-- end
+-- end
+
diff --git a/tex/context/modules/mkiv/s-fonts-system.mkiv b/tex/context/modules/mkiv/s-fonts-system.mkiv
index 6d9082a6b..9a0f7485d 100644
--- a/tex/context/modules/mkiv/s-fonts-system.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-system.mkiv
@@ -24,16 +24,27 @@
\registerctxluafile{s-fonts-system}{}
-\installmodulecommandluasingle \showinstalledfonts {moduledata.fonts.system.showinstalled}
+\installmodulecommandluasingle \showinstalledfonts {moduledata.fonts.system.showinstalled}
+\installmodulecommandluasingle \cacheinstalledfonts {moduledata.fonts.system.cacheinstalled}
+\installmodulecommandluasingle \showinstalledglyphnames {moduledata.fonts.system.showinstalledglyphnames}
+%installmodulecommandluasingle \showprivateglyphnames {moduledata.fonts.system.showprivateglyphnames}
\stopmodule
\continueifinputfile{s-fonts-system.mkiv}
-\usemodule[art-01] \setuplayout[overview] \setupbodyfont[7pt]
+\usemodule[art-01] \setuplayout[overview] \setupbodyfont[6pt]
\starttext
- \showinstalledfonts
+% \showinstalledfonts
+
+% \enabletrackers[otf.keepnames]
+
+% \cacheinstalledfonts[suffixes={otf,ttf,afm}]
+% \cacheinstalledfonts[threshold=4000000,suffixes={otf,ttf,afm}]
+% \cacheinstalledfonts[threshold=2000000,suffixes={otf,ttf,afm}]
+
+ \showinstalledglyphnames
\stoptext
diff --git a/tex/context/modules/mkiv/s-fonts-tables.lua b/tex/context/modules/mkiv/s-fonts-tables.lua
index c32f4628c..33cbc924c 100644
--- a/tex/context/modules/mkiv/s-fonts-tables.lua
+++ b/tex/context/modules/mkiv/s-fonts-tables.lua
@@ -6,18 +6,45 @@ if not modules then modules = { } end modules ['s-fonts-tables'] = {
license = "see context related readme files"
}
-moduledata.fonts = moduledata.fonts or { }
-moduledata.fonts.tables = moduledata.fonts.tables or { }
-
-local setmetatableindex = table.setmetatableindex
-local sortedhash = table.sortedhash
-local sortedkeys = table.sortedkeys
-local format = string.format
-local concat = table.concat
-
-local tabletracers = moduledata.fonts.tables
-
-local context = context
+moduledata.fonts = moduledata.fonts or { }
+moduledata.fonts.tables = moduledata.fonts.tables or { }
+
+local setmetatableindex = table.setmetatableindex
+local sortedhash = table.sortedhash
+local sortedkeys = table.sortedkeys
+local concat = table.concat
+local insert = table.insert
+local remove = table.remove
+local formatters = string.formatters
+
+local tabletracers = moduledata.fonts.tables
+
+local new_glyph = nodes.pool.glyph
+local copy_node = nodes.copy
+local setlink = nodes.setlink
+local hpack = nodes.hpack
+local applyvisuals = nodes.applyvisuals
+
+local handle_positions = fonts.handlers.otf.datasetpositionprocessor
+local handle_injections = nodes.injections.handler
+
+local context = context
+local ctx_sequence = context.formatted.sequence
+local ctx_char = context.char
+local ctx_setfontid = context.setfontid
+local ctx_type = context.formatted.type
+local ctx_dontleavehmode = context.dontleavehmode
+local ctx_startPair = context.startPair
+local ctx_stopPair = context.stopPair
+local ctx_startSingle = context.startSingle
+local ctx_stopSingle = context.stopSingle
+local ctx_startSingleKern = context.startSingleKern
+local ctx_stopSingleKern = context.stopSingleKern
+local ctx_startPairKern = context.startPairKern
+local ctx_stopPairKern = context.stopPairKern
+
+local ctx_NC = context.NC
+local ctx_NR = context.NR
local digits = {
dflt = {
@@ -106,53 +133,73 @@ setmetatableindex(digits.dflt, function(t,k) return rawget(t,"dflt") end)
setmetatableindex(symbols.dflt, function(t,k) return rawget(t,"dflt") end)
setmetatableindex(punctuation.dflt, function(t,k) return rawget(t,"dflt") end)
-local function typesettable(t,keys,synonyms,nesting,prefix)
- if t then
+-- scaled boolean string scale string float cardinal
+
+local function checked(specification)
+ specification = interfaces.checkedspecification(specification)
+ local id, cs = fonts.definers.internal(specification,"<module:fonts:features:font>")
+ local tfmdata = fonts.hashes.identifiers[id]
+ local resources = tfmdata.resources
+ return tfmdata, id, resources
+end
+
+local function nothing()
+ context("no entries")
+ context.par()
+end
+
+local function typesettable(t,keys,synonyms,nesting,prefix,depth)
+ if t and next(keys) then
if not prefix then
context.starttabulate { "|Tl|Tl|Tl|" }
end
for k, v in sortedhash(keys) do
if k == "synonyms" then
elseif type(v) ~= "table" then
- context.NC()
+ ctx_NC()
if prefix then
context("%s.%s",prefix,k)
else
context(k)
end
- context.NC()
+ ctx_NC()
+ -- print(v)
local tk = t[k]
- if v == "boolean" then
+ if v == "<boolean>" then
context(tostring(tk or false))
elseif not tk then
context("<unset>")
- elseif v == "filename" then
+ elseif k == "filename" then
context(file.basename(tk))
- elseif v == "basepoints" then
- context("%sbp",tk)
- elseif v == "scaledpoints" then
+ -- elseif v == "basepoints" then
+ -- context("%sbp",tk)
+ elseif v == "<scaled>" then
context("%p",tk)
- elseif v == "table" then
+ elseif v == "<table>" then
context("<table>")
- else -- if v == "integerscale" then
+ else
context(tostring(tk))
end
- context.NC()
- local synonym = (not prefix and synonyms[k]) or (prefix and synonyms[format("%s.%s",prefix,k)])
+ ctx_NC()
+ local synonym = (not prefix and synonyms[k]) or (prefix and synonyms[formatters["%s.%s"](prefix,k)])
if synonym then
- context(format("(%s)",concat(synonym," ")))
+ context("(% t)",synonym)
end
- context.NC()
- context.NR()
+ ctx_NC()
+ ctx_NR()
elseif nesting == false then
context("<table>")
- else -- true or nil
- typesettable(t[k],v,synonyms,nesting,k)
+ elseif next(v) then
+ typesettable(t[k],v,synonyms,nesting,k,true)
end
end
if not prefix then
context.stoptabulate()
end
+ return
+ end
+ if not depth then
+ nothing()
end
end
@@ -175,51 +222,342 @@ end
tabletracers.typeset = typeset
-function tabletracers.showproperties(nesting)
- local tfmdata = fonts.hashes.identifiers[font.current()]
- typeset(tfmdata.properties,fonts.constructors.keys.properties,nesting)
+-- function tabletracers.showproperties(nesting)
+-- local tfmdata = fonts.hashes.identifiers[true]
+-- typeset(tfmdata.properties,fonts.constructors.keys.properties,nesting)
+-- end
+
+-- function tabletracers.showparameters(nesting)
+-- local tfmdata = fonts.hashes.identifiers[true]
+-- typeset(tfmdata.parameters,fonts.constructors.keys.parameters,nesting)
+-- end
+
+function tabletracers.showproperties(specification)
+ local tfmdata = checked(specification)
+ if tfmdata then
+ typeset(tfmdata.properties,fonts.constructors.keys.properties)
+ else
+ nothing()
+ end
+end
+
+function tabletracers.showparameters(specification)
+ local tfmdata = checked(specification)
+ if tfmdata then
+ typeset(tfmdata.parameters,fonts.constructors.keys.parameters)
+ else
+ nothing()
+ end
end
-function tabletracers.showparameters(nesting)
- local tfmdata = fonts.hashes.identifiers[font.current()]
- typeset(tfmdata.parameters,fonts.constructors.keys.parameters,nesting)
+local f_u = formatters["%U"]
+local f_p = formatters["%p"]
+
+local function morept(t)
+ local r = { }
+ for i=1,t do
+ r[i] = f_p(t[i])
+ end
+ return concat(r," ")
end
-function tabletracers.showpositionings()
- local tfmdata = fonts.hashes.resources[font.current()]
- local resources = tfmdata.resources
+local function noprefix(kind)
+ kind = string.gsub(kind,"^gpos_","")
+ kind = string.gsub(kind,"^gsub_","")
+ return kind
+end
+
+local function banner(index,i,format,kind,order,chain)
+ if chain then
+ ctx_sequence("sequence: %i, step %i, format: %s, kind: %s, features: % t, chain: %s",
+ index,i,format,noprefix(kind),order,noprefix(chain))
+ else
+ ctx_sequence("sequence: %i, step %i, format: %s, kind: %s, features: % t",
+ index,i,format,noprefix(kind),order)
+ end
+end
+
+function tabletracers.showpositionings(specification)
+
+ local tfmdata, fontid, resources = checked(specification)
+
if resources then
- local features = resources.features
- if features then
- local gpos = features.gpos
- if gpos and next(gpos) then
- context.starttabulate { "|Tl|Tl|Tlp|" }
- for feature, scripts in sortedhash(gpos) do
- for script, languages in sortedhash(scripts) do
- context.NC()
- context(feature)
- context.NC()
- context(script)
- context.NC()
- context(concat(sortedkeys(languages)," "))
- context.NC()
- context.NR()
+
+ local direction = "TLT"
+
+ local sequences = resources.sequences
+ local marks = resources.marks
+
+ if tonumber(direction) == -1 or direction == "TRT" then
+ direction = "TRT"
+ else
+ direction = "TLT"
+ end
+
+ local visuals = "fontkern,glyph,box"
+
+ local datasets = fonts.handlers.otf.dataset(tfmdata,fontid,0)
+
+ local function process(dataset,sequence,kind,order,chain)
+ local steps = sequence.steps
+ local order = sequence.order or order
+ local index = sequence.index
+ for i=1,#steps do
+ local step = steps[i]
+ local format = step.format
+ banner(index,i,format,kind,order,chain)
+ if kind == "gpos_pair" then
+ local format = step.format
+ if "kern" or format == "move" then
+ for first, seconds in sortedhash(step.coverage) do
+ local done = false
+ local zero = 0
+ for second, kern in sortedhash(seconds) do
+ if kern == 0 then
+ zero = zero + 1
+ else
+ if not done then
+ ctx_startPairKern()
+ end
+ local one = new_glyph(fontid,first)
+ local two = new_glyph(fontid,second)
+ local raw = setlink(copy_node(one),copy_node(two))
+ local pos = setlink(done and one or copy_node(one),copy_node(two))
+ pos, okay = handle_positions(pos,fontid,direction,dataset)
+ pos = handle_injections(pos)
+ applyvisuals(raw,visuals)
+ applyvisuals(pos,visuals)
+ pos = hpack(pos,"exact",nil,direction)
+ raw = hpack(raw,"exact",nil,direction)
+ ctx_NC() if not done then context(f_u(first)) end
+ ctx_NC() if not done then ctx_dontleavehmode() context(one) end
+ ctx_NC() context(f_u(second))
+ ctx_NC() ctx_dontleavehmode() context(two)
+ ctx_NC() context("%p",kern)
+ ctx_NC() ctx_dontleavehmode() context(raw)
+ ctx_NC() ctx_dontleavehmode() context(pos)
+ ctx_NC() ctx_NR()
+ done = true
+ end
+ end
+ if done then
+ ctx_stopPairKern()
+ end
+ if zero > 0 then
+ ctx_type("zero: %s",zero)
+ end
+ end
+ elseif format == "pair" then
+ for first, seconds in sortedhash(step.coverage) do
+ local done = false
+ local allnull = 0
+ local allzero = 0
+ local zeronull = 0
+ local nullzero = 0
+ for second, pair in sortedhash(seconds) do
+ local pfirst = pair[1]
+ local psecond = pair[2]
+ if not pfirst and not psecond then
+ allnull = allnull + 1
+ elseif pfirst == true and psecond == true then
+ allzero = allzero + 1
+ elseif pfirst == true and not psecond then
+ zeronull = zeronull + 1
+ elseif not pfirst and psecond == true then
+ nullzero = nullzero + 1
+ else
+ if pfirst == true then
+ pfirst = "all zero"
+ elseif pfirst then
+ pfirst = morept(pfirst)
+ else
+ pfirst = "no first"
+ end
+ if psecond == true then
+ psecond = "all zero"
+ elseif psecond then
+ psecond = morept(psecond)
+ else
+ psecond = "no second"
+ end
+ if not done then
+ ctx_startPair()
+ end
+ local one = new_glyph(fontid,first)
+ local two = new_glyph(fontid,second)
+ local raw = setlink(copy_node(one),copy_node(two))
+ local pos = setlink(done and one or copy_node(one),copy_node(two))
+ pos, okay = handle_positions(pos,fontid,direction,dataset)
+ pos = handle_injections(pos)
+ applyvisuals(raw,visuals)
+ applyvisuals(pos,visuals)
+ pos = hpack(pos,"exact",nil,direction)
+ raw = hpack(raw,"exact",nil,direction)
+ ctx_NC() if not done then context(f_u(first)) end
+ ctx_NC() if not done then ctx_dontleavehmode() context(one) end
+ ctx_NC() context(f_u(second))
+ ctx_NC() ctx_dontleavehmode() context(two)
+ ctx_NC() context(pfirst)
+ ctx_NC() context(psecond)
+ ctx_NC() ctx_dontleavehmode() context(raw)
+ ctx_NC() ctx_dontleavehmode() context(pos)
+ ctx_NC() ctx_NR()
+ done = true
+ end
+ end
+ if done then
+ ctx_stopPair()
+ end
+ if allnull > 0 or allzero > 0 or zeronull > 0 or nullzero > 0 then
+ ctx_type("both null: %s, both zero: %s, zero and null: %s, null and zero: %s",
+ allnull,allzero,zeronull,nullzero)
+ end
+ end
+ else
+ -- maybe
+ end
+ elseif kind == "gpos_single" then
+ local format = step.format
+ if format == "kern" or format == "move" then
+ local done = false
+ local zero = 0
+ for first, kern in sortedhash(step.coverage) do
+ if kern == 0 then
+ zero = zero + 1
+ else
+ if not done then
+ ctx_startSingleKern()
+ end
+ local one = new_glyph(fontid,first)
+ local raw = copy_node(one)
+ local pos = copy_node(one)
+ pos, okay = handle_positions(pos,fontid,direction,dataset)
+ pos = handle_injections(pos)
+ applyvisuals(raw,visuals)
+ applyvisuals(pos,visuals)
+ pos = hpack(pos,"exact",nil,direction)
+ raw = hpack(raw,"exact",nil,direction)
+ ctx_NC() context(f_u(first))
+ ctx_NC() ctx_dontleavehmode() context(one)
+ ctx_NC() context("%p",kern)
+ ctx_NC() ctx_dontleavehmode() context(raw)
+ ctx_NC() ctx_dontleavehmode() context(pos)
+ ctx_NC() ctx_NR()
+ done = true
+ end
+ end
+ if done then
+ ctx_stopSingleKern()
+ end
+ if zero > 0 then
+ ctx_type("zero: %i",zero)
+ end
+ elseif format == "single" then
+ local done = false
+ local zero = 0
+ local null = 0
+ for first, single in sortedhash(step.coverage) do
+ if single == false then
+ null = null + 1
+ elseif single == true then
+ zero = zero + 1
+ else
+ single = morept(single)
+ if not done then
+ ctx_startSingle()
+ end
+ local one = new_glyph(fontid,first)
+ local raw = copy_node(one)
+ local pos = copy_node(one)
+ pos, okay = handle_positions(pos,fontid,direction,dataset)
+ pos = handle_injections(pos)
+ applyvisuals(raw,visuals)
+ applyvisuals(pos,visuals)
+ raw = hpack(raw,"exact",nil,direction)
+ pos = hpack(pos,"exact",nil,direction)
+ ctx_NC() context(f_u(first))
+ ctx_NC() ctx_dontleavehmode() context(one)
+ ctx_NC() context(single)
+ ctx_NC() ctx_dontleavehmode() context(raw)
+ ctx_NC() ctx_dontleavehmode() context(pos)
+ ctx_NC() ctx_NR()
+ done = true
+ end
+ end
+ if done then
+ ctx_stopSingle()
+ end
+ if null > 0 then
+ if zero > 0 then
+ ctx_type("null: %i, zero: %i",null,zero)
+ else
+ ctx_type("null: %i",null)
+ end
+ else
+ if null > 0 then
+ ctx_type("both zero: %i",zero)
+ end
+ end
+ else
+ -- todo
end
end
- context.stoptabulate()
- else
- context("no entries")
- context.par()
end
end
+
+ local done = false
+
+ for d=1,#datasets do
+ local dataset = datasets[d]
+ local sequence = dataset[3]
+ local kind = sequence.type
+ if kind == "gpos_contextchain" or kind == "gpos_context" then
+ local steps = sequence.steps
+ for i=1,#steps do
+ local step = steps[i]
+ local rules = step.rules
+ if rules then
+ for i=1,#rules do
+ local rule = rules[i]
+ local lookups = rule.lookups
+ if lookups then
+ for i=1,#lookups do
+ local lookup = lookups[i]
+ if lookup then
+ local look = lookup[1]
+ local dnik = look.type
+ if dnik == "gpos_pair" or dnik == "gpos_single" then
+ process(dataset,look,dnik,sequence.order,kind)
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ done = true
+ elseif kind == "gpos_pair" or kind == "gpos_single" then
+ process(dataset,sequence,kind)
+ done = true
+ end
+ end
+
+ if done then
+ return
+ end
+
end
+
+ nothing()
+
end
local dynamics = true
-function tabletracers.showsubstitutions()
- local tfmdata = fonts.hashes.identifiers[font.current()]
- local resources = tfmdata.resources
+function tabletracers.showsubstitutions(specification)
+
+ local tfmdata, fontid, resources = checked(specification)
+
if resources then
local features = resources.features
if features then
@@ -229,8 +567,8 @@ function tabletracers.showsubstitutions()
for feature, scripts in sortedhash(gsub) do
for script, languages in sortedhash(scripts) do
for language in sortedhash(languages) do
- local tag = format("dummy-%s-%s-%s",feature,script,language)
- local fnt = format("file:%s*%s",file.basename(tfmdata.properties.filename),tag)
+ local tag = formatters["dummy-%s-%s-%s"](feature,script,language)
+ local fnt = formatters["file:%s*%s"](file.basename(tfmdata.properties.filename),tag)
context.definefontfeature (
{ tag },
{
@@ -259,13 +597,13 @@ function tabletracers.showsubstitutions()
local data = makes_sense[i]
local script = data.script
local language = data.language
- context.NC()
+ ctx_NC()
context(data.feature)
- context.NC()
+ ctx_NC()
context(script)
- context.NC()
+ ctx_NC()
context(language)
- context.NC()
+ ctx_NC()
if not dynamics then
context.startfont { data.fontname }
else
@@ -279,85 +617,160 @@ function tabletracers.showsubstitutions()
if not dynamics then
context.stopfont()
end
- context.NC()
- context.NR()
+ ctx_NC()
+ ctx_NR()
end
context.stoptabulate()
- else
- context("no entries")
- context.par()
+ return
end
end
end
end
+
+ nothing()
+
end
-function tabletracers.showunicodevariants()
+function tabletracers.showunicodevariants(specification)
+
+ local tfmdata, fontid, resources = checked(specification)
- local variants = fonts.hashes.variants[true]
+ if resources then
- if variants then
- context.starttabulate { "|c|c|c|c|c|c|c|" }
- for selector, unicodes in sortedhash(variants) do
- local done = false
- for unicode, variant in sortedhash(unicodes) do
- context.NC()
- if not done then
- context("%U",selector)
- done = true
+ local variants = fonts.hashes.variants[fontid]
+
+ if variants then
+ context.starttabulate { "|c|c|c|c|c|c|c|" }
+ for selector, unicodes in sortedhash(variants) do
+ local done = false
+ for unicode, variant in sortedhash(unicodes) do
+ ctx_NC()
+ if not done then
+ context("%U",selector)
+ done = true
+ end
+ ctx_NC()
+ context("%U",unicode)
+ ctx_NC()
+ context("%c",unicode)
+ ctx_NC()
+ context("%U",variant)
+ ctx_NC()
+ context("%c",variant)
+ ctx_NC()
+ context("%c%c",unicode,selector)
+ ctx_NC()
+ context.startoverlay()
+ context("{\\color[trace:r]{%c}}{\\color[trace:ds]{%c}}",unicode,variant)
+ context.stopoverlay()
+ ctx_NC()
+ ctx_NR()
end
- context.NC()
- context("%U",unicode)
- context.NC()
- context("%c",unicode)
- context.NC()
- context("%U",variant)
- context.NC()
- context("%c",variant)
- context.NC()
- context("%c%c",unicode,selector)
- context.NC()
- context.startoverlay()
- context("{\\color[trace:r]{%c}}{\\color[trace:ds]{%c}}",unicode,variant)
- context.stopoverlay()
- context.NC()
- context.NR()
end
+ context.stoptabulate()
+ return
end
- context.stoptabulate()
+
end
+ nothing()
+
end
-function tabletracers.showall(specification) -- not interfaced
- specification = interfaces.checkedspecification(specification)
- if specification.title then
- context.starttitle { title = specification.title }
+local function collectligatures(steps)
+
+ local series = { }
+ local stack = { }
+ local max = 0
+
+ local function make(tree)
+ for k, v in sortedhash(tree) do
+ if k == "ligature" then
+ local n = #stack
+ if n > max then
+ max = n
+ end
+ series[#series+1] = { v, unpack(stack) }
+ else
+ insert(stack,k)
+ make(v)
+ remove(stack)
+ end
+ end
end
- context.startsubject { title = "Properties" }
- tabletracers.showproperties()
- context.stopsubject()
+ for i=1,#steps do
+ local step = steps[i]
+ local coverage = step.coverage
+ if coverage then
+ make(coverage)
+ end
+ end
- context.startsubject { title = "Parameters" }
- tabletracers.showparameters()
- context.stopsubject()
+ return series, max
+end
- context.startsubject { title = "Positioning features" }
- tabletracers.showpositionings()
- context.stopsubject()
+local function banner(index,kind,order)
+ ctx_sequence("sequence: %i, kind: %s, features: % t",index,noprefix(kind),order)
+end
+
+function tabletracers.showligatures(specification)
- context.startsubject { title = "Substitution features" }
- tabletracers.showsubstitutions()
- context.stopsubject()
+ local tfmdata, fontid, resources = checked(specification)
- context.startsubject { title = "Unicode variants" }
- tabletracers.showunicodevariants()
- context.stopsubject()
+ if resources then
- if title then
- context.stoptitle()
+ local characters = tfmdata.characters
+ local descriptions = tfmdata.descriptions
+ local sequences = resources.sequences
+ if sequences then
+ local done = true
+ for index=1,#sequences do
+ local sequence = sequences[index]
+ local kind = sequence.type
+ if kind == "gsub_ligature" then
+ local list, max = collectligatures(sequence.steps)
+ if #list > 0 then
+ banner(index,kind,sequence.order or { })
+ context.starttabulate { "|T|" .. string.rep("|",max) .. "|T|T|" }
+ for i=1,#list do
+ local s = list[i]
+ local n = #s
+ local u = s[1]
+ local c = characters[u]
+ local d = descriptions[u]
+ ctx_NC()
+ context("%U",u)
+ ctx_NC()
+ ctx_setfontid(fontid)
+ ctx_char(u)
+ ctx_NC()
+ ctx_setfontid(fontid)
+ for i=2,n do
+ ctx_char(s[i])
+ ctx_NC()
+ end
+ for i=n+1,max do
+ ctx_NC()
+ end
+ context(d.name)
+ ctx_NC()
+ context(c.tounicode)
+ ctx_NC()
+ ctx_NR()
+ end
+ context.stoptabulate()
+ done = true
+ end
+ end
+ end
+ if done then
+ return
+ end
+ end
end
+ nothing()
+
end
diff --git a/tex/context/modules/mkiv/s-fonts-tables.mkiv b/tex/context/modules/mkiv/s-fonts-tables.mkiv
index 64fe76f0e..f1340c3ea 100644
--- a/tex/context/modules/mkiv/s-fonts-tables.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-tables.mkiv
@@ -17,10 +17,28 @@
\registerctxluafile{s-fonts-tables}{}
-\installmodulecommandluasingle \showfonttables {moduledata.fonts.tables.showall}
+\definetabulate[Pair] [|T|cw(3em)|T|cw(3em)|Tw(10em)|Tw(10em)|cw(4em)|cw(4em)|]
+\definetabulate[Single] [|T|cw(3em)|Tw(10em)|cw(4em)|cw(4em)|]
+\definetabulate[SingleKern][|T|cw(3em)|Trw(5em)|cw(4em)|cw(4em)|]
+\definetabulate[PairKern] [|T|cw(3em)|T|cw(3em)|Trw(5em)|cw(4em)|cw(4em)|]
+
+\definehead
+ [sequence]
+ [subsubject]
+ [style=\ttbf]
+
+\definecolor
+ [bbcolor]
+ [t=.5,a=1,s=.5]
+
+\definefontfeature
+ [boundingbox]
+ [boundingbox={background,bbcolor}]
+
\installmodulecommandluasingle \showfontproperties {moduledata.fonts.tables.showproperties}
\installmodulecommandluasingle \showfontparameters {moduledata.fonts.tables.showparameters}
\installmodulecommandluasingle \showfontpositionings {moduledata.fonts.tables.showpositionings}
+\installmodulecommandluasingle \showfontligatures {moduledata.fonts.tables.showligatures}
\installmodulecommandluasingle \showfontsubstitutions {moduledata.fonts.tables.showsubstitutions}
\installmodulecommandluasingle \showfontunicodevariants{moduledata.fonts.tables.showunicodevariants}
@@ -34,5 +52,5 @@
[cambria]
\starttext
- \showfonttables[title=Cambria]
+ \showfontproperties[name=cambria]
\stoptext
diff --git a/tex/context/modules/mkiv/s-fonts-variable.mkiv b/tex/context/modules/mkiv/s-fonts-variable.mkiv
index d1bf8b69d..2cd612c75 100644
--- a/tex/context/modules/mkiv/s-fonts-variable.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-variable.mkiv
@@ -72,28 +72,28 @@
\char983040\relax\par
\stopbuffer
- \showfontvariations
- [font=file:adobevfprototype.otf]
+% \showfontvariations
+% [font=file:adobevfprototype.otf]
- \showfontvariations
- [font=file:avenirnextvariable.ttf]
+% \showfontvariations
+% [font=file:avenirnextvariable.ttf]
- \showfontvariations
- [font=file:DecoVar-VF.ttf]
+% \showfontvariations
+% [font=file:DecoVar-VF.ttf]
% \showfontvariations
% [font=file:VotoSerifGX.ttf,
% max=15]
- \showfontvariations
- [font=file:Selawik-Variable.ttf]
+% \showfontvariations
+% [font=file:Selawik-Variable.ttf]
- \showfontvariations
- [font=file:LibreFranklinGX-Romans.ttf]
+% \showfontvariations
+% [font=file:LibreFranklinGX-Romans.ttf]
- \showfontvariations
- [font=file:Zycon.ttf,
- sample={\getbuffer[zycon]}]
+ % \showfontvariations
+ % [font=file:Zycon.ttf,
+ % sample={\getbuffer[zycon]}]
% \showfontvariations
% [font=file:kairossansvariable.ttf]
@@ -104,8 +104,8 @@
% \showfontvariations
% [font=file:AmstelvarAlpha-VF.ttf]
- \showfontvariations
- [font=file:bahnschrift.ttf]
+ % \showfontvariations
+ % [font=file:bahnschrift.ttf]
% \showfontvariations
% [font=file:sitka.ttc]
diff --git a/tex/context/modules/mkiv/s-languages-hyphenation.lua b/tex/context/modules/mkiv/s-languages-hyphenation.lua
index 6d3cf3d3e..65fd1ab14 100644
--- a/tex/context/modules/mkiv/s-languages-hyphenation.lua
+++ b/tex/context/modules/mkiv/s-languages-hyphenation.lua
@@ -29,7 +29,8 @@ local newrule = nodepool.rule
local newglue = nodepool.glue
local insert_node_after = nuts.insert_after
-local traverse_by_id = nuts.traverse_id
+
+local nextglyph = nuts.traversers.glyph
local tonut = nodes.tonut
local tonode = nodes.tonode
@@ -129,7 +130,7 @@ end
local function getlanguage(head,l,left,right)
local t = { }
- for n in traverse_by_id(glyph_code,tonut(head)) do
+ for n in nextglyph, tonut(head) do
t[n] = {
getlang(n),
getfield(n,"left"),
@@ -148,7 +149,7 @@ function moduledata.languages.hyphenation.showhyphens(head)
local marked = { }
local cached = { }
-- somehow assigning -1 fails
- for n in traverse_by_id(glyph_code,tonut(head)) do
+ for n in nextglyph, tonut(head) do
cached[n] = {
getlang(n),
getfield(n,"left"),
diff --git a/tex/context/modules/mkiv/s-languages-system.lua b/tex/context/modules/mkiv/s-languages-system.lua
index 3b422db9f..d18050577 100644
--- a/tex/context/modules/mkiv/s-languages-system.lua
+++ b/tex/context/modules/mkiv/s-languages-system.lua
@@ -19,7 +19,7 @@ local ctx_bold = context.bold
function moduledata.languages.system.loadinstalled()
context.start()
- for k, v in table.sortedhash(registered) do
+ for k, v in sortedhash(registered) do
context.language{ k }
end
context.stop()
diff --git a/tex/context/modules/mkiv/s-maps.mkiv b/tex/context/modules/mkiv/s-maps.mkiv
index c7541babc..28e88af98 100644
--- a/tex/context/modules/mkiv/s-maps.mkiv
+++ b/tex/context/modules/mkiv/s-maps.mkiv
@@ -135,11 +135,11 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% 3 versions of layout with matching headers
-\definepapersize
+\definepapersize
[maps]
[width=21cm,height=26.5cm]
-\setuppapersize
+\setuppapersize
[maps][maps]
\setuplayout[
@@ -360,9 +360,9 @@
\xdef\MapsNumber{\the\numexpr (\the\year-1990)*2+1\relax}%
\fi }%
\doifnothing\MapsRunningAuthor
- {\global\let\MapsRunningAuthor\MapsAuthor}%
+ {\glet\MapsRunningAuthor\MapsAuthor}%
\doifnothing\MapsRunningTitle
- {\global\let\MapsRunningTitle\MapsTitle}}%
+ {\glet\MapsRunningTitle\MapsTitle}}%
\def\dostartArticle[#1]{%
\MapsBibData[#1]
diff --git a/tex/context/modules/mkiv/s-present-dark.mkiv b/tex/context/modules/mkiv/s-present-dark.mkiv
new file mode 100644
index 000000000..a3b6f6e14
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-dark.mkiv
@@ -0,0 +1,357 @@
+%D \module
+%D [ file=s-present-dark, % tug-2001
+%D version=2018.09.25, % 2000.*.*
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Dark,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[present-dark]
+
+%D The original document dates from 2000 and was meant for a presentation at \TUG\
+%D 2001. It used widgets and in particular check fields and push buttons.
+%D \JAVASCRIPT\ was used to show or hide them when rolling over, and appearances
+%D changed in a subtle way. It actually worked quite well at that time.
+%D
+%D However, over time these widgets proved to be sort of unstable. For instance we
+%D used the parent|-|child model of which (inheritance and appearance) behaviour
+%D changed over time. We're talking of a few decades ago when \TEX\ was one of the
+%D few (maybe only) tools that could actually support everything that the manual
+%D introduced: the \quote {standard} seemed to be ahead of the viewer. Anyway, we
+%D adapted but it meant that old document in principle were not always future proof.
+%D
+%D We used in this document a push button in the background of the menu so that it
+%D could become visible when rolled over. There were no layers in \PDF\ at that
+%D time! Nowadays such a trick doesn't work well because of the way a viewer
+%D intercepts regions. One gets kind of erratic behaviour when applying \JAVASCRIPT.
+%D
+%D I spent quite some time to test if we could still do the same without side
+%D effects and in the process also noticed that some functionality in \JAVASCRIPT\
+%D seems broken (or changed due to maybe security issues). So, in the end I decided
+%D to simplify the approach and use layers to pop up the menu when the mouse goes
+%D over it but no longer hide it when the mouse leaves that area. It just doesn't
+%D work too well otherwise.
+
+%D We start with the layout. We basically have three areas: edge, margin and text.
+%D Each are more or less the same width.
+
+\setuppapersize
+ [S6][S6]
+
+\setuplayout
+ [backspace=380pt,
+ topspace=20pt,
+ leftedge=100pt,
+ leftedgedistance=10pt,
+ leftmargin=230pt,
+ leftmargindistance=20pt,
+ header=0pt,
+ footer=0pt,
+ width=200pt,
+ backspace=360pt,
+ width=220pt,
+ leftmargin=210pt,
+ height=middle]
+
+%D The bodyfont is the Latin Modern Variable (of course at that time we used
+%D the Computer Modern predecessors). We still apply protrusion and expansion.
+%D The new \quotation {Modern Latin} look also works ok on screen.
+
+\definefontfeature
+ [default]
+ [default]
+ [expansion=pure,
+ protrusion=pure]
+
+\setupalign
+ [verytolerant,stretch,hanging] % space
+
+\setupbodyfont
+ [modernvariable,11pt]
+
+% \setupbodyfont
+% [modernlatin,11pt]
+
+\setupinmargin
+ [style=,
+ color=]
+
+%D We use some predefined \JAVASCRIPT\ functions. These are rather old helpers.
+%D Normally only the libraries (sets of functions) that are used will be
+%D embedded.
+
+\useJSscripts[fld]
+\useJSscripts[nav]
+
+%D The remarks that will pop up. By default they are not visible. Clicking
+%D on the page (or menu item) will show them step by step.
+
+\newcounter\bofremarks
+\newcounter\nofremarks
+
+\setupfield
+ [remark]
+ [offset=overlay,
+ option={readonly,hidden},
+ color=,
+ style=,
+ frame=off]
+
+\defineframed
+ [remarkable]
+ [frame=off,
+ backgroundcolor=white,
+ background=RollBackground]
+
+\starttexdefinition unexpanded remark #1#2
+
+ \doglobal\increment\nofremarks
+
+ \definesymbol
+ [remark:x:\nofremarks]
+ [\remarkable{#1}]
+
+ \definesymbol
+ [remark:y:\nofremarks]
+ [\remarkable{#2}]
+
+ \definefield
+ [remark:x:\nofremarks][check][remark]
+ [remark:x:\nofremarks]
+ [remark:x:\nofremarks]
+
+ \definefield
+ [remark:y:\nofremarks][check][remark]
+ [remark:y:\nofremarks]
+ [remark:y:\nofremarks]
+
+ \inleft
+ [scope=local]
+ {
+ \hpack to \hsize {
+ \hss
+ \linebox {
+ \fitfield[remark:y:\nofremarks]
+ }
+ }
+ }
+
+ \bgroup
+
+ \setbox\scratchbox\hbox {
+ #1
+ }
+
+ \hpack to \wd\scratchbox {
+ \wd\scratchbox\zeropoint
+ \box\scratchbox
+ \hss
+ \linebox {
+ \fitfield[remark:x:\nofremarks]
+ }
+ \hss
+ }
+
+ \egroup
+
+\stoptexdefinition
+
+%D We use lots of backgrounds. The \METAPOST\ graphics are a bit overkill
+%D but we keep them.
+
+\setupbackgrounds
+ [text]
+ [background=StepFields]
+
+\defineoverlay
+ [StepFields]
+ [\directsetup{syncrefs}\overlaybutton{ShowRemark}]
+
+\setupbackgrounds
+ [page]
+ [background=PageBackground]
+
+%D Just look in \type {java-imp-fld.mkiv} how \type {HideFields} and
+%D alike are defined. They are defined references to \JAVASCRIPT\ calls.
+
+\setupinteraction
+ [state=start,
+ click=no,
+ menu=on,
+ style=,
+ color=,
+ frame=off,
+ contrastcolor=]
+
+\setupinteractionscreen
+ [option=max]
+
+\setupbackgrounds
+ [paper]
+ [background=color,
+ backgroundcolor=black]
+
+\defineoverlay
+ [PageBackground]
+ [\useMPgraphic{PageBackground}]
+
+\startuseMPgraphic{PageBackground}
+ StartPage ;
+ numeric w ; w := 1.25 * PaperWidth ;
+ numeric n ; n := 2.50 * PageNumber ;
+ numeric d ; d := (1 + (PageNumber-1)/5) * 5pt ;
+ fill Page
+ withcolor black ;
+ for i=1 upto 500 :
+ draw
+ center Page
+ randomized w
+ rotatedaround(center Page,n)
+ withpen pencircle
+ scaled (uniformdeviate d)
+ withcolor
+ (yellow randomized (.3,.8))
+ ;
+ endfor ;
+ StopPage ;
+\stopuseMPgraphic
+
+\defineoverlay
+ [TextBackground]
+ [\uniqueMPgraphic{TextBackground}]
+
+\startuniqueMPgraphic{TextBackground}
+ fill
+ OverlayBox
+ withcolor black ;
+ draw
+ OverlayBox
+ withpen pencircle scaled 1pt
+ withcolor OverlayColor ;
+\stopuniqueMPgraphic
+
+\defineoverlay
+ [RollBackground]
+ [\uniqueMPgraphic{RollBackground}]
+
+\startuniqueMPgraphic{RollBackground}
+ fill
+ OverlayBox
+ withcolor black ;
+ draw
+ OverlayBox
+ withpen pencircle scaled 1pt
+ withcolor OverlayColor ;
+\stopuniqueMPgraphic
+
+\setupinteractionmenu
+ [left]
+ [state=start,
+ width=\leftedgewidth,
+ frame=on,
+ framecolor=white,
+ rulethickness=1pt,
+ foregroundcolor=white,
+ background=RollBackground]
+
+\startsetups syncrefs
+ \normalexpanded {
+ \definereference
+ [ShowRemark]
+ [StepFields{remark:x,\bofremarks,\nofremarks},
+ StepFields{remark:y,\bofremarks,\nofremarks}]
+ }
+\stopsetups
+
+%D The menu buttons used to be rollover buttons but are now normal simple
+%D ones (more predictable).
+
+\defineviewerlayer
+ [buttons]
+
+\startinteractionmenu[left]
+ \vfill
+ \directsetup{syncrefs}
+ \startviewerlayer[buttons]
+ \startbut [previouspage,HideFields] Previous \stopbut
+ \startbut [nextpage,HideFields] Next \stopbut
+ \startbut [ShowRemark] Remark \stopbut
+ \startbut [HideFields] Reset \stopbut
+ \startbut [CloseDocument,HideFields] Quit \stopbut
+ \stopviewerlayer
+\stopinteractionmenu
+
+\setupinteraction
+ [closeaction=ForgetChanges,
+ openpageaction={HideFields,HideLayer{buttons}},
+ closepageaction={HideFields,HideLayer{buttons}}]
+
+\defineoverlay
+ [ShowMenu]
+ [\overlayrollbutton{VideLayer{buttons}}{}]
+
+\setupbackgrounds
+ [text][leftedge]
+ [backgroundoffset=10pt,
+ background=ShowMenu]
+
+%D The environment has been adapted a bit. Instead of taking two
+%D arguments we now use a key|-|value approach. The remark is shown
+%D when one rolls over the title (author).
+
+\defineframedtext
+ [MainText]
+ [frame=off,
+ offset=10pt,
+ width=\textwidth,
+ before=,
+ after=,
+ color=,
+ foregroundcolor=white,
+ background=TextBackground,
+ backgroundcolor=white]
+
+\starttexdefinition unexpanded StartIdea
+ \dosingleempty{\texdefinition{StartIdeaIndeed}}
+\stoptexdefinition
+
+\starttexdefinition StartIdeaIndeed [#1]
+ \let\bofremarks\nofremarks
+ \increment\bofremarks
+ \startstandardmakeup
+ \setvariables[Idea][#1]
+ \startMainText
+ \setupalign[verytolerant,stretch,hanging]
+\stoptexdefinition
+
+\starttexdefinition unexpanded StopIdea
+ \doifvariable {Idea} {text} {
+ \blank
+ \rightaligned {
+ \doifelsevariable {Idea} {remark} {
+ \tooltip
+ [left]
+ {\getvariable{Idea}{title}}
+ {\getvariable{Idea}{remark}}
+ } {
+ \getvariable{Idea}{title}
+ }
+ }
+ }
+ \stopMainText
+ \vfill
+ \stopstandardmakeup
+\stoptexdefinition
+
+\stopmodule
+
+\continueifinputfile{s-present-dark.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{tug/2001/tug-2001-ideas.tex}
diff --git a/tex/context/modules/mkiv/s-present-steps.mkiv b/tex/context/modules/mkiv/s-present-steps.mkiv
new file mode 100644
index 000000000..432650a5e
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-steps.mkiv
@@ -0,0 +1,177 @@
+%D \module
+%D [ file=s-present-steps,
+%D version=2018.05.17,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Repeated Steps,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This a preliminary module, a quick hack and not entirely proper \CONTEXT, but
+%D let's see what more is needed.
+
+\startmodule[present-steps]
+
+\startluacode
+
+moduledata.steps = moduledata.steps or { }
+
+local steps = moduledata.steps
+local data = { }
+local name = "unknown"
+local set = 0
+local settings = nil
+
+function steps.startsteps(buffername)
+ set = set + 1
+ data = { }
+ name = buffername
+end
+
+function steps.stopsteps()
+ local n = 0
+ for i=1,#data do
+ local state = "once"
+ local done = 0
+ while true do
+ context.startprocessingsteps()
+ for j=1,i do
+ local step = data[j]
+ local nested = step.nested
+ local content = step.content
+ local last = (i == #data) and (j == i) and 1 or 0
+ local option = step.option
+ local flush = true
+ if option == interfaces.variables["title"] then
+ if i > 1 then
+ flush = false
+ end
+ elseif option == interfaces.variables["repeat"] then
+ if i == 1 then
+ flush = false
+ end
+ end
+ if flush then
+ if j < i or nested == 0 then
+ context(function()
+ buffers.assign("step",content)
+ context.processstep("step",i,0,last)
+ -- context.writestatus("step a",string.formatters["%i %i %i"](i,0,last))
+ end)
+ state = "done"
+ else
+ done = done + 1
+ local d = done
+ context(function()
+ buffers.assign("step",content)
+ context.processstep("step",i,d,last)
+ -- context.writestatus("step b",string.formatters["%i %i %i"](i,d,last))
+ end)
+ if done == nested then
+ state = "done"
+ n = n + nested
+ else
+ state = "busy"
+ end
+ end
+ end
+ end
+ context.stopprocessingsteps()
+ if state == "done" then
+ break
+ end
+ end
+ end
+end
+
+function steps.startstep(str)
+ settings = utilities.parsers.settings_to_hash(str)
+end
+
+function steps.stopstep()
+ settings.content = buffers.getcontent(name)
+ settings.nested = tonumber(settings.n) or 0
+ data[#data+1] = settings
+end
+
+function steps.startsubstep(str)
+ local d = data[#data]
+ d.nested = d.nested + 1
+end
+
+function steps.stopsubstep()
+end
+
+\stopluacode
+
+\definebuffer
+ [step]
+
+\def\currentstep {0}
+\def\currentsubstep{0}
+
+\unexpanded\def\startprocessingsteps
+ {\global\wantedsubstep\zerocount}
+
+\unexpanded\def\stopprocessingsteps
+ {}
+
+\unexpanded\def\processstep#1#2#3#4%
+ {\par
+ \edef\currentstep {#2}%
+ \edef\currentsubstep{#3}%
+ \ifcase#4\relax
+ \setupreferencing[prefix=#2:#3]
+ \getbuffer[#1]%
+ \par
+ \else
+ \setupreferencing[prefix=]
+ \getbuffer[#1]%
+ \page
+ \fi}
+
+\let\normalstartstep\startstep
+
+\newcount\wantedsubstep
+
+\unexpanded\def\startsteps
+ {\ctxlua{moduledata.steps.startsteps("\thedefinedbuffer{step}")}}
+
+\unexpanded\def\stopsteps
+ {\ctxlua{moduledata.steps.stopsteps()}}
+
+\unexpanded\def\startstep
+ {\dosingleempty\startstepindeed}
+
+\def\startstepindeed[#1]%
+ {\ctxlua{moduledata.steps.startstep("#1")}%
+ \normalstartstep}
+
+\unexpanded\def\stopstep
+ {\ctxlua{moduledata.steps.stopstep()}}
+
+\let\stopsubstep\relax
+
+\unexpanded\def\startsubstep#1\stopsubstep
+ {\ctxlua{moduledata.steps.startsubstep()}%
+ \ifcase\currentsubstep\relax
+ #1%
+ \else
+ \global\advance\wantedsubstep\plusone
+ \ifnum\currentsubstep>\wantedsubstep\else
+ #1%
+ \fi
+ \fi
+ \ctxlua{moduledata.steps.stopsubstep()}}
+
+\stopmodule
+
+\continueifinputfile{s-present-steps.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-steps-001.tex}
diff --git a/tex/context/modules/mkiv/s-references-identify.mkiv b/tex/context/modules/mkiv/s-references-identify.mkiv
new file mode 100644
index 000000000..85187be9d
--- /dev/null
+++ b/tex/context/modules/mkiv/s-references-identify.mkiv
@@ -0,0 +1,69 @@
+%D \module
+%D [ file=s-references-identity,
+%D version=2018.09.15,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Analyze References,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% begin info
+%
+% title : analyze reference
+%
+% comment : show the building blocks of a reference (list)
+%
+% end info
+
+\startmodule[references-identify]
+
+\startluacode
+
+moduledata.references = moduledata.references or { }
+
+local context = context
+local NC, NR = context.NC, context.NR
+local bold = context.bold
+local text = context
+
+function moduledata.references.show(str)
+ local t = structures.references.identify(str)
+ context.starttabulate { "|T|T|T|" }
+ for i=1,#t do
+ if i == 1 then
+ context.FL()
+ else
+ context.ML()
+ end
+ local ti = t[i]
+ NC() bold(i) NC() bold("reference") NC() bold(ti.reference) NC() NR()
+ NC() NC() text("kind") NC() text(ti.kind) NC() NR()
+ NC() NC() text("operation") NC() text(ti.operation) NC() NR()
+ NC() NC() text("arguments") NC() text(ti.arguments) NC() NR()
+ NC() NC() text("special") NC() text(ti.special) NC() NR()
+ end
+ context.LL()
+ context.stoptabulate()
+end
+
+\stopluacode
+
+\installmodulecommandluasingle \showreference {moduledata.references.show}
+
+\stopmodule
+
+\continueifinputfile{s-references-identify.mkiv}
+
+\usemodule[art-01]
+
+\starttext
+
+ \showreference[page(123),StartMovie{mymovie}]
+ \showreference[JS(Forget_Changes),CloseDocument]
+ \showreference[manual::contents]
+
+\stoptext
diff --git a/tex/context/modules/mkiv/s-xml-analyzers.lua b/tex/context/modules/mkiv/s-xml-analyzers.lua
index 6e7f7f2ba..93c6c37b6 100644
--- a/tex/context/modules/mkiv/s-xml-analyzers.lua
+++ b/tex/context/modules/mkiv/s-xml-analyzers.lua
@@ -230,6 +230,12 @@ local f_template = formatters [ [[
%% setups
+\xmlregistersetup{xml:presets:all}
+
+\starttext
+ \xmlprocessfile{main}{somefile.xml}{}
+\stoptext
+
%s
]] ]
diff --git a/tex/context/modules/mkiv/s-youless.mkiv b/tex/context/modules/mkiv/s-youless.mkiv
index d8b6e2ff6..e218e6110 100644
--- a/tex/context/modules/mkiv/s-youless.mkiv
+++ b/tex/context/modules/mkiv/s-youless.mkiv
@@ -33,7 +33,26 @@
moduledata.youless = { }
- local function process(specification)
+ local defaults = {
+ electricity = {
+ unit = "watt",
+ maxunit = "maxwatt",
+ },
+ watt = {
+ unit = "watt",
+ maxunit = "maxwatt",
+ },
+ pulse = {
+ unit = "watt",
+ maxunit = "maxwatt",
+ },
+ gas = {
+ unit = "liters",
+ maxunit = "maxliters",
+ },
+ }
+
+ local function process(specification,thevariant)
local data, message = utilities.youless.analyze(specification.filename or "youless-electricity.lua")
@@ -42,12 +61,32 @@
return
end
- local year = tonumber(specification.year) or os.today().year
- local years = data.years
local variant = data.variant
local unit = specification.unit
local maxunit = specification.maxunit
+ if thevariant then
+ if variant ~= thevariant then
+ context("invalid variant")
+ return
+ end
+ elseif variant then
+ local d = defaults[variant]
+ if d then
+ unit = d.unit
+ maxunit = d.maxunit
+ else
+ context("unknown variant")
+ return
+ end
+ else
+ context("invalid variant")
+ return
+ end
+
+ local year = tonumber(specification.year) or os.today().year
+ local month = tonumber(specification.month)
+ local years = data.years
local max = specification[maxunit]
if not max then
@@ -60,16 +99,19 @@
end
end
+ local firstmonth = month or 1
+ local lastmonth = month or 12
+
local max = max
local delta = round(max/10)
local scale = round(delta/20)
local mark = 3
for y=year,year do
- local year = years[y]
+ local year = years[y]
if year then
local grand = 0
- for m=1,12 do
+ for m=firstmonth,lastmonth do
local month = year.months[m]
if month then
context.startMPpage { offset = "10pt" }
@@ -167,7 +209,7 @@
function moduledata.youless.electricity(specification)
specification.unit = "watt"
specification.maxunit = "maxwatt"
- process(specification)
+ process(specification,"electricity")
end
moduledata.youless.watt = moduledata.youless.electricity
@@ -175,12 +217,16 @@
function moduledata.youless.gas(specification)
specification.unit = "liters"
specification.maxunit = "maxliters"
- process(specification)
+ process(specification,"gas")
end
function moduledata.youless.pulse(specification)
specification.unit = "watt"
specification.maxunit = "maxwatt"
+ process(specification,"pulse")
+ end
+
+ function moduledata.youless.graphics(specification)
process(specification)
end
diff --git a/tex/context/modules/mkiv/x-asciimath.lua b/tex/context/modules/mkiv/x-asciimath.lua
index b0d45659e..677ab0ce5 100644
--- a/tex/context/modules/mkiv/x-asciimath.lua
+++ b/tex/context/modules/mkiv/x-asciimath.lua
@@ -132,6 +132,12 @@ local reserved = {
["overbar"] = { false, "\\overline", "unary" },
["overline"] = { false, "\\overline", "unary" },
["underline"] = { false, "\\underline", "unary" },
+ ["overbrace"] = { false, "\\overbrace", "unary" },
+ ["underbrace"]= { false, "\\underbrace", "unary" },
+ ["overset"] = { false, "\\overset", "unary" },
+ ["underset"] = { false, "\\underset", "unary" },
+ ["obrace"] = { false, "\\overbrace", "unary" },
+ ["ubrace"] = { false, "\\underbrace", "unary" },
["ul"] = { false, "\\underline", "unary" },
["vec"] = { false, "\\overrightarrow", "unary" },
["dot"] = { false, "\\dot", "unary" }, -- 0x2D9
@@ -143,6 +149,7 @@ local reserved = {
["-"] = { true, "-" },
["*"] = { true, "⋅" },
["**"] = { true, "⋆" },
+ ["////"] = { true, "⁄⁄" }, -- crap
["//"] = { true, "⁄" }, -- \slash
["\\"] = { true, "\\" },
["xx"] = { true, "×" },
@@ -749,11 +756,14 @@ end
reserved.P = nil
reserved.S = nil
+
local isbinary = {
["\\frac"] = true,
["\\root"] = true,
["\\asciimathroot"] = true,
["\\asciimathstackrel"] = true,
+ ["\\overset"] = true,
+ ["\\underset"] = true,
}
local isunary = { -- can be taken from reserved
@@ -772,6 +782,10 @@ local isunary = { -- can be taken from reserved
["\\dot"] = true, --
["\\ddot"] = true, --
+ ["\\overbrace"] = true,
+ ["\\underbrace"] = true,
+ ["\\obrace"] = true,
+ ["\\ubrace"] = true,
}
local isfunny = {
@@ -1715,8 +1729,14 @@ local function collapse_fractions_2(t)
while i < n do
local current = t[i]
if current == "⁄" and i > 1 then -- \slash
- t[m] = "{" .. s_left .. t[i-1] .. s_mslash .. t[i+1] .. s_right .. "}"
- i = i + 2
+ if i < n and t[i+1] == "⁄" then
+ -- crap for
+ t[m] = "{" .. s_left .. t[i-1] .. s_mslash .. s_mslash .. t[i+2] .. s_right .. "}"
+ i = i + 3
+ else
+ t[m] = "{" .. s_left .. t[i-1] .. s_mslash .. t[i+1] .. s_right .. "}"
+ i = i + 2
+ end
if i < n then
m = m + 1
t[m] = t[i]
diff --git a/tex/context/modules/mkiv/x-mathml.mkiv b/tex/context/modules/mkiv/x-mathml.mkiv
index ea7f7d2e9..adc494314 100644
--- a/tex/context/modules/mkiv/x-mathml.mkiv
+++ b/tex/context/modules/mkiv/x-mathml.mkiv
@@ -350,7 +350,7 @@
%
% \def\postponedMMLactions
% {\global\setfalse\somepostponedMMLactions
-% \@EA\global\@EA\@@postponedMMLactions\@EA\emptytoks
+% \expandafter\global\expandafter\@@postponedMMLactions\expandafter\emptytoks
% \the\@@postponedMMLactions}
\startxmlsetups mml:apply
diff --git a/tex/context/modules/mkiv/x-setups-basics.mkiv b/tex/context/modules/mkiv/x-setups-basics.mkiv
index be96466b8..51c925397 100644
--- a/tex/context/modules/mkiv/x-setups-basics.mkiv
+++ b/tex/context/modules/mkiv/x-setups-basics.mkiv
@@ -66,6 +66,13 @@
\unprotect
+% We might apply this locally!
+
+\setupxml
+ [\c!entities=\v!yes]
+
+% So far.
+
\defineregister
[texmacro]
@@ -510,14 +517,11 @@
{\doifelsenextoptionalcs\cmd_show_setup_yes\cmd_show_setup_nop}
\def\cmd_show_setup_yes[#1]%
- {\iffirstargument
- \cmd_show_setup_nop{#1}%
- \else
- \expandafter\cmd_show_setup_nop
- \fi}
+ {\cmd_show_setup_nop{#1}}
\def\cmd_show_setup_nop#1% this will trigger 'used'
- {\registersort[texcommand][#1]%
+ {\begingroup
+ \registersort[texcommand][#1]%
\ifconditional\c_cmd_show_setup
\writestatus{setup}{#1 / \rawsynonymname{texcommand}{#1}}%
\fi
@@ -534,7 +538,8 @@
\let\m_cmd_instance\empty
\fi
\stopelement
- \stopelement}
+ \stopelement
+ \endgroup}
\unexpanded\def\placesetup {\placelistofsorts[texcommand][\c!criterium=\v!used]}
\unexpanded\def\placeallsetups{\placelistofsorts[texcommand][\c!criterium=\v!all ]}
diff --git a/tex/context/modules/mkiv/x-setups-overview.mkiv b/tex/context/modules/mkiv/x-setups-overview.mkiv
index f6dff12f5..512db3bd1 100644
--- a/tex/context/modules/mkiv/x-setups-overview.mkiv
+++ b/tex/context/modules/mkiv/x-setups-overview.mkiv
@@ -102,8 +102,9 @@
numeric h, w; boolean mapping ; path p, q, r ; color f, d ; pair s ;
h := OverlayHeight ; w := 2*OverlayWidth ;
r := unitsquare xyscaled (w,h) ;
- fill r withcolor \MPcolor{lightgray} ;
- mapping := lua.mp.processingmode("setups:mapping") ;
+ fill r withcolor resolvedcolor("lightgray") ;
+ % mapping := lua.mp.processingmode("setups:mapping") ;
+ mapping := lua.mp("processingmode","setups:mapping") ;
if mapping :
set_grid(w,h,w/8,w/160) ;
pickup pensquare yscaled (w/80) ;
@@ -114,8 +115,8 @@
forever :
s := center r randomized (w,h) ;
if new_on_grid(xpart s, ypart s) :
- d := .5[\MPcolor{LocalColor},\MPcolor{lightgray}] randomized (.5,.9) ;
- f := \MPcolor{lightgray} randomized (.5,.9) ;
+ d := .5[resolvedcolor("LocalColor"),resolvedcolor("lightgray")] randomized (.5,.9) ;
+ f := resolvedcolor("lightgray") randomized (.5,.9) ;
s := (dx,dy) ;
if mapping :
p := (-w/4,0) -- (w/4,0) ;