summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2023-02-06 19:14:14 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2023-02-06 19:14:14 +0100
commit0d0874ba797ee44f9fa53ed0fe95d7a863bf2f1b (patch)
treeea9c82877dd7a14db92e964277551370ecc156cb
parent83667a906d7cac842635bc5243db70f55b346562 (diff)
downloadcontext-0d0874ba797ee44f9fa53ed0fe95d7a863bf2f1b.tar.gz
2023-02-06 17:57:00
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-building.tex28
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex25
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-math.tex7
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-tex.tex4
-rw-r--r--scripts/context/lua/mtx-fonts.lua2
-rw-r--r--scripts/context/lua/mtxrun.lua12
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua12
-rw-r--r--scripts/context/stubs/unix/mtxrun12
-rw-r--r--scripts/context/stubs/win64/mtxrun.lua12
-rw-r--r--source/luametatex/cmake/lua.cmake14
-rw-r--r--source/luametatex/source/lua/lmtinterface.h1
-rw-r--r--source/luametatex/source/lua/lmttexlib.c3
-rw-r--r--source/luametatex/source/luacore/lua54/src/llimits.h21
-rw-r--r--source/luametatex/source/luacore/lua54/src/loslib.c17
-rw-r--r--source/luametatex/source/luacore/lua54/src/luaconf.h6
-rw-r--r--source/luametatex/source/tex/texalign.c4
-rw-r--r--source/luametatex/source/tex/texcommands.c4
-rw-r--r--source/luametatex/source/tex/texmaincontrol.c4
-rw-r--r--source/luametatex/source/tex/texmath.c252
-rw-r--r--source/luametatex/source/tex/texmlist.c68
-rw-r--r--source/luametatex/source/tex/texnodes.h133
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkii/mult-nl.mkii1
-rw-r--r--tex/context/base/mkii/mult-pe.mkii3
-rw-r--r--tex/context/base/mkiv/char-ini.lua2
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/data-con.lua6
-rw-r--r--tex/context/base/mkiv/font-cff.lua72
-rw-r--r--tex/context/base/mkiv/font-mis.lua2
-rw-r--r--tex/context/base/mkiv/font-onr.lua2
-rw-r--r--tex/context/base/mkiv/font-otl.lua2
-rw-r--r--tex/context/base/mkiv/font-shp.lua15
-rw-r--r--tex/context/base/mkiv/good-ini.lua4
-rw-r--r--tex/context/base/mkiv/math-ext.lua4
-rw-r--r--tex/context/base/mkiv/math-ren.lua7
-rw-r--r--tex/context/base/mkiv/math-ttv.lua10
-rw-r--r--tex/context/base/mkiv/math-vfu.lua9
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin24610 -> 24598 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin265594 -> 265646 bytes
-rw-r--r--tex/context/base/mkiv/strc-pag.lua4
-rw-r--r--tex/context/base/mkiv/strc-ref.lua10
-rw-r--r--tex/context/base/mkiv/typo-cln.lua2
-rw-r--r--tex/context/base/mkxl/buff-ver.mkxl1
-rw-r--r--tex/context/base/mkxl/char-prv.lmt210
-rw-r--r--tex/context/base/mkxl/chem-str.mkxl13
-rw-r--r--tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--tex/context/base/mkxl/context.mkxl210
-rw-r--r--tex/context/base/mkxl/driv-shp.lmt513
-rw-r--r--tex/context/base/mkxl/font-imp-scripts.lmt2
-rw-r--r--tex/context/base/mkxl/font-lib.mklx6
-rw-r--r--tex/context/base/mkxl/font-lig.lmt41
-rw-r--r--tex/context/base/mkxl/font-ogr.lmt10
-rw-r--r--tex/context/base/mkxl/font-onr.lmt606
-rw-r--r--tex/context/base/mkxl/font-tfm.lmt54
-rw-r--r--tex/context/base/mkxl/font-tpk.lmt135
-rw-r--r--tex/context/base/mkxl/font-unk.mkxl9
-rw-r--r--tex/context/base/mkxl/font-vfc.lmt49
-rw-r--r--tex/context/base/mkxl/font-vir.lmt6
-rw-r--r--tex/context/base/mkxl/lang-hyp.lmt1
-rw-r--r--tex/context/base/mkxl/lpdf-emb.lmt99
-rw-r--r--tex/context/base/mkxl/lpdf-lmt.lmt4
-rw-r--r--tex/context/base/mkxl/lpdf-rul.lmt16
-rw-r--r--tex/context/base/mkxl/math-act.lmt169
-rw-r--r--tex/context/base/mkxl/math-dim.lmt4
-rw-r--r--tex/context/base/mkxl/math-ext.lmt109
-rw-r--r--tex/context/base/mkxl/math-fbk.lmt3
-rw-r--r--tex/context/base/mkxl/math-fnt.lmt169
-rw-r--r--tex/context/base/mkxl/math-frc.mkxl9
-rw-r--r--tex/context/base/mkxl/math-inc.lmt94
-rw-r--r--tex/context/base/mkxl/math-inc.mkxl2
-rw-r--r--tex/context/base/mkxl/math-ini.mkxl23
-rw-r--r--tex/context/base/mkxl/math-noa.lmt36
-rw-r--r--tex/context/base/mkxl/math-ren.lmt74
-rw-r--r--tex/context/base/mkxl/math-stc.mklx6
-rw-r--r--tex/context/base/mkxl/math-ttv.lmt813
-rw-r--r--tex/context/base/mkxl/math-vfu.lmt988
-rw-r--r--tex/context/base/mkxl/page-ini.mkxl11
-rw-r--r--tex/context/base/mkxl/spac-hor.mkxl12
-rw-r--r--tex/context/base/mkxl/spac-prf.mklx3
-rw-r--r--tex/context/base/mkxl/strc-lst.lmt5
-rw-r--r--tex/context/base/mkxl/strc-ref.lmt11
-rw-r--r--tex/context/base/mkxl/syst-lua.lmt2
-rw-r--r--tex/context/base/mkxl/tabl-tbl.lmt60
-rw-r--r--tex/context/base/mkxl/tabl-tbl.mkxl12
-rw-r--r--tex/context/base/mkxl/task-ini.lmt4
-rw-r--r--tex/context/base/mkxl/type-set.mkxl16
-rw-r--r--tex/context/fonts/mkiv/antykwa-math.lfg70
-rw-r--r--tex/context/fonts/mkiv/bonum-math.lfg9
-rw-r--r--tex/context/fonts/mkiv/cambria-math.lfg7
-rw-r--r--tex/context/fonts/mkiv/common-math.lfg26
-rw-r--r--tex/context/fonts/mkiv/iwona-math.lfg72
-rw-r--r--tex/context/fonts/mkiv/kurier-math.lfg83
-rw-r--r--tex/context/fonts/mkiv/modern-math.lfg2
-rw-r--r--tex/context/fonts/mkiv/newcomputermodern-math.lfg4
-rw-r--r--tex/context/fonts/mkiv/type-imp-antykwa.mkiv29
-rw-r--r--tex/context/fonts/mkiv/type-imp-iwona.mkiv121
-rw-r--r--tex/context/fonts/mkiv/type-imp-kurier.mkiv29
-rw-r--r--tex/context/fonts/mkiv/type-imp-lucida.mkiv4
-rw-r--r--tex/context/interface/mkii/keys-nl.xml1
-rw-r--r--tex/context/interface/mkii/keys-pe.xml3
-rw-r--r--tex/context/modules/mkiv/s-fonts-charts.mkiv6
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua41
104 files changed, 4226 insertions, 1707 deletions
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-building.tex b/doc/context/sources/general/manuals/luametatex/luametatex-building.tex
index 4941a5929..ca09c53f9 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-building.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-building.tex
@@ -368,7 +368,8 @@ the acceptable range is from 0 to 65535.
\stopsubsection
-\startsubsection[title={\prm {hrule}, \prm {vrule}, \prm {srule}, \prm {nohrule} and \prm {novrule}}]
+\startsubsection[title={\prm {hrule}, \prm {vrule}, \prm {srule}, \prm {nohrule}, \prm {novrule},
+\prm {virtualhrule} and \prm {virtualvrule}}]
\topicindex {rules}
@@ -473,7 +474,22 @@ combination. This is especially important in math mode where then can adapt to
\stoplines
Because this kind of rules has a dedicated subtype you can intercept it in the backend
-if needed.
+if needed. The two virtual variants are special in the way that they are like normal
+rules but take no space. Can you figure out how to get this?
+
+\startlinecorrection[blank]
+\dontleavehmode \hbox{%
+ \hbox{\green before}%
+ {\darkblue \virtualvrule width 40pt height -2pt depth 4pt xoffset -20pt\relax}%
+ \hbox{\red after}%
+}
+\stoplinecorrection
+
+% \vskip5pt
+
+% \ruledvbox{\ruledhbox to 10pt{\green x}
+% \virtualhrule width 10pt height 2pt depth 2pt yoffset -2pt \relax
+% \ruledhbox to 10pt{\red x}}
\stopsubsection
@@ -604,6 +620,14 @@ Adapting will recalculate the dimensions with a scale factor for the glue:
\stopsubsection
+\startsubsection[title={\prm {boxvadjust}}]
+
+This primitive binds a \prm {vadjust} to a box and therefore also accepts the
+\type {pre} and \type {post} keywords which means that you can prepend and append
+as the box itself gets flushed.
+
+\stopsubsection
+
\startsubsection[title={Overshooting dimensions}]
\topicindex {boxes+overfull}
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex b/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex
index b64bcd4bc..13bc3a3e3 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex
@@ -969,8 +969,8 @@ An \prm {expandedafter} primitive is also provided as an variant on \prm
\stopsubsection
-\startsubsection[title={\prm {semiprotected}, \prm {semiexpanded}, \prm {expand} and
-\prm {semiexpand}}]
+\startsubsection[title={\prm {semiprotected}, \prm {semiexpanded}, \prm {expand},
+\prm {semiexpand} and \prm {expandactive}}]
These primitives can best be explained with a few examples. The semi boils down to
a bit more controlled usage of \prm {protected} macros.
@@ -1013,6 +1013,23 @@ I admit that is not yet applied much in \CONTEXT\ as we have no real need for it
and I implemented it more out for nostalgic reasons: the kind of selective
protect mechanism we have in \MKII.
+Assuming that \type {~} is made active:
+
+\starttyping
+\protected\def~{!}
+
+\edef\xxxx{~}
+\edef\xxxx{\expandactive~}
+\stoptyping
+
+In both cases the meaning will show \type {~} so it's kind of subtle because in reality
+they have the following internal representation:
+
+\starttyping
+active char 126
+protected call ~
+\stoptyping
+
\stopsubsection
\startsubsection[title={Going ahead with \prm {expandafterpars} and \prm {expandafterspaces}}]
@@ -1926,6 +1943,10 @@ This is slightly more efficient than constructing the string twice (deep down in
\LUATEX\ this also involves some \UTF8 juggling), but probably more relevant is
that it saves a few tokens and can make code a bit more readable.
+Active characters are stored in the hash with a special prefix sequence prepended
+to the character: \prm {csactive} or the never used \UTF\ representation of \type
+{U+FFFF}.
+
\stopsubsection
\startsubsection[title={\prm {futuredef} and \prm {futurecsname}}]
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-math.tex b/doc/context/sources/general/manuals/luametatex/luametatex-math.tex
index 1da49b455..61ec42ec3 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-math.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-math.tex
@@ -1562,9 +1562,10 @@ details can be found in the manuals that come with \CONTEXT\ for which all this
was implemented. In addition to \prm {mathordinary} (aka \prm {mathord}), \prm
{mathoperator} (aka \prm {mathop}), \prm {mathbinary} (aka \prm {mathbin}), \prm
{mathrelation} (aka \prm {mathrel}), \prm {mathopen}, \prm {mathclose}, \prm
-{mathpunct} and \prm {mathinner} we have \prm {mathfraction}, \prm {mathradical},
-\prm {mathmiddle}, \prm {mathaccent}, \prm {mathfenced}. \prm {mathghost} and the
-existing \prm {underline} and \prm {overline} class driven atoms.
+{mathpunctuation} (aka {mathpunct}) and \prm {mathinner} we have \prm
+{mathfraction}, \prm {mathradical}, \prm {mathmiddle}, \prm {mathaccent}, \prm
+{mathfenced}, \prm {mathghost} and the existing \prm {mathunderline} (aka \prm
+{underline}) and \prm {mathoverline} (aka \prm {overline}) class driven atoms.
The \prm {mathatom} primitive is the generic one and it accepts a couple of
keywords:
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex b/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex
index 837cc6e01..67661fe76 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex
@@ -1179,8 +1179,8 @@ tex.print(tex.romannumeral(123))
The first one returns the name only, the second one reports the size too.
\startfunctioncall
-tex.print(tex.fontname(tex.fontname))
-tex.print(tex.fontname(tex.fontidentidier))
+tex.print(tex.fontname(1))
+tex.print(tex.fontidentifier(1))
\stopfunctioncall
\subsubsection{\type {sp}}
diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua
index 1a677cb26..ab04cec13 100644
--- a/scripts/context/lua/mtx-fonts.lua
+++ b/scripts/context/lua/mtx-fonts.lua
@@ -16,7 +16,7 @@ local lower, gsub = string.lower, string.gsub
local concat = table.concat
local write_nl = (logs and logs.writer) or (texio and texio.write_nl) or print
-local otlversion = 3.131
+local otlversion = 3.132
local helpinfo = [[
<?xml version="1.0"?>
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 179111edf..a00dc5928 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -24226,7 +24226,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-con"] = package.loaded["data-con"] or true
--- original size: 5388, stripped down to: 3685
+-- original size: 5487, stripped down to: 3757
if not modules then modules={} end modules ['data-con']={
version=1.100,
@@ -24264,7 +24264,7 @@ local mt={
end,
__storage__=true
}
-function containers.define(category,subcategory,version,enabled)
+function containers.define(category,subcategory,version,enabled,reload)
if category and subcategory then
local c=allocated[category]
if not c then
@@ -24278,6 +24278,7 @@ function containers.define(category,subcategory,version,enabled)
subcategory=subcategory,
storage={},
enabled=enabled,
+ reload=reload,
version=version or math.pi,
trace=false,
}
@@ -24300,7 +24301,8 @@ function containers.is_valid(container,name)
end
function containers.read(container,name)
local storage=container.storage
- local stored=storage[name]
+ local reload=container.reload
+ local stored=not reload and storage[name]
if not stored and container.enabled and caches and containers.usecache then
stored=loaddatafromcache(container.readables,name,container.writable)
if stored and stored.cache_version==container.version then
@@ -26070,8 +26072,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1034828
--- stripped bytes : 407834
+-- original bytes : 1034927
+-- stripped bytes : 407861
-- end library merge
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 179111edf..a00dc5928 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -24226,7 +24226,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-con"] = package.loaded["data-con"] or true
--- original size: 5388, stripped down to: 3685
+-- original size: 5487, stripped down to: 3757
if not modules then modules={} end modules ['data-con']={
version=1.100,
@@ -24264,7 +24264,7 @@ local mt={
end,
__storage__=true
}
-function containers.define(category,subcategory,version,enabled)
+function containers.define(category,subcategory,version,enabled,reload)
if category and subcategory then
local c=allocated[category]
if not c then
@@ -24278,6 +24278,7 @@ function containers.define(category,subcategory,version,enabled)
subcategory=subcategory,
storage={},
enabled=enabled,
+ reload=reload,
version=version or math.pi,
trace=false,
}
@@ -24300,7 +24301,8 @@ function containers.is_valid(container,name)
end
function containers.read(container,name)
local storage=container.storage
- local stored=storage[name]
+ local reload=container.reload
+ local stored=not reload and storage[name]
if not stored and container.enabled and caches and containers.usecache then
stored=loaddatafromcache(container.readables,name,container.writable)
if stored and stored.cache_version==container.version then
@@ -26070,8 +26072,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1034828
--- stripped bytes : 407834
+-- original bytes : 1034927
+-- stripped bytes : 407861
-- end library merge
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 179111edf..a00dc5928 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -24226,7 +24226,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-con"] = package.loaded["data-con"] or true
--- original size: 5388, stripped down to: 3685
+-- original size: 5487, stripped down to: 3757
if not modules then modules={} end modules ['data-con']={
version=1.100,
@@ -24264,7 +24264,7 @@ local mt={
end,
__storage__=true
}
-function containers.define(category,subcategory,version,enabled)
+function containers.define(category,subcategory,version,enabled,reload)
if category and subcategory then
local c=allocated[category]
if not c then
@@ -24278,6 +24278,7 @@ function containers.define(category,subcategory,version,enabled)
subcategory=subcategory,
storage={},
enabled=enabled,
+ reload=reload,
version=version or math.pi,
trace=false,
}
@@ -24300,7 +24301,8 @@ function containers.is_valid(container,name)
end
function containers.read(container,name)
local storage=container.storage
- local stored=storage[name]
+ local reload=container.reload
+ local stored=not reload and storage[name]
if not stored and container.enabled and caches and containers.usecache then
stored=loaddatafromcache(container.readables,name,container.writable)
if stored and stored.cache_version==container.version then
@@ -26070,8 +26072,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1034828
--- stripped bytes : 407834
+-- original bytes : 1034927
+-- stripped bytes : 407861
-- end library merge
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index 179111edf..a00dc5928 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/mtxrun.lua
@@ -24226,7 +24226,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-con"] = package.loaded["data-con"] or true
--- original size: 5388, stripped down to: 3685
+-- original size: 5487, stripped down to: 3757
if not modules then modules={} end modules ['data-con']={
version=1.100,
@@ -24264,7 +24264,7 @@ local mt={
end,
__storage__=true
}
-function containers.define(category,subcategory,version,enabled)
+function containers.define(category,subcategory,version,enabled,reload)
if category and subcategory then
local c=allocated[category]
if not c then
@@ -24278,6 +24278,7 @@ function containers.define(category,subcategory,version,enabled)
subcategory=subcategory,
storage={},
enabled=enabled,
+ reload=reload,
version=version or math.pi,
trace=false,
}
@@ -24300,7 +24301,8 @@ function containers.is_valid(container,name)
end
function containers.read(container,name)
local storage=container.storage
- local stored=storage[name]
+ local reload=container.reload
+ local stored=not reload and storage[name]
if not stored and container.enabled and caches and containers.usecache then
stored=loaddatafromcache(container.readables,name,container.writable)
if stored and stored.cache_version==container.version then
@@ -26070,8 +26072,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1034828
--- stripped bytes : 407834
+-- original bytes : 1034927
+-- stripped bytes : 407861
-- end library merge
diff --git a/source/luametatex/cmake/lua.cmake b/source/luametatex/cmake/lua.cmake
index 7c7eac35d..a31f1c8b0 100644
--- a/source/luametatex/cmake/lua.cmake
+++ b/source/luametatex/cmake/lua.cmake
@@ -82,13 +82,13 @@ if (NOT MSVC)
)
endif (NOT MSVC)
-if (CMAKE_HOST_APPLE)
- target_compile_definitions(lua PUBLIC
- TARGET_OS_IOS=0
- TARGET_OS_WATCH=0
- TARGET_OS_TV=0
- )
-endif (CMAKE_HOST_APPLE)
+# if (CMAKE_HOST_APPLE)
+# target_compile_definitions(lua PUBLIC
+# TARGET_OS_IOS=0
+# TARGET_OS_WATCH=0
+# TARGET_OS_TV=0
+# )
+# endif (CMAKE_HOST_APPLE)
# this seems to be ok for mingw default
#
diff --git a/source/luametatex/source/lua/lmtinterface.h b/source/luametatex/source/lua/lmtinterface.h
index c3ea2a184..59ef808c8 100644
--- a/source/luametatex/source/lua/lmtinterface.h
+++ b/source/luametatex/source/lua/lmtinterface.h
@@ -472,6 +472,7 @@ make_lua_key(L, attributelist);\
make_lua_key(L, auto);\
make_lua_key(L, automatic);\
make_lua_key(L, automaticpenalty);\
+make_lua_key(L, autobase);\
make_lua_key(L, axis);\
make_lua_key(L, AxisHeight);\
make_lua_key(L, baselineskip);\
diff --git a/source/luametatex/source/lua/lmttexlib.c b/source/luametatex/source/lua/lmttexlib.c
index ecc0d63ed..0afd6cdf6 100644
--- a/source/luametatex/source/lua/lmttexlib.c
+++ b/source/luametatex/source/lua/lmttexlib.c
@@ -4829,7 +4829,7 @@ static int texlib_getglyphoptionvalues(lua_State *L)
static int texlib_getnoadoptionvalues(lua_State *L)
{
- lua_createtable(L, 2, 32);
+ lua_createtable(L, 2, 34);
lua_push_key_at_index(L, axis, noad_option_axis);
lua_push_key_at_index(L, noaxis, noad_option_no_axis);
lua_push_key_at_index(L, exact, noad_option_exact);
@@ -4865,6 +4865,7 @@ static int texlib_getnoadoptionvalues(lua_State *L)
lua_push_key_at_index(L, sourceonnucleus, noad_option_source_on_nucleus);
lua_push_key_at_index(L, fixedsuperorsubscript, noad_option_fixed_super_or_sub_script);
lua_push_key_at_index(L, fixedsuperandsubscript, noad_option_fixed_super_and_sub_script);
+ lua_push_key_at_index(L, autobase, noad_option_auto_base);
return 1;
}
diff --git a/source/luametatex/source/luacore/lua54/src/llimits.h b/source/luametatex/source/luacore/lua54/src/llimits.h
index 52a32f92e..251a27021 100644
--- a/source/luametatex/source/luacore/lua54/src/llimits.h
+++ b/source/luametatex/source/luacore/lua54/src/llimits.h
@@ -71,11 +71,24 @@ typedef signed char ls_byte;
/*
-** conversion of pointer to unsigned integer:
-** this is for hashing only; there is no problem if the integer
-** cannot hold the whole pointer value
+** conversion of pointer to unsigned integer: this is for hashing only;
+** there is no problem if the integer cannot hold the whole pointer
+** value. (In strict ISO C this may cause undefined behavior, but no
+** actual machine seems to bother.)
*/
-#define point2uint(p) ((unsigned int)((size_t)(p) & UINT_MAX))
+#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \
+ __STDC_VERSION__ >= 199901L
+#include <stdint.h>
+#if defined(UINTPTR_MAX) /* even in C99 this type is optional */
+#define L_P2I uintptr_t
+#else /* no 'intptr'? */
+#define L_P2I uintmax_t /* use the largerst available integer */
+#endif
+#else /* C89 option */
+#define L_P2I size_t
+#endif
+
+#define point2uint(p) ((unsigned int)((L_P2I)(p) & UINT_MAX))
diff --git a/source/luametatex/source/luacore/lua54/src/loslib.c b/source/luametatex/source/luacore/lua54/src/loslib.c
index 7eb05cafd..89ac06bc4 100644
--- a/source/luametatex/source/luacore/lua54/src/loslib.c
+++ b/source/luametatex/source/luacore/lua54/src/loslib.c
@@ -138,21 +138,14 @@
/* }================================================================== */
-/*
-** Despite claiming to be ISO, the C library in some Apple platforms
-** does not implement 'system'.
-*/
-#if !defined(l_system) && defined(__APPLE__) /* { */
-#include "TargetConditionals.h"
-#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV
-#define l_system(cmd) ((cmd) == NULL ? 0 : -1)
-#endif
-#endif /* } */
-
#if !defined(l_system)
+#if defined(LUA_USE_IOS)
+/* Despite claiming to be ISO C, iOS does not implement 'system'. */
+#define l_system(cmd) ((cmd) == NULL ? 0 : -1)
+#else
#define l_system(cmd) system(cmd) /* default definition */
#endif
-
+#endif
static int os_execute (lua_State *L) {
diff --git a/source/luametatex/source/luacore/lua54/src/luaconf.h b/source/luametatex/source/luacore/lua54/src/luaconf.h
index e4650fbce..137103ede 100644
--- a/source/luametatex/source/luacore/lua54/src/luaconf.h
+++ b/source/luametatex/source/luacore/lua54/src/luaconf.h
@@ -70,6 +70,12 @@
#endif
+#if defined(LUA_USE_IOS)
+#define LUA_USE_POSIX
+#define LUA_USE_DLOPEN
+#endif
+
+
/*
@@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits.
*/
diff --git a/source/luametatex/source/tex/texalign.c b/source/luametatex/source/tex/texalign.c
index 4ea4879c2..7a1045fea 100644
--- a/source/luametatex/source/tex/texalign.c
+++ b/source/luametatex/source/tex/texalign.c
@@ -971,7 +971,7 @@ void tex_run_alignment_initialize(void)
token_link(current) = null;
while (1) {
tex_aux_get_preamble_token();
- if (cur_cmd == parameter_cmd || (cur_cmd == alignment_cmd && cur_chr == align_content_code)) {
+ if ((cur_cmd == alignment_cmd && cur_chr == align_content_code) || cur_cmd == parameter_cmd) {
break;
} else if ((cur_cmd == alignment_cmd || cur_cmd == alignment_tab_cmd) && (lmt_input_state.align_state == -1000000)) {
if ((current == lmt_alignment_state.hold_token_head) && (! lmt_alignment_state.cur_loop) && (cur_cmd == alignment_tab_cmd)) {
@@ -1004,7 +1004,7 @@ void tex_run_alignment_initialize(void)
tex_aux_get_preamble_token();
if ((cur_cmd == alignment_cmd || cur_cmd == alignment_tab_cmd) && (lmt_input_state.align_state == -1000000)) {
break;
- } else if (cur_cmd == parameter_cmd || (cur_cmd == alignment_cmd && cur_chr == align_content_code)) {
+ } else if ((cur_cmd == alignment_cmd && cur_chr == align_content_code) || cur_cmd == parameter_cmd) {
tex_handle_error(
normal_error_type,
"Only one # is allowed per tab",
diff --git a/source/luametatex/source/tex/texcommands.c b/source/luametatex/source/tex/texcommands.c
index eaf2c7bbd..e52825b33 100644
--- a/source/luametatex/source/tex/texcommands.c
+++ b/source/luametatex/source/tex/texcommands.c
@@ -1056,8 +1056,8 @@ void tex_initialize_commands(void)
tex_primitive(tex_command, "unvcopy", un_vbox_cmd, copy_code, 0);
tex_primitive(luatex_command, "unvpack", un_vbox_cmd, unpack_code, 0);
- tex_primitive(etex_command, "pagediscards", un_vbox_cmd, page_discards_code, 0);
- tex_primitive(etex_command, "splitdiscards", un_vbox_cmd, split_discards_code, 0);
+ tex_primitive(etex_command, "pagediscards", un_vbox_cmd, page_discards_code, 0);
+ tex_primitive(etex_command, "splitdiscards", un_vbox_cmd, split_discards_code, 0);
tex_primitive(luatex_command, "insertunbox", un_vbox_cmd, insert_box_code, 0);
tex_primitive(luatex_command, "insertuncopy", un_vbox_cmd, insert_copy_code, 0);
diff --git a/source/luametatex/source/tex/texmaincontrol.c b/source/luametatex/source/tex/texmaincontrol.c
index c15704129..783de2b8b 100644
--- a/source/luametatex/source/tex/texmaincontrol.c
+++ b/source/luametatex/source/tex/texmaincontrol.c
@@ -4558,8 +4558,8 @@ static void tex_aux_set_def(int a, int force)
if (is_constant(a)) {
/* todo: check if already defined or just accept a leak */
set_token_reference(t, max_token_reference);
- } else if (! token_link(t)) {
- t = lmt_token_state.empty; /* maybe in tex_define */
+ // } else if (! token_link(t)) {
+ // t = lmt_token_state.empty; /* leaks */
}
tex_define(a, p, tex_flags_to_cmd(a), t);
}
diff --git a/source/luametatex/source/tex/texmath.c b/source/luametatex/source/tex/texmath.c
index 4979c1a23..0820b2405 100644
--- a/source/luametatex/source/tex/texmath.c
+++ b/source/luametatex/source/tex/texmath.c
@@ -2876,6 +2876,132 @@ void tex_finish_math_radical(void)
}
}
+// void tex_run_math_accent(void)
+// {
+// mathcodeval t = tex_no_math_code();
+// mathcodeval b = tex_no_math_code();
+// mathcodeval o = tex_no_math_code();
+// halfword code = cur_chr;
+// halfword accent = tex_new_node(accent_noad, bothflexible_accent_subtype);
+// quarterword subtype = ordinary_noad_subtype;
+// halfword attrlist = null;
+// if (cur_cmd == accent_cmd) {
+// tex_handle_error(
+// normal_error_type,
+// "Please use \\mathaccent for accents in math mode",
+// "I'm changing \\accent to \\mathaccent here; wish me luck. (Accents are not the\n"
+// "same in formulas as they are in text.)" );
+// }
+// tex_tail_append(accent);
+// switch (code) {
+// case math_accent_code:
+// /*tex |\mathaccent| */
+// t = tex_scan_mathchar(tex_mathcode);
+// break;
+// case math_uaccent_code:
+// /*tex |\Umathaccent| */
+// while (1) {
+// switch (tex_scan_character("abnsfABNSF", 0, 1, 0)) {
+// case 'a': case 'A':
+// if (tex_scan_mandate_keyword("attr", 1)) {
+// attrlist = tex_scan_attribute(attrlist);
+// }
+// break;
+// case 's': case 'S':
+// if (tex_scan_mandate_keyword("source", 1)) {
+// noad_source(accent) = tex_scan_int(0, NULL);
+// }
+// break;
+// case 'f': case 'F':
+// if (tex_scan_mandate_keyword("fraction", 1)) {
+// accent_fraction(accent) = tex_scan_int(0, NULL);
+// }
+// break;
+// case 'n': case 'N':
+// if (tex_scan_mandate_keyword("nooverflow", 1)) {
+// /*tex
+// Actually there never is an overflow but for consistency we do
+// accept this key. Mayebe in the future it will be used.
+// */
+// noad_options(accent) |= noad_option_no_overflow;
+// }
+// break;
+// case 'b': case 'B':
+// if (tex_scan_mandate_keyword("base", 1)) {
+// noad_options(accent) |= noad_option_auto_base;
+// }
+// break;
+// default:
+// goto DONE;
+// }
+// }
+// DONE:
+// /* todo: integrate in the above */
+// if (tex_scan_keyword("fixed")) {
+// /*tex top */
+// node_subtype(accent) = fixedtop_accent_subtype;
+// t = tex_scan_mathchar(umath_mathcode);
+// } else if (tex_scan_keyword("both")) {
+// /*tex top bottom */
+// if (tex_scan_keyword("fixed")) {
+// node_subtype(accent) = fixedtop_accent_subtype;
+// }
+// t = tex_scan_mathchar(umath_mathcode);
+// if (tex_scan_keyword("fixed")) {
+// node_subtype(accent) = fixedboth_accent_subtype;
+// }
+// b = tex_scan_mathchar(umath_mathcode);
+// } else if (tex_scan_keyword("bottom")) {
+// /*tex bottom */
+// if (tex_scan_keyword("fixed")) {
+// node_subtype(accent) = fixedbottom_accent_subtype;
+// }
+// b = tex_scan_mathchar(umath_mathcode);
+// } else if (tex_scan_keyword("top")) {
+// /*tex top */
+// if (tex_scan_keyword("fixed")) {
+// node_subtype(accent) = fixedtop_accent_subtype;
+// }
+// t = tex_scan_mathchar(umath_mathcode);
+// } else if (tex_scan_keyword("overlay")) {
+// /* overlay */
+// if (tex_scan_keyword("fixed")) {
+// node_subtype(accent) = fixedtop_accent_subtype;
+// }
+// o = tex_scan_mathchar(umath_mathcode);
+// } else {
+// /*tex top */
+// t = tex_scan_mathchar(umath_mathcode);
+// }
+// break;
+// default:
+// tex_confusion("scan math accent");
+// }
+// if (attrlist) {
+// tex_attach_attribute_list_attribute(accent, attrlist);
+// }
+// if (! (t.character_value == 0 && t.family_value == 0)) {
+// halfword n = tex_new_node(math_char_node, 0);
+// subtype = tex_aux_set_math_char(n, &t, NULL);
+// accent_top_character(accent) = n;
+// }
+// if (! (b.character_value == 0 && b.family_value == 0)) {
+// halfword n = tex_new_node(math_char_node, 0);
+// subtype = tex_aux_set_math_char(n, &b, NULL);
+// accent_bottom_character(accent) = n;
+// }
+// if (! (o.character_value == 0 && o.family_value == 0)) {
+// halfword n = tex_new_node(math_char_node, 0);
+// subtype = tex_aux_set_math_char(n, &o, NULL);
+// accent_middle_character(accent) = n;
+// }
+// {
+// halfword n = tex_new_node(math_char_node, subtype);
+// noad_nucleus(accent) = n;
+// tex_aux_scan_math(n, tex_math_style_variant(cur_list.math_style, math_parameter_accent_variant), 0, 0, 0, 0, unset_noad_class, unset_noad_class);
+// }
+// }
+
void tex_run_math_accent(void)
{
mathcodeval t = tex_no_math_code();
@@ -2901,7 +3027,7 @@ void tex_run_math_accent(void)
case math_uaccent_code:
/*tex |\Umathaccent| */
while (1) {
- switch (tex_scan_character("ansfASFN", 0, 1, 0)) {
+ switch (tex_scan_character("abnsftoABNSFTO", 0, 1, 0)) {
case 'a': case 'A':
if (tex_scan_mandate_keyword("attr", 1)) {
attrlist = tex_scan_attribute(attrlist);
@@ -2913,10 +3039,23 @@ void tex_run_math_accent(void)
}
break;
case 'f': case 'F':
- if (tex_scan_mandate_keyword("fraction", 1)) {
- accent_fraction(accent) = tex_scan_int(0, NULL);
+ switch (tex_scan_character("frFR", 0, 0, 0)) {
+ case 'r': case 'R':
+ if (tex_scan_mandate_keyword("fraction", 2)) {
+ accent_fraction(accent) = tex_scan_int(0, NULL);
+ }
+ break;
+ case 'f': case 'F':
+ /*tex fixed <char> */
+ if (tex_scan_mandate_keyword("fixed", 2)) {
+ node_subtype(accent) = fixedtop_accent_subtype;
+ t = tex_scan_mathchar(umath_mathcode);
+ }
+ goto DONE;
+ default:
+ tex_aux_show_keyword_error("fraction|fixed");
+ goto DONE;
}
- break;
case 'n': case 'N':
if (tex_scan_mandate_keyword("nooverflow", 1)) {
/*tex
@@ -2926,52 +3065,79 @@ void tex_run_math_accent(void)
noad_options(accent) |= noad_option_no_overflow;
}
break;
+ case 'b': case 'B':
+ switch (tex_scan_character("aoAo", 0, 0, 0)) {
+ case 'a': case 'A':
+ if (tex_scan_mandate_keyword("base", 2)) {
+ noad_options(accent) |= noad_option_auto_base;
+ }
+ break;
+ case 'o': case 'O':
+ /*tex bottom [fixed] <char> */
+ /*tex both [fixed] <char> [fixed] <char> */
+ if (tex_scan_character("t", 0, 0, 0)) {
+ switch (tex_scan_character("thTH", 0, 0, 0)) {
+ case 'h': case 'H':
+ if (tex_scan_mandate_keyword("both", 4)) {
+ /*tex top bottom */
+ if (tex_scan_keyword("fixed")) {
+ node_subtype(accent) = fixedtop_accent_subtype;
+ }
+ t = tex_scan_mathchar(umath_mathcode);
+ if (tex_scan_keyword("fixed")) {
+ node_subtype(accent) = fixedboth_accent_subtype;
+ }
+ b = tex_scan_mathchar(umath_mathcode);
+ }
+ goto DONE;
+ case 't': case 'T':
+ if (tex_scan_mandate_keyword("bottom", 4)) {
+ /*tex bottom */
+ if (tex_scan_keyword("fixed")) {
+ node_subtype(accent) = fixedbottom_accent_subtype;
+ }
+ b = tex_scan_mathchar(umath_mathcode);
+ }
+ goto DONE;
+ default:
+ tex_aux_show_keyword_error("both|bottom");
+ goto DONE;
+ }
+ }
+ goto DONE;
+ default:
+ tex_aux_show_keyword_error("base|both|bottom");
+ goto DONE;
+ }
+ break;
+ case 't': case 'T':
+ /*tex top [fixed] <char> */
+ if (tex_scan_mandate_keyword("top", 1)) {
+ if (tex_scan_keyword("fixed")) {
+ node_subtype(accent) = fixedtop_accent_subtype;
+ }
+ t = tex_scan_mathchar(umath_mathcode);
+ }
+ goto DONE;
+ case 'o': case 'O':
+ /*tex overlay [fixed] <char> */
+ if (tex_scan_mandate_keyword("overlay", 1)) {
+ if (tex_scan_keyword("fixed")) {
+ node_subtype(accent) = fixedtop_accent_subtype;
+ }
+ o = tex_scan_mathchar(umath_mathcode);
+ }
+ goto DONE;
default:
+ /*tex top <char> */
+ t = tex_scan_mathchar(umath_mathcode);
goto DONE;
}
}
- DONE:
- /* todo: integrate in the above */
- if (tex_scan_keyword("fixed")) {
- /*tex top */
- node_subtype(accent) = fixedtop_accent_subtype;
- t = tex_scan_mathchar(umath_mathcode);
- } else if (tex_scan_keyword("both")) {
- /*tex top bottom */
- if (tex_scan_keyword("fixed")) {
- node_subtype(accent) = fixedtop_accent_subtype;
- }
- t = tex_scan_mathchar(umath_mathcode);
- if (tex_scan_keyword("fixed")) {
- node_subtype(accent) = fixedboth_accent_subtype;
- }
- b = tex_scan_mathchar(umath_mathcode);
- } else if (tex_scan_keyword("bottom")) {
- /*tex bottom */
- if (tex_scan_keyword("fixed")) {
- node_subtype(accent) = fixedbottom_accent_subtype;
- }
- b = tex_scan_mathchar(umath_mathcode);
- } else if (tex_scan_keyword("top")) {
- /*tex top */
- if (tex_scan_keyword("fixed")) {
- node_subtype(accent) = fixedtop_accent_subtype;
- }
- t = tex_scan_mathchar(umath_mathcode);
- } else if (tex_scan_keyword("overlay")) {
- /* overlay */
- if (tex_scan_keyword("fixed")) {
- node_subtype(accent) = fixedtop_accent_subtype;
- }
- o = tex_scan_mathchar(umath_mathcode);
- } else {
- /*tex top */
- t = tex_scan_mathchar(umath_mathcode);
- }
- break;
default:
tex_confusion("scan math accent");
}
+ DONE:
if (attrlist) {
tex_attach_attribute_list_attribute(accent, attrlist);
}
diff --git a/source/luametatex/source/tex/texmlist.c b/source/luametatex/source/tex/texmlist.c
index b3f8cf294..d7c37e47a 100644
--- a/source/luametatex/source/tex/texmlist.c
+++ b/source/luametatex/source/tex/texmlist.c
@@ -1136,13 +1136,12 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m
if (overlap < initial) {
initial = overlap;
}
- // if (advance == 0) {
- // /*tex for tfm fonts (so no need for scaling) */
- // advance = tex_aux_math_x_size_scaled(fnt, tex_char_width_from_font(fnt, e->glyph), size); /* todo: combine */
- if (advance <= 0) {
- tex_formatted_error("fonts", "bad horizontal extensible character %i in font %i", chr, fnt);
- }
- // }
+ if (advance == 0) {
+ advance = tex_aux_math_x_size_scaled(fnt, tex_char_width_from_font(fnt, e->glyph), size); /* todo: combine */
+ }
+ if (advance <= 0) {
+ tex_formatted_error("fonts", "bad horizontal extensible character %i in font %i", chr, fnt);
+ }
max_natural += advance - initial;
overlap = tex_aux_math_x_size_scaled(fnt, e->end_overlap, size);
} else {
@@ -1156,13 +1155,12 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m
if (overlap < initial) {
initial = overlap;
}
- // if (advance == 0) {
- // /*tex for tfm fonts (so no need for scaling) */
- // advance = tex_aux_math_x_size_scaled(fnt, tex_char_width_from_font(fnt, e->glyph), size); /* todo: combine */
- if (advance <= 0) {
- tex_formatted_error("fonts", "bad horizontal extensible character %i in font %i", chr, fnt);
- }
- // }
+ if (advance == 0) {
+ advance = tex_aux_math_x_size_scaled(fnt, tex_char_width_from_font(fnt, e->glyph), size); /* todo: combine */
+ }
+ if (advance <= 0) {
+ tex_formatted_error("fonts", "bad horizontal extensible character %i in font %i", chr, fnt);
+ }
max_natural += advance - initial;
overlap = tex_aux_math_x_size_scaled(fnt, e->end_overlap, size);
pieces--;
@@ -1180,12 +1178,12 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m
if (overlap < initial) {
initial = overlap;
}
- // if (advance == 0) {
- // advance = tex_aux_math_y_size_scaled(fnt, tex_char_total_from_font(fnt, e->glyph), size); /* todo: combine */
- if (advance <= 0) {
- tex_formatted_error("fonts", "bad vertical extensible character %i in font %i", chr, fnt);
- }
- // }
+ if (advance == 0) {
+ advance = tex_aux_math_y_size_scaled(fnt, tex_char_total_from_font(fnt, e->glyph), size); /* todo: combine */
+ }
+ if (advance <= 0) {
+ tex_formatted_error("fonts", "bad vertical extensible character %i in font %i", chr, fnt);
+ }
max_natural += advance - initial;
overlap = tex_aux_math_y_size_scaled(fnt, e->end_overlap, size);
} else {
@@ -1199,12 +1197,12 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m
if (overlap < initial) {
initial = overlap;
}
- // if (advance == 0) {
- // advance = tex_aux_math_y_size_scaled(fnt, tex_char_total_from_font(fnt, e->glyph), size); /* todo: combine */
- if (advance <= 0) {
- tex_formatted_error("fonts", "bad vertical extensible character %i in font %i", chr, fnt);
- }
- // }
+ if (advance == 0) {
+ advance = tex_aux_math_y_size_scaled(fnt, tex_char_total_from_font(fnt, e->glyph), size); /* todo: combine */
+ }
+ if (advance <= 0) {
+ tex_formatted_error("fonts", "bad vertical extensible character %i in font %i", chr, fnt);
+ }
max_natural += advance - initial;
overlap = tex_aux_math_y_size_scaled(fnt, e->end_overlap, size);
pieces--;
@@ -1426,10 +1424,13 @@ static halfword tex_aux_make_delimiter(halfword target, halfword delimiter, int
}
}
if (tex_char_has_tag_from_font(curfnt, curchr, extensible_tag)) {
- if (flat ? tex_char_has_tag_from_font(curfnt, curchr, horizontal_tag) : tex_char_has_tag_from_font(curfnt, curchr, vertical_tag)) {
- fnt = curfnt;
- chr = curchr;
- do_parts = 1;
+ if (tex_char_has_tag_from_font(curfnt, curchr, horizontal_tag) || tex_char_has_tag_from_font(curfnt, curchr, vertical_tag)) {
+ /*tex We only check when we are explicit. */
+ if (flat ? tex_char_has_tag_from_font(curfnt, curchr, horizontal_tag) : tex_char_has_tag_from_font(curfnt, curchr, vertical_tag)) {
+ fnt = curfnt;
+ chr = curchr;
+ do_parts = 1;
+ }
}
goto FOUND;
} else if (count > 1000) {
@@ -2745,7 +2746,7 @@ typedef enum math_accent_location_codes {
top_accent_code = 1,
bot_accent_code = 2,
overlay_accent_code = 4,
- stretch_accent_code = 8,
+ stretch_accent_code = 8, /* reserved, not yet set */
} math_accent_location_codes;
static int tex_aux_compute_accent_skew(halfword target, int flags, scaled *skew, halfword size)
@@ -2982,8 +2983,11 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal
}
}
}
+ if (has_noad_option_auto_base(target)) {
+ b = - box_depth(accent);
+ }
if (b != undefined_math_parameter) {
- /* not okay */
+ /* not okay but interesting with negative values */
delta = baseheight < b ? baseheight : b;
}
if (u != undefined_math_parameter) {
diff --git a/source/luametatex/source/tex/texnodes.h b/source/luametatex/source/tex/texnodes.h
index 113de8f40..e19ff933d 100644
--- a/source/luametatex/source/tex/texnodes.h
+++ b/source/luametatex/source/tex/texnodes.h
@@ -1743,46 +1743,47 @@ typedef struct noad_classes {
// # else
typedef enum noad_options {
// # endif
- noad_option_axis = 0x000000001,
- noad_option_no_axis = 0x000000002,
- noad_option_exact = 0x000000004,
- noad_option_left = 0x000000008, /* align option for overflown under/over */ /* used ? */
- noad_option_middle = 0x000000010, /* idem */
- noad_option_right = 0x000000020, /* idem */
- noad_option_adapt_to_left_size = 0x000000040, /* old trickery, might go away but kind of fun */
- noad_option_adapt_to_right_size = 0x000000080, /* idem */
- noad_option_no_sub_script = 0x000000100,
- noad_option_no_super_script = 0x000000200,
- noad_option_no_sub_pre_script = 0x000000400,
- noad_option_no_super_pre_script = 0x000000800,
- noad_option_no_script = 0x000001000,
- noad_option_no_overflow = 0x000002000, /* keep (middle) extensible widthin target size */
- noad_option_void = 0x000004000, /* wipe and set width to zero */
- noad_option_phantom = 0x000008000, /* wipe */
- noad_option_openup_height = 0x000010000,
- noad_option_openup_depth = 0x000020000,
- noad_option_limits = 0x000040000, /* traditional modifier */
- noad_option_no_limits = 0x000080000, /* idem */
- noad_option_prefer_font_thickness = 0x000100000,
- noad_option_no_ruling = 0x000200000,
- noad_option_shifted_sub_script = 0x000400000,
- noad_option_shifted_super_script = 0x000800000,
- noad_option_shifted_sub_pre_script = 0x001000000,
- noad_option_shifted_super_pre_script = 0x002000000,
- noad_option_unpack_list = 0x004000000,
- noad_option_no_check = 0x008000000, /* don't check for missing end fence */
- noad_option_auto = 0x010000000,
- noad_option_unroll_list = 0x020000000,
- noad_option_followed_by_space = 0x040000000,
- noad_option_proportional = 0x080000000,
+ noad_option_axis = 0x0000000001,
+ noad_option_no_axis = 0x0000000002,
+ noad_option_exact = 0x0000000004,
+ noad_option_left = 0x0000000008, /* align option for overflown under/over */ /* used ? */
+ noad_option_middle = 0x0000000010, /* idem */
+ noad_option_right = 0x0000000020, /* idem */
+ noad_option_adapt_to_left_size = 0x0000000040, /* old trickery, might go away but kind of fun */
+ noad_option_adapt_to_right_size = 0x0000000080, /* idem */
+ noad_option_no_sub_script = 0x0000000100,
+ noad_option_no_super_script = 0x0000000200,
+ noad_option_no_sub_pre_script = 0x0000000400,
+ noad_option_no_super_pre_script = 0x0000000800,
+ noad_option_no_script = 0x0000001000,
+ noad_option_no_overflow = 0x0000002000, /* keep (middle) extensible widthin target size */
+ noad_option_void = 0x0000004000, /* wipe and set width to zero */
+ noad_option_phantom = 0x0000008000, /* wipe */
+ noad_option_openup_height = 0x0000010000,
+ noad_option_openup_depth = 0x0000020000,
+ noad_option_limits = 0x0000040000, /* traditional modifier */
+ noad_option_no_limits = 0x0000080000, /* idem */
+ noad_option_prefer_font_thickness = 0x0000100000,
+ noad_option_no_ruling = 0x0000200000,
+ noad_option_shifted_sub_script = 0x0000400000,
+ noad_option_shifted_super_script = 0x0000800000,
+ noad_option_shifted_sub_pre_script = 0x0001000000,
+ noad_option_shifted_super_pre_script = 0x0002000000,
+ noad_option_unpack_list = 0x0004000000,
+ noad_option_no_check = 0x0008000000, /* don't check for missing end fence */
+ noad_option_auto = 0x0010000000,
+ noad_option_unroll_list = 0x0020000000,
+ noad_option_followed_by_space = 0x0040000000,
+ noad_option_proportional = 0x0080000000,
/*tex Watch out: the following options exceed halfword: |noad_options| are |long long|. */
} noad_options;
/*tex The Microsoft compiler truncates to int, so: */
-# define noad_option_source_on_nucleus 0x100000000
-# define noad_option_fixed_super_or_sub_script 0x200000000
-# define noad_option_fixed_super_and_sub_script 0x400000000
+# define noad_option_source_on_nucleus 0x0100000000
+# define noad_option_fixed_super_or_sub_script 0x0200000000
+# define noad_option_fixed_super_and_sub_script 0x0400000000
+# define noad_option_auto_base 0x0800000000
# define has_option(a,b) (((a) & (b)) == (b))
# define unset_option(a,b) ((a) & ~(b))
@@ -1809,37 +1810,38 @@ inline static int has_noad_no_script_option(halfword n, halfword option)
# define has_noad_option_nosubprescript(a) has_noad_no_script_option(a, noad_option_no_sub_pre_script)
# define has_noad_option_nosupprescript(a) has_noad_no_script_option(a, noad_option_no_super_pre_script)
-# define has_noad_option_shiftedsubscript(a) (has_option(noad_options(a), noad_option_shifted_sub_script))
-# define has_noad_option_shiftedsupscript(a) (has_option(noad_options(a), noad_option_shifted_super_script))
-# define has_noad_option_shiftedsubprescript(a) (has_option(noad_options(a), noad_option_shifted_sub_pre_script))
-# define has_noad_option_shiftedsupprescript(a) (has_option(noad_options(a), noad_option_shifted_super_pre_script))
-# define has_noad_option_axis(a) (has_option(noad_options(a), noad_option_axis))
-# define has_noad_option_exact(a) (has_option(noad_options(a), noad_option_exact))
-# define has_noad_option_noaxis(a) (has_option(noad_options(a), noad_option_no_axis))
-# define has_noad_option_openupheight(a) (has_option(noad_options(a), noad_option_openup_height))
-# define has_noad_option_openupdepth(a) (has_option(noad_options(a), noad_option_openup_depth))
-# define has_noad_option_adapttoleft(a) (has_option(noad_options(a), noad_option_adapt_to_left_size))
-# define has_noad_option_adapttoright(a) (has_option(noad_options(a), noad_option_adapt_to_right_size))
-# define has_noad_option_limits(a) (has_option(noad_options(a), noad_option_limits))
-# define has_noad_option_nolimits(a) (has_option(noad_options(a), noad_option_no_limits))
-# define has_noad_option_nooverflow(a) (has_option(noad_options(a), noad_option_no_overflow))
-# define has_noad_option_preferfontthickness(a) (has_option(noad_options(a), noad_option_prefer_font_thickness))
-# define has_noad_option_noruling(a) (has_option(noad_options(a), noad_option_no_ruling))
-# define has_noad_option_unpacklist(a) (has_option(noad_options(a), noad_option_unpack_list))
-# define has_noad_option_nocheck(a) (has_option(noad_options(a), noad_option_no_check))
-# define has_noad_option_exact(a) (has_option(noad_options(a), noad_option_exact))
-# define has_noad_option_left(a) (has_option(noad_options(a), noad_option_left))
-# define has_noad_option_middle(a) (has_option(noad_options(a), noad_option_middle))
-# define has_noad_option_right(a) (has_option(noad_options(a), noad_option_right))
-# define has_noad_option_auto(a) (has_option(noad_options(a), noad_option_auto))
-# define has_noad_option_phantom(a) (has_option(noad_options(a), noad_option_phantom))
-# define has_noad_option_void(a) (has_option(noad_options(a), noad_option_void))
-# define has_noad_option_unrolllist(a) (has_option(noad_options(a), noad_option_unroll_list))
-# define has_noad_option_followedbyspace(a) (has_option(noad_options(a), noad_option_followed_by_space))
-# define has_noad_option_proportional(a) (has_option(noad_options(a), noad_option_proportional))
-# define has_noad_option_source_on_nucleus(a) (has_option(noad_options(a), noad_option_source_on_nucleus))
+# define has_noad_option_shiftedsubscript(a) (has_option(noad_options(a), noad_option_shifted_sub_script))
+# define has_noad_option_shiftedsupscript(a) (has_option(noad_options(a), noad_option_shifted_super_script))
+# define has_noad_option_shiftedsubprescript(a) (has_option(noad_options(a), noad_option_shifted_sub_pre_script))
+# define has_noad_option_shiftedsupprescript(a) (has_option(noad_options(a), noad_option_shifted_super_pre_script))
+# define has_noad_option_axis(a) (has_option(noad_options(a), noad_option_axis))
+# define has_noad_option_exact(a) (has_option(noad_options(a), noad_option_exact))
+# define has_noad_option_noaxis(a) (has_option(noad_options(a), noad_option_no_axis))
+# define has_noad_option_openupheight(a) (has_option(noad_options(a), noad_option_openup_height))
+# define has_noad_option_openupdepth(a) (has_option(noad_options(a), noad_option_openup_depth))
+# define has_noad_option_adapttoleft(a) (has_option(noad_options(a), noad_option_adapt_to_left_size))
+# define has_noad_option_adapttoright(a) (has_option(noad_options(a), noad_option_adapt_to_right_size))
+# define has_noad_option_limits(a) (has_option(noad_options(a), noad_option_limits))
+# define has_noad_option_nolimits(a) (has_option(noad_options(a), noad_option_no_limits))
+# define has_noad_option_nooverflow(a) (has_option(noad_options(a), noad_option_no_overflow))
+# define has_noad_option_preferfontthickness(a) (has_option(noad_options(a), noad_option_prefer_font_thickness))
+# define has_noad_option_noruling(a) (has_option(noad_options(a), noad_option_no_ruling))
+# define has_noad_option_unpacklist(a) (has_option(noad_options(a), noad_option_unpack_list))
+# define has_noad_option_nocheck(a) (has_option(noad_options(a), noad_option_no_check))
+# define has_noad_option_exact(a) (has_option(noad_options(a), noad_option_exact))
+# define has_noad_option_left(a) (has_option(noad_options(a), noad_option_left))
+# define has_noad_option_middle(a) (has_option(noad_options(a), noad_option_middle))
+# define has_noad_option_right(a) (has_option(noad_options(a), noad_option_right))
+# define has_noad_option_auto(a) (has_option(noad_options(a), noad_option_auto))
+# define has_noad_option_phantom(a) (has_option(noad_options(a), noad_option_phantom))
+# define has_noad_option_void(a) (has_option(noad_options(a), noad_option_void))
+# define has_noad_option_unrolllist(a) (has_option(noad_options(a), noad_option_unroll_list))
+# define has_noad_option_followedbyspace(a) (has_option(noad_options(a), noad_option_followed_by_space))
+# define has_noad_option_proportional(a) (has_option(noad_options(a), noad_option_proportional))
+# define has_noad_option_source_on_nucleus(a) (has_option(noad_options(a), noad_option_source_on_nucleus))
# define has_noad_option_fixed_super_or_sub_script(a) (has_option(noad_options(a), noad_option_fixed_super_or_sub_script))
# define has_noad_option_fixed_super_and_sub_script(a) (has_option(noad_options(a), noad_option_fixed_super_and_sub_script))
+# define has_noad_option_auto_base(a) (has_option(noad_options(a), noad_option_auto_base))
/*tex
In the meantime the codes and subtypes are in sync. The variable component does not really
@@ -1928,7 +1930,8 @@ typedef enum math_modifier_types {
# define accent_top_overshoot noad_extra_5
# define accent_bot_overshoot noad_extra_6
-typedef enum math_accent_subtypes {
+typedef enum math_accent_subtypes {
+ /* we can be more specific: todo fixedoverlay_accent_subtype */
bothflexible_accent_subtype,
fixedtop_accent_subtype,
fixedbottom_accent_subtype,
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index e224c87b5..37361a1dc 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2023.01.26 18:32}
+\newcontextversion{2023.02.06 17:55}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index dd497d22f..ea7523043 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2023.01.26 18:32}
+\edef\contextversion{2023.02.06 17:55}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-nl.mkii b/tex/context/base/mkii/mult-nl.mkii
index 0446f2084..1eabd6841 100644
--- a/tex/context/base/mkii/mult-nl.mkii
+++ b/tex/context/base/mkii/mult-nl.mkii
@@ -450,6 +450,7 @@
\setinterfacevariable{printable}{printbaar}
\setinterfacevariable{process}{proces}
\setinterfacevariable{product}{produkt}
+\setinterfacevariable{profile}{profile}
\setinterfacevariable{program}{programma}
\setinterfacevariable{project}{project}
\setinterfacevariable{protected}{beschermd}
diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii
index 8968b2083..659144c76 100644
--- a/tex/context/base/mkii/mult-pe.mkii
+++ b/tex/context/base/mkii/mult-pe.mkii
@@ -450,6 +450,7 @@
\setinterfacevariable{printable}{قابل‌چاپ}
\setinterfacevariable{process}{پردازش}
\setinterfacevariable{product}{محصول}
+\setinterfacevariable{profile}{profile}
\setinterfacevariable{program}{برنامه}
\setinterfacevariable{project}{پروژه}
\setinterfacevariable{protected}{حفاظت‌شده}
@@ -719,6 +720,7 @@
\setinterfaceconstant{bookmark}{چوبخط}
\setinterfaceconstant{bottom}{پایین}
\setinterfaceconstant{bottomafter}{bottomafter}
+\setinterfaceconstant{bottomalign}{bottomalign}
\setinterfaceconstant{bottombefore}{bottombefore}
\setinterfaceconstant{bottomcolor}{bottomcolor}
\setinterfaceconstant{bottomcommand}{bottomcommand}
@@ -1333,6 +1335,7 @@
\setinterfaceconstant{toffset}{toffset}
\setinterfaceconstant{tolerance}{بردباری}
\setinterfaceconstant{top}{بالا}
+\setinterfaceconstant{topalign}{topalign}
\setinterfaceconstant{topcolor}{topcolor}
\setinterfaceconstant{topcommand}{topcommand}
\setinterfaceconstant{topdistance}{فاصله‌بالا}
diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua
index 8f1bc4fb0..db1b85cc5 100644
--- a/tex/context/base/mkiv/char-ini.lua
+++ b/tex/context/base/mkiv/char-ini.lua
@@ -66,7 +66,7 @@ end
Extending the table.
--ldx]]--
-if context then
+if context and CONTEXTLMTXMODE == 0 then
if not characters.private then
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 1b0808abe..97de2e2d5 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2023.01.26 18:32}
+\newcontextversion{2023.02.06 17:55}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 19c917ba3..ee8b3bfe0 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -49,7 +49,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2023.01.26 18:32}
+\edef\contextversion{2023.02.06 17:55}
%D Kind of special:
diff --git a/tex/context/base/mkiv/data-con.lua b/tex/context/base/mkiv/data-con.lua
index ec2251b35..51e0ce856 100644
--- a/tex/context/base/mkiv/data-con.lua
+++ b/tex/context/base/mkiv/data-con.lua
@@ -56,7 +56,7 @@ local mt = {
__storage__ = true
}
-function containers.define(category, subcategory, version, enabled)
+function containers.define(category, subcategory, version, enabled, reload)
if category and subcategory then
local c = allocated[category]
if not c then
@@ -70,6 +70,7 @@ function containers.define(category, subcategory, version, enabled)
subcategory = subcategory,
storage = { },
enabled = enabled,
+ reload = reload,
version = version or math.pi, -- after all, this is TeX
trace = false,
-- writable = getwritablepath and getwritablepath (category,subcategory) or { "." },
@@ -97,7 +98,8 @@ end
function containers.read(container,name)
local storage = container.storage
- local stored = storage[name]
+ local reload = container.reload
+ local stored = not reload and storage[name]
if not stored and container.enabled and caches and containers.usecache then
stored = loaddatafromcache(container.readables,name,container.writable)
if stored and stored.cache_version == container.version then
diff --git a/tex/context/base/mkiv/font-cff.lua b/tex/context/base/mkiv/font-cff.lua
index f1c377637..ee6b843bc 100644
--- a/tex/context/base/mkiv/font-cff.lua
+++ b/tex/context/base/mkiv/font-cff.lua
@@ -714,7 +714,7 @@ do
local y = 0
local width = false
local lsb = 0
-local result = { }
+ local result = { }
local r = 0
local stems = 0
local globalbias = 0
@@ -1731,15 +1731,13 @@ end
end
for i=108,1131 do
local v = 0xF700 + i - 108
--- t[i] = char(band(rshift(v,8),0xFF),band(v,0xFF))
t[i] = char(extract(v,8,8),extract(v,0,8))
end
for i=1132,2048 do
t[i] = char(28,band(rshift(i,8),0xFF),band(i,0xFF))
end
- -- we could inline some ...
setmetatableindex(encode,function(t,k)
- -- 16.16-bit signed fixed value
+ -- as we're cff2 we write 16.16-bit signed fixed value
local r = round(k)
local v = rawget(t,r)
if v then
@@ -1844,42 +1842,6 @@ end
-- precompiling and reuse is much slower than redoing the calls
- -- local function decode(str)
- -- local a, b, c, d, e = byte(str,1,5)
- -- if a == 28 then
- -- if c then
- -- local n = 0x100 * b + c
- -- if n >= 0x8000 then
- -- return n - 0x10000
- -- else
- -- return n
- -- end
- -- end
- -- elseif a < 32 then
- -- return false
- -- elseif a <= 246 then
- -- return a - 139
- -- elseif a <= 250 then
- -- if b then
- -- return a*256 - 63124 + b
- -- end
- -- elseif a <= 254 then
- -- if b then
- -- return -a*256 + 64148 - b
- -- end
- -- else
- -- if e then
- -- local n = 0x100 * b + c
- -- if n >= 0x8000 then
- -- return n - 0x10000 + (0x100 * d + e)/0xFFFF
- -- else
- -- return n + (0x100 * d + e)/0xFFFF
- -- end
- -- end
- -- end
- -- return false
- -- end
-
process = function(tab)
local i = 1
local n = #tab
@@ -1903,8 +1865,14 @@ end
-- stack[top] = -t*256 + 251*256 - tab[i+1] - 108
stack[top] = -t*256 + 64148 - tab[i+1]
i = i + 2
+ elseif version == "cff" then
+ local n = 0x1000000 * tab[i+1] + 0x10000 * tab[i+2] + 0x100 * tab[i+3] + tab[i+4]
+ if n >= 0x8000000 then
+ n = n - 0xFFFFFFFF - 1
+ end
+ stack[top] = n
+ i = i + 5
else
- -- a 16.16 float (used for italic but pretty unreliable)
local n1 = 0x100 * tab[i+1] + tab[i+2]
local n2 = 0x100 * tab[i+3] + tab[i+4]
if n1 >= 0x8000 then
@@ -2167,7 +2135,7 @@ end
end
end
- local function processshape(tab,index,hack)
+ local function processshape(glyphs,tab,index,hack)
if not tab then
glyphs[index] = {
@@ -2233,9 +2201,10 @@ result = nil
-- report("vdata: %s",stream)
-- end
if glyph then
- glyph.stream = stream
+ glyph.stream = stream
+ glyph.width = width
else
- glyphs[index] = { stream = stream }
+ glyphs[index] = { stream = stream, width = width }
end
elseif glyph then
glyph.segments = keepcurve ~= false and result or nil
@@ -2263,7 +2232,6 @@ result = nil
name = charset and charset[index] or nil,
}
end
-
if trace_charstrings then
report("width : %s",tostring(width))
report("boundingbox: % t",boundingbox)
@@ -2326,7 +2294,8 @@ result = nil
locals = dictionary.subroutines or { }
charset = dictionary.charset
vsindex = dictionary.vsindex or 0
- glyphs = glphs or { }
+
+ local glyphs = glphs or { }
globalbias, localbias = setbias(globals,locals,nobias)
nominalwidth, defaultwidth = setwidths(dictionary.private)
@@ -2334,7 +2303,7 @@ result = nil
if charstrings then
startparsing(fontdata,data,streams)
for index=1,#charstrings do
- processshape(charstrings[index],index-1)
+ processshape(glyphs,charstrings[index],index-1)
end
if justpass and next(seacs) then
-- old type 1 stuff ... seacs
@@ -2350,7 +2319,7 @@ result = nil
-- this is a real ugly hack but we seldom enter this branch (e.g. old lbr)
local jp = justpass
justpass = false
- local x, y = processshape(charstrings[bindex+1],bindex,true)
+ local x, y = processshape(glyphs,charstrings[bindex+1],bindex,true)
justpass = jp
--
local base = bglyph.stream
@@ -2381,7 +2350,8 @@ result = nil
locals = dictionary.subroutines or { }
charset = false
vsindex = dictionary.vsindex or 0
- glyphs = glphs or { }
+
+ local glyphs = glphs or { }
justpass = streams == true
seacs = { }
@@ -2389,9 +2359,9 @@ result = nil
globalbias, localbias = setbias(globals,locals,nobias)
nominalwidth, defaultwidth = setwidths(dictionary.private)
- processshape(tab,index-1)
+ processshape(glyphs,tab,index-1)
- -- return glyphs[index]
+ return glyphs[index]
end
end
diff --git a/tex/context/base/mkiv/font-mis.lua b/tex/context/base/mkiv/font-mis.lua
index e00c84e40..42dc0bd3c 100644
--- a/tex/context/base/mkiv/font-mis.lua
+++ b/tex/context/base/mkiv/font-mis.lua
@@ -21,7 +21,7 @@ local readers = otf.readers
if readers then
- otf.version = otf.version or 3.131
+ otf.version = otf.version or 3.132
otf.cache = otf.cache or containers.define("fonts", "otl", otf.version, true)
function fonts.helpers.getfeatures(name,save)
diff --git a/tex/context/base/mkiv/font-onr.lua b/tex/context/base/mkiv/font-onr.lua
index c33b09f9e..9e5a012bd 100644
--- a/tex/context/base/mkiv/font-onr.lua
+++ b/tex/context/base/mkiv/font-onr.lua
@@ -211,6 +211,8 @@ do
+ P(1)
)^0 * Carg(1)
+ -- cache this?
+
local function loadpfbvector(filename,shapestoo,streams)
-- for the moment limited to encoding only
diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua
index 7114f5ba2..354ca59a7 100644
--- a/tex/context/base/mkiv/font-otl.lua
+++ b/tex/context/base/mkiv/font-otl.lua
@@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading")
local fonts = fonts
local otf = fonts.handlers.otf
-otf.version = 3.131 -- beware: also sync font-mis.lua and in mtx-fonts
+otf.version = 3.132 -- beware: also sync font-mis.lua and in mtx-fonts
otf.cache = containers.define("fonts", "otl", otf.version, true)
otf.svgcache = containers.define("fonts", "svg", otf.version, true)
otf.pngcache = containers.define("fonts", "png", otf.version, true)
diff --git a/tex/context/base/mkiv/font-shp.lua b/tex/context/base/mkiv/font-shp.lua
index feae0ba1c..843f75eb8 100644
--- a/tex/context/base/mkiv/font-shp.lua
+++ b/tex/context/base/mkiv/font-shp.lua
@@ -150,6 +150,8 @@ end
local readers = otf.readers
local cleanname = otf.readers.helpers.cleanname
+-- todo: shared hash for this but not accessed often
+
local function makehash(filename,sub,instance)
local name = cleanname(file.basename(filename))
if instance then
@@ -234,17 +236,21 @@ local function loadstreams(cache,filename,sub,instance)
if data then
local glyphs = data.glyphs
local streams = { }
+ -- local widths = { }
if glyphs then
for i=0,#glyphs do
local glyph = glyphs[i]
if glyph then
streams[i] = glyph.stream or ""
+ -- widths [i] = glyph.width or 0
else
streams[i] = ""
+ -- widths [i] = 0
end
end
end
data.streams = streams
+ -- data.widths = widths -- maybe more reliable!
data.glyphs = nil
data.size = size
data.format = data.format or (kind == "otf" and "opentype") or "truetype"
@@ -259,8 +265,11 @@ local function loadstreams(cache,filename,sub,instance)
local names, encoding, streams, metadata = pfb.loadvector(filename,false,true)
if streams then
local fontbbox = metadata.fontbbox or { 0, 0, 0, 0 }
+ -- local widths = { }
for i=0,#streams do
- streams[i] = streams[i].stream or "\14"
+ local s = streams[i]
+ streams[i] = s.stream or "\14"
+ -- widths [i] = s.width or 0
end
data = {
filename = filename,
@@ -268,6 +277,7 @@ local function loadstreams(cache,filename,sub,instance)
time = time,
format = "type1",
streams = streams,
+ -- widths = widths,
fontheader = {
fontversion = metadata.version,
units = 1000, -- can this be different?
@@ -346,7 +356,8 @@ local function getstreamhash(fontid)
local fontdata = identifiers[fontid]
if fontdata then
local properties = fontdata.properties
- return makehash(properties.filename,properties.subfont,properties.instance), fontdata
+ local fonthash = makehash(properties.filename,properties.subfont,properties.instance)
+ return fonthash, fontdata
end
end
diff --git a/tex/context/base/mkiv/good-ini.lua b/tex/context/base/mkiv/good-ini.lua
index 22ca12d28..df79adb61 100644
--- a/tex/context/base/mkiv/good-ini.lua
+++ b/tex/context/base/mkiv/good-ini.lua
@@ -150,7 +150,9 @@ end
local function flattenedfeatures(t,tt)
-- first set value dominates
- local tt = tt or { }
+ if not tt then
+ tt = { }
+ end
for i=1,#t do
local ti = t[i]
local ty = type(ti)
diff --git a/tex/context/base/mkiv/math-ext.lua b/tex/context/base/mkiv/math-ext.lua
index 762f1f904..1f78d6ad4 100644
--- a/tex/context/base/mkiv/math-ext.lua
+++ b/tex/context/base/mkiv/math-ext.lua
@@ -27,7 +27,7 @@ local mathplus = { }
-- todo: store them and skip storage if already stored
-- todo: make a char-ctx.lua (or is this already side effect of save in format)
-local function addextra(unicode)
+function extras.add(unicode)
local min = mathematics.extrabase
local max = min + 0xFFF
if unicode >= min and unicode <= max then
@@ -41,8 +41,6 @@ local function addextra(unicode)
end
end
-extras.add = addextra
-
function extras.copy(target,original)
local characters = target.characters
local properties = target.properties
diff --git a/tex/context/base/mkiv/math-ren.lua b/tex/context/base/mkiv/math-ren.lua
index 4628ffe55..cf429cb3a 100644
--- a/tex/context/base/mkiv/math-ren.lua
+++ b/tex/context/base/mkiv/math-ren.lua
@@ -33,6 +33,13 @@ mappings["blackboard-to-bold"] = {
[0x02124] = 0x1D419,
}
+mappings["mikaels-favourites"] = {
+ [0x211D] = 0x1D411,
+ [0x211A] = 0x1D410,
+ [0x2124] = 0x1D419,
+ [0x2115] = 0x1D40D,
+}
+
local function renderset(list) -- order matters
local tag = gsub(list," ","")
local n = sets[tag]
diff --git a/tex/context/base/mkiv/math-ttv.lua b/tex/context/base/mkiv/math-ttv.lua
index 151183212..662211a0d 100644
--- a/tex/context/base/mkiv/math-ttv.lua
+++ b/tex/context/base/mkiv/math-ttv.lua
@@ -61,6 +61,14 @@ mathencodings["large-to-small"] = {
[0x02044] = 0x0E, -- /
}
+mathencodings["large-to-small-private"] = {
+ [0xFE07A] = 0x7A, -- bracehtipdownleft
+ [0xFE07B] = 0x7B, -- bracehtipdownright
+ [0xFE07C] = 0x7C, -- bracehtipupleft
+ [0xFE07D] = 0x7D, -- bracehtipupright
+
+}
+
-- Beware: these are (in cm/lm) below the baseline due to limitations
-- in the tfm format but the engine (combined with the mathclass) takes
-- care of it. If we need them in textmode, we should make them virtual
@@ -429,7 +437,7 @@ mathencodings["tex-sy"] = {
[0x027E9] = 0x69, -- >, rangle
[0x0007C] = 0x6A, -- |, mid, lvert, rvert
[0x02225] = 0x6B, -- parallel
- -- [0x0 ] = 0x00, -- Vert, lVert, rVert, arrowvert, Arrowvert
+ -- [0x0 ] = 0x00, -- Vert, lVert, rVert, arrowvert, Arrowvert
[0x02195] = 0x6C, -- updownarrow
[0x021D5] = 0x6D, -- Updownarrow
[0x0005C] = 0x6E, -- \, backslash, setminus
diff --git a/tex/context/base/mkiv/math-vfu.lua b/tex/context/base/mkiv/math-vfu.lua
index f282005fc..5fe9738a2 100644
--- a/tex/context/base/mkiv/math-vfu.lua
+++ b/tex/context/base/mkiv/math-vfu.lua
@@ -284,10 +284,9 @@ local function dots(main,characters,id,size,unicode)
}
end
elseif unicode == 0x22EE then
- -- weird height !
characters[unicode] = {
width = w,
- height = h+(1.4)*size,
+ height = h+0.8*size,
depth = 0,
commands = {
push, push, slot, pop, up4size, push, slot, pop, up4size, slot, pop,
@@ -296,7 +295,7 @@ local function dots(main,characters,id,size,unicode)
elseif unicode == 0x22F1 then
characters[unicode] = {
width = 3*w + 6*size/18,
- height = 1.5*size,
+ height = 0.7*size,
depth = 0,
commands = {
push,
@@ -313,7 +312,7 @@ local function dots(main,characters,id,size,unicode)
elseif unicode == 0x22F0 then
characters[unicode] = {
width = 3*w + 6*size/18,
- height = 1.5*size,
+ height = 0.7*size,
depth = 0,
commands = {
push,
@@ -422,7 +421,7 @@ local function stack(main,characters,id,size,unicode,u1,d12,u2)
local mu = size/18
characters[unicode] = {
width = w1,
- height = h1 + h2 + d12,
+ height = h1 + h2 + d12*mu,
depth = d1,
commands = {
{ "slot", id, u1 },
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 2a59817c4..4395a2a82 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 08eb077f3..96871e62a 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-pag.lua b/tex/context/base/mkiv/strc-pag.lua
index 5cdba5b76..d26f4adcf 100644
--- a/tex/context/base/mkiv/strc-pag.lua
+++ b/tex/context/base/mkiv/strc-pag.lua
@@ -255,7 +255,7 @@ function helpers.analyze(entry,specification)
if not section then
return entry, false, "no section"
end
- local sectiondata = sections.collected[references.section]
+ local sectiondata = references.sectiondata or sections.collected[references.section] -- so we use an already resolved external one
if not sectiondata then
return entry, false, "no section data"
end
@@ -272,7 +272,7 @@ function helpers.analyze(entry,specification)
return entry, sectiondata, "okay"
end
-function helpers.prefix(data,prefixspec,nosuffix)
+function helpers.prefix(data,prefixspec,nosuffix) -- not only page
if data then
local _, prefixdata, status = helpers.analyze(data,prefixspec)
if prefixdata then
diff --git a/tex/context/base/mkiv/strc-ref.lua b/tex/context/base/mkiv/strc-ref.lua
index 87fea6b68..8d081c923 100644
--- a/tex/context/base/mkiv/strc-ref.lua
+++ b/tex/context/base/mkiv/strc-ref.lua
@@ -1039,6 +1039,7 @@ local function loadexternalreferences(name,utilitydata)
local external = struc.references.collected -- direct references
local lists = struc.lists.collected -- indirect references (derived)
local pages = struc.pages.collected -- pagenumber data
+ local sections = struc.sections.collected
-- a bit weird one, as we don't have the externals in the collected
for prefix, set in next, external do
if prefix == "" then
@@ -1074,6 +1075,15 @@ local function loadexternalreferences(name,utilitydata)
if prefix == "" then
prefix = name -- this can clash!
end
+ local section = references.section
+ if section then
+ -- we have to make sure that the right section is used, see helpers.prefix
+ if sections then
+ references.sectiondata = sections[section]
+ else
+ -- warning
+ end
+ end
local target = external[prefix]
if not target then
target = { }
diff --git a/tex/context/base/mkiv/typo-cln.lua b/tex/context/base/mkiv/typo-cln.lua
index b9b0e7d6c..469859162 100644
--- a/tex/context/base/mkiv/typo-cln.lua
+++ b/tex/context/base/mkiv/typo-cln.lua
@@ -10,6 +10,8 @@ if not modules then modules = { } end modules ['typo-cln'] = {
-- this case Dream Theaters' Octavium). Of course extensions will take
-- more time.
+-- This feature is probably never used so we can get rid of it.
+
local tonumber = tonumber
local utfbyte = utf.byte
diff --git a/tex/context/base/mkxl/buff-ver.mkxl b/tex/context/base/mkxl/buff-ver.mkxl
index 28ffe4988..461807162 100644
--- a/tex/context/base/mkxl/buff-ver.mkxl
+++ b/tex/context/base/mkxl/buff-ver.mkxl
@@ -56,6 +56,7 @@
\defcsname\??typingspace\v!stretch \endcsname{\enforced\let\obeyedspace\specialstretchedspace}
\letcsname\??typingspace\v!normal \endcsname\donothing
\defcsname\??typingspace\v!fixed \endcsname{\enforced\let\obeyedspace\specialfixedspace}
+\defcsname\??typingspace\v!character \endcsname{\enforced\chardef\obeyedspace\spaceasciicode}
\defcsname\??typingblank\v!standard \endcsname{\s_spac_whitespace_parskip}
\defcsname\??typingblank\v!small \endcsname{\smallskipamount}
diff --git a/tex/context/base/mkxl/char-prv.lmt b/tex/context/base/mkxl/char-prv.lmt
index 07a72d53e..38ae87dcc 100644
--- a/tex/context/base/mkxl/char-prv.lmt
+++ b/tex/context/base/mkxl/char-prv.lmt
@@ -7,211 +7,9 @@ if not modules then modules = { } end modules ['char-prv'] = {
dataonly = true,
}
-characters = characters or { }
-
--- 0xFE302 -- 0xFE320 for accents (gone with new lm/gyre)
--- 0xFE321 -- 0xFE340 for missing characters
-
--- [0xFE302] = {
--- category = "mn",
--- description = "WIDE MATHEMATICAL HAT",
--- direction = "nsm",
--- linebreak = "cm",
--- mathclass = "topaccent",
--- mathname = "widehat",
--- mathstretch = "h",
--- unicodeslot = 0xFE302,
--- nextinsize = { 0x00302, 0x0005E },
--- },
--- [0xFE303] = {
--- category = "mn",
--- cjkwd = "a",
--- description = "WIDE MATHEMATICAL TILDE",
--- direction = "nsm",
--- linebreak = "cm",
--- mathclass = "topaccent",
--- mathname = "widetilde",
--- mathstretch = "h",
--- unicodeslot = 0xFE303,
--- nextinsize = { 0x00303, 0x0007E },
--- },
--- [0xFE304] = {
--- category = "sm",
--- description = "TOP AND BOTTOM PARENTHESES",
--- direction = "on",
--- linebreak = "al",
--- mathclass = "doubleaccent",
--- mathname = "doubleparent",
--- unicodeslot = 0xFE304,
--- accents = { 0x023DC, 0x023DD },
--- },
--- [0xFE305] = {
--- category = "sm",
--- description = "TOP AND BOTTOM BRACES",
--- direction = "on",
--- linebreak = "al",
--- mathclass = "doubleaccent",
--- mathname = "doublebrace",
--- unicodeslot = 0xFE305,
--- accents = { 0x023DE, 0x023DF },
--- },
--- [0xFE941]={
--- category = "sm",
--- description = "EXTREMELY IDENTICAL TO",
--- mathclass = "relation",
--- mathextensible = "h",
--- mathname = "eqequiv",
--- mathpair = { 0x2261, 0x3D },
--- unicodeslot = 0xFE941,
--- },
+-- We needed this in mkiv for all kind of math compensations. This file is kept
+-- around in order to prevent loading the mkiv (.lua) variant.
-characters.private={
---[0xFE302]={ --fbk
--- description="EXTENSIBLE OF 0x0302",
--- mathclass="topaccent",
--- mathstretch="h",
--- unicodeslot=0xFE302,
---},
---[0xFE303]={ --fbk
--- description="EXTENSIBLE OF 0x0303",
--- mathclass="topaccent",
--- mathstretch="h",
--- unicodeslot=0xFE303,
---},
- [0xFE321]={ -- vfu
- category="sm",
- description="MATHEMATICAL SHORT BAR",
- mathclass="relation",
- mathname="mapstochar",
- unicodeslot=0xFE321,
- },
- [0xFE322]={ -- vfu
- category="sm",
- description="MATHEMATICAL LEFT HOOK",
- mathclass="relation",
- mathname="lhook",
- unicodeslot=0xFE322,
- },
- [0xFE323]={ -- vfu
- category="sm",
- description="MATHEMATICAL RIGHT HOOK",
- mathclass="relation",
- mathname="rhook",
- unicodeslot=0xFE323,
- },
- [0xFE324]={ -- vfu
- category="sm",
- description="MATHEMATICAL SHORT BAR MIRRORED",
- mathclass="relation",
- mathname="mapsfromchar",
- unicodeslot=0xFE324,
- },
- [0xFE33E]={ -- stc
- description="TOP OF 0x023E",
- mathclass="topaccent",
- mathextensible="r",
- mathstretch="h",
- unicodeslot=0xFE33E,
- },
- [0xFE33F]={ -- stc
- description="BOTTOM OF 0x023E",
- mathclass="botaccent",
- mathextensible="r",
- mathstretch="h",
- unicodeslot=0xFE33E,
- },
---[0xFE350]={ --fbk
--- category="sm",
--- description="MATHEMATICAL DOUBLE ARROW LEFT END",
--- mathclass="relation",
--- mathname="ctxdoublearrowfillleftend",
--- unicodeslot=0xFE350,
---},
---[0xFE351]={ --fbk
--- category="sm",
--- description="MATHEMATICAL DOUBLE ARROW MIDDLE PART",
--- mathclass="relation",
--- mathname="ctxdoublearrowfillmiddlepart",
--- unicodeslot=0xFE351,
---},
---[0xFE352]={ --fbk
--- category="sm",
--- description="MATHEMATICAL DOUBLE ARROW RIGHT END",
--- mathclass="relation",
--- mathname="ctxdoublearrowfillrightend",
--- unicodeslot=0xFE352,
---},
---[0xFE3B4]={ -- stc
--- description="EXTENSIBLE OF 0x03B4",
--- mathclass="topaccent",
--- mathextensible="r",
--- mathstretch="h",
--- unicodeslot=0xFE3B4,
---},
---[0xFE3B5]={ -- stc
--- description="EXTENSIBLE OF 0x03B5",
--- mathclass="botaccent",
--- mathextensible="r",
--- mathstretch="h",
--- unicodeslot=0xFE3B5,
---},
---[0xFE3DC]={ -- stc
--- description="EXTENSIBLE OF 0x03DC",
--- mathclass="topaccent",
--- mathextensible="r",
--- mathstretch="h",
--- unicodeslot=0xFE3DC,
---},
---[0xFE3DD]={ -- stc
--- description="EXTENSIBLE OF 0x03DD",
--- mathclass="botaccent",
--- mathextensible="r",
--- mathstretch="h",
--- unicodeslot=0xFE3DD,
---},
---[0xFE3DE]={ -- stc
--- description="EXTENSIBLE OF 0x03DE",
--- mathclass="topaccent",
--- mathextensible="r",
--- mathstretch="h",
--- unicodeslot=0xFE3DE,
---},
---[0xFE3DF]={ -- stc
--- description="EXTENSIBLE OF 0x03DF",
--- mathclass="botaccent",
--- mathextensible="r",
--- mathstretch="h",
--- unicodeslot=0xFE3DF,
---},
- [0xFE932]={ -- vfu
- description="SMASHED PRIME 0x02032",
- unicodeslot=0xFE932,
- },
- [0xFE933]={ -- vfu
- description="SMASHED PRIME 0x02033",
- unicodeslot=0xFE933,
- },
- [0xFE934]={ -- vfu
- description="SMASHED PRIME 0x02034",
- unicodeslot=0xFE934,
- },
- [0xFE935]={ -- vfu
- description="SMASHED BACKWARD PRIME 0x02035",
- unicodeslot=0xFE935,
- },
- [0xFE936]={ -- vfu
- description="SMASHED BACKWARD PRIME 0x02036",
- unicodeslot=0xFE936,
- },
- [0xFE937]={ -- vfu
- description="SMASHED BACKWARD PRIME 0x02037",
- unicodeslot=0xFE937,
- },
- --
- [0xFE957]={ -- vfu
- description="SMASHED PRIME 0x02057",
- unicodeslot=0xFE957,
- },
-}
+characters = characters or { }
--- print(table.serialize(characters.private,"characters.private", { hexify = true, noquotes = true }))
+characters.private = { }
diff --git a/tex/context/base/mkxl/chem-str.mkxl b/tex/context/base/mkxl/chem-str.mkxl
index 6c9d346b6..a4a974de1 100644
--- a/tex/context/base/mkxl/chem-str.mkxl
+++ b/tex/context/base/mkxl/chem-str.mkxl
@@ -607,12 +607,15 @@
\definechemicalsymbol[d:plus] [\enspace+\enspace]
\definechemicalsymbol[d:minus] [\enspace-\enspace]
\definechemicalsymbol[d:equals] [\enspace=\enspace]
-\definechemicalsymbol[d:gives] [\rightarrowfill] % \chem_arrow_construct\xrightarrow
-\definechemicalsymbol[d:equilibrium] [\rightoverleftarrowfill] % \chem_arrow_construct\xrightoverleftarrow
-\definechemicalsymbol[d:mesomeric] [\leftarrowfill] % \chem_arrow_construct\xleftrightarrow
+%definechemicalsymbol[d:gives] [\rightarrowfill] % \chem_arrow_construct\xrightarrow
+%definechemicalsymbol[d:equilibrium] [\rightoverleftarrowfill] % \chem_arrow_construct\xrightoverleftarrow
+%definechemicalsymbol[d:mesomeric] [\leftarrowfill] % \chem_arrow_construct\xleftrightarrow
+\definechemicalsymbol[d:gives] [\crightarrow]
+\definechemicalsymbol[d:equilibrium] [\cleftarrow]
+\definechemicalsymbol[d:mesomeric] [\crightoverleftarrow]
\definechemicalsymbol[d:single] [\chemicalbondrule]
-\definechemicalsymbol[d:double] [\hpack{\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}]
-\definechemicalsymbol[d:triple] [\hpack{\chemicalbondrule\hskip-1em\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}]
+\definechemicalsymbol[d:double] [\hpack{\lower.5\exheight\chemicalbondrule\hskip-\emwidth\raise.5\exheight\chemicalbondrule}]
+\definechemicalsymbol[d:triple] [\hpack{\chemicalbondrule\hskip-\emwidth\lower.5\exheight\chemicalbondrule\hskip-\emwidth\raise.5\exheight\chemicalbondrule}]
\definechemicalsymbol[d:opencomplex] [\mathematics{\Bigg[}] % not yet ok
\definechemicalsymbol[d:closecomplex][\mathematics{\Bigg]}] % not yet ok
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index 8d37b45f5..549404709 100644
--- a/tex/context/base/mkxl/cont-new.mkxl
+++ b/tex/context/base/mkxl/cont-new.mkxl
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2023.01.26 18:32}
+\newcontextversion{2023.02.06 17:55}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl
index 94dc84089..e51c3d732 100644
--- a/tex/context/base/mkxl/context.mkxl
+++ b/tex/context/base/mkxl/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\immutable\edef\contextformat {\jobname}
-\immutable\edef\contextversion{2023.01.26 18:32}
+\immutable\edef\contextversion{2023.02.06 17:55}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
@@ -641,3 +641,211 @@
\overloadmode\zerocount % for now
\errorstopmode \dump \endinput
+
+% These lua files are (still) shared with mkiv amd some are large and
+% rather generic. However there are some that can be improved in lmtx.
+
+% c:/data/develop/context/sources/attr-eff.lua
+% c:/data/develop/context/sources/attr-mkr.lua
+% c:/data/develop/context/sources/attr-neg.lua
+
+% c:/data/develop/context/sources/buff-imp-default.lua
+% c:/data/develop/context/sources/buff-imp-escaped.lua
+% c:/data/develop/context/sources/buff-imp-lua.lua
+% c:/data/develop/context/sources/buff-imp-mp.lua
+% c:/data/develop/context/sources/buff-imp-nested.lua
+% c:/data/develop/context/sources/buff-imp-parsed-xml.lua
+% c:/data/develop/context/sources/buff-imp-tex.lua
+% c:/data/develop/context/sources/buff-imp-xml.lua
+
+% c:/data/develop/context/sources/buff-par.lua
+% c:/data/develop/context/sources/buff-ver.lua
+
+% c:/data/develop/context/sources/char-cjk.lua
+% c:/data/develop/context/sources/char-def.lua
+% c:/data/develop/context/sources/char-enc.lua
+% c:/data/develop/context/sources/char-ent.lua
+% c:/data/develop/context/sources/char-fio.lua
+% c:/data/develop/context/sources/char-ini.lua
+% c:/data/develop/context/sources/char-map.lua
+% c:/data/develop/context/sources/char-scr.lua
+% c:/data/develop/context/sources/char-utf.lua
+
+% c:/data/develop/context/sources/chem-ini.lua
+% c:/data/develop/context/sources/chem-str.lua
+
+% c:/data/develop/context/sources/cldf-com.lua
+% c:/data/develop/context/sources/cldf-ini.lua
+% c:/data/develop/context/sources/cldf-prs.lua % use in chemistry
+% c:/data/develop/context/sources/cldf-scn.lua
+% c:/data/develop/context/sources/cldf-stp.lua
+% c:/data/develop/context/sources/cldf-ver.lua
+
+% c:/data/develop/context/sources/colo-icc.lua
+% c:/data/develop/context/sources/colo-ini.lua
+
+% c:/data/develop/context/sources/core-con.lua
+% c:/data/develop/context/sources/core-ctx.lua
+% c:/data/develop/context/sources/core-dat.lua
+% c:/data/develop/context/sources/core-two.lua
+
+% c:/data/develop/context/sources/file-ini.lua
+% c:/data/develop/context/sources/file-lib.lua
+% c:/data/develop/context/sources/file-res.lua
+% c:/data/develop/context/sources/file-syn.lua
+
+% c:/data/develop/context/sources/font-afk.lua
+% c:/data/develop/context/sources/font-agl.lua
+% c:/data/develop/context/sources/font-aux.lua
+% c:/data/develop/context/sources/font-cff.lua
+% c:/data/develop/context/sources/font-cid.lua
+% c:/data/develop/context/sources/font-enc.lua
+% c:/data/develop/context/sources/font-log.lua
+% c:/data/develop/context/sources/font-lua.lua % not realy used, more a demo
+% c:/data/develop/context/sources/font-map.lua
+% c:/data/develop/context/sources/font-nod.lua % some trace helpers
+% c:/data/develop/context/sources/font-onr.lua % type one afm/pfb
+% c:/data/develop/context/sources/font-osd.lua
+% c:/data/develop/context/sources/font-otc.lua
+% c:/data/develop/context/sources/font-oth.lua
+% c:/data/develop/context/sources/font-oti.lua
+% c:/data/develop/context/sources/font-oto.lua
+% c:/data/develop/context/sources/font-otr.lua
+% c:/data/develop/context/sources/font-ott.lua % just some tables
+% c:/data/develop/context/sources/font-oup.lua % packing and unpacking
+% c:/data/develop/context/sources/font-pat.lua
+% c:/data/develop/context/sources/font-prv.lua
+% c:/data/develop/context/sources/font-sel.lua
+% c:/data/develop/context/sources/font-shp.lua % shapes, for now shared
+% c:/data/develop/context/sources/font-sol.lua
+% c:/data/develop/context/sources/font-syn.lua % identification code
+% c:/data/develop/context/sources/font-trt.lua
+% c:/data/develop/context/sources/font-ttf.lua
+% c:/data/develop/context/sources/font-web.lua % proof of concept, never used
+
+% c:/data/develop/context/sources/font-imp-combining.lua % shared, like typescript
+% c:/data/develop/context/sources/font-imp-dimensions.lua % idem
+% c:/data/develop/context/sources/font-imp-italics.lua % idem
+% c:/data/develop/context/sources/font-imp-notused.lua % idem
+% c:/data/develop/context/sources/font-imp-properties.lua % idem
+% c:/data/develop/context/sources/font-imp-reorder.lua % idem
+% c:/data/develop/context/sources/font-imp-spacekerns.lua % idem
+% c:/data/develop/context/sources/font-imp-tex.lua % idem
+% c:/data/develop/context/sources/font-imp-tweaks.lua % idem
+% c:/data/develop/context/sources/font-imp-unicode.lua % idem
+
+% c:/data/develop/context/sources/good-ctx.lua
+% c:/data/develop/context/sources/good-ini.lua
+
+% c:/data/develop/context/sources/grph-bmp.lua
+% c:/data/develop/context/sources/grph-chk.lua
+% c:/data/develop/context/sources/grph-con.lua
+% c:/data/develop/context/sources/grph-fil.lua
+% c:/data/develop/context/sources/grph-img.lua
+% c:/data/develop/context/sources/grph-pat.lua
+% c:/data/develop/context/sources/grph-raw.lua
+% c:/data/develop/context/sources/grph-u3d.lua
+
+% c:/data/develop/context/sources/java-ini.lua
+
+% c:/data/develop/context/sources/lang-cnt.lua
+% c:/data/develop/context/sources/lang-def.lua % these are data files
+% c:/data/develop/context/sources/lang-txt.lua % these are data files
+% c:/data/develop/context/sources/lang-wrd.lua
+
+% c:/data/develop/context/sources/libs-ini.lua % will become lmt
+
+% c:/data/develop/context/sources/luat-exe.lua
+% c:/data/develop/context/sources/luat-iop.lua
+% c:/data/develop/context/sources/luat-mac.lua % will become lmt
+
+% c:/data/develop/context/sources/lxml-aux.lua
+% c:/data/develop/context/sources/lxml-css.lua
+% c:/data/develop/context/sources/lxml-dir.lua
+% c:/data/develop/context/sources/lxml-ent.lua
+% c:/data/develop/context/sources/lxml-ini.lua
+% c:/data/develop/context/sources/lxml-lpt.lua
+% c:/data/develop/context/sources/lxml-mis.lua
+% c:/data/develop/context/sources/lxml-sor.lua
+% c:/data/develop/context/sources/lxml-tab.lua
+% c:/data/develop/context/sources/lxml-tex.lua
+% c:/data/develop/context/sources/lxml-xml.lua
+
+% c:/data/develop/context/sources/meta-blb.lua
+% c:/data/develop/context/sources/meta-fun.lua
+% c:/data/develop/context/sources/meta-lua.lua
+% c:/data/develop/context/sources/meta-nod.lua
+% c:/data/develop/context/sources/meta-pdf.lua
+% c:/data/develop/context/sources/meta-tex.lua
+
+% c:/data/develop/context/sources/mult-aux.lua
+% c:/data/develop/context/sources/mult-fmt.lua
+
+% c:/data/develop/context/sources/page-cst.lua
+% c:/data/develop/context/sources/page-flt.lua
+% c:/data/develop/context/sources/page-inj.lua
+% c:/data/develop/context/sources/page-ins.lua
+% c:/data/develop/context/sources/page-mix.lua
+% c:/data/develop/context/sources/page-pst.lua
+
+% c:/data/develop/context/sources/phys-dim.lua
+
+% c:/data/develop/context/sources/publ-aut.lua
+% c:/data/develop/context/sources/publ-dat.lua
+% c:/data/develop/context/sources/publ-fnd.lua
+% c:/data/develop/context/sources/publ-inc.lua
+% c:/data/develop/context/sources/publ-ini.lua
+% c:/data/develop/context/sources/publ-jrn.lua
+% c:/data/develop/context/sources/publ-oth.lua
+% c:/data/develop/context/sources/publ-reg.lua
+% c:/data/develop/context/sources/publ-sor.lua
+% c:/data/develop/context/sources/publ-tra.lua
+% c:/data/develop/context/sources/publ-usr.lua
+
+% c:/data/develop/context/sources/regi-ini.lua
+
+% c:/data/develop/context/sources/scrn-but.lua
+% c:/data/develop/context/sources/scrn-fld.lua
+% c:/data/develop/context/sources/scrn-hlp.lua
+
+% c:/data/develop/context/sources/scrp-cjk.lua
+% c:/data/develop/context/sources/scrp-eth.lua
+% c:/data/develop/context/sources/scrp-tha.lua
+% c:/data/develop/context/sources/scrp-tib.lua
+
+% c:/data/develop/context/sources/sort-ini.lua
+% c:/data/develop/context/sources/sort-lan.lua
+
+% c:/data/develop/context/sources/strc-bkm.lua
+% c:/data/develop/context/sources/strc-blk.lua
+% c:/data/develop/context/sources/strc-con.lua
+% c:/data/develop/context/sources/strc-doc.lua
+% c:/data/develop/context/sources/strc-flt.lua
+% c:/data/develop/context/sources/strc-ini.lua
+% c:/data/develop/context/sources/strc-itm.lua
+% c:/data/develop/context/sources/strc-lev.lua
+% c:/data/develop/context/sources/strc-mat.lua
+% c:/data/develop/context/sources/strc-num.lua
+% c:/data/develop/context/sources/strc-pag.lua
+% c:/data/develop/context/sources/strc-syn.lua
+% c:/data/develop/context/sources/strc-usr.lua
+
+% c:/data/develop/context/sources/syst-cmp.lua
+% c:/data/develop/context/sources/syst-con.lua
+
+% c:/data/develop/context/sources/trac-ctx.lua
+% c:/data/develop/context/sources/trac-lmx.lua
+% c:/data/develop/context/sources/trac-par.lua
+% c:/data/develop/context/sources/trac-tex.lua
+
+% c:/data/develop/context/sources/typo-cln.lua
+% c:/data/develop/context/sources/typo-dha.lua
+% c:/data/develop/context/sources/typo-fkr.lua
+% c:/data/develop/context/sources/typo-inj.lua
+% c:/data/develop/context/sources/typo-lan.lua
+% c:/data/develop/context/sources/typo-man.lua
+% c:/data/develop/context/sources/typo-pnc.lua
+% c:/data/develop/context/sources/typo-prc.lua
+% c:/data/develop/context/sources/typo-rep.lua
+
+% c:/data/develop/context/sources/unic-ini.lua
diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt
index 2a2b14850..73e7085b2 100644
--- a/tex/context/base/mkxl/driv-shp.lmt
+++ b/tex/context/base/mkxl/driv-shp.lmt
@@ -143,6 +143,10 @@ function drivers.getvpos() return round(pos_v) end
-- characters
+-- experiment (smaller page stream but might be fragile)
+
+local tospace = false directives.register("backends.spaces", function(v) tospace = v end)
+
local flush_character do
local stack = setmetatableindex("table")
@@ -150,30 +154,65 @@ local flush_character do
local nesting = 0
local main = 0
- -- experiment (smaller page stream but might be fragile)
-
- local tospace = false directives.register("backends.spaces", function(v) tospace = v end)
-
-- todo: cache streams
- local default = 16384 -- * number.dimenfactors.bp -- 65536 // 4
+ local default = 16384 -- * number.dimenfactors.bp -- 65536 // 4
+ local refactored = 1000000 -- expansion related
local vfinjectors = fonts.helpers.vfinjectors
-- current can go
+ -- local alternative = false -- more local, can be an option: vf.commands.local
+
local function flush_vf_packet(current,pos_h,pos_v,pos_r,font,char,data,csx,csy,factor,sx,sy,vfcommands)
if nesting > 100 then
return
elseif nesting == 0 then
main = font
+ -- if alternative then
+ -- local s = stack[0]
+ -- s[1] = pos_h
+ -- s[2] = pos_v
+ -- s[3] = pos_r
+ -- end
+ else
+ -- if alternative then
+ -- local s = stack[0]
+ -- pos_h = s[1]
+ -- pos_v = s[2]
+ -- pos_r = s[3]
+ -- end
end
nesting = nesting + 1
+ local savedlevel = level
+
+ local function push()
+ level = level + 1
+ local s = stack[level]
+ s[1] = pos_h
+ s[2] = pos_v
+ s[3] = pos_r
+ end
+
+ local function pop()
+ if level > 0 then
+ local s = stack[level]
+ pos_h = s[1]
+ pos_v = s[2]
+ pos_r = s[3]
+ level = level - 1
+ end
+ end
+
+ -- push() -- or:
+
local saved_h = pos_h
local saved_v = pos_v
local saved_r = pos_r
+
pos_r = lefttoright_code
local fdata = fontdata[font] -- offsets etc
@@ -250,96 +289,118 @@ local flush_character do
end
end
- local refactored = 1000000
for i=1,#vfcommands do
- local packet = vfcommands[i]
- local command = packet[1]
- if command == "char" then
- local chr = packet[2]
- local csx = packet[3]
- local csy = packet[4] or csx
- pos_h = pos_h + flushchar(fnt,chr,csx,csy)
- elseif command == "slot" then
- local index = packet[2]
- local chr = packet[3]
- local csx = packet[4]
- local csy = packet[5] or csx
- if index == 0 then
- pos_h = pos_h + flushchar(font,chr,csx,csy)
- else
- local okay = fonts and fonts[index]
- if okay then
- local fnt = okay.id
- if fnt then
- pos_h = pos_h + flushchar(fnt,chr,csx,csy)
- end
- else
- -- safeguard, we assume the font itself (often index 1)
- pos_h = pos_h + flushchar(font,chr,csx,csy)
- end
- end
- elseif command == "use" then
- local index = packet[2]
- if index then
- local fnt
+ local packet = vfcommands[i]
+ if packet then
+ local command = packet[1]
+ if command == "char" then
+ local chr = packet[2]
+ local csx = packet[3]
+ local csy = packet[4] or csx
+ pos_h = pos_h + flushchar(fnt,chr,csx,csy)
+ elseif command == "slot" then
+ local index = packet[2]
+ local chr = packet[3]
+ local csx = packet[4]
+ local csy = packet[5] or csx
if index == 0 then
- fnt = font
+ pos_h = pos_h + flushchar(font,chr,csx,csy)
else
local okay = fonts and fonts[index]
if okay then
- fnt = okay.id
+ local fnt = okay.id
+ if fnt then
+ if fnt == 0 then
+ fnt = font
+ end
+ pos_h = pos_h + flushchar(fnt,chr,csx,csy)
+ end
+ else
+ -- safeguard, we assume the font itself (often index 1)
+ pos_h = pos_h + flushchar(font,chr,csx,csy)
end
end
- if fnt then
- -- not efficient but ok for now as experiment
- local d = characters[fnt]
- if d then
- for i=3,#packet do
- local chr = packet[i]
- local dat = d[chr]
- if dat then
- flushfontchar(fnt,chr,dat)
+ elseif command == "use" then
+ local index = packet[2]
+ if index then
+ local fnt
+ if index == 0 then
+ fnt = font
+ else
+ local okay = fonts and fonts[index]
+ if okay then
+ fnt = okay.id
+ end
+ end
+ if fnt then
+ -- not efficient but ok for now as experiment
+ local d = characters[fnt]
+ if d then
+ for i=3,#packet do
+ local chr = packet[i]
+ local dat = d[chr]
+ if dat then
+ flushfontchar(fnt,chr,dat)
+ end
end
end
end
end
- end
- elseif command == "right" then
- local h = packet[2] -- already scaled
- if h ~= 0 then
- if factor ~= 0 then
- h = h + h * factor / refactored -- expansion
+ elseif command == "right" then
+ local h = packet[2] -- already scaled
+ if h ~= 0 then
+ if factor ~= 0 then
+ h = h + h * factor / refactored -- expansion
+ end
+ pos_h = pos_h + h * sx
end
- pos_h = pos_h + h * sx
- end
- elseif command == "left" then
- local h = packet[2] -- already scaled
- if h ~= 0 then
- if factor ~= 0 then
- h = h + h * factor / refactored -- expansion
+ elseif command == "left" then
+ local h = packet[2] -- already scaled
+ if h ~= 0 then
+ if factor ~= 0 then
+ h = h + h * factor / refactored -- expansion
+ end
+ pos_h = pos_h - h * sx
end
- pos_h = pos_h - h * sx
- end
- elseif command == "down" then
- local v = packet[2] -- already scaled
- if v and v ~= 0 then
- pos_v = pos_v - v * sy
- end
- elseif command == "up" then
- local v = packet[2] -- already scaled
- if v and v ~= 0 then
- pos_v = pos_v + v * sy
- end
- elseif command == "offset" then
- local c = packet[4]
- if c then
- local ph = pos_h
- local pv = pos_v
- local csx = packet[5]
- local csy = packet[6] or csx
- local h = packet[2]
- local v = packet[3]
- if h and h ~= 0 then
+ elseif command == "down" then
+ local v = packet[2] -- already scaled
+ if v and v ~= 0 then
+ pos_v = pos_v - v * sy
+ end
+ elseif command == "up" then
+ local v = packet[2] -- already scaled
+ if v and v ~= 0 then
+ pos_v = pos_v + v * sy
+ end
+ elseif command == "offset" then
+ local c = packet[4]
+ if c then
+ local ph = pos_h
+ local pv = pos_v
+ local csx = packet[5]
+ local csy = packet[6] or csx
+ local h = packet[2]
+ local v = packet[3]
+ if h and h ~= 0 then
+ if factor ~= 0 then
+ h = h + h * factor / refactored -- expansion
+ end
+ pos_h = pos_h + h * sx
+ end
+ if v and v ~= 0 then
+ pos_v = pos_v + v * sy
+ end
+ flushchar(fnt,c,csx,csy)
+ pos_h = ph
+ pos_v = pv
+ end
+ elseif command == "compose" then -- for now idem
+ local ph = pos_h
+ local pv = pos_v
+ local h = packet[2] or 0
+ local v = packet[3] or 0
+ local c = packet[4]
+ if h ~= 0 then
if factor ~= 0 then
h = h + h * factor / refactored -- expansion
end
@@ -348,179 +409,165 @@ local flush_character do
if v and v ~= 0 then
pos_v = pos_v + v * sy
end
- flushchar(fnt,c,csx,csy)
- pos_h = ph
- pos_v = pv
- end
- elseif command == "compose" then -- for now idem
- local ph = pos_h
- local pv = pos_v
- local h = packet[2] or 0
- local v = packet[3] or 0
- local c = packet[4]
- if h ~= 0 then
- if factor ~= 0 then
- h = h + h * factor / refactored -- expansion
+ if c then
+ flushchar(fnt,c)
+ pos_h = ph
+ pos_v = pv
end
- pos_h = pos_h + h * sx
- end
- if v and v ~= 0 then
- pos_v = pos_v + v * sy
- end
- if c then
- flushchar(fnt,c)
- pos_h = ph
- pos_v = pv
- end
- elseif command == "push" then
- level = level + 1
- local s = stack[level]
- s[1] = pos_h
- s[2] = pos_v
- elseif command == "pop" then
- if level > 0 then
- local s = stack[level]
- pos_h = s[1]
- pos_v = s[2]
- level = level - 1
- end
- elseif command == "frame" then
- -- d:width d:height d:depth d:rulethickness b:outline b:advance b:baseline s:color
- local width = packet[2]
- local height = packet[3]
- local depth = packet[4]
- local wd, ht, dp
- if width == true or height == true or depth == true then
- wd, ht, dp = getwhd(current,true)
- end
- if width == true then
- width = wd
- elseif not width then
- width = 0
- end
- if height == true then
- height = ht
- elseif not height then
- height = 0
- end
- if depth == true then
- depth = dp
- elseif not depth then
- depth = 0
- end
- local total = height + depth
- if width > 0 and total > 0 then
- if factor ~= 0 then
- width = width + width * factor / refactored
+ elseif command == "push" then
+ push()
+ elseif command == "pop" then
+ pop()
+ elseif command == "frame" then
+ -- d:width d:height d:depth d:rulethickness b:outline b:advance b:baseline s:color
+ local width = packet[2]
+ local height = packet[3]
+ local depth = packet[4]
+ local wd, ht, dp
+ if width == true or height == true or depth == true then
+ wd, ht, dp = getwhd(current,true)
end
- if width > 0 then
- local line = packet[5] or default
- local outline = packet[6]
- local advance = packet[7]
- if outline == nil then
- outline = true
+ if width == true then
+ width = wd
+ elseif not width then
+ width = 0
+ end
+ if height == true then
+ height = ht
+ elseif not height then
+ height = 0
+ end
+ if depth == true then
+ depth = dp
+ elseif not depth then
+ depth = 0
+ end
+ local total = height + depth
+ if width > 0 and total > 0 then
+ if factor ~= 0 then
+ width = width + width * factor / refactored
end
- if advance == nil then
- advance = true
+ if width > 0 then
+ local line = packet[5] or default
+ local outline = packet[6]
+ local advance = packet[7]
+ if outline == nil then
+ outline = true
+ end
+ if advance == nil then
+ advance = true
+ end
+ local baseline = outline and packet[8]
+ local color = packet[9] -- no longer needed probably
+ if color then
+ vfinjectors.startcolor(pos_h,pos_v,color) -- takes packet or string
+ end
+ width = width * sx
+ height = height * sy
+ depth = depth * sy
+ flushspecialrule(pos_h,pos_v,pos_r,width,height,depth,line,outline,baseline)
+ if color then
+ vfinjectors.stopcolor()
+ end
+ if advance then
+ pos_h = pos_h + width
+ end
+ end
+ end
+ elseif command == "rule" then
+ local size_v = packet[2]
+ local size_h = packet[3]
+ if size_h > 0 and size_v > 0 then
+ if factor ~= 0 then
+ size_h = size_h + size_h * factor / refactored
end
- local baseline = outline and packet[8]
- local color = packet[9] -- no longer needed probably
- if color then
- vfinjectors.startcolor(pos_h,pos_v,color) -- takes packet or string
+ if size_h > 0 then
+ size_h = size_h * sx
+ size_v = size_v * sy
+ flushsimplerule(pos_h,pos_v,pos_r,size_h,size_v)
+ pos_h = pos_h + size_h
end
- width = width * sx
- height = height * sy
- depth = depth * sy
- flushspecialrule(pos_h,pos_v,pos_r,width,height,depth,line,outline,baseline)
- if color then
- vfinjectors.stopcolor()
+ end
+ elseif command == "line" then
+ local wd = packet[2] or 0
+ local ht = packet[3] or 0
+ local dp = packet[4] or 0
+ if wd > 0 and ht ~= 0 and dp ~= 0 then
+ if factor ~= 0 then
+ wd = wd + wd * factor / refactored
end
- if advance then
- pos_h = pos_h + width
+ if wd > 0 then
+ wd = wd * sx
+ ht = ht * sy
+ dp = dp * sy
+ local color = packet[5] -- no longer needed probably
+ if color then
+ vfinjectors.startcolor(pos_h,pos_v,color) -- takes packet or string
+ end
+ flushsimplerule(pos_h,pos_v-dp,pos_r,wd,ht+dp)
+ if color then
+ vfinjectors.stopcolor()
+ end
+ pos_h = pos_h + wd
end
end
- end
- elseif command == "rule" then
- local size_v = packet[2]
- local size_h = packet[3]
- if size_h > 0 and size_v > 0 then
- if factor ~= 0 then
- size_h = size_h + size_h * factor / refactored
+ elseif command == "font" then
+ local index = packet[2]
+ local okay = fonts and fonts[index]
+ if okay then
+ fnt = okay.id or fnt -- or maybe just return
end
- if size_h > 0 then
- size_h = size_h * sx
- size_v = size_v * sy
- flushsimplerule(pos_h,pos_v,pos_r,size_h,size_v)
- pos_h = pos_h + size_h
+ elseif command == "lua" then
+ local code = packet[2]
+ local kind = type(code)
+ if kind ~= "function" then
+ code = loadstring(code)
+ kind = type(code)
end
- end
- elseif command == "line" then
- local wd = packet[2] or 0
- local ht = packet[3] or 0
- local dp = packet[4] or 0
- if wd > 0 and ht ~= 0 and dp ~= 0 then
- if factor ~= 0 then
- wd = wd + wd * factor / refactored
+ if kind == "function" then
+ code(font,char,pos_h,pos_v,sx,sy) -- maybe also packet
end
- if wd > 0 then
- wd = wd * sx
- ht = ht * sy
- dp = dp * sy
- local color = packet[5] -- no longer needed probably
- if color then
- vfinjectors.startcolor(pos_h,pos_v,color) -- takes packet or string
- end
- flushsimplerule(pos_h,pos_v-dp,pos_r,wd,ht+dp)
- if color then
- vfinjectors.stopcolor()
- end
- pos_h = pos_h + wd
+ elseif command == "node" then
+ local h = packet[2]
+ hlist_out(h,getlist(h))
+ -- elseif command == "pdf" then
+ -- unsupported
+ -- elseif command == "pdfmode" then
+ -- unsupported
+ -- elseif command == "special" then
+ -- unsupported
+ -- elseif command == "nop" then
+ -- just ignored
+ -- elseif command == "image" then
+ -- unsupported, use "node"
+ elseif command == "inspect" then
+ inspect(vfcommands)
+ elseif command == "trace" then
+ report("virtual state: h=%p v=%p d=%i",pos_h,pos_v,pos_r)
+ else
+ local injector = vfinjectors[command]
+ if injector then
+ injector(pos_h,pos_v,packet) -- maybe also sx, sy but then we need to check usage
end
end
- elseif command == "font" then
- local index = packet[2]
- local okay = fonts and fonts[index]
- if okay then
- fnt = okay.id or fnt -- or maybe just return
- end
- elseif command == "lua" then
- local code = packet[2]
- local kind = type(code)
- if kind ~= "function" then
- code = loadstring(code)
- kind = type(code)
- end
- if kind == "function" then
- code(font,char,pos_h,pos_v,sx,sy) -- maybe also packet
- end
- elseif command == "node" then
- local h = packet[2]
- hlist_out(h,getlist(h))
- -- elseif command == "pdf" then
- -- unsupported
- -- elseif command == "pdfmode" then
- -- unsupported
- -- elseif command == "special" then
- -- unsupported
- -- elseif command == "nop" then
- -- just ignored
- -- elseif command == "image" then
- -- unsupported, use "node"
- else
- local injector = vfinjectors[command]
- if injector then
- injector(pos_h,pos_v,packet) -- maybe also sx, sy but then we need to check usage
- end
end
end
- -- hm, never seen outside here
+ -- pop() -- or:
pos_h = saved_h
pos_v = saved_v
pos_r = saved_r
+ if savedlevel ~= level then
+ report("")
+ report("virtual state: stack is corrupt")
+ report("")
+ end
+ level = savedlevel
+
nesting = nesting - 1
+
end
local onetimemessage -- could be defined later (todo: make plug for this)
diff --git a/tex/context/base/mkxl/font-imp-scripts.lmt b/tex/context/base/mkxl/font-imp-scripts.lmt
index 8cfbb9ac2..97b11c91d 100644
--- a/tex/context/base/mkxl/font-imp-scripts.lmt
+++ b/tex/context/base/mkxl/font-imp-scripts.lmt
@@ -90,7 +90,7 @@ local function initialize(tfmdata,key,value)
-- yoffset = shift,
-- xscale = factor,
-- yscale = factor,
- -- commands = { { "slot", 0, other } },
+ -- commands = { { "slot", 0, other } }, -- { slotcommand[0][other] or charcommand[other] }
}
end
end
diff --git a/tex/context/base/mkxl/font-lib.mklx b/tex/context/base/mkxl/font-lib.mklx
index 3ce1b8bff..cf6b51102 100644
--- a/tex/context/base/mkxl/font-lib.mklx
+++ b/tex/context/base/mkxl/font-lib.mklx
@@ -45,9 +45,9 @@
\registerctxluafile{font-ttf}{optimize} % cubic outlines
\registerctxluafile{font-dsp}{autosuffix,optimize}
\registerctxluafile{font-hsh}{autosuffix} % hashes used by context
-\registerctxluafile{font-vir}{}
\registerctxluafile{font-vfc}{autosuffix}
\registerctxluafile{font-prv}{} % needs hashes
+\registerctxluafile{font-vir}{}
\registerctxluafile{font-nod}{optimize}
\registerctxluafile{font-oti}{} % otf initialization
\registerctxluafile{font-ott}{} % otf tables (first)
@@ -71,7 +71,7 @@
% we use otf code for type one
-\registerctxluafile{font-onr}{optimize}
+\registerctxluafile{font-onr}{autosuffix,optimize}
\registerctxluafile{font-one}{autosuffix,optimize}
\registerctxluafile{font-afk}{}
@@ -137,7 +137,7 @@
\registerctxluafile{font-aux}{}
-\registerctxluafile{font-lig}{} % only for experiments so try to avoid it
+\registerctxluafile{font-lig}{autosuffix} % only for experiments so try to avoid it
%D Some low level helpers
%D
diff --git a/tex/context/base/mkxl/font-lig.lmt b/tex/context/base/mkxl/font-lig.lmt
new file mode 100644
index 000000000..9a68b4697
--- /dev/null
+++ b/tex/context/base/mkxl/font-lig.lmt
@@ -0,0 +1,41 @@
+if not modules then modules = { } end modules ['font-lig'] = {
+ version = 1.001,
+ comment = "companion to font-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files",
+}
+
+-- We keep this for compatibility reasons and demonstration purposes. We delay
+-- definition of the data table in order to save some memory.
+
+-- data['c'] = { 'a', 'b' }
+-- data['d'] = { 'c', 'c' }
+
+local next = next
+local setmetatableindex = table.setmetatableindex
+
+local data = { }
+
+setmetatableindex(data,function(t,k)
+ for first, seconds in next, characters.graphemes do
+ for second, combined in next, seconds do
+ data[combined] = { first, second }
+ end
+ end
+ setmetatableindex(data)
+ return t[k]
+end)
+
+local feature = {
+ name = "collapse",
+ type = "ligature",
+ prepend = true,
+ dataset = {
+ { data = data }, -- twice ?
+ { data = data },
+ }
+}
+
+-----.handlers.afm.addfeature(feature)
+fonts.handlers.otf.addfeature(feature)
diff --git a/tex/context/base/mkxl/font-ogr.lmt b/tex/context/base/mkxl/font-ogr.lmt
index 662c75b15..3b4f9f867 100644
--- a/tex/context/base/mkxl/font-ogr.lmt
+++ b/tex/context/base/mkxl/font-ogr.lmt
@@ -39,6 +39,8 @@ otf.pngenabled = true
local report_fonts = logs.reporter("backend","fonts")
local trace_fonts trackers.register("backend.fonts",function(v) trace_fonts = v end)
+local slotcommand = fonts.helpers.commands.slot
+
do
-- This is a prelude to something better but I'm still experimenting. We should delay more.
@@ -113,7 +115,7 @@ do
end
colrshapes[idx] = shape -- so not: description
-- todo: prepend
- v.commands = { { "slot", slot, idx } }
+ v.commands = { slotcommand[slot][idx] }
-- hack to prevent that type 3 also gets 'use' flags .. todo
local c = { commands = false, index = idx, dropin = tfmdrop }
local d = { } -- { index = idx, dropin = tfmdrop }
@@ -158,7 +160,7 @@ do
end
colrshapes[idx] = shape -- so not: description
-- todo: prepend
- v.commands = { { "slot", slot, idx } }
+ v.commands = { slotcommand[slot][idx] }
-- hack to prevent that type 3 also gets 'use' flags .. todo
local c = { commands = false, index = idx, dropin = tfmdrop }
local d = { } -- index = idx, dropin = tfmdrop }
@@ -206,7 +208,7 @@ do
end
colrshapes[idx] = shape.code -- so not: description
-- todo: prepend
- character.commands = { { "slot", slot, idx } }
+ character.commands = { slotcommand[slot][idx] }
-- hack to prevent that type 3 also gets 'use' flags .. todo
local c = { commands = false, index = idx, dropin = tfmdrop }
-- local d = { } -- index = idx, dropin = tfmdrop }
@@ -531,7 +533,7 @@ local initializeoverlay do
for i=1,#colorlist do
u[i+2] = colorlist[i].slot
end
- v.commands = { u, { "slot", slot, idx } }
+ v.commands = { u, slotcommand[slot][idx] }
-- hack to prevent that type 3 also gets 'use' flags .. todo
local c = { commands = false, index = idx, dropin = tfmdata }
local d = { } -- index = idx, dropin = tfmdrop
diff --git a/tex/context/base/mkxl/font-onr.lmt b/tex/context/base/mkxl/font-onr.lmt
new file mode 100644
index 000000000..f48b8e545
--- /dev/null
+++ b/tex/context/base/mkxl/font-onr.lmt
@@ -0,0 +1,606 @@
+if not modules then modules = { } end modules ['font-onr'] = {
+ version = 1.001,
+ optimize = true,
+ comment = "companion to font-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+--[[ldx--
+<p>Some code may look a bit obscure but this has to do with the fact that we also use
+this code for testing and much code evolved in the transition from <l n='tfm'/> to
+<l n='afm'/> to <l n='otf'/>.</p>
+
+<p>The following code still has traces of intermediate font support where we handles
+font encodings. Eventually font encoding went away but we kept some code around in
+other modules.</p>
+
+<p>This version implements a node mode approach so that users can also more easily
+add features.</p>
+--ldx]]--
+
+local fonts, logs, trackers, resolvers = fonts, logs, trackers, resolvers
+
+local next, type, tonumber, rawset = next, type, tonumber, rawset
+local match, lower, gsub, strip, find = string.match, string.lower, string.gsub, string.strip, string.find
+local char, byte, sub = string.char, string.byte, string.sub
+local abs = math.abs
+local bxor, rshift = bit32.bxor, bit32.rshift
+local P, S, R, V, Cmt, C, Ct, Cs, Carg, Cf, Cg, Cc = lpeg.P, lpeg.S, lpeg.R, lpeg.V, lpeg.Cmt, lpeg.C, lpeg.Ct, lpeg.Cs, lpeg.Carg, lpeg.Cf, lpeg.Cg, lpeg.Cc
+local lpegmatch, patterns = lpeg.match, lpeg.patterns
+
+local trace_indexing = false trackers.register("afm.indexing", function(v) trace_indexing = v end)
+local trace_loading = false trackers.register("afm.loading", function(v) trace_loading = v end)
+
+local report_afm = logs.reporter("fonts","afm loading")
+local report_pfb = logs.reporter("fonts","pfb loading")
+
+local handlers = fonts.handlers
+
+local afm = handlers.afm or { }
+handlers.afm = afm
+afm.version = 1.513 -- incrementing this number one up will force a re-cache
+
+local pfb = handlers.pfb or { }
+handlers.pfb = pfb
+pfb.version = 1.000
+
+local readers = afm.readers or { }
+afm.readers = readers
+
+--[[ldx--
+<p>We start with the basic reader which we give a name similar to the built in <l n='tfm'/>
+and <l n='otf'/> reader.</p>
+<p>We use a new (unfinished) pfb loader but I see no differences between the old
+and new vectors (we actually had one bad vector with the old loader).</p>
+--ldx]]--
+
+local get_indexes, get_shapes
+
+do
+
+ local decrypt
+
+ do
+
+ local r, c1, c2, n = 0, 0, 0, 0
+
+ local function step(c)
+ local cipher = byte(c)
+ local plain = bxor(cipher,rshift(r,8))
+ r = ((cipher + r) * c1 + c2) % 65536
+ return char(plain)
+ end
+
+ decrypt = function(binary,initial,seed)
+ r, c1, c2, n = initial, 52845, 22719, seed
+ binary = gsub(binary,".",step)
+ return sub(binary,n+1)
+ end
+
+ -- local pattern = Cs((P(1) / step)^1)
+ --
+ -- decrypt = function(binary,initial,seed)
+ -- r, c1, c2, n = initial, 52845, 22719, seed
+ -- binary = lpegmatch(pattern,binary)
+ -- return sub(binary,n+1)
+ -- end
+
+ end
+
+ local charstrings = P("/CharStrings")
+ local subroutines = P("/Subrs")
+ local encoding = P("/Encoding")
+ local dup = P("dup")
+ local put = P("put")
+ local array = P("array")
+ local name = P("/") * C((R("az","AZ","09")+S("-_."))^1)
+ local digits = R("09")^1
+ local cardinal = digits / tonumber
+ local spaces = P(" ")^1
+ local spacing = patterns.whitespace^0
+
+ local routines, vector, chars, n, m
+
+ local initialize = function(str,position,size)
+ n = 0
+ m = size
+ return position + 1
+ end
+
+ local setroutine = function(str,position,index,size,filename)
+ if routines[index] then
+ -- we have passed the end
+ return false
+ end
+ local forward = position + size
+ local stream = decrypt(sub(str,position+1,forward),4330,4)
+ routines[index] = { byte(stream,1,#stream) }
+ n = n + 1
+ if n >= m then
+ -- m should be index now but can we assume ordering?
+ return #str
+ end
+ return forward + 1
+ end
+
+ local setvector = function(str,position,name,size,filename)
+ local forward = position + tonumber(size)
+ if n >= m then
+ return #str
+ elseif forward < #str then
+ if n == 0 and name ~= ".notdef" then
+ report_pfb("reserving .notdef at index 0 in %a",filename) -- luatex needs that
+ n = n + 1
+ end
+ vector[n] = name
+ n = n + 1
+ return forward
+ else
+ return #str
+ end
+ end
+
+ local setshapes = function(str,position,name,size,filename)
+ local forward = position + tonumber(size)
+ local stream = sub(str,position+1,forward)
+ if n > m then
+ return #str
+ elseif forward < #str then
+ if n == 0 and name ~= ".notdef" then
+ report_pfb("reserving .notdef at index 0 in %a",filename) -- luatex needs that
+ n = n + 1
+ end
+ vector[n] = name
+ n = n + 1
+ chars [n] = decrypt(stream,4330,4)
+ return forward
+ else
+ return #str
+ end
+ end
+
+ local p_rd = spacing * (P("RD") + P("-|"))
+ local p_np = spacing * (P("NP") + P( "|"))
+ local p_nd = spacing * (P("ND") + P( "|"))
+
+ local p_filterroutines = -- dup <i> <n> RD or -| <n encrypted bytes> NP or |
+ (1-subroutines)^0 * subroutines * spaces * Cmt(cardinal,initialize)
+ * (Cmt(cardinal * spaces * cardinal * p_rd * Carg(1), setroutine) * p_np + (1-p_nd))^1
+
+ local p_filtershapes = -- /foo <n> RD <n encrypted bytes> ND
+ (1-charstrings)^0 * charstrings * spaces * Cmt(cardinal,initialize)
+ * (Cmt(name * spaces * cardinal * p_rd * Carg(1) , setshapes) * p_nd + P(1))^1
+
+ local p_filternames = Ct (
+ (1-charstrings)^0 * charstrings * spaces * Cmt(cardinal,initialize)
+ * (Cmt(name * spaces * cardinal * Carg(1), setvector) + P(1))^1
+ )
+
+ -- /Encoding 256 array
+ -- 0 1 255 {1 index exch /.notdef put} for
+ -- dup 0 /Foo put
+
+ local p_filterencoding =
+ (1-encoding)^0 * encoding * spaces * digits * spaces * array * (1-dup)^0
+ * Cf(
+ Ct("") * Cg(spacing * dup * spaces * cardinal * spaces * name * spaces * put)^1
+ ,rawset)
+
+ -- if one of first 4 not 0-9A-F then binary else hex
+
+ local key = spacing * P("/") * R("az","AZ")
+ local str = spacing * Cs { (P("(")/"") * ((1 - P("\\(") - P("\\)") - S("()")) + V(1))^0 * (P(")")/"") }
+ local num = spacing * (R("09") + S("+-."))^1 / tonumber
+ local arr = spacing * Ct (S("[{") * (num)^0 * spacing * S("]}"))
+ local boo = spacing * (P("true") * Cc(true) + P("false") * Cc(false))
+ local nam = spacing * P("/") * Cs(R("az","AZ")^1)
+
+ local p_filtermetadata = (
+ P("/") * Carg(1) * ( (
+ C("version") * str
+ + C("Copyright") * str
+ + C("Notice") * str
+ + C("FullName") * str
+ + C("FamilyName") * str
+ + C("Weight") * str
+ + C("ItalicAngle") * num
+ + C("isFixedPitch") * boo
+ + C("UnderlinePosition") * num
+ + C("UnderlineThickness") * num
+ + C("FontName") * nam
+ + C("FontMatrix") * arr
+ + C("FontBBox") * arr
+ ) ) / function (t,k,v) t[lower(k)] = v end
+ + P(1)
+ )^0 * Carg(1)
+
+ -- cache this?
+
+ local filecache = containers.define("fonts", "pfb", pfb.version, true)
+ local cleanname = fonts.handlers.otf.readers.helpers.cleanname
+
+ local caching = true -- mainly for MS and HH as they test huge files with many instances
+
+ local function loadpfbvector(filename,shapestoo,streams)
+ -- for the moment limited to encoding only
+
+ local fullname = resolvers.findfile(filename)
+
+ if not fullname or fullname == "" then
+ report_pfb("unknown file %a",filename)
+ return
+ end
+
+ local fileattr = lfs.attributes(fullname)
+ local filesize = fileattr and fileattr.size or 0
+ local filetime = fileattr and fileattr.modification or 0
+ local fileformat = "pfb"
+ local filehash = cleanname(file.basename(filename))
+
+ local names = nil
+ local encoding = nil
+ local metadata = nil
+ local glyphs = { }
+
+ local data = caching and containers.read(filecache,filehash)
+ if data and data.filetime == filetime and data.filesize == filesize and data.fileformat == fileformat then
+ names = data.names
+ encoding = data.encoding
+ metadata = data.metadata
+ end
+
+ if shapestoo or streams then
+ -- not cached
+ elseif names then
+ return names, encoding, glyphs, metadata
+ end
+
+ local data = io.loaddata(fullname)
+
+ if not data then
+ report_pfb("no data in %a",filename)
+ return
+ end
+
+ if not (find(data,"!PS-AdobeFont-",1,true) or find(data,"%!FontType1",1,true)) then
+ report_pfb("no font in %a",filename)
+ return
+ end
+
+ local ascii, binary = match(data,"(.*)eexec%s+......(.*)")
+
+ if not binary then
+ report_pfb("no binary data in %a",filename)
+ return
+ end
+
+ binary = decrypt(binary,55665,4)
+
+ encoding = names or lpegmatch(p_filterencoding,ascii)
+ metadata = names or lpegmatch(p_filtermetadata,ascii,1,{})
+
+ glyphs = { }
+ routines = { }
+ vector = { }
+ chars = { }
+
+ if shapestoo or streams then
+ -- io.savedata("foo.txt",binary)
+ lpegmatch(p_filterroutines,binary,1,filename)
+ lpegmatch(p_filtershapes, binary,1,filename)
+ local data = {
+ dictionaries = {
+ {
+ charstrings = chars,
+ charset = vector,
+ subroutines = routines,
+ }
+ },
+ }
+ -- only cff 1 in type 1 fonts
+ fonts.handlers.otf.readers.parsecharstrings(false,data,glyphs,true,"cff",streams,true)
+ elseif not names then
+ lpegmatch(p_filternames,binary,1,filename)
+ end
+
+ names = names or vector
+ routines = nil
+ vector = nil
+ chars = nil
+
+ if caching then
+ containers.write(filecache,filehash,{
+ filesize = filesize,
+ fileformat = fileformat,
+ filetime = filetime,
+ names = names,
+ encoding = encoding,
+ metadata = metadata,
+ })
+ end
+
+ return names, encoding, glyphs, metadata
+
+ end
+
+ pfb.loadvector = loadpfbvector
+
+ get_indexes = function(data,pfbname)
+ local vector = loadpfbvector(pfbname)
+ if vector then
+ local characters = data.characters
+ if trace_loading then
+ report_afm("getting index data from %a",pfbname)
+ end
+ for index=0,#vector do -- hm, zero, often space or notdef
+ local name = vector[index]
+ local char = characters[name]
+ if char then
+ if trace_indexing then
+ report_afm("glyph %a has index %a",name,index)
+ end
+ char.index = index
+ else
+ if trace_indexing then
+ report_afm("glyph %a has index %a but no data",name,index)
+ end
+ end
+ end
+ end
+ end
+
+ get_shapes = function(pfbname)
+ local vector, encoding, glyphs = loadpfbvector(pfbname,true)
+ return glyphs
+ end
+
+end
+
+--[[ldx--
+<p>We start with the basic reader which we give a name similar to the built in <l n='tfm'/>
+and <l n='otf'/> reader. We only need data that is relevant for our use. We don't support
+more complex arrangements like multiple master (obsolete), direction specific kerning, etc.</p>
+--ldx]]--
+
+local spacer = patterns.spacer
+local whitespace = patterns.whitespace
+local lineend = patterns.newline
+local spacing = spacer^0
+local number = spacing * S("+-")^-1 * (R("09") + S("."))^1 / tonumber
+local name = spacing * C((1 - whitespace)^1)
+local words = spacing * ((1 - lineend)^1 / strip)
+local rest = (1 - lineend)^0
+local fontdata = Carg(1)
+local semicolon = spacing * P(";")
+local plus = spacing * P("plus") * number
+local minus = spacing * P("minus") * number
+
+-- kern pairs
+
+local function addkernpair(data,one,two,value)
+ local chr = data.characters[one]
+ if chr then
+ local kerns = chr.kerns
+ if kerns then
+ kerns[two] = tonumber(value)
+ else
+ chr.kerns = { [two] = tonumber(value) }
+ end
+ end
+end
+
+local p_kernpair = (fontdata * P("KPX") * name * name * number) / addkernpair
+
+-- char metrics
+
+local chr = false
+local ind = 0
+
+local function start(data,version)
+ data.metadata.afmversion = version
+ ind = 0
+ chr = { }
+end
+
+local function stop()
+ ind = 0
+ chr = false
+end
+
+local function setindex(i)
+ if i < 0 then
+ ind = ind + 1 -- ?
+ else
+ ind = i
+ end
+ chr = {
+ index = ind
+ }
+end
+
+local function setwidth(width)
+ chr.width = width
+end
+
+local function setname(data,name)
+ data.characters[name] = chr
+end
+
+local function setboundingbox(boundingbox)
+ chr.boundingbox = boundingbox
+end
+
+local function setligature(plus,becomes)
+ local ligatures = chr.ligatures
+ if ligatures then
+ ligatures[plus] = becomes
+ else
+ chr.ligatures = { [plus] = becomes }
+ end
+end
+
+local p_charmetric = ( (
+ P("C") * number / setindex
+ + P("WX") * number / setwidth
+ + P("N") * fontdata * name / setname
+ + P("B") * Ct((number)^4) / setboundingbox
+ + P("L") * (name)^2 / setligature
+ ) * semicolon )^1
+
+local p_charmetrics = P("StartCharMetrics") * number * (p_charmetric + (1-P("EndCharMetrics")))^0 * P("EndCharMetrics")
+local p_kernpairs = P("StartKernPairs") * number * (p_kernpair + (1-P("EndKernPairs" )))^0 * P("EndKernPairs" )
+
+local function set_1(data,key,a) data.metadata[lower(key)] = a end
+local function set_2(data,key,a,b) data.metadata[lower(key)] = { a, b } end
+local function set_3(data,key,a,b,c) data.metadata[lower(key)] = { a, b, c } end
+
+-- Notice string
+-- EncodingScheme string
+-- MappingScheme integer
+-- EscChar integer
+-- CharacterSet string
+-- Characters integer
+-- IsBaseFont boolean
+-- VVector number number
+-- IsFixedV boolean
+
+local p_parameters = P(false)
+ + fontdata
+ * ((P("FontName") + P("FullName") + P("FamilyName"))/lower)
+ * words / function(data,key,value)
+ data.metadata[key] = value
+ end
+ + fontdata
+ * ((P("Weight") + P("Version"))/lower)
+ * name / function(data,key,value)
+ data.metadata[key] = value
+ end
+ + fontdata
+ * P("IsFixedPitch")
+ * name / function(data,pitch)
+ data.metadata.monospaced = toboolean(pitch,true)
+ end
+ + fontdata
+ * P("FontBBox")
+ * Ct(number^4) / function(data,boundingbox)
+ data.metadata.boundingbox = boundingbox
+ end
+ + fontdata
+ * ((P("CharWidth") + P("CapHeight") + P("XHeight") + P("Descender") + P("Ascender") + P("ItalicAngle"))/lower)
+ * number / function(data,key,value)
+ data.metadata[key] = value
+ end
+ + P("Comment") * spacing * ( P(false)
+ + (fontdata * C("DESIGNSIZE") * number * rest) / set_1 -- 1
+ + (fontdata * C("TFM designsize") * number * rest) / set_1
+ + (fontdata * C("DesignSize") * number * rest) / set_1
+ + (fontdata * C("CODINGSCHEME") * words * rest) / set_1 --
+ + (fontdata * C("CHECKSUM") * number * words * rest) / set_1 -- 2
+ + (fontdata * C("SPACE") * number * plus * minus * rest) / set_3 -- 3 4 5
+ + (fontdata * C("QUAD") * number * rest) / set_1 -- 6
+ + (fontdata * C("EXTRASPACE") * number * rest) / set_1 -- 7
+ + (fontdata * C("NUM") * number * number * number * rest) / set_3 -- 8 9 10
+ + (fontdata * C("DENOM") * number * number * rest) / set_2 -- 11 12
+ + (fontdata * C("SUP") * number * number * number * rest) / set_3 -- 13 14 15
+ + (fontdata * C("SUB") * number * number * rest) / set_2 -- 16 17
+ + (fontdata * C("SUPDROP") * number * rest) / set_1 -- 18
+ + (fontdata * C("SUBDROP") * number * rest) / set_1 -- 19
+ + (fontdata * C("DELIM") * number * number * rest) / set_2 -- 20 21
+ + (fontdata * C("AXISHEIGHT") * number * rest) / set_1 -- 22
+ )
+
+local fullparser = ( P("StartFontMetrics") * fontdata * name / start )
+ * ( p_charmetrics + p_kernpairs + p_parameters + (1-P("EndFontMetrics")) )^0
+ * ( P("EndFontMetrics") / stop )
+
+local infoparser = ( P("StartFontMetrics") * fontdata * name / start )
+ * ( p_parameters + (1-P("EndFontMetrics")) )^0
+ * ( P("EndFontMetrics") / stop )
+
+-- infoparser = ( P("StartFontMetrics") * fontdata * name / start )
+-- * ( p_parameters + (1-P("EndFontMetrics") - P("StartCharMetrics")) )^0
+-- * ( (P("EndFontMetrics") + P("StartCharMetrics")) / stop )
+
+local function read(filename,parser)
+ local afmblob = io.loaddata(filename)
+ if afmblob then
+ local data = {
+ resources = {
+ filename = resolvers.unresolve(filename),
+ version = afm.version,
+ creator = "context mkiv",
+ },
+ properties = {
+ hasitalics = false,
+ },
+ goodies = {
+ },
+ metadata = {
+ filename = file.removesuffix(file.basename(filename))
+ },
+ characters = {
+ -- a temporary store
+ },
+ descriptions = {
+ -- the final store
+ },
+ }
+ if trace_loading then
+ report_afm("parsing afm file %a",filename)
+ end
+ lpegmatch(parser,afmblob,1,data)
+ return data
+ else
+ if trace_loading then
+ report_afm("no valid afm file %a",filename)
+ end
+ return nil
+ end
+end
+
+function readers.loadfont(afmname,pfbname)
+ local data = read(resolvers.findfile(afmname),fullparser)
+ if data then
+ if not pfbname or pfbname == "" then
+ pfbname = resolvers.findfile(file.replacesuffix(file.nameonly(afmname),"pfb"))
+ end
+ if pfbname and pfbname ~= "" then
+ data.resources.filename = resolvers.unresolve(pfbname)
+ get_indexes(data,pfbname)
+ return data
+ else -- if trace_loading then
+ report_afm("no pfb file for %a",afmname)
+ -- better than loading the afm file: data.resources.filename = rawname
+ -- but that will still crash the backend so we just return nothing now
+ end
+ end
+end
+
+-- for now, todo: n and check with otf (no afm needed here)
+
+function readers.loadshapes(filename)
+ local fullname = resolvers.findfile(filename) or ""
+ if fullname == "" then
+ return {
+ filename = "not found: " .. filename,
+ glyphs = { }
+ }
+ else
+ return {
+ filename = fullname,
+ format = "opentype",
+ glyphs = get_shapes(fullname) or { },
+ units = 1000,
+ }
+ end
+end
+
+
+function readers.getinfo(filename)
+ local data = read(resolvers.findfile(filename),infoparser)
+ if data then
+ return data.metadata
+ end
+end
diff --git a/tex/context/base/mkxl/font-tfm.lmt b/tex/context/base/mkxl/font-tfm.lmt
index 5f1c7bf2a..9fce8fc5f 100644
--- a/tex/context/base/mkxl/font-tfm.lmt
+++ b/tex/context/base/mkxl/font-tfm.lmt
@@ -171,6 +171,8 @@ local function read_from_tfm(specification)
properties.filename = specification.filename -- todo: fallback
properties.format = tfmdata.format or fonts.formats.tfm -- better than nothing
properties.usedbitmap = tfmdata.usedbitmap
+ properties.designsize = tfmdata.designsize -- let's be nice
+ parameters.designsize = tfmdata.designsize -- needed because of pdf position synchronzing
--
if getmapentry and newtfmdata then
properties.filename = features.pfbfile
@@ -234,11 +236,6 @@ local function read_from_tfm(specification)
--
fonts.mappings.addtounicode(tfmdata,filename)
--
- -- The tounicode data is passed to the backend that constructs the vectors for us.
- --
-if not CONTEXTLMTXMODE or CONTEXTLMTXMODE == 0 then
- tfmdata.tounicode = 1
-end
local tounicode = fonts.mappings.tounicode
for unicode, v in next, tfmdata.characters do
local u = v.unicode
@@ -357,7 +354,7 @@ readers.ofm = readers.tfm
-- The reencoding acts upon the 'reencode' feature which can have values 'auto' or
-- an enc file. You can also specify a 'pfbfile' feature (but it defaults to the
--- tfm filename) and a 'bitmap' feature. When no enc file is givven (auto) we will
+-- tfm filename) and a 'bitmap' feature. When no enc file is given (auto) we will
-- get the vectors from the pfb file.
do
@@ -463,6 +460,7 @@ do
local backmap = vector and table.swapped(vector)
local done = { } -- prevent duplicate
+
for tfmindex, name in sortedhash(encoding) do -- predictable order
local original = originals[tfmindex]
if original then
@@ -495,6 +493,10 @@ do
-- redo kerns and ligatures
+-- for k, v in next, characters do
+-- print(k,v.width)
+-- end
+
for k, v in next, characters do
local kerns = v.kerns
if kerns then
@@ -519,24 +521,36 @@ do
end
v.ligatures = next(t) and t or nil
end
+ local parts = v.parts
+ if parts then
+ local t = { }
+ for i=1,#parts do
+ local p = parts[i]
+ local g = p.glyph
+ t[i] = {
+ glyph = indices[g] or g,
+ extender = p.extender,
+ }
+ end
+ v.parts = t
+ end
+ local next = v.next
+ if next then
+ v.next = indices[next]
+ end
end
-- wrap up
- tfmdata.fonts = { { id = virtualid } }
- tfmdata.characters = characters
- tfmdata.fullname = tfmdata.fullname or tfmdata.name
- tfmdata.psname = file.nameonly(pfbfile or tfmdata.name)
- tfmdata.filename = pfbfile
- -- tfmdata.format = bitmap and "type3" or "type1"
- tfmdata.format = "type1"
-if not CONTEXTLMTXMODE or CONTEXTLMTXMODE == 0 then
- tfmdata.encodingbytes = 2
- tfmdata.tounicode = 1
- tfmdata.embedding = "subset"
-end
- tfmdata.usedbitmap = bitmap and virtualid
- tfmdata.private = private
+ tfmdata.fonts = { { id = virtualid } }
+ tfmdata.characters = characters
+ tfmdata.fullname = tfmdata.fullname or tfmdata.name
+ tfmdata.psname = file.nameonly(pfbfile or tfmdata.name)
+ tfmdata.filename = pfbfile
+ -- tfmdata.format = bitmap and "type3" or "type1"
+ tfmdata.format = "type1"
+ tfmdata.usedbitmap = bitmap and virtualid
+ tfmdata.private = private
return tfmdata
end
diff --git a/tex/context/base/mkxl/font-tpk.lmt b/tex/context/base/mkxl/font-tpk.lmt
index bf74dedd9..2ad74d2a9 100644
--- a/tex/context/base/mkxl/font-tpk.lmt
+++ b/tex/context/base/mkxl/font-tpk.lmt
@@ -44,12 +44,11 @@ if not fonts then fonts = { handlers = { tfm = { } } } end
local handlers = fonts.handlers
local tfm = handlers.tfm or { }
handlers.tfm = tfm
+tfm.version = 1.005
+
local readers = tfm.readers or { }
tfm.readers = readers
-tfm.version = 1.005
-tfm.cache = containers.define("fonts", "tfm", tfm.version, true)
-
-- Performance is no real issue here so I didn't optimize too much. After
-- all, these files are small and we mostly use opentype or type1 fonts.
@@ -434,9 +433,66 @@ do
local rightboundary = -2
local boundarychar = 65536
+ local function toparts(extensible)
+ local top = extensible.top or 0
+ local middle = extensible.middle or 0
+ local extender = extensible.extender or 0
+ local bottom = extensible.bottom or 0
+ local extend = extender ~= 0 and { glyph = extender, extender = 1 }
+ if bottom == 0 and top == 0 and middle == 0 then
+ if extend then
+ return {
+ { glyph = extender },
+ extend,
+ }
+ end
+ else
+ local list = { }
+ local l = 0
+ if bottom ~= 0 then
+ l = l + 1 ; list[l] = { glyph = bottom }
+ end
+ if extend then
+ l = l + 1 ; list[l] = extend
+ end
+ if middle ~= 0 then
+ l = l + 1 ; list[l] = { glyph = middle }
+ if extend then
+ l = l + 1 ; list[l] = extend
+ end
+ end
+ if top ~= 0 then
+ l = l + 1 ; list[l] = { glyph = top }
+ end
+ return list
+ end
+ end
+
+ -- We don't cache because we hardly load tfm files multiple times and we need
+ -- to copy them anyway.
+
+ tfm.cache = containers.define("fonts", "tfm", tfm.version, true, true) -- reload: true
+
+ local filecache = tfm.cache
+ local cleanname = fonts.handlers.otf.readers.helpers.cleanname
+
+ local caching = true -- mainly for MS and HH as they test huge files with many instances
+
function readers.loadtfm(filename)
local data
--
+ local fileattr = lfs.attributes(filename)
+ local filesize = fileattr and fileattr.size or 0
+ local filetime = fileattr and fileattr.modification or 0
+ local fileformat = "tfm"
+ local filehash = cleanname(file.basename(filename))
+ --
+ data = caching and containers.read(filecache,filehash)
+ --
+ if data and data.filetime == filetime and data.filesize == filesize and data.fileformat == fileformat then
+ return data
+ end
+ --
local function someerror(m)
if not data then
data = { }
@@ -623,13 +679,13 @@ do
for i=0,ne-1 do
extensibles[i] = wide and {
top = readcardinal2(s),
- bottom = readcardinal2(s),
middle = readcardinal2(s),
+ bottom = readcardinal2(s),
extender = readcardinal2(s),
} or {
top = readcardinal1(s),
- bottom = readcardinal1(s),
middle = readcardinal1(s),
+ bottom = readcardinal1(s),
extender = readcardinal1(s),
}
end
@@ -764,7 +820,7 @@ do
remainder = 0
end
end
- glyphs[i] = {
+ local glyph = {
width = widths [width],
height = heights[height],
depth = depths [depth],
@@ -775,6 +831,15 @@ do
extensible = extensible,
next = nextinsize,
}
+ if extensible then
+ extensible = toparts(extensible)
+ if extensible then
+ glyph.parts = extensible
+ glyph.partsorientation = "vertical"
+ glyph.partsitalic = glyph.italic
+ end
+ end
+ glyphs[i] = glyph
end
end
for i=bc,ec do
@@ -838,7 +903,7 @@ do
-- v.remainder = nil
-- end
--
- return {
+ data = {
name = file.nameonly(filename),
fontarea = file.pathpart(filename),
glyphs = glyphs,
@@ -862,14 +927,24 @@ do
-- width = 0,
-- writingmode = "unknown",
}
+ --
+ data.filesize = filesize
+ data.fileformat = fileformat
+ data.filetime = filetime
+ if caching then
+ containers.write(filecache,filehash,data)
+ end
+ --
+ return data
end
end
do
- local push = { "push" }
- local push = { "pop" }
+ local pushcommand = fonts.helpers.commands.push
+ local popcommand = fonts.helpers.commands.pop
+ local slotcommand = fonts.helpers.commands.slot
local w, x, y, z, f
local stack
@@ -928,10 +1003,10 @@ do
local actions = {
- [128] = function() r = r + 1 result[r] = { "slot", f or 1, readcardinal1(s) } p = p + 1 end,
- [129] = function() r = r + 1 result[r] = { "slot", f or 1, readcardinal2(s) } p = p + 2 end,
- [130] = function() r = r + 1 result[r] = { "slot", f or 1, readcardinal3(s) } p = p + 3 end,
- [131] = function() r = r + 1 result[r] = { "slot", f or 1, readcardinal4(s) } p = p + 4 end,
+ [128] = function() r = r + 1 result[r] = slotcommand[f or 1][readcardinal1(s)] p = p + 1 end,
+ [129] = function() r = r + 1 result[r] = slotcommand[f or 1][readcardinal2(s)] p = p + 2 end,
+ [130] = function() r = r + 1 result[r] = slotcommand[f or 1][readcardinal3(s)] p = p + 3 end,
+ [131] = function() r = r + 1 result[r] = slotcommand[f or 1][readcardinal4(s)] p = p + 4 end,
[132] = function()
r = r + 1
@@ -940,34 +1015,34 @@ do
end,
[133] = function()
- r = r + 1 result[r] = push
- r = r + 1 result[r] = { "slot", f or 1, readcardinal1(s) }
- r = r + 1 result[r] = pop
+ r = r + 1 result[r] = pushcommand
+ r = r + 1 result[r] = slotcommand[f or 1][readcardinal1(s)]
+ r = r + 1 result[r] = popcommand
p = p + 1
end,
[134] = function()
- r = r + 1 result[r] = push
- r = r + 1 result[r] = { "slot", f or 1, readcardinal2(s) }
- r = r + 1 result[r] = pop
+ r = r + 1 result[r] = pushcommand
+ r = r + 1 result[r] = slotcommand[f or 1][readcardinal2(s)]
+ r = r + 1 result[r] = popcommand
p = p + 2
end,
[135] = function()
- r = r + 1 result[r] = push
- r = r + 1 result[r] = { "slot", f or 1, readcardinal2(s) }
- r = r + 1 result[r] = pop
+ r = r + 1 result[r] = pushcommand
+ r = r + 1 result[r] = slotcommand[f or 1][readcardinal3(s)]
+ r = r + 1 result[r] = popcommand
p = p + 3
end,
[136] = function()
- r = r + 1 result[r] = push
- r = r + 1 result[r] = { "slot", f or 1, readcardinal4(s) }
- r = r + 1 result[r] = pop
+ r = r + 1 result[r] = pushcommand
+ r = r + 1 result[r] = slotcommand[f or 1][readcardinal4(s)]
+ r = r + 1 result[r] = popcommand
p = p + 4
end,
[137] = function()
- r = r + 1 result[r] = push
+ r = r + 1 result[r] = pushcommand
r = r + 1 result[r] = { "rule", scaled4(), scaled4() }
- r = r + 1 result[r] = pop
+ r = r + 1 result[r] = popcommand
p = p + 8
end,
@@ -978,14 +1053,14 @@ do
[141] = function()
insert(stack, { w, x, y, z })
r = r + 1
- result[r] = push
+ result[r] = pushcommand
end,
[142] = function()
local t = remove(stack)
if t then
w, x, y, z = t[1], t[2], t[3], t[4]
r = r + 1
- result[r] = pop
+ result[r] = popcommand
end
end,
@@ -1048,7 +1123,7 @@ do
if f == 0 then
f = 1
end
- r = r + 1 ; result[r] = { "slot", f, cmd }
+ r = r + 1 ; result[r] = slotcommand[f][cmd]
end
elseif cmd >= 171 and cmd <= 234 then
cmd = cmd - 170
diff --git a/tex/context/base/mkxl/font-unk.mkxl b/tex/context/base/mkxl/font-unk.mkxl
index bc079add9..e44803ecc 100644
--- a/tex/context/base/mkxl/font-unk.mkxl
+++ b/tex/context/base/mkxl/font-unk.mkxl
@@ -42,11 +42,12 @@
\definefontsynonym [MonoCaps] [unknown]
\definefontsynonym [MathRoman] [unknown]
-\definefontsynonym [MathRomanL2R] [MathRoman]
-\definefontsynonym [MathRomanR2L] [MathRoman]
\definefontsynonym [MathRomanBold] [MathRoman]
-\definefontsynonym [MathRomanBoldL2R] [MathRomanBold]
-\definefontsynonym [MathRomanBoldR2L] [MathRomanBold]
+
+\definefontsynonym [MathRomanL2R] [MathRoman] % obsolete
+\definefontsynonym [MathRomanR2L] [MathRoman] % obsolete
+\definefontsynonym [MathRomanBoldL2R] [MathRomanBold] % obsolete
+\definefontsynonym [MathRomanBoldR2L] [MathRomanBold] % obsolete
\definefontsynonym [Handwriting] [unknown]
\definefontsynonym [Calligraphic] [unknown]
diff --git a/tex/context/base/mkxl/font-vfc.lmt b/tex/context/base/mkxl/font-vfc.lmt
index aff647dd1..479aa4ca0 100644
--- a/tex/context/base/mkxl/font-vfc.lmt
+++ b/tex/context/base/mkxl/font-vfc.lmt
@@ -18,25 +18,35 @@ local setmetatableindex = table.setmetatableindex
-- Helpers dealing with virtual fonts: beware, these are final values so
-- don't change the content of tables fetched from here!
-local push = { "push" }
-local pop = { "pop" }
-local dummy = { "comment" }
+local pushcommand = { "push" }
+local popcommand = { "pop" }
+local dummycommand = { "comment" }
+
+local slotcommand = setmetatableindex(function(t,k)
+ local v = setmetatableindex(function(tt,kk)
+ local vv = { "slot", k, kk }
+ tt[kk] = vv
+ return vv
+ end)
+ t[k] = v
+ return v
+end)
function helpers.prependcommands(commands,...)
- insert(commands,1,push)
+ insert(commands,1,pushcommand)
for i=select("#",...),1,-1 do
local s = (select(i,...))
if s then
insert(commands,1,s)
end
end
- insert(commands,pop)
+ insert(commands,popcommand)
return commands
end
function helpers.appendcommands(commands,...)
- insert(commands,1,push)
- insert(commands,pop)
+ insert(commands,1,pushcommand)
+ insert(commands,popcommand)
for i=1,select("#",...) do
local s = (select(i,...))
if s then
@@ -47,20 +57,20 @@ function helpers.appendcommands(commands,...)
end
function helpers.prependcommandtable(commands,t)
- insert(commands,1,push)
+ insert(commands,1,pushcommand)
for i=#t,1,-1 do
local s = t[i]
if s then
insert(commands,1,s)
end
end
- insert(commands,pop)
+ insert(commands,popcommand)
return commands
end
function helpers.appendcommandtable(commands,t)
- insert(commands,1,push)
- insert(commands,pop)
+ insert(commands,1,pushcommand)
+ insert(commands,popcommand)
for i=1,#t do
local s = t[i]
if s then
@@ -71,14 +81,15 @@ function helpers.appendcommandtable(commands,t)
end
helpers.commands = utilities.storage.allocate {
- char = setmetatableindex(function(t,k) local v = { "slot", 0, k } t[k] = v return v end),
- right = setmetatableindex(function(t,k) local v = { "right", k } t[k] = v return v end),
- left = setmetatableindex(function(t,k) local v = { "left", k } t[k] = v return v end),
- down = setmetatableindex(function(t,k) local v = { "down", k } t[k] = v return v end),
- up = setmetatableindex(function(t,k) local v = { "up", k } t[k] = v return v end),
- push = push,
- pop = pop,
- dummy = dummy,
+ char = setmetatableindex(function(t,k) local v = { "char", k } t[k] = v return v end),
+ right = setmetatableindex(function(t,k) local v = { "right", k } t[k] = v return v end),
+ left = setmetatableindex(function(t,k) local v = { "left", k } t[k] = v return v end),
+ down = setmetatableindex(function(t,k) local v = { "down", k } t[k] = v return v end),
+ up = setmetatableindex(function(t,k) local v = { "up", k } t[k] = v return v end),
+ push = pushcommand,
+ pop = popcommand,
+ dummy = dummycommand,
+ slot = slotcommand,
}
local codeinjections = backends.codeinjections
diff --git a/tex/context/base/mkxl/font-vir.lmt b/tex/context/base/mkxl/font-vir.lmt
index f60639d6a..84da09064 100644
--- a/tex/context/base/mkxl/font-vir.lmt
+++ b/tex/context/base/mkxl/font-vir.lmt
@@ -38,6 +38,8 @@ vf.whatever = whatever
vf.helpers = helpers
vf.predefined = predefined
+local slotcommand = predefined.slot
+
setmetatableindex(whatever, function(t,k) local v = { } t[k] = v return v end)
local function checkparameters(g,f)
@@ -78,7 +80,7 @@ local function combine_assign(g, name, from, to, start, force)
for i=from,to do
if fc[i] and (force or not gc[i]) then
gc[i] = fastcopy(fc[i],true) -- can be optimized
- gc[i].commands = { { "slot", hn, start } }
+ gc[i].commands = { slotcommand[hn][start] }
gd[i] = fd[i]
end
start = start + 1
@@ -107,7 +109,7 @@ local function combine_names(g,name,force)
for k, v in next, fc do
if force or not gc[k] then
gc[k] = fastcopy(v,true)
- gc[k].commands = { { "slot", hn, k } }
+ gc[k].commands = { slotcommand[hn][k] }
gd[i] = fd[i]
end
end
diff --git a/tex/context/base/mkxl/lang-hyp.lmt b/tex/context/base/mkxl/lang-hyp.lmt
index 42068ef39..1ac2604f2 100644
--- a/tex/context/base/mkxl/lang-hyp.lmt
+++ b/tex/context/base/mkxl/lang-hyp.lmt
@@ -1340,7 +1340,6 @@ featureset.hyphenonly = hyphenonly == v_yes
first, current = remove_node(first,current,true)
end
end
-
end
local function inject(leftchar,rightchar,code,attrnode)
diff --git a/tex/context/base/mkxl/lpdf-emb.lmt b/tex/context/base/mkxl/lpdf-emb.lmt
index 271aadd8d..f63dcf6ef 100644
--- a/tex/context/base/mkxl/lpdf-emb.lmt
+++ b/tex/context/base/mkxl/lpdf-emb.lmt
@@ -194,9 +194,9 @@ end
widtharray = function(details,indices,maxindex,units,correction)
local widths = pdfarray()
- local length = 0
- local factor = 10000 / (units * correction)
if maxindex > 0 then
+ local length = 0
+ local factor = 10000 / (units * (correction or 1))
local lastindex = -1
local sublist = nil
for index=1,maxindex do
@@ -204,8 +204,10 @@ end
if data then
local width = data.width -- hm, is inaccurate for cff, so take from elsewhere
if width then
- -- width = round(width * 10000 / units) / 10
- width = round(width * factor) / 10
+ if correction then
+ -- width = round(width * 10000 / units) / 10
+ width = round(width * factor) / 10
+ end
else
width = 0
end
@@ -241,7 +243,6 @@ end
local resolved = { }
setmetatable(used,nil) -- prevent more index allocations
-
for unicode, data in next, descriptions do
local index = data.index
reverse[index or unicode] = data
@@ -1422,27 +1423,81 @@ do
local descriptions = details.rawdata.descriptions
local metadata = details.rawdata.metadata
local indices = details.indices
+ local used = details.used
+ local usedfonts = details.usedfonts -- in case of multiple loaded t1 fonts with no common description
local metabbox = { fontheader.xmin, fontheader.ymin, fontheader.xmax, fontheader.ymax }
local correction = 1
-
- -- (*) We share code with type1 and when we have old school tfm with
- -- pfb but without descriptions we're kind of toast.
-
if not descriptions or not next(descriptions) then
- -- This is good enough, we only need indices and widths.
- descriptions = details.fontdata.characters
- -- This is a hack, we have no basepoints.
- correction = details.fontdata.parameters.size / 1000
- -- And this needs checking.
- correction = correction * bpfactor / ptfactor
- metadata = { }
+ -- (*) We share code with type1 and when we have old school tfm with pfb shapes
+ -- we don't have descriptions, so we need to construct these. This could be done
+ -- earlier but then we lack info about sharing. Horrible hackery. If Type1 wasn't
+ -- obsolete I'd make a dedicated mainwriter that does the index and width collect
+ -- more efficient but there is no gain now.
+ if true then
+ descriptions = { }
+ setmetatable(indices,nil)
+ setmetatable(used,nil)
+ for u in next, usedfonts do
+ local param = fonts.hashes.parameters[u]
+ local chars = fonts.hashes.characters[u]
+ local units = 1000 -- to be checked (picked up)
+ correction = param.size / 1000
+ -- correction = correction * bpfactor / ptfactor
+ local factor = 1000 / (units * correction)
+ if false then
+-- if true then
+ for k, v in sortedhash(chars) do
+ if descriptions[k] then
+ local w1 = descriptions[k].width
+ local w2 = round((v.advance or v.width or 0) * factor)
+ if w1 ~= w2 then
+ local w = v.advance or v.width or 0
+ print(
+ u,k,utf.char(k),
+ w1,w2,
+ ((v.advance or v.width or 0)*param.designsize/param.size) / 1000
+ )
+ end
+ else
+ descriptions[k] = {
+ index = v.index,
+ width = round((v.advance or v.width or 0) * factor),
+ unicode = v.unicode,
+ }
+ end
+ end
+ else
+ for k, v in next, chars do
+ if descriptions[k] then
+ -- done
+ else
+ local index = v.index
+ if indices[index] or used[index] then -- play safe
+ descriptions[k] = {
+ index = index,
+ width = round((v.advance or v.width or 0) * factor),
+ unicode = v.unicode,
+ }
+ end
+ end
+ end
+ end
+ end
+ correction = false
+ else
+ -- This is tricky as it can be the wrong one and incomplete so a first come
+ -- and go issue. The basepoint correction needs checking.
+ descriptions = details.fontdata.characters
+ correction = details.fontdata.parameters.size / 1000
+ correction = correction * bpfactor / ptfactor
+ end
+ metadata = { }
end
--
local indices,
include,
minindex,
- maxindex = collectindices(descriptions,indices,details.used,details.hash)
-
+ maxindex = collectindices(descriptions,indices,used,details.hash)
local streamoffset = 0
local glyphstreams,
charmappings = tablecreators.cff(fontfile)
@@ -1736,7 +1791,7 @@ do
local xforms = pdfdictionary()
local nofglyphs = 0
local scale = 10 * details.parameters.size/details.parameters.designsize
-scale = scale * (7200/7227) -- test on extensibles
+ scale = scale * (7200/7227) -- test on extensibles
local units = details.parameters.units
local function boxtopdf(image,data) -- image == glyph
nofglyphs = nofglyphs + 1
@@ -1980,7 +2035,6 @@ scale = scale * (7200/7227) -- test on extensibles
-- we're not going to hash this ... could be done if needed (but who mixes different
-- color schemes ...)
t = concat(t," ")
- -- print(t)
return t, w / dropunits
end
end
@@ -2173,6 +2227,7 @@ function lpdf.flushfonts()
-- don't have the id.
-- we can combine the two for loops .. todo
+-- inspect(lpdf.usedcharacters)
for fontid, used in sortedhash(lpdf.usedcharacters) do
@@ -2182,13 +2237,13 @@ function lpdf.flushfonts()
local hash = getstreamhash(fontid)
if hash then
local parent = mainfonts[hash]
--- print("before",fontid,hash,parent)
if not parent then
local fontdata = usedfonts[fontid]
local rawdata = fontdata.shared and fontdata.shared.rawdata
local resources = fontdata.resources
local properties = fontdata.properties -- writingmode and type3
local parameters = fontdata.parameters -- used in type3
+-- print("before",fontid,hash,parent,rawdata)
if not rawdata then
-- we have a virtual font that loaded directly ... at some point i will
-- sort this out (in readanddefine we need to do a bit more) .. the problem
@@ -2214,6 +2269,7 @@ function lpdf.flushfonts()
fontdata = fontdata,
filename = resources.filename or properties.filename or "unset",
indices = { },
+ usedfonts = { [fontid] = true },
used = used,
rawdata = rawdata,
properties = properties, -- we assume consistency
@@ -2229,6 +2285,7 @@ function lpdf.flushfonts()
end
-- print("after ",fontid,hash,parent)
if parent then
+ parent.usedfonts[fontid] = true
local indices = parent.indices
for k, v in next, used do
indices[k] = v
diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt
index 784654c06..6c321ec54 100644
--- a/tex/context/base/mkxl/lpdf-lmt.lmt
+++ b/tex/context/base/mkxl/lpdf-lmt.lmt
@@ -2717,7 +2717,7 @@ local function flushstreamobj(data,n,dict,comp,nolength)
-- probleem: we need to adapt length!
b = f_stream_b_d_r(n,dict) -- raw object, already treated
if encryptstream then
-print("check length")
+ print("check length")
data = encryptstream(data)
size = #data
end
@@ -2754,7 +2754,7 @@ print("check length")
else
if nolength then
if encryptstream then
-print("check length")
+ print("check length")
data = encryptstream(data)
end
data = f_stream_d_r(n,dict,data) -- raw object, already treated
diff --git a/tex/context/base/mkxl/lpdf-rul.lmt b/tex/context/base/mkxl/lpdf-rul.lmt
index 3bcfa80e2..4efa17bb0 100644
--- a/tex/context/base/mkxl/lpdf-rul.lmt
+++ b/tex/context/base/mkxl/lpdf-rul.lmt
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['lpdf-rul'] = {
-- todo: split backend and pdf
-local tonumber, next, type = tonumber, next, type
+local tonumber, tostring, next, type = tonumber, tostring, next, type
local concat, setmetatableindex = table.concat, table.setmetatableindex
local attributes = attributes
@@ -237,13 +237,23 @@ do
}
setmetatableindex(linemapping,function(t,k)
- local v = tonumber(k) and k or "ltrb"
+ local v = tonumber(k)
+ if v then
+ v = tostring(v)
+ else
+ v = "ltrb"
+ end
t[k] = v
return v
end)
setmetatableindex(roundmapping,function(t,k)
- local v = tonumber(k) and k or "ltrb"
+ local v = tonumber(k)
+ if v then
+ v = tostring(v)
+ else
+ v = "ltrb"
+ end
t[k] = v
return v
end)
diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt
index 1036445f1..3a7324586 100644
--- a/tex/context/base/mkxl/math-act.lmt
+++ b/tex/context/base/mkxl/math-act.lmt
@@ -9,6 +9,11 @@ if not modules then modules = { } end modules ['math-act'] = {
-- Here we tweak some font properties (if needed). The commented sections
-- have been removed (no longer viable) but can be found in the .lua variant.
+-- The tweaks here evolved from experiments with, discussions about and upgrades of
+-- the math subsystem, a project that Mikael Sundvist and I started end 2021 and
+-- that is still ongoing in 2023 (and probably beyond as we find new challenges as
+-- we go).
+
local type, next, tonumber = type, next, tonumber
local fastcopy, copytable, insert, remove, concat = table.fastcopy, table.copy, table.insert, table.remove, table.concat
local formatters = string.formatters
@@ -82,10 +87,12 @@ end
local undefined <const> = 0x3FFFFFFF -- maxdimen or undefined_math_parameter
-function mathematics.initializeparameters(target,original)
+function mathematics.initializeparameters(target,original,nodimensions)
local mathparameters = original.mathparameters
if mathparameters and next(mathparameters) then
- mathparameters = mathematics.dimensions(mathparameters)
+ if nodimensions ~= "noscale" then
+ mathparameters = mathematics.dimensions(mathparameters)
+ end
--
-- if not mathparameters.MinConnectorOverlap then mathparameters.MinConnectorOverlap = undefined end
if not mathparameters.SubscriptShiftDownWithSuperscript then mathparameters.SubscriptShiftDownWithSuperscript = mathparameters.SubscriptShiftDown * 1.5 end
@@ -2867,8 +2874,62 @@ do
local double <const> = 0x2016
local triple <const> = 0x2980
- local function extensible(unicode,total,used)
- return {
+ -- local nps = fonts.helpers.newprivateslot
+ --
+ -- local function variantlist(characters,unicode,chardata,what,total,used)
+ -- local parenthesis = characters[0x28].next
+ -- local width = chardata.width
+ -- local height = chardata.height
+ -- local depth = chardata.depth
+ -- local total = height + depth
+ -- local count = 1
+ -- while parenthesis do
+ -- local private = nps(what .. " size " .. count)
+ -- local pardata = characters[parenthesis]
+ -- local parheight = pardata.height
+ -- local pardepth = pardata.depth
+ -- local scale = (parheight+pardepth)/total
+ -- local offset = - pardepth + scale * depth
+ -- chardata.next = private
+ -- chardata = {
+ -- unicode = unicode,
+ -- width = width,
+ -- height = parheight,
+ -- depth = pardepth,
+ -- commands = {
+ -- { "offset", 0, offset, unicode, 1, scale }
+ -- },
+ -- }
+ -- characters[private] = chardata
+ -- parenthesis = pardata.next
+ -- if paranthesis then
+ -- pardata = characters[parenthesis]
+ -- end
+ -- count = count + 1
+ -- end
+ -- chardata.parts = {
+ -- {
+ -- advance = total,
+ -- ["end"] = used,
+ -- glyph = unicode,
+ -- start = 0,
+ -- -- start = used/5,
+ -- },
+ -- {
+ -- advance = total,
+ -- -- ["end"] = 0,
+ -- ["end"] = used/5, -- prevents small gap with inward curved endpoints
+ -- extender = 1,
+ -- glyph = unicode,
+ -- start = used,
+ -- },
+ -- }
+ -- chardata.partsorientation = "vertical"
+ -- end
+
+ local function variantlist(unicode,chardata,total,used)
+ chardata.varianttemplate = 0x0028
+ chardata.parts = {
{
advance = total,
["end"] = used,
@@ -2885,6 +2946,7 @@ do
start = used,
},
}
+ chardata.partsorientation = "vertical"
end
function mathtweaks.addbars(target,original,parameters)
@@ -2894,18 +2956,17 @@ do
local height = basechar.height
local depth = basechar.depth
local advance = (parameters.advance or 1/10) * width
- -- local used = 0.8*height
local used = 1.2*height -- large overlap because no smaller pieces
local total = height + depth
- basechar.parts = extensible(single,total,used)
- basechar.partsorientation = "vertical"
- characters[double] = {
+ --
+ -- variantlist(characters,single,basechar,"single bar",total,used)
+ variantlist(single,basechar,total,used)
+ --
+ basechar = {
unicode = double,
width = 2*width - 1*advance,
height = height,
depth = depth,
- parts = extensible(double,total,used),
- partsorientation = "vertical",
callback = "devirtualize",
commands = {
charcommand[single],
@@ -2913,13 +2974,15 @@ do
charcommand[single],
},
}
- characters[triple] = {
+ characters[double] = basechar
+ -- variantlist(characters,double,basechar,"double bar",total,used)
+ variantlist(double,basechar,total,used)
+ --
+ basechar = {
unicode = triple,
width = 3*width - 2*advance,
height = height,
depth = depth,
- parts = extensible(triple,total,used),
- partsorientation = "vertical",
callback = "devirtualize",
commands = {
charcommand[single],
@@ -2929,8 +2992,12 @@ do
charcommand[single],
},
}
+ characters[triple] = basechar
+ -- variantlist(characters,triple,basechar,"triple bar",total,used)
+ variantlist(triple,basechar,total,used)
+ --
if trace_tweaking then
- report_tweak("triple bars %U added",target,original,triple)
+ report_tweak("single, double and triple bars added",target,original)
end
end
@@ -3276,7 +3343,7 @@ do
properties.mathcontrol = newcontrol
target.mathcontrol = newcontrol
if trace_tweaking then
- report_tweak("forcing math font options 0x%08X instead of 0x08X",target,original,newcontrol,oldcontrol)
+ report_tweak("forcing math font options 0x%08X instead of 0x%08X",target,original,newcontrol,oldcontrol)
end
end
end
@@ -3402,6 +3469,21 @@ do
characters[targetunicode] = copiedglyph(target,characters,chars,sourceunicode,index)
end
end
+ --
+ local inherit = entry.inherit
+ if inherit then
+ local mathparameters = target.mathparameters
+ local dropparameters = fontdata[id].mathparameters
+ if dropparameters then
+ for name in sortedhash(inherit) do
+ local value = dropparameters[name]
+ if value then
+ mathparameters[name] = value
+ end
+ end
+ end
+ end
+ --
elseif feature then
for s=firstsource,lastsource do
local t = s + offset
@@ -3474,6 +3556,35 @@ end
local apply_tweaks = true directives.register("math.applytweaks", function(v) apply_tweaks = v end)
local applied_tweaks = 0
+local function tweaklist(target,original,tweaks)
+ if type(tweaks) == "table" then
+ for i=1,#tweaks do
+ local tweak = tweaks[i]
+ if type(tweak) == "table" then
+ local action = mathtweaks[tweak.tweak or ""]
+ if action then
+ local feature = tweak.feature
+ local features = target.specification.features.normal
+ if feature == nil or features[feature] then
+ local version = tweak.version
+ if version and version ~= target.tweakversion then
+ report_math("skipping tweak %a version %a",tweak.tweak,version)
+ elseif original then
+ action(target,original,tweak)
+ else
+ action(target,tweak)
+ end
+ end
+ end
+ end
+ end
+ end
+end
+
+function mathtweaks.tweaks(target,original,parameters)
+ tweaklist(target,original,parameters.list)
+end
+
local function applytweaks(when,target,original)
if apply_tweaks then
local goodies = original.goodies
@@ -3492,32 +3603,10 @@ local function applytweaks(when,target,original)
statistics.starttiming(mathtweaks)
applied_tweaks = applied_tweaks + 1
tweaks = tweaks[when]
- if type(tweaks) == "table" then
- if trace_defining then
- report_math("tweaking math of %a @ %p (%s: %s)",target.properties.fullname,target.parameters.size,when,"okay")
- end
- for i=1,#tweaks do
- local tweak = tweaks[i]
- local tvalue = type(tweak)
- if type(tweak) == "table" then
- local action = mathtweaks[tweak.tweak or ""]
- if action then
- local feature = tweak.feature
- local features = target.specification.features.normal
- if feature == nil or features[feature] then
- local version = tweak.version
- if version and version ~= target.tweakversion then
- report_math("skipping tweak %a version %a",tweak.tweak,version)
- elseif original then
- action(target,original,tweak)
- else
- action(target,tweak)
- end
- end
- end
- end
- end
+ if trace_defining then
+ report_math("tweaking math of %a @ %p (%s: %s)",target.properties.fullname,target.parameters.size,when,"okay")
end
+ tweaklist(target,original,tweaks)
end
statistics.stoptiming(mathtweaks)
end
diff --git a/tex/context/base/mkxl/math-dim.lmt b/tex/context/base/mkxl/math-dim.lmt
index 8f35b4bbd..cb2a48911 100644
--- a/tex/context/base/mkxl/math-dim.lmt
+++ b/tex/context/base/mkxl/math-dim.lmt
@@ -211,8 +211,8 @@ function mathematics.dimensions(dimens) -- beware, dimens get spoiled
RadicalDegreeBottomRaisePercent = t . radical_degree_raise . display_style,
-- ScriptPercentScaleDown
-- ScriptScriptPercentScaleDown
- -- SkewedFractionHorizontalGap
- -- SkewedFractionVerticalGap
+ SkewedFractionHorizontalGap = t . skewed_fraction_hgap . default,
+ SkewedFractionVerticalGap = t . skewed_fraction_vgap . default,
SpaceAfterScript = t . space_after_script . text_style,
StackBottomDisplayStyleShiftDown = t . stack_denom_down . display_style,
StackBottomShiftDown = t . stack_denom_down . text_style,
diff --git a/tex/context/base/mkxl/math-ext.lmt b/tex/context/base/mkxl/math-ext.lmt
new file mode 100644
index 000000000..e1dc74e48
--- /dev/null
+++ b/tex/context/base/mkxl/math-ext.lmt
@@ -0,0 +1,109 @@
+if not modules then modules = { } end modules ['math-ext'] = {
+ version = 1.001,
+ comment = "companion to math-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- local basename = file.basename
+-- local sortedhash = table.sortedhash
+--
+-- local mathematics = mathematics
+-- local extras = mathematics.extras or { }
+-- mathematics.extras = extras
+--
+-- local characters = characters
+-- local chardata = characters.data
+-- local mathpairs = characters.mathpairs
+--
+-- local trace_virtual = false
+-- local report_math = logs.reporter("mathematics")
+--
+-- trackers.register("math.virtual", function(v) trace_virtual = v end)
+--
+-- local mathplus = { }
+--
+-- function extras.add(unicode)
+-- local min = mathematics.extrabase
+-- local max = min + 0xFFF
+-- if unicode >= min and unicode <= max then
+-- if chardata[unicode] then
+-- mathplus[unicode] = true
+-- else
+-- report_math("extra %U is not a registered code point",unicode)
+-- end
+-- else
+-- report_math("extra %U should be in range %U - %U",unicode,min,max)
+-- end
+-- end
+--
+-- function extras.copy(target,original)
+-- local characters = target.characters
+-- local properties = target.properties
+-- local parameters = target.parameters
+-- for unicode in sortedhash(mathplus) do
+-- local extradesc = chardata[unicode]
+-- local nextinsize = extradesc.nextinsize
+-- if nextinsize then
+-- local extrachar = characters[unicode]
+-- local first = 1
+-- local charused = unicode
+-- if not extrachar then
+-- for i=1,#nextinsize do
+-- local slot = nextinsize[i]
+-- extrachar = characters[slot]
+-- if extrachar then
+-- characters[unicode] = extrachar
+-- first = i + 1
+-- charused = slot
+-- break
+-- end
+-- end
+-- end
+-- if not extrachar then
+-- if trace_virtual then
+-- report_math("extra %U in %a at %p with class %a and name %a is not mapped",
+-- unicode,basename(properties.fullname),parameters.size,
+-- extradesc.mathclass,extradesc.mathname)
+-- end
+-- elseif not extrachar.next then
+-- local nextused = false
+-- for i=first,#nextinsize do
+-- local nextslot = nextinsize[i]
+-- local nextbase = characters[nextslot]
+-- if nextbase then
+-- local nextnext = nextbase and nextbase.next
+-- if nextnext then
+-- local nextchar = characters[nextnext]
+-- if nextchar then
+-- extrachar.next = nextchar
+-- nextused = nextslot
+-- break
+-- end
+-- end
+-- end
+-- end
+-- if trace_virtual then
+-- if nextused then
+-- report_math("extra %U in %a at %p with class %a and name %a maps onto %U with next %U",
+-- unicode,basename(properties.fullname),parameters.size,charused,
+-- extradesc.mathclass,extradesc.mathname,nextused)
+-- else
+-- report_math("extra %U in %a at %p with class %a and name %a maps onto %U with no next",
+-- unicode,basename(properties.fullname),parameters.size,charused,
+-- extradesc.mathclass,extradesc.mathname)
+-- end
+-- end
+-- else
+-- if trace_virtual then
+-- report_math("extra %U in %a at %p with class %a and name %a maps onto %U with no next", -- own next
+-- unicode,basename(properties.fullname),parameters.size,charused,
+-- extradesc.mathclass,extradesc.mathname)
+-- end
+-- end
+-- end
+-- end
+-- end
+--
+-- utilities.sequencers.appendaction(mathactions,"system","mathematics.extras.copy")
diff --git a/tex/context/base/mkxl/math-fbk.lmt b/tex/context/base/mkxl/math-fbk.lmt
index 052f15f50..1cc02a49f 100644
--- a/tex/context/base/mkxl/math-fbk.lmt
+++ b/tex/context/base/mkxl/math-fbk.lmt
@@ -27,6 +27,7 @@ mathematics.fallbacks = fallbacks
----- helpers = fonts.helpers
----- charcommand = helpers.commands.char
+----- slotcommand = helpers.commands.slot
----- leftcommand = helpers.commands.left
----- rightcommand = helpers.commands.right
----- upcommand = helpers.commands.up
@@ -409,7 +410,7 @@ end
-- local function reference(index,char)
-- if index then
--- return { "slot", index, char }
+-- return slotcommand[index][char]
-- else
-- return charcommand[char]
-- end
diff --git a/tex/context/base/mkxl/math-fnt.lmt b/tex/context/base/mkxl/math-fnt.lmt
index af180b6e4..cf14b4aa2 100644
--- a/tex/context/base/mkxl/math-fnt.lmt
+++ b/tex/context/base/mkxl/math-fnt.lmt
@@ -7,6 +7,7 @@ if not modules then modules = { } end modules ['math-fnt'] = {
}
local round = math.round
+local setmetatableindex = table.setmetatableindex
local nuts = nodes.nuts
local tonut = nodes.tonut
@@ -32,80 +33,114 @@ local addcharacters = font.addcharacters
-- not yet ok for compact fonts .. needs checking .. or just make this non-compact only
-- there's also an inaccuracy creeping in: \sqrt{\quad\blackrule[height=25pt,depth=25pt]}
+local cache = setmetatableindex(function(t,width)
+ local v = setmetatableindex(function(t,height)
+ local v = setmetatableindex(function(t,depth)
+ local v = setmetatableindex(function(t,font)
+ local v = setmetatableindex(function(t,char)
+ t[char] = v
+ return v
+ end)
+ t[font] = v
+ return v
+ end)
+ t[depth] = v
+ return v
+ end)
+ t[height] = v
+ return v
+ end)
+ t[width] = v
+ return v
+end)
+
+
local function register_extensible(font,char,style,box)
-- We don't share (yet)!
- local bx = tonut(box)
- updaters.apply("tagging.state.disable") -- fast enough
- nodes.handlers.finalizelist(bx)
- updaters.apply("tagging.state.enable")
- local id = getid(bx)
- local al = getattrlst(bx)
- local wd, ht, dp = getwhd(bx)
local fontdata = chardata[font]
local oldchar = fontdata[char]
- local unicode = oldchar.unicode or char
- -- we cannot have self referencing t3 fonts
- local oldcommands = oldchar.oldcommands
- local newcommands = oldchar.commands
- if oldcommands then
- oldchar.commands = oldcommands
- end
- --
- local private = fonts.helpers.setboxdirectly(font,unicode,box)
- -- we saved a scaled glyph stream so we now use an unscaled one ...
- local p = fonts.hashes.parameters[font]
- local g = new_glyph(font,private,al)
--- if fonts.hashes.properties[font].compactmath then
--- nuts.setscales(g,1000,1000,1000)
--- end
- -- nasty, testcase: bold math sqrt extensible
- local sx = round(1000/p.extendfactor)
- local sy = round(1000/p.squeezefactor)
- nuts.setscales(g,1000,sx,sy)
- -- horrible
-if sx ~= 1000 then
- wd = wd * 7200/7227
-end
-if sy ~= 1000 then
- ht = ht * 7200/7227
- dp = dp * 7200/7227
-end
- --
- local n = new_hlist(g)
- --
- if newcommands then
- oldchar.commands = newcommands
- end
- --
- -- local newchar = {
- -- unicode = unicode,
- -- width = wd,
- -- height = ht,
- -- depth = dp,
- -- }
- -- local p = oldchar.vparts
- -- if p then
- -- local first = fontdata[p[#p].glyph]
- -- local last = fontdata[p[ 1].glyph]
- -- if first then
- -- newchar.topleft = first.topleft
- -- newchar.topright = first.topright
- -- end
- -- if last then
- -- newchar.bottomleft = last.bottomleft
- -- newchar.bottomright = last.bottomright
- -- end
- -- end
- -- addcharacters(font, { [private] = newchar })
- -- so the dimensions of the box don't match the glyph scale!
- setwhd(n,wd,ht,dp)
- setattrlst(n,al)
- if id == vlist_code then
- n = new_vlist(n)
+ if oldchar and oldchar.keepvirtual then
+ -- for now, needed for iwona etc
+ return
+ else
+ local bx = tonut(box)
+ updaters.apply("tagging.state.disable") -- fast enough
+ nodes.handlers.finalizelist(bx)
+ updaters.apply("tagging.state.enable")
+ local id = getid(bx)
+ local al = getattrlst(bx)
+ local wd, ht, dp = getwhd(bx)
+ local unicode = oldchar.unicode or char
+ -- we cannot have self referencing t3 fonts
+ local oldcommands = oldchar.oldcommands
+ local newcommands = oldchar.commands
+ if oldcommands then
+ oldchar.commands = oldcommands
+ end
+ --
+ local p = fonts.hashes.parameters[font]
+ local sx = round(1000/p.extendfactor)
+ local sy = round(1000/p.squeezefactor)
+ nuts.setscales(g,1000,sx,sy)
+ -- we saved a scaled glyph stream so we now use an unscaled one ... horrible hack:
+ if sx ~= 1000 then
+ wd = wd * 7200/7227
+ end
+ if sy ~= 1000 then
+ ht = ht * 7200/7227
+ dp = dp * 7200/7227
+ end
+ --
+ -- local private = fonts.helpers.setboxdirectly(font,unicode,box)
+ local private = cache[wd][ht][dp][font][unicode]
+ if not private then
+ private = fonts.helpers.setboxdirectly(font,unicode,box)
+ cache[wd][ht][dp][font][unicode] = private
+ end
+ local glyph = new_glyph(font,private,al)
+ --
+ -- if fonts.hashes.properties[font].compactmath then
+ -- nuts.setscales(g,1000,1000,1000)
+ -- end
+ --
+ -- nasty, testcase: bold math sqrt extensible
+ --
+ local n = new_hlist(glyph)
+ --
+ if newcommands then
+ oldchar.commands = newcommands
+ end
+ --
+ -- local newchar = {
+ -- unicode = unicode,
+ -- width = wd,
+ -- height = ht,
+ -- depth = dp,
+ -- }
+ -- local p = oldchar.vparts
+ -- if p then
+ -- local first = fontdata[p[#p].glyph]
+ -- local last = fontdata[p[ 1].glyph]
+ -- if first then
+ -- newchar.topleft = first.topleft
+ -- newchar.topright = first.topright
+ -- end
+ -- if last then
+ -- newchar.bottomleft = last.bottomleft
+ -- newchar.bottomright = last.bottomright
+ -- end
+ -- end
+ -- addcharacters(font, { [private] = newchar })
+ -- so the dimensions of the box don't match the glyph scale!
setwhd(n,wd,ht,dp)
setattrlst(n,al)
+ if id == vlist_code then
+ n = new_vlist(n)
+ setwhd(n,wd,ht,dp)
+ setattrlst(n,al)
+ end
+ return tonode(n)
end
- return tonode(n)
end
directives.register("math.extensibles", function(v)
diff --git a/tex/context/base/mkxl/math-frc.mkxl b/tex/context/base/mkxl/math-frc.mkxl
index f1a4de236..d11acac9b 100644
--- a/tex/context/base/mkxl/math-frc.mkxl
+++ b/tex/context/base/mkxl/math-frc.mkxl
@@ -294,6 +294,11 @@
\s!noaxis \space
\s!hfactor \numexpr\mathfractionparameter\c!hfactor\relax}
+\setupmathfractions % we now inherit !
+ [\c!topcolor=\mathfractionparameter\c!color,
+ \c!bottomcolor=\mathfractionparameter\c!color,
+ \c!rulecolor=\mathfractionparameter\c!color]
+
\def\math_frac_command_u
{\edef\p_method {\mathfractionparameter\c!method}%
\edef\p_rule {\mathfractionparameter\c!rule}%
@@ -317,7 +322,7 @@
\fi
\fi
\endcsname \lastnamedcs \else \csname\??fractionmethods\v!vertical\v!auto\endcsname \fi
- \usedcolorparameterattributes{\mathfractionparameter\c!color}%
+ \usedcolorparameterattributes{\mathfractionparameter\c!rulecolor}% was \c!color so we break compatibility !
thickness \ifx\p_thickness\v!font
\zeropoint
\s!font \space
@@ -480,7 +485,7 @@
\Umathfractiondelsize\alldisplaystyles\p_threshold\dimexpr\textface\relax}
\setupmathfractions
- [\c!inlinethreshold=.25, % no unit but fraction
+ [\c!inlinethreshold=1.2, % no unit but fraction
\c!displaythreshold=\v!auto, % no unit but fraction
\c!threshold=.25\exheight]
diff --git a/tex/context/base/mkxl/math-inc.lmt b/tex/context/base/mkxl/math-inc.lmt
new file mode 100644
index 000000000..7c32adde6
--- /dev/null
+++ b/tex/context/base/mkxl/math-inc.lmt
@@ -0,0 +1,94 @@
+if not modules then modules = { } end modules ['back-inc'] = {
+ version = 1.001,
+ comment = "companion to back-exp.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- This is an experiment. If it's really useful then I'll make a more efficient
+-- local export facility.
+
+local tonumber, next = tonumber, next
+local utfbyte, utfchar, utfsplit = utf.byte, utf.char, utf.split
+local match, gsub = string.match, string.gsub
+local nspaces = string.nspaces
+local concat = table.concat
+local xmltext = xml.text
+local undent = buffers.undent
+
+local f_entity = string.formatters["&x%X;"]
+local f_blob = string.formatters['<?xml version="2.0"?>\n\n<!-- formula %i -->\n\n%s']
+
+local report_tags = logs.reporter("structure","tags")
+
+local all = nil
+local back = nil
+
+local function unmath(s)
+ local t = utfsplit(s)
+ for i=1,#t do
+ local ti = t[i]
+ local bi = utfbyte(ti)
+ if bi > 0xFFFF then
+ local ch = back[bi]
+ t[i] = ch and utfchar(ch) or f_entity(bi)
+ end
+ end
+ s = concat(t)
+ return s
+end
+
+local function beautify(s)
+ local b = match(s,"^( *)<m:math")
+ local e = match(s,"( *)</m:math>%s*$")
+ if b and e then
+ b = #b
+ e = #e
+ if e > b then
+ s = undent(nspaces[e-b] .. s)
+ elseif e < b then
+ s = undent((gsub(s,"^( *)",nspaces[b-e])))
+ end
+ end
+ return s
+end
+
+local function getblob(n)
+ if all == nil then
+ local name = file.nameonly(tex.jobname)
+ local full = name .. "-export/" .. name .. "-raw.xml"
+ if lfs.isfile(full) then
+ all = { }
+ back = { }
+ local root = xml.load(full)
+ for c in xml.collected(root,"formulacontent") do
+ local index = tonumber(c.at.n)
+ local data = beautify(xmltext(c,"math") or "")
+ if index and data then
+ all[index] = f_blob(index,data)
+ else
+ report_tags("no formula content id")
+ end
+ end
+ local it = mathematics.alphabets.regular.it
+ for k, v in next, it.digits do back[v] = k end
+ for k, v in next, it.ucletters do back[v] = k end
+ for k, v in next, it.lcletters do back[v] = k end
+ else
+ all = false
+ end
+ end
+ if all == false then
+ return ""
+ end
+ return unmath(all[n] or "")
+end
+
+interfaces.implement {
+ name = "xmlformulatobuffer",
+ arguments = { "integer", "string" },
+ actions = function(n,target)
+ buffers.assign(target,getblob(n))
+ end
+}
diff --git a/tex/context/base/mkxl/math-inc.mkxl b/tex/context/base/mkxl/math-inc.mkxl
index 4db75e37e..e2a44217d 100644
--- a/tex/context/base/mkxl/math-inc.mkxl
+++ b/tex/context/base/mkxl/math-inc.mkxl
@@ -13,7 +13,7 @@
\writestatus{loading}{ConTeXt Math Macros / XML inclusion}
-\registerctxluafile{math-inc}{}
+\registerctxluafile{math-inc}{autosuffix}
%D I had some doubt about including this in \CONTEXT\ but it might serve some users
%D anyway. It's always the question to what extent one can be really roundtrip. I
diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl
index fd1cb2243..c3bbb9587 100644
--- a/tex/context/base/mkxl/math-ini.mkxl
+++ b/tex/context/base/mkxl/math-ini.mkxl
@@ -68,16 +68,16 @@
\registerctxluafile{math-ini}{autosuffix}
\registerctxluafile{math-dim}{autosuffix}
%registerctxluafile{math-act}{autosuffix}
-\registerctxluafile{math-ext}{}
+\registerctxluafile{math-ext}{autosuffix} % might go
\registerctxluafile{math-vfu}{autosuffix}
-\registerctxluafile{math-ttv}{}
+\registerctxluafile{math-ttv}{autosuffix}
\registerctxluafile{math-map}{autosuffix}
\registerctxluafile{math-act}{autosuffix}
-\registerctxluafile{math-ren}{}
+\registerctxluafile{math-ren}{autosuffix}
\registerctxluafile{math-noa}{autosuffix}
\registerctxluafile{math-tag}{autosuffix}
\registerctxluafile{math-fbk}{autosuffix}
-%registerctxluafile{math-dir}{}
+%registerctxluafile{math-dir}{autosuffix}
\registerctxluafile{math-spa}{autosuffix}
\registerctxluafile{math-fnt}{autosuffix}
\registerctxluafile{math-pre}{autosuffix}
@@ -2453,11 +2453,16 @@
\setnewconstant\c_math_collapsing_attribute\attributeunsetvalue
-\letcsname\??mathcollapsing 1\endcsname\plusone % specials
-\letcsname\??mathcollapsing 2\endcsname\plustwo % specials + mathlist
-\letcsname\??mathcollapsing 3\endcsname\plusthree % mathlist + specials
-\letcsname\??mathcollapsing\v!none \endcsname\attributeunsetvalue
-\letcsname\??mathcollapsing\v!reset\endcsname\attributeunsetvalue
+\letcsname\??mathcollapsing 0\endcsname\zerocount % enforced (primes)
+\letcsname\??mathcollapsing\s!tex \endcsname\zerocount
+\letcsname\??mathcollapsing 1\endcsname\plusone % enforced | specials
+\letcsname\??mathcollapsing\v!default\endcsname\plusone
+\letcsname\??mathcollapsing 2\endcsname\plustwo % enforced | specials | mathlist
+\letcsname\??mathcollapsing\v!all \endcsname\plustwo
+\letcsname\??mathcollapsing 3\endcsname\plusthree % enforced | mathlist | specials
+\letcsname\??mathcollapsing\v!list \endcsname\plusthree
+\letcsname\??mathcollapsing\v!none \endcsname\attributeunsetvalue
+\letcsname\??mathcollapsing\v!reset \endcsname\attributeunsetvalue
\def\math_collapsing_initialize
{\ifnum\c_math_collapsing_attribute=\attributeunsetvalue \else
diff --git a/tex/context/base/mkxl/math-noa.lmt b/tex/context/base/mkxl/math-noa.lmt
index a53810437..1ee5c26e3 100644
--- a/tex/context/base/mkxl/math-noa.lmt
+++ b/tex/context/base/mkxl/math-noa.lmt
@@ -840,7 +840,7 @@ do
local characters = fontcharacters[font]
if characters and characters[newchar] then
setchar(pointer,newchar)
- setattr(pointer,a_exportstatus,char)
+ setattr(pointer,a_exportstatus,char) -- yes or no
end
end
end
@@ -886,22 +886,28 @@ do
local chr, fnt, fam = getcharspec(delimiter)
if chr > 0 and fnt > 0 then
local data = fontdata[fnt]
- local char = mathematics.big(data,chr,size,method)
+local chardata = data.characters[chr]
+local template = chardata.varianttemplate
+ local char = mathematics.big(data,template or chr,size,method)
local ht = getheight(pointer)
local dp = getdepth(pointer)
- if ht == 1 or dp == 1 then -- 1 scaled point is a signal
+ if template or ht == 1 or dp == 1 then -- 1 scaled point is a signal
local chardata = data.characters[char]
- if ht == 1 then
+ if template or ht == 1 then
setheight(pointer,chardata.height)
end
- if dp == 1 then
+ if template or dp == 1 then
setdepth(pointer,chardata.depth)
end
end
if trace_fences then
report_fences("replacing %C by %C using method %a and size %a",chr,char,method,size)
end
+if template then
+ setoptions(pointer,0)
+else
setchar(delimiter,char)
+end
end
end
end
@@ -2103,30 +2109,34 @@ do
local reported = setmetatableindex("table")
+ mathlists[39] = { [39] = { [39] = { enforced = 0x2034, [39] = { enforced = 0x2057 } }, enforced = 0x2033 }, enforced = 0x2032 }
+ mathlists[96] = { [96] = { [96] = { enforced = 0x2037 }, enforced = 0x2036 }, enforced = 0x2035 }
+
collapse[mathchar_code] = function(pointer,what,n,parent)
if parent and mathlists[getchar(pointer)] then
local found, last, lucleus, lsup, lsub, category
local tree = mathlists
local current = parent
while current and validpair[getsubtype(current)] do
- local nucleus = getnucleus(current) -- == pointer
- local sub = getsub(current)
- local sup = getsup(current)
- local char = getchar(nucleus)
+ local nucleus, prime, sup, sub = getnucleus(current,true)
+ local char = getchar(nucleus)
if char then
local match = tree[char]
if match then
local method = getattr(current,a_mathcollapsing)
if method and method > 0 and method <= 3 then
+ local enforced = match.enforced
local specials = match.specials
local mathlist = match.mathlist
local ligature
- if method == 1 then
- ligature = specials
+ if method == 0 then
+ ligature = enforced
+ elseif method == 1 then
+ ligature = enforced or specials
elseif method == 2 then
- ligature = specials or mathlist
+ ligature = enforced or specials or mathlist
else -- 3
- ligature = mathlist or specials
+ ligature = enforced or mathlist or specials
end
if ligature then
category = mathlist and "mathlist" or "specials"
diff --git a/tex/context/base/mkxl/math-ren.lmt b/tex/context/base/mkxl/math-ren.lmt
new file mode 100644
index 000000000..cf429cb3a
--- /dev/null
+++ b/tex/context/base/mkxl/math-ren.lmt
@@ -0,0 +1,74 @@
+if not modules then modules = { } end modules ['math-ren'] = {
+ version = 1.001,
+ comment = "companion to math-ren.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local next = next
+local gsub = string.gsub
+
+local settings_to_array = utilities.parsers.settings_to_array
+local allocate = storage.allocate
+
+local renderings = { }
+mathematics.renderings = renderings
+
+local mappings = allocate()
+renderings.mappings = mappings
+
+local numbers = allocate()
+renderings.numbers = numbers
+
+local sets = allocate()
+renderings.sets = sets
+
+mappings["blackboard-to-bold"] = {
+ [0x1D538] = 0x1D400, [0x1D539] = 0x1D401, [0x02102] = 0x1D402, [0x1D53B] = 0x1D403, [0x1D53C] = 0x1D404,
+ [0x1D53D] = 0x1D405, [0x1D53E] = 0x1D406, [0x0210D] = 0x1D407, [0x1D540] = 0x1D408, [0x1D541] = 0x1D409,
+ [0x1D542] = 0x1D40A, [0x1D543] = 0x1D40B, [0x1D544] = 0x1D40C, [0x02115] = 0x1D40D, [0x1D546] = 0x1D40E,
+ [0x02119] = 0x1D40F, [0x0211A] = 0x1D410, [0x0211D] = 0x1D411, [0x1D54A] = 0x1D412, [0x1D54B] = 0x1D413,
+ [0x1D54C] = 0x1D414, [0x1D54D] = 0x1D415, [0x1D54E] = 0x1D416, [0x1D54F] = 0x1D417, [0x1D550] = 0x1D418,
+ [0x02124] = 0x1D419,
+}
+
+mappings["mikaels-favourites"] = {
+ [0x211D] = 0x1D411,
+ [0x211A] = 0x1D410,
+ [0x2124] = 0x1D419,
+ [0x2115] = 0x1D40D,
+}
+
+local function renderset(list) -- order matters
+ local tag = gsub(list," ","")
+ local n = sets[tag]
+ if not n then
+ local list = settings_to_array(tag)
+ local mapping = { }
+ for i=1,#list do
+ local m = mappings[list[i]]
+ if m then
+ for k, v in next, m do
+ mapping[k] = v
+ end
+ end
+ end
+ if next(mapping) then
+ n = #numbers + 1
+ numbers[n] = mapping
+ else
+ n = attributes.unsetvalue
+ end
+ sets[tag] = n
+ end
+ return n
+end
+
+mathematics.renderset = renderset
+
+interfaces.implement {
+ name = "mathrenderset",
+ actions = { renderset, context },
+ arguments = "string",
+}
diff --git a/tex/context/base/mkxl/math-stc.mklx b/tex/context/base/mkxl/math-stc.mklx
index e1c4fc90a..952fba6c6 100644
--- a/tex/context/base/mkxl/math-stc.mklx
+++ b/tex/context/base/mkxl/math-stc.mklx
@@ -94,14 +94,14 @@
\ifcsname\??mathextensiblefallbacks\number\scratchunicode\endcsname
\lastnamedcs
\else
- \Umathchar \fam \zerocount \scratchunicode
+ \Umathchar\zerocount\zerocount\scratchunicode
\fi
\hss}}
\def\math_stackers_regular
{\mathstylehbox{\usemathstackerscolorparameter\c!color
\hskip\d_math_stackers_offset_l
- \Umathaccent\fam\zerocount\scratchunicode
+ \Umathaccent\zerocount\zerocount\scratchunicode
{\hskip\dimexpr\scratchwidth-\d_math_stackers_offset_l-\d_math_stackers_offset_r}%
\hskip\d_math_stackers_offset_r
}}
@@ -109,7 +109,7 @@
\def\math_stackers_stretch % we don't have that one yet
{\mathstylehbox{\usemathstackerscolorparameter\c!color
\hskip\d_math_stackers_offset_l
- \Umathaccent\fam\zerocount\scratchunicode
+ \Umathaccent\zerocount\zerocount\scratchunicode
{\hskip\dimexpr\hsize-\d_math_stackers_offset_l-\d_math_stackers_offset_r}%
\hskip\d_math_stackers_offset_r
}}
diff --git a/tex/context/base/mkxl/math-ttv.lmt b/tex/context/base/mkxl/math-ttv.lmt
new file mode 100644
index 000000000..06e934dcd
--- /dev/null
+++ b/tex/context/base/mkxl/math-ttv.lmt
@@ -0,0 +1,813 @@
+if not modules then modules = { } end modules ['math-ttv'] = {
+ version = 1.001,
+ comment = "traditional tex vectors, companion to math-vfu.lua",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files",
+ dataonly = true,
+}
+
+local vfmath = fonts.handlers.vf.math
+local setletters = vfmath.setletters
+local setdigits = vfmath.setdigits
+
+local mathencodings = fonts.encodings.math
+
+-- varphi is part of the alphabet, contrary to the other var*s'
+
+mathencodings["large-to-small"] = {
+ [0x00028] = 0x00, -- (
+ [0x00029] = 0x01, -- )
+ [0x0005B] = 0x02, -- [
+ [0x0005D] = 0x03, -- ]
+ [0x0230A] = 0x04, -- lfloor
+ [0x0230B] = 0x05, -- rfloor
+ [0x02308] = 0x06, -- lceil
+ [0x02309] = 0x07, -- rceil
+ [0x0007B] = 0x08, -- {
+ [0x0007D] = 0x09, -- }
+ [0x027E8] = 0x0A, -- <
+ [0x027E9] = 0x0B, -- >
+ [0x0007C] = 0x0C, -- |
+ -- [0x0] = 0x0D, -- lVert rVert Vert
+ -- [0x0002F] = 0x0E, -- /
+ [0x0005C] = 0x0F, -- \
+ -- [0x0] = 0x3A, -- lgroup
+ -- [0x0] = 0x3B, -- rgroup
+ -- [0x0] = 0x3C, -- arrowvert
+ -- [0x0] = 0x3D, -- Arrowvert
+ [0x02195] = 0x3F, -- updownarrow
+ -- [0x0] = 0x40, -- lmoustache
+ -- [0x0] = 0x41, -- rmoustache
+ [0x0221A] = 0x70, -- sqrt
+ [0x021D5] = 0x77, -- Updownarrow
+ [0x02191] = 0x78, -- uparrow
+ [0x02193] = 0x79, -- downarrow
+ [0x021D1] = 0x7E, -- Uparrow
+ [0x021D3] = 0x7F, -- Downarrow
+ [0x0220F] = 0x59, -- prod
+ [0x02210] = 0x61, -- coprod
+ [0x02211] = 0x58, -- sum
+ [0x0222B] = 0x5A, -- intop
+ [0x0222E] = 0x49, -- ointop
+ [0x00302] = 0x62, -- widehat
+ [0x00303] = 0x65, -- widetilde
+ [0x022C0] = 0x5E, -- bigwedge
+ [0x022C1] = 0x5F, -- bigvee
+ [0x022C2] = 0x5C, -- bigcap
+ [0x022C3] = 0x5B, -- bigcup
+ [0x02044] = 0x0E, -- /
+}
+
+mathencodings["large-to-small-private"] = {
+ [0xFE07A] = 0x7A, -- bracehtipdownleft
+ [0xFE07B] = 0x7B, -- bracehtipdownright
+ [0xFE07C] = 0x7C, -- bracehtipupleft
+ [0xFE07D] = 0x7D, -- bracehtipupright
+
+}
+
+-- Beware: these are (in cm/lm) below the baseline due to limitations
+-- in the tfm format but the engine (combined with the mathclass) takes
+-- care of it. If we need them in textmode, we should make them virtual
+-- and move them up but we're in no hurry with that.
+
+mathencodings["tex-ex"] = {
+ [0x0220F] = 0x51, -- prod
+ [0x02210] = 0x60, -- coprod
+ [0x02211] = 0x50, -- sum
+ [0x0222B] = 0x52, -- intop
+ [0x0222E] = 0x48, -- ointop
+ [0x022C0] = 0x56, -- bigwedge
+ [0x022C1] = 0x57, -- bigvee
+ [0x022C2] = 0x54, -- bigcap
+ [0x022C3] = 0x53, -- bigcup
+ [0x02A00] = 0x4A, -- bigodot -- fixed BJ
+ [0x02A01] = 0x4C, -- bigoplus
+ [0x02A02] = 0x4E, -- bigotimes
+ -- [0x02A03] = , -- bigudot --
+ [0x02A04] = 0x55, -- biguplus
+ [0x02A06] = 0x46, -- bigsqcup
+}
+
+-- only math stuff is needed, since we always use an lm or gyre
+-- font as main font
+
+mathencodings["tex-mr"] = {
+ [0x00393] = 0x00, -- Gamma
+ [0x00394] = 0x01, -- Delta
+ [0x00398] = 0x02, -- Theta
+ [0x0039B] = 0x03, -- Lambda
+ [0x0039E] = 0x04, -- Xi
+ [0x003A0] = 0x05, -- Pi
+ [0x003A3] = 0x06, -- Sigma
+ [0x003A5] = 0x07, -- Upsilon
+ [0x003A6] = 0x08, -- Phi
+ [0x003A8] = 0x09, -- Psi
+ [0x003A9] = 0x0A, -- Omega
+-- [0x00060] = 0x12, -- [math]grave
+-- [0x000B4] = 0x13, -- [math]acute
+-- [0x002C7] = 0x14, -- [math]check
+-- [0x002D8] = 0x15, -- [math]breve
+-- [0x000AF] = 0x16, -- [math]bar
+-- [0x00021] = 0x21, -- !
+ [0x00028] = 0x28, -- (
+ [0x00029] = 0x29, -- )
+ [0x0002B] = 0x2B, -- +
+ [0x0002F] = 0x2F, -- /
+ [0x0003A] = 0x3A, -- :
+ [0x02236] = 0x3A, -- colon
+ [0x0003B] = 0x3B, -- ;
+ [0x0003C] = 0x3C, -- <
+ [0x0003D] = 0x3D, -- =
+ [0x0003E] = 0x3E, -- >
+ [0x0003F] = 0x3F, -- ?
+ [0x00391] = 0x41, -- Alpha
+ [0x00392] = 0x42, -- Beta
+ [0x02145] = 0x44,
+ [0x00395] = 0x45, -- Epsilon
+ [0x00397] = 0x48, -- Eta
+ [0x00399] = 0x49, -- Iota
+ [0x0039A] = 0x4B, -- Kappa
+ [0x0039C] = 0x4D, -- Mu
+ [0x0039D] = 0x4E, -- Nu
+ [0x0039F] = 0x4F, -- Omicron
+ [0x003A1] = 0x52, -- Rho
+ [0x003A4] = 0x54, -- Tau
+ [0x003A7] = 0x58, -- Chi
+ [0x00396] = 0x5A, -- Zeta
+ [0x0005B] = 0x5B, -- [
+ [0x0005D] = 0x5D, -- ]
+-- [0x0005E] = 0x5E, -- [math]hat -- the text one
+ [0x00302] = 0x5E, -- [math]hat -- the real math one
+-- [0x002D9] = 0x5F, -- [math]dot
+ [0x02146] = 0x64,
+ [0x02147] = 0x65,
+-- [0x002DC] = 0x7E, -- [math]tilde -- the text one
+ [0x00303] = 0x7E, -- [math]tilde -- the real one
+-- [0x000A8] = 0x7F, -- [math]ddot
+}
+
+mathencodings["tex-mr-missing"] = {
+ [0x02236] = 0x3A, -- colon
+}
+
+mathencodings["tex-mi"] = {
+ [0x1D6E4] = 0x00, -- Gamma
+ [0x1D6E5] = 0x01, -- Delta
+ [0x1D6E9] = 0x02, -- Theta
+ [0x1D6F3] = 0x02, -- varTheta (not present in TeX)
+ [0x1D6EC] = 0x03, -- Lambda
+ [0x1D6EF] = 0x04, -- Xi
+ [0x1D6F1] = 0x05, -- Pi
+ [0x1D6F4] = 0x06, -- Sigma
+ [0x1D6F6] = 0x07, -- Upsilon
+ [0x1D6F7] = 0x08, -- Phi
+ [0x1D6F9] = 0x09, -- Psi
+ [0x1D6FA] = 0x0A, -- Omega
+ [0x1D6FC] = 0x0B, -- alpha
+ [0x1D6FD] = 0x0C, -- beta
+ [0x1D6FE] = 0x0D, -- gamma
+ [0x1D6FF] = 0x0E, -- delta
+ [0x1D716] = 0x0F, -- epsilon TODO: 1D716
+ [0x1D701] = 0x10, -- zeta
+ [0x1D702] = 0x11, -- eta
+ [0x1D703] = 0x12, -- theta TODO: 1D703
+ [0x1D704] = 0x13, -- iota
+ [0x1D705] = 0x14, -- kappa
+ [0x1D718] = 0x14, -- varkappa, not in tex fonts
+ [0x1D706] = 0x15, -- lambda
+ [0x1D707] = 0x16, -- mu
+ [0x1D708] = 0x17, -- nu
+ [0x1D709] = 0x18, -- xi
+ [0x1D70B] = 0x19, -- pi
+ [0x1D70C] = 0x1A, -- rho
+ [0x1D70E] = 0x1B, -- sigma
+ [0x1D70F] = 0x1C, -- tau
+ [0x1D710] = 0x1D, -- upsilon
+ [0x1D719] = 0x1E, -- phi
+ [0x1D712] = 0x1F, -- chi
+ [0x1D713] = 0x20, -- psi
+ [0x1D714] = 0x21, -- omega
+ [0x1D700] = 0x22, -- varepsilon (the other way around)
+ [0x1D717] = 0x23, -- vartheta
+ [0x1D71B] = 0x24, -- varpi
+ [0x1D71A] = 0x25, -- varrho
+ [0x1D70D] = 0x26, -- varsigma
+ [0x1D711] = 0x27, -- varphi (the other way around)
+ [0x021BC] = 0x28, -- leftharpoonup
+ [0x021BD] = 0x29, -- leftharpoondown
+ [0x021C0] = 0x2A, -- rightharpoonup
+ [0x021C1] = 0x2B, -- rightharpoondown
+ [0xFE322] = 0x2C, -- lhook (hook for combining arrows)
+ [0xFE323] = 0x2D, -- rhook (hook for combining arrows)
+ [0x025B7] = 0x2E, -- triangleright : cf lmmath / BJ
+ [0x025C1] = 0x2F, -- triangleleft : cf lmmath / BJ
+ [0x022B3] = 0x2E, -- triangleright : cf lmmath this a cramped triangles / BJ / see *
+ [0x022B2] = 0x2F, -- triangleleft : cf lmmath this a cramped triangles / BJ / see *
+-- [0x00041] = 0x30, -- 0
+-- [0x00041] = 0x31, -- 1
+-- [0x00041] = 0x32, -- 2
+-- [0x00041] = 0x33, -- 3
+-- [0x00041] = 0x34, -- 4
+-- [0x00041] = 0x35, -- 5
+-- [0x00041] = 0x36, -- 6
+-- [0x00041] = 0x37, -- 7
+-- [0x00041] = 0x38, -- 8
+-- [0x00041] = 0x39, -- 9
+--~ [0x0002E] = 0x3A, -- .
+ [0x0002C] = 0x3B, -- ,
+ [0x0003C] = 0x3C, -- <
+-- [0x0002F] = 0x3D, -- /, slash, solidus
+ [0x02044] = 0x3D, -- / AM: Not sure
+ [0x0003E] = 0x3E, -- >
+ [0x022C6] = 0x3F, -- star
+ [0x02202] = 0x40, -- partial
+--
+ [0x0266D] = 0x5B, -- flat
+ [0x0266E] = 0x5C, -- natural
+ [0x0266F] = 0x5D, -- sharp
+ [0x02323] = 0x5E, -- smile
+ [0x02322] = 0x5F, -- frown
+ [0x02113] = 0x60, -- ell
+--
+ [0x1D6A4] = 0x7B, -- imath (TODO: also 0131)
+ [0x1D6A5] = 0x7C, -- jmath (TODO: also 0237)
+ [0x02118] = 0x7D, -- wp
+ [0x020D7] = 0x7E, -- vec (TODO: not sure)
+-- 0x7F, -- (no idea what that could be)
+}
+
+mathencodings["tex-it"] = {
+-- [0x1D434] = 0x41, -- A
+ [0x1D6E2] = 0x41, -- Alpha
+-- [0x1D435] = 0x42, -- B
+ [0x1D6E3] = 0x42, -- Beta
+-- [0x1D436] = 0x43, -- C
+-- [0x1D437] = 0x44, -- D
+-- [0x1D438] = 0x45, -- E
+ [0x1D6E6] = 0x45, -- Epsilon
+-- [0x1D439] = 0x46, -- F
+-- [0x1D43A] = 0x47, -- G
+-- [0x1D43B] = 0x48, -- H
+ [0x1D6E8] = 0x48, -- Eta
+-- [0x1D43C] = 0x49, -- I
+ [0x1D6EA] = 0x49, -- Iota
+-- [0x1D43D] = 0x4A, -- J
+-- [0x1D43E] = 0x4B, -- K
+ [0x1D6EB] = 0x4B, -- Kappa
+-- [0x1D43F] = 0x4C, -- L
+-- [0x1D440] = 0x4D, -- M
+ [0x1D6ED] = 0x4D, -- Mu
+-- [0x1D441] = 0x4E, -- N
+ [0x1D6EE] = 0x4E, -- Nu
+-- [0x1D442] = 0x4F, -- O
+ [0x1D6F0] = 0x4F, -- Omicron
+-- [0x1D443] = 0x50, -- P
+ [0x1D6F2] = 0x50, -- Rho
+-- [0x1D444] = 0x51, -- Q
+-- [0x1D445] = 0x52, -- R
+-- [0x1D446] = 0x53, -- S
+-- [0x1D447] = 0x54, -- T
+ [0x1D6F5] = 0x54, -- Tau
+-- [0x1D448] = 0x55, -- U
+-- [0x1D449] = 0x56, -- V
+-- [0x1D44A] = 0x57, -- W
+-- [0x1D44B] = 0x58, -- X
+ [0x1D6F8] = 0x58, -- Chi
+-- [0x1D44C] = 0x59, -- Y
+-- [0x1D44D] = 0x5A, -- Z
+--
+-- [0x1D44E] = 0x61, -- a
+-- [0x1D44F] = 0x62, -- b
+-- [0x1D450] = 0x63, -- c
+-- [0x1D451] = 0x64, -- d
+-- [0x1D452] = 0x65, -- e
+-- [0x1D453] = 0x66, -- f
+-- [0x1D454] = 0x67, -- g
+-- [0x1D455] = 0x68, -- h
+ [0x0210E] = 0x68, -- Planck constant (h)
+-- [0x1D456] = 0x69, -- i
+-- [0x1D457] = 0x6A, -- j
+-- [0x1D458] = 0x6B, -- k
+-- [0x1D459] = 0x6C, -- l
+-- [0x1D45A] = 0x6D, -- m
+-- [0x1D45B] = 0x6E, -- n
+-- [0x1D45C] = 0x6F, -- o
+ [0x1D70A] = 0x6F, -- omicron
+-- [0x1D45D] = 0x70, -- p
+-- [0x1D45E] = 0x71, -- q
+-- [0x1D45F] = 0x72, -- r
+-- [0x1D460] = 0x73, -- s
+-- [0x1D461] = 0x74, -- t
+-- [0x1D462] = 0x75, -- u
+-- [0x1D463] = 0x76, -- v
+-- [0x1D464] = 0x77, -- w
+-- [0x1D465] = 0x78, -- x
+-- [0x1D466] = 0x79, -- y
+-- [0x1D467] = 0x7A, -- z
+}
+
+mathencodings["tex-tf"] = { }
+mathencodings["tex-ss"] = { }
+mathencodings["tex-tt"] = { }
+mathencodings["tex-bf"] = { }
+mathencodings["tex-bi"] = { }
+mathencodings["tex-fraktur"] = { }
+mathencodings["tex-fraktur-bold"] = { }
+
+mathencodings["tex-sy"] = {
+ [0x0002D] = 0x00, -- -
+ [0x02212] = 0x00, -- -
+-- [0x02201] = 0x00, -- complement
+-- [0x02206] = 0x00, -- increment
+-- [0x02204] = 0x00, -- not exists
+-- [0x000B7] = 0x01, -- cdot
+ [0x022C5] = 0x01, -- cdot
+ [0x000D7] = 0x02, -- times
+ [0x0002A] = 0x03, -- *
+ [0x02217] = 0x03, -- *
+ [0x000F7] = 0x04, -- div
+ [0x022C4] = 0x05, -- diamond
+ [0x000B1] = 0x06, -- pm
+ [0x02213] = 0x07, -- mp
+ [0x02295] = 0x08, -- oplus
+ [0x02296] = 0x09, -- ominus
+ [0x02297] = 0x0A, -- otimes
+ [0x02298] = 0x0B, -- oslash
+ [0x02299] = 0x0C, -- odot
+ [0x025EF] = 0x0D, -- bigcirc, Orb (either 25EF or 25CB) -- todo
+ [0x02218] = 0x0E, -- circ
+ [0x02219] = 0x0F, -- bullet
+ [0x02022] = 0x0F, -- bullet
+ [0x0224D] = 0x10, -- asymp
+ [0x02261] = 0x11, -- equiv
+ [0x02286] = 0x12, -- subseteq
+ [0x02287] = 0x13, -- supseteq
+ [0x02264] = 0x14, -- leq
+ [0x02265] = 0x15, -- geq
+ [0x02AAF] = 0x16, -- preceq
+-- [0x0227C] = 0x16, -- preceq, AM:No see 2AAF
+ [0x02AB0] = 0x17, -- succeq
+-- [0x0227D] = 0x17, -- succeq, AM:No see 2AB0
+ [0x0223C] = 0x18, -- sim
+ [0x02248] = 0x19, -- approx
+ [0x02282] = 0x1A, -- subset
+ [0x02283] = 0x1B, -- supset
+ [0x0226A] = 0x1C, -- ll
+ [0x0226B] = 0x1D, -- gg
+ [0x0227A] = 0x1E, -- prec
+ [0x0227B] = 0x1F, -- succ
+ [0x02190] = 0x20, -- leftarrow
+ [0x02192] = 0x21, -- rightarrow
+--~ [0xFE190] = 0x20, -- leftarrow
+--~ [0xFE192] = 0x21, -- rightarrow
+ [0x02191] = 0x22, -- uparrow
+ [0x02193] = 0x23, -- downarrow
+ [0x02194] = 0x24, -- leftrightarrow
+ [0x02197] = 0x25, -- nearrow
+ [0x02198] = 0x26, -- searrow
+ [0x02243] = 0x27, -- simeq
+ [0x021D0] = 0x28, -- Leftarrow
+ [0x021D2] = 0x29, -- Rightarrow
+ [0x021D1] = 0x2A, -- Uparrow
+ [0x021D3] = 0x2B, -- Downarrow
+ [0x021D4] = 0x2C, -- Leftrightarrow
+ [0x02196] = 0x2D, -- nwarrow
+ [0x02199] = 0x2E, -- swarrow
+ [0x0221D] = 0x2F, -- propto
+ [0x02032] = 0x30, -- prime
+ [0x0221E] = 0x31, -- infty
+ [0x02208] = 0x32, -- in
+ [0x0220B] = 0x33, -- ni
+ [0x025B3] = 0x34, -- triangle, bigtriangleup
+ [0x025BD] = 0x35, -- bigtriangledown
+ [0x00338] = 0x36, -- not
+-- 0x37, -- (beginning of arrow)
+ [0x02200] = 0x38, -- forall
+ [0x02203] = 0x39, -- exists
+ [0x000AC] = 0x3A, -- neg, lnot
+ [0x02205] = 0x3B, -- empty set
+ [0x0211C] = 0x3C, -- Re
+ [0x02111] = 0x3D, -- Im
+ [0x022A4] = 0x3E, -- top
+ [0x022A5] = 0x3F, -- bot, perp
+ [0x02135] = 0x40, -- aleph
+ [0x1D49C] = 0x41, -- script A
+ [0x0212C] = 0x42, -- script B
+ [0x1D49E] = 0x43, -- script C
+ [0x1D49F] = 0x44, -- script D
+ [0x02130] = 0x45, -- script E
+ [0x02131] = 0x46, -- script F
+ [0x1D4A2] = 0x47, -- script G
+ [0x0210B] = 0x48, -- script H
+ [0x02110] = 0x49, -- script I
+ [0x1D4A5] = 0x4A, -- script J
+ [0x1D4A6] = 0x4B, -- script K
+ [0x02112] = 0x4C, -- script L
+ [0x02133] = 0x4D, -- script M
+ [0x1D4A9] = 0x4E, -- script N
+ [0x1D4AA] = 0x4F, -- script O
+ [0x1D4AB] = 0x50, -- script P
+ [0x1D4AC] = 0x51, -- script Q
+ [0x0211B] = 0x52, -- script R
+ [0x1D4AE] = 0x53, -- script S
+ [0x1D4AF] = 0x54, -- script T
+ [0x1D4B0] = 0x55, -- script U
+ [0x1D4B1] = 0x56, -- script V
+ [0x1D4B2] = 0x57, -- script W
+ [0x1D4B3] = 0x58, -- script X
+ [0x1D4B4] = 0x59, -- script Y
+ [0x1D4B5] = 0x5A, -- script Z
+ [0x0222A] = 0x5B, -- cup
+ [0x02229] = 0x5C, -- cap
+ [0x0228E] = 0x5D, -- uplus
+ [0x02227] = 0x5E, -- wedge, land
+ [0x02228] = 0x5F, -- vee, lor
+ [0x022A2] = 0x60, -- vdash
+ [0x022A3] = 0x61, -- dashv
+ [0x0230A] = 0x62, -- lfloor
+ [0x0230B] = 0x63, -- rfloor
+ [0x02308] = 0x64, -- lceil
+ [0x02309] = 0x65, -- rceil
+ [0x0007B] = 0x66, -- {, lbrace
+ [0x0007D] = 0x67, -- }, rbrace
+ [0x027E8] = 0x68, -- <, langle
+ [0x027E9] = 0x69, -- >, rangle
+ [0x0007C] = 0x6A, -- |, mid, lvert, rvert
+ [0x02225] = 0x6B, -- parallel
+ -- [0x0 ] = 0x00, -- Vert, lVert, rVert, arrowvert, Arrowvert
+ [0x02195] = 0x6C, -- updownarrow
+ [0x021D5] = 0x6D, -- Updownarrow
+ [0x0005C] = 0x6E, -- \, backslash, setminus
+ [0x02216] = 0x6E, -- setminus
+ [0x02240] = 0x6F, -- wr
+ [0x0221A] = 0x70, -- sqrt. AM: Check surd??
+ [0x02A3F] = 0x71, -- amalg
+ [0x1D6FB] = 0x72, -- nabla
+-- [0x0222B] = 0x73, -- smallint (TODO: what about intop?)
+ [0x02294] = 0x74, -- sqcup
+ [0x02293] = 0x75, -- sqcap
+ [0x02291] = 0x76, -- sqsubseteq
+ [0x02292] = 0x77, -- sqsupseteq
+ [0x000A7] = 0x78, -- S
+ [0x02020] = 0x79, -- dagger, dag
+ [0x02021] = 0x7A, -- ddagger, ddag
+ [0x000B6] = 0x7B, -- P
+ [0x02663] = 0x7C, -- clubsuit
+ [0x02662] = 0x7D, -- diamondsuit
+ [0x02661] = 0x7E, -- heartsuit
+ [0x02660] = 0x7F, -- spadesuit
+ [0xFE321] = 0x37, -- mapstochar
+
+ [0xFE325] = 0x30, -- prime 0x02032
+}
+
+-- The names in masm10.enc can be trusted best and are shown in the first
+-- column, while in the second column we show the tex/ams names. As usual
+-- it costs hours to figure out such a table.
+
+mathencodings["tex-ma"] = {
+ [0x022A1] = 0x00, -- squaredot \boxdot
+ [0x0229E] = 0x01, -- squareplus \boxplus
+ [0x022A0] = 0x02, -- squaremultiply \boxtimes
+ [0x025A1] = 0x03, -- square \square \Box
+ [0x025A0] = 0x04, -- squaresolid \blacksquare
+ [0x025AA] = 0x05, -- squaresmallsolid \centerdot
+ [0x022C4] = 0x06, -- diamond \Diamond \lozenge
+ [0x02666] = 0x07, -- diamondsolid \blacklozenge
+ [0x021BB] = 0x08, -- clockwise \circlearrowright
+ [0x021BA] = 0x09, -- anticlockwise \circlearrowleft
+ [0x021CC] = 0x0A, -- harpoonleftright \rightleftharpoons
+ [0x021CB] = 0x0B, -- harpoonrightleft \leftrightharpoons
+ [0x0229F] = 0x0C, -- squareminus \boxminus
+ [0x022A9] = 0x0D, -- forces \Vdash
+ [0x022AA] = 0x0E, -- forcesbar \Vvdash
+ [0x022A8] = 0x0F, -- satisfies \vDash
+ [0x021A0] = 0x10, -- dblarrowheadright \twoheadrightarrow
+ [0x0219E] = 0x11, -- dblarrowheadleft \twoheadleftarrow
+ [0x021C7] = 0x12, -- dblarrowleft \leftleftarrows
+ [0x021C9] = 0x13, -- dblarrowright \rightrightarrows
+ [0x021C8] = 0x14, -- dblarrowup \upuparrows
+ [0x021CA] = 0x15, -- dblarrowdwn \downdownarrows
+ [0x021BE] = 0x16, -- harpoonupright \upharpoonright \restriction
+ [0x021C2] = 0x17, -- harpoondownright \downharpoonright
+ [0x021BF] = 0x18, -- harpoonupleft \upharpoonleft
+ [0x021C3] = 0x19, -- harpoondownleft \downharpoonleft
+ [0x021A3] = 0x1A, -- arrowtailright \rightarrowtail
+ [0x021A2] = 0x1B, -- arrowtailleft \leftarrowtail
+ [0x021C6] = 0x1C, -- arrowparrleftright \leftrightarrows
+-- [0x021C5] = 0x00, -- \updownarrows (missing in lm)
+ [0x021C4] = 0x1D, -- arrowparrrightleft \rightleftarrows
+ [0x021B0] = 0x1E, -- shiftleft \Lsh
+ [0x021B1] = 0x1F, -- shiftright \Rsh
+ [0x021DD] = 0x20, -- squiggleright \leadsto \rightsquigarrow
+ [0x021AD] = 0x21, -- squiggleleftright \leftrightsquigarrow
+ [0x021AB] = 0x22, -- curlyleft \looparrowleft
+ [0x021AC] = 0x23, -- curlyright \looparrowright
+ [0x02257] = 0x24, -- circleequal \circeq
+ [0x0227F] = 0x25, -- followsorequal \succsim
+ [0x02273] = 0x26, -- greaterorsimilar \gtrsim
+ [0x02A86] = 0x27, -- greaterorapproxeql \gtrapprox
+ [0x022B8] = 0x28, -- multimap \multimap
+ [0x02234] = 0x29, -- therefore \therefore
+ [0x02235] = 0x2A, -- because \because
+ [0x02251] = 0x2B, -- equalsdots \Doteq \doteqdot
+ [0x0225C] = 0x2C, -- defines \triangleq
+ [0x0227E] = 0x2D, -- precedesorequal \precsim
+ [0x02272] = 0x2E, -- lessorsimilar \lesssim
+ [0x02A85] = 0x2F, -- lessorapproxeql \lessapprox
+ [0x02A95] = 0x30, -- equalorless \eqslantless
+ [0x02A96] = 0x31, -- equalorgreater \eqslantgtr
+ [0x022DE] = 0x32, -- equalorprecedes \curlyeqprec
+ [0x022DF] = 0x33, -- equalorfollows \curlyeqsucc
+ [0x0227C] = 0x34, -- precedesorcurly \preccurlyeq
+ [0x02266] = 0x35, -- lessdblequal \leqq
+ [0x02A7D] = 0x36, -- lessorequalslant \leqslant
+ [0x02276] = 0x37, -- lessorgreater \lessgtr
+ [0x02035] = 0x38, -- primereverse \backprime
+ -- [0x0] = 0x39, -- axisshort \dabar
+ [0x02253] = 0x3A, -- equaldotrightleft \risingdotseq
+ [0x02252] = 0x3B, -- equaldotleftright \fallingdotseq
+ [0x0227D] = 0x3C, -- followsorcurly \succcurlyeq
+ [0x02267] = 0x3D, -- greaterdblequal \geqq
+ [0x02A7E] = 0x3E, -- greaterorequalslant \geqslant
+ [0x02277] = 0x3F, -- greaterorless \gtrless
+ [0x0228F] = 0x40, -- squareimage \sqsubset
+ [0x02290] = 0x41, -- squareoriginal \sqsupset
+ -- wrong: see **
+ -- [0x022B3] = 0x42, -- triangleright \rhd \vartriangleright
+ -- [0x022B2] = 0x43, -- triangleleft \lhd \vartriangleleft
+ -- cf lm
+ [0x022B5] = 0x44, -- trianglerightequal \unrhd \trianglerighteq
+ [0x022B4] = 0x45, -- triangleleftequal \unlhd \trianglelefteq
+ --
+ [0x02605] = 0x46, -- star \bigstar
+ [0x0226C] = 0x47, -- between \between
+ [0x025BC] = 0x48, -- triangledownsld \blacktriangledown
+ [0x025B6] = 0x49, -- trianglerightsld \blacktriangleright
+ [0x025C0] = 0x4A, -- triangleleftsld \blacktriangleleft
+ -- [0x0] = 0x4B, -- arrowaxisright
+ -- [0x0] = 0x4C, -- arrowaxisleft
+ [0x025B2] = 0x4D, -- triangle \triangleup \vartriangle
+ [0x025B2] = 0x4E, -- trianglesolid \blacktriangle
+ [0x025BD] = 0x4F, -- triangleinv \triangledown
+ [0x02256] = 0x50, -- ringinequal \eqcirc
+ [0x022DA] = 0x51, -- lessequalgreater \lesseqgtr
+ [0x022DB] = 0x52, -- greaterlessequal \gtreqless
+ [0x02A8B] = 0x53, -- lessdbleqlgreater \lesseqqgtr
+ [0x02A8C] = 0x54, -- greaterdbleqlless \gtreqqless
+ [0x000A5] = 0x55, -- Yen \yen
+ [0x021DB] = 0x56, -- arrowtripleright \Rrightarrow
+ [0x021DA] = 0x57, -- arrowtripleleft \Lleftarrow
+ [0x02713] = 0x58, -- check \checkmark
+ [0x022BB] = 0x59, -- orunderscore \veebar
+ [0x022BC] = 0x5A, -- nand \barwedge
+ [0x02306] = 0x5B, -- perpcorrespond \doublebarwedge
+ [0x02220] = 0x5C, -- angle \angle
+ [0x02221] = 0x5D, -- measuredangle \measuredangle
+ [0x02222] = 0x5E, -- sphericalangle \sphericalangle
+ -- [0x0] = 0x5F, -- proportional \varpropto
+ -- [0x0] = 0x60, -- smile \smallsmile
+ -- [0x0] = 0x61, -- frown \smallfrown
+ [0x022D0] = 0x62, -- subsetdbl \Subset
+ [0x022D1] = 0x63, -- supersetdbl \Supset
+ [0x022D3] = 0x64, -- uniondbl \doublecup \Cup
+ [0x022D2] = 0x65, -- intersectiondbl \doublecap \Cap
+ [0x022CF] = 0x66, -- uprise \curlywedge
+ [0x022CE] = 0x67, -- downfall \curlyvee
+ [0x022CB] = 0x68, -- multiopenleft \leftthreetimes
+ [0x022CC] = 0x69, -- multiopenright \rightthreetimes
+ [0x02AC5] = 0x6A, -- subsetdblequal \subseteqq
+ [0x02AC6] = 0x6B, -- supersetdblequal \supseteqq
+ [0x0224F] = 0x6C, -- difference \bumpeq
+ [0x0224E] = 0x6D, -- geomequivalent \Bumpeq
+ [0x022D8] = 0x6E, -- muchless \lll \llless
+ [0x022D9] = 0x6F, -- muchgreater \ggg \gggtr
+ [0x0231C] = 0x70, -- rightanglenw \ulcorner
+ [0x0231D] = 0x71, -- rightanglene \urcorner
+ [0x024C7] = 0x72, -- circleR \circledR
+ [0x024C8] = 0x73, -- circleS \circledS
+ [0x022D4] = 0x74, -- fork \pitchfork
+ [0x02214] = 0x75, -- dotplus \dotplus
+ [0x0223D] = 0x76, -- revsimilar \backsim
+ [0x022CD] = 0x77, -- revasymptequal \backsimeq -- AM: Check this! I mapped it to simeq.
+ [0x0231E] = 0x78, -- rightanglesw \llcorner
+ [0x0231F] = 0x79, -- rightanglese \lrcorner
+ [0x02720] = 0x7A, -- maltesecross \maltese
+ [0x02201] = 0x7B, -- complement \complement
+ [0x022BA] = 0x7C, -- intercal \intercal
+ [0x0229A] = 0x7D, -- circlering \circledcirc
+ [0x0229B] = 0x7E, -- circleasterisk \circledast
+ [0x0229D] = 0x7F, -- circleminus \circleddash
+}
+
+mathencodings["tex-mb"] = {
+ -- [0x0] = 0x00, -- lessornotequal \lvertneqq
+ -- [0x0] = 0x01, -- greaterornotequal \gvertneqq
+ [0x02270] = 0x02, -- notlessequal \nleq
+ [0x02271] = 0x03, -- notgreaterequal \ngeq
+ [0x0226E] = 0x04, -- notless \nless
+ [0x0226F] = 0x05, -- notgreater \ngtr
+ [0x02280] = 0x06, -- notprecedes \nprec
+ [0x02281] = 0x07, -- notfollows \nsucc
+ [0x02268] = 0x08, -- lessornotdbleql \lneqq
+ [0x02269] = 0x09, -- greaterornotdbleql \gneqq
+ -- [0x0] = 0x0A, -- notlessorslnteql \nleqslant
+ -- [0x0] = 0x0B, -- notgreaterorslnteql \ngeqslant
+ [0x02A87] = 0x0C, -- lessnotequal \lneq
+ [0x02A88] = 0x0D, -- greaternotequal \gneq
+ -- [0x0] = 0x0E, -- notprecedesoreql \npreceq
+ -- [0x0] = 0x0F, -- notfollowsoreql \nsucceq
+ [0x022E8] = 0x10, -- precedeornoteqvlnt \precnsim
+ [0x022E9] = 0x11, -- followornoteqvlnt \succnsim
+ [0x022E6] = 0x12, -- lessornotsimilar \lnsim
+ [0x022E7] = 0x13, -- greaterornotsimilar \gnsim
+ -- [0x0] = 0x14, -- notlessdblequal \nleqq
+ -- [0x0] = 0x15, -- notgreaterdblequal \ngeqq
+ [0x02AB5] = 0x16, -- precedenotslnteql \precneqq
+ [0x02AB6] = 0x17, -- follownotslnteql \succneqq
+ [0x02AB9] = 0x18, -- precedenotdbleqv \precnapprox
+ [0x02ABA] = 0x19, -- follownotdbleqv \succnapprox
+ [0x02A89] = 0x1A, -- lessnotdblequal \lnapprox
+ [0x02A8A] = 0x1B, -- greaternotdblequal \gnapprox
+ [0x02241] = 0x1C, -- notsimilar \nsim
+ [0x02247] = 0x1D, -- notapproxequal \ncong
+ -- [0x0] = 0x1E, -- upslope \diagup
+ -- [0x0] = 0x1F, -- downslope \diagdown
+ -- [0x0] = 0x20, -- notsubsetoreql \varsubsetneq
+ -- [0x0] = 0x21, -- notsupersetoreql \varsupsetneq
+ -- [0x0] = 0x22, -- notsubsetordbleql \nsubseteqq
+ -- [0x0] = 0x23, -- notsupersetordbleql \nsupseteqq
+ [0x02ACB] = 0x24, -- subsetornotdbleql \subsetneqq
+ [0x02ACC] = 0x25, -- supersetornotdbleql \supsetneqq
+ -- [0x0] = 0x26, -- subsetornoteql \varsubsetneqq
+ -- [0x0] = 0x27, -- supersetornoteql \varsupsetneqq
+ [0x0228A] = 0x28, -- subsetnoteql \subsetneq
+ [0x0228B] = 0x29, -- supersetnoteql \supsetneq
+ [0x02288] = 0x2A, -- notsubseteql \nsubseteq
+ [0x02289] = 0x2B, -- notsuperseteql \nsupseteq
+ [0x02226] = 0x2C, -- notparallel \nparallel
+ [0x02224] = 0x2D, -- notbar \nmid \ndivides
+ -- [0x0] = 0x2E, -- notshortbar \nshortmid
+ -- [0x0] = 0x2F, -- notshortparallel \nshortparallel
+ [0x022AC] = 0x30, -- notturnstile \nvdash
+ [0x022AE] = 0x31, -- notforces \nVdash
+ [0x022AD] = 0x32, -- notsatisfies \nvDash
+ [0x022AF] = 0x33, -- notforcesextra \nVDash
+ [0x022ED] = 0x34, -- nottriangeqlright \ntrianglerighteq
+ [0x022EC] = 0x35, -- nottriangeqlleft \ntrianglelefteq
+ [0x022EA] = 0x36, -- nottriangleleft \ntriangleleft
+ [0x022EB] = 0x37, -- nottriangleright \ntriangleright
+ [0x0219A] = 0x38, -- notarrowleft \nleftarrow
+ [0x0219B] = 0x39, -- notarrowright \nrightarrow
+ [0x021CD] = 0x3A, -- notdblarrowleft \nLeftarrow
+ [0x021CF] = 0x3B, -- notdblarrowright \nRightarrow
+ [0x021CE] = 0x3C, -- notdblarrowboth \nLeftrightarrow
+ [0x021AE] = 0x3D, -- notarrowboth \nleftrightarrow
+ [0x022C7] = 0x3E, -- dividemultiply \divideontimes
+ [0x02300] = 0x3F, -- diametersign \varnothing
+ [0x02204] = 0x40, -- notexistential \nexists
+ [0x1D538] = 0x41, -- A (blackboard A)
+ [0x1D539] = 0x42, -- B
+ [0x02102] = 0x43, -- C
+ [0x1D53B] = 0x44, -- D
+ [0x1D53C] = 0x45, -- E
+ [0x1D53D] = 0x46, -- F
+ [0x1D53E] = 0x47, -- G
+ [0x0210D] = 0x48, -- H
+ [0x1D540] = 0x49, -- I
+ [0x1D541] = 0x4A, -- J
+ [0x1D542] = 0x4B, -- K
+ [0x1D543] = 0x4C, -- L
+ [0x1D544] = 0x4D, -- M
+ [0x02115] = 0x4E, -- N
+ [0x1D546] = 0x4F, -- O
+ [0x02119] = 0x50, -- P
+ [0x0211A] = 0x51, -- Q
+ [0x0211D] = 0x52, -- R
+ [0x1D54A] = 0x53, -- S
+ [0x1D54B] = 0x54, -- T
+ [0x1D54C] = 0x55, -- U
+ [0x1D54D] = 0x56, -- V
+ [0x1D54E] = 0x57, -- W
+ [0x1D54F] = 0x58, -- X
+ [0x1D550] = 0x59, -- Y
+ [0x02124] = 0x5A, -- Z (blackboard Z)
+ [0x02132] = 0x60, -- finv \Finv
+ [0x02141] = 0x61, -- fmir \Game
+ -- [0x0] = 0x62, tildewide
+ -- [0x0] = 0x63, tildewider
+ -- [0x0] = 0x64, Finv
+ -- [0x0] = 0x65, Gmir
+ [0x02127] = 0x66, -- Omegainv \mho
+ [0x000F0] = 0x67, -- eth \eth
+ [0x02242] = 0x68, -- equalorsimilar \eqsim
+ [0x02136] = 0x69, -- beth \beth
+ [0x02137] = 0x6A, -- gimel \gimel
+ [0x02138] = 0x6B, -- daleth \daleth
+ [0x022D6] = 0x6C, -- lessdot \lessdot
+ [0x022D7] = 0x6D, -- greaterdot \gtrdot
+ [0x022C9] = 0x6E, -- multicloseleft \ltimes
+ [0x022CA] = 0x6F, -- multicloseright \rtimes
+ -- [0x0] = 0x70, -- barshort \shortmid
+ -- [0x0] = 0x71, -- parallelshort \shortparallel
+ -- [0x02216] = 0x72, -- integerdivide \smallsetminus (2216 already part of tex-sy
+ -- [0x0] = 0x73, -- similar \thicksim
+ -- [0x0] = 0x74, -- approxequal \thickapprox
+ [0x0224A] = 0x75, -- approxorequal \approxeq
+ [0x02AB8] = 0x76, -- followsorequal \succapprox
+ [0x02AB7] = 0x77, -- precedesorequal \precapprox
+ [0x021B6] = 0x78, -- archleftdown \curvearrowleft
+ [0x021B7] = 0x79, -- archrightdown \curvearrowright
+ [0x003DC] = 0x7A, -- Digamma \digamma
+ [0x003F0] = 0x7B, -- kappa \varkappa
+ [0x1D55C] = 0x7C, -- k \Bbbk (blackboard k)
+ [0x0210F] = 0x7D, -- planckover2pi \hslash % 0x7D
+ [0x00127] = 0x7E, -- planckover2pi1 \hbar % 0x7E
+ [0x003F6] = 0x7F, -- epsiloninv \backepsilon
+}
+
+mathencodings["tex-mc"] = {
+ -- this file has no tfm so it gets mapped in the private space
+ [0xFE324] = "mapsfromchar",
+}
+
+mathencodings["tex-fraktur"] = {
+-- [0x1D504] = 0x41, -- A (fraktur A)
+-- [0x1D505] = 0x42, -- B
+ [0x0212D] = 0x43, -- C
+-- [0x1D507] = 0x44, -- D
+-- [0x1D508] = 0x45, -- E
+-- [0x1D509] = 0x46, -- F
+-- [0x1D50A] = 0x47, -- G
+ [0x0210C] = 0x48, -- H
+ [0x02111] = 0x49, -- I
+-- [0x1D50D] = 0x4A, -- J
+-- [0x1D50E] = 0x4B, -- K
+-- [0x1D50F] = 0x4C, -- L
+-- [0x1D510] = 0x4D, -- M
+-- [0x1D511] = 0x4E, -- N
+-- [0x1D512] = 0x4F, -- O
+-- [0x1D513] = 0x50, -- P
+-- [0x1D514] = 0x51, -- Q
+ [0x0211C] = 0x52, -- R
+-- [0x1D516] = 0x53, -- S
+-- [0x1D517] = 0x54, -- T
+-- [0x1D518] = 0x55, -- U
+-- [0x1D519] = 0x56, -- V
+-- [0x1D51A] = 0x57, -- W
+-- [0x1D51B] = 0x58, -- X
+-- [0x1D51C] = 0x59, -- Y
+ [0x02128] = 0x5A, -- Z (fraktur Z)
+-- [0x1D51E] = 0x61, -- a (fraktur a)
+-- [0x1D51F] = 0x62, -- b
+-- [0x1D520] = 0x63, -- c
+-- [0x1D521] = 0x64, -- d
+-- [0x1D522] = 0x65, -- e
+-- [0x1D523] = 0x66, -- f
+-- [0x1D524] = 0x67, -- g
+-- [0x1D525] = 0x68, -- h
+-- [0x1D526] = 0x69, -- i
+-- [0x1D527] = 0x6A, -- j
+-- [0x1D528] = 0x6B, -- k
+-- [0x1D529] = 0x6C, -- l
+-- [0x1D52A] = 0x6D, -- m
+-- [0x1D52B] = 0x6E, -- n
+-- [0x1D52C] = 0x6F, -- o
+-- [0x1D52D] = 0x70, -- p
+-- [0x1D52E] = 0x71, -- q
+-- [0x1D52F] = 0x72, -- r
+-- [0x1D530] = 0x73, -- s
+-- [0x1D531] = 0x74, -- t
+-- [0x1D532] = 0x75, -- u
+-- [0x1D533] = 0x76, -- v
+-- [0x1D534] = 0x77, -- w
+-- [0x1D535] = 0x78, -- x
+-- [0x1D536] = 0x79, -- y
+-- [0x1D537] = 0x7A, -- z
+}
+
+-- now that all other vectors are defined ...
+
+setletters(mathencodings, "tex-tf", 0x00041, 0x00061)
+setletters(mathencodings, "tex-mr", 0x00041, 0x00061)
+
+setletters(mathencodings, "tex-it", 0x1D434, 0x1D44E)
+setletters(mathencodings, "tex-ss", 0x1D5A0, 0x1D5BA)
+setletters(mathencodings, "tex-tt", 0x1D670, 0x1D68A)
+setletters(mathencodings, "tex-bf", 0x1D400, 0x1D41A)
+setletters(mathencodings, "tex-bi", 0x1D468, 0x1D482)
+setletters(mathencodings, "tex-fraktur", 0x1D504, 0x1D51E)
+setletters(mathencodings, "tex-fraktur-bold", 0x1D56C, 0x1D586)
+
+setdigits (mathencodings, "tex-mr", 0x00030)
+setdigits (mathencodings, "tex-tf", 0x00030)
+setdigits (mathencodings, "tex-ss", 0x1D7E2)
+setdigits (mathencodings, "tex-tt", 0x1D7F6)
+setdigits (mathencodings, "tex-bf", 0x1D7CE)
+
+-- setdigits (mathencodings, "tex-bi", 0x1D7CE)
+
+-- todo: add ss, tt, bf etc vectors
+-- todo: we can make ss tt etc an option
diff --git a/tex/context/base/mkxl/math-vfu.lmt b/tex/context/base/mkxl/math-vfu.lmt
index c1d45551b..1046a0c19 100644
--- a/tex/context/base/mkxl/math-vfu.lmt
+++ b/tex/context/base/mkxl/math-vfu.lmt
@@ -10,17 +10,18 @@ if not modules then modules = { } end modules ['math-vfu'] = {
-- better. If you have problems with math fonts or miss characters report it to the
-- ConTeXt mailing list. Also thanks to Boguslaw for finding a couple of errors.
--- This mechanism will eventually disappear or at least needs to be updated to the
--- way lmtx does virtual fonts.
-
--- 20D6 -> 2190
--- 20D7 -> 2192
+-- Although this mechanism was a candidate for obsolence, the fact that Iwona and
+-- Antykwa are nice fonts (especially for display) I decided to keep it around but
+-- in a bit upgraded way. It is also a test for virtual tfm/pfb fonts that we keep
+-- around but hardly gets tested. However, much is still pretty old code, dating
+-- from when we emulated \UNICODE\ math and \OPENTYPE\ math fonts using traditional
+-- fonts.
local type, next, tonumber = type, next, tonumber
local max = math.max
-local fastcopy = table.copy
+local fastcopy, sortedhash = table.copy, table.sortedhash
-local fonts, nodes, mathematics = fonts, nodes, mathematics
+local fonts, mathematics = fonts, mathematics
local trace_virtual = false trackers.register("math.virtual", function(v) trace_virtual = v end)
local trace_timings = false trackers.register("math.timings", function(v) trace_timings = v end)
@@ -41,211 +42,159 @@ local vfmath = allocate()
fonts.handlers.vf.math = vfmath
local helpers = fonts.helpers
+
+local addprivate = helpers.addprivate
local vfcommands = helpers.commands
+
local rightcommand = vfcommands.right
local leftcommand = vfcommands.left
local downcommand = vfcommands.down
local upcommand = vfcommands.up
local push = vfcommands.push
local pop = vfcommands.pop
-
-local shared = { }
-
--- local back = { "slot", 1, 0x2215 }
---
--- local function negate(main,characters,id,size,unicode,basecode)
--- if not characters[unicode] then
--- local basechar = characters[basecode]
--- if basechar then
--- local ht, wd = basechar.height, basechar.width
--- characters[unicode] = {
--- width = wd,
--- height = ht,
--- depth = basechar.depth,
--- italic = basechar.italic,
--- kerns = basechar.kerns,
--- commands = {
--- { "slot", 1, basecode },
--- push,
--- downcommand[ht/5],
--- leftcommand[wd/2],
--- back,
--- push,
--- }
--- }
--- end
--- end
--- end
---
--- \Umathchardef\braceld="0 "1 "FF07A
--- \Umathchardef\bracerd="0 "1 "FF07B
--- \Umathchardef\bracelu="0 "1 "FF07C
--- \Umathchardef\braceru="0 "1 "FF07D
+local slotcommand = vfcommands.slot
local function brace(main,characters,id,size,unicode,first,rule,left,right,rule,last)
if not characters[unicode] then
- characters[unicode] = {
- parts = {
- { extender = 0, glyph = first },
- { extender = 1, glyph = rule },
- { extender = 0, glyph = left },
- { extender = 0, glyph = right },
- { extender = 1, glyph = rule },
- { extender = 0, glyph = last },
+ local template = characters[first]
+ if template then
+ if not characters[rule] then
+ local width = template.width / 4
+ local height = template.height
+ characters[rule] = {
+ height = 3*height,
+ depth = 2*height,
+ width = width,
+ commands = { push, { "rule", height, width }, pop },
+ }
+ end
+ characters[unicode] = {
+ keepvirtual = true,
+ partsorientation = "horizontal",
+ parts = {
+ { glyph = first },
+ { glyph = rule, extender = 1 },
+ { glyph = left },
+ { glyph = right },
+ { glyph = rule, extender = 1 },
+ { glyph = last },
+ }
}
- }
- end
-end
-
-local function extension(main,characters,id,size,unicode,first,middle,last)
- local chr = characters[unicode]
- if not chr then
- return -- skip
- end
- local fw = characters[first]
- if not fw then
- return
- end
- local mw = characters[middle]
- if not mw then
- return
- end
- local lw = characters[last]
- if not lw then
- return
- end
- fw = fw.width
- mw = mw.width
- lw = lw.width
- if fw == 0 then
- fw = 1
- end
- if lw == 0 then
- lw = 1
+ end
end
- chr.parts = {
- { extender = 0, glyph = first, ["end"] = fw/2, start = 0, advance = fw },
- { extender = 1, glyph = middle, ["end"] = mw/2, start = mw/2, advance = mw },
- { extender = 0, glyph = last, ["end"] = 0, start = lw/2, advance = lw },
- }
end
-local function parent(main,characters,id,size,unicode,first,rule,last)
+local function horibar(main,characters,id,size,unicode,rule)
if not characters[unicode] then
+ if not characters[rule] then
+ local width = main.parameters .quad/4 or 4*65536
+ local height = main.mathparameters.defaultrulethickness or 4*65536/10
+ characters[rule] = {
+ height = height,
+ width = width,
+ commands = { push, { "rule", height, width }, pop },
+ }
+ end
characters[unicode] = {
- parts = {
- { extender = 0, glyph = first },
- { extender = 1, glyph = rule },
- { extender = 0, glyph = last },
+ keepvirtual = true,
+ partsorientation = "horizontal",
+ parts = {
+ { glyph = rule },
+ { glyph = rule, extender = 1 },
}
}
end
end
-local step = 0.2 -- 0.1 is nicer but gives larger files
-
-local function make(main,characters,id,size,n,m)
- local old = 0xFF000 + n
- local c = characters[old]
- if c then
- local upslot = 0xFF100 + n
- local dnslot = 0xFF200 + n
- local uprule = 0xFF300 + m
- local dnrule = 0xFF400 + m
- local xu = main.parameters.xheight + 0.3*size
- local xd = 0.3*size
- local w = c.width or 0
- local h = c.height or 0
- local d = c.depth or 0
- local thickness = h - d
- local rulewidth = step*size -- we could use an overlap
- local slot = { "slot", id, old }
- local rule = { "rule", thickness, rulewidth }
- local up = upcommand[xu]
- local dn = downcommand[xd]
- local ht = xu + 3*thickness
- local dp = 0
- if not characters[uprule] then
- characters[uprule] = {
- width = rulewidth,
- height = ht,
- depth = dp,
- commands = { push, up, rule, pop },
- }
- end
- characters[upslot] = {
- width = w,
- height = ht,
- depth = dp,
- commands = { push, up, slot, pop },
- }
- local ht = 0
- local dp = xd + 3*thickness
- if not characters[dnrule] then
- characters[dnrule] = {
- width = rulewidth,
- height = ht,
- depth = dp,
- commands = { push, dn, rule, pop }
+local function parent(main,characters,id,size,unicode,first,rule,last,where)
+ if not characters[unicode] then
+ local template = characters[first]
+ if template then
+ if not characters[rule] then
+ local width = template.width / 4
+ local height = template.height
+ characters[rule] = {
+ height = where == "top" and height or 3*height,
+ depth = where == "top" and 2*height or 0,
+ width = width,
+ commands = { push, { "rule", height, width }, pop },
+ }
+ end
+ characters[unicode] = {
+ keepvirtual = true,
+ partsorientation = "horizontal",
+ parts = {
+ { glyph = first },
+ { glyph = rule, extender = 1 },
+ { glyph = last },
+ }
}
end
- characters[dnslot] = {
- width = w,
- height = ht,
- depth = dp,
- commands = { push, dn, slot, pop },
- }
end
end
-local function clipped(main,characters,id,size,unicode,original) -- push/pop needed?
- local minus = characters[original]
- if minus then
- local mu = size/18
- local step = 3*mu
- local width = minus.width
- if width > step then
- width = width - step
- step = step / 2
- else
- width = width / 2
- step = width
- end
- characters[unicode] = {
- width = width,
- height = minus.height,
- depth = minus.depth,
- commands = {
- push,
- leftcommand[step],
- { "slot", id, original },
- pop,
- }
- }
- end
-end
+-- local function extension(main,characters,id,size,unicode,first,middle,last)
+-- local chr = characters[unicode]
+-- if not chr then
+-- return -- skip
+-- end
+-- local fw = characters[first]
+-- if not fw then
+-- return
+-- end
+-- local mw = characters[middle]
+-- if not mw then
+-- return
+-- end
+-- local lw = characters[last]
+-- if not lw then
+-- return
+-- end
+-- fw = fw.width
+-- mw = mw.width
+-- lw = lw.width
+-- if fw == 0 then
+-- fw = 1
+-- end
+-- if lw == 0 then
+-- lw = 1
+-- end
+-- chr.partsorientation = "horizontal"
+-- chr.parts = {
+-- { extender = 0, glyph = first, ["end"] = fw/2, start = 0, advance = fw },
+-- { extender = 1, glyph = middle, ["end"] = mw/2, start = mw/2, advance = mw },
+-- { extender = 0, glyph = last, ["end"] = 0, start = lw/2, advance = lw },
+-- }
+-- end
-local function raise(main,characters,id,size,unicode,private,n,id_of_smaller) -- this is a real fake mess
- local raised = fonts.hashes.characters[main.fonts[id_of_smaller].id][private] -- characters[private]
- if raised then
- local up = 0.85 * main.parameters.xheight
- local slot = { "slot", id_of_smaller, private }
- local commands = {
- push, upcommand[up], slot,
- }
- for i=2,n do
- commands[#commands+1] = slot
- end
- commands[#commands+1] = pop
- characters[unicode] = {
- width = n * raised.width,
- height = (raised.height or 0) + up,
- depth = (raised.depth or 0) - up,
- italic = raised.italic,
- commands = commands,
- }
- end
-end
+-- local step = 0.2 -- 0.1 is nicer but gives larger files
+
+-- local function clipped(main,characters,id,size,unicode,original) -- push/pop needed?
+-- local minus = characters[original]
+-- if minus then
+-- local mu = size/18
+-- local step = 3*mu
+-- local width = minus.width
+-- if width > step then
+-- width = width - step
+-- step = step / 2
+-- else
+-- width = width / 2
+-- step = width
+-- end
+-- characters[unicode] = {
+-- width = width,
+-- height = minus.height,
+-- depth = minus.depth,
+-- commands = {
+-- push,
+-- leftcommand[step],
+-- slotcommand[id][original],
+-- pop,
+-- }
+-- }
+-- end
+-- end
local function dots(main,characters,id,size,unicode)
local c = characters[0x002E]
@@ -260,14 +209,14 @@ local function dots(main,characters,id,size,unicode)
local up4size = upcommand[.4*size]
local up7size = upcommand[.7*size]
local right2muw = rightcommand[2*mu + w]
- local slot = { "slot", id, 0x002E }
+ local slot = slotcommand[id][0x002E]
if unicode == 0x22EF then
local c = characters[0x022C5]
if c then
local width = c.width
local height = c.height
local depth = c.depth
- local slot = { "slot", id, 0x022C5 }
+ local slot = slotcommand[id][0x022C5]
characters[unicode] = {
width = 3*width + 2*3*mu,
height = height,
@@ -278,10 +227,9 @@ local function dots(main,characters,id,size,unicode)
}
end
elseif unicode == 0x22EE then
- -- weird height !
characters[unicode] = {
width = w,
- height = h+(1.4)*size,
+ height = h+0.8*size,
depth = 0,
commands = {
push, push, slot, pop, up4size, push, slot, pop, up4size, slot, pop,
@@ -290,7 +238,7 @@ local function dots(main,characters,id,size,unicode)
elseif unicode == 0x22F1 then
characters[unicode] = {
width = 3*w + 6*size/18,
- height = 1.5*size,
+ height = h+0.7*size,
depth = 0,
commands = {
push,
@@ -307,7 +255,7 @@ local function dots(main,characters,id,size,unicode)
elseif unicode == 0x22F0 then
characters[unicode] = {
width = 3*w + 6*size/18,
- height = 1.5*size,
+ height = h+0.7*size,
depth = 0,
commands = {
push,
@@ -334,25 +282,25 @@ local function dots(main,characters,id,size,unicode)
end
end
-local function vertbar(main,characters,id,size,parent,scale,unicode)
- local cp = characters[parent]
- if cp then
- local sc = scale * size
- local pc = { "slot", id, parent }
- characters[unicode] = {
- width = cp.width,
- height = cp.height + sc,
- depth = cp.depth + sc,
- next = cp.next, -- can be extensible
- commands = {
- push, upcommand [sc], pc, pop,
- push, downcommand[sc], pc, pop,
- pc,
- },
- }
- cp.next = unicode
- end
-end
+-- local function vertbar(main,characters,id,size,parent,scale,unicode)
+-- local cp = characters[parent]
+-- if cp then
+-- local sc = scale * size
+-- local pc = slotcommand[id][parent]
+-- characters[unicode] = {
+-- width = cp.width,
+-- height = cp.height + sc,
+-- depth = cp.depth + sc,
+-- next = cp.next, -- can be extensible
+-- commands = {
+-- push, upcommand [sc], pc, pop,
+-- push, downcommand[sc], pc, pop,
+-- pc,
+-- },
+-- }
+-- cp.next = unicode
+-- end
+-- end
local function jointwo(main,characters,id,size,unicode,u1,d12,u2,what)
local c1 = characters[u1]
@@ -360,15 +308,26 @@ local function jointwo(main,characters,id,size,unicode,u1,d12,u2,what)
if c1 and c2 then
local w1 = c1.width
local w2 = c2.width
- local mu = size/18
+ local width
+ if d12 == false then
+ d12 = 0
+ width = w2
+ else
+ d12 = d12 * size/18 -- mu
+ width = w1 + w2 - d12
+ end
characters[unicode] = {
- width = w1 + w2 - d12 * mu,
+ width = width,
height = max(c1.height or 0, c2.height or 0),
depth = max(c1.depth or 0, c2.depth or 0),
commands = {
- { "slot", id, u1 },
- leftcommand[d12*mu],
- { "slot", id, u2 },
+-- { "inspect" },
+-- { "trace" },
+ slotcommand[id][u1],
+-- { "trace" },
+ d12 ~= 0 and leftcommand[d12] or false,
+ slotcommand[id][u2],
+-- { "trace" },
},
}
end
@@ -382,17 +341,24 @@ local function jointhree(main,characters,id,size,unicode,u1,d12,u2,d23,u3)
local w1 = c1.width
local w2 = c2.width
local w3 = c3.width
- local mu = size/18
+ d12 = d12 * size/18 -- mu
+ d23 = d23 * size/18 -- mu
characters[unicode] = {
- width = w1 + w2 + w3 - d12*mu - d23*mu,
+ width = w1 + w2 + w3 - d12 - d23,
height = max(c1.height or 0, c2.height or 0, c3.height or 0),
depth = max(c1.depth or 0, c2.depth or 0, c3.depth or 0),
commands = {
- { "slot", id, u1 },
- leftcommand[d12*mu],
- { "slot", id, u2 },
- leftcommand[d23*mu],
- { "slot", id, u3 },
+-- push,
+ slotcommand[id][u1],
+-- pop,
+ d12 ~= 0 and leftcommand[d12] or false,
+-- push,
+ slotcommand[id][u2],
+-- pop,
+ d23 ~= 0 and leftcommand[d23] or false,
+-- push,
+ slotcommand[id][u3],
+-- pop,
}
}
end
@@ -416,56 +382,64 @@ local function stack(main,characters,id,size,unicode,u1,d12,u2)
local mu = size/18
characters[unicode] = {
width = w1,
- height = h1 + h2 + d12,
+ height = h1 + h2 + d12*mu,
depth = d1,
commands = {
- { "slot", id, u1 },
+ slotcommand[id][u1],
leftcommand[w1/2 + w2/2],
downcommand[-h1 + d2 -d12*mu],
- { "slot", id, u2 },
+ slotcommand[id][u2],
}
}
end
-local function repeated(main,characters,id,size,unicode,u,n,private,fraction) -- math-fbk.lua
+local function repeated(main,characters,id,size,unicode,u,n,fraction)
local c = characters[u]
if c then
- local width = c.width
- local italic = fraction*width -- c.italic or 0 -- larger ones have funny italics
- local tc = { "slot", id, u }
- local tr = leftcommand[italic] -- see hack elsewhere
- local commands = { }
- for i=1,n-1 do
+ if n == 1 then
+ -- skip this one
+ else
+ local width = c.width
+ local italic = fraction*width -- c.italic or 0 -- larger ones have funny italics
+ local tc = slotcommand[id][u]
+ local tr = leftcommand[italic] -- see hack elsewhere
+ local commands = { }
+ for i=1,n-1 do
+ commands[#commands+1] = tc
+ commands[#commands+1] = tr
+ end
commands[#commands+1] = tc
- commands[#commands+1] = tr
- end
- commands[#commands+1] = tc
- local next = c.next
- if next then
- repeated(main,characters,id,size,private,next,n,private+1,fraction)
- next = private
+ local next = c.next
+ if next then
+ local p = addprivate(main,formatters["M-R-%H"](next))
+ repeated(main,characters,id,size,p,next,n,fraction)
+ next = p
+ end
+ characters[unicode] = {
+ width = width + (n-1)*(width-italic),
+ height = c.height,
+ depth = c.depth,
+ italic = italic,
+ commands = commands,
+ keepvirtual = true,
+ next = next,
+ }
end
- characters[unicode] = {
- width = width + (n-1)*(width-italic),
- height = c.height,
- depth = c.depth,
- italic = italic,
- commands = commands,
- next = next,
- }
end
end
-local function cloned(main,characters,id,size,source,target)
- local data = characters[source]
- if data then
- characters[target] = data
- return true
- end
-end
+-- local function cloned(main,characters,id,size,source,target)
+-- local data = characters[source]
+-- if data then
+-- characters[target] = data
+-- return true
+-- end
+-- end
-- we use the fact that context defines the smallest sizes first .. a real dirty and ugly hack
+-- todo: use privates as we don't need access by number
+
local data_of_smaller = nil
local size_of_smaller = 0
@@ -488,114 +462,97 @@ function vfmath.addmissing(main,id,size)
local variables = main.goodies.mathematics and main.goodies.mathematics.variables or { }
local joinrelfactor = variables.joinrelfactor or 3
- for i=0x7A,0x7D do
- make(main,characters,id,size,i,1)
- end
+ brace (main,characters,id,size,0x23DE,0xFE07A,0xFE070,0xFE07D,0xFE07C,0xFE070,0xFE07B)
+ brace (main,characters,id,size,0x23DF,0xFE07C,0xFE070,0xFE07B,0xFE07A,0xFE070,0xFE07D)
- brace (main,characters,id,size,0x23DE,0xFF17A,0xFF301,0xFF17D,0xFF17C,0xFF301,0xFF17B)
- brace (main,characters,id,size,0x23DF,0xFF27C,0xFF401,0xFF27B,0xFF27A,0xFF401,0xFF27D)
+ parent (main,characters,id,size,0x23DC,0xFE07A,0xFE071,0xFE07B,"top")
+ parent (main,characters,id,size,0x23DD,0xFE07C,0xFE072,0xFE07D,"bottom")
- parent (main,characters,id,size,0x23DC,0xFF17A,0xFF301,0xFF17B)
- parent (main,characters,id,size,0x23DD,0xFF27C,0xFF401,0xFF27D)
-
- -- negate (main,characters,id,size,0x2260,0x003D)
dots (main,characters,id,size,0x2026) -- ldots
dots (main,characters,id,size,0x22EE) -- vdots
dots (main,characters,id,size,0x22EF) -- cdots
dots (main,characters,id,size,0x22F1) -- ddots
dots (main,characters,id,size,0x22F0) -- udots
- vertbar (main,characters,id,size,0x0007C,0.10,0xFF601) -- big : 0.85 bodyfontsize
- vertbar (main,characters,id,size,0xFF601,0.30,0xFF602) -- Big : 1.15 bodyfontsize
- vertbar (main,characters,id,size,0xFF602,0.30,0xFF603) -- bigg : 1.45 bodyfontsize
- vertbar (main,characters,id,size,0xFF603,0.30,0xFF604) -- Bigg : 1.75 bodyfontsize
- vertbar (main,characters,id,size,0x02016,0.10,0xFF605)
- vertbar (main,characters,id,size,0xFF605,0.30,0xFF606)
- vertbar (main,characters,id,size,0xFF606,0.30,0xFF607)
- vertbar (main,characters,id,size,0xFF607,0.30,0xFF608)
-
- clipped (main,characters,id,size,0xFF501,0x0002D) -- minus
- clipped (main,characters,id,size,0xFF502,0x02190) -- lefthead
- clipped (main,characters,id,size,0xFF503,0x02192) -- righthead
- clipped (main,characters,id,size,0xFF504,0xFE321) -- mapsto
- clipped (main,characters,id,size,0xFF505,0xFE322) -- lhook
- clipped (main,characters,id,size,0xFF506,0xFE323) -- rhook
- clipped (main,characters,id,size,0xFF507,0xFE324) -- mapsfrom
- clipped (main,characters,id,size,0xFF508,0x021D0) -- double lefthead
- clipped (main,characters,id,size,0xFF509,0x021D2) -- double righthead
- clipped (main,characters,id,size,0xFF50A,0x0003D) -- equal
- clipped (main,characters,id,size,0xFF50B,0x0219E) -- lefttwohead
- clipped (main,characters,id,size,0xFF50C,0x021A0) -- righttwohead
- clipped (main,characters,id,size,0xFF50D,0xFF350) -- lr arrow combi snippet
- clipped (main,characters,id,size,0xFF50E,0xFF351) -- lr arrow combi snippet
- clipped (main,characters,id,size,0xFF50F,0xFF352) -- lr arrow combi snippet
- clipped (main,characters,id,size,0xFF510,0x02261) -- equiv
-
- extension(main,characters,id,size,0x2190,0xFF502,0xFF501,0xFF501) -- \leftarrow
- extension(main,characters,id,size,0x2192,0xFF501,0xFF501,0xFF503) -- \rightarrow
-
- extension(main,characters,id,size,0x002D,0xFF501,0xFF501,0xFF501) -- \rel
- extension(main,characters,id,size,0x003D,0xFF50A,0xFF50A,0xFF50A) -- \equal
- extension(main,characters,id,size,0x2261,0xFF510,0xFF510,0xFF510) -- \equiv
-
- jointwo (main,characters,id,size,0x21A6,0xFE321,0,0x02192) -- \mapstochar\rightarrow
- jointwo (main,characters,id,size,0x21A9,0x02190,joinrelfactor,0xFE323) -- \leftarrow\joinrel\rhook
- jointwo (main,characters,id,size,0x21AA,0xFE322,joinrelfactor,0x02192) -- \lhook\joinrel\rightarrow
+ horibar (main,characters,id,size,0x203E,0xFE073) -- overbar underbar
+
+ -- vertbar (main,characters,id,size,0x0007C,0.10,0xFF601) -- big : 0.85 bodyfontsize
+ -- vertbar (main,characters,id,size,0xFF601,0.30,0xFF602) -- Big : 1.15 bodyfontsize
+ -- vertbar (main,characters,id,size,0xFF602,0.30,0xFF603) -- bigg : 1.45 bodyfontsize
+ -- vertbar (main,characters,id,size,0xFF603,0.30,0xFF604) -- Bigg : 1.75 bodyfontsize
+ -- vertbar (main,characters,id,size,0x02016,0.10,0xFF605)
+ -- vertbar (main,characters,id,size,0xFF605,0.30,0xFF606)
+ -- vertbar (main,characters,id,size,0xFF606,0.30,0xFF607)
+ -- vertbar (main,characters,id,size,0xFF607,0.30,0xFF608)
+
+ -- clipped (main,characters,id,size,0xFF501,0x0002D) -- minus
+ -- clipped (main,characters,id,size,0xFF502,0x02190) -- lefthead
+ -- clipped (main,characters,id,size,0xFF503,0x02192) -- righthead
+ -- clipped (main,characters,id,size,0xFF504,0xFE321) -- mapsto
+ -- clipped (main,characters,id,size,0xFF505,0xFE322) -- lhook
+ -- clipped (main,characters,id,size,0xFF506,0xFE323) -- rhook
+ -- clipped (main,characters,id,size,0xFF507,0xFE324) -- mapsfrom
+ -- clipped (main,characters,id,size,0xFF508,0x021D0) -- double lefthead
+ -- clipped (main,characters,id,size,0xFF509,0x021D2) -- double righthead
+ -- clipped (main,characters,id,size,0xFF50A,0x0003D) -- equal
+ -- clipped (main,characters,id,size,0xFF50B,0x0219E) -- lefttwohead
+ -- clipped (main,characters,id,size,0xFF50C,0x021A0) -- righttwohead
+ -- clipped (main,characters,id,size,0xFF50D,0xFF350) -- lr arrow combi snippet
+ -- clipped (main,characters,id,size,0xFF50E,0xFF351) -- lr arrow combi snippet
+ -- clipped (main,characters,id,size,0xFF50F,0xFF352) -- lr arrow combi snippet
+ -- clipped (main,characters,id,size,0xFF510,0x02261) -- equiv
+
+ -- extension(main,characters,id,size,0x2190,0xFF502,0xFF501,0xFF501) -- \leftarrow
+ -- extension(main,characters,id,size,0x2192,0xFF501,0xFF501,0xFF503) -- \rightarrow
+
+ -- extension(main,characters,id,size,0x002D,0xFF501,0xFF501,0xFF501) -- \rel
+ -- extension(main,characters,id,size,0x003D,0xFF50A,0xFF50A,0xFF50A) -- \equal
+ -- extension(main,characters,id,size,0x2261,0xFF510,0xFF510,0xFF510) -- \equiv
+
+ -- jointwo (main,characters,id,size,0x21A6,0xFE321,0,0x02192) -- \mapstochar\rightarrow
+ -- jointwo (main,characters,id,size,0x21A9,0x02190,joinrelfactor,0xFE323) -- \leftarrow\joinrel\rhook
+ -- jointwo (main,characters,id,size,0x21AA,0xFE322,joinrelfactor,0x02192) -- \lhook\joinrel\rightarrow
jointwo (main,characters,id,size,0x27F5,0x02190,joinrelfactor,0x0002D) -- \leftarrow\joinrel\relbar
jointwo (main,characters,id,size,0x27F6,0x0002D,joinrelfactor,0x02192,2) -- \relbar\joinrel\rightarrow
jointwo (main,characters,id,size,0x27F7,0x02190,joinrelfactor,0x02192) -- \leftarrow\joinrel\rightarrow
jointwo (main,characters,id,size,0x27F8,0x021D0,joinrelfactor,0x0003D) -- \Leftarrow\joinrel\Relbar
jointwo (main,characters,id,size,0x27F9,0x0003D,joinrelfactor,0x021D2) -- \Relbar\joinrel\Rightarrow
jointwo (main,characters,id,size,0x27FA,0x021D0,joinrelfactor,0x021D2) -- \Leftarrow\joinrel\Rightarrow
- jointhree(main,characters,id,size,0x27FB,0x02190,joinrelfactor,0x0002D,0,0xFE324) -- \leftarrow\joinrel\relbar\mapsfromchar
- jointhree(main,characters,id,size,0x27FC,0xFE321,0,0x0002D,joinrelfactor,0x02192) -- \mapstochar\relbar\joinrel\rightarrow
-
- extension(main,characters,id,size,0x21A6,0xFF504,0xFF501,0xFF503) -- \mapstochar\rightarrow
- extension(main,characters,id,size,0x21A9,0xFF502,0xFF501,0xFF506) -- \leftarrow\joinrel\rhook
- extension(main,characters,id,size,0x21AA,0xFF505,0xFF501,0xFF503) -- \lhook\joinrel\rightarrow
- extension(main,characters,id,size,0x27F5,0xFF502,0xFF501,0xFF501) -- \leftarrow\joinrel\relbar
- extension(main,characters,id,size,0x27F6,0xFF501,0xFF501,0xFF503) -- \relbar\joinrel\rightarrow
- extension(main,characters,id,size,0x27F7,0xFF502,0xFF501,0xFF503) -- \leftarrow\joinrel\rightarrow
- extension(main,characters,id,size,0x27F8,0xFF508,0xFF50A,0xFF50A) -- \Leftarrow\joinrel\Relbar
- extension(main,characters,id,size,0x27F9,0xFF50A,0xFF50A,0xFF509) -- \Relbar\joinrel\Rightarrow
- extension(main,characters,id,size,0x27FA,0xFF508,0xFF50A,0xFF509) -- \Leftarrow\joinrel\Rightarrow
- extension(main,characters,id,size,0x27FB,0xFF502,0xFF501,0xFF507) -- \leftarrow\joinrel\relbar\mapsfromchar
- extension(main,characters,id,size,0x27FC,0xFF504,0xFF501,0xFF503) -- \mapstochar\relbar\joinrel\rightarrow
-
- extension(main,characters,id,size,0x219E,0xFF50B,0xFF501,0xFF501) -- \twoheadleftarrow\joinrel\relbar
- extension(main,characters,id,size,0x21A0,0xFF501,0xFF501,0xFF50C) -- \relbar\joinrel\twoheadrightarrow
- extension(main,characters,id,size,0x21C4,0xFF50D,0xFF50E,0xFF50F) -- leftoverright
+ -- jointhree(main,characters,id,size,0x27FB,0x02190,joinrelfactor,0x0002D,0,0xFE324) -- \leftarrow\joinrel\relbar\mapsfromchar
+ -- jointhree(main,characters,id,size,0x27FC,0xFE321,0,0x0002D,joinrelfactor,0x02192) -- \mapstochar\relbar\joinrel\rightarrow
+
+ -- extension(main,characters,id,size,0x21A6,0xFF504,0xFF501,0xFF503) -- \mapstochar\rightarrow
+ -- extension(main,characters,id,size,0x21A9,0xFF502,0xFF501,0xFF506) -- \leftarrow\joinrel\rhook
+ -- extension(main,characters,id,size,0x21AA,0xFF505,0xFF501,0xFF503) -- \lhook\joinrel\rightarrow
+ -- extension(main,characters,id,size,0x27F5,0xFF502,0xFF501,0xFF501) -- \leftarrow\joinrel\relbar
+ -- extension(main,characters,id,size,0x27F6,0xFF501,0xFF501,0xFF503) -- \relbar\joinrel\rightarrow
+ -- extension(main,characters,id,size,0x27F7,0xFF502,0xFF501,0xFF503) -- \leftarrow\joinrel\rightarrow
+ -- extension(main,characters,id,size,0x27F8,0xFF508,0xFF50A,0xFF50A) -- \Leftarrow\joinrel\Relbar
+ -- extension(main,characters,id,size,0x27F9,0xFF50A,0xFF50A,0xFF509) -- \Relbar\joinrel\Rightarrow
+ -- extension(main,characters,id,size,0x27FA,0xFF508,0xFF50A,0xFF509) -- \Leftarrow\joinrel\Rightarrow
+ -- extension(main,characters,id,size,0x27FB,0xFF502,0xFF501,0xFF507) -- \leftarrow\joinrel\relbar\mapsfromchar
+ -- extension(main,characters,id,size,0x27FC,0xFF504,0xFF501,0xFF503) -- \mapstochar\relbar\joinrel\rightarrow
+
+ -- extension(main,characters,id,size,0x219E,0xFF50B,0xFF501,0xFF501) -- \twoheadleftarrow\joinrel\relbar
+ -- extension(main,characters,id,size,0x21A0,0xFF501,0xFF501,0xFF50C) -- \relbar\joinrel\twoheadrightarrow
+ -- extension(main,characters,id,size,0x21C4,0xFF50D,0xFF50E,0xFF50F) -- leftoverright
-- 21CB leftrightharpoon
-- 21CC rightleftharpoon
- stack(main,characters,id,size,0x2259,0x0003D,3,0x02227) -- \buildrel\wedge\over=
-
- jointwo(main,characters,id,size,0x22C8,0x022B3,joinrelfactor,0x022B2) -- \mathrel\triangleright\joinrel\mathrel\triangleleft (4 looks better than 3)
- jointwo(main,characters,id,size,0x22A7,0x0007C,joinrelfactor,0x0003D) -- \mathrel|\joinrel=
- jointwo(main,characters,id,size,0x2260,0x00338,0,0x0003D) -- \not\equal
- jointwo(main,characters,id,size,0x2284,0x00338,0,0x02282) -- \not\subset
- jointwo(main,characters,id,size,0x2285,0x00338,0,0x02283) -- \not\supset
- jointwo(main,characters,id,size,0x2209,0x00338,0,0x02208) -- \not\in
- jointwo(main,characters,id,size,0x2254,0x03A,0,0x03D) -- := (≔)
-
- repeated(main,characters,id,size,0x222C,0x222B,2,0xFF800,1/3)
- repeated(main,characters,id,size,0x222D,0x222B,3,0xFF810,1/3)
-
- if cloned(main,characters,id,size,0x2032,0xFE325) then
- raise(main,characters,id,size,0x2032,0xFE325,1,id_of_smaller) -- prime
- raise(main,characters,id,size,0x2033,0xFE325,2,id_of_smaller) -- double prime
- raise(main,characters,id,size,0x2034,0xFE325,3,id_of_smaller) -- triple prime
- -- to satisfy the prime resolver
- characters[0xFE932] = characters[0x2032]
- characters[0xFE933] = characters[0x2033]
- characters[0xFE934] = characters[0x2034]
- end
+ stack(main,characters,id,size,0x2259,0x0003D,3,0x02227) -- \buildrel\wedge\over=
- -- there are more (needs discussion first):
+ jointwo(main,characters,id,size,0x22C8,0x022B3,joinrelfactor,0x022B2) -- \mathrel\triangleright\joinrel\mathrel\triangleleft (4 looks better than 3)
+ jointwo(main,characters,id,size,0x22A7,0x0007C,joinrelfactor,0x0003D) -- \mathrel|\joinrel=
+ jointwo(main,characters,id,size,0x2260,0x00338,0,0x0003D) -- \not\equal
+ jointwo(main,characters,id,size,0x2284,0x00338,false,0x02282) -- \not\subset
+ jointwo(main,characters,id,size,0x2285,0x00338,false,0x02283) -- \not\supset
+ jointwo(main,characters,id,size,0x2209,0x00338,false,0x02208) -- \not\in
+ jointwo(main,characters,id,size,0x2254,0x03A,0,0x03D) -- := (≔)
- -- characters[0x20D6] = characters[0x2190]
- -- characters[0x20D7] = characters[0x2192]
+ repeated(main,characters,id,size,0x222B,0x222B,1,1/2)
+ repeated(main,characters,id,size,0x222C,0x222B,2,1/2)
+ repeated(main,characters,id,size,0x222D,0x222B,3,1/2)
characters[0x02B9] = characters[0x2032] -- we're nice
@@ -622,9 +579,10 @@ setmetatableindex(reverse, function(t,name)
return r
end)
+-- Used in fallbacks (might move):
+
local function copy_glyph(main,target,original,unicode,slot)
- local addprivate = fonts.helpers.addprivate
- local olddata = original[unicode]
+ local olddata = original[unicode]
if olddata then
local newdata = {
width = olddata.width,
@@ -635,7 +593,7 @@ local function copy_glyph(main,target,original,unicode,slot)
kerns = olddata.kerns,
mathkerns = olddata.mathkerns,
tounicode = olddata.tounicode,
- commands = { { "slot", slot, unicode } },
+ commands = { slotcommand[slot][unicode] },
}
local glyphdata = newdata
local nextglyph = olddata.next
@@ -652,7 +610,7 @@ local function copy_glyph(main,target,original,unicode,slot)
mathkerns = olddata.mathkerns,
tounicode = olddata.tounicode,
smaller = olddata.smaller,
- commands = { { "slot", slot, nextglyph } },
+ commands = { slotcommand[slot][nextglyph] },
}
local newnextglyph = addprivate(main,formatters["M-N-%H"](nextglyph),newnextdata)
newdata.next = newnextglyph
@@ -668,22 +626,24 @@ local function copy_glyph(main,target,original,unicode,slot)
break -- safeguard (when testing stuff)
end
end
- local pv = olddata.parts
- if pv then
- pv = fastcopy(pv)
- newdata.parts = pv
- for i=1,#hp do
- local pvi = pv[i]
- local oldglyph = pvi.glyph
- local olddata = original[oldglyph]
- local newdata = {
+ local oldparts = olddata.parts
+ if oldparts then
+ newparts = fastcopy(oldparts)
+ newdata.parts = newparts
+ newdata.partsorientation = olddata.partsorientation
+ newdata.partsitalic = olddata.partsitalic
+ for i=1,#newparts do
+ local newpart = newparts[i]
+ local oldglyph = newpart.glyph
+ local olddata = original[oldglyph]
+ local newdata = {
width = olddata.width,
height = olddata.height,
depth = olddata.depth,
tounicode = olddata.tounicode,
- commands = { { "slot", slot, oldglyph } },
+ commands = { slotcommand[slot][oldglyph] },
}
- pvi.glyph = addprivate(main,formatters["M-P-%H"](oldglyph),newdata)
+ newpart.glyph = addprivate(main,formatters["M-P-%H"](oldglyph),newdata)
end
end
local smaller = olddata.smaller
@@ -702,6 +662,66 @@ vfmath.copy_glyph = copy_glyph
-- route: use the "order" field. I can probably make it a bit leaner but it's not
-- worth spending much time on now.
+local noitalics = true -- false can be used to test the engine
+
+-- revision timestamp 2023: after watching ten times "Over The Mountain (feat.
+-- Sierra Hull)" - Cory Wong (Live @ Brooklyn Steel FEB 2022):
+--
+-- https://www.youtube.com/watch?v=lT-W-UEcsns
+-- https://www.youtube.com/watch?v=TPGbj1gFalA
+
+-- The following code is now only used for iwona and antykwa, so I simplified it a
+-- bit to suit that purpose. It might get even simpler.
+
+local function virtualize(s,uni,fci,skewchar,move,mathparameters,unicode,parameters)
+ local kerns = fci.kerns
+ local width = fci.width
+ local height = fci.height
+ local depth = fci.depth
+ local italic = fci.italic
+ local advance = width
+ local bottomright
+ local topanchor
+ local yoffset
+ if kerns and skewchar then
+ local k = kerns[skewchar]
+ if k then
+ topanchor = width/2 + k
+ end
+ end
+ if italic and noitalics then
+ width = width + italic
+ bottomright = - italic
+ italic = nil
+ end
+ if move then -- 0x222B
+ local axis = move * mathparameters.axisheight
+ local half = (height + depth ) / 2
+ yoffset = depth - (half - axis)
+ height = half + axis
+ depth = half - axis
+ end
+ --
+ return {
+ advance = advance,
+ width = width,
+ height = height,
+ depth = depth,
+ italic = italic,
+ bottomright = bottomright,
+ topanchor = topanchor,
+ yoffset = yoffset,
+ commands = { slotcommand[s][uni] },
+ -- keepvirtual = true,
+ next = fci.next,
+ parts = fci.parts,
+ partsorientation = fci.partsorientation,
+ partsitalic = fci.partsitalic,
+ unicode = unicode,
+ name = fci.name,
+ }
+end
+
function vfmath.define(specification,set,goodies)
local name = specification.name -- symbolic name
local size = specification.size -- given size
@@ -712,6 +732,7 @@ function vfmath.define(specification,set,goodies)
local start = (trace_virtual or trace_timings) and os.clock()
local okset = { }
local n = 0
+ local f_extra = formatters["virtual.extra.%05X"]
for s=1,#set do
local ss = set[s]
local ssname = ss.name
@@ -735,7 +756,11 @@ function vfmath.define(specification,set,goodies)
end
else
f, id = fonts.constructors.readanddefine(ssname,size)
- names[ssname] = { f = f, id = id }
+ names[ssname] = {
+ f = f,
+ id = id,
+ fontname = ssname, -- diagnostics
+ }
end
if not f or id == 0 then
report_virtual("loading font %a subfont %s with name %a at %p is skipped, not found",name,s,ssname,size)
@@ -743,10 +768,11 @@ function vfmath.define(specification,set,goodies)
n = n + 1
okset[n] = ss
loaded[n] = f
- fontlist[n] = { id = id, size = size }
- if not shared[s] then
- shared[n] = { }
- end
+ fontlist[n] = {
+ id = id,
+ size = size,
+ fontname = ssname, -- diagnostics
+ }
if trace_virtual then
report_virtual("loading font %a subfont %s with name %a at %p as id %s using encoding %a",name,s,ssname,size,id,ss.vector)
end
@@ -823,16 +849,19 @@ function vfmath.define(specification,set,goodies)
end
--
local already_reported = false
- local parameters_done = false
+ local parameters_done = false
+ local offset = 0 -- 0xFF000 -- todo: -- private
+ --
for s=1,n do
- local ss, fs = okset[s], loaded[s]
+ local ss = okset[s]
+ local fs = loaded[s]
if not fs then
-- skip, error
elseif add_optional and ss.optional then
-- skip, redundant
else
local newparameters = fs.parameters
- local newmathparameters = fs.mathparameters
+ local newmathparameters = fs.mathparameters and ss.parameters ~= false
if newmathparameters then
if not parameters_done or ss.parameters then
mathparameters = newmathparameters
@@ -870,7 +899,11 @@ function vfmath.define(specification,set,goodies)
mathparameters.axisheight = newparameters[22] or 0 -- axisheight : height of fraction lines above the baseline
-- report_virtual("loading and virtualizing font %a at size %p, setting sy parameters",name,size)
end
+ -- We no longer care about kerns and ligatures here. We use backmack because we need to know
+ -- the original order and the loader has made a unicode font of it and weird glyph names have
+ -- spoiled that a bit too.
if ss.overlay then
+ -- This branch / option will go away.
local fc = fs.characters
local first = ss.first
if first then
@@ -886,29 +919,28 @@ function vfmath.define(specification,set,goodies)
else
local vectorname = ss.vector
if vectorname then
- local offset = 0xFF000 -- todo: -- private
local vector = mathencodings[vectorname]
- local rotcev = reverse[vectorname]
local isextension = ss.extension
- if vector and rotcev then
+ if vector then
local fc = fs.characters
local fd = fs.descriptions
- local si = shared[s]
+ local fp = fs.parameters
local fontname = fs.properties.name or "unknown"
local skewchar = ss.skewchar
local backmap = ss.backmap
- -- we need to know the original order because the loader has made a
- -- unicode font of it and weird glyphnames have spoiled that a bit
- if backmap then
+ local badones = ss.badones
+ local done = { }
+ local extras = { }
+ if not backmap then
backmap = { }
for unicode, character in next, fc do
backmap[character.order or character.index or unicode] = unicode
end
+ ss.backmap = backmap
end
- for unicode, i in next, vector do
- -- So, here we can have an extra remapping (compared to mkiv).
- local index = backmap and backmap[i] or i
- local fci = fc[index]
+ for unicode, index in sortedhash(vector) do
+ local uni = backmap and backmap[index] or index
+ local fci = fc[uni]
if not fci then
local rf = reported[fontname]
if not rf then rf = { } reported[fontname] = rf end
@@ -930,149 +962,56 @@ function vfmath.define(specification,set,goodies)
rv[unicode] = true
end
else
- local ref = si[index]
- if not ref then
- ref = { { 'slot', s, index } }
- si[index] = ref
- end
- local kerns = fci.kerns
- local width = fci.width
- local italic = fci.italic
- -- if trace_virtual then
- -- report_virtual("character %C uses index %H in vector %a for font %a, %s, %s",
- -- unicode,index,vectorname,fontname,
- -- kerns and "adding kerns" or "no kerns",
- -- kerns and "adding italic" or "no italic"
- -- )
- -- end
- if italic and italic > 0 then
- -- int_a^b
- if isextension then
- width = width + italic -- for obscure reasons the integral as a width + italic correction
- end
- end
- if kerns then
- local krn = { }
- for k, v in next, kerns do -- kerns is sparse
- local rk = rotcev[k]
- if rk then
- krn[rk] = v -- kerns[k]
- end
- end
- if not next(krn) then
- krn = nil
- end
- local t = {
- width = width,
- height = fci.height,
- depth = fci.depth,
- italic = italic,
- kerns = krn,
- commands = ref,
- }
- if skewchar then
- local k = kerns[skewchar]
- if k then
- t.topanchor = width/2 + k
- end
- end
- characters[unicode] = t
- else
- characters[unicode] = {
- width = width,
- height = fci.height,
- depth = fci.depth,
- italic = italic,
- commands = ref,
- }
- end
+ local u = mathematics.gaps[unicode] or unicode
+ local t = virtualize(s,uni,fci,skewchar,tonumber(badones and badones[fci.name or ""]),mathparameters,u,fp)
+ done[uni] = t
+ characters[unicode] = t
+ fci.unicode = u
end
end
if isextension then
- -- todo: if multiple ex, then 256 offsets per instance
local extension = mathencodings["large-to-small"]
- local variants_done = fs.variants_done
- for index, fci in next, fc do -- the raw ex file
- if type(index) == "number" then
- local ref = si[index]
- if not ref then
- ref = { { 'slot', s, index } }
- si[index] = ref
- end
- local italic = fci.italic
- local t = {
- width = fci.width,
- height = fci.height,
- depth = fci.depth,
- italic = italic,
- commands = ref,
- }
- local n = fci.next
- if n then
- t.next = offset + n
- elseif variants_done then
- local v = fci.parts
- if v then
- t.parts = v
- end
- else
- local v = fci.parts
- if v then
- for i=1,#v do
- local vi = v[i]
- vi.glyph = vi.glyph + offset
- end
- t.parts = v
- end
- end
- characters[offset + index] = t
+ for uni, fci in sortedhash(fc) do
+ if not done[uni] then
+ local t = virtualize(s,uni,fci,skewchar,tonumber(badones and badones[fci.name or ""]),mathparameters,nil,fp)
+ local o = addprivate(main,f_extra(offset))
+ extras[uni] = o
+ characters[o] = t
+ done[uni] = t
+ offset = offset + 1
end
end
- fs.variants_done = true
- for unicode, index in next, extension do
- local cu = characters[unicode]
- if cu then
- cu.next = offset + index
- else
- local fci = fc[index]
- if not fci then
- -- do nothing
- else
- -- probably never entered
- local ref = si[index]
- if not ref then
- ref = { { 'slot', s, index } }
- si[index] = ref
- end
- local kerns = fci.kerns
- if kerns then
- local krn = { }
- -- for k=1,#kerns do
- -- krn[offset + k] = kerns[k]
- -- end
- for k, v in next, kerns do -- is kerns sparse?
- krn[offset + k] = v
- end
- characters[unicode] = {
- width = fci.width,
- height = fci.height,
- depth = fci.depth,
- italic = fci.italic,
- commands = ref,
- kerns = krn,
- next = offset + index,
- }
- else
- characters[unicode] = {
- width = fci.width,
- height = fci.height,
- depth = fci.depth,
- italic = fci.italic,
- commands = ref,
- next = offset + index,
- }
- end
+ for uni, fci in sortedhash(done) do
+ local next = fci.next
+ if next then
+ fci.next = extras[backmap and backmap[next] or next]
+ end
+ local parts = fci.parts
+ if parts then
+ local p = table.copy(parts)
+ for i=1,#p do
+ local part = p[i]
+ local glyph = part.glyph
+ part.glyph = extras[backmap and backmap[glyph] or glyph] or glyph
end
+ fci.keepvirtual = true
+ fci.parts = p
+ fci.partsorientation = "vertical"
+ fci.partsitalic = fci.partsitalic or fci.italic
+ end
+ end
+ for unicode, index in sortedhash(extension) do
+ local fci = characters[unicode]
+ if fci then
+ fci.next = extras[backmap[index] or index]
+ end
+ end
+ local extension = mathencodings["large-to-small-private"]
+ for unicode, index in sortedhash(extension) do
+ if not characters[unicode] then
+ local uni = backmap and backmap[index] or index
+ local fci = fc[uni]
+ characters[unicode] = virtualize(s,uni,fci,skewchar,false,mathparameters,unicode,fp)
end
end
end
@@ -1081,21 +1020,15 @@ function vfmath.define(specification,set,goodies)
end
end
end
- mathematics.extras.copy(main) --not needed here (yet)
+ -- mathematics.extras.copy(main) -- Not needed here (yet) ... might go.
end
end
--- inspect(characters[0x1D465])
--- inspect(fonts.encodings.math["tex-it"])
--- inspect(fontlist)
--
main.mathparameters = mathparameters -- still traditional ones
- -- This should change (some day) as it's the only place where we look forward,
- -- so better is to also reserve the id already which then involves some more
- -- management (so not now).
fontlist[#fontlist+1] = {
- -- id = font.nextid(),
- id = 0, -- self
- size = size,
+ id = 0,
+ size = size,
+ fontname = name, -- diagnostics
}
vfmath.addmissing(main,#fontlist,size)
--
@@ -1104,16 +1037,15 @@ function vfmath.define(specification,set,goodies)
main.properties.math_is_scaled = true -- signal
fonts.constructors.assignmathparameters(main,main)
--
- main.mathconstants = main.mathparameters -- we directly pass it to TeX (bypasses the scaler) so this is needed
+ mathematics.initializeparameters(main,main,"noscale")
+ main.mathconstants = main.mathparameters -- we directly pass it to TeX (bypasses the scaler) so this is needed
+ main.MathConstants = main.mathconstants
+ main.nomath = false
--
if trace_virtual or trace_timings then
report_virtual("loading and virtualizing font %a at size %p took %0.3f seconds",name,size,os.clock()-start)
end
--
- -- We bypass the scaler so ...
- --
- main.MathConstants = main.mathconstants
- main.nomath = false
return main
end
@@ -1123,7 +1055,7 @@ function mathematics.makefont(name,set,goodies)
end
end
--- helpers
+-- helpers (todo: gaps)
function vfmath.setletters(font_encoding, name, uppercase, lowercase)
local enc = font_encoding[name]
diff --git a/tex/context/base/mkxl/page-ini.mkxl b/tex/context/base/mkxl/page-ini.mkxl
index 40cd87a42..38fe1e60d 100644
--- a/tex/context/base/mkxl/page-ini.mkxl
+++ b/tex/context/base/mkxl/page-ini.mkxl
@@ -110,8 +110,15 @@
\installoutputroutine\savepagecontent
{\global\setbox\b_page_otr_saved\box\normalpagebox}
-\permanent\protected\def\flushpagecontent
- {\ifvoid\b_page_otr_saved\else\unvbox\b_page_otr_saved\fi}
+% \permanent\protected\def\flushpagecontent
+% {\ifvoid\b_page_otr_saved\else\unvbox\b_page_otr_saved\fi}
+
+\permanent\protected\def\flushpagecontent % used in postponing
+ {\ifvoid\b_page_otr_saved\else
+ \scratchdepth\dp\b_page_otr_saved
+ \unvbox\b_page_otr_saved
+ \prevdepth\scratchdepth
+ \fi}
% Test case: assumes one group level for output routine, todo:
% a toks.
diff --git a/tex/context/base/mkxl/spac-hor.mkxl b/tex/context/base/mkxl/spac-hor.mkxl
index ba7633bec..017a94d5b 100644
--- a/tex/context/base/mkxl/spac-hor.mkxl
+++ b/tex/context/base/mkxl/spac-hor.mkxl
@@ -13,6 +13,8 @@
\writestatus{loading}{ConTeXt Spacing Macros / Horizontal}
+% document: \enabledirectives[backends.spaces]
+
\unprotect
\registerctxluafile{spac-hor}{autosuffix}
@@ -396,6 +398,16 @@
\fi
\updateraggedskips}
+% test test\fsp. test % beats frenchspacing
+
+\permanent\protected\def\fsp#1% fixed space puncuation
+ {\begingroup
+ \ifchknum`#1\or
+ \sfcode`#1\plusthousand
+ \fi
+ #1%
+ \endgroup}
+
%D Here's a tweak .. if needed one can configure it in the configuration
%D so that initialization happens more efficient.
%D
diff --git a/tex/context/base/mkxl/spac-prf.mklx b/tex/context/base/mkxl/spac-prf.mklx
index de5defc3e..06038d867 100644
--- a/tex/context/base/mkxl/spac-prf.mklx
+++ b/tex/context/base/mkxl/spac-prf.mklx
@@ -82,7 +82,6 @@
\edef\currentprofile{#profile}%
\fi
\spac_profile_set
-
\profileparameter\c!before}
\protected\def\spac_profile_stop
@@ -178,7 +177,7 @@
\permanent\protected\def\setmainlineprofile
{\lettonothing\currentlineprofile
- \clf_setlineprofile}
+ \spac_line_profile_set}
\appendtoks
\c_attr_lineprofile\attributeunsetvalue % or in general resetter
diff --git a/tex/context/base/mkxl/strc-lst.lmt b/tex/context/base/mkxl/strc-lst.lmt
index 467d916d8..67e06520c 100644
--- a/tex/context/base/mkxl/strc-lst.lmt
+++ b/tex/context/base/mkxl/strc-lst.lmt
@@ -962,7 +962,10 @@ function lists.process(specification)
local numberdata = listentry.numberdata
local references = listentry.references
local special = specials and numberdata and specials[zerostrippedconcat(numberdata.numbers,".")] or ""
- if cheat and references then
+ local view = usedviews[i]
+ -- if cheat and references then
+ -- -- HH: I still need to test this patch:
+ if cheat and references and view and cheats[view] then
-- this permits runs=2 with interactivity
local internal = references.internal
usedinternals[internal] = true
diff --git a/tex/context/base/mkxl/strc-ref.lmt b/tex/context/base/mkxl/strc-ref.lmt
index 3c86d66d9..238201336 100644
--- a/tex/context/base/mkxl/strc-ref.lmt
+++ b/tex/context/base/mkxl/strc-ref.lmt
@@ -1014,6 +1014,7 @@ local function loadexternalreferences(name,utilitydata)
local external = struc.references.collected -- direct references
local lists = struc.lists.collected -- indirect references (derived)
local pages = struc.pages.collected -- pagenumber data
+ local sections = struc.sections.collected
-- a bit weird one, as we don't have the externals in the collected
for prefix, set in next, external do
if prefix == "" then
@@ -1034,6 +1035,7 @@ local function loadexternalreferences(name,utilitydata)
end
end
end
+ -- maybe store utilitydata in metatable so that we can access all
for i=1,#lists do
local entry = lists[i]
local metadata = entry.metadata
@@ -1049,6 +1051,15 @@ local function loadexternalreferences(name,utilitydata)
if prefix == "" then
prefix = name -- this can clash!
end
+ local section = references.section
+ if section then
+ -- we have to make sure that the right section is used, see helpers.prefix
+ if sections then
+ references.sectiondata = sections[section]
+ else
+ -- warning
+ end
+ end
local target = external[prefix]
if not target then
target = { }
diff --git a/tex/context/base/mkxl/syst-lua.lmt b/tex/context/base/mkxl/syst-lua.lmt
index 0eef7afd0..d8e06d4fd 100644
--- a/tex/context/base/mkxl/syst-lua.lmt
+++ b/tex/context/base/mkxl/syst-lua.lmt
@@ -15,7 +15,7 @@ local S, C, P, lpegmatch, lpegtsplitat = lpeg.S, lpeg.C, lpeg.P, lpeg.match, lpe
local xmath = xmath or math
local xcomplex = xcomplex or { }
-local scannext = token.scannext
+----- scannext = token.scannext
local scancmdchr = token.scancmdchrexpanded
local scantoken = token.scantoken
local getcsname = token.getcsname
diff --git a/tex/context/base/mkxl/tabl-tbl.lmt b/tex/context/base/mkxl/tabl-tbl.lmt
new file mode 100644
index 000000000..50d871905
--- /dev/null
+++ b/tex/context/base/mkxl/tabl-tbl.lmt
@@ -0,0 +1,60 @@
+if not modules then modules = { } end modules ['tabl-tbl'] = {
+ version = 1.001,
+ comment = "companion to tabl-tbl.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- A couple of hacks ... easier to do in Lua than in regular TeX. More will
+-- follow.
+
+local tonumber = tonumber
+local gsub, rep, sub, find = string.gsub, string.rep, string.sub, string.find
+local P, C, Cc, Ct, lpegmatch = lpeg.P, lpeg.C, lpeg.Cc, lpeg.Ct, lpeg.match
+
+local context = context
+local commands = commands
+
+local texsetcount = tex.setcount
+local texiscount = tex.iscount
+
+local separator = P("|") -- keep { }
+----- nested = C(lpeg.patterns.nested) -- remove { }
+local nested = lpeg.patterns.argument
+local pattern = Ct((separator * (nested + Cc("")) * C((1-separator)^0))^0)
+
+local ctx_settabulatelastentry = context.settabulatelastentry
+local ctx_settabulateentry = context.settabulateentry
+
+local c_tabl_tabulate_nofcolumns = texiscount("c_tabl_tabulate_nofcolumns")
+local c_tabl_tabulate_has_rule_spec_first = texiscount("c_tabl_tabulate_has_rule_spec_first")
+local c_tabl_tabulate_has_rule_spec_last = texiscount("c_tabl_tabulate_has_rule_spec_last")
+
+-- the lmtx raw processor handles {} like the normal one so we need to prune
+
+local function presettabulate(preamble)
+ preamble = gsub(preamble,"~","d") -- let's get rid of ~ mess here
+ if find(preamble,"*",1,true) then
+ -- todo: lpeg but not now
+ preamble = gsub(preamble, "%*(%b{})(%b{})", function(n,p)
+ return rep(sub(p,2,-2),tonumber(sub(n,2,-2)) or 1)
+ end)
+ end
+ local t = lpegmatch(pattern,preamble)
+ local m = #t - 2
+ texsetcount("global",c_tabl_tabulate_nofcolumns, m/2)
+ texsetcount("global",c_tabl_tabulate_has_rule_spec_first, t[1] == "" and 0 or 1)
+ texsetcount("global",c_tabl_tabulate_has_rule_spec_last, t[m+1] == "" and 0 or 1)
+ for i=1,m,2 do
+ ctx_settabulateentry(t[i],t[i+1])
+ end
+ ctx_settabulatelastentry(t[m+1])
+end
+
+interfaces.implement {
+ name = "presettabulate",
+ actions = presettabulate,
+ arguments = "string",
+ scope = "private",
+}
diff --git a/tex/context/base/mkxl/tabl-tbl.mkxl b/tex/context/base/mkxl/tabl-tbl.mkxl
index d4ad013d5..b3b4b4c88 100644
--- a/tex/context/base/mkxl/tabl-tbl.mkxl
+++ b/tex/context/base/mkxl/tabl-tbl.mkxl
@@ -15,7 +15,13 @@
\unprotect
-\registerctxluafile{tabl-tbl}{} % experiment
+% These are set at the lua end by parser:
+
+\newinteger\c_tabl_tabulate_nofcolumns
+\newinteger\c_tabl_tabulate_has_rule_spec_first
+\newinteger\c_tabl_tabulate_has_rule_spec_last
+
+\registerctxluafile{tabl-tbl}{autosuffix} % experiment
%D I can probably reimplement this using a \LUATEX\ combination but it does not pay
%D of in development time. If I need something else I will write it from scratch
@@ -176,10 +182,6 @@
\newinteger \c_tabl_tabulate_nofrealrows
\newinteger \c_tabl_tabulate_autocolor
-\newinteger \c_tabl_tabulate_nofcolumns % set at the lua end by parser
-\newinteger \c_tabl_tabulate_has_rule_spec_first % set at the lua end by parser (for the moment a count)
-\newinteger \c_tabl_tabulate_has_rule_spec_last % set at the lua end by parser (for the moment a count)
-
\newconditional \c_tabl_tabulate_nopbreak
\newconditional \c_tabl_tabulate_firstflushed
\newconditional \c_tabl_tabulate_equal
diff --git a/tex/context/base/mkxl/task-ini.lmt b/tex/context/base/mkxl/task-ini.lmt
index 85892c7f5..6d4ebfcc2 100644
--- a/tex/context/base/mkxl/task-ini.lmt
+++ b/tex/context/base/mkxl/task-ini.lmt
@@ -98,7 +98,7 @@ appendaction("shipouts", "wrapup", "nodes.handlers.export",
appendaction("shipouts", "wrapup", "luatex.synctex.collect", nil, "nut", "disabled" )
appendaction("math", "normalizers", "noads.handlers.showtree", nil, "nonut", "disabled" )
-appendaction("math", "normalizers", "noads.handlers.collapse", nil, "nonut", "disabled" )
+appendaction("math", "normalizers", "noads.handlers.collapse", nil, "nonut", "disabled" ) -- first time
appendaction("math", "normalizers", "noads.handlers.numbers", nil, "nonut", "disabled" )
appendaction("math", "normalizers", "noads.handlers.spacing", nil, "nonut", "disabled" )
appendaction("math", "normalizers", "noads.handlers.fencing", nil, "nonut", "disabled" )
@@ -108,7 +108,7 @@ appendaction("math", "normalizers", "noads.handlers.relocate",
appendaction("math", "normalizers", "noads.handlers.variants", nil, "nonut", "enabled" )
appendaction("math", "normalizers", "noads.handlers.families", nil, "nonut", "enabled" )
appendaction("math", "normalizers", "noads.handlers.render", nil, "nonut", "enabled" )
-------------("math", "normalizers", "noads.handlers.collapse", nil, "nonut", "disabled" )
+appendaction("math", "normalizers", "noads.handlers.collapse", nil, "nonut", "disabled" ) -- second time
appendaction("math", "normalizers", "noads.handlers.fixscripts", nil, "nonut", "enabled" )
------------("math", "normalizers", "noads.handlers.domains", nil, "nonut", "disabled" )
appendaction("math", "normalizers", "noads.handlers.autofences", nil, "nonut", "disabled" )
diff --git a/tex/context/base/mkxl/type-set.mkxl b/tex/context/base/mkxl/type-set.mkxl
index 7eec5cc60..2425d8538 100644
--- a/tex/context/base/mkxl/type-set.mkxl
+++ b/tex/context/base/mkxl/type-set.mkxl
@@ -99,8 +99,6 @@
\definefilesynonym [type-imp-corbel.mkiv] [type-imp-cleartype.mkiv]
\definefilesynonym [type-imp-calibri.mkiv] [type-imp-cleartype.mkiv]
-\definefilesynonym [type-imp-antykwa-poltawskiego.mkiv] [type-imp-antykwapoltawskiego.mkiv]
-
%definefilesynonym [type-imp-mac.mkiv] [type-imp-osx.mkiv]
%definefilesynonym [type-imp-win.mkiv] [type-imp-mscore.mkiv]
@@ -168,4 +166,18 @@
\definefilesynonym [type-imp-concrete-nt.mkiv] [type-imp-concrete.mkiv]
\definefilesynonym [type-imp-xcharter-nt.mkiv] [type-imp-xcharter.mkiv]
+\definefilesynonym [type-imp-antykwa-poltawskiego.mkiv] [type-imp-antykwapoltawskiego.mkiv]
+
+\definefilesynonym [type-imp-iwona-light.mkiv] [type-imp-iwona.mkiv]
+\definefilesynonym [type-imp-iwona-medium.mkiv] [type-imp-iwona.mkiv]
+\definefilesynonym [type-imp-iwona-heavy.mkiv] [type-imp-iwona.mkiv]
+
+\definefilesynonym [type-imp-kurier-light.mkiv] [type-imp-kurier.mkiv]
+\definefilesynonym [type-imp-kurier-medium.mkiv] [type-imp-kurier.mkiv]
+\definefilesynonym [type-imp-kurier-heavy.mkiv] [type-imp-kurier.mkiv]
+
+\definefilesynonym [type-imp-antykwa-torunska-light.mkiv] [type-imp-antykwa.mkiv]
+\definefilesynonym [type-imp-antykwa-torunska-cond.mkiv] [type-imp-antykwa.mkiv]
+\definefilesynonym [type-imp-antykwa-torunska-lightcond.mkiv] [type-imp-antykwa.mkiv]
+
\protect \endinput
diff --git a/tex/context/fonts/mkiv/antykwa-math.lfg b/tex/context/fonts/mkiv/antykwa-math.lfg
index 112a3f9a7..fe259e909 100644
--- a/tex/context/fonts/mkiv/antykwa-math.lfg
+++ b/tex/context/fonts/mkiv/antykwa-math.lfg
@@ -1,5 +1,23 @@
-local msam = { name = "msam10.tfm", vector = "tex-ma" }
-local msbm = { name = "msbm10.tfm", vector = "tex-mb" }
+local badones = {
+ summationtext = .25,
+ producttext = .25,
+ integraltext = .25,
+ uniontext = .25,
+ intersectiontext = .25,
+ unionmultitext = .25,
+ logicalandtext = .25,
+ logicalortext = .25,
+ summationdisplay = .25,
+ productdisplay = .25,
+ integraldisplay = .25,
+ uniondisplay = .25,
+ intersectiondisplay = .25,
+ unionmultidisplay = .25,
+ logicalanddisplay = .25,
+ logicalordisplay = .25,
+ coproducttext = .25,
+ coproductdisplay = .25,
+}
return {
name = "antykwa-math",
@@ -17,40 +35,48 @@ return {
},
virtuals = {
["antykwa-math"] = {
- { name = "file:AntykwaTorunska-Regular", features = "virtualmath", main = true },
+ { name = "file:LatinModern-Math", features = "virtualmath-antykwa", main = true, parameters = false },
+ --
+ { name = "rm-anttr.tfm", vector = "tex-mr", skewchar=0x7F },
{ name = "mi-anttri.tfm", vector = "tex-mi", skewchar=0x7F },
{ name = "mi-anttri.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "sy-anttrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } ,
- { name = "ex-anttr.tfm", vector = "tex-ex", extension = true } ,
- msam,
- msbm,
+ { name = "mi-anttbi.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-anttb.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-anttrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-anttr.tfm", vector = "tex-ex", extension = true, badones = badones },
},
["antykwa-light-math"] = {
- { name = "file:AntykwaTorunskaLight-Regular", features = "virtualmath", main = true },
+ { name = "file:LatinModern-Math", features = "virtualmath-antykwa-light", main = true, parameters = false },
+ --
+ { name = "rm-anttl.tfm", vector = "tex-mr", skewchar=0x7F },
{ name = "mi-anttli.tfm", vector = "tex-mi", skewchar=0x7F },
{ name = "mi-anttli.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "sy-anttlz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } ,
- { name = "ex-anttl.tfm", vector = "tex-ex", extension = true } ,
- msam,
- msbm,
+ { name = "mi-anttri.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-anttr.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-anttlz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-anttl.tfm", vector = "tex-ex", extension = true, badones = badones },
},
["antykwa-cond-math"] = {
- { name = "file:AntykwaTorunskaCond-Regular", features = "virtualmath", main = true },
+ { name = "file:LatinModern-Math", features = "virtualmath-antykwa-cond", main = true, parameters = false },
+ --
+ { name = "rm-anttcr.tfm", vector = "tex-mr", skewchar=0x7F },
{ name = "mi-anttcri.tfm", vector = "tex-mi", skewchar=0x7F },
{ name = "mi-anttcri.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "sy-anttcrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } ,
- { name = "ex-anttcr.tfm", vector = "tex-ex", extension = true } ,
- msam,
- msbm,
+ { name = "mi-anttcbi.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-anttcb.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-anttcrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-anttcr.tfm", vector = "tex-ex", extension = true, badones = badones },
},
["antykwa-lightcond-math"] = {
- { name = "file:AntykwaTorunskaCondLight-Regular", features = "virtualmath", main = true },
+ { name = "file:LatinModern-Math", features = "virtualmath-antykwa-lightcond", main = true, parameters = false },
+ --
+ { name = "rm-anttcl.tfm", vector = "tex-mr", skewchar=0x7F },
{ name = "mi-anttcli.tfm", vector = "tex-mi", skewchar=0x7F },
{ name = "mi-anttcli.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "sy-anttclz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } ,
- { name = "ex-anttcl.tfm", vector = "tex-ex", extension = true } ,
- msam,
- msbm,
+ { name = "mi-anttcri.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-anttcr.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-anttclz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-anttcl.tfm", vector = "tex-ex", extension = true, badones = badones },
}
}
}
diff --git a/tex/context/fonts/mkiv/bonum-math.lfg b/tex/context/fonts/mkiv/bonum-math.lfg
index 30a49da80..e3fd4119d 100644
--- a/tex/context/fonts/mkiv/bonum-math.lfg
+++ b/tex/context/fonts/mkiv/bonum-math.lfg
@@ -204,6 +204,13 @@ return {
},
},
{
+ -- The v could have a bit more sidebearing
+ tweak = "dimensions",
+ list = {
+ ["0x1D463"] = { width = 1.075, }, -- italic v
+ },
+ },
+ {
tweak = "addprivates",
},
{
@@ -300,4 +307,4 @@ return {
1, 3, 5, 7
},
},
-} \ No newline at end of file
+}
diff --git a/tex/context/fonts/mkiv/cambria-math.lfg b/tex/context/fonts/mkiv/cambria-math.lfg
index 84c4d0070..a855a2513 100644
--- a/tex/context/fonts/mkiv/cambria-math.lfg
+++ b/tex/context/fonts/mkiv/cambria-math.lfg
@@ -32,6 +32,7 @@ return {
presets.moveitalics { correct = true, letters = true },
presets.moveintegrals { factor = 1.5}, -- needs checking
presets.wipeitalics { },
+ presets.pagellaradical { },
{
tweak = "simplifykerns",
},
@@ -89,9 +90,9 @@ return {
{
tweak = "dimensions",
list = {
- [0x00302] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widehat
- [0x00303] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widetilde
- [0x00306] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widebreve
+ [0x00302] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widehat
+ [0x00303] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widetilde
+ [0x00306] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widebreve
[0x0030C] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widecheck
},
},
diff --git a/tex/context/fonts/mkiv/common-math.lfg b/tex/context/fonts/mkiv/common-math.lfg
index 5074c83ec..45e46d865 100644
--- a/tex/context/fonts/mkiv/common-math.lfg
+++ b/tex/context/fonts/mkiv/common-math.lfg
@@ -275,6 +275,32 @@ return {
},
}
end,
+ pagellaradical = function(parameters)
+ return {
+ tweak = "tweaks",
+ feature = "pagellaradical",
+ list = {
+ {
+ tweak = "replacealphabets",
+ list = {
+ {
+ source = { first = 0x0221A }, -- sqrt
+ filename = "texgyrepagella-math.otf",
+ inherit = {
+ RadicalRuleThickness = true,
+ },
+ },
+ },
+ },
+ -- {
+ -- tweak = "parameters",
+ -- list = {
+ -- RadicalRuleThickness = 122.88, -- 60*2048/1000
+ -- },
+ -- },
+ },
+ }
+ end,
},
},
},
diff --git a/tex/context/fonts/mkiv/iwona-math.lfg b/tex/context/fonts/mkiv/iwona-math.lfg
index f2fb69341..bc402ea33 100644
--- a/tex/context/fonts/mkiv/iwona-math.lfg
+++ b/tex/context/fonts/mkiv/iwona-math.lfg
@@ -1,5 +1,23 @@
-local msam = { name = "msam10.tfm", vector = "tex-ma" }
-local msbm = { name = "msbm10.tfm", vector = "tex-mb" }
+local badones = {
+ summationtext = .25,
+ producttext = .25,
+ integraltext = .25,
+ uniontext = .25,
+ intersectiontext = .25,
+ unionmultitext = .25,
+ logicalandtext = .25,
+ logicalortext = .25,
+ summationdisplay = .25,
+ productdisplay = .25,
+ integraldisplay = .25,
+ uniondisplay = .25,
+ intersectiondisplay = .25,
+ unionmultidisplay = .25,
+ logicalanddisplay = .25,
+ logicalordisplay = .25,
+ coproducttext = .25,
+ coproductdisplay = .25,
+}
return {
name = "iwona-math",
@@ -17,41 +35,49 @@ return {
},
virtuals = {
["iwona-math"] = {
- { name = "file:Iwona-Regular", features = "virtualmath", main = true },
+ { name = "file:LatinModern-Math", features = "virtualmath-iwona", main = true, parameters = false },
+ --
+ { name = "rm-iwonar.tfm", vector = "tex-mr", skewchar=0x7F },
{ name = "mi-iwonari.tfm", vector = "tex-mi", skewchar=0x7F },
{ name = "mi-iwonari.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "sy-iwonarz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } ,
- { name = "ex-iwonar.tfm", vector = "tex-ex", extension = true } ,
- msam,
- msbm,
+ { name = "mi-iwonami.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-iwonam.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-iwonarz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-iwonar.tfm", vector = "tex-ex", extension = true, badones = badones },
},
["iwona-light-math"] = {
- { name = "file:IwonaLight-Regular", features = "virtualmath", main = true },
+ { name = "file:LatinModern-Math", features = "virtualmath-iwona-light", main = true, parameters = false },
+ --
+ { name = "rm-iwonal.tfm", vector = "tex-mr", skewchar=0x7F },
{ name = "mi-iwonali.tfm", vector = "tex-mi", skewchar=0x7F },
{ name = "mi-iwonali.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "sy-iwonalz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } ,
- { name = "ex-iwonal.tfm", vector = "tex-ex", extension = true } ,
- msam,
- msbm,
+ { name = "mi-iwonari.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-iwonar.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-iwonalz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-iwonal.tfm", vector = "tex-ex", extension = true, badones = badones },
},
["iwona-medium-math"] = {
- { name = "file:IwonaMedium-Regular", features = "virtualmath", main = true },
+ { name = "file:LatinModern-Math", features = "virtualmath-iwona-medium", main = true, parameters = false },
+ --
+ { name = "rm-iwonam.tfm", vector = "tex-mr", skewchar=0x7F },
{ name = "mi-iwonami.tfm", vector = "tex-mi", skewchar=0x7F },
{ name = "mi-iwonami.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "sy-iwonamz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } ,
- { name = "ex-iwonam.tfm", vector = "tex-ex", extension = true } ,
- msam,
- msbm,
+ { name = "mi-iwonabi.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-iwonab.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-iwonamz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-iwonam.tfm", vector = "tex-ex", extension = true, badones = badones },
},
["iwona-heavy-math"] = {
- { name = "file:IwonaHeavy-Regular", features = "virtualmath", main = true },
+ { name = "file:LatinModern-Math", features = "virtualmath-iwona-heavy", main = true, parameters = false },
+ --
+ { name = "rm-iwonah.tfm", vector = "tex-mr", skewchar=0x7F },
{ name = "mi-iwonahi.tfm", vector = "tex-mi", skewchar=0x7F },
{ name = "mi-iwonahi.tfm", vector = "tex-it", skewchar=0x7F },
- { name = "sy-iwonahz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } ,
- { name = "ex-iwonah.tfm", vector = "tex-ex", extension = true } ,
- msam,
- msbm,
+ { name = "mi-iwonahi.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-iwonah.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-iwonahz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-iwonah.tfm", vector = "tex-ex", extension = true, badones = badones },
}
- }
+ },
}
}
diff --git a/tex/context/fonts/mkiv/kurier-math.lfg b/tex/context/fonts/mkiv/kurier-math.lfg
new file mode 100644
index 000000000..bee2e08e4
--- /dev/null
+++ b/tex/context/fonts/mkiv/kurier-math.lfg
@@ -0,0 +1,83 @@
+local badones = {
+ summationtext = .25,
+ producttext = .25,
+ integraltext = .25,
+ uniontext = .25,
+ intersectiontext = .25,
+ unionmultitext = .25,
+ logicalandtext = .25,
+ logicalortext = .25,
+ summationdisplay = .25,
+ productdisplay = .25,
+ integraldisplay = .25,
+ uniondisplay = .25,
+ intersectiondisplay = .25,
+ unionmultidisplay = .25,
+ logicalanddisplay = .25,
+ logicalordisplay = .25,
+ coproducttext = .25,
+ coproductdisplay = .25,
+}
+
+return {
+ name = "kurier-math",
+ version = "1.00",
+ comment = "Goodies that complement kurier math.",
+ author = "Hans Hagen",
+ copyright = "ConTeXt development team",
+ mathematics = {
+ mapfiles = {
+ "kurier-rm.map",
+ "kurier-mi.map",
+ "kurier-sy.map",
+ "kurier-ex.map",
+ "mkiv-base.map",
+ },
+ virtuals = {
+ ["kurier-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-kurier", main = true, parameters = false },
+ --
+ { name = "rm-kurierr.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-kurierri.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-kurierri.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-kuriermi.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-kurierm.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-kurierrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-kurierr.tfm", vector = "tex-ex", extension = true, badones = badones },
+ },
+ ["kurier-light-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-kurier-light", main = true, parameters = false },
+ --
+ { name = "rm-kurierl.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-kurierli.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-kurierli.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-kurierri.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-kurierr.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-kurierlz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-kurierl.tfm", vector = "tex-ex", extension = true, badones = badones },
+ },
+ ["kurier-medium-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-kurier-medium", main = true, parameters = false },
+ --
+ { name = "rm-kurierm.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-kuriermi.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-kuriermi.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-kurierhi.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-kurierh.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-kuriermz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-kurierm.tfm", vector = "tex-ex", extension = true, badones = badones },
+ },
+ ["kurier-heavy-math"] = {
+ { name = "file:LatinModern-Math", features = "virtualmath-kurier-heavy", main = true, parameters = false },
+ --
+ { name = "rm-kurierh.tfm", vector = "tex-mr", skewchar=0x7F },
+ { name = "mi-kurierhi.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-kurierhi.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "mi-kurierhi.tfm", vector = "tex-bi", skewchar=0x7F },
+ { name = "rm-kurierh.tfm", vector = "tex-bf", skewchar=0x7F },
+ { name = "sy-kurierhz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "ex-kurierh.tfm", vector = "tex-ex", extension = true, badones = badones },
+ }
+ },
+ }
+}
diff --git a/tex/context/fonts/mkiv/modern-math.lfg b/tex/context/fonts/mkiv/modern-math.lfg
index fadd13da7..4af740789 100644
--- a/tex/context/fonts/mkiv/modern-math.lfg
+++ b/tex/context/fonts/mkiv/modern-math.lfg
@@ -219,7 +219,7 @@ return {
["0x7D.variants.*"] = { topright = -0.25, bottomright = -0.25 }, -- right brace variants
["0x29.parts.top"] = { topright = -0.3, }, -- right parenthesis top
["0x29.parts.bottom"] = { bottomright = -0.3 }, -- right parenthesis bottom
- ["0x29.variants.*"] = { topright = -0.25, bottomright = -0.25 }, -- right parenthesis variants
+ ["0x29.variants.*"] = { topright = -0.15, bottomright = -0.15 }, -- right parenthesis variants
["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top
["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom
["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants
diff --git a/tex/context/fonts/mkiv/newcomputermodern-math.lfg b/tex/context/fonts/mkiv/newcomputermodern-math.lfg
index 4eb557221..cae69aecc 100644
--- a/tex/context/fonts/mkiv/newcomputermodern-math.lfg
+++ b/tex/context/fonts/mkiv/newcomputermodern-math.lfg
@@ -101,9 +101,9 @@ return {
["0x7D.parts.top"] = { topright = -0.25 }, -- right brace top
["0x7D.parts.bottom"] = { bottomright = -0.25 }, -- right brace bottom
["0x7D.variants.*"] = { topright = -0.25, bottomright = -0.25 }, -- right brace variants
- ["0x29.parts.top"] = { topright = -0.3, }, -- right parenthesis top
+ ["0x29.parts.top"] = { topright = -0.3, }, -- right parenthesis top
["0x29.parts.bottom"] = { bottomright = -0.3 }, -- right parenthesis bottom
- ["0x29.variants.*"] = { topright = -0.25, bottomright = -0.25 }, -- right parenthesis variants
+ ["0x29.variants.*"] = { topright = -0.15, bottomright = -0.15 }, -- right parenthesis variants
["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top
["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom
["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants
diff --git a/tex/context/fonts/mkiv/type-imp-antykwa.mkiv b/tex/context/fonts/mkiv/type-imp-antykwa.mkiv
index ba5895c8e..15a2f39b6 100644
--- a/tex/context/fonts/mkiv/type-imp-antykwa.mkiv
+++ b/tex/context/fonts/mkiv/type-imp-antykwa.mkiv
@@ -3,7 +3,7 @@
%D version=2010.06.21,
%D title=\CONTEXT\ Typescript Macros,
%D subtitle=Antykwa Torunska,
-%D author=Mojca Miklavec \& Hans Hagen,
+%D author=Mojca Miklavec \& Hans Hagen \& Mikael Sundqvist,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
@@ -13,7 +13,12 @@
\starttypescriptcollection[antykwa-torunska]
- \starttypescript [antykwa,antykwa-torunska,antykwa-torunska-light,antykwa-torunska-cond,antykwa-torunska-lightcond]
+ \definefontfeature[virtualmath-antykwa] [virtualmath][virtualweight=antykwa]
+ \definefontfeature[virtualmath-antykwa-cond] [virtualmath][virtualweight=antykwa-cond]
+ \definefontfeature[virtualmath-antykwa-light] [virtualmath][virtualweight=antykwa-light]
+ \definefontfeature[virtualmath-antykwa-lightcond][virtualmath][virtualweight=antykwa-lightcond]
+
+ \starttypescript [antykwa,antykwa-torunska,antykwa-light,antykwa-torunska-light,antykwa-cond,antykwa-torunska-cond,antykwa-lightcond,antykwa-torunska-lightcond]
\definetypeface[\typescriptone][\s!rm][\s!serif][\typescriptone] [\s!default]
\definetypeface[\typescriptone][\s!ss][\s!sans] [modern] [\s!default] [\s!rscale=1.05]
\definetypeface[\typescriptone][\s!tt][\s!mono] [modern] [\s!default] [\s!rscale=1.05]
@@ -21,7 +26,7 @@
\quittypescriptscanning
\stoptypescript
- \starttypescript [\s!serif] [antykwa,antykwa-torunska,antykwa-torunska-light,antykwa-torunska-cond,antykwa-torunska-lightcond]
+ \starttypescript [\s!serif] [antykwa,antykwa-torunska,antykwa-light,antykwa-torunska-light,antykwa-cond,antykwa-torunska-cond,antykwa-lightcond,antykwa-torunska-lightcond]
\definefontsynonym [AntykwaTorunska-Regular] [\s!file:AntykwaTorunska-Regular] [\s!features=\s!default]
\definefontsynonym [AntykwaTorunska-Italic] [\s!file:AntykwaTorunska-Italic] [\s!features=\s!default]
\definefontsynonym [AntykwaTorunska-Bold] [\s!file:AntykwaTorunska-Bold] [\s!features=\s!default]
@@ -62,17 +67,17 @@
\definefontsynonym[\s!MathRoman][antykwamath@antykwa-math]
\stoptypescript
- \starttypescript [\s!math][antykwa-torunska-light][\s!all]
+ \starttypescript [\s!math][antykwa-light,antykwa-torunska-light][\s!all]
\loadfontgoodies[antykwa-math]
\definefontsynonym[\s!MathRoman][antykwalightmath@antykwa-light-math]
\stoptypescript
- \starttypescript [\s!math][antykwa-torunska-cond][\s!all]
+ \starttypescript [\s!math][antykwa-cond,antykwa-torunska-cond][\s!all]
\loadfontgoodies[antykwa-math]
\definefontsynonym[\s!MathRoman][antykwacondmath@antykwa-cond-math]
\stoptypescript
- \starttypescript [\s!math][antykwa-torunska-lightcond][\s!all]
+ \starttypescript [\s!math][antykwa-lightcond,antykwa-torunska-lightcond][\s!all]
\loadfontgoodies[antykwa-math]
\definefontsynonym[\s!MathRoman][antykwalightcondmath@antykwa-lightcond-math]
\stoptypescript
@@ -87,7 +92,7 @@
\definefontsynonym [\s!SerifCaps] [AntykwaTorunska-Cap]
\stoptypescript
- \starttypescript [\s!serif] [antykwa-torunska-light] [\s!name]
+ \starttypescript [\s!serif] [antykwa-light,antykwa-torunska-light] [\s!name]
\definefontsynonym [\s!Serif] [AntykwaTorunska-Light]
\definefontsynonym [\s!SerifBold] [AntykwaTorunska-Medium]
\definefontsynonym [\s!SerifItalic] [AntykwaTorunska-LightItalic]
@@ -97,7 +102,7 @@
\definefontsynonym [\s!SerifCaps] [AntykwaTorunska-LightCap]
\stoptypescript
- \starttypescript [\s!serif] [antykwa-torunska-cond] [\s!name]
+ \starttypescript [\s!serif] [antykwa-cond,antykwa-torunska-cond] [\s!name]
\definefontsynonym [\s!Serif] [AntykwaTorunska-CondRegular]
\definefontsynonym [\s!SerifBold] [AntykwaTorunska-CondBold]
\definefontsynonym [\s!SerifItalic] [AntykwaTorunska-CondItalic]
@@ -107,7 +112,7 @@
\definefontsynonym [\s!SerifCaps] [AntykwaTorunska-CondCap]
\stoptypescript
- \starttypescript [\s!serif] [antykwa-torunska-lightcond] [\s!name]
+ \starttypescript [\s!serif] [antykwa-lightcond,antykwa-torunska-lightcond] [\s!name]
\definefontsynonym [\s!Serif] [AntykwaTorunska-CondLight]
\definefontsynonym [\s!SerifBold] [AntykwaTorunska-CondMedium]
\definefontsynonym [\s!SerifItalic] [AntykwaTorunska-CondLightItalic]
@@ -144,7 +149,7 @@
\definefontsynonym [SerifCapsCond] [AntykwaTorunska-CondCap]
\stoptypescript
- \starttypescript [\s!serif] [antykwa-torunska-light] [\s!name]
+ \starttypescript [\s!serif] [antykwa-light,antykwa-torunska-light] [\s!name]
\definefontsynonym [SerifRegular] [Serif]
\definefontsynonym [SerifRegularCaps] [AntykwaTorunska-LightCap]
\definefontsynonym [SerifBoldCaps] [AntykwaTorunska-MediumCap]
@@ -171,7 +176,7 @@
\definefontsynonym [SerifCapsCond] [AntykwaTorunska-CondLightCap]
\stoptypescript
- \starttypescript [\s!serif] [antykwa-torunska-cond] [\s!name]
+ \starttypescript [\s!serif] [antykwa-cond,antykwa-torunska-cond] [\s!name]
\definefontsynonym [SerifRegular] [Serif]
\definefontsynonym [SerifRegularCaps] [AntykwaTorunska-CondCap]
\definefontsynonym [SerifBoldCaps] [AntykwaTorunska-CondBoldCap]
@@ -198,7 +203,7 @@
\definefontsynonym [SerifCapsExp] [AntykwaTorunska-Cap]
\stoptypescript
- \starttypescript [\s!serif] [antykwa-torunska-lightcond] [\s!name]
+ \starttypescript [\s!serif] [antykwa-lightcond,antykwa-torunska-lightcond] [\s!name]
\definefontsynonym [SerifRegular] [Serif]
\definefontsynonym [SerifRegularCaps] [AntykwaTorunska-CondLightCap]
\definefontsynonym [SerifBoldCaps] [AntykwaTorunska-CondMediumCap]
diff --git a/tex/context/fonts/mkiv/type-imp-iwona.mkiv b/tex/context/fonts/mkiv/type-imp-iwona.mkiv
index 88cb7e719..8b67b7be9 100644
--- a/tex/context/fonts/mkiv/type-imp-iwona.mkiv
+++ b/tex/context/fonts/mkiv/type-imp-iwona.mkiv
@@ -3,7 +3,7 @@
%D version=2010.06.21,
%D title=\CONTEXT\ Typescript Macros,
%D subtitle=Iwona,
-%D author=Mojca Miklavec \& Hans Hagen,
+%D author=Mojca Miklavec \& Hans Hagen \& Mikael Sundqvist,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
@@ -13,10 +13,10 @@
\starttypescriptcollection[iwona]
- % maybe this will change in Iwona-Math-Letters and Iwona-Math-Letters-Italic
-
- % These names are a depressing mess. They have changed over time and are
- % still not consistent. I'd expect Bold-Regular and Bold-Italic.
+ \definefontfeature[virtualmath-iwona] [virtualmath][virtualweight=iwona]
+ \definefontfeature[virtualmath-iwona-light] [virtualmath][virtualweight=iwona-light]
+ \definefontfeature[virtualmath-iwona-medium][virtualmath][virtualweight=iwona-medium]
+ \definefontfeature[virtualmath-iwona-heavy] [virtualmath][virtualweight=iwona-heavy]
\starttypescript [\s!sans] [iwona-light,iwona,iwona-medium,iwona-heavy,iwona-light-cond,iwona-cond,iwona-medium-cond,iwona-heavy-cond]
@@ -31,17 +31,6 @@
\definefontsynonym [Iwona-Heavy-Regular] [\s!file:IwonaHeavy-Regular] [\s!features=\s!default]
\definefontsynonym [Iwona-Heavy-Italic] [\s!file:IwonaHeavy-Italic] [\s!features=\s!default]
- \definefontsynonym [Iwona-CapsRegular] [\s!file:Iwona-Regular] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsItalic] [\s!file:Iwona-Italic] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsBold] [\s!file:Iwona-Bold] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsBoldItalic] [\s!file:Iwona-BoldItalic] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsLight] [\s!file:IwonaLight-Regular] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsLight-Italic] [\s!file:IwonaLight-Italic] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsMedium] [\s!file:IwonaMedium-Regular] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsMedium-Italic] [\s!file:IwonaMedium-Italic] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsHeavy] [\s!file:IwonaHeavy-Regular] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsHeavy-Italic] [\s!file:IwonaHeavy-Italic] [\s!features=\s!smallcaps]
-
\definefontsynonym [Iwona-CondRegular] [\s!file:IwonaCond-Regular] [\s!features=\s!default]
\definefontsynonym [Iwona-CondItalic] [\s!file:IwonaCond-Italic] [\s!features=\s!default]
\definefontsynonym [Iwona-CondBold] [\s!file:IwonaCond-Bold] [\s!features=\s!default]
@@ -53,29 +42,18 @@
\definefontsynonym [Iwona-CondHeavy-Regular] [\s!file:IwonaCondHeavy-Regular] [\s!features=\s!default]
\definefontsynonym [Iwona-CondHeavy-Italic] [\s!file:IwonaCondHeavy-Italic] [\s!features=\s!default]
- \definefontsynonym [Iwona-CapsCondRegular] [\s!file:IwonaCond-Regular] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsCondItalic] [\s!file:IwonaCond-Italic] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsCondBold] [\s!file:IwonaCond-Bold] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsCondBoldItalic] [\s!file:IwonaCond-BoldItalic] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsCondLight-Regular] [\s!file:IwonaCondLight-Regular] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsCondLight-Italic] [\s!file:IwonaCondLight-Italic] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsCondMedium-Regular][\s!file:IwonaCondMedium-Regular] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsCondMedium-Italic] [\s!file:IwonaCondMedium-Italic] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsCondHeavy-Regular] [\s!file:IwonaCondHeavy-Regular] [\s!features=\s!smallcaps]
- \definefontsynonym [Iwona-CapsCondHeavy-Italic] [\s!file:IwonaCondHeavy-Italic] [\s!features=\s!smallcaps]
-
\stoptypescript
% [all] is redundant
\starttypescript [\s!math][iwona][\s!all]
- \definefontsynonym[\s!MathRoman][iwonamath@iwona-math]
+ \definefontsynonym[\s!MathRoman] [iwonamath@iwona-math]
\stoptypescript
\starttypescript [\s!math][iwona-light][\s!all]
- \definefontsynonym[\s!MathRoman][iwonalightmath@iwona-light-math]
+ \definefontsynonym[\s!MathRoman] [iwonalightmath@iwona-light-math]
\stoptypescript
\starttypescript [\s!math][iwona-medium][\s!all]
- \definefontsynonym[\s!MathRoman][iwonamediummath@iwona-medium-math]
+ \definefontsynonym[\s!MathRoman] [iwonamediummath@iwona-medium-math]
\stoptypescript
\starttypescript [\s!math][iwona-heavy][\s!all]
\definefontsynonym[\s!MathRoman][iwonaheavymath@iwona-heavy-math]
@@ -91,18 +69,6 @@
\definefontsynonym [\s!SansItalic] [Iwona-Light-Italic]
\definefontsynonym [\s!SansBold] [Iwona-Medium-Regular]
\definefontsynonym [\s!SansBoldItalic] [Iwona-Medium-Italic]
- \definefontsynonym [SansCaps] [Iwona-CapsLight]
- \definefontsynonym [SansItalicCaps] [Iwona-CapsLightItalic]
- \definefontsynonym [SansBoldCaps] [Iwona-CapsMedium]
- \definefontsynonym [SansBoldItalicCaps] [Iwona-CapsMediumItalic]
- \stoptypescript
-
- \starttypescript [\s!sans] [iwona-light-caps] [\s!name]
- \setups[\s!font:\s!fallback:\s!sans]
- \definefontsynonym [\s!Sans] [Iwona-CapsLight-Regular]
- \definefontsynonym [\s!SansItalic] [Iwona-CapsLight-Italic]
- \definefontsynonym [\s!SansBold] [Iwona-CapsMedium-Regular]
- \definefontsynonym [\s!SansBoldItalic] [Iwona-CapsMedium-Italic]
\stoptypescript
\starttypescript [\s!sans] [iwona] [\s!name]
@@ -111,18 +77,6 @@
\definefontsynonym [\s!SansItalic] [Iwona-Italic]
\definefontsynonym [\s!SansBold] [Iwona-Bold]
\definefontsynonym [\s!SansBoldItalic] [Iwona-BoldItalic]
- \definefontsynonym [SansCaps] [Iwona-CapsRegular]
- \definefontsynonym [SansItalicCaps] [Iwona-CapsItalic]
- \definefontsynonym [SansBoldCaps] [Iwona-CapsBold]
- \definefontsynonym [SansBoldItalicCaps] [Iwona-CapsBoldItalic]
- \stoptypescript
-
- \starttypescript [\s!sans] [iwona-caps] [\s!name]
- \setups[\s!font:\s!fallback:\s!sans]
- \definefontsynonym [\s!Sans] [Iwona-CapsRegular]
- \definefontsynonym [\s!SansItalic] [Iwona-CapsItalic]
- \definefontsynonym [\s!SansBold] [Iwona-CapsBold]
- \definefontsynonym [\s!SansBoldItalic] [Iwona-CapsBoldItalic]
\stoptypescript
\starttypescript [\s!sans] [iwona-medium] [\s!name]
@@ -131,18 +85,6 @@
\definefontsynonym [\s!SansItalic] [Iwona-Medium-Italic]
\definefontsynonym [\s!SansBold] [Iwona-Heavy-Regular]
\definefontsynonym [\s!SansBoldItalic] [Iwona-Heavy-Italic]
- \definefontsynonym [SansCaps] [Iwona-CapsHeavy-Regular]
- \definefontsynonym [SansItalicCaps] [Iwona-CapsMedium-Italic]
- \definefontsynonym [SansBoldCaps] [Iwona-CapsHeavy-Regular]
- \definefontsynonym [SansBoldItalicCaps] [Iwona-CapsHeavy-Italic]
- \stoptypescript
-
- \starttypescript [\s!sans] [iwona-medium-caps] [\s!name]
- \setups[\s!font:\s!fallback:\s!sans]
- \definefontsynonym [\s!Sans] [Iwona-CapsHeavy-Regular]
- \definefontsynonym [\s!SansItalic] [Iwona-CapsMedium-Italic]
- \definefontsynonym [\s!SansBold] [Iwona-CapsHeavy-Regular]
- \definefontsynonym [\s!SansBoldItalic] [Iwona-CapsHeavy-Italic]
\stoptypescript
\starttypescript [\s!sans] [iwona-heavy] [\s!name]
@@ -151,18 +93,6 @@
\definefontsynonym [\s!SansItalic] [Iwona-Heavy-Italic]
\definefontsynonym [\s!SansBold] [Iwona-Heavy-Regular]
\definefontsynonym [\s!SansBoldItalic] [Iwona-Heavy-Italic]
- \definefontsynonym [SansCaps] [Iwona-CapsHeavy-Regular]
- \definefontsynonym [SansItalicCaps] [Iwona-CapsHeavy-Italic]
- \definefontsynonym [SansBoldCaps] [Iwona-CapsHeavy-Regular]
- \definefontsynonym [SansBoldItalicCaps] [Iwona-CapsHeavy-Italic]
- \stoptypescript
-
- \starttypescript [\s!sans] [iwona-heavy-caps] [\s!name]
- \setups[\s!font:\s!fallback:\s!sans]
- \definefontsynonym [SansCaps] [Iwona-CapsHeavy-Regular]
- \definefontsynonym [SansItalicCaps] [Iwona-CapsHeavy-Italic]
- \definefontsynonym [SansBoldCaps] [Iwona-CapsHeavy-Regular]
- \definefontsynonym [SansBoldItalicCaps] [Iwona-CapsHeavy-Italic]
\stoptypescript
\starttypescript [\s!sans] [iwona-light-cond] [\s!name]
@@ -171,19 +101,8 @@
\definefontsynonym [\s!SansItalic] [Iwona-CondLight-Italic]
\definefontsynonym [\s!SansBold] [Iwona-CondMedium-Regular]
\definefontsynonym [\s!SansBoldItalic] [Iwona-CondMedium-Italic]
- \definefontsynonym [SansCaps] [Iwona-CapsCondLight-Regular]
- \definefontsynonym [SansItalicCaps] [Iwona-CapsCondLight-Italic]
- \definefontsynonym [SansBoldCaps] [Iwona-CapsCondMedium-Regular]
- \definefontsynonym [SansBoldItalicCaps] [Iwona-CapsCondMedium-Italic]
\stoptypescript
- \starttypescript [\s!sans] [iwona-light-cond-caps,iwona-light-caps-cond] [\s!name]
- \setups[\s!font:\s!fallback:\s!sans]
- \definefontsynonym [\s!Sans] [Iwona-CapsCondLight-Regular]
- \definefontsynonym [\s!SansItalic] [Iwona-CapsCondLight-Italic]
- \definefontsynonym [\s!SansBold] [Iwona-CapsCondMedium-Regular]
- \definefontsynonym [\s!SansBoldItalic] [Iwona-CapsCondMedium-Italic]
- \stoptypescript
\starttypescript [\s!sans] [iwona-cond] [\s!name]
\setups[\s!font:\s!fallback:\s!sans]
@@ -191,18 +110,6 @@
\definefontsynonym [\s!SansItalic] [Iwona-CondItalic]
\definefontsynonym [\s!SansBold] [Iwona-CondBold]
\definefontsynonym [\s!SansBoldItalic] [Iwona-CondBoldItalic]
- \definefontsynonym [SansCaps] [Iwona-CapsCondRegular]
- \definefontsynonym [SansItalicCaps] [Iwona-CapsCondItalic]
- \definefontsynonym [SansBoldCaps] [Iwona-CapsCondBold]
- \definefontsynonym [SansBoldItalicCaps] [Iwona-CapsCondBoldItalic]
- \stoptypescript
-
- \starttypescript [\s!sans] [iwona-cond-caps,iwona-caps-cond] [\s!name]
- \setups[\s!font:\s!fallback:\s!sans]
- \definefontsynonym [\s!Sans] [Iwona-CapsCondRegular]
- \definefontsynonym [\s!SansItalic] [Iwona-CapsCondItalic]
- \definefontsynonym [\s!SansBold] [Iwona-CapsCondBold]
- \definefontsynonym [\s!SansBoldItalic] [Iwona-CapsCondBoldItalic]
\stoptypescript
\starttypescript [\s!sans] [iwona-medium-cond] [\s!name]
@@ -211,18 +118,6 @@
\definefontsynonym [\s!SansItalic] [Iwona-CondMedium-Italic]
\definefontsynonym [\s!SansBold] [Iwona-CondHeavy-Regular]
\definefontsynonym [\s!SansBoldItalic] [Iwona-CondHeavy-Italic]
- \definefontsynonym [SansCaps] [Iwona-CapsCondHeavy-Regular]
- \definefontsynonym [SansItalicCaps] [Iwona-CapsCondMedium-Italic]
- \definefontsynonym [SansBoldCaps] [Iwona-CapsCondHeavy-Regular]
- \definefontsynonym [SansBoldItalicCaps] [Iwona-CapsCondHeavy-Italic]
- \stoptypescript
-
- \starttypescript [\s!sans] [iwona-medium-cond-caps,iwona-medium-caps-cond] [\s!name]
- \setups[\s!font:\s!fallback:\s!sans]
- \definefontsynonym [\s!Sans] [Iwona-CapsCondHeavy-Regular]
- \definefontsynonym [\s!SansItalic] [Iwona-CapsCondMedium-Italic]
- \definefontsynonym [\s!SansBold] [Iwona-CapsCondHeavy-Regular]
- \definefontsynonym [\s!SansBoldItalic] [Iwona-CapsCondHeavy-Italic]
\stoptypescript
\starttypescript [iwona,iwona-light,iwona-heavy,iwona-medium]
diff --git a/tex/context/fonts/mkiv/type-imp-kurier.mkiv b/tex/context/fonts/mkiv/type-imp-kurier.mkiv
index eb54aa68d..0bf1a43ca 100644
--- a/tex/context/fonts/mkiv/type-imp-kurier.mkiv
+++ b/tex/context/fonts/mkiv/type-imp-kurier.mkiv
@@ -3,7 +3,7 @@
%D version=2021.10.24,
%D title=\CONTEXT\ Typescript Macros,
%D subtitle=Kurier,
-%D author=Hans Hagen,
+%D author=Hans Hagen & Mikael Sundqvist,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
@@ -13,6 +13,11 @@
\starttypescriptcollection [kurier]
+ \definefontfeature[virtualmath-kurier] [virtualmath][virtualweight=kurier]
+ \definefontfeature[virtualmath-kurier-light] [virtualmath][virtualweight=kurier-light]
+ \definefontfeature[virtualmath-kurier-medium][virtualmath][virtualweight=kurier-medium]
+ \definefontfeature[virtualmath-kurier-heavy] [virtualmath][virtualweight=kurier-heavy]
+
\starttypescript [\s!sans] [kurier-light,kurier,kurier-medium]
\definefontsynonym [Kurier-Light] [\s!file:kurierlightregular] [\s!features=\s!default]
\definefontsynonym [Kurier-LightItalic] [\s!file:kurierlightitalic] [\s!features=\s!default]
@@ -39,6 +44,26 @@
\definefontsynonym [Kurier-CondHeavyItalic] [\s!file:kuriercondheavyitalic] [\s!features=\s!default]
\stoptypescript
+ \starttypescript [\s!math][kurier][\s!all]
+ \definefontsynonym[\s!MathRoman] [kuriermath@kurier-math]
+ \definefontsynonym[\s!MathRomanBold][kuriermediummath@kurier-medium-math]
+ \stoptypescript
+ \starttypescript [\s!math][kurier-light][\s!all]
+ \definefontsynonym[\s!MathRoman][kurierlightmath@kurier-light-math]
+ \definefontsynonym[\s!MathRomanBold][kuriermath@kurier-math]
+ \stoptypescript
+ \starttypescript [\s!math][kurier-medium][\s!all]
+ \definefontsynonym[\s!MathRoman] [kuriermediummath@kurier-medium-math]
+ \definefontsynonym[\s!MathRomanBold][kurierheavymath@kurier-heavy-math]
+ \stoptypescript
+ \starttypescript [\s!math][kurier-heavy][\s!all]
+ \definefontsynonym[\s!MathRoman][kurierheavymath@kurier-heavy-math]
+ \stoptypescript
+
+ \starttypescript [\s!math] [kurier,kurier-light,kurier-medium,kurier-heavy] [\s!all]
+ \loadfontgoodies[kurier-math]
+ \stoptypescript
+
\starttypescript [\s!sans] [kurier-light]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [Kurier-Light]
@@ -91,7 +116,7 @@
\definetypeface [\typescriptone] [\s!ss] [\s!sans] [\typescriptone] [\s!default]
\definetypeface [\typescriptone] [\s!rm] [\s!serif] [modern] [\s!default]
\definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default]
- \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern] [\s!default]
+ \definetypeface [\typescriptone] [\s!mm] [\s!math] [\typescriptone] [\s!default][text=ss]
\quittypescriptscanning
\stoptypescript
diff --git a/tex/context/fonts/mkiv/type-imp-lucida.mkiv b/tex/context/fonts/mkiv/type-imp-lucida.mkiv
index 1e4c35abc..186854efc 100644
--- a/tex/context/fonts/mkiv/type-imp-lucida.mkiv
+++ b/tex/context/fonts/mkiv/type-imp-lucida.mkiv
@@ -77,8 +77,8 @@
\starttypescript [\s!math] [lucida,lucidaot,lucidadk]
\definefontsynonym [\s!MathRoman] [\s!file:LucidaBrightMathOT.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,lucida:mathextra,mathextra},\s!goodies=lucida-math]
-% \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT-Demi.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,mathextra},\s!goodies=lucida-math]
- \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT.otf] [\s!features={\s!math\mathsizesuffix,lucida-math-bold,mathlucida,lucida:mathextra,mathextra},\s!goodies=lucida-math]
+ % \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT-Demi.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,mathextra},\s!goodies=lucida-math]
+ \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT.otf] [\s!features={\s!math\mathsizesuffix,lucida-math-bold,mathlucida,lucida:mathextra,mathextra},\s!goodies=lucida-math]
\stoptypescript
\starttypescript [\s!math] [lucidaot-nt,lucida-nt]
diff --git a/tex/context/interface/mkii/keys-nl.xml b/tex/context/interface/mkii/keys-nl.xml
index e01eb74d1..249cbfb45 100644
--- a/tex/context/interface/mkii/keys-nl.xml
+++ b/tex/context/interface/mkii/keys-nl.xml
@@ -453,6 +453,7 @@
<cd:variable name='printable' value='printbaar'/>
<cd:variable name='process' value='proces'/>
<cd:variable name='product' value='produkt'/>
+ <cd:variable name='profile' value='profile'/>
<cd:variable name='program' value='programma'/>
<cd:variable name='project' value='project'/>
<cd:variable name='protected' value='beschermd'/>
diff --git a/tex/context/interface/mkii/keys-pe.xml b/tex/context/interface/mkii/keys-pe.xml
index 5eca0c1bc..d4bccab50 100644
--- a/tex/context/interface/mkii/keys-pe.xml
+++ b/tex/context/interface/mkii/keys-pe.xml
@@ -453,6 +453,7 @@
<cd:variable name='printable' value='قابل‌چاپ'/>
<cd:variable name='process' value='پردازش'/>
<cd:variable name='product' value='محصول'/>
+ <cd:variable name='profile' value='profile'/>
<cd:variable name='program' value='برنامه'/>
<cd:variable name='project' value='پروژه'/>
<cd:variable name='protected' value='حفاظت‌شده'/>
@@ -725,6 +726,7 @@
<cd:constant name='bookmark' value='چوبخط'/>
<cd:constant name='bottom' value='پایین'/>
<cd:constant name='bottomafter' value='bottomafter'/>
+ <cd:constant name='bottomalign' value='bottomalign'/>
<cd:constant name='bottombefore' value='bottombefore'/>
<cd:constant name='bottomcolor' value='bottomcolor'/>
<cd:constant name='bottomcommand' value='bottomcommand'/>
@@ -1339,6 +1341,7 @@
<cd:constant name='toffset' value='toffset'/>
<cd:constant name='tolerance' value='بردباری'/>
<cd:constant name='top' value='بالا'/>
+ <cd:constant name='topalign' value='topalign'/>
<cd:constant name='topcolor' value='topcolor'/>
<cd:constant name='topcommand' value='topcommand'/>
<cd:constant name='topdistance' value='فاصله‌بالا'/>
diff --git a/tex/context/modules/mkiv/s-fonts-charts.mkiv b/tex/context/modules/mkiv/s-fonts-charts.mkiv
index 6fe58c899..0f183e39d 100644
--- a/tex/context/modules/mkiv/s-fonts-charts.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-charts.mkiv
@@ -172,7 +172,7 @@
\starttext
- \showfontchart[filename=texgyredejavu-math.otf,page=yes,option=all]
+% \showfontchart[filename=texgyredejavu-math.otf,page=yes,option=all]
% \showfontchart[filename=danlan.otf] % ,page=yes,option=all]
% \showfontchart[filename=danlan-bold.otf] % ,page=yes,option=all]
@@ -213,4 +213,8 @@
% \showfontchart[filename=LucidaCalligraphyOT.otf,page=yes]
% \showfontchart[filename=LucidaHandwritingOT.otf,page=yes]
+% \showfontchart[filename=iwonar.afm,page=yes]
+% \showfontchart[filename=iwonarz.afm,page=yes]
+ \showfontchart[filename=e:/tmp/Iwona-Math.otf,page=yes]
+
\stoptext
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 567851faf..ac7c0e20b 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 2023-01-26 18:32
+-- merge date : 2023-02-06 17:55
do -- begin closure to overcome local limits and interference
@@ -4860,7 +4860,7 @@ local mt={
end,
__storage__=true
}
-function containers.define(category,subcategory,version,enabled)
+function containers.define(category,subcategory,version,enabled,reload)
if category and subcategory then
local c=allocated[category]
if not c then
@@ -4874,6 +4874,7 @@ function containers.define(category,subcategory,version,enabled)
subcategory=subcategory,
storage={},
enabled=enabled,
+ reload=reload,
version=version or math.pi,
trace=false,
}
@@ -4896,7 +4897,8 @@ function containers.is_valid(container,name)
end
function containers.read(container,name)
local storage=container.storage
- local stored=storage[name]
+ local reload=container.reload
+ local stored=not reload and storage[name]
if not stored and container.enabled and caches and containers.usecache then
stored=loaddatafromcache(container.readables,name,container.writable)
if stored and stored.cache_version==container.version then
@@ -13683,7 +13685,7 @@ do
local y=0
local width=false
local lsb=0
-local result={}
+ local result={}
local r=0
local stems=0
local globalbias=0
@@ -14701,6 +14703,13 @@ end
elseif t<=254 then
stack[top]=-t*256+64148-tab[i+1]
i=i+2
+ elseif version=="cff" then
+ local n=0x1000000*tab[i+1]+0x10000*tab[i+2]+0x100*tab[i+3]+tab[i+4]
+ if n>=0x8000000 then
+ n=n-0xFFFFFFFF-1
+ end
+ stack[top]=n
+ i=i+5
else
local n1=0x100*tab[i+1]+tab[i+2]
local n2=0x100*tab[i+3]+tab[i+4]
@@ -14893,7 +14902,7 @@ end
((l<1240 and 107) or (l<33900 and 1131) or 32768)+1
end
end
- local function processshape(tab,index,hack)
+ local function processshape(glyphs,tab,index,hack)
if not tab then
glyphs[index]={
boundingbox={ 0,0,0,0 },
@@ -14948,8 +14957,9 @@ end
result=nil
if glyph then
glyph.stream=stream
+ glyph.width=width
else
- glyphs[index]={ stream=stream }
+ glyphs[index]={ stream=stream,width=width }
end
elseif glyph then
glyph.segments=keepcurve~=false and result or nil
@@ -15027,13 +15037,13 @@ result=nil
locals=dictionary.subroutines or {}
charset=dictionary.charset
vsindex=dictionary.vsindex or 0
- glyphs=glphs or {}
+ local glyphs=glphs or {}
globalbias,localbias=setbias(globals,locals,nobias)
nominalwidth,defaultwidth=setwidths(dictionary.private)
if charstrings then
startparsing(fontdata,data,streams)
for index=1,#charstrings do
- processshape(charstrings[index],index-1)
+ processshape(glyphs,charstrings[index],index-1)
end
if justpass and next(seacs) then
local charset=data.dictionaries[1].charset
@@ -15047,7 +15057,7 @@ result=nil
if bglyph and aglyph then
local jp=justpass
justpass=false
- local x,y=processshape(charstrings[bindex+1],bindex,true)
+ local x,y=processshape(glyphs,charstrings[bindex+1],bindex,true)
justpass=jp
local base=bglyph.stream
local accent=aglyph.stream
@@ -15072,12 +15082,13 @@ result=nil
locals=dictionary.subroutines or {}
charset=false
vsindex=dictionary.vsindex or 0
- glyphs=glphs or {}
+ local glyphs=glphs or {}
justpass=streams==true
seacs={}
globalbias,localbias=setbias(globals,locals,nobias)
nominalwidth,defaultwidth=setwidths(dictionary.private)
- processshape(tab,index-1)
+ processshape(glyphs,tab,index-1)
+ return glyphs[index]
end
end
local function readglobals(f,data,version)
@@ -21340,7 +21351,7 @@ local trace_defining=false registertracker("fonts.defining",function(v) trace_d
local report_otf=logs.reporter("fonts","otf loading")
local fonts=fonts
local otf=fonts.handlers.otf
-otf.version=3.131
+otf.version=3.132
otf.cache=containers.define("fonts","otl",otf.version,true)
otf.svgcache=containers.define("fonts","svg",otf.version,true)
otf.pngcache=containers.define("fonts","png",otf.version,true)
@@ -37400,7 +37411,8 @@ local function loadstreams(cache,filename,sub,instance)
if streams then
local fontbbox=metadata.fontbbox or { 0,0,0,0 }
for i=0,#streams do
- streams[i]=streams[i].stream or "\14"
+ local s=streams[i]
+ streams[i]=s.stream or "\14"
end
data={
filename=filename,
@@ -37482,7 +37494,8 @@ local function getstreamhash(fontid)
local fontdata=identifiers[fontid]
if fontdata then
local properties=fontdata.properties
- return makehash(properties.filename,properties.subfont,properties.instance),fontdata
+ local fonthash=makehash(properties.filename,properties.subfont,properties.instance)
+ return fonthash,fontdata
end
end
local function loadstreamdata(fontdata)