From b32da8747292384893ea07a0a5659b24eb216c10 Mon Sep 17 00:00:00 2001
From: Hans Hagen
Date: Fri, 17 Jul 2009 13:16:00 +0200
Subject: stable 2009.07.17 13:16
---
context/data/texworks/TUG/texworks.ini | 6 +-
context/data/texworks/texworks-context.rme | 2 +
context/data/texworks/texworks-setup.ini | 4 +-
fonts/map/luatex/context/demo-font.lum | 70 +
metapost/context/base/mp-core.mp | 2 +-
scripts/context/lua/mtx-context.lua | 17 +-
scripts/context/lua/mtx-convert.lua | 132 +-
scripts/context/lua/mtx-grep.lua | 4 +-
scripts/context/lua/mtx-texworks.lua | 96 +
scripts/context/lua/mtx-tools.lua | 57 +
scripts/context/lua/mtx-update.lua | 27 +-
scripts/context/lua/mtxrun.lua | 9 +
scripts/context/stubs/mswin/mtxrun.lua | 9 +
scripts/context/stubs/mswin/mtxworks.cmd | 1 +
scripts/context/stubs/unix/mtxrun | 9 +
scripts/context/stubs/unix/mtxworks | 2 +
tex/context/base/anch-pgr.mkii | 1 +
tex/context/base/anch-pgr.mkiv | 311 +-
tex/context/base/anch-pos.lua | 2 +-
tex/context/base/anch-pos.mkiv | 14 -
tex/context/base/anch-snc.tex | 2 -
tex/context/base/attr-ini.lua | 335 +-
tex/context/base/attr-ini.mkiv | 24 +-
tex/context/base/back-ini.lua | 106 +-
tex/context/base/back-ini.mkiv | 746 +---
tex/context/base/back-pdf.lua | 489 ++-
tex/context/base/back-pdf.mkiv | 3232 +----------------
tex/context/base/bibl-bib.mkiv | 29 +
tex/context/base/bibl-bib.tex | 29 -
tex/context/base/buff-ini.lua | 49 +
tex/context/base/buff-ini.mkiv | 35 +
tex/context/base/buff-ver.mkii | 2 +-
tex/context/base/buff-ver.mkiv | 24 +-
tex/context/base/catc-ctx.tex | 43 +
tex/context/base/catc-sym.tex | 69 +
tex/context/base/colo-ext.mkiv | 2 +-
tex/context/base/colo-hex.mkii | 18 +-
tex/context/base/colo-hex.mkiv | 109 +-
tex/context/base/colo-ini.lua | 278 +-
tex/context/base/colo-ini.mkiv | 171 +-
tex/context/base/cont-log.tex | 14 +
tex/context/base/cont-new.mkii | 3 +
tex/context/base/cont-new.mkiv | 101 +-
tex/context/base/cont-new.tex | 738 +---
tex/context/base/context.mkii | 223 +-
tex/context/base/context.mkiv | 184 +-
tex/context/base/context.tex | 2 +-
tex/context/base/core-def.mkii | 7 +
tex/context/base/core-def.mkiv | 2 -
tex/context/base/core-fil.mkii | 347 ++
tex/context/base/core-fil.mkiv | 317 ++
tex/context/base/core-fil.tex | 347 --
tex/context/base/core-gen.mkii | 166 +
tex/context/base/core-gen.mkiv | 166 +
tex/context/base/core-gen.tex | 166 -
tex/context/base/core-grd.mkii | 1074 ++++++
tex/context/base/core-grd.mkiv | 1074 ++++++
tex/context/base/core-grd.tex | 1074 ------
tex/context/base/core-ini.mkii | 67 +
tex/context/base/core-ini.mkiv | 67 +
tex/context/base/core-ini.tex | 67 -
tex/context/base/core-ins.tex | 103 -
tex/context/base/core-job.mkiv | 41 +-
tex/context/base/core-lme.tex | 55 -
tex/context/base/core-lnt.tex | 197 --
tex/context/base/core-mak.tex | 84 -
tex/context/base/core-mis.mkii | 66 +
tex/context/base/core-mis.mkiv | 240 +-
tex/context/base/core-par.mkii | 300 ++
tex/context/base/core-par.tex | 300 --
tex/context/base/core-spa.lua | 61 +-
tex/context/base/core-spa.mkii | 64 +-
tex/context/base/core-spa.mkiv | 410 ++-
tex/context/base/core-stg.mkii | 72 +
tex/context/base/core-stg.tex | 72 -
tex/context/base/core-sys.mkiv | 45 +-
tex/context/base/core-two.lua | 8 +
tex/context/base/core-two.mkiv | 3 -
tex/context/base/core-uti.mkii | 47 +-
tex/context/base/core-uti.mkiv | 54 +-
tex/context/base/core-var.mkii | 286 ++
tex/context/base/core-var.mkiv | 275 ++
tex/context/base/core-var.tex | 286 --
tex/context/base/enco-032.mkii | 82 +
tex/context/base/enco-032.tex | 82 -
tex/context/base/enco-037.mkii | 276 ++
tex/context/base/enco-037.tex | 276 --
tex/context/base/enco-acc.mkii | 139 +
tex/context/base/enco-acc.tex | 139 -
tex/context/base/enco-agr.mkii | 364 ++
tex/context/base/enco-agr.tex | 364 --
tex/context/base/enco-ans.mkii | 237 ++
tex/context/base/enco-ans.tex | 237 --
tex/context/base/enco-cas.mkii | 143 +
tex/context/base/enco-cas.tex | 143 -
tex/context/base/enco-chi.mkii | 371 ++
tex/context/base/enco-chi.tex | 371 --
tex/context/base/enco-com.mkii | 37 +
tex/context/base/enco-com.tex | 37 -
tex/context/base/enco-cyr.mkii | 1037 ++++++
tex/context/base/enco-cyr.tex | 1037 ------
tex/context/base/enco-def.mkii | 920 +++++
tex/context/base/enco-def.tex | 920 -----
tex/context/base/enco-ec.mkii | 295 ++
tex/context/base/enco-ec.tex | 295 --
tex/context/base/enco-ecm.mkii | 33 +
tex/context/base/enco-ecm.tex | 33 -
tex/context/base/enco-el.mkii | 272 ++
tex/context/base/enco-el.tex | 272 --
tex/context/base/enco-fde.mkii | 128 +
tex/context/base/enco-fde.tex | 128 -
tex/context/base/enco-ffr.mkii | 53 +
tex/context/base/enco-ffr.tex | 53 -
tex/context/base/enco-fpl.mkii | 98 +
tex/context/base/enco-fpl.tex | 98 -
tex/context/base/enco-fro.mkii | 35 +
tex/context/base/enco-fro.tex | 35 -
tex/context/base/enco-fsl.mkii | 32 +
tex/context/base/enco-fsl.tex | 32 -
tex/context/base/enco-grk.mkii | 190 +
tex/context/base/enco-grk.tex | 190 -
tex/context/base/enco-heb.mkii | 16 +
tex/context/base/enco-heb.tex | 16 -
tex/context/base/enco-ibm.mkii | 7 +
tex/context/base/enco-ibm.tex | 7 -
tex/context/base/enco-il2.mkii | 157 +
tex/context/base/enco-il2.tex | 157 -
tex/context/base/enco-ini.mkii | 12 +-
tex/context/base/enco-ini.mkiv | 74 +-
tex/context/base/enco-lat.mkii | 7 +
tex/context/base/enco-lat.tex | 7 -
tex/context/base/enco-mis.mkii | 188 +
tex/context/base/enco-mis.tex | 188 -
tex/context/base/enco-pdf.mkii | 278 ++
tex/context/base/enco-pdf.tex | 278 --
tex/context/base/enco-pfr.mkii | 305 ++
tex/context/base/enco-pfr.tex | 303 --
tex/context/base/enco-pol.mkii | 276 ++
tex/context/base/enco-pol.tex | 276 --
tex/context/base/enco-qx.mkii | 266 ++
tex/context/base/enco-qx.tex | 266 --
tex/context/base/enco-raw.mkii | 119 +
tex/context/base/enco-raw.tex | 119 -
tex/context/base/enco-run.mkii | 149 +
tex/context/base/enco-run.tex | 149 -
tex/context/base/enco-t5.mkii | 244 ++
tex/context/base/enco-t5.tex | 244 --
tex/context/base/enco-tbo.mkii | 222 ++
tex/context/base/enco-tbo.tex | 222 --
tex/context/base/enco-uc.mkii | 1091 ++++++
tex/context/base/enco-uc.tex | 1091 ------
tex/context/base/enco-vis.mkii | 3 +
tex/context/base/enco-vis.tex | 3 -
tex/context/base/enco-vna.mkii | 145 +
tex/context/base/enco-vna.tex | 145 -
tex/context/base/enco-win.mkii | 7 +
tex/context/base/enco-win.tex | 7 -
tex/context/base/enco-x5.mkii | 218 ++
tex/context/base/enco-x5.tex | 218 --
tex/context/base/filt-bas.mkii | 63 +
tex/context/base/filt-bas.tex | 63 -
tex/context/base/filt-ini.mkii | 121 +
tex/context/base/filt-ini.tex | 133 -
tex/context/base/font-arb.mkii | 5 +
tex/context/base/font-arb.tex | 5 -
tex/context/base/font-bfm.mkii | 196 ++
tex/context/base/font-bfm.tex | 196 --
tex/context/base/font-chi.mkii | 1156 +++++++
tex/context/base/font-chi.tex | 1156 -------
tex/context/base/font-chk.lua | 12 +-
tex/context/base/font-cid.lua | 1 +
tex/context/base/font-col.lua | 4 +-
tex/context/base/font-heb.mkii | 5 +
tex/context/base/font-heb.tex | 5 -
tex/context/base/font-ini.mkii | 24 +-
tex/context/base/font-ini.mkiv | 211 +-
tex/context/base/font-jap.mkii | 83 +
tex/context/base/font-jap.tex | 83 -
tex/context/base/font-map.lua | 95 +-
tex/context/base/font-mis.lua | 2 +-
tex/context/base/font-otf.lua | 183 +-
tex/context/base/font-otn.lua | 4 +-
tex/context/base/font-run.mkii | 326 ++
tex/context/base/font-run.mkiv | 326 ++
tex/context/base/font-run.tex | 326 --
tex/context/base/font-tfm.lua | 19 +-
tex/context/base/font-uni.mkii | 2 +-
tex/context/base/font-xtx.mkii | 357 ++
tex/context/base/font-xtx.tex | 357 --
tex/context/base/grph-fig.mkiv | 212 +-
tex/context/base/grph-inc.lua | 47 +-
tex/context/base/grph-inc.mkii | 24 +
tex/context/base/grph-inc.mkiv | 77 +-
tex/context/base/grph-u3d.lua | 45 +
tex/context/base/hand-def.mkii | 577 ++++
tex/context/base/hand-def.tex | 577 ----
tex/context/base/hand-ini.mkii | 18 +-
tex/context/base/java-fld.tex | 27 +-
tex/context/base/java-ini.lua | 112 +
tex/context/base/java-ini.mkiv | 582 +---
tex/context/base/java-stp.tex | 16 +-
tex/context/base/l-aux.lua | 31 +-
tex/context/base/l-table.lua | 2 +-
tex/context/base/l-xml.lua | 2 +-
tex/context/base/lang-ara.mkiv | 150 +
tex/context/base/lang-ara.tex | 150 -
tex/context/base/lang-chi.mkii | 305 ++
tex/context/base/lang-chi.tex | 305 --
tex/context/base/lang-cjk.mkiv | 328 ++
tex/context/base/lang-cjk.tex | 328 --
tex/context/base/lang-ctx.mkii | 53 +
tex/context/base/lang-ctx.tex | 53 -
tex/context/base/lang-dis.mkii | 59 +
tex/context/base/lang-dis.tex | 59 -
tex/context/base/lang-ini.mkii | 2 +-
tex/context/base/lang-ini.mkiv | 43 +-
tex/context/base/lang-ita.tex | 10 +-
tex/context/base/lang-jap.mkii | 234 ++
tex/context/base/lang-jap.tex | 234 --
tex/context/base/lang-lab.mkiv | 212 +-
tex/context/base/lang-mis.mkii | 683 ++++
tex/context/base/lang-mis.mkiv | 683 ++++
tex/context/base/lang-mis.tex | 683 ----
tex/context/base/lang-run.mkii | 36 +
tex/context/base/lang-run.tex | 36 -
tex/context/base/lang-sla.tex | 22 -
tex/context/base/lang-spe.mkiv | 111 -
tex/context/base/lpdf-ano.lua | 573 +++
tex/context/base/lpdf-col.lua | 150 +
tex/context/base/lpdf-fld.lua | 747 ++++
tex/context/base/lpdf-grp.lua | 70 +
tex/context/base/lpdf-ini.lua | 314 +-
tex/context/base/lpdf-ini.mkiv | 243 +-
tex/context/base/lpdf-mis.lua | 230 ++
tex/context/base/lpdf-nod.lua | 53 +
tex/context/base/lpdf-ren.lua | 210 ++
tex/context/base/lpdf-u3d.lua | 427 +++
tex/context/base/lpdf-wid.lua | 328 ++
tex/context/base/luat-bas.mkiv | 1 +
tex/context/base/luat-cod.mkiv | 6 +-
tex/context/base/luat-ini.mkiv | 28 +-
tex/context/base/luat-lib.mkiv | 2 +-
tex/context/base/lxml-ini.mkiv | 408 +++
tex/context/base/lxml-ini.tex | 408 ---
tex/context/base/lxml-tab.lua | 2 +-
tex/context/base/m-format.tex | 409 +++
tex/context/base/math-ams.mkii | 336 ++
tex/context/base/math-ams.tex | 336 --
tex/context/base/math-cow.mkii | 31 +
tex/context/base/math-cow.tex | 31 -
tex/context/base/math-def.mkiv | 2 +-
tex/context/base/math-eul.mkii | 277 ++
tex/context/base/math-eul.tex | 277 --
tex/context/base/math-fou.mkii | 196 ++
tex/context/base/math-fou.tex | 196 --
tex/context/base/math-frc.mkiv | 12 +-
tex/context/base/math-ini.mkii | 4 +-
tex/context/base/math-inl.mkiv | 10 +-
tex/context/base/math-lbr.mkii | 450 +++
tex/context/base/math-lbr.tex | 450 ---
tex/context/base/math-noa.lua | 15 +-
tex/context/base/math-tex.mkii | 718 ++++
tex/context/base/math-tex.tex | 718 ----
tex/context/base/math-tim.mkii | 371 ++
tex/context/base/math-tim.tex | 371 --
tex/context/base/math-uni.mkii | 237 ++
tex/context/base/math-uni.tex | 237 --
tex/context/base/math-vfu.lua | 54 +-
tex/context/base/meta-ini.mkii | 29 +-
tex/context/base/meta-ini.mkiv | 318 +-
tex/context/base/meta-pag.mkii | 226 ++
tex/context/base/meta-pag.mkiv | 223 ++
tex/context/base/meta-pag.tex | 226 --
tex/context/base/meta-pdf.lua | 214 +-
tex/context/base/meta-pdf.mkiv | 702 +---
tex/context/base/meta-pdh.lua | 62 +-
tex/context/base/meta-pdh.mkiv | 780 +++++
tex/context/base/metatex.tex | 44 +-
tex/context/base/mlib-ctx.lua | 11 +-
tex/context/base/mlib-pdf.lua | 43 +-
tex/context/base/mlib-pdf.mkiv | 6 +-
tex/context/base/mlib-pps.lua | 360 +-
tex/context/base/mlib-pps.mkiv | 18 +-
tex/context/base/mlib-run.lua | 2 +-
tex/context/base/mult-chk.lua | 2 +-
tex/context/base/mult-chk.mkii | 3 +
tex/context/base/mult-cld.lua | 174 +
tex/context/base/mult-cld.mkiv | 20 +
tex/context/base/mult-de.tex | 2 +
tex/context/base/mult-def.lua | 13 +
tex/context/base/mult-en.tex | 2 +
tex/context/base/mult-fr.tex | 2 +
tex/context/base/mult-his.tex | 1155 -------
tex/context/base/mult-ini.lua | 25 +-
tex/context/base/mult-ini.mkiv | 3 +
tex/context/base/mult-it.tex | 2 +
tex/context/base/mult-nl.tex | 2 +
tex/context/base/mult-ro.tex | 2 +
tex/context/base/mult-sys.tex | 32 +-
tex/context/base/node-dum.lua | 12 +-
tex/context/base/node-fin.lua | 249 +-
tex/context/base/node-fin.mkiv | 10 +-
tex/context/base/node-ini.lua | 5 +-
tex/context/base/node-inj.lua | 298 +-
tex/context/base/node-pro.lua | 29 +-
tex/context/base/node-ref.lua | 496 +++
tex/context/base/node-res.lua | 14 +-
tex/context/base/node-seq.lua | 18 +-
tex/context/base/node-shp.lua | 2 +-
tex/context/base/node-tex.lua | 33 +-
tex/context/base/node-tra.lua | 4 +-
tex/context/base/node-tsk.lua | 16 +-
tex/context/base/node-tst.lua | 13 +-
tex/context/base/pack-bar.mkiv | 67 +
tex/context/base/pack-box.mkiv | 37 +-
tex/context/base/pack-lyr.mkiv | 417 +--
tex/context/base/pack-obj.lua | 2 +-
tex/context/base/pack-obj.mkiv | 168 +-
tex/context/base/pack-rul.lua | 55 +-
tex/context/base/pack-rul.mkii | 13 +
tex/context/base/pack-rul.mkiv | 538 ++-
tex/context/base/page-app.mkii | 225 ++
tex/context/base/page-app.mkiv | 225 ++
tex/context/base/page-app.tex | 225 --
tex/context/base/page-bck.mkiv | 198 +-
tex/context/base/page-flw.mkii | 107 +
tex/context/base/page-flw.mkiv | 107 +
tex/context/base/page-flw.tex | 107 -
tex/context/base/page-imp.mkii | 1314 +++++++
tex/context/base/page-imp.mkiv | 1298 +++++++
tex/context/base/page-imp.tex | 1314 -------
tex/context/base/page-ini.mkiv | 203 +-
tex/context/base/page-ins.mkii | 103 +
tex/context/base/page-ins.mkiv | 94 +
tex/context/base/page-lay.mkii | 1429 ++++++++
tex/context/base/page-lay.mkiv | 1404 ++++++++
tex/context/base/page-lay.tex | 1429 --------
tex/context/base/page-lin.mkiv | 7 +-
tex/context/base/page-log.mkii | 202 ++
tex/context/base/page-log.tex | 218 --
tex/context/base/page-mak.mkii | 234 ++
tex/context/base/page-mak.mkiv | 233 ++
tex/context/base/page-mak.tex | 234 --
tex/context/base/page-mar.mkii | 867 +++++
tex/context/base/page-mar.mkiv | 838 +++++
tex/context/base/page-mar.tex | 867 -----
tex/context/base/page-mis.mkii | 268 ++
tex/context/base/page-mis.mkiv | 266 ++
tex/context/base/page-mis.tex | 268 --
tex/context/base/page-mul.mkii | 1773 ++++++++++
tex/context/base/page-mul.mkiv | 1755 ++++++++++
tex/context/base/page-mul.tex | 1773 ----------
tex/context/base/page-new.tex | 277 --
tex/context/base/page-not.mkii | 72 +
tex/context/base/page-not.mkiv | 72 +
tex/context/base/page-not.tex | 72 -
tex/context/base/page-one.mkiv | 28 +-
tex/context/base/page-par.mkii | 58 +
tex/context/base/page-par.mkiv | 58 +
tex/context/base/page-par.tex | 58 -
tex/context/base/page-plg.mkii | 202 ++
tex/context/base/page-plg.mkiv | 198 ++
tex/context/base/page-plg.tex | 202 --
tex/context/base/page-run.mkii | 382 ++
tex/context/base/page-run.mkiv | 382 ++
tex/context/base/page-run.tex | 382 --
tex/context/base/page-set.mkii | 3109 +++++++++++++++++
tex/context/base/page-set.mkiv | 3104 +++++++++++++++++
tex/context/base/page-set.tex | 2815 ---------------
tex/context/base/page-sid.mkii | 931 +++++
tex/context/base/page-sid.mkiv | 931 +++++
tex/context/base/page-sid.tex | 931 -----
tex/context/base/page-spr.mkii | 104 +
tex/context/base/page-spr.mkiv | 103 +
tex/context/base/page-spr.tex | 104 -
tex/context/base/page-str.mkii | 376 ++
tex/context/base/page-str.mkiv | 380 ++
tex/context/base/page-str.tex | 374 --
tex/context/base/page-txt.mkiv | 455 +--
tex/context/base/pdfr-def.mkii | 843 +++++
tex/context/base/pdfr-def.tex | 843 -----
tex/context/base/pdfr-ec.mkii | 145 +
tex/context/base/pdfr-ec.tex | 145 -
tex/context/base/pdfr-il2.mkii | 233 ++
tex/context/base/prop-ini.mkiv | 8 +-
tex/context/base/prop-lay.mkiv | 133 +-
tex/context/base/regi-8859-1.mkii | 154 +
tex/context/base/regi-8859-1.tex | 154 -
tex/context/base/regi-8859-10.mkii | 152 +
tex/context/base/regi-8859-10.tex | 152 -
tex/context/base/regi-8859-13.mkii | 152 +
tex/context/base/regi-8859-13.tex | 152 -
tex/context/base/regi-8859-15.mkii | 154 +
tex/context/base/regi-8859-15.tex | 154 -
tex/context/base/regi-8859-16.mkii | 151 +
tex/context/base/regi-8859-16.tex | 151 -
tex/context/base/regi-8859-2.mkii | 152 +
tex/context/base/regi-8859-2.tex | 152 -
tex/context/base/regi-8859-3.mkii | 145 +
tex/context/base/regi-8859-3.tex | 145 -
tex/context/base/regi-8859-4.mkii | 152 +
tex/context/base/regi-8859-4.tex | 152 -
tex/context/base/regi-8859-5.mkii | 152 +
tex/context/base/regi-8859-5.tex | 152 -
tex/context/base/regi-8859-7.mkii | 153 +
tex/context/base/regi-8859-7.tex | 153 -
tex/context/base/regi-8859-9.mkii | 152 +
tex/context/base/regi-8859-9.tex | 152 -
tex/context/base/regi-cp1250.mkii | 153 +
tex/context/base/regi-cp1250.tex | 153 -
tex/context/base/regi-cp1251.mkii | 152 +
tex/context/base/regi-cp1251.tex | 152 -
tex/context/base/regi-cp1252.mkii | 156 +
tex/context/base/regi-cp1252.tex | 156 -
tex/context/base/regi-cp1253.mkii | 153 +
tex/context/base/regi-cp1253.tex | 153 -
tex/context/base/regi-cp1254.mkii | 153 +
tex/context/base/regi-cp1254.tex | 153 -
tex/context/base/regi-cp1257.mkii | 153 +
tex/context/base/regi-cp1257.tex | 153 -
tex/context/base/regi-cyp.mkii | 1169 +++++++
tex/context/base/regi-cyp.tex | 1169 -------
tex/context/base/regi-cyr.mkii | 722 ++++
tex/context/base/regi-cyr.tex | 722 ----
tex/context/base/regi-def.mkii | 21 +
tex/context/base/regi-def.tex | 21 -
tex/context/base/regi-ibm.mkii | 73 +
tex/context/base/regi-ibm.tex | 73 -
tex/context/base/regi-ini.mkii | 20 +-
tex/context/base/regi-mac.mkii | 147 +
tex/context/base/regi-mac.tex | 147 -
tex/context/base/regi-run.mkii | 32 -
tex/context/base/regi-uni.mkii | 24 +
tex/context/base/regi-uni.tex | 24 -
tex/context/base/regi-utf.mkii | 51 +
tex/context/base/regi-utf.tex | 51 -
tex/context/base/regi-vis.mkii | 158 +
tex/context/base/regi-vis.tex | 158 -
tex/context/base/s-pre-11.tex | 220 ++
tex/context/base/s-pre-12.tex | 226 ++
tex/context/base/s-pre-17.tex | 399 +++
tex/context/base/s-pre-18.tex | 177 +
tex/context/base/s-pre-19.tex | 1 +
tex/context/base/s-pre-26.tex | 255 ++
tex/context/base/s-pre-27.tex | 181 +
tex/context/base/s-pre-61.tex | 2 +-
tex/context/base/s-pre-93.tex | 210 ++
tex/context/base/scrn-bar.mkiv | 398 +++
tex/context/base/scrn-but.mkiv | 126 +
tex/context/base/scrn-fld.mkii | 165 +
tex/context/base/scrn-fld.mkiv | 1061 ++----
tex/context/base/scrn-int.lua | 111 +
tex/context/base/scrn-int.mkii | 198 +-
tex/context/base/scrn-int.mkiv | 2235 +++---------
tex/context/base/scrn-men.mkiv | 616 ++++
tex/context/base/scrn-nav.mkiv | 363 +-
tex/context/base/sort-def.mkii | 450 +++
tex/context/base/sort-def.tex | 450 ---
tex/context/base/sort-ini.lua | 118 +-
tex/context/base/sort-ini.mkii | 12 +-
tex/context/base/sort-lan.lua | 157 +-
tex/context/base/sort-lan.mkii | 203 ++
tex/context/base/sort-lan.tex | 203 --
tex/context/base/spec-def.mkii | 1016 ++++++
tex/context/base/spec-def.tex | 1016 ------
tex/context/base/spec-dpm.mkii | 445 +++
tex/context/base/spec-dpm.tex | 445 ---
tex/context/base/spec-dpx.mkii | 793 +++++
tex/context/base/spec-dpx.tex | 793 -----
tex/context/base/spec-dvi.mkii | 118 +
tex/context/base/spec-dvi.tex | 118 -
tex/context/base/spec-fdf.mkii | 3444 ++++++++++++++++++
tex/context/base/spec-fdf.tex | 3446 ------------------
tex/context/base/spec-ini.mkii | 559 +++
tex/context/base/spec-ini.tex | 591 ----
tex/context/base/spec-mis.mkii | 286 ++
tex/context/base/spec-mis.tex | 286 --
tex/context/base/spec-pdf.mkii | 484 +++
tex/context/base/spec-pdf.tex | 484 ---
tex/context/base/spec-ps.mkii | 229 ++
tex/context/base/spec-ps.tex | 229 --
tex/context/base/spec-tpd.mkii | 1334 +++++++
tex/context/base/spec-tpd.tex | 1334 -------
tex/context/base/spec-tr.mkii | 107 +
tex/context/base/spec-tr.tex | 107 -
tex/context/base/spec-tst.mkii | 152 +
tex/context/base/spec-tst.tex | 152 -
tex/context/base/spec-var.mkii | 83 +
tex/context/base/spec-var.tex | 83 -
tex/context/base/spec-win.mkii | 99 +
tex/context/base/spec-win.tex | 99 -
tex/context/base/spec-xet.mkii | 66 +
tex/context/base/spec-xet.tex | 66 -
tex/context/base/spec-xtx.mkii | 87 +
tex/context/base/spec-xtx.tex | 87 -
tex/context/base/spec-yy.mkii | 90 +
tex/context/base/spec-yy.tex | 90 -
tex/context/base/strc-bkm.lua | 124 +-
tex/context/base/strc-def.mkiv | 14 +-
tex/context/base/strc-des.mkiv | 13 +-
tex/context/base/strc-doc.lua | 182 +-
tex/context/base/strc-doc.mkiv | 80 +-
tex/context/base/strc-flt.mkiv | 74 +-
tex/context/base/strc-itm.mkii | 8 +
tex/context/base/strc-itm.mkiv | 48 +-
tex/context/base/strc-lnt.mkii | 197 ++
tex/context/base/strc-lnt.mkiv | 193 ++
tex/context/base/strc-lst.lua | 15 +-
tex/context/base/strc-lst.mkiv | 64 +-
tex/context/base/strc-mar.lua | 2 +-
tex/context/base/strc-mat.mkiv | 30 +-
tex/context/base/strc-not.lua | 102 +-
tex/context/base/strc-not.mkiv | 160 +-
tex/context/base/strc-num.lua | 39 +-
tex/context/base/strc-num.mkiv | 41 +-
tex/context/base/strc-pag.lua | 15 +-
tex/context/base/strc-pag.mkiv | 172 +-
tex/context/base/strc-ref.lua | 421 ++-
tex/context/base/strc-ref.mkiv | 916 ++---
tex/context/base/strc-reg.lua | 158 +-
tex/context/base/strc-reg.mkiv | 192 +-
tex/context/base/strc-ren.mkiv | 74 +-
tex/context/base/strc-sec.mkii | 19 +
tex/context/base/strc-sec.mkiv | 53 +-
tex/context/base/strc-syn.lua | 14 +-
tex/context/base/supp-box.tex | 172 +-
tex/context/base/supp-emp.mkii | 398 +++
tex/context/base/supp-emp.tex | 398 ---
tex/context/base/supp-eps.mkii | 202 ++
tex/context/base/supp-eps.tex | 202 --
tex/context/base/supp-lan.tex | 1377 --------
tex/context/base/supp-mis.mkii | 710 ++++
tex/context/base/supp-mis.tex | 710 ----
tex/context/base/supp-mpe.mkii | 1370 ++++++++
tex/context/base/supp-mpe.tex | 1370 --------
tex/context/base/supp-mps.mkii | 2133 ++++++++++++
tex/context/base/supp-mps.tex | 2133 ------------
tex/context/base/supp-mrk.mkii | 591 ++++
tex/context/base/supp-mrk.tex | 591 ----
tex/context/base/supp-pat.mkii | 179 +
tex/context/base/supp-pat.tex | 179 -
tex/context/base/supp-pdf.mkii | 2187 ++++++++++++
tex/context/base/supp-pdf.tex | 2187 ------------
tex/context/base/supp-ran.mkii | 2 +-
tex/context/base/supp-spe.mkii | 164 +
tex/context/base/supp-spe.tex | 164 -
tex/context/base/supp-tpi.mkii | 353 ++
tex/context/base/supp-tpi.tex | 353 --
tex/context/base/symb-ini.mkii | 281 ++
tex/context/base/symb-ini.mkiv | 281 ++
tex/context/base/symb-ini.tex | 294 --
tex/context/base/symb-jmn.tex | 9 +-
tex/context/base/symb-nav.tex | 10 +-
tex/context/base/symb-run.mkii | 54 +
tex/context/base/symb-run.mkiv | 54 +
tex/context/base/symb-run.tex | 54 -
tex/context/base/syst-aux.mkiv | 89 +-
tex/context/base/syst-ext.mkii | 4980 +++++++++++++++++++++++++++
tex/context/base/syst-ext.tex | 4978 --------------------------
tex/context/base/syst-gen.mkii | 4420 ++++++++++++++++++++++++
tex/context/base/syst-gen.tex | 4420 ------------------------
tex/context/base/syst-ini.tex | 4 +-
tex/context/base/syst-lua.lua | 2 -
tex/context/base/syst-new.mkii | 868 +++++
tex/context/base/syst-new.tex | 868 -----
tex/context/base/syst-tex.mkii | 314 ++
tex/context/base/syst-tex.tex | 314 --
tex/context/base/tabl-ltb.mkii | 866 +++++
tex/context/base/tabl-ltb.mkiv | 866 +++++
tex/context/base/tabl-ltb.tex | 856 -----
tex/context/base/tabl-ntb.mkiv | 3 +-
tex/context/base/tabl-nte.mkii | 107 +
tex/context/base/tabl-nte.mkiv | 107 +
tex/context/base/tabl-nte.tex | 107 -
tex/context/base/tabl-pln.mkii | 91 +
tex/context/base/tabl-pln.mkiv | 91 +
tex/context/base/tabl-pln.tex | 91 -
tex/context/base/tabl-tab.mkii | 2515 ++++++++++++++
tex/context/base/tabl-tab.mkiv | 2515 ++++++++++++++
tex/context/base/tabl-tab.tex | 2507 --------------
tex/context/base/tabl-tbl.mkii | 1439 ++++++++
tex/context/base/tabl-tbl.mkiv | 1472 ++++++++
tex/context/base/tabl-tbl.tex | 1439 --------
tex/context/base/tabl-tsp.mkii | 427 +++
tex/context/base/tabl-tsp.mkiv | 427 +++
tex/context/base/tabl-tsp.tex | 427 ---
tex/context/base/task-ini.lua | 58 +-
tex/context/base/thrd-ran.mkii | 168 +
tex/context/base/thrd-ran.tex | 168 -
tex/context/base/thrd-trg.mkii | 127 +
tex/context/base/thrd-trg.tex | 127 -
tex/context/base/todo-mkii.tex | 1 -
tex/context/base/todo-mkiv.tex | 6 -
tex/context/base/trac-inf.lua | 1 +
tex/context/base/trac-log.lua | 7 +-
tex/context/base/trac-tra.lua | 6 +-
tex/context/base/trac-vis.mkiv | 28 +-
tex/context/base/type-akb.tex | 253 --
tex/context/base/type-dis.tex | 241 --
tex/context/base/type-enc.tex | 1182 -------
tex/context/base/type-exa.tex | 27 -
tex/context/base/type-ini.mkii | 9 +-
tex/context/base/type-ini.mkiv | 145 +-
tex/context/base/type-map.tex | 197 --
tex/context/base/type-old.tex | 320 --
tex/context/base/type-omg.tex | 204 --
tex/context/base/type-one.mkii | 1185 +++++++
tex/context/base/type-one.mkiv | 16 +
tex/context/base/type-one.tex | 1171 +------
tex/context/base/type-otf.mkiv | 244 +-
tex/context/base/type-run.mkii | 51 +
tex/context/base/type-run.mkiv | 51 +
tex/context/base/type-run.tex | 51 -
tex/context/base/type-siz.mkii | 12 +-
tex/context/base/type-siz.mkiv | 460 +--
tex/context/base/type-spe.tex | 49 -
tex/context/base/type-syn.tex | 880 -----
tex/context/base/type-tmf.mkii | 1161 +++++++
tex/context/base/type-tmf.mkiv | 933 +++++
tex/context/base/type-tmf.tex | 1159 +------
tex/context/base/typo-krn.lua | 8 +-
tex/context/base/typo-mir.lua | 6 +-
tex/context/base/unic-000.mkii | 135 +
tex/context/base/unic-000.tex | 135 -
tex/context/base/unic-001.mkii | 220 ++
tex/context/base/unic-001.tex | 220 --
tex/context/base/unic-002.mkii | 104 +
tex/context/base/unic-002.tex | 104 -
tex/context/base/unic-003.mkii | 147 +
tex/context/base/unic-003.tex | 147 -
tex/context/base/unic-004.mkii | 291 ++
tex/context/base/unic-004.tex | 291 --
tex/context/base/unic-005.mkii | 50 +
tex/context/base/unic-005.tex | 50 -
tex/context/base/unic-030.mkii | 113 +
tex/context/base/unic-030.tex | 113 -
tex/context/base/unic-031.mkii | 283 ++
tex/context/base/unic-031.tex | 283 --
tex/context/base/unic-032.mkii | 278 ++
tex/context/base/unic-032.tex | 278 --
tex/context/base/unic-033.mkii | 275 ++
tex/context/base/unic-033.tex | 275 --
tex/context/base/unic-034.mkii | 274 ++
tex/context/base/unic-034.tex | 274 --
tex/context/base/unic-035.mkii | 32 +
tex/context/base/unic-035.tex | 32 -
tex/context/base/unic-037.mkii | 278 ++
tex/context/base/unic-037.tex | 278 --
tex/context/base/unic-039.mkii | 68 +
tex/context/base/unic-039.tex | 68 -
tex/context/base/unic-251.mkii | 34 +
tex/context/base/unic-251.tex | 34 -
tex/context/base/unic-cjk.mkii | 22 +
tex/context/base/unic-cjk.tex | 22 -
tex/context/base/unic-exp.mkii | 82 +
tex/context/base/unic-exp.tex | 82 -
tex/context/base/unic-ini.mkii | 6 +-
tex/context/base/unic-run.mkii | 130 +
tex/context/base/unic-run.tex | 130 -
tex/context/base/verb-c.mkii | 484 +++
tex/context/base/verb-c.tex | 484 ---
tex/context/base/verb-eif.mkii | 211 ++
tex/context/base/verb-eif.tex | 211 --
tex/context/base/verb-ini.mkii | 1810 ++++++++++
tex/context/base/verb-ini.tex | 1810 ----------
tex/context/base/verb-js.mkii | 171 +
tex/context/base/verb-js.tex | 171 -
tex/context/base/verb-jv.mkii | 222 ++
tex/context/base/verb-jv.tex | 222 --
tex/context/base/verb-mp.mkii | 364 ++
tex/context/base/verb-mp.tex | 364 --
tex/context/base/verb-pas.mkii | 266 ++
tex/context/base/verb-pas.tex | 266 --
tex/context/base/verb-pl.mkii | 547 +++
tex/context/base/verb-pl.tex | 547 ---
tex/context/base/verb-raw.mkii | 7 +
tex/context/base/verb-raw.tex | 7 -
tex/context/base/verb-sql.mkii | 230 ++
tex/context/base/verb-sql.tex | 230 --
tex/context/base/verb-tex.mkii | 294 ++
tex/context/base/verb-tex.tex | 294 --
tex/context/base/verb-xml.mkii | 441 +++
tex/context/base/verb-xml.tex | 441 ---
tex/context/base/xetx-chr.mkii | 1167 +++++++
tex/context/base/xetx-chr.tex | 1167 -------
tex/context/base/xetx-cls.mkii | 378 ++
tex/context/base/xetx-cls.tex | 378 --
tex/context/base/xetx-ini.mkii | 132 +
tex/context/base/xetx-ini.tex | 132 -
tex/context/base/xetx-utf.mkii | 1989 +++++++++++
tex/context/base/xetx-utf.tex | 1989 -----------
tex/context/base/xtag-exp.tex | 65 +-
tex/context/base/xtag-ext.tex | 35 +-
tex/context/base/xtag-hyp.tex | 22 +-
tex/context/base/xtag-ini.tex | 13 +-
tex/context/base/xtag-pre.tex | 9 +-
tex/context/bib/bibl-ams.tex | 48 +-
tex/context/bib/t-bib.mkiv | 2 -
tex/context/bib/t-bib.tex | 4 +-
tex/context/interface/cont-cs.xml | 3 +
tex/context/interface/cont-de.xml | 3 +
tex/context/interface/cont-en.xml | 3 +
tex/context/interface/cont-fr.xml | 3 +
tex/context/interface/cont-it.xml | 3 +
tex/context/interface/cont-nl.xml | 3 +
tex/context/interface/cont-pe.xml | 3 +
tex/context/interface/cont-ro.xml | 3 +
tex/context/interface/keys-cs.xml | 2 +
tex/context/interface/keys-de.xml | 2 +
tex/context/interface/keys-en.xml | 2 +
tex/context/interface/keys-fr.xml | 2 +
tex/context/interface/keys-it.xml | 2 +
tex/context/interface/keys-nl.xml | 2 +
tex/context/interface/keys-pe.xml | 2 +
tex/context/interface/keys-ro.xml | 2 +
tex/context/sample/demo-cld.cld | 74 +
tex/context/sample/sample.tex | 8 +-
tex/generic/context/luatex-fonts-merged.lua | 763 ++--
tex/generic/context/luatex-fonts.lua | 5 +-
tex/generic/context/mptopdf.tex | 8 +-
tex/generic/context/ppchtex.noc | 4 +-
tpm/t-bib.tpm | 4 +-
web2c/context.cnf | 4 +-
723 files changed, 125094 insertions(+), 107982 deletions(-)
create mode 100644 context/data/texworks/texworks-context.rme
create mode 100644 fonts/map/luatex/context/demo-font.lum
create mode 100644 scripts/context/lua/mtx-texworks.lua
create mode 100644 scripts/context/lua/mtx-tools.lua
create mode 100644 scripts/context/stubs/mswin/mtxworks.cmd
create mode 100755 scripts/context/stubs/unix/mtxworks
create mode 100644 tex/context/base/bibl-bib.mkiv
delete mode 100644 tex/context/base/bibl-bib.tex
create mode 100644 tex/context/base/core-fil.mkii
create mode 100644 tex/context/base/core-fil.mkiv
delete mode 100644 tex/context/base/core-fil.tex
create mode 100644 tex/context/base/core-gen.mkii
create mode 100644 tex/context/base/core-gen.mkiv
delete mode 100644 tex/context/base/core-gen.tex
create mode 100644 tex/context/base/core-grd.mkii
create mode 100644 tex/context/base/core-grd.mkiv
delete mode 100644 tex/context/base/core-grd.tex
create mode 100644 tex/context/base/core-ini.mkii
create mode 100644 tex/context/base/core-ini.mkiv
delete mode 100644 tex/context/base/core-ini.tex
delete mode 100644 tex/context/base/core-ins.tex
delete mode 100644 tex/context/base/core-lme.tex
delete mode 100644 tex/context/base/core-lnt.tex
delete mode 100644 tex/context/base/core-mak.tex
create mode 100644 tex/context/base/core-par.mkii
delete mode 100644 tex/context/base/core-par.tex
create mode 100644 tex/context/base/core-stg.mkii
delete mode 100644 tex/context/base/core-stg.tex
create mode 100644 tex/context/base/core-var.mkii
create mode 100644 tex/context/base/core-var.mkiv
delete mode 100644 tex/context/base/core-var.tex
create mode 100644 tex/context/base/enco-032.mkii
delete mode 100644 tex/context/base/enco-032.tex
create mode 100644 tex/context/base/enco-037.mkii
delete mode 100644 tex/context/base/enco-037.tex
create mode 100644 tex/context/base/enco-acc.mkii
delete mode 100644 tex/context/base/enco-acc.tex
create mode 100644 tex/context/base/enco-agr.mkii
delete mode 100644 tex/context/base/enco-agr.tex
create mode 100644 tex/context/base/enco-ans.mkii
delete mode 100644 tex/context/base/enco-ans.tex
create mode 100644 tex/context/base/enco-cas.mkii
delete mode 100644 tex/context/base/enco-cas.tex
create mode 100644 tex/context/base/enco-chi.mkii
delete mode 100644 tex/context/base/enco-chi.tex
create mode 100644 tex/context/base/enco-com.mkii
delete mode 100644 tex/context/base/enco-com.tex
create mode 100644 tex/context/base/enco-cyr.mkii
delete mode 100644 tex/context/base/enco-cyr.tex
create mode 100644 tex/context/base/enco-def.mkii
delete mode 100644 tex/context/base/enco-def.tex
create mode 100644 tex/context/base/enco-ec.mkii
delete mode 100644 tex/context/base/enco-ec.tex
create mode 100644 tex/context/base/enco-ecm.mkii
delete mode 100644 tex/context/base/enco-ecm.tex
create mode 100644 tex/context/base/enco-el.mkii
delete mode 100644 tex/context/base/enco-el.tex
create mode 100644 tex/context/base/enco-fde.mkii
delete mode 100644 tex/context/base/enco-fde.tex
create mode 100644 tex/context/base/enco-ffr.mkii
delete mode 100644 tex/context/base/enco-ffr.tex
create mode 100644 tex/context/base/enco-fpl.mkii
delete mode 100644 tex/context/base/enco-fpl.tex
create mode 100644 tex/context/base/enco-fro.mkii
delete mode 100644 tex/context/base/enco-fro.tex
create mode 100644 tex/context/base/enco-fsl.mkii
delete mode 100644 tex/context/base/enco-fsl.tex
create mode 100644 tex/context/base/enco-grk.mkii
delete mode 100644 tex/context/base/enco-grk.tex
create mode 100644 tex/context/base/enco-heb.mkii
delete mode 100644 tex/context/base/enco-heb.tex
create mode 100644 tex/context/base/enco-ibm.mkii
delete mode 100644 tex/context/base/enco-ibm.tex
create mode 100644 tex/context/base/enco-il2.mkii
delete mode 100644 tex/context/base/enco-il2.tex
create mode 100644 tex/context/base/enco-lat.mkii
delete mode 100644 tex/context/base/enco-lat.tex
create mode 100644 tex/context/base/enco-mis.mkii
delete mode 100644 tex/context/base/enco-mis.tex
create mode 100644 tex/context/base/enco-pdf.mkii
delete mode 100644 tex/context/base/enco-pdf.tex
create mode 100644 tex/context/base/enco-pfr.mkii
delete mode 100644 tex/context/base/enco-pfr.tex
create mode 100644 tex/context/base/enco-pol.mkii
delete mode 100644 tex/context/base/enco-pol.tex
create mode 100644 tex/context/base/enco-qx.mkii
delete mode 100644 tex/context/base/enco-qx.tex
create mode 100644 tex/context/base/enco-raw.mkii
delete mode 100644 tex/context/base/enco-raw.tex
create mode 100644 tex/context/base/enco-run.mkii
delete mode 100644 tex/context/base/enco-run.tex
create mode 100644 tex/context/base/enco-t5.mkii
delete mode 100644 tex/context/base/enco-t5.tex
create mode 100644 tex/context/base/enco-tbo.mkii
delete mode 100644 tex/context/base/enco-tbo.tex
create mode 100644 tex/context/base/enco-uc.mkii
delete mode 100644 tex/context/base/enco-uc.tex
create mode 100644 tex/context/base/enco-vis.mkii
delete mode 100644 tex/context/base/enco-vis.tex
create mode 100644 tex/context/base/enco-vna.mkii
delete mode 100644 tex/context/base/enco-vna.tex
create mode 100644 tex/context/base/enco-win.mkii
delete mode 100644 tex/context/base/enco-win.tex
create mode 100644 tex/context/base/enco-x5.mkii
delete mode 100644 tex/context/base/enco-x5.tex
create mode 100644 tex/context/base/filt-bas.mkii
delete mode 100644 tex/context/base/filt-bas.tex
create mode 100644 tex/context/base/filt-ini.mkii
delete mode 100644 tex/context/base/filt-ini.tex
create mode 100644 tex/context/base/font-arb.mkii
delete mode 100644 tex/context/base/font-arb.tex
create mode 100644 tex/context/base/font-bfm.mkii
delete mode 100644 tex/context/base/font-bfm.tex
create mode 100644 tex/context/base/font-chi.mkii
delete mode 100644 tex/context/base/font-chi.tex
create mode 100644 tex/context/base/font-heb.mkii
delete mode 100644 tex/context/base/font-heb.tex
create mode 100644 tex/context/base/font-jap.mkii
delete mode 100644 tex/context/base/font-jap.tex
create mode 100644 tex/context/base/font-run.mkii
create mode 100644 tex/context/base/font-run.mkiv
delete mode 100644 tex/context/base/font-run.tex
create mode 100644 tex/context/base/font-xtx.mkii
delete mode 100644 tex/context/base/font-xtx.tex
create mode 100644 tex/context/base/grph-u3d.lua
create mode 100644 tex/context/base/hand-def.mkii
delete mode 100644 tex/context/base/hand-def.tex
create mode 100644 tex/context/base/java-ini.lua
create mode 100644 tex/context/base/lang-ara.mkiv
delete mode 100644 tex/context/base/lang-ara.tex
create mode 100644 tex/context/base/lang-chi.mkii
delete mode 100644 tex/context/base/lang-chi.tex
create mode 100644 tex/context/base/lang-cjk.mkiv
delete mode 100644 tex/context/base/lang-cjk.tex
create mode 100644 tex/context/base/lang-ctx.mkii
delete mode 100644 tex/context/base/lang-ctx.tex
create mode 100644 tex/context/base/lang-dis.mkii
delete mode 100644 tex/context/base/lang-dis.tex
create mode 100644 tex/context/base/lang-jap.mkii
delete mode 100644 tex/context/base/lang-jap.tex
create mode 100644 tex/context/base/lang-mis.mkii
create mode 100644 tex/context/base/lang-mis.mkiv
delete mode 100644 tex/context/base/lang-mis.tex
create mode 100644 tex/context/base/lang-run.mkii
delete mode 100644 tex/context/base/lang-run.tex
delete mode 100644 tex/context/base/lang-spe.mkiv
create mode 100644 tex/context/base/lpdf-ano.lua
create mode 100644 tex/context/base/lpdf-col.lua
create mode 100644 tex/context/base/lpdf-fld.lua
create mode 100644 tex/context/base/lpdf-grp.lua
create mode 100644 tex/context/base/lpdf-mis.lua
create mode 100644 tex/context/base/lpdf-nod.lua
create mode 100644 tex/context/base/lpdf-ren.lua
create mode 100644 tex/context/base/lpdf-u3d.lua
create mode 100644 tex/context/base/lpdf-wid.lua
create mode 100644 tex/context/base/lxml-ini.mkiv
delete mode 100644 tex/context/base/lxml-ini.tex
create mode 100644 tex/context/base/m-format.tex
create mode 100644 tex/context/base/math-ams.mkii
delete mode 100644 tex/context/base/math-ams.tex
create mode 100644 tex/context/base/math-cow.mkii
delete mode 100644 tex/context/base/math-cow.tex
create mode 100644 tex/context/base/math-eul.mkii
delete mode 100644 tex/context/base/math-eul.tex
create mode 100644 tex/context/base/math-fou.mkii
delete mode 100644 tex/context/base/math-fou.tex
create mode 100644 tex/context/base/math-lbr.mkii
delete mode 100644 tex/context/base/math-lbr.tex
create mode 100644 tex/context/base/math-tex.mkii
delete mode 100644 tex/context/base/math-tex.tex
create mode 100644 tex/context/base/math-tim.mkii
delete mode 100644 tex/context/base/math-tim.tex
create mode 100644 tex/context/base/math-uni.mkii
delete mode 100644 tex/context/base/math-uni.tex
create mode 100644 tex/context/base/meta-pag.mkii
create mode 100644 tex/context/base/meta-pag.mkiv
delete mode 100644 tex/context/base/meta-pag.tex
create mode 100644 tex/context/base/meta-pdh.mkiv
create mode 100644 tex/context/base/mult-cld.lua
create mode 100644 tex/context/base/mult-cld.mkiv
delete mode 100644 tex/context/base/mult-his.tex
create mode 100644 tex/context/base/node-ref.lua
create mode 100644 tex/context/base/pack-bar.mkiv
create mode 100644 tex/context/base/page-app.mkii
create mode 100644 tex/context/base/page-app.mkiv
delete mode 100644 tex/context/base/page-app.tex
create mode 100644 tex/context/base/page-flw.mkii
create mode 100644 tex/context/base/page-flw.mkiv
delete mode 100644 tex/context/base/page-flw.tex
create mode 100644 tex/context/base/page-imp.mkii
create mode 100644 tex/context/base/page-imp.mkiv
delete mode 100644 tex/context/base/page-imp.tex
create mode 100644 tex/context/base/page-ins.mkii
create mode 100644 tex/context/base/page-ins.mkiv
create mode 100644 tex/context/base/page-lay.mkii
create mode 100644 tex/context/base/page-lay.mkiv
delete mode 100644 tex/context/base/page-lay.tex
create mode 100644 tex/context/base/page-log.mkii
delete mode 100644 tex/context/base/page-log.tex
create mode 100644 tex/context/base/page-mak.mkii
create mode 100644 tex/context/base/page-mak.mkiv
delete mode 100644 tex/context/base/page-mak.tex
create mode 100644 tex/context/base/page-mar.mkii
create mode 100644 tex/context/base/page-mar.mkiv
delete mode 100644 tex/context/base/page-mar.tex
create mode 100644 tex/context/base/page-mis.mkii
create mode 100644 tex/context/base/page-mis.mkiv
delete mode 100644 tex/context/base/page-mis.tex
create mode 100644 tex/context/base/page-mul.mkii
create mode 100644 tex/context/base/page-mul.mkiv
delete mode 100644 tex/context/base/page-mul.tex
delete mode 100644 tex/context/base/page-new.tex
create mode 100644 tex/context/base/page-not.mkii
create mode 100644 tex/context/base/page-not.mkiv
delete mode 100644 tex/context/base/page-not.tex
create mode 100644 tex/context/base/page-par.mkii
create mode 100644 tex/context/base/page-par.mkiv
delete mode 100644 tex/context/base/page-par.tex
create mode 100644 tex/context/base/page-plg.mkii
create mode 100644 tex/context/base/page-plg.mkiv
delete mode 100644 tex/context/base/page-plg.tex
create mode 100644 tex/context/base/page-run.mkii
create mode 100644 tex/context/base/page-run.mkiv
delete mode 100644 tex/context/base/page-run.tex
create mode 100644 tex/context/base/page-set.mkii
create mode 100644 tex/context/base/page-set.mkiv
delete mode 100644 tex/context/base/page-set.tex
create mode 100644 tex/context/base/page-sid.mkii
create mode 100644 tex/context/base/page-sid.mkiv
delete mode 100644 tex/context/base/page-sid.tex
create mode 100644 tex/context/base/page-spr.mkii
create mode 100644 tex/context/base/page-spr.mkiv
delete mode 100644 tex/context/base/page-spr.tex
create mode 100644 tex/context/base/page-str.mkii
create mode 100644 tex/context/base/page-str.mkiv
delete mode 100644 tex/context/base/page-str.tex
create mode 100644 tex/context/base/pdfr-def.mkii
delete mode 100644 tex/context/base/pdfr-def.tex
create mode 100644 tex/context/base/pdfr-ec.mkii
delete mode 100644 tex/context/base/pdfr-ec.tex
create mode 100644 tex/context/base/pdfr-il2.mkii
create mode 100644 tex/context/base/regi-8859-1.mkii
delete mode 100644 tex/context/base/regi-8859-1.tex
create mode 100644 tex/context/base/regi-8859-10.mkii
delete mode 100644 tex/context/base/regi-8859-10.tex
create mode 100644 tex/context/base/regi-8859-13.mkii
delete mode 100644 tex/context/base/regi-8859-13.tex
create mode 100644 tex/context/base/regi-8859-15.mkii
delete mode 100644 tex/context/base/regi-8859-15.tex
create mode 100644 tex/context/base/regi-8859-16.mkii
delete mode 100644 tex/context/base/regi-8859-16.tex
create mode 100644 tex/context/base/regi-8859-2.mkii
delete mode 100644 tex/context/base/regi-8859-2.tex
create mode 100644 tex/context/base/regi-8859-3.mkii
delete mode 100644 tex/context/base/regi-8859-3.tex
create mode 100644 tex/context/base/regi-8859-4.mkii
delete mode 100644 tex/context/base/regi-8859-4.tex
create mode 100644 tex/context/base/regi-8859-5.mkii
delete mode 100644 tex/context/base/regi-8859-5.tex
create mode 100644 tex/context/base/regi-8859-7.mkii
delete mode 100644 tex/context/base/regi-8859-7.tex
create mode 100644 tex/context/base/regi-8859-9.mkii
delete mode 100644 tex/context/base/regi-8859-9.tex
create mode 100644 tex/context/base/regi-cp1250.mkii
delete mode 100644 tex/context/base/regi-cp1250.tex
create mode 100644 tex/context/base/regi-cp1251.mkii
delete mode 100644 tex/context/base/regi-cp1251.tex
create mode 100644 tex/context/base/regi-cp1252.mkii
delete mode 100644 tex/context/base/regi-cp1252.tex
create mode 100644 tex/context/base/regi-cp1253.mkii
delete mode 100644 tex/context/base/regi-cp1253.tex
create mode 100644 tex/context/base/regi-cp1254.mkii
delete mode 100644 tex/context/base/regi-cp1254.tex
create mode 100644 tex/context/base/regi-cp1257.mkii
delete mode 100644 tex/context/base/regi-cp1257.tex
create mode 100644 tex/context/base/regi-cyp.mkii
delete mode 100644 tex/context/base/regi-cyp.tex
create mode 100644 tex/context/base/regi-cyr.mkii
delete mode 100644 tex/context/base/regi-cyr.tex
create mode 100644 tex/context/base/regi-def.mkii
delete mode 100644 tex/context/base/regi-def.tex
create mode 100644 tex/context/base/regi-ibm.mkii
delete mode 100644 tex/context/base/regi-ibm.tex
create mode 100644 tex/context/base/regi-mac.mkii
delete mode 100644 tex/context/base/regi-mac.tex
delete mode 100644 tex/context/base/regi-run.mkii
create mode 100644 tex/context/base/regi-uni.mkii
delete mode 100644 tex/context/base/regi-uni.tex
create mode 100644 tex/context/base/regi-utf.mkii
delete mode 100644 tex/context/base/regi-utf.tex
create mode 100644 tex/context/base/regi-vis.mkii
delete mode 100644 tex/context/base/regi-vis.tex
create mode 100644 tex/context/base/s-pre-11.tex
create mode 100644 tex/context/base/s-pre-12.tex
create mode 100644 tex/context/base/s-pre-17.tex
create mode 100644 tex/context/base/s-pre-18.tex
create mode 100644 tex/context/base/s-pre-26.tex
create mode 100644 tex/context/base/s-pre-27.tex
create mode 100644 tex/context/base/s-pre-93.tex
create mode 100644 tex/context/base/scrn-bar.mkiv
create mode 100644 tex/context/base/scrn-but.mkiv
create mode 100644 tex/context/base/scrn-int.lua
create mode 100644 tex/context/base/scrn-men.mkiv
create mode 100644 tex/context/base/sort-def.mkii
delete mode 100644 tex/context/base/sort-def.tex
create mode 100644 tex/context/base/sort-lan.mkii
delete mode 100644 tex/context/base/sort-lan.tex
create mode 100644 tex/context/base/spec-def.mkii
delete mode 100644 tex/context/base/spec-def.tex
create mode 100644 tex/context/base/spec-dpm.mkii
delete mode 100644 tex/context/base/spec-dpm.tex
create mode 100644 tex/context/base/spec-dpx.mkii
delete mode 100644 tex/context/base/spec-dpx.tex
create mode 100644 tex/context/base/spec-dvi.mkii
delete mode 100644 tex/context/base/spec-dvi.tex
create mode 100644 tex/context/base/spec-fdf.mkii
delete mode 100644 tex/context/base/spec-fdf.tex
create mode 100644 tex/context/base/spec-ini.mkii
delete mode 100644 tex/context/base/spec-ini.tex
create mode 100644 tex/context/base/spec-mis.mkii
delete mode 100644 tex/context/base/spec-mis.tex
create mode 100644 tex/context/base/spec-pdf.mkii
delete mode 100644 tex/context/base/spec-pdf.tex
create mode 100644 tex/context/base/spec-ps.mkii
delete mode 100644 tex/context/base/spec-ps.tex
create mode 100644 tex/context/base/spec-tpd.mkii
delete mode 100644 tex/context/base/spec-tpd.tex
create mode 100644 tex/context/base/spec-tr.mkii
delete mode 100644 tex/context/base/spec-tr.tex
create mode 100644 tex/context/base/spec-tst.mkii
delete mode 100644 tex/context/base/spec-tst.tex
create mode 100644 tex/context/base/spec-var.mkii
delete mode 100644 tex/context/base/spec-var.tex
create mode 100644 tex/context/base/spec-win.mkii
delete mode 100644 tex/context/base/spec-win.tex
create mode 100644 tex/context/base/spec-xet.mkii
delete mode 100644 tex/context/base/spec-xet.tex
create mode 100644 tex/context/base/spec-xtx.mkii
delete mode 100644 tex/context/base/spec-xtx.tex
create mode 100644 tex/context/base/spec-yy.mkii
delete mode 100644 tex/context/base/spec-yy.tex
create mode 100644 tex/context/base/strc-lnt.mkii
create mode 100644 tex/context/base/strc-lnt.mkiv
create mode 100644 tex/context/base/supp-emp.mkii
delete mode 100644 tex/context/base/supp-emp.tex
create mode 100644 tex/context/base/supp-eps.mkii
delete mode 100644 tex/context/base/supp-eps.tex
delete mode 100644 tex/context/base/supp-lan.tex
create mode 100644 tex/context/base/supp-mis.mkii
delete mode 100644 tex/context/base/supp-mis.tex
create mode 100644 tex/context/base/supp-mpe.mkii
delete mode 100644 tex/context/base/supp-mpe.tex
create mode 100644 tex/context/base/supp-mps.mkii
delete mode 100644 tex/context/base/supp-mps.tex
create mode 100644 tex/context/base/supp-mrk.mkii
delete mode 100644 tex/context/base/supp-mrk.tex
create mode 100644 tex/context/base/supp-pat.mkii
delete mode 100644 tex/context/base/supp-pat.tex
create mode 100644 tex/context/base/supp-pdf.mkii
delete mode 100644 tex/context/base/supp-pdf.tex
create mode 100644 tex/context/base/supp-spe.mkii
delete mode 100644 tex/context/base/supp-spe.tex
create mode 100644 tex/context/base/supp-tpi.mkii
delete mode 100644 tex/context/base/supp-tpi.tex
create mode 100644 tex/context/base/symb-ini.mkii
create mode 100644 tex/context/base/symb-ini.mkiv
delete mode 100644 tex/context/base/symb-ini.tex
create mode 100644 tex/context/base/symb-run.mkii
create mode 100644 tex/context/base/symb-run.mkiv
delete mode 100644 tex/context/base/symb-run.tex
create mode 100644 tex/context/base/syst-ext.mkii
delete mode 100644 tex/context/base/syst-ext.tex
create mode 100644 tex/context/base/syst-gen.mkii
delete mode 100644 tex/context/base/syst-gen.tex
create mode 100644 tex/context/base/syst-new.mkii
delete mode 100644 tex/context/base/syst-new.tex
create mode 100644 tex/context/base/syst-tex.mkii
delete mode 100644 tex/context/base/syst-tex.tex
create mode 100644 tex/context/base/tabl-ltb.mkii
create mode 100644 tex/context/base/tabl-ltb.mkiv
delete mode 100644 tex/context/base/tabl-ltb.tex
create mode 100644 tex/context/base/tabl-nte.mkii
create mode 100644 tex/context/base/tabl-nte.mkiv
delete mode 100644 tex/context/base/tabl-nte.tex
create mode 100644 tex/context/base/tabl-pln.mkii
create mode 100644 tex/context/base/tabl-pln.mkiv
delete mode 100644 tex/context/base/tabl-pln.tex
create mode 100644 tex/context/base/tabl-tab.mkii
create mode 100644 tex/context/base/tabl-tab.mkiv
delete mode 100644 tex/context/base/tabl-tab.tex
create mode 100644 tex/context/base/tabl-tbl.mkii
create mode 100644 tex/context/base/tabl-tbl.mkiv
delete mode 100644 tex/context/base/tabl-tbl.tex
create mode 100644 tex/context/base/tabl-tsp.mkii
create mode 100644 tex/context/base/tabl-tsp.mkiv
delete mode 100644 tex/context/base/tabl-tsp.tex
create mode 100644 tex/context/base/thrd-ran.mkii
delete mode 100644 tex/context/base/thrd-ran.tex
create mode 100644 tex/context/base/thrd-trg.mkii
delete mode 100644 tex/context/base/thrd-trg.tex
delete mode 100644 tex/context/base/todo-mkii.tex
delete mode 100644 tex/context/base/todo-mkiv.tex
delete mode 100644 tex/context/base/type-akb.tex
delete mode 100644 tex/context/base/type-dis.tex
delete mode 100644 tex/context/base/type-enc.tex
delete mode 100644 tex/context/base/type-exa.tex
delete mode 100644 tex/context/base/type-map.tex
delete mode 100644 tex/context/base/type-old.tex
delete mode 100644 tex/context/base/type-omg.tex
create mode 100644 tex/context/base/type-one.mkii
create mode 100644 tex/context/base/type-one.mkiv
create mode 100644 tex/context/base/type-run.mkii
create mode 100644 tex/context/base/type-run.mkiv
delete mode 100644 tex/context/base/type-run.tex
delete mode 100644 tex/context/base/type-spe.tex
delete mode 100644 tex/context/base/type-syn.tex
create mode 100644 tex/context/base/type-tmf.mkii
create mode 100644 tex/context/base/type-tmf.mkiv
create mode 100644 tex/context/base/unic-000.mkii
delete mode 100644 tex/context/base/unic-000.tex
create mode 100644 tex/context/base/unic-001.mkii
delete mode 100644 tex/context/base/unic-001.tex
create mode 100644 tex/context/base/unic-002.mkii
delete mode 100644 tex/context/base/unic-002.tex
create mode 100644 tex/context/base/unic-003.mkii
delete mode 100644 tex/context/base/unic-003.tex
create mode 100644 tex/context/base/unic-004.mkii
delete mode 100644 tex/context/base/unic-004.tex
create mode 100644 tex/context/base/unic-005.mkii
delete mode 100644 tex/context/base/unic-005.tex
create mode 100644 tex/context/base/unic-030.mkii
delete mode 100644 tex/context/base/unic-030.tex
create mode 100644 tex/context/base/unic-031.mkii
delete mode 100644 tex/context/base/unic-031.tex
create mode 100644 tex/context/base/unic-032.mkii
delete mode 100644 tex/context/base/unic-032.tex
create mode 100644 tex/context/base/unic-033.mkii
delete mode 100644 tex/context/base/unic-033.tex
create mode 100644 tex/context/base/unic-034.mkii
delete mode 100644 tex/context/base/unic-034.tex
create mode 100644 tex/context/base/unic-035.mkii
delete mode 100644 tex/context/base/unic-035.tex
create mode 100644 tex/context/base/unic-037.mkii
delete mode 100644 tex/context/base/unic-037.tex
create mode 100644 tex/context/base/unic-039.mkii
delete mode 100644 tex/context/base/unic-039.tex
create mode 100644 tex/context/base/unic-251.mkii
delete mode 100644 tex/context/base/unic-251.tex
create mode 100644 tex/context/base/unic-cjk.mkii
delete mode 100644 tex/context/base/unic-cjk.tex
create mode 100644 tex/context/base/unic-exp.mkii
delete mode 100644 tex/context/base/unic-exp.tex
create mode 100644 tex/context/base/unic-run.mkii
delete mode 100644 tex/context/base/unic-run.tex
create mode 100644 tex/context/base/verb-c.mkii
delete mode 100644 tex/context/base/verb-c.tex
create mode 100644 tex/context/base/verb-eif.mkii
delete mode 100644 tex/context/base/verb-eif.tex
create mode 100644 tex/context/base/verb-ini.mkii
delete mode 100644 tex/context/base/verb-ini.tex
create mode 100644 tex/context/base/verb-js.mkii
delete mode 100644 tex/context/base/verb-js.tex
create mode 100644 tex/context/base/verb-jv.mkii
delete mode 100644 tex/context/base/verb-jv.tex
create mode 100644 tex/context/base/verb-mp.mkii
delete mode 100644 tex/context/base/verb-mp.tex
create mode 100644 tex/context/base/verb-pas.mkii
delete mode 100644 tex/context/base/verb-pas.tex
create mode 100644 tex/context/base/verb-pl.mkii
delete mode 100644 tex/context/base/verb-pl.tex
create mode 100644 tex/context/base/verb-raw.mkii
delete mode 100644 tex/context/base/verb-raw.tex
create mode 100644 tex/context/base/verb-sql.mkii
delete mode 100644 tex/context/base/verb-sql.tex
create mode 100644 tex/context/base/verb-tex.mkii
delete mode 100644 tex/context/base/verb-tex.tex
create mode 100644 tex/context/base/verb-xml.mkii
delete mode 100644 tex/context/base/verb-xml.tex
create mode 100644 tex/context/base/xetx-chr.mkii
delete mode 100644 tex/context/base/xetx-chr.tex
create mode 100644 tex/context/base/xetx-cls.mkii
delete mode 100644 tex/context/base/xetx-cls.tex
create mode 100644 tex/context/base/xetx-ini.mkii
delete mode 100644 tex/context/base/xetx-ini.tex
create mode 100644 tex/context/base/xetx-utf.mkii
delete mode 100644 tex/context/base/xetx-utf.tex
create mode 100644 tex/context/sample/demo-cld.cld
diff --git a/context/data/texworks/TUG/texworks.ini b/context/data/texworks/TUG/texworks.ini
index a0ff34539..8ef43433e 100644
--- a/context/data/texworks/TUG/texworks.ini
+++ b/context/data/texworks/TUG/texworks.ini
@@ -12,10 +12,10 @@ previewScale=200
magnifierSize=2
circularMagnifier=true
defaultEngine=ConTeXt MkIV
-binaryPaths=E:/context/lua, E:/tex/texmf-mswin/bin
+binaryPaths=
autoHideConsole=false
-openDialogDir=E:/context/manuals/mk
-recentFileList=D:/texworks/bin/texworks-setup.ini, E:/context/manuals/mk/mk-math.tex, E:/tmp/oeps.tex
+openDialogDir=
+recentFileList=
[engines]
size=6
diff --git a/context/data/texworks/texworks-context.rme b/context/data/texworks/texworks-context.rme
new file mode 100644
index 000000000..7019cb78e
--- /dev/null
+++ b/context/data/texworks/texworks-context.rme
@@ -0,0 +1,2 @@
+This is just a placeholder. We need to make sure that we end
+up here in case of multiple texworks ini files.
diff --git a/context/data/texworks/texworks-setup.ini b/context/data/texworks/texworks-setup.ini
index 1c638fc1b..6357e775b 100644
--- a/context/data/texworks/texworks-setup.ini
+++ b/context/data/texworks/texworks-setup.ini
@@ -1,2 +1,2 @@
-inipath=./../../texmf-context/context/data/texworks
-libpath=./../../texmf-context/context/data/texworks
+inipath=.
+libpath=.
diff --git a/fonts/map/luatex/context/demo-font.lum b/fonts/map/luatex/context/demo-font.lum
new file mode 100644
index 000000000..0beca031b
--- /dev/null
+++ b/fonts/map/luatex/context/demo-font.lum
@@ -0,0 +1,70 @@
+if not modules then modules = { } end modules ['demo-font.lum'] = {
+ version = 1.001,
+ comment = "companion to font-map.lua",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+--[[
+
+ After some testing Taco and I decided that the lack of information
+ with regards to unicode mapping of alternative shapes can best be
+ handled by an auxiliary table. So, here is an example. This file
+ gets its place in TDS in:
+
+ /fonts/map/luatex/context/demo-file.lum
+
+ We recommend that you use a lowercase filename, just to prevent
+ lookup errors. Font filenames are already such a mess.
+
+ A test file, dedicated to Dohyun Kim is:
+
+ \usemodule[fnt-20]
+
+ \starttext
+
+ \definefontfeature
+ [otftracker-kozminprovi-regular]
+ [mode=node,vrt2=yes,script=latn]
+
+ \setvariables
+ [otftracker]
+ [font=kozminprovi-regular,
+ sample=\char"3002]
+
+ \stoptext
+
+ In the resulting pdf file you will then find:
+
+ begincmap
+ /CIDSystemInfo
+ << /Registry (TeX)
+ /Ordering (FNUMTE-KozMinProVI-Regular)
+ /Supplement 0
+ >> def
+ /CMapName /TeX-Identity-FNUMTE-KozMinProVI-Regular def
+ /CMapType 2 def
+ 1 begincodespacerange
+ <0000>
+ endcodespacerange
+ 0 beginbfrange
+ endbfrange
+ 2 beginbfchar
+ <027B> <3002>
+ <1ED0> <3002>
+ endbfchar
+ endcmap
+
+ Of course this assumes that the font used is the same as we
+ have on our machines.
+
+]]--
+
+return {
+ version = 1.00,
+ fontname = "kozminprovi-regular.otf",
+ tounicode = {
+ ["Japan1.7888"] = 0x3002,
+ },
+}
diff --git a/metapost/context/base/mp-core.mp b/metapost/context/base/mp-core.mp
index 6720fe90d..7c5d5a1c1 100644
--- a/metapost/context/base/mp-core.mp
+++ b/metapost/context/base/mp-core.mp
@@ -346,7 +346,7 @@ boolean force_multi_par_chain ; force_multi_par_chain := true ;
boolean one_piece_multi_par ; one_piece_multi_par := false ;
boolean check_multi_par_chain ; check_multi_par_chain := true ; % extra page check
-boolean multi_column_first_page_hack; multi_column_first_page_hack := false ;
+boolean multi_column_first_page_hack; multi_column_first_page_hack := true ; % seems to work ok
def simplify_multi_pars = % boundingbox ipv shape als optie
for i := 1 upto nofmultipars :
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua
index 3e0abb1e7..71d2eee56 100644
--- a/scripts/context/lua/mtx-context.lua
+++ b/scripts/context/lua/mtx-context.lua
@@ -9,6 +9,13 @@ if not modules then modules = { } end modules ['mtx-context'] = {
scripts = scripts or { }
scripts.context = scripts.context or { }
+-- a demo cld file:
+--
+-- context.starttext()
+-- context.chapter("Hello There")
+-- context.readfile("tufte","","not found")
+-- context.stoptext()
+
-- l-file / todo
function file.needsupdate(oldfile,newfile)
@@ -521,6 +528,10 @@ end
-- end
-- end
+scripts.context.cldsuffixes = table.tohash {
+ "cld",
+}
+
scripts.context.xmlsuffixes = table.tohash {
"xml",
}
@@ -648,6 +659,7 @@ function scripts.context.run(ctxdata,filename)
if a and (a.engine == 'pdftex' or a.engine == 'xetex' or environment.argument("pdftex") or environment.argument("xetex")) then
local texexec = resolvers.find_file("texexec.rb") or ""
if texexec ~= "" then
+ os.setenv("RUBYOPT","")
local command = string.format("ruby %s %s",texexec,environment.reconstruct_commandline(environment.arguments_after))
os.exec(command)
end
@@ -672,7 +684,9 @@ function scripts.context.run(ctxdata,filename)
else
filename = makestub("\\xmlprocess{\\xmldocument}{%s}{}",filename)
end
- elseif scripts.context.luasuffixes[suffix] then
+ elseif scripts.context.cldsuffixes[suffix] or environment.argument("forcecld") then
+ filename = makestub("\\ctxlua{context.runfile('%s')}",filename)
+ elseif scripts.context.luasuffixes[suffix] or environment.argument("forcelua") then
filename = makestub("\\ctxlua{dofile('%s')}",filename)
end
--
@@ -1333,6 +1347,7 @@ messages.help = [[
--ctx=name use ctx file
--version report installed context version
--forcexml force xml stub (optional flag: --mkii)
+--forcecld force cld (context lua document) stub
--autopdf close pdf file in viewer and start pdf viewer afterwards
--once only one run
--purge(all) purge files (--pattern=...)
diff --git a/scripts/context/lua/mtx-convert.lua b/scripts/context/lua/mtx-convert.lua
index cf1d640c5..c0c383b17 100644
--- a/scripts/context/lua/mtx-convert.lua
+++ b/scripts/context/lua/mtx-convert.lua
@@ -6,66 +6,88 @@ if not modules then modules = { } end modules ['mtx-convert'] = {
license = "see context related readme files"
}
-do
+-- todo: eps and svg
- graphics = graphics or { }
- graphics.converters = graphics.converters or { }
+graphics = graphics or { }
+graphics.converters = graphics.converters or { }
- local gsprogram = (os.platform == "windows" and "gswin32c") or "gs"
- local gstemplate = "%s -q -sDEVICE=pdfwrite -dEPSCrop -dNOPAUSE -dNOCACHE -dBATCH -dAutoRotatePages=/None -dProcessColorModel=/DeviceCMYK -sOutputFile=%s %s -c quit"
+local gsprogram = (os.platform == "windows" and "gswin32c") or "gs"
+local gstemplate = "%s -q -sDEVICE=pdfwrite -dEPSCrop -dNOPAUSE -dNOCACHE -dBATCH -dAutoRotatePages=/None -dProcessColorModel=/DeviceCMYK -sOutputFile=%s %s -c quit"
- function graphics.converters.eps(oldname,newname)
- return gstemplate:format(gsprogram,newname,oldname)
- end
+function graphics.converters.eps(oldname,newname)
+ return gstemplate:format(gsprogram,newname,oldname)
+end
- local improgram = "convert"
- local imtemplate = {
- low = "%s -quality 0 -compress zip %s pdf:%s",
- medium = "%s -quality 75 -compress zip %s pdf:%s",
- high = "%s -quality 100 -compress zip %s pdf:%s",
- }
-
- function graphics.converters.jpg(oldname,newname)
- local ea = environment.arguments
- local quality = (ea.high and 'high') or (ea.medium and 'medium') or (ea.low and 'low') or 'high'
- return imtemplate[quality]:format(improgram,oldname,newname)
+local improgram = "convert"
+local imtemplate = {
+ low = "%s -quality 0 -compress zip %s pdf:%s",
+ medium = "%s -quality 75 -compress zip %s pdf:%s",
+ high = "%s -quality 100 -compress zip %s pdf:%s",
+}
+
+function graphics.converters.jpg(oldname,newname)
+ local ea = environment.arguments
+ local quality = (ea.high and 'high') or (ea.medium and 'medium') or (ea.low and 'low') or 'high'
+ return imtemplate[quality]:format(improgram,oldname,newname)
+end
+
+graphics.converters.tif = graphics.converters.jpg
+graphics.converters.tiff = graphics.converters.jpg
+graphics.converters.png = graphics.converters.jpg
+
+local function convert(kind,oldname,newname)
+ if graphics.converters[kind] then -- extra test
+ local tmpname = file.replacesuffix(newname,"tmp")
+ local command = graphics.converters[kind](oldname,tmpname)
+ logs.simple("command: %s",command)
+ io.flush()
+ os.spawn(command)
+ os.remove(newname)
+ os.rename(tmpname,newname)
+ if lfs.attributes(newname,"size") == 0 then
+ os.remove(newname)
+ end
end
+end
- graphics.converters.tif = graphics.converters.jpg
- graphics.converters.tiff = graphics.converters.jpg
- graphics.converters.png = graphics.converters.jpg
-
- function graphics.converters.convertpath(inputpath,outputpath)
- inputpath = inputpath or "."
- outputpath = outputpath or "."
- for name in lfs.dir(inputpath) do
- local suffix = file.extname(name)
- if name:find("%.$") then
- -- skip . and ..
- elseif graphics.converters[suffix] then
- local oldname = file.join(inputpath,name)
- local newname = file.join(outputpath,file.replacesuffix(name,"pdf"))
- local et = lfs.attributes(oldname,"modification")
- local pt = lfs.attributes(newname,"modification")
- if not pt or et > pt then
- dir.mkdirs(outputpath)
- local tmpname = file.replacesuffix(newname,"tmp")
- local command = graphics.converters[suffix](oldname,tmpname)
- logs.simple("command: %s",command)
- io.flush()
- os.spawn(command)
- os.remove(newname)
- os.rename(tmpname,newname)
- if lfs.attributes(newname,"size") == 0 then
- os.remove(newname)
- end
- end
- elseif lfs.isdir(inputpath .. "/".. name) then
- graphics.converters.convertpath(inputpath .. "/".. name,outputpath .. "/".. name)
+function graphics.converters.convertpath(inputpath,outputpath)
+ inputpath = inputpath or "."
+ outputpath = outputpath or "."
+ for name in lfs.dir(inputpath) do
+ local suffix = file.extname(name)
+ if name:find("%.$") then
+ -- skip . and ..
+ elseif graphics.converters[suffix] then
+ local oldname = file.join(inputpath,name)
+ local newname = file.join(outputpath,file.replacesuffix(name,"pdf"))
+ local et = lfs.attributes(oldname,"modification")
+ local pt = lfs.attributes(newname,"modification")
+ if not pt or et > pt then
+ dir.mkdirs(outputpath)
+ convert(suffix,oldname,newname)
end
+ elseif lfs.isdir(inputpath .. "/".. name) then
+ graphics.converters.convertpath(inputpath .. "/".. name,outputpath .. "/".. name)
end
end
+end
+function graphics.converters.convertfile(oldname)
+ local suffix = file.extname(oldname)
+ if graphics.converters[suffix] then
+ local newname = file.replacesuffix(name,"pdf")
+ if oldname == newname then
+ -- todo: downsample, crop etc
+ elseif environment.argument("force") then
+ convert(suffix,oldname,newname)
+ else
+ local et = lfs.attributes(oldname,"modification")
+ local pt = lfs.attributes(newname,"modification")
+ if not pt or et > pt then
+ convert(suffix,oldname,newname)
+ end
+ end
+ end
end
scripts = scripts or { }
@@ -88,6 +110,13 @@ function scripts.convert.convertall()
end
end
+function scripts.convert.convertgiven()
+ for _, name in ipairs(environment.files) do
+ graphics.converters.convertfile(name)
+ end
+end
+
+
logs.extendbanner("Graphic Conversion Tools 0.10",true)
messages.help = [[
@@ -95,11 +124,14 @@ messages.help = [[
--inputpath=string original graphics path
--outputpath=string converted graphics path
--watch watch folders
+--force force conversion (even if older)
--delay time between sweeps
]]
if environment.argument("convertall") then
scripts.convert.convertall()
+elseif environment.files[1] then
+ scripts.convert.convertgiven()
else
logs.help(messages.help)
end
diff --git a/scripts/context/lua/mtx-grep.lua b/scripts/context/lua/mtx-grep.lua
index 82a80314a..a6617d711 100644
--- a/scripts/context/lua/mtx-grep.lua
+++ b/scripts/context/lua/mtx-grep.lua
@@ -44,7 +44,7 @@ function scripts.grep.find(pattern, files, offset)
-- skip
elseif find(line,pattern) then
m = m + 1
- write_nl(format("%s %s: %s",name,n,line))
+ write_nl(format("%s %6i: %s",name,n,line))
io.flush()
end
end
@@ -62,7 +62,7 @@ function scripts.grep.find(pattern, files, offset)
n = n + 1
if find(line,pattern) then
m = m + 1
- write_nl(format("%s %s: %s",name,n,line))
+ write_nl(format("%s %6i: %s",name,n,line))
io.flush()
end
end
diff --git a/scripts/context/lua/mtx-texworks.lua b/scripts/context/lua/mtx-texworks.lua
new file mode 100644
index 000000000..f525d5336
--- /dev/null
+++ b/scripts/context/lua/mtx-texworks.lua
@@ -0,0 +1,96 @@
+if not modules then modules = { } end modules ['mtx-texworks'] = {
+ version = 1.002,
+ comment = "companion to mtxrun.lua",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+scripts = scripts or { }
+scripts.texworks = scripts.texworks or { }
+
+local texworkspaths = {
+ "completion",
+ "configuration",
+ "dictionaries",
+ "translations",
+ "scripts",
+ "templates",
+ "TUG"
+}
+
+local texworkssignal = "texworks-context.rme"
+local texworkininame = "TeXworks.ini"
+
+function scripts.texworks.start(indeed)
+ local is_mswin = os.platform == "windows"
+ local workname = (is_mswin and "texworks.exe") or "TeXworks"
+ local fullname = nil
+ local binpaths = file.split_path(os.getenv("PATH")) or file.split_path(os.getenv("path"))
+ local datapath = resolvers.find_file(texworkssignal,"other text files") or ""
+ if datapath ~= "" then
+ datapath = file.dirname(datapath) -- data
+ if datapath == "" then
+ datapath = resolvers.ownpath
+ end
+ else
+ datapath = resolvers.find_file(texworkininame,"other text files") or ""
+ if datapath == "" then
+ datapath = resolvers.find_file(string.lower(texworkininame),"other text files") or ""
+ end
+ if datapath ~= "" and lfs.isfile(datapath) then
+ datapath = file.dirname(datapath) -- TUG
+ datapath = file.dirname(datapath) -- data
+ if datapath == "" then
+ datapath = resolvers.ownpath
+ end
+ end
+ end
+ if datapath == "" then
+ logs.simple("invalid datapath, maybe you need to regenerate the file database")
+ return false
+ end
+ if not binpaths or #binpaths == 0 then
+ logs.simple("invalid binpath")
+ return false
+ end
+ for i=1,#binpaths do
+ local p = file.join(binpaths[i],workname)
+ if lfs.isfile(p) then
+ fullname = p
+ break
+ end
+ end
+ if not fullname then
+ logs.simple("unable to locate %s",workname)
+ return false
+ end
+ for _, subpath in ipairs(texworkspaths) do
+ dir.makedirs(file.join(datapath,subpath))
+ end
+ os.setenv("TW_INIPATH",datapath)
+ os.setenv("TW_LIBPATH",datapath)
+ if not indeed or environment.argument("verbose") then
+ logs.simple("data path: %s", datapath)
+ logs.simple("full name: %s", fullname)
+ end
+ if indeed then
+ os.launch(fullname)
+ end
+end
+
+
+logs.extendbanner("TeXworks startup script 1.0",true)
+
+messages.help = [[
+--start [--verbose] start texworks
+--test report what will happen
+]]
+
+if environment.argument("start") then
+ scripts.texworks.start(true)
+elseif environment.argument("test") then
+ scripts.texworks.start()
+else
+ logs.help(messages.help)
+end
diff --git a/scripts/context/lua/mtx-tools.lua b/scripts/context/lua/mtx-tools.lua
new file mode 100644
index 000000000..87fd51dc6
--- /dev/null
+++ b/scripts/context/lua/mtx-tools.lua
@@ -0,0 +1,57 @@
+if not modules then modules = { } end modules ['mtx-tools'] = {
+ version = 1.002,
+ comment = "companion to mtxrun.lua",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- data tables by Thomas A. Schmitz
+
+local find, gsub = string.find, string.gsub
+
+scripts = scripts or { }
+scripts.tools = scripts.tools or { }
+
+local bomb_1, bomb_2 = "^\254\255", "^\239\187\191"
+
+function scripts.tools.disarmutfbomb()
+ local force, done = environment.argument("force"), false
+ for _, name in ipairs(environment.files) do
+ if lfs.isfile(name) then
+ local data = io.loaddata(name)
+ if not data then
+ -- just skip
+ elseif find(data,bomb_1) then
+ logs.simple("file '%s' has a 2 character utf bomb",name)
+ if force then
+ io.savedata(name,(gsub(data,bomb_1,"")))
+ end
+ done = true
+ elseif find(data,bomb_2) then
+ logs.simple("file '%s' has a 3 character utf bomb",name)
+ if force then
+ io.savedata(name,(gsub(data,bomb_2,"")))
+ end
+ done = true
+ else
+ -- logs.simple("file '%s' has no utf bomb",name)
+ end
+ end
+ end
+ if done and not force then
+ logs.simple("use --force to do a real disarming")
+ end
+end
+
+logs.extendbanner("All Kind Of Tools 1.0",true)
+
+messages.help = [[
+--disarmutfbomb remove utf bomb if present
+]]
+
+if environment.argument("disarmutfbomb") then
+ scripts.tools.disarmutfbomb()
+else
+ logs.help(messages.help)
+end
diff --git a/scripts/context/lua/mtx-update.lua b/scripts/context/lua/mtx-update.lua
index 66f6898d3..bc6ca4026 100644
--- a/scripts/context/lua/mtx-update.lua
+++ b/scripts/context/lua/mtx-update.lua
@@ -102,6 +102,15 @@ scripts.update.engines = {
},
}
+scripts.update.goodies = {
+ ["scite"] = {
+ { "bin//scite/", "texmf-" },
+ },
+ ["texworks"] = {
+ { "bin//texworks/", "texmf-" },
+ },
+}
+
scripts.update.platforms = {
["mswin"] = "mswin",
["windows"] = "mswin",
@@ -163,7 +172,8 @@ function scripts.update.synchronize()
local bin = states.get("rsync.program") -- rsync
local url = states.get("rsync.server") -- contextgarden.net
local version = states.get("context.version") -- current (or beta)
- local extras = states.get("extras") -- extra goodies (like modules)
+ local extras = states.get("extras") -- extras (like modules)
+ local goodies = states.get("goodies") -- goodies (like editors)
local force = environment.argument("force")
bin = string.gsub(bin,"\\","/")
@@ -285,6 +295,14 @@ function scripts.update.synchronize()
end
end
+ if goodies and type(goodies) == "table" then
+ for goodie, _ in pairs(goodies) do
+ for platform, _ in pairs(platforms) do
+ add_collection(scripts.update.goodies[goodie],platform)
+ end
+ end
+ end
+
local combined = { }
for _, repository in ipairs(scripts.update.repositories) do
if repositories[repository] then
@@ -374,7 +392,8 @@ function scripts.update.make()
local force = environment.argument("force")
local texroot = scripts.update.fullpath(states.get("paths.root"))
- local engines= states.get('engines')
+ local engines = states.get('engines')
+ local goodies = states.get('goodies')
local platforms = states.get('platforms')
local formats = states.get('formats')
@@ -431,6 +450,7 @@ messages.help = [[
--texroot=string installation directory (not guessed for the moment)
--engine=string tex engine (luatex, pdftex, xetex)
--extras=string extra modules (can be list or 'all')
+--goodies=string extra binaries (like scite and texworks)
--force instead of a dryrun, do the real thing
--update update minimal tree
--make also make formats and generate file databases
@@ -500,6 +520,9 @@ if scripts.savestate then
for r in gmatch(environment.argument("extras") or "","([^, ]+)") do
states.set("extras." .. r, true)
end
+ for r in gmatch(environment.argument("goodies") or "","([^, ]+)") do
+ states.set("goodies." .. r, true)
+ end
logs.report("state","loaded")
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 0c96ed446..d30350ea5 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -10070,6 +10070,12 @@ function runners.execute_ctx_script(filename,arguments)
end
end
+function runners.timedrun(filename) -- just for me
+ if filename and filename ~= "" then
+ runners.timed(function() os.execute(filename) end)
+ end
+end
+
function runners.timed(action)
statistics.timed(action)
end
@@ -10197,6 +10203,9 @@ elseif environment.argument("locate") then
elseif environment.argument("platform")then
-- locate platform
runners.locate_platform()
+elseif environment.argument("timedrun") then
+ -- locate platform
+ runners.timedrun(filename)
elseif environment.argument("help") or filename=='help' or filename == "" then
logs.help(messages.help)
-- execute script
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 0c96ed446..d30350ea5 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -10070,6 +10070,12 @@ function runners.execute_ctx_script(filename,arguments)
end
end
+function runners.timedrun(filename) -- just for me
+ if filename and filename ~= "" then
+ runners.timed(function() os.execute(filename) end)
+ end
+end
+
function runners.timed(action)
statistics.timed(action)
end
@@ -10197,6 +10203,9 @@ elseif environment.argument("locate") then
elseif environment.argument("platform")then
-- locate platform
runners.locate_platform()
+elseif environment.argument("timedrun") then
+ -- locate platform
+ runners.timedrun(filename)
elseif environment.argument("help") or filename=='help' or filename == "" then
logs.help(messages.help)
-- execute script
diff --git a/scripts/context/stubs/mswin/mtxworks.cmd b/scripts/context/stubs/mswin/mtxworks.cmd
new file mode 100644
index 000000000..322d9464d
--- /dev/null
+++ b/scripts/context/stubs/mswin/mtxworks.cmd
@@ -0,0 +1 @@
+mtxrun --script texworks --start
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 0c96ed446..d30350ea5 100755
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -10070,6 +10070,12 @@ function runners.execute_ctx_script(filename,arguments)
end
end
+function runners.timedrun(filename) -- just for me
+ if filename and filename ~= "" then
+ runners.timed(function() os.execute(filename) end)
+ end
+end
+
function runners.timed(action)
statistics.timed(action)
end
@@ -10197,6 +10203,9 @@ elseif environment.argument("locate") then
elseif environment.argument("platform")then
-- locate platform
runners.locate_platform()
+elseif environment.argument("timedrun") then
+ -- locate platform
+ runners.timedrun(filename)
elseif environment.argument("help") or filename=='help' or filename == "" then
logs.help(messages.help)
-- execute script
diff --git a/scripts/context/stubs/unix/mtxworks b/scripts/context/stubs/unix/mtxworks
new file mode 100755
index 000000000..ef8f230c3
--- /dev/null
+++ b/scripts/context/stubs/unix/mtxworks
@@ -0,0 +1,2 @@
+#!/bin/sh
+mtxrun --script texworks --start
diff --git a/tex/context/base/anch-pgr.mkii b/tex/context/base/anch-pgr.mkii
index bc4e0d828..fde8755c2 100644
--- a/tex/context/base/anch-pgr.mkii
+++ b/tex/context/base/anch-pgr.mkii
@@ -1352,6 +1352,7 @@
\def\do@@ammenuposition#1%
{\ifnum\currentamposition>0
\dowithnextbox{\hpos{menu:#1:\realfolio}{\flushnextbox}}\hbox
+ % \hpos{menu:#1:\realfolio} % also ok if we skip over fi
\fi}
%D \macros
diff --git a/tex/context/base/anch-pgr.mkiv b/tex/context/base/anch-pgr.mkiv
index ba566f970..8e719e0d7 100644
--- a/tex/context/base/anch-pgr.mkiv
+++ b/tex/context/base/anch-pgr.mkiv
@@ -17,6 +17,9 @@
%D the reference point on the page. The next macro does so and
%D is hooked into the page building routine.
+%D I will speed up this module when I have a proper torture
+%D test file.
+
\unprotect
% in the future, the depth of tail will reflect page depth
@@ -26,9 +29,9 @@
%D The next macros so some housekeeping.
\def\pageanchor{page:0} % for the moment only one pagesize
-\def\textanchor{text:\realfolio}
-\def\headanchor{head:\realfolio} % virtual position
-\def\tailanchor{tail:\realfolio} % virtual position
+\def\textanchor{text:\the\realpageno}
+\def\headanchor{head:\the\realpageno} % virtual position
+\def\tailanchor{tail:\the\realpageno} % virtual position
%D Anchors:
@@ -201,7 +204,7 @@
\newtoks\everyinsertpositionaction
\def\cleanuppositionaction#1% not in trialtypesetting
- {\ifcsname\POSactionprefix#1++\endcsname % \ifundefined{\POSactionprefix#1++}\else
+ {\ifcsname\POSactionprefix#1++\endcsname
\the\everycleanpositionaction
\iflocalpositioning
\letgvalue{\POSactionprefix#1++}\empty
@@ -273,10 +276,6 @@
\let\stopMPpositiongraphic\relax
-% \def\prepareMPpositionvariables
-% {\ifundefined{\@@meta self}\setvalue{\@@meta self}{\currentposition}\fi
-% \ifundefined{\@@meta from}\setvalue{\@@meta from}{\currentposition}\fi}
-
\def\prepareMPpositionvariables
{\ifcsname\@@meta self\endcsname\else\setvalue{\@@meta self}{\currentposition}\fi
\ifcsname\@@meta from\endcsname\else\setvalue{\@@meta from}{\currentposition}\fi}
@@ -292,23 +291,26 @@
% Now we need a adapted action handler:
\def\dopositionaction#1% test saves hash entry in etex
- {\ifundefined{\POSactionprefix#1::}\else
- \ifnum\MPp{#1}>\zerocount % new
- \bgroup
- \setbox\scratchbox\hbox
- \bgroup
- \traceposstring\clap\red{<#1>}%
- \the\everyinsertpositionaction
- \the\everypositionaction
- \getvalue{\POSactionprefix#1::}%
- \cleanuppositionaction{#1}%
- \egroup % smashed is really needed else
- \smashedbox\scratchbox % we get problems with too big
- \egroup % overlays (s-pre-0x.tex)
- \else
- % shouldn't happen too often
- \traceposstring\clap\cyan{<#1>}%
- \fi
+ {\ifcsname\POSactionprefix#1::\endcsname
+ \dodopositionaction{#1}%
+ \fi}
+
+\def\dodopositionaction#1%
+ {\ifnum\MPp{#1}>\zerocount % new
+ \bgroup
+ \setbox\scratchbox\hbox
+ \bgroup
+ \traceposstring\clap\red{<#1>}%
+ \the\everyinsertpositionaction
+ \the\everypositionaction
+ \csname\POSactionprefix#1::\endcsname
+ \cleanuppositionaction{#1}%
+ \egroup % smashed is really needed else
+ \smashedbox\scratchbox % we get problems with too big
+ \egroup % overlays (s-pre-0x.tex)
+ \else
+ % shouldn't happen too often
+ \traceposstring\clap\cyan{<#1>}%
\fi}
\def\MPpositiongraphic
@@ -607,28 +609,29 @@
\newcounter\localpositionnumber
\def\MPanchornumber
- {\iflocalpositioning\localpositionnumber\else\realfolio\fi}
+ {\iflocalpositioning\localpositionnumber\else\the\realpageno\fi}
%D So far for the trickery.
\newcount\textbackgrounddepth
-\appendtoks
- \expanded{\savecurrentvalue\noexpand\totalnofparbackgrounds{\number\nofparbackgrounds}}%
-\to \everybye
-
-\appendtoks
- \initializeparbackgrounds
-\to \everystarttext
-
-\ifx\totalnofparbackgrounds\undefined \newcounter\totalnofparbackgrounds \fi
\ifx\nofparbackgrounds \undefined \newcount \nofparbackgrounds \fi
-\def\initializeparbackgrounds
- {\ifcase\totalnofparbackgrounds\else
- \global\positioningtrue
- \global\positioningpartrue
- \fi}
+% \ifx\totalnofparbackgrounds\undefined \newcounter\totalnofparbackgrounds \fi
+%
+% \appendtoks
+% \expanded{\savecurrentvalue\noexpand\totalnofparbackgrounds{\number\nofparbackgrounds}}%
+% \to \everybye
+%
+% \appendtoks
+% \initializeparbackgrounds
+% \to \everystarttext
+%
+% \def\initializeparbackgrounds
+% {\ifcase\totalnofparbackgrounds\else
+% \global\positioningtrue
+% \global\positioningpartrue
+% \fi}
\unexpanded\def\starttextbackground
{\bgroup
@@ -680,10 +683,6 @@
\def\currenttextbackground{#1}%
\global\advance\nofparbackgrounds\plusone
\edef\currentparbackground{pbg:\number\nofparbackgrounds}%
-% \bgroup
-% \advance\nofparbackgrounds\plusone
-% \xdef\nextparbackground{pbg:\number\nofparbackgrounds}%
-% \egroup
\xdef\nextparbackground{pbg:\number\numexpr\nofparbackgrounds+\plusone\relax}% still xdef ?
% todo : \synchonizepositionpage{b:\currentparbackground}{s:\currentparbackground}%
\setuptextbackground[#1][#2]%
@@ -695,8 +694,7 @@
% todo \backgroundvariable\c!variant
\def\dopresettextbackground#1% todo: \backgroundparameter
- {\ExpandFirstAfter\processaction % \EFA niet echt nodig
- [\textbackgroundparameter\c!location]
+ {\normalexpanded{\noexpand\processaction[\textbackgroundparameter\c!location]}
[ \v!text=>\let\dodostarttextbackground\dostarttextbackgroundtxt
\let\dodostoptextbackground \dostoptextbackgroundtxt,
\v!paragraph=>\let\dodostarttextbackground\dostarttextbackgroundpar
@@ -754,7 +752,7 @@
\dostopattributes}
\def\dostarttextbackgroundtxt
- {\ifvmode \dontleavehmode \fi % was leavevmode, brrr
+ {\ifvmode \dontleavehmode \fi
\dostartattributes{\??td\currenttextbackground}\c!style\c!color\empty
\fpos\currentparbackground\ignorespaces}
@@ -762,37 +760,6 @@
{\tpos\currentparbackground
\dostopattributes}
-% keep this simple one, it's used in prikkels and alike
-%
-% \def\dostarttextbackgroundpar
-% {\endgraf % new
-% \getvalue{\??td\currenttextbackground\c!before}%
-% \noindent\fpos\currentparbackground\ignorespaces
-% \bgroup
-% \nobreak \vskip-\lineheight \nobreak
-% \doassignsomeskip\getvalue{\??td\currenttextbackground\c!topoffset}\to\scratchskip
-% \kern\scratchskip\nobreak
-% \dosetleftskipadaption{\getvalue{\??td\currenttextbackground\c!leftoffset}}%
-% \advance\leftskip\leftskipadaption
-% \dosetleftskipadaption{\getvalue{\??td\currenttextbackground\c!rightoffset}}%
-% \advance\rightskip\leftskipadaption
-% \dostartattributes{\??td\currenttextbackground}\c!style\c!color{}%
-% \nowhitespace
-% \seteffectivehsize
-% \par}
-%
-% \def\dostoptextbackgroundpar
-% {\par
-% \dostopattributes
-% \doassignsomeskip\getvalue{\??td\currenttextbackground\c!bottomoffset}\to\scratchskip
-% \kern\scratchskip\nobreak
-% \nobreak \vskip-\lineheight \nobreak
-% \nowhitespace
-% \egroup
-% \nobreak \noindent \strut \hfill \kern\zeropoint \tpos\currentparbackground
-% \endgraf % new
-% \getvalue{\??td\currenttextbackground\c!after}}
-
\newskip\textbackgroundskip
\def\dostarttextbackgroundpar
@@ -868,52 +835,83 @@
\let\textparwidth \!!zeropoint
\def\calculatetextpardimensions
- {\docalculatetextpardimensions\btbanchor \etbanchor \MPparanchor}
+ {\docalculatetextpardimensions\btbanchor\etbanchor\MPparanchor}
\def\calculatenexttextpardimensions
{\docalculatetextpardimensions\nextbtbanchor\nextetbanchor\relax}
-\def\docalculatetextpardimensions#1#2#3% todo: dimexpr
- {\scratchcounter\MPp#2%\etbanchor
- \advance\scratchcounter-\MPp#1%\btanchor
- \edef\textparpages{\the\scratchcounter}%
- \ifcase\scratchcounter
- % one page
- \scratchdimen \MPy#1%\btanchor
- \advance\scratchdimen-\MPy#2%\etbanchor
- \else
- % two or more pages
- \scratchdimen \MPy#1%\btanchor
- \advance\scratchdimen-\MPy#2%\etbanchor
- \advance\scratchdimen-\MPy\textanchor
- \advance\scratchdimen \MPy\textanchor % - and then + ?
- \advance\scratchdimen \MPh\textanchor\relax
- \ifcase\scratchcounter>2 \ifnum\scratchcounter<5
- % more pages
- \scratchdimen\textheight
- \advance\scratchcounter \minusone
- \multiply\scratchdimen \scratchcounter
- \else
- % keep'm small
- \scratchdimen5\textheight
- \fi \fi
- \fi
- \edef\textparheight{\the\scratchdimen}%
- \ifcase\scratchcounter
- % one page
- \scratchdimen \MPx#2%\etbanchor
- \advance\scratchdimen-\MPx#1%\btanchor
- \else
- % two or more pages / maybe also hang
- \ifx#3\relax
- \scratchdimen\makeupwidth % \textwidth
- \else
- \scratchdimen\MPw\MPparanchor
- \advance\scratchdimen-\MPl\MPparanchor
- \advance\scratchdimen-\MPr\MPparanchor
- \fi
- \fi
- \edef\textparwidth{\the\scratchdimen}}
+% \def\docalculatetextpardimensions#1#2#3% #1=\btbanchor #2=\etbanchor
+% {\scratchcounter\numexpr\MPp#2-\MPp#1\relax
+% \edef\textparpages{\the\scratchcounter}%
+% \ifcase\scratchcounter
+% % one page
+% \scratchdimen\dimexpr\MPy#1-\MPy#2\relax
+% \else
+% % two or more pages
+% \ifnum\scratchcounter>2
+% \ifnum\scratchcounter<5
+% % more pages
+% \scratchdimen\textheight
+% \advance\scratchcounter \minusone
+% \multiply\scratchdimen \scratchcounter
+% \else
+% % keep'm small
+% \scratchdimen5\textheight
+% \fi
+% \else
+% \scratchdimen\dimexpr\MPy#1-\MPy#2-\MPy\textanchor+\MPy\textanchor+\MPh\textanchor\relax
+% \fi
+% \fi
+% \edef\textparheight{\the\scratchdimen}%
+% \ifcase\scratchcounter
+% % one page
+% \scratchdimen\dimexpr\MPx#2-\MPx#1\relax
+% \else
+% % two or more pages / maybe also hang
+% \ifx#3\relax
+% \scratchdimen\makeupwidth % \textwidth
+% \else
+% \scratchdimen\dimexpr\MPw\MPparanchor-\MPl\MPparanchor-\MPr\MPparanchor\relax
+% \fi
+% \fi
+% \edef\textparwidth{\the\scratchdimen}}
+
+\def\docalculatetextpardimensions#1#2#3% #1=\btbanchor #2=\etbanchor (adapted 8/6/2009)
+ {\scratchcounter\numexpr\MPp#2-\MPp#1\relax
+ \edef\textparpages
+ {\the\scratchcounter}%
+ \edef\textparheight
+ {\the\dimexpr
+ \ifcase\scratchcounter
+ % one page
+ \MPy#1-\MPy#2%
+ \else
+ % two or more pages
+ \ifnum\scratchcounter>2
+ \ifnum\scratchcounter<5
+ % more pages
+ \textheight*\numexpr\scratchcounter+\minusone
+ \else
+ % keep'm small
+ 5\textheight
+ \fi
+ \else
+ \MPy#1-\MPy#2-\MPy\textanchor+\MPy\textanchor+\MPh\textanchor
+ \fi
+ \fi}%
+ \edef\textparwidth
+ {\the\dimexpr
+ \ifcase\scratchcounter
+ % one page
+ \dimexpr\MPx#2-\MPx#1%
+ \else
+ % two or more pages / maybe also hang
+ \ifx#3\relax
+ \makeupwidth % \textwidth
+ \else
+ \MPw\MPparanchor-\MPl\MPparanchor-\MPr\MPparanchor
+ \fi
+ \fi}}
\def\mintextparheight{4\lineheight}
@@ -938,7 +936,7 @@
\def\definetextbackground
{\dodoubleempty\dodefinetextbackground}
-\def\dodefinetextbackground[#1][#2]%
+\def\dodefinetextbackground[#1][#2]% parent and ..parameter
{\ifsecondargument % why ?
\copyparameters[\??td#1][\??td]
[\c!state,\c!location,\c!alternative,\c!mp,\c!method,
@@ -1250,7 +1248,7 @@
% new but bugged
% \setbox#1\hbox
% {\hskip-\MPx{\s!margin:\number\currentmarginpos}%
- % \hskip\MPx{head:\realfolio}%
+ % \hskip\MPx{head:\the\realpageno}%
% \box#1}%
% so far
\setbox#1\hbox
@@ -1278,7 +1276,7 @@
\dp#1\zeropoint
\ht#1\zeropoint
\fi
- \graphicvadjust{\box#1}%
+ \graphicvadjust{\dontleavehmode\box#1}% dontleavehmode is needed to get direction right
\egroup}
\chardef\marginrepositionmethod\plusone % sidemethod
@@ -1308,25 +1306,22 @@
% 0=notfound 1=found 2=currentpage
-\def\do@@amposition#1#2#3%
+\def\domenuitemposition#1#2#3%
{\doifelsevalue{\??am#1\c!position}\v!yes
{\doglobal\increment\currentamposition
- \doifnumberelse{#2}
- {\docheckrealreferencepage{#2}%
- \global\chardef\currentamrealpage\ifrealreferencepage2\else1\fi}
- {\doifreferencefoundelse{#2}
- {\global\chardef\currentamrealpage\ifrealreferencepage2\else1\fi}
- {\global\chardef\currentamrealpage0}}% % not found
+ \doifreferencefoundelse{#2}% 0=not found, 1=same page, >1=elsewhere
+ {\chardef\currentamrealpage\ifnum\currentreferencerealpage=\realpageno\plusone\else\plustwo\fi}%
+ {\chardef\currentamrealpage\plustwo}%
\expanded
{\doglobal\noexpand\appendtoks
- #1_menu_button(\currentamposition,\the\currentamrealpage,\MPpos{#1:\currentamposition}) ;
+ #1_menu_button(\number\currentamposition,\the\currentamrealpage,\MPpos{#1:\currentamposition}) ;
\to \MPmenutoks}%
\hpos{#1:\currentamposition}{#3}}
{#3}}
-\def\do@@ammenuposition#1%
+\def\dowholemenuposition#1%
{\ifnum\currentamposition>0
- \dowithnextbox{\hpos{menu:#1:\realfolio}{\flushnextbox}}\hbox
+ \dowithnextbox{\hpos{menu:#1:\the\realpageno}{\flushnextbox}}\hbox
\fi}
%D \macros
@@ -1337,6 +1332,7 @@
%D specified with symbolic names, and symbolic references to
%D the graphics involved. Each table has its own namespace.
+\newconditional\tablehaspositions
\newcount\noftabpositions
\newtoks \posXCtoks
@@ -1346,10 +1342,13 @@
\def\tbPOSprefix
{tbp:\number\noftabpositions:}
+% \def\tableposindeed
+% {\scratchtoks\posXCtoks
+% \global\posXCtoks\emptytoks
+% \the\scratchtoks}
+
\def\tablepos
- {\scratchtoks\posXCtoks
- \global\posXCtoks\emptytoks
- \the\scratchtoks}
+ {\normalexpanded{\global\posXCtoks\emptytoks\the\posXCtoks}}
\let\tabulatepos\tablepos
@@ -1403,10 +1402,16 @@
\def\dodoXC[#1]%
{{\let\NC\relax\processcommalist[#1]\dododoXC}}
-\def\doGSC[#1]{\iffirstargument\dodoGSC[#1]\else\expandafter\NC\fi}
-\def\doGFC[#1]{\iffirstargument\dodoGFC[#1]\else\expandafter\NC\fi}
-\def\doGTC[#1]{\iffirstargument\dodoGTC[#1]\else\expandafter\NC\fi}
-\def\doXC [#1]{\iffirstargument\dodoXC [#1]\else\expandafter\fi\NC}
+\def\@@checktablepositionstate
+ {\iftrialtypesetting
+ \global\settrue\tablehaspositions
+ \firstargumentfalse
+ \fi}
+
+\def\doGSC[#1]{\@@checktablepositionstate\iffirstargument\dodoGSC[#1]\else\expandafter\NC\fi}
+\def\doGFC[#1]{\@@checktablepositionstate\iffirstargument\dodoGFC[#1]\else\expandafter\NC\fi}
+\def\doGTC[#1]{\@@checktablepositionstate\iffirstargument\dodoGTC[#1]\else\expandafter\NC\fi}
+\def\doXC [#1]{\@@checktablepositionstate\iffirstargument\dodoXC [#1]\else\expandafter\fi\NC}
\def\tbGSC{\dosingleempty\doGSC}
\def\tbGFC{\dosingleempty\doGFC}
@@ -1419,15 +1424,30 @@
\let\tabulatepos\tablepos
\def\tabulatenormalpos
- {\hss\tabulatepos\hss}
+ {\iftrialtypesetting
+ % nothing
+ \else\ifconditional\tablehaspositions
+ \hss\tabulatepos\hss
+ \else
+ % nothing
+ \fi\fi}
\def\tabulateequalpos
+ {\iftrialtypesetting
+ \tabulateEQ
+ \else\ifconditional\tablehaspositions
+ \tabulateEQpos
+ \else
+ \tabulateEQ
+ \fi\fi}
+
+\def\tabulateEQpos
{\setbox\scratchbox\hbox{\tabulateEQ}%
\hbox to \wd\scratchbox{\hss\kern\zeropoint\tabulatepos\hss}%
\hskip-\wd\scratchbox
\box\scratchbox}
-\def\tabulatenormalcolumn#1% overloaded
+\def\tabulatenormalcolumn#1% overloaded later in node-bck
{&\iftabulateequal\tabulateequalpos\else\tabulatenormalpos\fi
&\global\chardef\tabulatetype#1&}
@@ -1437,6 +1457,7 @@
\appendtoks
\global\advance\noftabpositions\plusone
+ \global\setfalse\tablehaspositions
\to \everytabulate
% We need to handle paragraphs as well.
@@ -1454,7 +1475,7 @@
\gdef\doflushtabulateepos{\epos{#1}}%
\fi}
-\def\splitofftabulatebox
+\def\splitofftabulatebox % overloaded in node-bck
{\dontcomplain
\global\setbox\tabulatebox % % % global ? % % %
\vsplit\tablebox\tabulatecolumn to \lineheight
@@ -1465,11 +1486,12 @@
\ht\tabulatebox\strutht
\dp\tabulatebox\strutdp
\box\tabulatebox
- \doflushtabulateepos}
+ \iftrialtypesetting\else\ifconditional\tablehaspositions\doflushtabulateepos\fi\fi}
\appendtoks
\let\dotablebpos\dotabulatebpos
\let\dotableepos\dotabulateepos
+ \glet\doflushtabulateepos\relax
\to \everytabulate
%D In order to prevent potential clashes with abbreviations,
@@ -1517,6 +1539,7 @@
\appendtoks
\global\advance\noftabpositions\plusone
+ \global\setfalse\tablehaspositions
\to \everytable
%D Since we don't want nameclashes:
diff --git a/tex/context/base/anch-pos.lua b/tex/context/base/anch-pos.lua
index b6a66870f..b16fac05c 100644
--- a/tex/context/base/anch-pos.lua
+++ b/tex/context/base/anch-pos.lua
@@ -29,7 +29,7 @@ local dx, dy = "0pt", "0pt"
local function initializer()
ptbs, pcol = jobpositions.tobesaved, jobpositions.collected
- local p = pcol["page:0"]
+ local p = pcol["page:0"] -- page:1
if p then
-- to be checked !
--~ dx, dy = p[2] or "0pt", p[3] or "0pt"
diff --git a/tex/context/base/anch-pos.mkiv b/tex/context/base/anch-pos.mkiv
index f58f68302..88f492fb8 100644
--- a/tex/context/base/anch-pos.mkiv
+++ b/tex/context/base/anch-pos.mkiv
@@ -188,11 +188,6 @@
%D positions.
\newcount\currentpositions % current number of positions
-\newcounter\totalnofpositions % total from previous run
-
-\appendtoks
- \expanded{\savecurrentvalue\noexpand\totalnofpositions{\the\currentpositions}}%
-\to \everybye
%D The next switch can be used to communicate a special
%D situation. Positioning and associated actions can be
@@ -216,15 +211,6 @@
\localpositioningfalse
\to \everypagebody
-% \def\checkpositions
-% {\startnointerference
-% \protectlabels
-% \doutilities{positions}\jobname\empty\relax\relax
-% \global\let\checkpositions\relax
-% \stopnointerference}
-
-\let\checkpositions\relax
-
%D Since the positional values are to be fully expandable, we
%D need to preload them as soon as possible, which is why we
%D load the data when we start a text.
diff --git a/tex/context/base/anch-snc.tex b/tex/context/base/anch-snc.tex
index ed090eaf9..cf5b35d69 100644
--- a/tex/context/base/anch-snc.tex
+++ b/tex/context/base/anch-snc.tex
@@ -143,8 +143,6 @@
\starttext
-\setupcolors[state=start]
-
\definesyncpositions[1]
\startuseMPgraphic{sync}
diff --git a/tex/context/base/attr-ini.lua b/tex/context/base/attr-ini.lua
index a7d09bba1..afd69f1f5 100644
--- a/tex/context/base/attr-ini.lua
+++ b/tex/context/base/attr-ini.lua
@@ -7,6 +7,7 @@ if not modules then modules = { } end modules ['attr-ini'] = {
}
-- this module is being reconstructed
+-- we can also do the nsnone via a metatable and then also se index 0
local type = type
local format, gmatch = string.format, string.gmatch
@@ -28,11 +29,6 @@ shipouts = shipouts or { }
-- first implementation did that and while it saves a bit for glyphs and rules, it
-- costs more resourses for transparencies. So why bother.
--- namespace for all those features / plural becomes singular
-
--- i will do the resource stuff later, when we have an interface to pdf (ok, i can
--- fake it with tokens but it will take some coding
-
--
-- colors
--
@@ -63,6 +59,7 @@ colors = colors or { }
colors.data = colors.data or { }
colors.values = colors.values or { }
colors.registered = colors.registered or { }
+
colors.enabled = true
colors.weightgray = true
colors.attribute = 0
@@ -174,38 +171,49 @@ function colors.spot(parent,f,d,p)
return { 5, .5, .5, .5, .5, 0, 0, 0, .5, parent, f, d, p }
end
-function colors.reviver(n)
- local d = data[n]
- if not d then
- local v = values[n]
- if not v then
- local gray = nodeinjections.graycolor(0)
+local function graycolor(...) graycolor = nodeinjections.graycolor return graycolor(...) end
+local function rgbcolor (...) rgbcolor = nodeinjections.rgbcolor return rgbcolor (...) end
+local function cmykcolor(...) cmykcolor = nodeinjections.cmykcolor return cmykcolor(...) end
+local function spotcolor(...) spotcolor = nodeinjections.spotcolor return spotcolor(...) end
+
+local function extender(colors,key)
+ if key == "none" then
+ local d = graycolor(0)
+ colors.none = d
+ return d
+ end
+end
+
+local function reviver(data,n)
+ local v = values[n]
+ if not v then
+ local gray = graycolor(0)
+ d = { gray, gray, gray, gray }
+ logs.report("attributes","unable to revive color %s",n or "?")
+ else
+ local kind, gray, rgb, cmyk = v[1], graycolor(v[2]), rgbcolor(v[3],v[4],v[5]), cmykcolor(v[6],v[7],v[8],v[9])
+ if kind == 2 then
d = { gray, gray, gray, gray }
- logs.report("attributes","unable to revive color %s",n or "?")
- else
- local kind, gray, rgb, cmyk = v[1], nodeinjections.graycolor(v[2]), nodeinjections.rgbcolor(v[3],v[4],v[5]), nodeinjections.cmykcolor(v[6],v[7],v[8],v[9])
- if kind == 2 then
- d = { gray, gray, gray, gray }
- elseif kind == 3 then
- d = { rgb, gray, rgb, cmyk }
- elseif kind == 4 then
- d = { cmyk, gray, rgb, cmyk }
- elseif kind == 5 then
- local spot = nodeinjections.spotcolor(v[10],v[11],v[12],v[13])
- d = { spot, gray, rgb, cmyk }
- end
+ elseif kind == 3 then
+ d = { rgb, gray, rgb, cmyk }
+ elseif kind == 4 then
+ d = { cmyk, gray, rgb, cmyk }
+ elseif kind == 5 then
+ local spot = spotcolor(v[10],v[11],v[12],v[13])
+ d = { spot, gray, rgb, cmyk }
end
- data[n] = d
end
+ data[n] = d
return d
end
+setmetatable(colors, { __index = extender })
+setmetatable(colors.data, { __index = reviver })
+
function colors.filter(n)
return concat(data[n],":",5)
end
-colors.none = nodeinjections.graycolor(0)
-
function colors.setmodel(attribute,name,weightgray)
colors.model = name
colors.selector = numbers[attribute]
@@ -221,7 +229,7 @@ function colors.register(attribute, name, colorspace, ...) -- passing 9 vars is
color = #values+1
values[color] = colors[colorspace](...)
registered[stamp] = color
- colors.reviver(color)
+ -- colors.reviver(color)
end
if name then
list[numbers[attribute]][name] = color -- not grouped, so only global colors
@@ -244,9 +252,6 @@ shipouts.handle_color = nodes.install_attribute_handler {
-- transparencies
--- for the moment we manage transparencies in the pdf driver because
--- first we need a nice interface to some pdf things
-
transparencies = transparencies or { }
transparencies.registered = transparencies.registered or { }
transparencies.data = transparencies.data or { }
@@ -262,43 +267,45 @@ local data = transparencies.data
local values = transparencies.values
local template = "%s:%s"
-local function reference(n)
- reference = nodeinjections.transparency
- return reference(n)
-end
+local function inject_transparency (...) inject_transparency = nodeinjections.transparency return inject_transparency (...) end
+local function register_transparency(...) register_transparency = registrations.transparency return register_transparency(...) end
function transparencies.register(name,a,t)
local stamp = format(template,a,t)
local n = registered[stamp]
if not n then
- n = #data+1
- data[n] = reference(n)
+ n = #values + 1
values[n] = { a, t }
registered[stamp] = n
- registrations.transparency(n,a,t)
+ register_transparency(n,a,t)
end
return registered[stamp]
end
-function transparencies.reviver(n)
- local d = data[n]
- if not d then
- local v = values[n]
- if not v then
- d = reference(0)
- logs.report("attributes","unable to revive transparency %s",n or "?")
- else
- d = reference(n)
- registrations.transparency(n,v[1],v[2])
- end
- data[n] = d
+local function extender(transparencies,key)
+ if key == "none" then
+ local d = inject_transparency(0)
+ transparencies.none = d
+ return d
+ end
+end
+
+local function reviver(data,n)
+ local v = values[n]
+ if not v then
+ d = inject_transparency(0)
+ else
+ d = inject_transparency(n)
+ register_transparency(n,v[1],v[2])
end
+ data[n] = d
return d
end
--- check if there is an identity
+setmetatable(transparencies, { __index = extender })
+setmetatable(transparencies.data, { __index = reviver })
-transparencies.none = reference(0) -- for the moment the pdf backend does this
+-- check if there is an identity
function transparencies.value(id)
return values[id]
@@ -308,8 +315,8 @@ shipouts.handle_transparency = nodes.install_attribute_handler {
name = "transparency",
namespace = transparencies,
initializer = states.initialize,
- finalizer = states.finalize ,
- processor = states.process ,
+ finalizer = states.finalize,
+ processor = states.process,
}
--- overprint / knockout
@@ -318,21 +325,35 @@ overprints = overprints or { }
overprints.data = overprints.data or { }
overprints.enabled = false
-overprints.data[1] = nodeinjections.overprint()
-overprints.data[2] = nodeinjections.knockout()
-
-overprints.none = overprints.data[2]
-
overprints.registered = {
overprint = 1,
knockout = 2,
}
---~ storage.register("overprints/registered", overprints.registered, "overprints.registered")
---~ storage.register("overprints/data", overprints.data, "overprints.data")
+local data, registered = overprints.data, overprints.registered
-local data = overprints.data
-local registered = overprints.registered
+local function extender(overprints,key)
+ if key == "none" then
+ local d = data[2]
+ overprints.none = d
+ return d
+ end
+end
+
+local function reviver(data,n)
+ if n == 1 then
+ local d = nodeinjections.overprint() -- called once
+ data[1] = d
+ return d
+ elseif n == 2 then
+ local d = nodeinjections.knockout() -- called once
+ data[2] = d
+ return d
+ end
+end
+
+setmetatable(overprints, { __index = extender })
+setmetatable(overprints.data, { __index = reviver })
function overprints.register(stamp)
return registered[stamp] or registered.overprint
@@ -348,22 +369,42 @@ shipouts.handle_overprint = nodes.install_attribute_handler {
--- negative / positive
-negatives = negatives or { }
-negatives.data = negatives.data or { }
-negatives.enabled = false
-
-negatives.data[1] = nodeinjections.positive()
-negatives.data[2] = nodeinjections.negative()
-
-negatives.none = negatives.data[1]
+negatives = negatives or { }
+negatives.data = negatives.data or { }
+negatives.enabled = false
negatives.registered = {
positive = 1,
negative = 2,
}
+local data, registered = negatives.data, negatives.registered
+
+local function extender(negatives,key)
+ if key == "none" then
+ local d = data[1]
+ negatives.none = d
+ return d
+ end
+end
+
+local function reviver(data,n)
+ if n == 1 then
+ local d = nodeinjections.positive() -- called once
+ data[1] = d
+ return d
+ elseif n == 2 then
+ local d = nodeinjections.negative() -- called once
+ data[2] = d
+ return d
+ end
+end
+
+setmetatable(negatives, { __index = extender })
+setmetatable(negatives.data, { __index = reviver })
+
function negatives.register(stamp)
- return negatives.registered[stamp] or negatives.registered.positive
+ return registered[stamp] or registered.positive
end
shipouts.handle_negative = nodes.install_attribute_handler {
@@ -374,36 +415,52 @@ shipouts.handle_negative = nodes.install_attribute_handler {
processor = states.process,
}
--- effects -- can be optimized
+-- effects -- can be optimized (todo: metatables)
effects = effects or { }
effects.data = effects.data or { }
+effects.values = effects.values or { }
effects.registered = effects.registered or { }
effects.enabled = false
effects.stamp = "%s:%s:%s"
storage.register("effects/registered", effects.registered, "effects.registered")
-storage.register("effects/data", effects.data, "effects.data")
+storage.register("effects/values", effects.values, "effects.values")
-function effects.register(effect,stretch,rulethickness)
- local stamp = format(effects.stamp,effect,stretch,rulethickness)
- local n = effects.registered[stamp]
- if not n then
- n = #effects.data+1
- effects.data[n] = effects.reference(effect,stretch,rulethickness)
- effects.registered[stamp] = n
+local data, registered, values = effects.data, effects.registered, effects.values
+
+-- valid effects: normal inner outer both hidden (stretch,rulethickness,effect)
+
+local function effect(...) effect = nodeinjections.effect return effect(...) end
+
+local function extender(effects,key)
+ if key == "none" then
+ local d = effect(0,0,0)
+ effects.none = d
+ return d
end
- return effects.registered[stamp]
end
--- valid effects: normal inner outer both hidden
-
-function effects.reference(effect,stretch,rulethickness)
- effects.reference = nodeinjections.effect
- return nodeinjections.effect(stretch,rulethickness,effect)
+local function reviver(data,n)
+ local e = values[n] -- we could nil values[n] now but hardly needed
+ local d = effect(v[1],v[2],v[3])
+ data[n] = d
+ return d
end
-effects.none = effects.reference(0,0,0)
+setmetatable(effects, { __index = extender })
+setmetatable(effects.data, { __index = reviver })
+
+function effects.register(effect,stretch,rulethickness)
+ local stamp = format(effects.stamp,effect,stretch,rulethickness)
+ local n = registered[stamp]
+ if not n then
+ n = #values + 1
+ values[n] = { effect, stretch, rulethickness }
+ registered[stamp] = n
+ end
+ return n
+end
shipouts.handle_effect = nodes.install_attribute_handler {
name = "effect",
@@ -413,61 +470,101 @@ shipouts.handle_effect = nodes.install_attribute_handler {
processor = states.process,
}
--- layers (ugly code, due to no grouping and such)
+-- layers (ugly code, due to no grouping and such); currently we use exclusive layers
+-- but when we need it stacked layers might show up too; the next function based
+-- approach can be replaced by static (metatable driven) resolvers
viewerlayers = viewerlayers or { }
viewerlayers.data = viewerlayers.data or { }
viewerlayers.registered = viewerlayers.registered or { }
+viewerlayers.values = viewerlayers.values or { }
viewerlayers.enabled = false
storage.register("viewerlayers/registered", viewerlayers.registered, "viewerlayers.registered")
---~ storage.register("viewerlayers/data", viewerlayers.data, "viewerlayers.data")
+storage.register("viewerlayers/values", viewerlayers.values, "viewerlayers.values")
local data = viewerlayers.data
+local values = viewerlayers.values
local registered = viewerlayers.registered
local template = "%s"
-local somedone = false
-local somedata = { }
-local nonedata = nodeinjections.stoplayer()
+-- interwoven
+
+--~ local somedone = false
+--~ local somedata = { }
+--~ local nonedata = nodeinjections.stoplayer()
+--~
+--~ function viewerlayers.none() -- no local
+--~ if somedone then
+--~ somedone = false
+--~ return nonedata
+--~ else
+--~ return nil
+--~ end
+--~ end
+--~
+--~ local function some(name)
+--~ local sd = somedata[name]
+--~ if not sd then
+--~ sd = {
+--~ nodeinjections.switchlayer(name),
+--~ nodeinjections.startlayer(name),
+--~ }
+--~ somedata[name] = sd
+--~ end
+--~ if somedone then
+--~ return sd[1]
+--~ else
+--~ somedone = true
+--~ return sd[2]
+--~ end
+--~ end
+--~
+--~ local function initializer(...)
+--~ somedone = false
+--~ return states.initialize(...)
+--~ end
+--~
+--~ viewerlayers.register = function(name) -- if not inimode redefine data[n] in first call
+--~ local stamp = format(template,name)
+--~ local n = registered[stamp]
+--~ if not n then
+--~ n = #data + 1
+--~ data[n] = function() return some(name) end -- slow but for the moment we don't store things in the format
+--~ registered[stamp] = n
+--~ end
+--~ return registered[stamp] -- == n
+--~ end
-function viewerlayers.none() -- no local
- if somedone then
- somedone = false
- return nonedata
- else
- return nil
+-- stacked
+
+local function extender(viewerlayers,key)
+ if key == "none" then
+ local d = nodeinjections.stoplayer()
+ viewerlayers.none = d
+ return d
end
end
-local function some(name)
- local sd = somedata[name]
- if not sd then
- sd = {
- nodeinjections.switchlayer(name),
- nodeinjections.startlayer(name),
- }
- somedata[name] = sd
- end
- if somedone then
- return sd[1]
- else
- somedone = true
- return sd[2]
- end
+local function reviver(data,n)
+ local d = nodeinjections.startlayer(values[n])
+ data[n] = d
+ return d
end
+setmetatable(viewerlayers, { __index = extender })
+setmetatable(viewerlayers.data, { __index = reviver })
+
local function initializer(...)
- somedone = false
return states.initialize(...)
end
-viewerlayers.register = function(name)
+viewerlayers.register = function(name) -- if not inimode redefine data[n] in first call
local stamp = format(template,name)
local n = registered[stamp]
if not n then
- n = #data + 1
- data[n] = function() return some(name) end -- slow but for the moment we don't store things in the format
+ n = #values + 1
+ values[n] = name
registered[stamp] = n
end
return registered[stamp] -- == n
@@ -478,5 +575,5 @@ shipouts.handle_viewerlayer = nodes.install_attribute_handler {
namespace = viewerlayers,
initializer = initializer,
finalizer = states.finalize,
- processor = states.process,
+ processor = states.stacked,
}
diff --git a/tex/context/base/attr-ini.mkiv b/tex/context/base/attr-ini.mkiv
index a44a16be6..f653e8c75 100644
--- a/tex/context/base/attr-ini.mkiv
+++ b/tex/context/base/attr-ini.mkiv
@@ -23,15 +23,17 @@
\definesystemattribute[state]
\definesystemattribute[skip]
\definesystemattribute[penalty]
-\definesystemattribute[colormodel][global] % no reset
-\definesystemattribute[color]
-\definesystemattribute[transparency]
-\definesystemattribute[background]
+\definesystemattribute[colormodel][global] % no reset \chardef\colormodelattribute \dogetattributeid{colormodel}
+\definesystemattribute[color] \chardef\colorattribute \dogetattributeid{color}
+\definesystemattribute[transparency] \chardef\transparencyattribute \dogetattributeid{transparency}
+\definesystemattribute[background] \chardef\backgroundattribute \dogetattributeid{background}
\definesystemattribute[overprint]
\definesystemattribute[negative]
\definesystemattribute[effect]
-\definesystemattribute[viewerlayer]
-\definesystemattribute[reference]
+\definesystemattribute[viewerlayer] \chardef\viewerlayerattribute \dogetattributeid{viewerlayer}
+\definesystemattribute[reference] \chardef\referenceattribute \dogetattributeid{reference}
+\definesystemattribute[destination] \chardef\destinationattribute \dogetattributeid{destination}
+\definesystemattribute[graphicvadjust] \chardef\graphicvadjustattribute\dogetattributeid{graphicvadjust}
% \definesystemattribute[ignore]
%
@@ -85,8 +87,7 @@
{\setevalue{(os:#1)}{\dosetattribute{overprint}{\ctxlua{tex.print(overprints.register('#2'))}}}}
\def\dotriggeroverprint
- {\initializePDFoverprint % temp here, to be tested in la code (states.collect)
- \ctxlua{overprints.enabled=true}%
+ {\ctxlua{overprints.enabled=true}%
\gdef\dotriggeroverprint##1{\csname(os:##1)\endcsname}%
\dotriggeroverprint}
@@ -99,8 +100,7 @@
{\setevalue{(ns:#1)}{\dosetattribute{negative}{\ctxlua{tex.print(negatives.register('#2'))}}}}
\def\dotriggernegative
- {\initializePDFnegative % temp here, to be tested in la code (states.collect)
- \ctxlua{negatives.enabled=true}%
+ {\ctxlua{negatives.enabled=true}%
\gdef\dotriggernegative##1{\csname(ns:##1)\endcsname}%
\dotriggernegative}
@@ -126,7 +126,7 @@
% \registereffect{both}
% \registereffect{hidden}
-% viewerlayers
+% viewerlayers (will probably change a bit)
% \def\registerviewerlayer#1#2% global !
% {\setxvalue{(vl:#1)}{\dosetattribute{viewerlayer}{\ctxlua{tex.print(viewerlayers.register('#2'))}}}}
@@ -140,8 +140,6 @@
\setevalue{(vl:)}{\global\doresetattribute{viewerlayer}}
-%
-
\def\dotriggerviewerlayer
{\ctxlua{viewerlayers.enabled=true}%
\gdef\dotriggerviewerlayer##1{\csname(vl:##1)\endcsname}%
diff --git a/tex/context/base/back-ini.lua b/tex/context/base/back-ini.lua
index 0a11c2ef7..bad6b0282 100644
--- a/tex/context/base/back-ini.lua
+++ b/tex/context/base/back-ini.lua
@@ -8,8 +8,12 @@ if not modules then modules = { } end modules ['back-ini'] = {
backends = backends or { }
+local trace_backend = false
+
local function nothing() return nil end
+backends.nothing = nothing
+
backends.nodeinjections = {
rgbcolor = nothing,
cmykcolor = nothing,
@@ -24,10 +28,61 @@ backends.nodeinjections = {
startlayer = nothing,
stoplayer = nothing,
switchlayer = nothing,
+
+ reference = nothing,
+ destination = nothing,
+
}
backends.codeinjections = {
- insertmovie = nothing,
+
+ prerollreference = nothing,
+
+ insertmovie = nothing,
+ insertsound = nothing,
+
+ presetsymbollist = nothing,
+ registersymbol = nothing,
+ registeredsymbol = nothing,
+
+ registercomment = nothing,
+ attachfile = nothing,
+ adddocumentinfo = nothing,
+ setupidentity = nothing,
+ setpagetransition = nothing,
+ defineviewerlayer = nothing,
+ addbookmarks = nothing,
+ addtransparencygroup = nothing,
+
+ typesetfield = nothing,
+ finishfields = nothing,
+ doiffieldelse = nothing,
+ doiffieldgroupelse = nothing,
+ definefield = nothing,
+ clonefield = nothing,
+ definefieldset = nothing,
+ getfieldgroup = nothing,
+ setformsmethod = nothing,
+ getdefaultfieldvalue = nothing,
+
+ setupcanvas = nothing,
+
+ initializepage = nothing,
+ initializedocument = nothing,
+ finalizepage = nothing,
+ finalizedocument = nothing,
+
+ flushpageactions = nothing,
+ flushdocumentactions = nothing,
+
+ insertrenderingwindow = nothing,
+ processrendering = nothing,
+ kindofrendering = nothing,
+ flushrenderingwindow = nothing,
+
+ setfigurecolorspace = nothing,
+ setfigurealternative = nothing,
+
}
backends.registrations = {
@@ -49,27 +104,40 @@ backends.current = "unknown"
function backends.install(what)
if type(what) == "string" then
- backends.current = what
- what = backends[what]
- if what then
- local wi = what.nodeinjections
- if wi then
- for k, v in next, wi do
- nodeinjections[k] = v
- end
- end
- local wi = what.codeinjections
- if wi then
- for k, v in next, wi do
- codeinjections[k] = v
- end
+ local backend = backends[what]
+ if backend then
+ if trace_backend then
+ logs.report("backend", "initializing backend %s (%s)",what,backend.comment or "no comment")
end
- local wi = what.registrations
- if wi then
- for k, v in next, wi do
- registrations[k] = v
+ backends.current = what
+ for _, category in next, { "nodeinjections", "codeinjections", "registrations"} do
+ local plugin = backend[category]
+ if plugin then
+ local whereto = backends[category]
+ for name, meaning in next, whereto do
+ if plugin[name] then
+ whereto[name] = plugin[name]
+ -- logs.report("backend", "installing function %s in category %s of %s",name,category,what)
+ elseif trace_backend then
+ logs.report("backend", "no function %s in category %s of %s",name,category,what)
+ end
+ end
+ elseif trace_backend then
+ logs.report("backend", "no category %s in %s",category,what)
end
end
+ backends.helpers = backend.helpers
+ elseif trace_backend then
+ logs.report("backend", "no backend named %s",what)
end
end
end
+
+statistics.register("used backend", function()
+ local bc = backends.current
+ if bc ~= "unknown" then
+ return string.format("%s (%s)",bc,backends[bc].comment or "no comment")
+ else
+ return nil
+ end
+end)
diff --git a/tex/context/base/back-ini.mkiv b/tex/context/base/back-ini.mkiv
index a60b6a329..b074d04fe 100644
--- a/tex/context/base/back-ini.mkiv
+++ b/tex/context/base/back-ini.mkiv
@@ -11,6 +11,9 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+%D Most will go away here as it is replaced by \LUA\ calls to
+%D backend functions.
+
\writestatus{loading}{ConTeXt Backend Macros / Initialization}
\registerctxluafile{back-ini}{1.001}
@@ -20,6 +23,9 @@
\unprotect
+\ifdefined\everybackendshipout \else \newtoks\everybackendshipout \fi
+\ifdefined\everylastbackendshipout \else \newtoks\everylastbackendshipout \fi
+
%D Right from the start \CONTEXT\ had a backend system based on
%D runtime pluggable code. As most backend issues involved specials
%D and since postprocessors had not that much in common, we ended up
@@ -44,122 +50,6 @@
%D Not everything here makes sense and the content of this file will
%D definitely change.
-%D We use a couple of (global) variables because it saves us the
-%D trouble of dealing with arguments.
-
-\letempty \@@DriverFieldName
-\letempty \@@DriverFieldWidth
-\letempty \@@DriverFieldHeight
-\letempty \@@DriverFieldDefault
-\letempty \@@DriverFieldNumber
-\letempty \@@DriverFieldNumber
-\letempty \@@DriverFieldStyle
-\letempty \@@DriverFieldColor
-\letempty \@@DriverFieldBackgroundColor
-\letempty \@@DriverFieldFrameColor
-\letempty \@@DriverFieldLayer
-\letempty \@@DriverFieldOption
-\letempty \@@DriverFieldAlign
-\letempty \@@DriverFieldClickIn
-\letempty \@@DriverFieldClickOut
-\letempty \@@DriverFieldRegionIn
-\letempty \@@DriverFieldRegionOut
-\letempty \@@DriverFieldAfterKey
-\letempty \@@DriverFieldFormat
-\letempty \@@DriverFieldValidate
-\letempty \@@DriverFieldCalculate
-\letempty \@@DriverFieldFocusIn
-\letempty \@@DriverFieldFocusOut
-
-\letempty \@@DriverCommentLayer
-\letempty \@@DriverAttachmentLayer
-
-\letempty \@@DriverImageBox
-\letempty \@@DriverImageOptions
-\letempty \@@DriverImageWidth
-\letempty \@@DriverImageHeight
-\letempty \@@DriverImageFile
-\letempty \@@DriverImageLabel
-\letempty \@@DriverImageType
-\letempty \@@DriverImageMethod
-\letempty \@@DriverImagePage
-
-\newif\ifcollectreferenceactions
-
-%D \macros
-%D {dostartgraymode,dostopgraymode,
-%D dostartrgbcolormode,dostartcmykcolormode,dostartgraycolormode,dostopcolormode}
-%D
-%D Switching to and from color can be done in two ways:
-%D
-%D \startitemize[packed,n]
-%D \item insert driver specific commands
-%D \item pass instructions to the output device
-%D \stopitemize
-%D
-%D The first approach is more general and lays the
-%D responsibility at the driver side. Probably due to the fact
-%D that \TEX\ does not directly support color, we have been
-%D confronted for the last few years with changing special
-%D definitions. The need for support depends on how a macro
-%D package handles colored text that crosses the page boundary.
-%D Again, there are two approaches.
-%D
-%D \startitemize[packed,n]
-%D \item let \TEX\ do the job
-%D \item let the driver handle things
-%D \stopitemize
-%D
-%D The first approach is as driver independant as possible and
-%D can easily be accomplished by using \TEX's mark mechanism.
-%D In \CONTEXT\ we follow this approach. More and more, drivers
-%D are starting to support color, including stacking them.
-%D
-%D Colors as well as grayscales can be represented in scales
-%D from~0 to~1. When drivers use values in the range 0..255,
-%D this value has to be adapted in the translation process.
-%D Technically it's possible to get a grayscale from combining
-%D colors. In the \cap{RGB} color system, a color with Red,
-%D Green and Blue components of 0.80 show the same gray as a
-%D Gray Scale specified 0.80. The \cap{CMYK} color system
-%D supports a Black component apart from Cyan, Magenta and
-%D Yellow.
-%D
-%D Depending on the target format, color support differs from
-%D gray support. PostScript for example offers different
-%D operators for setting gray and color. This is because
-%D printing something using three colors is someting else than
-%D printing with just black.
-%D
-%D In \CONTEXT\ we have implemented a color subsystem that
-%D supports the use of well defined colors that, when printed
-%D in black and white, still can be distinguished. This
-%D approach enables us to serve both printed and electronic
-%D versions, using colored text and illustrations. More on the
-%D fundamentals of this topic can be found in the \cap{MAPS} of
-%D the Dutch User Group, 14 (95.1).
-%D
-%D To satisfy all those needs, we define four specials which
-%D supply enough information for drivers to act upon. We
-%D could have used more general commands with the keywords
-%D 'rgb' and 'gray', but because these specials are used often,
-%D we prefer the more direct and shorter alternative.
-%D
-%D We start with the installation of color and grayscale
-%D specials. The values are in the range 0..1 (e.g. 0.25).
-%D
-%D \starttyping
-%D \dostartgraymode {gray} ... \dostopgraymode
-%D \dostartrgbcolormode {red} {green} {blue} ... \dostopcolormode
-%D \dostartcmykcolormode {cyan} {magenta} {yellow} {black} ... \dostopcolormode
-%D \dostartgraycolormode {gray} ... \dostopcolormode
-%D \stoptyping
-%D
-%D Because we can expect conflicts between drivers, we
-%D implement them as category \type{or}. In previous versions
-%D of \DVIPSONE\ the use of their color||specials did not
-%D interfere with the PostScript ones, but recent versions do.
-
\let \dostartgraymode \gobbleoneargument
\let \dostopgraymode \donothing
\let \dostartrgbcolormode \gobblethreearguments
@@ -167,70 +57,24 @@
\let \dostartgraycolormode \gobbleoneargument
\let \dostopcolormode \donothing
\let \dostartspotcolormode \gobbletwoarguments
-\let \doregisterrgbspotcolor \gobblesevenarguments
-\let \doregistercmykspotcolor \gobbleeightarguments
-\let \doregistergrayspotcolor \gobblefourarguments
-\let \doregisterrgbindexcolor \gobblesevenarguments
-\let \doregistercmykindexcolor \gobbleeightarguments
-\let \doregistergrayindexcolor \gobblefourarguments
\let \doregisterspotcolorname \gobbletwoarguments
\let \dostartnonecolormode \donothing
\let \doregisternonecolor \donothing
-%D \macros
-%D {doinsertsoundtrack}
-%D
-%D Sounds are (for the moment) just files with
-%D associated options.
-%D
-%D \starttyping
-%D \doinsertsoundtrack {file} {label} {options}
-%D \stoptyping
+\let \doinsertsoundtrack \gobblethreearguments
-\let \doinsertsoundtrack \gobblethreearguments
-
-%D \macros
-%D {dostartrotation,dostoprotation,
-%D dostartscaling,dostopscaling,
-%D dostartmirroring,dostopmirroring,
-%D dostartnegative,dostopnegative}
-%D dostartoverprint,dostopoverprint}
-%D
-%D We support a couple of transformations and renderings:
-%D
-%D \starttyping
-%D \dostartrotation {angle} ... \dostoprotation
-%D \dostartscaling {x} {y} ... \dostopscaling
-%D \dostartmirroring {x} {y} ... \dostopmirroring
-%D \stoptyping
-
-\let \dostartrotation \gobbleoneargument
-\let \dostoprotation \donothing
-\let \dostartscaling \gobbletwoarguments
-\let \dostopscaling \donothing
-\let \dostartmirroring \donothing
-\let \dostopmirroring \donothing
-
-\let \dostartnegative \donothing
-\let \dostopnegative \donothing
-\let \dostartoverprint \donothing
-\let \dostopoverprint \donothing
-
-%D The following two specials are used in for instance \type
-%D {\vadjust}'d margin material inside colored paragraphs.
-
-\let \dostartgraphicgroup \donothing
-\let \dostopgraphicgroup \donothing
-
-%D \macros
-%D {doselectfirstpaperbin,
-%D doselectsecondpaperbin}
-%D
-%D Here are some very printer||specific ones. No further
-%D comment.
-
-\let \doselectfirstpaperbin \donothing
-\let \doselectsecondpaperbin \donothing
+\let \dostartrotation \gobbleoneargument
+\let \dostoprotation \donothing
+\let \dostartscaling \gobbletwoarguments
+\let \dostopscaling \donothing
+\let \dostartmirroring \donothing
+\let \dostopmirroring \donothing
+\let \dostartnegative \donothing
+\let \dostopnegative \donothing
+\let \dostartoverprint \donothing
+\let \dostopoverprint \donothing
+\let \dostartgraphicgroup \donothing
+\let \dostopgraphicgroup \donothing
%D \macros
%D {doovalbox}
@@ -263,300 +107,8 @@
\let \dostartclipping \gobblethreearguments
\let \dostopclipping \donothing
-%D \macros
-%D {dosetupidentity}
-%D
-%D We can declare some characteristics of the document with
-%D
-%D \starttyping
-%D \dosetupidentity {title} {subject} {author} {creator} {date} {keys}
-%D \stoptyping
-%D
-%D All data is in string format.
-
-\let \dosetupidentity \gobblesixarguments
-
-%D \macros
-%D {dosetuppaper}
-%D
-%D This special can be used to tell the driver what page size
-%D to use. The special takes three arguments.
-%D
-%D \starttyping
-%D \dosetuppaper {type} {width} {height}
-%D \stoptyping
-%D
-%D The type is one of the common identifiers, like A4, A5 or
-%D B2.
-
-\let \dosetuppaper \gobblethreearguments
-
-%D \macros
-%D {dosetupprinter}
-%D
-%D Some drivers enable the user to specify the paper type
-%D used and/or page dimensions to be taken into account.
-%D
-%D \starttyping
-%D \dosetupprinter {type} {hoffset} {voffset} {width} {height}
-%D \stoptyping
-%D
-%D The first argument is one of \type{letter}, \type{legal},
-%D \type{A4}, \type{A5} etc. The dimensions are in
-%D basepoints.
-
-\let \dosetupprinter \gobblefourarguments
-
-%D \macros
-%D {dosetupopenaction, dosetupclosaction,
-%D dosetupopenpageaction, dosetupclospageaction,
-%D dosetupinteraction,
-%D dosetupscreen,
-%D dosetupviewmode}
-%D
-%D Here come some obscure interactive commands. Probably the
-%D specs will change with the development of the macros that
-%D use them.
-%D
-%D The first ones can be used to set up the interaction.
-%D
-%D \starttyping
-%D \dosetupinteraction
-%D \stoptyping
-%D
-%D Normally this command does nothing but giving a message
-%D that some scheme is supported.
-%D
-%D \starttyping
-%D \dosetupstartaction
-%D \dosetupstopaction
-%D \stoptyping
-%D
-%D These two setup the actions to be executed when the document
-%D is opened and closed.
-%D
-%D The next commands sets up the page and screen. They are
-%D kind of related.
-%D
-%D \starttyping
-%D \dosetuppage {hoffset} {voffset} {width} {height} {options}
-%D \dosetupscreen {hoffset} {voffset} {width} {height} {options}
-%D \stoptyping
-%D
-%D The first four arguments are in points. Option~1 results in a
-%D full screen launch.
-%D
-%D \starttyping
-%D \dosetuppageview {keyword}
-%D \stoptyping
-%D
-%D For the moment we only support \type{fit}.
-
-\let \dosetupinteraction \donothing
-\let \dosetupopenaction \donothing
-\let \dosetupscreen \gobblefourarguments
-\let \dosetuppageview \gobbleoneargument
-\let \dosetupcloseaction \donothing
-\let \dosetupopenpageaction \donothing
-\let \dosetupclosepageaction \donothing
\let \dosetuprenderingopenpageaction \donothing
\let \dosetuprenderingclosepageaction \donothing
-\let \dosetupcropbox \gobblefourarguments
-\let \dosetuptrimbox \gobblefourarguments
-\let \dosetupartbox \gobblefourarguments
-\let \dosetupbleedbox \gobblefourarguments
-
-%D \macros
-%D {dostarthide,
-%D dostophide}
-%D
-%D Not every part of the screen is suitable for paper. Menus
-%D for instance have no meaning on an non||interactive medium.
-%D These elements are hidden by means of:
-%D
-%D \starttyping
-%D \dostarthide .. \dostophide
-%D \stoptyping
-
-\let \dostarthide \donothing
-\let \dostophide \donothing
-
-%D \macros
-%D {dostartgotolocation, dostopgotolocation,
-%D dostartgotorealpage, dostopgotorealpage}
-%D
-%D When we want to support hypertext buttons, again we have
-%D to deal with two concepts.
-%D
-%D \startitemize[packed,n]
-%D \item let \TEX\ highlight the text
-%D \item let the driver show us where to click
-%D \stopitemize
-%D
-%D The first approach is the most secure one. It gives us
-%D complete control over the visual appearance of hyper
-%D buttons. The second alternative lets the driver guess what
-%D part of the text needs highlighting. As long as we deal with
-%D not too complicated textual buttons, this is no problem.
-%D It's even a bit more efficient when we take long mid
-%D paragraph active regions into account. When we let \TEX\
-%D handle active sentences {\em for instance marked like this
-%D one}, we have to take care of line- and pagebreaks ourselve.
-%D However, it's no trivial matter to let a driver find out
-%D where things begin and end. Because most hyperlinks can be
-%D found in tables of contents and registers, the saving in
-%D terms of bytes can be neglected and the first approach is a
-%D clear winner.
-%D
-%D The most convenient way of cross||referencing is using named
-%D destinations. A more simple scheme is using page numbers as
-%D destinations. Because the latter alternative can often be
-%D implemented more efficient, and because we cannot be sure
-%D what scheme a driver supports, we always have to supply a
-%D pagenumber, even when we use named destinations.
-%D
-%D To enable a driver to find out what to make active, we have
-%D to provide begin and endpoints, so like with color, we use
-%D pairs of specials. The first scheme can be satisfied with
-%D proper dimensions of the areas to be made active.
-%D
-%D The interactive real work is done by the following four
-%D specials. The reason for providing the first one with both
-%D a label and a number, is a result of the quite poor
-%D implementation of \type{pdfmarks} in version 1.0 of
-%D Acrobat. Because only pagenumbers were supported as
-%D destination, we had to provide both labels (\DVIWINDO) and
-%D pagenumbers (\PDF). Some drivers use start stop pairs.
-%D
-%D \starttyping
-%D \dostartgotolocation {w} {h} {url} {file} {label} {page}
-%D \dostartgotorealpage {w} {h} {url} {file} {page}
-%D \stoptyping
-%D
-%D Their counterparts are:
-%D
-%D \starttyping
-%D \dostopgotolocation
-%D \dostopgotorealpage
-%D \stoptyping
-%D
-%D The internal alternative is used for system||generated
-%D links, the external one for user||generated links. The
-%D Uniform Resource Locator can be used to let the reader
-%D surf the net.
-
-\let \dostartgotolocation \gobblesixarguments
-\let \dostopgotolocation \donothing
-\let \dostartgotorealpage \gobblefourarguments
-\let \dostopgotorealpage \donothing
-
-%D One may wonder why jumps to page and location are not
-%D combined. By splitting them, we enable macro||packages to
-%D force the prefered alternative, while on the other hand
-%D drivers can pick up the alternative desired most.
-
-%D \macros
-%D {dostartgotoJS, doflushJSpreamble}
-%D
-%D Rather special is the option to include and execute
-%D JavaScript code. This is a typical \PDF\ option.
-%D
-%D \starttyping
-%D \dostartgotoJS {w} {h} {script}
-%D \stoptyping
-%D
-%D This not so standard \TEX\ feature should be used with
-%D care. Preamble scripts are flushed by
-%D
-%D \doflushJSpreamble {script}
-
-\let \dostartgotoJS \gobblethreearguments
-\let \dostopgotoJS \donothing
-\let \doflushJSpreamble \gobbleoneargument
-
-%D \macros
-%D {dostartthisislocation, dostopthisislocation,
-%D dostartthisisrealpage, dostopthisisrealpage}
-%D
-%D Before we can goto some location or page, we have to tell
-%D the system where it can be found. Because some drivers
-%D follow the \SGML\ approach of begin||end tags, we have to
-%D support pairs. A possible extension to this scheme is
-%D supplying coordinates for viewing the text.
-%D
-%D The opposite commands of \type{\dogotosomething} have only
-%D one argument:
-%D
-%D \starttyping
-%D \dostartthisislocation {label}
-%D \dostartthisisrealpage {page}
-%D \stoptyping
-%D
-%D These commands are accompanied by:
-%D
-%D \starttyping
-%D \dostopthisislocation
-%D \dostopthisisrealpage
-%D \stoptyping
-%D
-%D As with all interactive commands's they are installed as
-%D \type{and} category specials.
-
-\let \dostartthisislocation \gobbleoneargument
-\let \dostopthisislocation \donothing
-\let \dostartthisisrealpage \gobbleoneargument
-\let \dostopthisisrealpage \donothing
-
-%D In \CONTEXT\ we don't use the \type{\stopsomething}
-%D macros because we let \TEX\ take care of typographic
-%D issues.
-
-%D \macros
-%D {doresetgotowhereever}
-%D
-%D These and others need:
-
-\let \doresetgotowhereever \donothing
-
-%D \macros
-%D {dostartexecutecommand, dostopexecutecommand}
-%D
-%D The actual behavior of the next pair of commands depends
-%D much on the viewing engine. Therefore one cannot depend
-%D too much on their support.
-%D
-%D \starttyping
-%D \dostartexecutecommand {w} {h} {command} {options}
-%D \stoptyping
-%D
-%D At least the next commands are supported (more examples
-%D can be found in \type {spec-fdf.tex}:
-%D
-%D \startlinecorrection\setupalign[middle]\leavevmode
-%D \starttable[|l|l|]
-%D \HL
-%D \NC \bf command \NC \bf action \NC\SR
-%D \HL
-%D \NC first \NC go to the first page \NC\FR
-%D \NC previous \NC go to the previous page \NC\MR
-%D \NC next \NC go to the next page \NC\MR
-%D \NC last \NC go to the last page \NC\MR
-%D \NC backward \NC go back to the link list \NC\MR
-%D \NC forward \NC go forward in the link list \NC\MR
-%D \NC print \NC enter print mode \NC\MR
-%D \NC exit \NC exit viewer \NC\MR
-%D \NC close \NC close document \NC\MR
-%D \NC enter \NC enter viewer \NC\MR
-%D \NC help \NC show help on the viewer \NC\LR
-%D \HL
-%D \stoptable
-%D \stoplinecorrection
-%D
-%D Options are to be passed as a comma separated list of
-%D assignments.
-
-\let \dostartexecutecommand \gobblefourarguments
-\let \dostopexecutecommand \donothing
%D \macros
%D {dostartobject,
@@ -590,229 +142,6 @@
\let \doinsertobject \gobbletwoarguments
\let \doresetobjects \donothing
-%D \macros
-%D {doregisterfigure, doregisterfigurecolor}
-%D
-%D Images can be objects as well and it's up to the driver to
-%D handle this. Alternative images are also up to the driver,
-%D and the next macro tells the driver that the previous image
-%D is somehow followed by another and that both have to be
-%D handled together. This is a rather fuzzy model, but for the
-%D moment it suits its purpose: low res screen versions combined
-%D with high res printable ones.
-
-\let \doregisterfigure \gobbletwoarguments
-\let \doregisterfigurecolor \gobbleoneargument
-
-% %D \macros
-% %D {dogetobjectreference}
-% %D
-% %D For very special purposes, one can ask for the internal
-% %D reference to the object. Beware!
-%
-% \let \dogetobjectreference \gobblethreearguments
-%
-% %D The first argument is the name, the second a macro that
-% %D gets the associated value.
-
-%D \macros
-%D {dostartrunprogram, dostoprunprogram,
-%D dostartgotoprofile, dostopgotoprofile,
-%D dobeginofprofile,
-%D doendofprofile}
-%D
-%D These specials are still experimental. They are not yet
-%D supported by the programs the way they should be.
-%D
-%D {\em --- still undocumented ---}
-
-\let \dostartrunprogram \gobblefourarguments
-\let \dostoprunprogram \donothing
-\let \dostartgotoprofile \gobblethreearguments
-\let \dostopgotoprofile \donothing
-\let \dobeginofprofile \gobblefourarguments
-\let \doendofprofile \donothing
-
-%D \macros
-%D {doinsertbookmark}
-%D
-%D Bookmarks, that is viewer generated tables of contents, are
-%D a strange phenomena, mainly because \TEX\ can provide
-%D whatever kind of table in much better quality.
-
-\let \doinsertbookmark \gobblefourarguments
-
-%D This special is called as:
-%D
-%D \starttyping
-%D \doinstallbookmark {level} {nofsubentries} {text} {page} {open}
-%D \stoptyping
-%D
-%D This definition is very \PDF\ oriented, so for more
-%D information we kindly refer to the \PDF\ manuals.
-
-%D \macros
-%D {dosetpagetransition}
-%D
-%D In presentations, fancy page transitions can, at least for a
-%D short moment, let the audience focus at the screen. Like the
-%D previous one, this special is very \PDF.
-%D
-%D \starttyping
-%D \dosetpagetransition{dissolve}{0}
-%D \stoptyping
-%D
-%D Transitions have symbolic names, like dissolve, box, split,
-%D blinds, wipe and glitter. The second argument determines
-%D the wait time (unless zero).
-
-\let \dosetpagetransition \gobbletwoarguments
-
-%D \macros
-%D {dopresettextfield,dopresetlinefield,
-%D dopresetchoicefield,dopresetpopupfield,dopresetcombofield,
-%D dopresetbuttonfield,dopresetcheckfield,
-%D dopresetradiofield,dopresetradiorecord}
-%D
-%D The special drivers are programmed independant from their
-%D calling macros are thereby use the standard \TEX\ way of
-%D passing parameters. Unfortunately fields often have more
-%D than nine characteristics, so we pack some arguments in one.
-%D
-%D \starttyping
-%D \dopresettextfield / \dopresetlinefield
-%D {name} {width} {height} {default} {length}
-%D {style,color} {options} {alignment} {actions}
-%D
-%D \dopresetchoicefield / \dopresetpopupfield / \dopresetcombofield
-%D {name} {width} {height} {default}
-%D {style,color} {options} {values} {actions}
-%D
-%D \dopresetpushfield
-%D {name} {width} {height} {default}
-%D {options} {values} {actions}
-%D
-%D \dopresetcheckfield
-%D {name} {width} {height} {default}
-%D {options} {values} {actions}
-%D
-%D \dopresetradiofield
-%D {name} {width} {height} {default}
-%D {options} {parent} {values} {actions}
-%D
-%D \dopresetradiorecord
-%D {name} {top} {options} {kids} {actions}
-%D \stoptyping
-
-\let \dopresetlinefield \gobbleninearguments
-\let \dopresettextfield \gobbleninearguments
-\let \dopresetchoicefield \gobbleeightarguments
-\let \dopresetpopupfield \gobbleeightarguments
-\let \dopresetcombofield \gobbleeightarguments
-\let \dopresetpushfield \gobblesevenarguments
-\let \dopresetcheckfield \gobblesevenarguments
-\let \dopresetradiofield \gobbleeightarguments
-\let \dopresetradiorecord \gobblefourarguments
-
-%D \macros
-%D {dodefinefieldset,dogetfieldset,doiffieldset}
-%D
-%D Field sets, used in resetting and submitting, are handled
-%D by:
-
-\let \dodefinefieldset \gobbletwoarguments
-\let \dogetfieldset \gobbleoneargument
-\let \doiffieldset \gobbletwoarguments
-
-%D \macros
-%D {dosetfieldstatus}
-%D
-%D For practical reasons we set some field characteristics
-%D using:
-%D
-%D \starttyping
-%D \dosetfieldstatus {mode} {parent} {kids} {root}
-%D \stoptyping
-
-\let \dosetfieldstatus \gobblefourarguments
-
-%D with:
-
-\def\fieldlonermode {0} % no \chardef here
-\def\fieldparentmode{1} % no \chardef here
-\def\fieldchildmode {2} % no \chardef here
-\def\fieldcopymode {3} % no \chardef here
-
-%D \macros
-%D {doregistercalculationset}
-%D
-%D We can define a calculation order list with:
-%D
-%D \starttyping
-%D \doregistercalculationset {set identifier}
-%D \stoptyping
-
-\let \doregistercalculationset \gobbleoneargument
-
-%D \macros
-%D {doinsertcomment, doflushcomments}
-%D
-%D Not so much out of need, but to be complete, we also
-%D implement text annotations, so called comment:
-%D
-%D \starttyping
-%D \doinsertcomment
-%D {title} {width} {height} {color} {open} {symbol} {collect} {data}
-%D \stoptyping
-%D
-%D When enables, comments can be collected and flushed:
-%D
-%D \starttyping
-%D \doflushcomments
-%D \stoptyping
-
-\let \doinsertcomment \gobbleeightarguments
-\let \doflushcomments \donothing
-
-%D \macros
-%D {dostarttransparency,dostoptransparency}
-%D
-%D \starttyping
-%D \dostarttransparency{fraction}{type}
-%D \dostoptransparency
-%D \stoptyping
-%D
-%D Although in \CONTEXT\ transparency is closely integrated
-%D in the color drivers, in the end it is an independent
-%D feature.
-
-\let \dostarttransparency \gobbletwoarguments
-\let \dostoptransparency \donothing
-
-%D \macros
-%D {doattachfile}
-%D
-%D \starttyping
-%D \doattachfile{title}{width}{height}{depth}{color}{symbol}{filename}{source}
-%D \stoptyping
-
-\let \doattachfile \gobbleeightarguments
-
-%D Experimental (properties):
-
-\let \dostartviewerlayer \gobbleoneargument
-\let \dostopviewerlayer \donothing
-\let \dodefineviewerlayer \gobblefivearguments
-\let \domakeviewerlayerlist \gobbleoneargument
-
-\let \doinsertrenderingwindow \gobblefourarguments
-\let \doinsertrendering \gobblefourarguments
-\let \doinsertrenderingobject \gobblefourarguments
-\let \doinsertrenderingobject \gobblefourarguments
-
-\let \dostartfonteffect \gobblethreearguments
-\let \dostopfonteffect \donothing
-
%D From now on, mapfile loading is also a special; we assume the
%D more or less standard dvips syntax.
@@ -836,24 +165,6 @@
\newif\ifusepagedestinations
-%D \macros
-%D {ifhighlighthyperlinks}
-%D
-%D The next switch can be used to make user hyperlinks are
-%D not highlighted when clicked on.
-
-\newif\ifhighlighthyperlinks
-
-%D \macros
-%D {ifgotonewwindow}
-%D
-%D To make the {\em goto previous jump} feature more
-%D convenient when using more than one file, it makes sense
-%D to force the viewer to open a new window for each file
-%D opened.
-
-\newif\ifgotonewwindow
-
%D \macros
%D {jobsuffix}
%D
@@ -862,8 +173,6 @@
%D know what the target file will be. In other driver
%D modules we wil set \type {\jobsuffix} to \type {pdf}.
-% this will become a mode
-
\def\jobsuffix{pdf}
\ifdefined\resetsystemmode \else
@@ -876,21 +185,6 @@
\edef\jobsuffix{#1}%
\setsystemmode\jobsuffix}
-%D \macros
-%D {everyresetspecials}
-%D
-%D Now what will this one do? We'll see in a few lines.
-
-\newtoks\everyresetspecials
-
-\appendtoksonce
- \ifdefined\setjobsuffix\setjobsuffix{pdf}\fi
-\to \everyresetspecials
-
-\def\defineoutput{\dodoubleargument\dodefineoutput}
-
-\def\usespecials [#1]{}
-\def\dodefineoutput[#1][#2]{}
-\def\setupoutput [#1]{}
+\def\setupoutput[#1]{} % will be command line switch
\protect \endinput
diff --git a/tex/context/base/back-pdf.lua b/tex/context/base/back-pdf.lua
index 7f04ced5f..b2e103d36 100644
--- a/tex/context/base/back-pdf.lua
+++ b/tex/context/base/back-pdf.lua
@@ -14,63 +14,30 @@ than one argument to .
--ldx]]--
local type, next, tostring = type, next, tostring
-local char, byte, format, gsub = string.char, string.byte, string.format, string.gsub
+local char, byte, format, gsub, rep, gmatch = string.char, string.byte, string.format, string.gsub, string.rep, string.gmatch
local concat = table.concat
+local round = math.round
local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues
local texsprint, texwrite = tex.sprint, tex.write
ctxcatcodes = tex.ctxcatcodes
-pdf = pdf or { } -- global
+local copy_node = node.copy
-backends.pdf = pdf -- registered
-
-function pdf.cleandestination(str)
- texsprint((gsub(str,"[%/%#%<%>%[%]%(%)%-%s]+","-")))
-end
-
-function pdf.cleandestination(str)
- texsprint((gsub(str,"[%/%#%<%>%[%]%(%)%-%s]+","-")))
-end
-
-function pdf.sanitizedstring(str)
- texsprint((gsub(str,"([\\/#<>%[%]%(%)])","\\%1")))
-end
-
-function pdf.hexify(str)
- texwrite("feff")
- for b in utfvalues(str) do
- if b < 0x10000 then
- texwrite(format("%04x",b))
- else
- texwrite(format("%04x%04x",b/1024+0xD800,b%1024+0xDC00))
- end
- end
-end
-
-function pdf.utf8to16(s,offset) -- derived from j. sauter's post on the list
- offset = (offset and 0x110000) or 0 -- so, only an offset when true
- texwrite(char(offset+254,offset+255))
- for c in utfvalues(s) do
- if c < 0x10000 then
- texwrite(char(offset+c/256,offset+c%256))
- else
- c = c - 0x10000
- local c1, c2 = c / 1024 + 0xD800, c % 1024 + 0xDC00
- texwrite(char(offset+c1/256,offset+c1%256,offset+c2/256,offset+c2%256))
- end
- end
-end
-
-pdf.nodeinjections = pdf.nodeinjections or { } -- we hash elsewhere
-pdf.codeinjections = pdf.codeinjections or { } -- we hash elsewhere
-pdf.registrations = pdf.registrations or { } -- we hash elsewhere
+local nodeinjections = backends.pdf.nodeinjections
+local codeinjections = backends.pdf.codeinjections
+local registrations = backends.pdf.registrations
local pdfliteral, register = nodes.pdfliteral, nodes.register
-local nodeinjections = pdf.nodeinjections
-local codeinjections = pdf.codeinjections
-local registrations = pdf.registrations
+local pdfconstant = lpdf.constant
+local pdfdictionary = lpdf.dictionary
+local pdfarray = lpdf.array
+local pdfreference = lpdf.reference
+local pdfverbose = lpdf.verbose
+
+local pdfreserveobj = pdf.reserveobj
+local pdfimmediateobj = pdf.immediateobj
function nodeinjections.rgbcolor(r,g,b)
return register(pdfliteral(format("%s %s %s rg %s %s %s RG",r,g,b,r,g,b)))
@@ -80,7 +47,7 @@ function nodeinjections.cmykcolor(c,m,y,k)
return register(pdfliteral(format("%s %s %s %s k %s %s %s %s K",c,m,y,k,c,m,y,k)))
end
-function nodeinjections.graycolor(s)
+function nodeinjections.graycolor(s) -- caching 0/1 does not pay off
return register(pdfliteral(format("%s g %s G",s,s)))
end
@@ -95,21 +62,15 @@ function nodeinjections.transparency(n)
return register(pdfliteral(format("/Tr%s gs",n)))
end
-function nodeinjections.overprint()
- return register(pdfliteral("/GSoverprint gs"))
-end
-
-function nodeinjections.knockout()
- return register(pdfliteral("/GSknockout gs"))
-end
-
-function nodeinjections.positive()
- return register(pdfliteral("/GSpositive gs"))
-end
+local positive = register(pdfliteral("/GSpositive gs"))
+local negative = register(pdfliteral("/GSnegative gs"))
+local overprint = register(pdfliteral("/GSoverprint gs"))
+local knockout = register(pdfliteral("/GSknockout gs"))
-function nodeinjections.negative()
- return register(pdfliteral("/GSnegative gs"))
-end
+function nodeinjections.positive () return copy_node(positive) end
+function nodeinjections.negative () return copy_node(negative) end
+function nodeinjections.overprint() return copy_node(overprint) end
+function nodeinjections.knockout () return copy_node(knockout) end
local effects = {
normal = 0,
@@ -126,60 +87,379 @@ function nodeinjections.effect(stretch,rulethickness,effect)
return register(pdfliteral(format("%s Tc %s w %s Tr",stretch,rulethickness,effect))) -- watch order
end
+-- cached ..
+
+local cache = { }
+
function nodeinjections.startlayer(name)
- return register(pdfliteral(format("/OC /%s BDC",name)))
+ local c = cache[name]
+ if not c then
+ c = register(pdfliteral(format("/OC /%s BDC",name)))
+ cache[name] = c
+ end
+ return copy_node(c)
end
+local stop = register(pdfliteral("EMC"))
+
function nodeinjections.stoplayer()
- return register(pdfliteral("EMC"))
+ return copy_node(stop)
end
+local cache = { }
+
function nodeinjections.switchlayer(name)
- return register(pdfliteral(format("EMC /OC /%s BDC",name)))
+ local c = cache[name]
+ if not c then
+ c = register(pdfliteral(format("EMC /OC /%s BDC",name)))
+ end
+ return copy_node(c)
end
-- code
-function codeinjections.insertmovie(spec) -- width, height, factor, repeat, controls, preview, label, foundname
- local width, height, factor = spec.width, spec.height, spec.factor or number.dimenfactors.bp
- local options, actions = "", ""
- if spec["repeat"] then
- actions = actions .. "/Mode /Repeat "
+function codeinjections.insertmovie(specification)
+ -- managed in figure inclusion: width, height, factor, repeat, controls, preview, label, foundname
+ local width = specification.width
+ local height = specification.height
+ local factor = specification.factor or number.dimenfactors.bp
+ local moviedict = pdfdictionary {
+ F = specification.foundname,
+ Aspect = pdfarray { factor * width, factor * height },
+ Poster = (specification.preview and true) or false,
+ }
+ local controldict = pdfdictionary {
+ ShowControls = (specification.controls and true) or false,
+ Mode = (specification["repeat"] and pdfconstant("Repeat")) or nil,
+ }
+ local action = pdfdictionary {
+ Subtype = pdfconstant("Movie"),
+ Border = pdfarray { 0, 0, 0 },
+ T = format("movie %s",specification.label),
+ Movie = moviedict,
+ A = controldict,
+ }
+ node.write(nodes.pdfannot(width,height,0,action()))
+end
+
+function codeinjections.insertsound(specification)
+ -- rmanaged in interaction: repeat, label, foundname
+ local soundclip = interactions.soundclip(specification.label)
+ if soundclip then
+ local controldict = pdfdictionary {
+ Mode = (specification["repeat"] and pdfconstant("Repeat")) or nil
+ }
+ local sounddict = pdfdictionary {
+ F = soundclip.filename
+ }
+ local action = pdfdictionary {
+ Subtype = pdfconstant("Movie"),
+ Border = pdfarray { 0, 0, 0 },
+ T = format("sound %s",specification.label),
+ Movie = sounddict,
+ A = controldict,
+ }
+ node.write(nodes.pdfannot(0,0,0,action()))
end
- if spec.controls then
- actions = actions .. "/ShowControls true "
+end
+
+-- spot- and indexcolors
+
+local pdf_separation = pdfconstant("Separation")
+local pdf_indexed = pdfconstant("Indexed")
+local pdf_device_n = pdfconstant("DeviceN")
+local pdf_device_rgb = pdfconstant("DeviceRGB")
+local pdf_device_cmyk = pdfconstant("DeviceCMYK")
+local pdf_device_gray = pdfconstant("Devicegray")
+local pdf_extgstate = pdfconstant("ExtGState")
+
+local pdf_rbg_range = pdfarray { 0, 1, 0, 1, 0, 1 }
+local pdf_cmyk_range = pdfarray { 0, 1, 0, 1, 0, 1, 0, 1 }
+local pdf_gray_range = pdfarray { 0, 1 }
+
+local rgb_function = "dup %s mul exch dup %s mul exch %s mul"
+local cmyk_function = "dup %s mul exch dup %s mul exch dup %s mul exch %s mul"
+local gray_function = "%s mul"
+
+local documentcolorspaces = pdfdictionary()
+
+local spotcolorhash = { } -- not needed
+local spotcolornames = { }
+local indexcolorhash = { }
+local delayedindexcolors = { }
+
+function registrations.spotcolorname(name,e)
+ spotcolornames[name] = e or name
+end
+
+local function registersomespotcolor(name,noffractions,names,p,colorspace,range,funct)
+ noffractions = tonumber(noffractions) or 1 -- to be checked
+ if noffractions == 0 then
+ -- can't happen
+ elseif noffractions == 1 then
+ local dictionary = pdfdictionary {
+ FunctionType = 4,
+ Domain = { 0, 1 },
+ Range = range,
+ }
+ local n = pdfimmediateobj("stream",format("{ %s }",funct),dictionary())
+ local array = pdfarray {
+ pdf_separation,
+ pdfconstant(spotcolornames[name] or name),
+ colorspace,
+ pdfreference(n),
+ }
+ local m = pdfimmediateobj(tostring(array))
+ local mr = pdfreference(m)
+ spotcolorhash[name] = m
+ documentcolorspaces[name] = mr
+ lpdf.adddocumentcolorspace(name,mr)
else
- actions = actions .. "/ShowControls false "
- end
- if spec.preview then
- options = options .. "/Poster true "
- end
- if actions ~= "" then
- actions= "/A <<" .. actions .. ">>"
- end
- return format( -- todo: doPDFannotation
- "\\insertpdfannotation{%ssp}{%ssp}{/Subtype /Movie /Border [0 0 0] /T (movie %s) /Movie << /F (%s) /Aspect [%s %s] %s>> %s}",
- width, height, spec.label, spec.foundname, factor * width, factor * height, options, actions
- )
-end
-
-local s_template_g = "\\dodoPDFregistergrayspotcolor{%s}{%s}{%s}{%s}{%s}" -- n f d p s (p can go away)
-local s_template_r = "\\dodoPDFregisterrgbspotcolor {%s}{%s}{%s}{%s}{%s}{%s}{%s}" -- n f d p r g b
-local s_template_c = "\\dodoPDFregistercmykspotcolor{%s}{%s}{%s}{%s}{%s}{%s}{%s}{%s}" -- n f d p c m y k
-local m_template_g = "\\doPDFregistergrayindexcolor{%s}{%s}{%s}{%s}{%s}" -- n f d p s (p can go away)
-local m_template_r = "\\doPDFregisterrgbindexcolor {%s}{%s}{%s}{%s}{%s}{%s}{%s}" -- n f d p r g b
-local m_template_c = "\\doPDFregistercmykindexcolor{%s}{%s}{%s}{%s}{%s}{%s}{%s}{%s}" -- n f d p c m y k
-local s_template_e = "\\doPDFregisterspotcolorname{%s}{%s}" -- name, e -- todo in new backend: gsub(e," ","#20")
-local t_template = "\\presetPDFtransparencybynumber{%s}{%s}{%s}" -- n, a, t
-
-function registrations.grayspotcolor (n,f,d,p,s) states.collect(format(s_template_g,n,f,d,p,s)) end
-function registrations.rgbspotcolor (n,f,d,p,r,g,b) states.collect(format(s_template_r,n,f,d,p,r,g,b)) end
-function registrations.cmykspotcolor (n,f,d,p,c,m,y,k) states.collect(format(s_template_c,n,f,d,p,c,m,y,k)) end
-function registrations.grayindexcolor(n,f,d,p,s) states.collect(format(m_template_g,n,f,d,p,s)) end
-function registrations.rgbindexcolor (n,f,d,p,r,g,b) states.collect(format(m_template_r,n,f,d,p,r,g,b)) end
-function registrations.cmykindexcolor(n,f,d,p,c,m,y,k) states.collect(format(m_template_c,n,f,d,p,c,m,y,k)) end
-function registrations.spotcolorname (name,e) states.collect(format(s_template_e,name,e)) end -- texsprint(ctxcatcodes,format(s_template_e,name,e))
-function registrations.transparency (n,a,t) states.collect(format(t_template ,n,a,t)) end -- too many, but experimental anyway
+ local cnames = pdfarray()
+ local domain = pdfarray()
+ for n in gmatch(names,"[^,]+") do
+ cnames[#cnames+1] = pdfconstant(spotcolornames[n] or n)
+ domain[#domain+1] = 0
+ domain[#domain+1] = 1
+ end
+ local dictionary = pdfdictionary {
+ FunctionType = 4,
+ Domain = domain,
+ Range = range,
+ }
+ local n = pdfimmediateobj("stream",format("{ %s %s }",rep("pop ",noffractions),funct),dictionary())
+ local array = pdfarray {
+ pdf_device_n,
+ cnames,
+ colorspace,
+ pdfreference(n),
+ }
+ local m = pdfimmediateobj(tostring(array))
+ local mr = pdfreference(m)
+ spotcolorhash[name] = m
+ documentcolorspaces[name] = mr
+ lpdf.adddocumentcolorspace(name,mr)
+ end
+end
+
+function registersomeindexcolor(name,noffractions,names,p,colorspace,range,funct)
+ noffractions = tonumber(noffractions) or 1 -- to be checked
+ local cnames = pdfarray()
+ local domain = pdfarray()
+ if names == "" then
+ names = name .. ",None"
+ else
+ names = names .. ",None"
+ end
+ for n in gmatch(names,"[^,]+") do
+ cnames[#cnames+1] = pdfconstant(spotcolornames[n] or n)
+ domain[#domain+1] = 0
+ domain[#domain+1] = 1
+ end
+ local dictionary = pdfdictionary {
+ FunctionType = 4,
+ Domain = domain,
+ Range = range,
+ }
+ local n = pdfimmediateobj("stream",format("{ %s %s }",rep("exch pop ",noffractions),funct),dictionary()) -- exch pop
+ local a = pdfarray {
+ pdf_device_n,
+ cnames,
+ colorspace,
+ pdfreference(n),
+ }
+ if p == "" then
+ p = "1"
+ else
+ p = p .. ",1"
+ end
+ local pi = { }
+ for pp in gmatch(p,"[^,]+") do
+ pi[#pi+1] = tonumber(pp)
+ end
+ local vector, set, n = { }, { }, #pi
+ for i=255,0,-1 do
+ for j=1,n do
+ set[j] = format("%02X",round(pi[j]*i))
+ end
+ vector[#vector+1] = concat(set)
+ end
+ vector = pdfverbose { "<", concat(vector, " "), ">" }
+ local n = pdfimmediateobj(tostring(pdfarray{ pdf_indexed, a, 255, vector }))
+ lpdf.adddocumentcolorspace(format("%s_indexed",name),pdfreference(n))
+ return n
+end
+
+-- actually, names (parent) is the hash
+
+local function delayindexcolor(name,names,func)
+ local hash = (names ~= "" and names) or name
+ -- logs.report("index colors","delaying '%s'",name)
+ delayedindexcolors[hash] = func
+end
+
+local function indexcolorref(name) -- actually, names (parent) is the hash
+ if not indexcolorhash[name] then
+ -- logs.report("index colors","registering '%s'",name)
+ local delayedindexcolor = delayedindexcolors[name]
+ if type(delayedindexcolor) == "function" then
+ indexcolorhash[name] = delayedindexcolor()
+ delayedindexcolors[name] = true
+ end
+ end
+ return indexcolorhash[name]
+end
+
+function registrations.rgbspotcolor(name,noffractions,names,p,r,g,b)
+ if noffractions == 1 then
+ registersomespotcolor(name,noffractions,names,p,pdf_device_rgb,pdf_rbg_range,format(rgb_function,r,g,b))
+ else
+ registersomespotcolor(name,noffractions,names,p,pdf_device_rgb,pdf_rbg_range,format("%s %s %s",r,g,b))
+ end
+ delayindexcolor(name,names,function()
+ return registersomeindexcolor(name,noffractions,names,p,pdf_device_rgb,pdf_rgb_range,format(rgb_function,r,g,b))
+ end)
+end
+
+function registrations.cmykspotcolor(name,noffractions,names,p,c,m,y,k)
+ if noffractions == 1 then
+ registersomespotcolor(name,noffractions,names,p,pdf_device_cmyk,pdf_cmyk_range,format(cmyk_function,c,m,y,k))
+ else
+ registersomespotcolor(name,noffractions,names,p,pdf_device_cmyk,pdf_cmyk_range,format("%s %s %s %s",c,m,y,k))
+ end
+ delayindexcolor(name,names,function()
+ return registersomeindexcolor(name,noffractions,names,p,pdf_device_cmyk,pdf_cmyk_range,format(cmyk_function,c,m,y,k))
+ end)
+end
+
+function registrations.grayspotcolor(name,noffractions,names,p,s)
+ if noffractions == 1 then
+ registersomespotcolor(name,noffractions,names,p,pdf_device_gray,pdf_gray_range,format(gray_function,s))
+ else
+ registersomespotcolor(name,noffractions,names,p,pdf_device_gray,pdf_gray_range,s)
+ end
+ delayindexcolor(name,names,function()
+ return registersomeindexcolor(name,noffractions,names,p,pdf_device_gray,pdf_gray_range,format(gray_function,s))
+ end)
+end
+
+function registrations.rgbindexcolor(name,noffractions,names,p,r,g,b)
+ registersomeindexcolor(name,noffractions,names,p,pdf_device_rgb,pdf_rgb_range,format(rgb_function,r,g,b))
+end
+
+function registrations.cmykindexcolor(name,noffractions,names,p,c,m,y,k)
+ registersomeindexcolor(name,noffractions,names,p,pdf_device_cmyk,pdf_cmyk_range,format(cmyk_function,c,m,y,k))
+end
+
+function registrations.grayindexcolor(name,noffractions,names,p,s)
+ registersomeindexcolor(name,noffractions,names,p,pdf_device_gray,pdf_gray_range,gray_function)
+end
+
+function codeinjections.setfigurecolorspace(data,figure)
+ local color = data.request.color
+ if color then
+ local ref = indexcolorref(color)
+ if ref then
+ figure.colorspace = ref
+ data.used.color = color
+ end
+ end
+end
+
+-- transparency
+
+local transparencies = { [0] =
+ pdfconstant("Normal"),
+ pdfconstant("Normal"),
+ pdfconstant("Multiply"),
+ pdfconstant("Screen"),
+ pdfconstant("Overlay"),
+ pdfconstant("SoftLight"),
+ pdfconstant("HardLight"),
+ pdfconstant("ColorDodge"),
+ pdfconstant("ColorBurn"),
+ pdfconstant("Darken"),
+ pdfconstant("Lighten"),
+ pdfconstant("Difference"),
+ pdfconstant("Exclusion"),
+ pdfconstant("Compatible"),
+}
+
+local documenttransparencies = { }
+local transparencyhash = { } -- not needed
+
+local done = false
+
+function registrations.transparency(n,a,t)
+ if not done then
+ local d = pdfdictionary {
+ Type = pdf_extgstate,
+ ca = 1,
+ CA = 1,
+ BM = transparencies[1],
+ AIS = false,
+ }
+ local m = pdfimmediateobj(tostring(d))
+ local mr = pdfreference(m)
+ transparencyhash[0] = m
+ documenttransparencies[0] = mr
+ lpdf.adddocumentextgstate("Tr0",mr)
+ done = true
+ end
+ if n > 0 then
+ local d = pdfdictionary {
+ Type = pdf_extgstate,
+ ca = tonumber(t),
+ CA = tonumber(t),
+ BM = transparencies[a] or transparencies[0],
+ AIS = false,
+ }
+ local m = pdfimmediateobj(tostring(d))
+ local mr = pdfreference(m)
+ transparencyhash[n] = m
+ documenttransparencies[n] = mr
+ lpdf.adddocumentextgstate(format("Tr%s",n),mr)
+ end
+end
+
+function codeinjections.adddocumentinfo(key,value)
+ lpdf.addtoinfo(key,lpdf.tosixteen(value))
+end
+
+-- graphics
+
+function codeinjections.setfigurealternative(data,figure)
+ local display = data.request.display
+ if display and display ~= "" then
+ local request = data.request
+ figures.push {
+ name = request.display,
+ page = request.page,
+ size = request.size,
+ prefix = request.prefix,
+ cache = request.cache,
+ width = request.width,
+ height = request.height,
+ }
+ figures.identify()
+ local displayfigure = figures.check()
+ if displayfigure then
+ -- figure.aform = true
+ img.immediatewrite(figure)
+ local a = lpdf.array {
+ lpdf.dictionary {
+ Image = lpdf.reference(figure.objnum),
+ DefaultForPrinting = true,
+ }
+ }
+ local d = lpdf.dictionary {
+ Alternates = lpdf.reference(pdf.immediateobj(tostring(a))),
+ }
+ displayfigure.attr = d()
+ return displayfigure, figures.current()
+ end
+ end
+end
-- eventually we need to load this runtime
--
@@ -187,4 +467,7 @@ function registrations.transparency (n,a,t) states.collect(format(t_t
--
-- but now we need to force this as we also load the pdf tex part which hooks into all kind of places
+codeinjections.finalizepage = lpdf.finalizepage
+codeinjections.finalizedocument = lpdf.finalizedocument
+
backends.install("pdf")
diff --git a/tex/context/base/back-pdf.mkiv b/tex/context/base/back-pdf.mkiv
index fcfc53091..aaba4554f 100644
--- a/tex/context/base/back-pdf.mkiv
+++ b/tex/context/base/back-pdf.mkiv
@@ -13,320 +13,14 @@
\writestatus{loading}{ConTeXt Backend Macros / PDF}
-\registerctxluafile{back-pdf}{1.001}
+\registerctxluafile{back-pdf}{1.001} % this will change
\unprotect
-%D When dealing with resources, we share the resource dictionaries
-%D between all xforms. This is inefficent in the sense that when no
-%D resources are used, redundant entries take space, but on the other
-%D hand we save redundant dictionaries so it's a nice compromise. Maybe
-%D that in \LUATEX\ I will reimplement most of the code here anyway.
-
-%D Initialization of fields is tricky. If a field has no
-%D value, it is kind of not there. If ResetForm is used, the
-%D default is assigned, but pushbuttons are spoiled. Adding a
-%D \type {/MK} dictionary helps, but gives ugly down
-%D appearances (displaced with background). What a mess.
-%D Also, in order to get at least something, the \type {/AS}
-%D key should be provided.
-
-%D A couple of variables:
-
-\newtoks \everybackendshipout
-\newtoks \everylastbackendshipout
-
-\let\lastPDFaction\empty
-
-\ifdefined\everyPDFximage \else \newtoks\everyPDFximage \fi
-\ifdefined\everyPDFxform \else \newtoks\everyPDFxform \fi
-\ifdefined\everygoto \else \newtoks\everygoto \fi
-\ifdefined\everysetfield \else \newtoks\everysetfield \fi
-
-%D A few helpers:
-
-\let\PDFcode \pdfliteral
-\def\PDFcontentcode{\pdfliteral}
-\def\PDFdirectcode {\pdfliteral direct}
-
-%D \macros
-%D {PDFobjref}
-%D
-%D Just a shortcut.
-
-% Watch out, \def\PDFobjref#1{\purenumber#1 0 R} also works, but not when
-% #1 == \the\whatever
-
-\def\PDFobjref#1{\purenumber{#1} 0 R}
-
-%D \macros
-%D {PDFswapdir}
-
-\let\PDFswapdir\empty \def\PDFswapdir{\ifcase\inlinedirection\or\or-\fi}
-
-% the pdf spec changed cq. viewers started behaving differently / 5+
-
-\chardef\overcomePDFpage\plusone % page numbers/ beware: optimizers remove this one
-\chardef\overcomePDFpage\plustwo % page:number
-\chardef\overcomePDFpage\plusthree % pdftex page ref feature
-
-%D \macros
-%D {setPDFdestination}
-%D
-%D \PDF\ destinations should obey the specifications laid down
-%D in the \PDF\ reference manual. The next macro strips illegal
-%D characters from the destination name.
-
-\def\setPDFdestination #1{\xdef\PDFdestination{\ctxlua{pdf.cleandestination("\luaescapestring{#1}")}}}
-\def\hexifiedPDFstring #1{\ctxlua{pdf.hexify("\luaescapestring{#1}")}}
-\def\sanitizePDFencoding#1\to#2{\xdef#2{\ctxlua{pdf.hexify("\luaescapestring{#1}")}}}
-
-%D
-
-\def\appendtopdfpageresources #1{\normalexpanded{\global\pdfpageresources{#1\the\pdfpageresources}}}
-\def\appendtopdfpageattributes #1{\normalexpanded{\global\pdfpageattr {#1\the\pdfpageattr }}}
-\def\appendtopdfpagesattributes#1{\normalexpanded{\global\pdfpagesattr {#1\the\pdfpagesattr }}}
-\def\appendtopdfcatalog {\pdfcatalog}
-\def\appendtopdfinfo {\pdfinfo}
-
-\def\resetpdfpageattributes{\global\pdfpageattr\emptytoks}
-\def\resetpdfpageresources {\global\pdfpageresources\emptytoks}
-
-%D Due to the fact that \PDFTEX\ has a different concept of
-%D page attributes, we need:
-
-\appendtoksonce
- \resetpdfpageattributes
- \resetpdfpageresources
-\to \everyaftershipout
-
-%D \macros
-%D {insertpdfaction,
-%D insertpdfannotation,
-%D insertpdfannotationobject,
-%D createpdfdictionaryobject,
-%D createpdfarrayobject,
-%D defaultobjectreference,
-%D doPDFgetobjectreference}
-%D
-%D This module deals with \PDF\ support, including fill||in
-%D forms. Before we present the largely unreadable bunch of
-%D macros, we introduce the here||not||defined low level
-%D interface macros. These must be provided by the special
-%D drivers \type{pdf} (\ACROBAT) and \type{tpd} (\PDFTEX).
-%D
-%D \starttyping
-%D \insertpdfaction #1#2#3 width height action
-%D \insertpdfannotation #1#2#3 width height data
-%D \createpdfannotationobject #1#2#3#4#5 class name width height data
-%D \createpdfdictionaryobject #1#2#3 class name data
-%D \createpdfarrayobject #1#2#3 class name data
-%D
-%D \defaultobjectreference #1#2 class name
-%D \doPDFgetobjectreference #1#2#3 class name \PDFobjectreference
-%D \doPDFgetobjectpagereference #1#2#3 class name \PDFobjectreference
-%D \stoptyping
-%D
-%D The keywords reflect their use. For the moment we stick to
-%D keywords, because that way at we get an indication of what
-%D we're doing.
-
-\def\createpdfdictionaryobject#1#2#3%
- {\flushatshipout
- {\immediate\pdfobj{<< #3 >>}%
- \dosetobjectreference{#1}{#2}{\the\pdflastobj}}}
-
-\def\createpdfarrayobject#1#2#3%
- {\flushatshipout
- {\immediate\pdfobj{[ #3 ]}%
- \dosetobjectreference{#1}{#2}{\the\pdflastobj}}}
-
-\def\createpdfannotationobject#1#2#3#4#5%
- {\insertpdfannotation{#3}{#4}{#5}%
- \dosetobjectreference{#1}{#2}{\the\pdflastannot}}
-
-\def\createpdfactionobject#1#2#3#4#5%
- {\insertpdfaction{#3}{#4}{#5}%
- \dosetobjectreference{#1}{#2}{\the\pdflastannot}}
-
-%D \macros
-%D {insertpdfaction,insertpdfannotation,ifsharePDFactions}
-%D
-%D Next we handle annotations. All link annotations are
-%D implemented using the action dictionary. This enables us to
-%D use multiple actions. The second macro is for instance
-%D used for movie inclusion.
-
-\newif\ifsharePDFactions \sharePDFactionstrue
-
-\def\insertpdfaction#1#2#3%
- {\xdef\lastPDFcontent{#3}%
- \ifcollectreferenceactions
- \global\let\lastPDFaction\lastPDFcontent
- \else
- \ifsharePDFactions
- \ifcase\similarreference\relax
- \xdef\lastPDFaction{<<\lastPDFcontent>>}%
- \or
- \immediate\pdfobj{<<\lastPDFcontent>>}%
- \xdef\lastPDFaction{\PDFobjref\pdflastobj}%
- \else
- % leave \lastPDFaction untouched
- \fi
- \else
- \xdef\lastPDFaction{<<\lastPDFcontent>>}%
- \fi
- \pdfannot
- width #1 height #2 depth \zeropoint
- {/Subtype /Link
- /Border [0 0 0]
- \ifhighlighthyperlinks \else /H /N \fi
- /A \lastPDFaction}%
- \fi}
-
-\def\insertpdfannotation#1#2#3%
- {\pdfannot width #1 height #2 depth \zeropoint{#3}}
-
-%D \macros
-%D {doPDFbookmark}
-%D
-%D Well, isn't the next one ugly? Thanks to the \PDF\
-%D standard.
-
-\def\doPDFbookmark#1#2#3#4#5% to be renamed
- {\doPDFgetpagereference{#4}\PDFobjectreference
- \pdfoutline
- user {<>}%
- \ifcase#2 \else count \ifcase#5-\fi#2 \fi
- {#3}}
-
-%D For special (\METAPOST) effects, we need to build
-%D resource dictionaries. Here is the framework.
-
-\let\docuPDFextgstates \empty
-\let\docuPDFcolorspaces\empty
-\let\docuPDFshades \empty
-
-\def\checkPDFextgstates
- {\ifx\docuPDFextgstates\empty \else
- \ifnum\realpageno=\lastpage\relax
- \createpdfdictionaryobject{FDF}{docuextgstates}{\docuPDFextgstates}%
- \fi
- \doPDFgetobjectreference{FDF}{docuextgstates}\PDFobjectreference
- \appendtopdfpageresources{/ExtGState \PDFobjectreference}%
- \fi}
-
-\def\checkPDFcolorspaces
- {\ifx\docuPDFcolorspaces\empty \else
- \ifnum\realpageno=\lastpage\relax
- \createpdfdictionaryobject{FDF}{colorspaces}{\docuPDFcolorspaces}%
- \fi
- \doPDFgetobjectreference{FDF}{colorspaces}\PDFobjectreference
- \appendtopdfpageresources{/ColorSpace \PDFobjectreference}%
- \fi}
-
-\def\checkPDFshades
- {\ifx\docuPDFshades\empty \else
- \ifnum\realpageno=\lastpage\relax
- \createpdfdictionaryobject{FDF}{docushades}{\docuPDFshades}%
- \fi
- \doPDFgetobjectreference{FDF}{docushades}\PDFobjectreference
- \appendtopdfpageresources{/Shading \PDFobjectreference}%
- \fi}
-
-\def\appendtoPDFdocumentextgstates #1{\xdef\docuPDFextgstates {\docuPDFextgstates \space#1}}
-\def\appendtoPDFdocumentcolorspaces#1{\xdef\docuPDFcolorspaces{\docuPDFcolorspaces\space#1}}
-\def\appendtoPDFdocumentshades #1{\xdef\docuPDFshades {\docuPDFshades \space#1}}
-
-%D Page actions:
-
-\let\lastpdfopenaction \empty
-\let\lastpdfcloseaction\empty
-
-\def\dosetupopenaction {\appendtopdfcatalog{/OpenAction <<\lastPDFaction>>}}
-\def\dosetupcloseaction{\appendtopdfcatalog{/CloseAction <<\lastPDFaction>>}}
-
-\def\dosetupopenpageaction {\glet\lastpdfopenaction \lastPDFaction}
-\def\dosetupclosepageaction{\glet\lastpdfcloseaction\lastPDFaction}
-
-\def\checkPDFpageactions
- {\iflocation % important since direct
- \donefalse
- \ifx\lastpdfopenaction \empty\!!doneafalse\else\donetrue\!!doneatrue\fi
- \ifx\lastpdfcloseaction\empty\!!donebfalse\else\donetrue\!!donebtrue\fi
- \ifdone
- \appendtopdfpageattributes
- {/AA <<\if!!donea/O <<\lastpdfopenaction >> \fi
- \if!!doneb/C <<\lastpdfcloseaction>> \fi>>}%
- \fi
- \glet\lastpdfopenaction \empty
- \glet\lastpdfcloseaction\empty
- \fi}
-
-%D \macros
-%D {ifPDFstrokecolor}
-%D
-%D We can reduce the filesize a bit by setting the next switch
-%D to false. The amount of reduction depends on the use of
-%D color, but don't expect more than a few percent. Zip
-%D compression is already rather efficient in itself.
-
-\newif\ifPDFstrokecolor \PDFstrokecolortrue
-
-%D When submitting forms, we need to communicate the format.
-
-\chardef\submitoutputformat=0 % 0=unknown 1=HTML 2=FDF 3=XML
-
-\def\setsubmitoutputformat#1%
- {\doifinsetelse{#1}{FDF,fdf}
- {\chardef\submitoutputformat\plustwo}
- {\doifinsetelse{#1}{XML,xml}
- {\chardef\submitoutputformat\plusthree}
- {\chardef\submitoutputformat\plusone}}%
- \relax}
-
-%D Handy to have this available asap:
-
-\ifdefined\everyPDFxform \newtoks\everyPDFxform \fi
-\ifdefined\everyPDFximage \newtoks\everyPDFximage \fi
-
-% once we can be sure that the latest versions of pdftex are
-% available we can use:
-%
-% \pdfobj reserveobjnum \edef\one{\the\pdflastobj}
-% \pdfobj reserveobjnum \edef\two{\the\pdflastobj}
-%
-% \pdfobj useobjnum \one {x}
-% \pdfobj useobjnum \two {x}
-%
-% we then can rewrite part of spec-fdf because the other drivers
-% already support symbolic references
-
-%D \macros
-%D {jobsuffix}
-%D
-%D Being one of the first typographical systems able to support
-%D advances \PDF\ support, \TEX\ is also one of the first
-%D systems to produce high quality \PDF\ code directly. Thanks
-%D to Han The Thanh c.s. the \TEX\ community can leap forward
-%D once again.
-%D
-%D One important characteristic of \PDFTEX\ is that is can
-%D produce standard \DVI\ code as well as \PDF\ code. This
-%D enables us to use one format file to support both output
-%D formats.
-
-%D All modules in this group use specials to tell drivers what
-%D non||\TEX\ actions to take. Because from the \TEX\ point of
-%D view, there is no difference between \DVI\ and \PDF, we
-%D therefore only have to bend the \DVI\ driver support into
-%D \PDF\ support. Technically spoken, specials no longer serve
-%D a purpose, except from ending up as comment in the \PDF\
-%D file.
+%D We will minimize the number of calls to \PDF\ specific primitives
+%D and delegate all management and injection of code to the backend.
%D
-%D Before we continue we need to make sure if indeed those
-%D \PDFTEX\ primitives are permitted. If no primitives are
-%D available, we just stop reading any further.
+%D Here we initialize some internal quantities.
\pdfoutput = 1
\pdfhorigin = 1 true in
@@ -338,2889 +32,141 @@
\pdfminorversion = 5
%pdfuniqueresname = 1
-\def\PDFversion{1.\number\pdfminorversion}
-
-%D For some internal testing we need to know the output
-%D suffix.
+%D This one can be consulted by users although the suffix is also
+%D a system mode.
\setjobsuffix{pdf}
-%D \macros
-%D {dosetuppaper}
-%D
-%D If we don't set the paper size, \PDFTEX\ will certainly do
-%D it in a way we don't want, therefore we need:
-
-\def\dosetuppaper#1#2#3%
- {\global\pdfpagewidth #2\relax
- \global\pdfpageheight#3\relax}
-
-%D \macros
-%D {doloadmapfile,doloadmapline,doresetmapfilelist}
-
-\def\doresetmapfilelist
- {\global\let\doresetmapfilelist\relax
- \pdfmapfile{original-empty.map}}
-
-\def\doloadmapfile #1#2{\pdfmapfile{#1#2}}
-\def\doloadmapline #1#2{\pdfmapline{#1#2}}
-
-%D nasty but needed
-
-\appendtoksonce \loadallfontmapfiles \to \everyPDFximage
-\appendtoksonce \loadallfontmapfiles \to \everyPDFxform
-
-%D left overs:
-
- \let\currentmovie\s!unknown
-
- \def\doPDFinsertmov
- {\bgroup
- \xdef\currentmovie{\@@DriverImageLabel}%
- \PointsToBigPoints\@@DriverImageWidth \width
- \PointsToBigPoints\@@DriverImageHeight\height
- \let\pdf@@options\empty
- \let\pdf@@actions\empty
- \donefalse
- \expanded{\processallactionsinset[\@@DriverImageOptions]}
- [\v!controls=>\donetrue,
- \v!repeat=>\edef\pdf@@actions{\pdf@@actions /Mode /Repeat },
- \v!preview=>\edef\pdf@@options{\pdf@@options /Poster true }]%
- \edef\pdf@@actions{\pdf@@actions /ShowControls \ifdone true\else false\fi}%
- \insertpdfannotation\@@DriverImageWidth\@@DriverImageHeight
- {/Subtype /Movie
- /Border [0 0 0]
- /T (movie \currentmovie)
- /Movie << /F (\@@DriverImageFile) /Aspect [\width\space\height] \pdf@@options >>
- /A << \pdf@@actions >>}%
- \egroup}
-
-%D \macros
-%D {doinsertsoundtrack}
-%D
-%D We use numbers instead of labels to keep track of sounds.
-
-\let\currentsound\s!unknown
-
-\def\doinsertsoundtrack#1#2#3%
- {\bgroup
- \xdef\currentsound{#2}%
- \let\pdf@@actions\empty
- \@EA\processallactionsinset\@EA
- [#3]
- [\v!repeat=>\edef\pdf@@actions{\pdf@@actions /Mode /Repeat }]%
- \collectdriverresource
- %\flushatshipout % since it can be buried in a chained box
- {\insertpdfannotation{0pt}{0pt}
- {/Subtype /Movie
- /Border [0 0 0]
- /T (sound \currentsound)
- /Movie <>%
- \ifx\pdf@@actions\empty\else/A << \pdf@@actions >>\fi}}%
- \egroup}
-
-%D \macros
-%D {doPDFattachfile}
-
-\def\doPDFfilestreamobject#1#2#3#4%
- {}
-
-\def\doPDFfilestreamidentifier#1%
- {0}
-
-\def\doPDFgetfilestreamreference#1#2%
- {0 0 R}
-
-\def\doattachfile#1#2#3#4#5#6#7#8%
- {\bgroup % title width height color symbol file
- \edefconvertedargument\PDFfile{#8}%
- % beware: the symbol may (indirectly) use the file
- % reference when typesetting the object number;
- \presetPDFsymbolappearance{#5}{#6}{#2}{#3}{#4}% sets width/height
- \startPDFsymbolappearance
- \doPDFembedfile\PDFfile{#7}{#8}%
- \doPDFgetembeddedfilereference\PDFfile\PDFobjectreference
- \setFDFlayer\@@DriverAttachmentLayer
- \insertpdfannotation{\width}{\totalheight}
- {/Subtype /FileAttachment
- /FS \PDFobjectreference\space
- /Contents (#1)
- \PDFsymbol
- \FDFlayer
- \PDFattributes}%
- \stopPDFsymbolappearance
- \egroup}
-
-% semi-public
-
-\def\doPDFembedfile#1#2#3% symbolic name | filename | user name
- {\edefconvertedargument\PDFfile{#1}%
- \doifnotflagged{a:\PDFfile}%
- {\doPDFfilestreamobject{PDFEF}{\PDFfile}{#2}{#3}%
- \doglobal\setflag{a:\PDFfile}}}
-
-\def\doPDFgetembeddedfilereference#1#2%
- {\edefconvertedargument\PDFfile{#1}%
- \doPDFgetobjectreference{PDFEF}\PDFfile#2}
-
-\def\doPDFgetembeddedfilestreamreference#1#2%
- {\edefconvertedargument\PDFfile{#1}%
- \doPDFgetfilestreamreference\PDFfile#2} % == \doPDFgetobjectreference{PDFFS}\PDFfile#2
-
-% requested by Jens-Uwe Morawski: permits usage of pdftosrc
-% in viewers that don't support attachments:
-%
-% \definesymbol
-% [ObjectNumber]
-% % [object number {\PDFattachmentnumber[xx]}] % named
-% [object number \PDFattachmentnumber] % current
-%
-% \useattachment[test][xx][test.tex]
-% \setupattachments[symbol=ObjectNumber]
-% \attachment[test]
-
-\def\PDFattachmentnumber
- {\dosingleargument\doPDFattachmentnumber}
+%D For the moment we keep these.
-\def\doPDFattachmentnumber[#1]%
- {\iffirstargument
- \doPDFfilestreamidentifier{#1}%
- \else
- \doPDFfilestreamidentifier\PDFfile
- \fi}
+\newtoks \pdfbackendeveryximage
+\newtoks \pdfbackendeveryxform
-%D \macros
-%D {...}
-%D
-%D Rather preliminary. We have to wait till the complete specs
-%D show up. As usual, we cannot really check it (Acrobat 6.0
-%D has a bug that inhibits us to make a test file). Half a day
-%D of testing made clear that trying to control the plugin fails
-%D in most cases (we need plugin specs -). We also miss a feature
-%D to let acrobat wait with proceeding (action processing) till
-%D the media clip is ready.
-
-% aiff audio/aiff
-% au audio/basic
-% avi video/avi
-% mid audio/midi
-% mov video/quicktime
-% mp3 audio/x-mp3 (mpeg)
-% mp4 audio/mp4
-% mp4 video/mp4
-% mpeg video/mpeg
-% smil application/smil
-% swf application/x-shockwave-flash
-
-% beware, this is preliminary code, should be improved
-
-\def\PDFrenderingspecs#1{\executeifdefined{PDFMR:#1}\empty}
-
-\def\PDFexecutestartrendering {/Rendition /OP 0 \PDFrenderingspecs\argumentA}
-\def\PDFexecutestoprendering {/Rendition /OP 1 \PDFrenderingspecs\argumentA}
-\def\PDFexecutepauserendering {/Rendition /OP 2 \PDFrenderingspecs\argumentA}
-\def\PDFexecuteresumerendering {/Rendition /OP 3 \PDFrenderingspecs\argumentA}
-
-% todo : sub files
-%
-% \doPDFembedfile{pier-39.png}{pier-39.png}{pier-39.png}%
-% \doPDFgetembeddedfilestreamreference{pier-39.png}\xPDFobjectreference
-% \edef\xxxx{/RF [(pier-39.png) \xPDFobjectreference]}%
-
-% todo: alternative renderings
-%
-% object_1 -> <> >>
-% object_2 -> <> >>
-% rendering -> <>
+%D These are the only official methods to add stuff to the resources.
-\def\doinsertrendering#1#2#3#4% tag mime file options
- {\ifundefined{PDFMR:#1}%
- \doifinstringelse{://}{#3}\donetrue\donefalse % evt url as keyword
- \createpdfdictionaryobject{PDFMF}{#1}
- {/Type /Rendition
- /S /MR
- % does not work: /SP << /Type /MediaScreenParam /BE << /B [1 0 0] /O 0.5 >> >>
- /C << /Type /MediaClip
- /S /MCD
- /N (#1)
- /Alt [() (file not found)] % language id + message
- /D << /Type /Filespec
- /F (#3)
- \ifdone/FS /URL\fi >>
- /CT (#2) >>}%
- % common code
- \doifobjectreferencefoundelse{PDFMS}{#1}
- {\doPDFgetobjectreference{PDFMS}{#1}\PDFobjectreferenceB}
- {\doPDFgetobjectreference{PDFMU}{#1}\PDFobjectreferenceB}%
- \doPDFgetobjectreference{PDFMF}{#1}\PDFobjectreferenceA
- \setxvalue{PDFMR:#1}% needed /AA actions in /Screen
- {/R \PDFobjectreferenceA
- /AN \PDFobjectreferenceB}%
- \doifobjectreferencefoundelse{PDFMS}{#1}\donothing
- {\dodoinsertrenderingwindow{PDFMU}{#1}\zeropoint\zeropoint{#4}}%
- \fi}
+\def\pdfbackendsetcatalog #1#2{\ctxlua{lpdf.addtocatalog ("#1",\!!bs#2\!!es)}} \newtoks\pdfcatalog
+\def\pdfbackendsetinfo #1#2{\ctxlua{lpdf.addtoinfo ("#1",\!!bs#2\!!es)}} \newtoks\pdfinfo
+\def\pdfbackendsetname #1#2{\ctxlua{lpdf.addtonames ("#1",\!!bs#2\!!es)}} \newtoks\pdfnames
-\def\doinsertrenderingobject#1#2#3#4% tag class objectname options
- {\ifundefined{PDFMR:#1}%
- \doPDFgetobjectreference{#2}{#3}\PDFobjectreference
- \createpdfdictionaryobject{PDFMF}{#1}
- {/Type /Rendition
- /S /MR
- /C << /Type /MediaClip
- /S /MCD
- /N (#1)
- /D \PDFobjectreference>>}%
- % common code
- \doifobjectreferencefoundelse{PDFMS}{#1}
- {\doPDFgetobjectreference{PDFMS}{#1}\PDFobjectreferenceB}
- {\doPDFgetobjectreference{PDFMU}{#1}\PDFobjectreferenceB}%
- \doPDFgetobjectreference{PDFMF}{#1}\PDFobjectreferenceA
- \setxvalue{PDFMR:#1}% needed /AA actions in /Screen
- {/R \PDFobjectreferenceA
- /AN \PDFobjectreferenceB}%
- \doifobjectreferencefoundelse{PDFMS}{#1}\donothing
- {\dodoinsertrenderingwindow{PDFMU}{#1}\zeropoint\zeropoint{#4}}%
- \fi}
+\def\pdfbackendsetpageattribute #1#2{\ctxlua{lpdf.addtopageattributes ("#1",\!!bs#2\!!es)}} \newtoks\pdfpageresources
+\def\pdfbackendsetpagesattribute#1#2{\ctxlua{lpdf.addtopagesattributes("#1",\!!bs#2\!!es)}} \newtoks\pdfpageattr
+\def\pdfbackendsetpageresource #1#2{\ctxlua{lpdf.addtopageresources ("#1",\!!bs#2\!!es)}} \newtoks\pdfpagesattr
-\def\doinsertrenderingwindow
- {\dodoinsertrenderingwindow{PDFMS}}
+\def\pdfbackendsetextgstate #1#2{\ctxlua{lpdf.adddocumentextgstate ("#1",lpdf.verbose(\!!bs#2\!!es))}}
+\def\pdfbackendsetcolorspace #1#2{\ctxlua{lpdf.adddocumentcolorspace("#1",lpdf.verbose(\!!bs#2\!!es))}}
+\def\pdfbackendsetpattern #1#2{\ctxlua{lpdf.adddocumentpattern ("#1",lpdf.verbose(\!!bs#2\!!es))}}
+\def\pdfbackendsetshade #1#2{\ctxlua{lpdf.adddocumentshade ("#1",lpdf.verbose(\!!bs#2\!!es))}}
-\def\dodoinsertrenderingwindow#1#2#3#4#5%
- {\vbox to #4 \bgroup
- \checkPDFscreenactions{#2}{#5}%
- \doPDFgetobjectpagereference{PDFMF}{#2}\PDFobjectreferenceA
- \doPDFgetobjectreference {PDFMF}{#2}\PDFobjectreferenceB
- \vss
- \hbox to #3 \bgroup
- \createpdfannotationobject{#1}{#2}{#3}{#4}
- {/Subtype /Screen
- /P \PDFobjectreferenceA
- /A \PDFobjectreferenceB
- \PDFattributes
- /Border [0 0 0]}%
- \hss
- \egroup
- \egroup}
-
-\global\let\PDFrenderingopenpageaction \empty
-\global\let\PDFrenderingclosepageaction\empty
-
-\def\checkPDFscreenactions#1#2%
- {\let\PDFattributes\empty
- \iflocation % important since direct -)
- % the action can either (already) be set by the window handler
- % or (normally when no window [i.e a zero dimensions one] is present) by keyword
- \doifinset\v!auto{#2}
- {% brrr, here instead of in navigation module, must move and become special
- % now two sided dependency
- \let\checkrendering\gobbleoneargument
- \ifx\PDFrenderingopenpageaction \empty
- \handlereferenceactions{\v!StartRendering{#1}}\dosetuprenderingopenpageaction
- \fi
- \ifx\PDFrenderingclosepageaction\empty
- \handlereferenceactions{\v!StopRendering {#1}}\dosetuprenderingclosepageaction
- \fi
- }%
- \donefalse
- \ifx\PDFrenderingopenpageaction \empty\!!doneafalse\else\donetrue\!!doneatrue\fi
- \ifx\PDFrenderingclosepageaction\empty\!!donebfalse\else\donetrue\!!donebtrue\fi
- \ifdone
- \edef\PDFattributes
- {/AA <<\if!!donea/PO <<\PDFrenderingopenpageaction >> \fi
- \if!!doneb/PC <<\PDFrenderingclosepageaction>> \fi>>}%
- \fi
- \global\let\PDFrenderingopenpageaction \empty
- \global\let\PDFrenderingclosepageaction\empty
- \fi}
-
-\def\dosetuprenderingopenpageaction {\global\let\PDFrenderingopenpageaction \lastPDFaction}
-\def\dosetuprenderingclosepageaction{\global\let\PDFrenderingclosepageaction\lastPDFaction}
+\def\pdfbackendcurrentresources {\ctxlua{lpdf.collectedresources()}}
-%D For the moment we don't test for alternatives that
-%D themselves have alternatives, especially cylcic
-%D dependencies.
+%D An example of usage is:
-% \def\pdfimmediateximage{\immediate\pdfximage}
-%
-% \def\checkpdfimageattributes
-% {\ifx\PDFfigurereference\empty
-% \global\let\pdfimageattributes\empty
-% \else
-% \immediate\pdfobj
-% {[ << /Image \PDFobjref\PDFfigurereference
-% /DefaultForPrinting true >> ]}%
-% \xdef\pdfimageattributes
-% {attr {/Alternates \PDFobjref\pdflastobj}}%
-% \fi}
-%
-% \global\let\PDFimagecolorreference\empty
-%
-% \def\checkpdfimagecolorspecs
-% {\ifx\pdflastximagecolordepth \undefined
-% \global\let\pdfimagecolorspecs\empty
-% \else\ifx\PDFimagecolorreference\empty
-% \global\let\pdfimagecolorspecs\empty
-% \else
-% \xdef\pdfimagecolorspecs{colorspace \PDFimagecolorreference\space}%
-% \fi\fi
-% \global\let\PDFimagecolorreference\empty}
+\appendtoks % will change ...
+ \pdfbackendsetinfo{ConTeXt.Version}{(\contextversion)}%
+ \pdfbackendsetinfo{ConTeXt.Time} {(\number\normalyear.\twodigits\normalmonth.\twodigits\normalday\space \twodigits\currenthour:\twodigits\currentminute)}%
+ \pdfbackendsetinfo{ConTeXt.Jobname}{(\jobname)}%
+ \pdfbackendsetinfo{ConTeXt.Url} {(www.pragma-ade.com)}%
+\to \everylastbackendshipout
-%D \macros
-%D {doregisterfigure}
-%D
-%D Here is the fuzzy, very special dependant figure
-%D registration special. We need to refer to the innermost
-%D object (ximage).
+%D Unfortunately this is still needed (also for \METAPOST\ to
+%D \PDF\ converter):
- \def\doregisterfigure#1#2%
- {\doifundefined{IM::#1::#2}
- {\setxvalue{IM::#1::#2}{\the\pdflastximage}}%
- \xdef\PDFfigurereference{\getvalue{IM::#1::#2}}}
+\def\doresetmapfilelist
+ {\global\let\doresetmapfilelist\relax
+ \pdfmapfile{original-empty.map}}
-%D \macros
-%D {doovalbox}
-%D
-%D Drawing frames with round corners is inherited from the
-%D main module.
-%D
-%D For drawing ovals we use quite raw \PDF\ code. The next
-%D implementation does not differ that much from the one
-%D implemented in the \POSTSCRIPT\ driver.
+\def\doloadmapfile #1#2{\pdfmapfile{#1#2}}
+\def\doloadmapline #1#2{\pdfmapline{#1#2}}
-\def\doPDFovalcalc#1#2#3%
- {\PointsToBigPoints{\dimexpr#1+#2\relax}#3}
+\appendtoksonce \loadallfontmapfiles \to \pdfbackendeveryxform
+\appendtoksonce \loadallfontmapfiles \to \pdfbackendeveryximage
-\def\doovalbox#1#2#3#4#5#6#7#8% todo: \scratchdimen/\scatchbox
- {\forcecolorhack
- \bgroup
- \dimen0=#4\divide\dimen0 \plustwo
- \doPDFovalcalc{0pt}{+\dimen0}\xmin
- \doPDFovalcalc{#1}{-\dimen0}\xmax
- \doPDFovalcalc{#2}{-\dimen0}\ymax
- \doPDFovalcalc{-#3}{+\dimen0}\ymin
- \advance\dimen0 by #5%
- \doPDFovalcalc{0pt}{+\dimen0}\xxmin
- \doPDFovalcalc{#1}{-\dimen0}\xxmax
- \doPDFovalcalc{#2}{-\dimen0}\yymax
- \doPDFovalcalc{-#3}{+\dimen0}\yymin
- \doPDFovalcalc{#4}{\zeropoint}\stroke
- \doPDFovalcalc{#5}{\zeropoint}\radius
- \edef\dostroke{#6}%
- \edef\dofill{#7}%
- \edef\mode{\number#8 \space}%
- % no \ifcase, else \relax in pdfcode
- \setbox\scratchbox\hbox
- {\ifnum\dostroke\dofill>\zerocount
- \ifPDFstrokecolor\else\ifnum\dostroke=\plusone
- \writestatus\m!colors{pdf stroke color will fail}\wait
- \fi\fi
- \PDFcode
- {q
- \stroke\space w
- \ifcase\mode
- \xxmin\space \ymin \space m
- \xxmax\space \ymin \space l
- \xmax \space \ymin \space \xmax \space \yymin\space y
- \xmax \space \yymax\space l
- \xmax \space \ymax \space \xxmax\space \ymax \space y
- \xxmin\space \ymax \space l
- \xmin \space \ymax \space \xmin \space \yymax\space y
- \xmin \space \yymin\space l
- \xmin \space \ymin \space \xxmin\space \ymin \space y
- h
- \or % 1
- \xxmin\space \ymin \space m
- \xxmax\space \ymin \space l
- \xmax \space \ymin \space \xmax \space \yymin\space y
- \xmax \space \ymax \space l
- \xmin \space \ymax \space l
- \xmin \space \yymin\space l
- \xmin \space \ymin \space \xxmin\space \ymin \space y
- h
- \or % 2
- \xxmin\space \ymin \space m
- \xmax \space \ymin \space l
- \xmax \space \ymax \space l
- \xxmin\space \ymax \space l
- \xmin \space \ymax \space \xmin \space \yymax\space y
- \xmin \space \yymin\space l
- \xmin \space \ymin \space \xxmin\space \ymin \space y
- h
- \or % 3
- \xmin \space \ymin \space m
- \xmax \space \ymin \space l
- \xmax \space \yymax\space l
- \xmax \space \ymax \space \xxmax\space \ymax \space y
- \xxmin\space \ymax \space l
- \xmin \space \ymax \space \xmin \space \yymax\space y
- \xmin \space \ymin \space l
- h
- \or % 4
- \xmin \space \ymin \space m
- \xxmax\space \ymin \space l
- \xmax \space \ymin \space \xmax \space \yymin\space y
- \xmax \space \yymax\space l
- \xmax \space \ymax \space \xxmax\space \ymax \space y
- \xmin \space \ymax \space l
- \xmin \space \ymin\space l
- h
- \or % 5
- \xmin \space \ymin \space m
- \xmax \space \ymin \space l
- \xmax \space \yymax\space l
- \xmax \space \ymax \space \xxmax\space \ymax \space y
- \xmin \space \ymax \space l
- \xmin \space \ymin \space l
- h
- \or % 6
- \xmin \space \ymin \space m
- \xxmax\space \ymin \space l
- \xmax \space \ymin \space \xmax \space \yymin\space y
- \xmax \space \ymax \space l
- \xmin \space \ymax \space l
- \xmin \space \ymin \space l
- h
- \or
- \xxmin\space \ymin \space m
- \xmax \space \ymin \space l
- \xmax \space \ymax \space l
- \xmin \space \ymax \space l
- \xmin \space \yymin\space l
- \xmin \space \ymin \space \xxmin\space \ymin \space y
- h
- \or
- \xmin \space \ymin \space m
- \xmax \space \ymin \space l
- \xmax \space \ymax \space l
- \xxmin\space \ymax \space l
- \xmin \space \ymax \space \xmin \space \yymax\space y
- \xmin \space \ymin \space l
- h
- \or % 9 top open
- \xmin \space \ymax \space m
- \xmin \space \yymin\space l
- \xmin \space \ymin \space \xxmin\space \ymin \space y
- \xxmax\space \ymin \space l
- \xmax \space \ymin \space \xmax \space \yymin\space y
- \xmax \space \ymax \space l
- \or % 10 right open
- \xmax \space \ymax \space m
- \xxmin\space \ymax \space l
- \xmin \space \ymax \space \xmin \space \yymax\space y
- \xmin \space \yymin\space l
- \xmin \space \ymin \space \xxmin\space \ymin \space y
- \xmax\space \ymin \space l
- \or % 11 bottom open
- \xmax \space \ymin \space m
- \xmax \space \yymax\space l
- \xmax \space \ymax \space \xxmax \space \ymax\space y
- \xxmin\space \ymax \space l
- \xmin \space \ymax \space \xmin \space \yymax\space y
- \xmin \space \ymin \space l
- \or % 12 left open
- \xmin \space \ymax \space m
- \xxmax\space \ymax \space l
- \xmax \space \ymax \space \xmax \space \yymax\space y
- \xmax \space \yymin\space l
- \xmax \space \ymin \space \xxmax\space \ymin \space y
- \xmin \space \ymin \space l
- \or % 13
- \xmin \space \ymax \space m
- \xxmax\space \ymax \space l
- \xmax \space \ymax \space \xmax \space \yymax\space y
- \xmax\space \ymin \space l
- \or % 14
- \xmax \space \ymax \space m
- \xmax \space \yymin\space l
- \xmax \space \ymin \space \xxmax\space \ymin \space y
- \xmin \space \ymin \space l
- \or % 15
- \xmax \space \ymin \space m
- \xxmin\space \ymin \space l
- \xmin \space \ymin \space \xmin \space \yymin\space y
- \xmin \space \ymax \space l
- \or % 16
- \xmin \space \ymin \space m
- \xmin \space \yymax\space l
- \xmin \space \ymax \space \xxmin\space \ymax \space y
- \xmax \space \ymax \space l
- \or % 17
- \xxmax\space \ymax \space m
- \xmax \space \ymax \space \xmax \space \yymax\space y
- \or % 18
- \xmax \space \yymin\space m
- \xmax \space \ymin \space \xxmax\space \ymin \space y
- \or % 19
- \xxmin\space \ymin \space m
- \xmin \space \ymin \space \xmin \space \yymin\space y
- \or % 20
- \xmin \space \yymax\space m
- \xmin \space \ymax \space \xxmin\space \ymax \space y
- \or % 21
- \xxmax\space \ymax \space m
- \xmax \space \ymax \space \xmax \space \yymax\space y
- \xmin \space \yymax\space m
- \xmin \space \ymax \space \xxmin\space \ymax \space y
- \or % 22
- \xxmax\space \ymax \space m
- \xmax \space \ymax \space \xmax \space \yymax\space y
- \xmax \space \yymin\space m
- \xmax \space \ymin \space \xxmax\space \ymin \space y
- \or % 23
- \xmax \space \yymin\space m
- \xmax \space \ymin \space \xxmax\space \ymin \space y
- \xxmin\space \ymin \space m
- \xmin \space \ymin \space \xmin \space \yymin\space y
- \or % 24
- \xxmin\space \ymin \space m
- \xmin \space \ymin \space \xmin \space \yymin\space y
- \xmin \space \yymax\space m
- \xmin \space \ymax \space \xxmin\space \ymax \space y
- \or % 25
- \xxmax\space \ymax \space m
- \xmax \space \ymax \space \xmax \space \yymax\space y
- \xmax \space \yymin\space m
- \xmax \space \ymin \space \xxmax\space \ymin \space y
- \xxmin\space \ymin \space m
- \xmin \space \ymin \space \xmin \space \yymin\space y
- \xmin \space \yymax\space m
- \xmin \space \ymax \space \xxmin\space \ymax \space y
- \or % 26
- \xmax \space \yymin\space m
- \xmax \space \ymin \space \xxmax\space \ymin \space y
- \xmin \space \yymax\space m
- \xmin \space \ymax \space \xxmin\space \ymax \space y
- \or % 27
- \xxmax\space \ymax \space m
- \xmax \space \ymax \space \xmax \space \yymax\space y
- \xxmin\space \ymin \space m
- \xmin \space \ymin \space \xmin \space \yymin\space y
- \or % 28
- \fi
- \ifnum\mode>8
- S
- \else
- \ifnum\dostroke=\plusone S \fi
- \ifnum\dofill =\plusone f \fi
- \fi
- Q}%
- \fi}%
- \wd\scratchbox#1\ht\scratchbox#2\dp\scratchbox#3\box\scratchbox
- \egroup}
+%D Transformations. Some day we will use primitives (once they're fixed).
-%D \macros
-%D {dostartgraymode,dostopgraymode,
-%D dostartrgbcolormode,dostartcmykcolormode,dostartgraycolormode,
-%D dostopcolormode,
-%D dostartrotation,dostoprotation,
-%D dostartscaling,dostopscaling,
-%D dostartmirroring,dostopmirroring,
-%D dostartnegative,dostopnegative,
-%D dostartoverprint,dostopoverprint}
+\def\dostartgraphicgroup{\pdfliteral{q}}
+\def\dostopgraphicgroup {\pdfliteral{Q}}
\def\dostartrotation#1% grouped
- {\setcalculatedcos\cos{#1}%
- \setcalculatedsin\sin{#1}%
- \forcecolorhack
- \PDFcode{q \cos\space\sin\space\negated\sin\space\cos\space0 0 cm}}
+ {\forcecolorhack
+ \pdfliteral{q \ctxlua{lpdf.rotationcm(#1)}}}
\def\dostoprotation
- {\PDFcode{Q}}
-
-\def\@@PDFzeroscale{.0001}
+ {\pdfliteral{Q}}
\def\dostartscaling#1#2% the test is needed because acrobat is bugged!
{\forcecolorhack
- \PDFcode{q \ifdim#1\points=\zeropoint\@@PDFzeroscale\else#1\fi\space 0 0
- \ifdim#2\points=\zeropoint\@@PDFzeroscale\else#2\fi\space 0 0 cm}}
+ \pdfliteral{q \ifdim#1\points=\zeropoint.0001\else#1\fi\space 0 0
+ \ifdim#2\points=\zeropoint.0001\else#2\fi\space 0 0 cm}}
\def\dostopscaling
- {\PDFcode{Q}}
-
-\def\dostartmirroring{\PDFcode{-1 0 0 1 0 0 cm}}
-\def\dostopmirroring {\PDFcode{-1 0 0 1 0 0 cm}}
-
-\def\dostartnegative {\ifdefined\initializePDFnegative \initializePDFnegative \PDFcode{/GSnegative gs}\fi}
-\def\dostopnegative {\ifdefined\initializePDFnegative \initializePDFnegative \PDFcode{/GSpositive gs}\fi}
-\def\dostartoverprint{\ifdefined\initializePDFoverprint\initializePDFoverprint\PDFcode{/GSoverprint gs}\fi}
-\def\dostopoverprint {\ifdefined\initializePDFoverprint\initializePDFoverprint\PDFcode{/GSknockout gs}\fi} % wrong
-
-%D \macros
-%D {doPDFstartgraymode,doPDFstopgraymode,
-%D doPDFstartrgbcolormode,doPDFstartcmykcolormode,doPDFstartgraycolormode,
-%D doPDFstopcolormode}
-%D
-%D In \PDF\ there are two color states, one for strokes and one
-%D for fills. This means that we have to set the color in a
-%D rather redundant looking way. Unfortunately this makes the
-%D \PDF\ file much larger than needed. We can save few bytes
-%D by not setting the stroke color. Due to zip compression we
-%D only save a few percent.
-
-\def\dostartgraymode #1{\PDFcode{#1 g\ifPDFstrokecolor\space#1 G\fi}}
-\def\dostopgraymode {\PDFcode{0 g\ifPDFstrokecolor\space 0 G\fi}}
-\def\dostartrgbcolormode #1#2#3{\PDFcode{#1 #2 #3 rg\ifPDFstrokecolor\space#1 #2 #3 RG\fi}}
-\def\dostartcmykcolormode#1#2#3#4{\PDFcode{#1 #2 #3 #4 k\ifPDFstrokecolor\space#1 #2 #3 #4 K\fi}}
-\def\dostartgraycolormode #1{\PDFcode{#1 g\ifPDFstrokecolor\space#1 G\fi}}
-\def\dostopcolormode {\PDFcode{0 g\ifPDFstrokecolor\space0 G\fi}}
-
-\def\dostartspotcolormode#1#2% redefining spotcolors is not possible anyway
- {\ifundefined{pdf:scs:#2}%
- \bgroup
- \getcommacommandsize[#2]%
- \ifcase\commalistsize\or
- \setxvalue{pdf:scs:#2}{#2 SCN #2 scn}% \setxvalue{pdf:scs:#2}{#2 SC #2 sc}%
- \else
- \let\PDFspotcolorspecs\empty
- \def\dospotcolorcommand##1{\edef\PDFspotcolorspecs{\PDFspotcolorspecs##1\space}}%
- \processcommacommand[#2]\dospotcolorcommand
- \setxvalue{pdf:scs:#2}{\PDFspotcolorspecs SCN \PDFspotcolorspecs scn}%
- \fi
- \egroup
- \fi
- \PDFcode{/#1 cs /#1 CS \PDFgetspotcolorspec{#2}}}
-
-\def\PDFgetspotcolorspec#1%
- {\executeifdefined{pdf:scs:#1}\empty} % better no default than one with too less args
-
-\def\dostartnonecolormode
- {\PDFcode{/None CS 1 SC /None cs 1 sc}}
-
-%D We need to register the spot colors and their fallbacks.
-
-% we cannot use /DeviceN since GS <=7.21 breaks on it
-% and Jaws does not handle it at all {[/DeviceN [/All|/None]
-% /Device#2 \PDFobjref\pdflastobj]} so we use separation
-% colors that work and print ok
-
-\def\doPDFregistersomespotcolor#1#2#3#4% implemented in the driver
- {\writestatus\m!systems{missing spot color definition}\wait}
-
-\def\doregisternonecolor % internal command
- {\doregistergrayspotcolor{None}{1}%
- \globallet\doregisternonecolor\relax}
-
-\def\dodoPDFregisterrgbspotcolor#1#2#3#4#5#6#7% name noffractions names p's r g b
- {\doPDFregistersomespotcolor{#1}{#2}{#3}{#4}{RGB}{0.0 1.0 0.0 1.0 0.0 1.0}%
- {\ifcase#2\or dup #5 mul exch dup #6 mul exch #7 mul\else#5 #6 #7\fi}}
-
-\def\dodoPDFregistercmykspotcolor#1#2#3#4#5#6#7#8% name noffractions names p's c m y k
- {\doPDFregistersomespotcolor{#1}{#2}{#3}{#4}{CMYK}{0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0}%
- {\ifcase#2\or dup #5 mul exch dup #6 mul exch dup #7 mul exch #8 mul\else #5 #6 #7 #8\fi}}
-
-\def\dodoPDFregistergrayspotcolor#1#2#3#4#5% name noffractions names p's s
- {\doPDFregistersomespotcolor{#1}{#2}{#3}{#4}{Gray}{0.0 1.0}%
- {\ifcase#2\or #5 mul\else #5\fi}}
-
-\def\doregisterrgbspotcolor#1#2#3#4#5#6#7% name noffractions names p's r g b
- {\ifRGBsupported
- \dodoPDFregisterrgbspotcolor{#1}{#2}{#3}{#4}{#5}{#6}{#7}%
- \else
- \edef\@@cl@@r{#5}\edef\@@cl@@g{#6}\edef\@@cl@@b{#7}%
- \ifCMYKsupported
- \convertRGBtoCMYK\@@cl@@r\@@cl@@g\@@cl@@b
- \dodoPDFregistercmykspotcolor{#1}{#2}{#3}{#4}\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k
- \else
- \convertRGBtoGRAY\@@cl@@r\@@cl@@g\@@cl@@b
- \dodoPDFregistergrayspotcolor{#1}{#2}{#3}{#4}\@@cl@@s
- \fi
- \fi}
-
-\def\doregistercmykspotcolor#1#2#3#4#5#6#7#8% name noffractions names p's c m y k
- {\ifCMYKsupported
- \dodoPDFregistercmykspotcolor{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
- \else
- \edef\@@cl@@c{#5}\edef\@@cl@@m{#6}\edef\@@cl@@y{#7}\edef\@@cl@@k{#8}%
- \ifRGBsupported
- \convertCMYKtoRGB\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k
- \dodoPDFregisterrgbspotcolor{#1}{#2}{#3}{#4}\@@cl@@r\@@cl@@g\@@cl@@b
- \else
- \convertCMYKtoGRAY\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k
- \dodoPDFregistergrayspotcolor{#1}{#2}{#3}{#4}\@@cl@@s
- \fi
- \fi}
-
-\def\doregistergrayspotcolor{\dodoPDFregistergrayspotcolor}
-
-%D New and very experimental.
-
-\def\doregistercmykindexcolor#1#2#3#4#5#6#7#8% name noffractions names p's c m y k
- {\doPDFregistersomeindexcolor{#1}{#2}{#3}{#4}{CMYK}{0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0}%
- {dup #5 mul exch dup #6 mul exch dup #7 mul exch #8 mul}}
-
-\def\doregisterrgbindexcolor#1#2#3#4#5#6#7% name noffractions names p's r g b
- {\doPDFregistersomeindexcolor{#1}{#2}{#3}{#4}{RGB}{0.0 1.0 0.0 1.0 0.0 1.0}%
- {dup #5 mul exch dup #6 mul exch #7 mul}}
-
-\def\doregistergrayindexcolor#1#2#3#4#5% name noffractions names p's s
- {\doPDFregistersomeindexcolor{#1}{#2}{#3}{#4}{Gray}{0.0 1.0}%
- {pop}}
-
-\let\checkpredefinedcolor\predefineindexcolor % we need an index in order to negate bitmaps
-
-\def\doregisterfigurecolor#1% always an index color
- {\dogetobjectreference{PDFIX}{\internalspotcolorname{#1}}\PDFimagecolorreference}
-
-\def\doregisterspotcolorname#1#2% no need for escape in luatex
- {\bgroup
- \let\ascii\empty
- \def\docommand##1%
- {\edef\ascii{\ascii
- \ifx\nexthandledtoken\space
- \letterhash20%
- \else\ifx\nexthandledtoken\blankspace
- \letterhash20%
- \else
- ##1%
- \fi\fi}}%
- \expanded{\handletokens#2}\with\docommand
- \letgvalue{@@pdf@@scn@@#1}\ascii
- \egroup}
-
-\def\doPDFregistersomespotcolor#1#2#3#4#5#6#7% name fractions names p's space domain function
- {\bgroup
- \let\spotpops\empty
- \ifcase#2\or
- %def\PDFspotcolornames{/Separation /#1}%
- \edef\PDFspotcolornames{/Separation /\executeifdefined{@@pdf@@scn@@#1}{#1}}%
- \def\PDFspotcolordomain{0.0 1.0}%
- \else
- \dorecurse{#2}{\edef\spotpops{\spotpops pop }}%
- \let\PDFspotcolornames \empty
- \let\PDFspotcolordomain\empty
- \def\dospotcolorcommand##1%
- {\edef\PDFspotcolornames {\PDFspotcolornames/\executeifdefined{@@pdf@@scn@@##1}{##1}\space}%
- \edef\PDFspotcolordomain{\PDFspotcolordomain 0.0 1.0\space}}%
- \processcommacommand[#3]\dospotcolorcommand
- \edef\PDFspotcolornames{/DeviceN [\PDFspotcolornames]}%
- \fi
- \immediate \pdfobj stream attr
- {/FunctionType 4 /Domain [\PDFspotcolordomain] /Range [#6]}{{\spotpops#7}}%
- \immediate \pdfobj
- {[\PDFspotcolornames\space /Device#5 \PDFobjref\pdflastobj]}%
- \dosetobjectreference{PDFCS}{#1}{\the\pdflastobj}%
- \appendtoPDFdocumentcolorspaces{/#1 \PDFobjref\pdflastobj}%
- \egroup}
-
-%D New and very experimental.
-
-\def\doPDFregistersomeindexcolor#1#2#3#4#5#6#7% name fractions names p's space domain function
- {\bgroup
- \let\spotpops\empty
- \dorecurse{#2}{\edef\spotpops{\spotpops exch pop\space}}%
- \let\PDFspotcolornames \empty
- \let\PDFspotcolordomain\empty
- \def\docommand##1%
- {%\edef\PDFspotcolornames {\PDFspotcolornames/##1\space}%
- \edef\PDFspotcolornames{\PDFspotcolornames/\executeifdefined{@@pdf@@scn@@##1}{##1}\space}%
- \edef\PDFspotcolordomain{\PDFspotcolordomain 0.0 1.0\space}}%
- \processcommacommand[#3,None]\docommand
- \let\PDFcolorindexvector\empty
- \def\docommand##1%
- {\scratchdimen##1\points
- \scratchdimen\recurselevel\scratchdimen
- \scratchcounter\scratchdimen
- \divide\scratchcounter \maxcard
- \edef\PDFcolorindexvector{\PDFcolorindexvector\uchexnumbers\scratchcounter}}%
- %\dostepwiserecurse\zerocount{255}\plusone
- \dostepwiserecurse{255}\zerocount\minusone % we need to negate
- {\rawprocesscommacommand[#4,1]\docommand
- \xdef\PDFcolorindexvector{\PDFcolorindexvector\space}}%
- \immediate \pdfobj stream attr
- {/FunctionType 4 /Domain [\PDFspotcolordomain] /Range [#6]}{{\spotpops#7}}%
- \immediate \pdfobj
- {[/Indexed
- [/DeviceN [\PDFspotcolornames] /Device#5 \the\pdflastobj\space0 R] %
- 255 <\PDFcolorindexvector>]}%
- \dosetobjectreference{PDFIX}{#1}{\the\pdflastobj}%
- \appendtoPDFdocumentcolorspaces{/#1_INDEXED \the\pdflastobj\space0 R}%
- \egroup}
-
-%D \macros
-%D {dostarttransparency,dostoptransparency}
-%D
-%D For transparency, we need to implement a couple of
-%D auxiliary macros. If needed, we will generalize them later.
-
-\def\@@PDT{@PDT@}
-
-\ifx\PDFcurrenttransparency\undefined
- \newcount\PDFcurrenttransparency \PDFcurrenttransparency=0 % -1
-\fi
-
-\def\assignPDFtransparency#1#2%
- {\edef\PDFtransparencyidentifier{/Tr#1}%
- \edef\PDFtransparencyreference{\PDFobjref{#2}}}
-
-\def\presetPDFtransparency#1#2%
- {\initializePDFtransparency
- \executeifdefined{\@@PDT#1:#2}{\dopresetPDFtransparency{#1}{#2}}}
-
-\def\dopresetPDFtransparency#1#2%
- {\global\advance\PDFcurrenttransparency \plusone
- \immediate\pdfobj{\PDFtransparancydictionary{#1}{#2}{}}%
- \edef\PDFtransparencyidentifier{/Tr\the\PDFcurrenttransparency}%
- \edef\PDFtransparencyreference {\PDFobjref\pdflastobj}%
- \setxvalue{\@@PDT#1:#2}%
- {\noexpand\assignPDFtransparency{\the\PDFcurrenttransparency}{\the\pdflastobj}}%
- \appendtoPDFdocumentextgstates
- {\PDFtransparencyidentifier\space
- \PDFtransparencyreference\space}}
-
-\def\initializePDFtransparency
- {\immediate\pdfobj{\PDFtransparancydictionary{1}{1}{/AIS false}}%
- \xdef\PDFtransparencyresetidentifier{/Tr0}%
- \xdef\PDFtransparencyresetreference{\PDFobjref\pdflastobj}%
- \setxvalue{\@@PDT0:0}%
- {\noexpand\assignPDFtransparency{0}{\the\pdflastobj}}%
- \appendtoPDFdocumentextgstates
- {\PDFtransparencyresetidentifier\space
- \PDFtransparencyresetreference\space}%
- \global\let\initializePDFtransparency\relax}
-
-%D Transparency support:
-
-\def\PDFtransparancydictionary#1#2#3% type fraction extras
- {<>}
-
-\def\dodoPDFstarttransparency#1#2%
- {\presetPDFtransparency{#1}{#2}%
- \PDFcode{\PDFtransparencyidentifier\space gs }}
-
-\def\dodoPDFstoptransparency
- {\PDFcode{/Tr0 gs }}
-
-\def\dostarttransparency
- {\global\let\dostarttransparency\dodoPDFstarttransparency
- \global\let\dostoptransparency \dodoPDFstoptransparency
- \initializetransparency
- \dostarttransparency}
-
-% This is tricky: because a text stream is handled before
-% the page body is built, we can run into stops that will
-% match an outer start; however, the stop is needed in case
-% of a text color: [text color text] [other color text] on a
-% first page combined with color splitting will go wrong if
-% we stick to the relaxing method.
-
-% \def\dostoptransparency
-% {\initializetransparency
-% \dodoPDFstoptransparency}
-
-%D These use:
+ {\pdfliteral{Q}}
-\let\initializetransparency\relax
+\def\dostartmirroring{\pdfliteral{-1 0 0 1 0 0 cm}}
+\def\dostopmirroring {\pdfliteral{-1 0 0 1 0 0 cm}}
-\let\PDFtransparencyresetreference \empty
-\let\PDFtransparencyresetidentifier\empty
-
-\let\PDFtransparencyreference \empty
-\let\PDFtransparencyidentifier\empty
-
-%D New trickery:
-
-\def\dostartgraphicgroup{\PDFcode{q}}
-\def\dostopgraphicgroup {\PDFcode{Q}}
-
-%D \macros
-%D {dostartclipping,dostopclipping}
-%D
-%D Clipping in \PDFTEX\ is rather trivial. We can even hook
-%D in \METAPOST\ without problems.
-
-\def\dostartclipping#1#2#3%
+\def\dostartclipping#1#2#3% todo
{\PointsToBigPoints{#2}\width
\PointsToBigPoints{#3}\height
- \grabMPclippath{#1}{1}\width\height
- {0 0 m \width\space 0 l \width \height l 0 \height l}%
- \pdfliteral % PDFcode ?
- {q 0 w \MPclippath\space W n}}
+ \grabMPclippath{#1}{1}\width\height{0 0 m \width\space 0 l \width \height l 0 \height l}%
+ \pdfliteral{q 0 w \MPclippath\space W n}}
\def\dostopclipping
- {\pdfliteral{Q n}} % PDFcode
-
-%D \macros
-%D {dosetupinteraction}
-%D
-%D Nothing special is needed to enable \PDF\ commands and
-%D interaction. We stick with a message.
-
-\def\dosetupinteraction
- {\showmessage\m!interactions{21}{pdftex}}
-
-%D \macros
-%D {doresetgotowhereever,
-%D dostartthisisrealpage,dostartthisislocation,
-%D dostartgotorealpage,dostartgotolocation,dostartgotoJS}
-%D
-%D The interactions macros are the core of this module. We
-%D support both page destinations and named ones. We don't
-%D need the \type{\stop}||alternatives. We also don't need
-%D to set the special that sets the real page number.
-
-%D In the goto specials we took care of secondary references.
-%D Here we define the macros used.
-
-\def\doresetgotowhereever
- {\global\let\secondaryPDFreferences\empty}
+ {\pdfliteral{Q n}}
-\doresetgotowhereever % just to be sure
+%D The following will move to the backend \LUA\ code:
-% we can (in etex) share more by testing on this
+\appendtoks \ctxlua{backends.codeinjections.finalizepage ()}\to \everybackendshipout % is immediate
+\appendtoks \ctxlua{backends.codeinjections.finalizedocument()}\to \everylastbackendshipout % is immediate
-\def\savesecondaryPDFreference#1%
- {\@EA\xdef\csname PDF-SR:\the\nofsecondaryreferences\endcsname{#1}}
+%D Temporary hack, will be removed or improved.
-\def\savesecondaryPDFreference % #1 == \action
- {\global\@EA\let\csname PDF-SR:\the\nofsecondaryreferences\endcsname}
-
-% test should happen in core-ref
-
-\def\getsecondaryPDFreferences
- {\ifcase\nofsecondaryreferences\else
- \ifcsname PDF-SR:\the\nofsecondaryreferences\endcsname
- \xdef\secondaryPDFreferences{/Next <<\csname PDF-SR:\the\nofsecondaryreferences\endcsname\space\secondaryPDFreferences>>}%
- \fi
- \global\advance\nofsecondaryreferences \minusone
- \expandafter\getsecondaryPDFreferences
- \fi}
+\def\TransparencyHack{\ctxlua{backends.codeinjections.addtransparencygroup()}}
%D \macros
-%D {dostartthisislocation}
-%D
-%D Next we define the macros that deal with hyperreferencing,
-%D graphic inclusion and general document features. These are
-%D the olderst ones. I won't comment much because one needs
-%D knowledge of \PDF\ itself, and explaning \PDF\ is beyond
-%D this documentation.
-
-\def\dostartthisislocation#1%
- {\bgroup
- \setPDFdestination{#1}%
- \ifx\PDFdestination\empty \else
- \pdfdest name {\PDFdestination}\PDFpageviewkey
- \fi
- \egroup}
-
-\def\locationfilesuffix{pdf}
-
-\def\dostartgotolocation#1#2#3#4#5#6%
- {\bgroup
- \doifelsenothing{#3}
- {\setPDFdestination{#5}%
- \doifelsenothing\PDFdestination
- {\let\action\empty}
- {\doifelsenothing{#4}
- {\let\PDFfile\empty}
- {\expanded{\beforesplitstring#4}\at.\to\PDFfile
- \doifparentfileelse\PDFfile % {#4}
- {\let\PDFfile\empty}
- %{\setreferencefilename#4.\locationfilesuffix\to\PDFfile
- {\@EA\setreferencefilename\PDFfile.\locationfilesuffix\to\PDFfile
- \edef\PDFfile
- {R /F (\PDFfile)\ifgotonewwindow\space/NewWindow true \fi}}}%
- \edef\action%
- {/S /GoTo\PDFfile\space /D (\PDFdestination)}}}
- {\doifelsenothing{#4}
- {\let\PDFfile\empty
- \let\PDFdestination\empty}
- {\setreferencefilename/#4\to\PDFfile
- \setPDFdestination{#5}%
- \doifsomething\PDFdestination
- {\edef\PDFdestination{\letterhash\PDFdestination}}}%
- \edef\action{/S /URI /URI (#3\PDFfile\PDFdestination)}}%
- \ifx\action\empty\else
- \ifsecondaryreference
- \savesecondaryPDFreference\action
- \else
- \getsecondaryPDFreferences
- \insertpdfaction{\PDFswapdir#1}{#2}{\action \secondaryPDFreferences}%
- \fi
- \fi
- \egroup}
-
-\def\PDFgotonewwindow{\ifgotonewwindow\space/NewWindow true \fi}
-
-% optimization in tpd driver
-%
-% \edef\PDFdestination{(page:\the\scratchcounter)}%
-%
-% ==>
-%
-% \advance\scratchcounter 1
-% \edef\PDFdestination{[\pdfpageref \PDFobjref\scratchcounter\PDFpageviewwrd]}%
-%
-% \doPDFgetpagedestination#1#2% pagenumber macro % % fuzzy hack
-
-\def\dostartgotorealpage#1#2#3#4#5% watch the R append trick
- {\bgroup
- \doifelsenothing{#3}% #1 = url
- {\scratchcounter0#5\relax
- \ifnum\scratchcounter>0
- \doifelsenothing{#4}
- {\let\PDFfile\empty}
- {\expanded{\beforesplitstring#4}\at.\to\PDFfile
- \doifparentfileelse\PDFfile % {#4}
- {\let\PDFfile\empty}
- %{\setreferencefilename#4.\locationfilesuffix\to\PDFfile
- {\@EA\setreferencefilename\PDFfile.\locationfilesuffix\to\PDFfile
- \edef\PDFfile{R /F (\PDFfile)\PDFgotonewwindow}}}%
- \ifx\PDFfile\empty
- \ifcase\overcomePDFpage
- \or % pdf starts numbering at zero
- \advance\scratchcounter \minusone
- \edef\PDFdestination{[\the\scratchcounter\space\PDFpageviewwrd]}%
- \or % pdf starts numbering at zero
- \advance\scratchcounter \minusone
- \edef\PDFdestination{(page:\the\scratchcounter)}%
- \or % pdftex starts numbering at one
- \edef\PDFdestination{[\pdfpageref\scratchcounter\space0 R \PDFpageviewwrd]}%
- \fi
- \else % across files it's a page number / pdf starts numbering at zero
- \advance\scratchcounter \minusone
- \edef\PDFdestination{[\the\scratchcounter\space\PDFpageviewwrd]}%
- \fi
- \edef\action{/S /GoTo\PDFfile\space /D \PDFdestination}%
- \else
- \let\action\empty
- \fi}
- {\doifelsenothing{#4}
- {\let\PDFfile\empty}
- {\setreferencefilename/#4\to\PDFfile}%
- \edef\action{/S /URI /URI (#3\PDFfile)}}%
- \ifx\action\empty\else
- \ifsecondaryreference
- \savesecondaryPDFreference\action
- \else
- \getsecondaryPDFreferences
- \insertpdfaction{\PDFswapdir#1}{#2}{\action \secondaryPDFreferences}%
- \fi
- \fi
- \egroup}
-
-\let\lastfakedPDFpage\!!zerocount
-
-\def\fakePDFpagedestination % as in pdf, we start numbering at zero
- {\iflocation \ifarrangingpages \ifnum\overcomePDFpage=\plustwo \else
- \ifnum\lastfakedPDFpage<\realpageno
- \bgroup
- \xdef\lastfakedPDFpage{\realfolio}%
- \advance\realpageno \minusone % is \expanded needed ?
- \normalexpanded{\noexpand\pdfdest name {page:\realfolio}\PDFpageviewkey}%
- \egroup
- \fi
- \fi \fi \fi}
-
-\def\dostartgotoJS#1#2#3%
- {\bgroup
- \doPSsanitizeJScode#3\to\sanitizedJScode
- \edef\action{/S /JavaScript /JS (\sanitizedJScode)}%
- \ifsecondaryreference
- \savesecondaryPDFreference\action
- \else
- \getsecondaryPDFreferences
- \insertpdfaction{\PDFswapdir#1}{#2}{\action \secondaryPDFreferences}%
- \fi
- \egroup}
-
-%D When going to a location, we obey the time and space saving
-%D boolean \type{\ifusepagedestination}. Named destinations are
-%D stripped and made robust. This all happens in the macros
-%D called for.
+%D {dostartobject,dostopobject,doinsertobject}
-%D \macros
-%D {doflushJSpreamble}
-%D
-%D It does not make sense to duplicate common \JAVASCRIPT\
-%D functions, and therefore they can be predefined and must be
-%D output separately. Currently this special is not shared
-%D with the \ACROBAT\ one, simply because \DISTILLER\ does not
-%D yet support something \type{\pdfnames}.
+%D This will change:
-% \oneJSpreamblefalse % buggy in acrobat
+\newbox\objectbox
-\def\doflushJSpreamble#1%
+\def\dostartobject#1#2#3#4#5%
{\bgroup
- \let\compositeJScode\empty
- \def\docommand##1%
- {\edef\sanitizedJScode{\getJSpreamble{##1}}%
- \@EA\doPSsanitizeJScode\sanitizedJScode\to\sanitizedJScode
- \immediate\pdfobj {<< /S /JavaScript /JS (\sanitizedJScode) >>}%
- \edef\compositeJScode
- {\compositeJScode\space (##1) \PDFobjref\pdflastobj}}%
- \processcommalist[#1]\docommand
- \immediate\pdfobj{<< /Names [ \compositeJScode ] >>}%
- \pdfnames{/JavaScript \PDFobjref\pdflastobj}%
- \egroup}
-
-%D \macros
-%D {dostarthide,dostophide}
-%D
-%D Hiding parts of the document for printing is not yet
-%D supported by \PDF\ and therefore \PDFTEX.
-
-\let\dostarthide\donothing
-\let\dostophide \donothing
-
-%D \macros
-%D {doPDFsetupscreen,doPDFsetupidentity}
-%D
-%D Opposite to \DVI\ drivers, \PDF\ ones must know which what
-%D page dimensions they are dealing. We also use the
-%D opportunity to launch full screen (1) or show bookmarks (2).
-%D
-%D Setting of the screen boundingbox involves some
-%D calculations. Here we also take care of (non) full screen
-%D startup. The dimensions are rounded. Because \PDFTEX\ and
-%D \ACROBAT\ handle setting the page dimensions in a
-%D different way, we do not share this special.
-
-\def\dosetupscreen{\doPDFsetupscreen\pdfpageheight}
-
-\let\currentPDFpagemode \empty % document catalog
-\let\currentPDFviewerprefs\empty % document catalog
+ \setbox\objectbox\vbox\bgroup
+ \def\dodostopobject{\egroup\doregisterobject{#1}{#2}}}
-\let\currentPDFcropbox \empty % page attributes
-\let\currentPDFbleedbox \empty % page attributes
-\let\currentPDFartbox \empty % page attributes
-\let\currentPDFtrimbox \empty % page attributes
-
-\def\doPDFsetupscreen#1#2#3#4#5#6% watch the extra argument
- {\bgroup
- \xdef\currentPDFpagemode
- {\ifnum#6=4
- /PageLayout /TwoColumnRight
- \else
- /PageMode \ifcase#6
- /UseNone\or/FullScreen\or/UseOutlines\else/UseNone\fi
- \fi}%
- \xdef\currentPDFviewerprefs % space after #6 needed, else \relax
- {\ifcase#6 \or\or\else /ViewerPreferences << /FitWindow true >>\fi}%
+\def\dostopobject
+ {\dodostopobject
\egroup}
-\def\addPDFdocumentinfo
- {\appendtopdfcatalog{\currentPDFpagemode\currentPDFviewerprefs}%
- \appendtopdfcatalog{/Version \ifdim\PDFversion00\points>100\points 1.\fi\PDFversion}%
- \appendtopdfinfo{/Trapped /False}%
- \appendtopdfinfo{/ConTeXt.Version (\contextversion)}%
- \appendtopdfinfo{/ConTeXt.Time (\number\normalyear.\twodigits\normalmonth.\twodigits\normalday\space \twodigits\currenthour:\twodigits\currentminute)}%
- \appendtopdfinfo{/ConTeXt.Jobname (\jobname)}%
- \appendtopdfinfo{/ConTeXt.Url (www.pragma-ade.com)}%
- \glet\addPDFdocumentinfo\relax}
+\def\doregisterobject#1#2%
+ {\the\pdfbackendeveryxform
+ \finalizeobjectbox\objectbox
+ \immediate\pdfxform resources {\pdfbackendcurrentresources}\objectbox
+ \dosetobjectreference{#1}{#2}{\the\pdflastxform}}
-\def\PDFversion{1.5}
+\def\doresetobjects
+ {}
-\appendtoksonce
- \def\PDFversion{1.5}%
-\to \everyresetspecials
+\def\doinsertobject#1#2%
+ {\begingroup
+ \doifobjectreferencefoundelse{#1}{#2}
+ {\dogetobjectreference{#1}{#2}\PDFobjectreference\pdfrefxform\PDFobjectreference}%
+ \donothing
+ \endgroup}
-\def\doPDFsetupwhateverbox#1#2#3#4#5#6% watch the extra arguments
- {\bgroup
- \!!widtha \dimexpr#5+#3\relax
- \!!heightb\dimexpr#2-#4\relax
- \!!heighta\dimexpr\!!heightb-#6\relax
- % sometimes whole values give better results
- % \PointsToWholeBigPoints{#3}\left
- % \PointsToWholeBigPoints\!!heighta\bottom
- % \PointsToWholeBigPoints\!!widtha \width
- % \PointsToWholeBigPoints\!!heightb\height
- % but since pdf/x does not round when checking if
- % the boxes fit inside the media box ...
- \PointsToBigPoints{#3}\left
- \PointsToBigPoints\!!heighta\bottom
- \PointsToBigPoints\!!widtha \width
- \PointsToBigPoints\!!heightb\height
- \xdef#1{[\left\space\bottom\space\width\space\height]}%
- \egroup}
-
-\gdef\currentPDFtrimbox{\currentPDFcropbox} % default, needed for pdf/x
-
-\def\dosetupartbox {\doPDFsetupwhateverbox\currentPDFartbox \pdfpageheight}
-\def\dosetupcropbox {\doPDFsetupwhateverbox\currentPDFcropbox \pdfpageheight}
-\def\dosetupbleedbox{\doPDFsetupwhateverbox\currentPDFbleedbox\pdfpageheight}
-\def\dosetuptrimbox {\doPDFsetupwhateverbox\currentPDFtrimbox \pdfpageheight}
-
-\def\flushPDFpageboxes
- {\edef\currentPDFtrimbox{\currentPDFtrimbox}%
- \ifx\currentPDFartbox \empty\else\appendtopdfpageattributes{/ArtBox \currentPDFartbox }\fi
- \ifx\currentPDFcropbox \empty\else\appendtopdfpageattributes{/CropBox \currentPDFcropbox }\fi
- \ifx\currentPDFbleedbox\empty\else\appendtopdfpageattributes{/BleedBox \currentPDFbleedbox}\fi
- \ifx\currentPDFtrimbox \empty\else\appendtopdfpageattributes{/TrimBox \currentPDFtrimbox }\fi}
-
-%D \macros
-%D {dostartexecutecommand}
-%D
-%D \PDF\ viewers enable us to navigate using menus and shortcut
-%D keys. These navigational tools can also be accessed by using
-%D annotations. The next special takes care of inserting them.
-%D
-%D At the cost of much auxiliary placeholders, we can pretty
-%D fast convert the command asked for. This is how the \PDF\
-%D code looks like.
-
-\def\PDFmoviecode#1#2#3%
- {/Movie
- /T (\ifcase#1movie \else sound \fi\ifx\argumentA\empty#2\else\argumentA\fi)
- /Operation /\ifcase#3Play\or Stop\or Pause\or Resume\fi\space}
-
-\def\PDFexecutestartmovie {\PDFmoviecode0\currentmovie0}
-\def\PDFexecutestopmovie {\PDFmoviecode0\currentmovie1}
-\def\PDFexecutepausemovie {\PDFmoviecode0\currentmovie2}
-\def\PDFexecuteresumemovie {\PDFmoviecode0\currentmovie3}
-
-\def\PDFexecutestartsound {\PDFmoviecode1\currentsound0}
-\def\PDFexecutestopsound {\PDFmoviecode1\currentsound1}
-\def\PDFexecutepausesound {\PDFmoviecode1\currentsound2}
-\def\PDFexecuteresumesound {\PDFmoviecode1\currentsound3}
-
-\def\PDFformcode#1%
- {\doiffieldset{#1}{/Field [\dogetfieldset{#1}]}}
-
-% bit 3 = html
-% bit 6 = xml
-% bit 4 = get
-
-\ifx\PDFsubmitfiller\undefined \let\PDFsubmitfiller\empty \fi
-
-\chardef\PDFformmethod=1 % 0=GET 1=POST
-
-\def\PDFformflag#1#2{\ifcase\PDFformmethod#1\else#2\fi}
-
-\def\PDFexecuteimportform {/Named /N /AcroForm:ImportFDF}
-\def\PDFexecuteexportform {/Named /N /AcroForm:ExportFDF}
-\def\PDFexecuteresetform {/ResetForm \PDFformcode\argumentA}
-\def\PDFexecutesubmitform {/SubmitForm \PDFformcode\argumentB
- /Flags \ifcase\submitoutputformat\space
- \PDFformflag{12} {4} % 0=unknown
- \or \PDFformflag{12} {4} % 1=HTML
- \or \PDFformflag {8} {0} % 2=FDF
- \or \PDFformflag{40}{32} % 3=XML
- \else \PDFformflag{12} {4} % ?=unknown
- \fi
- /F (\argumentA)\PDFsubmitfiller}
-
-% urifill permits url substitution
-
-\def\PDFexecutehide {/Hide /T (\argumentA) /H true}
-\def\PDFexecuteshow {/Hide /T (\argumentA) /H false}
-
-\def\PDFexecutefirst {/Named /N /FirstPage}
-\def\PDFexecuteprevious {/Named /N /PrevPage}
-\def\PDFexecutenext {/Named /N /NextPage}
-\def\PDFexecutelast {/Named /N /LastPage}
-\def\PDFexecutebackward {/Named /N /GoBack}
-\def\PDFexecuteforward {/Named /N /GoForward}
-\def\PDFexecuteprint {/Named /N /Print}
-\def\PDFexecuteexit {/Named /N /Quit}
-\def\PDFexecuteclose {/Named /N /Close}
-\def\PDFexecutesave {/Named /N /Save}
-\def\PDFexecutesavenamed {/Named /N /SaveAs}
-\def\PDFexecuteopennamed {/Named /N /Open}
-\def\PDFexecutehelp {/Named /N /HelpUserGuide}
-\def\PDFexecutetoggle {/Named /N /FullScreen}
-\def\PDFexecutesearch {/Named /N /Find}
-\def\PDFexecutesearchagain {/Named /N /FindAgain}
-\def\PDFexecutegotopage {/Named /N /GoToPage}
-\def\PDFexecutequery {/Named /N /AcroSrch:Query}
-\def\PDFexecutequeryagain {/Named /N /AcroSrch:NextHit}
-\def\PDFexecutefitwidth {/Named /N /FitWidth}
-\def\PDFexecutefitheight {/Named /N /FitHeight}
-
-\let\PDFobjectclass\empty
-\let\PDFobjectname \empty
-
-\def\dostartexecutecommand#1#2#3#4%
- {\doifdefined{PDFexecute#3}
- {\bgroup
- \edef\argument{#4}%
- \ifx\argument\empty
- \let\argumentA\empty
- \let\argumentB\empty
- \else
- \@EA\dogetcommalistelement\@EA1\@EA\from#4\to\argumentA
- \@EA\dogetcommalistelement\@EA2\@EA\from#4\to\argumentB
- \fi
- \edef\action%
- {/S \getvalue{PDFexecute#3}}%
- \ifsecondaryreference
- \savesecondaryPDFreference\action
- \else
- \getsecondaryPDFreferences
-% \ifx\PDFobjectclass\empty
-% \let\next\insertpdfaction
-% \else
-% \edef\next{\createpdfactionobject{\PDFobjectclass}{\PDFobjectname}}%
-% \globalletempty\PDFobjectclass
-% \globalletempty\PDFobjectname
-% \fi
-% \next
- \insertpdfaction{\PDFswapdir#1}{#2}{\action \secondaryPDFreferences}%
- \fi
- \egroup}}
-
-%D \macros
-%D {dosetupidentity}
-%D
-%D Documents can be tagged with an application accessible title
-%D and subtitle, the authorname, a date, the creator, keywords
-%D etc. For the moment \PDFTEX\ only supports the first three
-%D of these.
-
-\def\dosetupidentity#1#2#3#4#5#6%
- {\normalexpanded{\noexpand\appendtopdfinfo
- {/Title <\hexifiedPDFstring{#1}>
- /Subject <\hexifiedPDFstring{#2}>
- /Author <\hexifiedPDFstring{#3}>
- /Creator <\hexifiedPDFstring{#4}>
- /ModDate (#4)
- /ID (\jobname.#5) % needed for pdf/x
- /Keywords <\hexifiedPDFstring{#6}>}}}
-
-%D \macros
-%D {dostartrunprogam}
-%D
-%D We can run a program form within a document, although this
-%D feature is rather weak, due to path problems and buggy
-%D argument passing.
-
-\def\dostartrunprogram#1#2#3#4% new: #3 => #3#4
- {\bgroup
- %\edef\string{#3}%
- %\@EA\beforesplitstring\string\at{ }\to\program
- %\@EA\aftersplitstring \string\at{ }\to\parameters
- %\edef\action%
- % {/S /Launch /F (\program) /P (\parameters) /D (.)}%
- \edef\action
- {/S /Launch /F (#3) /P (#4) /D (.)}%
- \ifsecondaryreference
- \savesecondaryPDFreference\action
- \else
- \getsecondaryPDFreferences
- \insertpdfaction{\PDFswapdir#1}{#2}{\action \secondaryPDFreferences}%
- \fi
- \egroup}
-
-%D \macros
-%D {dostartgotoprofile, dostopgotoprofile,
-%D dobeginofprofile, doendofprofile}
-%D
-%D \CONTEXT\ user profiles and version control fall back on
-%D \PDF\ article threads. Unfortunately one cannot influence
-%D the view yet in an (for me) acceptable way.
-
-\def\dostartgotoprofile#1#2#3% to be done: file
- {\bgroup
- \setPDFdestination{#3}%
- \doifsomething\PDFdestination
- {\edef\action
- {/S /Thread /D (\PDFdestination)}%
- \ifsecondaryreference
- \savesecondaryPDFreference\action
- \else
- \getsecondaryPDFreferences
- \insertpdfaction{\PDFswapdir#1}{#2}{\action \secondaryPDFreferences}%
- \fi}%
- \egroup}
-
-%D Some day, I'll reimplement threading in a useful way.
-%D Currently the viewers handle threads rather diffuse.
-
-\def\dobeginofprofile#1#2#3#4%
- {\setPDFdestination{#1}%
- \doifsomething\PDFdestination
- {\pdfthread
- width #2 height #3
- attr {/Title (\PDFdestination)} % can be omitted
- name {\PDFdestination}}}
-
-\def\doendofprofile
- {}
-
-%D \macros
-%D {doinsertbookmark}
-%D
-%D In \PDF\ bookmarks are the building blocks of a viewer
-%D provided sort of table of contents. \TEX\ has to provide
-%D the entry as well as the number of child entries. Strings
-%D need to be sanatized as good as possible to suit the default
-%D encoding. In \CONTEXT\ users can overrule this string by
-%D supplying an alternative one. Look at the macro called for
-%D to see how funny these bookmarks are defined.
-
-\def\doinsertbookmark#1#2#3#4#5% level sublevels text page open=1
- {\bgroup
- \doPDFgetpagereference{#4}\PDFobjectreference
- \pdfoutline
- user {<>}%
- \ifcase#2 \else count \ifcase#5-\fi#2 \fi
-% {<\hexifiedPDFstring{#3}>}% goes wrong
- {<#3>}%
- \egroup}
-
-%D \macros
-%D {dostartobject,dostopobject,doinsertobject}
-%D
-%D Due to \PDF's object oriented character, we can include and
-%D reuse objects. These can be compared with \TEX's boxes. The
-%D \TEX\ counterpart is defined in the module \type{spec-dvi}.
-%D We don't use the dimensions here.
-%D
-%D The next solution is not that beautiful. Because objects are
-%D containers for whatever kind of content, graphics can be
-%D part of this content, and a graphic object can be part of
-%D the more general type. In practice this means that an ximage
-%D would be embedded in an xform, which in itself is not that
-%D big a problem, apart from a few bytes overhead. However, for
-%D reasons unknown to me alternative images must be pure
-%D ximages |<|indeed, somehow one cannot use a vector graphic
-%D as alternative|>| that are not embedded into forms, so this
-%D is why the object handler treats them different. This
-%D implies knowledge of the calling routines, especially the
-%D \type{FIG} trigger, that signals that we just embedded an
-%D image. Alternatively I could have introduced a dual object
-%D system, but the overhead in duplicate specials is currently
-%D not what we want. I'd rather implement a more mature
-%D object support system from scratch.
-
-\let\currentPDFresources\empty
-\let\PDFimageattributes \empty
-\let\PDFfigurereference \empty
-\let\PDFimagereference \empty
-
-\def\dostartobject#1#2#3#4#5%
- {\bgroup
- \setbox\nextbox\vbox\bgroup
- \def\dodostopobject
- {\egroup
- \ifx\PDFimagereference\empty
- % We also flush page resources, since shared
- % resources end up there; otherwise transparencies
- % won't work in xforms; some day I will optimize
- % this.
- \the\everyPDFxform
- \finalizeobjectbox\nextbox
- \immediate\pdfxform
- resources {\currentPDFresources\the\pdfpageresources}%
- \nextbox
- \global\let\currentPDFresources\empty
- \dosetobjectreference{#1}{#2}{\the\pdflastxform}%
- \else
- \dosetobjectreference{#1}{#2}{-\PDFimagereference}%
- \global\let\PDFimagereference\empty
- \fi}}
-
-\def\dostopobject
- {\dodostopobject
- \egroup}
-
-\def\doresetobjects
- {\global\let\PDFimagereference\empty}
-
-\def\doinsertobject#1#2%
- {\bgroup
- \doifobjectreferencefoundelse{#1}{#2}
- {\dogetobjectreference{#1}{#2}\PDFobjectreference
- \ifnum\PDFobjectreference<0
- \@EA\@EA\@EA\pdfrefximage\@EA\gobbleoneargument\PDFobjectreference
- \else
- \pdfrefxform\PDFobjectreference
- \fi}%
- {}%
- \egroup}
-
-\appendtoksonce
- \collectPDFresources
- \global\let\currentPDFresources\collectedPDFresources
-\to \everyPDFxform
-
-%D \macros
-%D {dosetpagetransition}
-%D
-%D Page transitions only make sence in presentations. They are
-%D passed as raw \PDF\ code to the page object. Take a look
-%D at the implementation to get an impression of the rubish
-%D passed on.
-%D
-%D This array holds a reasonable selection of transitions
-%D (watch out: \type{replace} is not in this list). Most of
-%D the transitions look awful anyway. By the way, \CONTEXT\ is
-%D able to select transitions randomly.
-
-\def\pagetransitions
- {{split,in,vertical},{split,in,horizontal},
- {split,out,vertical},{split,out,horizontal},
- {blinds,horizontal},{blinds,vertical},
- {box,in},{box,out},
- {wipe,east},{wipe,west},{wipe,north},{wipe,south},
- dissolve,
- {glitter,east},{glitter,south},
- {fly,in,east},{fly,in,west},{fly,in,north},{fly,in,south},
- {fly,out,east},{fly,out,west},{fly,out,north},{fly,out,south},
- {push,east},{push,west},{push,north},{push,south},
- {cover,east},{cover,west},{cover,north},{cover,south},
- {uncover,east},{uncover,west},{uncover,north},{uncover,south},
- fade}
-
-%D Again, we use macros as placeholders for \PDF\ key||value
-%D pairs.
-
-\def\PDFpagesplit {/S /Split }
-\def\PDFpageblinds {/S /Blinds }
-\def\PDFpagebox {/S /Box }
-\def\PDFpagewipe {/S /Wipe }
-\def\PDFpagedissolve {/S /Dissolve }
-\def\PDFpageglitter {/S /Glitter }
-\def\PDFpagereplace {/S /R }
-
-\def\PDFpagefly {/S /Fly } % 1.5
-\def\PDFpagepush {/S /Push } % 1.5
-\def\PDFpagecover {/S /Cover } % 1.5
-\def\PDFpageuncover {/S /Uncover } % 1.5
-\def\PDFpagefade {/S /Fade } % 1.5
-
-\def\PDFpagehorizontal {/Dm /H }
-\def\PDFpagevertical {/Dm /V }
-\def\PDFpagein {/M /I }
-\def\PDFpageout {/M /O }
-\def\PDFpageeast {/Di 0 }
-\def\PDFpagenorth {/Di 90 }
-\def\PDFpagewest {/Di 180 }
-\def\PDFpagesouth {/Di 270 }
-
-\def\dodoPDFsetpagetransition#1%
- {\doifdefined{PDFpage#1}
- {\edef\PDFpagetransitions{\PDFpagetransitions\getvalue{PDFpage#1}}}}
-
-\def\dosetpagetransition#1#2%
- {\let\PDFpagetransitions\empty
- \processcommalist[#1]\dodoPDFsetpagetransition
- \appendtopdfpageattributes
- %{\ifnum#2>0 /Dur #2 \fi
- {\ifnum0<0#2 /Dur #2 \fi
- \ifx\PDFpagetransitions\empty\else/Trans <<\PDFpagetransitions>>\fi}}
-
-%D The expansion is needed because else the \type{\pdfpageattr}
-%D token list flushes an unexpanded \type{\csname}. The
-%D \type{\global} is needed because the assignment can take
-%D place deeply buried (for instance in the \type{\shipout}
-%D box.
-
-%D \macros
-%D {doinsertcomment, doflushcomments}
-%D
-%D Text annotation, or comments, are provided too:
-
-%D \macros
-%D {dopresetlinefield,dopresettextfield,
-%D dopresetchoicefield,dopresetpopupfield,dopresetcombofield,
-%D dopresetpushfield,dopresetcheckfield,
-%D dopresetradiofield,dopresetradiorecord}
-%D
-%D \PDF\ offers extensive field support. The next bunch of
-%D definitions map the specials.
-
-%D \macros
-%D {dodefinefieldset,dogetfieldset,doiffieldset}
-%D
-%D Field sets, needed for reset and submit handling, are
-%D taken care of by:
-
-%D The next section of this module is dedicated to form
-%D support. These macros are complicated by the fact that
-%D cloning is possible.
-
-%D \macros
-%D {FDFflag...,FDFplus...}
-%D
-%D The \type{/FT} key determines the type of field: text,
-%D button or choice. The latter two come in several disguises,
-%D which are set by flipping bits in the \type{/Ff}. Other bits
-%D are used to set states. Personally I hate this bitty way of
-%D doing things. The next six bit determine the field sub type:
-
-\def\FDFflagMultiLine {4096} % 13
-\def\FDFflagNoToggleToOff {16384} % 15
-\def\FDFflagRadio {32768} % 16
-\def\FDFflagPushButton {65536} % 17
-\def\FDFflagPopUp {131072} % 18
-\def\FDFflagEdit {262144} % 19
-
-% bugged anyway, so we need to drop it:
-
-\def\FDFflagRadiosInUnison {33554432} % 26
-
-%D A few more (pdf 1.4) flags, what the spell check one: for
-%D obscure reasons for Adobe downward compatibility means
-%D enabling features that harm old applications like testing.
-
-\def\FDFflagDoNotSpellCheck {4194304} % 23
-\def\FDFflagDoNotScroll {8388608} % 24
-
-%D The next bits (watch how strange the bits are organized)
-%D take care of the states:
-
-\def\FDFflagReadOnly {1} % 1
-\def\FDFflagRequired {2} % 2
-\def\FDFflagNoExport {4} % 3
-\def\FDFflagPassword {8192} % 14
-\def\FDFflagSort {524288} % 20
-\def\FDFflagFileSelect {1048576} % 21
-
-%D There is a second, again bitset oriented, \type{/F} flag:
-
-\def\FDFplusInvisible {1} % 1
-\def\FDFplusHidden {2} % 2
-\def\FDFplusPrintable {4} % 3
-
-%def\FDFplusNoView {32} % 6
-%def\FDFplusToggleNoView {256} % 9
-
-\def\FDFplusAutoView {256} % {288} % 6+9
-
-%D \macros
-%D {setFDFswitches}
-%D
-%D The non||type bits are mapped onto user||interface
-%D swithes, to be used later on:
-
-\def\@@FDFflag{FDFflag}
-\def\@@FDFplus{FDFplus}
-
-\letvalue {\@@FDFflag\v!readonly}=\FDFflagReadOnly
-\letvalue {\@@FDFflag\v!required}=\FDFflagRequired
-\letvalue {\@@FDFflag\v!protected}=\FDFflagPassword
-\letvalue {\@@FDFflag\v!sorted}=\FDFflagSort
-\letvalue {\@@FDFflag\v!unavailable}=\FDFflagNoExport
-\letvalue {\@@FDFflag\v!nocheck}=\FDFflagDoNotSpellCheck
-\letvalue {\@@FDFflag\v!fixed}=\FDFflagDoNotScroll
-\letvalue {\@@FDFflag\v!file}=\FDFflagFileSelect
-
-\letvalue {\@@FDFplus\v!hidden}=\FDFplusHidden
-\letvalue {\@@FDFplus\v!printable}=\FDFplusPrintable
-
-\letvalue {\@@FDFplus\v!auto}=\FDFplusAutoView
-
-%D A set of switches is collected into the flags we mentioned
-%D before by the next macro (we don't handle negations yet,
-%D but do take care of redundancy):
-
-\def\FDFflag{0}
-\def\FDFplus{0}
-
-\def\setFDFswitches[#1]%
- {\bgroup
- \!!counta\zerocount
- \!!countb\zerocount
- \def\docommand##1%
- {\doifsomething{##1}
- {\advance\!!counta 0\getvalue{\@@FDFflag##1}%
- \setvalue{\@@FDFflag##1}{0}%
- \advance\!!countb 0\getvalue{\@@FDFplus##1}%
- \setvalue{\@@FDFplus##1}{0}}}%
- \processcommacommand[#1]\docommand
- \xdef\FDFflag{\the\!!counta}%
- \xdef\FDFplus{\the\!!countb}%
- \egroup}
-
-%D \macros
-%D {setFDFvalues}
-%D
-%D Menu items are passed as an array of \type{(string)}'s and
-%D the content of this array is build with:
-
-\let\FDFvalues \empty
-\let\FDFfirstvalues \empty
-\let\FDFsecondvalues\empty
-\let\FDFkidlist \empty
-\let\FDFdefaultindex\!!zerocount
-\let\FDFdefaultvalue\empty
-
-% Why do we need to tweak this mechanism each time acrobat updates ...
-% it would make sense to have version specific sections in pdf files
-% since my guess is that it never will be done right since each year
-% new programmers have new ideas about what is supposed to happen with
-% kids. So .. best is not to trust this feature esp not for radio
-% widgets. (new flags, different interpretation of AS etc etc)
-
-\def\setFDFvalues[#1][#2]% #1 = list (item=>value) #2 = default
- {\let\FDFvalues \empty
- %when radio opt works ok
- %\let\FDFfirstvalues \empty
- %\let\FDFsecondvalues\empty
- \let\FDFkidlist \empty
- %\let\FDFdefaultindex\!!zerocount
- %\let\FDFdefaultvalue\empty
- %\scratchcounter\zerocount
- \def\dodocommand##1=>##2=>##3\end
- {\addtocommalist{##1}\FDFkidlist
- %\edef\FDFfirstvalues{\FDFfirstvalues(##1)}%
- %\doif{##1}{#2}{\edef\FDFdefaultindex{\the\scratchcounter}}%
- %\advance\scratchcounter\plusone
- \doifelsenothing{##2}
- {\doif{##1}{#2}{\edef\FDFdefaultvalue{##1}}%
- %\edef\FDFsecondvalues{\FDFsecondvalues(##1)}%
- \edef\FDFvalues{\FDFvalues [(##1)(##1)] }}
- {\doif{##1}{#2}{\edef\FDFdefaultvalue{##2}}%
- %\edef\FDFsecondvalues{\FDFsecondvalues(##2)}%
- \edef\FDFvalues{\FDFvalues [(##2)(##1)] }}}% ! ##1 is shown
- \def\docommand##1%
- {\dodocommand##1=>=>\end}%
- \expanded{\processcommalist[#1]}\docommand}
-
-%D This macro accepts comma separated \type{visual=>result}
-%D pairs.
-
-%D \macros
-%D {setFDFalignment}
-%D
-%D Text and line fields can be entered and showed in three
-%D alternative alingments, indicated by a digit:
-
-\def\FDFalign{0}
-
-\def\setFDFalignment[#1]%
- {\processaction
- [#1]
- [ \v!left=>\edef\FDFalign{2}, % raggedleft
- \v!middle=>\edef\FDFalign{1}, % raggedcenter
- \v!right=>\edef\FDFalign{0}]} % raggedright
-
-%D \macros
-%D {setFDFattributes}
-%D
-%D The weak part of (at least version 2.1 \PDF) is that only
-%D default fonts are handled well. Another restriction is that
-%D the encoding vector must be the standard \PDF\ document one.
-%D Although the \PDF\ reference explictly states that one could
-%D use the normal text operators, leading is not yet handled.
-%D
-%D For the moment the current \CONTEXT\ font is mapped onto
-%D one best suitable default font. The color attribute is
-%D less problematic and is directly derived from the \CONTEXT\
-%D color.
-
-\def\FDFattributes{/Helv 12 Tf 0 g 14.4 TL}
-
-\def\FDFrm {TiRo} \def\FDFss {Helv} \def\FDFtt {Cour}
-\def\FDFrmtf{TiRo} \def\FDFsstf{Helv} \def\FDFtttf{Cour}
-\def\FDFrmbf{TiBo} \def\FDFssbf{HeBo} \def\FDFttbf{CoBo}
-\def\FDFrmit{TiIt} \def\FDFssit{HeOb} \def\FDFttit{CoOb}
-\def\FDFrmsl{TiIt} \def\FDFsssl{HeOb} \def\FDFttsl{CoOb}
-\def\FDFrmbi{TiBI} \def\FDFssbi{HeBO} \def\FDFttbi{CoBO}
-\def\FDFrmbs{TiBI} \def\FDFssbs{HeBO} \def\FDFttbs{CoBO}
-
-\let\FDFusedfonts=\FDFsstf
-
-\def\setFDFattributes[#1,#2,#3,#4]% style, color, backgroundcolor, framecolor
- {\bgroup % nog interlinie: n TL
- \setbox\scratchbox\hbox
- \bgroup
- \doconvertfont{#1}{}%
- \PointsToBigPoints\bodyfontsize\size % x/xx, so better the actual size
- \doifdefinedelse{FDF\fontstyle\fontalternative}
- {\xdef\FDFattributes{\getvalue{FDF\fontstyle\fontalternative}}}
- {\doifdefinedelse{FDF\fontstyle}
- {\xdef\FDFattributes{\getvalue{FDF\fontstyle}}}
- {\xdef\FDFattributes{\FDFrm}}}%
- \doglobal\addtocommalist\FDFattributes\FDFusedfonts
- \xdef\FDFattributes% move up with "x.y Ts"
- {/\FDFattributes\space\size\space Tf\space\PDFcolor{#2}}%
- \doifelsenothing{#3}
- {\global\let\FDFsurroundings\empty}
- {\xdef\FDFsurroundings{/BG \FDFcolor{#3}}}%
- \doifsomething{#4}
- {\xdef\FDFsurroundings{\FDFsurroundings\space /BC \FDFcolor{#4}}}%
- \ifx\FDFsurroundings\empty \else
- \xdef\FDFsurroundings{/MK << \FDFsurroundings\space>>}%
- \fi
- \egroup
- \egroup}
-
-%D \macros
-%D {setFDFactions}
-%D
-%D Depending on the type of the field, one can assign
-%D \JAVASCRIPT\ code to a mouse event or keystroke. The next
-%D preparation macro shows what events are handled.
-
-\let\FDFactions\empty
-
-\def\setFDFactions[#1,#2,#3,#4,#5,#6,#7,#8,%
- {\global\let\FDFactions\empty
- \setFDFaction D#1% mousedown
- \setFDFaction U#2% mouseup
- \setFDFaction E#3% enterregion
- \setFDFaction X#4% exitregion
- \setFDFaction K#5% afterkeystroke
- \setFDFaction F#6% formatresult
- \setFDFaction V#7% validateresult
- \setFDFaction C#8% calculatewhatever
- \setFDFactionsmore}
-
-\def\setFDFactionsmore#1,#2]%
- {\setFDFaction{Fo}#1% focusin
- \setFDFaction{Bl}#2% focusout % was I (now pdf ref manual explicitly talks about lowercase l)
- \ifx\FDFactions\empty\else
- \xdef\FDFactions{/AA << \FDFactions >>}% since 1.3 no longer inherited
- \fi}
-
-% todo, when new var scheme is implemented
-%
-% \setFDFaction{PO}\@@DriverFieldPageOpen
-% \setFDFaction{PC}\@@DriverFieldPageClose
-% \setFDFaction{PV}\@@DriverFieldPageVisible
-% \setFDFaction{PI}\@@DriverFieldPageInVisible
-
-%D The event handler becomes something:
-%D
-%D \starttyping
-%D /AA << /D << /S ... >> ... /C << /S ... >>
-%D /A << /S /JavaScript /JS (...) >>
-%D \stoptyping
-
-\def\setFDFaction#1#2%
- {\bgroup
- \def\docommand{\xdef\FDFactions{\FDFactions /#1 << \lastPDFaction >> }}%
- \@EA\handlereferenceactions\@EA{#2}\docommand % one level expansion
- \egroup}
-
-%D \macros
-%D {testFDFactions}
-%D
-%D This rather confusion prone series of script can be tested
-%D with:
-%D
-%D \starttyping
-%D \testFDFactions
-%D \stoptyping
-%D
-%D which simply redefined the previous macro to one that prints
-%D a message to the console.
-
-\def\testFDFactions
- {\def\setFDFaction##1##2%
- {\doPSsanitizeJScode console.show();console.println("executing:##1"); \to\sanitizedJScode
- \edef\FDFactions{\FDFactions /##1 << /S /JavaScript /JS (\sanitizedJScode) >> }}}
-
-%D \macros
-%D {doregistercalculationset}
-%D
-%D There is at most one calculation order list, which defines
-%D the order in which fields are calculated. The calculation
-%D order is defined using:
-
-\let\PDFcalculationset\empty
-
-\def\doregistercalculationset#1%
- {\def\PDFcalculationset{#1}}
-
-%D \macros
-%D {registerFDFobject,everylastshipout}
-%D
-%D Officially one needs to embed some general datastructures
-%D that tell the viewer what fields are present in the file, as
-%D well as what resources they use. The next mechanism does that
-%D job automatically when one registers the field.
-
-\def\flushFDFnames
- {\ifx\FDFcollection\empty\else
- \defineFDFfonts
- \createpdfarrayobject{FDF}{local:fields}{\FDFcollection}%
- \doPDFgetobjectreference{FDF}{local:fields}\PDFobjectreference
- % The /NeedAppearances is pretty important because
- % otherwise Acrobat 5 blows up on cloned radio widgets
- \createpdfdictionaryobject{FDF}{local:acroform}
- {/Fields \PDFobjectreference\space
- /NeedAppearances true
- \doiffieldset\PDFcalculationset{/CO [\dogetfieldset\PDFcalculationset]}
- /DR << /Font << \FDFfonts >> >>
- /DA (/Helv 10 Tf 0 g)}%
- \doPDFgetobjectreference{FDF}{local:acroform}\PDFobjectreference
- \appendtopdfcatalog
- {/AcroForm \PDFobjectreference}%
- \global\let\FDFcollection\empty
- \global\let\flushFDFnames\relax
- \fi}
-
-\let\FDFcollection\empty
-
-\def\registerFDFobject#1%
- {\ifx\flushFDFnames\relax
- \writestatus{FDF}{second run needed for field list (#1)}%
- \fi
- \doPDFgetobjectreference{FDF}{#1}\PDFobjectreference
- \xdef\FDFcollection{\FDFcollection\space\PDFobjectreference}}
-
-\appendtoksonce \flushFDFnames \to \everylastshipout % test \everybye / was \prependtoksonce
-
-%D \macros
-%D {defineFDFfonts}
-%D
-%D Another datastruture concerns the fonts used. We only
-%D define the fonts we use.
-
-\def\defineFDFfonts
- {\let\FDFfonts\empty
- \processcommacommand[\FDFusedfonts]\defineFDFfont}
-
-\def\defineFDFfont#1%
- {\createpdfdictionaryobject{FDF}{local:#1}
- {/Type /Font
- /Subtype /Type1
- /Name /#1
- /BaseFont /\getvalue{FDFname#1}}%
- \doPDFgetobjectreference{FDF}{local:#1}\PDFobjectreference
- \edef\FDFfonts{\FDFfonts \space/#1 \PDFobjectreference}}
-
-%D Another list of constants:
-
-\def\FDFnameTiRo {Times-Roman}
-\def\FDFnameTiBo {Times-Bold}
-\def\FDFnameTiIt {Times-Italic}
-\def\FDFnameTiBI {Times-BoldItalic}
-\def\FDFnameHelv {Helvetica}
-\def\FDFnameHeBo {Helvetica-Bold}
-\def\FDFnameHeOb {Helvetica-Oblique}
-\def\FDFnameHeBO {Helvetica-BoldOblique}
-\def\FDFnameCour {Courier}
-\def\FDFnameCoBo {Courier-Bold}
-\def\FDFnameCoOb {Courier-Oblique}
-\def\FDFnameCoBO {Courier-BoldOblique}
-
-%D \macros
-%D {currentFDFmode,currentFDFparent,currentFDFkids,currenrFDFroot}
-%D
-%D There are three more quasi global interfacing variables
-%D that need to be set.
-
-\let\currentFDFmode \fieldlonermode
-\let\currentFDFkids \empty
-\let\currentFDFparent\empty
-\let\currentFDFroot \empty
-
-%D \macros
-%D {dosetfieldstatus}
-%D
-%D And here comes the special that deals with them.
-
-\def\dosetfieldstatus#1#2#3#4%
- {\chardef\currentFDFmode #1%
- \edef\currentFDFparent {#2}%
- \edef\currentFDFkids {#3}%
- \edef\currentFDFroot {#4}}
-
-%D We already dealt with the encoding vector. Conversion from
-%D \TEX\ \ASCII\ encoding to the other one, is accomplished by
-%D the next few macros. Wach out: we don't group here.
-
-\appendtoksonce
- \simplifycommands
-\to \everysetfield
-
-%D \macros
-%D {doPDFinsertcomment}
-%D
-%D An example its use is the next special, one that deals with
-%D text annotations.
-
-\newcounter\nofFDFcomments
-
-\newif\ifPDFpopupcomments \PDFpopupcommentstrue
-
-\def\doflushcomments
- {\box\PDFsymbolbox}
-
-\long\def\doinsertcomment#1#2#3#4#5#6#7#8% % \@@DriverCommentLayer set otherwise
- {\bgroup % title width height color open symbol collect data
- \presetPDFsymbolappearance{#4}{#6}{#2}{#3}\!!zeropoint% sets width/height
- \doifelsenothing{#1}
- {\let\PDFidentifier\empty}
- {\sanitizePDFencoding#1\to\PDFcommenttitle
- \def\PDFidentifier{/T <\PDFcommenttitle>}}%
- \sanitizePDFencoding#8\to\PDFdata
- \setFDFlayer\@@DriverCommentLayer
- \startPDFsymbolappearance
- \ifPDFpopupcomments
- \doglobal\increment\nofFDFcomments
- \doifobjectreferencefoundelse{FDF}{c:\nofFDFcomments}
- {\doPDFgetobjectreference{FDF}{c:\nofFDFcomments}\PDFobjectreference
- \donetrue}
- \donefalse
- \ifdone
- \setbox\scratchbox\hbox
- {\createpdfannotationobject{FDF}{c::\nofFDFcomments}{#2}{#3}% text window, size does not work
- {/Subtype /Popup
- /Parent \PDFobjectreference}}%
- \ifcase#7\relax
- \vbox to \height{\forgetall\vskip#3\box\scratchbox\vss}%
- \else % incredible trial and error hack
- % it's quite a mess, the annot width cannot be set, well, it can
- % but the appearance and text sizes get mixed up
-% \setbox\scratchbox\vbox to \height{\forgetall\vskip#3\box\scratchbox\vss}%
-% \global\setbox\PDFsymbolbox\vbox
-% {\hsize#2%
-% \forgetall
-% \vsmash{\box\PDFsymbolbox}
-% \box\scratchbox}%
- % this may change when acrobat gets less bugged
- \setbox\scratchbox\vbox to #3{\forgetall\vss\box\scratchbox}%
- \wd\scratchbox#2%
- \global\setbox\PDFsymbolbox\vbox
- {\startoverlay{\box\PDFsymbolbox}{\box\scratchbox}\stopoverlay}%
- \fi
- \fi
- % generic
- \doifobjectreferencefoundelse{FDF}{c::\nofFDFcomments}
- {\doPDFgetobjectreference{FDF}{c::\nofFDFcomments}\PDFobjectreference
- \donetrue}
- \donefalse
- \createpdfannotationobject{FDF}{c:\nofFDFcomments}{\width}{\height}
- {/Subtype /Text
- \ifcase#5 \else/Open true\fi
- % pdftex (efficient)
- % \ifdone /Popup \PDFobjref\pdflastannot\fi
- % generic (less efficient)
- \ifdone /Popup \PDFobjectreference\fi
- /Contents <\PDFdata>
- \PDFidentifier
- \FDFlayer
- \PDFsymbol
- \PDFattributes}%
- \else
- \insertpdfannotation{#2}{#3}
- {/Subtype /Text
- \ifcase#5 \else/Open true\fi
- /Contents <\PDFdata>
- \FDFlayer
- \PDFsymbol
- \PDFidentifier
- \PDFattributes}%
- \fi
- \stopPDFsymbolappearance
- \egroup}
-
-% symbols with a reasonable default of 18/24 pt
-
-\newbox\PDFsymbolbox
-
-\def\PDFsymbolNew {/Insert}
-\def\PDFsymbolBalloon {/Comment}
-\def\PDFsymbolAddition {/NewParagraph}
-\def\PDFsymbolHelp {/Help}
-\def\PDFsymbolParagraph {/Paragraph}
-\def\PDFsymbolKey {/Key }
-
-\def\PDFsymbolGraph {/Graph}
-\def\PDFsymbolPaperclip {/Paperclip}
-\def\PDFsymbolAttachment{/Attachment}
-\def\PDFsymbolTag {/Tag}
-
-\def\startPDFsymbolappearance
- {\setbox\scratchbox\vbox to \totalheight \bgroup \vfill}
-
-\def\stopPDFsymbolappearance
- {\egroup
- \setbox\scratchbox\hbox{\lower\depth\box\scratchbox}%
- \wd\scratchbox\width
- \ht\scratchbox\height
- \dp\scratchbox\depth
- \box\scratchbox}
-
-\def\presetPDFsymbolappearance#1#2#3#4#5% symbol color width height depth
- {\doifelsenothing{#1}
- {\let\PDFattributes\empty}
- {\def\PDFattributes{/C \FDFcolor{#1}}}%
- \scratchdimen#3\edef\width {\the\scratchdimen}%
- \scratchdimen#4\edef\height{\the\scratchdimen}%
- \scratchdimen#5\edef\depth {\the\scratchdimen}%
- \advance\scratchdimen\height\edef\totalheight{\the\scratchdimen}%
- \doifelsenothing{#2}
- {\let\PDFsymbol\empty}
- {\ifundefined{PDFsymbol#2}%
- \getfromcommacommand[#2][1]\let\PDFsymbolnormalsymbol\commalistelement
- \getfromcommacommand[#2][2]\let\PDFsymboldownsymbol \commalistelement
- \doifsymboldefinedelse\PDFsymbolnormalsymbol
- {\doifsymboldefinedelse\PDFsymboldownsymbol
- {\dopresetPDFsymbolappearance
- \PDFsymbolnormalsymbol\PDFsymboldownsymbol}
- {\dopresetPDFsymbolappearance
- \PDFsymbolnormalsymbol\PDFsymbolnormalsymbol}}
- {\doifsymboldefinedelse\PDFsymboldownsymbol
- {\dopresetPDFsymbolappearance
- \PDFsymboldownsymbol\PDFsymboldownsymbol}
- {\let\PDFsymbol\empty}}%
- \else
- \def\PDFsymbol{/Name \getvalue{PDFsymbol#2} }%
- \fi}}
-
-\def\dopresetPDFsymbolappearance#1#2%
- {\dopresetfieldsymbol{#1}%
- \dopresetfieldsymbol{#2}%
- \setbox\scratchbox\hbox{\symbol[#1]}%
- \edef\width {\the\wd\scratchbox}%
- \edef\height{\the\ht\scratchbox}%
- \edef\depth {\the\dp\scratchbox}%
- \scratchdimen\height \advance\scratchdimen\depth
- \edef\totalheight{\the\scratchdimen}%
- \doPDFgetobjectreference{SYM}{#1}\FDFsymbolNappearance
- \doPDFgetobjectreference{SYM}{#2}\FDFsymbolDappearance
- \edef\PDFsymbol
- {/AP <>}}
-
-%D Hooked into \CONTEXT, this special supports
-%D
-%D \starttyping
-%D \startcomment
-%D hello beautiful\\world
-%D \stopcomment
-%D
-%D \startcomment[hello]
-%D de \'e\'erste keer
-%D the f\'irst time
-%D \stopcommen
-%D
-%D \startcommentaar[hallo][color=green,width=4cm,height=3cm]
-%D first
-%D
-%D second
-%D \stopcommentaar
-%D \stoptyping
-%D
-%D So, special characters, forced linebreaks using \type{\\}
-%D and \type{\par} are handled in the appropriate way.
-
-%D \macros
-%D {dosetuppageview}
-%D
-%D Because this command will seldom be called, we can permit
-%D slow action processing. We need three settings, one for
-%D direct \PDF\ inclusion, the other as \PDFTEX\ keyword, an
-%D a last one for form. All determine in what way the
-%D screen is adapted when going to a destination. Watch the
-%D space.
-
-\def\PDFpageviewkey{fit}
-\def\PDFpageviewwrd{/Fit}
-\def\PDFpageview {/View [\PDFpageviewwrd] }
-\def\PDFpagexyzspec{0 0 0} % hack, pdftex does handle this
-\let\PDFpagexyzspec\empty % hack, pdftex does not accept spec
-
-\def\dosetuppageview#1% watch the v-h swapping here
- {\processaction
- [#1]
- [ \v!fit=>\def\PDFpageviewkey {fit}\def\PDFpageviewwrd{/Fit},
- \v!width=>\def\PDFpageviewkey {fith}\def\PDFpageviewwrd{/FitH},
- \v!height=>\def\PDFpageviewkey {fitv}\def\PDFpageviewwrd{/FitV},
- \v!minwidth=>\def\PDFpageviewkey{fitbh}\def\PDFpageviewwrd{/FitBH},
- \v!minheight=>\def\PDFpageviewkey{fitbv}\def\PDFpageviewwrd{/FitBV},
- \v!standard=>\def\PDFpageviewkey{xyz \PDFpagexyzspec}\def\PDFpageviewwrd{/XYZ \PDFpagexyzspec},
- \s!unknown=>\def\PDFpageviewkey {fit}\def\PDFpageviewwrd{/Fit}]%
- \edef\PDFpageview{/View [\PDFpageviewwrd]}}
-
-%D \macros
-%D {setFDFkids}
-%D
-%D Clones as well as radiofields (which themselves can have
-%D cloned components) need a list of kids. The next macro
-%D builds one.
-
-\def\setFDFkids[#1][#2]% tag commalist
- {\let\FDFkids\empty
- \def\docommand##1%
- {\doPDFgetobjectreference{FDF}{#1##1}\PDFobjectreference
- \edef\FDFkids{\FDFkids\PDFobjectreference\space}}%
- \@EA\processcommalist\@EA[#2]\docommand
- \ifx\FDFkids\empty\else\edef\FDFkids{/Kids [\FDFkids]}\fi}
-
-%D \macros
-%D {dopresetlinefield,dopresettextfield,
-%D dopresetchoicefield,dopresetpopupfield,dopresetcombofield,
-%D dopresetpushfield,dopresetcheckfield,
-%D dopresetfield,dopresetradiorecord}
-%D
-%D I would say: read the \PDF\ reference manual first and see
-%D what happens here next. Lucky us that they have so much in
-%D common.
-
-\def\dopresetlinefield#1#2#3#4#5#6#7#8#9%
- {\bgroup
- \setFDFlayer\@@DriverFieldLayer
- \setFDFswitches[#7]%
- \setFDFattributes[#6]%
- \setFDFalignment[#8]%
- \setFDFactions[#9]%
- \edef\FDFtext{\hexifiedPDFstring{#4}}%
- \ifcase\currentFDFmode
- \createpdfannotationobject{FDF}{#1}{#2}{#3}
- {/Subtype /Widget /T (#1) /FT /Tx
- /MaxLen \ifcase0#5 1000 \else#5 \fi
- %/DV (#4) /V (#4) % value added
- /DV <\FDFtext> /V <\FDFtext>
- /Ff \FDFflag\space
- /F \FDFplus\space
- /DA (\FDFattributes)
- \FDFlayer\space
- \FDFsurroundings\space
- /Q \FDFalign\space
- \FDFactions}%
- \registerFDFobject{#1}%
- \or
- \setFDFkids[kids:][\currentFDFkids]%
- \createpdfdictionaryobject{FDF}{#1}
- {/T (#1) /FT /Tx
- /MaxLen \ifcase0#5 1000 \else#5 \fi
- \FDFkids\space
- %/DV (#4) /V (#4) % value added
- /DV <\FDFtext> /V <\FDFtext>
- /Ff \FDFflag\space
- /F \FDFplus\space
- /DA (\FDFattributes)
- \FDFlayer\space
- \FDFsurroundings\space
- /Q \FDFalign\space
- \FDFactions}%
- \registerFDFobject{#1}%
- \or
- \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference
- %\global\objectreferencingtrue
- \createpdfannotationobject{FDF}{kids:#1}{#2}{#3}
- {/Subtype /Widget
- /Parent \PDFobjectreference
- /Ff \FDFflag\space
- /F \FDFplus\space
- /DA (\FDFattributes)
- \FDFlayer\space
- \FDFsurroundings\space
- /Q \FDFalign\space
- \FDFactions}%
- \or
- \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference
- %\global\objectreferencingtrue
- \createpdfannotationobject{FDF}{kids:#1}{#2}{#3}
- {/Subtype /Widget
- /Parent \PDFobjectreference
- /F \FDFplus
- \FDFactions}%
- \fi
- \egroup}
-
-\def\dopresettextfield#1#2#3#4#5#6#7#8#9%
- {\dopresetlinefield{#1}{#2}{#3}{#4}{#5}{#6}{MultiLine,#7}{#8}{#9}}
-
-\def\dopresetchoicefield#1#2#3#4#5#6#7#8%
- {\bgroup
- \setFDFlayer\@@DriverFieldLayer
- \setFDFswitches[#6]%
- \setFDFattributes[#5]%
- \setFDFvalues[#7][#4]%
- \setFDFactions[#8]%
- \ifcase\currentFDFmode
- \createpdfannotationobject{FDF}{#1}{#2}{#3}
- {/Subtype /Widget
- /T (#1) /FT /Ch
- /DV (#4) /V (#4)
- /Ff \FDFflag\space
- /F \FDFplus\space
- /DA (\FDFattributes)
- \FDFlayer\space
- \FDFsurroundings\space
- /Opt [\FDFvalues]
- \FDFactions}%
- \registerFDFobject{#1}%
- \or
- \setFDFkids[kids:][\currentFDFkids]%
- \createpdfdictionaryobject{FDF}{#1}
- {/T (#1) /FT /Ch
- \FDFkids\space
- /DV (#4) /V (#4)
- /Ff \FDFflag\space
- /F \FDFplus\space
- /DA (\FDFattributes)
- \FDFlayer\space
- \FDFsurroundings\space
- /Opt [\FDFvalues]
- \FDFactions}%
- \registerFDFobject{#1}%
- \or
- \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference
- %\global\objectreferencingtrue
- \createpdfannotationobject{FDF}{kids:#1}{#2}{#3}
- {/Subtype /Widget
- /Parent \PDFobjectreference
- /Ff \FDFflag\space
- /F \FDFplus\space
- /DA (\FDFattributes)
- \FDFlayer\space
- \FDFsurroundings\space
- \FDFactions}%
- \or
- \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference
- %\global\objectreferencingtrue
- \createpdfannotationobject{FDF}{kids:#1}{#2}{#3}
- {/Subtype /Widget
- /Parent \PDFobjectreference
- /F \FDFplus
- \FDFactions}%
- \fi
- \egroup}
-
-\def\dopresetpopupfield#1#2#3#4#5#6#7#8%
- {\dopresetchoicefield{#1}{#2}{#3}{#4}{#5}{PopUp,#6}{#7}{#8}}
-
-\def\dopresetcombofield#1#2#3#4#5#6#7#8%
- {\dopresetchoicefield{#1}{#2}{#3}{#4}{#5}{PopUp,Edit,#6}{#7}{#8}}
-
-\newif\ifFDFvalues
-
-\def\doFDFpresetpushcheckfield#1#2#3#4#5#6#7#8% in acro<5 (\FDFdefault)
- {\bgroup % in acro>5 /\FDFdefault
- \setFDFlayer\@@DriverFieldLayer
- \ifcase#8\relax\FDFvaluesfalse\else\FDFvaluestrue\fi
- \setFDFswitches[#5]%
- \setFDFactions[#7]%
- \doifelse{#4}{1}
- {\def\FDFdefault{On}}
- {\def\FDFdefault{Off}}%
- \ifcase\currentFDFmode
- \doFDFappearance{On}{#6}{#8}%
- \createpdfannotationobject{FDF}{#1}{#2}{#3}
- {/Subtype /Widget /T (#1) /FT /Btn
- \ifFDFvalues
- /DV /\FDFdefault\space
- /V /\FDFdefault\space
- /AS /\FDFdefault\space
- \fi
- \FDFlayer
- /Ff \FDFflag\space
- /F \FDFplus\space
- \FDFlayer\space
- \FDFappearance\space
-% /IF << /SW /N >> % strange, only works for stupid buttons
- \FDFactions}%
- \registerFDFobject{#1}%
- \or % no appearance and layer ?
- \setFDFkids[kids:][\currentFDFkids]%
- \createpdfdictionaryobject{FDF}{#1}
- {/T (#1) /FT /Btn
- \FDFkids\space
- \ifFDFvalues
- /DV /\FDFdefault\space
- /V /\FDFdefault\space
- /AS /\FDFdefault\space
- \fi
- /Ff \FDFflag\space
- /F \FDFplus\space
- \FDFactions}%
- \registerFDFobject{#1}%
- \or
- \doFDFappearance{On}{#6}{#8}%
- \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference
- %\global\objectreferencingtrue
- \createpdfannotationobject{FDF}{kids:#1}{#2}{#3}
- {/Subtype /Widget
- /Parent \PDFobjectreference\space
- \ifFDFvalues
- /DV /\FDFdefault\space
- /V /\FDFdefault\space
- /AS /\FDFdefault\space
- \fi
- /Ff \FDFflag\space
- /F \FDFplus\space
- \FDFlayer\space
- \FDFappearance\space
- \FDFactions}%
- \or
- \doFDFappearance{On}{#6}{#8}%
- \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference
- %\global\objectreferencingtrue
- \createpdfannotationobject{FDF}{kids:#1}{#2}{#3}
- {/Subtype /Widget
- /Parent \PDFobjectreference\space
- /F \FDFplus\space
- \ifFDFvalues
- /DV /\FDFdefault\space
- /V /\FDFdefault\space
- /AS /\FDFdefault\space
- \fi
- \FDFlayer\space
- \FDFappearance
- \FDFactions}%
- \fi
- \egroup}
-
-\def\dopresetpushfield#1#2#3#4#5#6#7%
- {\doFDFpresetpushcheckfield{#1}{#2}{#3}{#4}{PushButton,#5}{#6}{#7}{0}}
-
-\def\dopresetcheckfield#1#2#3#4#5#6#7%
- {\doFDFpresetpushcheckfield{#1}{#2}{#3}{#4}{#5}{#6}{#7}{1}}
-
-\def\dopresetradiofield#1#2#3#4#5#6#7#8%
- {\bgroup
- \setFDFlayer\@@DriverFieldLayer
- \FDFvaluestrue
- \setFDFswitches[#5]%
- \setFDFactions[#8]%
- \doifelsenothing{#4}
- {\def\FDFdefault{Off}}
- {\def\FDFdefault{#4}}%
- \@EA\aftersplitstring\FDFdefault\at=>\to\FDFdefaultvalue
- \ifx\FDFdefaultvalue\empty\else\let\FDFdefault\FDFdefaultvalue\fi
- \ifcase\currentFDFmode
- \doFDFappearance{#1}{#7}{1}%
- \doPDFgetobjectreference{FDF}{#6}\PDFobjectreference
- \createpdfannotationobject{FDF}{#1}{#2}{#3}
- {/Subtype /Widget
- /Parent \PDFobjectreference\space
- /F \FDFplus\space
- /AS /\FDFdefault\space
- \FDFlayer\space
- \FDFappearance\space
- \FDFactions}%
- \registerFDFobject{#1}%
- \or
- \setFDFkids[kids:][\currentFDFkids]%
- \doPDFgetobjectreference{FDF}{#6}\PDFobjectreference
- \createpdfdictionaryobject{FDF}{#1}
- {/Parent \PDFobjectreference\space
- \FDFkids\space
- /F \FDFplus\space
- \FDFactions}%
- \registerFDFobject{#1}%
- \or
- %\doFDFappearance{#1}{#7}{1}%
- \doFDFappearance{\currentFDFparent}{#7}{1}%
- \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference
- %\global\objectreferencingtrue % nb
- \createpdfannotationobject{FDF}{kids:#1}{#2}{#3}
- {/Subtype /Widget
- /Parent \PDFobjectreference\space
- /AS /\FDFdefault\space
- /F \FDFplus\space
- \FDFlayer\space
- \FDFappearance\space
- \FDFactions}%
- \or
- %\doFDFappearance{#1}{#7}{1}%
- \doFDFappearance{\currentFDFparent}{#7}{1}%
- \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference
- %\global\objectreferencingtrue
- \createpdfannotationobject{FDF}{kids:#1}{#2}{#3}
- {/Subtype /Widget
- /Parent \PDFobjectreference\space
- /AS /\FDFdefault\space
- /F \FDFplus\space
- \FDFlayer\space
- \FDFappearance\space
- \FDFactions}%
- \fi
- \egroup}
-
-% Beware, RadiosInUnison is really needed in the pre 1.5/6 time this
-% was the default but out of a sudden it's no longer the case. Also
-% the NoToggleToOff interferes with kids of kids and both it will
-% break older documents, i.e. so much for pdf as standard. With
-% features like widgets we can probably best wait till adobe tools
-% themselves support it because that's probably the moment that
-% functionality gets frozen/becomes definitive. Actually, acrobat
-% flattens the kids tree, so that's yet another situation. The
-% interesting thing is that it worked ok in acrobat 2/3 but got bugged
-% in later versions. [The rationale is in html compatibility, which
-% seems to be more important than compatibility of documents, which in
-% turn renders acrobat useless for forms.] Anyway, synchronization is
-% broken or not depending on the combination pdfversion/acrobatversion.
-
-\def\dopresetradiorecord#1#2#3#4#5%
- {\bgroup
- % < pdf 1.5 (1.5 was broken)
- % \setFDFswitches[Radio,NoToggleToOff,RadiosInUnison,#3]%
- % > pdf 1.5
- \setFDFswitches[Radio,RadiosInUnison,#3]%
- % older, else fatal error
- % \setFDFkids[#4][]%
- % newer
- \setFDFvalues[#4][#2]% inits kidlist
- \expanded{\setFDFkids[][\FDFkidlist]}%
- %
- \setFDFactions[#5]%
- \createpdfdictionaryobject{FDF}{#1}
- {%/Subtype /Widget
- /FT /Btn /T (#1) /Rect [0 0 0 0]
- % used to be this
- % /V (#2)
- % then this
- % /DV (#2)
- % since this bomded in 5
- % /V (#2)
- % and now finally this works
- /H /N
- % /opt is buggy in 5.05, only works once, sigh
- %\ifx\FDFfirstvalues\FDFsecondvalues
- /V /#2
- %\else
- % /V /\FDFdefaultindex\space
- % /Opt [\FDFsecondvalues]
- %\fi
- /Ff \FDFflag\space
- /F \FDFplus\space
- \FDFkids\space
- \FDFactions}%
- \egroup}
-
-%D At the cost of some more references, we can save bytes,
-%D by sharing appearance dictionaries. This code needs more
-%D documentation. Surprise:
-
-\def\dodoFDFappearance#1#2%
- {\ifx#2\empty\else
- \dogetcommacommandelement1\from#2\to\commalistelement
- \ifx\commalistelement\empty\else
- \doPDFgetobjectreference{SYM}\commalistelement\PDFobjectreference
- \edef\N{\ifFDFvalues\N /#1 \fi\PDFobjectreference\space}%
- \fi
- \dogetcommacommandelement2\from#2\to\commalistelement
- \ifx\commalistelement\empty\else
- \doPDFgetobjectreference{SYM}\commalistelement\PDFobjectreference
- \edef\R{\ifFDFvalues\R /#1 \fi\PDFobjectreference\space}%
- \fi
- \dogetcommacommandelement3\from#2\to\commalistelement
- \ifx\commalistelement\empty\else
- \doPDFgetobjectreference{SYM}\commalistelement\PDFobjectreference
- \edef\D{\ifFDFvalues\D /#1 \fi\PDFobjectreference\space}%
- \def\FDFappearance{/H /P }%
- \fi
- \fi}
-
-\def\redoFDFappearance#1%
- {\ifx#1\empty\else
- \dogetcommacommandelement3\from#1\to\commalistelement
- \ifx\commalistelement\empty\else
- \def\FDFappearance{/H /P }%
- \fi
- \fi}
-
-\def\doFDFappearance#1#2#3%
- {\ifcase#3\relax % push only field
- \edef\yes{#2}%
- \let\no\empty
- \else % on / off field
- \dogetcommacommandelement1\from#2,\to\yes
- \dogetcommacommandelement2\from#2,\to\no
- \fi
- \def\FDFappearance{/H /N}%
- \doifobjectfoundelse{FDF}{ap:#1:\yes:\no}
- {\redoFDFappearance\yes
- \redoFDFappearance\no}
- {\presetobject{FDF}{ap:#1:\yes:\no}% funny hack
- \let\N\empty\let\R\empty\let\D\empty
- \dodoFDFappearance{#1}\yes
- \dodoFDFappearance{Off}\no
- \createpdfdictionaryobject{FDF}{ap:#1:\yes:\no}
- {\ifx\N\empty\else/N \ifFDFvalues<<\N>>\else\N\fi\fi
- \ifx\R\empty\else/R \ifFDFvalues<<\R>>\else\R\fi\fi
- \ifx\D\empty\else/D \ifFDFvalues<<\D>>\else\D\fi\fi}}%
- \doPDFgetobjectreference{FDF}{ap:#1:\yes:\no}\PDFobjectreference
- \edef\FDFappearance{\FDFappearance /AP \PDFobjectreference}}
-
-\def\doFDFdefault#1#2%
- {\doifelse{#2}{1}{\def\FDFdefault{On}}{\def\FDFdefault{Off}}}
-
-%D Layer support:
-
-\def\setFDFlayer#1% todo : \ifx\PDFobjectreference\noPDFobjectreference ipv found
- {\letempty\FDFlayer
- \doifsomething{#1}%
- {\checkproperty[#1]% == \dodocheckproperty\@@DriverFieldLayer
- \doifobjectreferencefoundelse{PDLN}{#1}
- {\doPDFgetobjectreference{PDLN}{#1}\!!stringa % we need to avoid a clash with other macros
- \edef\FDFlayer{/OC \!!stringa}}%
- \donothing}}
-
-%D The three appearances {\em normal}, \type{roll over} and
-%D \type{push down} are passed as comma separated triplets,
-%D that is, the second argument can look like:
-%D
-%D \starttyping
-%D {yes,ok,fine},{no,rubish,awful}
-%D \stoptyping
-
-%D \macros
-%D {dodefinefieldset,dogetfieldset,doiffieldset}
-%D
-%D Field sets, the ones we use in submitting and resetting
-%D fields, are implemented using the next low level specials:
-%D
-%D \starttyping
-%D \doFDFdefinefieldset{TAG}{name,name,...}
-%D \doFDFgetfieldset{TAG}
-%D \doiffieldset{TAG}{sequence}
-%D \stoptyping
-
-\def\dodefinefieldset#1#2% tag commalist
- {\let\FDFfieldset\empty
- \def\docommand##1%
- {\doPDFgetobjectreference{FDF}{##1}\PDFobjectreference
- \edef\FDFfieldset{\FDFfieldset\PDFobjectreference\space}}%
- \processcommacommand[#2]\docommand % nb: command
- \setevalue{FDF:set:#1}{\FDFfieldset}}
-
-\def\dogetfieldset#1%
- {\getvalue{FDF:set:#1}}
-
-\def\doiffieldset#1#2%
- {\ifundefined{FDF:set:#1}\else#2\fi}
-
-%D \macros
-%D {defaultobjectreference,doPDFgetobjectreference}
-%D
-%D Because in \PDFTEX\ we have to construct the object
-%D references \type{N 0 R}, we can default to the non existing
-%D zero object number.
-
-\def\defaultobjectreference#1#2%
- {0}
-
-\def\doPDFgetobjectreference#1#2#3%
- {\dogetobjectreference{#1}{#2}#3%
- \edef#3{\ifx#3\empty null\else\PDFobjref{#3}\fi}}
-
-\def\doPDFgetobjectnumber#1#2#3%
- {\dogetobjectreference{#1}{#2}#3%
- \edef#3{\ifx#3\empty 0\else#3\fi}}
-
-\def\doPDFgetobjectpage#1#2#3%
- {\dogetobjectreferencepage{#1}{#2}#3%
- \ifx#3\empty\def#3{1}\fi}
+\def\doPDFgetobjectpage#1#2#3%
+ {\dogetobjectreferencepage{#1}{#2}#3%
+ \ifx#3\empty\def#3{\realfolio}\fi}
\def\doPDFgetobjectpagereference#1#2#3%
{\dogetobjectreferencepage{#1}{#2}#3%
- \ifx#3\empty
- \doPDFgetpagereference\realfolio#3%
- \else
- \doPDFgetpagereference#3#3% we assume that #3 gets expanded
- \fi}
-
-\def\doPDFgetpagereference#1#2% number macro
- {\edef#2{\ifnum#1>\zerocount\PDFobjref{\pdfpageref#1}\else null\fi}}
-
-\def\thePDFpagereference#1#2% number macro
- {\ifnum#1>\zerocount\PDFobjref{\pdfpageref#1}\else null\fi}
-
-%D \macros
-%D {initializePDFnegative,initializePDFoverprint}
-%D
-%D Here follow some rather obscure macros. They will only
-%D come into action when one wants negated output.
-
-\def\initializePDFnegative
- {\immediate\pdfobj stream attr {/FunctionType 4 /Range [0 1] /Domain [0 1]} {{1 exch sub}}%
- \immediate\pdfobj{<>}%
- \appendtoPDFdocumentextgstates{/GSnegative \PDFobjref\pdflastobj}%
- \immediate\pdfobj{<>}%
- \appendtoPDFdocumentextgstates{/GSpositive \PDFobjref\pdflastobj}%
- \global\let\initializePDFnegative\relax}
-
-\def\initializePDFoverprint
- {\immediate\pdfobj{<>}% /op defaults to /OP
- \appendtoPDFdocumentextgstates{/GSknockout \PDFobjref\pdflastobj}%
- \immediate\pdfobj{<>}% /op defaults to /OP
- \edef\PDFobjectreferenceB{\the\pdflastobj}%
- \appendtoPDFdocumentextgstates{/GSoverprint \PDFobjref\pdflastobj}%
- \global\let\initializePDFoverprint\relax}
-
-%D File embedding. Storing the stream identifier is needed
-%D to get access to the number. When typeset, the user can
-%D feed this number to \type {pdftosrc} and filter the
-%D file from the \PDF\ file.
-
-\let\PDFlaststreamobject \s!unknown
-%def\PDFlaststreamreference{0 0 R}
-
-\def\doPDFfilestreamobject#1#2#3#4%
- {\immediate\pdfobj stream file{#4}%
- \edef\PDFlaststreamobject{\the\pdflastobj}%
- \dosetobjectreference{PDFFS}{#2}{\PDFlaststreamobject}%
- \createpdfdictionaryobject{#1}{#2}{/Type /Filespec /F (#3) /EF <>}}
-
-\def\doPDFgetfilestreamreference#1#2%
- {\doPDFgetobjectreference{PDFFS}{#1}#2}
-
-\def\doPDFfilestreamidentifier#1%
- {\doifsomething{#1}
- {\doPDFgetfilestreamreference{#1}\PDFobjectreference
- \@EA\beforesplitstring\PDFobjectreference\at{ }\to\PDFlaststreamobject
- \PDFlaststreamobject}}
-
-% MP ?
-
- \def\setMPPDFobject#1#2% resources boxnumber
- {\the\everyPDFxform
- \finalizeobjectbox{#2}%
- \immediate\pdfxform resources{#1}#2%
- \edef\getMPPDFobject{\noexpand\pdfrefxform\the\pdflastxform}}
-
- \let\getMPPDFobject\relax
-
- \def\doinsertMPfile#1%
- {\doiffileelse{./#1}{\includeMPasPDF{./#1}}{\message{[MP #1]}}}
-
-%D Even newer trickery:
-
-% resource -> prop -> mc's -> OCG|OCMD (nested)
-% ocg:
-% /Intent/Design
-% ocmd
-% /P /AllOn
-% kan zelf ocmd bevatten
-
-\let\PDFtextlayers\empty
-\let\PDFpagelayers\empty
-\let\PDFhidelayers\empty
-\let\PDFvidelayers\empty
-
-\def\dostartlayer#1{\PDFcode{/OC /#1 BDC}}
-\def\dostoplayer {\PDFcode {EMC}}
-
-\def\dodefineviewerlayer#1#2#3#4#5% tag title visible type printable
- {\createpdfdictionaryobject{PDLN}{#1}
- {/Type /OCG
- \ifcase#4 \or
- /Intent /Design % disable layer hiding by user
- \fi
- \ifnum#5=\zerocount
- /Usage << /Print << /PrintState /OFF >> >> % printable or not
- \fi
- /Name (#2)}%
- \doPDFgetobjectreference{PDLN}{#1}\PDFobjectreference
- \xdef\PDFtextlayers{\PDFtextlayers\space\PDFobjectreference}%
- \doifelse{#3}\v!start
- {\xdef\PDFvidelayers{\PDFvidelayers\space\PDFobjectreference}}%
- {\xdef\PDFhidelayers{\PDFhidelayers\space\PDFobjectreference}}%
- \createpdfdictionaryobject{PDLD}{#1}
- {/Type /OCMD
- /OCGs [\PDFobjectreference]}%
- \doPDFgetobjectreference{PDLD}{#1}\PDFobjectreference
- \xdef\PDFpagelayers{\PDFpagelayers\space /#1 \PDFobjectreference}}
-
-\def\flushPDFtextlayers
- {\ifx\PDFtextlayers\empty \else
- \driverreferenced \createpdfarrayobject{PDF}{textlayers}{\PDFtextlayers}%
- \doPDFgetobjectreference{PDF}{textlayers}\!!stringa
- \ifx\PDFvidelayers\empty
- \def\!!stringb{[null]}%
- \else
- \driverreferenced \createpdfarrayobject{PDF}{videlayers}{\PDFvidelayers}%
- \doPDFgetobjectreference{PDF}{videlayers}\!!stringb
- \fi
- \ifx\PDFhidelayers\empty
- \def\!!stringc{[null]}%
- \else
- \driverreferenced \createpdfarrayobject{PDF}{hidelayers}{\PDFhidelayers}%
- \doPDFgetobjectreference{PDF}{hidelayers}\!!stringc
- \fi
- \appendtopdfcatalog
- {/OCProperties
- << % display in menu
- /D << /Order \!!stringa
- /ON \!!stringb
- /OFF \!!stringc >>
- % used properties
- /OCGs \!!stringa >>}%
- \globallet\flushPDFtextlayers\relax
- \fi}
-
-\def\flushPDFpagelayers
- {\ifx\PDFpagelayers\empty \else
- \appendtopdfpageresources{/Properties <<\PDFpagelayers>>}%
- \fi}
-
-\def\PDFlayeractionlist{null}
-
-\def\PDFexecutehidelayer {/SetOCGState /State [/OFF \PDFlayeractionlist]}
-\def\PDFexecutevidelayer {/SetOCGState /State [/ON \PDFlayeractionlist]}
-\def\PDFexecutetogglelayer {/SetOCGState /State [/Toggle \PDFlayeractionlist]}
-
-\def\domakeviewerlayerlist#1%
- {\bgroup
- \globallet\PDFlayeractionlist\empty
- \def\docommand##1%
- {\doPDFgetobjectreference{PDLN}{##1}\PDFobjectreference
- \xdef\PDFlayeractionlist{\PDFlayeractionlist\space\PDFobjectreference}}%
- \processcommalist[#1]\docommand
- \egroup}
-
-%D Something rather pdf dependent:
-
-% #1 => 1=fill 2=stroke 3=strokedfill 4=invisible
-% #2 => linewidth
-% #3 => spacing (beware, one needs to set the hsize as well)
-
-\def\dostartfonteffect#1#2#3%
- {\ifdim#2>\zeropoint
- \PointsToBigPoints{#2}\ascii
- \PDFcode{\ascii\space w}%
- \fi
- \ifdim#3\points=\onepoint\else
- \scratchdimen#3\points
- \PDFcode{\withoutpt{\the\scratchdimen}\space Tc}%
- \fi
- \PDFcode{\purenumber#1 Tr}}
-
-\def\dostopfonteffect
- {\PDFcode{1 w 0 Tc 0 Tr}}
-
-%D Handy for the \METAPOST\ to \PDF\ converter:
-
-\appendtoksonce
- \collectPDFresources
- \global\let\currentPDFresources\collectedPDFresources
-\to \everyPDFxform
-
-\let\collectedPDFresources\empty
-
-\def\collectPDFresources % suboptimal
- {\doifobjectreferencefoundelse{FDF}{docushades} % redundant, we have an reserved object now
- {\doPDFgetobjectreference{FDF}{docushades}\PDFobjectreference
- \xdef\collectedPDFresources{\collectedPDFresources/Shading \PDFobjectreference}}\donothing
- \doifobjectreferencefoundelse{FDF}{docuextgstates}
- {\doPDFgetobjectreference{FDF}{docuextgstates}\PDFobjectreference
- \xdef\collectedPDFresources{\collectedPDFresources/ExtGState \PDFobjectreference}}\donothing
- \doifobjectreferencefoundelse{FDF}{colorspaces}
- {\doPDFgetobjectreference{FDF}{colorspaces}\PDFobjectreference
- \xdef\collectedPDFresources{\collectedPDFresources/ColorSpace \PDFobjectreference}}\donothing
- \global\let\collectPDFresources\relax}
-
-\appendtoks
- \flushPDFpagelayers
- \flushJSpreamble
- \flushJSpreamble
- \checkPDFextgstates
- \checkPDFcolorspaces
- \checkPDFshades
- \checkPDFpageactions
- \fakePDFpagedestination
- \flushPDFpageboxes
- \addPDFdocumentinfo
-\to \everybackendshipout
-
-\appendtoks
- \flushPDFtextlayers
- \finalflushJSpreamble
-\to \everylastbackendshipout
-
-%D Temporary hack:
-
-\def\TransparencyHack % png: /CS /DeviceRGB /I true
- {\appendtoksonce
- \appendtopdfpageattributes{/Group << /S /Transparency /I true /K true>>}%
- \to \everyPDFxform
- \appendtoksonce
- \appendtopdfpageattributes{/Group << /S /Transparency /I true /K true>>}%
- \to \everyshipout}
+ \doPDFgetpagereference{\ifx#3\empty\realfolio\else#3\fi}#3}
+
+\def\predefinesymbol[#1]%
+ {\begingroup
+ \setobject{SYM}{#1}\hbox{\symbol[#1]}%
+ \dogetobjectreference{SYM}{#1}\lastref
+ \ctxlua{backends.codeinjections.registersymbol("#1",\lastref)}%
+ \endgroup}
\protect \endinput
diff --git a/tex/context/base/bibl-bib.mkiv b/tex/context/base/bibl-bib.mkiv
new file mode 100644
index 000000000..51db67ed7
--- /dev/null
+++ b/tex/context/base/bibl-bib.mkiv
@@ -0,0 +1,29 @@
+%D \module
+%D [ file=bibl-bib,
+%D version=2007.08.17,
+%D title=\CONTEXT\ Bibliography Support,
+%D subtitle=Initialization,
+%D author=Hans Hagen \& Taco Hoekwater,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Bibliography Support / BibTeX}
+
+\registerctxluafile{bibl-bib}{1.001}
+
+\unprotect
+
+\def\definebibtexsession [#1]{\ctxlua{commands.definebibtexsession("#1")}}
+\def\preparebibtexsession [#1]{\ctxlua{commands.preparebibtexsession("#1")}}
+\def\registerbibtexfile {\dodoubleargument\doregisterbibtexfile}
+\def\doregisterbibtexfile [#1][#2]{\ctxlua{commands.registerbibtexfile("#1","#2")}} % also the fast one
+\def\registerbibtexentry {\dodoubleargument\doregisterbibtexentry}
+\def\doregisterbibtexentry [#1][#2]{\ctxlua{commands.registerbibtexentry("#1","#2")}} % also the fast one
+\def\applytobibtexsession {\dodoubleargument\doapplytobibtexsession}
+\def\doapplytobibtexsession[#1][#2]{\xmlprocessregistered{bibtex:#1}{#2}{#2}}
+
+\protect \endinput
diff --git a/tex/context/base/bibl-bib.tex b/tex/context/base/bibl-bib.tex
deleted file mode 100644
index 51db67ed7..000000000
--- a/tex/context/base/bibl-bib.tex
+++ /dev/null
@@ -1,29 +0,0 @@
-%D \module
-%D [ file=bibl-bib,
-%D version=2007.08.17,
-%D title=\CONTEXT\ Bibliography Support,
-%D subtitle=Initialization,
-%D author=Hans Hagen \& Taco Hoekwater,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Bibliography Support / BibTeX}
-
-\registerctxluafile{bibl-bib}{1.001}
-
-\unprotect
-
-\def\definebibtexsession [#1]{\ctxlua{commands.definebibtexsession("#1")}}
-\def\preparebibtexsession [#1]{\ctxlua{commands.preparebibtexsession("#1")}}
-\def\registerbibtexfile {\dodoubleargument\doregisterbibtexfile}
-\def\doregisterbibtexfile [#1][#2]{\ctxlua{commands.registerbibtexfile("#1","#2")}} % also the fast one
-\def\registerbibtexentry {\dodoubleargument\doregisterbibtexentry}
-\def\doregisterbibtexentry [#1][#2]{\ctxlua{commands.registerbibtexentry("#1","#2")}} % also the fast one
-\def\applytobibtexsession {\dodoubleargument\doapplytobibtexsession}
-\def\doapplytobibtexsession[#1][#2]{\xmlprocessregistered{bibtex:#1}{#2}{#2}}
-
-\protect \endinput
diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua
index 4be320f76..5b13f669a 100644
--- a/tex/context/base/buff-ini.lua
+++ b/tex/context/base/buff-ini.lua
@@ -31,6 +31,10 @@ local ctxcatcodes = tex.ctxcatcodes
local data, commands, flags, hooks, visualizers = buffers.data, buffers.commands, buffers.flags, buffers.hooks, buffers.visualizers
+function buffers.raw(name)
+ return data[name] or { }
+end
+
function buffers.erase(name)
data[name] = nil
end
@@ -484,3 +488,48 @@ function buffers.flush_result(result,nested)
texsprint(ctxcatcodes,concat(result,""))
end
end
+
+-- THIS WILL BECOME A FRAMEWORK: the problem with prety printing is that
+-- we deal with snippets and therefore we need tolerant parsing
+
+--~ local type = type
+
+--~ visualizers = visualizers or { }
+
+--~ local function fallback(s) return s end
+
+--~ function visualizers.visualize(visualizer,kind,pattern)
+--~ if type(visualizer) == "table" and type(kind) == "string" then
+--~ kind = visualizer[kind] or visualizer.default or fallback
+--~ else
+--~ kind = fallback
+--~ end
+--~ return (lpeg.C(pattern))/kind
+--~ end
+
+--~ local flusher = texio.write
+--~ local format = string.format
+
+--~ local visualizer = {
+--~ word = function(s) return flusher(format("\\bold{%s}",s)) end,
+--~ number = function(s) return flusher(format("\\slanted{%s}",s)) end,
+--~ default = function(s) return flusher(s) end,
+--~ }
+
+--~ local word = lpeg.R("AZ","az")^1
+--~ local number = lpeg.R("09")^1
+--~ local any = lpeg.P(1)
+
+--~ local pattern = lpeg.P { "start",
+--~ start = (
+--~ visualizers.visualize(visualizer,"word",word) +
+--~ visualizers.visualize(visualizer,"number",number) +
+--~ visualizers.visualize(visualizer,"default",any)
+--~ )^1
+--~ }
+
+--~ str = [[test 123 test $oeps$]]
+
+--~ pattern:match(str)
+
+
diff --git a/tex/context/base/buff-ini.mkiv b/tex/context/base/buff-ini.mkiv
index c9c1ae052..29ce4687d 100644
--- a/tex/context/base/buff-ini.mkiv
+++ b/tex/context/base/buff-ini.mkiv
@@ -15,6 +15,41 @@
\registerctxluafile{buff-ini}{1.001}
+% todo:
+%
+% \startluacode
+% local locations = { }
+% function document.set_number(name)
+% locations[name] = {
+% line = status.linenumber,
+% file = status.filename
+% }
+% end
+% function document.add_number(name)
+% local b, l = buffers.raw(name), locations[name]
+% if b and l then
+% for i=1,#b do
+% b[i] = string.gsub(b[i],"# line: ","# line: " .. l.line + 2)
+% end
+% end
+% end
+% \stopluacode
+%
+% \starttext
+%
+% \ctxlua{document.set_number("oeps")}
+% \startbuffer[oeps]
+% # line:
+%
+% test
+% test
+% \stopbuffer
+% \ctxlua{document.add_number("oeps")}
+%
+% \typebuffer[oeps]
+%
+% \stoptext
+
\ifdefined\doinitializeverbatim \else% temp hack
\ifdefined\mkinitializeverbatim
\let\doinitializeverbatim\mkinitializeverbatim
diff --git a/tex/context/base/buff-ver.mkii b/tex/context/base/buff-ver.mkii
index c9ad8cbc9..8c2929a4b 100644
--- a/tex/context/base/buff-ver.mkii
+++ b/tex/context/base/buff-ver.mkii
@@ -60,7 +60,7 @@
\restorecatcodes % also needed when loading during \newpretty
\startreadingfile % restore < and > if needed
\lowercasestring verb-\prettyidentifier.tex\to\filename
- \readsysfile\filename\donothing\donothing
+ \readsysfile{\filename.mkii}\donothing\donothing
\stopreadingfile
\stopnointerference}%
\doifdefinedelse{setuppretty\prettyidentifier type}%
diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv
index aed357de8..53ad235fe 100644
--- a/tex/context/base/buff-ver.mkiv
+++ b/tex/context/base/buff-ver.mkiv
@@ -142,7 +142,6 @@
\def\obs{\obeyedspace}%
\ctxlua{buffers.doifelsevisualizer("\prettyidentifier")}
{\ctxlua{buffers.setvisualizer("\prettyidentifier")}%
- \localcolortrue % tricky, maybe not here
\def\bop{\bgroup\beginofpretty}%
\def\eop{\endofpretty\egroup}%
\def\sop{\endofpretty\egroup\bgroup\beginofpretty}}%
@@ -568,14 +567,14 @@
\ctxlua{buffers.typefile("\readfilename")}%
#2}
-\def\dotypeblockverbatim#1#2%
+\unexpanded\def\dotypeblockverbatim#1#2%
{\dowithbuffer{_typing_}{#1}{#2}
{}
{\doinitializeverbatim
\beginofverbatimlines
\ctxlua{buffers.type("_typing_")}%
\endofverbatimlines
- \getvalue{\strippedcsname#2}}}
+ \csname#2\endcsname}}
\def\dododostarttyping[#1]%
{\typingparameter\c!before
@@ -583,7 +582,7 @@
\dosetuptypelinenumbering{#1}%
\initializetyping
\startverbatimcolor
- \expanded{\dotypeblockverbatim{\s!start\currenttyping}{\s!stop\currenttyping}}}
+ \normalexpanded{\dotypeblockverbatim{\e!start\currenttyping}{\e!stop\currenttyping}}} % was s!start
\def\dostoptyping#1% hm, currenttyping
{\stopverbatimcolor
@@ -753,8 +752,9 @@
\fi\fi}
\def\dosetuptypelinenumbering#1% fuzzy
- {\doifundefined{\currenttypingclass\currenttyping\c!start}
- {\setuptyping[\currenttyping][\c!start=1,\c!stop=,\c!step=1,\c!nlines=]}%
+ {\ifcsname\currenttypingclass\currenttyping\c!start\endcsname \else
+ \setuptyping[\currenttyping][\c!start=1,\c!stop=,\c!step=1,\c!nlines=]%
+ \fi
\setuptyping[\currenttyping][#1]%
\doifelse{\typingparameter\c!numbering}\v!file
{% kind of special: filters lines !
@@ -804,11 +804,13 @@
\settypingparameter\c!option{\prettyidentifier}}%
\initializetyping
\startverbatimcolor
- \doifundefinedelse{\currenttypingclass#3\v!global\c!start}
- {\scratchcounter\zerocount}
- {\scratchcounter\getvalue{\currenttypingclass#3\v!global\c!start}}%
- \advance\scratchcounter\plusone
- \setxvalue{\currenttypingclass#3\v!global\c!start}{\the\scratchcounter}%
+ \scratchcounter
+ \ifcsname\currenttypingclass#3\v!global\c!start\endcsname
+ \numexpr\csname\currenttypingclass#3\v!global\c!start\endcsname+\plusone\relax
+ \else
+ \plusone
+ \fi
+ \setxvalue{\currenttypingclass#3\v!global\c!start}{\the\scratchcounter}% no direct setxvalue as it defines beforehand
\doifelsenothing{\typingparameter\c!start}
{#4}
{\doif{\typingparameter\c!start}\v!continue
diff --git a/tex/context/base/catc-ctx.tex b/tex/context/base/catc-ctx.tex
index 028ae496c..83e802e77 100644
--- a/tex/context/base/catc-ctx.tex
+++ b/tex/context/base/catc-ctx.tex
@@ -205,3 +205,46 @@
\let\xmlcatcodes \xmlcatcodesn
\endinput
+
+% under consideration:
+%
+% \newcatcodetable\txtcatcodes
+%
+% \startcatcodetable \txtcatcodes
+% \catcode`\^^I = 10
+% \catcode`\^^M = 5
+% \catcode`\^^L = 5
+% \catcode`\ = 10
+% \catcode`\\ = 0
+% \catcode`\{ = 1
+% \catcode`\} = 2
+% \stopcatcodetable
+%
+% \newcount\relaxedcatcodedepth
+%
+% \def\startrelaxedcatcodes
+% {\global\chardef\relaxedcatcodeparent\catcodetable
+% \global\advance\relaxedcatcodedepth\plusone
+% \nonknuthmode\setcatcodetable\txtcatcodes}
+%
+% \def\stoprelaxedcatcodes
+% {\ifcase\relaxedcatcodedepth
+% % error
+% \or
+% \setcatcodetable\relaxedcatcodeparent
+% \global\relaxedcatcodedepth\zerocount
+% \else
+% \global\advance\relaxedcatcodedepth\minusone
+% \setcatcodetable\txtcatcodes
+% \fi}
+%
+% \starttext
+%
+% \startrelaxedcatcodes
+% \startcomment test \stopcomment
+% test $ test 10% whatever|test \mathematics{x^2=1}
+% \stoprelaxedcatcodes
+%
+% $x^2=1$
+%
+% \stoptext
diff --git a/tex/context/base/catc-sym.tex b/tex/context/base/catc-sym.tex
index 49d94815c..da6c9c068 100644
--- a/tex/context/base/catc-sym.tex
+++ b/tex/context/base/catc-sym.tex
@@ -115,4 +115,73 @@
\egroup
+%D (Inspired by a discussion on the \CONTEXT\ mailing list)
+%D
+%D In \TEX\ each character can have one of 16 catcodes. This way the
+%D backslash, dollar, ampersand, hash and some more characters get
+%D their special meaning. If you want to process tokens under a
+%D certain catcode regime, passing arguments can interfere badly.
+%D
+%D \startbuffer[a]
+%D \def\whatever#1{[#1]}
+%D \whatever{whatever \type {\whatever{you want}} $or$ not!}
+%D \stopbuffer
+%D
+%D \typebuffer[a]
+%D
+%D Here we pass an argument to \type {\whatever} but part of that
+%D argument is to be processed under a different catcode regime, i.e.\
+%D all characters that need to be typeset verbatim need to get
+%D the catcode that makes it a letter. This is what we get when we typeset
+%D the text verbatim:
+%D
+%D \starttyping
+%D whatever \type {\whatever{you want}} $or$ not!
+%D \stoptyping
+%D
+%D However, when passed to \type {\whatever} we get:
+%D
+%D \getbuffer[a]
+%D
+%D In \ETEX\ one can use \type {\scantokens} to circumvent this problem.
+%D
+%D \startbuffer[b]
+%D \def\rescan#1{\scantokens{#1}}
+%D \def\whatever#1{[\rescan{#1}]}
+%D \whatever{whatever \type {\whatever{you want}} $or$ not!}
+%D \stopbuffer
+%D
+%D \getbuffer[b] \typebuffer[b]
+%D
+%D This time the \type {\whatever} call gives:
+%D
+%D \getbuffer[b]
+%D
+%D In this example, two spaces have crept in. The first one, after the
+%D macro name, is inserted by \TEX\ and cannot be avoided. The last space
+%D is inserted by \type {\scantokens}, and is the consequence of the fact
+%D that this macro mimics reading from a file. You can avoid the last
+%D space by a slightly different definition:
+%D
+%D \startbuffer[c]
+%D \def\rescan#1{\scantokens{#1\ignorespaces}}
+%D \def\whatever#1{[\rescan{#1}]}
+%D \whatever{whatever \type {\whatever{you want}} $or$ not!}
+%D \stopbuffer
+%D
+%D \typebuffer[c]
+%D
+%D Unfortunately we still keep the first space, but at least it's better than
+%D a failure:
+%D
+%D \getbuffer[c]
+
+\long\def\rescan#1{\scantokens{#1\ignorespaces}}
+\long\def\rescanwithsetup#1#2{\begingroup\directsetup{#1}\scantokens{#2\ignorespaces}\endgroup}
+
+\ifx\scantextokens\undefined \else
+ \long\def\rescan#1{\scantextokens{#1}}
+ \long\def\rescanwithsetup#1#2{\begingroup\directsetup{#1}\scantextokens{#2}\endgroup}
+\fi
+
\protect \endinput
diff --git a/tex/context/base/colo-ext.mkiv b/tex/context/base/colo-ext.mkiv
index 06facd34e..274086bb6 100644
--- a/tex/context/base/colo-ext.mkiv
+++ b/tex/context/base/colo-ext.mkiv
@@ -32,7 +32,7 @@
\def\negatecolorbox#1%
{\setbox#1\hbox
{\dostartnegative
- \localstartcolor[white]\vrule\!!height\ht#1\!!depth\dp#1\!!width\wd#1\localstopcolor
+ \startcolor[white]\vrule\!!height\ht#1\!!depth\dp#1\!!width\wd#1\stopcolor
\hskip-\wd#1%
\box#1%
\dostopnegative}}
diff --git a/tex/context/base/colo-hex.mkii b/tex/context/base/colo-hex.mkii
index dac2e46d0..7cef6e8a2 100644
--- a/tex/context/base/colo-hex.mkii
+++ b/tex/context/base/colo-hex.mkii
@@ -38,7 +38,17 @@
\unprotect
-\newdimen\hexcolorfraction \hexcolorfraction=\dimexpr(1pt/256)
+% \definecolor[rgbtestcolor] [r=0.87843,g=0.87451,b=0.89020] % RGB(224,223,227)
+% \definecolor[hextestcolor] [h=E0DFE3]
+%
+% \startMPpage
+% path p ; % example by Peter Rolf
+% p := unitsquare xyscaled(5cm,5cm) ;
+% fill (point 0 of p -- point 1 of p -- point 2 of p --cycle) withcolor \MPcolor{rgbtestcolor} ; % bottom right part of the square
+% fill (point 0 of p -- point 3 of p -- point 2 of p --cycle) withcolor \MPcolor{hextestcolor} ; % top left part
+% \stopMPpage
+
+\newdimen\hexcolorfraction \hexcolorfraction=\dimexpr1pt/255\relax
\chardef\hexcolorprefix=`#
@@ -49,7 +59,7 @@
\def\hexcolorcomponent#1#2%
{\ifnum\dohexstringtonumber#1#2=\zerocount0\else\ifnum\dohexstringtonumber#1#2=\plusone1\else
- \expandafter\withoutpt\the\dimexpr(\dohexstringtonumber#1#2\hexcolorfraction)%
+ \expandafter\withoutpt\the\dimexpr\dohexstringtonumber#1#2\hexcolorfraction\relax
\fi\fi}
\def\dohexcolorspec#1#2#3#4#5#6#7#8\relax
@@ -98,7 +108,7 @@
\def\colorhexcomponent#1%
{\ifdim#1\points<.005\points
- 00\else\lchexnumbers{\the\dimexpr(255\dimexpr(#1\points)\relax+.5\points)\relax}%
+ 00\else\lchexnumbers{\the\dimexpr255\dimexpr#1\points\relax+.5\points\relax}%
\fi}
% the faster one
@@ -109,7 +119,7 @@
\def\colorhexcomponent#1%
{\ifdim#1\points<\hex@color@a
- 00\else\lchexnumbers{\the\dimexpr(#1\points*\hex@color@c+\hex@color@b)\relax}%
+ 00\else\lchexnumbers{\the\dimexpr#1\points*\hex@color@c+\hex@color@b\relax}%
\fi}
\protect \endinput
diff --git a/tex/context/base/colo-hex.mkiv b/tex/context/base/colo-hex.mkiv
index b31321b7e..dd8e03938 100644
--- a/tex/context/base/colo-hex.mkiv
+++ b/tex/context/base/colo-hex.mkiv
@@ -11,105 +11,16 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-%D Not yet supported in \MKIV.
+%D This is built in.
-\endinput
-
-\writestatus{loading}{ConTeXt Color Macros / Hexadecimal}
-
-% \edef\testcolor{\string#FFC0C0}
-% \edef\testcolor{\string#55}
-%
-% \setupcolors[state=start]
-%
-% \expanded{\definecolor[thehexcolor][\hexcolorspec\testcolor]}
-%
-% \checkhexcolor[\testcolor]
-%
-% \definecolor[thehexcolor][\testcolor]
-%
-% \starttext
+% \definecolor[rgbtestcolor] [r=0.87843,g=0.87451,b=0.89020] % RGB(224,223,227)
+% \definecolor[hextestcolor] [\letterhash E0DFE3] % or [h=E0DFE3]
%
-% test \color[thehexcolor]{rood}
-% test \color[red]{rood}
-% test \color[\testcolor]{rood}
-%
-% \stoptext
-
-\unprotect
-
-\newdimen\hexcolorfraction \hexcolorfraction=\dimexpr1pt/256\relax
-
-\chardef\hexcolorprefix=`#
-
-\def\hexcolorspec #1{\expandafter\dohexcolorspec #1\empty\empty\empty\empty\relax}
-\def\hexcolorpattern#1{\expandafter\dohexcolorpattern#1\empty\empty\empty\empty\relax}
-
-\ifx\dohexstringtonumber\undefined \def\dohexstringtonumber{"} \fi
-
-\def\hexcolorcomponent#1#2%
- {\ifnum\dohexstringtonumber#1#2=\zerocount0\else\ifnum\dohexstringtonumber#1#2=\plusone1\else
- \expandafter\withoutpt\the\dimexpr(\dohexstringtonumber#1#2\hexcolorfraction)%
- \fi\fi}
-
-\def\dohexcolorspec#1#2#3#4#5#6#7#8\relax
- {\ifx#4\empty
- s=\hexcolorcomponent#2#3%
- \else
- r=\hexcolorcomponent#2#3,g=\hexcolorcomponent#4#5,b=\hexcolorcomponent#6#7%
- \fi}
+% \startMPpage
+% path p ; % example by Peter Rolf
+% p := unitsquare xyscaled(5cm,5cm) ;
+% fill (point 0 of p -- point 1 of p -- point 2 of p --cycle) withcolor \MPcolor{rgbtestcolor} ; % bottom right part of the square
+% fill (point 0 of p -- point 3 of p -- point 2 of p --cycle) withcolor \MPcolor{hextestcolor} ; % top left part
+% \stopMPpage
-\def\dohexcolorpattern#1#2#3#4#5#6#7#8\relax
- {0\ifx#4\empty
- S:\hexcolorcomponent#2#3%
- \else
- R:\hexcolorcomponent#2#3:\hexcolorcomponent#4#5:\hexcolorcomponent#6#7%
- \fi:0:0}
-
-\def\doifhexcolorelse#1%
- {\expandafter\dodoifhexcolorelse#10\od} % 0 is a dirty trick to catch an empty #1
-
-\def\dodoifhexcolorelse#1#2\od
- {\ifnum`#1=\hexcolorprefix
- \expandafter\firstoftwoarguments
- \else
- \expandafter\secondoftwoarguments
- \fi}
-
-\def\docheckhexcolor#1%
- {\doifhexcolorelse{#1}{\doifundefined{#1}{\setxvalue{\??cr#1}{\hexcolorpattern{#1}}}}\donothing}
-
-\def\checkhexcolor[#1]%
- {\expanded{\docheckhexcolor{#1}}}
-
-\def\colorHpattern{\@EA\hexcolorpattern\@EA{\@EA*\@@cl@@h}} % * == dummy placeholder
-
-\let\dodododefinecolor\dododefinecolor % we will overload this one
-
-\def\dododefinecolor#1#2#3#4[#5][#6]%
- {\doifhexcolorelse{#6}
- {\setxvalue{\??cr#5}{\hexcolorpattern{#6}}}
- {\dodododefinecolor#1#2#3#4[#5][#6]}}
-
-%D For Adam Lindsay and his XeTeX special driver:
-
-% because we intercept the zero condition, the .23pt in 1.23pt will disappear in the
-% ifcase zero part branch
-
-\def\colorhexcomponent#1%
- {\ifdim#1\points<.005\points
- 00\else\lchexnumbers{\the\dimexpr(255\dimexpr(#1\points)\relax+.5\points)\relax}%
- \fi}
-
-% the faster one
-
-\newdimen\hex@color@a \hex@color@a=.005pt
-\newdimen\hex@color@b \hex@color@b=.5pt
-\chardef \hex@color@c =255
-
-\def\colorhexcomponent#1%
- {\ifdim#1\points<\hex@color@a
- 00\else\lchexnumbers{\the\dimexpr(#1\points*\hex@color@c+\hex@color@b)\relax}%
- \fi}
-
-\protect \endinput
+\endinput
diff --git a/tex/context/base/colo-ini.lua b/tex/context/base/colo-ini.lua
index 4a188eba8..befac2452 100644
--- a/tex/context/base/colo-ini.lua
+++ b/tex/context/base/colo-ini.lua
@@ -6,26 +6,15 @@ if not modules then modules = { } end modules ['colo-ini'] = {
license = "see context related readme files"
}
--- split_settings -> aux.settings_to_hash
-
--- for the moment this looks messy but we're waiting for a pdf backend interface
---
--- code collected here will move and be adapted
---
--- some pdf related code can go away
-
--- spec-pdf.lua
-
--- todo: %s -> %f
-
+local concat = table.concat
+local format, gmatch, gsub, lower, match = string.format, string.gmatch, string.gsub, string.lower, string.match
local texsprint = tex.sprint
-local concat =table.concat
-local format, gmatch, gsub, lower = string.format, string.gmatch, string.gsub, string.lower
+local ctxcatcodes = tex.ctxcatcodes
-ctx = ctx or { }
-ctx.aux = ctx.aux or { }
+local settings_to_hash_strict = aux.settings_to_hash_strict
-local ctxcatcodes = tex.ctxcatcodes
+colors = colors or { }
+transparencies = transparencies or { }
local registrations = backends.registrations
@@ -60,7 +49,7 @@ local r_l_t_template = "\\localundefine{(ta:%s)}" ..
local r_g_t_template = "\\globalundefine{(ta:%s)}" ..
"\\globalundefine{(ts:%s)}"
-function ctx.aux.definecolor(name, ca, global)
+local function definecolor(name, ca, global)
if ca and ca > 0 then
if global then
texsprint(ctxcatcodes,format(a_g_c_template, name, ca, name, ca))
@@ -75,7 +64,7 @@ function ctx.aux.definecolor(name, ca, global)
end
end
end
-function ctx.aux.inheritcolor(name, ca, global)
+local function inheritcolor(name, ca, global)
if ca and ca ~= "" then
if global then
texsprint(ctxcatcodes,format(f_g_c_template, name, ca, name, ca))
@@ -90,7 +79,7 @@ function ctx.aux.inheritcolor(name, ca, global)
end
end
end
-function ctx.aux.definetransparent(name, ta, global)
+local function definetransparent(name, ta, global)
if ta and ta > 0 then
if global then
texsprint(ctxcatcodes,format(a_g_t_template, name, ta, name, ta))
@@ -105,7 +94,7 @@ function ctx.aux.definetransparent(name, ta, global)
end
end
end
-function ctx.aux.inherittransparent(name, ta, global)
+local function inherittransparent(name, ta, global)
if ta and ta ~= "" then
if global then
texsprint(ctxcatcodes,format(f_g_t_template, name, ta, name, ta))
@@ -139,17 +128,17 @@ local transparent = {
-- By coupling we are downward compatible. When we decouple we need to do more tricky
-- housekeeping (e.g. persist color independent transparencies when color bound ones
--- are nil.
+-- are nil.)
-ctx.couplecolors = true
+colors.couple = true
-function ctx.definetransparency(name,n)
+function colors.definetransparency(name,n)
transparent[name] = n
end
local registered = { }
-local function registerspotcolor(parent,name,parentnumber,e,f,d,p)
+local function do_registerspotcolor(parent,name,parentnumber,e,f,d,p)
if not registered[parentnumber] then
local v = colors.values[parentnumber]
if v then
@@ -170,7 +159,7 @@ local function registerspotcolor(parent,name,parentnumber,e,f,d,p)
end
end
-local function registermultitonecolor(parent,name,parentnumber,e,f,d,p) -- same as spot but different template
+local function do_registermultitonecolor(parent,name,parentnumber,e,f,d,p) -- same as spot but different template
if not registered[parentnumber] then
local v = colors.values[parentnumber]
if v then
@@ -188,41 +177,42 @@ local function registermultitonecolor(parent,name,parentnumber,e,f,d,p) -- same
end
end
-function ctx.definesimplegray(name,s)
+function colors.definesimplegray(name,s)
return colors.register('color',name,'gray',s) -- we still need to get rid of 'color'
end
-function ctx.defineprocesscolor(name,str,global,freeze) -- still inconsistent color vs transparent
- local t = str:split_settings()
+function colors.defineprocesscolor(name,str,global,freeze) -- still inconsistent color vs transparent
+ local r = match(str,"^#(.+)$") -- for old times sake (if we need to feed from xml or so)
+ local t = (r and { h = r }) or settings_to_hash_strict(str)
if t then
if t.h then
- local r, g, b = (t.h .. "000000"):match("(..)(..)(..)")
- ctx.aux.definecolor(name, colors.register('color',name,'rgb',(tonumber(r,16) or 0)/256,(tonumber(g,16) or 0)/256,(tonumber(b,16) or 0)/256 ), global)
+ local r, g, b = match(t.h .. "000000","(..)(..)(..)") -- watch the 255
+ definecolor(name, colors.register('color',name,'rgb',(tonumber(r,16) or 0)/255,(tonumber(g,16) or 0)/255,(tonumber(b,16) or 0)/255 ), global)
elseif t.r or t.g or t.b then
- ctx.aux.definecolor(name, colors.register('color',name,'rgb', tonumber(t.r) or 0, tonumber(t.g) or 0, tonumber(t.b) or 0 ), global)
+ definecolor(name, colors.register('color',name,'rgb', tonumber(t.r) or 0, tonumber(t.g) or 0, tonumber(t.b) or 0 ), global)
elseif t.c or t.m or t.y or t.k then
- ctx.aux.definecolor(name, colors.register('color',name,'cmyk',tonumber(t.c) or 0, tonumber(t.m) or 0, tonumber(t.y) or 0, tonumber(t.k) or 0), global)
+ definecolor(name, colors.register('color',name,'cmyk',tonumber(t.c) or 0, tonumber(t.m) or 0, tonumber(t.y) or 0, tonumber(t.k) or 0), global)
else
- ctx.aux.definecolor(name, colors.register('color',name,'gray',tonumber(t.s) or 0), global)
+ definecolor(name, colors.register('color',name,'gray',tonumber(t.s) or 0), global)
end
if t.a and t.t then
- ctx.aux.definetransparent(name, transparencies.register(name,transparent[t.a] or tonumber(t.a) or 1,tonumber(t.t) or 1), global)
- elseif ctx.couplecolors then
- -- ctx.aux.definetransparent(name, transparencies.register(nil, 1, 1), global) -- can be sped up
- ctx.aux.definetransparent(name, 0, global) -- can be sped up
+ definetransparent(name, transparencies.register(name,transparent[t.a] or tonumber(t.a) or 1,tonumber(t.t) or 1), global)
+ elseif colors.couple then
+ -- definetransparent(name, transparencies.register(nil, 1, 1), global) -- can be sped up
+ definetransparent(name, 0, global) -- can be sped up
end
elseif freeze then
local ca = attributes.list[a_color] [str]
local ta = attributes.list[a_transparency][str]
if ca then
- ctx.aux.definecolor(name, ca, global)
+ definecolor(name, ca, global)
end
if ta then
- ctx.aux.definetransparent(name, ta, global)
+ definetransparent(name, ta, global)
end
else
- ctx.aux.inheritcolor(name, str, global)
- ctx.aux.inherittransparent(name, str, global)
+ inheritcolor(name, str, global)
+ inherittransparent(name, str, global)
-- if global and str ~= "" then -- For Peter Rolf who wants access to the numbers in Lua. (Currently only global is supported.)
-- attributes.list[a_color] [name] = attributes.list[a_color] [str] or attributes.unsetvalue -- reset
-- attributes.list[a_transparency][name] = attributes.list[a_transparency][str] or attributes.unsetvalue
@@ -230,28 +220,28 @@ function ctx.defineprocesscolor(name,str,global,freeze) -- still inconsistent co
end
end
-function ctx.isblack(ca) -- maybe commands
+function colors.isblack(ca) -- maybe commands
local cv = ca > 0 and colors.value(ca)
return (cv and cv[2] == 0) or false
end
-function ctx.definespotcolor(name,parent,str,global)
+function colors.definespotcolor(name,parent,str,global)
if parent == "" or parent:find("=") then
- ctx.registerspotcolor(name, parent)
+ colors.registerspotcolor(name, parent)
elseif name ~= parent then
local cp = attributes.list[a_color][parent]
if cp then
- local t = str:split_settings()
+ local t = settings_to_hash_strict(str)
if t then
t.p = tonumber(t.p) or 1
- registerspotcolor(parent, name, cp, t.e, 1, "", t.p) -- p not really needed, only diagnostics
+ do_registerspotcolor(parent, name, cp, t.e, 1, "", t.p) -- p not really needed, only diagnostics
if name and name ~= "" then
- ctx.aux.definecolor(name, colors.register('color',name,'spot', parent, 1, "", t.p), true)
+ definecolor(name, colors.register('color',name,'spot', parent, 1, "", t.p), true)
if t.a and t.t then
- ctx.aux.definetransparent(name, transparencies.register(name,transparent[t.a] or tonumber(t.a) or 1,tonumber(t.t) or 1), global)
- elseif ctx.couplecolors then
- --~ ctx.aux.definetransparent(name, transparencies.register(nil, 1, 1), global) -- can be sped up
- ctx.aux.definetransparent(name, 0, global) -- can be sped up
+ definetransparent(name, transparencies.register(name,transparent[t.a] or tonumber(t.a) or 1,tonumber(t.t) or 1), global)
+ elseif colors.couple then
+ --~ definetransparent(name, transparencies.register(nil, 1, 1), global) -- can be sped up
+ definetransparent(name, 0, global) -- can be sped up
end
end
end
@@ -259,49 +249,49 @@ function ctx.definespotcolor(name,parent,str,global)
end
end
-function ctx.registerspotcolor(parent, str)
+function colors.registerspotcolor(parent, str)
local cp = attributes.list[a_color][parent]
if cp then
local e = ""
if str then
- local t = str:split_settings()
+ local t = settings_to_hash_strict(str)
e = (t and t.e) or ""
end
- registerspotcolor(parent, "dummy", cp, e, 1, "", 1) -- p not really needed, only diagnostics
+ do_registerspotcolor(parent, "dummy", cp, e, 1, "", 1) -- p not really needed, only diagnostics
end
end
-function ctx.definemultitonecolor(name,multispec,colorspec,selfspec)
+function colors.definemultitonecolor(name,multispec,colorspec,selfspec)
local dd, pp, nn = { }, { }, { }
for k,v in gmatch(multispec,"(%a+)=([^%,]*)") do
dd[#dd+1] = k
pp[#pp+1] = v
nn[#nn+1] = k
- nn[#nn+1] = format("%1.3g",tonumber(v))
+ nn[#nn+1] = format("%1.3g",tonumber(v) or 0) -- 0 can't happen
end
--~ v = tonumber(v) * p
local nof = #dd
if nof > 0 then
dd, pp, nn = concat(dd,','), concat(pp,','), concat(nn,'_')
local parent = gsub(lower(nn),"[^%d%a%.]+","_")
- ctx.defineprocesscolor(parent,colorspec..","..selfspec,true,true)
+ colors.defineprocesscolor(parent,colorspec..","..selfspec,true,true)
local cp = attributes.list[a_color][parent]
if cp then
- registerspotcolor (parent, name, cp, "", nof, dd, pp)
- registermultitonecolor(parent, name, cp, "", nof, dd, pp)
- ctx.aux.definecolor(name, colors.register('color', name, 'spot', parent, nof, dd, pp), true)
- local t = selfspec:split_settings()
+ do_registerspotcolor(parent, name, cp, "", nof, dd, pp)
+ do_registermultitonecolor(parent, name, cp, "", nof, dd, pp)
+ definecolor(name, colors.register('color', name, 'spot', parent, nof, dd, pp), true)
+ local t = settings_to_hash_strict(selfspec)
if t and t.a and t.t then
- ctx.aux.definetransparent(name, transparencies.register(name,transparent[t.a] or tonumber(t.a) or 1,tonumber(t.t) or 1), global)
- elseif ctx.couplecolors then
- -- ctx.aux.definetransparent(name, transparencies.register(nil, 1, 1), global) -- can be sped up
- ctx.aux.definetransparent(name, 0, global) -- can be sped up
+ definetransparent(name, transparencies.register(name,transparent[t.a] or tonumber(t.a) or 1,tonumber(t.t) or 1), global)
+ elseif colors.couple then
+ -- definetransparent(name, transparencies.register(nil, 1, 1), global) -- can be sped up
+ definetransparent(name, 0, global) -- can be sped up
end
end
end
end
-function ctx.mpcolor(model,ca,ta,default)
+function colors.mp(model,ca,ta,default)
local cv = colors.value(ca) -- faster when direct colors.values[ca]
if cv then
local tv = transparencies.value(ta)
@@ -335,7 +325,7 @@ function ctx.mpcolor(model,ca,ta,default)
end
end
-function ctx.formatcolor(ca,separator)
+function colors.formatcolor(ca,separator)
local cv = colors.value(ca)
if cv then
local c, f, t, model = { }, 13, 13, cv[1]
@@ -355,12 +345,12 @@ function ctx.formatcolor(ca,separator)
end
end
-function ctx.formatgray(ca,separator)
+function colors.formatgray(ca,separator)
local cv = colors.value(ca)
return format("%0.3f",(cv and cv[2]) or 0)
end
-function ctx.colorcomponents(ca)
+function colors.colorcomponents(ca)
local cv = colors.value(ca)
if cv then
local model = cv[1]
@@ -380,7 +370,7 @@ function ctx.colorcomponents(ca)
end
end
-function ctx.transparencycomponents(ta)
+function colors.transparencycomponents(ta)
local tv = transparencies.value(ta)
if tv then
return format("a=%1.3f t=%1.3f",tv[1],tv[2])
@@ -389,153 +379,29 @@ function ctx.transparencycomponents(ta)
end
end
-function ctx.pdfcolor(model,ca,default) -- todo: use gray when no color
- local cv = colors.value(ca)
- if cv then
- if model == 1 then
- model = cv[1]
- end
- if model == 2 then
- local s = cv[2]
- return format("%s g %s G",s,s)
- elseif model == 3 then
- local r, g, b = cv[3], cv[4], cv[5]
- return format("%s %s %s rg %s %s %s RG",r,g,b,r,g,b)
- elseif model == 4 then
- local c, m, y, k = cv[6],cv[7],cv[8],cv[9]
- return format("%s %s %s %s k %s %s %s %s K",c,m,y,k,c,m,y,k)
- else
- local n,f,d,p = cv[10],cv[11],cv[12],cv[13]
- if type(p) == "string" then
- p = gsub(p,","," ") -- brr misuse of spot
- end
- return format("/%s cs /%s CS %s SCN %s scn",n,n,p,p)
- end
- else
- return format("%s g %s G",default or 0,default or 0)
- end
-end
-
-function ctx.pdfcolorvalue(model,ca,default)
- local cv = colors.value(ca)
- if cv then
- if model == 1 then
- model = cv[1]
- end
- if model == 2 then
- return format("%s",cv[2])
- elseif model == 3 then
- return format("%s %s %s",cv[3],cv[4],cv[5])
- elseif model == 4 then
- return format("%s %s %s %s",cv[6],cv[7],cv[8],cv[9])
- else
- return format("%s",cv[13])
- end
- else
- return format("%s",default or 0)
- end
-end
-
-function ctx.fdfcolor(model,ca,default)
- local cv = colors.value(ca)
- if cv then
- if model == 1 then
- model = cv[1]
- end
- if model == 2 then
- return format("[%s]",cv[2])
- elseif model == 3 then
- return format("[%s %s %s]",cv[3],cv[4],cv[5])
- elseif model == 4 then
- return format("[%s %s %s %s]",cv[6],cv[7],cv[8],cv[9])
- elseif model == 4 then
- return format("[%s]",cv[13])
- end
- else
- return format("[%s]",default or 0)
- end
-end
-
-function ctx.pdfcolorspace(model,ca)
- local cv = colors.value(ca)
- if cv then
- if model == 1 then
- model = cv[1]
- end
- if model == 2 then
- return "DeviceGray"
- elseif model == 3 then
- return "DeviceRGB"
- elseif model == 4 then
- return "DeviceCMYK"
- end
+function colors.spotcolorname(ca,default)
+ local cv, v = colors.value(ca), "unknown"
+ if cv and cv[1] == 5 then
+ v = cv[10]
end
- return "DeviceGRAY"
+ return tostring(v)
end
-function ctx.spotcolorname(ca,default)
+function colors.spotcolorparent(ca,default)
local cv, v = colors.value(ca), "unknown"
if cv and cv[1] == 5 then
- v = cv[10]
+ v = cv[12]
+ if v == "" then
+ v = cv[10]
+ end
end
return tostring(v)
end
-function ctx.spotcolorvalue(ca,default)
+function colors.spotcolorvalue(ca,default)
local cv, v = colors.value(ca), 0
if cv and cv[1] == 5 then
v = cv[13]
end
return tostring(v)
end
-
--- unfortunately we have \cs's here but this will go anyway once we have mplib and such
-
-function ctx.resolvempgraycolor(csa,csb,model,s)
- local ca = colors.register('color',nil,'gray',s)
- texsprint(ctxcatcodes,format("\\setxvalue{%s}{%s}",csa,ctx.pdfcolorvalue(model,ca)))
- texsprint(ctxcatcodes,format("\\setxvalue{%s}{%s}",csb,ctx.pdfcolorspace(model,ca)))
-end
-function ctx.resolvemprgbcolor(csa,csb,model,r,g,b)
- local ca = colors.register('color',nil,'rgb',r,g,b)
- texsprint(ctxcatcodes,format("\\setxvalue{%s}{%s}",csa,ctx.pdfcolorvalue(model,ca)))
- texsprint(ctxcatcodes,format("\\setxvalue{%s}{%s}",csb,ctx.pdfcolorspace(model,ca)))
-end
-function ctx.resolvempcmykcolor(csa,csb,model,c,m,y,k)
- local ca = colors.register('color',nil,'cmyk',c,m,y,k)
- texsprint(ctxcatcodes,format("\\setxvalue{%s}{%s}",csa,ctx.pdfcolorvalue(model,ca)))
- texsprint(ctxcatcodes,format("\\setxvalue{%s}{%s}",csb,ctx.pdfcolorspace(model,ca)))
-end
-function ctx.resolvempspotcolor(csa,csb,model,n,f,d,p)
- local ca = colors.register('color',nil,'spot',n,f,d,p)
- texsprint(ctxcatcodes,format("\\setxvalue{%s}{%s}",csa,ctx.pdfcolorvalue(model,ca)))
- texsprint(ctxcatcodes,format("\\setxvalue{%s}{%s}",csb,ctx.pdfcolorspace(model,ca)))
-end
-
--- literals needed to inject code in the mp stream, we cannot use attributes there
--- since literals may have qQ's, much may go away once we have mplib code in place
-
-local intransparency = false
-
-function ctx.pdfrgbliteral(model,r,g,b)
- texsprint(ctxcatcodes,format("\\pdfliteral{%s}",ctx.pdfcolor(model,colors.register('color',nil,'rgb',r,g,b))))
-end
-function ctx.pdfcmykliteral(model,c,m,y,k)
- texsprint(ctxcatcodes,format("\\pdfliteral{%s}",ctx.pdfcolor(model,colors.register('color',nil,'cmyk',c,m,y,k))))
-end
-function ctx.pdfgrayliteral(model,s)
- texsprint(ctxcatcodes,format("\\pdfliteral{%s}",ctx.pdfcolor(model,colors.register('color',nil,'gray',s))))
-end
-function ctx.pdfspotliteral(model,n,f,d,p)
- texsprint(ctxcatcodes,format("\\pdfliteral{%s}",ctx.pdfcolor(model,colors.register('color',nil,'spot',n,f,d,p)))) -- incorrect
-end
-function ctx.pdftransparencyliteral(a,t)
- intransparency = true
- texsprint(ctxcatcodes,format("\\pdfliteral{/Tr%s gs}",transparencies.register(nil,a,t)))
-end
-function ctx.pdffinishtransparency()
- if intransparency then
- intransparency = false
- texsprint(ctxcatcodes,"\\pdfliteral{/Tr0 gs}") -- we happen to know this -)
- end
-end
diff --git a/tex/context/base/colo-ini.mkiv b/tex/context/base/colo-ini.mkiv
index 197a69ba6..197cbcdca 100644
--- a/tex/context/base/colo-ini.mkiv
+++ b/tex/context/base/colo-ini.mkiv
@@ -20,6 +20,7 @@
%D different approach, this module only implements a few generic mechanisms.
\registerctxluafile{colo-ini}{1.000}
+\registerctxluafile{lpdf-col}{1.000}
\unprotect
@@ -80,7 +81,6 @@
\newif\iffreezecolors \freezecolorsfalse
\newif\ifincolor % true if colors enabled
-\newif\iflocalcolor
\let\colorlist \empty
\let\currentspotcolor \empty
@@ -122,8 +122,6 @@
%D \macros
%D {startcolor,stopcolor,
%D faststartcolor,faststopcolor,
-%D localstartcolor,localstopcolor,
-%D localstartraster,localstopraster,
%D startraster,stopraster,raster,
%D color,graycolor}
%D
@@ -162,13 +160,7 @@
\def\faststopcolor {}
\unexpanded\def\dosetcolorattribute#1#2{\ifcsname#1#2\endcsname\doactivatecolor{\csname#1#2\endcsname}\fi}
-\let\localstartcolor \startcolor
-\let\localstopcolor \stopcolor
-\let\globalstartcolor\startcolor
-\let\globalstopcolor \stopcolor
-\let\localstartraster\startraster
-\let\localstopraster \stopraster
-\let\grey \graycolor
+\let\grey\graycolor
%D \macros
%D {startcurrentcolor,stopcurrentcolor}
@@ -211,8 +203,8 @@
{\makeshortfilename[\truefilename{\f!colorprefix#1}]%
\startreadingfile
\readsysfile\shortfilename
- {\showmessage\m!colors4\colorstyle}
- {\showmessage\m!colors5\colorstyle}%
+ {\showcolormessage\m!colors4\colorstyle}
+ {\showcolormessage\m!colors5\colorstyle}%
\stopreadingfile}
\let\usecolors\setupcolor
@@ -262,6 +254,8 @@
\setsystemmode{\v!color\colorsplitsuffix}%
\iffilterspotcolor \let\@@clrgb\v!no \fi}
+\let\showcolormessage\gobblethreearguments
+
\def\dosetupcolors[#1]% some no longer make sense in MkIV
{\getparameters[\??cl][#1]%
\doifelse\@@clspot\v!yes
@@ -283,17 +277,17 @@
\weightGRAYfalse
\weightGRAYtrue
\doifelse\@@clrgb\v!no
- {\ifRGBsupported \ifproductionrun\showmessage\m!colors {9}\v!rgb \fi\RGBsupportedfalse \fi}
- {\ifRGBsupported \else\ifproductionrun\showmessage\m!colors{10}\v!rgb \fi\RGBsupportedtrue \fi}%
+ {\ifRGBsupported \showcolormessage\m!colors {9}\v!rgb \RGBsupportedfalse \fi}
+ {\ifRGBsupported \else\showcolormessage\m!colors{10}\v!rgb \RGBsupportedtrue \fi}%
\doifelse\@@clcmyk\v!no
- {\ifCMYKsupported \ifproductionrun\showmessage\m!colors {9}\v!cmyk \fi\CMYKsupportedfalse\fi}
- {\ifCMYKsupported\else\ifproductionrun\showmessage\m!colors{10}\v!cmyk \fi\CMYKsupportedtrue \fi}%
+ {\ifCMYKsupported \showcolormessage\m!colors {9}\v!cmyk \CMYKsupportedfalse\fi}
+ {\ifCMYKsupported\else\showcolormessage\m!colors{10}\v!cmyk \CMYKsupportedtrue \fi}%
\doifelse\@@clmpcmyk\v!no
- {\ifMPcmykcolors \ifproductionrun\showmessage\m!colors {9}{\v!mp\v!cmyk}\fi\MPcmykcolorsfalse \fi}
- {\ifMPcmykcolors \else\ifproductionrun\showmessage\m!colors{10}{\v!mp\v!cmyk}\fi\MPcmykcolorstrue \fi}%
+ {\ifMPcmykcolors \showcolormessage\m!colors {9}{\v!mp\v!cmyk}\MPcmykcolorsfalse \fi}
+ {\ifMPcmykcolors \else\showcolormessage\m!colors{10}{\v!mp\v!cmyk}\MPcmykcolorstrue \fi}%
\doifelse\@@clmpspot\v!no
- {\ifMPspotcolors \ifproductionrun\showmessage\m!colors {9}{\v!mp\v!spot}\fi\MPspotcolorsfalse \fi}
- {\ifMPspotcolors \else\ifproductionrun\showmessage\m!colors{10}{\v!mp\v!spot}\fi\MPspotcolorstrue \fi}%
+ {\ifMPspotcolors \showcolormessage\m!colors {9}{\v!mp\v!spot}\MPspotcolorsfalse \fi}
+ {\ifMPspotcolors \else\showcolormessage\m!colors{10}{\v!mp\v!spot}\MPspotcolorstrue \fi}%
\preferGRAYfalse
\processaction
[\@@clconversion]
@@ -310,23 +304,15 @@
\reduceMPcolorstrue
\fi
\else
- \ifconverttoGRAY\else\showmessage\m!colors{11}\empty\fi
+ \ifconverttoGRAY\else\showcolormessage\m!colors{11}\empty\fi
\converttoGRAYtrue
\forcegrayMPcolorstrue
\convertMPcolorsfalse
\reduceMPcolorsfalse
\fi\fi
- \processaction
- [\@@clstate]
- [ \v!global=>\ifincolor\else\showmessage\m!colors1\colorstyle\fi
- \incolortrue\localcolorfalse,
- \v!local=>\ifincolor\else\showmessage\m!colors2\colorstyle\fi
- \incolortrue\localcolortrue,
- \v!start=>\ifincolor\else\showmessage\m!colors1\colorstyle\fi
- \incolortrue\localcolorfalse
- \let\@@clstate\v!global,
- \v!stop=>\incolorfalse\localcolorfalse
- \forcegrayMPcolorstrue]%
+ \doifelse\@@clstate\v!stop
+ {\incolorfalse\forcegrayMPcolorstrue}%
+ {\ifincolor\else\showcolormessage\m!colors1\colorstyle\fi\incolortrue\let\@@clstate\v!start}%
\dosetupcolormodel
\initializemaintextcolor}
@@ -400,7 +386,7 @@
\def\dodefinepalet[#1][#2]%
{\doifassignmentelse{#2}
- {%\showmessage\m!colors6{#1}%
+ {%\showcolormessage\m!colors6{#1}%
\letvalue{\??pa#1}\empty
\setevalue{\??pa\??pa#1}{#2}%
\def\dodododefinepalet[##1=##2]%
@@ -448,7 +434,7 @@
\else\ifcsname\??pa\currentpalet\endcsname
\edef\currentpalet{#1:}%
\else
- \showmessage\m!colors7\currentpalet
+ \showcolormessage\m!colors7\currentpalet
\let\currentpalet\empty
\fi\fi}
@@ -695,11 +681,6 @@
\def\MPcolor#1{(0,0,0)}
\fi
-%D \macros
-%D {PDFcolor,FDFcolor}
-%D
-%D Similar alternatives are avaliable for \PDF:
-
%D For the moment we keep the next downward compatibility
%D switch, i.e.\ expanded colors. However, predefined colors
%D and palets are no longer expanded (which is what I wanted
@@ -791,7 +772,7 @@
\ifx\currentcolormodel\undefined \newcount\currentcolormodel \fi
\def\setcolormodel#1%
- {\showmessage\m!colors1{#1}%
+ {\showcolormessage\m!colors1{#1}%
\currentcolormodel\ctxlua{tex.print(colors.setmodel('colormodel','#1',\ifweightGRAY true\else false\fi))}%
\dosetattribute{colormodel}{\the\currentcolormodel}}
@@ -859,8 +840,8 @@
\def\deactivatecolor
{\let\currentcolorname\s!black
- \doresetattribute\s!color
- \doresetattribute\s!transparency}
+ \attribute\colorattribute\attributeunsetvalue
+ \attribute\transparencyattribute\attributeunsetvalue}
\def\dodefinecolorcommand#1#2%
{\unexpanded#1{#2}{\doactivatecolor{#2}}}
@@ -869,41 +850,41 @@
\setfalse\collectcolorsinlist
\def\collectcolorinlist#1{\doglobal\addtocommalist{#1}\colorlist}
-\def\doregistercolor#1#2{\ctxlua{ctx.defineprocesscolor("#1","#2",false,\iffreezecolors true\else false\fi)}}
+\def\doregistercolor#1#2{\ctxlua{colors.defineprocesscolor("#1","#2",false,\iffreezecolors true\else false\fi)}}
\def\dodefinecolor[#1][#2]%
{\ifconditional\collectcolorsinlist\collectcolorinlist{#1}\fi
- \ctxlua{ctx.defineprocesscolor("#1","#2",false,\iffreezecolors true\else false\fi)}%
+ \ctxlua{colors.defineprocesscolor("#1","#2",false,\iffreezecolors true\else false\fi)}%
\dodefinecolorcommand\setvalue{#1}}
\def\dodefineglobalcolor[#1][#2]%
{\ifconditional\collectcolorsinlist\collectcolorinlist{#1}\fi
- \ctxlua{ctx.defineprocesscolor("#1","#2",true,\iffreezecolors true\else false\fi)}%
+ \ctxlua{colors.defineprocesscolor("#1","#2",true,\iffreezecolors true\else false\fi)}%
\dodefinecolorcommand\setgvalue{#1}}
\def\dodefinenamedcolor[#1][#2]%
{\ifconditional\collectcolorsinlist\collectcolorinlist{#1}\fi
- \ctxlua{ctx.defineprocesscolor("#1","#2",false,\iffreezecolors true\else false\fi)}%
+ \ctxlua{colors.defineprocesscolor("#1","#2",false,\iffreezecolors true\else false\fi)}%
\dodefinecolorcommand\setvalue{#1}}
\def\dodefinespotcolor[#1][#2][#3]%
{\ifconditional\collectcolorsinlist\collectcolorinlist{#1}\fi
- \ctxlua{ctx.definespotcolor("#1","#2","#3",true)}%
+ \ctxlua{colors.definespotcolor("#1","#2","#3",true)}%
\dodefinecolorcommand\setxvalue{#1}}
\def\dodefinemultitonecolor[#1][#2][#3][#4]%
- {\ctxlua{ctx.definemultitonecolor("#1","#2","#3","#4",true)}%
+ {\ctxlua{colors.definemultitonecolor("#1","#2","#3","#4",true)}%
\dodefinecolorcommand\setxvalue{#1}}
\def\dodefinetransparency[#1][#2]%
- {\ctxlua{ctx.definetransparency("#1",#2)}}
+ {\ctxlua{colors.definetransparency("#1",#2)}}
\def\dosetrastercolor#1% slow, we need a fast one
{\edef\@@rastervalue{#1}%
\ifx\@@rastervalue\empty
\let\@@rastervalue\@@rsscreen
\fi
- \dosetattribute\s!color{\ctxlua{tex.sprint(ctx.definesimplegray("_raster_",\@@rastervalue))}}}
+ \dosetattribute\s!color{\ctxlua{tex.sprint(colors.definesimplegray("_raster_",\@@rastervalue))}}}
%D \macros
%D {doifcolorelse, doifcolor}
@@ -936,7 +917,7 @@
%D A bit like \type {\definedfont}:
\unexpanded\def\colored[#1]%
- {\ctxlua{ctx.defineprocesscolor("@colored@","#1",false,false)}%
+ {\ctxlua{colors.defineprocesscolor("@colored@","#1",false,false)}%
\groupedcommand{\doactivatecolor{@colored@}}{}}
%D \macros
@@ -965,37 +946,15 @@
%D \stopregistercolor
%D \stoptyping
+% can be cleaned up
+
\let\maintextcolor \empty
\def\defaulttextcolor {black}
\def\@@themaintextcolor{themaintextcolor}
-\def\startregistercolor[#1]%
- {\doifelsenothing{#1}
- {\let\stopregistercolor\relax}
- {\edef\stopregistercolor
- {\dosetattribute\s!color {\dogetattribute\s!color }%
- \dosetattribute\s!transparency{\dogetattribute\s!transparency}}%
- \doactivatecolor{#1}}}
-
-\let\resynccolor \relax % ?
-\let\pushcolor \relax
-\let\popcolor \relax
-\let\popsplitcolor\relax
-
-\def\restorecolormode
- {\ifincolor
- \deactivatecolor
- \ifx\maintextcolor\empty \else
- \doactivatecolor\maintextcolor
- \fi
- \fi}
-
-\let\pushpostponedpagecolor\relax
-\let\poppostponedpagecolor \relax
-
-\appendtoks\deactivatecolor\to\everybeforeoutput % maybe we don't need push pop now
+\appendtoks\deactivatecolor\to\everybeforeoutput
-\def\startregistercolor[#1]%
+\def\startregistercolor[#1]% probably obsolete
{\doifelsenothing{#1}
{\let\stopregistercolor\relax}
{\edef\stopregistercolor
@@ -1024,10 +983,6 @@
\appendtoks \initializemaintextcolor \to \everyjob
-\def\localstarttextcolor{\normalexpanded{\noexpand\startcolor[\ifx\maintextcolor\empty\defaulttextcolor\else\maintextcolor\fi]}}
-\let\localstoptextcolor \stopcolor
-\let\restoretextcolor \firstofoneargument
-
\def\dodefinepaletcolor#1#2#3%
{\doifassignmentelse{#3}% \definepalet[test][xx={y=.4}]
{\definecolor[\??pa#1:#2][#3]%
@@ -1071,7 +1026,7 @@
\def\colorformatseparator{ }
-\def\MPcolor#1{\ctxlua{tex.sprint(ctx.mpcolor(\number\currentcolormodel,\number\doinheritca{#1},\number\doinheritta{#1}))}}
+\def\MPcolor#1{\ctxlua{tex.sprint(colors.mp(\number\currentcolormodel,\number\doinheritca{#1},\number\doinheritta{#1}))}}
\let\currentcolorname\s!black % todo
\let\outercolorname \s!black % todo
@@ -1079,33 +1034,18 @@
\def\thecolorattribute #1{\number\csname(ca:\ifcsname(ca:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ca:#1)\endcsname#1\fi\fi)\endcsname}
\def\thetransparencyattribute#1{\number\csname(ta:\ifcsname(ta:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ta:#1)\endcsname#1\fi\fi)\endcsname}
-\def\PDFcolor #1{\ctxlua{tex.sprint(ctx.pdfcolor (\number\currentcolormodel, \thecolorattribute{#1}))}}
-\def\PDFcolorvalue#1{\ctxlua{tex.sprint(ctx.pdfcolorvalue(\number\currentcolormodel, \thecolorattribute{#1}))}}
-\def\FDFcolor #1{\ctxlua{tex.sprint(ctx.fdfcolor (\number\currentcolormodel, \thecolorattribute{#1}))}}
-
-\def\internalspotcolorname#1{\ctxlua{tex.sprint(ctx.spotcolorname (\thecolorattribute{#1}))}}
-\def\internalspotcolorsize#1{\ctxlua{tex.sprint(ctx.spotcolorvalue(\thecolorattribute{#1}))}}
-
-\def\colorcomponents #1{\ctxlua{tex.sprint(ctx.colorcomponents (\thecolorattribute {#1}))}}
-\def\transparencycomponents#1{\ctxlua{tex.sprint(ctx.transparencycomponents(\thetransparencyattribute{#1}))}}
-
-\def\colorvalue#1{\ctxlua{tex.sprint(ctx.formatcolor(\thecolorattribute{#1},"\colorformatseparator"))}}
-\def\grayvalue #1{\ctxlua{tex.sprint(ctx.formatgray (\thecolorattribute{#1},"\colorformatseparator"))}}
+\def\internalspotcolorname #1{\ctxlua{tex.sprint(colors.spotcolorname (\thecolorattribute{#1}))}}
+\def\internalspotcolorparent#1{\ctxlua{tex.sprint(colors.spotcolorparent(\thecolorattribute{#1}))}}
+\def\internalspotcolorsize #1{\ctxlua{tex.sprint(colors.spotcolorvalue (\thecolorattribute{#1}))}}
-% \definecolor[foo][black] {\red red {\foo (\doifblackelse{foo}{YES}{NO} \doifdrawingblackelse{YES}{NO}) black} red}
-% \definecolor[foo][green] {\red red {\foo (\doifblackelse{foo}{YES}{NO} \doifdrawingblackelse{YES}{NO}) green} red}
+\def\colorcomponents #1{\ctxlua{tex.sprint(colors.colorcomponents (\thecolorattribute {#1}))}}
+\def\transparencycomponents#1{\ctxlua{tex.sprint(colors.transparencycomponents(\thetransparencyattribute{#1}))}}
-\def\doifblackelse #1{\ctxlua{commands.doifelse(ctx.isblack(\thecolorattribute{#1}))}}
-\def\doifdrawingblackelse {\ctxlua{commands.doifelse(ctx.isblack(tex.attribute[attributes.numbers['color']]))}}
+\def\colorvalue#1{\ctxlua{tex.sprint(colors.formatcolor(\thecolorattribute{#1},"\colorformatseparator"))}}
+\def\grayvalue #1{\ctxlua{tex.sprint(colors.formatgray (\thecolorattribute{#1},"\colorformatseparator"))}}
-% hack, till we have adapted backend: (move it there)
-
-\def\presetPDFtransparencybynumber#1#2#3%
- {\initializetransparency
- \ifcase#1\else
- \global\PDFcurrenttransparency\numexpr#1+\minusone\relax
- \presetPDFtransparency{#2}{#3}%
- \fi}
+\def\doifblackelse #1{\ctxlua{commands.doifelse(colors.isblack(\thecolorattribute{#1}))}}
+\def\doifdrawingblackelse {\ctxlua{commands.doifelse(colors.isblack(tex.attribute[attributes.numbers['color']]))}}
%D \macros
%D {forcecolorhack}
@@ -1129,21 +1069,6 @@
\unexpanded\def\forcecolorhack{\leaders\hrule\normalhskip\zeropoint}
-% \setupcolors[state=start]
-%
-% \starttext
-% \defineglobalcolor[foo][black] {\red red {\foo black} red}
-% \ctxlua{tex.print(ctx.aux.colorattribute("foo"))}
-% \ctxlua{tex.print(ctx.aux.colorattribute("red"))}
-% \ctxlua{tex.print(ctx.aux.colorattribute("green"))}
-% \ctxlua{tex.print(ctx.aux.colorattribute("black"))}
-% \definecolor[black][green] {\red red {\foo black} red}
-% \ctxlua{tex.print(ctx.aux.colorattribute("foo"))}
-% \ctxlua{tex.print(ctx.aux.colorattribute("red"))}
-% \ctxlua{tex.print(ctx.aux.colorattribute("green"))}
-% \ctxlua{tex.print(ctx.aux.colorattribute("black"))}
-% \stoptext
-
%D We default to the colors defined in \module{colo-rgb} and
%D support both \cap{RGB} and \cap{CMYK} output. As you can
%D see, color support is turned off by default. Reduction of
@@ -1170,6 +1095,10 @@
\setupcolors[\c!state=\v!start]% later direct
\to \everyjob
+\appendtoks
+ \let\showcolormessage\showmessage
+\to \everyjob
+
\setupcolors
[\c!state=\v!stop, % in mkii: \v!stop
\c!conversion=\v!yes,
diff --git a/tex/context/base/cont-log.tex b/tex/context/base/cont-log.tex
index 27f3b1134..a22c1d2c4 100644
--- a/tex/context/base/cont-log.tex
+++ b/tex/context/base/cont-log.tex
@@ -292,4 +292,18 @@
\let\LUATEX \luaTeX
\let\XETEX \XeTeX
+\def\MkApproved
+ {\rotate
+ [\c!rotation={\ifnum\texengine=\luatexengine\ctxlua{tex.write(45-45*\the\luatexversion/100)}\else0\fi},
+ \c!align=\v!middle,
+ \c!foregroundstyle=\v!type,
+ \c!foregroundcolor=darkred,
+ \c!frame=\v!on,
+ \c!offset=1ex,
+ \c!background=\v!color,
+ \c!backgroundcolor=lightgray,
+ \c!framecolor=darkred,
+ \c!rulethickness=2pt]
+ {Mk\ifnum\texengine=\luatexengine IV\else II\fi\\approved}}
+
\protect \endinput
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 6af6de4b6..8b5bed657 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -13,4 +13,7 @@
\enablemode[mkii]
+\long\def\startluacode#1\stopluacode{}
+\long\def\ctxlua #1{}
+
\endinput
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 9e2ca49c0..35b716ed4 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,19 +11,26 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+% 2009-07-15 / vista sp 2 / 2.2G duo dell M90 precision:
+%
+% \dorecurse{10000}{test \page} % 300 pps
+% \dorecurse {2000}{test \page} % 260 pps
+% \dorecurse {300}{test \page} % 135 pps
+
% \ctxlua { fonts.define.method = 2 } % normally 3
\enablemode[mkiv] \setsystemmode{mkiv}
-% there is more code here that is wise, but first we need to split
-% more modules in mkii/mkiv
-
% potential new defaults:
-
+%
% \setbreakpoints[compound]
\unprotect
+% % % % % % needs testing but saves runtime
+
+\let\checknotes\relax % probably not needed, checking already done
+
% we need to figure this out (to be discussed)
\unexpanded\def\textminus
@@ -46,82 +53,6 @@
% \def\pagedir{\expandafter\gobblethreearguments}
% \def\bodydir{\expandafter\gobblethreearguments}
-% we have to make an mkii/mkiv core-not
-
-\ifx\definestructurecounter\undefined
-
-\def\dochecknote % only to be called locally, some bools will become class-ones
- {% for the moment no mixed text/endnotes modes, so we use
- % \footnoteparameter and not \noteparameter (**)
- \setnotedistance
- \edef\notelocationasked{\noteparameter\c!location}% can be set
- \count\currentnoteins\plusthousand
- \expdoifcommonelse{\v!columns,\v!lastcolumn}\notelocationasked
- {\chardef\clevernotes\plustwo}
- {\expdoifinsetelse\v!firstcolumn\notelocationasked
- {\chardef\clevernotes\plusone}%
- {\chardef\clevernotes\zerocount}}%
- \ifcase\clevernotes\relax
- % notes not in column areas
- \ifnum\noteparameter\c!n=\zerocount % no ifcase
- \settextnotes
- \scratchcounter\plusone
- \else
- \setcolumnnotes
- \scratchcounter\noteparameter\c!n\relax
- \divide\count\currentnoteins \scratchcounter
- \fi
- \global\endnotesfalse
- \expdoifinsetelse\v!page\notelocationasked
- {\expdoifinsetelse\v!high\notelocationasked
- {\global\bottomnotesfalse}
- {\global\bottomnotestrue}}
- {\global\endnotestrue
- \global\bottomnotestrue}% not: \postponenotes, else global
- \else
- % notes in column areas
- \ifnum\@@kln=\zerocount % no ifcase / brrr dependency on \??kl
- \scratchcounter\plusone
- \else
- \scratchcounter\footnoteparameter\c!n\relax % **
- \fi
- \global\endnotesfalse
- \global\bottomnotestrue
- \setclevernotes
- \fi
- \doifsomething{\noteparameter\c!factor}
- {\ifnum\noteparameter\c!factor<\zerocount\else
- \count\currentnoteins\noteparameter\c!factor
- \fi}%
- \ifnotelimit
- \dimen\currentnoteins\noteparameter\c!height
- \multiply\dimen\currentnoteins \scratchcounter
- \fi
- \ifendnotes
- \dimen\currentnoteins\maxdimen
- \count\currentnoteins\zerocount
- \skip \currentnoteins\zeropoint
- \fi}
-
-\fi
-
-\ifx\clearmarks\undefined
- \def\clearmarks {\begingroup\afterassignment\doclearmarks\scratchcounter}
- \def\doclearmarks{\normalmarks\scratchcounter{}\endgroup}
-\fi
-
-\ifx\@@trk\undefined \else
-
- \def\resetmark#1% we cannot use \normalmarks#1{}
- {\global\@EA\chardef\csname\@@mrk\string#1\endcsname\zerocount
- \@EA\clearmarks\csname\@@prk\string#1\endcsname
- \global\@EA\let\csname\@@trk\string#1\endcsname\empty
- \global\@EA\let\csname\@@frk\string#1\endcsname\empty
- \global\@EA\let\csname\@@brk\string#1\endcsname\empty
- \global\@EA\let\csname\@@crk\string#1\endcsname\empty}
-
-\fi
-
%D Since this can be a showstopper, we report the path at the beginning
%D as well as at the end of a run.
@@ -169,12 +100,12 @@
% remapper.define('encoding','^qtm','^(.*)$','q-\letterpercent1')
% }
-\appendtoksonce \loadallXfontmapfiles \to \everyPDFxform
-\appendtoksonce \loadallXfontmapfiles \to \everyPDFximage
-\appendtoksonce \loadallXfontmapfiles \to \everystarttext
-\appendtoksonce \loadallXfontmapfiles \to \everybeforepagebody
+% \appendtoksonce \loadallXfontmapfiles \to \pdfbackendeveryximage
+% \appendtoksonce \loadallXfontmapfiles \to \pdfbackendeveryxform
+% \appendtoksonce \loadallXfontmapfiles \to \everystarttext
+% \appendtoksonce \loadallXfontmapfiles \to \everybeforepagebody
-\def\loadallXfontmapfiles{\ctxlua{fonts.map.flush("pdftex")}}
+% \def\loadallXfontmapfiles{\ctxlua{fonts.map.flush("pdftex")}}
% \ctxlua{
% do
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 378eed523..9c729629c 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2009.06.13 14:03}
+\newcontextversion{2009.07.17 13:16}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
@@ -28,8 +28,6 @@
% \font\f=dummyfont \rpcode\f0=500 \hbox{..}\char0
% todo: mp-new
% caption: grid=top|bottom in xml defs
-
-\let\then\relax % \ifnum1>2\then -)
\def\fastscale#1%
{\begingroup
@@ -74,35 +72,6 @@
\fi
\relax}
-% maybe to be integrated (option=...)
-
-\def\directexternalfigure
- {\dodoubleempty\dodirectexternalfigure}
-
-\def\dodirectexternalfigure[#1][#2]%
- {\bgroup
- \getparameters[\??ef][\c!type=\splitofftype,\c!page=1,#2]%
- \sanitizefilename#1\to\expandedfigurename
- \splitfilename\expandedfigurename
- \let\@@DriverImageWidth \!!zeropoint
- \let\@@DriverImageHeight \!!zeropoint
- \let\@@DriverImageFile \splitofffull
- \let\@@DriverImageType \@@eftype
- \let\@@DriverImageMethod \@@eftype
- \let\@@DriverImageLabel \empty
- \let\@@DriverImagePage \@@efpage
- \doinsertfile
- \egroup}
-
-% \directexternalfigure[cow.pdf]
-
-% normally one does not want this to happen nested, maybe there
-% is more; non public vars btw, will become conditionals
-
-\ifx\writetoregisterfalse\undefined \else \appendtoks \writetoregisterfalse \to \everybeforeutilityread \fi
-\ifx\writetolistfalse \undefined \else \appendtoks \writetolistfalse \to \everybeforeutilityread \fi
-\ifx\notesenabledfalse \undefined \else \appendtoks \notesenabledfalse \to \everybeforeutilityread \fi
-
% \setuplabeltext[\s!itemcount1={{I(},{)}}]
% \def\labeledcountervalue#1{\labeltexts{#1}{\countervalue{#1}}}
@@ -213,132 +182,6 @@
%
% \shapesynonym{eacute}
-% \page[left]
-% \definecolumntextarea[intro][left][x=1,y=1,nx=4,ny=20,state=start,background=introlayer]
-% \setupcolumntextareatext[intro][left][\setups{intro}]
-% \flushcolumntextareas
-
-\def\flushcolumntextareas
- {\initializecolumntextareas
- \setvsize}
-
-%D (Inspired by a discussion on the \CONTEXT\ mailing list)
-%D
-%D In \TEX\ each character can have one of 16 catcodes. This way the
-%D backslash, dollar, ampersand, hash and some more characters get
-%D their special meaning. If you want to process tokens under a
-%D certain catcode regime, passing arguments can interfere badly.
-%D
-%D \startbuffer[a]
-%D \def\whatever#1{[#1]}
-%D \whatever{whatever \type {\whatever{you want}} $or$ not!}
-%D \stopbuffer
-%D
-%D \typebuffer[a]
-%D
-%D Here we pass an argument to \type {\whatever} but part of that
-%D argument is to be processed under a different catcode regime, i.e.\
-%D all characters that need to be typeset verbatim need to get
-%D the catcode that makes it a letter. This is what we get when we typeset
-%D the text verbatim:
-%D
-%D \starttyping
-%D whatever \type {\whatever{you want}} $or$ not!
-%D \stoptyping
-%D
-%D However, when passed to \type {\whatever} we get:
-%D
-%D \getbuffer[a]
-%D
-%D In \ETEX\ one can use \type {\scantokens} to circumvent this problem.
-%D
-%D \startbuffer[b]
-%D \def\rescan#1{\scantokens{#1}}
-%D \def\whatever#1{[\rescan{#1}]}
-%D \whatever{whatever \type {\whatever{you want}} $or$ not!}
-%D \stopbuffer
-%D
-%D \getbuffer[b] \typebuffer[b]
-%D
-%D This time the \type {\whatever} call gives:
-%D
-%D \getbuffer[b]
-%D
-%D In this example, two spaces have crept in. The first one, after the
-%D macro name, is inserted by \TEX\ and cannot be avoided. The last space
-%D is inserted by \type {\scantokens}, and is the consequence of the fact
-%D that this macro mimics reading from a file. You can avoid the last
-%D space by a slightly different definition:
-%D
-%D \startbuffer[c]
-%D \def\rescan#1{\scantokens{#1\ignorespaces}}
-%D \def\whatever#1{[\rescan{#1}]}
-%D \whatever{whatever \type {\whatever{you want}} $or$ not!}
-%D \stopbuffer
-%D
-%D \typebuffer[c]
-%D
-%D Unfortunately we still keep the first space, but at least it's better than
-%D a failure:
-%D
-%D \getbuffer[c]
-
-\long\def\rescan#1{\scantokens{#1\ignorespaces}}
-\long\def\rescanwithsetup#1#2{\begingroup\directsetup{#1}\scantokens{#2\ignorespaces}\endgroup}
-
-\ifx\scantextokens\undefined \else
- \long\def\rescan#1{\scantextokens{#1}}
- \long\def\rescanwithsetup#1#2{\begingroup\directsetup{#1}\scantextokens{#2}\endgroup}
-\fi
-
-% In 2005 we will abandon support for font encodings that don't have
-% the ascii characters { } $ etc in their normal slot, i.e. latin modern
-% instead of computer modern. Then we can also clean up some of the ugly
-% xml internals that are a result from the need to deal with funny
-% encodings.
-%
-% a solution:
-%
-% \defineXMLargument[ctx:c]{\getXMLcharacter}
-% \defineXMLargument[ctx:e]{\getXMLentity }
-% \defineXMLargument[ctx:u]{\unicodechar }
-%
-% \bgroup \catcode`\<=\active \catcode`\&=\active
-%
-% \gdef\dontexpandutf
-% {\def\getXMLcharacter##1{##1}%
-% \def\getXMLentity ##1{##1}%
-% \def\unicodechar ##1{##1}}
-%
-% \egroup
-%
-% more generic
-%
-% IS THIS STILL OK? TO BE CHECKED (UTF AND SUCH) ! ! ! !
-
-\def\XMLexpanded#1%
- {\bgroup
- \honorunexpanded
-% \dontexpandencoding
-% \dontexpandutf
- \chardef\activecharactermode\zerocount
- \xdef\@@globalexpanded{#1}%
- \egroup
- \@@globalexpanded}
-
-\def\setXMLexpandedmark#1#2% using a tok prevents unwanted expansion in mark
- {\XMLexpanded{\scratchtoks{\enableXML#2}}%
- \expanded{\normalsetnormalmark{#1}{\the\scratchtoks}}}
-
-% \separatestring123 456\to\test [\test]
-
-% \def\separatestring#1\to#2%
-% {\let#2\empty
-% \def\docommand##1{\edef#2{\ifx#2\empty\else#2,\fi##1}}%
-% \processseparatedlist[#1][ ]\docommand}
-%
-% \processseparatedlist[aap noot][]\ruledhbox
-
% this will be activated when
% \newinsert\thispageinsert % <- installinsertion
@@ -509,7 +352,7 @@
\expandafter#1%
\fi}
-\gdef\collapsespaces%
+\gdef\collapsespaces
{\prependtoksonce\relax\to\everyeof%
\ignorelines%
\ignoretabs%
@@ -518,165 +361,6 @@
\egroup
-% no, wrong! never!
-%
-% \def\tightlayer[#1]%
-% {\begingroup
-% \def\currentlayer{#1}% todo: left/right
-% \setbox\nextbox\emptybox % hoogte/breedte are \wd\nextbox/\ht\nextbox
-% \hsize\layerparameter\c!width % \overlaywidth = \hsize
-% \vsize\layerparameter\c!height % \overlaywheight = \vsize
-% \hbox to \hsize{\composedlayer{#1}}%
-% \endgroup}
-
-% todo : share symbols
-
-% \definecolor[rollover:n][red]
-% \definecolor[rollover:r][green]
-% \definecolor[rollover:d][blue]
-
-\definepalet
- [rollover]
- [n=red,
- r=green,
- d=blue]
-
-% \newcounter\nofrollovers
-%
-% \def\dorollbutton[#1][#2]#3[#4]%
-% {\dontleavehmode
-% \bgroup
-% \doglobal\increment\nofrollovers
-% \unexpanded\def\dosetlocationbox[##1]##2[##3]%
-% {\getparameters[##1][##3]%
-% \definecolor[rollover][rollover:##2]%
-% \let\next\hbox
-% \doif{##2}{n}
-% {\doifvalue{##1\c!variant}\v!verborgen{\let\next\phantom}}%
-% \next
-% {\localframed[##1]
-% [\c!framecolor=rollover,\c!backgroundcolor=rollover,\c!color=rollover]%
-% {\dolocationattributes{##1}\c!style\c!color{#3}}}}%
-% \iffirstargument
-% \ifsecondargument
-% \def\setlocationbox##1{\dosetlocationbox[\??am#1]{##1}[#2]}%
-% \else
-% \doifassignmentelse{#1}
-% {\def\setlocationbox##1{\dosetlocationbox[\??bt]{##1}[#1]}}
-% {\def\setlocationbox##1{\dosetlocationbox[\??am#1]{##1}[]}}%
-% \fi
-% \else
-% \def\setlocationbox##1{\dosetlocationbox[\??bt]{##1}[]}%
-% \fi
-% % todo: share symbols
-% \definesymbol[rsym:\nofrollovers:n][\setlocationbox n]%
-% \definesymbol[rsym:\nofrollovers:r][\setlocationbox r]%
-% \definesymbol[rsym:\nofrollovers:d][\setlocationbox d]%
-% \nextsystemfield
-% \setupfield
-% [rollbutton]
-% [\c!frame=\v!off,\c!offset=\v!overlay,\c!klickoff={#4}]%
-% \definefield
-% [\currentsystemfield][push][rollbutton]
-% [rsym:\nofrollovers:n,%
-% rsym:\nofrollovers:r,%
-% rsym:\nofrollovers:d]%
-% \fitfield[\currentsystemfield]%
-% \egroup}
-
-\newcounter\nofrollovers
-\newcounter\nofrollbuttons
-
-\def\dorollbutton[#1][#2]#3[#4]%
- {\dontleavehmode
- \bgroup
- \doglobal\increment\nofrollovers
- \doglobal\increment\nofrollbuttons
- \unexpanded\def\dosetlocationbox[##1]##2[##3]%
- {\getparameters[##1][##3]%
- \definecolor[rollover][rollover:##2]%
- \doifelse{##2}{n}{\doifelsevalue{##1\c!alternative}\v!hidden\phantom\hbox}\hbox
- {\localframed[##1]
- [\c!framecolor=rollover,\c!backgroundcolor=rollover,\c!color=rollover]%
- {\dolocationattributes{##1}\c!style\c!color{#3}}}}%
- \iffirstargument
- \ifsecondargument
- \def\setlocationbox##1{\dosetlocationbox[\??am#1]{##1}[#2]}%
- \else
- \doifassignmentelse{#1}
- {\def\setlocationbox##1{\dosetlocationbox[\??bt]{##1}[#1]}}
- {\def\setlocationbox##1{\dosetlocationbox[\??am#1]{##1}[]}}%
- \fi
- \else
- \def\setlocationbox##1{\dosetlocationbox[\??bt]{##1}[]}%
- \fi
- % todo: share symbols, tricky since different dimensions
- \definesymbol[rsym:\nofrollovers:n][\setlocationbox n]%
- \definesymbol[rsym:\nofrollovers:r][\setlocationbox r]%
- \definesymbol[rsym:\nofrollovers:d][\setlocationbox d]%
- \setupfield
- [rollbutton]
- [\c!frame=\v!off,
- \c!offset=\v!overlay,
- \c!clickout={#4}]%
- \definefield
- [roll:\nofrollbuttons][push][rollbutton]
- [rsym:\nofrollovers:n,%
- rsym:\nofrollovers:r,%
- rsym:\nofrollovers:d]%
- \fitfield[roll:\nofrollbuttons]%
- \egroup}
-
-\unexpanded\def\rollbutton
- {\dodoubleempty\dorollbutton}
-
-% \def\do@@amrob[#1]#2\\%
-% {\txt\rollbutton[\currentmenu]{\ignorespaces#2\unskip}[#1]\\}%
-
-% \appendtoks \let\rob\do@@amrob \to \everysetmenucommands
-
-\def\menu@rob[#1]#2\\%
- {\@@amboxcommand\rollbutton[\currentmenu]{\ignorespaces#2\unskip}[#1]\\}%
-
-\appendtoks \let\rob\menu@rob \to \everysetmenucommands
-
-% calls:
-% {..} [JS..]
-% [left] {..} [JS..]
-% [a=b] {..} [JS..]
-% [left] [a=b] {..} [JS..]
-%
-% \setupbuttons[offset=0pt,frame=off] % alternative=hidden
-%
-% \rollbutton {Manuals} [JS(Goto_File{show-man.pdf})]
-% \rollbutton {Articles} [JS(Goto_File{show-art.pdf})]
-% \rollbutton {Papers} [JS(Goto_File{show-pap.pdf})]
-% \rollbutton {Presentations} [JS(Goto_File{show-pre.pdf})]
-% \rollbutton {Resources} [JS(Goto_File{show-res.pdf})]
-%
-% \rob [JS(...)] bla bla \\
-
-\unexpanded\def\overlayrollbutton
- {\dodoubleargument\dooverlayrollbutton}
-
-\def\dooverlayrollbutton[#1][#2]%
- {\bgroup
- \nextsystemfield
- \setupfield
- [overlayrollbutton]
- [\c!frame=\v!off,\c!offset=\v!overlay,\c!regionin={#1},\c!regionout={#2}]%
- \definesymbol
- [\currentsystemfield]
- [{\framed[\c!frame=\v!off,\c!width=\overlaywidth,\c!height=\overlayheight]{}}]%
- \definefield
- [\currentsystemfield][push][overlayrollbutton][\currentsystemfield][\currentsystemfield]%
- \fitfield[\currentsystemfield]%
- \egroup}
-
-% \defineoverlay
-% [ShowMenu]
-% [{\overlayrollbutton[VideLayer{navigation}][HideLayer{navigation}]}]
-
\def\inlinedbox
{\bgroup
\dowithnextbox
@@ -708,19 +392,6 @@
\unexpanded\def\asciistr#1{\dontleavehmode{\defconvertedargument\ascii{#1}\verbatimfont\ascii}}
-% messy, will be improved:
-
-\prependtoks \setnormalcatcodes \to \everyTEXinputmode
-\appendtoks \processingXMLfalse \to \everyTEXinputmode
-
-\let\normalenableXML\enableXML % some day we move the normal \enableXML into the toks
-
-\prependtoks \normalenableXML \to \everyXMLinputmode
-\appendtoks \processingXMLtrue \to \everyXMLinputmode
-
-\unexpanded\def\enableXML {\setinputmode[XML]} % \enableXML is used in edef's and marks
-\unexpanded\def\disableXML{\setinputmode[TEX]}
-
\def\shapefill{\vskip\zeropoint\!!plus\lineheight\!!minus\lineheight\relax}
\let\normaltype\type
@@ -771,10 +442,6 @@
\fi \fi
\advance\boislevel\minusone}
-\defineblankmethod [\v!synchronize] {\verticalstrut\vskip-2\lineheight\verticalstrut}
-
-% \vtop{\blank[synchronize]\blank[line]test}
-
\def\minimalhbox#1#%
{\dowithnextbox
{\bgroup
@@ -784,28 +451,6 @@
\egroup}
\hbox}
-% manual
-%
-% externfiguur -> grid =ja|hoogte|diepte|halveregel|passend -> helemaal in details
-% stelplaatsblokin -> zijuitlijnen=hoogte|diepte|regel|halveregel|grid -> halveregel in 'details'
-
-% todo: switch koppelen aan par scheelt pos
-
-% to be documented: \startspread .. \stopspread
-
-% to be documented primarydef p crossed d
-% to be documented PlainTextArea
-
-% manual
-%
-% Sometimes the demands are getting pretty weird:
-%
-% \startitemize
-% \item test
-% \item test
-% \headsym{xx} test \par test
-% \stopitemize
-
% \def\dodimchoice#1#2#3%
% {\ifx#3\relax
% #1\@EA\gobbleuntilrelax
@@ -853,22 +498,6 @@
\def\showsetupsdefinition[#1]{\showvalue{\??su:#1}} % temp hack for debugging
% documentation : \setupregister[alternative=a|b|A|B]
-
-\def\defineXMLstore {\doquadrupleargument\dodefineXMLstore[\saveXMLasdata]}
-\def\defineXMLgstore{\doquadrupleargument\dodefineXMLstore[\gsaveXMLasdata]}
-
-\def\dodefineXMLstore[#1][#2][#3][#4]% element attribute prefix % will become faster
- {\defineXMLargument[#2][#3=\s!dummy]{#1{#4:\XMLop{#3}}}}
-
-\def\countXMLchildren[#1]#2%
- {\startnointerference
- \doglobal\newcounter\nofXMLchildren
- \defineXMLargument[#1]{\doglobal\increment\nofXMLchildren}%
- \startXMLignore
- #2%
- \stopXMLignore
- \stopnointerference}
-
\unprotected \def\traceposstring#1#2#3%
{\iftracepositions
\smashedhbox%
@@ -878,144 +507,6 @@
\vrule\!!width4\scratchdimen\!!height\scratchdimen\!!depth\scratchdimen}%
\fi}
-% It took quite a while to figure this out (using the preliminary 1.5
-% spec). There are still a lot of things to be implemented. This is
-% the third alternative.
-
-% todo: multiple instances, dus indirect
-
-\let\currentrendering\empty
-
-\definereference[StartCurrentRendering] [\v!StartRendering {\currentrendering}]
-\definereference[StopCurrentRendering] [\v!StopRendering {\currentrendering}]
-\definereference[PauseCurrentRendering] [\v!PauseRendering {\currentrendering}]
-\definereference[ResumeCurrentRendering][\v!ResumeRendering{\currentrendering}]
-
-\newcounter\nofexternalrenderings
-
-\def\useexternalrendering{\doquadrupleempty\douseexternalrendering}
-\def\setinternalrendering{\dodoubleempty \dosetinternalrendering}
-
-\def\douseexternalrendering[#1][#2][#3][#4]% tag mime file options
- {\setgvalue{\??rd:#1}{\plusone{#1}{#2}{#3}{#4}}}
-
-\def\dosetinternalrendering[#1][#2]% tag options {content}
- {\bgroup
- \dowithnextbox
- {\setgvalue{\??rd:#1}{\plustwo{#1}{IRO}{#1}{#2}}%
- \let\objectoffset\zeropoint
- \setobject{IRO}{#1}\hbox{\box\nextbox}%
- \egroup}%
- \hbox}
-
-\def\checkrendering#1% let's hope that \next is not used
- {\iflocation
- \doifsomething{#1}%
- {\doifdefined{\??rd:#1}%
- {\expanded{\getvalue{\??rd::\number\renderingtype{#1}}%
- {\filterfromvalue{\??rd:#1}52}{\filterfromvalue{\??rd:#1}53}%
- {\filterfromvalue{\??rd:#1}54}{\filterfromvalue{\??rd:#1}55}}}}%
- \fi}
-
-\setvalue{\??rd::1}{\doinsertrendering}
-\setvalue{\??rd::2}{\doinsertrenderingobject}
-
-\def\renderingtype #1{\filterfromvalue{\??rd:#1}51}
-\def\renderingoptions#1{\filterfromvalue{\??rd:#1}55}
-
-\setexecutecommandcheck {startrendering} \checkrendering
-\setexecutecommandcheck {stoprendering} \checkrendering
-\setexecutecommandcheck {pauserendering} \checkrendering
-\setexecutecommandcheck {resumerendering} \checkrendering
-
-% by using a nice trick (used in other places of context as well) we
-% can easily overload the default size to match the opbject size
-
-\def\renderingwidth {8cm}
-\def\renderingheight{6cm}
-
-\def\definerenderingwindow
- {\dodoubleempty\dodefinerenderingwindow}
-
-\def\dodefinerenderingwindow[#1][#2]%
- {\presetlocalframed[\??rw#1]%
- \getparameters%
- [\??rw#1]%
- [\c!openpageaction=,\c!closepageaction=,%
- \c!width=\renderingwidth,\c!height=\renderingheight,%
- #2]}
-
-\def\setuprenderingwindow
- {\dodoubleargument\dosetuprenderingwindow}
-
-\def\dosetuprenderingwindow[#1]%
- {\getparameters[\??rw#1]}
-
-\def\placerenderingwindow
- {\dodoubleempty\doplacerenderingwindow}
-
-\def\doplacerenderingwindow[#1][#2]%
- {\bgroup
- \edef\currentrendering{\ifsecondargument#2\else#1\fi}%
- \ifcase\renderingtype\currentrendering\or
- % a file
- \or
- % an object
- \getobjectdimensions{IRO}\currentrendering
- \scratchdimen\objectheight
- \advance\scratchdimen\objectdepth
- \edef\renderingheight{\the\scratchdimen}%
- \edef\renderingwidth{\objectwidth}%
- \fi
- % create fall back if needed
- \doifdefinedelse{\??rw#1\c!width}
- {\def\currentrenderingwindow{#1}}
- {\let\currentrenderingwindow\s!default
- \definerenderingwindow[\currentrenderingwindow]}%
- \checkrendering\currentrendering
- \handlereferenceactions{\getvalue{\??rw\currentrenderingwindow\c!openpageaction }}\dosetuprenderingopenpageaction
- \handlereferenceactions{\getvalue{\??rw\currentrenderingwindow\c!closepageaction}}\dosetuprenderingclosepageaction
- \localframed
- [\??rw\currentrenderingwindow][\c!offset=\v!overlay]%
- {\expanded{\doinsertrenderingwindow
- \noexpand\currentrendering\hsize\vsize{\renderingoptions\currentrendering}}}%
- \egroup}
-
-% todo:
-%
-% \setinternalrendering[example-1][options]{}
-
-% test file:
-%
-% \definerenderingwindow
-% [example]
-% [width=320pt,height=150pt,frame=off,
-% background=color,backgroundcolor=gray,
-% openpageaction=StartCurrentRendering,
-% closepageaction=NextPage]% StopCurrentRendering]
-%
-% \useexternalrendering[example-1][audio/mpeg] [eldorado.mp3]
-% \useexternalrendering[example-2][audio/mpeg] [myst-12.mp3]
-% \useexternalrendering[example-3][application/x-shockwave-flash][http://localhost/mb.swf] [auto]
-% \useexternalrendering[example-4][application/x-shockwave-flash][celebration.swf]
-% \useexternalrendering[example-5][video/quicktime] [p1000726.mov]
-% \useexternalrendering[example-6][application/smil] [quadratic_map.smi]
-%
-% \def\renderingmenu[#1]%
-% {\hbox
-% {\setupbuttons[width=2.5em]%
-% \button{\symbol[StartRendering]} [StartRendering{#1}]\enspace
-% \button{\symbol[StopRendering]} [StopRendering{#1}]\enspace
-% \button{\symbol[PauseRendering]} [PauseRendering{#1}]\enspace
-% \button{\symbol[ResumeRendering]}[ResumeRendering{#1}]}}
-%
-% \renderingmenu[example-1]\blank
-% \renderingmenu[example-2]\blank
-% \renderingmenu[example-3]\blank
-% \renderingmenu[example-4] \placefigure{A ShockWave}{\placerenderingwindow[example][example-4]} \page
-% \renderingmenu[example-5] \placefigure{A Movie}{\placerenderingwindow[example][example-5]} \page
-% \renderingmenu[example-6] \placefigure{A Smile}{\placerenderingwindow[example][example-6]}
-
% will be a MyWay
%
% \setuplayout[grid=yes] \setupcaption[figure][inbetween=] \useMPlibrary[dum] \setupcolors[state=start]
@@ -1118,94 +609,12 @@
{\endgraf\verticalstrut\endgraf\kern-2\lineheight
\egroup}
-\def\definepushbutton % name optional setup
- {\dodoubleempty\dodefinepushbutton}
-
-\def\dodefinepushbutton[#1][#2]% name setup
- {\dododefinepushbutton{#1}{n}{push}%
- \dododefinepushbutton{#1}{r}{\symbol[psym:#1:n]}%
- \dododefinepushbutton{#1}{d}{\symbol[psym:#1:r]}%
- \setvalue{pushbutton:#1}{\dohandlepushbutton{#1}{#2}}}
-
-\def\dododefinepushbutton#1#2#3%
- {\doifsymboldefinedelse{psym:#1:#2}%
- \donothing{\definesymbol[psym:#1:#2][{#3}]}}
-
-\def\definepushsymbol
- {\dotripleargument\dodefinepushsymbol}
-
-\def\dodefinepushsymbol[#1][#2]% [#3]
- {\definesymbol[psym:#1:#2]}
-
-\def\dopushbutton[#1][#2]%
- {\executeifdefined{pushbutton:#1}\gobbleoneargument{#2}}
-
-\def\pushbutton
- {\dodoubleargument\dopushbutton}
-
-\def\dohandlepushbutton#1#2#3% identifier setup script
- {\bgroup
- \nextsystemfield
- \setupfield
- [pushbutton]
- [\c!frame=\v!overlay,
- \c!offset=\v!overlay,
- \c!clickout=#3,#2]%
- \definefield
- [\currentsystemfield]
- [push]
- [pushbutton]
- [psym:#1:n,psym:#1:r,psym:#1:d]%
- \fitfield
- [\currentsystemfield]%
- \egroup}
-
-% \def\do@@ampsh
-% {\dodoubleargument\dodo@@ampsh}
-%
-% \def\dodo@@ampsh[#1][#2]#3\\%
-% {\txt\pushbutton[#1][#2]\\}%
-%
-%\appendtoks \let\psh\do@@ampsh \to \everysetmenucommands
-
-\def\@@ampsh{\txt\pushbutton}
-
-\appendtoks \let\psh\@@ampsh \to \everysetmenucommands
-
-% \definepushbutton [reset]
-%
-% \definepushsymbol [reset] [n] [\uniqueMPgraphic{whatever}{color=green}]
-% \definepushsymbol [reset] [r] [\uniqueMPgraphic{whatever}{color=white}]
-%
-% \startinteractionmenu[bottom]
-% \psh [reset] [JS(reset_something)] \\
-% \stopinteractionmenu
-
\def\tabulaterule % to be redone, not correct
{\dotabulaterule
{\hrule\!!height.5\scratchdimen\!!depth.5\scratchdimen\relax
\doifvalue{\??tt\currenttabulate\c!distance}\v!grid
{\kern-\scratchdimen}}} % experimental tm-prikkels
-% todo: \setupinterlinespace[\c!regel=\v!vast] => ==\the\baselineskip
-
-%%%%%%%% todo: \chardef\snapstruts=1 => d=l-h
-
-\def\useMPvariables
- {\dodoubleargument\douseMPvariables}
-
-\def\douseMPvariables[#1][#2]%
- {\def\@@meta{#1:}%
- \prepareMPvariables{#2}}
-
-\def\processlinetableXMLfile#1%
- {\bgroup
- \let\startlinetable\donothing
- \let\stoplinetable \donothing
- \startlinetableanalysis\processXMLfile{#1}\stoplinetableanalysis
- \startlinetablerun \processXMLfile{#1}\stoplinetablerun
- \egroup}
-
% experimental: \synchronizegrid bla bla bla
\newcounter\currentgridsync
@@ -1241,13 +650,10 @@
% \message{no grid correction: \the\scratchdimen}\wait
\fi}
-% needed for extreme
+% needed for extreme (will go away)
\definesystemvariable{ie}
-% \def\definetest[#1]#2%
-% {\long\setvalue{\??ie#1}{#2}}
-
\def\definetest
{\dodoubleempty\dodefinetest}
@@ -1257,13 +663,13 @@
\processaction
[#2]
[% first test true, rest depends
- \v!next=>\setgvalue{\??ie#1}{\setgvalue{\??ie#1}{#3}\firstoftwoarguments},
+ \v!next=>\setgvalue{\??ie#1}{\setgvalue{\??ie#1}{#3}\firstoftwoarguments},
% rest true if first true
% \v!first=>\setgvalue{\??ie#1}{#3{\letgvalue{\??ie#1}%
- % \firstoftwoarguments\firstoftwoarguments}%
- % \secondoftwoarguments},
+ % \firstoftwoarguments\firstoftwoarguments}%
+ % \secondoftwoarguments},
% always true
- \v!yes=>\letgvalue{\??ie#1}\firstoftwoarguments,
+ \v!yes=>\letgvalue{\??ie#1}\firstoftwoarguments,
% always false
\v!no=>\letgvalue{\??ie#1}\secondoftwoarguments]%
\fi}
@@ -1296,42 +702,13 @@
% \tableifelse{\doifelse{a}{a}}{\NC Xtest \NC test \NC \NR}{}%
% \stoptabulate}
-\long \def\tableifelse#1%
+\long\def\tableifelse#1%
{\TABLEnoalign{#1%
{\aftergroup \firstoftwoarguments}%
{\aftergroup\secondoftwoarguments}}}
-% \long \def\tableif#1% whow, this is real ugly
-% {\TABLEnoalign{\let\gnext\gobbleoneargument#1%
-% {\let\gnext\firstofoneargument}}\gnext}
-
\long \def\tableiftextelse#1{\tableifelse{\doiftextelse{#1}}}
-\def\expandifnonempty#1%
- {\@EA\ifx\csname#1\endcsname\empty
- \expandafter\secondoftwoarguments
- \else
- \expandafter\firstoftwoarguments
- \fi
- {\csname#1\endcsname}}
-
-\def\@@sectiekoppeling#1%
- {\expandifnonempty{\??ko#1\c!coupling}{#1}}
-
-\def\@@sectiesectie#1%
- {\expandifnonempty{\??ko#1\c!section}{\@@sectiekoppeling{#1}}}
-
-\def\sectioncountervalue#1%
- {\@@sectionvalue{\@@sectiesectie{#1}}}
-
-% todo namespace \@@meta:#1:... ! ! ! ! ! !
-
-\def\presetMPvariable
- {\dodoubleargument\dopresetMPvariable}
-
-\def\dopresetMPvariable[#1][#2=#3]%
- {\doifundefined{#1:#2}{\setvalue{#1:#2}{#3}}}
-
% experiment, not yet to be used
\def\displaybreak
@@ -1347,30 +724,6 @@
\def\tightvbox{\dowithnextbox{\nextboxdp\zeropoint\flushnextbox}\vbox}
\def\tightvtop{\dowithnextbox{\nextboxht\zeropoint\flushnextbox}\vtop}
-% \translateMPinput{il2-pl}
-%
-% \startMPenvironment[global]
-% \setupbodyfont[plr]
-% \stopMPenvironment
-%
-% \TeX:
-%
-% \startMPcode
-% draw btex MetaPost: etex scaled 5 ;
-% \stopMPcode
-
-% now in cont-loc.tex, for the sake of testing.
-%
-% %D When \type {\somecolor} is issued, we can savely assume
-% %D grouping. Using \type {\groupedcommand} here (i.e.\ the
-% %D definition of \type {\color}) is unsafe because in
-% %D interferes with for instance switching attributes.
-%
-% \def\switchtocolor[#1]%
-% {\bgroup\startcolor[#1]
-% \aftergroup\stopcolor
-% \aftergroup\egroup}
-
% what is this stupid macro meant for:
\def\hyphenationpoint
@@ -1502,8 +855,6 @@
\egroup
\synchronizehsize}
-% todo : hoe komt box er uit
-
\long\def\startexternalfigure
{\dotripleempty\dostartexternalfigure}
@@ -1538,6 +889,18 @@
%% \def\changedpage#1%
%% {\getvalue{\s!paragraph:p:#1}}
+\newcount\nofprofiled
+
+\def\profilemacro#1%
+ {\nofprofiled\zerocount
+ \letvalue{\string#1\string#1}#1%
+ \appendtoks
+ \normalwritestatus\m!systems{profile \string#1: \number\nofprofiled}%
+ \to \everystoptext
+ \unexpanded\def#1%
+ {\global\advance\nofprofiled\plusone
+ \csname\string#1\string#1\endcsname}}
+
% incomplete, will be a special case of float placement
\def\startfixed{\dosingleempty\dostartfixed}
@@ -1555,7 +918,7 @@
\processaction
[#2]
[ \v!high=>\bbox {\flushnextbox},
- \v!low=>\tbox {\flushnextbox},
+ \v!low=>\tbox {\flushnextbox},
\v!middle=>\vcenter{\flushnextbox},
\v!lohi=>\vcenter{\flushnextbox},
\s!unknown=>\tbox {\flushnextbox},
@@ -1596,44 +959,29 @@
%
% \stopitemize
-% still needed for uguide
-
-\let\placefloatlabel \placefloatcaption
-\let\placefloatlabeltext \placefloatcaptiontext
-\let\placefloatlabelreference \placefloatcaptionreference
-
\def\obeyfollowingtoken{{}} % end \cs scanning
-\def\gobbleparameters{\doquadrupleempty\dogobbleparameters}
-\def\dogobbleparameters[#1][#2][#3][#4]{}
-
-% documentation
-
-% \starttable[|||]
-% \HL
-% \VL test \VS test \VL \FR
-% \VL test \VD test \VL \MR
-% \VL test \VT test \VL \LR
-% \HL
-% \stoptable
-
-%D To be documented, \type {\includemenu[menu]}.
-%D To be documented, \type {\emphbf} cum suis.
-
-%D For Ton. To be documented.
-
-\def\plaatsexterndocument[#1]%
- {\def\doexternaldocument##1##2##3{\readlocfile{##2}\donothing\donothing}%
- \getvalue{\v!file:::#1}}
-
-%D Far from complete.
-
-\def\startgeheel
- {\startlinecorrection
- \insidefloattrue}
-
-\def\stopgeheel
- {\stoplinecorrection}
+% \def\comparedimension#1#2%
+% {\chardef\compresult
+% \ifdim#1<#2%
+% \zerocount
+% \else\ifdim#1<#2%
+% \plusone
+% \else
+% \plustwo
+% \fi\fi}
+% \newdimen\roundingeps \roundingeps=10sp
+% \def\comparedimensioneps#1#2%
+% {\chardef\compresult
+% \ifdim\dimexpr(#1-#2)<\roudingeps
+% \zerocount
+% \else\ifdim\dimexpr(#2-#1)<\roudingeps
+% \zerocount
+% \else\ifdim#1<#2%
+% \plusone
+% \else
+% \plustwo
+% \fi\fi\fi}
%D Next we load a few local optimizations and new features. They
%D live on on my machine and are not distributed, but they may end
@@ -1643,6 +991,6 @@
\readsysfile {cont-loc} {} {} % local improvements, patches, new features
\readsysfile {cont-exp} {} {} % experimental features (e.g. local speed-ups)
-\readsysfile {cont-mtx} {} {} % experimental metatex features
+%readsysfile {cont-mtx} {} {} % experimental metatex features
\protect \endinput
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index 61650e4fd..24a4d6514 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -15,35 +15,35 @@
%D manipulation macros. The first one loads \PLAIN\ \TEX, as
%D minimal as possible.
-\loadcorefile{syst-ini.tex}
-\loadcorefile{norm-tex.tex}
-\loadcorefile{norm-etx.tex}
-\loadcorefile{norm-ptx.tex}
-\loadcorefile{norm-xtx.tex}
-\loadcorefile{norm-ctx.tex}
-\loadcorefile{syst-pln.tex}
+\loadcorefile{syst-ini}
+\loadcorefile{norm-tex}
+\loadcorefile{norm-etx}
+\loadcorefile{norm-ptx}
+\loadcorefile{norm-xtx}
+\loadcorefile{norm-ctx}
+\loadcorefile{syst-pln}
\loadmarkfile{catc-ini}
-\loadcorefile{catc-act.tex}
-\loadcorefile{catc-def.tex}
-\loadcorefile{catc-ctx.tex}
-\loadcorefile{catc-sym.tex}
-
-\loadcorefile{syst-gen.tex}
-\loadcorefile{syst-ext.tex}
-\loadcorefile{syst-new.tex}
+\loadcorefile{catc-act}
+\loadcorefile{catc-def}
+\loadcorefile{catc-ctx}
+\loadcorefile{catc-sym}
+
+\loadmarkfile{syst-gen}
+\loadmarkfile{syst-ext}
+\loadmarkfile{syst-new}
\loadmarkfile{syst-con}
-\loadcorefile{thrd-trg.tex} % based on: David Carlisle
+\loadmarkfile{thrd-trg} % based on: David Carlisle
\loadmarkfile{syst-fnt}
\loadmarkfile{syst-str}
\loadmarkfile{syst-rtp}
\ifnum\texengine=\xetexengine
- \loadcorefile{xetx-ini.tex}
- \loadcorefile{xetx-utf.tex}
- \loadcorefile{xetx-chr.tex}
- \loadcorefile{xetx-cls.tex}
+ \loadmarkfile{xetx-ini}
+ \loadmarkfile{xetx-utf}
+ \loadmarkfile{xetx-chr}
+ \loadmarkfile{xetx-cls}
\fi
%D To enable selective loading, we say:
@@ -60,36 +60,35 @@
%D modules.
\loadmarkfile{mult-ini}
-\loadcorefile{mult-fst.tex}
-\loadcorefile{mult-sys.tex}
-\loadcorefile{mult-def.tex}
+\loadcorefile{mult-fst}
+\loadcorefile{mult-sys}
+\loadcorefile{mult-def}
\loadmarkfile{mult-chk}
%D Now we're ready for some general support modules. These
%D modules implement some basic typesetting functionality.
-\loadcorefile{core-var.tex}
+\loadmarkfile{core-var}
\loadmarkfile{core-env}
-\loadcorefile{supp-box.tex}
-\loadcorefile{supp-mrk.tex}
-\loadcorefile{supp-vis.tex}
-\loadcorefile{supp-fun.tex}
-%loadcorefile{supp-eps.tex}
-\loadcorefile{supp-spe.tex}
+\loadcorefile{supp-box}
+\loadmarkfile{supp-mrk}
+\loadcorefile{supp-vis}
+\loadcorefile{supp-fun}
+%loadmarkfile{supp-eps}
+\loadmarkfile{supp-spe}
\loadmarkfile{supp-ran}
-%loadcorefile{supp-mps.tex}
-\loadmkiifile{supp-mps.tex}
-\loadmkiifile{supp-tpi.tex}
-\loadcorefile{supp-mat.tex}
-\loadcorefile{supp-ali.tex}
-\loadcorefile{supp-num.tex}
+\loadmarkfile{supp-mps}
+\loadmarkfile{supp-tpi}
+\loadcorefile{supp-mat}
+\loadcorefile{supp-ali}
+\loadcorefile{supp-num}
%D Verbatim typesetting is implemented in a separate class of
%D modules. The pretty typesetting modules are loaded at run
%D time.
-\loadcorefile{verb-ini.tex}
+\loadmarkfile{verb-ini}
%D The following modules are not sequentially dependent,
%D i.e. they have ugly dependencies, which will be cleaned
@@ -99,33 +98,33 @@
%D bit more advanced file handling as well as some general
%D variables, and features, so next we load:
-\loadcorefile{core-ins.tex}
-\loadcorefile{core-fil.tex}
+\loadmarkfile{page-ins}
+\loadmarkfile{core-fil}
\loadmarkfile{core-con}
%D We already need some synonyms (patterns). At runtime this
%D file will be reloaded.
-\loadcorefile{cont-fil.tex}
+\loadcorefile{cont-fil}
%D \CONTEXT\ does not implement its own table handling. We
%D just go for the best there is and load \TABLE. Just to be
%D sure we do it here, before we redefine \type{|}.
-\loadcorefile{thrd-tab.tex} % based on: Michael Wichura / will be reimplemented
+\loadcorefile{thrd-tab} % based on: Michael Wichura / will be reimplemented
%D Here comes the last support modules. They take care of
%D some language specific things.
-\loadcorefile{supp-pat.tex}
+\loadmarkfile{supp-pat}
%D The next few modules do what their names state. They
%D load additional definition modules when needed.
\loadmarkfile{regi-ini}
-\loadcorefile{regi-syn.tex}
+\loadcorefile{regi-syn}
\loadmarkfile{enco-ini}
-%loadcorefile{filt-ini.tex}
+%loadmarkfile{filt-ini}
\loadmarkfile{hand-ini}
\loadmarkfile{lang-ini}
@@ -134,15 +133,15 @@
\loadmarkfile{unic-ini}
-\loadcorefile{core-gen.tex}
+\loadmarkfile{core-gen}
\loadmarkfile{core-uti}
\loadmarkfile{core-two}
-\loadcorefile{core-stg.tex}
+\loadmarkfile{core-stg}
-\loadcorefile{spec-ini.tex}
-\loadcorefile{spec-mis.tex}
-\loadcorefile{spec-def.tex}
-\loadcorefile{spec-var.tex}
+\loadmarkfile{spec-ini}
+\loadmarkfile{spec-mis}
+\loadmarkfile{spec-def}
+\loadmarkfile{spec-var}
\loadmarkfile{colo-ini}
\loadmarkfile{colo-ext}
@@ -150,29 +149,28 @@
%D For the moment we load a lot of languages. In the future
%D we'll have to be more space conservative.
-\loadcorefile{lang-mis.tex}
+\loadmarkfile{lang-mis}
\loadmarkfile{lang-url}
-\loadcorefile{lang-ger.tex}
-\loadcorefile{lang-ita.tex}
-\loadcorefile{lang-sla.tex}
-\loadcorefile{lang-alt.tex}
-\loadcorefile{lang-ana.tex}
-\loadcorefile{lang-art.tex}
-\loadcorefile{lang-bal.tex}
-\loadcorefile{lang-cel.tex}
-\loadcorefile{lang-grk.tex}
-\loadcorefile{lang-ind.tex}
-\loadcorefile{lang-ura.tex}
-\loadcorefile{lang-vn.tex}
-\loadcorefile{lang-ara.tex}
-\loadcorefile{lang-cyr.tex}
+\loadcorefile{lang-ger}
+\loadcorefile{lang-ita}
+\loadcorefile{lang-sla}
+\loadcorefile{lang-alt}
+\loadcorefile{lang-ana}
+\loadcorefile{lang-art}
+\loadcorefile{lang-bal}
+\loadcorefile{lang-cel}
+\loadcorefile{lang-grk}
+\loadcorefile{lang-ind}
+\loadcorefile{lang-ura}
+\loadcorefile{lang-vn}
+\loadcorefile{lang-cyr}
\loadmarkfile{typo-ini}
%D All kind of symbols are handled in:
-\loadcorefile{symb-ini.tex}
+\loadmarkfile{symb-ini}
%D Sorting:
@@ -183,10 +181,9 @@
%D is important, due to dependancies.
\loadmarkfile{core-spa}
-\loadcorefile{core-grd.tex}
+\loadmarkfile{core-grd}
\loadmarkfile{strc-mar}
\loadmarkfile{anch-pos}
-\loadcorefile{core-mak.tex}
\loadmarkfile{buff-ver}
\loadmarkfile{buff-ini}
@@ -194,9 +191,9 @@
\loadmarkfile{pack-rul}
\loadmarkfile{trac-vis}
\loadmarkfile{strc-num}
-\loadcorefile{tabl-pln.tex}
-\loadcorefile{tabl-tab.tex}
-\loadcorefile{tabl-tsp.tex}
+\loadmarkfile{tabl-pln}
+\loadmarkfile{tabl-tab}
+\loadmarkfile{tabl-tsp}
\loadmarkfile{scrn-nav}
\loadmarkfile{strc-ref}
\loadmarkfile{pack-obj}
@@ -209,22 +206,22 @@
\loadmarkfile{page-ini}
\loadmarkfile{page-bck}
-\loadcorefile{page-not.tex}
+\loadmarkfile{page-not}
\loadmarkfile{page-one}
-\loadcorefile{page-lay.tex}
-\loadmkiifile{page-log.tex}
+\loadmarkfile{page-lay}
+\loadmarkfile{page-log}
\loadmarkfile{page-txt}
-\loadcorefile{page-sid.tex}
+\loadmarkfile{page-sid}
\loadmarkfile{strc-flt}
-\loadcorefile{page-mis.tex}
-\loadcorefile{page-mul.tex}
-\loadcorefile{page-set.tex}
+\loadmarkfile{page-mis}
+\loadmarkfile{page-mul}
+\loadmarkfile{page-set}
\loadmarkfile{pack-lyr}
-\loadcorefile{page-mak.tex}
+\loadmarkfile{page-mak}
\loadmarkfile{strc-pag}
\loadmarkfile{page-lin}
-\loadcorefile{page-par.tex}
-\loadcorefile{page-mar.tex}
+\loadmarkfile{page-par}
+\loadmarkfile{page-mar}
\loadmarkfile{core-job} % why so late?
@@ -234,18 +231,19 @@
\loadmarkfile{strc-swd}
\loadmarkfile{strc-blk}
-\loadcorefile{page-imp.tex}
-\loadcorefile{tabl-tbl.tex}
+\loadmarkfile{page-imp}
+\loadmarkfile{tabl-tbl}
\loadmarkfile{scrn-int}
\loadmarkfile{tabl-ntb}
-\loadcorefile{tabl-nte.tex}
-\loadcorefile{tabl-ltb.tex}
+\loadmarkfile{tabl-nte}
+\loadmarkfile{tabl-ltb}
%D A few more languages, that have specifics using core
%D functionality:
-\loadcorefile{lang-chi.tex}
-\loadcorefile{lang-jap.tex}
+%loadmarkfile{lang-ara} % undefined
+\loadmarkfile{lang-chi}
+\loadmarkfile{lang-jap}
%D How about fill||in fields and related stuff?
@@ -265,17 +263,17 @@
\loadmarkfile{font-ini}
\ifnum\texengine=\xetexengine
- \loadcorefile{font-xtx.tex}
+ \loadmarkfile{font-xtx}
\fi
\loadmarkfile{font-unk}
\loadmarkfile{font-uni}
-\loadcorefile{font-bfm.tex}
+\loadmarkfile{font-bfm}
-\loadcorefile{enco-pfr.tex}
+\loadmarkfile{enco-pfr}
\loadmarkfile{type-ini}
-\loadcorefile{type-def.tex}
+\loadcorefile{type-def}
%D Properties. Don't ask.
@@ -290,20 +288,20 @@
\loadmarkfile{meta-tex}
\loadmarkfile{meta-pdf}
-\loadcorefile{meta-pag.tex}
+\loadmarkfile{meta-pag}
%D Special page handling (maybe even later)
-\loadcorefile{page-flw.tex}
-\loadcorefile{page-spr.tex}
-\loadcorefile{page-plg.tex}
-\loadcorefile{page-str.tex}
+\loadmarkfile{page-flw}
+\loadmarkfile{page-spr}
+\loadmarkfile{page-plg}
+\loadmarkfile{page-str}
%D Anchoring graphics:
\loadmarkfile{anch-pgr}
-\loadcorefile{anch-bar.tex}
-\loadcorefile{anch-snc.tex}
+\loadcorefile{anch-bar}
+\loadcorefile{anch-snc}
%D Math.
@@ -316,7 +314,7 @@
\loadmarkfile{core-fnt}
\loadmarkfile{strc-not}
-\loadcorefile{core-lnt.tex}
+\loadmarkfile{strc-lnt}
\loadmarkfile{core-mis}
@@ -324,35 +322,35 @@
\loadmarkfile{grph-inc}
\loadmarkfile{grph-fig}
-\loadcorefile{core-par.tex}
+\loadmarkfile{core-par}
\loadmarkfile{pack-box}
-\loadcorefile{page-app.tex}
+\loadmarkfile{page-app}
\loadmarkfile{meta-fig}
%D Language specific spacing.
-\loadcorefile{lang-spa.tex}
+\loadcorefile{lang-spa}
%D Only the basic XML parser and remapper are part of the core.
%D These macros are loaded last since they overload and|/|or
%D extend previously defined ones.
-\loadcorefile{xtag-ini.tex}
-\loadcorefile{xtag-ext.tex}
-\loadcorefile{xtag-exp.tex}
-\loadcorefile{xtag-pre.tex}
-\loadcorefile{xtag-xsd.tex}
-\loadcorefile{xtag-rng.tex}
+\loadcorefile{xtag-ini}
+\loadcorefile{xtag-ext}
+\loadcorefile{xtag-exp}
+\loadcorefile{xtag-pre}
+\loadcorefile{xtag-xsd}
+\loadcorefile{xtag-rng}
%D How about this:
-\loadcorefile{meta-xml.tex}
+\loadcorefile{meta-xml}
%D \TEX\ related logo's are always typeset in a special way.
%D Here they come:
-\loadcorefile{cont-log.tex}
+\loadcorefile{cont-log}
%D This one overloads af few things:
@@ -361,8 +359,7 @@
%D Defaults go here (more will be moved to this module
%D later):
-\loadcorefile{core-lme.tex}
-\loadcorefile{core-ini.tex}
+\loadmarkfile{core-ini}
\loadmarkfile{core-def}
%D Preloaded modules (some need xml support):
@@ -383,4 +380,4 @@
% %D Except from english, no hyphenation patterns are loaded
% %D yet. Users can specify their needs in the next module:
%
-% \input cont-usr.tex
+% \input cont-usr
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index fc3149f6b..735d1c780 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -18,19 +18,25 @@
%D manipulation macros. The first one loads \PLAIN\ \TEX, as
%D minimal as possible.
-\loadcorefile{syst-ini.tex}
-\loadcorefile{norm-ctx.tex}
-\loadcorefile{syst-pln.tex}
+\loadcorefile{syst-ini}
+
+\ifnum\luatexversion<42
+ \writestatus{!!!!}{Your luatex binary is way too old, you need at least version 0.42.}
+ \expandafter\end
+\fi
+
+\loadcorefile{norm-ctx}
+\loadcorefile{syst-pln}
\loadmarkfile{luat-cod}
\loadmarkfile{luat-bas}
\loadmarkfile{luat-lib}
\loadmarkfile{catc-ini}
-\loadcorefile{catc-act.tex}
-\loadcorefile{catc-def.tex}
-\loadcorefile{catc-ctx.tex}
-\loadcorefile{catc-sym.tex}
+\loadcorefile{catc-act}
+\loadcorefile{catc-def}
+\loadcorefile{catc-ctx}
+\loadcorefile{catc-sym}
\newif\ifCONTEXT \CONTEXTtrue % will disappear
@@ -50,10 +56,11 @@
\loadmarkfile{char-act}
\loadmarkfile{mult-ini}
-\loadcorefile{mult-fst.tex}
-\loadcorefile{mult-sys.tex}
-\loadcorefile{mult-def.tex}
+\loadcorefile{mult-fst}
+\loadcorefile{mult-sys}
+\loadcorefile{mult-def}
\loadmarkfile{mult-chk}
+\loadmarkfile{mult-cld}
\loadmarkfile{luat-ini}
@@ -63,12 +70,11 @@
\loadmarkfile{node-fin}
\loadmarkfile{node-par}
-\loadcorefile{core-var.tex}
-
-\loadmarkfile{lpdf-ini}
+\loadmarkfile{core-var}
\loadmarkfile{back-ini}
-\loadmarkfile{back-pdf}
+\loadmarkfile{lpdf-ini} % some day back-ini will load this
+\loadmarkfile{back-pdf} % some day back-ini will load this
\loadmarkfile{attr-ini}
@@ -77,71 +83,70 @@
\loadmarkfile{trac-lmx}
\loadmarkfile{trac-deb}
-\loadcorefile{supp-box.tex}
+\loadcorefile{supp-box}
-\loadcorefile{supp-vis.tex}
-\loadcorefile{supp-fun.tex}
+\loadcorefile{supp-vis}
+\loadcorefile{supp-fun}
\loadmarkfile{supp-ran}
-\loadcorefile{supp-mat.tex}
-\loadcorefile{supp-ali.tex}
-\loadcorefile{supp-num.tex}
+\loadcorefile{supp-mat}
+\loadcorefile{supp-ali}
+\loadcorefile{supp-num}
\loadmarkfile{typo-ini}
-\loadcorefile{core-ins.tex}
-\loadcorefile{core-fil.tex}
+\loadmarkfile{page-ins}
+\loadmarkfile{core-fil}
\loadmarkfile{core-con}
-\loadcorefile{cont-fil.tex}
+\loadcorefile{cont-fil}
\loadmarkfile{regi-ini}
-\loadcorefile{regi-syn.tex}
+\loadcorefile{regi-syn}
\loadmarkfile{enco-ini}
\loadmarkfile{hand-ini}
\loadmarkfile{lang-ini}
-\loadmarkfile{lang-spe}
\loadmarkfile{lang-lab}
\loadmarkfile{unic-ini}
-\loadcorefile{core-gen.tex}
+\loadmarkfile{core-gen}
\loadmarkfile{core-uti}
\loadmarkfile{core-two}
-\loadcorefile{core-stg.tex}
\loadmarkfile{colo-ini}
\loadmarkfile{colo-ext}
\loadmarkfile{trac-vis}
-\loadcorefile{lang-mis.tex}
+\loadmarkfile{lang-mis}
\loadmarkfile{lang-url}
-\loadcorefile{lang-ger.tex}
-\loadcorefile{lang-ita.tex}
-\loadcorefile{lang-sla.tex}
-\loadcorefile{lang-alt.tex}
-\loadcorefile{lang-ana.tex}
-\loadcorefile{lang-art.tex}
-\loadcorefile{lang-bal.tex}
-\loadcorefile{lang-cel.tex}
-\loadcorefile{lang-grk.tex}
-\loadcorefile{lang-ind.tex}
-\loadcorefile{lang-ura.tex}
-\loadcorefile{lang-cjk.tex}
-\loadcorefile{lang-vn.tex}
-\loadcorefile{lang-ara.tex}
-\loadcorefile{lang-cyr.tex}
-
-\loadcorefile{symb-ini.tex}
+\loadcorefile{lang-ger}
+\loadcorefile{lang-ita}
+\loadcorefile{lang-sla}
+\loadcorefile{lang-alt}
+\loadcorefile{lang-ana}
+\loadcorefile{lang-art}
+\loadcorefile{lang-bal}
+\loadcorefile{lang-cel}
+\loadcorefile{lang-grk}
+\loadcorefile{lang-ind}
+\loadcorefile{lang-ura}
+\loadcorefile{lang-vn}
+\loadcorefile{lang-cyr}
+
+\loadmarkfile{lang-ara}
+\loadmarkfile{lang-cjk}
+
+\loadmarkfile{symb-ini}
\loadmarkfile{sort-ini}
\loadmarkfile{pack-rul}
-\loadcorefile{lxml-ini}
+\loadmarkfile{lxml-ini}
\loadmarkfile{strc-ini}
\loadmarkfile{strc-doc}
@@ -158,13 +163,12 @@
\loadmarkfile{strc-ref}
\loadmarkfile{strc-reg}
-\loadcorefile{bibl-bib}
+\loadmarkfile{bibl-bib}
\loadmarkfile{core-spa}
-\loadcorefile{core-grd.tex}
+\loadmarkfile{core-grd}
\loadmarkfile{anch-pos}
-\loadcorefile{core-mak.tex}
\loadmarkfile{scrn-nav}
\loadmarkfile{pack-obj}
@@ -177,23 +181,23 @@
\loadmarkfile{page-ini}
\loadmarkfile{page-bck}
-\loadcorefile{page-not.tex}
+\loadmarkfile{page-not}
\loadmarkfile{page-one}
-\loadcorefile{page-lay.tex}
+\loadmarkfile{page-lay}
\loadmarkfile{page-txt}
-\loadcorefile{page-sid.tex}
+\loadmarkfile{page-sid}
\loadmarkfile{strc-flt}
-\loadcorefile{page-mis.tex}
-\loadcorefile{page-mul.tex}
-\loadcorefile{page-set.tex}
+\loadmarkfile{page-mis}
+\loadmarkfile{page-mul}
+\loadmarkfile{page-set}
\loadmarkfile{pack-lyr}
-\loadcorefile{page-mak.tex}
+\loadmarkfile{page-mak}
\loadmarkfile{page-lin}
-\loadcorefile{page-par.tex}
-\loadcorefile{page-mar.tex}
+\loadmarkfile{page-par}
+\loadmarkfile{page-mar}
\loadmarkfile{core-job} % why so late?
@@ -202,19 +206,22 @@
\loadmarkfile{strc-blk}
-\loadcorefile{page-imp.tex}
+\loadmarkfile{page-imp}
\loadmarkfile{scrn-int}
+\loadmarkfile{scrn-men}
+\loadmarkfile{scrn-but}
+\loadmarkfile{scrn-bar}
\loadmarkfile{strc-bkm} % bookmarks
-\loadcorefile{tabl-pln.tex}
-\loadcorefile{thrd-tab.tex}
-\loadcorefile{tabl-tab.tex}
-\loadcorefile{tabl-tbl.tex}
+\loadmarkfile{tabl-pln}
+\loadcorefile{thrd-tab}
+\loadmarkfile{tabl-tab}
+\loadmarkfile{tabl-tbl}
\loadmarkfile{tabl-ntb}
-\loadcorefile{tabl-nte.tex}
-\loadcorefile{tabl-ltb.tex}
-\loadcorefile{tabl-tsp.tex}
+\loadmarkfile{tabl-nte}
+\loadmarkfile{tabl-ltb}
+\loadmarkfile{tabl-tsp}
\loadmarkfile{java-ini}
@@ -235,7 +242,7 @@
\loadmarkfile{typo-cap}
\loadmarkfile{type-ini}
-\loadcorefile{type-def.tex}
+\loadcorefile{type-def}
\loadmarkfile{scrp-ini}
@@ -252,16 +259,16 @@
\loadmarkfile{meta-pdf}
\loadmarkfile{meta-fun}
-\loadcorefile{meta-pag.tex}
+\loadmarkfile{meta-pag}
-\loadcorefile{page-flw.tex}
-\loadcorefile{page-spr.tex}
-\loadcorefile{page-plg.tex}
-\loadcorefile{page-str.tex}
+\loadmarkfile{page-flw}
+\loadmarkfile{page-spr}
+\loadmarkfile{page-plg}
+\loadmarkfile{page-str}
-\loadmarkfile{anch-pgr}
-\loadcorefile{anch-bar.tex}
-\loadcorefile{anch-snc.tex}
+\loadmarkfile{anch-pgr} % overloads tabl-tbl
+\loadcorefile{anch-bar}
+\loadcorefile{anch-snc}
\loadmarkfile{math-pln}
\loadmarkfile{math-ini}
@@ -284,8 +291,7 @@
\loadmarkfile{core-fnt}
\loadmarkfile{strc-not}
-
-\loadcorefile{core-lnt.tex}
+\loadmarkfile{strc-lnt}
\loadmarkfile{core-mis}
@@ -294,28 +300,28 @@
\loadmarkfile{grph-fig}
\loadmarkfile{pack-box}
-\loadcorefile{page-app.tex}
+\loadmarkfile{pack-bar}
+\loadmarkfile{page-app}
\loadmarkfile{meta-fig}
-\loadcorefile{lang-spa.tex}
+\loadcorefile{lang-spa}
-\loadcorefile{xtag-ini.tex} % might go away
-\loadcorefile{xtag-ext.tex} % might go away
-\loadcorefile{xtag-exp.tex} % will go away
-\loadcorefile{xtag-pre.tex} % has old encoding code
-\loadcorefile{xtag-xsd.tex} % will go away (stub anyway)
-\loadcorefile{xtag-rng.tex} % will go away (stub anyway)
+\loadcorefile{xtag-ini} % might go away
+\loadcorefile{xtag-ext} % might go away
+\loadcorefile{xtag-exp} % will go away
+\loadcorefile{xtag-pre} % has old encoding code
+\loadcorefile{xtag-xsd} % will go away (stub anyway)
+\loadcorefile{xtag-rng} % will go away (stub anyway)
-\loadcorefile{meta-xml.tex}
+\loadcorefile{meta-xml}
-\loadcorefile{cont-log.tex}
+\loadcorefile{cont-log}
\loadmarkfile{task-ini}
\loadmarkfile{core-ctx}
-\loadcorefile{core-lme.tex}
-\loadcorefile{core-ini.tex}
+\loadmarkfile{core-ini}
\loadmarkfile{core-def}
%usemodule[x][res-04] % xml resource libraries
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index 6316c6156..95c528f32 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2009.06.13 14:03}
+\edef\contextversion{2009.07.17 13:16}
%D For those who want to use this:
diff --git a/tex/context/base/core-def.mkii b/tex/context/base/core-def.mkii
index ea2d0ff15..e51cd96d3 100644
--- a/tex/context/base/core-def.mkii
+++ b/tex/context/base/core-def.mkii
@@ -74,4 +74,11 @@
% \appendtoks\everyjob\expandafter{\the\everyjob\checkpreprocessor}\to\everydump
+% normally one does not want this to happen nested, maybe there
+% is more; non public vars btw, will become conditionals
+
+\ifx\writetoregisterfalse\undefined \else \appendtoks \writetoregisterfalse \to \everybeforeutilityread \fi
+\ifx\writetolistfalse \undefined \else \appendtoks \writetolistfalse \to \everybeforeutilityread \fi
+\ifx\notesenabledfalse \undefined \else \appendtoks \notesenabledfalse \to \everybeforeutilityread \fi
+
\protect \endinput
diff --git a/tex/context/base/core-def.mkiv b/tex/context/base/core-def.mkiv
index 380b733bc..782fe3f67 100644
--- a/tex/context/base/core-def.mkiv
+++ b/tex/context/base/core-def.mkiv
@@ -54,8 +54,6 @@
\appendtoks \ifarrangingpages\poparrangedpages\fi \to \everybye
\appendtoks \registerfileinfo[end]\jobname \to \everybye
-\prependtoks \resetutilities \to \everystarttext % moved 28-02-2002
-
\appendtoks \MPLIBallocate{1000} \to \everydump
\prependtoks \resetallattributes \to \everybeforeoutput
diff --git a/tex/context/base/core-fil.mkii b/tex/context/base/core-fil.mkii
new file mode 100644
index 000000000..fca253a7b
--- /dev/null
+++ b/tex/context/base/core-fil.mkii
@@ -0,0 +1,347 @@
+%D \module
+%D [ file=core-fil,
+%D version=1997.11.15,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=File Support,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Core Macros / File Support}
+
+\unprotect
+
+%D Files registered as temporary files will be deleted after a
+%D run by texexec:
+
+% \starttext
+% \immediate\openout\scratchwrite=oeps.tmp
+% \immediate\write\scratchwrite{oeps}
+% \immediate\closeout\scratchwrite
+% \registertempfile{oeps.tmp}
+% \typefile{oeps.tmp}
+% \stoptext
+
+\let\usedtempfile\gobbleoneargument
+
+\def\registertempfile#1{\immediatewriteutility{f t {#1}}}
+
+%D \macros
+%D {definefilesynonym}
+%D
+%D One of the problems with loading files is that their names
+%D can depend on the interface language. We therefore need a
+%D method to define filesynonyms. The actual synonyms are
+%D defined elsewhere, but look like:
+%D
+%D \starttyping
+%D \definefilesynonym [chemic] [chemie]
+%D \definefilesynonym [einheit] [unit]
+%D \definefilesynonym [unit] [unit]
+%D \stoptyping
+%D
+%D So we can say in english:
+%D
+%D \starttyping
+%D \usemodules[pictex,chemic,unit]
+%D \stoptyping
+%D
+%D and in dutch:
+%D
+%D \starttyping
+%D \usemodules[pictex,chemie,unit]
+%D \stoptyping
+
+% will be redone in mkiv
+
+\def\definefilesynonym
+ {\dodoubleempty\dodefinefilesynonym}
+
+\def\dodefinefilesynonym[#1][#2]%
+ {\ifundefined{\??fs#1}\else
+ \doifnotvalue{\??fs#1}{#2}{\showmessage\m!files1{#1 (#2),\getvalue{\??fs#1}}}%
+ \fi
+ \doifelse{#1}{#2}{\letbeundefined{\??fs#1}{#2}}{\setevalue{\??fs#1}{#2}}}
+
+%D \macros
+%D {definefilefallback}
+
+\def\definefilefallback
+ {\dodoubleargument\dodefinefilefallback}
+
+\def\dodefinefilefallback[#1][#2]%
+ {\doifnotfile{#1}
+ {\def\docommand##1{\doiffile{##1}{\definefilesynonym[#1][##1]\quitcommalist}}%
+ \processcommalist[#2]\docommand}}
+
+%D \macros
+%D {truefilename}
+%D
+%D At the system level such a filename can be called upon by
+%D saying:
+%D
+%D \starttyping
+%D \truefilename{filename/filesynonym}
+%D \stoptyping
+%D
+%D The implementation shows that nesting is supported.
+
+\def\truefilename#1%
+ {\ifundefined{\??fs#1}#1\else\truefilename{\csname\??fs#1\endcsname}\fi}
+
+%D \macros
+%D {makeshortfilename}
+%D
+%D To prevent cross platform problems with filenames, we
+%D lowercase them as well as only use the first 8~characters.
+%D
+%D \starttyping
+%D \def\domakeshortfilename[#1#2#3#4#5#6#7#8#9]%
+%D {\lowercase{\edef\shortfilename{#1#2#3#4#5#6#7#8.}}%
+%D \expandafter\beforesplitstring\shortfilename\at.\to\shortfilename}
+%D
+%D \def\makeshortfilename[#1]%
+%D {\edef\fullfilename{#1.........}%
+%D \expanded{\domakeshortfilename[\fullfilename]}}
+%D \stoptyping
+%D
+%D In 2005 there is no need for the 8~character limit any more, so:
+
+\def\makeshortfilename[#1]% no need for further cleanup and shortening
+ {\lowercase{\edef\shortfilename{#1.}}%
+ \expandafter\beforesplitstring\shortfilename\at.\to\shortfilename}
+
+%D \macros
+%D {usemodule}
+%D
+%D Most of \CONTEXT is preloaded in the format file. Some very
+%D domain specific typesetting topics are however dealt with in
+%D separate modules, e.g. typesetting of chemical structure
+%D formulas. These modules are loaded by:
+%D
+%D \showsetup{usemodule}
+%D
+%D More information on the specific modules can be found in
+%D their dedicated manuals. We use \type {\next} so that we
+%D can \type {\end} in modules.
+
+\newconditional\moduleisloaded
+
+\def\dododousemodules#1#2% no \unprotect/\protect when loading,
+ {\relax % since we need to use ? ! unprotected
+ \ifconditional\moduleisloaded % sometimes (see xtag-map)
+ \let\next\relax % or: \expandafter\gobbleoneargument
+ \else
+ \makeshortfilename[#1\truefilename{#2}]% beware: *- is not part of syn
+ \doifelseflagged\shortfilename
+ {\showmessage\m!systems7{#2 (line \number\inputlineno)}%
+ \settrue\moduleisloaded
+ \let\next\relax}
+ {\doglobal\setflag\shortfilename
+ \def\next
+ {\startreadingfile
+ \readsysfile\shortfilename
+ {\showmessage\m!systems5{#2}\settrue\moduleisloaded}
+ {\readsysfile{\shortfilename.\mksuffix} % new
+ {\showmessage\m!systems5{#2 (\mksuffix)}\settrue\moduleisloaded}
+ \donothing}%
+ \stopreadingfile}}%
+ \fi
+ \next}
+
+\def\dodousemodules#1#2%
+ {\setfalse\moduleisloaded
+ \doifelsenothing{#1}
+ {\dododousemodules\f!moduleprefix {#2}%
+ \dododousemodules\f!privateprefix{#2}%
+ \dododousemodules\f!styleprefix {#2}%
+ \dododousemodules\f!xstyleprefix {#2}%
+ \dododousemodules\f!thirdprefix {#2}%
+ \dododousemodules\empty {#2}}% new, fall back on raw name
+ {\dododousemodules{#1-}{#2}}%
+ \ifconditional\moduleisloaded\else
+ \showmessage\m!systems6{#2}%
+ \appendtoks\showmessage\m!systems6{#2}\to\everynotabene
+ \fi}
+
+% \def\usemodules
+% {\dodoubleempty\dousemodules}
+%
+% \def\dousemodules[#1][#2]%
+% {\ifsecondargument
+% \doifelsenothing{#2}
+% {\let\next\relax}
+% {\def\next{\processcommalist[#2]{\dodousemodules{#1}}}}%
+% \else
+% \def\next{\usemodules[][#1]}%
+% \fi
+% \next}
+%
+% \let\usemodule\usemodules
+
+\def\usemodules
+ {\dotripleempty\dousemodules}
+
+\def\dousemodules[#1][#2][#3]%
+ {\pushmacro\currentmodule
+ \pushmacro\currentmoduleparameters
+ \let\currentmoduleparameters\empty
+ \ifthirdargument
+ \doifelsenothing{#2}
+ {\let\next\relax}
+ {\def\currentmoduleparameters{#3}%
+ \def\next{\processcommalist[#2]{\dodousemodules{#1}}}}%
+ \else\ifsecondargument
+ \doifelsenothing{#2}
+ {\let\next\relax}
+ {\doifassignmentelse{#2}
+ {\def\currentmoduleparameters{#2}%
+ \def\next{\processcommalist[#1]{\dodousemodules{}}}}
+ {\def\next{\processcommalist[#2]{\dodousemodules{#1}}}}}%
+ \else
+ \def\next{\processcommalist[#1]{\dodousemodules{}}}%
+ \fi\fi
+ \next
+ \popmacro\currentmoduleparameters
+ \popmacro\currentmodule}
+
+\let\currentmoduleparameters\empty
+\let\currentmodule \s!unknown
+
+\def\startmodule
+ {\doifnextoptionalelse\dostartmodule\nostartmodule}
+
+\def\nostartmodule #1 %
+ {\dostartmodule[#1]}
+
+\def\dostartmodule[#1]%
+ {\pushmacro\currentmodule
+ \pushmacro\currentmoduleparameters
+ \def\currentmodule{#1}}
+
+\def\stopmodule
+ {\popmacro\currentmoduleparameters
+ \popmacro\currentmodule}
+
+\def\setupmodule
+ {\dodoubleempty\dosetupmodule}
+
+\def\dosetupmodule[#1][#2]%
+ {\scratchtoks\expandafter{\currentmoduleparameters}%
+ \ifsecondargument
+ \getparameters[\??md:#1:][#2]%
+ \expanded{\getparameters[\??md:#1:][\the\scratchtoks]}%
+ \else
+ \getparameters[\??md:\currentmodule:][#1]%
+ \expanded{\getparameters[\??md:\currentmodule:][\the\scratchtoks]}%
+ \fi
+ \let\currentmoduleparameters\empty}
+
+\def\moduleparameter #1#2{\executeifdefined{\??md:#1:#2}\s!empty}
+\def\currentmoduleparameter#1{\executeifdefined{\??md:\currentmodule:#1}\s!empty}
+
+% \usemodule[newmml]
+% \usemodule[newmml][a=b]
+% \usemodule[x][newmml]
+% \usemodule[x][newmml][a=b]
+%
+% \startmodule [mathml]
+% \setupmodule[a=c] \relax [\currentmoduleparameter{a}] % user vars will be set afterwards
+% \setupmodule[a=c] \relax [\currentmoduleparameter{a}] % user vars are now forgotten
+% \stopmodule
+
+% one can introduce test sections with:
+%
+% \enablemode[newmml:test:\currentmoduleparameter{test}]
+% \startmode[newmml:test:yes} ... \stopmode
+%
+% these will be ignored unless test=yes
+%
+% however, a better way is:
+
+\let\stopmoduletestsection\donothing
+
+\def\startmoduletestsection
+ {\bgroup
+ \setupmodule % we need to make sure that the vars are set
+ \doifelse{\currentmoduleparameter\v!test}\v!yes
+ {\egroup
+ \writestatus{\currentmodule}{loading experimental code}}
+ {\egroup
+ \writestatus{\currentmodule}{skipping experimental code}%
+ \gobbleuntil\stopmoduletestsection}}
+
+%D We also support a singular call, which saves us for
+%D frustrations when we do a typo.
+
+\let\usemodule=\usemodules
+
+% %D The definition shows that the language specific settings
+% %D are activated after loading all the modules specified.
+
+%D \macros
+%D {ifprotectbuffers, bufferprefix,
+%D TEXbufferfile, MPgraphicfile}
+%D
+%D The next switch enables protection of temporary filenames,
+%D which is needed when we process more files on one path at
+%D the same time.
+
+\newif\ifprotectbuffers
+
+\def\bufferprefix{\ifprotectbuffers\jobname-\fi}
+
+% The following filenames are defined here:
+
+\def\TEXbufferfile #1{\bufferprefix#1.\f!temporaryextension}
+\def\MPgraphicfile {\bufferprefix mp\ifMPrun run\else graph\fi} % not needed in luatex
+\def\convertMPcolorfile{\bufferprefix metacmyk.tmp}
+
+%D To save memory, we implement some seldomly used commands
+%D in a lazy way. Nota bene: such runtime definitions are
+%D global.
+%D
+%D \starttyping
+%D \fetchruntimecommand\showaccents{\f!encodingprefix ...}
+%D \stoptyping
+
+\def\fetchruntimecommand#1#2%
+ {\def#1{\dofetchruntimecommand#1{#2}}}
+
+\def\dofetchruntimecommand#1#2%
+ {\doifnotflagged{#2}
+ {\let#1\undefined
+ \startreadingfile
+ \startnointerference % \bgroup
+ \cleanupfeatures % better \setnormalcatcodes / test first
+ \readfile{#2}\donothing\donothing
+ \stopnointerference % \egroup
+ \stopreadingfile
+ \doglobal\setflag{#2}}%
+ \ifx#1\undefined
+ \writestatus\m!systems{command \string#1 not found in file #2}%
+ \def#1{{\infofont[unknown command \string#1]}}%
+ \fi
+ #1}
+
+%D Experimental:
+
+\let\checkpreprocessor\relax
+
+%D To be documented and probably moved
+
+\def\documentresources{\@@erurl}
+
+\def\setupexternalresources
+ {\dodoubleargument\getparameters[\??er]}
+
+\setupexternalresources
+ [url=]
+
+%D This module will be perfected / changed / weeded.
+
+\protect \endinput
diff --git a/tex/context/base/core-fil.mkiv b/tex/context/base/core-fil.mkiv
new file mode 100644
index 000000000..14154fca4
--- /dev/null
+++ b/tex/context/base/core-fil.mkiv
@@ -0,0 +1,317 @@
+%D \module
+%D [ file=core-fil,
+%D version=1997.11.15,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=File Support,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Core Macros / File Support}
+
+\unprotect
+
+%D \macros
+%D {definefilesynonym}
+%D
+%D One of the problems with loading files is that their names
+%D can depend on the interface language. We therefore need a
+%D method to define filesynonyms. The actual synonyms are
+%D defined elsewhere, but look like:
+%D
+%D \starttyping
+%D \definefilesynonym [chemic] [chemie]
+%D \definefilesynonym [einheit] [unit]
+%D \definefilesynonym [unit] [unit]
+%D \stoptyping
+%D
+%D So we can say in english:
+%D
+%D \starttyping
+%D \usemodules[pictex,chemic,unit]
+%D \stoptyping
+%D
+%D and in dutch:
+%D
+%D \starttyping
+%D \usemodules[pictex,chemie,unit]
+%D \stoptyping
+
+% will be redone in mkiv
+
+\def\definefilesynonym
+ {\dodoubleempty\dodefinefilesynonym}
+
+\def\dodefinefilesynonym[#1][#2]%
+ {\ifcsname\??fs#1\endcsname
+ \doifnotvalue{\??fs#1}{#2}{\showmessage\m!files1{#1 (#2),\getvalue{\??fs#1}}}%
+ \fi
+ \doifelse{#1}{#2}{\letbeundefined{\??fs#1}{#2}}{\setevalue{\??fs#1}{#2}}}
+
+%D \macros
+%D {definefilefallback}
+
+\def\definefilefallback
+ {\dodoubleargument\dodefinefilefallback}
+
+\def\dodefinefilefallback[#1][#2]%
+ {\doifnotfile{#1}
+ {\def\docommand##1{\doiffile{##1}{\definefilesynonym[#1][##1]\quitcommalist}}%
+ \processcommalist[#2]\docommand}}
+
+%D \macros
+%D {truefilename}
+%D
+%D At the system level such a filename can be called upon by
+%D saying:
+%D
+%D \starttyping
+%D \truefilename{filename/filesynonym}
+%D \stoptyping
+%D
+%D The implementation shows that nesting is supported.
+
+\def\truefilename#1%
+ {\ifcsname\??fs#1\endcsname\expandafter\truefilename\csname\??fs#1\endcsname\else#1\fi}
+
+%D \macros
+%D {makeshortfilename}
+%D
+%D To prevent cross platform problems with filenames, we
+%D lowercase them as well as only use the first 8~characters.
+%D
+%D \starttyping
+%D \def\domakeshortfilename[#1#2#3#4#5#6#7#8#9]%
+%D {\lowercase{\edef\shortfilename{#1#2#3#4#5#6#7#8.}}%
+%D \expandafter\beforesplitstring\shortfilename\at.\to\shortfilename}
+%D
+%D \def\makeshortfilename[#1]%
+%D {\edef\fullfilename{#1.........}%
+%D \expanded{\domakeshortfilename[\fullfilename]}}
+%D \stoptyping
+%D
+%D In 2005 there is no need for the 8~character limit any more, so:
+
+\def\makeshortfilename[#1]% no need for further cleanup and shortening
+ {\lowercase{\edef\shortfilename{#1.}}%
+ \expandafter\beforesplitstring\shortfilename\at.\to\shortfilename}
+
+%D \macros
+%D {usemodule}
+%D
+%D Most of \CONTEXT is preloaded in the format file. Some very
+%D domain specific typesetting topics are however dealt with in
+%D separate modules, e.g. typesetting of chemical structure
+%D formulas. These modules are loaded by:
+%D
+%D \showsetup{usemodule}
+%D
+%D More information on the specific modules can be found in
+%D their dedicated manuals. We use \type {\next} so that we
+%D can \type {\end} in modules.
+
+\newconditional\moduleisloaded
+
+\def\dododousemodules#1#2% no \unprotect/\protect when loading,
+ {\relax % since we need to use ? ! unprotected
+ \ifconditional\moduleisloaded % sometimes (see xtag-map)
+ \let\next\relax % or: \expandafter\gobbleoneargument
+ \else
+ \makeshortfilename[#1\truefilename{#2}]% beware: *- is not part of syn
+ \doifelseflagged\shortfilename
+ {\showmessage\m!systems7{#2 (line \number\inputlineno)}%
+ \settrue\moduleisloaded
+ \let\next\relax}
+ {\doglobal\setflag\shortfilename
+ \def\next
+ {\startreadingfile
+ \readsysfile\shortfilename
+ {\showmessage\m!systems5{#2}\settrue\moduleisloaded}
+ {\readsysfile{\shortfilename.\mksuffix} % new
+ {\showmessage\m!systems5{#2 (\mksuffix)}\settrue\moduleisloaded}
+ \donothing}%
+ \stopreadingfile}}%
+ \fi
+ \next}
+
+\def\dodousemodules#1#2%
+ {\setfalse\moduleisloaded
+ \doifelsenothing{#1}
+ {\dododousemodules\f!moduleprefix {#2}%
+ \dododousemodules\f!privateprefix{#2}%
+ \dododousemodules\f!styleprefix {#2}%
+ \dododousemodules\f!xstyleprefix {#2}%
+ \dododousemodules\f!thirdprefix {#2}%
+ \dododousemodules\empty {#2}}% new, fall back on raw name
+ {\dododousemodules{#1-}{#2}}%
+ \ifconditional\moduleisloaded\else
+ \showmessage\m!systems6{#2}%
+ \appendtoks\showmessage\m!systems6{#2}\to\everynotabene
+ \fi}
+
+\def\usemodules
+ {\dotripleempty\dousemodules}
+
+\def\dousemodules[#1][#2][#3]%
+ {\pushmacro\currentmodule
+ \pushmacro\currentmoduleparameters
+ \let\currentmoduleparameters\empty
+ \ifthirdargument
+ \doifelsenothing{#2}
+ {\let\next\relax}
+ {\def\currentmoduleparameters{#3}%
+ \def\next{\processcommalist[#2]{\dodousemodules{#1}}}}%
+ \else\ifsecondargument
+ \doifelsenothing{#2}
+ {\let\next\relax}
+ {\doifassignmentelse{#2}
+ {\def\currentmoduleparameters{#2}%
+ \def\next{\processcommalist[#1]{\dodousemodules{}}}}
+ {\def\next{\processcommalist[#2]{\dodousemodules{#1}}}}}%
+ \else
+ \def\next{\processcommalist[#1]{\dodousemodules{}}}%
+ \fi\fi
+ \next
+ \popmacro\currentmoduleparameters
+ \popmacro\currentmodule}
+
+\let\currentmoduleparameters\empty
+\let\currentmodule \s!unknown
+
+\def\startmodule
+ {\doifnextoptionalelse\dostartmodule\nostartmodule}
+
+\def\nostartmodule #1 %
+ {\dostartmodule[#1]}
+
+\def\dostartmodule[#1]%
+ {\pushmacro\currentmodule
+ \pushmacro\currentmoduleparameters
+ \def\currentmodule{#1}}
+
+\def\stopmodule
+ {\popmacro\currentmoduleparameters
+ \popmacro\currentmodule}
+
+\def\setupmodule
+ {\dodoubleempty\dosetupmodule}
+
+\def\dosetupmodule[#1][#2]%
+ {\scratchtoks\expandafter{\currentmoduleparameters}%
+ \ifsecondargument
+ \getparameters[\??md:#1:][#2]%
+ \expanded{\getparameters[\??md:#1:][\the\scratchtoks]}%
+ \else
+ \getparameters[\??md:\currentmodule:][#1]%
+ \expanded{\getparameters[\??md:\currentmodule:][\the\scratchtoks]}%
+ \fi
+ \let\currentmoduleparameters\empty}
+
+\def\moduleparameter #1#2{\executeifdefined{\??md:#1:#2}\s!empty}
+\def\currentmoduleparameter#1{\executeifdefined{\??md:\currentmodule:#1}\s!empty}
+
+% \usemodule[newmml]
+% \usemodule[newmml][a=b]
+% \usemodule[x][newmml]
+% \usemodule[x][newmml][a=b]
+%
+% \startmodule [mathml]
+% \setupmodule[a=c] \relax [\currentmoduleparameter{a}] % user vars will be set afterwards
+% \setupmodule[a=c] \relax [\currentmoduleparameter{a}] % user vars are now forgotten
+% \stopmodule
+
+% one can introduce test sections with:
+%
+% \enablemode[newmml:test:\currentmoduleparameter{test}]
+% \startmode[newmml:test:yes} ... \stopmode
+%
+% these will be ignored unless test=yes
+%
+% however, a better way is:
+
+\let\stopmoduletestsection\donothing
+
+\def\startmoduletestsection
+ {\bgroup
+ \setupmodule % we need to make sure that the vars are set
+ \doifelse{\currentmoduleparameter\v!test}\v!yes
+ {\egroup
+ \writestatus{\currentmodule}{loading experimental code}}
+ {\egroup
+ \writestatus{\currentmodule}{skipping experimental code}%
+ \gobbleuntil\stopmoduletestsection}}
+
+%D We also support a singular call, which saves us for
+%D frustrations when we do a typo.
+
+\let\usemodule=\usemodules
+
+% %D The definition shows that the language specific settings
+% %D are activated after loading all the modules specified.
+
+%D \macros
+%D {ifprotectbuffers, bufferprefix,
+%D TEXbufferfile, MPgraphicfile}
+%D
+%D The next switch enables protection of temporary filenames,
+%D which is needed when we process more files on one path at
+%D the same time.
+
+\newif\ifprotectbuffers
+
+\def\bufferprefix{\ifprotectbuffers\jobname-\fi}
+
+% The following filenames are defined here:
+
+\def\TEXbufferfile #1{\bufferprefix#1.\f!temporaryextension}
+\def\MPgraphicfile {\bufferprefix mp\ifMPrun run\else graph\fi} % not needed in luatex
+\def\convertMPcolorfile{\bufferprefix metacmyk.tmp}
+
+%D To save memory, we implement some seldomly used commands
+%D in a lazy way. Nota bene: such runtime definitions are
+%D global.
+%D
+%D \starttyping
+%D \fetchruntimecommand\showaccents{\f!encodingprefix ...}
+%D \stoptyping
+
+\def\fetchruntimecommand#1#2%
+ {\def#1{\dofetchruntimecommand#1{#2}}}
+
+\def\dofetchruntimecommand#1#2%
+ {\doifnotflagged{#2}
+ {\let#1\undefined
+ \startreadingfile
+ \startnointerference % \bgroup
+ \cleanupfeatures % better \setnormalcatcodes / test first
+ \readfile{#2}\donothing\donothing
+ \stopnointerference % \egroup
+ \stopreadingfile
+ \doglobal\setflag{#2}}%
+ \ifx#1\undefined
+ \writestatus\m!systems{command \string#1 not found in file #2}%
+ \def#1{{\infofont[unknown command \string#1]}}%
+ \fi
+ #1}
+
+%D Experimental:
+
+\let\checkpreprocessor\relax
+
+%D To be documented and probably moved
+
+\def\documentresources{\@@erurl}
+
+\def\setupexternalresources
+ {\dodoubleargument\getparameters[\??er]}
+
+\setupexternalresources
+ [url=]
+
+%D This module will be perfected / changed / weeded.
+
+\protect \endinput
diff --git a/tex/context/base/core-fil.tex b/tex/context/base/core-fil.tex
deleted file mode 100644
index fca253a7b..000000000
--- a/tex/context/base/core-fil.tex
+++ /dev/null
@@ -1,347 +0,0 @@
-%D \module
-%D [ file=core-fil,
-%D version=1997.11.15,
-%D title=\CONTEXT\ Core Macros,
-%D subtitle=File Support,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Core Macros / File Support}
-
-\unprotect
-
-%D Files registered as temporary files will be deleted after a
-%D run by texexec:
-
-% \starttext
-% \immediate\openout\scratchwrite=oeps.tmp
-% \immediate\write\scratchwrite{oeps}
-% \immediate\closeout\scratchwrite
-% \registertempfile{oeps.tmp}
-% \typefile{oeps.tmp}
-% \stoptext
-
-\let\usedtempfile\gobbleoneargument
-
-\def\registertempfile#1{\immediatewriteutility{f t {#1}}}
-
-%D \macros
-%D {definefilesynonym}
-%D
-%D One of the problems with loading files is that their names
-%D can depend on the interface language. We therefore need a
-%D method to define filesynonyms. The actual synonyms are
-%D defined elsewhere, but look like:
-%D
-%D \starttyping
-%D \definefilesynonym [chemic] [chemie]
-%D \definefilesynonym [einheit] [unit]
-%D \definefilesynonym [unit] [unit]
-%D \stoptyping
-%D
-%D So we can say in english:
-%D
-%D \starttyping
-%D \usemodules[pictex,chemic,unit]
-%D \stoptyping
-%D
-%D and in dutch:
-%D
-%D \starttyping
-%D \usemodules[pictex,chemie,unit]
-%D \stoptyping
-
-% will be redone in mkiv
-
-\def\definefilesynonym
- {\dodoubleempty\dodefinefilesynonym}
-
-\def\dodefinefilesynonym[#1][#2]%
- {\ifundefined{\??fs#1}\else
- \doifnotvalue{\??fs#1}{#2}{\showmessage\m!files1{#1 (#2),\getvalue{\??fs#1}}}%
- \fi
- \doifelse{#1}{#2}{\letbeundefined{\??fs#1}{#2}}{\setevalue{\??fs#1}{#2}}}
-
-%D \macros
-%D {definefilefallback}
-
-\def\definefilefallback
- {\dodoubleargument\dodefinefilefallback}
-
-\def\dodefinefilefallback[#1][#2]%
- {\doifnotfile{#1}
- {\def\docommand##1{\doiffile{##1}{\definefilesynonym[#1][##1]\quitcommalist}}%
- \processcommalist[#2]\docommand}}
-
-%D \macros
-%D {truefilename}
-%D
-%D At the system level such a filename can be called upon by
-%D saying:
-%D
-%D \starttyping
-%D \truefilename{filename/filesynonym}
-%D \stoptyping
-%D
-%D The implementation shows that nesting is supported.
-
-\def\truefilename#1%
- {\ifundefined{\??fs#1}#1\else\truefilename{\csname\??fs#1\endcsname}\fi}
-
-%D \macros
-%D {makeshortfilename}
-%D
-%D To prevent cross platform problems with filenames, we
-%D lowercase them as well as only use the first 8~characters.
-%D
-%D \starttyping
-%D \def\domakeshortfilename[#1#2#3#4#5#6#7#8#9]%
-%D {\lowercase{\edef\shortfilename{#1#2#3#4#5#6#7#8.}}%
-%D \expandafter\beforesplitstring\shortfilename\at.\to\shortfilename}
-%D
-%D \def\makeshortfilename[#1]%
-%D {\edef\fullfilename{#1.........}%
-%D \expanded{\domakeshortfilename[\fullfilename]}}
-%D \stoptyping
-%D
-%D In 2005 there is no need for the 8~character limit any more, so:
-
-\def\makeshortfilename[#1]% no need for further cleanup and shortening
- {\lowercase{\edef\shortfilename{#1.}}%
- \expandafter\beforesplitstring\shortfilename\at.\to\shortfilename}
-
-%D \macros
-%D {usemodule}
-%D
-%D Most of \CONTEXT is preloaded in the format file. Some very
-%D domain specific typesetting topics are however dealt with in
-%D separate modules, e.g. typesetting of chemical structure
-%D formulas. These modules are loaded by:
-%D
-%D \showsetup{usemodule}
-%D
-%D More information on the specific modules can be found in
-%D their dedicated manuals. We use \type {\next} so that we
-%D can \type {\end} in modules.
-
-\newconditional\moduleisloaded
-
-\def\dododousemodules#1#2% no \unprotect/\protect when loading,
- {\relax % since we need to use ? ! unprotected
- \ifconditional\moduleisloaded % sometimes (see xtag-map)
- \let\next\relax % or: \expandafter\gobbleoneargument
- \else
- \makeshortfilename[#1\truefilename{#2}]% beware: *- is not part of syn
- \doifelseflagged\shortfilename
- {\showmessage\m!systems7{#2 (line \number\inputlineno)}%
- \settrue\moduleisloaded
- \let\next\relax}
- {\doglobal\setflag\shortfilename
- \def\next
- {\startreadingfile
- \readsysfile\shortfilename
- {\showmessage\m!systems5{#2}\settrue\moduleisloaded}
- {\readsysfile{\shortfilename.\mksuffix} % new
- {\showmessage\m!systems5{#2 (\mksuffix)}\settrue\moduleisloaded}
- \donothing}%
- \stopreadingfile}}%
- \fi
- \next}
-
-\def\dodousemodules#1#2%
- {\setfalse\moduleisloaded
- \doifelsenothing{#1}
- {\dododousemodules\f!moduleprefix {#2}%
- \dododousemodules\f!privateprefix{#2}%
- \dododousemodules\f!styleprefix {#2}%
- \dododousemodules\f!xstyleprefix {#2}%
- \dododousemodules\f!thirdprefix {#2}%
- \dododousemodules\empty {#2}}% new, fall back on raw name
- {\dododousemodules{#1-}{#2}}%
- \ifconditional\moduleisloaded\else
- \showmessage\m!systems6{#2}%
- \appendtoks\showmessage\m!systems6{#2}\to\everynotabene
- \fi}
-
-% \def\usemodules
-% {\dodoubleempty\dousemodules}
-%
-% \def\dousemodules[#1][#2]%
-% {\ifsecondargument
-% \doifelsenothing{#2}
-% {\let\next\relax}
-% {\def\next{\processcommalist[#2]{\dodousemodules{#1}}}}%
-% \else
-% \def\next{\usemodules[][#1]}%
-% \fi
-% \next}
-%
-% \let\usemodule\usemodules
-
-\def\usemodules
- {\dotripleempty\dousemodules}
-
-\def\dousemodules[#1][#2][#3]%
- {\pushmacro\currentmodule
- \pushmacro\currentmoduleparameters
- \let\currentmoduleparameters\empty
- \ifthirdargument
- \doifelsenothing{#2}
- {\let\next\relax}
- {\def\currentmoduleparameters{#3}%
- \def\next{\processcommalist[#2]{\dodousemodules{#1}}}}%
- \else\ifsecondargument
- \doifelsenothing{#2}
- {\let\next\relax}
- {\doifassignmentelse{#2}
- {\def\currentmoduleparameters{#2}%
- \def\next{\processcommalist[#1]{\dodousemodules{}}}}
- {\def\next{\processcommalist[#2]{\dodousemodules{#1}}}}}%
- \else
- \def\next{\processcommalist[#1]{\dodousemodules{}}}%
- \fi\fi
- \next
- \popmacro\currentmoduleparameters
- \popmacro\currentmodule}
-
-\let\currentmoduleparameters\empty
-\let\currentmodule \s!unknown
-
-\def\startmodule
- {\doifnextoptionalelse\dostartmodule\nostartmodule}
-
-\def\nostartmodule #1 %
- {\dostartmodule[#1]}
-
-\def\dostartmodule[#1]%
- {\pushmacro\currentmodule
- \pushmacro\currentmoduleparameters
- \def\currentmodule{#1}}
-
-\def\stopmodule
- {\popmacro\currentmoduleparameters
- \popmacro\currentmodule}
-
-\def\setupmodule
- {\dodoubleempty\dosetupmodule}
-
-\def\dosetupmodule[#1][#2]%
- {\scratchtoks\expandafter{\currentmoduleparameters}%
- \ifsecondargument
- \getparameters[\??md:#1:][#2]%
- \expanded{\getparameters[\??md:#1:][\the\scratchtoks]}%
- \else
- \getparameters[\??md:\currentmodule:][#1]%
- \expanded{\getparameters[\??md:\currentmodule:][\the\scratchtoks]}%
- \fi
- \let\currentmoduleparameters\empty}
-
-\def\moduleparameter #1#2{\executeifdefined{\??md:#1:#2}\s!empty}
-\def\currentmoduleparameter#1{\executeifdefined{\??md:\currentmodule:#1}\s!empty}
-
-% \usemodule[newmml]
-% \usemodule[newmml][a=b]
-% \usemodule[x][newmml]
-% \usemodule[x][newmml][a=b]
-%
-% \startmodule [mathml]
-% \setupmodule[a=c] \relax [\currentmoduleparameter{a}] % user vars will be set afterwards
-% \setupmodule[a=c] \relax [\currentmoduleparameter{a}] % user vars are now forgotten
-% \stopmodule
-
-% one can introduce test sections with:
-%
-% \enablemode[newmml:test:\currentmoduleparameter{test}]
-% \startmode[newmml:test:yes} ... \stopmode
-%
-% these will be ignored unless test=yes
-%
-% however, a better way is:
-
-\let\stopmoduletestsection\donothing
-
-\def\startmoduletestsection
- {\bgroup
- \setupmodule % we need to make sure that the vars are set
- \doifelse{\currentmoduleparameter\v!test}\v!yes
- {\egroup
- \writestatus{\currentmodule}{loading experimental code}}
- {\egroup
- \writestatus{\currentmodule}{skipping experimental code}%
- \gobbleuntil\stopmoduletestsection}}
-
-%D We also support a singular call, which saves us for
-%D frustrations when we do a typo.
-
-\let\usemodule=\usemodules
-
-% %D The definition shows that the language specific settings
-% %D are activated after loading all the modules specified.
-
-%D \macros
-%D {ifprotectbuffers, bufferprefix,
-%D TEXbufferfile, MPgraphicfile}
-%D
-%D The next switch enables protection of temporary filenames,
-%D which is needed when we process more files on one path at
-%D the same time.
-
-\newif\ifprotectbuffers
-
-\def\bufferprefix{\ifprotectbuffers\jobname-\fi}
-
-% The following filenames are defined here:
-
-\def\TEXbufferfile #1{\bufferprefix#1.\f!temporaryextension}
-\def\MPgraphicfile {\bufferprefix mp\ifMPrun run\else graph\fi} % not needed in luatex
-\def\convertMPcolorfile{\bufferprefix metacmyk.tmp}
-
-%D To save memory, we implement some seldomly used commands
-%D in a lazy way. Nota bene: such runtime definitions are
-%D global.
-%D
-%D \starttyping
-%D \fetchruntimecommand\showaccents{\f!encodingprefix ...}
-%D \stoptyping
-
-\def\fetchruntimecommand#1#2%
- {\def#1{\dofetchruntimecommand#1{#2}}}
-
-\def\dofetchruntimecommand#1#2%
- {\doifnotflagged{#2}
- {\let#1\undefined
- \startreadingfile
- \startnointerference % \bgroup
- \cleanupfeatures % better \setnormalcatcodes / test first
- \readfile{#2}\donothing\donothing
- \stopnointerference % \egroup
- \stopreadingfile
- \doglobal\setflag{#2}}%
- \ifx#1\undefined
- \writestatus\m!systems{command \string#1 not found in file #2}%
- \def#1{{\infofont[unknown command \string#1]}}%
- \fi
- #1}
-
-%D Experimental:
-
-\let\checkpreprocessor\relax
-
-%D To be documented and probably moved
-
-\def\documentresources{\@@erurl}
-
-\def\setupexternalresources
- {\dodoubleargument\getparameters[\??er]}
-
-\setupexternalresources
- [url=]
-
-%D This module will be perfected / changed / weeded.
-
-\protect \endinput
diff --git a/tex/context/base/core-gen.mkii b/tex/context/base/core-gen.mkii
new file mode 100644
index 000000000..b6ab2a208
--- /dev/null
+++ b/tex/context/base/core-gen.mkii
@@ -0,0 +1,166 @@
+%D \module
+%D [ file=core-gen,
+%D version=1995.10.10,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=General,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Core Macros / General}
+
+\unprotect
+
+%D \macros
+%D {assigndimension,assignalfadimension}
+%D
+%D Hieronder worden enkele commando's gedefinieerd rond
+%D toekenningen. Allereerst een commando om waarden aan
+%D een \DIMENSION\ toe te kennen:
+%D
+%D \starttyping
+%D \assigndimension
+%D {|klein|middel|groot|-klein|-middel|-groot|geen}
+%D {\dimension}
+%D {waarde klein}
+%D {waarde middel}
+%D {waarde groot}
+%D \stoptyping
+%D
+%D Hierbij krijgt de \DIMENSION\ \type{\dimension} een waarde
+%D afhankelijk van het meegegeven trefwoord.
+%D
+%D \startnarrower
+%D \startlines
+%D \type{(-)klein }\qquad (--) waarde klein
+%D \type{(-)middel}\qquad (--) waarde middel
+%D \type{(-)groot }\qquad (--) waarde groot
+%D \type{geen }\qquad 0pt
+%D \type{waarde }\qquad waarde
+%D \stoplines
+%D \stopnarrower
+%D
+%D Een trefwoord mag worden voorafgegaan door een \type{-}.
+%D Deze macro toont een voorbeeld van het gebruik van
+%D \type{\processaction} en constanten.
+%D
+%D Analoog aan het bovenstaande commando kennen we een
+%D commando om waarden toe te kennen aan een macro:
+%D
+%D \starttyping
+%D \assignalfadimension
+%D {|klein|middel|groot|geen}
+%D {\macro}
+%D {waarde klein}
+%D {waarde middel}
+%D {waarde groot}
+%D \stoptyping
+
+% The third (optimized) version:
+
+\def\@ad@{@ad@}
+
+\setvalue{\@ad@ \v!none }{\zeropoint\gobblethreearguments}
+\setvalue{\@ad@ \v!big }{\thirdofthreearguments}
+\setvalue{\@ad@ \v!medium}{\secondofthreearguments}
+\setvalue{\@ad@ \v!small }{\firstofthreearguments}
+\setvalue{\@ad@-\v!big }{-\thirdofthreearguments}
+\setvalue{\@ad@-\v!medium}{-\secondofthreearguments}
+\setvalue{\@ad@-\v!small }{-\firstofthreearguments}
+
+\def\assigndimension#1#2% #3 #4 #5
+ {#2=\ifcsname\@ad@#1\endcsname
+ \csname\@ad@#1\expandafter\endcsname
+ \else
+ #1\expandafter\gobblethreearguments
+ \fi}
+
+\def\@aa@{@aa@}
+
+\setvalue{\@aa@\v!none }{0\gobblethreearguments}
+\setvalue{\@aa@\v!big }{\thirdofthreearguments}
+\setvalue{\@aa@\v!medium}{\secondofthreearguments}
+\setvalue{\@aa@\v!small }{\firstofthreearguments}
+
+\def\assignalfadimension#1#2#3#4#5% #3#4#5 are single digits
+ {\edef#2{\ifcsname\@aa@#1\endcsname
+ \csname\@aa@#1\expandafter\endcsname
+ \else
+ #1\expandafter\gobblethreearguments
+ \fi#3#4#5}}
+
+%D \macros
+%D {assignvalue}
+%D
+%D Een variant hierop is het commando:
+%D
+%D \starttyping
+%D \assignvalue
+%D {|klein|middel|groot}
+%D {\macro}
+%D {waarde klein }
+%D {waarde middel}
+%D {waarde groot}
+%D \stoptyping
+%D
+%D Hierbij krijgt \type{\macro} een waarde afhankelijk van
+%D het meegegeven trefwoord:
+%D
+%D \startnarrower
+%D \startlines
+%D \type{klein }\qquad waarde klein
+%D \type{middel}\qquad waarde middel
+%D \type{groot }\qquad waarde groot
+%D \type{waarde}\qquad waarde
+%D \stoplines
+%D \stopnarrower
+%D
+%D Hier doet \type{geen} dus niet mee.
+
+\def\@av@{@av@}
+
+\letvalue{\@av@\v!big }\thirdofthreearguments
+\letvalue{\@av@\v!medium}\secondofthreearguments
+\letvalue{\@av@\v!small }\firstofthreearguments
+
+\def\assignvalue#1#2#3#4#5%
+ {\edef#2{\ifcsname\@av@#1\endcsname
+ \csname\@av@#1\expandafter\endcsname
+ \else
+ #1\expandafter\gobblethreearguments
+ \fi{#3}{#4}{#5}}}
+
+%D \macros
+%D {assignwidth}
+%D
+%D Een breedte van een opgegeven tekst kan worden berekend en
+%D toegekend aan een \DIMENSION\ met:
+%D
+%D \starttyping
+%D \assignwidth
+%D {\dimension}
+%D {|passend|ruim}
+%D {tekst}
+%D \stoptyping
+%D
+%D Dit commando sluit, evenals de bovenstaande
+%D \type{\assign}||commando's, aan op de wijze waarop
+%D in de andere \CONTEXT||modules toekenningen
+%D plaatsvinden. Bij \type{ruim} wordt de gemeten breedte
+%D met 1~em vermeerderd.
+
+\def\assignwidth#1#2#3#4%
+ {\doifelsenothing{#2}
+ {\setbox\scratchbox\hbox{#3}%
+ #1\wd\scratchbox}
+ {\doifinsetelse{#2}{\v!fit,\v!broad}
+ {\setbox\scratchbox\hbox{#3}%
+ #1\wd\scratchbox
+ \doif{#2}\v!broad{\advance#1 #4}}%
+ {#1=#2}}}%
+
+\protect \endinput
diff --git a/tex/context/base/core-gen.mkiv b/tex/context/base/core-gen.mkiv
new file mode 100644
index 000000000..b6ab2a208
--- /dev/null
+++ b/tex/context/base/core-gen.mkiv
@@ -0,0 +1,166 @@
+%D \module
+%D [ file=core-gen,
+%D version=1995.10.10,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=General,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Core Macros / General}
+
+\unprotect
+
+%D \macros
+%D {assigndimension,assignalfadimension}
+%D
+%D Hieronder worden enkele commando's gedefinieerd rond
+%D toekenningen. Allereerst een commando om waarden aan
+%D een \DIMENSION\ toe te kennen:
+%D
+%D \starttyping
+%D \assigndimension
+%D {|klein|middel|groot|-klein|-middel|-groot|geen}
+%D {\dimension}
+%D {waarde klein}
+%D {waarde middel}
+%D {waarde groot}
+%D \stoptyping
+%D
+%D Hierbij krijgt de \DIMENSION\ \type{\dimension} een waarde
+%D afhankelijk van het meegegeven trefwoord.
+%D
+%D \startnarrower
+%D \startlines
+%D \type{(-)klein }\qquad (--) waarde klein
+%D \type{(-)middel}\qquad (--) waarde middel
+%D \type{(-)groot }\qquad (--) waarde groot
+%D \type{geen }\qquad 0pt
+%D \type{waarde }\qquad waarde
+%D \stoplines
+%D \stopnarrower
+%D
+%D Een trefwoord mag worden voorafgegaan door een \type{-}.
+%D Deze macro toont een voorbeeld van het gebruik van
+%D \type{\processaction} en constanten.
+%D
+%D Analoog aan het bovenstaande commando kennen we een
+%D commando om waarden toe te kennen aan een macro:
+%D
+%D \starttyping
+%D \assignalfadimension
+%D {|klein|middel|groot|geen}
+%D {\macro}
+%D {waarde klein}
+%D {waarde middel}
+%D {waarde groot}
+%D \stoptyping
+
+% The third (optimized) version:
+
+\def\@ad@{@ad@}
+
+\setvalue{\@ad@ \v!none }{\zeropoint\gobblethreearguments}
+\setvalue{\@ad@ \v!big }{\thirdofthreearguments}
+\setvalue{\@ad@ \v!medium}{\secondofthreearguments}
+\setvalue{\@ad@ \v!small }{\firstofthreearguments}
+\setvalue{\@ad@-\v!big }{-\thirdofthreearguments}
+\setvalue{\@ad@-\v!medium}{-\secondofthreearguments}
+\setvalue{\@ad@-\v!small }{-\firstofthreearguments}
+
+\def\assigndimension#1#2% #3 #4 #5
+ {#2=\ifcsname\@ad@#1\endcsname
+ \csname\@ad@#1\expandafter\endcsname
+ \else
+ #1\expandafter\gobblethreearguments
+ \fi}
+
+\def\@aa@{@aa@}
+
+\setvalue{\@aa@\v!none }{0\gobblethreearguments}
+\setvalue{\@aa@\v!big }{\thirdofthreearguments}
+\setvalue{\@aa@\v!medium}{\secondofthreearguments}
+\setvalue{\@aa@\v!small }{\firstofthreearguments}
+
+\def\assignalfadimension#1#2#3#4#5% #3#4#5 are single digits
+ {\edef#2{\ifcsname\@aa@#1\endcsname
+ \csname\@aa@#1\expandafter\endcsname
+ \else
+ #1\expandafter\gobblethreearguments
+ \fi#3#4#5}}
+
+%D \macros
+%D {assignvalue}
+%D
+%D Een variant hierop is het commando:
+%D
+%D \starttyping
+%D \assignvalue
+%D {|klein|middel|groot}
+%D {\macro}
+%D {waarde klein }
+%D {waarde middel}
+%D {waarde groot}
+%D \stoptyping
+%D
+%D Hierbij krijgt \type{\macro} een waarde afhankelijk van
+%D het meegegeven trefwoord:
+%D
+%D \startnarrower
+%D \startlines
+%D \type{klein }\qquad waarde klein
+%D \type{middel}\qquad waarde middel
+%D \type{groot }\qquad waarde groot
+%D \type{waarde}\qquad waarde
+%D \stoplines
+%D \stopnarrower
+%D
+%D Hier doet \type{geen} dus niet mee.
+
+\def\@av@{@av@}
+
+\letvalue{\@av@\v!big }\thirdofthreearguments
+\letvalue{\@av@\v!medium}\secondofthreearguments
+\letvalue{\@av@\v!small }\firstofthreearguments
+
+\def\assignvalue#1#2#3#4#5%
+ {\edef#2{\ifcsname\@av@#1\endcsname
+ \csname\@av@#1\expandafter\endcsname
+ \else
+ #1\expandafter\gobblethreearguments
+ \fi{#3}{#4}{#5}}}
+
+%D \macros
+%D {assignwidth}
+%D
+%D Een breedte van een opgegeven tekst kan worden berekend en
+%D toegekend aan een \DIMENSION\ met:
+%D
+%D \starttyping
+%D \assignwidth
+%D {\dimension}
+%D {|passend|ruim}
+%D {tekst}
+%D \stoptyping
+%D
+%D Dit commando sluit, evenals de bovenstaande
+%D \type{\assign}||commando's, aan op de wijze waarop
+%D in de andere \CONTEXT||modules toekenningen
+%D plaatsvinden. Bij \type{ruim} wordt de gemeten breedte
+%D met 1~em vermeerderd.
+
+\def\assignwidth#1#2#3#4%
+ {\doifelsenothing{#2}
+ {\setbox\scratchbox\hbox{#3}%
+ #1\wd\scratchbox}
+ {\doifinsetelse{#2}{\v!fit,\v!broad}
+ {\setbox\scratchbox\hbox{#3}%
+ #1\wd\scratchbox
+ \doif{#2}\v!broad{\advance#1 #4}}%
+ {#1=#2}}}%
+
+\protect \endinput
diff --git a/tex/context/base/core-gen.tex b/tex/context/base/core-gen.tex
deleted file mode 100644
index b6ab2a208..000000000
--- a/tex/context/base/core-gen.tex
+++ /dev/null
@@ -1,166 +0,0 @@
-%D \module
-%D [ file=core-gen,
-%D version=1995.10.10,
-%D title=\CONTEXT\ Core Macros,
-%D subtitle=General,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Core Macros / General}
-
-\unprotect
-
-%D \macros
-%D {assigndimension,assignalfadimension}
-%D
-%D Hieronder worden enkele commando's gedefinieerd rond
-%D toekenningen. Allereerst een commando om waarden aan
-%D een \DIMENSION\ toe te kennen:
-%D
-%D \starttyping
-%D \assigndimension
-%D {|klein|middel|groot|-klein|-middel|-groot|geen}
-%D {\dimension}
-%D {waarde klein}
-%D {waarde middel}
-%D {waarde groot}
-%D \stoptyping
-%D
-%D Hierbij krijgt de \DIMENSION\ \type{\dimension} een waarde
-%D afhankelijk van het meegegeven trefwoord.
-%D
-%D \startnarrower
-%D \startlines
-%D \type{(-)klein }\qquad (--) waarde klein
-%D \type{(-)middel}\qquad (--) waarde middel
-%D \type{(-)groot }\qquad (--) waarde groot
-%D \type{geen }\qquad 0pt
-%D \type{waarde }\qquad waarde
-%D \stoplines
-%D \stopnarrower
-%D
-%D Een trefwoord mag worden voorafgegaan door een \type{-}.
-%D Deze macro toont een voorbeeld van het gebruik van
-%D \type{\processaction} en constanten.
-%D
-%D Analoog aan het bovenstaande commando kennen we een
-%D commando om waarden toe te kennen aan een macro:
-%D
-%D \starttyping
-%D \assignalfadimension
-%D {|klein|middel|groot|geen}
-%D {\macro}
-%D {waarde klein}
-%D {waarde middel}
-%D {waarde groot}
-%D \stoptyping
-
-% The third (optimized) version:
-
-\def\@ad@{@ad@}
-
-\setvalue{\@ad@ \v!none }{\zeropoint\gobblethreearguments}
-\setvalue{\@ad@ \v!big }{\thirdofthreearguments}
-\setvalue{\@ad@ \v!medium}{\secondofthreearguments}
-\setvalue{\@ad@ \v!small }{\firstofthreearguments}
-\setvalue{\@ad@-\v!big }{-\thirdofthreearguments}
-\setvalue{\@ad@-\v!medium}{-\secondofthreearguments}
-\setvalue{\@ad@-\v!small }{-\firstofthreearguments}
-
-\def\assigndimension#1#2% #3 #4 #5
- {#2=\ifcsname\@ad@#1\endcsname
- \csname\@ad@#1\expandafter\endcsname
- \else
- #1\expandafter\gobblethreearguments
- \fi}
-
-\def\@aa@{@aa@}
-
-\setvalue{\@aa@\v!none }{0\gobblethreearguments}
-\setvalue{\@aa@\v!big }{\thirdofthreearguments}
-\setvalue{\@aa@\v!medium}{\secondofthreearguments}
-\setvalue{\@aa@\v!small }{\firstofthreearguments}
-
-\def\assignalfadimension#1#2#3#4#5% #3#4#5 are single digits
- {\edef#2{\ifcsname\@aa@#1\endcsname
- \csname\@aa@#1\expandafter\endcsname
- \else
- #1\expandafter\gobblethreearguments
- \fi#3#4#5}}
-
-%D \macros
-%D {assignvalue}
-%D
-%D Een variant hierop is het commando:
-%D
-%D \starttyping
-%D \assignvalue
-%D {|klein|middel|groot}
-%D {\macro}
-%D {waarde klein }
-%D {waarde middel}
-%D {waarde groot}
-%D \stoptyping
-%D
-%D Hierbij krijgt \type{\macro} een waarde afhankelijk van
-%D het meegegeven trefwoord:
-%D
-%D \startnarrower
-%D \startlines
-%D \type{klein }\qquad waarde klein
-%D \type{middel}\qquad waarde middel
-%D \type{groot }\qquad waarde groot
-%D \type{waarde}\qquad waarde
-%D \stoplines
-%D \stopnarrower
-%D
-%D Hier doet \type{geen} dus niet mee.
-
-\def\@av@{@av@}
-
-\letvalue{\@av@\v!big }\thirdofthreearguments
-\letvalue{\@av@\v!medium}\secondofthreearguments
-\letvalue{\@av@\v!small }\firstofthreearguments
-
-\def\assignvalue#1#2#3#4#5%
- {\edef#2{\ifcsname\@av@#1\endcsname
- \csname\@av@#1\expandafter\endcsname
- \else
- #1\expandafter\gobblethreearguments
- \fi{#3}{#4}{#5}}}
-
-%D \macros
-%D {assignwidth}
-%D
-%D Een breedte van een opgegeven tekst kan worden berekend en
-%D toegekend aan een \DIMENSION\ met:
-%D
-%D \starttyping
-%D \assignwidth
-%D {\dimension}
-%D {|passend|ruim}
-%D {tekst}
-%D \stoptyping
-%D
-%D Dit commando sluit, evenals de bovenstaande
-%D \type{\assign}||commando's, aan op de wijze waarop
-%D in de andere \CONTEXT||modules toekenningen
-%D plaatsvinden. Bij \type{ruim} wordt de gemeten breedte
-%D met 1~em vermeerderd.
-
-\def\assignwidth#1#2#3#4%
- {\doifelsenothing{#2}
- {\setbox\scratchbox\hbox{#3}%
- #1\wd\scratchbox}
- {\doifinsetelse{#2}{\v!fit,\v!broad}
- {\setbox\scratchbox\hbox{#3}%
- #1\wd\scratchbox
- \doif{#2}\v!broad{\advance#1 #4}}%
- {#1=#2}}}%
-
-\protect \endinput
diff --git a/tex/context/base/core-grd.mkii b/tex/context/base/core-grd.mkii
new file mode 100644
index 000000000..249e2e430
--- /dev/null
+++ b/tex/context/base/core-grd.mkii
@@ -0,0 +1,1074 @@
+%D \module
+%D [ file=core-grd,
+%D version=1998.03.10,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Grid Snapping (Experimental),
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Core Macros / Grid Snapping}
+
+\unprotect
+
+%D Moved from supp-box:
+
+%D \macros
+%D {startbaselinecorrection,baselinecorrection,
+%D showbaselinecorrection,offbaselinecorrection}
+%D
+%D Spacing around ruled boxes can get pretty messed up. The
+%D next macro tries as good as possible to fix this.
+%D
+%D \startbuffer[1]
+%D \startbaselinecorrection
+%D \ruledhbox{Rule Brittanica}
+%D \stopbaselinecorrection
+%D \stopbuffer
+%D
+%D \typebuffer[1]
+%D
+%D The macros put some white space around the box:
+%D
+%D \getbuffer[1]
+%D
+%D A simple alternative is \type {\baselinecorrection}, which
+%D only looks at the previous line.
+%D
+%D \startbuffer[2]
+%D \baselinecorrection
+%D \ruledhbox{Rule Brittanica}
+%D \baselinecorrection
+%D \stopbuffer
+%D
+%D \typebuffer[2]
+%D
+%D This time the last preceding line gets a correction,%
+%D dependant on the depth.
+%D
+%D \getbuffer[2]
+%D
+%D One can make the correction visible by saying \type
+%D {\showbaselinecorrection}. Part of the correction is
+%D calculated from the dimensions of a~(. One can disble the
+%D correction by calling \type {\offbaselinecorrection}.
+%D
+%D When visualize the first example looks like:
+%D
+%D {\showbaselinecorrection\getbuffer[1]}
+%D
+%D and the second one comes out as:
+%D
+%D {\showbaselinecorrection\getbuffer[2]}
+
+% \definecolor[GridLineColor][red]
+% \definecolor[GridTextColor][blue]
+
+\definepalet
+ [grid]
+ [ one=red,
+ two=green,
+ three=blue,
+ four=gray]
+
+\def\setbaselinecorrections
+ {\setbox0\hbox{\setstrut\strut}%
+ \setbox2\hbox{(}%
+ \dimen0\ht0\advance\dimen0 -\ht2
+ \ifdim\dimen0<\zeropoint\dimen0\zeropoint\fi
+ \dimen2\dp0\advance\dimen2 -\dp2
+ \ifdim\dimen2<\zeropoint\dimen2\zeropoint\fi
+ \edef\thetopbaselinecorrection {\the\dimen0}\dimen0-\dimen0
+ \edef\thebotbaselinecorrection {\the\dimen2}\dimen2-\dimen2
+ \edef\thenegtopbaselinecorrection{\the\dimen0}%
+ \edef\thenegbotbaselinecorrection{\the\dimen2}}
+
+\def\dotopbaselinecorrection {\kern\thetopbaselinecorrection}
+\def\dobotbaselinecorrection {\kern\thebotbaselinecorrection}
+\def\donegtopbaselinecorrection{\kern\thenegtopbaselinecorrection}
+\def\donegbotbaselinecorrection{\kern\thenegbotbaselinecorrection}
+
+\def\showbaselinecorrection
+ {\def\dobaselinecorrection % visualization is not watertight!
+ {\bgroup
+\ifdim\prevdepth>\zeropoint\kern-\prevdepth\fi
+ \setbox0\null
+ \wd0\hsize
+ \dp0\strutdp
+ \nointerlineskip
+ \forgetall
+ \ruledvbox{\box0}%
+ \egroup
+ \prevdepth\strutdp}%
+ \def\dotopbaselinecorrection
+ {\hrule\!!height\thetopbaselinecorrection}%
+ \def\dobotbaselinecorrection
+ {\hrule\!!height\thebotbaselinecorrection}}
+
+\def\dobaselinecorrection
+ {\ifdim\prevdepth>\zeropoint\kern-\prevdepth\fi
+ \kern\strutdp
+ \prevdepth\strutdp}
+
+% \def\baselinecorrection
+% {\endgraf
+% \ifvmode
+% \ifdim\prevdepth<\maxdimen
+% \ifdim\prevdepth<\zeropoint \else
+% \ifdim\prevdepth<\strutdp
+% \dobaselinecorrection
+% \fi
+% \fi
+% \fi
+% \fi}
+
+\def\baselinecorrection
+ {\endgraf
+ \ifvmode
+ \ifdim\prevdepth<\maxdimen
+ \ifdim\prevdepth<\zeropoint \else
+ \ifdim\prevdepth<\strutdepth \relax
+ \pushlastnode
+ \dobaselinecorrection
+ \poplastnode
+ \fi
+ \fi
+ \fi
+ \fi}
+
+\def\pagebaselinecorrection
+ {\ifdim\pagegoal<\maxdimen
+ \ifdim\pagetotal>\lineheight % or \topskip
+ \scratchdimen\pagetotal
+ \advance\scratchdimen\lineheight
+ \ifdim\scratchdimen<\pagegoal
+ \baselinecorrection
+ \fi
+ \fi
+ \fi}
+
+% Beware, keep this one as it is, see for instance module
+% m-steps.tex, where we apply a \localhsize to the \vbox, in
+% order to follow narrower and side floats !
+
+% \def\startbaselinecorrection
+% {\baselinecorrection
+% \ifvmode
+% \bgroup
+% \setbox\scratchbox\vbox\bgroup
+% \ignorespaces
+% \let\stopbaselinecorrection\dostopbaselinecorrection
+% \else
+% \let\stopbaselinecorrection\relax
+% \fi}
+
+% \def\dostopbaselinecorrection % I have to check columns yet.
+% {\endgraf
+% \egroup
+% \topbaselinecorrection
+% \box\scratchbox
+% \botbaselinecorrection
+% \egroup}
+
+% \let\stopbaselinecorrection=\relax
+
+\def\startbaselinecorrection
+ {\bgroup
+ \let\stopbaselinecorrection\egroup
+ \ifcase\baselinecorrectionmode
+ \or % normal
+ \baselinecorrection
+ \ifvmode
+ \setbox\scratchbox\vbox\bgroup\ignorespaces
+ \let\stopbaselinecorrection\donormalstopbaselinecorrection
+ \fi
+ \or % off
+ \or % force
+ \baselinecorrection
+ \ifvmode
+ \setbox\scratchbox\vbox\bgroup\ignorespaces
+ \let\stopbaselinecorrection\doforcedstopbaselinecorrection
+ \fi
+ \fi}
+
+\let\stopbaselinecorrection\relax
+
+\def\donormalstopbaselinecorrection % I have to check columns yet.
+ {\egroup
+ \topbaselinecorrection
+ \box\scratchbox
+ \botbaselinecorrection
+ \egroup}
+
+\def\doforcedstopbaselinecorrection % I have to check columns yet.
+ {\egroup
+ \forcedtopbaselinecorrection
+ \box\scratchbox
+ \forcedbotbaselinecorrection
+ \egroup}
+
+%D We do a bit more checking than needed. The pageborder check
+%D is not needed, but I want to look the visualization as good
+%D as possible too.
+
+% \def\offbaselinecorrection % Can be used inside correction.
+% {\def\startbaselinecorrection{\bgroup\let\stopbaselinecorrection\egroup}}
+
+\chardef\baselinecorrectionmode\plusone
+
+\def\onbaselinecorrection {\chardef\baselinecorrectionmode\plusone }
+\def\offbaselinecorrection {\chardef\baselinecorrectionmode\plustwo }
+\def\forcebaselinecorrection{\chardef\baselinecorrectionmode\plusthree}
+
+%D \macros
+%D {topbaselinecorrection,botbaselinecorrection}
+%D
+%D The actual top and bottom corrections are implemented as:
+
+% \def\topbaselinecorrection
+% {\ifvmode \ifdim\pagegoal<\maxdimen
+% \bgroup
+% \setbaselinecorrections
+% \whitespace
+% \nointerlineskip
+% \dotopbaselinecorrection
+% \egroup
+% \fi \fi}
+
+
+\def\topbaselinecorrection
+ {\ifvmode \ifdim\pagegoal<\maxdimen
+ \forcedtopbaselinecorrection
+ \fi \fi}
+
+\def\forcedtopbaselinecorrection
+ {\ifvmode
+ \bgroup
+ \setbaselinecorrections
+ \whitespace
+ \nointerlineskip
+ \dotopbaselinecorrection
+ \egroup
+ \fi}
+
+\def\botbaselinecorrection
+ {\ifvmode
+ \bgroup
+ \setbaselinecorrections
+ \dobotbaselinecorrection
+ \allowbreak % new, otherwise problems when many in a row
+ \prevdepth\strutdp
+ \egroup
+ \fi}
+
+\let\forcedbotbaselinecorrection\botbaselinecorrection
+
+%D Still very experimental and therefore undocumented.
+
+\newif\ifgridsnapping % UNDER DEVELOPMENT, USE WITH CARE
+\newif\ifforcepresnap \forcepresnaptrue % false in mixed single/double
+\newif\ifstrutsnapping \strutsnappingtrue % sometimes handy to be false
+
+\def\positiveextrasnap {\gdef\extrasnapsign{+}}
+\def\negativeextrasnap {\gdef\extrasnapsign{-}}
+
+\def\extrasnapreset {\global\chardef\@@extrasnap0
+ \positiveextrasnap}
+\def\extrasnapbefore {\global\chardef\@@extrasnap1 }
+\def\extrasnaparound {\global\chardef\@@extrasnap2 }
+\def\extrasnapafter {\global\chardef\@@extrasnap3 }
+
+\def\enablepresnapcorrection {\global\chardef\@@presnap\zerocount}
+\def\disablepresnapcorrection {\global\chardef\@@presnap\plusone}
+
+\extrasnapreset \enablepresnapcorrection
+
+\newif\iftracegridsnapping
+\newif\ifshowgridboxes
+\newif\ifshowfuzzyskips
+
+\let\showgridboxes\showgridboxestrue
+
+\def\showgridsnapping
+ {\tracegridsnappingtrue
+ \showgridboxestrue}
+
+\chardef\@@alignsnap =0
+\chardef\@@alignsnapbox =0
+\chardef\@@alignsnapmethod=0
+
+\let\presnapskip \!!zeropoint \def\presnap {-}
+\let\postsnapskip\!!zeropoint \let\postsnap\presnap
+
+\newcount\currentgridsnap
+
+\def\tracedsnapping
+ {\iftracegridsnapping
+ \llap
+ {\startlayoutcomponent{gridsnaps}{grid snaps}%
+ \infofont
+ \global\advance\currentgridsnap\plusone
+ \color[grid:three]{\vl\presnapskip
+ \vl\presnap
+ \vl\postsnap
+ \ifcase\@@alignsnapbox\relax
+ \vl\ifcase\@@extrasnap
+ 00\or
+ \extrasnapsign0\or
+ \extrasnapsign\extrasnapsign\or
+ 0\extrasnapsign\fi
+ \fi
+ \vl\the\currentgridsnap\vl}%
+ \stoplayoutcomponent}%
+ \fi}
+
+\def\snaptogrid% [#1]#2 -> #2 == \hbox|\vbox
+ {\dosingleempty\dosnaptogrid}
+
+% \def\dosnaptogrid[#1]%
+% {\ifgridsnapping
+% \iffirstargument\doifsomething{#1}{\verplaatsopgrid[#1]}\fi
+% \expandafter\dodosnaptogrid
+% \fi}
+
+% \def\dosnaptogrid[#1]%
+% {\resetlastlinewidth % maybe in more places, otherwise spacing gets messed up
+% \ifgridsnapping
+% \iffirstargument\doifsomething{#1}{\moveongrid[#1]}\fi
+% \expandafter\dodosnaptogrid
+% \fi}
+
+\def\dosnaptogrid[#1]%
+ {\resetlastlinewidth % maybe in more places, otherwise spacing gets messed up
+ \doifinsetelse\v!force{#1}%
+ {\moveongrid[#1]%
+ \dodosnaptogrid}
+ {\ifgridsnapping
+ \doifsomething{#1}{\moveongrid[#1]}%
+ \expandafter\dodosnaptogrid
+ \fi}}
+
+% \def\forcedpresnapcorrection % test this on 'details'
+% {\ifforcepresnap
+% \ifvmode \else \par \fi % new
+% % we don't want top of page space when 'top' option
+% %\verticalstrut\nobreak\vskip-\struttotal
+% %\verticalstrut\vskip-\struttotal
+% % nobreak really needed
+% \allowbreak\verticalstrut\nobreak\vskip-\struttotal
+% %\ifdim\pagetotal>\topskip \else
+% % eigenlijk signal
+% %\writestatus{grid}{removing dummy at top of page}%
+% %\bgroup
+% %\output{\setbox\scratchbox\box255}%
+% %\penalty\outputpenalty
+% %\egroup
+% %\fi
+% \fi}
+
+\def\forcedpresnapcorrection % test this on 'details'
+ {\ifforcepresnap
+ \ifvmode \else \par \fi % new
+ % we don't want top of page space when 'top' option
+ % \verticalstrut\nobreak\vskip-\struttotal
+ % \verticalstrut\vskip-\struttotal
+ % \nobreak really needed
+ % \dosomebreak\allowbreak % no: spoils heads, so only under know situation, not in snapper
+ \verticalstrut
+ \nobreak
+ \vskip-\struttotal
+ %\ifdim\pagetotal>\topskip \else
+ % eigenlijk signal
+ %\writestatus{grid}{removing dummy at top of page}%
+ %\bgroup
+ %\output{\setbox\scratchbox\box255}%
+ %\penalty\outputpenalty
+ %\egroup
+ %\fi
+ \fi}
+
+\def\setgridtracebox#1[#2]% % maybe reverse the order
+ {\setbox\nextbox#1%
+ {\hbox
+ {\hbox to \zeropoint
+ {\startlayoutcomponent{gridsnaps}{grid snaps}%
+ \color[grid:#2]{\ruledhbox{\fakebox\nextbox}}%
+ \stoplayoutcomponent
+ \hss}%
+ \flushnextbox}}}
+
+\newif\ifboxedsnapping \boxedsnappingtrue
+
+\chardef\depthsnapmethod \plusone % downward compatible, minus one line
+\chardef\heightsnapmethod\plusone % downward compatible, minus one line
+
+\def\dodosnaptogrid
+ {\dowithnextbox
+ {\bgroup
+ \ifcase\@@alignsnapmethod \or
+ % we're dealing with text with a possible big depth/height
+ \chardef\depthsnapmethod \plustwo
+ \chardef\heightsnapmethod\plustwo
+ \fi
+ \ifdim\nextboxht<\textheight % handle special case (like page fig)
+ \ifcase\@@alignsnapbox\relax
+ \ifcase\@@alignsnap\else % 1=top 2=high 3=middle 4=low
+ \ifshowgridboxes
+ \setgridtracebox\hbox[two]%
+ \fi
+ %\getnoflines{\nextboxht}%
+ \getnoflines\nextboxht
+ \setbox\nextbox\vbox to \noflines\lineheight
+ {\ifnum\@@alignsnap=1 \kern\lineheight\kern-\topskip\fi
+ \ifnum\@@alignsnap>2 \vfill\fi
+ \flushnextbox
+ \ifnum\@@alignsnap<4 \vfill\fi}%
+ \fi
+ \ifshowgridboxes
+ \setgridtracebox\hbox[three]%
+ \fi
+ \forgetall
+ \par
+ \ifvbox\nextbox
+ \setbox\nextbox\hbox{\flushnextbox}% don't ask
+ \fi
+ \scratchskip\lastskip
+ \edef\presnapskip{\the\lastskip}%
+ % mixing single/double columns sometimes goes wrong,
+ % check 'som' document
+ \ifinsidecolumns
+ \forcepresnaptrue
+ \fi
+ \forcedpresnapcorrection
+ \ifdim\nextboxht>\strutht
+ \scratchdimen\nextboxht
+ \ifcase\@@presnap\relax
+ \ifdim\scratchskip>\zeropoint\relax
+ \scratchcounter\scratchskip
+ \advance\scratchcounter -\openlineheight
+ \ifnum\scratchcounter<0
+ \scratchcounter-\scratchcounter
+ \fi
+ \ifnum\scratchcounter<10 % \lastkip is about \openlineheight
+ \advance\scratchdimen -\openstrutdepth
+ \edef\presnapskip{*\presnapskip}%
+ \else\ifdim\scratchskip>\openlineheight
+ %<\openlineheight \else
+ \advance\scratchdimen -\openstrutdepth
+ \edef\presnapskip{*\presnapskip}%
+ \fi\fi
+ \fi
+ \fi
+ % \getnoflines\scratchdimen % maybe raw ?
+ % \advance\noflines -1
+ \ifcase\heightsnapmethod
+ % raw
+ \or
+ \advance\scratchdimen-\lineheight % tight (default)
+ \or
+ \advance\scratchdimen-\strutheight % fit (text)
+ \or
+ \advance\scratchdimen-\strutheight % tolerant
+ \advance\scratchdimen-\roundingeps
+ \fi
+ \getnoflines\scratchdimen
+ \ifnum\noflines>0
+ \scratchdimen\noflines\lineheight
+ \else
+ \scratchdimen\zeropoint
+ \fi
+ \else
+ \scratchdimen\zeropoint
+ \fi
+ \ifnum\@@extrasnap=1 \advance\scratchdimen \extrasnapsign \lineheight \fi
+ \ifnum\@@extrasnap=2 \advance\scratchdimen \extrasnapsign.5\lineheight \fi
+ \edef\presnap{\the\scratchdimen}%
+ \ifstrutsnapping
+ \ifboxedsnapping
+ \getrawnoflines\scratchdimen
+ \advance\scratchdimen-\noflines\lineheight
+ \vskip\scratchdimen % disappears at top of page
+ \dorecurse\noflines{\verticalstrut\nobreak}%
+ \else \ifdim\scratchdimen=\zeropoint
+ % nothing to skip
+ \else % disappears at top of page
+ \vskip\scratchdimen
+ \fi \fi
+ \fi
+ \ifdim\nextboxdp>\strutdp
+ % \getnoflines\nextboxdp
+ % \advance\noflines \minusone
+ \scratchdimen\nextboxdp\relax
+ \ifcase\depthsnapmethod
+ % raw
+ \or
+ \advance\scratchdimen-\lineheight % tight (default)
+ \or
+ \advance\scratchdimen-\strutdepth % fit (text)
+ \or
+ \advance\scratchdimen-\strutdepth % tolerant
+ \advance\scratchdimen-\roundingeps
+ \fi
+ \getnoflines\scratchdimen
+ \ifnum\noflines>0
+ \scratchdimen\noflines\lineheight
+ \else
+ \scratchdimen\zeropoint
+ \fi
+ \else
+ \scratchdimen\zeropoint
+ \fi
+ \ifnum\@@extrasnap=2 \advance\scratchdimen \extrasnapsign.5\lineheight \fi
+ \ifnum\@@extrasnap=3 \advance\scratchdimen \extrasnapsign \lineheight \fi
+ \edef\postsnap{\the\scratchdimen}%
+ \ifstrutsnapping
+ \nextboxht\strutht
+ \nextboxdp\strutdp
+ \else
+ \scratchdimen\presnap
+ \advance\scratchdimen \strutht
+ \nextboxht\scratchdimen
+ \scratchdimen\postsnap
+ \advance\scratchdimen \strutdp
+ \nextboxdp\scratchdimen
+ \fi
+ \hbox{\tracedsnapping\flushnextbox}%
+ \ifstrutsnapping
+ \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi
+ \fi
+ \else
+ \scratchdimen\nextboxht\relax
+ \ifcase\@@alignsnapbox
+ % can't happen here
+ \or
+ \getrawnoflines\scratchdimen
+ \else
+ \getnoflines \scratchdimen
+ \fi
+ \scratchdimen\noflines\lineheight\relax
+ \advance\scratchdimen-\strutdepth
+ % spoils the whole game (fit/broad/line)
+ % \ifnum\pagetotal>\zeropoint \else % disable this as option
+ % \advance\scratchdimen-\strutheight
+ % \advance\scratchdimen+\topskip
+ % \fi
+ \dimen0=\scratchdimen
+ \dimen2=\strutdepth
+ \ifshowgridboxes
+ \setgridtracebox\hbox[two]%
+ \fi
+ \nextboxdp\strutdp
+ \dimen4=\nextboxht
+ \dimen6=\nextboxdp
+ \iftracegridsnapping
+ \setbox\scratchbox\hbox
+ {\scratchdimen\@@alignsnapamount\relax
+ \ifdim\scratchdimen<\zeropoint
+ \tracedgridamount\zeropoint{-\scratchdimen}%
+ \else
+ \tracedgridamount\scratchdimen\zeropoint
+ \fi}%
+ \smashbox\scratchbox
+ \setbox\nextbox\hbox{\box\scratchbox\flushnextbox}%
+ \fi
+ \setbox\nextbox\hbox
+ {\scratchdimen\@@alignsnapamount\relax
+ \ifcase\@@alignsnapdepth\or
+ % don't change this ever !
+ \ifdim\dimen0<\lineheight
+ % otherwise it is ok, but ending up inside
+ % the next paragraph is seldom what we want,
+ % so we move one line up
+ \advance\scratchdimen-\lineheight
+ \advance\scratchdimen\strutheight
+ \else
+ % otherwise we can move down to the
+ % baseline
+ \advance\scratchdimen\dimen6 % == \strutdepth
+ \fi
+ \fi
+ \lower\scratchdimen\flushnextbox}%
+ \nextboxht\dimen4
+ \nextboxdp\dimen6
+ \ifnum\@@alignsnap<4 % 4 = regel
+ \setbox\nextbox\vbox to \scratchdimen
+ {\forgetall
+ \ifnum\@@alignsnap>2 \vfill\fi % 3 4
+ \flushnextbox
+ \nointerlineskip % \offinterlineskip
+ \ifnum\@@alignsnap<4 \vfill\fi % 2 3
+ \kern\zeropoint}%
+ \fi
+ \ifshowgridboxes
+ \setgridtracebox\vbox[three]%
+ \fi
+ \scratchdimen\@@alignsnapamount
+ \edef\presnapskip{\the\scratchdimen}%
+ \ifnum\@@alignsnap>2 \def\presnap {+}\fi
+ \ifnum\@@alignsnap<4 \def\postsnap{+}\fi
+ \setbox\nextbox\hbox{\tracedsnapping\flushnextbox}%
+ \par
+ \nextboxht\dimen0
+ \nextboxdp\dimen2
+ \forcedpresnapcorrection
+ \nointerlineskip
+ \flushnextbox
+ \fi
+ \else
+ \setbox\nextbox\vbox to \textheight
+ {\ifdim\nextboxdp=\zeropoint
+ \hbox{\lower\strutdepth\flushnextbox}
+ \else % this branch is yet untested
+ \vss
+ \hbox{\lower\nextboxdp\flushnextbox}
+ \vskip-\strutdepth
+ \fi}%
+ \nextboxdp\strutdepth
+ \flushnextbox
+ \fi
+ \extrasnapreset
+ \enablepresnapcorrection
+ \global\chardef\@@alignsnap\zerocount
+ \global\chardef\@@alignsnapbox\zerocount
+ \egroup}}
+
+\def\tracedgridamount#1#2%
+ {\startlayoutcomponent{gridsnaps}{grid snaps}%
+ \color[grid:four]{\vrule\!!width\nextboxwd\!!height#1\!!depth#2}%
+ \stoplayoutcomponent}
+
+\def\snaptomathgrid % probably not working ok, also kind of obsolete
+ {\ifgridsnapping
+ \dowithnextbox
+ {\blank[\v!line]\snaptogrid\vbox{\flushnextbox}\blank[\v!line]}
+ \vbox\bgroup
+ \forgetdisplayskips
+ \@EA\let\@EA\next
+ \fi}
+
+\def\topsnaptogrid
+ {\ifgridsnapping
+ \dowithnextbox
+ {\scratchdimen\nextboxht
+ \advance\scratchdimen -\strutht
+ \advance\scratchdimen \topskip
+ \nextboxht\scratchdimen
+ \nextboxdp\zeropoint
+ \flushnextbox
+ \kern\lineheight
+ \kern-\topskip
+ \nointerlineskip}
+ \hbox
+ \fi}
+
+% \def\centertogrid % meant for special situations
+% {\ifgridsnapping
+% \dowithnextboxcontent
+% {\ignorespaces}
+% {\bgroup
+% \par
+% \scratchdimen\nextboxht
+% \advance\scratchdimen \nextboxdp
+% \getnoflines\scratchdimen
+% \setbox\nextbox\vbox to \noflines\lineheight
+% {\forgetall
+% \vskip\zeropoint \!!plus \nextboxht
+% \copy\nextbox
+% \kern.5\strutdp % VOORLOPIGE WAARDE
+% \vskip\zeropoint \!!plus \nextboxdp}%
+% \noindent\snaptogrid\vbox{\flushnextbox}%
+% \egroup}
+% \vbox % was \hbox
+% \fi}
+
+% The next implementation is sub-optimal
+%
+% \def\centertogrid % usage: see ie pascal / stepcharts
+% {\snaptogrid[\v!midden,.5\strutdp]\vbox}
+
+\def\centertogrid % meant for special situations
+ {\ifgridsnapping
+ \dowithnextboxcontent
+ {\ignorespaces}
+ {\bgroup
+ \par
+ \scratchdimen\nextboxht
+ \advance\scratchdimen \nextboxdp
+ \getnoflines\scratchdimen
+ \setbox\nextbox\vbox to \noflines\lineheight
+ {\forgetall
+ \vss
+ \topbaselinecorrection
+ \copy\nextbox
+ \botbaselinecorrection
+ \vss}%
+ \setbox\nextbox\hbox{\lower\strutdp\flushnextbox}%
+ \forgeteverypar % new per 3/4/2008, prevents duplicate pos nodes resulting in extra whitespace
+ \noindent\snaptogrid\vbox{\flushnextbox}%
+ \egroup}
+ \vbox % was \hbox
+ \fi}
+
+% testbed for \centertogrid
+%
+% \strut Bruggetje
+% \startlinecorrection
+% \startcombination
+% {\framed{test}} {} {\framed{test}} {}
+% \stopcombination
+% \stoplinecorrection
+% \strut Bruggetje
+% \startlinecorrection
+% \startcombination[2*2]
+% {\framed{test}} {} {\framed{test}} {}
+% {\framed{test}} {} {\framed{test}} {}
+% \stopcombination
+% \stoplinecorrection
+% \strut Bruggetje
+% \startlinecorrection[blank]
+% \startcombination
+% {\framed{test}} {} {\framed{test}} {}
+% \stopcombination
+% \stoplinecorrection
+% \strut Bruggetje
+% \startlinecorrection[blank]
+% \startcombination[2*2]
+% {\framed{test}} {} {\framed{test}} {}
+% {\framed{test}} {} {\framed{test}} {}
+% \stopcombination
+% \stoplinecorrection
+% \strut Bruggetje
+% \startlinecorrection
+% \startcombination
+% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
+% \stopcombination
+% \stoplinecorrection
+% \strut Bruggetje
+% \startlinecorrection
+% \startcombination[2*2]
+% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
+% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
+% \stopcombination
+% \stoplinecorrection
+% \strut Bruggetje
+% \startlinecorrection[blank]
+% \startcombination
+% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
+% \stopcombination
+% \stoplinecorrection
+% \strut Bruggetje
+% \startlinecorrection[blank]
+% \startcombination[2*2]
+% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
+% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
+% \stopcombination
+% \stoplinecorrection
+
+\ifx\startbaselinecorrection\undefined \wait \fi % change order
+
+\let\normalstartbaselinecorrection=\startbaselinecorrection
+
+\def\startbaselinecorrection
+ {\ifgridsnapping
+ \centertogrid\bgroup
+ \let\stopbaselinecorrection\egroup
+ \else
+ \normalstartbaselinecorrection
+ \fi}
+
+\chardef\gridboxlinenomode\plusone
+\chardef\gridboxlinemode \plusone % 0:nothing 1:all 2:lines 3:frame
+
+\def\gridboxvbox {\ifcase\gridboxlinemode\vbox\or\ruledvbox\or\vbox\or\ruledvbox\else\ruledvbox\fi}
+\def\gridboxwidth{\ifcase\gridboxlinemode0\or.5\or.5\or0\else.5\fi\testrulewidth}
+
+\def\setgridbox#1#2#3%
+ {\setbox#1\gridboxvbox to #3 % given size
+ {\forgetall
+ \resetteststrut
+ \offinterlineskip
+ \hsize#2%
+ \baselinerulefalse
+ \gridboxvbox % calculated size
+ {\getrawnoflines{#3}% \getnoflines{#3}%
+ \vskip\topskip
+ \vskip-\strutht
+ \scratchdimen#2\advance\scratchdimen \lineheight
+ \dorecurse\noflines
+ {\strut
+ \hskip-.5\lineheight
+ \ifcase\gridboxlinenomode\or
+ \rlap
+ {\hskip.2\bodyfontsize\hskip\scratchdimen
+ \infofont\hbox to 1em{\hss\recurselevel}}%
+ \or
+ \llap
+ {\infofont\hbox to 1em{\hss\recurselevel}%
+ \hskip.2\bodyfontsize}%
+ \fi
+ \vrule
+ \!!height \gridboxwidth
+ \!!depth \gridboxwidth
+ \!!width \scratchdimen
+ \par}}
+ \vfill}}
+
+%D Some intervention macros:
+
+\def\gridwarning#1{\message{[beware of #1 extra snap]}}
+
+\global\let\@@alignsnapamount\!!zeropoint
+\global\chardef\@@alignsnapdepth0
+
+\def\@@unknowngriddisplacement
+ {\global\chardef\@@alignsnapbox\plusthree
+ \global\let\@@alignsnapamount\commalistelement}
+
+\def\domoveongrid[#1]%
+ {\ifgridsnapping\doifsomething{#1}{\dodomoveongrid[#1]}\fi}
+
+\def\dodomoveongrid[#1]% some day : speed up
+ {\global\chardef\@@alignsnap\zerocount
+ \global\chardef\@@alignsnapbox\zerocount
+ \global\chardef\@@alignsnapdepth\zerocount
+ \global\chardef\@@alignsnapmethod\zerocount
+ \global\let\@@alignsnapamount\!!zeropoint
+ \donefalse
+ \expanded{\processallactionsinset[#1]}
+ [\v!standard=>,
+ \v!normal=>, % to be sure
+ \v!yes=>, % to be sure
+ \v!top=>\gridwarning+\positiveextrasnap\extrasnapbefore,
+ \v!bottom=>\gridwarning+\positiveextrasnap\extrasnapafter,
+ \v!both=>\positiveextrasnap\extrasnaparound,
+ -\v!top=>\gridwarning-\negativeextrasnap\extrasnapbefore,
+ -\v!bottom=>\gridwarning-\negativeextrasnap\extrasnapafter,
+ -\v!both=>\negativeextrasnap\extrasnaparound,
+ \v!text=>\global\chardef\@@alignsnapmethod\plusone, % accurate calculations
+ \v!page=>\global\chardef\@@alignsnap\plusone, % topskip
+ \v!high=>\global\chardef\@@alignsnap\plustwo,
+ \v!middle=>\global\chardef\@@alignsnap\plusthree,
+ \v!low=>\global\chardef\@@alignsnap\plusfour,
+ \v!fit=>\global\chardef\@@alignsnapbox\plusone, % new
+ \v!broad=>\global\chardef\@@alignsnapbox\plustwo, % new
+ \v!depth=>\global\chardef\@@alignsnapdepth\plusone, % new
+ \v!line=>\global\chardef\@@alignsnapbox\plusthree
+% \global\chardef\@@alignsnapdepth\plusone
+ \global\chardef\@@alignsnap\plusfour,
+ \v!reset=>\positiveextrasnap\extrasnapreset,
+ \v!none=>\global\chardef\@@alignsnap\zerocount
+ \global\chardef\@@alignsnapbox\zerocount,
+ \v!force=>, % turns on grid snapping even when not on
+ \s!default=>,
+ \s!unknown=>\@@unknowngriddisplacement]}
+
+\def\moveongrid
+ {\dosingleempty\domoveongrid}
+
+\def\doplaceongrid[#1]%
+ {\domoveongrid[#1]\snaptogrid\vbox}
+
+\def\placeongrid
+ {\dosingleempty\doplaceongrid}
+
+%D Snapping is rather robust as long as we use whole lines.
+%D Half lines of white space can however be handled when they
+%D come in pairs. The corrections needed when crossing page
+%D boundaries in the middle of such a pair, are handled by
+%D macros that are (named) sort of fuzzy. This fuzzy mechanism
+%D was written as an extension to the grid typesetting needed
+%D for typesetting (part of) the \MAPS.
+%D
+%D \starttyping
+%D \setuptyping
+%D [before={\blank[halfline]},
+%D after={\blank[halfline]}]
+%D \stoptyping
+
+\newif \iffuzzyvskip
+\newif \iffuzzysnapdone
+\newif \iffuzzysnapping
+\newif \iffuzzysnapped
+\chardef \fuzzysnappedleft=0 % ==1 when fuzzybegin still open
+\newpersistentmark\fuzzymark % (!)
+\newcount \fuzzymarker
+\newbox \fuzzysnapbox
+\newbox \fuzzysnapsplit
+
+\def\dosyncfuzzyvskip
+ {\ifvmode\ifdim\lastskip<\lineheight\ifdim\lastskip>\zeropoint
+ \bgroup % - added 28/2/2003: check this, there was no -
+ \endgraf\forgetall\verticalstrut\nobreak\vskip-\struttotal
+ \egroup
+ \fi\fi\fi}
+
+\def\fuzzyvskip#1%
+ {\iffuzzysnapdone
+ \dosyncfuzzyvskip % NEWER
+ \endfuzzysnapping
+ \vskip#1\relax
+ \global\fuzzysnapdonefalse
+ \else
+ \vskip#1\relax
+ \beginfuzzysnapping
+ \global\fuzzysnapdonetrue
+ \fi}
+
+\def\setfuzzymark#1#2#3% #1/#2 => error recovery
+ {\ifgridsnapping
+ \global\fuzzysnappingtrue
+ \global\advance\fuzzymarker \ifodd\fuzzymarker#1\else#2\fi
+ \nobreak
+ \ifshowfuzzyskips
+ \hbox{\color[grid:three]
+ {\llap{\infofont#3\vl\the\fuzzymarker}\nobreak
+ \vrule\!!width\hsize\!!height.1\lineheight}}
+ \nobreak
+ \fi
+ %[\the\fuzzymarker]
+ %\expandafter\fuzzymark\expandafter{\the\fuzzymarker}%
+ \expandafter\rawsetmark\expandafter\fuzzymark\expandafter{\the\fuzzymarker}%
+ \nobreak
+ \fi}
+
+\def\beginfuzzysnapping{\setfuzzymark21\v!start} % odd
+\def\endfuzzysnapping {\setfuzzymark12\v!stop } % even
+
+\def\removelastfuzzyvskip
+ {\ifgridsnapping
+ \iffuzzysnapping
+ \ifdim\lastskip<\openlineheight
+ \else
+ \removelastskip
+ \fi
+ \else
+ \removelastskip
+ \fi
+ \else
+ \removelastskip
+ \fi}
+
+\def\docheckfuzzysnap#1%
+ {\bgroup
+ \dontcomplain
+ \setbox\fuzzysnapbox\copy#1\relax
+ \setbox\fuzzysnapsplit\vsplit\fuzzysnapbox to 1\lineheight
+ \let\topfuzzymark\empty % indeed here ... no real mark
+ \getsplitmarks\fuzzymark
+% \ifcase0\topfuzzymark
+ \ifcase0\rawgetsplittopmark\fuzzymark
+ \global\chardef\fuzzysnappedleft\zerocount
+ \global\fuzzysnappedfalse
+% \else\ifodd\topfuzzymark
+ \else\ifodd\rawgetsplittopmark\fuzzymark
+ \global\chardef\fuzzysnappedleft\plusone
+ \global\fuzzysnappedtrue
+ \else
+ \global\chardef\fuzzysnappedleft=2
+ \global\fuzzysnappedtrue
+ \fi\fi
+ \iffuzzysnapped \else
+ \doloop
+ {\ifvoid\fuzzysnapbox
+ \exitloop
+ \else
+ \setbox\fuzzysnapsplit=\vsplit\fuzzysnapbox to \lineheight
+ %\let\topfuzzymark=\empty % ... but not here
+ \getsplitmarks\fuzzymark
+% \ifcase0\topfuzzymark
+ \ifcase0\rawgetsplittopmark\fuzzymark
+ % continue
+% \else\ifodd\topfuzzymark
+ \else\ifodd\rawgetsplittopmark\fuzzymark
+ \exitloop
+ \else
+ \global\chardef\fuzzysnappedleft\plusone
+ \global\fuzzysnappedtrue
+ \exitloop
+ \fi\fi
+ \fi}%
+ \fi
+ \egroup}
+
+\def\getfuzzysnapcorrection#1%
+ {\global\let\presnapcorrection \relax
+ \global\let\postsnapcorrection\relax
+ \ifgridsnapping\iffuzzysnapping
+ \docheckfuzzysnap{#1}%
+ \iffuzzysnapped
+ \iftracegridsnapping
+ \gdef\presnapcorrection
+ {\color[grid:four]{\hrule\!!height.5\openlineheight\!!width\hsize}}%
+ \else
+ \gdef\presnapcorrection{\kern.5\openlineheight}%
+ \fi
+ \gdef\postsnapcorrection{\kern-.5\openlineheight}% get the height ok
+ \fi
+ \fi\fi}
+
+\def\fuzzysnappedbox#1#2% \box \unvbox
+ {\getfuzzysnapcorrection{#2}%
+ \presnapcorrection
+ #1#2%
+ \postsnapcorrection}
+
+\def\adaptfuzzypagegoal
+ {\ifgridsnapping\iffuzzysnapping\ifcase\fuzzysnappedleft\or % see dopagecontents
+ \scratchdimen\pagegoal
+ \advance\scratchdimen -.5\openlineheight
+ \global\pagegoal\scratchdimen
+ \global\advance\vsize -.5\openlineheight
+ \global\chardef\fuzzysnappedleft0
+ \fi\fi\fi}
+
+%D New, experimental, used in caption snapping:
+%D
+%D \starttyping
+%D \startcolumnset
+%D
+%D \setupcaption[figure][style=\tfx\setupinterlinespace,inbetween=,grid=top]
+%D
+%D \placefigure [lrtb] {\dorecurse{5}{green gras}}
+%D {\externalfigure[dummy][width=\textwidth,height=3cm,grid=height]}
+%D \placefigure [lrtb] {\dorecurse{15}{green gras}}
+%D {\externalfigure[dummy][width=\textwidth,height=3cm,grid=height]}
+%D
+%D \setupcaption[figure][style=\tfx\setupinterlinespace,inbetween=,grid=bottom]
+%D
+%D \placefigure [rltb] {\dorecurse{5}{green gras}}
+%D {\externalfigure[dummy][width=\textwidth,height=3cm,grid=height]}
+%D \placefigure [rltb] {\dorecurse{15}{green gras}}
+%D {\externalfigure[dummy][width=\textwidth,height=3cm,grid=height]}
+%D
+%D \input thuan
+%D
+%D \stopcolumnset
+%D \stoptyping
+
+\def\moveboxontogrid#1#2#3% box method firstlineht % experimental ! ! !
+ {\doifsomething{#2}
+ {\getnoflines{\ht#1}% no depth taken into account, depth preserved
+ \scratchdimen\noflines\lineheight
+ \advance\scratchdimen-\strutdp
+ \bgroup
+ \advance\scratchdimen-\onepoint % be a bit tolerant
+ \ifdim\scratchdimen>\ht#1\relax
+ \egroup
+ \doif{#2}\v!top {\setbox#1\vbox to \scratchdimen{\vskip-#3\vskip\strutht\box#1\vfill}}%
+ \doif{#2}\v!bottom{\setbox#1\vbox to \scratchdimen{\vfill\box#1\removedepth}}%
+ \dp#1\strutdp
+ \else
+ \egroup
+ \ht#1\scratchdimen
+ \dp#1\strutdp
+ \fi}}
+
+%D New:
+
+\let\checkgridsnapping\relax
+
+\protect \endinput
diff --git a/tex/context/base/core-grd.mkiv b/tex/context/base/core-grd.mkiv
new file mode 100644
index 000000000..d6cc93735
--- /dev/null
+++ b/tex/context/base/core-grd.mkiv
@@ -0,0 +1,1074 @@
+%D \module
+%D [ file=core-grd,
+%D version=1998.03.10,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Grid Snapping (Experimental),
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Core Macros / Grid Snapping}
+
+\unprotect
+
+%D Moved from supp-box:
+
+%D \macros
+%D {startbaselinecorrection,baselinecorrection,
+%D showbaselinecorrection,offbaselinecorrection}
+%D
+%D Spacing around ruled boxes can get pretty messed up. The
+%D next macro tries as good as possible to fix this.
+%D
+%D \startbuffer[1]
+%D \startbaselinecorrection
+%D \ruledhbox{Rule Brittanica}
+%D \stopbaselinecorrection
+%D \stopbuffer
+%D
+%D \typebuffer[1]
+%D
+%D The macros put some white space around the box:
+%D
+%D \getbuffer[1]
+%D
+%D A simple alternative is \type {\baselinecorrection}, which
+%D only looks at the previous line.
+%D
+%D \startbuffer[2]
+%D \baselinecorrection
+%D \ruledhbox{Rule Brittanica}
+%D \baselinecorrection
+%D \stopbuffer
+%D
+%D \typebuffer[2]
+%D
+%D This time the last preceding line gets a correction,%
+%D dependant on the depth.
+%D
+%D \getbuffer[2]
+%D
+%D One can make the correction visible by saying \type
+%D {\showbaselinecorrection}. Part of the correction is
+%D calculated from the dimensions of a~(. One can disble the
+%D correction by calling \type {\offbaselinecorrection}.
+%D
+%D When visualize the first example looks like:
+%D
+%D {\showbaselinecorrection\getbuffer[1]}
+%D
+%D and the second one comes out as:
+%D
+%D {\showbaselinecorrection\getbuffer[2]}
+
+% \definecolor[GridLineColor][red]
+% \definecolor[GridTextColor][blue]
+
+\let\thetopbaselinecorrection \!!zeropoint
+\let\thebotbaselinecorrection \!!zeropoint
+\let\thenegtopbaselinecorrection\!!zeropoint
+\let\thenegbotbaselinecorrection\!!zeropoint
+
+\definepalet
+ [grid]
+ [ one=red,
+ two=green,
+ three=blue,
+ four=gray]
+
+\def\setbaselinecorrections
+ {\setbox0\hbox{\setstrut\strut}%
+ \setbox2\hbox{(}%
+ \dimen0\ht0\advance\dimen0 -\ht2
+ \ifdim\dimen0<\zeropoint\dimen0\zeropoint\fi
+ \dimen2\dp0\advance\dimen2 -\dp2
+ \ifdim\dimen2<\zeropoint\dimen2\zeropoint\fi
+ \edef\thetopbaselinecorrection {\the\dimen0}\dimen0-\dimen0
+ \edef\thebotbaselinecorrection {\the\dimen2}\dimen2-\dimen2
+ \edef\thenegtopbaselinecorrection{\the\dimen0}%
+ \edef\thenegbotbaselinecorrection{\the\dimen2}}
+
+\def\dotopbaselinecorrection {\kern\thetopbaselinecorrection}
+\def\dobotbaselinecorrection {\kern\thebotbaselinecorrection}
+\def\donegtopbaselinecorrection{\kern\thenegtopbaselinecorrection}
+\def\donegbotbaselinecorrection{\kern\thenegbotbaselinecorrection}
+
+\def\showbaselinecorrection
+ {\def\dobaselinecorrection % visualization is not watertight!
+ {\bgroup
+\ifdim\prevdepth>\zeropoint\kern-\prevdepth\fi
+ \setbox0\null
+ \wd0\hsize
+ \dp0\strutdp
+ \nointerlineskip
+ \forgetall
+ \ruledvbox{\box0}%
+ \egroup
+ \prevdepth\strutdp}%
+ \def\dotopbaselinecorrection
+ {\hrule\!!height\thetopbaselinecorrection}%
+ \def\dobotbaselinecorrection
+ {\hrule\!!height\thebotbaselinecorrection}}
+
+\def\dobaselinecorrection
+ {\ifdim\prevdepth>\zeropoint\kern-\prevdepth\fi
+ \kern\strutdp
+ \prevdepth\strutdp}
+
+% \def\baselinecorrection
+% {\endgraf
+% \ifvmode
+% \ifdim\prevdepth<\maxdimen
+% \ifdim\prevdepth<\zeropoint \else
+% \ifdim\prevdepth<\strutdp
+% \dobaselinecorrection
+% \fi
+% \fi
+% \fi
+% \fi}
+
+\def\baselinecorrection
+ {\endgraf
+ \ifvmode
+ \ifdim\prevdepth<\maxdimen
+ \ifdim\prevdepth<\zeropoint \else
+ \ifdim\prevdepth<\strutdepth \relax
+ \pushlastnode
+ \dobaselinecorrection
+ \poplastnode
+ \fi
+ \fi
+ \fi
+ \fi}
+
+\def\pagebaselinecorrection
+ {\ifdim\pagegoal<\maxdimen
+ \ifdim\pagetotal>\lineheight % or \topskip
+ \scratchdimen\pagetotal
+ \advance\scratchdimen\lineheight
+ \ifdim\scratchdimen<\pagegoal
+ \baselinecorrection
+ \fi
+ \fi
+ \fi}
+
+% Beware, keep this one as it is, see for instance module
+% m-steps.tex, where we apply a \localhsize to the \vbox, in
+% order to follow narrower and side floats !
+
+% \def\startbaselinecorrection
+% {\baselinecorrection
+% \ifvmode
+% \bgroup
+% \setbox\scratchbox\vbox\bgroup
+% \ignorespaces
+% \let\stopbaselinecorrection\dostopbaselinecorrection
+% \else
+% \let\stopbaselinecorrection\relax
+% \fi}
+
+% \def\dostopbaselinecorrection % I have to check columns yet.
+% {\endgraf
+% \egroup
+% \topbaselinecorrection
+% \box\scratchbox
+% \botbaselinecorrection
+% \egroup}
+
+% \let\stopbaselinecorrection=\relax
+
+\def\startbaselinecorrection
+ {\bgroup
+ \let\stopbaselinecorrection\egroup
+ \ifcase\baselinecorrectionmode
+ \or % normal
+ \baselinecorrection
+ \ifvmode
+ \setbox\scratchbox\vbox\bgroup\ignorespaces
+ \let\stopbaselinecorrection\donormalstopbaselinecorrection
+ \fi
+ \or % off
+ \or % force
+ \baselinecorrection
+ \ifvmode
+ \setbox\scratchbox\vbox\bgroup\ignorespaces
+ \let\stopbaselinecorrection\doforcedstopbaselinecorrection
+ \fi
+ \fi}
+
+\let\stopbaselinecorrection\relax
+
+\def\donormalstopbaselinecorrection % I have to check columns yet.
+ {\egroup
+ \topbaselinecorrection
+ \box\scratchbox
+ \botbaselinecorrection
+ \egroup}
+
+\def\doforcedstopbaselinecorrection % I have to check columns yet.
+ {\egroup
+ \forcedtopbaselinecorrection
+ \box\scratchbox
+ \forcedbotbaselinecorrection
+ \egroup}
+
+%D We do a bit more checking than needed. The pageborder check
+%D is not needed, but I want to look the visualization as good
+%D as possible too.
+
+% \def\offbaselinecorrection % Can be used inside correction.
+% {\def\startbaselinecorrection{\bgroup\let\stopbaselinecorrection\egroup}}
+
+\chardef\baselinecorrectionmode\plusone
+
+\def\onbaselinecorrection {\chardef\baselinecorrectionmode\plusone }
+\def\offbaselinecorrection {\chardef\baselinecorrectionmode\plustwo }
+\def\forcebaselinecorrection{\chardef\baselinecorrectionmode\plusthree}
+
+%D \macros
+%D {topbaselinecorrection,botbaselinecorrection}
+%D
+%D The actual top and bottom corrections are implemented as:
+
+% \def\topbaselinecorrection
+% {\ifvmode \ifdim\pagegoal<\maxdimen
+% \bgroup
+% \setbaselinecorrections
+% \whitespace
+% \nointerlineskip
+% \dotopbaselinecorrection
+% \egroup
+% \fi \fi}
+
+
+\def\topbaselinecorrection
+ {\ifvmode \ifdim\pagegoal<\maxdimen
+ \forcedtopbaselinecorrection
+ \fi \fi}
+
+\def\forcedtopbaselinecorrection
+ {\ifvmode
+ \bgroup
+ \setbaselinecorrections
+ \whitespace
+ \nointerlineskip
+ \dotopbaselinecorrection
+ \egroup
+ \fi}
+
+\def\botbaselinecorrection
+ {\ifvmode
+ \bgroup
+ \setbaselinecorrections
+ \dobotbaselinecorrection
+ \allowbreak % new, otherwise problems when many in a row
+ \prevdepth\strutdp
+ \egroup
+ \fi}
+
+\let\forcedbotbaselinecorrection\botbaselinecorrection
+
+%D Still very experimental and therefore undocumented.
+
+\newif\ifgridsnapping % UNDER DEVELOPMENT, USE WITH CARE
+\newif\ifforcepresnap \forcepresnaptrue % false in mixed single/double
+\newif\ifstrutsnapping \strutsnappingtrue % sometimes handy to be false
+
+\def\positiveextrasnap {\gdef\extrasnapsign{+}}
+\def\negativeextrasnap {\gdef\extrasnapsign{-}}
+
+\def\extrasnapreset {\global\chardef\@@extrasnap0
+ \positiveextrasnap}
+\def\extrasnapbefore {\global\chardef\@@extrasnap1 }
+\def\extrasnaparound {\global\chardef\@@extrasnap2 }
+\def\extrasnapafter {\global\chardef\@@extrasnap3 }
+
+\def\enablepresnapcorrection {\global\chardef\@@presnap\zerocount}
+\def\disablepresnapcorrection {\global\chardef\@@presnap\plusone}
+
+\extrasnapreset \enablepresnapcorrection
+
+\newif\iftracegridsnapping
+\newif\ifshowgridboxes
+\newif\ifshowfuzzyskips
+
+\let\showgridboxes\showgridboxestrue
+
+\def\showgridsnapping
+ {\tracegridsnappingtrue
+ \showgridboxestrue}
+
+\chardef\@@alignsnap =0
+\chardef\@@alignsnapbox =0
+\chardef\@@alignsnapmethod=0
+
+\let\presnapskip \!!zeropoint \def\presnap {-}
+\let\postsnapskip\!!zeropoint \let\postsnap\presnap
+
+\newcount\currentgridsnap
+
+\def\tracedsnapping
+ {\iftracegridsnapping
+ \llap
+ {\setlayoutcomponentattribute\v!grid\v!test
+ \hbox \layoutcomponentboxattribute
+ {\infofont
+ \global\advance\currentgridsnap\plusone
+ \color[grid:three]
+ {\vl\presnapskip
+ \vl\presnap
+ \vl\postsnap
+ \ifcase\@@alignsnapbox\relax\vl\ifcase\@@extrasnap00\or\extrasnapsign0\or\extrasnapsign\extrasnapsign\or0\extrasnapsign\fi\fi
+ \vl\the\currentgridsnap\vl}}}%
+ \fi}
+
+\def\snaptogrid% [#1]#2 -> #2 == \hbox|\vbox
+ {\dosingleempty\dosnaptogrid}
+
+% \def\dosnaptogrid[#1]%
+% {\ifgridsnapping
+% \iffirstargument\doifsomething{#1}{\verplaatsopgrid[#1]}\fi
+% \expandafter\dodosnaptogrid
+% \fi}
+
+% \def\dosnaptogrid[#1]%
+% {\resetlastlinewidth % maybe in more places, otherwise spacing gets messed up
+% \ifgridsnapping
+% \iffirstargument\doifsomething{#1}{\moveongrid[#1]}\fi
+% \expandafter\dodosnaptogrid
+% \fi}
+
+\def\dosnaptogrid[#1]%
+ {\resetlastlinewidth % maybe in more places, otherwise spacing gets messed up
+ \doifinsetelse\v!force{#1}%
+ {\moveongrid[#1]%
+ \dodosnaptogrid}
+ {\ifgridsnapping
+ \doifsomething{#1}{\moveongrid[#1]}%
+ \expandafter\dodosnaptogrid
+ \fi}}
+
+% \def\forcedpresnapcorrection % test this on 'details'
+% {\ifforcepresnap
+% \ifvmode \else \par \fi % new
+% % we don't want top of page space when 'top' option
+% %\verticalstrut\nobreak\vskip-\struttotal
+% %\verticalstrut\vskip-\struttotal
+% % nobreak really needed
+% \allowbreak\verticalstrut\nobreak\vskip-\struttotal
+% %\ifdim\pagetotal>\topskip \else
+% % eigenlijk signal
+% %\writestatus{grid}{removing dummy at top of page}%
+% %\bgroup
+% %\output{\setbox\scratchbox\box255}%
+% %\penalty\outputpenalty
+% %\egroup
+% %\fi
+% \fi}
+
+\def\forcedpresnapcorrection % test this on 'details'
+ {\ifforcepresnap
+ \ifvmode \else \par \fi % new
+ % we don't want top of page space when 'top' option
+ % \verticalstrut\nobreak\vskip-\struttotal
+ % \verticalstrut\vskip-\struttotal
+ % \nobreak really needed
+ % \dosomebreak\allowbreak % no: spoils heads, so only under know situation, not in snapper
+ \verticalstrut
+ \nobreak
+ \vskip-\struttotal
+ %\ifdim\pagetotal>\topskip \else
+ % eigenlijk signal
+ %\writestatus{grid}{removing dummy at top of page}%
+ %\bgroup
+ %\output{\setbox\scratchbox\box255}%
+ %\penalty\outputpenalty
+ %\egroup
+ %\fi
+ \fi}
+
+\def\setgridtracebox#1[#2]% % maybe reverse the order
+ {\setbox\nextbox#1%
+ {\hbox
+ {\hbox to \zeropoint
+ {\setlayoutcomponentattribute\v!grid\v!test
+ \color[grid:#2]{\ruledhbox \layoutcomponentboxattribute {\fakebox\nextbox}}%
+ \hss}%
+ \flushnextbox}}}
+
+\newif\ifboxedsnapping \boxedsnappingtrue
+
+\chardef\depthsnapmethod \plusone % downward compatible, minus one line
+\chardef\heightsnapmethod\plusone % downward compatible, minus one line
+
+\def\dodosnaptogrid
+ {\dowithnextbox
+ {\bgroup
+ \ifcase\@@alignsnapmethod \or
+ % we're dealing with text with a possible big depth/height
+ \chardef\depthsnapmethod \plustwo
+ \chardef\heightsnapmethod\plustwo
+ \fi
+ \ifdim\nextboxht<\textheight % handle special case (like page fig)
+ \ifcase\@@alignsnapbox\relax
+ \ifcase\@@alignsnap\else % 1=top 2=high 3=middle 4=low
+ \ifshowgridboxes
+ \setgridtracebox\hbox[two]%
+ \fi
+ %\getnoflines{\nextboxht}%
+ \getnoflines\nextboxht
+ \setbox\nextbox\vbox to \noflines\lineheight
+ {\ifnum\@@alignsnap=1 \kern\lineheight\kern-\topskip\fi
+ \ifnum\@@alignsnap>2 \vfill\fi
+ \flushnextbox
+ \ifnum\@@alignsnap<4 \vfill\fi}%
+ \fi
+ \ifshowgridboxes
+ \setgridtracebox\hbox[three]%
+ \fi
+ \forgetall
+ \par
+ \ifvbox\nextbox
+ \setbox\nextbox\hbox{\flushnextbox}% don't ask
+ \fi
+ \scratchskip\lastskip
+ \edef\presnapskip{\the\lastskip}%
+ % mixing single/double columns sometimes goes wrong,
+ % check 'som' document
+ \ifinsidecolumns
+ \forcepresnaptrue
+ \fi
+ \forcedpresnapcorrection
+ \ifdim\nextboxht>\strutht
+ \scratchdimen\nextboxht
+ \ifcase\@@presnap\relax
+ \ifdim\scratchskip>\zeropoint\relax
+ \scratchcounter\scratchskip
+ \advance\scratchcounter -\openlineheight
+ \ifnum\scratchcounter<0
+ \scratchcounter-\scratchcounter
+ \fi
+ \ifnum\scratchcounter<10 % \lastkip is about \openlineheight
+ \advance\scratchdimen -\openstrutdepth
+ \edef\presnapskip{*\presnapskip}%
+ \else\ifdim\scratchskip>\openlineheight
+ %<\openlineheight \else
+ \advance\scratchdimen -\openstrutdepth
+ \edef\presnapskip{*\presnapskip}%
+ \fi\fi
+ \fi
+ \fi
+ % \getnoflines\scratchdimen % maybe raw ?
+ % \advance\noflines -1
+ \ifcase\heightsnapmethod
+ % raw
+ \or
+ \advance\scratchdimen-\lineheight % tight (default)
+ \or
+ \advance\scratchdimen-\strutheight % fit (text)
+ \or
+ \advance\scratchdimen-\strutheight % tolerant
+ \advance\scratchdimen-\roundingeps
+ \fi
+ \getnoflines\scratchdimen
+ \ifnum\noflines>0
+ \scratchdimen\noflines\lineheight
+ \else
+ \scratchdimen\zeropoint
+ \fi
+ \else
+ \scratchdimen\zeropoint
+ \fi
+ \ifnum\@@extrasnap=1 \advance\scratchdimen \extrasnapsign \lineheight \fi
+ \ifnum\@@extrasnap=2 \advance\scratchdimen \extrasnapsign.5\lineheight \fi
+ \edef\presnap{\the\scratchdimen}%
+ \ifstrutsnapping
+ \ifboxedsnapping
+ \getrawnoflines\scratchdimen
+ \advance\scratchdimen-\noflines\lineheight
+ \vskip\scratchdimen % disappears at top of page
+ \dorecurse\noflines{\verticalstrut\nobreak}%
+ \else \ifdim\scratchdimen=\zeropoint
+ % nothing to skip
+ \else % disappears at top of page
+ \vskip\scratchdimen
+ \fi \fi
+ \fi
+ \ifdim\nextboxdp>\strutdp
+ % \getnoflines\nextboxdp
+ % \advance\noflines \minusone
+ \scratchdimen\nextboxdp\relax
+ \ifcase\depthsnapmethod
+ % raw
+ \or
+ \advance\scratchdimen-\lineheight % tight (default)
+ \or
+ \advance\scratchdimen-\strutdepth % fit (text)
+ \or
+ \advance\scratchdimen-\strutdepth % tolerant
+ \advance\scratchdimen-\roundingeps
+ \fi
+ \getnoflines\scratchdimen
+ \ifnum\noflines>0
+ \scratchdimen\noflines\lineheight
+ \else
+ \scratchdimen\zeropoint
+ \fi
+ \else
+ \scratchdimen\zeropoint
+ \fi
+ \ifnum\@@extrasnap=2 \advance\scratchdimen \extrasnapsign.5\lineheight \fi
+ \ifnum\@@extrasnap=3 \advance\scratchdimen \extrasnapsign \lineheight \fi
+ \edef\postsnap{\the\scratchdimen}%
+ \ifstrutsnapping
+ \nextboxht\strutht
+ \nextboxdp\strutdp
+ \else
+ \scratchdimen\presnap
+ \advance\scratchdimen \strutht
+ \nextboxht\scratchdimen
+ \scratchdimen\postsnap
+ \advance\scratchdimen \strutdp
+ \nextboxdp\scratchdimen
+ \fi
+ \hbox{\tracedsnapping\flushnextbox}%
+ \ifstrutsnapping
+ \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi
+ \fi
+ \else
+ \scratchdimen\nextboxht\relax
+ \ifcase\@@alignsnapbox
+ % can't happen here
+ \or
+ \getrawnoflines\scratchdimen
+ \else
+ \getnoflines \scratchdimen
+ \fi
+ \scratchdimen\noflines\lineheight\relax
+ \advance\scratchdimen-\strutdepth
+ % spoils the whole game (fit/broad/line)
+ % \ifnum\pagetotal>\zeropoint \else % disable this as option
+ % \advance\scratchdimen-\strutheight
+ % \advance\scratchdimen+\topskip
+ % \fi
+ \dimen0=\scratchdimen
+ \dimen2=\strutdepth
+ \ifshowgridboxes
+ \setgridtracebox\hbox[two]%
+ \fi
+ \nextboxdp\strutdp
+ \dimen4=\nextboxht
+ \dimen6=\nextboxdp
+ \iftracegridsnapping
+ \setbox\scratchbox\hbox
+ {\scratchdimen\@@alignsnapamount\relax
+ \ifdim\scratchdimen<\zeropoint
+ \tracedgridamount\zeropoint{-\scratchdimen}%
+ \else
+ \tracedgridamount\scratchdimen\zeropoint
+ \fi}%
+ \smashbox\scratchbox
+ \setbox\nextbox\hbox{\box\scratchbox\flushnextbox}%
+ \fi
+ \setbox\nextbox\hbox
+ {\scratchdimen\@@alignsnapamount\relax
+ \ifcase\@@alignsnapdepth\or
+ % don't change this ever !
+ \ifdim\dimen0<\lineheight
+ % otherwise it is ok, but ending up inside
+ % the next paragraph is seldom what we want,
+ % so we move one line up
+ \advance\scratchdimen-\lineheight
+ \advance\scratchdimen\strutheight
+ \else
+ % otherwise we can move down to the
+ % baseline
+ \advance\scratchdimen\dimen6 % == \strutdepth
+ \fi
+ \fi
+ \lower\scratchdimen\flushnextbox}%
+ \nextboxht\dimen4
+ \nextboxdp\dimen6
+ \ifnum\@@alignsnap<4 % 4 = regel
+ \setbox\nextbox\vbox to \scratchdimen
+ {\forgetall
+ \ifnum\@@alignsnap>2 \vfill\fi % 3 4
+ \flushnextbox
+ \nointerlineskip % \offinterlineskip
+ \ifnum\@@alignsnap<4 \vfill\fi % 2 3
+ \kern\zeropoint}%
+ \fi
+ \ifshowgridboxes
+ \setgridtracebox\vbox[three]%
+ \fi
+ \scratchdimen\@@alignsnapamount
+ \edef\presnapskip{\the\scratchdimen}%
+ \ifnum\@@alignsnap>2 \def\presnap {+}\fi
+ \ifnum\@@alignsnap<4 \def\postsnap{+}\fi
+ \setbox\nextbox\hbox{\tracedsnapping\flushnextbox}%
+ \par
+ \nextboxht\dimen0
+ \nextboxdp\dimen2
+ \forcedpresnapcorrection
+ \nointerlineskip
+ \flushnextbox
+ \fi
+ \else
+ \setbox\nextbox\vbox to \textheight
+ {\ifdim\nextboxdp=\zeropoint
+ \hbox{\lower\strutdepth\flushnextbox}
+ \else % this branch is yet untested
+ \vss
+ \hbox{\lower\nextboxdp\flushnextbox}
+ \vskip-\strutdepth
+ \fi}%
+ \nextboxdp\strutdepth
+ \flushnextbox
+ \fi
+ \extrasnapreset
+ \enablepresnapcorrection
+ \global\chardef\@@alignsnap\zerocount
+ \global\chardef\@@alignsnapbox\zerocount
+ \egroup}}
+
+\def\tracedgridamount#1#2%
+ {\startcolor[grid:four]%
+ \setlayoutcomponentattribute\v!grid\v!test
+ \hbox \layoutcomponentboxattribute{\vrule\!!width\nextboxwd\!!height#1\!!depth#2}%
+ \stopcolor}
+
+\def\snaptomathgrid % probably not working ok, also kind of obsolete
+ {\ifgridsnapping
+ \dowithnextbox
+ {\blank[\v!line]\snaptogrid\vbox{\flushnextbox}\blank[\v!line]}
+ \vbox\bgroup
+ \forgetdisplayskips
+ \@EA\let\@EA\next
+ \fi}
+
+\def\topsnaptogrid
+ {\ifgridsnapping
+ \dowithnextbox
+ {\scratchdimen\nextboxht
+ \advance\scratchdimen -\strutht
+ \advance\scratchdimen \topskip
+ \nextboxht\scratchdimen
+ \nextboxdp\zeropoint
+ \flushnextbox
+ \kern\lineheight
+ \kern-\topskip
+ \nointerlineskip}
+ \hbox
+ \fi}
+
+% \def\centertogrid % meant for special situations
+% {\ifgridsnapping
+% \dowithnextboxcontent
+% {\ignorespaces}
+% {\bgroup
+% \par
+% \scratchdimen\nextboxht
+% \advance\scratchdimen \nextboxdp
+% \getnoflines\scratchdimen
+% \setbox\nextbox\vbox to \noflines\lineheight
+% {\forgetall
+% \vskip\zeropoint \!!plus \nextboxht
+% \copy\nextbox
+% \kern.5\strutdp % VOORLOPIGE WAARDE
+% \vskip\zeropoint \!!plus \nextboxdp}%
+% \noindent\snaptogrid\vbox{\flushnextbox}%
+% \egroup}
+% \vbox % was \hbox
+% \fi}
+
+% The next implementation is sub-optimal
+%
+% \def\centertogrid % usage: see ie pascal / stepcharts
+% {\snaptogrid[\v!midden,.5\strutdp]\vbox}
+
+\def\centertogrid % meant for special situations
+ {\ifgridsnapping
+ \dowithnextboxcontent
+ {\ignorespaces}
+ {\bgroup
+ \par
+ \scratchdimen\nextboxht
+ \advance\scratchdimen \nextboxdp
+ \getnoflines\scratchdimen
+ \setbox\nextbox\vbox to \noflines\lineheight
+ {\forgetall
+ \vss
+ \topbaselinecorrection
+ \copy\nextbox
+ \botbaselinecorrection
+ \vss}%
+ \setbox\nextbox\hbox{\lower\strutdp\flushnextbox}%
+ \forgeteverypar % new per 3/4/2008, prevents duplicate pos nodes resulting in extra whitespace
+ \noindent\snaptogrid\vbox{\flushnextbox}%
+ \egroup}
+ \vbox % was \hbox
+ \fi}
+
+% testbed for \centertogrid
+%
+% \strut Bruggetje
+% \startlinecorrection
+% \startcombination
+% {\framed{test}} {} {\framed{test}} {}
+% \stopcombination
+% \stoplinecorrection
+% \strut Bruggetje
+% \startlinecorrection
+% \startcombination[2*2]
+% {\framed{test}} {} {\framed{test}} {}
+% {\framed{test}} {} {\framed{test}} {}
+% \stopcombination
+% \stoplinecorrection
+% \strut Bruggetje
+% \startlinecorrection[blank]
+% \startcombination
+% {\framed{test}} {} {\framed{test}} {}
+% \stopcombination
+% \stoplinecorrection
+% \strut Bruggetje
+% \startlinecorrection[blank]
+% \startcombination[2*2]
+% {\framed{test}} {} {\framed{test}} {}
+% {\framed{test}} {} {\framed{test}} {}
+% \stopcombination
+% \stoplinecorrection
+% \strut Bruggetje
+% \startlinecorrection
+% \startcombination
+% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
+% \stopcombination
+% \stoplinecorrection
+% \strut Bruggetje
+% \startlinecorrection
+% \startcombination[2*2]
+% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
+% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
+% \stopcombination
+% \stoplinecorrection
+% \strut Bruggetje
+% \startlinecorrection[blank]
+% \startcombination
+% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
+% \stopcombination
+% \stoplinecorrection
+% \strut Bruggetje
+% \startlinecorrection[blank]
+% \startcombination[2*2]
+% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
+% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
+% \stopcombination
+% \stoplinecorrection
+
+\ifx\startbaselinecorrection\undefined \wait \fi % change order
+
+\let\normalstartbaselinecorrection=\startbaselinecorrection
+
+\def\startbaselinecorrection
+ {\ifgridsnapping
+ \centertogrid\bgroup
+ \let\stopbaselinecorrection\egroup
+ \else
+ \normalstartbaselinecorrection
+ \fi}
+
+\chardef\gridboxlinenomode\plusone
+\chardef\gridboxlinemode \plusone % 0:nothing 1:all 2:lines 3:frame
+
+\def\gridboxvbox {\ifcase\gridboxlinemode\vbox\or\ruledvbox\or\vbox\or\ruledvbox\else\ruledvbox\fi}
+\def\gridboxwidth{\ifcase\gridboxlinemode0\or.5\or.5\or0\else.5\fi\testrulewidth}
+
+\def\setgridbox#1#2#3%
+ {\setbox#1\gridboxvbox to #3 % given size
+ {\forgetall
+ \resetteststrut
+ \offinterlineskip
+ \hsize#2%
+ \baselinerulefalse
+ \gridboxvbox % calculated size
+ {\getrawnoflines{#3}% \getnoflines{#3}%
+ \vskip\topskip
+ \vskip-\strutht
+ \scratchdimen#2\advance\scratchdimen \lineheight
+ \dorecurse\noflines
+ {\strut
+ \hskip-.5\lineheight
+ \ifcase\gridboxlinenomode\or
+ \rlap
+ {\hskip.2\bodyfontsize\hskip\scratchdimen
+ \infofont\hbox to 1em{\hss\recurselevel}}%
+ \or
+ \llap
+ {\infofont\hbox to 1em{\hss\recurselevel}%
+ \hskip.2\bodyfontsize}%
+ \fi
+ \vrule
+ \!!height \gridboxwidth
+ \!!depth \gridboxwidth
+ \!!width \scratchdimen
+ \par}}
+ \vfill}}
+
+%D Some intervention macros:
+
+\def\gridwarning#1{\message{[beware of #1 extra snap]}}
+
+\global\let\@@alignsnapamount\!!zeropoint
+\global\chardef\@@alignsnapdepth0
+
+\def\@@unknowngriddisplacement
+ {\global\chardef\@@alignsnapbox\plusthree
+ \global\let\@@alignsnapamount\commalistelement}
+
+\def\domoveongrid[#1]%
+ {\ifgridsnapping\doifsomething{#1}{\dodomoveongrid[#1]}\fi}
+
+\def\dodomoveongrid[#1]% some day : speed up
+ {\global\chardef\@@alignsnap\zerocount
+ \global\chardef\@@alignsnapbox\zerocount
+ \global\chardef\@@alignsnapdepth\zerocount
+ \global\chardef\@@alignsnapmethod\zerocount
+ \global\let\@@alignsnapamount\!!zeropoint
+ \donefalse
+ \expanded{\processallactionsinset[#1]}
+ [\v!standard=>,
+ \v!normal=>, % to be sure
+ \v!yes=>, % to be sure
+ \v!top=>\gridwarning+\positiveextrasnap\extrasnapbefore,
+ \v!bottom=>\gridwarning+\positiveextrasnap\extrasnapafter,
+ \v!both=>\positiveextrasnap\extrasnaparound,
+ -\v!top=>\gridwarning-\negativeextrasnap\extrasnapbefore,
+ -\v!bottom=>\gridwarning-\negativeextrasnap\extrasnapafter,
+ -\v!both=>\negativeextrasnap\extrasnaparound,
+ \v!text=>\global\chardef\@@alignsnapmethod\plusone, % accurate calculations
+ \v!page=>\global\chardef\@@alignsnap\plusone, % topskip
+ \v!high=>\global\chardef\@@alignsnap\plustwo,
+ \v!middle=>\global\chardef\@@alignsnap\plusthree,
+ \v!low=>\global\chardef\@@alignsnap\plusfour,
+ \v!fit=>\global\chardef\@@alignsnapbox\plusone, % new
+ \v!broad=>\global\chardef\@@alignsnapbox\plustwo, % new
+ \v!depth=>\global\chardef\@@alignsnapdepth\plusone, % new
+ \v!line=>\global\chardef\@@alignsnapbox\plusthree
+% \global\chardef\@@alignsnapdepth\plusone
+ \global\chardef\@@alignsnap\plusfour,
+ \v!reset=>\positiveextrasnap\extrasnapreset,
+ \v!none=>\global\chardef\@@alignsnap\zerocount
+ \global\chardef\@@alignsnapbox\zerocount,
+ \v!force=>, % turns on grid snapping even when not on
+ \s!default=>,
+ \s!unknown=>\@@unknowngriddisplacement]}
+
+\def\moveongrid
+ {\dosingleempty\domoveongrid}
+
+\def\doplaceongrid[#1]%
+ {\domoveongrid[#1]\snaptogrid\vbox}
+
+\def\placeongrid
+ {\dosingleempty\doplaceongrid}
+
+%D Snapping is rather robust as long as we use whole lines.
+%D Half lines of white space can however be handled when they
+%D come in pairs. The corrections needed when crossing page
+%D boundaries in the middle of such a pair, are handled by
+%D macros that are (named) sort of fuzzy. This fuzzy mechanism
+%D was written as an extension to the grid typesetting needed
+%D for typesetting (part of) the \MAPS.
+%D
+%D \starttyping
+%D \setuptyping
+%D [before={\blank[halfline]},
+%D after={\blank[halfline]}]
+%D \stoptyping
+
+\newif \iffuzzyvskip
+\newif \iffuzzysnapdone
+\newif \iffuzzysnapping
+\newif \iffuzzysnapped
+\chardef \fuzzysnappedleft=0 % ==1 when fuzzybegin still open
+\newpersistentmark\fuzzymark % (!)
+\newcount \fuzzymarker
+\newbox \fuzzysnapbox
+\newbox \fuzzysnapsplit
+
+\def\dosyncfuzzyvskip
+ {\ifvmode\ifdim\lastskip<\lineheight\ifdim\lastskip>\zeropoint
+ \bgroup % - added 28/2/2003: check this, there was no -
+ \endgraf\forgetall\verticalstrut\nobreak\vskip-\struttotal
+ \egroup
+ \fi\fi\fi}
+
+\def\fuzzyvskip#1%
+ {\iffuzzysnapdone
+ \dosyncfuzzyvskip % NEWER
+ \endfuzzysnapping
+ \vskip#1\relax
+ \global\fuzzysnapdonefalse
+ \else
+ \vskip#1\relax
+ \beginfuzzysnapping
+ \global\fuzzysnapdonetrue
+ \fi}
+
+\def\setfuzzymark#1#2#3% #1/#2 => error recovery
+ {\ifgridsnapping
+ \global\fuzzysnappingtrue
+ \global\advance\fuzzymarker \ifodd\fuzzymarker#1\else#2\fi
+ \nobreak
+ \ifshowfuzzyskips
+ \hbox{\color[grid:three]
+ {\llap{\infofont#3\vl\the\fuzzymarker}\nobreak
+ \vrule\!!width\hsize\!!height.1\lineheight}}
+ \nobreak
+ \fi
+ %[\the\fuzzymarker]
+ %\expandafter\fuzzymark\expandafter{\the\fuzzymarker}%
+ \expandafter\rawsetmark\expandafter\fuzzymark\expandafter{\the\fuzzymarker}%
+ \nobreak
+ \fi}
+
+\def\beginfuzzysnapping{\setfuzzymark21\v!start} % odd
+\def\endfuzzysnapping {\setfuzzymark12\v!stop } % even
+
+\def\removelastfuzzyvskip
+ {\ifgridsnapping
+ \iffuzzysnapping
+ \ifdim\lastskip<\openlineheight
+ \else
+ \removelastskip
+ \fi
+ \else
+ \removelastskip
+ \fi
+ \else
+ \removelastskip
+ \fi}
+
+\def\docheckfuzzysnap#1%
+ {\bgroup
+ \dontcomplain
+ \setbox\fuzzysnapbox\copy#1\relax
+ \setbox\fuzzysnapsplit\vsplit\fuzzysnapbox to 1\lineheight
+ \let\topfuzzymark\empty % indeed here ... no real mark
+ \getsplitmarks\fuzzymark
+% \ifcase0\topfuzzymark
+ \ifcase0\rawgetsplittopmark\fuzzymark
+ \global\chardef\fuzzysnappedleft\zerocount
+ \global\fuzzysnappedfalse
+% \else\ifodd\topfuzzymark
+ \else\ifodd\rawgetsplittopmark\fuzzymark
+ \global\chardef\fuzzysnappedleft\plusone
+ \global\fuzzysnappedtrue
+ \else
+ \global\chardef\fuzzysnappedleft=2
+ \global\fuzzysnappedtrue
+ \fi\fi
+ \iffuzzysnapped \else
+ \doloop
+ {\ifvoid\fuzzysnapbox
+ \exitloop
+ \else
+ \setbox\fuzzysnapsplit=\vsplit\fuzzysnapbox to \lineheight
+ %\let\topfuzzymark=\empty % ... but not here
+ \getsplitmarks\fuzzymark
+% \ifcase0\topfuzzymark
+ \ifcase0\rawgetsplittopmark\fuzzymark
+ % continue
+% \else\ifodd\topfuzzymark
+ \else\ifodd\rawgetsplittopmark\fuzzymark
+ \exitloop
+ \else
+ \global\chardef\fuzzysnappedleft\plusone
+ \global\fuzzysnappedtrue
+ \exitloop
+ \fi\fi
+ \fi}%
+ \fi
+ \egroup}
+
+\def\getfuzzysnapcorrection#1%
+ {\global\let\presnapcorrection \relax
+ \global\let\postsnapcorrection\relax
+ \ifgridsnapping\iffuzzysnapping
+ \docheckfuzzysnap{#1}%
+ \iffuzzysnapped
+ \iftracegridsnapping
+ \gdef\presnapcorrection
+ {\color[grid:four]{\hrule\!!height.5\openlineheight\!!width\hsize}}%
+ \else
+ \gdef\presnapcorrection{\kern.5\openlineheight}%
+ \fi
+ \gdef\postsnapcorrection{\kern-.5\openlineheight}% get the height ok
+ \fi
+ \fi\fi}
+
+\def\fuzzysnappedbox#1#2% \box \unvbox
+ {\getfuzzysnapcorrection{#2}%
+ \presnapcorrection
+ #1#2%
+ \postsnapcorrection}
+
+\def\adaptfuzzypagegoal
+ {\ifgridsnapping\iffuzzysnapping\ifcase\fuzzysnappedleft\or % see dopagecontents
+ \scratchdimen\pagegoal
+ \advance\scratchdimen -.5\openlineheight
+ \global\pagegoal\scratchdimen
+ \global\advance\vsize -.5\openlineheight
+ \global\chardef\fuzzysnappedleft0
+ \fi\fi\fi}
+
+%D New, experimental, used in caption snapping:
+%D
+%D \starttyping
+%D \startcolumnset
+%D
+%D \setupcaption[figure][style=\tfx\setupinterlinespace,inbetween=,grid=top]
+%D
+%D \placefigure [lrtb] {\dorecurse{5}{green gras}}
+%D {\externalfigure[dummy][width=\textwidth,height=3cm,grid=height]}
+%D \placefigure [lrtb] {\dorecurse{15}{green gras}}
+%D {\externalfigure[dummy][width=\textwidth,height=3cm,grid=height]}
+%D
+%D \setupcaption[figure][style=\tfx\setupinterlinespace,inbetween=,grid=bottom]
+%D
+%D \placefigure [rltb] {\dorecurse{5}{green gras}}
+%D {\externalfigure[dummy][width=\textwidth,height=3cm,grid=height]}
+%D \placefigure [rltb] {\dorecurse{15}{green gras}}
+%D {\externalfigure[dummy][width=\textwidth,height=3cm,grid=height]}
+%D
+%D \input thuan
+%D
+%D \stopcolumnset
+%D \stoptyping
+
+\def\moveboxontogrid#1#2#3% box method firstlineht % experimental ! ! !
+ {\doifsomething{#2}
+ {\getnoflines{\ht#1}% no depth taken into account, depth preserved
+ \scratchdimen\noflines\lineheight
+ \advance\scratchdimen-\strutdp
+ \bgroup
+ \advance\scratchdimen-\onepoint % be a bit tolerant
+ \ifdim\scratchdimen>\ht#1\relax
+ \egroup
+ \doif{#2}\v!top {\setbox#1\vbox to \scratchdimen{\vskip-#3\vskip\strutht\box#1\vfill}}%
+ \doif{#2}\v!bottom{\setbox#1\vbox to \scratchdimen{\vfill\box#1\removedepth}}%
+ \dp#1\strutdp
+ \else
+ \egroup
+ \ht#1\scratchdimen
+ \dp#1\strutdp
+ \fi}}
+
+%D New:
+
+\let\checkgridsnapping\relax
+
+\protect \endinput
diff --git a/tex/context/base/core-grd.tex b/tex/context/base/core-grd.tex
deleted file mode 100644
index 249e2e430..000000000
--- a/tex/context/base/core-grd.tex
+++ /dev/null
@@ -1,1074 +0,0 @@
-%D \module
-%D [ file=core-grd,
-%D version=1998.03.10,
-%D title=\CONTEXT\ Core Macros,
-%D subtitle=Grid Snapping (Experimental),
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Core Macros / Grid Snapping}
-
-\unprotect
-
-%D Moved from supp-box:
-
-%D \macros
-%D {startbaselinecorrection,baselinecorrection,
-%D showbaselinecorrection,offbaselinecorrection}
-%D
-%D Spacing around ruled boxes can get pretty messed up. The
-%D next macro tries as good as possible to fix this.
-%D
-%D \startbuffer[1]
-%D \startbaselinecorrection
-%D \ruledhbox{Rule Brittanica}
-%D \stopbaselinecorrection
-%D \stopbuffer
-%D
-%D \typebuffer[1]
-%D
-%D The macros put some white space around the box:
-%D
-%D \getbuffer[1]
-%D
-%D A simple alternative is \type {\baselinecorrection}, which
-%D only looks at the previous line.
-%D
-%D \startbuffer[2]
-%D \baselinecorrection
-%D \ruledhbox{Rule Brittanica}
-%D \baselinecorrection
-%D \stopbuffer
-%D
-%D \typebuffer[2]
-%D
-%D This time the last preceding line gets a correction,%
-%D dependant on the depth.
-%D
-%D \getbuffer[2]
-%D
-%D One can make the correction visible by saying \type
-%D {\showbaselinecorrection}. Part of the correction is
-%D calculated from the dimensions of a~(. One can disble the
-%D correction by calling \type {\offbaselinecorrection}.
-%D
-%D When visualize the first example looks like:
-%D
-%D {\showbaselinecorrection\getbuffer[1]}
-%D
-%D and the second one comes out as:
-%D
-%D {\showbaselinecorrection\getbuffer[2]}
-
-% \definecolor[GridLineColor][red]
-% \definecolor[GridTextColor][blue]
-
-\definepalet
- [grid]
- [ one=red,
- two=green,
- three=blue,
- four=gray]
-
-\def\setbaselinecorrections
- {\setbox0\hbox{\setstrut\strut}%
- \setbox2\hbox{(}%
- \dimen0\ht0\advance\dimen0 -\ht2
- \ifdim\dimen0<\zeropoint\dimen0\zeropoint\fi
- \dimen2\dp0\advance\dimen2 -\dp2
- \ifdim\dimen2<\zeropoint\dimen2\zeropoint\fi
- \edef\thetopbaselinecorrection {\the\dimen0}\dimen0-\dimen0
- \edef\thebotbaselinecorrection {\the\dimen2}\dimen2-\dimen2
- \edef\thenegtopbaselinecorrection{\the\dimen0}%
- \edef\thenegbotbaselinecorrection{\the\dimen2}}
-
-\def\dotopbaselinecorrection {\kern\thetopbaselinecorrection}
-\def\dobotbaselinecorrection {\kern\thebotbaselinecorrection}
-\def\donegtopbaselinecorrection{\kern\thenegtopbaselinecorrection}
-\def\donegbotbaselinecorrection{\kern\thenegbotbaselinecorrection}
-
-\def\showbaselinecorrection
- {\def\dobaselinecorrection % visualization is not watertight!
- {\bgroup
-\ifdim\prevdepth>\zeropoint\kern-\prevdepth\fi
- \setbox0\null
- \wd0\hsize
- \dp0\strutdp
- \nointerlineskip
- \forgetall
- \ruledvbox{\box0}%
- \egroup
- \prevdepth\strutdp}%
- \def\dotopbaselinecorrection
- {\hrule\!!height\thetopbaselinecorrection}%
- \def\dobotbaselinecorrection
- {\hrule\!!height\thebotbaselinecorrection}}
-
-\def\dobaselinecorrection
- {\ifdim\prevdepth>\zeropoint\kern-\prevdepth\fi
- \kern\strutdp
- \prevdepth\strutdp}
-
-% \def\baselinecorrection
-% {\endgraf
-% \ifvmode
-% \ifdim\prevdepth<\maxdimen
-% \ifdim\prevdepth<\zeropoint \else
-% \ifdim\prevdepth<\strutdp
-% \dobaselinecorrection
-% \fi
-% \fi
-% \fi
-% \fi}
-
-\def\baselinecorrection
- {\endgraf
- \ifvmode
- \ifdim\prevdepth<\maxdimen
- \ifdim\prevdepth<\zeropoint \else
- \ifdim\prevdepth<\strutdepth \relax
- \pushlastnode
- \dobaselinecorrection
- \poplastnode
- \fi
- \fi
- \fi
- \fi}
-
-\def\pagebaselinecorrection
- {\ifdim\pagegoal<\maxdimen
- \ifdim\pagetotal>\lineheight % or \topskip
- \scratchdimen\pagetotal
- \advance\scratchdimen\lineheight
- \ifdim\scratchdimen<\pagegoal
- \baselinecorrection
- \fi
- \fi
- \fi}
-
-% Beware, keep this one as it is, see for instance module
-% m-steps.tex, where we apply a \localhsize to the \vbox, in
-% order to follow narrower and side floats !
-
-% \def\startbaselinecorrection
-% {\baselinecorrection
-% \ifvmode
-% \bgroup
-% \setbox\scratchbox\vbox\bgroup
-% \ignorespaces
-% \let\stopbaselinecorrection\dostopbaselinecorrection
-% \else
-% \let\stopbaselinecorrection\relax
-% \fi}
-
-% \def\dostopbaselinecorrection % I have to check columns yet.
-% {\endgraf
-% \egroup
-% \topbaselinecorrection
-% \box\scratchbox
-% \botbaselinecorrection
-% \egroup}
-
-% \let\stopbaselinecorrection=\relax
-
-\def\startbaselinecorrection
- {\bgroup
- \let\stopbaselinecorrection\egroup
- \ifcase\baselinecorrectionmode
- \or % normal
- \baselinecorrection
- \ifvmode
- \setbox\scratchbox\vbox\bgroup\ignorespaces
- \let\stopbaselinecorrection\donormalstopbaselinecorrection
- \fi
- \or % off
- \or % force
- \baselinecorrection
- \ifvmode
- \setbox\scratchbox\vbox\bgroup\ignorespaces
- \let\stopbaselinecorrection\doforcedstopbaselinecorrection
- \fi
- \fi}
-
-\let\stopbaselinecorrection\relax
-
-\def\donormalstopbaselinecorrection % I have to check columns yet.
- {\egroup
- \topbaselinecorrection
- \box\scratchbox
- \botbaselinecorrection
- \egroup}
-
-\def\doforcedstopbaselinecorrection % I have to check columns yet.
- {\egroup
- \forcedtopbaselinecorrection
- \box\scratchbox
- \forcedbotbaselinecorrection
- \egroup}
-
-%D We do a bit more checking than needed. The pageborder check
-%D is not needed, but I want to look the visualization as good
-%D as possible too.
-
-% \def\offbaselinecorrection % Can be used inside correction.
-% {\def\startbaselinecorrection{\bgroup\let\stopbaselinecorrection\egroup}}
-
-\chardef\baselinecorrectionmode\plusone
-
-\def\onbaselinecorrection {\chardef\baselinecorrectionmode\plusone }
-\def\offbaselinecorrection {\chardef\baselinecorrectionmode\plustwo }
-\def\forcebaselinecorrection{\chardef\baselinecorrectionmode\plusthree}
-
-%D \macros
-%D {topbaselinecorrection,botbaselinecorrection}
-%D
-%D The actual top and bottom corrections are implemented as:
-
-% \def\topbaselinecorrection
-% {\ifvmode \ifdim\pagegoal<\maxdimen
-% \bgroup
-% \setbaselinecorrections
-% \whitespace
-% \nointerlineskip
-% \dotopbaselinecorrection
-% \egroup
-% \fi \fi}
-
-
-\def\topbaselinecorrection
- {\ifvmode \ifdim\pagegoal<\maxdimen
- \forcedtopbaselinecorrection
- \fi \fi}
-
-\def\forcedtopbaselinecorrection
- {\ifvmode
- \bgroup
- \setbaselinecorrections
- \whitespace
- \nointerlineskip
- \dotopbaselinecorrection
- \egroup
- \fi}
-
-\def\botbaselinecorrection
- {\ifvmode
- \bgroup
- \setbaselinecorrections
- \dobotbaselinecorrection
- \allowbreak % new, otherwise problems when many in a row
- \prevdepth\strutdp
- \egroup
- \fi}
-
-\let\forcedbotbaselinecorrection\botbaselinecorrection
-
-%D Still very experimental and therefore undocumented.
-
-\newif\ifgridsnapping % UNDER DEVELOPMENT, USE WITH CARE
-\newif\ifforcepresnap \forcepresnaptrue % false in mixed single/double
-\newif\ifstrutsnapping \strutsnappingtrue % sometimes handy to be false
-
-\def\positiveextrasnap {\gdef\extrasnapsign{+}}
-\def\negativeextrasnap {\gdef\extrasnapsign{-}}
-
-\def\extrasnapreset {\global\chardef\@@extrasnap0
- \positiveextrasnap}
-\def\extrasnapbefore {\global\chardef\@@extrasnap1 }
-\def\extrasnaparound {\global\chardef\@@extrasnap2 }
-\def\extrasnapafter {\global\chardef\@@extrasnap3 }
-
-\def\enablepresnapcorrection {\global\chardef\@@presnap\zerocount}
-\def\disablepresnapcorrection {\global\chardef\@@presnap\plusone}
-
-\extrasnapreset \enablepresnapcorrection
-
-\newif\iftracegridsnapping
-\newif\ifshowgridboxes
-\newif\ifshowfuzzyskips
-
-\let\showgridboxes\showgridboxestrue
-
-\def\showgridsnapping
- {\tracegridsnappingtrue
- \showgridboxestrue}
-
-\chardef\@@alignsnap =0
-\chardef\@@alignsnapbox =0
-\chardef\@@alignsnapmethod=0
-
-\let\presnapskip \!!zeropoint \def\presnap {-}
-\let\postsnapskip\!!zeropoint \let\postsnap\presnap
-
-\newcount\currentgridsnap
-
-\def\tracedsnapping
- {\iftracegridsnapping
- \llap
- {\startlayoutcomponent{gridsnaps}{grid snaps}%
- \infofont
- \global\advance\currentgridsnap\plusone
- \color[grid:three]{\vl\presnapskip
- \vl\presnap
- \vl\postsnap
- \ifcase\@@alignsnapbox\relax
- \vl\ifcase\@@extrasnap
- 00\or
- \extrasnapsign0\or
- \extrasnapsign\extrasnapsign\or
- 0\extrasnapsign\fi
- \fi
- \vl\the\currentgridsnap\vl}%
- \stoplayoutcomponent}%
- \fi}
-
-\def\snaptogrid% [#1]#2 -> #2 == \hbox|\vbox
- {\dosingleempty\dosnaptogrid}
-
-% \def\dosnaptogrid[#1]%
-% {\ifgridsnapping
-% \iffirstargument\doifsomething{#1}{\verplaatsopgrid[#1]}\fi
-% \expandafter\dodosnaptogrid
-% \fi}
-
-% \def\dosnaptogrid[#1]%
-% {\resetlastlinewidth % maybe in more places, otherwise spacing gets messed up
-% \ifgridsnapping
-% \iffirstargument\doifsomething{#1}{\moveongrid[#1]}\fi
-% \expandafter\dodosnaptogrid
-% \fi}
-
-\def\dosnaptogrid[#1]%
- {\resetlastlinewidth % maybe in more places, otherwise spacing gets messed up
- \doifinsetelse\v!force{#1}%
- {\moveongrid[#1]%
- \dodosnaptogrid}
- {\ifgridsnapping
- \doifsomething{#1}{\moveongrid[#1]}%
- \expandafter\dodosnaptogrid
- \fi}}
-
-% \def\forcedpresnapcorrection % test this on 'details'
-% {\ifforcepresnap
-% \ifvmode \else \par \fi % new
-% % we don't want top of page space when 'top' option
-% %\verticalstrut\nobreak\vskip-\struttotal
-% %\verticalstrut\vskip-\struttotal
-% % nobreak really needed
-% \allowbreak\verticalstrut\nobreak\vskip-\struttotal
-% %\ifdim\pagetotal>\topskip \else
-% % eigenlijk signal
-% %\writestatus{grid}{removing dummy at top of page}%
-% %\bgroup
-% %\output{\setbox\scratchbox\box255}%
-% %\penalty\outputpenalty
-% %\egroup
-% %\fi
-% \fi}
-
-\def\forcedpresnapcorrection % test this on 'details'
- {\ifforcepresnap
- \ifvmode \else \par \fi % new
- % we don't want top of page space when 'top' option
- % \verticalstrut\nobreak\vskip-\struttotal
- % \verticalstrut\vskip-\struttotal
- % \nobreak really needed
- % \dosomebreak\allowbreak % no: spoils heads, so only under know situation, not in snapper
- \verticalstrut
- \nobreak
- \vskip-\struttotal
- %\ifdim\pagetotal>\topskip \else
- % eigenlijk signal
- %\writestatus{grid}{removing dummy at top of page}%
- %\bgroup
- %\output{\setbox\scratchbox\box255}%
- %\penalty\outputpenalty
- %\egroup
- %\fi
- \fi}
-
-\def\setgridtracebox#1[#2]% % maybe reverse the order
- {\setbox\nextbox#1%
- {\hbox
- {\hbox to \zeropoint
- {\startlayoutcomponent{gridsnaps}{grid snaps}%
- \color[grid:#2]{\ruledhbox{\fakebox\nextbox}}%
- \stoplayoutcomponent
- \hss}%
- \flushnextbox}}}
-
-\newif\ifboxedsnapping \boxedsnappingtrue
-
-\chardef\depthsnapmethod \plusone % downward compatible, minus one line
-\chardef\heightsnapmethod\plusone % downward compatible, minus one line
-
-\def\dodosnaptogrid
- {\dowithnextbox
- {\bgroup
- \ifcase\@@alignsnapmethod \or
- % we're dealing with text with a possible big depth/height
- \chardef\depthsnapmethod \plustwo
- \chardef\heightsnapmethod\plustwo
- \fi
- \ifdim\nextboxht<\textheight % handle special case (like page fig)
- \ifcase\@@alignsnapbox\relax
- \ifcase\@@alignsnap\else % 1=top 2=high 3=middle 4=low
- \ifshowgridboxes
- \setgridtracebox\hbox[two]%
- \fi
- %\getnoflines{\nextboxht}%
- \getnoflines\nextboxht
- \setbox\nextbox\vbox to \noflines\lineheight
- {\ifnum\@@alignsnap=1 \kern\lineheight\kern-\topskip\fi
- \ifnum\@@alignsnap>2 \vfill\fi
- \flushnextbox
- \ifnum\@@alignsnap<4 \vfill\fi}%
- \fi
- \ifshowgridboxes
- \setgridtracebox\hbox[three]%
- \fi
- \forgetall
- \par
- \ifvbox\nextbox
- \setbox\nextbox\hbox{\flushnextbox}% don't ask
- \fi
- \scratchskip\lastskip
- \edef\presnapskip{\the\lastskip}%
- % mixing single/double columns sometimes goes wrong,
- % check 'som' document
- \ifinsidecolumns
- \forcepresnaptrue
- \fi
- \forcedpresnapcorrection
- \ifdim\nextboxht>\strutht
- \scratchdimen\nextboxht
- \ifcase\@@presnap\relax
- \ifdim\scratchskip>\zeropoint\relax
- \scratchcounter\scratchskip
- \advance\scratchcounter -\openlineheight
- \ifnum\scratchcounter<0
- \scratchcounter-\scratchcounter
- \fi
- \ifnum\scratchcounter<10 % \lastkip is about \openlineheight
- \advance\scratchdimen -\openstrutdepth
- \edef\presnapskip{*\presnapskip}%
- \else\ifdim\scratchskip>\openlineheight
- %<\openlineheight \else
- \advance\scratchdimen -\openstrutdepth
- \edef\presnapskip{*\presnapskip}%
- \fi\fi
- \fi
- \fi
- % \getnoflines\scratchdimen % maybe raw ?
- % \advance\noflines -1
- \ifcase\heightsnapmethod
- % raw
- \or
- \advance\scratchdimen-\lineheight % tight (default)
- \or
- \advance\scratchdimen-\strutheight % fit (text)
- \or
- \advance\scratchdimen-\strutheight % tolerant
- \advance\scratchdimen-\roundingeps
- \fi
- \getnoflines\scratchdimen
- \ifnum\noflines>0
- \scratchdimen\noflines\lineheight
- \else
- \scratchdimen\zeropoint
- \fi
- \else
- \scratchdimen\zeropoint
- \fi
- \ifnum\@@extrasnap=1 \advance\scratchdimen \extrasnapsign \lineheight \fi
- \ifnum\@@extrasnap=2 \advance\scratchdimen \extrasnapsign.5\lineheight \fi
- \edef\presnap{\the\scratchdimen}%
- \ifstrutsnapping
- \ifboxedsnapping
- \getrawnoflines\scratchdimen
- \advance\scratchdimen-\noflines\lineheight
- \vskip\scratchdimen % disappears at top of page
- \dorecurse\noflines{\verticalstrut\nobreak}%
- \else \ifdim\scratchdimen=\zeropoint
- % nothing to skip
- \else % disappears at top of page
- \vskip\scratchdimen
- \fi \fi
- \fi
- \ifdim\nextboxdp>\strutdp
- % \getnoflines\nextboxdp
- % \advance\noflines \minusone
- \scratchdimen\nextboxdp\relax
- \ifcase\depthsnapmethod
- % raw
- \or
- \advance\scratchdimen-\lineheight % tight (default)
- \or
- \advance\scratchdimen-\strutdepth % fit (text)
- \or
- \advance\scratchdimen-\strutdepth % tolerant
- \advance\scratchdimen-\roundingeps
- \fi
- \getnoflines\scratchdimen
- \ifnum\noflines>0
- \scratchdimen\noflines\lineheight
- \else
- \scratchdimen\zeropoint
- \fi
- \else
- \scratchdimen\zeropoint
- \fi
- \ifnum\@@extrasnap=2 \advance\scratchdimen \extrasnapsign.5\lineheight \fi
- \ifnum\@@extrasnap=3 \advance\scratchdimen \extrasnapsign \lineheight \fi
- \edef\postsnap{\the\scratchdimen}%
- \ifstrutsnapping
- \nextboxht\strutht
- \nextboxdp\strutdp
- \else
- \scratchdimen\presnap
- \advance\scratchdimen \strutht
- \nextboxht\scratchdimen
- \scratchdimen\postsnap
- \advance\scratchdimen \strutdp
- \nextboxdp\scratchdimen
- \fi
- \hbox{\tracedsnapping\flushnextbox}%
- \ifstrutsnapping
- \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi
- \fi
- \else
- \scratchdimen\nextboxht\relax
- \ifcase\@@alignsnapbox
- % can't happen here
- \or
- \getrawnoflines\scratchdimen
- \else
- \getnoflines \scratchdimen
- \fi
- \scratchdimen\noflines\lineheight\relax
- \advance\scratchdimen-\strutdepth
- % spoils the whole game (fit/broad/line)
- % \ifnum\pagetotal>\zeropoint \else % disable this as option
- % \advance\scratchdimen-\strutheight
- % \advance\scratchdimen+\topskip
- % \fi
- \dimen0=\scratchdimen
- \dimen2=\strutdepth
- \ifshowgridboxes
- \setgridtracebox\hbox[two]%
- \fi
- \nextboxdp\strutdp
- \dimen4=\nextboxht
- \dimen6=\nextboxdp
- \iftracegridsnapping
- \setbox\scratchbox\hbox
- {\scratchdimen\@@alignsnapamount\relax
- \ifdim\scratchdimen<\zeropoint
- \tracedgridamount\zeropoint{-\scratchdimen}%
- \else
- \tracedgridamount\scratchdimen\zeropoint
- \fi}%
- \smashbox\scratchbox
- \setbox\nextbox\hbox{\box\scratchbox\flushnextbox}%
- \fi
- \setbox\nextbox\hbox
- {\scratchdimen\@@alignsnapamount\relax
- \ifcase\@@alignsnapdepth\or
- % don't change this ever !
- \ifdim\dimen0<\lineheight
- % otherwise it is ok, but ending up inside
- % the next paragraph is seldom what we want,
- % so we move one line up
- \advance\scratchdimen-\lineheight
- \advance\scratchdimen\strutheight
- \else
- % otherwise we can move down to the
- % baseline
- \advance\scratchdimen\dimen6 % == \strutdepth
- \fi
- \fi
- \lower\scratchdimen\flushnextbox}%
- \nextboxht\dimen4
- \nextboxdp\dimen6
- \ifnum\@@alignsnap<4 % 4 = regel
- \setbox\nextbox\vbox to \scratchdimen
- {\forgetall
- \ifnum\@@alignsnap>2 \vfill\fi % 3 4
- \flushnextbox
- \nointerlineskip % \offinterlineskip
- \ifnum\@@alignsnap<4 \vfill\fi % 2 3
- \kern\zeropoint}%
- \fi
- \ifshowgridboxes
- \setgridtracebox\vbox[three]%
- \fi
- \scratchdimen\@@alignsnapamount
- \edef\presnapskip{\the\scratchdimen}%
- \ifnum\@@alignsnap>2 \def\presnap {+}\fi
- \ifnum\@@alignsnap<4 \def\postsnap{+}\fi
- \setbox\nextbox\hbox{\tracedsnapping\flushnextbox}%
- \par
- \nextboxht\dimen0
- \nextboxdp\dimen2
- \forcedpresnapcorrection
- \nointerlineskip
- \flushnextbox
- \fi
- \else
- \setbox\nextbox\vbox to \textheight
- {\ifdim\nextboxdp=\zeropoint
- \hbox{\lower\strutdepth\flushnextbox}
- \else % this branch is yet untested
- \vss
- \hbox{\lower\nextboxdp\flushnextbox}
- \vskip-\strutdepth
- \fi}%
- \nextboxdp\strutdepth
- \flushnextbox
- \fi
- \extrasnapreset
- \enablepresnapcorrection
- \global\chardef\@@alignsnap\zerocount
- \global\chardef\@@alignsnapbox\zerocount
- \egroup}}
-
-\def\tracedgridamount#1#2%
- {\startlayoutcomponent{gridsnaps}{grid snaps}%
- \color[grid:four]{\vrule\!!width\nextboxwd\!!height#1\!!depth#2}%
- \stoplayoutcomponent}
-
-\def\snaptomathgrid % probably not working ok, also kind of obsolete
- {\ifgridsnapping
- \dowithnextbox
- {\blank[\v!line]\snaptogrid\vbox{\flushnextbox}\blank[\v!line]}
- \vbox\bgroup
- \forgetdisplayskips
- \@EA\let\@EA\next
- \fi}
-
-\def\topsnaptogrid
- {\ifgridsnapping
- \dowithnextbox
- {\scratchdimen\nextboxht
- \advance\scratchdimen -\strutht
- \advance\scratchdimen \topskip
- \nextboxht\scratchdimen
- \nextboxdp\zeropoint
- \flushnextbox
- \kern\lineheight
- \kern-\topskip
- \nointerlineskip}
- \hbox
- \fi}
-
-% \def\centertogrid % meant for special situations
-% {\ifgridsnapping
-% \dowithnextboxcontent
-% {\ignorespaces}
-% {\bgroup
-% \par
-% \scratchdimen\nextboxht
-% \advance\scratchdimen \nextboxdp
-% \getnoflines\scratchdimen
-% \setbox\nextbox\vbox to \noflines\lineheight
-% {\forgetall
-% \vskip\zeropoint \!!plus \nextboxht
-% \copy\nextbox
-% \kern.5\strutdp % VOORLOPIGE WAARDE
-% \vskip\zeropoint \!!plus \nextboxdp}%
-% \noindent\snaptogrid\vbox{\flushnextbox}%
-% \egroup}
-% \vbox % was \hbox
-% \fi}
-
-% The next implementation is sub-optimal
-%
-% \def\centertogrid % usage: see ie pascal / stepcharts
-% {\snaptogrid[\v!midden,.5\strutdp]\vbox}
-
-\def\centertogrid % meant for special situations
- {\ifgridsnapping
- \dowithnextboxcontent
- {\ignorespaces}
- {\bgroup
- \par
- \scratchdimen\nextboxht
- \advance\scratchdimen \nextboxdp
- \getnoflines\scratchdimen
- \setbox\nextbox\vbox to \noflines\lineheight
- {\forgetall
- \vss
- \topbaselinecorrection
- \copy\nextbox
- \botbaselinecorrection
- \vss}%
- \setbox\nextbox\hbox{\lower\strutdp\flushnextbox}%
- \forgeteverypar % new per 3/4/2008, prevents duplicate pos nodes resulting in extra whitespace
- \noindent\snaptogrid\vbox{\flushnextbox}%
- \egroup}
- \vbox % was \hbox
- \fi}
-
-% testbed for \centertogrid
-%
-% \strut Bruggetje
-% \startlinecorrection
-% \startcombination
-% {\framed{test}} {} {\framed{test}} {}
-% \stopcombination
-% \stoplinecorrection
-% \strut Bruggetje
-% \startlinecorrection
-% \startcombination[2*2]
-% {\framed{test}} {} {\framed{test}} {}
-% {\framed{test}} {} {\framed{test}} {}
-% \stopcombination
-% \stoplinecorrection
-% \strut Bruggetje
-% \startlinecorrection[blank]
-% \startcombination
-% {\framed{test}} {} {\framed{test}} {}
-% \stopcombination
-% \stoplinecorrection
-% \strut Bruggetje
-% \startlinecorrection[blank]
-% \startcombination[2*2]
-% {\framed{test}} {} {\framed{test}} {}
-% {\framed{test}} {} {\framed{test}} {}
-% \stopcombination
-% \stoplinecorrection
-% \strut Bruggetje
-% \startlinecorrection
-% \startcombination
-% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
-% \stopcombination
-% \stoplinecorrection
-% \strut Bruggetje
-% \startlinecorrection
-% \startcombination[2*2]
-% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
-% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
-% \stopcombination
-% \stoplinecorrection
-% \strut Bruggetje
-% \startlinecorrection[blank]
-% \startcombination
-% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
-% \stopcombination
-% \stoplinecorrection
-% \strut Bruggetje
-% \startlinecorrection[blank]
-% \startcombination[2*2]
-% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
-% {\framed[lines=1]{test}} {} {\framed[lines=1]{test}} {}
-% \stopcombination
-% \stoplinecorrection
-
-\ifx\startbaselinecorrection\undefined \wait \fi % change order
-
-\let\normalstartbaselinecorrection=\startbaselinecorrection
-
-\def\startbaselinecorrection
- {\ifgridsnapping
- \centertogrid\bgroup
- \let\stopbaselinecorrection\egroup
- \else
- \normalstartbaselinecorrection
- \fi}
-
-\chardef\gridboxlinenomode\plusone
-\chardef\gridboxlinemode \plusone % 0:nothing 1:all 2:lines 3:frame
-
-\def\gridboxvbox {\ifcase\gridboxlinemode\vbox\or\ruledvbox\or\vbox\or\ruledvbox\else\ruledvbox\fi}
-\def\gridboxwidth{\ifcase\gridboxlinemode0\or.5\or.5\or0\else.5\fi\testrulewidth}
-
-\def\setgridbox#1#2#3%
- {\setbox#1\gridboxvbox to #3 % given size
- {\forgetall
- \resetteststrut
- \offinterlineskip
- \hsize#2%
- \baselinerulefalse
- \gridboxvbox % calculated size
- {\getrawnoflines{#3}% \getnoflines{#3}%
- \vskip\topskip
- \vskip-\strutht
- \scratchdimen#2\advance\scratchdimen \lineheight
- \dorecurse\noflines
- {\strut
- \hskip-.5\lineheight
- \ifcase\gridboxlinenomode\or
- \rlap
- {\hskip.2\bodyfontsize\hskip\scratchdimen
- \infofont\hbox to 1em{\hss\recurselevel}}%
- \or
- \llap
- {\infofont\hbox to 1em{\hss\recurselevel}%
- \hskip.2\bodyfontsize}%
- \fi
- \vrule
- \!!height \gridboxwidth
- \!!depth \gridboxwidth
- \!!width \scratchdimen
- \par}}
- \vfill}}
-
-%D Some intervention macros:
-
-\def\gridwarning#1{\message{[beware of #1 extra snap]}}
-
-\global\let\@@alignsnapamount\!!zeropoint
-\global\chardef\@@alignsnapdepth0
-
-\def\@@unknowngriddisplacement
- {\global\chardef\@@alignsnapbox\plusthree
- \global\let\@@alignsnapamount\commalistelement}
-
-\def\domoveongrid[#1]%
- {\ifgridsnapping\doifsomething{#1}{\dodomoveongrid[#1]}\fi}
-
-\def\dodomoveongrid[#1]% some day : speed up
- {\global\chardef\@@alignsnap\zerocount
- \global\chardef\@@alignsnapbox\zerocount
- \global\chardef\@@alignsnapdepth\zerocount
- \global\chardef\@@alignsnapmethod\zerocount
- \global\let\@@alignsnapamount\!!zeropoint
- \donefalse
- \expanded{\processallactionsinset[#1]}
- [\v!standard=>,
- \v!normal=>, % to be sure
- \v!yes=>, % to be sure
- \v!top=>\gridwarning+\positiveextrasnap\extrasnapbefore,
- \v!bottom=>\gridwarning+\positiveextrasnap\extrasnapafter,
- \v!both=>\positiveextrasnap\extrasnaparound,
- -\v!top=>\gridwarning-\negativeextrasnap\extrasnapbefore,
- -\v!bottom=>\gridwarning-\negativeextrasnap\extrasnapafter,
- -\v!both=>\negativeextrasnap\extrasnaparound,
- \v!text=>\global\chardef\@@alignsnapmethod\plusone, % accurate calculations
- \v!page=>\global\chardef\@@alignsnap\plusone, % topskip
- \v!high=>\global\chardef\@@alignsnap\plustwo,
- \v!middle=>\global\chardef\@@alignsnap\plusthree,
- \v!low=>\global\chardef\@@alignsnap\plusfour,
- \v!fit=>\global\chardef\@@alignsnapbox\plusone, % new
- \v!broad=>\global\chardef\@@alignsnapbox\plustwo, % new
- \v!depth=>\global\chardef\@@alignsnapdepth\plusone, % new
- \v!line=>\global\chardef\@@alignsnapbox\plusthree
-% \global\chardef\@@alignsnapdepth\plusone
- \global\chardef\@@alignsnap\plusfour,
- \v!reset=>\positiveextrasnap\extrasnapreset,
- \v!none=>\global\chardef\@@alignsnap\zerocount
- \global\chardef\@@alignsnapbox\zerocount,
- \v!force=>, % turns on grid snapping even when not on
- \s!default=>,
- \s!unknown=>\@@unknowngriddisplacement]}
-
-\def\moveongrid
- {\dosingleempty\domoveongrid}
-
-\def\doplaceongrid[#1]%
- {\domoveongrid[#1]\snaptogrid\vbox}
-
-\def\placeongrid
- {\dosingleempty\doplaceongrid}
-
-%D Snapping is rather robust as long as we use whole lines.
-%D Half lines of white space can however be handled when they
-%D come in pairs. The corrections needed when crossing page
-%D boundaries in the middle of such a pair, are handled by
-%D macros that are (named) sort of fuzzy. This fuzzy mechanism
-%D was written as an extension to the grid typesetting needed
-%D for typesetting (part of) the \MAPS.
-%D
-%D \starttyping
-%D \setuptyping
-%D [before={\blank[halfline]},
-%D after={\blank[halfline]}]
-%D \stoptyping
-
-\newif \iffuzzyvskip
-\newif \iffuzzysnapdone
-\newif \iffuzzysnapping
-\newif \iffuzzysnapped
-\chardef \fuzzysnappedleft=0 % ==1 when fuzzybegin still open
-\newpersistentmark\fuzzymark % (!)
-\newcount \fuzzymarker
-\newbox \fuzzysnapbox
-\newbox \fuzzysnapsplit
-
-\def\dosyncfuzzyvskip
- {\ifvmode\ifdim\lastskip<\lineheight\ifdim\lastskip>\zeropoint
- \bgroup % - added 28/2/2003: check this, there was no -
- \endgraf\forgetall\verticalstrut\nobreak\vskip-\struttotal
- \egroup
- \fi\fi\fi}
-
-\def\fuzzyvskip#1%
- {\iffuzzysnapdone
- \dosyncfuzzyvskip % NEWER
- \endfuzzysnapping
- \vskip#1\relax
- \global\fuzzysnapdonefalse
- \else
- \vskip#1\relax
- \beginfuzzysnapping
- \global\fuzzysnapdonetrue
- \fi}
-
-\def\setfuzzymark#1#2#3% #1/#2 => error recovery
- {\ifgridsnapping
- \global\fuzzysnappingtrue
- \global\advance\fuzzymarker \ifodd\fuzzymarker#1\else#2\fi
- \nobreak
- \ifshowfuzzyskips
- \hbox{\color[grid:three]
- {\llap{\infofont#3\vl\the\fuzzymarker}\nobreak
- \vrule\!!width\hsize\!!height.1\lineheight}}
- \nobreak
- \fi
- %[\the\fuzzymarker]
- %\expandafter\fuzzymark\expandafter{\the\fuzzymarker}%
- \expandafter\rawsetmark\expandafter\fuzzymark\expandafter{\the\fuzzymarker}%
- \nobreak
- \fi}
-
-\def\beginfuzzysnapping{\setfuzzymark21\v!start} % odd
-\def\endfuzzysnapping {\setfuzzymark12\v!stop } % even
-
-\def\removelastfuzzyvskip
- {\ifgridsnapping
- \iffuzzysnapping
- \ifdim\lastskip<\openlineheight
- \else
- \removelastskip
- \fi
- \else
- \removelastskip
- \fi
- \else
- \removelastskip
- \fi}
-
-\def\docheckfuzzysnap#1%
- {\bgroup
- \dontcomplain
- \setbox\fuzzysnapbox\copy#1\relax
- \setbox\fuzzysnapsplit\vsplit\fuzzysnapbox to 1\lineheight
- \let\topfuzzymark\empty % indeed here ... no real mark
- \getsplitmarks\fuzzymark
-% \ifcase0\topfuzzymark
- \ifcase0\rawgetsplittopmark\fuzzymark
- \global\chardef\fuzzysnappedleft\zerocount
- \global\fuzzysnappedfalse
-% \else\ifodd\topfuzzymark
- \else\ifodd\rawgetsplittopmark\fuzzymark
- \global\chardef\fuzzysnappedleft\plusone
- \global\fuzzysnappedtrue
- \else
- \global\chardef\fuzzysnappedleft=2
- \global\fuzzysnappedtrue
- \fi\fi
- \iffuzzysnapped \else
- \doloop
- {\ifvoid\fuzzysnapbox
- \exitloop
- \else
- \setbox\fuzzysnapsplit=\vsplit\fuzzysnapbox to \lineheight
- %\let\topfuzzymark=\empty % ... but not here
- \getsplitmarks\fuzzymark
-% \ifcase0\topfuzzymark
- \ifcase0\rawgetsplittopmark\fuzzymark
- % continue
-% \else\ifodd\topfuzzymark
- \else\ifodd\rawgetsplittopmark\fuzzymark
- \exitloop
- \else
- \global\chardef\fuzzysnappedleft\plusone
- \global\fuzzysnappedtrue
- \exitloop
- \fi\fi
- \fi}%
- \fi
- \egroup}
-
-\def\getfuzzysnapcorrection#1%
- {\global\let\presnapcorrection \relax
- \global\let\postsnapcorrection\relax
- \ifgridsnapping\iffuzzysnapping
- \docheckfuzzysnap{#1}%
- \iffuzzysnapped
- \iftracegridsnapping
- \gdef\presnapcorrection
- {\color[grid:four]{\hrule\!!height.5\openlineheight\!!width\hsize}}%
- \else
- \gdef\presnapcorrection{\kern.5\openlineheight}%
- \fi
- \gdef\postsnapcorrection{\kern-.5\openlineheight}% get the height ok
- \fi
- \fi\fi}
-
-\def\fuzzysnappedbox#1#2% \box \unvbox
- {\getfuzzysnapcorrection{#2}%
- \presnapcorrection
- #1#2%
- \postsnapcorrection}
-
-\def\adaptfuzzypagegoal
- {\ifgridsnapping\iffuzzysnapping\ifcase\fuzzysnappedleft\or % see dopagecontents
- \scratchdimen\pagegoal
- \advance\scratchdimen -.5\openlineheight
- \global\pagegoal\scratchdimen
- \global\advance\vsize -.5\openlineheight
- \global\chardef\fuzzysnappedleft0
- \fi\fi\fi}
-
-%D New, experimental, used in caption snapping:
-%D
-%D \starttyping
-%D \startcolumnset
-%D
-%D \setupcaption[figure][style=\tfx\setupinterlinespace,inbetween=,grid=top]
-%D
-%D \placefigure [lrtb] {\dorecurse{5}{green gras}}
-%D {\externalfigure[dummy][width=\textwidth,height=3cm,grid=height]}
-%D \placefigure [lrtb] {\dorecurse{15}{green gras}}
-%D {\externalfigure[dummy][width=\textwidth,height=3cm,grid=height]}
-%D
-%D \setupcaption[figure][style=\tfx\setupinterlinespace,inbetween=,grid=bottom]
-%D
-%D \placefigure [rltb] {\dorecurse{5}{green gras}}
-%D {\externalfigure[dummy][width=\textwidth,height=3cm,grid=height]}
-%D \placefigure [rltb] {\dorecurse{15}{green gras}}
-%D {\externalfigure[dummy][width=\textwidth,height=3cm,grid=height]}
-%D
-%D \input thuan
-%D
-%D \stopcolumnset
-%D \stoptyping
-
-\def\moveboxontogrid#1#2#3% box method firstlineht % experimental ! ! !
- {\doifsomething{#2}
- {\getnoflines{\ht#1}% no depth taken into account, depth preserved
- \scratchdimen\noflines\lineheight
- \advance\scratchdimen-\strutdp
- \bgroup
- \advance\scratchdimen-\onepoint % be a bit tolerant
- \ifdim\scratchdimen>\ht#1\relax
- \egroup
- \doif{#2}\v!top {\setbox#1\vbox to \scratchdimen{\vskip-#3\vskip\strutht\box#1\vfill}}%
- \doif{#2}\v!bottom{\setbox#1\vbox to \scratchdimen{\vfill\box#1\removedepth}}%
- \dp#1\strutdp
- \else
- \egroup
- \ht#1\scratchdimen
- \dp#1\strutdp
- \fi}}
-
-%D New:
-
-\let\checkgridsnapping\relax
-
-\protect \endinput
diff --git a/tex/context/base/core-ini.mkii b/tex/context/base/core-ini.mkii
new file mode 100644
index 000000000..69edf9735
--- /dev/null
+++ b/tex/context/base/core-ini.mkii
@@ -0,0 +1,67 @@
+%D \module
+%D [ file=core-ini,
+%D version=2003.12.01,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Additional Initialization,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Core Macros / Additional Initialization}
+
+%D We will move more code to here, so that we become less dependent of the
+%D orde in which modules are loaded.
+
+\unprotect
+
+\everypar \emptytoks
+\neverypar \emptytoks
+
+\appendtoks \flushnotes \to \everypar
+\appendtoks \synchronizesidefloats \to \everypar
+
+\appendtoks \checkinlinedirection \to \everypar
+
+\appendtoks \checkindentation \to \everypar
+\appendtoks \showparagraphnumber \to \everypar
+\appendtoks \flushmargincontents \to \everypar
+\appendtoks \flushcommentanchors \to \everypar
+\appendtoks \synchronizenotes \to \everypar
+\appendtoks \OTRSETshowstatus \to \everypar
+\appendtoks \flushpostponedbookmark \to \everypar
+\appendtoks \registerparoptions \to \everypar
+\appendtoks \flushsyncpositions \to \everypar
+\appendtoks \flushpostponednodedata \to \everypar
+\appendtoks \dohandlerepeatdelimitedtext \to \everypar
+\appendtoks \insertparagraphintro \to \everypar
+
+\appendtoks \flushpostponedbookmark \to \neverypar
+\appendtoks \flushpostponedbookmark \to \everylistentry
+
+\appendtoks \flushnotes \to \everydisplay
+\appendtoks \adjustsidefloatdisplaylines \to \everydisplay
+
+\appendtoks \flushsyncpositions \to \everyheadstart
+
+\appendtoks \flushsyncresets \to \everyendoftextbody
+
+\appendtoks \ignorespaces \to \everybeginofpar
+
+\appendtoks \removeunwantedspaces \to \everyendofpar
+%appendtoks \strut \to \everyendofpar % option ?
+\appendtoks \flushsyncresets \to \everyendofpar
+\appendtoks \setlastlinewidth \to \everyendofpar % must happen before endgraf
+\appendtoks \endgraf \to \everyendofpar
+
+% Todo: verbatim, xml, tex, move code to here
+
+\ifx\normalcompound\undefined \let\normalcompound=| \fi
+
+\appendtoks \catcode`|=\@@active \let|\normalcompound \to \everyTEXinputmode
+\appendtoks \catcode`|=\@@letter \to \everyXMLinputmode
+
+\protect \endinput
diff --git a/tex/context/base/core-ini.mkiv b/tex/context/base/core-ini.mkiv
new file mode 100644
index 000000000..69edf9735
--- /dev/null
+++ b/tex/context/base/core-ini.mkiv
@@ -0,0 +1,67 @@
+%D \module
+%D [ file=core-ini,
+%D version=2003.12.01,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Additional Initialization,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Core Macros / Additional Initialization}
+
+%D We will move more code to here, so that we become less dependent of the
+%D orde in which modules are loaded.
+
+\unprotect
+
+\everypar \emptytoks
+\neverypar \emptytoks
+
+\appendtoks \flushnotes \to \everypar
+\appendtoks \synchronizesidefloats \to \everypar
+
+\appendtoks \checkinlinedirection \to \everypar
+
+\appendtoks \checkindentation \to \everypar
+\appendtoks \showparagraphnumber \to \everypar
+\appendtoks \flushmargincontents \to \everypar
+\appendtoks \flushcommentanchors \to \everypar
+\appendtoks \synchronizenotes \to \everypar
+\appendtoks \OTRSETshowstatus \to \everypar
+\appendtoks \flushpostponedbookmark \to \everypar
+\appendtoks \registerparoptions \to \everypar
+\appendtoks \flushsyncpositions \to \everypar
+\appendtoks \flushpostponednodedata \to \everypar
+\appendtoks \dohandlerepeatdelimitedtext \to \everypar
+\appendtoks \insertparagraphintro \to \everypar
+
+\appendtoks \flushpostponedbookmark \to \neverypar
+\appendtoks \flushpostponedbookmark \to \everylistentry
+
+\appendtoks \flushnotes \to \everydisplay
+\appendtoks \adjustsidefloatdisplaylines \to \everydisplay
+
+\appendtoks \flushsyncpositions \to \everyheadstart
+
+\appendtoks \flushsyncresets \to \everyendoftextbody
+
+\appendtoks \ignorespaces \to \everybeginofpar
+
+\appendtoks \removeunwantedspaces \to \everyendofpar
+%appendtoks \strut \to \everyendofpar % option ?
+\appendtoks \flushsyncresets \to \everyendofpar
+\appendtoks \setlastlinewidth \to \everyendofpar % must happen before endgraf
+\appendtoks \endgraf \to \everyendofpar
+
+% Todo: verbatim, xml, tex, move code to here
+
+\ifx\normalcompound\undefined \let\normalcompound=| \fi
+
+\appendtoks \catcode`|=\@@active \let|\normalcompound \to \everyTEXinputmode
+\appendtoks \catcode`|=\@@letter \to \everyXMLinputmode
+
+\protect \endinput
diff --git a/tex/context/base/core-ini.tex b/tex/context/base/core-ini.tex
deleted file mode 100644
index 69edf9735..000000000
--- a/tex/context/base/core-ini.tex
+++ /dev/null
@@ -1,67 +0,0 @@
-%D \module
-%D [ file=core-ini,
-%D version=2003.12.01,
-%D title=\CONTEXT\ Core Macros,
-%D subtitle=Additional Initialization,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Core Macros / Additional Initialization}
-
-%D We will move more code to here, so that we become less dependent of the
-%D orde in which modules are loaded.
-
-\unprotect
-
-\everypar \emptytoks
-\neverypar \emptytoks
-
-\appendtoks \flushnotes \to \everypar
-\appendtoks \synchronizesidefloats \to \everypar
-
-\appendtoks \checkinlinedirection \to \everypar
-
-\appendtoks \checkindentation \to \everypar
-\appendtoks \showparagraphnumber \to \everypar
-\appendtoks \flushmargincontents \to \everypar
-\appendtoks \flushcommentanchors \to \everypar
-\appendtoks \synchronizenotes \to \everypar
-\appendtoks \OTRSETshowstatus \to \everypar
-\appendtoks \flushpostponedbookmark \to \everypar
-\appendtoks \registerparoptions \to \everypar
-\appendtoks \flushsyncpositions \to \everypar
-\appendtoks \flushpostponednodedata \to \everypar
-\appendtoks \dohandlerepeatdelimitedtext \to \everypar
-\appendtoks \insertparagraphintro \to \everypar
-
-\appendtoks \flushpostponedbookmark \to \neverypar
-\appendtoks \flushpostponedbookmark \to \everylistentry
-
-\appendtoks \flushnotes \to \everydisplay
-\appendtoks \adjustsidefloatdisplaylines \to \everydisplay
-
-\appendtoks \flushsyncpositions \to \everyheadstart
-
-\appendtoks \flushsyncresets \to \everyendoftextbody
-
-\appendtoks \ignorespaces \to \everybeginofpar
-
-\appendtoks \removeunwantedspaces \to \everyendofpar
-%appendtoks \strut \to \everyendofpar % option ?
-\appendtoks \flushsyncresets \to \everyendofpar
-\appendtoks \setlastlinewidth \to \everyendofpar % must happen before endgraf
-\appendtoks \endgraf \to \everyendofpar
-
-% Todo: verbatim, xml, tex, move code to here
-
-\ifx\normalcompound\undefined \let\normalcompound=| \fi
-
-\appendtoks \catcode`|=\@@active \let|\normalcompound \to \everyTEXinputmode
-\appendtoks \catcode`|=\@@letter \to \everyXMLinputmode
-
-\protect \endinput
diff --git a/tex/context/base/core-ins.tex b/tex/context/base/core-ins.tex
deleted file mode 100644
index 069153434..000000000
--- a/tex/context/base/core-ins.tex
+++ /dev/null
@@ -1,103 +0,0 @@
-%D \module
-%D [ file=core-ins,
-%D version=2002.04.16,
-%D title=\CONTEXT\ Insertion Macros,
-%D subtitle=Insertions,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Core Macros / Insertions}
-
-%D Insertions are special data collections that are associated
-%D to \TEX's internal page builder. When multiple footnote
-%D classes were introduced, I decided to isolate some of the
-%D functionality in a module.
-
-\unprotect
-
-\newtoks\@@insertionlist
-
-\def\processinsertions{\the\@@insertionlist}
-
-\let\doprocessinsert\gobbleoneargument
-
-%\def\installinsertion#1%
-% {\ifx#1\undefined
-% \newinsert#1%
-% \count#1\plusthousand
-% \skip #1\zeropoint
-% \dimen#1\maxdimen
-% \appendtoks\doprocessinsert#1\to\@@insertionlist
-% \fi}
-
-\def\installinsertion#1%
- {\ifx#1\undefined
- \let#1\relax
- \fi
- \ifx#1\relax % permits \csname...\endcsname
- \newinsert#1%
- \count#1\plusthousand
- \skip #1\zeropoint
- \dimen#1\maxdimen
- \appendtoks\doprocessinsert#1\to\@@insertionlist
- \fi}
-
-
-\def\synchronizeinsertions
- {\def\doprocessinsert##1{\ifvoid##1\else\insert##1{\unvbox##1}\fi}%
- \processinsertions}
-
-%D For instance, when we postpone footnotes, we need to save
-%D some data related to the inserts. The next methods are
-%D far from ideal, but better than nothing. We save and
-%D restore box content and associated data independently.
-%D The box content is only restores when non||void.
-
-\def\backupinsertion#1%
- {\csname\string#1\endcsname}
-
-\def\installbackupinsertion#1%
- {\expandafter\newinsert\csname\string#1\endcsname
- \count\backupinsertion#1\zerocount
- \skip \backupinsertion#1\zeropoint
- \dimen\backupinsertion#1\maxdimen}
-
-\def\saveinsertionbox#1%
- {\ifdim\ht#1>\zeropoint % hm, actually unknown
- \global\setbox\backupinsertion#1\box#1%
- \else
- \global\setbox\backupinsertion#1\emptybox
- \fi}
-
-\def\restoreinsertionbox#1%
- {\ifvoid\backupinsertion#1\else % if void, we keep the content
- \global\setbox#1\box\backupinsertion#1%
- \fi}
-
-\def\eraseinsertionbackup#1%
- {\global\setbox\backupinsertion#1\emptybox}
-
-\def\saveinsertiondata#1%
- {\global\skip \backupinsertion#1\skip #1%
- \global\count\backupinsertion#1\count#1%
- \global\dimen\backupinsertion#1\dimen#1}
-
-\def\restoreinsertiondata#1%
- {\global\skip #1\skip \backupinsertion#1%
- \global\count#1\count\backupinsertion#1%
- \global\dimen#1\dimen\backupinsertion#1}
-
-%D Auxiliary macros:
-
-\def\addinsertionheight#1\to#2%
- {\ifvoid#1\else
- \advance#2 1\skip#1\relax
- \advance#2 \ht #1\relax
- \fi}
-
-\protect \endinput
diff --git a/tex/context/base/core-job.mkiv b/tex/context/base/core-job.mkiv
index 84877eb3f..7231ac383 100644
--- a/tex/context/base/core-job.mkiv
+++ b/tex/context/base/core-job.mkiv
@@ -63,8 +63,7 @@
\def\doloadexamodes [#1]{\ctxlua{commands.loadexamodes("#1")}}
\def\registerfileinfo[#1#2]#3% geen \showmessage ?
- {\writestatus\m!systems{#1#2 file #3 at line \the\inputlineno}%
- \immediatewriteutility{f #1 {#3}}}
+ {\writestatus\m!systems{#1#2 file #3 at line \the\inputlineno}}
\ifx\preloadfonts \undefined \let\preloadfonts \relax \fi
\ifx\preloadspecials\undefined \let\preloadspecials\relax \fi
@@ -92,19 +91,6 @@
\bgroup\disableXML\loadallsystemfiles\f!errfilename\donothing\egroup
\to\everygoodbye}}
-%D Loading of \type {cont-usr.tex} (edited by the user)
-%D and \type {cont-fmt.tex} (generated by texexec).
-
-% \def\loaduserspecifications
-% {% this used to be the file where users can tune their system, especially patterns
-% \readsysfile\f!usrfilename{\showmessage\m!systems2\f!usrfilename}\donothing
-% % this one took care of user preferences (fonts, messages) but lm made this obsolete
-% \readjobfile\f!fmtfilename{\showmessage\m!systems2\f!fmtfilename}\donothing
-% % from now on we preload all patterns (only in mkii)
-% \preloadallpatterns}
-
-\let\loaduserspecifications\relax
-
%D We don't want multiple jobfiles to interfere.
\def\loadoptionfile
@@ -189,9 +175,6 @@
\def\donotexecutefile#1%
{}
-\def\verwerkfile#1 %
- {\doexecutefile{#1}}
-
\def\useenvironment[#1]% maybe commalist
{\environment #1 \relax}
@@ -300,7 +283,7 @@
% NOT TOEVOEGEN: \the\everytrace
-\neverypar=\emptytoks
+\neverypar\emptytoks
% \appendtoks \flushnotes \to \everypar
% \appendtoks \synchronizesidefloats \to \everypar
@@ -313,8 +296,6 @@
% \appendtoks \flushnotes \to \everydisplay
% \appendtoks \adjustsidefloatdisplaylines \to \everydisplay
-% soon, when pdftex 1.22 is out in the field:
-
\chardef\systemcommandmode\zerocount % 0=unknown 1=disabled 2=enabled
\def\checksystemcommandmode
@@ -331,22 +312,4 @@
\writestatus\m!systems{system commands are enabled}%
\fi}
-% \ifx\etexversion\undefined \else \ifnum\etexversion<202
-% \prependtoks
-% \writestatus\m!systems{eTeX version \number\etexversion\space -> too old (bugs)}%
-% \writeline
-% \to \everyjob
-% \fi \fi
-
-% \ifx\pdftexversion\undefined \else \ifnum\number\pdftexversion<120
-% \prependtoks
-% \writestatus\m!systems{pdfTeX version \number\pdftexversion\space -> please update}%
-% \writeline
-% \to \everyjob
-% \fi \fi
-
-% Default-instellingen (verborgen)
-
-\resetutilities
-
\protect \endinput
diff --git a/tex/context/base/core-lme.tex b/tex/context/base/core-lme.tex
deleted file mode 100644
index 69dc3b7b2..000000000
--- a/tex/context/base/core-lme.tex
+++ /dev/null
@@ -1,55 +0,0 @@
-%D \module
-%D [ file=core-lme,
-%D version=2006.08.14,
-%D title=\CONTEXT\ Core Macros,
-%D subtitle=LAst Minute Extensions,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Core Macros / Last Minute Extensions}
-
-%D Things that depend on too much other things.
-
-\unprotect
-
-%D Probably obsolete, depends on \type {\checksidefloat}. May disappear.
-
-\def\checkframedtext
- {\ifinsidefloat
- \localhsize\hsize
- \else\ifdim\sidefloatvsize>\zeropoint % will be proper handle
- % \strut % rather clean way to invoke the sidefloat OTR
- % \setbox0=\lastbox % and get the widths set, so from now on we
- % \setlocalhsize % can have framed texts alongside sidefloats
- \checksidefloat
- \setlocalhsize
- \else
- \localhsize\hsize
- \fi\fi}
-
-%D For my eyes only:
-
-\newcount\nofprofiled
-
-\def\profilemacro#1%
- {\nofprofiled\zerocount
- \letvalue{\string#1\string#1}#1%
- \appendtoks
- \normalwritestatus\m!systems{profile \string#1: \number\nofprofiled}%
- \to \everystoptext
- \unexpanded\def#1%
- {\global\advance\nofprofiled\plusone
- \csname\string#1\string#1\endcsname}}
-
-%D Some plain goodies, they may be moved to \type {m-plain.tex} some day.
-
-\ifx\hang \undefined \def\hang {\hangindent\parindent} \fi
-\ifx\textindent\undefined \def\textindent#1{\indent\llap{#1\enspace}\ignorespaces} \fi
-\ifx\narrower \undefined \def\narrower {\advance\leftskip \parindent\advance\rightskip\parindent} \fi
-
-\protect \endinput
diff --git a/tex/context/base/core-lnt.tex b/tex/context/base/core-lnt.tex
deleted file mode 100644
index ae3200e7a..000000000
--- a/tex/context/base/core-lnt.tex
+++ /dev/null
@@ -1,197 +0,0 @@
-%D \module
-%D [ file=core-lnt,
-%D version=2002.05.10,
-%D title=\CONTEXT\ Core Macros,
-%D subtitle=Line Notes,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Core Macros / Line Notes}
-
-%D This module loads on top of the footnote and line numbering macros.
-
-\unprotect
-
-\newcounter\linenotecounter
-\newtoks \collectedlinenotes
-\newif \iftracelinenotes
-
-\appendtoks
- \the\collectedlinenotes
-\to \everylinenumber
-
-\appendtoks
- \global\collectedlinenotes\emptytoks
-\to \beforeeverylinenumbering
-
-\def\dohandlelinenote#1#2#3%
- {\bgroup
- \expanded{\beforesplitstring#2}\at--\to\linenotelinenumber
- \ifnum\linenotelinenumber=\linenumber\relax
- % todo: \onlyfootnote{#2}{#3}% == configurable
- % \setupnote[#1][\c!numbercommand=\gobbleoneargument]%
- % \setnotetext[#1]{\rawreference\s!fnt{\s!fnt:f:\number\internalnotereference}{}#2: #3}%
- \def\linenotelinenumber##1{#2}%
- \setupnote[#1][\c!numbercommand=\linenotelinenumber,\c!textcommand=\gobbleoneargument]%
- \setnote[#1]{#3}%
- \fi
- \egroup}
-
-\def\dotracedlinenote#1%
- {\iftracelinenotes
- \hbox to \zeropoint
- {\forgetall
- \localcolortrue
- \hsize\zeropoint
- \hss
- \vbox to \strutheight{\llap{\red\infofont\setstrut\linenotecounter}\vss}%
- {\color[blue]{\vl}}%
- \vbox to \strutheight{\rlap{\red\infofont\setstrut#1}\vss}%
- \hss}%
- \prewordbreak
- \fi}
-
-\def\dolinenote#1#2%
- {\doglobal\increment\linenotecounter
- \doifreferencefoundelse{\??rr:\linenotecounter}%
- {\expanded{\doglobal\noexpand\appendtoks\noexpand\dohandlelinenote
- {#1}{\currenttextreference}}{#2}\to\collectedlinenotes}
- \donothing
- \dotracedlinenote\empty
- \expanded{\someline[\??rr:\linenotecounter]}}
-
-\def\dostartlinenote#1[#2]#3%
- {\doifreferencefoundelse{\??rr:#2}%
- {\expanded{\doglobal\noexpand\appendtoks\noexpand\dohandlelinenote
- {#1}{\currenttextreference}}{#3}\to\collectedlinenotes}
- \donothing
- \dotracedlinenote{#2}%
- \startline[\??rr:#2]}
-
-\def\dostoplinenote#1[#2]%
- {\stopline[\??rr:#2]}
-
-% defining them
-
-\def\definelinenote
- {\dodoubleempty\dodefinelinenote}
-
-\def\dodefinelinenote[#1][#2]%
- {\definenote[#1][#2]%
- \setvalue {#1}{\dolinenote {#1}}%
- \setvalue{\e!start#1}{\dostartlinenote{#1}}%
- \setvalue{\e!stop #1}{\dostoplinenote {#1}}}
-
-\def\setuplinenote % convenient
- {\setupnote}
-
-% We predefine one, namely \type {\linenote} cum suis.
-
-\definelinenote[\v!linenote]
-
-% \startbuffer[test]
-% \startlinenumbering[100]
-% test \linenote {oeps} test test test test test test
-% test \startlinenote [well] {oeps} test test test test test test
-% test \linenote {oeps} test test test test test test
-% test \linenote {oeps} test test test test test test
-% test \linenote {oeps} test test test test test test
-% test \linenote {oeps} test test test test test test
-% test \stoplinenote [well] test test test test test test
-% \stoplinenumbering
-% \stopbuffer
-%
-% \setupnotedefinition[linenote] [location=serried,distance=.5em]
-%
-% {\typebuffer[test] \getbuffer[test]} \page
-%
-% \startbuffer[setup]
-% \setuplinenumbering
-% [align=left]
-% \stopbuffer
-%
-% {\typebuffer[setup] \getbuffer[setup,test]} \page
-%
-% \startbuffer[setup]
-% \setuplinenumbering
-% [width=1em,
-% align=left]
-% \stopbuffer
-%
-% {\typebuffer[setup] \getbuffer[setup,test]} \page
-%
-% \startbuffer[setup]
-% \setuplinenumbering
-% [width=2em,
-% distance=.5em,
-% align=left]
-% \stopbuffer
-%
-% {\typebuffer[setup] \getbuffer[setup,test]} \page
-%
-% \startbuffer[setup]
-% \setuplinenumbering
-% [width=2em,
-% align=middle]
-% \stopbuffer
-%
-% {\typebuffer[setup] \getbuffer[setup,test]} \page
-%
-% \startbuffer[setup]
-% \setuplinenumbering
-% [conversion=romannumerals,
-% start=1,
-% step=1,
-% location=text,
-% style=slanted,
-% color=blue,
-% width=1.5em]
-% \stopbuffer
-%
-% {\typebuffer[setup] \startnarrower\getbuffer[setup,test]\stopnarrower} \page
-%
-% \startbuffer[setup]
-% \setuplinenumbering
-% [width=4em,
-% left=--,
-% right=--,
-% align=middle]
-% \stopbuffer
-%
-% {\typebuffer[setup] \getbuffer[setup,test]} \page
-%
-% \startbuffer[setup-1]
-% \setuplinenumbering
-% [style=\bfxx,
-% command=\WatchThis]
-% \stopbuffer
-%
-% \startbuffer[setup-2]
-% \def\WatchThis#1%
-% {\ifodd\linenumber
-% \definecolor[linecolor][red]%
-% \else
-% \definecolor[linecolor][green]%
-% \fi
-% \inframed
-% [offset=1pt,frame=off,background=color,backgroundcolor=linecolor]
-% {#1}}
-% \stopbuffer
-%
-% {\typebuffer[setup-1,setup-2] \getbuffer[setup-1,setup-2,test]} \page
-%
-% \startbuffer[setup-1]
-% \setuplinenumbering
-% [location=inright,
-% style=\bfxx,
-% command=\WatchThis]
-% \stopbuffer
-%
-% {\typebuffer[setup-1] \getbuffer[setup-1,setup-2,test]} \page
-
-\protect \endinput
diff --git a/tex/context/base/core-mak.tex b/tex/context/base/core-mak.tex
deleted file mode 100644
index 574fb9756..000000000
--- a/tex/context/base/core-mak.tex
+++ /dev/null
@@ -1,84 +0,0 @@
-%D \module
-%D [ file=core-mak,
-%D version=1997.10.05,
-%D title=\CONTEXT\ Core Macros,
-%D subtitle=General Makeup Commands,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Core Macros / General Makeup Commands}
-
-\unprotect
-
-% \definieerplaats[naam][instellingen]
-% \stelplaatsin[naam][instellingen]
-% \plaats[[instellingen]]
-%
-% - still undocumented and also not in setupb yet
-% - kan ook intern/direct (scheelt duplicatie), zie \framedtext
-
-\def\dodefineplacement[#1][#2]%
- {\getparameters
- [\??pl#1]
- [\c!left=\hss,
- \c!right=\hss,
- \c!linecorrection=\v!off,
- \c!depthcorrection=\v!off,
- \c!margin=\v!standard,
- \c!grid=\v!middle,
- %\c!before=,
- %\c!after=,
- #2]%
- \setvalue{\e!place#1}{\doplacement[\??pl#1]}}
-
-\def\defineplacement
- {\dodoubleempty\dodefineplacement}
-
-\def\setupplacement
- {\dodoubleempty\dosetupplacement}
-
-\def\dosetupplacement[#1]%
- {\dodoubleempty\getparameters[\??pl#1]}
-
-\def\doplacement
- {\dodoubleempty\dodoplacement}
-
-\def\dodoplacement[#1][#2]% correctie moet mooier
- {\bgroup
- \dowithnextboxcontent
- {\forgetall}
- {\setlocalhsize
- \getparameters[#1][#2]%
- \getvalue{#1\c!before}%
- \begingroup
- \positioningparfalse
- \setbox\nextbox\hbox to \localhsize
- {\getvalue{#1\c!left}%
- \flushnextbox
- \getvalue{#1\c!right}}%
- \ifinsidefloat \else
- \addlocalbackgroundtobox\nextbox
- \fi
- \ifgridsnapping
- \doifundefined{#1\c!grid}{\letvalue{#1\c!grid}\v!middle}%
- % unchecked
- \doifinset{\getvalue{#1\c!margin}}{\v!standard,\v!yes}\noindent
- \snaptogrid[\getvalue{#1\c!grid}]\hbox{\flushnextbox}%
- \else
- \doifvalue{#1\c!linecorrection}\v!on \startbaselinecorrection
- \doifinset{\getvalue{#1\c!margin}}{\v!standard,\v!yes}\noindent
- \flushnextbox
- \doifvalue{#1\c!depthcorrection}\v!on\baselinecorrection
- \doifvalue{#1\c!linecorrection }\v!on\stopbaselinecorrection
- \fi
- \endgroup
- \getvalue{#1\c!after}%
- \egroup}
- \vbox}
-
-\protect \endinput
diff --git a/tex/context/base/core-mis.mkii b/tex/context/base/core-mis.mkii
index e860a537a..e61adee25 100644
--- a/tex/context/base/core-mis.mkii
+++ b/tex/context/base/core-mis.mkii
@@ -196,6 +196,72 @@
\c!inbetween={\blank[\v!medium]},
\c!after=\blank]
+% \definieerplaats[naam][instellingen]
+% \stelplaatsin[naam][instellingen]
+% \plaats[[instellingen]]
+%
+% - still undocumented and also not in setupb yet
+% - kan ook intern/direct (scheelt duplicatie), zie \framedtext
+
+\def\dodefineplacement[#1][#2]%
+ {\getparameters
+ [\??pl#1]
+ [\c!left=\hss,
+ \c!right=\hss,
+ \c!linecorrection=\v!off,
+ \c!depthcorrection=\v!off,
+ \c!margin=\v!standard,
+ \c!grid=\v!middle,
+ %\c!before=,
+ %\c!after=,
+ #2]%
+ \setvalue{\e!place#1}{\doplacement[\??pl#1]}}
+
+\def\defineplacement
+ {\dodoubleempty\dodefineplacement}
+
+\def\setupplacement
+ {\dodoubleempty\dosetupplacement}
+
+\def\dosetupplacement[#1]%
+ {\dodoubleempty\getparameters[\??pl#1]}
+
+\def\doplacement
+ {\dodoubleempty\dodoplacement}
+
+\def\dodoplacement[#1][#2]% correctie moet mooier
+ {\bgroup
+ \dowithnextboxcontent
+ {\forgetall}
+ {\setlocalhsize
+ \getparameters[#1][#2]%
+ \getvalue{#1\c!before}%
+ \begingroup
+ \positioningparfalse
+ \setbox\nextbox\hbox to \localhsize
+ {\getvalue{#1\c!left}%
+ \flushnextbox
+ \getvalue{#1\c!right}}%
+ \ifinsidefloat \else
+ \addlocalbackgroundtobox\nextbox
+ \fi
+ \ifgridsnapping
+ \doifundefined{#1\c!grid}{\letvalue{#1\c!grid}\v!middle}%
+ % unchecked
+ \doifinset{\getvalue{#1\c!margin}}{\v!standard,\v!yes}\noindent
+ \snaptogrid[\getvalue{#1\c!grid}]\hbox{\flushnextbox}%
+ \else
+ \doifvalue{#1\c!linecorrection}\v!on \startbaselinecorrection
+ \doifinset{\getvalue{#1\c!margin}}{\v!standard,\v!yes}\noindent
+ \flushnextbox
+ \doifvalue{#1\c!depthcorrection}\v!on\baselinecorrection
+ \doifvalue{#1\c!linecorrection }\v!on\stopbaselinecorrection
+ \fi
+ \endgroup
+ \getvalue{#1\c!after}%
+ \egroup}
+ \vbox}
+
% Te zijner tijd [plaats=boven,onder,midden] implementeren,
% in dat geval moet eerst de maximale hoogte worden bepaald.
%
diff --git a/tex/context/base/core-mis.mkiv b/tex/context/base/core-mis.mkiv
index 96d3bd2cd..88a027c02 100644
--- a/tex/context/base/core-mis.mkiv
+++ b/tex/context/base/core-mis.mkiv
@@ -44,16 +44,16 @@
%appendtoks \def\executesynonym#1#2#3#4{#3}\to\simplifiedcommands
%appendtoks \def\executesort#1#2#3{#3}\to\simplifiedcommands
-\appendtoks \def\ { }\to\simplifiedcommands
-\appendtoks \def\type#1{\letterbackslash\strippedcsname#1}\to\simplifiedcommands
-\appendtoks \def\tex#1{\letterbackslash#1}\to\simplifiedcommands
-\appendtoks \def\TeX{TeX}\to\simplifiedcommands
-\appendtoks \def\ConTeXt{ConTeXt}\to\simplifiedcommands
-\appendtoks \def\MetaPost{MetaPost}\to\simplifiedcommands
-\appendtoks \def\MetaFont{MetaFont}\to\simplifiedcommands
-\appendtoks \def\MetaFun{MetaFun}\to\simplifiedcommands
-%appendtoks \def||{-}\to\simplifiedcommands
-\appendtoks \def|#1|{\ifx#1\empty\empty-\else#1\fi}\to\simplifiedcommands
+\appendtoks \def\ { }\to\simplifiedcommands
+\appendtoks \def\type#1{\letterbackslash\checkedstrippedcsname#1}\to\simplifiedcommands
+\appendtoks \def\tex#1{\letterbackslash#1}\to\simplifiedcommands
+\appendtoks \def\TeX{TeX}\to\simplifiedcommands
+\appendtoks \def\ConTeXt{ConTeXt}\to\simplifiedcommands
+\appendtoks \def\MetaPost{MetaPost}\to\simplifiedcommands
+\appendtoks \def\MetaFont{MetaFont}\to\simplifiedcommands
+\appendtoks \def\MetaFun{MetaFun}\to\simplifiedcommands
+%appendtoks \def||{-}\to\simplifiedcommands
+\appendtoks \def|#1|{\ifx#1\empty\empty-\else#1\fi}\to\simplifiedcommands
\appendtoks\let\buildtextaccent\secondoftwoarguments\to\simplifiedcommands
@@ -196,6 +196,72 @@
\c!inbetween={\blank[\v!medium]},
\c!after=\blank]
+% \definieerplaats[naam][instellingen]
+% \stelplaatsin[naam][instellingen]
+% \plaats[[instellingen]]
+%
+% - still undocumented and also not in setupb yet
+% - kan ook intern/direct (scheelt duplicatie), zie \framedtext
+
+\def\dodefineplacement[#1][#2]%
+ {\getparameters
+ [\??pl#1]
+ [\c!left=\hss,
+ \c!right=\hss,
+ \c!linecorrection=\v!off,
+ \c!depthcorrection=\v!off,
+ \c!margin=\v!standard,
+ \c!grid=\v!middle,
+ %\c!before=,
+ %\c!after=,
+ #2]%
+ \setvalue{\e!place#1}{\doplacement[\??pl#1]}}
+
+\def\defineplacement
+ {\dodoubleempty\dodefineplacement}
+
+\def\setupplacement
+ {\dodoubleempty\dosetupplacement}
+
+\def\dosetupplacement[#1]%
+ {\dodoubleempty\getparameters[\??pl#1]}
+
+\def\doplacement
+ {\dodoubleempty\dodoplacement}
+
+\def\dodoplacement[#1][#2]% correctie moet mooier
+ {\bgroup
+ \dowithnextboxcontent
+ {\forgetall}
+ {\setlocalhsize
+ \getparameters[#1][#2]%
+ \getvalue{#1\c!before}%
+ \begingroup
+ \positioningparfalse
+ \setbox\nextbox\hbox to \localhsize
+ {\getvalue{#1\c!left}%
+ \flushnextbox
+ \getvalue{#1\c!right}}%
+ \ifinsidefloat \else
+ \addlocalbackgroundtobox\nextbox
+ \fi
+ \ifgridsnapping
+ \doifundefined{#1\c!grid}{\letvalue{#1\c!grid}\v!middle}%
+ % unchecked
+ \doifinset{\getvalue{#1\c!margin}}{\v!standard,\v!yes}\noindent
+ \snaptogrid[\getvalue{#1\c!grid}]\hbox{\flushnextbox}%
+ \else
+ \doifvalue{#1\c!linecorrection}\v!on \startbaselinecorrection
+ \doifinset{\getvalue{#1\c!margin}}{\v!standard,\v!yes}\noindent
+ \flushnextbox
+ \doifvalue{#1\c!depthcorrection}\v!on\baselinecorrection
+ \doifvalue{#1\c!linecorrection }\v!on\stopbaselinecorrection
+ \fi
+ \endgroup
+ \getvalue{#1\c!after}%
+ \egroup}
+ \vbox}
+
% Te zijner tijd [plaats=boven,onder,midden] implementeren,
% in dat geval moet eerst de maximale hoogte worden bepaald.
%
@@ -1654,13 +1720,11 @@
\def\afterbothpairedboxes
{\setbox\secondpairedbox\vbox
- {% \localstartcolor[\@@ldcolor]% does not work yet
- \ifnum\@@ldn>1
- \rigidcolumnbalance\nextbox
- \else
- \flushnextbox
- \fi
- }% \localstopcolor}%
+ {\ifnum\@@ldn>1
+ \rigidcolumnbalance\nextbox
+ \else
+ \flushnextbox
+ \fi}%
\ifnum\pairedlocationa<2\hbox\else\vbox\fi\bgroup % hide vsize
\forgetall
\ifnum\pairedlocationa<2
@@ -1836,101 +1900,9 @@
\afterassignment\next\let\nexttoken=}
\hbox}
-% stupid version, does not align top stuff when captions,
-% keep as example
-%
-% \def\dodocombination
-% {\vbox
-% {\forgetall % \setupwhitespace[\v!none]%
-% \let\next\vbox
-% \ExpandFirstAfter\processallactionsinset
-% [\combinationparameter\c!location]
-% [ \v!top=>\let\next\tbox,
-% \v!middle=>\let\next\halfwaybox]%
-% \next{\copy0}%
-% \ifdim\ht2>\zeropoint % beter dan \wd2, nu \strut mogelijk
-% \combinationparameter\c!inbetween
-% %\vtop % wrong code
-% % {\nointerlineskip % recently added
-% % \hsize\wd0
-% % \setupalign[\combinationparameter\c!align]% % \raggedcenter
-% % \begstrut\unhbox2\endstrut}%
-% \box2
-% \fi}%
-% \ifnum\totcombination>\plusone
-% \global\advance\totcombination\minusone
-% \global\advance\horcombination\minusone
-% \ifnum\horcombination=\zerocount
-% \def\next
-% {\cr\noalign
-% {\forgetall % \setupwhitespace[\v!geen]% no
-% \nointerlineskip
-% \combinationparameter\c!before
-% \combinationparameter\c!after
-% \vss
-% \nointerlineskip}%
-% \global\horcombination\maxhorcombination\relax
-% \docombination}%
-% \else
-% \def\next
-% {&&&\hskip\combinationparameter\c!distance&\docombination}%
-% \fi
-% \else
-% \def\next
-% {\cr\egroup}%
-% \fi
-% \next}
-
-% \def\dodocombination
-% {\vbox
-% {\forgetall % \setupwhitespace[\v!none]%
-% \let\next\vbox
-% \ExpandFirstAfter\processallactionsinset
-% [\combinationparameter\c!plaats]
-% [ \v!top=>\let\next\tbox,
-% \v!middle=>\let\next\halfwaybox]%
-% \next{\copy0}%
-% % we need to save the caption for a next alignment line
-% \saveoncombinationstack2}%
-% \ifnum\totcombination>\plusone
-% \global\advance\totcombination\minusone
-% \global\advance\horcombination\minusone
-% \ifnum\horcombination=\zerocount
-% \def\next
-% {\cr
-% \flushcombinationstack
-% \noalign
-% {\forgetall % \setupwhitespace[\v!none]% no
-% \global\setbox\combinationstack\emptybox
-% \nointerlineskip
-% \combinationparameter\c!after
-% \combinationparameter\c!before
-% \vss
-% \nointerlineskip}%
-% \global\horcombination\maxhorcombination\relax
-% \docombination}%
-% \else
-% \def\next
-% {&&&\hskip\combinationparameter\c!distance&\docombination}%
-% \fi
-% \else
-% \def\next
-% {\cr
-% \flushcombinationstack
-% \egroup}%
-% \fi
-% \next}
-
\def\depthonlybox
{\dowithnextbox{\vtop{\hsize\wd\nextbox\kern\zeropoint\box\nextbox}}\vbox}
-% \def\boxwithstrutheight
-% {\dowithnextbox
-% {\scratchdimen\strutheight
-% \advance\scratchdimen-\nextboxht
-% \hbox{\raise\scratchdimen\box\nextbox}}%
-% \vbox}
-
\def\dodocombination
{\vbox
{\forgetall % \setupwhitespace[\v!none]%
@@ -2088,56 +2060,6 @@
\def\placeontopofeachother{\placerelativetoeachother\halign\hss}
\def\placesidebyside {\placerelativetoeachother\valign\vss}
-% this will be replaced or go away, never used
-
-\def\douseexternalfiles[#1][#2]%
- {\getparameters
- [\??fi#1]
- [\c!file=,
- \c!bodyfont=,
- \c!option=,
- #2]}
-
-\def\useexternalfiles
- {\dodoubleargument\douseexternalfiles}
-
-\def\dostelexternefilesin[#1][#2]%
- {\doifundefinedelse{\??fi#1\c!file}
- {\useexternalfiles[#1][#2]}
- {\getparameters[\??fi#1][#2]}}
-
-\def\stelexternefilesin
- {\dodoubleargument\dostelexternefilesin}
-
-\def\verwerkexternefile#1#2#3%
- {\bgroup
- \getparameters[\??fi#1][\c!file=,#3]%
- \doinputonce{\getvalue{\??fi#1\c!file}}%
- \ExpandFirstAfter\switchtobodyfont[\getvalue{\??fi#1\c!bodyfont}]%
- \readsysfile{#2} % beter: loc of fix gebied
- \donothing
- {\showmessage\m!systems{41}{#2,#1}}%
- \egroup}
-
-\def\douseexternalfile[#1][#2][#3][#4]%
- {\stelexternefilesin[#1][]%
- \doinputonce{\getvalue{\??fi#1\c!file}}%
- \doifelsenothing{#2}
- {\setvalue{#3}{\verwerkexternefile{#1}{#3}{#4}}}
- {\setvalue{#2}{\verwerkexternefile{#1}{#3}{#4}}}}
-
-\def\useexternalfile
- {\doquadrupleargument\douseexternalfile}
-
-\useexternalfiles
- [pictex]
- [\c!bodyfont=\v!small,
- \c!file=pictex]
-
-\useexternalfiles
- [table]
- [\c!file=table]
-
%D A couple of examples, demonstrating how the depth is
%D taken care of:
%D
diff --git a/tex/context/base/core-par.mkii b/tex/context/base/core-par.mkii
new file mode 100644
index 000000000..0b283b294
--- /dev/null
+++ b/tex/context/base/core-par.mkii
@@ -0,0 +1,300 @@
+%D \module
+%D [ file=core-par,
+%D version=1997.03.31,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Paragraph Tricks,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Core Macros / Pararaph Tricks}
+
+\unprotect
+
+% \ifprocesspreviousparagraphs
+%
+% \nofskippedparagraphs
+% \paragraphnumber
+% \nofparagraphs
+%
+% \dosetparagraph
+% \doresetparagraph
+% \dobeforeparagraph
+% \doafterparagraph
+% \dobeforeskipparagraph
+% \doafterskipparagraph
+%
+% \pushparagraphs\endcommand alle alineas tot \endcommand laden
+% \pushmoreparagraphs\endcommand alle alineas tot \endcommand toevoegen
+% \popparagraphs alle alineas oproepen
+% \popparagraphs[a,b,c] enkele alineas oproepen [geen]
+%
+% tzt een optionele prefix:
+%
+% \pushparagraphs[xxx]\endcommand alle alineas tot \endcommand laden
+% \popparagraphs[xxx] alle alineas oproepen
+% \popparagraphs[xxx][a,b,c] enkele alineas oproepen
+%
+% \numberparagraphs
+% \numberparagraphlines
+% \resetparagraphlines
+
+\newif\ifprocesspreviousparagraphs % public
+\newif\ifprocessallparagraphs % private
+
+\newcounter\totalnofparagraphs % private
+\newcounter\globalparagraphnumber % private
+\newcounter\discardedparagraphs % private
+\newcounter\mostrecentparagraphtotal % public
+
+\let\dosetparagraph = \relax % public
+\let\doresetparagraph = \relax % public
+\let\dobeforeparagraph = \relax % public
+\let\doafterparagraph = \relax % public
+\let\dobeforeskipparagraph = \relax % public
+\let\doafterskipparagraph = \relax % public
+
+\def\paragraphnumber {} % public
+\def\nofparagraphs {} % public
+\def\nofskippedparagraphs {} % public
+
+\def\paragraphprefix {paragraph} % private
+
+% voorlopig, wordt nog class
+
+\def\resetparagraphlines
+ {\global\linenumber\plusone}
+
+\def\numberparagraphs % instelbaar maken en slimmer ivm breedte regelnummer !!!!!
+ {\processpreviousparagraphstrue
+ \def\dosetparagraph
+ {\bgroup
+ \resetparagraphlines
+ \EveryPar
+ {\strut\inleftmargin{\tf{\tx\paragraphnumber}\kern2em}%
+ \ignorespaces}}%
+ \def\doresetparagraph
+ {\resetparagraphlines
+ \egroup}}
+
+\def\numberparagraphlines
+ {\processpreviousparagraphstrue
+ \def\dosetparagraph
+ {\resetparagraphlines}%
+ \def\doresetparagraph
+ {\resetparagraphlines}%
+ \def\dobeforeparagraph
+ {\startlinenumbering[\v!continue]}%
+ \def\doafterparagraph
+ {\stoplinenumbering}%
+ \def\dobeforeskipparagraph
+ {\stoplinenumbering
+ \let\paragraphnumber\relax}%
+ \def\doafterskipparagraph
+ {\startlinenumbering[\v!continue]}}
+
+\long\def\directpushparagraph#1%
+ {\doglobal\increment\totalnofparagraphs
+ \ifnum\totalnofparagraphs>0\nofskippedparagraphs\relax
+ \setgvalue{\paragraphprefix\totalnofparagraphs}{#1}%
+ \else
+ \setgvalue{\paragraphprefix\totalnofparagraphs}{\skipparagraph#1\par}%
+ \fi}
+
+\long\def\directskipparagraph#1%
+ {\doglobal\increment\totalnofparagraphs
+ \setgvalue{\paragraphprefix\totalnofparagraphs}{\skipparagraph#1\par}}
+
+\def\dopushparagraphs#1%
+ {\global\let\mostrecentparagraphtotal\totalnofparagraphs
+ \ifx#1\undefined
+ \let#1\relax
+ \fi
+ \defconvertedargument\asciia{#1}%
+ \defconvertedargument\asciib{ }% % lege regel
+ \def\dopushparagraph##1\par
+ {\defconvertedargument\asciic{##1}%
+ \doifelse\asciic\asciia
+ {#1}
+ {\doifsomething\asciic % lege paragraaf
+ {\doifnot\asciic\asciib
+ {\directpushparagraph{#1}}}%
+ \dopushparagraph}}%
+ \dopushparagraph}
+
+\def\pushparagraphs
+ {\doglobal\newcounter\totalnofparagraphs
+ \dopushparagraphs}
+
+\def\pushmoreparagraphs
+ {\dopushparagraphs}
+
+\def\dododopopparagraph#1% no grouping, i.v.m. sidefloats
+ {\ifnum#1>\totalnofparagraphs\relax
+ \else
+ \let\paragraphnumber\globalparagraphnumber
+ \decrement(\paragraphnumber,\discardedparagraphs)%
+ \dobeforeparagraph
+ \ifhmode\indentation\fi\getvalue{\paragraphprefix#1}\par
+ \doafterparagraph
+ \fi}
+
+\long\def\skipparagraph#1\par
+ {\doglobal\increment\discardedparagraphs
+ \ifprocessallparagraphs
+ \dobeforeskipparagraph
+ \ifhmode\indentation\fi#1\par
+ \doafterskipparagraph
+ \fi}
+
+\def\dodopopparagraph
+ {\dododopopparagraph}
+
+\def\dodoprocessparagraph#1%
+ {\ifprocesspreviousparagraphs
+ \bgroup
+ \setbox0\vbox{\dododopopparagraph{#1}}%
+ \egroup
+ \fi}
+
+\def\processpreviousparagraphs[#1]% process previous ones
+ {\ifprocesspreviousparagraphs
+ \bgroup
+ \getfromcommacommand[#1][1]% tzt snelle \..command.. testen
+ \let\totalnofparagraphs\commalistelement
+ \decrement\totalnofparagraphs
+ \let\dodopopparagraph\dodoprocessparagraph
+ \popparagraphs
+ \egroup
+ \fi}
+
+\def\dopopparagraphs[#1]%
+ {\doifnotinset{#1}{\v!none,0}
+ {\dosetparagraph
+ \doglobal\newcounter\globalparagraphnumber
+ \doglobal\newcounter\discardedparagraphs
+ \doifelse{#1}{}
+ {\processallparagraphstrue}
+ {\processallparagraphsfalse}%
+ \def\dopopparagraph
+ {\doglobal\increment\globalparagraphnumber
+ \ifnum\globalparagraphnumber>\totalnofparagraphs\relax
+ \let\dopopparagraph\relax
+ \else\ifprocessallparagraphs
+ \ifnum\globalparagraphnumber>\mostrecentparagraphtotal\relax
+ \dodopopparagraph\globalparagraphnumber
+ \else
+ \dodoprocessparagraph\globalparagraphnumber
+ \fi
+ \else
+ \let\paragraphnumber\globalparagraphnumber
+ \decrement(\paragraphnumber,\discardedparagraphs)%
+ \ExpandBothAfter\doifinsetelse{\paragraphnumber}{#1}
+ {\dodopopparagraph\globalparagraphnumber}
+ {\dodoprocessparagraph\globalparagraphnumber}%
+ \fi\fi
+ \dopopparagraph}%
+ \dopopparagraph
+ \doresetparagraph}}
+
+\def\popparagraphs
+ {\dosingleempty\dopopparagraphs}
+
+\def\countparagraphs
+ {\popparagraphs[\!!maxcard]%
+ \global\let\nofparagraphs\totalnofparagraphs
+ \doglobal\decrement(\nofparagraphs,\discardedparagraphs)}
+
+% \showframe
+%
+% \numberparagraphlines
+% \numberparagraphs
+%
+% \def\nofskippedparagraphs{1}
+%
+% \pushparagraphs\ThatsIt
+%
+% \ruledbaseline eerste eerste eerste eerste eerste eerste
+% eerste eerste eerste eerste eerste eerste eerste eerste
+% eerste eerste eerste eerste eerste eerste eerste eerste
+% eerste eerste eerste eerste eerste eerste eerste eerste
+% eerste eerste eerste eerste eerste eerste eerste eerste
+% eerste eerste eerste eerste eerste
+%
+% \ruledbaseline eerste eerste eerste eerste eerste eerste
+% eerste eerste eerste eerste eerste eerste eerste eerste
+% eerste eerste eerste eerste eerste eerste eerste eerste
+% eerste eerste eerste eerste eerste eerste eerste eerste
+% eerste eerste eerste eerste eerste eerste eerste eerste
+% eerste eerste eerste eerste eerste
+%
+% \ruledbaseline tweede tweede tweede tweede tweede tweede
+% tweede tweede tweede tweede tweede tweede tweede tweede
+% tweede tweede tweede tweede tweede tweede tweede tweede
+% tweede tweede tweede tweede tweede tweede tweede tweede
+% tweede tweede tweede tweede tweede tweede tweede tweede
+% tweede tweede tweede tweede tweede tweede tweede tweede
+% tweede tweede tweede tweede tweede
+%
+% \skipparagraph \ruledbaseline skipped skipped skipped
+% skipped skipped skipped skipped skipped skipped skipped
+% skipped skipped skipped skipped skipped skipped skipped
+% skipped skipped
+%
+% \ruledbaseline derde derde derde derde derde derde derde
+% derde derde derde derde derde derde derde derde derde derde
+% derde derde derde derde derde derde derde derde derde derde
+% derde derde derde derde derde derde derde derde derde derde
+% derde derde derde derde derde derde derde derde derde derde
+% derde derde derde derde derde derde derde derde derde derde
+%
+% \skipparagraph \ruledbaseline skipped skipped skipped
+% skipped skipped skipped skipped skipped skipped skipped
+% skipped skipped skipped skipped skipped skipped skipped
+% skipped skipped skipped
+%
+% \ruledbaseline vierde vierde vierde vierde vierde vierde
+% vierde vierde vierde vierde vierde vierde vierde vierde
+% vierde vierde vierde vierde vierde vierde vierde vierde
+% vierde vierde vierde vierde
+%
+% \ruledbaseline vijfde vijfde vijfde vijfde vijfde vijfde
+% vijfde vijfde vijfde vijfde vijfde vijfde vijfde vijfde
+% vijfde vijfde vijfde vijfde vijfde vijfde vijfde vijfde
+% vijfde vijfde vijfde vijfde vijfde vijfde vijfde vijfde
+% vijfde vijfde vijfde
+%
+% \skipparagraph \ruledbaseline skipped skipped skipped
+% skipped skipped skipped skipped skipped skipped skipped
+% skipped skipped skipped skipped skipped skipped skipped
+% skipped skipped skipped
+%
+% \ThatsIt
+%
+% \popparagraphs
+%
+% \countparagraphs
+%
+% \blanko[2*groot]
+%
+% nofparagraphs:~\nofparagraphs
+%
+% \pagina
+%
+% \popparagraphs[1]
+% \popparagraphs[2]
+% \popparagraphs[3]
+% \popparagraphs[4]
+% \popparagraphs[5]
+%
+% \pagina
+%
+% \ruledvbox{\popparagraphs[1,2,3,4,5]}
+%
+% \pagina
+
+\protect \endinput
diff --git a/tex/context/base/core-par.tex b/tex/context/base/core-par.tex
deleted file mode 100644
index 0b283b294..000000000
--- a/tex/context/base/core-par.tex
+++ /dev/null
@@ -1,300 +0,0 @@
-%D \module
-%D [ file=core-par,
-%D version=1997.03.31,
-%D title=\CONTEXT\ Core Macros,
-%D subtitle=Paragraph Tricks,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Core Macros / Pararaph Tricks}
-
-\unprotect
-
-% \ifprocesspreviousparagraphs
-%
-% \nofskippedparagraphs
-% \paragraphnumber
-% \nofparagraphs
-%
-% \dosetparagraph
-% \doresetparagraph
-% \dobeforeparagraph
-% \doafterparagraph
-% \dobeforeskipparagraph
-% \doafterskipparagraph
-%
-% \pushparagraphs\endcommand alle alineas tot \endcommand laden
-% \pushmoreparagraphs\endcommand alle alineas tot \endcommand toevoegen
-% \popparagraphs alle alineas oproepen
-% \popparagraphs[a,b,c] enkele alineas oproepen [geen]
-%
-% tzt een optionele prefix:
-%
-% \pushparagraphs[xxx]\endcommand alle alineas tot \endcommand laden
-% \popparagraphs[xxx] alle alineas oproepen
-% \popparagraphs[xxx][a,b,c] enkele alineas oproepen
-%
-% \numberparagraphs
-% \numberparagraphlines
-% \resetparagraphlines
-
-\newif\ifprocesspreviousparagraphs % public
-\newif\ifprocessallparagraphs % private
-
-\newcounter\totalnofparagraphs % private
-\newcounter\globalparagraphnumber % private
-\newcounter\discardedparagraphs % private
-\newcounter\mostrecentparagraphtotal % public
-
-\let\dosetparagraph = \relax % public
-\let\doresetparagraph = \relax % public
-\let\dobeforeparagraph = \relax % public
-\let\doafterparagraph = \relax % public
-\let\dobeforeskipparagraph = \relax % public
-\let\doafterskipparagraph = \relax % public
-
-\def\paragraphnumber {} % public
-\def\nofparagraphs {} % public
-\def\nofskippedparagraphs {} % public
-
-\def\paragraphprefix {paragraph} % private
-
-% voorlopig, wordt nog class
-
-\def\resetparagraphlines
- {\global\linenumber\plusone}
-
-\def\numberparagraphs % instelbaar maken en slimmer ivm breedte regelnummer !!!!!
- {\processpreviousparagraphstrue
- \def\dosetparagraph
- {\bgroup
- \resetparagraphlines
- \EveryPar
- {\strut\inleftmargin{\tf{\tx\paragraphnumber}\kern2em}%
- \ignorespaces}}%
- \def\doresetparagraph
- {\resetparagraphlines
- \egroup}}
-
-\def\numberparagraphlines
- {\processpreviousparagraphstrue
- \def\dosetparagraph
- {\resetparagraphlines}%
- \def\doresetparagraph
- {\resetparagraphlines}%
- \def\dobeforeparagraph
- {\startlinenumbering[\v!continue]}%
- \def\doafterparagraph
- {\stoplinenumbering}%
- \def\dobeforeskipparagraph
- {\stoplinenumbering
- \let\paragraphnumber\relax}%
- \def\doafterskipparagraph
- {\startlinenumbering[\v!continue]}}
-
-\long\def\directpushparagraph#1%
- {\doglobal\increment\totalnofparagraphs
- \ifnum\totalnofparagraphs>0\nofskippedparagraphs\relax
- \setgvalue{\paragraphprefix\totalnofparagraphs}{#1}%
- \else
- \setgvalue{\paragraphprefix\totalnofparagraphs}{\skipparagraph#1\par}%
- \fi}
-
-\long\def\directskipparagraph#1%
- {\doglobal\increment\totalnofparagraphs
- \setgvalue{\paragraphprefix\totalnofparagraphs}{\skipparagraph#1\par}}
-
-\def\dopushparagraphs#1%
- {\global\let\mostrecentparagraphtotal\totalnofparagraphs
- \ifx#1\undefined
- \let#1\relax
- \fi
- \defconvertedargument\asciia{#1}%
- \defconvertedargument\asciib{ }% % lege regel
- \def\dopushparagraph##1\par
- {\defconvertedargument\asciic{##1}%
- \doifelse\asciic\asciia
- {#1}
- {\doifsomething\asciic % lege paragraaf
- {\doifnot\asciic\asciib
- {\directpushparagraph{#1}}}%
- \dopushparagraph}}%
- \dopushparagraph}
-
-\def\pushparagraphs
- {\doglobal\newcounter\totalnofparagraphs
- \dopushparagraphs}
-
-\def\pushmoreparagraphs
- {\dopushparagraphs}
-
-\def\dododopopparagraph#1% no grouping, i.v.m. sidefloats
- {\ifnum#1>\totalnofparagraphs\relax
- \else
- \let\paragraphnumber\globalparagraphnumber
- \decrement(\paragraphnumber,\discardedparagraphs)%
- \dobeforeparagraph
- \ifhmode\indentation\fi\getvalue{\paragraphprefix#1}\par
- \doafterparagraph
- \fi}
-
-\long\def\skipparagraph#1\par
- {\doglobal\increment\discardedparagraphs
- \ifprocessallparagraphs
- \dobeforeskipparagraph
- \ifhmode\indentation\fi#1\par
- \doafterskipparagraph
- \fi}
-
-\def\dodopopparagraph
- {\dododopopparagraph}
-
-\def\dodoprocessparagraph#1%
- {\ifprocesspreviousparagraphs
- \bgroup
- \setbox0\vbox{\dododopopparagraph{#1}}%
- \egroup
- \fi}
-
-\def\processpreviousparagraphs[#1]% process previous ones
- {\ifprocesspreviousparagraphs
- \bgroup
- \getfromcommacommand[#1][1]% tzt snelle \..command.. testen
- \let\totalnofparagraphs\commalistelement
- \decrement\totalnofparagraphs
- \let\dodopopparagraph\dodoprocessparagraph
- \popparagraphs
- \egroup
- \fi}
-
-\def\dopopparagraphs[#1]%
- {\doifnotinset{#1}{\v!none,0}
- {\dosetparagraph
- \doglobal\newcounter\globalparagraphnumber
- \doglobal\newcounter\discardedparagraphs
- \doifelse{#1}{}
- {\processallparagraphstrue}
- {\processallparagraphsfalse}%
- \def\dopopparagraph
- {\doglobal\increment\globalparagraphnumber
- \ifnum\globalparagraphnumber>\totalnofparagraphs\relax
- \let\dopopparagraph\relax
- \else\ifprocessallparagraphs
- \ifnum\globalparagraphnumber>\mostrecentparagraphtotal\relax
- \dodopopparagraph\globalparagraphnumber
- \else
- \dodoprocessparagraph\globalparagraphnumber
- \fi
- \else
- \let\paragraphnumber\globalparagraphnumber
- \decrement(\paragraphnumber,\discardedparagraphs)%
- \ExpandBothAfter\doifinsetelse{\paragraphnumber}{#1}
- {\dodopopparagraph\globalparagraphnumber}
- {\dodoprocessparagraph\globalparagraphnumber}%
- \fi\fi
- \dopopparagraph}%
- \dopopparagraph
- \doresetparagraph}}
-
-\def\popparagraphs
- {\dosingleempty\dopopparagraphs}
-
-\def\countparagraphs
- {\popparagraphs[\!!maxcard]%
- \global\let\nofparagraphs\totalnofparagraphs
- \doglobal\decrement(\nofparagraphs,\discardedparagraphs)}
-
-% \showframe
-%
-% \numberparagraphlines
-% \numberparagraphs
-%
-% \def\nofskippedparagraphs{1}
-%
-% \pushparagraphs\ThatsIt
-%
-% \ruledbaseline eerste eerste eerste eerste eerste eerste
-% eerste eerste eerste eerste eerste eerste eerste eerste
-% eerste eerste eerste eerste eerste eerste eerste eerste
-% eerste eerste eerste eerste eerste eerste eerste eerste
-% eerste eerste eerste eerste eerste eerste eerste eerste
-% eerste eerste eerste eerste eerste
-%
-% \ruledbaseline eerste eerste eerste eerste eerste eerste
-% eerste eerste eerste eerste eerste eerste eerste eerste
-% eerste eerste eerste eerste eerste eerste eerste eerste
-% eerste eerste eerste eerste eerste eerste eerste eerste
-% eerste eerste eerste eerste eerste eerste eerste eerste
-% eerste eerste eerste eerste eerste
-%
-% \ruledbaseline tweede tweede tweede tweede tweede tweede
-% tweede tweede tweede tweede tweede tweede tweede tweede
-% tweede tweede tweede tweede tweede tweede tweede tweede
-% tweede tweede tweede tweede tweede tweede tweede tweede
-% tweede tweede tweede tweede tweede tweede tweede tweede
-% tweede tweede tweede tweede tweede tweede tweede tweede
-% tweede tweede tweede tweede tweede
-%
-% \skipparagraph \ruledbaseline skipped skipped skipped
-% skipped skipped skipped skipped skipped skipped skipped
-% skipped skipped skipped skipped skipped skipped skipped
-% skipped skipped
-%
-% \ruledbaseline derde derde derde derde derde derde derde
-% derde derde derde derde derde derde derde derde derde derde
-% derde derde derde derde derde derde derde derde derde derde
-% derde derde derde derde derde derde derde derde derde derde
-% derde derde derde derde derde derde derde derde derde derde
-% derde derde derde derde derde derde derde derde derde derde
-%
-% \skipparagraph \ruledbaseline skipped skipped skipped
-% skipped skipped skipped skipped skipped skipped skipped
-% skipped skipped skipped skipped skipped skipped skipped
-% skipped skipped skipped
-%
-% \ruledbaseline vierde vierde vierde vierde vierde vierde
-% vierde vierde vierde vierde vierde vierde vierde vierde
-% vierde vierde vierde vierde vierde vierde vierde vierde
-% vierde vierde vierde vierde
-%
-% \ruledbaseline vijfde vijfde vijfde vijfde vijfde vijfde
-% vijfde vijfde vijfde vijfde vijfde vijfde vijfde vijfde
-% vijfde vijfde vijfde vijfde vijfde vijfde vijfde vijfde
-% vijfde vijfde vijfde vijfde vijfde vijfde vijfde vijfde
-% vijfde vijfde vijfde
-%
-% \skipparagraph \ruledbaseline skipped skipped skipped
-% skipped skipped skipped skipped skipped skipped skipped
-% skipped skipped skipped skipped skipped skipped skipped
-% skipped skipped skipped
-%
-% \ThatsIt
-%
-% \popparagraphs
-%
-% \countparagraphs
-%
-% \blanko[2*groot]
-%
-% nofparagraphs:~\nofparagraphs
-%
-% \pagina
-%
-% \popparagraphs[1]
-% \popparagraphs[2]
-% \popparagraphs[3]
-% \popparagraphs[4]
-% \popparagraphs[5]
-%
-% \pagina
-%
-% \ruledvbox{\popparagraphs[1,2,3,4,5]}
-%
-% \pagina
-
-\protect \endinput
diff --git a/tex/context/base/core-spa.lua b/tex/context/base/core-spa.lua
index 0f308b19c..0e33bf609 100644
--- a/tex/context/base/core-spa.lua
+++ b/tex/context/base/core-spa.lua
@@ -25,7 +25,7 @@ local trace_vspacing = false trackers.register("nodes.vspacing",
local has_attribute = node.has_attribute
local unset_attribute = node.unset_attribute
local set_attribute = node.set_attribute
-local slide_node_list = node.slide
+local find_node_tail = node.tail
local free_node = node.free
local copy_node = node.copy
local traverse_nodes = node.traverse
@@ -35,6 +35,7 @@ local remove_node = nodes.remove
local make_penalty_node = nodes.penalty
local count_nodes = nodes.count
local node_ids_to_string = nodes.ids_to_string
+local hpack_node = node.hpack
local glyph = node.id("glyph")
local penalty = node.id("penalty")
@@ -42,6 +43,7 @@ local kern = node.id("kern")
local glue = node.id('glue')
local hlist = node.id('hlist')
local vlist = node.id('vlist')
+local adjust = node.id('adjust')
vspacing = vspacing or { }
@@ -550,7 +552,7 @@ local function collapser(head,where,what,trace) -- maybe also pass tail
current = current.next
end
end
- local tail = slide_node_list(head) -- still needed, check previous code ?
+ local tail = find_node_tail(head) -- still needed, check previous code ?
if trace then trace_info("stop analyzing",where,what) end
--~ if natural_penalty and (not penalty_data or natural_penalty > penalty_data) then
--~ penalty_data = natural_penalty
@@ -596,7 +598,7 @@ function nodes.handle_page_spacing(where)
local newhead = texlists.contrib_head
if newhead then
statistics.starttiming(vspacing)
- local newtail = slide_node_list(newhead)
+ local newtail = find_node_tail(newhead)
local flush = false
for n in traverse_nodes(newhead) do
local id = n.id
@@ -655,7 +657,7 @@ local ignore = table.tohash {
function nodes.handle_vbox_spacing(head,where)
if head and not ignore[where] and head.next then
statistics.starttiming(vspacing)
- head = collapser(slide_node_list(head),"vbox",where,trace_vbox_vspacing)
+ head = collapser(head,"vbox",where,trace_vbox_vspacing)
statistics.stoptiming(vspacing)
end
return head
@@ -679,3 +681,54 @@ function vspacing.disable()
callback.register('vpack_filter', nil)
callback.register('buildpage_filter', nil)
end
+
+-- we will split this module
+
+local attribute = attributes.private('graphicvadjust')
+
+--~ local hlist = node.id('hlist')
+--~ local vlist = node.id('vlist')
+
+--~ local remove_node = nodes.remove
+--~ local hpack_node = node.hpack
+--~ local has_attribute = node.has_attribute
+
+function nodes.repackage_graphicvadjust(head,groupcode) -- we can make an actionchain for mvl only
+ if groupcode == "" then -- mvl only
+ local h, p, done = head, nil, false
+ while h do
+ local id = h.id
+ if id == hlist or id == vlist then
+ local a = has_attribute(h,attribute)
+ if a then
+ if p then
+ local n
+ head, h, n = remove_node(head,h)
+ local pl = p.list
+ if n.width ~= 0 then
+ n = hpack_node(n,0,'exactly')
+ end
+ if pl then
+ pl.prev = n
+ n.next = pl
+ end
+ p.list = n
+ done = true
+ else
+ -- can't happen
+ end
+ else
+ p = h
+ h = h.next
+ end
+ else
+ h = h.next
+ end
+ end
+ return head, done
+ else
+ return head, false
+ end
+end
+
+--~ tasks.appendaction("finalizers", "lists", "nodes.repackage_graphicvadjust")
diff --git a/tex/context/base/core-spa.mkii b/tex/context/base/core-spa.mkii
index 356b2cbe3..7c97bcc9c 100644
--- a/tex/context/base/core-spa.mkii
+++ b/tex/context/base/core-spa.mkii
@@ -298,32 +298,34 @@
\def\defineblankmethod[#1]#2{\setvalue{\??bo\??bo#1}{#2}}
-\defineblankmethod [\v!big] {\addblankskip+\bigskipamount \openlineheight}
-\defineblankmethod [-\v!big] {\addblankskip-\bigskipamount \openlineheight}
-\defineblankmethod [\v!medium] {\addblankskip+\medskipamount {.5\openlineheight}}
-\defineblankmethod [-\v!medium] {\addblankskip-\medskipamount {.5\openlineheight}}
-\defineblankmethod [\v!small] {\addblankskip+\smallskipamount{.25\openlineheight}}
-\defineblankmethod [-\v!small] {\addblankskip-\smallskipamount{.25\openlineheight}}
-\defineblankmethod [\v!white] {\addblankskip+\parskip \openlineheight}
-\defineblankmethod [-\v!white] {\addblankskip-\parskip \openlineheight}
-\defineblankmethod [\v!line] {\addblankskip+\openlineheight \openlineheight}
-\defineblankmethod [-\v!line] {\addblankskip-\openlineheight \openlineheight}
-
-\defineblankmethod [\v!formula] {\global\advance\blankskip\medskipamount}
-\defineblankmethod [\v!nowhite] {\global\blanknowhitetrue}
-\defineblankmethod [\v!disable] {\global\blankdisabletrue}
-\defineblankmethod [\v!force] {\global\blankforcetrue}
-\defineblankmethod [\v!outer] {\ifvmode\ifinner\blankoutertrue\fi\fi}
-\defineblankmethod [\v!reset] {\global\blankresettrue}
-\defineblankmethod [\v!flexible] {\global\localblankflexibletrue}
-\defineblankmethod [\v!fixed] {\global\localblankfixedtrue}
-\defineblankmethod [\v!back] {\global\blankgobacktrue} % {\geenblanko}
-\defineblankmethod [\v!halfline] {\ifgridsnapping\global\fuzzyvskiptrue\fi
- \global\advance\blankskip .5\lineheight}
-
-\defineblankmethod [\v!none] {\global\blankresettrue}
-\defineblankmethod [\v!joinedup] {\ifvmode\nointerlineskip\fi}
-
+\defineblankmethod [\v!big] {\addblankskip+\bigskipamount \openlineheight}
+\defineblankmethod [-\v!big] {\addblankskip-\bigskipamount \openlineheight}
+\defineblankmethod [\v!medium] {\addblankskip+\medskipamount {.5\openlineheight}}
+\defineblankmethod [-\v!medium] {\addblankskip-\medskipamount {.5\openlineheight}}
+\defineblankmethod [\v!small] {\addblankskip+\smallskipamount{.25\openlineheight}}
+\defineblankmethod [-\v!small] {\addblankskip-\smallskipamount{.25\openlineheight}}
+\defineblankmethod [\v!white] {\addblankskip+\parskip \openlineheight}
+\defineblankmethod [-\v!white] {\addblankskip-\parskip \openlineheight}
+\defineblankmethod [\v!line] {\addblankskip+\openlineheight \openlineheight}
+\defineblankmethod [-\v!line] {\addblankskip-\openlineheight \openlineheight}
+
+\defineblankmethod [\v!formula] {\global\advance\blankskip\medskipamount}
+\defineblankmethod [\v!nowhite] {\global\blanknowhitetrue}
+\defineblankmethod [\v!disable] {\global\blankdisabletrue}
+\defineblankmethod [\v!force] {\global\blankforcetrue}
+\defineblankmethod [\v!outer] {\ifvmode\ifinner\blankoutertrue\fi\fi}
+\defineblankmethod [\v!reset] {\global\blankresettrue}
+\defineblankmethod [\v!flexible] {\global\localblankflexibletrue}
+\defineblankmethod [\v!fixed] {\global\localblankfixedtrue}
+\defineblankmethod [\v!back] {\global\blankgobacktrue} % {\geenblanko}
+\defineblankmethod [\v!halfline] {\ifgridsnapping\global\fuzzyvskiptrue\fi
+ \global\advance\blankskip .5\lineheight}
+\defineblankmethod [\v!none] {\global\blankresettrue}
+\defineblankmethod [\v!joinedup] {\ifvmode\nointerlineskip\fi}
+\defineblankmethod[\v!synchronize] {\verticalstrut\vskip-2\lineheight\verticalstrut}
+
+% \vtop{\blank[synchronize]\blank[line]test}
+
\defineblankmethod [\v!always] {\redowhitespace} % experimental
% happens often, so we speed this up:
@@ -4571,10 +4573,9 @@
\gdef\afterfirstobeyedline % tzt two pass, net als opsomming
{\gdef\afterfirstobeyedline
{\nobreak
- \global\let\afterfirstobeyedline\relax}}%
+ \doifnot\@@rgoption\v!packed{\global\let\afterfirstobeyedline\relax}}}%
\def\obeyedline
{\par
- \afterfirstobeyedline
\futurelet\next\dobetweenthelines}%
\activatespacehandler\@@rgspace
\GotoPar}
@@ -4585,10 +4586,13 @@
\@@rgafter}
\def\dobetweenthelines
- {\doifmeaningelse\next\obeyedline\@@rginbetween\donothing}
+ {\doifmeaningelse\next\obeyedline
+ {\@@rginbetween}
+ {\afterfirstobeyedline}}
\setuplines
- [\c!before=\blank,
+ [\c!option=,
+ \c!before=\blank,
\c!after=\blank,
\c!inbetween=\blank,
\c!indenting=\v!no,
diff --git a/tex/context/base/core-spa.mkiv b/tex/context/base/core-spa.mkiv
index fbc949349..ad59f7779 100644
--- a/tex/context/base/core-spa.mkiv
+++ b/tex/context/base/core-spa.mkiv
@@ -30,13 +30,12 @@
\let \baselinecorrection \relax
\let \offbaselinecorrection \relax
-\appendtoks \spacing 1\to \everybodyfont
+\appendtoks \spacing\plusone \to \everybodyfont
\appendtoks \presetnormallineheight \to \everybodyfont
\appendtoks \setnormalbaselines \to \everybodyfont % check if redundant
\appendtoks \setstrut \to \everybodyfont % check if redundant
\appendtoks \settopskip \to \everybodyfont
\appendtoks \setmaxdepth \to \everybodyfont
-%appendtoks \spacing 1\to \everybodyfont
\appendtoks \simplesetupindenting \to \everybodyfont
\appendtoks \simplesetupblank \to \everybodyfont
\appendtoks \simplesetupwhitespace \to \everybodyfont
@@ -87,7 +86,7 @@
\global\let\carriedoverpar\relax
\def\carryoverpar#1%
- {\expanded % \scratchtoks{#1}%
+ {\normalexpanded % \scratchtoks{#1}%
{\noexpand#1% \the\scratchtoks
\hangindent\the\hangindent
\hangafter \the\hangafter
@@ -284,32 +283,34 @@
\def\defineblankmethod[#1]#2{\setvalue{\??bo\??bo#1}{#2}}
-\defineblankmethod [\v!big] {\addblankskip+\bigskipamount \openlineheight}
-\defineblankmethod [-\v!big] {\addblankskip-\bigskipamount \openlineheight}
-\defineblankmethod [\v!medium] {\addblankskip+\medskipamount {.5\openlineheight}}
-\defineblankmethod [-\v!medium] {\addblankskip-\medskipamount {.5\openlineheight}}
-\defineblankmethod [\v!small] {\addblankskip+\smallskipamount{.25\openlineheight}}
-\defineblankmethod [-\v!small] {\addblankskip-\smallskipamount{.25\openlineheight}}
-\defineblankmethod [\v!white] {\addblankskip+\parskip \openlineheight}
-\defineblankmethod [-\v!white] {\addblankskip-\parskip \openlineheight}
-\defineblankmethod [\v!line] {\addblankskip+\openlineheight \openlineheight}
-\defineblankmethod [-\v!line] {\addblankskip-\openlineheight \openlineheight}
-
-\defineblankmethod [\v!formula] {\global\advance\blankskip\medskipamount}
-\defineblankmethod [\v!nowhite] {\global\blanknowhitetrue}
-\defineblankmethod [\v!disable] {\global\blankdisabletrue}
-\defineblankmethod [\v!force] {\global\blankforcetrue}
-\defineblankmethod [\v!outer] {\ifvmode\ifinner\blankoutertrue\fi\fi}
-\defineblankmethod [\v!reset] {\global\blankresettrue}
-\defineblankmethod [\v!flexible] {\global\localblankflexibletrue}
-\defineblankmethod [\v!fixed] {\global\localblankfixedtrue}
-\defineblankmethod [\v!back] {\global\blankgobacktrue} % {\geenblanko}
-\defineblankmethod [\v!halfline] {\ifgridsnapping\global\fuzzyvskiptrue\fi
- \global\advance\blankskip .5\lineheight}
-
-\defineblankmethod [\v!none] {\global\blankresettrue}
-\defineblankmethod [\v!joinedup] {\ifvmode\nointerlineskip\fi}
-
+\defineblankmethod [\v!big] {\addblankskip+\bigskipamount \openlineheight}
+\defineblankmethod [-\v!big] {\addblankskip-\bigskipamount \openlineheight}
+\defineblankmethod [\v!medium] {\addblankskip+\medskipamount {.5\openlineheight}}
+\defineblankmethod [-\v!medium] {\addblankskip-\medskipamount {.5\openlineheight}}
+\defineblankmethod [\v!small] {\addblankskip+\smallskipamount{.25\openlineheight}}
+\defineblankmethod [-\v!small] {\addblankskip-\smallskipamount{.25\openlineheight}}
+\defineblankmethod [\v!white] {\addblankskip+\parskip \openlineheight}
+\defineblankmethod [-\v!white] {\addblankskip-\parskip \openlineheight}
+\defineblankmethod [\v!line] {\addblankskip+\openlineheight \openlineheight}
+\defineblankmethod [-\v!line] {\addblankskip-\openlineheight \openlineheight}
+
+\defineblankmethod [\v!formula] {\global\advance\blankskip\medskipamount}
+\defineblankmethod [\v!nowhite] {\global\blanknowhitetrue}
+\defineblankmethod [\v!disable] {\global\blankdisabletrue}
+\defineblankmethod [\v!force] {\global\blankforcetrue}
+\defineblankmethod [\v!outer] {\ifvmode\ifinner\blankoutertrue\fi\fi}
+\defineblankmethod [\v!reset] {\global\blankresettrue}
+\defineblankmethod [\v!flexible] {\global\localblankflexibletrue}
+\defineblankmethod [\v!fixed] {\global\localblankfixedtrue}
+\defineblankmethod [\v!back] {\global\blankgobacktrue} % {\geenblanko}
+\defineblankmethod [\v!halfline] {\ifgridsnapping\global\fuzzyvskiptrue\fi
+ \global\advance\blankskip .5\lineheight}
+\defineblankmethod [\v!none] {\global\blankresettrue}
+\defineblankmethod [\v!joinedup] {\ifvmode\nointerlineskip\fi}
+\defineblankmethod[\v!synchronize] {\verticalstrut\vskip-2\lineheight\verticalstrut}
+
+% \vtop{\blank[synchronize]\blank[line]test}
+
\defineblankmethod [\v!always] {\redowhitespace} % experimental
% happens often, so we speed this up:
@@ -443,7 +444,7 @@
\else\ifcsname\??bo\ascii\endcsname % user def / slow
\@EA\rawprocesscommalist\@EA[\csname\??bo\ascii\endcsname]\doblank\relax
\else
- \expanded{\rawprocesscommalist[#1]}\doblank
+ \rawprocesscommacommand[#1]\doblank
\fi\fi
%
\relax % to be sure
@@ -642,13 +643,11 @@
{\ifgridsnapping
\blankflexiblefalse
\else
- \ExpandFirstAfter\processallactionsinset
- [#1]
+ \normalexpanded{\noexpand\processallactionsinset[#1]}
[ \v!flexible=>\blankflexibletrue,
\v!fixed=>\blankflexiblefalse]%
\fi
- \ExpandFirstAfter\processallactionsinset
- [#1]
+ \normalexpanded{\noexpand\processallactionsinset[#1]}
[ \v!flexible=>\dosetupblank\appliedblankskip,
\v!fixed=>\dosetupblank\appliedblankskip,
\v!line=>\edef\appliedblankskip{\linedistance}%
@@ -698,17 +697,22 @@
\def\defineblank
{\dodoubleargument\dodefineblank}
-\def\savecurrentblank
- {\edef\restorecurrentblank
- {\bigskipamount\the\bigskipamount
- \medskipamount\the\medskipamount
- \smallskipamount\the\smallskipamount
- \noexpand\def\noexpand\currentblank{\currentblank}%
- \ifblankflexible
- \noexpand\blankflexibletrue
- \else
- \noexpand\blankflexiblefalse
- \fi}}
+% \def\savecurrentblank
+% {\edef\restorecurrentblank
+% {\bigskipamount\the\bigskipamount
+% \medskipamount\the\medskipamount
+% \smallskipamount\the\smallskipamount
+% \noexpand\def\noexpand\currentblank{\currentblank}%
+% \ifblankflexible
+% \noexpand\blankflexibletrue
+% \else
+% \noexpand\blankflexiblefalse
+% \fi}}
+
+\def\savecurrentblank {\edef\savedcurrentblank{\currentblank}}
+\def\restorecurrentblank{\edef\currentblank{\savedcurrentblank}}
+
+\def\savedcurrentblank{\currentblank}
%D Now.
@@ -764,11 +768,12 @@
\toggleindentation}}
\def\docomplexsetupindentingA#1%
- {\edefconvertedargument\!!stringa{#1}%
- \doifundefined{\??in:\!!stringa}%
- {\edef\currentindentation{#1}%
- \let\normalindentation\currentindentation
- \simplesetupindenting}}
+ {\edefconvertedargument\!!stringa{#1}% can this be doen differently now?
+ \ifcsname\??in:\!!stringa\endcsname \else
+ \edef\currentindentation{#1}%
+ \let\normalindentation\currentindentation
+ \simplesetupindenting
+ \fi}
\def\docomplexsetupindentingB#1%
{\edefconvertedargument\!!stringa{#1}% catch #1=\somedimen
@@ -1070,25 +1075,23 @@
\def\fixedspaces
{\letcatcodecommand \ctxcatcodes `\~ \fixedspace}
-\def\removeunwantedspaces
- {\ifhmode % we also need to unskip 0pt skips
- \unskip\unskip\unskip\unskip\unskip
- \unskip\unskip\unskip\unskip\unskip
- \fi}
-
\appendtoks\let~\space\to\simplifiedcommands
-% still not fixed in aleph / luatex
-%
% \def\removeunwantedspaces
-% {\ifhmode \ifnum\lastnodetype=\@@gluenode
-% \unskip \@EAEAEA\removeunwantedspaces
-% \fi \fi}
+% {\ifhmode % we also need to unskip 0pt skips
+% \unskip\unskip\unskip\unskip\unskip
+% \unskip\unskip\unskip\unskip\unskip
+% \fi}
-%D For old time sake, will disappear soon.
+\def\removeunwantedspaces
+ {\ifhmode
+ \expandafter \doremoveunwantedspace
+ \fi}
-\let\hardespatie\fixedspace
-\let\geenspatie \nospace
+\def\doremoveunwantedspace
+ {\ifnum\lastnodetype=\@@gluenode
+ \unskip \expandafter\doremoveunwantedspace
+ \fi}
% \startbuffer
% \startlines \tt \fixedspaces
@@ -1367,16 +1370,21 @@
\vskip\parskip
\fi}
-\def\savecurrentwhitespace
- {\edef\restorecurrentwhitespace
- {\ctxparskip\the\ctxparskip
- \parskip\the\parskip
- \noexpand\def\noexpand\currentwhitespace{\currentwhitespace}%
- \ifconditional\flexiblewhitespace
- \noexpand\settrue\flexiblewhitespace
- \else
- \noexpand\setfalse\flexiblewhitespace
- \fi}}
+% \def\savecurrentwhitespace
+% {\edef\restorecurrentwhitespace
+% {\ctxparskip\the\ctxparskip
+% \parskip\the\parskip
+% \noexpand\def\noexpand\currentwhitespace{\currentwhitespace}%
+% \ifconditional\flexiblewhitespace
+% \noexpand\settrue\flexiblewhitespace
+% \else
+% \noexpand\setfalse\flexiblewhitespace
+% \fi}}
+
+\def\savecurrentwhitespace {\edef\savedcurrentwhitespace{\currentwhitespace}}
+\def\restorecurrentwhitespace{\edef\currentwhitespace{\savedcurrentwhitespace}}
+
+\def\savedcurrentwhitespace{\currentwhitespace}
% deze variant is nodig binnen \startopelkaar
% steeds testen:
@@ -1403,6 +1411,37 @@
\def\noblanko
{\dosingleempty\nonoblanko}
+% I'm not sure if the restore is still needed. Anyway, when we do
+% restore, we get a parskip someplace in the output that will push
+% the content off page (\vbox to pageheight{skip smashed-box}) so
+% we have now disabled this hack. If it is introduced again it needs
+% to be more controlled. Test case:
+%
+% \setupwhitespace[big]
+% \starttext
+% \startcolumns[n=2]\dorecurse{200}{test\crlf}\stopcolumns
+% \stoptext
+%
+% \def\saveouterspacing
+% {\savecurrentblank
+% \savecurrentwhitespace
+% \def\restoreouterspacing
+% {\restorecurrentblank
+% \restorecurrentwhitespace}}
+%
+% \let\restoreouterspacing\relax
+% \let\saveouterspacing \relax % mult-ini: i will look into it when needed
+%
+% let's test this (restore before we restore the global bodyfont):
+
+\def\saveouterspacing
+ {\savecurrentblank
+ \savecurrentwhitespace}
+
+\def\restoreouterspacing
+ {\restorecurrentblank
+ \restorecurrentwhitespace}
+
% De onderstaande macro handelt ook de situatie dat er geen
% tekst tussen \start ... \stop is geplaatst. Daartoe wordt de
% laatste skip over de lege tekst heen gehaald. Dit komt goed
@@ -1562,7 +1601,7 @@
\def\strutdepth {0pt}
\def\strutwidth {0pt}
-\def\spacingfactor {1}
+\let\spacingfactor \plusone
\def\topskipfactor {1.0}
\def\maxdepthfactor {0.5}
@@ -1653,13 +1692,11 @@
\def\spacing#1%
{\ifgridsnapping
- \ifdim#1\points=\onepoint\else\showmessage\m!layouts{11}{#1}\fi
- \edef\spacingfactor{1}%
+ %\ifdim#1\points=\onepoint\else\showmessage\m!layouts{11}{\withoutpt\the\dimexpr#1\points\relax}\fi
+ \let\spacingfactor\plusone
\else
\edef\spacingfactor{#1}%
\fi
- %\setspacingfactor\systemtopskipfactor \topskipfactor {#1}% why no \spacingfactor ?
- %\setspacingfactor\systemmaxdepthfactor\maxdepthfactor{#1}% why no \spacingfactor ?
\edef\systemtopskipfactor {\withoutpt\the\dimexpr#1\dimexpr\topskipfactor \points}%
\edef\systemmaxdepthfactor{\withoutpt\the\dimexpr#1\dimexpr\maxdepthfactor\points}%
\setnormalbaselines
@@ -1697,9 +1734,8 @@
\newbox\strutbox
- \setbox\strutbox=\normalhbox{\vrule height8.5pt depth3.5pt width\zeropoint}
+ \setbox\strutbox\normalhbox{\vrule height8.5pt depth3.5pt width\zeropoint}
- %\def\strut{\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi}
\def\strut{\relax\ifmmode\copy\else\unhcopy\fi\strutbox}
\fi
@@ -1709,39 +1745,50 @@
% The double \hbox construction enables us to \backtrack
% boxes.
+\let\strutht\undefined \newdimen\strutht
+\let\strutdp\undefined \newdimen\strutdp
+
\unexpanded\def\setstrut
- {% height
- \edef\strutheight
- {\the\dimexpr\spacingfactor\dimexpr
- \ifdim\minimumstrutheight>\zeropoint
- \minimumstrutheight
- \else
- \strutheightfactor\dimexpr\normallineheight
- \fi}%
- % depth
- \edef\strutdepth
- {\the\dimexpr
- \ifgridsnapping
- \ifdim\minimumstrutdepth>\zeropoint
- \minimumstrutdepth
- \else
- \normallineheight-\strutheight
- \fi
- \else
- \spacingfactor\dimexpr
- \ifdim\minimumstrutdepth>\zeropoint
- \minimumstrutdepth
- \else
- \strutdepthfactor\dimexpr\normallineheight
- \fi
- \fi}%
- % finish
+ {\ifgridsnapping
+ \setstrutgridyes
+ \else
+ \setstrutgridnop
+ \fi}
+
+\unexpanded\def\setstrutgridyes
+ {\strutht\spacingfactor\dimexpr
+ \ifdim\minimumstrutheight>\zeropoint
+ \minimumstrutheight
+ \else
+ \strutheightfactor\dimexpr\normallineheight
+ \fi
+ \strutdp\dimexpr
+ \ifdim\minimumstrutdepth>\zeropoint
+ \minimumstrutdepth
+ \else
+ \normallineheight-\strutht
+ \fi
+ \dosetstrut}
+
+\unexpanded\def\setstrutgridnop
+ {\strutht\spacingfactor\dimexpr
+ \ifdim\minimumstrutheight>\zeropoint
+ \minimumstrutheight
+ \else
+ \strutheightfactor\dimexpr\normallineheight
+ \fi
+ \strutdp\spacingfactor\dimexpr
+ \ifdim\minimumstrutdepth>\zeropoint
+ \minimumstrutdepth
+ \else
+ \strutdepthfactor\dimexpr\normallineheight
+ \fi
\dosetstrut}
\unexpanded\def\setcharstrut#1%
{\setbox\strutbox\normalhbox{#1}%
- \edef\strutheight{\the\strutht}%
- \edef\strutdepth {\the\strutdp}%
+ \strutht\ht\strutbox
+ \strutdp\dp\strutbox
\dosetstrut}
\unexpanded\def\setfontstrut
@@ -1771,28 +1818,50 @@
\def\dosetstrut
{\let\strut\normalstrut
+ \edef\strutheight{\the\strutht}%
+ \edef\strutdepth {\the\strutdp}%
\ifdim\strutwidth=\zeropoint
- \setbox\strutbox\normalhbox
- {\vrule
- \!!width \zeropoint
- \!!height\strutheight
- \!!depth \strutdepth}%
+ \dosetstruthide
\else
- \setbox\strutbox\normalhbox
- {\normalhbox to \zeropoint
- {% \hss % new, will be option
- \vrule
- \!!width \strutwidth
- \!!height\strutheight
- \!!depth \strutdepth
- \hss}}%
+ \dosetstrutvide
\fi
\struttotal\dimexpr\strutht+\strutdp\relax}
+\def\dosetstruthide
+ {\setbox\strutbox\normalhbox
+ {\vrule
+ \!!width \zeropoint
+ \!!height\strutht
+ \!!depth \strutdp}}
+
+\def\dosetstrutvide
+ {\setbox\strutbox\normalhbox
+ {\normalhbox to \zeropoint
+ {% \hss % new, will be option
+ \vrule
+ \!!width \strutwidth
+ \!!height\strutht
+ \!!depth \strutdp
+ \hss}}}
+
%D The dimen \type {\struttotal} holds the exact size of the
%D strut; occasionally a one scaled point difference can show
%D up with the lineheight.
+% experiment
+
+\newbox\emptystrutbox \setbox\emptystrutbox\hbox{}
+
+\def\dosetstruthide
+ {\setbox\strutbox\copy\emptystrutbox
+ \ht\strutbox\strutht
+ \dp\strutbox\strutdp}
+
+\def\strut{\relax\dontleavehmode\copy\strutbox} % still callbacks for \hbox{\strut}
+
+
+\let\normalstrut\strut
+
%D Sometimes a capstrut comes in handy
%D
%D \starttabulate[|Tl|l|l|]
@@ -1828,9 +1897,9 @@
{\begingroup
\setbox\scratchbox\copy\strutbox
\setstrut
- \ifdim\ht\strutbox>\autostrutfactor\ht\scratchbox
+ \ifdim\strutht>\autostrutfactor\ht\scratchbox
\endgroup \setstrut
- \else\ifdim\dp\strutbox>\autostrutfactor\dp\scratchbox
+ \else\ifdim\strutdp>\autostrutfactor\dp\scratchbox
\endgroup \setstrut
\else
\endgroup
@@ -1938,15 +2007,21 @@
%D My own one:
+\def\dopushinterlineskip
+ {\edef\oninterlineskip
+ {\baselineskip\the\baselineskip
+ \lineskip\the\lineskip
+ \lineskiplimit\the\lineskiplimit
+ \let\noexpand\offinterlineskip\noexpand\normaloffinterlineskip}}
+
+\def\nopushinterlineskip
+ {\let\oninterlineskip\setnormalbaselines}
+
\def\offinterlineskip
{\ifdim\baselineskip>\zeropoint
- \edef\oninterlineskip
- {\baselineskip\the\baselineskip
- \lineskip\the\lineskip
- \lineskiplimit\the\lineskiplimit
- \let\noexpand\offinterlineskip\noexpand\normaloffinterlineskip}%
+ \dopushinterlineskip
\else
- \let\oninterlineskip\setnormalbaselines
+ \nopushinterlineskip
\fi
\normaloffinterlineskip}
@@ -2135,6 +2210,20 @@
\let\effectiveleftskip \@@effectiveleftskip
\let\effectiverightskip\@@effectiverightskip}
+% We will not use bodydir and pagedir so we disable them. That way we get
+% normal hyperlink support.
+
+\let\@@bodydir\normalbodydir
+\let\@@pagedir\normalpagedir
+
+\unexpanded\def\bodydir{\afterassignment\do@@bodydir\@@bodydir} \let\normalbodydir\bodydir
+\unexpanded\def\pagedir{\afterassignment\do@@pagedir\@@pagedir} \let\normalpagedir\pagedir
+
+\def\do@@bodydir{\@@bodydir TLT\relax}
+\def\do@@pagedir{\@@pagedir TLT\relax}
+
+% This will become a more advanced layout controller soon:
+
\unexpanded\def\lefttoright{\textdir TLT\pardir TLT\relax}
\unexpanded\def\righttoleft{\textdir TRT\pardir TRT\relax}
@@ -2185,7 +2274,7 @@
\v!center=>\def\raggedbox{\doalignedline\v!middle}]}
\def\dosetraggedcommand#1%
- {\expanded{\dodosetraggedcommand{#1}}}
+ {\normalexpanded{\noexpand\dodosetraggedcommand{#1}}}
\newtoks\everyraggedcommand
@@ -2369,7 +2458,7 @@
\appendtoks \forgetparindent \to \everyforgetall
\appendtoks \forgetbothskips \to \everyforgetall
\appendtoks \forgetspacing \to \everyforgetall % i.v.m. funny spacing in pagebody
-\appendtoks \spacing\!!plusone \to \everyforgetall % new per 10/08/2004, else problems in otr / !! needed
+\appendtoks \spacing\plusone \to \everyforgetall % new per 10/08/2004, else problems in otr / !! needed
\appendtoks \everypar\emptytoks \to \everyforgetall % indeed!
\def\localvbox#1#%
@@ -3352,14 +3441,12 @@
\def\dosetuptolerance[#1]%
{\doifinsetelse\v!vertical{#1}%
- {\ExpandFirstAfter\processallactionsinset
- [#1]
+ {\normalexpanded{\noexpand\processallactionsinset[#1]}
[ \v!verystrict=>\def\bottomtolerance{},
\v!strict=>\def\bottomtolerance{.050},
\v!tolerant=>\def\bottomtolerance{.075},
\v!verytolerant=>\def\bottomtolerance{.100}]}%
- {\ExpandFirstAfter\processallactionsinset
- [#1]
+ {\normalexpanded{\noexpand\processallactionsinset[#1]}
[ \v!stretch=>\emergencystretch\bodyfontsize,
\v!space=>\spaceskip.5em\!!plus.25em\!!minus.25em\relax,
\v!verystrict=>\tolerance 200,
@@ -3884,29 +3971,28 @@
\let\normalvadjust\vadjust
-% test this prikkels/pascal margin text before heads (mode
-% 1) as well as uitwerkingen (mode 2)
-
-%chardef\graphicvadjustmode=0 % fake
-%chardef\graphicvadjustmode=1 % normal
-\chardef\graphicvadjustmode=2 % normal + compensate (== default)
-
-\def\graphicvadjust % bad, those low level color calls here
+% \def\graphicvadjust % bad, those low level color calls here
+% {\dowithnextboxcontent
+% {\forgetall}
+% {\normalvadjust
+% {\unvbox\nextbox
+% % corrects for one line paragraphs
+% \nointerlineskip
+% \kern-\struttotal
+% \nointerlineskip
+% \verticalstrut}}%
+% \vbox}
+
+\def\graphicvadjust % nasty bidi handling
{\dowithnextboxcontent
{\forgetall}
- {\ifcase\graphicvadjustmode \@EA \fakedvadjust \else \@EA\normalvadjust \fi
- {\dostartgraphicgroup % don't ask
- \localstarttextcolor
- \unvbox\nextbox
- \localstoptextcolor % don't ask
- \dostopgraphicgroup
- \ifcase\graphicvadjustmode \or \or
- % corrects for one line paragraphs
- \nointerlineskip
- \kern-\struttotal
- \nointerlineskip
- \verticalstrut
- \fi}}%
+ {\vadjust{\vbox attr \graphicvadjustattribute \plusone
+ {\unvbox\nextbox
+ % corrects for one line paragraphs
+ \nointerlineskip
+ \kern-\struttotal
+ \nointerlineskip
+ \verticalstrut}}}%
\vbox}
%D This works only in a properly strutted line, and is meant
@@ -4029,10 +4115,9 @@
\gdef\afterfirstobeyedline % tzt two pass, net als opsomming
{\gdef\afterfirstobeyedline
{\nobreak
- \global\let\afterfirstobeyedline\relax}}%
+ \doifnot\@@rgoption\v!packed{\global\let\afterfirstobeyedline\relax}}}%
\def\obeyedline
{\par
- \afterfirstobeyedline
\futurelet\next\dobetweenthelines}%
\activatespacehandler\@@rgspace
\GotoPar}
@@ -4043,10 +4128,13 @@
\@@rgafter}
\def\dobetweenthelines
- {\doifmeaningelse\next\obeyedline\@@rginbetween\donothing}
+ {\doifmeaningelse\next\obeyedline
+ {\@@rginbetween}
+ {\afterfirstobeyedline}}
\setuplines
- [\c!before=\blank,
+ [\c!option=,
+ \c!before=\blank,
\c!after=\blank,
\c!inbetween=\blank,
\c!indenting=\v!no,
diff --git a/tex/context/base/core-stg.mkii b/tex/context/base/core-stg.mkii
new file mode 100644
index 000000000..429e1e894
--- /dev/null
+++ b/tex/context/base/core-stg.mkii
@@ -0,0 +1,72 @@
+%D \module
+%D [ file=core-stg,
+%D version=2006.08.16,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Strategies,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This is a prelude to strategies. It is rather old code
+%D used in a project many years ago. Use with care since I
+%D will pick up this thread. (moved from cont-new)
+
+\unprotect
+
+\def\s!strategy{strategy}
+
+\def\currentstrategypass {1}
+\def\currentstrategyvariable{0}
+\def\maximumstrategypass {8}
+
+\newconditional\strategypassneeded
+\newconditional\strategypassforced
+
+\definetwopasslist{\s!strategy}
+
+\def\registerstrategypass
+ {\ifnum\currentstrategypass>\maximumstrategypass \else
+ \ifconditional\strategypassforced
+ \doglobal\increment\currentstrategypass
+ \else%\ifconditional\strategypassneeded
+ %\doglobal\increment\currentstrategypass
+ \fi%\fi
+ \fi
+ \savecurrentvalue\currentstrategypass{\currentstrategypass}}
+
+\appendtoks \registerstrategypass \to \everybye % \everylastshipout
+
+\def\setstrategyvariable#1#2% key value
+ {%\doifnotstrategyvariable{#1}{\global\settrue\strategypassneeded}%
+ \doglobal\increment\currentstrategyvariable
+ \savetaggedtwopassdata{\s!strategy}{\currentstrategyvariable}{#1}{#2}}
+
+\def\doifstrategyvariableelse#1#2#3%
+ {\getstrategyvariable{#1}\iftwopassdatafound#2\else#3\fi}
+
+\def\getstrategyvariable#1% key
+ {\findtwopassdata{\s!strategy}{#1}%
+ \setxvalue{\s!strategy:#1}{\twopassdata}}
+
+\def\retainstrategyvariable#1% key
+ {\expanded{\setstrategyvariable{#1}{\strategyvariable{#1}}}}
+
+\def\strategyvariable#1% key
+ {\csname\s!strategy:#1\endcsname}
+
+\let\stratvar\strategyvariable
+
+\def\forcestrategy{\global\settrue \strategypassforced}
+\def\abortstrategy{\global\setfalse\strategypassforced}
+
+\def\doifstrategyvariableelse#1#2#3%
+ {\getstrategyvariable{#1}\iftwopassdatafound#2\else#3\fi}
+
+\def\doifstrategyvariable #1#2{\doifstrategyvariableelse{#1}{#2}{}}
+\def\doifnotstrategyvariable#1#2{\doifstrategyvariableelse{#1}{}{#2}}
+
+\protect \endinput
diff --git a/tex/context/base/core-stg.tex b/tex/context/base/core-stg.tex
deleted file mode 100644
index 429e1e894..000000000
--- a/tex/context/base/core-stg.tex
+++ /dev/null
@@ -1,72 +0,0 @@
-%D \module
-%D [ file=core-stg,
-%D version=2006.08.16,
-%D title=\CONTEXT\ Core Macros,
-%D subtitle=Strategies,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D This is a prelude to strategies. It is rather old code
-%D used in a project many years ago. Use with care since I
-%D will pick up this thread. (moved from cont-new)
-
-\unprotect
-
-\def\s!strategy{strategy}
-
-\def\currentstrategypass {1}
-\def\currentstrategyvariable{0}
-\def\maximumstrategypass {8}
-
-\newconditional\strategypassneeded
-\newconditional\strategypassforced
-
-\definetwopasslist{\s!strategy}
-
-\def\registerstrategypass
- {\ifnum\currentstrategypass>\maximumstrategypass \else
- \ifconditional\strategypassforced
- \doglobal\increment\currentstrategypass
- \else%\ifconditional\strategypassneeded
- %\doglobal\increment\currentstrategypass
- \fi%\fi
- \fi
- \savecurrentvalue\currentstrategypass{\currentstrategypass}}
-
-\appendtoks \registerstrategypass \to \everybye % \everylastshipout
-
-\def\setstrategyvariable#1#2% key value
- {%\doifnotstrategyvariable{#1}{\global\settrue\strategypassneeded}%
- \doglobal\increment\currentstrategyvariable
- \savetaggedtwopassdata{\s!strategy}{\currentstrategyvariable}{#1}{#2}}
-
-\def\doifstrategyvariableelse#1#2#3%
- {\getstrategyvariable{#1}\iftwopassdatafound#2\else#3\fi}
-
-\def\getstrategyvariable#1% key
- {\findtwopassdata{\s!strategy}{#1}%
- \setxvalue{\s!strategy:#1}{\twopassdata}}
-
-\def\retainstrategyvariable#1% key
- {\expanded{\setstrategyvariable{#1}{\strategyvariable{#1}}}}
-
-\def\strategyvariable#1% key
- {\csname\s!strategy:#1\endcsname}
-
-\let\stratvar\strategyvariable
-
-\def\forcestrategy{\global\settrue \strategypassforced}
-\def\abortstrategy{\global\setfalse\strategypassforced}
-
-\def\doifstrategyvariableelse#1#2#3%
- {\getstrategyvariable{#1}\iftwopassdatafound#2\else#3\fi}
-
-\def\doifstrategyvariable #1#2{\doifstrategyvariableelse{#1}{#2}{}}
-\def\doifnotstrategyvariable#1#2{\doifstrategyvariableelse{#1}{}{#2}}
-
-\protect \endinput
diff --git a/tex/context/base/core-sys.mkiv b/tex/context/base/core-sys.mkiv
index 073c29b66..28ef1e520 100644
--- a/tex/context/base/core-sys.mkiv
+++ b/tex/context/base/core-sys.mkiv
@@ -283,6 +283,9 @@
%D processaction alternative on an string of average length.
%D Since this feature is used in XML processing, it made sense
%D to support this faster alternative. It's installable as well.
+%D
+%D We keep this around for \MKII\ \XML\ but it's not used in \MKIV\
+%D code as expansion is controlled in another way there.
\def\installexpander#1#2#3% changed, no longer \convert..\to...
{\setvalue{\s!do\c!expansion#1l}{#2}%
@@ -315,12 +318,8 @@
\installexpander\v!strict \defreducedargument \gdefreducedargument
\installexpander {utf} \defreducedtoutf \gdefreducedtoutf
-%installexpander {xml} {see xtag-ext}
-
\def\dodefconvertedmeaning#1#2#3% watch the double expansion !
{\bgroup
- \honorunexpanded
- \convertencodedtokens % can be overloaded
\xdef\@@globalexpanded{#3}%
\xdef\@@globalexpanded{\@@globalexpanded}%
\egroup
@@ -337,44 +336,6 @@
\def\defreducedargument {\dodefreducedargument\edef}
\def\gdefreducedargument{\dodefreducedargument\xdef}
-
-% \setupindex[expansion=utf]\index{\eacute}
-
-\def\dodefreducedtoutf#1#2#3%
- {\begingroup
- \reducetocoding[uc]%
- \let\uchar\uchartoutf
- \let\unicodechar\numbertoutf
- \edef\ascii{#3}%
- \expandafter\endgroup\expandafter#1\expandafter#2\expandafter{\ascii}}
-
-\def\defreducedtoutf {\dodefreducedtoutf\edef}
-\def\gdefreducedtoutf{\dodefreducedtoutf\xdef}
-
-% old syntax:
-
-\def\convertmeaning#1\to#2% watch the double expansion !
- {\bgroup
- \honorunexpanded
- \convertencodedtokens % can be overloaded
- \xdef\@@globalexpanded{#1}%
- \xdef\@@globalexpanded{\@@globalexpanded}%
- \egroup
- \defconvertedcommand#2\@@globalexpanded}
-
-\def\reduceargument#1\to#2%
- {\begingroup
- \reducetocoding[raw]%
- \edef\ascii{#1}%
- \expandafter\endgroup\expandafter\edef\expandafter#2\expandafter{\ascii}}
-
-\def\reducetoutf#1\to#2%
- {\begingroup
- \reducetocoding[uc]%
- \let\uchar\uchartoutf
- \let\unicodechar\numbertoutf
- \edef\ascii{#1}%
- \expandafter\endgroup\expandafter\edef\expandafter#2\expandafter{\ascii}}
\startruntimeluacode
\ctxlua {
diff --git a/tex/context/base/core-two.lua b/tex/context/base/core-two.lua
index 5749d406d..50c356f7b 100644
--- a/tex/context/base/core-two.lua
+++ b/tex/context/base/core-two.lua
@@ -48,6 +48,14 @@ function jobpasses.savetagged(id,tag,str)
jti[tag] = str
end
+function jobpasses.getcollected(id)
+ return collected[id] or { }
+end
+
+function jobpasses.gettobesaved(id)
+ return allocate(id)
+end
+
function jobpasses.get(id)
local jti = collected[id]
if jti and #jti > 0 then
diff --git a/tex/context/base/core-two.mkiv b/tex/context/base/core-two.mkiv
index f7dbd4c91..98d396d08 100644
--- a/tex/context/base/core-two.mkiv
+++ b/tex/context/base/core-two.mkiv
@@ -71,9 +71,6 @@
\unprotect
-\let\alltwopasslists\empty
-\let\twopassentry \empty
-\let\twopassentry \gobblethreearguments % permits loading a MK II file
\let\twopassdatalist\empty
\newif\iftwopassdatafound
diff --git a/tex/context/base/core-uti.mkii b/tex/context/base/core-uti.mkii
index b348ba358..5b8f66f50 100644
--- a/tex/context/base/core-uti.mkii
+++ b/tex/context/base/core-uti.mkii
@@ -208,29 +208,32 @@
\fi
\to \everybeforeutilityread
-\edef\testbytesequence
- {\rawcharacter{7}%
- \rawcharacter{27}%
- %rawcharacter{227}% invalid in xetex, which expects utf
- \rawcharacter{195}\rawcharacter{128}} % valid utf code
-
-\def\thisisbytesequence#1%
- {\ifx\testbytesequence\empty\else
- \defconvertedcommand\testbytesequence\testbytesequence
- \defconvertedargument\ascii{#1}%
- \ifx\testbytesequence\ascii \else
- \writestatus\m!systems{possible problem with 8 bit output}%
- \fi
- \fi
- \global\let\thisisbytesequence\gobbleoneargument}
-
-\ifnum\texengine=\xetexengine
- \let\testbytesequence\empty
-\fi
+% \edef\testbytesequence
+% {\rawcharacter{7}%
+% \rawcharacter{27}%
+% %rawcharacter{227}% invalid in xetex, which expects utf
+% \rawcharacter{195}\rawcharacter{128}} % valid utf code
+%
+% \def\thisisbytesequence#1%
+% {\ifx\testbytesequence\empty\else
+% \defconvertedcommand\testbytesequence\testbytesequence
+% \defconvertedargument\ascii{#1}%
+% \ifx\testbytesequence\ascii \else
+% \writestatus\m!systems{possible problem with 8 bit output}%
+% \fi
+% \fi
+% \global\let\thisisbytesequence\gobbleoneargument}
+%
+% \ifnum\texengine=\xetexengine
+% \let\testbytesequence\empty
+% \fi
+%
+% \appendtoks
+% \immediatewriteutilitycommand{\thisisbytesequence{\testbytesequence}}%
+% \to \everyopenutilities
-\appendtoks
- \immediatewriteutilitycommand{\thisisbytesequence{\testbytesequence}}%
-\to \everyopenutilities
+\let\testbytesequence \empty % keep this
+\let\thisisbytesequence\gobbleoneargument % keep this
\long\def\doutilities#1#2#3#4#5% % introduceren in utility file
{\resetutilities
diff --git a/tex/context/base/core-uti.mkiv b/tex/context/base/core-uti.mkiv
index 77cf91dd9..29e6342be 100644
--- a/tex/context/base/core-uti.mkiv
+++ b/tex/context/base/core-uti.mkiv
@@ -11,8 +11,6 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-%D Most will disappear!
-
\writestatus{loading}{ConTeXt Core Macros / Utility File Handling}
\unprotect
@@ -22,23 +20,16 @@
\def\savecurrentvalue#1#2%
{\ctxlua{jobvariables.save("\strippedcsname#1","#2")}}
-\let\initializevariable\gobbletwoarguments % mkii/mkiv
-\let\thisisbytesequence\gobbleoneargument
-
\appendtoks
- \globallet\initializevariable\gobbletwoarguments
-\to \everyafterutilityread
-
-\appendtoks
- \ctxlua{storage.dump()}%
+ \ctxlua{storage.dump()}% will move to lua
\to \everydump
\appendtoks
- \ctxlua{storage.finalize()}%
+ \ctxlua{storage.finalize()}% will move to lua
\to \everyfinalizeluacode
\appendtoks
- \ctxlua{nodes.cleanup_reserved()}%
+ \ctxlua{nodes.cleanup_reserved()}% will move to lua
\to \everydump
\appendtoks
@@ -60,37 +51,14 @@
% }%
% \to \everystarttext
-% keep this for a while
-
-\newif\ifutilitydone
-\newif\ifdoinpututilities
-\newif\ifunprotectutilities
-
-\let\writeutility \gobbleoneargument
-\let\writeutilitycommand \gobbleoneargument
-\let\immediatewriteutility \gobbleoneargument
-\let\immediatewriteutilitycommand\gobbleoneargument
-\let\cwriteutility \gobbleoneargument
-\let\cwriteutilitycommand \gobbleoneargument
-\let\checkedutility \secondoftwoarguments
-\let\doutilities \gobblefivearguments
-\let\abortutilitygeneration \relax
-
-\newtoks \everyopenutilities \let\openutilities \relax
-\newtoks \everycloseutilities \let\closeutilities\relax
-\newtoks \everycheckutilities \let\checkutilities\relax
-\newtoks \utilityresetlist
-
-\def\addutilityreset#1{\@EA\appendtoks\csname\s!reset#1\endcsname\to\utilityresetlist}
-\def\resetutilities {\the\utilityresetlist}
-
-\def\currentutilityfilename{\jobname}
-
-\prependtoks \resetutilities \to \everyjob
+%D Some styles might use these use these commands:
-\def\installprogram {\dosingleempty\doinstallprogram}
-\def\doinstallprogram[#1]{\gobbleoneargument}
-\def\installedprogram[#1]{}
-\let\installplugin \gobblethreearguments
+\newif \ifutilitydone
+\let \checkutilities \relax
+\let \currentutilityfilename \jobname
+\def \installprogram {\dosingleempty\doinstallprogram}
+\def \doinstallprogram [#1]{\gobbleoneargument}
+\def \installedprogram [#1]{}
+\let \installplugin \gobblethreearguments
\protect \endinput
diff --git a/tex/context/base/core-var.mkii b/tex/context/base/core-var.mkii
new file mode 100644
index 000000000..4de1b8718
--- /dev/null
+++ b/tex/context/base/core-var.mkii
@@ -0,0 +1,286 @@
+%D \module
+%D [ file=core-var,
+%D version=1998.02.21,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Variables,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Core Macros / Variables}
+
+\unprotect
+
+%D We introduce a couple of variables that are used all over
+%D \CONTEXT. Alternatively we could define them in each module
+%D but as they are part of the bigger picture we prefer to do
+%D it here.
+
+%D \macros
+%D {every...}
+%D
+%D A few every's. Some are only used in \MKII\ or \MKIV.
+
+%D Output routine:
+
+\newtoks \everybeforeoutput
+\newtoks \everyafteroutput
+
+%D Shipout:
+
+\newtoks \everyshipout
+\newtoks \everybeforeshipout
+\newtoks \everyaftershipout
+\newtoks \everyfirstshipout
+\newtoks \everylastshipout
+
+%D End of run:
+
+\newtoks \everybye
+\newtoks \everygoodbye
+\newtoks \everynotabene
+
+%D Document
+
+\newtoks \everysetupdocument
+\newtoks \everyendoftextbody
+
+\newtoks \everystarttext
+\newtoks \everystoptext
+
+%D Purity:
+
+\newtoks \everyforgetall
+\newtoks \everycleanupfeatures
+
+\def\cleanupfeatures{\the\everycleanupfeatures}
+\def\forgetall {\the\everyforgetall}
+
+%D Page building:
+
+\newtoks \everybeforepagebody
+\newtoks \everyafterpagebody
+
+\let \everypagebody \everybeforepagebody % backward compatible
+
+%D Multipass:
+
+\newtoks \everybeforeutilityread
+\newtoks \everyafterutilityread
+
+%D Floats:
+
+\newtoks \everyinsidefloat
+
+%D Sectioning:
+
+\newtoks \everyheadstart
+
+%D Par building (experimental, used in xml ..
)
+
+\newtoks \everybeginofpar
+\newtoks \everyendofpar
+%newtoks \everyparflush
+
+\def\bpar{\the\everybeginofpar\ignorespaces} % may interfere with \everypar
+\def\epar{\ifhmode\removeunwantedspaces\the\everyendofpar\fi} % test prevents problems with \bpar\epar
+
+%D Lists:
+
+\newtoks \everylistentry
+\newtoks \everysavesortkeys
+
+%D Marks:
+
+\newtoks \everymarking
+
+%D Fonts:
+
+\newtoks \everyfont
+\newtoks \everyglobalbodyfont
+\newtoks \everydefinedfont
+
+\newevery \everybodyfont \EveryBodyFont
+\newevery \everyfontswitch \EveryFontSwitch
+
+%D Math:
+
+\newtoks \everybeforedisplayformula
+\newtoks \everymathematics
+
+\prependtoks \the\everymathematics \to \everymath
+\prependtoks \the\everymathematics \to \everydisplay
+
+%D Tables
+
+\newtoks \everytable
+
+%D State mess:
+
+\newtoks \everypushsomestate
+\newtoks \everypopsomestate
+
+\def\pushsomestates{\the\everypushsomestate}
+\def\popsomestates {\the\everypopsomestate }
+
+%D More generic (used to be pushcolor etc)
+
+\newtoks\everypushproperties
+\newtoks\everypopproperties
+\newtoks\everypopsplitproperties
+
+\newtoks\everystarttextproperties
+\newtoks\everystoptextproperties
+
+\def\pushproperties {\the\everypushproperties}
+\def\popproperties {\the\everypopproperties}
+\def\popsplitproperties {\the\everypopsplitproperties}
+
+\def\starttextproperties{\the\everystarttextproperties}
+\def\stoptextproperties {\the\everystoptextproperties}
+
+%D This is pretty important (esp since we now ignore shipouts).
+%D Actually we should nil all writes, marks, specials.
+
+\appendtoks \globallet\popproperties \relax \to \everylastshipout
+\appendtoks \globallet\popsplitproperties\relax \to \everylastshipout
+
+%D \macros
+%D {defineinputmode,setinputmode}
+%D
+%D New. Some work needs to be done.
+
+% not in mkiv
+
+\def\defineinputmode[#1]{\@EA\newtoks\csname every#1inputmode\endcsname}
+\def\setinputmode [#1]{\the\executeifdefined{every#1inputmode}\emptytoks}
+
+\defineinputmode [TEX]
+\defineinputmode [XML]
+
+\setinputmode [TEX]
+
+%D \macros
+%D {trialtypesetting}
+%D
+%D We disable trial typesetting in the output routine,
+%D just to be sure.
+
+\newif\iftrialtypesetting
+
+\prependtoks \trialtypesettingfalse \to \everybeforepagebody
+
+%D \macros
+%D {ifinpagebody,ifinsidecolumns,ifdoublesided,ifsinglesided}
+
+\newif \ifinpagebody
+\newif \ifinsidecolumns
+\newif \ifdoublesided \doublesidedfalse
+\newif \ifsinglesided \singlesidedtrue
+\newif \ifinsidefloat
+\newif \ifdoingblocks
+\newif \ifgridsnapping
+
+%D \macros
+%D {ifprocessingXML}
+%D
+%D We need this one even if no \XML\ is supported.
+
+\newif\ifprocessingXML % old way
+
+%D \macros
+%D {ifproductionrun}
+%D
+%D This boolean can be used to bypass certain
+%D initializations.
+
+\ifx\protectionlevel\undefined \newcount\protectionlevel \fi
+
+\newif\ifproductionrun
+
+\appendtoks \productionruntrue \to \everydump
+
+\appendtoks \ifcase\protectionlevel\else\reportunprotection\fi \to \everydump
+
+%D \macros
+%D {everyboxedcontent, ifboxedcontent,
+%D startboxedcontent, stopboxedcontent}
+%D
+%D This one is relatively new and will be used as a more
+%D robust test for inner situations.
+
+\newif \ifboxedcontent
+\newtoks\everyboxedcontent
+
+\appendtoks \boxedcontenttrue \to \everyboxedcontent
+
+\def\startboxedcontent{\bgroup\the\everyboxedcontent}
+\let\stopboxedcontent \egroup
+
+%D \macros
+%D {fastmode,silentmode}
+%D
+%D These commands are obsolete.
+
+\let\fastmode \relax
+\let\silentmode\relax
+
+%D \macros
+%D {defineselector,setupselector}
+%D
+%D \starttyping
+%D \defineselector[caption][max=2,n=2]
+%D
+%D \start
+%D \setupselector[caption][n=1]
+%D \placelist[figure][criterium=all]
+%D \stop
+%D
+%D \starttext
+%D \placefigure
+%D {\select{caption}{zapf}{\input zapf \relax}}
+%D {}
+%D \stoptext
+%D \stoptyping
+
+\def\defineselector{\dodoubleargument\dodefineselector}
+\def\setupselector {\dodoubleargument\dosetupselector}
+
+\def\dodefineselector[#1][#2]{\getparameters[\??sx#1][\c!max=2,\c!n=1,#2]}
+\def\dosetupselector [#1][#2]{\getparameters[\??sx#1][#2]}
+
+\unexpanded\def\select#1%
+ {\filterfromnext
+ {\executeifdefined{\??sx#1\c!max}1}
+ {\executeifdefined{\??sx#1\c!n }1}}
+
+%D We store some original meanings, maybe in \type
+%D {math-ini}.
+
+\let\normalat \at
+\let\normalin \in
+\let\normalfrom \from
+%let\normalover \over
+\let\normalabout\about
+
+%D Add-ons:
+
+\let\startlayoutcomponent\gobbletwoarguments
+\let\stoplayoutcomponent \relax
+
+%D Concepts:
+
+\chardef\conceptmode\zerocount
+
+\def\doifconcepttracing
+ {\ifnum\conceptmode>\plustwo
+ \expandafter\firstofoneargument
+ \else
+ \expandafter\gobbleoneargument
+ \fi}
+
+\protect \endinput
diff --git a/tex/context/base/core-var.mkiv b/tex/context/base/core-var.mkiv
new file mode 100644
index 000000000..9a0b190d8
--- /dev/null
+++ b/tex/context/base/core-var.mkiv
@@ -0,0 +1,275 @@
+%D \module
+%D [ file=core-var,
+%D version=1998.02.21,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Variables,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Core Macros / Variables}
+
+\unprotect
+
+%D We introduce a couple of variables that are used all over
+%D \CONTEXT. Alternatively we could define them in each module
+%D but as they are part of the bigger picture we prefer to do
+%D it here.
+
+%D \macros
+%D {every...}
+%D
+%D A few every's. Some are only used in \MKII\ or \MKIV.
+
+%D Output routine:
+
+\newtoks \everybeforeoutput
+\newtoks \everyafteroutput
+
+%D Shipout:
+
+\newtoks \everyshipout
+\newtoks \everybeforeshipout
+\newtoks \everyaftershipout
+\newtoks \everyfirstshipout
+\newtoks \everylastshipout
+
+%D End of run:
+
+\newtoks \everybye
+\newtoks \everygoodbye
+\newtoks \everynotabene
+
+%D Document
+
+\newtoks \everysetupdocument
+\newtoks \everyendoftextbody
+
+\newtoks \everystarttext
+\newtoks \everystoptext
+
+%D Purity:
+
+\newtoks \everyforgetall
+\newtoks \everycleanupfeatures
+
+\def\cleanupfeatures{\the\everycleanupfeatures}
+\def\forgetall {\the\everyforgetall}
+
+%D Page building:
+
+\newtoks \everybeforepagebody
+\newtoks \everyafterpagebody
+
+\let \everypagebody \everybeforepagebody % backward compatible
+
+%D Multipass:
+
+\newtoks \everybeforeutilityread
+\newtoks \everyafterutilityread
+
+%D Floats:
+
+\newtoks \everyinsidefloat
+
+%D Sectioning:
+
+\newtoks \everyheadstart
+
+%D Par building (experimental, used in xml ..
)
+
+\newtoks \everybeginofpar
+\newtoks \everyendofpar
+%newtoks \everyparflush
+
+\def\bpar{\the\everybeginofpar\ignorespaces} % may interfere with \everypar
+\def\epar{\ifhmode\removeunwantedspaces\the\everyendofpar\fi} % test prevents problems with \bpar\epar
+
+%D Lists:
+
+\newtoks \everylistentry
+\newtoks \everysavesortkeys
+
+%D Marks:
+
+\newtoks \everymarking
+
+%D Fonts:
+
+\newtoks \everyfont
+\newtoks \everyglobalbodyfont
+\newtoks \everydefinedfont
+
+\newevery \everybodyfont \EveryBodyFont
+\newevery \everyfontswitch \EveryFontSwitch
+
+%D Math:
+
+\newtoks \everybeforedisplayformula
+\newtoks \everymathematics
+
+\prependtoks \the\everymathematics \to \everymath
+\prependtoks \the\everymathematics \to \everydisplay
+
+%D Tables
+
+\newtoks \everytable
+
+%D State mess:
+
+\newtoks \everypushsomestate
+\newtoks \everypopsomestate
+
+\def\pushsomestates{\the\everypushsomestate}
+\def\popsomestates {\the\everypopsomestate }
+
+%D More generic (used to be pushcolor etc)
+
+\newtoks\everystarttextproperties
+\newtoks\everystoptextproperties
+
+\def\starttextproperties{\the\everystarttextproperties}
+\def\stoptextproperties {\the\everystoptextproperties}
+
+%D \macros
+%D {defineinputmode,setinputmode}
+%D
+%D New. Some work needs to be done.
+
+% not in mkiv
+
+\def\defineinputmode[#1]{\@EA\newtoks\csname every#1inputmode\endcsname}
+\def\setinputmode [#1]{\the\executeifdefined{every#1inputmode}\emptytoks}
+
+\defineinputmode [TEX]
+\defineinputmode [XML]
+
+\setinputmode [TEX]
+
+%D \macros
+%D {trialtypesetting}
+%D
+%D We disable trial typesetting in the output routine,
+%D just to be sure.
+
+\newif\iftrialtypesetting
+
+\prependtoks \trialtypesettingfalse \to \everybeforepagebody
+
+%D \macros
+%D {ifinpagebody,ifinsidecolumns,ifdoublesided,ifsinglesided}
+
+\newif \ifinpagebody
+\newif \ifinsidecolumns
+\newif \ifdoublesided \doublesidedfalse
+\newif \ifsinglesided \singlesidedtrue
+\newif \ifinsidefloat
+\newif \ifdoingblocks
+\newif \ifgridsnapping
+
+%D \macros
+%D {ifprocessingXML}
+%D
+%D We need this one even if no \XML\ is supported.
+
+\newif\ifprocessingXML % old way
+
+%D \macros
+%D {ifproductionrun}
+%D
+%D This boolean can be used to bypass certain
+%D initializations.
+
+\ifx\protectionlevel\undefined \newcount\protectionlevel \fi
+
+\newif\ifproductionrun
+
+\appendtoks \productionruntrue \to \everydump
+
+\appendtoks \ifcase\protectionlevel\else\reportunprotection\fi \to \everydump
+
+%D \macros
+%D {everyboxedcontent, ifboxedcontent,
+%D startboxedcontent, stopboxedcontent}
+%D
+%D This one is relatively new and will be used as a more
+%D robust test for inner situations.
+
+\newif \ifboxedcontent
+\newtoks\everyboxedcontent
+
+\appendtoks \boxedcontenttrue \to \everyboxedcontent
+
+\def\startboxedcontent{\bgroup\the\everyboxedcontent}
+\let\stopboxedcontent \egroup
+
+%D \macros
+%D {fastmode,silentmode}
+%D
+%D These commands are obsolete.
+
+\let\fastmode \relax
+\let\silentmode\relax
+
+%D \macros
+%D {defineselector,setupselector}
+%D
+%D \starttyping
+%D \defineselector[caption][max=2,n=2]
+%D
+%D \start
+%D \setupselector[caption][n=1]
+%D \placelist[figure][criterium=all]
+%D \stop
+%D
+%D \starttext
+%D \placefigure
+%D {\select{caption}{zapf}{\input zapf \relax}}
+%D {}
+%D \stoptext
+%D \stoptyping
+
+\def\defineselector{\dodoubleargument\dodefineselector}
+\def\setupselector {\dodoubleargument\dosetupselector}
+
+\def\dodefineselector[#1][#2]{\getparameters[\??sx#1][\c!max=2,\c!n=1,#2]}
+\def\dosetupselector [#1][#2]{\getparameters[\??sx#1][#2]}
+
+\unexpanded\def\select#1%
+ {\filterfromnext
+ {\executeifdefined{\??sx#1\c!max}1}
+ {\executeifdefined{\??sx#1\c!n }1}}
+
+%D We store some original meanings, maybe in \type
+%D {math-ini}.
+
+\let\normalat \at
+\let\normalin \in
+\let\normalfrom \from
+%let\normalover \over
+\let\normalabout\about
+
+%D Add-ons:
+
+\let\startlayoutcomponent \gobbletwoarguments % obsolete
+\let\stoplayoutcomponent \relax % obsolete
+\let\setlayoutcomponentattribute \gobbletwoarguments
+\let\resetlayoutcomponentattribute\relax
+\let\layoutcomponentboxattribute \empty
+
+%D Concepts:
+
+\chardef\conceptmode\zerocount
+
+\def\doifconcepttracing
+ {\ifnum\conceptmode>\plustwo
+ \expandafter\firstofoneargument
+ \else
+ \expandafter\gobbleoneargument
+ \fi}
+
+\protect \endinput
diff --git a/tex/context/base/core-var.tex b/tex/context/base/core-var.tex
deleted file mode 100644
index 4de1b8718..000000000
--- a/tex/context/base/core-var.tex
+++ /dev/null
@@ -1,286 +0,0 @@
-%D \module
-%D [ file=core-var,
-%D version=1998.02.21,
-%D title=\CONTEXT\ Core Macros,
-%D subtitle=Variables,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Core Macros / Variables}
-
-\unprotect
-
-%D We introduce a couple of variables that are used all over
-%D \CONTEXT. Alternatively we could define them in each module
-%D but as they are part of the bigger picture we prefer to do
-%D it here.
-
-%D \macros
-%D {every...}
-%D
-%D A few every's. Some are only used in \MKII\ or \MKIV.
-
-%D Output routine:
-
-\newtoks \everybeforeoutput
-\newtoks \everyafteroutput
-
-%D Shipout:
-
-\newtoks \everyshipout
-\newtoks \everybeforeshipout
-\newtoks \everyaftershipout
-\newtoks \everyfirstshipout
-\newtoks \everylastshipout
-
-%D End of run:
-
-\newtoks \everybye
-\newtoks \everygoodbye
-\newtoks \everynotabene
-
-%D Document
-
-\newtoks \everysetupdocument
-\newtoks \everyendoftextbody
-
-\newtoks \everystarttext
-\newtoks \everystoptext
-
-%D Purity:
-
-\newtoks \everyforgetall
-\newtoks \everycleanupfeatures
-
-\def\cleanupfeatures{\the\everycleanupfeatures}
-\def\forgetall {\the\everyforgetall}
-
-%D Page building:
-
-\newtoks \everybeforepagebody
-\newtoks \everyafterpagebody
-
-\let \everypagebody \everybeforepagebody % backward compatible
-
-%D Multipass:
-
-\newtoks \everybeforeutilityread
-\newtoks \everyafterutilityread
-
-%D Floats:
-
-\newtoks \everyinsidefloat
-
-%D Sectioning:
-
-\newtoks \everyheadstart
-
-%D Par building (experimental, used in xml ..
)
-
-\newtoks \everybeginofpar
-\newtoks \everyendofpar
-%newtoks \everyparflush
-
-\def\bpar{\the\everybeginofpar\ignorespaces} % may interfere with \everypar
-\def\epar{\ifhmode\removeunwantedspaces\the\everyendofpar\fi} % test prevents problems with \bpar\epar
-
-%D Lists:
-
-\newtoks \everylistentry
-\newtoks \everysavesortkeys
-
-%D Marks:
-
-\newtoks \everymarking
-
-%D Fonts:
-
-\newtoks \everyfont
-\newtoks \everyglobalbodyfont
-\newtoks \everydefinedfont
-
-\newevery \everybodyfont \EveryBodyFont
-\newevery \everyfontswitch \EveryFontSwitch
-
-%D Math:
-
-\newtoks \everybeforedisplayformula
-\newtoks \everymathematics
-
-\prependtoks \the\everymathematics \to \everymath
-\prependtoks \the\everymathematics \to \everydisplay
-
-%D Tables
-
-\newtoks \everytable
-
-%D State mess:
-
-\newtoks \everypushsomestate
-\newtoks \everypopsomestate
-
-\def\pushsomestates{\the\everypushsomestate}
-\def\popsomestates {\the\everypopsomestate }
-
-%D More generic (used to be pushcolor etc)
-
-\newtoks\everypushproperties
-\newtoks\everypopproperties
-\newtoks\everypopsplitproperties
-
-\newtoks\everystarttextproperties
-\newtoks\everystoptextproperties
-
-\def\pushproperties {\the\everypushproperties}
-\def\popproperties {\the\everypopproperties}
-\def\popsplitproperties {\the\everypopsplitproperties}
-
-\def\starttextproperties{\the\everystarttextproperties}
-\def\stoptextproperties {\the\everystoptextproperties}
-
-%D This is pretty important (esp since we now ignore shipouts).
-%D Actually we should nil all writes, marks, specials.
-
-\appendtoks \globallet\popproperties \relax \to \everylastshipout
-\appendtoks \globallet\popsplitproperties\relax \to \everylastshipout
-
-%D \macros
-%D {defineinputmode,setinputmode}
-%D
-%D New. Some work needs to be done.
-
-% not in mkiv
-
-\def\defineinputmode[#1]{\@EA\newtoks\csname every#1inputmode\endcsname}
-\def\setinputmode [#1]{\the\executeifdefined{every#1inputmode}\emptytoks}
-
-\defineinputmode [TEX]
-\defineinputmode [XML]
-
-\setinputmode [TEX]
-
-%D \macros
-%D {trialtypesetting}
-%D
-%D We disable trial typesetting in the output routine,
-%D just to be sure.
-
-\newif\iftrialtypesetting
-
-\prependtoks \trialtypesettingfalse \to \everybeforepagebody
-
-%D \macros
-%D {ifinpagebody,ifinsidecolumns,ifdoublesided,ifsinglesided}
-
-\newif \ifinpagebody
-\newif \ifinsidecolumns
-\newif \ifdoublesided \doublesidedfalse
-\newif \ifsinglesided \singlesidedtrue
-\newif \ifinsidefloat
-\newif \ifdoingblocks
-\newif \ifgridsnapping
-
-%D \macros
-%D {ifprocessingXML}
-%D
-%D We need this one even if no \XML\ is supported.
-
-\newif\ifprocessingXML % old way
-
-%D \macros
-%D {ifproductionrun}
-%D
-%D This boolean can be used to bypass certain
-%D initializations.
-
-\ifx\protectionlevel\undefined \newcount\protectionlevel \fi
-
-\newif\ifproductionrun
-
-\appendtoks \productionruntrue \to \everydump
-
-\appendtoks \ifcase\protectionlevel\else\reportunprotection\fi \to \everydump
-
-%D \macros
-%D {everyboxedcontent, ifboxedcontent,
-%D startboxedcontent, stopboxedcontent}
-%D
-%D This one is relatively new and will be used as a more
-%D robust test for inner situations.
-
-\newif \ifboxedcontent
-\newtoks\everyboxedcontent
-
-\appendtoks \boxedcontenttrue \to \everyboxedcontent
-
-\def\startboxedcontent{\bgroup\the\everyboxedcontent}
-\let\stopboxedcontent \egroup
-
-%D \macros
-%D {fastmode,silentmode}
-%D
-%D These commands are obsolete.
-
-\let\fastmode \relax
-\let\silentmode\relax
-
-%D \macros
-%D {defineselector,setupselector}
-%D
-%D \starttyping
-%D \defineselector[caption][max=2,n=2]
-%D
-%D \start
-%D \setupselector[caption][n=1]
-%D \placelist[figure][criterium=all]
-%D \stop
-%D
-%D \starttext
-%D \placefigure
-%D {\select{caption}{zapf}{\input zapf \relax}}
-%D {}
-%D \stoptext
-%D \stoptyping
-
-\def\defineselector{\dodoubleargument\dodefineselector}
-\def\setupselector {\dodoubleargument\dosetupselector}
-
-\def\dodefineselector[#1][#2]{\getparameters[\??sx#1][\c!max=2,\c!n=1,#2]}
-\def\dosetupselector [#1][#2]{\getparameters[\??sx#1][#2]}
-
-\unexpanded\def\select#1%
- {\filterfromnext
- {\executeifdefined{\??sx#1\c!max}1}
- {\executeifdefined{\??sx#1\c!n }1}}
-
-%D We store some original meanings, maybe in \type
-%D {math-ini}.
-
-\let\normalat \at
-\let\normalin \in
-\let\normalfrom \from
-%let\normalover \over
-\let\normalabout\about
-
-%D Add-ons:
-
-\let\startlayoutcomponent\gobbletwoarguments
-\let\stoplayoutcomponent \relax
-
-%D Concepts:
-
-\chardef\conceptmode\zerocount
-
-\def\doifconcepttracing
- {\ifnum\conceptmode>\plustwo
- \expandafter\firstofoneargument
- \else
- \expandafter\gobbleoneargument
- \fi}
-
-\protect \endinput
diff --git a/tex/context/base/enco-032.mkii b/tex/context/base/enco-032.mkii
new file mode 100644
index 000000000..d7e15126c
--- /dev/null
+++ b/tex/context/base/enco-032.mkii
@@ -0,0 +1,82 @@
+%D \module
+%D [ file=enco-032,
+%D version=2006.03.30,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Unicode Goodies,
+%D author={Taco Hoekwater},
+%D date=\currentdate,
+%D copyright=PRAGMA]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+% unicode table 32 (= hex 20)
+
+\startencoding [default]
+
+ \definecommand unic@threeperemspace {\hskip .33333em }
+ \definecommand unic@fourperemspace {\hskip .25em }
+ \definecommand unic@sixperemspace {\hskip .16667em }
+ \definecommand unic@figurespace {\hphantom{0}}
+ \definecommand unic@punctuationspace {\hphantom{,}}
+ \definecommand unic@hairspace {\hskip .08333em }
+ \definecommand unic@zerowidthspace {\hskip 0em plus 1sp }
+ \definecommand unic@zerowidthjoiner {\kern 0em }
+ \definecommand unic@zerowidthnonjoiner {\hskip 0em }
+
+ \definecommand unic@quotedblleftreversed {\mirror{\quotedblright}}
+ \definecommand unic@quoteleftreversed {\mirror{\quoteright}}
+
+ \definecommand unic@onedotleader {{\periods[1]}}
+ \definecommand unic@twodotleader {{\periods[2]}}
+ \definecommand unic@hyphenationpoint {.\allowbreak }
+
+ \definecommand unic@doubleexclamationmark {!!}
+ \definecommand unic@exclamationquestionmark {!?}
+ \definecommand unic@questionexclamationmark {?!}
+ \definecommand unic@doublequestionmark {??}
+
+ \definecommand unic@reversedpilcrowsign {\mirror{\P}}
+ \definecommand unic@reversedsemicolon {\mirror{;}}
+
+ \definecommand unic@superscriptzero {\high{0}}
+ \definecommand unic@superscripti {\high{i}}
+ \definecommand unic@superscriptfour {\high{4}}
+ \definecommand unic@superscriptfive {\high{5}}
+ \definecommand unic@superscriptsix {\high{6}}
+ \definecommand unic@superscriptseven {\high{7}}
+ \definecommand unic@superscripteight {\high{8}}
+ \definecommand unic@superscriptnine {\high{9}}
+ \definecommand unic@superscriptplus {\high{+}}
+ \definecommand unic@superscriptminus {\high{\textminus}}
+ \definecommand unic@superscriptequals {\high{=}}
+ \definecommand unic@superscriptleft {\high{(}}
+ \definecommand unic@superscriptright {\high{)}}
+ \definecommand unic@superscriptn {\high{n}}
+ \definecommand unic@subscriptzero {\low{0}}
+ \definecommand unic@subscriptone {\low{1}}
+ \definecommand unic@subscripttwo {\low{2}}
+ \definecommand unic@subscriptthree {\low{3}}
+ \definecommand unic@subscriptfour {\low{4}}
+ \definecommand unic@subscriptfive {\low{5}}
+ \definecommand unic@subscriptsix {\low{6}}
+ \definecommand unic@subscriptseven {\low{7}}
+ \definecommand unic@subscripteight {\low{8}}
+ \definecommand unic@subscriptnine {\low{9}}
+ \definecommand unic@subscriptplus {\low{+}}
+ \definecommand unic@subscriptminus {\low{\textminus}}
+ \definecommand unic@subscriptequals {\low{=}}
+ \definecommand unic@subscriptleft {\low{(}}
+ \definecommand unic@subscriptright {\low{)}}
+ \definecommand unic@subscripta {\low{a}}
+ \definecommand unic@subscripte {\low{e}}
+ \definecommand unic@subscripto {\low{o}}
+ \definecommand unic@subscriptx {\low{x}}
+ \definecommand unic@subscriptschwa {\low{\schwa}}
+
+\stopencoding
+
+\protect \endinput
diff --git a/tex/context/base/enco-032.tex b/tex/context/base/enco-032.tex
deleted file mode 100644
index d7e15126c..000000000
--- a/tex/context/base/enco-032.tex
+++ /dev/null
@@ -1,82 +0,0 @@
-%D \module
-%D [ file=enco-032,
-%D version=2006.03.30,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Unicode Goodies,
-%D author={Taco Hoekwater},
-%D date=\currentdate,
-%D copyright=PRAGMA]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\unprotect
-
-% unicode table 32 (= hex 20)
-
-\startencoding [default]
-
- \definecommand unic@threeperemspace {\hskip .33333em }
- \definecommand unic@fourperemspace {\hskip .25em }
- \definecommand unic@sixperemspace {\hskip .16667em }
- \definecommand unic@figurespace {\hphantom{0}}
- \definecommand unic@punctuationspace {\hphantom{,}}
- \definecommand unic@hairspace {\hskip .08333em }
- \definecommand unic@zerowidthspace {\hskip 0em plus 1sp }
- \definecommand unic@zerowidthjoiner {\kern 0em }
- \definecommand unic@zerowidthnonjoiner {\hskip 0em }
-
- \definecommand unic@quotedblleftreversed {\mirror{\quotedblright}}
- \definecommand unic@quoteleftreversed {\mirror{\quoteright}}
-
- \definecommand unic@onedotleader {{\periods[1]}}
- \definecommand unic@twodotleader {{\periods[2]}}
- \definecommand unic@hyphenationpoint {.\allowbreak }
-
- \definecommand unic@doubleexclamationmark {!!}
- \definecommand unic@exclamationquestionmark {!?}
- \definecommand unic@questionexclamationmark {?!}
- \definecommand unic@doublequestionmark {??}
-
- \definecommand unic@reversedpilcrowsign {\mirror{\P}}
- \definecommand unic@reversedsemicolon {\mirror{;}}
-
- \definecommand unic@superscriptzero {\high{0}}
- \definecommand unic@superscripti {\high{i}}
- \definecommand unic@superscriptfour {\high{4}}
- \definecommand unic@superscriptfive {\high{5}}
- \definecommand unic@superscriptsix {\high{6}}
- \definecommand unic@superscriptseven {\high{7}}
- \definecommand unic@superscripteight {\high{8}}
- \definecommand unic@superscriptnine {\high{9}}
- \definecommand unic@superscriptplus {\high{+}}
- \definecommand unic@superscriptminus {\high{\textminus}}
- \definecommand unic@superscriptequals {\high{=}}
- \definecommand unic@superscriptleft {\high{(}}
- \definecommand unic@superscriptright {\high{)}}
- \definecommand unic@superscriptn {\high{n}}
- \definecommand unic@subscriptzero {\low{0}}
- \definecommand unic@subscriptone {\low{1}}
- \definecommand unic@subscripttwo {\low{2}}
- \definecommand unic@subscriptthree {\low{3}}
- \definecommand unic@subscriptfour {\low{4}}
- \definecommand unic@subscriptfive {\low{5}}
- \definecommand unic@subscriptsix {\low{6}}
- \definecommand unic@subscriptseven {\low{7}}
- \definecommand unic@subscripteight {\low{8}}
- \definecommand unic@subscriptnine {\low{9}}
- \definecommand unic@subscriptplus {\low{+}}
- \definecommand unic@subscriptminus {\low{\textminus}}
- \definecommand unic@subscriptequals {\low{=}}
- \definecommand unic@subscriptleft {\low{(}}
- \definecommand unic@subscriptright {\low{)}}
- \definecommand unic@subscripta {\low{a}}
- \definecommand unic@subscripte {\low{e}}
- \definecommand unic@subscripto {\low{o}}
- \definecommand unic@subscriptx {\low{x}}
- \definecommand unic@subscriptschwa {\low{\schwa}}
-
-\stopencoding
-
-\protect \endinput
diff --git a/tex/context/base/enco-037.mkii b/tex/context/base/enco-037.mkii
new file mode 100644
index 000000000..d9fc653b2
--- /dev/null
+++ b/tex/context/base/enco-037.mkii
@@ -0,0 +1,276 @@
+%D \module
+%D [ file=enco-037,
+%D version=2006.02.13,
+%D title=\CONTEXT\ \UNICODE\ Macros,
+%D subtitle=Encoding for vector 37,
+%D author=Luigi Scarso,
+%D date=\currentdate,
+%D copyright={PRAGMA}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startencoding[default]
+
+\definecharacter UnicodeLightHorizontal {\uchar{37}{000}} %%BOX DRAWINGS LIGHT HORIZONTAL
+\definecharacter UnicodeHeavyHorizontal {\uchar{37}{001}} %%BOX DRAWINGS HEAVY HORIZONTAL
+\definecharacter UnicodeLightVertical {\uchar{37}{002}} %%BOX DRAWINGS LIGHT VERTICAL
+\definecharacter UnicodeHeavyVertical {\uchar{37}{003}} %%BOX DRAWINGS HEAVY VERTICAL
+\definecharacter UnicodeLightTripleDashHorizontal {\uchar{37}{004}} %%BOX DRAWINGS LIGHT TRIPLE DASH HORIZONTAL
+\definecharacter UnicodeHeavyTripleDashHorizontal {\uchar{37}{005}} %%BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL
+\definecharacter UnicodeLightTripleDashVertical {\uchar{37}{006}} %%BOX DRAWINGS LIGHT TRIPLE DASH VERTICAL
+\definecharacter UnicodeHeavyTripleDashVertical {\uchar{37}{007}} %%BOX DRAWINGS HEAVY TRIPLE DASH VERTICAL
+\definecharacter UnicodeLightQuadrupleDashHorizontal {\uchar{37}{008}} %%BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL
+\definecharacter UnicodeHeavyQuadrupleDashHorizontal {\uchar{37}{009}} %%BOX DRAWINGS HEAVY QUADRUPLE DASH HORIZONTAL
+\definecharacter UnicodeLightQuadrupleDashVertical {\uchar{37}{010}} %%BOX DRAWINGS LIGHT QUADRUPLE DASH VERTICAL
+\definecharacter UnicodeHeavyQuadrupleDashVertical {\uchar{37}{011}} %%BOX DRAWINGS HEAVY QUADRUPLE DASH VERTICAL
+\definecharacter UnicodeLightDownAndRight {\uchar{37}{012}} %%BOX DRAWINGS LIGHT DOWN AND RIGHT
+\definecharacter UnicodeDownLightAndRightHeavy {\uchar{37}{013}} %%BOX DRAWINGS DOWN LIGHT AND RIGHT HEAVY
+\definecharacter UnicodeDownHeavyAndRightLight {\uchar{37}{014}} %%BOX DRAWINGS DOWN HEAVY AND RIGHT LIGHT
+\definecharacter UnicodeHeavyDownAndRight {\uchar{37}{015}} %%BOX DRAWINGS HEAVY DOWN AND RIGHT
+\definecharacter UnicodeLightDownAndLeft {\uchar{37}{016}} %%BOX DRAWINGS LIGHT DOWN AND LEFT
+\definecharacter UnicodeDownLightAndLeftHeavy {\uchar{37}{017}} %%BOX DRAWINGS DOWN LIGHT AND LEFT HEAVY
+\definecharacter UnicodeDownHeavyAndLeftLight {\uchar{37}{018}} %%BOX DRAWINGS DOWN HEAVY AND LEFT LIGHT
+\definecharacter UnicodeHeavyDownAndLeft {\uchar{37}{019}} %%BOX DRAWINGS HEAVY DOWN AND LEFT
+\definecharacter UnicodeLightUpAndRight {\uchar{37}{020}} %%BOX DRAWINGS LIGHT UP AND RIGHT
+\definecharacter UnicodeUpLightAndRightHeavy {\uchar{37}{021}} %%BOX DRAWINGS UP LIGHT AND RIGHT HEAVY
+\definecharacter UnicodeUpHeavyAndRightLight {\uchar{37}{022}} %%BOX DRAWINGS UP HEAVY AND RIGHT LIGHT
+\definecharacter UnicodeHeavyUpAndRight {\uchar{37}{023}} %%BOX DRAWINGS HEAVY UP AND RIGHT
+\definecharacter UnicodeLightUpAndLeft {\uchar{37}{024}} %%BOX DRAWINGS LIGHT UP AND LEFT
+\definecharacter UnicodeUpLightAndLeftHeavy {\uchar{37}{025}} %%BOX DRAWINGS UP LIGHT AND LEFT HEAVY
+\definecharacter UnicodeUpHeavyAndLeftLight {\uchar{37}{026}} %%BOX DRAWINGS UP HEAVY AND LEFT LIGHT
+\definecharacter UnicodeHeavyUpAndLeft {\uchar{37}{027}} %%BOX DRAWINGS HEAVY UP AND LEFT
+\definecharacter UnicodeLightVerticalAndRight {\uchar{37}{028}} %%BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+\definecharacter UnicodeVerticalLightAndRightHeavy {\uchar{37}{029}} %%BOX DRAWINGS VERTICAL LIGHT AND RIGHT HEAVY
+\definecharacter UnicodeUpHeavyAndRightDownLight {\uchar{37}{030}} %%BOX DRAWINGS UP HEAVY AND RIGHT DOWN LIGHT
+\definecharacter UnicodeDownHeavyAndRightUpLight {\uchar{37}{031}} %%BOX DRAWINGS DOWN HEAVY AND RIGHT UP LIGHT
+\definecharacter UnicodeVerticalHeavyAndRightLight {\uchar{37}{032}} %%BOX DRAWINGS VERTICAL HEAVY AND RIGHT LIGHT
+\definecharacter UnicodeDownLightAndRightUpHeavy {\uchar{37}{033}} %%BOX DRAWINGS DOWN LIGHT AND RIGHT UP HEAVY
+\definecharacter UnicodeUpLightAndRightDownHeavy {\uchar{37}{034}} %%BOX DRAWINGS UP LIGHT AND RIGHT DOWN HEAVY
+\definecharacter UnicodeHeavyVerticalAndRight {\uchar{37}{035}} %%BOX DRAWINGS HEAVY VERTICAL AND RIGHT
+\definecharacter UnicodeLightVerticalAndLeft {\uchar{37}{036}} %%BOX DRAWINGS LIGHT VERTICAL AND LEFT
+\definecharacter UnicodeVerticalLightAndLeftHeavy {\uchar{37}{037}} %%BOX DRAWINGS VERTICAL LIGHT AND LEFT HEAVY
+\definecharacter UnicodeUpHeavyAndLeftDownLight {\uchar{37}{038}} %%BOX DRAWINGS UP HEAVY AND LEFT DOWN LIGHT
+\definecharacter UnicodeDownHeavyAndLeftUpLight {\uchar{37}{039}} %%BOX DRAWINGS DOWN HEAVY AND LEFT UP LIGHT
+\definecharacter UnicodeVerticalHeavyAndLeftLight {\uchar{37}{040}} %%BOX DRAWINGS VERTICAL HEAVY AND LEFT LIGHT
+\definecharacter UnicodeDownLightAndLeftUpHeavy {\uchar{37}{041}} %%BOX DRAWINGS DOWN LIGHT AND LEFT UP HEAVY
+\definecharacter UnicodeUpLightAndLeftDownHeavy {\uchar{37}{042}} %%BOX DRAWINGS UP LIGHT AND LEFT DOWN HEAVY
+\definecharacter UnicodeHeavyVerticalAndLeft {\uchar{37}{043}} %%BOX DRAWINGS HEAVY VERTICAL AND LEFT
+\definecharacter UnicodeLightDownAndHorizontal {\uchar{37}{044}} %%BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+\definecharacter UnicodeLeftHeavyAndRightDownLight {\uchar{37}{045}} %%BOX DRAWINGS LEFT HEAVY AND RIGHT DOWN LIGHT
+\definecharacter UnicodeRightHeavyAndLeftDownLight {\uchar{37}{046}} %%BOX DRAWINGS RIGHT HEAVY AND LEFT DOWN LIGHT
+\definecharacter UnicodeDownLightAndHorizontalHeavy {\uchar{37}{047}} %%BOX DRAWINGS DOWN LIGHT AND HORIZONTAL HEAVY
+\definecharacter UnicodeDownHeavyAndHorizontalLight {\uchar{37}{048}} %%BOX DRAWINGS DOWN HEAVY AND HORIZONTAL LIGHT
+\definecharacter UnicodeRightLightAndLeftDownHeavy {\uchar{37}{049}} %%BOX DRAWINGS RIGHT LIGHT AND LEFT DOWN HEAVY
+\definecharacter UnicodeLeftLightAndRightDownHeavy {\uchar{37}{050}} %%BOX DRAWINGS LEFT LIGHT AND RIGHT DOWN HEAVY
+\definecharacter UnicodeHeavyDownAndHorizontal {\uchar{37}{051}} %%BOX DRAWINGS HEAVY DOWN AND HORIZONTAL
+\definecharacter UnicodeLightUpAndHorizontal {\uchar{37}{052}} %%BOX DRAWINGS LIGHT UP AND HORIZONTAL
+\definecharacter UnicodeLeftHeavyAndRightUpLight {\uchar{37}{053}} %%BOX DRAWINGS LEFT HEAVY AND RIGHT UP LIGHT
+\definecharacter UnicodeRightHeavyAndLeftUpLight {\uchar{37}{054}} %%BOX DRAWINGS RIGHT HEAVY AND LEFT UP LIGHT
+\definecharacter UnicodeUpLightAndHorizontalHeavy {\uchar{37}{055}} %%BOX DRAWINGS UP LIGHT AND HORIZONTAL HEAVY
+\definecharacter UnicodeUpHeavyAndHorizontalLight {\uchar{37}{056}} %%BOX DRAWINGS UP HEAVY AND HORIZONTAL LIGHT
+\definecharacter UnicodeRightLightAndLeftUpHeavy {\uchar{37}{057}} %%BOX DRAWINGS RIGHT LIGHT AND LEFT UP HEAVY
+\definecharacter UnicodeLeftLightAndRightUpHeavy {\uchar{37}{058}} %%BOX DRAWINGS LEFT LIGHT AND RIGHT UP HEAVY
+\definecharacter UnicodeHeavyUpAndHorizontal {\uchar{37}{059}} %%BOX DRAWINGS HEAVY UP AND HORIZONTAL
+\definecharacter UnicodeLightVerticalAndHorizontal {\uchar{37}{060}} %%BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+\definecharacter UnicodeLeftHeavyAndRightVerticalLight {\uchar{37}{061}} %%BOX DRAWINGS LEFT HEAVY AND RIGHT VERTICAL LIGHT
+\definecharacter UnicodeRightHeavyAndLeftVerticalLight {\uchar{37}{062}} %%BOX DRAWINGS RIGHT HEAVY AND LEFT VERTICAL LIGHT
+\definecharacter UnicodeVerticalLightAndHorizontalHeavy {\uchar{37}{063}} %%BOX DRAWINGS VERTICAL LIGHT AND HORIZONTAL HEAVY
+\definecharacter UnicodeUpHeavyAndDownHorizontalLight {\uchar{37}{064}} %%BOX DRAWINGS UP HEAVY AND DOWN HORIZONTAL LIGHT
+\definecharacter UnicodeDownHeavyAndUpHorizontalLight {\uchar{37}{065}} %%BOX DRAWINGS DOWN HEAVY AND UP HORIZONTAL LIGHT
+\definecharacter UnicodeVerticalHeavyAndHorizontalLight {\uchar{37}{066}} %%BOX DRAWINGS VERTICAL HEAVY AND HORIZONTAL LIGHT
+\definecharacter UnicodeLeftUpHeavyAndRightDownLight {\uchar{37}{067}} %%BOX DRAWINGS LEFT UP HEAVY AND RIGHT DOWN LIGHT
+\definecharacter UnicodeRightUpHeavyAndLeftDownLight {\uchar{37}{068}} %%BOX DRAWINGS RIGHT UP HEAVY AND LEFT DOWN LIGHT
+\definecharacter UnicodeLeftDownHeavyAndRightUpLight {\uchar{37}{069}} %%BOX DRAWINGS LEFT DOWN HEAVY AND RIGHT UP LIGHT
+\definecharacter UnicodeRightDownHeavyAndLeftUpLight {\uchar{37}{070}} %%BOX DRAWINGS RIGHT DOWN HEAVY AND LEFT UP LIGHT
+\definecharacter UnicodeDownLightAndUpHorizontalHeavy {\uchar{37}{071}} %%BOX DRAWINGS DOWN LIGHT AND UP HORIZONTAL HEAVY
+\definecharacter UnicodeUpLightAndDownHorizontalHeavy {\uchar{37}{072}} %%BOX DRAWINGS UP LIGHT AND DOWN HORIZONTAL HEAVY
+\definecharacter UnicodeRightLightAndLeftVerticalHeavy {\uchar{37}{073}} %%BOX DRAWINGS RIGHT LIGHT AND LEFT VERTICAL HEAVY
+\definecharacter UnicodeLeftLightAndRightVerticalHeavy {\uchar{37}{074}} %%BOX DRAWINGS LEFT LIGHT AND RIGHT VERTICAL HEAVY
+\definecharacter UnicodeHeavyVerticalAndHorizontal {\uchar{37}{075}} %%BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL
+\definecharacter UnicodeLightDoubleDashHorizontal {\uchar{37}{076}} %%BOX DRAWINGS LIGHT DOUBLE DASH HORIZONTAL
+\definecharacter UnicodeHeavyDoubleDashHorizontal {\uchar{37}{077}} %%BOX DRAWINGS HEAVY DOUBLE DASH HORIZONTAL
+\definecharacter UnicodeLightDoubleDashVertical {\uchar{37}{078}} %%BOX DRAWINGS LIGHT DOUBLE DASH VERTICAL
+\definecharacter UnicodeHeavyDoubleDashVertical {\uchar{37}{079}} %%BOX DRAWINGS HEAVY DOUBLE DASH VERTICAL
+\definecharacter UnicodeDoubleHorizontal {\uchar{37}{080}} %%BOX DRAWINGS DOUBLE HORIZONTAL
+\definecharacter UnicodeDoubleVertical {\uchar{37}{081}} %%BOX DRAWINGS DOUBLE VERTICAL
+\definecharacter UnicodeDownSingleAndRightDouble {\uchar{37}{082}} %%BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+\definecharacter UnicodeDownDoubleAndRightSingle {\uchar{37}{083}} %%BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+\definecharacter UnicodeDoubleDownAndRight {\uchar{37}{084}} %%BOX DRAWINGS DOUBLE DOWN AND RIGHT
+\definecharacter UnicodeDownSingleAndLeftDouble {\uchar{37}{085}} %%BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+\definecharacter UnicodeDownDoubleAndLeftSingle {\uchar{37}{086}} %%BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+\definecharacter UnicodeDoubleDownAndLeft {\uchar{37}{087}} %%BOX DRAWINGS DOUBLE DOWN AND LEFT
+\definecharacter UnicodeUpSingleAndRightDouble {\uchar{37}{088}} %%BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+\definecharacter UnicodeUpDoubleAndRightSingle {\uchar{37}{089}} %%BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+\definecharacter UnicodeDoubleUpAndRight {\uchar{37}{090}} %%BOX DRAWINGS DOUBLE UP AND RIGHT
+\definecharacter UnicodeUpSingleAndLeftDouble {\uchar{37}{091}} %%BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+\definecharacter UnicodeUpDoubleAndLeftSingle {\uchar{37}{092}} %%BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+\definecharacter UnicodeDoubleUpAndLeft {\uchar{37}{093}} %%BOX DRAWINGS DOUBLE UP AND LEFT
+\definecharacter UnicodeVerticalSingleAndRightDouble {\uchar{37}{094}} %%BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+\definecharacter UnicodeVerticalDoubleAndRightSingle {\uchar{37}{095}} %%BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+\definecharacter UnicodeDoubleVerticalAndRight {\uchar{37}{096}} %%BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+\definecharacter UnicodeVerticalSingleAndLeftDouble {\uchar{37}{097}} %%BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+\definecharacter UnicodeVerticalDoubleAndLeftSingle {\uchar{37}{098}} %%BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+\definecharacter UnicodeDoubleVerticalAndLeft {\uchar{37}{099}} %%BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+\definecharacter UnicodeDownSingleAndHorizontalDouble {\uchar{37}{100}} %%BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+\definecharacter UnicodeDownDoubleAndHorizontalSingle {\uchar{37}{101}} %%BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+\definecharacter UnicodeDoubleDownAndHorizontal {\uchar{37}{102}} %%BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+\definecharacter UnicodeUpSingleAndHorizontalDouble {\uchar{37}{103}} %%BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+\definecharacter UnicodeUpDoubleAndHorizontalSingle {\uchar{37}{104}} %%BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+\definecharacter UnicodeDoubleUpAndHorizontal {\uchar{37}{105}} %%BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+\definecharacter UnicodeVerticalSingleAndHorizontalDouble {\uchar{37}{106}} %%BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+\definecharacter UnicodeVerticalDoubleAndHorizontalSingle {\uchar{37}{107}} %%BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+\definecharacter UnicodeDoubleVerticalAndHorizontal {\uchar{37}{108}} %%BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+\definecharacter UnicodeLightArcDownAndRight {\uchar{37}{109}} %%BOX DRAWINGS LIGHT ARC DOWN AND RIGHT
+\definecharacter UnicodeLightArcDownAndLeft {\uchar{37}{110}} %%BOX DRAWINGS LIGHT ARC DOWN AND LEFT
+\definecharacter UnicodeLightArcUpAndLeft {\uchar{37}{111}} %%BOX DRAWINGS LIGHT ARC UP AND LEFT
+\definecharacter UnicodeLightArcUpAndRight {\uchar{37}{112}} %%BOX DRAWINGS LIGHT ARC UP AND RIGHT
+\definecharacter UnicodeLightDiagonalUpperRightToLowerLeft {\uchar{37}{113}} %%BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT
+\definecharacter UnicodeLightDiagonalUpperLeftToLowerRight {\uchar{37}{114}} %%BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT
+\definecharacter UnicodeLightDiagonalCross {\uchar{37}{115}} %%BOX DRAWINGS LIGHT DIAGONAL CROSS
+\definecharacter UnicodeLightLeft {\uchar{37}{116}} %%BOX DRAWINGS LIGHT LEFT
+\definecharacter UnicodeLightUp {\uchar{37}{117}} %%BOX DRAWINGS LIGHT UP
+\definecharacter UnicodeLightRight {\uchar{37}{118}} %%BOX DRAWINGS LIGHT RIGHT
+\definecharacter UnicodeLightDown {\uchar{37}{119}} %%BOX DRAWINGS LIGHT DOWN
+\definecharacter UnicodeHeavyLeft {\uchar{37}{120}} %%BOX DRAWINGS HEAVY LEFT
+\definecharacter UnicodeHeavyUp {\uchar{37}{121}} %%BOX DRAWINGS HEAVY UP
+\definecharacter UnicodeHeavyRight {\uchar{37}{122}} %%BOX DRAWINGS HEAVY RIGHT
+\definecharacter UnicodeHeavyDown {\uchar{37}{123}} %%BOX DRAWINGS HEAVY DOWN
+\definecharacter UnicodeLightLeftAndHeavyRight {\uchar{37}{124}} %%BOX DRAWINGS LIGHT LEFT AND HEAVY RIGHT
+\definecharacter UnicodeLightUpAndHeavyDown {\uchar{37}{125}} %%BOX DRAWINGS LIGHT UP AND HEAVY DOWN
+\definecharacter UnicodeHeavyLeftAndLightRight {\uchar{37}{126}} %%BOX DRAWINGS HEAVY LEFT AND LIGHT RIGHT
+\definecharacter UnicodeHeavyUpAndLightDown {\uchar{37}{127}} %%BOX DRAWINGS HEAVY UP AND LIGHT DOWN
+\definecharacter UnicodeUpperHalfBlock {\uchar{37}{128}} %%UPPER HALF BLOCK
+\definecharacter UnicodeLowerOneEighthBlock {\uchar{37}{129}} %%LOWER ONE EIGHTH BLOCK
+\definecharacter UnicodeLowerOneQuarterBlock {\uchar{37}{130}} %%LOWER ONE QUARTER BLOCK
+\definecharacter UnicodeLowerThreeEighthsBlock {\uchar{37}{131}} %%LOWER THREE EIGHTHS BLOCK
+\definecharacter UnicodeLowerHalfBlock {\uchar{37}{132}} %%LOWER HALF BLOCK
+\definecharacter UnicodeLowerFiveEighthsBlock {\uchar{37}{133}} %%LOWER FIVE EIGHTHS BLOCK
+\definecharacter UnicodeLowerThreeQuartersBlock {\uchar{37}{134}} %%LOWER THREE QUARTERS BLOCK
+\definecharacter UnicodeLowerSevenEighthsBlock {\uchar{37}{135}} %%LOWER SEVEN EIGHTHS BLOCK
+\definecharacter UnicodeFullBlock {\uchar{37}{136}} %%FULL BLOCK
+\definecharacter UnicodeLeftSevenEighthsBlock {\uchar{37}{137}} %%LEFT SEVEN EIGHTHS BLOCK
+\definecharacter UnicodeLeftThreeQuartersBlock {\uchar{37}{138}} %%LEFT THREE QUARTERS BLOCK
+\definecharacter UnicodeLeftFiveEighthsBlock {\uchar{37}{139}} %%LEFT FIVE EIGHTHS BLOCK
+\definecharacter UnicodeLeftHalfBlock {\uchar{37}{140}} %%LEFT HALF BLOCK
+\definecharacter UnicodeLeftThreeEighthsBlock {\uchar{37}{141}} %%LEFT THREE EIGHTHS BLOCK
+\definecharacter UnicodeLeftOneQuarterBlock {\uchar{37}{142}} %%LEFT ONE QUARTER BLOCK
+\definecharacter UnicodeLeftOneEighthBlock {\uchar{37}{143}} %%LEFT ONE EIGHTH BLOCK
+\definecharacter UnicodeRightHalfBlock {\uchar{37}{144}} %%RIGHT HALF BLOCK
+\definecharacter UnicodeLightShade {\uchar{37}{145}} %%LIGHT SHADE
+\definecharacter UnicodeMediumShade {\uchar{37}{146}} %%MEDIUM SHADE
+\definecharacter UnicodeDarkShade {\uchar{37}{147}} %%DARK SHADE
+\definecharacter UnicodeUpperOneEighthBlock {\uchar{37}{148}} %%UPPER ONE EIGHTH BLOCK
+\definecharacter UnicodeRightOneEighthBlock {\uchar{37}{149}} %%RIGHT ONE EIGHTH BLOCK
+\definecharacter UnicodeQuadrantLowerLeft {\uchar{37}{150}} %%[Unassigned U+2596]
+\definecharacter UnicodeQuadrantLowerRight {\uchar{37}{151}} %%[Unassigned U+2597]
+\definecharacter UnicodeQuadrantUpperLeft {\uchar{37}{152}} %%[Unassigned U+2598]
+\definecharacter UnicodeQuadrantUpperLeftAndLowerLeftAndLowerRight {\uchar{37}{153}} %%[Unassigned U+2599]
+\definecharacter UnicodeQuadrantUpperLeftAndLowerRight {\uchar{37}{154}} %%[Unassigned U+259A]
+\definecharacter UnicodeQuadrantUpperLeftAndUpperRightandLowerLeft {\uchar{37}{155}} %%[Unassigned U+259B]
+\definecharacter UnicodeQuadrantUpperLeftAndUpperRightAndLowerRight {\uchar{37}{156}} %%[Unassigned U+259C]
+\definecharacter UnicodeQuadrantUpperRight {\uchar{37}{157}} %%[Unassigned U+259D]
+\definecharacter UnicodeQuadrantUpperRightAndLowerLeft {\uchar{37}{158}} %%[Unassigned U+259E]
+\definecharacter UnicodeQuadrantUpperRightAndLowerLeftAndLowerRight {\uchar{37}{159}} %%[Unassigned U+259F]
+\definecharacter UnicodeBlackSquare {\uchar{37}{160}} %%BLACK SQUARE
+\definecharacter UnicodeWhiteSquare {\uchar{37}{161}} %%WHITE SQUARE
+\definecharacter UnicodeWhiteSquareWithRoundedCorners {\uchar{37}{162}} %%WHITE SQUARE WITH ROUNDED CORNERS
+\definecharacter UnicodeWhiteSquareContainingBlackSmallSquare {\uchar{37}{163}} %%WHITE SQUARE CONTAINING BLACK SMALL SQUARE
+\definecharacter UnicodeSquareWithHorizontalFill {\uchar{37}{164}} %%SQUARE WITH HORIZONTAL FILL
+\definecharacter UnicodeSquareWithVerticalFill {\uchar{37}{165}} %%SQUARE WITH VERTICAL FILL
+\definecharacter UnicodeSquareWithOrthogonalCrosshatchFill {\uchar{37}{166}} %%SQUARE WITH ORTHOGONAL CROSSHATCH FILL
+\definecharacter UnicodeSquareWithUpperLeftToLowerRightFill {\uchar{37}{167}} %%SQUARE WITH UPPER LEFT TO LOWER RIGHT FILL
+\definecharacter UnicodeSquareWithUpperRightToLowerLeftFill {\uchar{37}{168}} %%SQUARE WITH UPPER RIGHT TO LOWER LEFT FILL
+\definecharacter UnicodeSquareWithDiagonalCrosshatchFill {\uchar{37}{169}} %%SQUARE WITH DIAGONAL CROSSHATCH FILL
+\definecharacter UnicodeBlackSmallSquare {\uchar{37}{170}} %%BLACK SMALL SQUARE
+\definecharacter UnicodeWhiteSmallSquare {\uchar{37}{171}} %%WHITE SMALL SQUARE
+\definecharacter UnicodeBlackRectangle {\uchar{37}{172}} %%BLACK RECTANGLE
+\definecharacter UnicodeWhiteRectangle {\uchar{37}{173}} %%WHITE RECTANGLE
+\definecharacter UnicodeBlackVerticalRectangle {\uchar{37}{174}} %%BLACK VERTICAL RECTANGLE
+\definecharacter UnicodeWhiteVerticalRectangle {\uchar{37}{175}} %%WHITE VERTICAL RECTANGLE
+\definecharacter UnicodeBlackParallelogram {\uchar{37}{176}} %%BLACK PARALLELOGRAM
+\definecharacter UnicodeWhiteParallelogram {\uchar{37}{177}} %%WHITE PARALLELOGRAM
+\definecharacter UnicodeBlackUpPointingTriangle {\uchar{37}{178}} %%BLACK UP-POINTING TRIANGLE
+\definecharacter UnicodeWhiteUpPointingTriangle {\uchar{37}{179}} %%WHITE UP-POINTING TRIANGLE
+\definecharacter UnicodeBlackUpPointingSmallTriangle {\uchar{37}{180}} %%BLACK UP-POINTING SMALL TRIANGLE
+\definecharacter UnicodeWhiteUpPointingSmallTriangle {\uchar{37}{181}} %%WHITE UP-POINTING SMALL TRIANGLE
+\definecharacter UnicodeBlackRightPointingTriangle {\uchar{37}{182}} %%BLACK RIGHT-POINTING TRIANGLE
+\definecharacter UnicodeWhiteRightPointingTriangle {\uchar{37}{183}} %%WHITE RIGHT-POINTING TRIANGLE
+\definecharacter UnicodeBlackRightPointingSmallTriangle {\uchar{37}{184}} %%BLACK RIGHT-POINTING SMALL TRIANGLE
+\definecharacter UnicodeWhiteRightPointingSmallTriangle {\uchar{37}{185}} %%WHITE RIGHT-POINTING SMALL TRIANGLE
+\definecharacter UnicodeBlackRightPointingPointer {\uchar{37}{186}} %%BLACK RIGHT-POINTING POINTER
+\definecharacter UnicodeWhiteRightPointingPointer {\uchar{37}{187}} %%WHITE RIGHT-POINTING POINTER
+\definecharacter UnicodeBlackDownPointingTriangle {\uchar{37}{188}} %%BLACK DOWN-POINTING TRIANGLE
+\definecharacter UnicodeWhiteDownPointingTriangle {\uchar{37}{189}} %%WHITE DOWN-POINTING TRIANGLE
+\definecharacter UnicodeBlackDownPointingSmallTriangle {\uchar{37}{190}} %%BLACK DOWN-POINTING SMALL TRIANGLE
+\definecharacter UnicodeWhiteDownPointingSmallTriangle {\uchar{37}{191}} %%WHITE DOWN-POINTING SMALL TRIANGLE
+\definecharacter UnicodeBlackLeftPointingTriangle {\uchar{37}{192}} %%BLACK LEFT-POINTING TRIANGLE
+\definecharacter UnicodeWhiteLeftPointingTriangle {\uchar{37}{193}} %%WHITE LEFT-POINTING TRIANGLE
+\definecharacter UnicodeBlackLeftPointingSmallTriangle {\uchar{37}{194}} %%BLACK LEFT-POINTING SMALL TRIANGLE
+\definecharacter UnicodeWhiteLeftPointingSmallTriangle {\uchar{37}{195}} %%WHITE LEFT-POINTING SMALL TRIANGLE
+\definecharacter UnicodeBlackLeftPointingPointer {\uchar{37}{196}} %%BLACK LEFT-POINTING POINTER
+\definecharacter UnicodeWhiteLeftPointingPointer {\uchar{37}{197}} %%WHITE LEFT-POINTING POINTER
+\definecharacter UnicodeBlackDiamond {\uchar{37}{198}} %%BLACK DIAMOND
+\definecharacter UnicodeWhiteDiamond {\uchar{37}{199}} %%WHITE DIAMOND
+\definecharacter UnicodeWhiteDiamondContainingBlackSmallDiamond {\uchar{37}{200}} %%WHITE DIAMOND CONTAINING BLACK SMALL DIAMOND
+\definecharacter UnicodeFisheye {\uchar{37}{201}} %%FISHEYE
+\definecharacter UnicodeLozenge {\uchar{37}{202}} %%LOZENGE
+\definecharacter UnicodeWhiteCircle {\uchar{37}{203}} %%WHITE CIRCLE
+\definecharacter UnicodeDottedCircle {\uchar{37}{204}} %%DOTTED CIRCLE
+\definecharacter UnicodeCircleWithVerticalFill {\uchar{37}{205}} %%CIRCLE WITH VERTICAL FILL
+\definecharacter UnicodeBullseye {\uchar{37}{206}} %%BULLSEYE
+\definecharacter UnicodeBlackCircle {\uchar{37}{207}} %%BLACK CIRCLE
+\definecharacter UnicodeCircleWithLeftHalfBlack {\uchar{37}{208}} %%CIRCLE WITH LEFT HALF BLACK
+\definecharacter UnicodeCircleWithRightHalfBlack {\uchar{37}{209}} %%CIRCLE WITH RIGHT HALF BLACK
+\definecharacter UnicodeCircleWithLowerHalfBlack {\uchar{37}{210}} %%CIRCLE WITH LOWER HALF BLACK
+\definecharacter UnicodeCircleWithUpperHalfBlack {\uchar{37}{211}} %%CIRCLE WITH UPPER HALF BLACK
+\definecharacter UnicodeCircleWithUpperRightQuadrantBlack {\uchar{37}{212}} %%CIRCLE WITH UPPER RIGHT QUADRANT BLACK
+\definecharacter UnicodeCircleWithAllButUpperLeftQuadrantBlack {\uchar{37}{213}} %%CIRCLE WITH ALL BUT UPPER LEFT QUADRANT BLACK
+\definecharacter UnicodeLeftHalfBlackCircle {\uchar{37}{214}} %%LEFT HALF BLACK CIRCLE
+\definecharacter UnicodeRightHalfBlackCircle {\uchar{37}{215}} %%RIGHT HALF BLACK CIRCLE
+\definecharacter UnicodeInverseBullet {\uchar{37}{216}} %%INVERSE BULLET
+\definecharacter UnicodeInverseWhiteCircle {\uchar{37}{217}} %%INVERSE WHITE CIRCLE
+\definecharacter UnicodeUpperHalfInverseWhiteCircle {\uchar{37}{218}} %%UPPER HALF INVERSE WHITE CIRCLE
+\definecharacter UnicodeLowerHalfInverseWhiteCircle {\uchar{37}{219}} %%LOWER HALF INVERSE WHITE CIRCLE
+\definecharacter UnicodeUpperLeftQuadrantCircularArc {\uchar{37}{220}} %%UPPER LEFT QUADRANT CIRCULAR ARC
+\definecharacter UnicodeUpperRightQuadrantCircularArc {\uchar{37}{221}} %%UPPER RIGHT QUADRANT CIRCULAR ARC
+\definecharacter UnicodeLowerRightQuadrantCircularArc {\uchar{37}{222}} %%LOWER RIGHT QUADRANT CIRCULAR ARC
+\definecharacter UnicodeLowerLeftQuadrantCircularArc {\uchar{37}{223}} %%LOWER LEFT QUADRANT CIRCULAR ARC
+\definecharacter UnicodeUpperHalfCircle {\uchar{37}{224}} %%UPPER HALF CIRCLE
+\definecharacter UnicodeLowerHalfCircle {\uchar{37}{225}} %%LOWER HALF CIRCLE
+\definecharacter UnicodeBlackLowerRightTriangle {\uchar{37}{226}} %%BLACK LOWER RIGHT TRIANGLE
+\definecharacter UnicodeBlackLowerLeftTriangle {\uchar{37}{227}} %%BLACK LOWER LEFT TRIANGLE
+\definecharacter UnicodeBlackUpperLeftTriangle {\uchar{37}{228}} %%BLACK UPPER LEFT TRIANGLE
+\definecharacter UnicodeBlackUpperRightTriangle {\uchar{37}{229}} %%BLACK UPPER RIGHT TRIANGLE
+\definecharacter UnicodeWhiteBullet {\uchar{37}{230}} %%WHITE BULLET
+\definecharacter UnicodeSquareWithLeftHalfBlack {\uchar{37}{231}} %%SQUARE WITH LEFT HALF BLACK
+\definecharacter UnicodeSquareWithRightHalfBlack {\uchar{37}{232}} %%SQUARE WITH RIGHT HALF BLACK
+\definecharacter UnicodeSquareWithUpperLeftDiagonalHalfBlack {\uchar{37}{233}} %%SQUARE WITH UPPER LEFT DIAGONAL HALF BLACK
+\definecharacter UnicodeSquareWithLowerRightDiagonalHalfBlack {\uchar{37}{234}} %%SQUARE WITH LOWER RIGHT DIAGONAL HALF BLACK
+\definecharacter UnicodeWhiteSquareWithVerticalBisectingLine {\uchar{37}{235}} %%WHITE SQUARE WITH VERTICAL BISECTING LINE
+\definecharacter UnicodeWhiteUpPointingTriangleWithDot {\uchar{37}{236}} %%WHITE UP-POINTING TRIANGLE WITH DOT
+\definecharacter UnicodeUpPointingTriangleWithLeftHalfBlack {\uchar{37}{237}} %%UP-POINTING TRIANGLE WITH LEFT HALF BLACK
+\definecharacter UnicodeUpPointingTriangleWithRightHalfBlack {\uchar{37}{238}} %%UP-POINTING TRIANGLE WITH RIGHT HALF BLACK
+\definecharacter UnicodeLargeCircle {\uchar{37}{239}} %%LARGE CIRCLE
+\definecharacter UnicodeWhiteSquareWithUpperLeftQuadrant {\uchar{37}{240}} %%WHITE SQUARE WITH UPPER LEFT QUADRANT
+\definecharacter UnicodeWhiteSquareWithLowerLeftQuadrant {\uchar{37}{241}} %%WHITE SQUARE WITH LOWER LEFT QUADRANT
+\definecharacter UnicodeWhiteSquareWithLowerRightQuadrant {\uchar{37}{242}} %%WHITE SQUARE WITH LOWER RIGHT QUADRANT
+\definecharacter UnicodeWhiteSquareWithUpperRightQuadrant {\uchar{37}{243}} %%WHITE SQUARE WITH UPPER RIGHT QUADRANT
+\definecharacter UnicodeWhiteCircleWithUpperLeftQuadrant {\uchar{37}{244}} %%WHITE CIRCLE WITH UPPER LEFT QUADRANT
+\definecharacter UnicodeWhiteCircleWithLowerLeftQuadrant {\uchar{37}{245}} %%WHITE CIRCLE WITH LOWER LEFT QUADRANT
+\definecharacter UnicodeWhiteCircleWithLowerRightQuadrant {\uchar{37}{246}} %%WHITE CIRCLE WITH LOWER RIGHT QUADRANT
+\definecharacter UnicodeWhiteCircleWithUpperRightQuadrant {\uchar{37}{247}} %%WHITE CIRCLE WITH UPPER RIGHT QUADRANT
+\definecharacter UnicodeUpperLeftTriangle {\uchar{37}{248}} %%[Unassigned U+25F8]
+\definecharacter UnicodeUpperRightTriangle {\uchar{37}{249}} %%[Unassigned U+25F9]
+\definecharacter UnicodeLowerLeftTriangle {\uchar{37}{250}} %%[Unassigned U+25FA]
+\definecharacter UnicodeWhiteMediumSquare {\uchar{37}{251}} %%[Unassigned U+25FB]
+\definecharacter UnicodeBlackMediumSquare {\uchar{37}{252}} %%[Unassigned U+25FC]
+\definecharacter UnicodeWhiteMediumSmallSquare {\uchar{37}{253}} %%[Unassigned U+25FD]
+\definecharacter UnicodeBlackMediumSmallSquare {\uchar{37}{254}} %%[Unassigned U+25FE]
+\definecharacter UnicodeLowerRightTriangle {\uchar{37}{255}} %%[Unassigned U+25FF]
+
+\stopencoding
+
+\endinput
+
diff --git a/tex/context/base/enco-037.tex b/tex/context/base/enco-037.tex
deleted file mode 100644
index d9fc653b2..000000000
--- a/tex/context/base/enco-037.tex
+++ /dev/null
@@ -1,276 +0,0 @@
-%D \module
-%D [ file=enco-037,
-%D version=2006.02.13,
-%D title=\CONTEXT\ \UNICODE\ Macros,
-%D subtitle=Encoding for vector 37,
-%D author=Luigi Scarso,
-%D date=\currentdate,
-%D copyright={PRAGMA}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\startencoding[default]
-
-\definecharacter UnicodeLightHorizontal {\uchar{37}{000}} %%BOX DRAWINGS LIGHT HORIZONTAL
-\definecharacter UnicodeHeavyHorizontal {\uchar{37}{001}} %%BOX DRAWINGS HEAVY HORIZONTAL
-\definecharacter UnicodeLightVertical {\uchar{37}{002}} %%BOX DRAWINGS LIGHT VERTICAL
-\definecharacter UnicodeHeavyVertical {\uchar{37}{003}} %%BOX DRAWINGS HEAVY VERTICAL
-\definecharacter UnicodeLightTripleDashHorizontal {\uchar{37}{004}} %%BOX DRAWINGS LIGHT TRIPLE DASH HORIZONTAL
-\definecharacter UnicodeHeavyTripleDashHorizontal {\uchar{37}{005}} %%BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL
-\definecharacter UnicodeLightTripleDashVertical {\uchar{37}{006}} %%BOX DRAWINGS LIGHT TRIPLE DASH VERTICAL
-\definecharacter UnicodeHeavyTripleDashVertical {\uchar{37}{007}} %%BOX DRAWINGS HEAVY TRIPLE DASH VERTICAL
-\definecharacter UnicodeLightQuadrupleDashHorizontal {\uchar{37}{008}} %%BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL
-\definecharacter UnicodeHeavyQuadrupleDashHorizontal {\uchar{37}{009}} %%BOX DRAWINGS HEAVY QUADRUPLE DASH HORIZONTAL
-\definecharacter UnicodeLightQuadrupleDashVertical {\uchar{37}{010}} %%BOX DRAWINGS LIGHT QUADRUPLE DASH VERTICAL
-\definecharacter UnicodeHeavyQuadrupleDashVertical {\uchar{37}{011}} %%BOX DRAWINGS HEAVY QUADRUPLE DASH VERTICAL
-\definecharacter UnicodeLightDownAndRight {\uchar{37}{012}} %%BOX DRAWINGS LIGHT DOWN AND RIGHT
-\definecharacter UnicodeDownLightAndRightHeavy {\uchar{37}{013}} %%BOX DRAWINGS DOWN LIGHT AND RIGHT HEAVY
-\definecharacter UnicodeDownHeavyAndRightLight {\uchar{37}{014}} %%BOX DRAWINGS DOWN HEAVY AND RIGHT LIGHT
-\definecharacter UnicodeHeavyDownAndRight {\uchar{37}{015}} %%BOX DRAWINGS HEAVY DOWN AND RIGHT
-\definecharacter UnicodeLightDownAndLeft {\uchar{37}{016}} %%BOX DRAWINGS LIGHT DOWN AND LEFT
-\definecharacter UnicodeDownLightAndLeftHeavy {\uchar{37}{017}} %%BOX DRAWINGS DOWN LIGHT AND LEFT HEAVY
-\definecharacter UnicodeDownHeavyAndLeftLight {\uchar{37}{018}} %%BOX DRAWINGS DOWN HEAVY AND LEFT LIGHT
-\definecharacter UnicodeHeavyDownAndLeft {\uchar{37}{019}} %%BOX DRAWINGS HEAVY DOWN AND LEFT
-\definecharacter UnicodeLightUpAndRight {\uchar{37}{020}} %%BOX DRAWINGS LIGHT UP AND RIGHT
-\definecharacter UnicodeUpLightAndRightHeavy {\uchar{37}{021}} %%BOX DRAWINGS UP LIGHT AND RIGHT HEAVY
-\definecharacter UnicodeUpHeavyAndRightLight {\uchar{37}{022}} %%BOX DRAWINGS UP HEAVY AND RIGHT LIGHT
-\definecharacter UnicodeHeavyUpAndRight {\uchar{37}{023}} %%BOX DRAWINGS HEAVY UP AND RIGHT
-\definecharacter UnicodeLightUpAndLeft {\uchar{37}{024}} %%BOX DRAWINGS LIGHT UP AND LEFT
-\definecharacter UnicodeUpLightAndLeftHeavy {\uchar{37}{025}} %%BOX DRAWINGS UP LIGHT AND LEFT HEAVY
-\definecharacter UnicodeUpHeavyAndLeftLight {\uchar{37}{026}} %%BOX DRAWINGS UP HEAVY AND LEFT LIGHT
-\definecharacter UnicodeHeavyUpAndLeft {\uchar{37}{027}} %%BOX DRAWINGS HEAVY UP AND LEFT
-\definecharacter UnicodeLightVerticalAndRight {\uchar{37}{028}} %%BOX DRAWINGS LIGHT VERTICAL AND RIGHT
-\definecharacter UnicodeVerticalLightAndRightHeavy {\uchar{37}{029}} %%BOX DRAWINGS VERTICAL LIGHT AND RIGHT HEAVY
-\definecharacter UnicodeUpHeavyAndRightDownLight {\uchar{37}{030}} %%BOX DRAWINGS UP HEAVY AND RIGHT DOWN LIGHT
-\definecharacter UnicodeDownHeavyAndRightUpLight {\uchar{37}{031}} %%BOX DRAWINGS DOWN HEAVY AND RIGHT UP LIGHT
-\definecharacter UnicodeVerticalHeavyAndRightLight {\uchar{37}{032}} %%BOX DRAWINGS VERTICAL HEAVY AND RIGHT LIGHT
-\definecharacter UnicodeDownLightAndRightUpHeavy {\uchar{37}{033}} %%BOX DRAWINGS DOWN LIGHT AND RIGHT UP HEAVY
-\definecharacter UnicodeUpLightAndRightDownHeavy {\uchar{37}{034}} %%BOX DRAWINGS UP LIGHT AND RIGHT DOWN HEAVY
-\definecharacter UnicodeHeavyVerticalAndRight {\uchar{37}{035}} %%BOX DRAWINGS HEAVY VERTICAL AND RIGHT
-\definecharacter UnicodeLightVerticalAndLeft {\uchar{37}{036}} %%BOX DRAWINGS LIGHT VERTICAL AND LEFT
-\definecharacter UnicodeVerticalLightAndLeftHeavy {\uchar{37}{037}} %%BOX DRAWINGS VERTICAL LIGHT AND LEFT HEAVY
-\definecharacter UnicodeUpHeavyAndLeftDownLight {\uchar{37}{038}} %%BOX DRAWINGS UP HEAVY AND LEFT DOWN LIGHT
-\definecharacter UnicodeDownHeavyAndLeftUpLight {\uchar{37}{039}} %%BOX DRAWINGS DOWN HEAVY AND LEFT UP LIGHT
-\definecharacter UnicodeVerticalHeavyAndLeftLight {\uchar{37}{040}} %%BOX DRAWINGS VERTICAL HEAVY AND LEFT LIGHT
-\definecharacter UnicodeDownLightAndLeftUpHeavy {\uchar{37}{041}} %%BOX DRAWINGS DOWN LIGHT AND LEFT UP HEAVY
-\definecharacter UnicodeUpLightAndLeftDownHeavy {\uchar{37}{042}} %%BOX DRAWINGS UP LIGHT AND LEFT DOWN HEAVY
-\definecharacter UnicodeHeavyVerticalAndLeft {\uchar{37}{043}} %%BOX DRAWINGS HEAVY VERTICAL AND LEFT
-\definecharacter UnicodeLightDownAndHorizontal {\uchar{37}{044}} %%BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
-\definecharacter UnicodeLeftHeavyAndRightDownLight {\uchar{37}{045}} %%BOX DRAWINGS LEFT HEAVY AND RIGHT DOWN LIGHT
-\definecharacter UnicodeRightHeavyAndLeftDownLight {\uchar{37}{046}} %%BOX DRAWINGS RIGHT HEAVY AND LEFT DOWN LIGHT
-\definecharacter UnicodeDownLightAndHorizontalHeavy {\uchar{37}{047}} %%BOX DRAWINGS DOWN LIGHT AND HORIZONTAL HEAVY
-\definecharacter UnicodeDownHeavyAndHorizontalLight {\uchar{37}{048}} %%BOX DRAWINGS DOWN HEAVY AND HORIZONTAL LIGHT
-\definecharacter UnicodeRightLightAndLeftDownHeavy {\uchar{37}{049}} %%BOX DRAWINGS RIGHT LIGHT AND LEFT DOWN HEAVY
-\definecharacter UnicodeLeftLightAndRightDownHeavy {\uchar{37}{050}} %%BOX DRAWINGS LEFT LIGHT AND RIGHT DOWN HEAVY
-\definecharacter UnicodeHeavyDownAndHorizontal {\uchar{37}{051}} %%BOX DRAWINGS HEAVY DOWN AND HORIZONTAL
-\definecharacter UnicodeLightUpAndHorizontal {\uchar{37}{052}} %%BOX DRAWINGS LIGHT UP AND HORIZONTAL
-\definecharacter UnicodeLeftHeavyAndRightUpLight {\uchar{37}{053}} %%BOX DRAWINGS LEFT HEAVY AND RIGHT UP LIGHT
-\definecharacter UnicodeRightHeavyAndLeftUpLight {\uchar{37}{054}} %%BOX DRAWINGS RIGHT HEAVY AND LEFT UP LIGHT
-\definecharacter UnicodeUpLightAndHorizontalHeavy {\uchar{37}{055}} %%BOX DRAWINGS UP LIGHT AND HORIZONTAL HEAVY
-\definecharacter UnicodeUpHeavyAndHorizontalLight {\uchar{37}{056}} %%BOX DRAWINGS UP HEAVY AND HORIZONTAL LIGHT
-\definecharacter UnicodeRightLightAndLeftUpHeavy {\uchar{37}{057}} %%BOX DRAWINGS RIGHT LIGHT AND LEFT UP HEAVY
-\definecharacter UnicodeLeftLightAndRightUpHeavy {\uchar{37}{058}} %%BOX DRAWINGS LEFT LIGHT AND RIGHT UP HEAVY
-\definecharacter UnicodeHeavyUpAndHorizontal {\uchar{37}{059}} %%BOX DRAWINGS HEAVY UP AND HORIZONTAL
-\definecharacter UnicodeLightVerticalAndHorizontal {\uchar{37}{060}} %%BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
-\definecharacter UnicodeLeftHeavyAndRightVerticalLight {\uchar{37}{061}} %%BOX DRAWINGS LEFT HEAVY AND RIGHT VERTICAL LIGHT
-\definecharacter UnicodeRightHeavyAndLeftVerticalLight {\uchar{37}{062}} %%BOX DRAWINGS RIGHT HEAVY AND LEFT VERTICAL LIGHT
-\definecharacter UnicodeVerticalLightAndHorizontalHeavy {\uchar{37}{063}} %%BOX DRAWINGS VERTICAL LIGHT AND HORIZONTAL HEAVY
-\definecharacter UnicodeUpHeavyAndDownHorizontalLight {\uchar{37}{064}} %%BOX DRAWINGS UP HEAVY AND DOWN HORIZONTAL LIGHT
-\definecharacter UnicodeDownHeavyAndUpHorizontalLight {\uchar{37}{065}} %%BOX DRAWINGS DOWN HEAVY AND UP HORIZONTAL LIGHT
-\definecharacter UnicodeVerticalHeavyAndHorizontalLight {\uchar{37}{066}} %%BOX DRAWINGS VERTICAL HEAVY AND HORIZONTAL LIGHT
-\definecharacter UnicodeLeftUpHeavyAndRightDownLight {\uchar{37}{067}} %%BOX DRAWINGS LEFT UP HEAVY AND RIGHT DOWN LIGHT
-\definecharacter UnicodeRightUpHeavyAndLeftDownLight {\uchar{37}{068}} %%BOX DRAWINGS RIGHT UP HEAVY AND LEFT DOWN LIGHT
-\definecharacter UnicodeLeftDownHeavyAndRightUpLight {\uchar{37}{069}} %%BOX DRAWINGS LEFT DOWN HEAVY AND RIGHT UP LIGHT
-\definecharacter UnicodeRightDownHeavyAndLeftUpLight {\uchar{37}{070}} %%BOX DRAWINGS RIGHT DOWN HEAVY AND LEFT UP LIGHT
-\definecharacter UnicodeDownLightAndUpHorizontalHeavy {\uchar{37}{071}} %%BOX DRAWINGS DOWN LIGHT AND UP HORIZONTAL HEAVY
-\definecharacter UnicodeUpLightAndDownHorizontalHeavy {\uchar{37}{072}} %%BOX DRAWINGS UP LIGHT AND DOWN HORIZONTAL HEAVY
-\definecharacter UnicodeRightLightAndLeftVerticalHeavy {\uchar{37}{073}} %%BOX DRAWINGS RIGHT LIGHT AND LEFT VERTICAL HEAVY
-\definecharacter UnicodeLeftLightAndRightVerticalHeavy {\uchar{37}{074}} %%BOX DRAWINGS LEFT LIGHT AND RIGHT VERTICAL HEAVY
-\definecharacter UnicodeHeavyVerticalAndHorizontal {\uchar{37}{075}} %%BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL
-\definecharacter UnicodeLightDoubleDashHorizontal {\uchar{37}{076}} %%BOX DRAWINGS LIGHT DOUBLE DASH HORIZONTAL
-\definecharacter UnicodeHeavyDoubleDashHorizontal {\uchar{37}{077}} %%BOX DRAWINGS HEAVY DOUBLE DASH HORIZONTAL
-\definecharacter UnicodeLightDoubleDashVertical {\uchar{37}{078}} %%BOX DRAWINGS LIGHT DOUBLE DASH VERTICAL
-\definecharacter UnicodeHeavyDoubleDashVertical {\uchar{37}{079}} %%BOX DRAWINGS HEAVY DOUBLE DASH VERTICAL
-\definecharacter UnicodeDoubleHorizontal {\uchar{37}{080}} %%BOX DRAWINGS DOUBLE HORIZONTAL
-\definecharacter UnicodeDoubleVertical {\uchar{37}{081}} %%BOX DRAWINGS DOUBLE VERTICAL
-\definecharacter UnicodeDownSingleAndRightDouble {\uchar{37}{082}} %%BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
-\definecharacter UnicodeDownDoubleAndRightSingle {\uchar{37}{083}} %%BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
-\definecharacter UnicodeDoubleDownAndRight {\uchar{37}{084}} %%BOX DRAWINGS DOUBLE DOWN AND RIGHT
-\definecharacter UnicodeDownSingleAndLeftDouble {\uchar{37}{085}} %%BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
-\definecharacter UnicodeDownDoubleAndLeftSingle {\uchar{37}{086}} %%BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
-\definecharacter UnicodeDoubleDownAndLeft {\uchar{37}{087}} %%BOX DRAWINGS DOUBLE DOWN AND LEFT
-\definecharacter UnicodeUpSingleAndRightDouble {\uchar{37}{088}} %%BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
-\definecharacter UnicodeUpDoubleAndRightSingle {\uchar{37}{089}} %%BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
-\definecharacter UnicodeDoubleUpAndRight {\uchar{37}{090}} %%BOX DRAWINGS DOUBLE UP AND RIGHT
-\definecharacter UnicodeUpSingleAndLeftDouble {\uchar{37}{091}} %%BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
-\definecharacter UnicodeUpDoubleAndLeftSingle {\uchar{37}{092}} %%BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
-\definecharacter UnicodeDoubleUpAndLeft {\uchar{37}{093}} %%BOX DRAWINGS DOUBLE UP AND LEFT
-\definecharacter UnicodeVerticalSingleAndRightDouble {\uchar{37}{094}} %%BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
-\definecharacter UnicodeVerticalDoubleAndRightSingle {\uchar{37}{095}} %%BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
-\definecharacter UnicodeDoubleVerticalAndRight {\uchar{37}{096}} %%BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
-\definecharacter UnicodeVerticalSingleAndLeftDouble {\uchar{37}{097}} %%BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
-\definecharacter UnicodeVerticalDoubleAndLeftSingle {\uchar{37}{098}} %%BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
-\definecharacter UnicodeDoubleVerticalAndLeft {\uchar{37}{099}} %%BOX DRAWINGS DOUBLE VERTICAL AND LEFT
-\definecharacter UnicodeDownSingleAndHorizontalDouble {\uchar{37}{100}} %%BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
-\definecharacter UnicodeDownDoubleAndHorizontalSingle {\uchar{37}{101}} %%BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
-\definecharacter UnicodeDoubleDownAndHorizontal {\uchar{37}{102}} %%BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
-\definecharacter UnicodeUpSingleAndHorizontalDouble {\uchar{37}{103}} %%BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
-\definecharacter UnicodeUpDoubleAndHorizontalSingle {\uchar{37}{104}} %%BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
-\definecharacter UnicodeDoubleUpAndHorizontal {\uchar{37}{105}} %%BOX DRAWINGS DOUBLE UP AND HORIZONTAL
-\definecharacter UnicodeVerticalSingleAndHorizontalDouble {\uchar{37}{106}} %%BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
-\definecharacter UnicodeVerticalDoubleAndHorizontalSingle {\uchar{37}{107}} %%BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
-\definecharacter UnicodeDoubleVerticalAndHorizontal {\uchar{37}{108}} %%BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
-\definecharacter UnicodeLightArcDownAndRight {\uchar{37}{109}} %%BOX DRAWINGS LIGHT ARC DOWN AND RIGHT
-\definecharacter UnicodeLightArcDownAndLeft {\uchar{37}{110}} %%BOX DRAWINGS LIGHT ARC DOWN AND LEFT
-\definecharacter UnicodeLightArcUpAndLeft {\uchar{37}{111}} %%BOX DRAWINGS LIGHT ARC UP AND LEFT
-\definecharacter UnicodeLightArcUpAndRight {\uchar{37}{112}} %%BOX DRAWINGS LIGHT ARC UP AND RIGHT
-\definecharacter UnicodeLightDiagonalUpperRightToLowerLeft {\uchar{37}{113}} %%BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT
-\definecharacter UnicodeLightDiagonalUpperLeftToLowerRight {\uchar{37}{114}} %%BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT
-\definecharacter UnicodeLightDiagonalCross {\uchar{37}{115}} %%BOX DRAWINGS LIGHT DIAGONAL CROSS
-\definecharacter UnicodeLightLeft {\uchar{37}{116}} %%BOX DRAWINGS LIGHT LEFT
-\definecharacter UnicodeLightUp {\uchar{37}{117}} %%BOX DRAWINGS LIGHT UP
-\definecharacter UnicodeLightRight {\uchar{37}{118}} %%BOX DRAWINGS LIGHT RIGHT
-\definecharacter UnicodeLightDown {\uchar{37}{119}} %%BOX DRAWINGS LIGHT DOWN
-\definecharacter UnicodeHeavyLeft {\uchar{37}{120}} %%BOX DRAWINGS HEAVY LEFT
-\definecharacter UnicodeHeavyUp {\uchar{37}{121}} %%BOX DRAWINGS HEAVY UP
-\definecharacter UnicodeHeavyRight {\uchar{37}{122}} %%BOX DRAWINGS HEAVY RIGHT
-\definecharacter UnicodeHeavyDown {\uchar{37}{123}} %%BOX DRAWINGS HEAVY DOWN
-\definecharacter UnicodeLightLeftAndHeavyRight {\uchar{37}{124}} %%BOX DRAWINGS LIGHT LEFT AND HEAVY RIGHT
-\definecharacter UnicodeLightUpAndHeavyDown {\uchar{37}{125}} %%BOX DRAWINGS LIGHT UP AND HEAVY DOWN
-\definecharacter UnicodeHeavyLeftAndLightRight {\uchar{37}{126}} %%BOX DRAWINGS HEAVY LEFT AND LIGHT RIGHT
-\definecharacter UnicodeHeavyUpAndLightDown {\uchar{37}{127}} %%BOX DRAWINGS HEAVY UP AND LIGHT DOWN
-\definecharacter UnicodeUpperHalfBlock {\uchar{37}{128}} %%UPPER HALF BLOCK
-\definecharacter UnicodeLowerOneEighthBlock {\uchar{37}{129}} %%LOWER ONE EIGHTH BLOCK
-\definecharacter UnicodeLowerOneQuarterBlock {\uchar{37}{130}} %%LOWER ONE QUARTER BLOCK
-\definecharacter UnicodeLowerThreeEighthsBlock {\uchar{37}{131}} %%LOWER THREE EIGHTHS BLOCK
-\definecharacter UnicodeLowerHalfBlock {\uchar{37}{132}} %%LOWER HALF BLOCK
-\definecharacter UnicodeLowerFiveEighthsBlock {\uchar{37}{133}} %%LOWER FIVE EIGHTHS BLOCK
-\definecharacter UnicodeLowerThreeQuartersBlock {\uchar{37}{134}} %%LOWER THREE QUARTERS BLOCK
-\definecharacter UnicodeLowerSevenEighthsBlock {\uchar{37}{135}} %%LOWER SEVEN EIGHTHS BLOCK
-\definecharacter UnicodeFullBlock {\uchar{37}{136}} %%FULL BLOCK
-\definecharacter UnicodeLeftSevenEighthsBlock {\uchar{37}{137}} %%LEFT SEVEN EIGHTHS BLOCK
-\definecharacter UnicodeLeftThreeQuartersBlock {\uchar{37}{138}} %%LEFT THREE QUARTERS BLOCK
-\definecharacter UnicodeLeftFiveEighthsBlock {\uchar{37}{139}} %%LEFT FIVE EIGHTHS BLOCK
-\definecharacter UnicodeLeftHalfBlock {\uchar{37}{140}} %%LEFT HALF BLOCK
-\definecharacter UnicodeLeftThreeEighthsBlock {\uchar{37}{141}} %%LEFT THREE EIGHTHS BLOCK
-\definecharacter UnicodeLeftOneQuarterBlock {\uchar{37}{142}} %%LEFT ONE QUARTER BLOCK
-\definecharacter UnicodeLeftOneEighthBlock {\uchar{37}{143}} %%LEFT ONE EIGHTH BLOCK
-\definecharacter UnicodeRightHalfBlock {\uchar{37}{144}} %%RIGHT HALF BLOCK
-\definecharacter UnicodeLightShade {\uchar{37}{145}} %%LIGHT SHADE
-\definecharacter UnicodeMediumShade {\uchar{37}{146}} %%MEDIUM SHADE
-\definecharacter UnicodeDarkShade {\uchar{37}{147}} %%DARK SHADE
-\definecharacter UnicodeUpperOneEighthBlock {\uchar{37}{148}} %%UPPER ONE EIGHTH BLOCK
-\definecharacter UnicodeRightOneEighthBlock {\uchar{37}{149}} %%RIGHT ONE EIGHTH BLOCK
-\definecharacter UnicodeQuadrantLowerLeft {\uchar{37}{150}} %%[Unassigned U+2596]
-\definecharacter UnicodeQuadrantLowerRight {\uchar{37}{151}} %%[Unassigned U+2597]
-\definecharacter UnicodeQuadrantUpperLeft {\uchar{37}{152}} %%[Unassigned U+2598]
-\definecharacter UnicodeQuadrantUpperLeftAndLowerLeftAndLowerRight {\uchar{37}{153}} %%[Unassigned U+2599]
-\definecharacter UnicodeQuadrantUpperLeftAndLowerRight {\uchar{37}{154}} %%[Unassigned U+259A]
-\definecharacter UnicodeQuadrantUpperLeftAndUpperRightandLowerLeft {\uchar{37}{155}} %%[Unassigned U+259B]
-\definecharacter UnicodeQuadrantUpperLeftAndUpperRightAndLowerRight {\uchar{37}{156}} %%[Unassigned U+259C]
-\definecharacter UnicodeQuadrantUpperRight {\uchar{37}{157}} %%[Unassigned U+259D]
-\definecharacter UnicodeQuadrantUpperRightAndLowerLeft {\uchar{37}{158}} %%[Unassigned U+259E]
-\definecharacter UnicodeQuadrantUpperRightAndLowerLeftAndLowerRight {\uchar{37}{159}} %%[Unassigned U+259F]
-\definecharacter UnicodeBlackSquare {\uchar{37}{160}} %%BLACK SQUARE
-\definecharacter UnicodeWhiteSquare {\uchar{37}{161}} %%WHITE SQUARE
-\definecharacter UnicodeWhiteSquareWithRoundedCorners {\uchar{37}{162}} %%WHITE SQUARE WITH ROUNDED CORNERS
-\definecharacter UnicodeWhiteSquareContainingBlackSmallSquare {\uchar{37}{163}} %%WHITE SQUARE CONTAINING BLACK SMALL SQUARE
-\definecharacter UnicodeSquareWithHorizontalFill {\uchar{37}{164}} %%SQUARE WITH HORIZONTAL FILL
-\definecharacter UnicodeSquareWithVerticalFill {\uchar{37}{165}} %%SQUARE WITH VERTICAL FILL
-\definecharacter UnicodeSquareWithOrthogonalCrosshatchFill {\uchar{37}{166}} %%SQUARE WITH ORTHOGONAL CROSSHATCH FILL
-\definecharacter UnicodeSquareWithUpperLeftToLowerRightFill {\uchar{37}{167}} %%SQUARE WITH UPPER LEFT TO LOWER RIGHT FILL
-\definecharacter UnicodeSquareWithUpperRightToLowerLeftFill {\uchar{37}{168}} %%SQUARE WITH UPPER RIGHT TO LOWER LEFT FILL
-\definecharacter UnicodeSquareWithDiagonalCrosshatchFill {\uchar{37}{169}} %%SQUARE WITH DIAGONAL CROSSHATCH FILL
-\definecharacter UnicodeBlackSmallSquare {\uchar{37}{170}} %%BLACK SMALL SQUARE
-\definecharacter UnicodeWhiteSmallSquare {\uchar{37}{171}} %%WHITE SMALL SQUARE
-\definecharacter UnicodeBlackRectangle {\uchar{37}{172}} %%BLACK RECTANGLE
-\definecharacter UnicodeWhiteRectangle {\uchar{37}{173}} %%WHITE RECTANGLE
-\definecharacter UnicodeBlackVerticalRectangle {\uchar{37}{174}} %%BLACK VERTICAL RECTANGLE
-\definecharacter UnicodeWhiteVerticalRectangle {\uchar{37}{175}} %%WHITE VERTICAL RECTANGLE
-\definecharacter UnicodeBlackParallelogram {\uchar{37}{176}} %%BLACK PARALLELOGRAM
-\definecharacter UnicodeWhiteParallelogram {\uchar{37}{177}} %%WHITE PARALLELOGRAM
-\definecharacter UnicodeBlackUpPointingTriangle {\uchar{37}{178}} %%BLACK UP-POINTING TRIANGLE
-\definecharacter UnicodeWhiteUpPointingTriangle {\uchar{37}{179}} %%WHITE UP-POINTING TRIANGLE
-\definecharacter UnicodeBlackUpPointingSmallTriangle {\uchar{37}{180}} %%BLACK UP-POINTING SMALL TRIANGLE
-\definecharacter UnicodeWhiteUpPointingSmallTriangle {\uchar{37}{181}} %%WHITE UP-POINTING SMALL TRIANGLE
-\definecharacter UnicodeBlackRightPointingTriangle {\uchar{37}{182}} %%BLACK RIGHT-POINTING TRIANGLE
-\definecharacter UnicodeWhiteRightPointingTriangle {\uchar{37}{183}} %%WHITE RIGHT-POINTING TRIANGLE
-\definecharacter UnicodeBlackRightPointingSmallTriangle {\uchar{37}{184}} %%BLACK RIGHT-POINTING SMALL TRIANGLE
-\definecharacter UnicodeWhiteRightPointingSmallTriangle {\uchar{37}{185}} %%WHITE RIGHT-POINTING SMALL TRIANGLE
-\definecharacter UnicodeBlackRightPointingPointer {\uchar{37}{186}} %%BLACK RIGHT-POINTING POINTER
-\definecharacter UnicodeWhiteRightPointingPointer {\uchar{37}{187}} %%WHITE RIGHT-POINTING POINTER
-\definecharacter UnicodeBlackDownPointingTriangle {\uchar{37}{188}} %%BLACK DOWN-POINTING TRIANGLE
-\definecharacter UnicodeWhiteDownPointingTriangle {\uchar{37}{189}} %%WHITE DOWN-POINTING TRIANGLE
-\definecharacter UnicodeBlackDownPointingSmallTriangle {\uchar{37}{190}} %%BLACK DOWN-POINTING SMALL TRIANGLE
-\definecharacter UnicodeWhiteDownPointingSmallTriangle {\uchar{37}{191}} %%WHITE DOWN-POINTING SMALL TRIANGLE
-\definecharacter UnicodeBlackLeftPointingTriangle {\uchar{37}{192}} %%BLACK LEFT-POINTING TRIANGLE
-\definecharacter UnicodeWhiteLeftPointingTriangle {\uchar{37}{193}} %%WHITE LEFT-POINTING TRIANGLE
-\definecharacter UnicodeBlackLeftPointingSmallTriangle {\uchar{37}{194}} %%BLACK LEFT-POINTING SMALL TRIANGLE
-\definecharacter UnicodeWhiteLeftPointingSmallTriangle {\uchar{37}{195}} %%WHITE LEFT-POINTING SMALL TRIANGLE
-\definecharacter UnicodeBlackLeftPointingPointer {\uchar{37}{196}} %%BLACK LEFT-POINTING POINTER
-\definecharacter UnicodeWhiteLeftPointingPointer {\uchar{37}{197}} %%WHITE LEFT-POINTING POINTER
-\definecharacter UnicodeBlackDiamond {\uchar{37}{198}} %%BLACK DIAMOND
-\definecharacter UnicodeWhiteDiamond {\uchar{37}{199}} %%WHITE DIAMOND
-\definecharacter UnicodeWhiteDiamondContainingBlackSmallDiamond {\uchar{37}{200}} %%WHITE DIAMOND CONTAINING BLACK SMALL DIAMOND
-\definecharacter UnicodeFisheye {\uchar{37}{201}} %%FISHEYE
-\definecharacter UnicodeLozenge {\uchar{37}{202}} %%LOZENGE
-\definecharacter UnicodeWhiteCircle {\uchar{37}{203}} %%WHITE CIRCLE
-\definecharacter UnicodeDottedCircle {\uchar{37}{204}} %%DOTTED CIRCLE
-\definecharacter UnicodeCircleWithVerticalFill {\uchar{37}{205}} %%CIRCLE WITH VERTICAL FILL
-\definecharacter UnicodeBullseye {\uchar{37}{206}} %%BULLSEYE
-\definecharacter UnicodeBlackCircle {\uchar{37}{207}} %%BLACK CIRCLE
-\definecharacter UnicodeCircleWithLeftHalfBlack {\uchar{37}{208}} %%CIRCLE WITH LEFT HALF BLACK
-\definecharacter UnicodeCircleWithRightHalfBlack {\uchar{37}{209}} %%CIRCLE WITH RIGHT HALF BLACK
-\definecharacter UnicodeCircleWithLowerHalfBlack {\uchar{37}{210}} %%CIRCLE WITH LOWER HALF BLACK
-\definecharacter UnicodeCircleWithUpperHalfBlack {\uchar{37}{211}} %%CIRCLE WITH UPPER HALF BLACK
-\definecharacter UnicodeCircleWithUpperRightQuadrantBlack {\uchar{37}{212}} %%CIRCLE WITH UPPER RIGHT QUADRANT BLACK
-\definecharacter UnicodeCircleWithAllButUpperLeftQuadrantBlack {\uchar{37}{213}} %%CIRCLE WITH ALL BUT UPPER LEFT QUADRANT BLACK
-\definecharacter UnicodeLeftHalfBlackCircle {\uchar{37}{214}} %%LEFT HALF BLACK CIRCLE
-\definecharacter UnicodeRightHalfBlackCircle {\uchar{37}{215}} %%RIGHT HALF BLACK CIRCLE
-\definecharacter UnicodeInverseBullet {\uchar{37}{216}} %%INVERSE BULLET
-\definecharacter UnicodeInverseWhiteCircle {\uchar{37}{217}} %%INVERSE WHITE CIRCLE
-\definecharacter UnicodeUpperHalfInverseWhiteCircle {\uchar{37}{218}} %%UPPER HALF INVERSE WHITE CIRCLE
-\definecharacter UnicodeLowerHalfInverseWhiteCircle {\uchar{37}{219}} %%LOWER HALF INVERSE WHITE CIRCLE
-\definecharacter UnicodeUpperLeftQuadrantCircularArc {\uchar{37}{220}} %%UPPER LEFT QUADRANT CIRCULAR ARC
-\definecharacter UnicodeUpperRightQuadrantCircularArc {\uchar{37}{221}} %%UPPER RIGHT QUADRANT CIRCULAR ARC
-\definecharacter UnicodeLowerRightQuadrantCircularArc {\uchar{37}{222}} %%LOWER RIGHT QUADRANT CIRCULAR ARC
-\definecharacter UnicodeLowerLeftQuadrantCircularArc {\uchar{37}{223}} %%LOWER LEFT QUADRANT CIRCULAR ARC
-\definecharacter UnicodeUpperHalfCircle {\uchar{37}{224}} %%UPPER HALF CIRCLE
-\definecharacter UnicodeLowerHalfCircle {\uchar{37}{225}} %%LOWER HALF CIRCLE
-\definecharacter UnicodeBlackLowerRightTriangle {\uchar{37}{226}} %%BLACK LOWER RIGHT TRIANGLE
-\definecharacter UnicodeBlackLowerLeftTriangle {\uchar{37}{227}} %%BLACK LOWER LEFT TRIANGLE
-\definecharacter UnicodeBlackUpperLeftTriangle {\uchar{37}{228}} %%BLACK UPPER LEFT TRIANGLE
-\definecharacter UnicodeBlackUpperRightTriangle {\uchar{37}{229}} %%BLACK UPPER RIGHT TRIANGLE
-\definecharacter UnicodeWhiteBullet {\uchar{37}{230}} %%WHITE BULLET
-\definecharacter UnicodeSquareWithLeftHalfBlack {\uchar{37}{231}} %%SQUARE WITH LEFT HALF BLACK
-\definecharacter UnicodeSquareWithRightHalfBlack {\uchar{37}{232}} %%SQUARE WITH RIGHT HALF BLACK
-\definecharacter UnicodeSquareWithUpperLeftDiagonalHalfBlack {\uchar{37}{233}} %%SQUARE WITH UPPER LEFT DIAGONAL HALF BLACK
-\definecharacter UnicodeSquareWithLowerRightDiagonalHalfBlack {\uchar{37}{234}} %%SQUARE WITH LOWER RIGHT DIAGONAL HALF BLACK
-\definecharacter UnicodeWhiteSquareWithVerticalBisectingLine {\uchar{37}{235}} %%WHITE SQUARE WITH VERTICAL BISECTING LINE
-\definecharacter UnicodeWhiteUpPointingTriangleWithDot {\uchar{37}{236}} %%WHITE UP-POINTING TRIANGLE WITH DOT
-\definecharacter UnicodeUpPointingTriangleWithLeftHalfBlack {\uchar{37}{237}} %%UP-POINTING TRIANGLE WITH LEFT HALF BLACK
-\definecharacter UnicodeUpPointingTriangleWithRightHalfBlack {\uchar{37}{238}} %%UP-POINTING TRIANGLE WITH RIGHT HALF BLACK
-\definecharacter UnicodeLargeCircle {\uchar{37}{239}} %%LARGE CIRCLE
-\definecharacter UnicodeWhiteSquareWithUpperLeftQuadrant {\uchar{37}{240}} %%WHITE SQUARE WITH UPPER LEFT QUADRANT
-\definecharacter UnicodeWhiteSquareWithLowerLeftQuadrant {\uchar{37}{241}} %%WHITE SQUARE WITH LOWER LEFT QUADRANT
-\definecharacter UnicodeWhiteSquareWithLowerRightQuadrant {\uchar{37}{242}} %%WHITE SQUARE WITH LOWER RIGHT QUADRANT
-\definecharacter UnicodeWhiteSquareWithUpperRightQuadrant {\uchar{37}{243}} %%WHITE SQUARE WITH UPPER RIGHT QUADRANT
-\definecharacter UnicodeWhiteCircleWithUpperLeftQuadrant {\uchar{37}{244}} %%WHITE CIRCLE WITH UPPER LEFT QUADRANT
-\definecharacter UnicodeWhiteCircleWithLowerLeftQuadrant {\uchar{37}{245}} %%WHITE CIRCLE WITH LOWER LEFT QUADRANT
-\definecharacter UnicodeWhiteCircleWithLowerRightQuadrant {\uchar{37}{246}} %%WHITE CIRCLE WITH LOWER RIGHT QUADRANT
-\definecharacter UnicodeWhiteCircleWithUpperRightQuadrant {\uchar{37}{247}} %%WHITE CIRCLE WITH UPPER RIGHT QUADRANT
-\definecharacter UnicodeUpperLeftTriangle {\uchar{37}{248}} %%[Unassigned U+25F8]
-\definecharacter UnicodeUpperRightTriangle {\uchar{37}{249}} %%[Unassigned U+25F9]
-\definecharacter UnicodeLowerLeftTriangle {\uchar{37}{250}} %%[Unassigned U+25FA]
-\definecharacter UnicodeWhiteMediumSquare {\uchar{37}{251}} %%[Unassigned U+25FB]
-\definecharacter UnicodeBlackMediumSquare {\uchar{37}{252}} %%[Unassigned U+25FC]
-\definecharacter UnicodeWhiteMediumSmallSquare {\uchar{37}{253}} %%[Unassigned U+25FD]
-\definecharacter UnicodeBlackMediumSmallSquare {\uchar{37}{254}} %%[Unassigned U+25FE]
-\definecharacter UnicodeLowerRightTriangle {\uchar{37}{255}} %%[Unassigned U+25FF]
-
-\stopencoding
-
-\endinput
-
diff --git a/tex/context/base/enco-acc.mkii b/tex/context/base/enco-acc.mkii
new file mode 100644
index 000000000..e02536be6
--- /dev/null
+++ b/tex/context/base/enco-acc.mkii
@@ -0,0 +1,139 @@
+%D \module
+%D [ file=enco-acc,
+%D version=2000.20.12, % split from base file
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Composed Characters Commands,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=Hans Hagen \& Ton Otten]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D Although it is technically possible to redefine the commands
+%D that are responsible for building composed characters, this
+%D is seldom needed, since they map onto named glyphs. The
+%D meaning of these names glyphs may change, although their
+%D visual appearance seldom will.
+
+\startencoding[default]
+
+\defineaccent ^ A {\Acircumflex} \defineaccent ^ a {\acircumflex}
+\defineaccent ^ C {\Ccircumflex} \defineaccent ^ c {\ccircumflex}
+\defineaccent ^ E {\Ecircumflex} \defineaccent ^ e {\ecircumflex}
+\defineaccent ^ G {\Gcircumflex} \defineaccent ^ g {\gcircumflex}
+\defineaccent ^ H {\Hcircumflex} \defineaccent ^ h {\hcircumflex}
+\defineaccent ^ I {\Icircumflex} \defineaccent ^ i {\icircumflex} \defineaccent ^ {\i} {\icircumflex}
+\defineaccent ^ J {\Jcircumflex} \defineaccent ^ j {\jcircumflex} \defineaccent ^ {\j} {\jcircumflex}
+\defineaccent ^ O {\Ocircumflex} \defineaccent ^ o {\ocircumflex}
+\defineaccent ^ S {\Scircumflex} \defineaccent ^ s {\scircumflex}
+\defineaccent ^ U {\Ucircumflex} \defineaccent ^ u {\ucircumflex}
+\defineaccent ^ W {\Wcircumflex} \defineaccent ^ w {\wcircumflex}
+\defineaccent ^ Y {\Ycircumflex} \defineaccent ^ y {\ycircumflex}
+
+\defineaccent ` A {\Agrave} \defineaccent ` a {\agrave}
+\defineaccent ` E {\Egrave} \defineaccent ` e {\egrave}
+\defineaccent ` I {\Igrave} \defineaccent ` i {\igrave} \defineaccent ` {\i} {\igrave}
+\defineaccent ` O {\Ograve} \defineaccent ` o {\ograve}
+\defineaccent ` U {\Ugrave} \defineaccent ` u {\ugrave}
+\defineaccent ` Y {\Ygrave} \defineaccent ` y {\ygrave}
+
+\defineaccent ~ A {\Atilde} \defineaccent ~ a {\atilde}
+\defineaccent ~ I {\Itilde} \defineaccent ~ i {\itilde} \defineaccent ~ {\i} {\itilde}
+\defineaccent ~ O {\Otilde} \defineaccent ~ o {\otilde}
+\defineaccent ~ U {\Utilde} \defineaccent ~ u {\utilde}
+
+\defineaccent " A {\Adiaeresis} \defineaccent " a {\adiaeresis}
+\defineaccent " E {\Ediaeresis} \defineaccent " e {\ediaeresis}
+\defineaccent " I {\Idiaeresis} \defineaccent " i {\idiaeresis} \defineaccent " {\i} {\idiaeresis}
+\defineaccent " O {\Odiaeresis} \defineaccent " o {\odiaeresis}
+\defineaccent " U {\Udiaeresis} \defineaccent " u {\udiaeresis}
+\defineaccent " Y {\Ydiaeresis} \defineaccent " y {\ydiaeresis}
+
+\defineaccent ' A {\Aacute} \defineaccent ' a {\aacute}
+\defineaccent ' C {\Cacute} \defineaccent ' c {\cacute}
+\defineaccent ' E {\Eacute} \defineaccent ' e {\eacute}
+\defineaccent ' I {\Iacute} \defineaccent ' i {\iacute} \defineaccent ' {\i} {\iacute}
+\defineaccent ' L {\Lacute} \defineaccent ' l {\lacute}
+\defineaccent ' N {\Nacute} \defineaccent ' n {\nacute}
+\defineaccent ' O {\Oacute} \defineaccent ' o {\oacute}
+\defineaccent ' R {\Racute} \defineaccent ' r {\racute}
+\defineaccent ' S {\Sacute} \defineaccent ' s {\sacute}
+\defineaccent ' U {\Uacute} \defineaccent ' u {\uacute}
+\defineaccent ' Y {\Yacute} \defineaccent ' y {\yacute}
+\defineaccent ' Z {\Zacute} \defineaccent ' z {\zacute}
+
+\defineaccent . C {\Cdotaccent} \defineaccent . c {\cdotaccent}
+\defineaccent . E {\Edotaccent} \defineaccent . e {\edotaccent}
+\defineaccent . G {\Gdotaccent} \defineaccent . g {\gdotaccent}
+\defineaccent . I {\Idotaccent} \defineaccent . i {\idotaccent} \defineaccent . {\i} {\idotaccent}
+\defineaccent . Z {\Zdotaccent} \defineaccent . z {\zdotaccent}
+
+\defineaccent = A {\Amacron} \defineaccent = a {\amacron}
+\defineaccent = E {\Emacron} \defineaccent = e {\emacron}
+\defineaccent = I {\Imacron} \defineaccent = i {\imacron} \defineaccent = {\i} {\imacron}
+\defineaccent = O {\Omacron} \defineaccent = o {\omacron}
+\defineaccent = U {\Umacron} \defineaccent = u {\umacron}
+
+\defineaccent c C {\Ccedilla} \defineaccent c c {\ccedilla}
+\defineaccent c K {\Kcedilla} \defineaccent c k {\kcedilla}
+\defineaccent c L {\Lcedilla} \defineaccent c l {\lcedilla}
+\defineaccent c N {\Ncedilla} \defineaccent c n {\ncedilla}
+\defineaccent c R {\Rcedilla} \defineaccent c r {\rcedilla}
+\defineaccent c S {\Scedilla} \defineaccent c s {\scedilla}
+\defineaccent c T {\Tcedilla} \defineaccent c t {\tcedilla}
+
+\defineaccent H O {\Ohungarumlaut} \defineaccent H o {\ohungarumlaut}
+\defineaccent H u {\uhungarumlaut} \defineaccent H U {\Uhungarumlaut}
+
+\defineaccent k A {\Aogonek} \defineaccent k a {\aogonek}
+\defineaccent k E {\Eogonek} \defineaccent k e {\eogonek}
+\defineaccent k I {\Iogonek} \defineaccent k i {\iogonek}
+\defineaccent k U {\Uogonek} \defineaccent k u {\uogonek}
+
+\defineaccent r A {\Aring} \defineaccent r a {\aring}
+\defineaccent r U {\Uring} \defineaccent r u {\uring}
+
+\defineaccent u A {\Abreve} \defineaccent u a {\abreve}
+\defineaccent u E {\Ebreve} \defineaccent u e {\ebreve}
+\defineaccent u G {\Gbreve} \defineaccent u g {\gbreve}
+\defineaccent u I {\Ibreve} \defineaccent u i {\ibreve} \defineaccent u {\i} {\ibreve}
+\defineaccent u O {\Obreve} \defineaccent u o {\obreve}
+\defineaccent u U {\Ubreve} \defineaccent u u {\ubreve}
+
+\defineaccent v C {\Ccaron} \defineaccent v c {\ccaron}
+\defineaccent v D {\Dcaron} \defineaccent v d {\dcaron}
+\defineaccent v E {\Ecaron} \defineaccent v e {\ecaron}
+\defineaccent v L {\Lcaron} \defineaccent v l {\lcaron}
+\defineaccent v N {\Ncaron} \defineaccent v n {\ncaron}
+\defineaccent v R {\Rcaron} \defineaccent v r {\rcaron}
+\defineaccent v S {\Scaron} \defineaccent v s {\scaron}
+\defineaccent v T {\Tcaron} \defineaccent v t {\tcaron}
+\defineaccent v Z {\Zcaron} \defineaccent v z {\zcaron}
+
+\stopencoding
+
+\startencoding[default]
+
+% vietnamese: if needed, \useencoding[enco-vna]
+
+\stopencoding
+
+% For Tobias Burnus, who wants:
+%
+% \starttypen
+% \setupinteraction[state=start]
+% \setupinteractionscreen[option=bookmark]
+% \placebookmarks[chapter]
+%
+% \starttext \chapter{F\"ur Na\"ive und Na\"\i ve} \stoptext
+% \stoptypen
+
+\startencoding[default]
+
+ \defineaccent " {\i} {\idiaeresis}
+
+\stopencoding
+
+\endinput
diff --git a/tex/context/base/enco-acc.tex b/tex/context/base/enco-acc.tex
deleted file mode 100644
index e02536be6..000000000
--- a/tex/context/base/enco-acc.tex
+++ /dev/null
@@ -1,139 +0,0 @@
-%D \module
-%D [ file=enco-acc,
-%D version=2000.20.12, % split from base file
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Composed Characters Commands,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=Hans Hagen \& Ton Otten]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D Although it is technically possible to redefine the commands
-%D that are responsible for building composed characters, this
-%D is seldom needed, since they map onto named glyphs. The
-%D meaning of these names glyphs may change, although their
-%D visual appearance seldom will.
-
-\startencoding[default]
-
-\defineaccent ^ A {\Acircumflex} \defineaccent ^ a {\acircumflex}
-\defineaccent ^ C {\Ccircumflex} \defineaccent ^ c {\ccircumflex}
-\defineaccent ^ E {\Ecircumflex} \defineaccent ^ e {\ecircumflex}
-\defineaccent ^ G {\Gcircumflex} \defineaccent ^ g {\gcircumflex}
-\defineaccent ^ H {\Hcircumflex} \defineaccent ^ h {\hcircumflex}
-\defineaccent ^ I {\Icircumflex} \defineaccent ^ i {\icircumflex} \defineaccent ^ {\i} {\icircumflex}
-\defineaccent ^ J {\Jcircumflex} \defineaccent ^ j {\jcircumflex} \defineaccent ^ {\j} {\jcircumflex}
-\defineaccent ^ O {\Ocircumflex} \defineaccent ^ o {\ocircumflex}
-\defineaccent ^ S {\Scircumflex} \defineaccent ^ s {\scircumflex}
-\defineaccent ^ U {\Ucircumflex} \defineaccent ^ u {\ucircumflex}
-\defineaccent ^ W {\Wcircumflex} \defineaccent ^ w {\wcircumflex}
-\defineaccent ^ Y {\Ycircumflex} \defineaccent ^ y {\ycircumflex}
-
-\defineaccent ` A {\Agrave} \defineaccent ` a {\agrave}
-\defineaccent ` E {\Egrave} \defineaccent ` e {\egrave}
-\defineaccent ` I {\Igrave} \defineaccent ` i {\igrave} \defineaccent ` {\i} {\igrave}
-\defineaccent ` O {\Ograve} \defineaccent ` o {\ograve}
-\defineaccent ` U {\Ugrave} \defineaccent ` u {\ugrave}
-\defineaccent ` Y {\Ygrave} \defineaccent ` y {\ygrave}
-
-\defineaccent ~ A {\Atilde} \defineaccent ~ a {\atilde}
-\defineaccent ~ I {\Itilde} \defineaccent ~ i {\itilde} \defineaccent ~ {\i} {\itilde}
-\defineaccent ~ O {\Otilde} \defineaccent ~ o {\otilde}
-\defineaccent ~ U {\Utilde} \defineaccent ~ u {\utilde}
-
-\defineaccent " A {\Adiaeresis} \defineaccent " a {\adiaeresis}
-\defineaccent " E {\Ediaeresis} \defineaccent " e {\ediaeresis}
-\defineaccent " I {\Idiaeresis} \defineaccent " i {\idiaeresis} \defineaccent " {\i} {\idiaeresis}
-\defineaccent " O {\Odiaeresis} \defineaccent " o {\odiaeresis}
-\defineaccent " U {\Udiaeresis} \defineaccent " u {\udiaeresis}
-\defineaccent " Y {\Ydiaeresis} \defineaccent " y {\ydiaeresis}
-
-\defineaccent ' A {\Aacute} \defineaccent ' a {\aacute}
-\defineaccent ' C {\Cacute} \defineaccent ' c {\cacute}
-\defineaccent ' E {\Eacute} \defineaccent ' e {\eacute}
-\defineaccent ' I {\Iacute} \defineaccent ' i {\iacute} \defineaccent ' {\i} {\iacute}
-\defineaccent ' L {\Lacute} \defineaccent ' l {\lacute}
-\defineaccent ' N {\Nacute} \defineaccent ' n {\nacute}
-\defineaccent ' O {\Oacute} \defineaccent ' o {\oacute}
-\defineaccent ' R {\Racute} \defineaccent ' r {\racute}
-\defineaccent ' S {\Sacute} \defineaccent ' s {\sacute}
-\defineaccent ' U {\Uacute} \defineaccent ' u {\uacute}
-\defineaccent ' Y {\Yacute} \defineaccent ' y {\yacute}
-\defineaccent ' Z {\Zacute} \defineaccent ' z {\zacute}
-
-\defineaccent . C {\Cdotaccent} \defineaccent . c {\cdotaccent}
-\defineaccent . E {\Edotaccent} \defineaccent . e {\edotaccent}
-\defineaccent . G {\Gdotaccent} \defineaccent . g {\gdotaccent}
-\defineaccent . I {\Idotaccent} \defineaccent . i {\idotaccent} \defineaccent . {\i} {\idotaccent}
-\defineaccent . Z {\Zdotaccent} \defineaccent . z {\zdotaccent}
-
-\defineaccent = A {\Amacron} \defineaccent = a {\amacron}
-\defineaccent = E {\Emacron} \defineaccent = e {\emacron}
-\defineaccent = I {\Imacron} \defineaccent = i {\imacron} \defineaccent = {\i} {\imacron}
-\defineaccent = O {\Omacron} \defineaccent = o {\omacron}
-\defineaccent = U {\Umacron} \defineaccent = u {\umacron}
-
-\defineaccent c C {\Ccedilla} \defineaccent c c {\ccedilla}
-\defineaccent c K {\Kcedilla} \defineaccent c k {\kcedilla}
-\defineaccent c L {\Lcedilla} \defineaccent c l {\lcedilla}
-\defineaccent c N {\Ncedilla} \defineaccent c n {\ncedilla}
-\defineaccent c R {\Rcedilla} \defineaccent c r {\rcedilla}
-\defineaccent c S {\Scedilla} \defineaccent c s {\scedilla}
-\defineaccent c T {\Tcedilla} \defineaccent c t {\tcedilla}
-
-\defineaccent H O {\Ohungarumlaut} \defineaccent H o {\ohungarumlaut}
-\defineaccent H u {\uhungarumlaut} \defineaccent H U {\Uhungarumlaut}
-
-\defineaccent k A {\Aogonek} \defineaccent k a {\aogonek}
-\defineaccent k E {\Eogonek} \defineaccent k e {\eogonek}
-\defineaccent k I {\Iogonek} \defineaccent k i {\iogonek}
-\defineaccent k U {\Uogonek} \defineaccent k u {\uogonek}
-
-\defineaccent r A {\Aring} \defineaccent r a {\aring}
-\defineaccent r U {\Uring} \defineaccent r u {\uring}
-
-\defineaccent u A {\Abreve} \defineaccent u a {\abreve}
-\defineaccent u E {\Ebreve} \defineaccent u e {\ebreve}
-\defineaccent u G {\Gbreve} \defineaccent u g {\gbreve}
-\defineaccent u I {\Ibreve} \defineaccent u i {\ibreve} \defineaccent u {\i} {\ibreve}
-\defineaccent u O {\Obreve} \defineaccent u o {\obreve}
-\defineaccent u U {\Ubreve} \defineaccent u u {\ubreve}
-
-\defineaccent v C {\Ccaron} \defineaccent v c {\ccaron}
-\defineaccent v D {\Dcaron} \defineaccent v d {\dcaron}
-\defineaccent v E {\Ecaron} \defineaccent v e {\ecaron}
-\defineaccent v L {\Lcaron} \defineaccent v l {\lcaron}
-\defineaccent v N {\Ncaron} \defineaccent v n {\ncaron}
-\defineaccent v R {\Rcaron} \defineaccent v r {\rcaron}
-\defineaccent v S {\Scaron} \defineaccent v s {\scaron}
-\defineaccent v T {\Tcaron} \defineaccent v t {\tcaron}
-\defineaccent v Z {\Zcaron} \defineaccent v z {\zcaron}
-
-\stopencoding
-
-\startencoding[default]
-
-% vietnamese: if needed, \useencoding[enco-vna]
-
-\stopencoding
-
-% For Tobias Burnus, who wants:
-%
-% \starttypen
-% \setupinteraction[state=start]
-% \setupinteractionscreen[option=bookmark]
-% \placebookmarks[chapter]
-%
-% \starttext \chapter{F\"ur Na\"ive und Na\"\i ve} \stoptext
-% \stoptypen
-
-\startencoding[default]
-
- \defineaccent " {\i} {\idiaeresis}
-
-\stopencoding
-
-\endinput
diff --git a/tex/context/base/enco-agr.mkii b/tex/context/base/enco-agr.mkii
new file mode 100644
index 000000000..cfd86dfd3
--- /dev/null
+++ b/tex/context/base/enco-agr.mkii
@@ -0,0 +1,364 @@
+%D \module
+%D [ file=enco-agr,
+%D version=2005.02.20,
+%D title=\CONTEXT\ \UNICODE\ Macros,
+%D subtitle=Ancient Greek,
+%D author=Thomas A. Schmitz,
+%D date=\currentdate]
+
+\startmapping[agr]
+
+ \definecasemaps 13 to 64 lc 0 uc 0
+ \definecasemaps 65 to 66 lc +32 uc 0
+ \definecasemaps 67 to 67 lc 0 uc 0
+ \definecasemaps 68 to 85 lc +32 uc 0
+ \definecasemaps 86 to 86 lc 0 uc 0
+ \definecasemaps 87 to 90 lc +32 uc 0
+ \definecasemaps 91 to 255 lc 0 uc 0
+
+\stopmapping
+
+\startencoding[agr]
+
+\definecharacter greeksigmalunate 1
+\definecharacter endash 2
+\definecharacter emdash 3
+\definecharacter apostrophe 4
+\definecharacter greekaltbeta 5
+\definecharacter epih 6
+
+\definecharacter textbraceleft 8
+\definecharacter textbraceright 9
+\definecharacter textbreve 10
+
+\definecharacter greekSigmalunate 13
+\definecharacter greekIotadialytika 14
+\definecharacter greekUpsilondialytika 15
+
+\definecharacter greekepsilonperispomeni 18
+\definecharacter greekomicronperispomeni 19
+\definecharacter greekepsilondasiaperispomeni 20
+\definecharacter greekomicrondasiaperispomeni 21
+\definecharacter greekepsilonpsiliperispomeni 22
+\definecharacter greekomicronpsiliperispomeni 23
+\definecharacter greekiotadialytikaperispomeni 24
+\definecharacter greekupsilondialytikaperispomeni 25
+\definecharacter greekdialytikaperispomeni 26
+
+\definecharacter textbottomdot 33
+\definecharacter greeksampi 34
+\definecharacter greekdigamma 35
+\definecharacter greekstigma 36
+\definecharacter greeknumkoppa 37
+\definecharacter greekkoppa 38
+\definecharacter guilsingleright 39
+
+\definecharacter textdag 43
+
+\definecharacter greekoxia 47
+
+\definecharacter greekanoteleia 59
+\definecharacter greekdasia 60
+
+\definecharacter greekpsili 62
+\definecharacter greekquestionmark 63
+\definecharacter dialytika 64
+\definecharacter greekAlpha 65
+\definecharacter greekBeta 66
+\definecharacter greekomegaiotasub 67
+\definecharacter greekDelta 68
+\definecharacter greekEpsilon 69
+\definecharacter greekPhi 70
+\definecharacter greekGamma 71
+\definecharacter greekEta 72
+\definecharacter greekIota 73
+\definecharacter greekTheta 74
+\definecharacter greekKappa 75
+\definecharacter greekLambda 76
+\definecharacter greekMu 77
+\definecharacter greekNu 78
+\definecharacter greekOmicron 79
+\definecharacter greekPi 80
+\definecharacter greekChi 81
+\definecharacter greekRho 82
+\definecharacter greekSigma 83
+\definecharacter greekTau 84
+\definecharacter greekUpsilon 85
+\definecharacter greeketaiotasub 86
+\definecharacter greekOmega 87
+\definecharacter greekXi 88
+\definecharacter greekPsi 89
+\definecharacter greekZeta 90
+\definecharacter bracketleft 91
+\definecharacter greekvaria 92
+\definecharacter bracketright 93
+\definecharacter greekperispomeni 94
+
+\definecharacter guilsingleleft 96
+
+% the above is a quote character
+\definecharacter greekalpha 97
+\definecharacter greekbeta 98
+\definecharacter greekfinalsigma 99
+\definecharacter greekdelta 100
+\definecharacter greekepsilon 101
+\definecharacter greekphi 102
+\definecharacter greekgamma 103
+\definecharacter greeketa 104
+\definecharacter greekiota 105
+\definecharacter greektheta 106
+\definecharacter greekkappa 107
+\definecharacter greeklambda 108
+\definecharacter greekmu 109
+\definecharacter greeknu 110
+\definecharacter greekomicron 111
+\definecharacter greekpi 112
+\definecharacter greekchi 113
+\definecharacter greekrho 114
+\definecharacter greeksigma 115
+\definecharacter greektau 116
+\definecharacter greekupsilon 117
+\definecharacter greekalphaiotasub 118
+\definecharacter greekomega 119
+\definecharacter greekxi 120
+\definecharacter greekpsi 121
+\definecharacter greekzeta 122
+\definecharacter floorleft 123
+\definecharacter textbar 124
+\definecharacter floorright 125
+\definecharacter greekperispomeni 126
+
+\definecharacter quotedblleft 128
+\definecharacter quotedblright 129
+\definecharacter exclam 130
+\definecharacter greekiotadasia 131
+\definecharacter greekiotapsili 132
+\definecharacter greekiotaoxia 133
+\definecharacter greekiotadasiatonos 134
+\definecharacter greekiotapsilitonos 135
+\definecharacter greekiotavaria 136
+\definecharacter greekiotadasiavaria 137
+\definecharacter greekiotapsilivaria 138
+\definecharacter greekiotaperispomeni 139
+\definecharacter greekiotadasiaperispomeni 140
+\definecharacter greekiotapsiliperispomeni 141
+\definecharacter greekiotadialytika 142
+\definecharacter greekiotadialytikatonos 143
+\definecharacter greekiotadialytikavaria 144
+\definecharacter greekdasiaperispomeni 145
+\definecharacter greekpsiliperispomeni 146
+\definecharacter greekdasiatonos 147
+\definecharacter greekpsilitonos 148
+\definecharacter greekdasiavaria 149
+\definecharacter greekpsilivaria 150
+\definecharacter greekdialytikatonos 151
+\definecharacter greekepsilondasia 152
+\definecharacter greekepsilonpsili 153
+\definecharacter greekepsilonoxia 154
+\definecharacter greekepsilondasiatonos 155
+\definecharacter greekepsilonpsilitonos 156
+\definecharacter greekepsilonvaria 157
+\definecharacter greekepsilondasiavaria 158
+\definecharacter greekepsilonpsilivaria 159
+\definecharacter greekdialytikavaria 160
+\definecharacter greekalphadasia 161
+\definecharacter greekalphapsili 162
+\definecharacter greekalphaoxia 163
+\definecharacter greekalphadasiatonos 164
+\definecharacter greekalphapsilitonos 165
+\definecharacter greekalphavaria 166
+\definecharacter greekalphadasiavaria 167
+\definecharacter greekalphapsilivaria 168
+\definecharacter greekalphaperispomeni 169
+\definecharacter greekalphadasiaperispomeni 170
+\definecharacter greekalphapsiliperispomeni 171
+\definecharacter greekalphaiotasubdasia 172
+\definecharacter greekalphaiotasubpsili 173
+\definecharacter greekalphaiotasubtonos 174
+\definecharacter greekalphaiotasubdasiatonos 175
+\definecharacter greekalphaiotasubpsilitonos 176
+\definecharacter greekalphaiotasubvaria 177
+\definecharacter greekalphaiotasubdasiavaria 178
+\definecharacter greekalphaiotasubpsilivaria 179
+\definecharacter greekalphaiotasubperispomeni 180
+\definecharacter greekalphaiotasubdasiaperispomeni 181
+\definecharacter greekalphaiotasubpsiliperispomeni 182
+\definecharacter greekrhodasia 183
+\definecharacter greekrhopsili 184
+\definecharacter greeketadasia 185
+\definecharacter greeketapsili 186
+\definecharacter greeketaoxia 187
+\definecharacter greeketadasiatonos 188
+\definecharacter greeketapsilitonos 189
+\definecharacter greeketavaria 190
+\definecharacter greeketadasiavaria 191
+\definecharacter greeketapsilivaria 192
+\definecharacter greeketaperispomeni 193
+\definecharacter greeketadasiaperispomeni 194
+\definecharacter greeketapsiliperispomeni 195
+\definecharacter textslash 196
+\definecharacter greeketaiotasubdasia 197
+\definecharacter greeketaiotasubpsili 198
+\definecharacter greeketaiotasubtonos 199
+\definecharacter greeketaiotasubdasiatonos 200
+\definecharacter greeketaiotasubpsilitonos 201
+\definecharacter greeketaiotasubvaria 202
+\definecharacter greeketaiotasubdasiavaria 203
+\definecharacter greeketaiotasubpsilivaria 204
+\definecharacter greeketaiotasubperispomeni 205
+\definecharacter greeketaiotasubdasiaperispomeni 206
+\definecharacter greeketaiotasubpsiliperispomeni 207
+\definecharacter greekomicrondasia 208
+\definecharacter greekomicronpsili 209
+\definecharacter greekomicronoxia 210
+\definecharacter greekomicrondasiatonos 211
+\definecharacter greekomicronpsilitonos 212
+\definecharacter greekomicronvaria 213
+\definecharacter greekomicrondasiavaria 214
+\definecharacter greekomicronpsilivaria 215
+\definecharacter greekupsilondasia 216
+\definecharacter greekupsilonpsili 217
+\definecharacter greekupsilonoxia 218
+\definecharacter greekupsilondasiatonos 219
+\definecharacter greekupsilonpsilitonos 220
+\definecharacter greekupsilonvaria 221
+\definecharacter greekupsilondasiavaria 222
+\definecharacter greekupsilonpsilivaria 223
+\definecharacter greekupsilonperispomeni 224
+\definecharacter greekupsilondasiaperispomeni 225
+\definecharacter greekupsilonpsiliperispomeni 226
+\definecharacter greekupsilondiaeresis 227
+\definecharacter greekupsilondialytikatonos 228
+\definecharacter greekupsilondialytikavaria 229
+\definecharacter greekomegadasia 230
+\definecharacter greekomegapsili 231
+\definecharacter greekomegaoxia 232
+\definecharacter greekomegadasiatonos 233
+\definecharacter greekomegapsilitonos 234
+\definecharacter greekomegavaria 235
+\definecharacter greekomegadasiavaria 236
+\definecharacter greekomegapsilivaria 237
+\definecharacter greekomegaperispomeni 238
+\definecharacter greekomegadasiaperispomeni 239
+\definecharacter greekomegapsiliperispomeni 240
+\definecharacter greekomegaiotasubdasia 241
+\definecharacter greekomegaiotasubpsili 242
+\definecharacter greekomegaiotasubtonos 243
+\definecharacter greekomegaiotasubdasiatonos 244
+\definecharacter greekomegaiotasubpsilitonos 245
+\definecharacter greekomegaiotasubvaria 246
+\definecharacter greekomegaiotasubdasiavaria 247
+\definecharacter greekomegaiotasubpsilivaria 248
+\definecharacter greekomegaiotasubperispomeni 249
+\definecharacter greekomegaiotasubdasiaperispomeni 250
+\definecharacter greekomegaiotasubpsiliperispomeni 251
+\definecharacter greeknumeralsign 254
+\definecharacter greeknumeralsignlower 255
+
+\stopencoding
+
+\startencoding[default]
+
+\definecharacter greekAlphapsili {\greekpsili \greekAlpha}
+\definecharacter greekAlphadasia {\greekdasia \greekAlpha}
+\definecharacter greekAlphapsilivaria {\greekpsilivaria \greekAlpha}
+\definecharacter greekAlphadasiavaria {\greekdasiavaria \greekAlpha}
+\definecharacter greekAlphapsilitonos {\greekpsilitonos \greekAlpha}
+\definecharacter greekAlphadasiatonos {\greekdasiatonos \greekAlpha}
+\definecharacter greekAlphapsiliperispomeni {\greekpsiliperispomeni \greekAlpha}
+\definecharacter greekAlphadasiaperispomeni {\greekdasiaperispomeni \greekAlpha}
+\definecharacter greekEpsilonpsili {\greekpsili \greekEpsilon}
+\definecharacter greekEpsilondasia {\greekdasia \greekEpsilon}
+\definecharacter greekEpsilonpsilivaria {\greekpsilivaria \greekEpsilon}
+\definecharacter greekEpsilondasiavaria {\greekdasiavaria \greekEpsilon}
+\definecharacter greekEpsilonpsilitonos {\greekpsilitonos \greekEpsilon}
+\definecharacter greekEpsilondasiatonos {\greekdasiatonos \greekEpsilon}
+\definecharacter greekEtapsili {\greekpsili \greekEta}
+\definecharacter greekEtadasia {\greekdasia \greekEta}
+\definecharacter greekEtapsilivaria {\greekpsilivaria \greekEta}
+\definecharacter greekEtadasiavaria {\greekdasiavaria \greekEta}
+\definecharacter greekEtapsilitonos {\greekpsilitonos \greekEta}
+\definecharacter greekEtadasiatonos {\greekdasiatonos \greekEta}
+\definecharacter greekEtapsiliperispomeni {\greekpsiliperispomeni \greekEta}
+\definecharacter greekEtadasiaperispomeni {\greekdasiaperispomeni \greekEta}
+\definecharacter greekIotapsili {\greekpsili \greekIota}
+\definecharacter greekIotadasia {\greekdasia \greekIota}
+\definecharacter greekIotapsilivaria {\greekpsilivaria \greekIota}
+\definecharacter greekIotadasiavaria {\greekdasiavaria \greekIota}
+\definecharacter greekIotapsilitonos {\greekpsilitonos \greekIota}
+\definecharacter greekIotadasiatonos {\greekdasiatonos \greekIota}
+\definecharacter greekIotapsiliperispomeni {\greekpsiliperispomeni \greekIota}
+\definecharacter greekIotadasiaperispomeni {\greekdasiaperispomeni \greekIota}
+\definecharacter greekOmicronpsili {\greekpsili \greekOmicron}
+\definecharacter greekOmicrondasia {\greekdasia \greekOmicron}
+\definecharacter greekOmicronpsilivaria {\greekpsilivaria \greekOmicron}
+\definecharacter greekOmicrondasiavaria {\greekdasiavaria \greekOmicron}
+\definecharacter greekOmicronpsilitonos {\greekpsilitonos \greekOmicron}
+\definecharacter greekOmicrondasiatonos {\greekdasiatonos \greekOmicron}
+\definecharacter greekUpsilondasia {\greekdasia \greekUpsilon}
+\definecharacter greekUpsilondasiavaria {\greekdasiavaria \greekUpsilon}
+\definecharacter greekUpsilondasiatonos {\greekdasiatonos \greekUpsilon}
+\definecharacter greekUpsilondasiaperispomeni {\greekdasiaperispomeni \greekUpsilon}
+\definecharacter greekOmegapsili {\greekpsili \greekOmega}
+\definecharacter greekOmegadasia {\greekdasia \greekOmega}
+\definecharacter greekOmegapsilivaria {\greekpsilivaria \greekOmega}
+\definecharacter greekOmegadasiavaria {\greekdasiavaria \greekOmega}
+\definecharacter greekOmegapsilitonos {\greekpsilitonos \greekOmega}
+\definecharacter greekOmegadasiatonos {\greekdasiatonos \greekOmega}
+\definecharacter greekOmegapsiliperispomeni {\greekpsiliperispomeni \greekOmega}
+\definecharacter greekOmegadasiaperispomeni {\greekdasiaperispomeni \greekOmega}
+\definecharacter greekAlphaiotasubpsili {\greekpsili \greekAlpha \greekiota}
+\definecharacter greekAlphaiotasubdasia {\greekdasia \greekAlpha \greekiota}
+\definecharacter greekAlphaiotasubpsilivaria {\greekpsilivaria \greekAlpha \greekiota}
+\definecharacter greekAlphaiotasubdasiavaria {\greekdasiavaria \greekAlpha \greekiota}
+\definecharacter greekAlphaiotasubpsilitonos {\greekpsilitonos \greekAlpha \greekiota}
+\definecharacter greekAlphaiotasubdasiatonos {\greekdasiatonos \greekAlpha \greekiota}
+\definecharacter greekAlphaiotasubpsiliperispomeni {\greekpsiliperispomeni \greekAlpha \greekiota}
+\definecharacter greekAlphaiotasubdasiaperispomeni {\greekdasiaperispomeni \greekAlpha \greekiota}
+\definecharacter greekEtaiotasubpsili {\greekpsili \greekEta \greekiota}
+\definecharacter greekEtaiotasubdasia {\greekdasia \greekEta \greekiota}
+\definecharacter greekEtaiotasubpsilivaria {\greekpsilivaria \greekEta \greekiota}
+\definecharacter greekEtaiotasubdasiavaria {\greekdasiavaria \greekEta \greekiota}
+\definecharacter greekEtaiotasubpsilitonos {\greekpsilitonos \greekEta \greekiota}
+\definecharacter greekEtaiotasubdasiatonos {\greekdasiatonos \greekEta \greekiota}
+\definecharacter greekEtaiotasubpsiliperispomeni {\greekpsiliperispomeni \greekEta \greekiota}
+\definecharacter greekEtaiotasubdasiaperispomeni {\greekdasiaperispomeni \greekEta \greekiota}
+\definecharacter greekOmegaiotasubpsili {\greekpsili \greekOmega \greekiota}
+\definecharacter greekOmegaiotasubdasia {\greekdasia \greekOmega \greekiota}
+\definecharacter greekOmegaiotasubpsilivaria {\greekpsilivaria \greekOmega \greekiota}
+\definecharacter greekOmegaiotasubdasiavaria {\greekdasiavaria \greekOmega \greekiota}
+\definecharacter greekOmegaiotasubpsilitonos {\greekpsilitonos \greekOmega \greekiota}
+\definecharacter greekOmegaiotasubdasiatonos {\greekdasiatonos \greekOmega \greekiota}
+\definecharacter greekOmegaiotasubpsiliperispomeni {\greekpsiliperispomeni \greekOmega \greekiota}
+\definecharacter greekOmegaiotasubdasiaperispomeni {\greekdasiaperispomeni \greekOmega \greekiota}
+\definecharacter greekAlphavaria {\greekvaria \greekAlpha}
+\definecharacter greekAlphaoxia {\greekoxia \greekAlpha}
+\definecharacter greekAlphaiotasub {\greekAlpha \greekiota}
+\definecharacter greekEpsilonvaria {\greekvaria \greekEpsilon}
+\definecharacter greekEpsilonoxia {\greekoxia \greekEpsilon}
+\definecharacter greekEtavaria {\greekvaria \greekEta}
+\definecharacter greekEtaoxia {\greekoxia \greekEta}
+\definecharacter greekEtaiotasub {\greekEta \greekiota}
+\definecharacter greekIotavaria {\greekvaria \greekIota}
+\definecharacter greekIotaoxia {\greekoxia \greekIota}
+\definecharacter greekUpsilonvaria {\greekvaria \greekUpsilon}
+\definecharacter greekUpsilonoxia {\greekoxia \greekUpsilon}
+\definecharacter greekOmicronvaria {\greekvaria \greekOmicron}
+\definecharacter greekOmicronoxia {\greekoxia \greekOmicron}
+\definecharacter greekOmegavaria {\greekvaria \greekOmega}
+\definecharacter greekOmegaoxia {\greekoxia \greekOmega}
+\definecharacter greekOmegaiotasub {\greekOmega \greekiota}
+\definecharacter greekRhodasia {\greekdasia \greekRho}
+\definecharacter digamma {\greekdigamma}
+\definecharacter sampi {\greeksampi}
+\definecharacter stigma {\greekstigma}
+\definecharacter koppa {\greeknumkoppa}
+\definecharacter lunars {\greeksigmalunate}
+\definecharacter lunarS {\greekSigmalunate}
+\definecharacter halfbraceleft {\floorleft}
+\definecharacter halfbraceright {\floorright}
+\definecharacter crux {\textdag}
+
+\stopencoding
+
+\endinput
diff --git a/tex/context/base/enco-agr.tex b/tex/context/base/enco-agr.tex
deleted file mode 100644
index cfd86dfd3..000000000
--- a/tex/context/base/enco-agr.tex
+++ /dev/null
@@ -1,364 +0,0 @@
-%D \module
-%D [ file=enco-agr,
-%D version=2005.02.20,
-%D title=\CONTEXT\ \UNICODE\ Macros,
-%D subtitle=Ancient Greek,
-%D author=Thomas A. Schmitz,
-%D date=\currentdate]
-
-\startmapping[agr]
-
- \definecasemaps 13 to 64 lc 0 uc 0
- \definecasemaps 65 to 66 lc +32 uc 0
- \definecasemaps 67 to 67 lc 0 uc 0
- \definecasemaps 68 to 85 lc +32 uc 0
- \definecasemaps 86 to 86 lc 0 uc 0
- \definecasemaps 87 to 90 lc +32 uc 0
- \definecasemaps 91 to 255 lc 0 uc 0
-
-\stopmapping
-
-\startencoding[agr]
-
-\definecharacter greeksigmalunate 1
-\definecharacter endash 2
-\definecharacter emdash 3
-\definecharacter apostrophe 4
-\definecharacter greekaltbeta 5
-\definecharacter epih 6
-
-\definecharacter textbraceleft 8
-\definecharacter textbraceright 9
-\definecharacter textbreve 10
-
-\definecharacter greekSigmalunate 13
-\definecharacter greekIotadialytika 14
-\definecharacter greekUpsilondialytika 15
-
-\definecharacter greekepsilonperispomeni 18
-\definecharacter greekomicronperispomeni 19
-\definecharacter greekepsilondasiaperispomeni 20
-\definecharacter greekomicrondasiaperispomeni 21
-\definecharacter greekepsilonpsiliperispomeni 22
-\definecharacter greekomicronpsiliperispomeni 23
-\definecharacter greekiotadialytikaperispomeni 24
-\definecharacter greekupsilondialytikaperispomeni 25
-\definecharacter greekdialytikaperispomeni 26
-
-\definecharacter textbottomdot 33
-\definecharacter greeksampi 34
-\definecharacter greekdigamma 35
-\definecharacter greekstigma 36
-\definecharacter greeknumkoppa 37
-\definecharacter greekkoppa 38
-\definecharacter guilsingleright 39
-
-\definecharacter textdag 43
-
-\definecharacter greekoxia 47
-
-\definecharacter greekanoteleia 59
-\definecharacter greekdasia 60
-
-\definecharacter greekpsili 62
-\definecharacter greekquestionmark 63
-\definecharacter dialytika 64
-\definecharacter greekAlpha 65
-\definecharacter greekBeta 66
-\definecharacter greekomegaiotasub 67
-\definecharacter greekDelta 68
-\definecharacter greekEpsilon 69
-\definecharacter greekPhi 70
-\definecharacter greekGamma 71
-\definecharacter greekEta 72
-\definecharacter greekIota 73
-\definecharacter greekTheta 74
-\definecharacter greekKappa 75
-\definecharacter greekLambda 76
-\definecharacter greekMu 77
-\definecharacter greekNu 78
-\definecharacter greekOmicron 79
-\definecharacter greekPi 80
-\definecharacter greekChi 81
-\definecharacter greekRho 82
-\definecharacter greekSigma 83
-\definecharacter greekTau 84
-\definecharacter greekUpsilon 85
-\definecharacter greeketaiotasub 86
-\definecharacter greekOmega 87
-\definecharacter greekXi 88
-\definecharacter greekPsi 89
-\definecharacter greekZeta 90
-\definecharacter bracketleft 91
-\definecharacter greekvaria 92
-\definecharacter bracketright 93
-\definecharacter greekperispomeni 94
-
-\definecharacter guilsingleleft 96
-
-% the above is a quote character
-\definecharacter greekalpha 97
-\definecharacter greekbeta 98
-\definecharacter greekfinalsigma 99
-\definecharacter greekdelta 100
-\definecharacter greekepsilon 101
-\definecharacter greekphi 102
-\definecharacter greekgamma 103
-\definecharacter greeketa 104
-\definecharacter greekiota 105
-\definecharacter greektheta 106
-\definecharacter greekkappa 107
-\definecharacter greeklambda 108
-\definecharacter greekmu 109
-\definecharacter greeknu 110
-\definecharacter greekomicron 111
-\definecharacter greekpi 112
-\definecharacter greekchi 113
-\definecharacter greekrho 114
-\definecharacter greeksigma 115
-\definecharacter greektau 116
-\definecharacter greekupsilon 117
-\definecharacter greekalphaiotasub 118
-\definecharacter greekomega 119
-\definecharacter greekxi 120
-\definecharacter greekpsi 121
-\definecharacter greekzeta 122
-\definecharacter floorleft 123
-\definecharacter textbar 124
-\definecharacter floorright 125
-\definecharacter greekperispomeni 126
-
-\definecharacter quotedblleft 128
-\definecharacter quotedblright 129
-\definecharacter exclam 130
-\definecharacter greekiotadasia 131
-\definecharacter greekiotapsili 132
-\definecharacter greekiotaoxia 133
-\definecharacter greekiotadasiatonos 134
-\definecharacter greekiotapsilitonos 135
-\definecharacter greekiotavaria 136
-\definecharacter greekiotadasiavaria 137
-\definecharacter greekiotapsilivaria 138
-\definecharacter greekiotaperispomeni 139
-\definecharacter greekiotadasiaperispomeni 140
-\definecharacter greekiotapsiliperispomeni 141
-\definecharacter greekiotadialytika 142
-\definecharacter greekiotadialytikatonos 143
-\definecharacter greekiotadialytikavaria 144
-\definecharacter greekdasiaperispomeni 145
-\definecharacter greekpsiliperispomeni 146
-\definecharacter greekdasiatonos 147
-\definecharacter greekpsilitonos 148
-\definecharacter greekdasiavaria 149
-\definecharacter greekpsilivaria 150
-\definecharacter greekdialytikatonos 151
-\definecharacter greekepsilondasia 152
-\definecharacter greekepsilonpsili 153
-\definecharacter greekepsilonoxia 154
-\definecharacter greekepsilondasiatonos 155
-\definecharacter greekepsilonpsilitonos 156
-\definecharacter greekepsilonvaria 157
-\definecharacter greekepsilondasiavaria 158
-\definecharacter greekepsilonpsilivaria 159
-\definecharacter greekdialytikavaria 160
-\definecharacter greekalphadasia 161
-\definecharacter greekalphapsili 162
-\definecharacter greekalphaoxia 163
-\definecharacter greekalphadasiatonos 164
-\definecharacter greekalphapsilitonos 165
-\definecharacter greekalphavaria 166
-\definecharacter greekalphadasiavaria 167
-\definecharacter greekalphapsilivaria 168
-\definecharacter greekalphaperispomeni 169
-\definecharacter greekalphadasiaperispomeni 170
-\definecharacter greekalphapsiliperispomeni 171
-\definecharacter greekalphaiotasubdasia 172
-\definecharacter greekalphaiotasubpsili 173
-\definecharacter greekalphaiotasubtonos 174
-\definecharacter greekalphaiotasubdasiatonos 175
-\definecharacter greekalphaiotasubpsilitonos 176
-\definecharacter greekalphaiotasubvaria 177
-\definecharacter greekalphaiotasubdasiavaria 178
-\definecharacter greekalphaiotasubpsilivaria 179
-\definecharacter greekalphaiotasubperispomeni 180
-\definecharacter greekalphaiotasubdasiaperispomeni 181
-\definecharacter greekalphaiotasubpsiliperispomeni 182
-\definecharacter greekrhodasia 183
-\definecharacter greekrhopsili 184
-\definecharacter greeketadasia 185
-\definecharacter greeketapsili 186
-\definecharacter greeketaoxia 187
-\definecharacter greeketadasiatonos 188
-\definecharacter greeketapsilitonos 189
-\definecharacter greeketavaria 190
-\definecharacter greeketadasiavaria 191
-\definecharacter greeketapsilivaria 192
-\definecharacter greeketaperispomeni 193
-\definecharacter greeketadasiaperispomeni 194
-\definecharacter greeketapsiliperispomeni 195
-\definecharacter textslash 196
-\definecharacter greeketaiotasubdasia 197
-\definecharacter greeketaiotasubpsili 198
-\definecharacter greeketaiotasubtonos 199
-\definecharacter greeketaiotasubdasiatonos 200
-\definecharacter greeketaiotasubpsilitonos 201
-\definecharacter greeketaiotasubvaria 202
-\definecharacter greeketaiotasubdasiavaria 203
-\definecharacter greeketaiotasubpsilivaria 204
-\definecharacter greeketaiotasubperispomeni 205
-\definecharacter greeketaiotasubdasiaperispomeni 206
-\definecharacter greeketaiotasubpsiliperispomeni 207
-\definecharacter greekomicrondasia 208
-\definecharacter greekomicronpsili 209
-\definecharacter greekomicronoxia 210
-\definecharacter greekomicrondasiatonos 211
-\definecharacter greekomicronpsilitonos 212
-\definecharacter greekomicronvaria 213
-\definecharacter greekomicrondasiavaria 214
-\definecharacter greekomicronpsilivaria 215
-\definecharacter greekupsilondasia 216
-\definecharacter greekupsilonpsili 217
-\definecharacter greekupsilonoxia 218
-\definecharacter greekupsilondasiatonos 219
-\definecharacter greekupsilonpsilitonos 220
-\definecharacter greekupsilonvaria 221
-\definecharacter greekupsilondasiavaria 222
-\definecharacter greekupsilonpsilivaria 223
-\definecharacter greekupsilonperispomeni 224
-\definecharacter greekupsilondasiaperispomeni 225
-\definecharacter greekupsilonpsiliperispomeni 226
-\definecharacter greekupsilondiaeresis 227
-\definecharacter greekupsilondialytikatonos 228
-\definecharacter greekupsilondialytikavaria 229
-\definecharacter greekomegadasia 230
-\definecharacter greekomegapsili 231
-\definecharacter greekomegaoxia 232
-\definecharacter greekomegadasiatonos 233
-\definecharacter greekomegapsilitonos 234
-\definecharacter greekomegavaria 235
-\definecharacter greekomegadasiavaria 236
-\definecharacter greekomegapsilivaria 237
-\definecharacter greekomegaperispomeni 238
-\definecharacter greekomegadasiaperispomeni 239
-\definecharacter greekomegapsiliperispomeni 240
-\definecharacter greekomegaiotasubdasia 241
-\definecharacter greekomegaiotasubpsili 242
-\definecharacter greekomegaiotasubtonos 243
-\definecharacter greekomegaiotasubdasiatonos 244
-\definecharacter greekomegaiotasubpsilitonos 245
-\definecharacter greekomegaiotasubvaria 246
-\definecharacter greekomegaiotasubdasiavaria 247
-\definecharacter greekomegaiotasubpsilivaria 248
-\definecharacter greekomegaiotasubperispomeni 249
-\definecharacter greekomegaiotasubdasiaperispomeni 250
-\definecharacter greekomegaiotasubpsiliperispomeni 251
-\definecharacter greeknumeralsign 254
-\definecharacter greeknumeralsignlower 255
-
-\stopencoding
-
-\startencoding[default]
-
-\definecharacter greekAlphapsili {\greekpsili \greekAlpha}
-\definecharacter greekAlphadasia {\greekdasia \greekAlpha}
-\definecharacter greekAlphapsilivaria {\greekpsilivaria \greekAlpha}
-\definecharacter greekAlphadasiavaria {\greekdasiavaria \greekAlpha}
-\definecharacter greekAlphapsilitonos {\greekpsilitonos \greekAlpha}
-\definecharacter greekAlphadasiatonos {\greekdasiatonos \greekAlpha}
-\definecharacter greekAlphapsiliperispomeni {\greekpsiliperispomeni \greekAlpha}
-\definecharacter greekAlphadasiaperispomeni {\greekdasiaperispomeni \greekAlpha}
-\definecharacter greekEpsilonpsili {\greekpsili \greekEpsilon}
-\definecharacter greekEpsilondasia {\greekdasia \greekEpsilon}
-\definecharacter greekEpsilonpsilivaria {\greekpsilivaria \greekEpsilon}
-\definecharacter greekEpsilondasiavaria {\greekdasiavaria \greekEpsilon}
-\definecharacter greekEpsilonpsilitonos {\greekpsilitonos \greekEpsilon}
-\definecharacter greekEpsilondasiatonos {\greekdasiatonos \greekEpsilon}
-\definecharacter greekEtapsili {\greekpsili \greekEta}
-\definecharacter greekEtadasia {\greekdasia \greekEta}
-\definecharacter greekEtapsilivaria {\greekpsilivaria \greekEta}
-\definecharacter greekEtadasiavaria {\greekdasiavaria \greekEta}
-\definecharacter greekEtapsilitonos {\greekpsilitonos \greekEta}
-\definecharacter greekEtadasiatonos {\greekdasiatonos \greekEta}
-\definecharacter greekEtapsiliperispomeni {\greekpsiliperispomeni \greekEta}
-\definecharacter greekEtadasiaperispomeni {\greekdasiaperispomeni \greekEta}
-\definecharacter greekIotapsili {\greekpsili \greekIota}
-\definecharacter greekIotadasia {\greekdasia \greekIota}
-\definecharacter greekIotapsilivaria {\greekpsilivaria \greekIota}
-\definecharacter greekIotadasiavaria {\greekdasiavaria \greekIota}
-\definecharacter greekIotapsilitonos {\greekpsilitonos \greekIota}
-\definecharacter greekIotadasiatonos {\greekdasiatonos \greekIota}
-\definecharacter greekIotapsiliperispomeni {\greekpsiliperispomeni \greekIota}
-\definecharacter greekIotadasiaperispomeni {\greekdasiaperispomeni \greekIota}
-\definecharacter greekOmicronpsili {\greekpsili \greekOmicron}
-\definecharacter greekOmicrondasia {\greekdasia \greekOmicron}
-\definecharacter greekOmicronpsilivaria {\greekpsilivaria \greekOmicron}
-\definecharacter greekOmicrondasiavaria {\greekdasiavaria \greekOmicron}
-\definecharacter greekOmicronpsilitonos {\greekpsilitonos \greekOmicron}
-\definecharacter greekOmicrondasiatonos {\greekdasiatonos \greekOmicron}
-\definecharacter greekUpsilondasia {\greekdasia \greekUpsilon}
-\definecharacter greekUpsilondasiavaria {\greekdasiavaria \greekUpsilon}
-\definecharacter greekUpsilondasiatonos {\greekdasiatonos \greekUpsilon}
-\definecharacter greekUpsilondasiaperispomeni {\greekdasiaperispomeni \greekUpsilon}
-\definecharacter greekOmegapsili {\greekpsili \greekOmega}
-\definecharacter greekOmegadasia {\greekdasia \greekOmega}
-\definecharacter greekOmegapsilivaria {\greekpsilivaria \greekOmega}
-\definecharacter greekOmegadasiavaria {\greekdasiavaria \greekOmega}
-\definecharacter greekOmegapsilitonos {\greekpsilitonos \greekOmega}
-\definecharacter greekOmegadasiatonos {\greekdasiatonos \greekOmega}
-\definecharacter greekOmegapsiliperispomeni {\greekpsiliperispomeni \greekOmega}
-\definecharacter greekOmegadasiaperispomeni {\greekdasiaperispomeni \greekOmega}
-\definecharacter greekAlphaiotasubpsili {\greekpsili \greekAlpha \greekiota}
-\definecharacter greekAlphaiotasubdasia {\greekdasia \greekAlpha \greekiota}
-\definecharacter greekAlphaiotasubpsilivaria {\greekpsilivaria \greekAlpha \greekiota}
-\definecharacter greekAlphaiotasubdasiavaria {\greekdasiavaria \greekAlpha \greekiota}
-\definecharacter greekAlphaiotasubpsilitonos {\greekpsilitonos \greekAlpha \greekiota}
-\definecharacter greekAlphaiotasubdasiatonos {\greekdasiatonos \greekAlpha \greekiota}
-\definecharacter greekAlphaiotasubpsiliperispomeni {\greekpsiliperispomeni \greekAlpha \greekiota}
-\definecharacter greekAlphaiotasubdasiaperispomeni {\greekdasiaperispomeni \greekAlpha \greekiota}
-\definecharacter greekEtaiotasubpsili {\greekpsili \greekEta \greekiota}
-\definecharacter greekEtaiotasubdasia {\greekdasia \greekEta \greekiota}
-\definecharacter greekEtaiotasubpsilivaria {\greekpsilivaria \greekEta \greekiota}
-\definecharacter greekEtaiotasubdasiavaria {\greekdasiavaria \greekEta \greekiota}
-\definecharacter greekEtaiotasubpsilitonos {\greekpsilitonos \greekEta \greekiota}
-\definecharacter greekEtaiotasubdasiatonos {\greekdasiatonos \greekEta \greekiota}
-\definecharacter greekEtaiotasubpsiliperispomeni {\greekpsiliperispomeni \greekEta \greekiota}
-\definecharacter greekEtaiotasubdasiaperispomeni {\greekdasiaperispomeni \greekEta \greekiota}
-\definecharacter greekOmegaiotasubpsili {\greekpsili \greekOmega \greekiota}
-\definecharacter greekOmegaiotasubdasia {\greekdasia \greekOmega \greekiota}
-\definecharacter greekOmegaiotasubpsilivaria {\greekpsilivaria \greekOmega \greekiota}
-\definecharacter greekOmegaiotasubdasiavaria {\greekdasiavaria \greekOmega \greekiota}
-\definecharacter greekOmegaiotasubpsilitonos {\greekpsilitonos \greekOmega \greekiota}
-\definecharacter greekOmegaiotasubdasiatonos {\greekdasiatonos \greekOmega \greekiota}
-\definecharacter greekOmegaiotasubpsiliperispomeni {\greekpsiliperispomeni \greekOmega \greekiota}
-\definecharacter greekOmegaiotasubdasiaperispomeni {\greekdasiaperispomeni \greekOmega \greekiota}
-\definecharacter greekAlphavaria {\greekvaria \greekAlpha}
-\definecharacter greekAlphaoxia {\greekoxia \greekAlpha}
-\definecharacter greekAlphaiotasub {\greekAlpha \greekiota}
-\definecharacter greekEpsilonvaria {\greekvaria \greekEpsilon}
-\definecharacter greekEpsilonoxia {\greekoxia \greekEpsilon}
-\definecharacter greekEtavaria {\greekvaria \greekEta}
-\definecharacter greekEtaoxia {\greekoxia \greekEta}
-\definecharacter greekEtaiotasub {\greekEta \greekiota}
-\definecharacter greekIotavaria {\greekvaria \greekIota}
-\definecharacter greekIotaoxia {\greekoxia \greekIota}
-\definecharacter greekUpsilonvaria {\greekvaria \greekUpsilon}
-\definecharacter greekUpsilonoxia {\greekoxia \greekUpsilon}
-\definecharacter greekOmicronvaria {\greekvaria \greekOmicron}
-\definecharacter greekOmicronoxia {\greekoxia \greekOmicron}
-\definecharacter greekOmegavaria {\greekvaria \greekOmega}
-\definecharacter greekOmegaoxia {\greekoxia \greekOmega}
-\definecharacter greekOmegaiotasub {\greekOmega \greekiota}
-\definecharacter greekRhodasia {\greekdasia \greekRho}
-\definecharacter digamma {\greekdigamma}
-\definecharacter sampi {\greeksampi}
-\definecharacter stigma {\greekstigma}
-\definecharacter koppa {\greeknumkoppa}
-\definecharacter lunars {\greeksigmalunate}
-\definecharacter lunarS {\greekSigmalunate}
-\definecharacter halfbraceleft {\floorleft}
-\definecharacter halfbraceright {\floorright}
-\definecharacter crux {\textdag}
-
-\stopencoding
-
-\endinput
diff --git a/tex/context/base/enco-ans.mkii b/tex/context/base/enco-ans.mkii
new file mode 100644
index 000000000..7a48b5b55
--- /dev/null
+++ b/tex/context/base/enco-ans.mkii
@@ -0,0 +1,237 @@
+%D \module
+%D [ file=enco-ans,
+%D version=2000.05.07, % 1995.01.01,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=\YandY\ texnansi Encoding,
+%D author={Patrick Gundlach, Hans Hagen},
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This is \YandY's texnansi encoding vector, which combines
+%D the best of the ansi encoding vector (prebuilt accented
+%D characters etc.) and some of \TEX's vectors.
+
+\startmapping[texnansi]
+
+\resetcaserange 128 to 158
+\resetcaserange 160 to 191
+\resetcaserange 215 to 215
+\resetcaserange 247 to 247
+
+\definecasemaps 192 to 214 lc +32 uc 0
+\definecasemaps 224 to 246 lc 0 uc -32
+\definecasemaps 216 to 222 lc +32 uc 0
+\definecasemaps 248 to 254 lc 0 uc -32
+
+\definecaseself 223
+\definecaseswap 156 140
+\definecaseswap 255 159
+
+% needed by some patterns:
+
+% \definecaseself 34 % quotedbl
+% \definecaseself 132 % quotedblbase
+% \definecaseself 147 % quotedblleft
+% \definecaseself 148 % quotedblright
+% \definecaseself 129 % quotesingle
+% \definecaseself 130 % quotesinglebase
+% \definecaseself 145 % quoteleft
+% \definecaseself 146 % quoteright
+
+\stopmapping
+
+\startencoding[texnansi]
+
+\definecharacter textacute 19
+\definecharacter textbreve 21
+\definecharacter textcaron 20
+\definecharacter textcedilla 184
+\definecharacter textcircumflex 94 % 136
+\definecharacter textdiaeresis 168
+\definecharacter textdotaccent 5
+\definecharacter textgrave 18
+\definecharacter texthungarumlaut 6
+\definecharacter textmacron 175
+\definecharacter textogonek 7
+\definecharacter textring 23
+\definecharacter texttilde 152
+
+\definecharacter dotlessi 16 % 105
+\definecharacter dotlessj 17
+
+\definecharacter endash 150 % lig
+\definecharacter emdash 151 % lig
+
+\definecharacter aeligature 230
+\definecharacter AEligature 198
+\definecharacter oeligature 156
+\definecharacter OEligature 140
+
+\definecharacter ssharp 223
+
+\definecharacter thorn 254
+\definecharacter Thorn 222
+
+\definecharacter Dstroke 208 % also Eth, mapped in enco-def
+\definecharacter eth 240
+
+\definecharacter exclamdown 161
+\definecharacter questiondown 191
+
+\definecharacter copyright 169
+\definecharacter registered 174
+\definecharacter trademark 153
+
+\definecharacter sectionmark 167
+\definecharacter paragraphmark 182
+
+\definecharacter onequarter 188
+\definecharacter onehalf 189
+\definecharacter threequarter 190
+
+\definecharacter onesuperior 185
+\definecharacter twosuperior 178
+\definecharacter threesuperior 179
+
+\definecharacter textcent 162 % ?
+\definecharacter textcurrency 164
+\definecharacter texteuro 1
+\definecharacter textflorin 131
+\definecharacter textsterling 163
+\definecharacter textyen 165
+
+\definecharacter percent 37
+\definecharacter perthousand 137
+
+\definecharacter softhyphen 45
+\definecharacter periodcentered 183
+
+\definecharacter textasciicircum 142
+\definecharacter textasciitilde 158
+\definecharacter textbackslash 92
+\definecharacter textbraceleft 123
+\definecharacter textbar 124
+\definecharacter textbraceright 125
+\definecharacter textunderscore 95
+
+\definecharacter textbrokenbar 166
+\definecharacter textbullet 149
+\definecharacter textdag 134
+\definecharacter textddag 135
+\definecharacter textdegree 176
+\definecharacter textdiv 247
+\definecharacter textellipsis 133
+\definecharacter textfraction 4
+\definecharacter textlognot 172
+\definecharacter textminus 143
+\definecharacter textmu 181
+\definecharacter textmultiply 215
+\definecharacter textpm 177
+
+\definecharacter quotedbl 34
+\definecharacter quotedblbase 132
+\definecharacter quotedblleft 147
+\definecharacter quotedblright 148
+
+\definecharacter quotesingle 129
+\definecharacter quotesinglebase 130
+
+\definecharacter quoteleft 145
+\definecharacter quoteright 146
+
+\definecharacter guilsingleleft 139
+\definecharacter guilsingleright 155
+\definecharacter leftguillemot 171
+\definecharacter rightguillemot 187
+
+\definecharacter aacute 225
+\definecharacter Aacute 193
+\definecharacter eacute 233
+\definecharacter Eacute 201
+\definecharacter iacute 237
+\definecharacter Iacute 205
+\definecharacter oacute 243
+\definecharacter Oacute 211
+\definecharacter uacute 250
+\definecharacter Uacute 218
+\definecharacter yacute 253
+\definecharacter Yacute 221
+
+\definecharacter scaron 154
+\definecharacter Scaron 138
+\definecharacter zcaron 157
+\definecharacter Zcaron 141
+
+\definecharacter ccedilla 231
+\definecharacter Ccedilla 199
+
+\definecharacter acircumflex 226
+\definecharacter Acircumflex 194
+\definecharacter ecircumflex 234
+\definecharacter Ecircumflex 202
+\definecharacter icircumflex 238
+\definecharacter Icircumflex 206
+\definecharacter ocircumflex 244
+\definecharacter Ocircumflex 212
+\definecharacter ucircumflex 251
+\definecharacter Ucircumflex 219
+
+\definecharacter adiaeresis 228
+\definecharacter Adiaeresis 196
+\definecharacter ediaeresis 235
+\definecharacter Ediaeresis 203
+\definecharacter idiaeresis 239
+\definecharacter Idiaeresis 207
+\definecharacter odiaeresis 246
+\definecharacter Odiaeresis 214
+\definecharacter udiaeresis 252
+\definecharacter Udiaeresis 220
+\definecharacter ydiaeresis 255
+\definecharacter Ydiaeresis 159
+
+\definecharacter agrave 224
+\definecharacter Agrave 192
+\definecharacter egrave 232
+\definecharacter Egrave 200
+\definecharacter igrave 236
+\definecharacter Igrave 204
+\definecharacter ograve 242
+\definecharacter Ograve 210
+\definecharacter ugrave 249
+\definecharacter Ugrave 217
+
+\definecharacter aring 229
+\definecharacter Aring 197
+
+\definecharacter Lstroke 128
+\definecharacter lstroke 144
+\definecharacter ostroke 248
+\definecharacter Ostoke 216
+
+\definecharacter atilde 227
+\definecharacter Atilde 195
+\definecharacter ntilde 241
+\definecharacter Ntilde 209
+\definecharacter otilde 245
+\definecharacter Otilde 213
+
+\stopencoding
+
+% will be replaced by math collection, fails anyway
+
+\startencoding[texnansi]
+
+\definecharacter mathgrave "7060
+\definecharacter mathacute "70B4
+\definecharacter mathhat "7088
+\definecharacter mathtilde "7098
+\definecharacter mathddot "70A8
+\definecharacter mathbar "70AF
+
+\stopencoding
+
+\endinput
diff --git a/tex/context/base/enco-ans.tex b/tex/context/base/enco-ans.tex
deleted file mode 100644
index 7a48b5b55..000000000
--- a/tex/context/base/enco-ans.tex
+++ /dev/null
@@ -1,237 +0,0 @@
-%D \module
-%D [ file=enco-ans,
-%D version=2000.05.07, % 1995.01.01,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=\YandY\ texnansi Encoding,
-%D author={Patrick Gundlach, Hans Hagen},
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D This is \YandY's texnansi encoding vector, which combines
-%D the best of the ansi encoding vector (prebuilt accented
-%D characters etc.) and some of \TEX's vectors.
-
-\startmapping[texnansi]
-
-\resetcaserange 128 to 158
-\resetcaserange 160 to 191
-\resetcaserange 215 to 215
-\resetcaserange 247 to 247
-
-\definecasemaps 192 to 214 lc +32 uc 0
-\definecasemaps 224 to 246 lc 0 uc -32
-\definecasemaps 216 to 222 lc +32 uc 0
-\definecasemaps 248 to 254 lc 0 uc -32
-
-\definecaseself 223
-\definecaseswap 156 140
-\definecaseswap 255 159
-
-% needed by some patterns:
-
-% \definecaseself 34 % quotedbl
-% \definecaseself 132 % quotedblbase
-% \definecaseself 147 % quotedblleft
-% \definecaseself 148 % quotedblright
-% \definecaseself 129 % quotesingle
-% \definecaseself 130 % quotesinglebase
-% \definecaseself 145 % quoteleft
-% \definecaseself 146 % quoteright
-
-\stopmapping
-
-\startencoding[texnansi]
-
-\definecharacter textacute 19
-\definecharacter textbreve 21
-\definecharacter textcaron 20
-\definecharacter textcedilla 184
-\definecharacter textcircumflex 94 % 136
-\definecharacter textdiaeresis 168
-\definecharacter textdotaccent 5
-\definecharacter textgrave 18
-\definecharacter texthungarumlaut 6
-\definecharacter textmacron 175
-\definecharacter textogonek 7
-\definecharacter textring 23
-\definecharacter texttilde 152
-
-\definecharacter dotlessi 16 % 105
-\definecharacter dotlessj 17
-
-\definecharacter endash 150 % lig
-\definecharacter emdash 151 % lig
-
-\definecharacter aeligature 230
-\definecharacter AEligature 198
-\definecharacter oeligature 156
-\definecharacter OEligature 140
-
-\definecharacter ssharp 223
-
-\definecharacter thorn 254
-\definecharacter Thorn 222
-
-\definecharacter Dstroke 208 % also Eth, mapped in enco-def
-\definecharacter eth 240
-
-\definecharacter exclamdown 161
-\definecharacter questiondown 191
-
-\definecharacter copyright 169
-\definecharacter registered 174
-\definecharacter trademark 153
-
-\definecharacter sectionmark 167
-\definecharacter paragraphmark 182
-
-\definecharacter onequarter 188
-\definecharacter onehalf 189
-\definecharacter threequarter 190
-
-\definecharacter onesuperior 185
-\definecharacter twosuperior 178
-\definecharacter threesuperior 179
-
-\definecharacter textcent 162 % ?
-\definecharacter textcurrency 164
-\definecharacter texteuro 1
-\definecharacter textflorin 131
-\definecharacter textsterling 163
-\definecharacter textyen 165
-
-\definecharacter percent 37
-\definecharacter perthousand 137
-
-\definecharacter softhyphen 45
-\definecharacter periodcentered 183
-
-\definecharacter textasciicircum 142
-\definecharacter textasciitilde 158
-\definecharacter textbackslash 92
-\definecharacter textbraceleft 123
-\definecharacter textbar 124
-\definecharacter textbraceright 125
-\definecharacter textunderscore 95
-
-\definecharacter textbrokenbar 166
-\definecharacter textbullet 149
-\definecharacter textdag 134
-\definecharacter textddag 135
-\definecharacter textdegree 176
-\definecharacter textdiv 247
-\definecharacter textellipsis 133
-\definecharacter textfraction 4
-\definecharacter textlognot 172
-\definecharacter textminus 143
-\definecharacter textmu 181
-\definecharacter textmultiply 215
-\definecharacter textpm 177
-
-\definecharacter quotedbl 34
-\definecharacter quotedblbase 132
-\definecharacter quotedblleft 147
-\definecharacter quotedblright 148
-
-\definecharacter quotesingle 129
-\definecharacter quotesinglebase 130
-
-\definecharacter quoteleft 145
-\definecharacter quoteright 146
-
-\definecharacter guilsingleleft 139
-\definecharacter guilsingleright 155
-\definecharacter leftguillemot 171
-\definecharacter rightguillemot 187
-
-\definecharacter aacute 225
-\definecharacter Aacute 193
-\definecharacter eacute 233
-\definecharacter Eacute 201
-\definecharacter iacute 237
-\definecharacter Iacute 205
-\definecharacter oacute 243
-\definecharacter Oacute 211
-\definecharacter uacute 250
-\definecharacter Uacute 218
-\definecharacter yacute 253
-\definecharacter Yacute 221
-
-\definecharacter scaron 154
-\definecharacter Scaron 138
-\definecharacter zcaron 157
-\definecharacter Zcaron 141
-
-\definecharacter ccedilla 231
-\definecharacter Ccedilla 199
-
-\definecharacter acircumflex 226
-\definecharacter Acircumflex 194
-\definecharacter ecircumflex 234
-\definecharacter Ecircumflex 202
-\definecharacter icircumflex 238
-\definecharacter Icircumflex 206
-\definecharacter ocircumflex 244
-\definecharacter Ocircumflex 212
-\definecharacter ucircumflex 251
-\definecharacter Ucircumflex 219
-
-\definecharacter adiaeresis 228
-\definecharacter Adiaeresis 196
-\definecharacter ediaeresis 235
-\definecharacter Ediaeresis 203
-\definecharacter idiaeresis 239
-\definecharacter Idiaeresis 207
-\definecharacter odiaeresis 246
-\definecharacter Odiaeresis 214
-\definecharacter udiaeresis 252
-\definecharacter Udiaeresis 220
-\definecharacter ydiaeresis 255
-\definecharacter Ydiaeresis 159
-
-\definecharacter agrave 224
-\definecharacter Agrave 192
-\definecharacter egrave 232
-\definecharacter Egrave 200
-\definecharacter igrave 236
-\definecharacter Igrave 204
-\definecharacter ograve 242
-\definecharacter Ograve 210
-\definecharacter ugrave 249
-\definecharacter Ugrave 217
-
-\definecharacter aring 229
-\definecharacter Aring 197
-
-\definecharacter Lstroke 128
-\definecharacter lstroke 144
-\definecharacter ostroke 248
-\definecharacter Ostoke 216
-
-\definecharacter atilde 227
-\definecharacter Atilde 195
-\definecharacter ntilde 241
-\definecharacter Ntilde 209
-\definecharacter otilde 245
-\definecharacter Otilde 213
-
-\stopencoding
-
-% will be replaced by math collection, fails anyway
-
-\startencoding[texnansi]
-
-\definecharacter mathgrave "7060
-\definecharacter mathacute "70B4
-\definecharacter mathhat "7088
-\definecharacter mathtilde "7098
-\definecharacter mathddot "70A8
-\definecharacter mathbar "70AF
-
-\stopencoding
-
-\endinput
diff --git a/tex/context/base/enco-cas.mkii b/tex/context/base/enco-cas.mkii
new file mode 100644
index 000000000..38d12f9fa
--- /dev/null
+++ b/tex/context/base/enco-cas.mkii
@@ -0,0 +1,143 @@
+%D \module
+%D [ file=enco-cas,
+%D version=2005.08.23,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Named Glyph Case Mapping,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D For quite some years \CONTEXT\ used a rather compact way of
+%D defining encoded characters as well as case maps. When late
+%D 2000 more advanced remapping features were needed (like pdf
+%D unicode remapping), named glyphs were introduced to keep the
+%D coding tables more readable. At the same time, we introduced
+%D named glyph case mapping.
+
+\defineULcharacter Acircumflex acircumflex
+\defineULcharacter Ccircumflex ccircumflex
+\defineULcharacter Ecircumflex ecircumflex
+\defineULcharacter Gcircumflex gcircumflex
+\defineULcharacter Hcircumflex hcircumflex
+\defineULcharacter Icircumflex icircumflex
+\defineULcharacter Jcircumflex jcircumflex
+\defineULcharacter Ocircumflex ocircumflex
+\defineULcharacter Scircumflex scircumflex
+\defineULcharacter Ucircumflex ucircumflex
+\defineULcharacter Wcircumflex wcircumflex
+\defineULcharacter Ycircumflex ycircumflex
+
+\defineULcharacter Agrave agrave
+\defineULcharacter Egrave egrave
+\defineULcharacter Igrave igrave
+\defineULcharacter Ograve ograve
+\defineULcharacter Ugrave ugrave
+\defineULcharacter Ygrave ygrave
+
+\defineULcharacter Atilde atilde
+\defineULcharacter Itilde itilde
+\defineULcharacter Otilde otilde
+\defineULcharacter Ntilde ntilde
+\defineULcharacter Utilde utilde
+
+\defineULcharacter Adiaeresis adiaeresis
+\defineULcharacter Ediaeresis ediaeresis
+\defineULcharacter Idiaeresis idiaeresis
+\defineULcharacter Odiaeresis odiaeresis
+\defineULcharacter Udiaeresis udiaeresis
+\defineULcharacter Ydiaeresis ydiaeresis
+
+\defineULcharacter Aacute aacute
+\defineULcharacter Cacute cacute
+\defineULcharacter Eacute eacute
+\defineULcharacter Iacute iacute
+\defineULcharacter Lacute lacute
+\defineULcharacter Nacute nacute
+\defineULcharacter Oacute oacute
+\defineULcharacter Racute racute
+\defineULcharacter Sacute sacute
+\defineULcharacter Uacute uacute
+\defineULcharacter Yacute yacute
+\defineULcharacter Zacute zacute
+
+\defineULcharacter Dstroke dstroke
+\defineULcharacter Hstroke hstroke
+\defineULcharacter Lstroke lstroke
+\defineULcharacter Lslash lslash
+\defineULcharacter Ostroke ostroke
+\defineULcharacter Tstroke tstroke
+
+\defineULcharacter Cdotaccent cdotaccent
+\defineULcharacter Edotaccent edotaccent
+\defineULcharacter Gdotaccent gdotaccent
+\defineULcharacter Idotaccent idotaccent
+\defineULcharacter Zdotaccent zdotaccent
+
+\defineULcharacter Amacron amacron
+\defineULcharacter Emacron emacron
+\defineULcharacter Imacron imacron
+\defineULcharacter Omacron omacron
+\defineULcharacter Umacron umacron
+
+\defineULcharacter Ccedilla ccedilla
+\defineULcharacter Gcedilla gcedilla
+\defineULcharacter Kcedilla kcedilla
+\defineULcharacter Lcedilla lcedilla
+\defineULcharacter Ncedilla ncedilla
+\defineULcharacter Rcedilla rcedilla
+\defineULcharacter Scedilla scedilla
+\defineULcharacter Tcedilla tcedilla
+
+\defineULcharacter Ccommaaccent ccommaaccent
+\defineULcharacter Gcommaaccent gcommaaccent
+\defineULcharacter Kcommaaccent kcommaaccent
+\defineULcharacter Lcommaaccent lcommaaccent
+\defineULcharacter Ncommaaccent ncommaaccent
+\defineULcharacter Rcommaaccent rcommaaccent
+\defineULcharacter Scommaaccent scommaaccent
+\defineULcharacter Tcommaaccent tcommaaccent
+
+\defineULcharacter Ohungarumlaut ohungarumlaut
+\defineULcharacter Uhungarumlaut uhungarumlaut
+
+\defineULcharacter Aogonek aogonek
+\defineULcharacter Eogonek eogonek
+\defineULcharacter Iogonek iogonek
+\defineULcharacter Uogonek uogonek
+
+\defineULcharacter Aring aring
+\defineULcharacter Uring uring
+
+\defineULcharacter Abreve abreve
+\defineULcharacter Ebreve ebreve
+\defineULcharacter Gbreve gbreve
+\defineULcharacter Ibreve ibreve
+\defineULcharacter Obreve obreve
+\defineULcharacter Ubreve ubreve
+
+\defineULcharacter Ccaron ccaron
+\defineULcharacter Dcaron dcaron
+\defineULcharacter Ecaron ecaron
+\defineULcharacter Lcaron lcaron
+\defineULcharacter Ncaron ncaron
+\defineULcharacter Rcaron rcaron
+\defineULcharacter Scaron scaron
+\defineULcharacter Tcaron tcaron
+\defineULcharacter Zcaron zcaron
+
+\defineULcharacter dotlessI dotlessi
+\defineULcharacter dotlessJ dotlessj
+
+\defineULcharacter AEligature aeligature
+\defineULcharacter OEligature oeligature
+\defineULcharacter Ssharp ssharp
+\defineULcharacter IJligature ijligature
+
+\defineULcharacter Eth eth
+\defineULcharacter Thorn thorn
+
+\endinput
diff --git a/tex/context/base/enco-cas.tex b/tex/context/base/enco-cas.tex
deleted file mode 100644
index 38d12f9fa..000000000
--- a/tex/context/base/enco-cas.tex
+++ /dev/null
@@ -1,143 +0,0 @@
-%D \module
-%D [ file=enco-cas,
-%D version=2005.08.23,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Named Glyph Case Mapping,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D For quite some years \CONTEXT\ used a rather compact way of
-%D defining encoded characters as well as case maps. When late
-%D 2000 more advanced remapping features were needed (like pdf
-%D unicode remapping), named glyphs were introduced to keep the
-%D coding tables more readable. At the same time, we introduced
-%D named glyph case mapping.
-
-\defineULcharacter Acircumflex acircumflex
-\defineULcharacter Ccircumflex ccircumflex
-\defineULcharacter Ecircumflex ecircumflex
-\defineULcharacter Gcircumflex gcircumflex
-\defineULcharacter Hcircumflex hcircumflex
-\defineULcharacter Icircumflex icircumflex
-\defineULcharacter Jcircumflex jcircumflex
-\defineULcharacter Ocircumflex ocircumflex
-\defineULcharacter Scircumflex scircumflex
-\defineULcharacter Ucircumflex ucircumflex
-\defineULcharacter Wcircumflex wcircumflex
-\defineULcharacter Ycircumflex ycircumflex
-
-\defineULcharacter Agrave agrave
-\defineULcharacter Egrave egrave
-\defineULcharacter Igrave igrave
-\defineULcharacter Ograve ograve
-\defineULcharacter Ugrave ugrave
-\defineULcharacter Ygrave ygrave
-
-\defineULcharacter Atilde atilde
-\defineULcharacter Itilde itilde
-\defineULcharacter Otilde otilde
-\defineULcharacter Ntilde ntilde
-\defineULcharacter Utilde utilde
-
-\defineULcharacter Adiaeresis adiaeresis
-\defineULcharacter Ediaeresis ediaeresis
-\defineULcharacter Idiaeresis idiaeresis
-\defineULcharacter Odiaeresis odiaeresis
-\defineULcharacter Udiaeresis udiaeresis
-\defineULcharacter Ydiaeresis ydiaeresis
-
-\defineULcharacter Aacute aacute
-\defineULcharacter Cacute cacute
-\defineULcharacter Eacute eacute
-\defineULcharacter Iacute iacute
-\defineULcharacter Lacute lacute
-\defineULcharacter Nacute nacute
-\defineULcharacter Oacute oacute
-\defineULcharacter Racute racute
-\defineULcharacter Sacute sacute
-\defineULcharacter Uacute uacute
-\defineULcharacter Yacute yacute
-\defineULcharacter Zacute zacute
-
-\defineULcharacter Dstroke dstroke
-\defineULcharacter Hstroke hstroke
-\defineULcharacter Lstroke lstroke
-\defineULcharacter Lslash lslash
-\defineULcharacter Ostroke ostroke
-\defineULcharacter Tstroke tstroke
-
-\defineULcharacter Cdotaccent cdotaccent
-\defineULcharacter Edotaccent edotaccent
-\defineULcharacter Gdotaccent gdotaccent
-\defineULcharacter Idotaccent idotaccent
-\defineULcharacter Zdotaccent zdotaccent
-
-\defineULcharacter Amacron amacron
-\defineULcharacter Emacron emacron
-\defineULcharacter Imacron imacron
-\defineULcharacter Omacron omacron
-\defineULcharacter Umacron umacron
-
-\defineULcharacter Ccedilla ccedilla
-\defineULcharacter Gcedilla gcedilla
-\defineULcharacter Kcedilla kcedilla
-\defineULcharacter Lcedilla lcedilla
-\defineULcharacter Ncedilla ncedilla
-\defineULcharacter Rcedilla rcedilla
-\defineULcharacter Scedilla scedilla
-\defineULcharacter Tcedilla tcedilla
-
-\defineULcharacter Ccommaaccent ccommaaccent
-\defineULcharacter Gcommaaccent gcommaaccent
-\defineULcharacter Kcommaaccent kcommaaccent
-\defineULcharacter Lcommaaccent lcommaaccent
-\defineULcharacter Ncommaaccent ncommaaccent
-\defineULcharacter Rcommaaccent rcommaaccent
-\defineULcharacter Scommaaccent scommaaccent
-\defineULcharacter Tcommaaccent tcommaaccent
-
-\defineULcharacter Ohungarumlaut ohungarumlaut
-\defineULcharacter Uhungarumlaut uhungarumlaut
-
-\defineULcharacter Aogonek aogonek
-\defineULcharacter Eogonek eogonek
-\defineULcharacter Iogonek iogonek
-\defineULcharacter Uogonek uogonek
-
-\defineULcharacter Aring aring
-\defineULcharacter Uring uring
-
-\defineULcharacter Abreve abreve
-\defineULcharacter Ebreve ebreve
-\defineULcharacter Gbreve gbreve
-\defineULcharacter Ibreve ibreve
-\defineULcharacter Obreve obreve
-\defineULcharacter Ubreve ubreve
-
-\defineULcharacter Ccaron ccaron
-\defineULcharacter Dcaron dcaron
-\defineULcharacter Ecaron ecaron
-\defineULcharacter Lcaron lcaron
-\defineULcharacter Ncaron ncaron
-\defineULcharacter Rcaron rcaron
-\defineULcharacter Scaron scaron
-\defineULcharacter Tcaron tcaron
-\defineULcharacter Zcaron zcaron
-
-\defineULcharacter dotlessI dotlessi
-\defineULcharacter dotlessJ dotlessj
-
-\defineULcharacter AEligature aeligature
-\defineULcharacter OEligature oeligature
-\defineULcharacter Ssharp ssharp
-\defineULcharacter IJligature ijligature
-
-\defineULcharacter Eth eth
-\defineULcharacter Thorn thorn
-
-\endinput
diff --git a/tex/context/base/enco-chi.mkii b/tex/context/base/enco-chi.mkii
new file mode 100644
index 000000000..9d77893a0
--- /dev/null
+++ b/tex/context/base/enco-chi.mkii
@@ -0,0 +1,371 @@
+%D \module
+%D [ file=enco-chi,
+%D version=1999.12.02,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Traditional and Simplified Chinese,
+%D author={Wang Lei \& Hans Hagen},
+%D date=\currentdate,
+%D copyright=Hans Hagen]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% actually this is also a filter -> enco-fcn.tex
+
+%D This is an experimental definition. Since we are dealing
+%D with unicode's, the registered values are not saved, so
+%D actually we're dealing with an pseudo encoding. The digits
+%D on the other hand are encoding specific.
+
+% chinese classes: left=1|right=2|center=3
+
+% untested, probably wrong
+
+\startencoding[cjk-uni]
+
+\defineuclass 1 32 24
+\defineuclass 1 32 28
+\defineuclass 1 48 20
+\defineuclass 1 48 8
+\defineuclass 1 48 10
+\defineuclass 1 48 12
+\defineuclass 1 48 14
+\defineuclass 1 48 22
+\defineuclass 1 48 16
+\defineuclass 1 255 8
+\defineuclass 1 255 59
+\defineuclass 1 255 64
+\defineuclass 1 255 91
+
+\defineuclass 3 0 183
+\defineuclass 3 0 168
+\defineuclass 3 32 38
+\defineuclass 3 255 30
+
+\defineuclass 2 48 1
+\defineuclass 2 48 2
+\defineuclass 2 32 20
+\defineuclass 2 255 94
+\defineuclass 2 32 25
+\defineuclass 2 32 29
+\defineuclass 2 48 21
+\defineuclass 2 48 9
+\defineuclass 2 48 11
+\defineuclass 2 48 13
+\defineuclass 2 48 15
+\defineuclass 2 48 23
+\defineuclass 2 48 17
+\defineuclass 2 34 55
+\defineuclass 2 0 176
+\defineuclass 2 32 50
+\defineuclass 2 32 51
+\defineuclass 2 255 1
+\defineuclass 2 255 2
+\defineuclass 2 255 7
+\defineuclass 2 255 9
+\defineuclass 2 255 12
+\defineuclass 2 255 14
+\defineuclass 2 255 26
+\defineuclass 2 255 27
+\defineuclass 2 255 31
+\defineuclass 2 255 61
+\defineuclass 2 255 93
+
+\defineudigit 0 37 203
+\defineudigit 1 78 0
+\defineudigit 2 78 140
+\defineudigit 3 78 9
+\defineudigit 4 86 219
+\defineudigit 5 78 148
+\defineudigit 6 81 109
+\defineudigit 7 78 3
+\defineudigit 8 81 107
+\defineudigit 9 78 93
+\defineudigit 10 83 65
+\defineudigit 100 118 126
+\defineudigit 1000 83 67
+\defineudigit 10000 78 7
+\defineudigit 100000000 78 191
+
+\defineudigit 0* 150 246
+\defineudigit 1* 88 249
+\defineudigit 2* 141 48
+\defineudigit 3* 83 193
+\defineudigit 4* 128 134
+\defineudigit 5* 79 13
+\defineudigit 6* 150 70
+\defineudigit 7* 103 210
+\defineudigit 8* 99 76
+\defineudigit 9* 115 150
+\defineudigit 10* 98 254
+\defineudigit 100* 79 112
+\defineudigit 1000* 78 223
+\defineudigit 10000* 132 44
+\defineudigit 100000000* 78 191
+
+\defineudigit 20 94 255
+\defineudigit 21 78 0
+\defineudigit 22 78 140
+\defineudigit 23 78 9
+\defineudigit 24 86 219
+\defineudigit 25 78 148
+\defineudigit 26 81 109
+\defineudigit 27 78 3
+\defineudigit 28 81 107
+\defineudigit 29 78 93
+
+\defineudigit 30 83 69
+\defineudigit 31 78 0
+\defineudigit 32 78 140
+\defineudigit 33 78 9
+\defineudigit 34 86 219
+\defineudigit 35 78 148
+\defineudigit 36 81 109
+\defineudigit 37 78 3
+\defineudigit 38 81 107
+\defineudigit 39 78 93
+
+\stopencoding
+
+% \doif \currentregime {utf} \endinput
+
+\startencoding[big5]
+
+\defineuclass 1 161 93
+\defineuclass 1 161 95
+\defineuclass 1 161 97
+\defineuclass 1 161 99
+\defineuclass 1 161 101
+\defineuclass 1 161 103
+\defineuclass 1 161 105
+\defineuclass 1 161 107
+\defineuclass 1 161 111
+\defineuclass 1 161 111
+\defineuclass 1 161 113
+\defineuclass 1 161 115
+\defineuclass 1 161 117
+\defineuclass 1 161 119
+\defineuclass 1 161 121
+\defineuclass 1 161 123
+\defineuclass 1 161 125
+\defineuclass 1 161 161
+\defineuclass 1 161 163
+\defineuclass 1 161 165
+\defineuclass 1 161 167
+\defineuclass 1 161 169
+\defineuclass 1 161 171
+
+\defineuclass 3 161 69
+\defineuclass 3 161 75
+\defineuclass 3 161 76
+
+\defineuclass 2 161 65
+\defineuclass 2 161 66
+\defineuclass 2 161 67
+\defineuclass 2 161 68
+\defineuclass 2 161 70
+\defineuclass 2 161 71
+\defineuclass 2 161 72
+\defineuclass 2 161 73
+\defineuclass 2 161 74
+\defineuclass 2 161 77
+\defineuclass 2 161 78
+\defineuclass 2 161 79
+\defineuclass 2 161 80
+\defineuclass 2 161 81
+\defineuclass 2 161 82
+\defineuclass 2 161 83
+\defineuclass 2 161 84
+\defineuclass 2 161 88
+\defineuclass 2 161 94
+\defineuclass 2 161 96
+\defineuclass 2 161 98
+\defineuclass 2 161 100
+\defineuclass 2 161 102
+\defineuclass 2 161 104
+\defineuclass 2 161 106
+\defineuclass 2 161 108
+\defineuclass 2 161 110
+\defineuclass 2 161 112
+\defineuclass 2 161 114
+\defineuclass 2 161 116
+\defineuclass 2 161 118
+\defineuclass 2 161 120
+\defineuclass 2 161 122
+\defineuclass 2 161 124
+\defineuclass 2 161 126
+\defineuclass 2 161 162
+\defineuclass 2 161 164
+\defineuclass 2 161 166
+\defineuclass 2 161 168
+\defineuclass 2 161 170
+\defineuclass 2 161 172
+\defineuclass 2 161 196
+\defineuclass 2 161 227
+\defineuclass 2 162 88
+\defineuclass 2 163 223
+
+\defineudigit 0 162 179
+\defineudigit 1 164 64
+\defineudigit 2 164 71
+\defineudigit 3 164 84
+\defineudigit 4 165 124
+\defineudigit 5 164 173
+\defineudigit 6 164 187
+\defineudigit 7 164 67
+\defineudigit 8 164 75
+\defineudigit 9 164 69
+\defineudigit 10 164 81
+\defineudigit 100 166 202
+\defineudigit 1000 164 100
+\defineudigit 10000 201 69
+\defineudigit 100000000 187 245
+
+\defineudigit 0* 185 115
+\defineudigit 1* 179 252
+\defineudigit 2* 182 76
+\defineudigit 3* 176 209
+\defineudigit 4* 184 118
+\defineudigit 5* 165 238
+\defineudigit 6* 179 176
+\defineudigit 7* 172 110
+\defineudigit 8* 174 195
+\defineudigit 9* 168 104
+\defineudigit 10* 172 66
+\defineudigit 100* 168 213
+\defineudigit 1000* 165 97
+\defineudigit 10000* 184 85
+\defineudigit 100000000* 187 245
+
+\defineudigit 20 164 220
+\defineudigit 21 164 64
+\defineudigit 22 164 71
+\defineudigit 23 164 84
+\defineudigit 24 165 124
+\defineudigit 25 164 173
+\defineudigit 26 164 187
+\defineudigit 27 164 67
+\defineudigit 28 164 75
+\defineudigit 29 164 69
+
+\defineudigit 30 164 202
+\defineudigit 31 164 64
+\defineudigit 32 164 71
+\defineudigit 33 164 84
+\defineudigit 34 165 124
+\defineudigit 35 164 173
+\defineudigit 36 164 187
+\defineudigit 37 164 67
+\defineudigit 38 164 75
+\defineudigit 39 164 69
+
+\stopencoding
+
+\startencoding[gbk]
+
+\defineuclass 1 161 174
+\defineuclass 1 161 176
+\defineuclass 1 161 178
+\defineuclass 1 161 180
+\defineuclass 1 161 182
+\defineuclass 1 161 184
+\defineuclass 1 161 186
+\defineuclass 1 161 188
+\defineuclass 1 161 190
+\defineuclass 1 163 168
+\defineuclass 1 163 219
+\defineuclass 1 163 224
+\defineuclass 1 163 251
+
+\defineuclass 3 161 164
+\defineuclass 3 161 167
+\defineuclass 3 161 173
+\defineuclass 3 163 190
+
+\defineuclass 2 161 162
+\defineuclass 2 161 163
+\defineuclass 2 161 170
+\defineuclass 2 161 171
+\defineuclass 2 161 175
+\defineuclass 2 161 177
+\defineuclass 2 161 179
+\defineuclass 2 161 181
+\defineuclass 2 161 183
+\defineuclass 2 161 185
+\defineuclass 2 161 187
+\defineuclass 2 161 189
+\defineuclass 2 161 191
+\defineuclass 2 161 203
+\defineuclass 2 161 227
+\defineuclass 2 161 228
+\defineuclass 2 161 229
+\defineuclass 2 163 161
+\defineuclass 2 163 162
+\defineuclass 2 163 167
+\defineuclass 2 163 169
+\defineuclass 2 163 172
+\defineuclass 2 163 174
+\defineuclass 2 163 186
+\defineuclass 2 163 187
+\defineuclass 2 163 191
+\defineuclass 2 163 221
+\defineuclass 2 163 253
+
+\defineudigit 0 161 240
+\defineudigit 1 210 187
+\defineudigit 2 182 254
+\defineudigit 3 200 253
+\defineudigit 4 203 196
+\defineudigit 5 206 229
+\defineudigit 6 193 249
+\defineudigit 7 198 223
+\defineudigit 8 176 203
+\defineudigit 9 190 197
+\defineudigit 10 202 174
+\defineudigit 100 176 217
+\defineudigit 1000 199 167
+\defineudigit 10000 205 242
+\defineudigit 100000000 210 218
+
+\defineudigit 0* 193 227
+\defineudigit 1* 210 188
+\defineudigit 2* 183 161
+\defineudigit 3* 200 254
+\defineudigit 4* 203 193
+\defineudigit 5* 206 233
+\defineudigit 6* 194 189
+\defineudigit 7* 198 226
+\defineudigit 8* 176 198
+\defineudigit 9* 190 193
+\defineudigit 10* 202 176
+\defineudigit 100* 176 219
+\defineudigit 1000* 199 170
+\defineudigit 10000* 200 102
+\defineudigit 100000000* 210 218
+
+\defineudigit 20 216 165
+\defineudigit 21 210 187
+\defineudigit 22 182 254
+\defineudigit 23 200 253
+\defineudigit 24 203 196
+\defineudigit 25 206 229
+\defineudigit 26 193 249
+\defineudigit 27 198 223
+\defineudigit 28 176 203
+\defineudigit 29 190 197
+
+\defineudigit 30 216 166
+\defineudigit 31 210 187
+\defineudigit 32 182 254
+\defineudigit 33 200 253
+\defineudigit 34 203 196
+\defineudigit 35 206 229
+\defineudigit 36 193 249
+\defineudigit 37 198 223
+\defineudigit 38 176 203
+\defineudigit 39 190 197
+
+\stopencoding
+
+\endinput
diff --git a/tex/context/base/enco-chi.tex b/tex/context/base/enco-chi.tex
deleted file mode 100644
index 9d77893a0..000000000
--- a/tex/context/base/enco-chi.tex
+++ /dev/null
@@ -1,371 +0,0 @@
-%D \module
-%D [ file=enco-chi,
-%D version=1999.12.02,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Traditional and Simplified Chinese,
-%D author={Wang Lei \& Hans Hagen},
-%D date=\currentdate,
-%D copyright=Hans Hagen]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-% actually this is also a filter -> enco-fcn.tex
-
-%D This is an experimental definition. Since we are dealing
-%D with unicode's, the registered values are not saved, so
-%D actually we're dealing with an pseudo encoding. The digits
-%D on the other hand are encoding specific.
-
-% chinese classes: left=1|right=2|center=3
-
-% untested, probably wrong
-
-\startencoding[cjk-uni]
-
-\defineuclass 1 32 24
-\defineuclass 1 32 28
-\defineuclass 1 48 20
-\defineuclass 1 48 8
-\defineuclass 1 48 10
-\defineuclass 1 48 12
-\defineuclass 1 48 14
-\defineuclass 1 48 22
-\defineuclass 1 48 16
-\defineuclass 1 255 8
-\defineuclass 1 255 59
-\defineuclass 1 255 64
-\defineuclass 1 255 91
-
-\defineuclass 3 0 183
-\defineuclass 3 0 168
-\defineuclass 3 32 38
-\defineuclass 3 255 30
-
-\defineuclass 2 48 1
-\defineuclass 2 48 2
-\defineuclass 2 32 20
-\defineuclass 2 255 94
-\defineuclass 2 32 25
-\defineuclass 2 32 29
-\defineuclass 2 48 21
-\defineuclass 2 48 9
-\defineuclass 2 48 11
-\defineuclass 2 48 13
-\defineuclass 2 48 15
-\defineuclass 2 48 23
-\defineuclass 2 48 17
-\defineuclass 2 34 55
-\defineuclass 2 0 176
-\defineuclass 2 32 50
-\defineuclass 2 32 51
-\defineuclass 2 255 1
-\defineuclass 2 255 2
-\defineuclass 2 255 7
-\defineuclass 2 255 9
-\defineuclass 2 255 12
-\defineuclass 2 255 14
-\defineuclass 2 255 26
-\defineuclass 2 255 27
-\defineuclass 2 255 31
-\defineuclass 2 255 61
-\defineuclass 2 255 93
-
-\defineudigit 0 37 203
-\defineudigit 1 78 0
-\defineudigit 2 78 140
-\defineudigit 3 78 9
-\defineudigit 4 86 219
-\defineudigit 5 78 148
-\defineudigit 6 81 109
-\defineudigit 7 78 3
-\defineudigit 8 81 107
-\defineudigit 9 78 93
-\defineudigit 10 83 65
-\defineudigit 100 118 126
-\defineudigit 1000 83 67
-\defineudigit 10000 78 7
-\defineudigit 100000000 78 191
-
-\defineudigit 0* 150 246
-\defineudigit 1* 88 249
-\defineudigit 2* 141 48
-\defineudigit 3* 83 193
-\defineudigit 4* 128 134
-\defineudigit 5* 79 13
-\defineudigit 6* 150 70
-\defineudigit 7* 103 210
-\defineudigit 8* 99 76
-\defineudigit 9* 115 150
-\defineudigit 10* 98 254
-\defineudigit 100* 79 112
-\defineudigit 1000* 78 223
-\defineudigit 10000* 132 44
-\defineudigit 100000000* 78 191
-
-\defineudigit 20 94 255
-\defineudigit 21 78 0
-\defineudigit 22 78 140
-\defineudigit 23 78 9
-\defineudigit 24 86 219
-\defineudigit 25 78 148
-\defineudigit 26 81 109
-\defineudigit 27 78 3
-\defineudigit 28 81 107
-\defineudigit 29 78 93
-
-\defineudigit 30 83 69
-\defineudigit 31 78 0
-\defineudigit 32 78 140
-\defineudigit 33 78 9
-\defineudigit 34 86 219
-\defineudigit 35 78 148
-\defineudigit 36 81 109
-\defineudigit 37 78 3
-\defineudigit 38 81 107
-\defineudigit 39 78 93
-
-\stopencoding
-
-% \doif \currentregime {utf} \endinput
-
-\startencoding[big5]
-
-\defineuclass 1 161 93
-\defineuclass 1 161 95
-\defineuclass 1 161 97
-\defineuclass 1 161 99
-\defineuclass 1 161 101
-\defineuclass 1 161 103
-\defineuclass 1 161 105
-\defineuclass 1 161 107
-\defineuclass 1 161 111
-\defineuclass 1 161 111
-\defineuclass 1 161 113
-\defineuclass 1 161 115
-\defineuclass 1 161 117
-\defineuclass 1 161 119
-\defineuclass 1 161 121
-\defineuclass 1 161 123
-\defineuclass 1 161 125
-\defineuclass 1 161 161
-\defineuclass 1 161 163
-\defineuclass 1 161 165
-\defineuclass 1 161 167
-\defineuclass 1 161 169
-\defineuclass 1 161 171
-
-\defineuclass 3 161 69
-\defineuclass 3 161 75
-\defineuclass 3 161 76
-
-\defineuclass 2 161 65
-\defineuclass 2 161 66
-\defineuclass 2 161 67
-\defineuclass 2 161 68
-\defineuclass 2 161 70
-\defineuclass 2 161 71
-\defineuclass 2 161 72
-\defineuclass 2 161 73
-\defineuclass 2 161 74
-\defineuclass 2 161 77
-\defineuclass 2 161 78
-\defineuclass 2 161 79
-\defineuclass 2 161 80
-\defineuclass 2 161 81
-\defineuclass 2 161 82
-\defineuclass 2 161 83
-\defineuclass 2 161 84
-\defineuclass 2 161 88
-\defineuclass 2 161 94
-\defineuclass 2 161 96
-\defineuclass 2 161 98
-\defineuclass 2 161 100
-\defineuclass 2 161 102
-\defineuclass 2 161 104
-\defineuclass 2 161 106
-\defineuclass 2 161 108
-\defineuclass 2 161 110
-\defineuclass 2 161 112
-\defineuclass 2 161 114
-\defineuclass 2 161 116
-\defineuclass 2 161 118
-\defineuclass 2 161 120
-\defineuclass 2 161 122
-\defineuclass 2 161 124
-\defineuclass 2 161 126
-\defineuclass 2 161 162
-\defineuclass 2 161 164
-\defineuclass 2 161 166
-\defineuclass 2 161 168
-\defineuclass 2 161 170
-\defineuclass 2 161 172
-\defineuclass 2 161 196
-\defineuclass 2 161 227
-\defineuclass 2 162 88
-\defineuclass 2 163 223
-
-\defineudigit 0 162 179
-\defineudigit 1 164 64
-\defineudigit 2 164 71
-\defineudigit 3 164 84
-\defineudigit 4 165 124
-\defineudigit 5 164 173
-\defineudigit 6 164 187
-\defineudigit 7 164 67
-\defineudigit 8 164 75
-\defineudigit 9 164 69
-\defineudigit 10 164 81
-\defineudigit 100 166 202
-\defineudigit 1000 164 100
-\defineudigit 10000 201 69
-\defineudigit 100000000 187 245
-
-\defineudigit 0* 185 115
-\defineudigit 1* 179 252
-\defineudigit 2* 182 76
-\defineudigit 3* 176 209
-\defineudigit 4* 184 118
-\defineudigit 5* 165 238
-\defineudigit 6* 179 176
-\defineudigit 7* 172 110
-\defineudigit 8* 174 195
-\defineudigit 9* 168 104
-\defineudigit 10* 172 66
-\defineudigit 100* 168 213
-\defineudigit 1000* 165 97
-\defineudigit 10000* 184 85
-\defineudigit 100000000* 187 245
-
-\defineudigit 20 164 220
-\defineudigit 21 164 64
-\defineudigit 22 164 71
-\defineudigit 23 164 84
-\defineudigit 24 165 124
-\defineudigit 25 164 173
-\defineudigit 26 164 187
-\defineudigit 27 164 67
-\defineudigit 28 164 75
-\defineudigit 29 164 69
-
-\defineudigit 30 164 202
-\defineudigit 31 164 64
-\defineudigit 32 164 71
-\defineudigit 33 164 84
-\defineudigit 34 165 124
-\defineudigit 35 164 173
-\defineudigit 36 164 187
-\defineudigit 37 164 67
-\defineudigit 38 164 75
-\defineudigit 39 164 69
-
-\stopencoding
-
-\startencoding[gbk]
-
-\defineuclass 1 161 174
-\defineuclass 1 161 176
-\defineuclass 1 161 178
-\defineuclass 1 161 180
-\defineuclass 1 161 182
-\defineuclass 1 161 184
-\defineuclass 1 161 186
-\defineuclass 1 161 188
-\defineuclass 1 161 190
-\defineuclass 1 163 168
-\defineuclass 1 163 219
-\defineuclass 1 163 224
-\defineuclass 1 163 251
-
-\defineuclass 3 161 164
-\defineuclass 3 161 167
-\defineuclass 3 161 173
-\defineuclass 3 163 190
-
-\defineuclass 2 161 162
-\defineuclass 2 161 163
-\defineuclass 2 161 170
-\defineuclass 2 161 171
-\defineuclass 2 161 175
-\defineuclass 2 161 177
-\defineuclass 2 161 179
-\defineuclass 2 161 181
-\defineuclass 2 161 183
-\defineuclass 2 161 185
-\defineuclass 2 161 187
-\defineuclass 2 161 189
-\defineuclass 2 161 191
-\defineuclass 2 161 203
-\defineuclass 2 161 227
-\defineuclass 2 161 228
-\defineuclass 2 161 229
-\defineuclass 2 163 161
-\defineuclass 2 163 162
-\defineuclass 2 163 167
-\defineuclass 2 163 169
-\defineuclass 2 163 172
-\defineuclass 2 163 174
-\defineuclass 2 163 186
-\defineuclass 2 163 187
-\defineuclass 2 163 191
-\defineuclass 2 163 221
-\defineuclass 2 163 253
-
-\defineudigit 0 161 240
-\defineudigit 1 210 187
-\defineudigit 2 182 254
-\defineudigit 3 200 253
-\defineudigit 4 203 196
-\defineudigit 5 206 229
-\defineudigit 6 193 249
-\defineudigit 7 198 223
-\defineudigit 8 176 203
-\defineudigit 9 190 197
-\defineudigit 10 202 174
-\defineudigit 100 176 217
-\defineudigit 1000 199 167
-\defineudigit 10000 205 242
-\defineudigit 100000000 210 218
-
-\defineudigit 0* 193 227
-\defineudigit 1* 210 188
-\defineudigit 2* 183 161
-\defineudigit 3* 200 254
-\defineudigit 4* 203 193
-\defineudigit 5* 206 233
-\defineudigit 6* 194 189
-\defineudigit 7* 198 226
-\defineudigit 8* 176 198
-\defineudigit 9* 190 193
-\defineudigit 10* 202 176
-\defineudigit 100* 176 219
-\defineudigit 1000* 199 170
-\defineudigit 10000* 200 102
-\defineudigit 100000000* 210 218
-
-\defineudigit 20 216 165
-\defineudigit 21 210 187
-\defineudigit 22 182 254
-\defineudigit 23 200 253
-\defineudigit 24 203 196
-\defineudigit 25 206 229
-\defineudigit 26 193 249
-\defineudigit 27 198 223
-\defineudigit 28 176 203
-\defineudigit 29 190 197
-
-\defineudigit 30 216 166
-\defineudigit 31 210 187
-\defineudigit 32 182 254
-\defineudigit 33 200 253
-\defineudigit 34 203 196
-\defineudigit 35 206 229
-\defineudigit 36 193 249
-\defineudigit 37 198 223
-\defineudigit 38 176 203
-\defineudigit 39 190 197
-
-\stopencoding
-
-\endinput
diff --git a/tex/context/base/enco-com.mkii b/tex/context/base/enco-com.mkii
new file mode 100644
index 000000000..42d0d4774
--- /dev/null
+++ b/tex/context/base/enco-com.mkii
@@ -0,0 +1,37 @@
+%D \module
+%D [ file=enco-com,
+%D version=2000.20.12, % split from base file
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Composed Characters Commands,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=Hans Hagen \& Ton Otten]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D Here we map some \quote {short} names onto the more
+%D verbose glyph names.
+
+\def\AA{\Aring}
+\def\aa{\aring}
+\def\AE{\AEligature}
+\def\ae{\aeligature}
+\def\CC{\Ccedilla}
+\def\cc{\ccedilla}
+\def \L{\Lstroke}
+\def \l{\lstroke}
+\def \O{\Ostroke}
+\def \o{\ostroke}
+\def\OE{\OEligature}
+\def\oe{\oeligature}
+\def\SZ{\Ssharp}
+\def\sz{\ssharp}
+\def\SS{\ssharp}
+\def\IJ{\IJligature}
+\def\ij{\ijligature}
+\def \i{\dotlessi}
+\def \j{\dotlessj}
+
+\endinput
diff --git a/tex/context/base/enco-com.tex b/tex/context/base/enco-com.tex
deleted file mode 100644
index 42d0d4774..000000000
--- a/tex/context/base/enco-com.tex
+++ /dev/null
@@ -1,37 +0,0 @@
-%D \module
-%D [ file=enco-com,
-%D version=2000.20.12, % split from base file
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Composed Characters Commands,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=Hans Hagen \& Ton Otten]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D Here we map some \quote {short} names onto the more
-%D verbose glyph names.
-
-\def\AA{\Aring}
-\def\aa{\aring}
-\def\AE{\AEligature}
-\def\ae{\aeligature}
-\def\CC{\Ccedilla}
-\def\cc{\ccedilla}
-\def \L{\Lstroke}
-\def \l{\lstroke}
-\def \O{\Ostroke}
-\def \o{\ostroke}
-\def\OE{\OEligature}
-\def\oe{\oeligature}
-\def\SZ{\Ssharp}
-\def\sz{\ssharp}
-\def\SS{\ssharp}
-\def\IJ{\IJligature}
-\def\ij{\ijligature}
-\def \i{\dotlessi}
-\def \j{\dotlessj}
-
-\endinput
diff --git a/tex/context/base/enco-cyr.mkii b/tex/context/base/enco-cyr.mkii
new file mode 100644
index 000000000..36bca82b5
--- /dev/null
+++ b/tex/context/base/enco-cyr.mkii
@@ -0,0 +1,1037 @@
+%D \module
+%D [ file=enco-cyr,
+%D version=2003.01.24,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Cyrillic,
+%D author=...,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D The following kerning test is inspired by a test file
+%D provided by Victor Figurnov. I hope he still recognizes
+%D some bit and pieces.
+%D
+%D \starttyping
+%D \setupoutput[pdftex]
+%D
+%D \startMPenvironment[global]
+%D \useregime[cyr]
+%D \useencoding[cyr]
+%D \mainlanguage[ru]
+%D \enableregime[cp1251]
+%D \setupbodyfont[cyr]
+%D \stopMPenvironment
+%D
+%D \startbuffer
+%D \starttabulate[|l|l|l|]
+%D \NC \ruledhbox{} \NC \ruledhbox{AV} \NC with kerning \NC \NR
+%D \NC \ruledhbox{{}{}} \NC \ruledhbox{A{}V} \NC without kerning \NC \NR
+%D \NC \ruledhbox{\tfd } \NC \ruledhbox{\tfd AV} \NC with kerning \NC \NR
+%D \NC \ruledhbox{\tfd {}{}} \NC \ruledhbox{\tfd A{}V} \NC without kerning \NC \NR
+%D \stoptabulate
+%D
+%D \showkerning{ }
+%D \stopbuffer
+%D
+%D \starttext
+%D
+%D \title{Kerning test}
+%D
+%D \typebuffer
+%D
+%D \rm \subject{Serif font} \getbuffer
+%D \ss \subject{SansSerif font} \getbuffer
+%D \tt \subject{MonoSpacec font} \getbuffer
+%D
+%D \stoptext
+%D \stoptyping
+
+%D We start with a fallback, define by HH, who assumes that
+%D this is phonetic.
+
+\startmapping[t2a]
+
+\resetcaserange 128 to 255
+
+\definecasemaps 192 to 223 lc +32 uc 0 % base letters (russian)
+\definecasemaps 224 to 255 lc 0 uc -32
+
+\definecasemaps 128 to 156 lc +32 uc 0 % extra letters (cyrillic and old-slav)
+\definecasemaps 160 to 188 lc 0 uc -32
+
+\definecasemap 73 105 73 \definecasemap 105 105 73 % cyrillicII
+\definecasemap 74 106 74 \definecasemap 106 106 74 % cyrillicJE
+\definecasemap 81 113 81 \definecasemap 113 113 81 % cyrillicQ
+\definecasemap 87 119 87 \definecasemap 119 119 87 % cyrillicW
+
+\stopmapping
+
+\startencoding[t2a]
+
+\definecharacter textgrave 0
+\definecharacter textacute 1
+\definecharacter textcircumflex 2
+\definecharacter texttilde 3
+\definecharacter textdiaeresis 4
+\definecharacter texthungarumlaut 5
+\definecharacter textring 6
+\definecharacter textcaron 7
+\definecharacter textbreve 8
+\definecharacter textmacron 9
+\definecharacter textdotaccent 10
+\definecharacter textcedilla 11
+\definecharacter textogonek 12
+
+\definecharacter textcyrillicflex 18
+\definecharacter textdblgrave 19
+\definecharacter textcyrillicbreve 20
+
+\definecharacter endash 21
+\definecharacter emdash 22
+
+\definecharacter textcompwordmark 23
+\definecharacter textbackslash 92
+\definecharacter textasciicircum 94
+\definecharacter textunderscore 95
+\definecharacter textbraceleft 123
+\definecharacter textbraceright 125
+\definecharacter textasciitilde 126
+\definecharacter textnumero 157
+\definecharacter textcurrency 158
+\definecharacter sectionmark 159
+
+\definecharacter quotedbl 34
+\definecharacter quoteleft 96
+\definecharacter upperleftsingleninequote 39
+\definecharacter quotedblleft 16
+\definecharacter quotedblright 17
+\definecharacter lowerleftdoubleninequote 189
+\definecharacter upperrightdoublesixquote 16
+\definecharacter upperrightdoubleninequote 17
+\definecharacter quotedblbase 189
+
+\definecharacter cyrillicpalochka 13
+\definecharacter cyrilliclangle 14
+\definecharacter cyrillicrangle 15
+
+\definecharacter leftguillemot 190
+\definecharacter rightguillemot 191
+\definecharacter dotlessi 25
+
+\definecharacter cyrillicA 192
+\definecharacter cyrillica 224
+\definecharacter cyrillicB 193
+\definecharacter cyrillicb 225
+\definecharacter cyrillicV 194
+\definecharacter cyrillicv 226
+\definecharacter cyrillicG 195
+\definecharacter cyrillicg 227
+\definecharacter cyrillicD 196
+\definecharacter cyrillicd 228
+\definecharacter cyrillicE 197
+\definecharacter cyrillice 229
+\definecharacter cyrillicZH 198
+\definecharacter cyrilliczh 230
+\definecharacter cyrillicZ 199
+\definecharacter cyrillicz 231
+\definecharacter cyrillicI 200
+\definecharacter cyrillici 232
+\definecharacter cyrillicISHRT 201
+\definecharacter cyrillicishrt 233
+\definecharacter cyrillicK 202
+\definecharacter cyrillick 234
+\definecharacter cyrillicL 203
+\definecharacter cyrillicl 235
+\definecharacter cyrillicM 204
+\definecharacter cyrillicm 236
+\definecharacter cyrillicN 205
+\definecharacter cyrillicn 237
+\definecharacter cyrillicO 206
+\definecharacter cyrillico 238
+\definecharacter cyrillicP 207
+\definecharacter cyrillicp 239
+\definecharacter cyrillicR 208
+\definecharacter cyrillicr 240
+\definecharacter cyrillicS 209
+\definecharacter cyrillics 241
+\definecharacter cyrillicT 210
+\definecharacter cyrillict 242
+\definecharacter cyrillicU 211
+\definecharacter cyrillicu 243
+\definecharacter cyrillicF 212
+\definecharacter cyrillicf 244
+\definecharacter cyrillicH 213
+\definecharacter cyrillich 245
+\definecharacter cyrillicC 214
+\definecharacter cyrillicc 246
+\definecharacter cyrillicCH 215
+\definecharacter cyrillicch 247
+\definecharacter cyrillicSH 216
+\definecharacter cyrillicsh 248
+\definecharacter cyrillicSHCH 217
+\definecharacter cyrillicshch 249
+\definecharacter cyrillicHRDSN 218
+\definecharacter cyrillichrdsn 250
+\definecharacter cyrillicERY 219
+\definecharacter cyrillicery 251
+\definecharacter cyrillicSFTSN 220
+\definecharacter cyrillicsftsn 252
+\definecharacter cyrillicEREV 221
+\definecharacter cyrillicerev 253
+\definecharacter cyrillicYU 222
+\definecharacter cyrillicyu 254
+\definecharacter cyrillicYA 223
+\definecharacter cyrillicya 255
+\definecharacter cyrillicGUP 128
+\definecharacter cyrillicgup 160
+\definecharacter cyrillicGHCRS 129
+\definecharacter cyrillicghcrs 161
+\definecharacter cyrillicDJE 130
+\definecharacter cyrillicdje 162
+\definecharacter cyrillicTSHE 131
+\definecharacter cyrillictshe 163
+\definecharacter cyrillicSHHA 132
+\definecharacter cyrillicshha 164
+\definecharacter cyrillicZHDSC 133
+\definecharacter cyrilliczhdsc 165
+\definecharacter cyrillicZDSC 134
+\definecharacter cyrilliczdsc 166
+\definecharacter cyrillicLJE 135
+\definecharacter cyrilliclje 167
+\definecharacter cyrillicYI 136
+\definecharacter cyrillicyi 168
+\definecharacter cyrillicKDSC 137
+\definecharacter cyrillickdsc 169
+\definecharacter cyrillicKBEAK 138
+\definecharacter cyrillickbeak 170
+\definecharacter cyrillicKVCRS 139
+\definecharacter cyrillickvcrs 171
+\definecharacter cyrillicAE 140
+\definecharacter cyrillicae 172
+\definecharacter cyrillicNDSC 141
+\definecharacter cyrillicndsc 173
+\definecharacter cyrillicNG 142
+\definecharacter cyrillicng 174
+\definecharacter cyrillicDZE 143
+\definecharacter cyrillicdze 175
+\definecharacter cyrillicOTLD 144
+\definecharacter cyrillicotld 176
+\definecharacter cyrillicSDSC 145
+\definecharacter cyrillicsdsc 177
+\definecharacter cyrillicUSHRT 146
+\definecharacter cyrillicushrt 178
+\definecharacter cyrillicY 147
+\definecharacter cyrillicy 179
+\definecharacter cyrillicYHCRS 148
+\definecharacter cyrillicyhcrs 180
+\definecharacter cyrillicHDSC 149
+\definecharacter cyrillichdsc 181
+\definecharacter cyrillicDZHE 150
+\definecharacter cyrillicdzhe 182
+\definecharacter cyrillicCHVCRS 151
+\definecharacter cyrillicchvcrs 183
+\definecharacter cyrillicCHRDSC 152
+\definecharacter cyrillicchrdsc 184
+\definecharacter cyrillicIE 153
+\definecharacter cyrillicie 185
+\definecharacter cyrillicSCHWA 154
+\definecharacter cyrillicschwa 186
+\definecharacter cyrillicNJE 155
+\definecharacter cyrillicnje 187
+\definecharacter cyrillicYO 156
+\definecharacter cyrillicyo 188
+\definecharacter cyrillicII 73
+\definecharacter cyrillicii 105
+\definecharacter cyrillicJE 74
+\definecharacter cyrillicje 106
+\definecharacter cyrillicQ 81
+\definecharacter cyrillicq 113
+\definecharacter cyrillicW 87
+\definecharacter cyrillicw 119
+
+% \definecharacter textperthousand {\%\char 24 }
+% \definecharacter textpertenthousand {\%\char 24\char 24 }
+
+\definecharacter cyrillicgheupturn 160 % to satisfy the patterns
+
+\stopencoding
+
+\startmapping[t2b]
+
+\resetcaserange 128 to 255
+
+\definecasemaps 192 to 223 lc +32 uc 0 % base letters (russian)
+\definecasemaps 224 to 255 lc 0 uc -32
+
+\definecasemaps 128 to 156 lc +32 uc 0 % extra letters (cyrillic and old-slav)
+\definecasemaps 160 to 188 lc 0 uc -32
+
+\definecasemap 73 105 73 \definecasemap 105 105 73 % cyrillicII
+\definecasemap 74 106 74 \definecasemap 106 106 74 % cyrillicJE
+\definecasemap 81 113 81 \definecasemap 113 113 81 % cyrillicQ
+\definecasemap 83 115 83 \definecasemap 115 115 83 % cyrillicDZE
+\definecasemap 87 119 87 \definecasemap 119 119 87 % cyrillicW
+
+\stopmapping
+
+\startencoding[t2b]
+
+\definecharacter textgrave 0
+\definecharacter textacute 1
+\definecharacter textcircumflex 2
+\definecharacter texttilde 3
+\definecharacter textdiaeresis 4
+\definecharacter texthungarumlaut 5
+\definecharacter textring 6
+\definecharacter textcaron 7
+\definecharacter textbreve 8
+\definecharacter textmacron 9
+\definecharacter textdotaccent 10
+\definecharacter textcedilla 11
+\definecharacter textogonek 12
+
+\definecharacter textcyrillicflex 18
+\definecharacter textdblgrave 19
+\definecharacter textcyrillicbreve 20
+
+\definecharacter endash 21
+\definecharacter emdash 22
+
+\definecharacter textcompwordmark 23
+\definecharacter textbackslash 92
+\definecharacter textasciicircum 94
+\definecharacter textunderscore 95
+\definecharacter textbraceleft 123
+\definecharacter textbraceright 125
+\definecharacter textasciitilde 126
+\definecharacter textnumero 157
+\definecharacter textcurrency 158
+\definecharacter sectionmark 159
+\definecharacter quotedbl 34
+\definecharacter quoteleft 96
+\definecharacter upperleftsingleninequote 39
+\definecharacter quotedblleft 16
+\definecharacter quotedblright 17
+\definecharacter lowerleftdoubleninequote 189
+
+\definecharacter upperrightdoublesixquote 16
+\definecharacter upperrightdoubleninequote 17
+\definecharacter quotedblbase 189
+
+\definecharacter cyrillicpalochka 13
+\definecharacter cyrilliclangle 14
+\definecharacter cyrillicrangle 15
+
+\definecharacter leftguillemot 190
+\definecharacter rightguillemot 191
+\definecharacter dotlessi 25
+
+\definecharacter cyrillicA 192
+\definecharacter cyrillica 224
+\definecharacter cyrillicB 193
+\definecharacter cyrillicb 225
+\definecharacter cyrillicV 194
+\definecharacter cyrillicv 226
+\definecharacter cyrillicG 195
+\definecharacter cyrillicg 227
+\definecharacter cyrillicD 196
+\definecharacter cyrillicd 228
+\definecharacter cyrillicE 197
+\definecharacter cyrillice 229
+\definecharacter cyrillicZH 198
+\definecharacter cyrilliczh 230
+\definecharacter cyrillicZ 199
+\definecharacter cyrillicz 231
+\definecharacter cyrillicI 200
+\definecharacter cyrillici 232
+\definecharacter cyrillicISHRT 201
+\definecharacter cyrillicishrt 233
+\definecharacter cyrillicK 202
+\definecharacter cyrillick 234
+\definecharacter cyrillicL 203
+\definecharacter cyrillicl 235
+\definecharacter cyrillicM 204
+\definecharacter cyrillicm 236
+\definecharacter cyrillicN 205
+\definecharacter cyrillicn 237
+\definecharacter cyrillicO 206
+\definecharacter cyrillico 238
+\definecharacter cyrillicP 207
+\definecharacter cyrillicp 239
+\definecharacter cyrillicR 208
+\definecharacter cyrillicr 240
+\definecharacter cyrillicS 209
+\definecharacter cyrillics 241
+\definecharacter cyrillicT 210
+\definecharacter cyrillict 242
+\definecharacter cyrillicU 211
+\definecharacter cyrillicu 243
+\definecharacter cyrillicF 212
+\definecharacter cyrillicf 244
+\definecharacter cyrillicH 213
+\definecharacter cyrillich 245
+\definecharacter cyrillicC 214
+\definecharacter cyrillicc 246
+\definecharacter cyrillicCH 215
+\definecharacter cyrillicch 247
+\definecharacter cyrillicSH 216
+\definecharacter cyrillicsh 248
+\definecharacter cyrillicSHCH 217
+\definecharacter cyrillicshch 249
+\definecharacter cyrillicHRDSN 218
+\definecharacter cyrillichrdsn 250
+\definecharacter cyrillicERY 219
+\definecharacter cyrillicery 251
+\definecharacter cyrillicSFTSN 220
+\definecharacter cyrillicsftsn 252
+\definecharacter cyrillicEREV 221
+\definecharacter cyrillicerev 253
+\definecharacter cyrillicYU 222
+\definecharacter cyrillicyu 254
+\definecharacter cyrillicYA 223
+\definecharacter cyrillicya 255
+\definecharacter cyrillicGDSCHCRS 128
+\definecharacter cyrillicgdschcrs 160
+\definecharacter cyrillicGHCRS 129
+\definecharacter cyrillicghcrs 161
+\definecharacter cyrillicGDSC 130
+\definecharacter cyrillicgdsc 162
+\definecharacter cyrillicGHK 131
+\definecharacter cyrillicghk 163
+\definecharacter cyrillicSHHA 132
+\definecharacter cyrillicshha 164
+\definecharacter cyrillicZHDSC 133
+\definecharacter cyrilliczhdsc 165
+\definecharacter cyrillicDELTA 134
+\definecharacter cyrillicdelta 166
+\definecharacter cyrillicABHDZE 135
+\definecharacter cyrillicabhdze 167
+\definecharacter cyrillicLJE 136
+\definecharacter cyrilliclje 168
+\definecharacter cyrillicKDSC 137
+\definecharacter cyrillickdsc 169
+\definecharacter cyrillicLDSC 138
+\definecharacter cyrillicldsc 170
+\definecharacter cyrillicKHK 139
+\definecharacter cyrillickhk 171
+\definecharacter cyrillicLHK 140
+\definecharacter cyrilliclhk 172
+\definecharacter cyrillicNDSC 141
+\definecharacter cyrillicndsc 173
+\definecharacter cyrillicNG 142
+\definecharacter cyrillicng 174
+\definecharacter cyrillicNHK 143
+\definecharacter cyrillicnhk 175
+\definecharacter cyrillicOTLD 144
+\definecharacter cyrillicotld 176
+\definecharacter cyrillicSACRS 145
+\definecharacter cyrillicsacrs 177
+\definecharacter cyrillicUSHRT 146
+\definecharacter cyrillicushrt 178
+\definecharacter cyrillicY 147
+\definecharacter cyrillicy 179
+\definecharacter cyrillicHHCRS 148
+\definecharacter cyrillichhcrs 180
+\definecharacter cyrillicHDSC 149
+\definecharacter cyrillichdsc 181
+\definecharacter cyrillicHHK 150
+\definecharacter cyrillichhk 182
+\definecharacter cyrillicCHLDSC 151
+\definecharacter cyrillicchldsc 183
+\definecharacter cyrillicCHRDSC 152
+\definecharacter cyrillicchrdsc 184
+\definecharacter cyrillicNJE 153
+\definecharacter cyrillicnje 185
+\definecharacter cyrillicSCHWA 154
+\definecharacter cyrillicschwa 186
+\definecharacter cyrillicEPS 155
+\definecharacter cyrilliceps 187
+\definecharacter cyrillicYO 156
+\definecharacter cyrillicyo 188
+\definecharacter cyrillicII 73
+\definecharacter cyrillicii 105
+\definecharacter cyrillicJE 74
+\definecharacter cyrillicje 106
+\definecharacter cyrillicQ 81
+\definecharacter cyrillicq 113
+\definecharacter cyrillicDZE 83
+\definecharacter cyrillicdze 115
+\definecharacter cyrillicW 87
+\definecharacter cyrillicw 119
+
+\stopencoding
+
+\startmapping[t2c]
+
+\resetcaserange 128 to 255
+
+\definecasemaps 192 to 223 lc +32 uc 0 % base letters (russian)
+\definecasemaps 224 to 255 lc 0 uc -32
+
+\definecasemaps 128 to 156 lc +32 uc 0 % extra letters (cyrillic and old-slav)
+\definecasemaps 160 to 188 lc 0 uc -32
+
+\definecasemap 73 105 73 \definecasemap 105 105 73 % cyrillicII
+\definecasemap 74 106 74 \definecasemap 106 106 74 % cyrillicJE
+\definecasemap 81 113 81 \definecasemap 113 113 81 % cyrillicQ
+\definecasemap 83 115 83 \definecasemap 115 115 83 % cyrillicDZE
+\definecasemap 87 119 87 \definecasemap 119 119 87 % cyrillicW
+
+\stopmapping
+
+\startencoding[t2c]
+
+\definecharacter textgrave 0
+\definecharacter textacute 1
+\definecharacter textcircumflex 2
+\definecharacter texttilde 3
+\definecharacter textdiaeresis 4
+\definecharacter texthungarumlaut 5
+\definecharacter textring 6
+\definecharacter textcaron 7
+\definecharacter textbreve 8
+\definecharacter textmacron 9
+\definecharacter textdotaccent 10
+\definecharacter textcedilla 11
+\definecharacter textogonek 12
+
+\definecharacter textcyrillicflex 18
+\definecharacter textdblgrave 19
+\definecharacter textcyrillicbreve 20
+
+\definecharacter endash 21
+\definecharacter emdash 22
+
+\definecharacter textcompwordmark 23
+\definecharacter textbackslash 92
+\definecharacter textasciicircum 94
+\definecharacter textunderscore 95
+\definecharacter textbraceleft 123
+\definecharacter textbraceright 125
+\definecharacter textasciitilde 126
+\definecharacter textnumero 157
+\definecharacter textcurrency 158
+\definecharacter sectionmark 159
+\definecharacter quotedbl 34
+\definecharacter quoteleft 96
+\definecharacter upperleftsingleninequote 39
+\definecharacter quotedblleft 16
+\definecharacter quotedblright 17
+\definecharacter lowerleftdoubleninequote 189
+\definecharacter upperrightdoublesixquote 16
+\definecharacter upperrightdoubleninequote 17
+\definecharacter quotedblbase 189
+
+\definecharacter cyrillicpalochka 13
+\definecharacter cyrilliclangle 14
+\definecharacter cyrillicrangle 15
+
+\definecharacter leftguillemot 190
+\definecharacter rightguillemot 191
+
+\definecharacter dotlessi 25
+
+\definecharacter cyrillicA 192
+\definecharacter cyrillica 224
+\definecharacter cyrillicB 193
+\definecharacter cyrillicb 225
+\definecharacter cyrillicV 194
+\definecharacter cyrillicv 226
+\definecharacter cyrillicG 195
+\definecharacter cyrillicg 227
+\definecharacter cyrillicD 196
+\definecharacter cyrillicd 228
+\definecharacter cyrillicE 197
+\definecharacter cyrillice 229
+\definecharacter cyrillicZH 198
+\definecharacter cyrilliczh 230
+\definecharacter cyrillicZ 199
+\definecharacter cyrillicz 231
+\definecharacter cyrillicI 200
+\definecharacter cyrillici 232
+\definecharacter cyrillicISHRT 201
+\definecharacter cyrillicishrt 233
+\definecharacter cyrillicK 202
+\definecharacter cyrillick 234
+\definecharacter cyrillicL 203
+\definecharacter cyrillicl 235
+\definecharacter cyrillicM 204
+\definecharacter cyrillicm 236
+\definecharacter cyrillicN 205
+\definecharacter cyrillicn 237
+\definecharacter cyrillicO 206
+\definecharacter cyrillico 238
+\definecharacter cyrillicP 207
+\definecharacter cyrillicp 239
+\definecharacter cyrillicR 208
+\definecharacter cyrillicr 240
+\definecharacter cyrillicS 209
+\definecharacter cyrillics 241
+\definecharacter cyrillicT 210
+\definecharacter cyrillict 242
+\definecharacter cyrillicU 211
+\definecharacter cyrillicu 243
+\definecharacter cyrillicF 212
+\definecharacter cyrillicf 244
+\definecharacter cyrillicH 213
+\definecharacter cyrillich 245
+\definecharacter cyrillicC 214
+\definecharacter cyrillicc 246
+\definecharacter cyrillicCH 215
+\definecharacter cyrillicch 247
+\definecharacter cyrillicSH 216
+\definecharacter cyrillicsh 248
+\definecharacter cyrillicSHCH 217
+\definecharacter cyrillicshch 249
+\definecharacter cyrillicHRDSN 218
+\definecharacter cyrillichrdsn 250
+\definecharacter cyrillicERY 219
+\definecharacter cyrillicery 251
+\definecharacter cyrillicSFTSN 220
+\definecharacter cyrillicsftsn 252
+\definecharacter cyrillicEREV 221
+\definecharacter cyrillicerev 253
+\definecharacter cyrillicYU 222
+\definecharacter cyrillicyu 254
+\definecharacter cyrillicYA 223
+\definecharacter cyrillicya 255
+\definecharacter cyrillicPHK 128
+\definecharacter cyrillicphk 160
+\definecharacter cyrillicTETSE 129
+\definecharacter cyrillictetse 161
+\definecharacter cyrillicTDSC 130
+\definecharacter cyrillictdsc 162
+\definecharacter cyrillicGHK 131
+\definecharacter cyrillicghk 163
+\definecharacter cyrillicSHHA 132
+\definecharacter cyrillicshha 164
+\definecharacter cyrillicRDSC 133
+\definecharacter cyrillicrdsc 165
+\definecharacter cyrillicRTICK 134
+\definecharacter cyrillicrtick 166
+\definecharacter cyrillicABHDZE 135
+\definecharacter cyrillicabhdze 167
+\definecharacter cyrillicMDSC 136
+\definecharacter cyrillicmdsc 168
+\definecharacter cyrillicKDSC 137
+\definecharacter cyrillickdsc 169
+\definecharacter cyrillicLDSC 138
+\definecharacter cyrillicldsc 170
+\definecharacter cyrillicKHCRS 139
+\definecharacter cyrillickhcrs 171
+\definecharacter cyrillicLHK 140
+\definecharacter cyrilliclhk 172
+\definecharacter cyrillicNDSC 141
+\definecharacter cyrillicndsc 173
+\definecharacter cyrillicMHK 142
+\definecharacter cyrillicmhk 174
+\definecharacter cyrillicNHK 143
+\definecharacter cyrillicnhk 175
+\definecharacter cyrillicOTLD 144
+\definecharacter cyrillicotld 176
+\definecharacter cyrillicABHCH 145
+\definecharacter cyrillicabhch 177
+\definecharacter cyrillicABHCHDSC 146
+\definecharacter cyrillicabhchdsc 178
+\definecharacter cyrillicSEMISFTSN 147
+\definecharacter cyrillicsemisftsn 179
+\definecharacter cyrillicISHRTDSC 148
+\definecharacter cyrillicishrtdsc 180
+\definecharacter cyrillicHDSC 149
+\definecharacter cyrillichdsc 181
+\definecharacter cyrillicDZHE 150
+\definecharacter cyrillicdzhe 182
+\definecharacter cyrillicABHHA 151
+\definecharacter cyrillicabhha 183
+\definecharacter cyrillicCHRDSC 152
+\definecharacter cyrillicchrdsc 184
+\definecharacter cyrillicNLHK 153
+\definecharacter cyrillicnlhk 185
+\definecharacter cyrillicSCHWA 154
+\definecharacter cyrillicschwa 186
+\definecharacter cyrillicRHK 155
+\definecharacter cyrillicrhk 187
+\definecharacter cyrillicYO 156
+\definecharacter cyrillicyo 188
+\definecharacter cyrillicII 73
+\definecharacter cyrillicii 105
+\definecharacter cyrillicJE 74
+\definecharacter cyrillicje 106
+\definecharacter cyrillicQ 81
+\definecharacter cyrillicq 113
+\definecharacter cyrillicDZE 83
+\definecharacter cyrillicdze 115
+\definecharacter cyrillicW 87
+\definecharacter cyrillicw 119
+
+\stopencoding
+
+\startmapping[x2]
+
+\resetcaserange 128 to 255
+
+\definecasemaps 192 to 223 lc +32 uc 0 % base letters (russian)
+\definecasemaps 224 to 255 lc 0 uc -32
+
+\definecasemaps 128 to 156 lc +32 uc 0 % extra letters (cyrillic and old-slav)
+\definecasemaps 160 to 188 lc 0 uc -32
+
+\definecasemaps 65 to 90 lc +32 uc 0 % more extra letters (cyrillic and old-slav)
+\definecasemaps 97 to 122 lc 0 uc -32
+
+\definecasemap 28 29 28 \definecasemap 29 29 28 % cyrillicNLHK
+\definecasemap 30 31 30 \definecasemap 31 31 30 % cyrillicDELTA
+
+\stopmapping
+
+\startencoding[x2]
+
+\definecharacter textgrave 0
+\definecharacter textacute 1
+\definecharacter textcircumflex 2
+\definecharacter texttilde 3
+\definecharacter textdiaeresis 4
+\definecharacter texthungarumlaut 5
+\definecharacter textring 6
+\definecharacter textcaron 7
+\definecharacter textbreve 8
+\definecharacter textmacron 9
+\definecharacter textdotaccent 10
+\definecharacter textcedilla 11
+\definecharacter textogonek 12
+
+\definecharacter endash 21
+\definecharacter emdash 22
+
+\definecharacter textcompwordmark 23
+\definecharacter textvisiblespace 32
+\definecharacter textdollar 36
+\definecharacter textless 60
+\definecharacter textgreater 62
+\definecharacter textbackslash 92
+\definecharacter textasciicircum 94
+\definecharacter textunderscore 95
+\definecharacter textbraceleft 123
+\definecharacter textbar 124
+\definecharacter textbraceright 125
+\definecharacter textasciitilde 126
+\definecharacter textnumero 157
+\definecharacter textcurrency 158
+\definecharacter textsection 159
+\definecharacter sectionmark 159
+\definecharacter textquotedbl 34
+
+\definecharacter cyrillicpalochka 13
+\definecharacter cyrilliclangle 14
+\definecharacter cyrillicrangle 15
+
+\definecharacter leftguillemot 190
+\definecharacter rightguillemot 191
+
+\definecharacter upperleftsinglesixquote 96
+\definecharacter upperleftsingleninequote 39
+\definecharacter upperleftdoublesixquote 16
+\definecharacter upperleftdoubleninequote 17
+\definecharacter lowerleftdoubleninequote 189
+
+\definecharacter upperrightsinglesixquote 96
+\definecharacter upperrightsingleninequote 39
+\definecharacter upperrightdoublesixquote 16
+\definecharacter upperrightdoubleninequote 17
+\definecharacter lowerrightdoubleninequote 189
+
+\definecharacter cyrillicA 192
+\definecharacter cyrillica 224
+\definecharacter cyrillicB 193
+\definecharacter cyrillicb 225
+\definecharacter cyrillicV 194
+\definecharacter cyrillicv 226
+\definecharacter cyrillicG 195
+\definecharacter cyrillicg 227
+\definecharacter cyrillicD 196
+\definecharacter cyrillicd 228
+\definecharacter cyrillicE 197
+\definecharacter cyrillice 229
+\definecharacter cyrillicZH 198
+\definecharacter cyrilliczh 230
+\definecharacter cyrillicZ 199
+\definecharacter cyrillicz 231
+\definecharacter cyrillicI 200
+\definecharacter cyrillici 232
+\definecharacter cyrillicISHRT 201
+\definecharacter cyrillicishrt 233
+\definecharacter cyrillicK 202
+\definecharacter cyrillick 234
+\definecharacter cyrillicL 203
+\definecharacter cyrillicl 235
+\definecharacter cyrillicM 204
+\definecharacter cyrillicm 236
+\definecharacter cyrillicN 205
+\definecharacter cyrillicn 237
+\definecharacter cyrillicO 206
+\definecharacter cyrillico 238
+\definecharacter cyrillicP 207
+\definecharacter cyrillicp 239
+\definecharacter cyrillicR 208
+\definecharacter cyrillicr 240
+\definecharacter cyrillicS 209
+\definecharacter cyrillics 241
+\definecharacter cyrillicT 210
+\definecharacter cyrillict 242
+\definecharacter cyrillicU 211
+\definecharacter cyrillicu 243
+\definecharacter cyrillicF 212
+\definecharacter cyrillicf 244
+\definecharacter cyrillicH 213
+\definecharacter cyrillich 245
+\definecharacter cyrillicC 214
+\definecharacter cyrillicc 246
+\definecharacter cyrillicCH 215
+\definecharacter cyrillicch 247
+\definecharacter cyrillicSH 216
+\definecharacter cyrillicsh 248
+\definecharacter cyrillicSHCH 217
+\definecharacter cyrillicshch 249
+\definecharacter cyrillicHRDSN 218
+\definecharacter cyrillichrdsn 250
+\definecharacter cyrillicERY 219
+\definecharacter cyrillicery 251
+\definecharacter cyrillicSFTSN 220
+\definecharacter cyrillicsftsn 252
+\definecharacter cyrillicEREV 221
+\definecharacter cyrillicerev 253
+\definecharacter cyrillicYU 222
+\definecharacter cyrillicyu 254
+\definecharacter cyrillicYA 223
+\definecharacter cyrillicya 255
+\definecharacter cyrillicGUP 128
+\definecharacter cyrillicgup 160
+\definecharacter cyrillicGHCRS 129
+\definecharacter cyrillicghcrs 161
+\definecharacter cyrillicGDSC 130
+\definecharacter cyrillicgdsc 162
+\definecharacter cyrillicGHK 131
+\definecharacter cyrillicghk 163
+\definecharacter cyrillicSHHA 132
+\definecharacter cyrillicshha 164
+\definecharacter cyrillicZHDSC 133
+\definecharacter cyrilliczhdsc 165
+\definecharacter cyrillicZDSC 134
+\definecharacter cyrilliczdsc 166
+\definecharacter cyrillicABHDZE 135
+\definecharacter cyrillicabhdze 167
+\definecharacter cyrillicYI 136
+\definecharacter cyrillicyi 168
+\definecharacter cyrillicKDSC 137
+\definecharacter cyrillickdsc 169
+\definecharacter cyrillicKBEAK 138
+\definecharacter cyrillickbeak 170
+\definecharacter cyrillicKHK 139
+\definecharacter cyrillickhk 171
+\definecharacter cyrillicLHK 140
+\definecharacter cyrilliclhk 172
+\definecharacter cyrillicNDSC 141
+\definecharacter cyrillicndsc 173
+\definecharacter cyrillicNG 142
+\definecharacter cyrillicng 174
+\definecharacter cyrillicNHK 143
+\definecharacter cyrillicnhk 175
+\definecharacter cyrillicOTLD 144
+\definecharacter cyrillicotld 176
+\definecharacter cyrillicSDSC 145
+\definecharacter cyrillicsdsc 177
+\definecharacter cyrillicUSHRT 146
+\definecharacter cyrillicushrt 178
+\definecharacter cyrillicY 147
+\definecharacter cyrillicy 179
+\definecharacter cyrillicYHCRS 148
+\definecharacter cyrillicyhcrs 180
+\definecharacter cyrillicHDSC 149
+\definecharacter cyrillichdsc 181
+\definecharacter cyrillicHHK 150
+\definecharacter cyrillichhk 182
+\definecharacter cyrillicCHLDSC 151
+\definecharacter cyrillicchldsc 183
+\definecharacter cyrillicCHRDSC 152
+\definecharacter cyrillicchrdsc 184
+\definecharacter cyrillicIE 153
+\definecharacter cyrillicie 185
+\definecharacter cyrillicSCHWA 154
+\definecharacter cyrillicschwa 186
+\definecharacter cyrillicEPS 155
+\definecharacter cyrilliceps 187
+\definecharacter cyrillicYO 156
+\definecharacter cyrillicyo 188
+\definecharacter cyrillicAE 65
+\definecharacter cyrillicae 97
+\definecharacter cyrillicDJE 66
+\definecharacter cyrillicdje 98
+\definecharacter cyrillicTSHE 67
+\definecharacter cyrillictshe 99
+\definecharacter cyrillicABHCH 68
+\definecharacter cyrillicabhch 100
+\definecharacter cyrillicABHCHDSC 69
+\definecharacter cyrillicabhchdsc 101
+\definecharacter cyrillicKVCRS 70
+\definecharacter cyrillickvcrs 102
+\definecharacter cyrillicKHCRS 71
+\definecharacter cyrillickhcrs 103
+\definecharacter cyrillicLDSC 72
+\definecharacter cyrillicldsc 104
+\definecharacter cyrillicII 73
+\definecharacter cyrillicii 105
+\definecharacter cyrillicJE 74
+\definecharacter cyrillicje 106
+\definecharacter cyrillicLJE 75
+\definecharacter cyrilliclje 107
+\definecharacter cyrillicMDSC 76
+\definecharacter cyrillicmdsc 108
+\definecharacter cyrillicNJE 77
+\definecharacter cyrillicnje 109
+\definecharacter cyrillicABHHA 78
+\definecharacter cyrillicabhha 110
+\definecharacter cyrillicPHK 79
+\definecharacter cyrillicphk 111
+\definecharacter cyrillicRDSC 80
+\definecharacter cyrillicrdsc 112
+\definecharacter cyrillicQ 81
+\definecharacter cyrillicq 113
+\definecharacter cyrillicTDSC 82
+\definecharacter cyrillictdsc 114
+\definecharacter cyrillicDZE 83
+\definecharacter cyrillicdze 115
+\definecharacter cyrillicTETSE 84
+\definecharacter cyrillictetse 116
+\definecharacter cyrillicDZHE 85
+\definecharacter cyrillicdzhe 117
+\definecharacter cyrillicCHVCRS 86
+\definecharacter cyrillicchvcrs 118
+\definecharacter cyrillicW 87
+\definecharacter cyrillicw 119
+\definecharacter cyrillicYAT 88
+\definecharacter cyrillicyat 120
+\definecharacter cyrillicBYUS 89
+\definecharacter cyrillicbyus 121
+\definecharacter cyrillicIZH 90
+\definecharacter cyrillicizh 122
+\definecharacter cyrillicNLHK 28
+\definecharacter cyrillicnlhk 29
+\definecharacter cyrillicDELTA 30
+\definecharacter cyrillicdelta 31
+
+\stopencoding
+
+\startmapping[lcy]
+
+\resetcaserange 128 to 255
+
+\definecasemaps 128 to 143 lc +32 uc 0
+\definecasemaps 160 to 175 lc 0 uc -32
+
+\definecasemaps 144 to 159 lc +80 uc 0
+\definecasemaps 224 to 239 lc 0 uc -80
+
+\definecasemap 240 241 240 \definecasemap 241 241 240 % cyrillicYO
+\definecasemap 242 243 242 \definecasemap 243 243 242 % cyrillicGUP
+\definecasemap 244 245 244 \definecasemap 245 245 244 % cyrillicIE
+\definecasemap 244 247 244 \definecasemap 247 247 244 % cyrillicII
+\definecasemap 248 249 248 \definecasemap 249 249 248 % cyrillicYI
+\definecasemap 250 251 240 \definecasemap 241 241 240 % cyrillicUSHRT
+
+\stopmapping
+
+\startencoding[lcy]
+
+%D Characters 0 to 127 are as in normal cmr slots
+
+\definecharacter cyrillicA 128
+\definecharacter cyrillicB 129
+\definecharacter cyrillicV 130
+\definecharacter cyrillicG 131
+\definecharacter cyrillicD 132
+\definecharacter cyrillicE 133
+\definecharacter cyrillicZH 134
+\definecharacter cyrillicZ 135
+\definecharacter cyrillicI 136
+\definecharacter cyrillicISHRT 137
+\definecharacter cyrillicK 138
+\definecharacter cyrillicL 139
+\definecharacter cyrillicM 140
+\definecharacter cyrillicN 141
+\definecharacter cyrillicO 142
+\definecharacter cyrillicP 143
+\definecharacter cyrillicR 144
+\definecharacter cyrillicS 145
+\definecharacter cyrillicT 146
+\definecharacter cyrillicU 147
+\definecharacter cyrillicF 148
+\definecharacter cyrillicH 149
+\definecharacter cyrillicC 150
+\definecharacter cyrillicCH 151
+\definecharacter cyrillicSH 152
+\definecharacter cyrillicSHCH 153
+\definecharacter cyrillicHRDSN 154
+\definecharacter cyrillicERY 155
+\definecharacter cyrillicSFTSN 156
+\definecharacter cyrillicEREV 157
+\definecharacter cyrillicYU 158
+\definecharacter cyrillicYA 159
+\definecharacter cyrillica 160
+\definecharacter cyrillicb 161
+\definecharacter cyrillicv 162
+\definecharacter cyrillicg 163
+\definecharacter cyrillicd 164
+\definecharacter cyrillice 165
+\definecharacter cyrilliczh 166
+\definecharacter cyrillicz 167
+\definecharacter cyrillici 168
+\definecharacter cyrillicishrt 169
+\definecharacter cyrillick 170
+\definecharacter cyrillicl 171
+\definecharacter cyrillicm 172
+\definecharacter cyrillicn 173
+\definecharacter cyrillico 174
+\definecharacter cyrillicp 175
+\definecharacter cyrillicr 224
+\definecharacter cyrillics 225
+\definecharacter cyrillict 226
+\definecharacter cyrillicu 227
+\definecharacter cyrillicf 228
+\definecharacter cyrillich 229
+\definecharacter cyrillicc 230
+\definecharacter cyrillicch 231
+\definecharacter cyrillicsh 232
+\definecharacter cyrillicshch 233
+\definecharacter cyrillichrdsn 234
+\definecharacter cyrillicery 235
+\definecharacter cyrillicsftsn 236
+\definecharacter cyrillicerev 237
+\definecharacter cyrillicyu 238
+\definecharacter cyrillicya 239
+\definecharacter cyrillicYO 240
+\definecharacter cyrillicyo 241
+\definecharacter cyrillicGUP 242
+\definecharacter cyrillicgup 243
+\definecharacter cyrillicIE 244
+\definecharacter cyrillicie 245
+\definecharacter cyrillicII 246
+\definecharacter cyrillicii 247
+\definecharacter cyrillicYI 248
+\definecharacter cyrillicyi 249
+\definecharacter cyrillicUSHRT 250
+\definecharacter cyrillicushrt 251
+
+\definecharacter emdash 196
+\definecharacter textcurrency 197
+\definecharacter textnumero 252
+\definecharacter leftguillemot 253
+\definecharacter rightguillemot 254
+\definecharacter quotedblbase 255
+
+\stopencoding
+
+\endinput
diff --git a/tex/context/base/enco-cyr.tex b/tex/context/base/enco-cyr.tex
deleted file mode 100644
index 36bca82b5..000000000
--- a/tex/context/base/enco-cyr.tex
+++ /dev/null
@@ -1,1037 +0,0 @@
-%D \module
-%D [ file=enco-cyr,
-%D version=2003.01.24,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Cyrillic,
-%D author=...,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D The following kerning test is inspired by a test file
-%D provided by Victor Figurnov. I hope he still recognizes
-%D some bit and pieces.
-%D
-%D \starttyping
-%D \setupoutput[pdftex]
-%D
-%D \startMPenvironment[global]
-%D \useregime[cyr]
-%D \useencoding[cyr]
-%D \mainlanguage[ru]
-%D \enableregime[cp1251]
-%D \setupbodyfont[cyr]
-%D \stopMPenvironment
-%D
-%D \startbuffer
-%D \starttabulate[|l|l|l|]
-%D \NC \ruledhbox{} \NC \ruledhbox{AV} \NC with kerning \NC \NR
-%D \NC \ruledhbox{{}{}} \NC \ruledhbox{A{}V} \NC without kerning \NC \NR
-%D \NC \ruledhbox{\tfd } \NC \ruledhbox{\tfd AV} \NC with kerning \NC \NR
-%D \NC \ruledhbox{\tfd {}{}} \NC \ruledhbox{\tfd A{}V} \NC without kerning \NC \NR
-%D \stoptabulate
-%D
-%D \showkerning{ }
-%D \stopbuffer
-%D
-%D \starttext
-%D
-%D \title{Kerning test}
-%D
-%D \typebuffer
-%D
-%D \rm \subject{Serif font} \getbuffer
-%D \ss \subject{SansSerif font} \getbuffer
-%D \tt \subject{MonoSpacec font} \getbuffer
-%D
-%D \stoptext
-%D \stoptyping
-
-%D We start with a fallback, define by HH, who assumes that
-%D this is phonetic.
-
-\startmapping[t2a]
-
-\resetcaserange 128 to 255
-
-\definecasemaps 192 to 223 lc +32 uc 0 % base letters (russian)
-\definecasemaps 224 to 255 lc 0 uc -32
-
-\definecasemaps 128 to 156 lc +32 uc 0 % extra letters (cyrillic and old-slav)
-\definecasemaps 160 to 188 lc 0 uc -32
-
-\definecasemap 73 105 73 \definecasemap 105 105 73 % cyrillicII
-\definecasemap 74 106 74 \definecasemap 106 106 74 % cyrillicJE
-\definecasemap 81 113 81 \definecasemap 113 113 81 % cyrillicQ
-\definecasemap 87 119 87 \definecasemap 119 119 87 % cyrillicW
-
-\stopmapping
-
-\startencoding[t2a]
-
-\definecharacter textgrave 0
-\definecharacter textacute 1
-\definecharacter textcircumflex 2
-\definecharacter texttilde 3
-\definecharacter textdiaeresis 4
-\definecharacter texthungarumlaut 5
-\definecharacter textring 6
-\definecharacter textcaron 7
-\definecharacter textbreve 8
-\definecharacter textmacron 9
-\definecharacter textdotaccent 10
-\definecharacter textcedilla 11
-\definecharacter textogonek 12
-
-\definecharacter textcyrillicflex 18
-\definecharacter textdblgrave 19
-\definecharacter textcyrillicbreve 20
-
-\definecharacter endash 21
-\definecharacter emdash 22
-
-\definecharacter textcompwordmark 23
-\definecharacter textbackslash 92
-\definecharacter textasciicircum 94
-\definecharacter textunderscore 95
-\definecharacter textbraceleft 123
-\definecharacter textbraceright 125
-\definecharacter textasciitilde 126
-\definecharacter textnumero 157
-\definecharacter textcurrency 158
-\definecharacter sectionmark 159
-
-\definecharacter quotedbl 34
-\definecharacter quoteleft 96
-\definecharacter upperleftsingleninequote 39
-\definecharacter quotedblleft 16
-\definecharacter quotedblright 17
-\definecharacter lowerleftdoubleninequote 189
-\definecharacter upperrightdoublesixquote 16
-\definecharacter upperrightdoubleninequote 17
-\definecharacter quotedblbase 189
-
-\definecharacter cyrillicpalochka 13
-\definecharacter cyrilliclangle 14
-\definecharacter cyrillicrangle 15
-
-\definecharacter leftguillemot 190
-\definecharacter rightguillemot 191
-\definecharacter dotlessi 25
-
-\definecharacter cyrillicA 192
-\definecharacter cyrillica 224
-\definecharacter cyrillicB 193
-\definecharacter cyrillicb 225
-\definecharacter cyrillicV 194
-\definecharacter cyrillicv 226
-\definecharacter cyrillicG 195
-\definecharacter cyrillicg 227
-\definecharacter cyrillicD 196
-\definecharacter cyrillicd 228
-\definecharacter cyrillicE 197
-\definecharacter cyrillice 229
-\definecharacter cyrillicZH 198
-\definecharacter cyrilliczh 230
-\definecharacter cyrillicZ 199
-\definecharacter cyrillicz 231
-\definecharacter cyrillicI 200
-\definecharacter cyrillici 232
-\definecharacter cyrillicISHRT 201
-\definecharacter cyrillicishrt 233
-\definecharacter cyrillicK 202
-\definecharacter cyrillick 234
-\definecharacter cyrillicL 203
-\definecharacter cyrillicl 235
-\definecharacter cyrillicM 204
-\definecharacter cyrillicm 236
-\definecharacter cyrillicN 205
-\definecharacter cyrillicn 237
-\definecharacter cyrillicO 206
-\definecharacter cyrillico 238
-\definecharacter cyrillicP 207
-\definecharacter cyrillicp 239
-\definecharacter cyrillicR 208
-\definecharacter cyrillicr 240
-\definecharacter cyrillicS 209
-\definecharacter cyrillics 241
-\definecharacter cyrillicT 210
-\definecharacter cyrillict 242
-\definecharacter cyrillicU 211
-\definecharacter cyrillicu 243
-\definecharacter cyrillicF 212
-\definecharacter cyrillicf 244
-\definecharacter cyrillicH 213
-\definecharacter cyrillich 245
-\definecharacter cyrillicC 214
-\definecharacter cyrillicc 246
-\definecharacter cyrillicCH 215
-\definecharacter cyrillicch 247
-\definecharacter cyrillicSH 216
-\definecharacter cyrillicsh 248
-\definecharacter cyrillicSHCH 217
-\definecharacter cyrillicshch 249
-\definecharacter cyrillicHRDSN 218
-\definecharacter cyrillichrdsn 250
-\definecharacter cyrillicERY 219
-\definecharacter cyrillicery 251
-\definecharacter cyrillicSFTSN 220
-\definecharacter cyrillicsftsn 252
-\definecharacter cyrillicEREV 221
-\definecharacter cyrillicerev 253
-\definecharacter cyrillicYU 222
-\definecharacter cyrillicyu 254
-\definecharacter cyrillicYA 223
-\definecharacter cyrillicya 255
-\definecharacter cyrillicGUP 128
-\definecharacter cyrillicgup 160
-\definecharacter cyrillicGHCRS 129
-\definecharacter cyrillicghcrs 161
-\definecharacter cyrillicDJE 130
-\definecharacter cyrillicdje 162
-\definecharacter cyrillicTSHE 131
-\definecharacter cyrillictshe 163
-\definecharacter cyrillicSHHA 132
-\definecharacter cyrillicshha 164
-\definecharacter cyrillicZHDSC 133
-\definecharacter cyrilliczhdsc 165
-\definecharacter cyrillicZDSC 134
-\definecharacter cyrilliczdsc 166
-\definecharacter cyrillicLJE 135
-\definecharacter cyrilliclje 167
-\definecharacter cyrillicYI 136
-\definecharacter cyrillicyi 168
-\definecharacter cyrillicKDSC 137
-\definecharacter cyrillickdsc 169
-\definecharacter cyrillicKBEAK 138
-\definecharacter cyrillickbeak 170
-\definecharacter cyrillicKVCRS 139
-\definecharacter cyrillickvcrs 171
-\definecharacter cyrillicAE 140
-\definecharacter cyrillicae 172
-\definecharacter cyrillicNDSC 141
-\definecharacter cyrillicndsc 173
-\definecharacter cyrillicNG 142
-\definecharacter cyrillicng 174
-\definecharacter cyrillicDZE 143
-\definecharacter cyrillicdze 175
-\definecharacter cyrillicOTLD 144
-\definecharacter cyrillicotld 176
-\definecharacter cyrillicSDSC 145
-\definecharacter cyrillicsdsc 177
-\definecharacter cyrillicUSHRT 146
-\definecharacter cyrillicushrt 178
-\definecharacter cyrillicY 147
-\definecharacter cyrillicy 179
-\definecharacter cyrillicYHCRS 148
-\definecharacter cyrillicyhcrs 180
-\definecharacter cyrillicHDSC 149
-\definecharacter cyrillichdsc 181
-\definecharacter cyrillicDZHE 150
-\definecharacter cyrillicdzhe 182
-\definecharacter cyrillicCHVCRS 151
-\definecharacter cyrillicchvcrs 183
-\definecharacter cyrillicCHRDSC 152
-\definecharacter cyrillicchrdsc 184
-\definecharacter cyrillicIE 153
-\definecharacter cyrillicie 185
-\definecharacter cyrillicSCHWA 154
-\definecharacter cyrillicschwa 186
-\definecharacter cyrillicNJE 155
-\definecharacter cyrillicnje 187
-\definecharacter cyrillicYO 156
-\definecharacter cyrillicyo 188
-\definecharacter cyrillicII 73
-\definecharacter cyrillicii 105
-\definecharacter cyrillicJE 74
-\definecharacter cyrillicje 106
-\definecharacter cyrillicQ 81
-\definecharacter cyrillicq 113
-\definecharacter cyrillicW 87
-\definecharacter cyrillicw 119
-
-% \definecharacter textperthousand {\%\char 24 }
-% \definecharacter textpertenthousand {\%\char 24\char 24 }
-
-\definecharacter cyrillicgheupturn 160 % to satisfy the patterns
-
-\stopencoding
-
-\startmapping[t2b]
-
-\resetcaserange 128 to 255
-
-\definecasemaps 192 to 223 lc +32 uc 0 % base letters (russian)
-\definecasemaps 224 to 255 lc 0 uc -32
-
-\definecasemaps 128 to 156 lc +32 uc 0 % extra letters (cyrillic and old-slav)
-\definecasemaps 160 to 188 lc 0 uc -32
-
-\definecasemap 73 105 73 \definecasemap 105 105 73 % cyrillicII
-\definecasemap 74 106 74 \definecasemap 106 106 74 % cyrillicJE
-\definecasemap 81 113 81 \definecasemap 113 113 81 % cyrillicQ
-\definecasemap 83 115 83 \definecasemap 115 115 83 % cyrillicDZE
-\definecasemap 87 119 87 \definecasemap 119 119 87 % cyrillicW
-
-\stopmapping
-
-\startencoding[t2b]
-
-\definecharacter textgrave 0
-\definecharacter textacute 1
-\definecharacter textcircumflex 2
-\definecharacter texttilde 3
-\definecharacter textdiaeresis 4
-\definecharacter texthungarumlaut 5
-\definecharacter textring 6
-\definecharacter textcaron 7
-\definecharacter textbreve 8
-\definecharacter textmacron 9
-\definecharacter textdotaccent 10
-\definecharacter textcedilla 11
-\definecharacter textogonek 12
-
-\definecharacter textcyrillicflex 18
-\definecharacter textdblgrave 19
-\definecharacter textcyrillicbreve 20
-
-\definecharacter endash 21
-\definecharacter emdash 22
-
-\definecharacter textcompwordmark 23
-\definecharacter textbackslash 92
-\definecharacter textasciicircum 94
-\definecharacter textunderscore 95
-\definecharacter textbraceleft 123
-\definecharacter textbraceright 125
-\definecharacter textasciitilde 126
-\definecharacter textnumero 157
-\definecharacter textcurrency 158
-\definecharacter sectionmark 159
-\definecharacter quotedbl 34
-\definecharacter quoteleft 96
-\definecharacter upperleftsingleninequote 39
-\definecharacter quotedblleft 16
-\definecharacter quotedblright 17
-\definecharacter lowerleftdoubleninequote 189
-
-\definecharacter upperrightdoublesixquote 16
-\definecharacter upperrightdoubleninequote 17
-\definecharacter quotedblbase 189
-
-\definecharacter cyrillicpalochka 13
-\definecharacter cyrilliclangle 14
-\definecharacter cyrillicrangle 15
-
-\definecharacter leftguillemot 190
-\definecharacter rightguillemot 191
-\definecharacter dotlessi 25
-
-\definecharacter cyrillicA 192
-\definecharacter cyrillica 224
-\definecharacter cyrillicB 193
-\definecharacter cyrillicb 225
-\definecharacter cyrillicV 194
-\definecharacter cyrillicv 226
-\definecharacter cyrillicG 195
-\definecharacter cyrillicg 227
-\definecharacter cyrillicD 196
-\definecharacter cyrillicd 228
-\definecharacter cyrillicE 197
-\definecharacter cyrillice 229
-\definecharacter cyrillicZH 198
-\definecharacter cyrilliczh 230
-\definecharacter cyrillicZ 199
-\definecharacter cyrillicz 231
-\definecharacter cyrillicI 200
-\definecharacter cyrillici 232
-\definecharacter cyrillicISHRT 201
-\definecharacter cyrillicishrt 233
-\definecharacter cyrillicK 202
-\definecharacter cyrillick 234
-\definecharacter cyrillicL 203
-\definecharacter cyrillicl 235
-\definecharacter cyrillicM 204
-\definecharacter cyrillicm 236
-\definecharacter cyrillicN 205
-\definecharacter cyrillicn 237
-\definecharacter cyrillicO 206
-\definecharacter cyrillico 238
-\definecharacter cyrillicP 207
-\definecharacter cyrillicp 239
-\definecharacter cyrillicR 208
-\definecharacter cyrillicr 240
-\definecharacter cyrillicS 209
-\definecharacter cyrillics 241
-\definecharacter cyrillicT 210
-\definecharacter cyrillict 242
-\definecharacter cyrillicU 211
-\definecharacter cyrillicu 243
-\definecharacter cyrillicF 212
-\definecharacter cyrillicf 244
-\definecharacter cyrillicH 213
-\definecharacter cyrillich 245
-\definecharacter cyrillicC 214
-\definecharacter cyrillicc 246
-\definecharacter cyrillicCH 215
-\definecharacter cyrillicch 247
-\definecharacter cyrillicSH 216
-\definecharacter cyrillicsh 248
-\definecharacter cyrillicSHCH 217
-\definecharacter cyrillicshch 249
-\definecharacter cyrillicHRDSN 218
-\definecharacter cyrillichrdsn 250
-\definecharacter cyrillicERY 219
-\definecharacter cyrillicery 251
-\definecharacter cyrillicSFTSN 220
-\definecharacter cyrillicsftsn 252
-\definecharacter cyrillicEREV 221
-\definecharacter cyrillicerev 253
-\definecharacter cyrillicYU 222
-\definecharacter cyrillicyu 254
-\definecharacter cyrillicYA 223
-\definecharacter cyrillicya 255
-\definecharacter cyrillicGDSCHCRS 128
-\definecharacter cyrillicgdschcrs 160
-\definecharacter cyrillicGHCRS 129
-\definecharacter cyrillicghcrs 161
-\definecharacter cyrillicGDSC 130
-\definecharacter cyrillicgdsc 162
-\definecharacter cyrillicGHK 131
-\definecharacter cyrillicghk 163
-\definecharacter cyrillicSHHA 132
-\definecharacter cyrillicshha 164
-\definecharacter cyrillicZHDSC 133
-\definecharacter cyrilliczhdsc 165
-\definecharacter cyrillicDELTA 134
-\definecharacter cyrillicdelta 166
-\definecharacter cyrillicABHDZE 135
-\definecharacter cyrillicabhdze 167
-\definecharacter cyrillicLJE 136
-\definecharacter cyrilliclje 168
-\definecharacter cyrillicKDSC 137
-\definecharacter cyrillickdsc 169
-\definecharacter cyrillicLDSC 138
-\definecharacter cyrillicldsc 170
-\definecharacter cyrillicKHK 139
-\definecharacter cyrillickhk 171
-\definecharacter cyrillicLHK 140
-\definecharacter cyrilliclhk 172
-\definecharacter cyrillicNDSC 141
-\definecharacter cyrillicndsc 173
-\definecharacter cyrillicNG 142
-\definecharacter cyrillicng 174
-\definecharacter cyrillicNHK 143
-\definecharacter cyrillicnhk 175
-\definecharacter cyrillicOTLD 144
-\definecharacter cyrillicotld 176
-\definecharacter cyrillicSACRS 145
-\definecharacter cyrillicsacrs 177
-\definecharacter cyrillicUSHRT 146
-\definecharacter cyrillicushrt 178
-\definecharacter cyrillicY 147
-\definecharacter cyrillicy 179
-\definecharacter cyrillicHHCRS 148
-\definecharacter cyrillichhcrs 180
-\definecharacter cyrillicHDSC 149
-\definecharacter cyrillichdsc 181
-\definecharacter cyrillicHHK 150
-\definecharacter cyrillichhk 182
-\definecharacter cyrillicCHLDSC 151
-\definecharacter cyrillicchldsc 183
-\definecharacter cyrillicCHRDSC 152
-\definecharacter cyrillicchrdsc 184
-\definecharacter cyrillicNJE 153
-\definecharacter cyrillicnje 185
-\definecharacter cyrillicSCHWA 154
-\definecharacter cyrillicschwa 186
-\definecharacter cyrillicEPS 155
-\definecharacter cyrilliceps 187
-\definecharacter cyrillicYO 156
-\definecharacter cyrillicyo 188
-\definecharacter cyrillicII 73
-\definecharacter cyrillicii 105
-\definecharacter cyrillicJE 74
-\definecharacter cyrillicje 106
-\definecharacter cyrillicQ 81
-\definecharacter cyrillicq 113
-\definecharacter cyrillicDZE 83
-\definecharacter cyrillicdze 115
-\definecharacter cyrillicW 87
-\definecharacter cyrillicw 119
-
-\stopencoding
-
-\startmapping[t2c]
-
-\resetcaserange 128 to 255
-
-\definecasemaps 192 to 223 lc +32 uc 0 % base letters (russian)
-\definecasemaps 224 to 255 lc 0 uc -32
-
-\definecasemaps 128 to 156 lc +32 uc 0 % extra letters (cyrillic and old-slav)
-\definecasemaps 160 to 188 lc 0 uc -32
-
-\definecasemap 73 105 73 \definecasemap 105 105 73 % cyrillicII
-\definecasemap 74 106 74 \definecasemap 106 106 74 % cyrillicJE
-\definecasemap 81 113 81 \definecasemap 113 113 81 % cyrillicQ
-\definecasemap 83 115 83 \definecasemap 115 115 83 % cyrillicDZE
-\definecasemap 87 119 87 \definecasemap 119 119 87 % cyrillicW
-
-\stopmapping
-
-\startencoding[t2c]
-
-\definecharacter textgrave 0
-\definecharacter textacute 1
-\definecharacter textcircumflex 2
-\definecharacter texttilde 3
-\definecharacter textdiaeresis 4
-\definecharacter texthungarumlaut 5
-\definecharacter textring 6
-\definecharacter textcaron 7
-\definecharacter textbreve 8
-\definecharacter textmacron 9
-\definecharacter textdotaccent 10
-\definecharacter textcedilla 11
-\definecharacter textogonek 12
-
-\definecharacter textcyrillicflex 18
-\definecharacter textdblgrave 19
-\definecharacter textcyrillicbreve 20
-
-\definecharacter endash 21
-\definecharacter emdash 22
-
-\definecharacter textcompwordmark 23
-\definecharacter textbackslash 92
-\definecharacter textasciicircum 94
-\definecharacter textunderscore 95
-\definecharacter textbraceleft 123
-\definecharacter textbraceright 125
-\definecharacter textasciitilde 126
-\definecharacter textnumero 157
-\definecharacter textcurrency 158
-\definecharacter sectionmark 159
-\definecharacter quotedbl 34
-\definecharacter quoteleft 96
-\definecharacter upperleftsingleninequote 39
-\definecharacter quotedblleft 16
-\definecharacter quotedblright 17
-\definecharacter lowerleftdoubleninequote 189
-\definecharacter upperrightdoublesixquote 16
-\definecharacter upperrightdoubleninequote 17
-\definecharacter quotedblbase 189
-
-\definecharacter cyrillicpalochka 13
-\definecharacter cyrilliclangle 14
-\definecharacter cyrillicrangle 15
-
-\definecharacter leftguillemot 190
-\definecharacter rightguillemot 191
-
-\definecharacter dotlessi 25
-
-\definecharacter cyrillicA 192
-\definecharacter cyrillica 224
-\definecharacter cyrillicB 193
-\definecharacter cyrillicb 225
-\definecharacter cyrillicV 194
-\definecharacter cyrillicv 226
-\definecharacter cyrillicG 195
-\definecharacter cyrillicg 227
-\definecharacter cyrillicD 196
-\definecharacter cyrillicd 228
-\definecharacter cyrillicE 197
-\definecharacter cyrillice 229
-\definecharacter cyrillicZH 198
-\definecharacter cyrilliczh 230
-\definecharacter cyrillicZ 199
-\definecharacter cyrillicz 231
-\definecharacter cyrillicI 200
-\definecharacter cyrillici 232
-\definecharacter cyrillicISHRT 201
-\definecharacter cyrillicishrt 233
-\definecharacter cyrillicK 202
-\definecharacter cyrillick 234
-\definecharacter cyrillicL 203
-\definecharacter cyrillicl 235
-\definecharacter cyrillicM 204
-\definecharacter cyrillicm 236
-\definecharacter cyrillicN 205
-\definecharacter cyrillicn 237
-\definecharacter cyrillicO 206
-\definecharacter cyrillico 238
-\definecharacter cyrillicP 207
-\definecharacter cyrillicp 239
-\definecharacter cyrillicR 208
-\definecharacter cyrillicr 240
-\definecharacter cyrillicS 209
-\definecharacter cyrillics 241
-\definecharacter cyrillicT 210
-\definecharacter cyrillict 242
-\definecharacter cyrillicU 211
-\definecharacter cyrillicu 243
-\definecharacter cyrillicF 212
-\definecharacter cyrillicf 244
-\definecharacter cyrillicH 213
-\definecharacter cyrillich 245
-\definecharacter cyrillicC 214
-\definecharacter cyrillicc 246
-\definecharacter cyrillicCH 215
-\definecharacter cyrillicch 247
-\definecharacter cyrillicSH 216
-\definecharacter cyrillicsh 248
-\definecharacter cyrillicSHCH 217
-\definecharacter cyrillicshch 249
-\definecharacter cyrillicHRDSN 218
-\definecharacter cyrillichrdsn 250
-\definecharacter cyrillicERY 219
-\definecharacter cyrillicery 251
-\definecharacter cyrillicSFTSN 220
-\definecharacter cyrillicsftsn 252
-\definecharacter cyrillicEREV 221
-\definecharacter cyrillicerev 253
-\definecharacter cyrillicYU 222
-\definecharacter cyrillicyu 254
-\definecharacter cyrillicYA 223
-\definecharacter cyrillicya 255
-\definecharacter cyrillicPHK 128
-\definecharacter cyrillicphk 160
-\definecharacter cyrillicTETSE 129
-\definecharacter cyrillictetse 161
-\definecharacter cyrillicTDSC 130
-\definecharacter cyrillictdsc 162
-\definecharacter cyrillicGHK 131
-\definecharacter cyrillicghk 163
-\definecharacter cyrillicSHHA 132
-\definecharacter cyrillicshha 164
-\definecharacter cyrillicRDSC 133
-\definecharacter cyrillicrdsc 165
-\definecharacter cyrillicRTICK 134
-\definecharacter cyrillicrtick 166
-\definecharacter cyrillicABHDZE 135
-\definecharacter cyrillicabhdze 167
-\definecharacter cyrillicMDSC 136
-\definecharacter cyrillicmdsc 168
-\definecharacter cyrillicKDSC 137
-\definecharacter cyrillickdsc 169
-\definecharacter cyrillicLDSC 138
-\definecharacter cyrillicldsc 170
-\definecharacter cyrillicKHCRS 139
-\definecharacter cyrillickhcrs 171
-\definecharacter cyrillicLHK 140
-\definecharacter cyrilliclhk 172
-\definecharacter cyrillicNDSC 141
-\definecharacter cyrillicndsc 173
-\definecharacter cyrillicMHK 142
-\definecharacter cyrillicmhk 174
-\definecharacter cyrillicNHK 143
-\definecharacter cyrillicnhk 175
-\definecharacter cyrillicOTLD 144
-\definecharacter cyrillicotld 176
-\definecharacter cyrillicABHCH 145
-\definecharacter cyrillicabhch 177
-\definecharacter cyrillicABHCHDSC 146
-\definecharacter cyrillicabhchdsc 178
-\definecharacter cyrillicSEMISFTSN 147
-\definecharacter cyrillicsemisftsn 179
-\definecharacter cyrillicISHRTDSC 148
-\definecharacter cyrillicishrtdsc 180
-\definecharacter cyrillicHDSC 149
-\definecharacter cyrillichdsc 181
-\definecharacter cyrillicDZHE 150
-\definecharacter cyrillicdzhe 182
-\definecharacter cyrillicABHHA 151
-\definecharacter cyrillicabhha 183
-\definecharacter cyrillicCHRDSC 152
-\definecharacter cyrillicchrdsc 184
-\definecharacter cyrillicNLHK 153
-\definecharacter cyrillicnlhk 185
-\definecharacter cyrillicSCHWA 154
-\definecharacter cyrillicschwa 186
-\definecharacter cyrillicRHK 155
-\definecharacter cyrillicrhk 187
-\definecharacter cyrillicYO 156
-\definecharacter cyrillicyo 188
-\definecharacter cyrillicII 73
-\definecharacter cyrillicii 105
-\definecharacter cyrillicJE 74
-\definecharacter cyrillicje 106
-\definecharacter cyrillicQ 81
-\definecharacter cyrillicq 113
-\definecharacter cyrillicDZE 83
-\definecharacter cyrillicdze 115
-\definecharacter cyrillicW 87
-\definecharacter cyrillicw 119
-
-\stopencoding
-
-\startmapping[x2]
-
-\resetcaserange 128 to 255
-
-\definecasemaps 192 to 223 lc +32 uc 0 % base letters (russian)
-\definecasemaps 224 to 255 lc 0 uc -32
-
-\definecasemaps 128 to 156 lc +32 uc 0 % extra letters (cyrillic and old-slav)
-\definecasemaps 160 to 188 lc 0 uc -32
-
-\definecasemaps 65 to 90 lc +32 uc 0 % more extra letters (cyrillic and old-slav)
-\definecasemaps 97 to 122 lc 0 uc -32
-
-\definecasemap 28 29 28 \definecasemap 29 29 28 % cyrillicNLHK
-\definecasemap 30 31 30 \definecasemap 31 31 30 % cyrillicDELTA
-
-\stopmapping
-
-\startencoding[x2]
-
-\definecharacter textgrave 0
-\definecharacter textacute 1
-\definecharacter textcircumflex 2
-\definecharacter texttilde 3
-\definecharacter textdiaeresis 4
-\definecharacter texthungarumlaut 5
-\definecharacter textring 6
-\definecharacter textcaron 7
-\definecharacter textbreve 8
-\definecharacter textmacron 9
-\definecharacter textdotaccent 10
-\definecharacter textcedilla 11
-\definecharacter textogonek 12
-
-\definecharacter endash 21
-\definecharacter emdash 22
-
-\definecharacter textcompwordmark 23
-\definecharacter textvisiblespace 32
-\definecharacter textdollar 36
-\definecharacter textless 60
-\definecharacter textgreater 62
-\definecharacter textbackslash 92
-\definecharacter textasciicircum 94
-\definecharacter textunderscore 95
-\definecharacter textbraceleft 123
-\definecharacter textbar 124
-\definecharacter textbraceright 125
-\definecharacter textasciitilde 126
-\definecharacter textnumero 157
-\definecharacter textcurrency 158
-\definecharacter textsection 159
-\definecharacter sectionmark 159
-\definecharacter textquotedbl 34
-
-\definecharacter cyrillicpalochka 13
-\definecharacter cyrilliclangle 14
-\definecharacter cyrillicrangle 15
-
-\definecharacter leftguillemot 190
-\definecharacter rightguillemot 191
-
-\definecharacter upperleftsinglesixquote 96
-\definecharacter upperleftsingleninequote 39
-\definecharacter upperleftdoublesixquote 16
-\definecharacter upperleftdoubleninequote 17
-\definecharacter lowerleftdoubleninequote 189
-
-\definecharacter upperrightsinglesixquote 96
-\definecharacter upperrightsingleninequote 39
-\definecharacter upperrightdoublesixquote 16
-\definecharacter upperrightdoubleninequote 17
-\definecharacter lowerrightdoubleninequote 189
-
-\definecharacter cyrillicA 192
-\definecharacter cyrillica 224
-\definecharacter cyrillicB 193
-\definecharacter cyrillicb 225
-\definecharacter cyrillicV 194
-\definecharacter cyrillicv 226
-\definecharacter cyrillicG 195
-\definecharacter cyrillicg 227
-\definecharacter cyrillicD 196
-\definecharacter cyrillicd 228
-\definecharacter cyrillicE 197
-\definecharacter cyrillice 229
-\definecharacter cyrillicZH 198
-\definecharacter cyrilliczh 230
-\definecharacter cyrillicZ 199
-\definecharacter cyrillicz 231
-\definecharacter cyrillicI 200
-\definecharacter cyrillici 232
-\definecharacter cyrillicISHRT 201
-\definecharacter cyrillicishrt 233
-\definecharacter cyrillicK 202
-\definecharacter cyrillick 234
-\definecharacter cyrillicL 203
-\definecharacter cyrillicl 235
-\definecharacter cyrillicM 204
-\definecharacter cyrillicm 236
-\definecharacter cyrillicN 205
-\definecharacter cyrillicn 237
-\definecharacter cyrillicO 206
-\definecharacter cyrillico 238
-\definecharacter cyrillicP 207
-\definecharacter cyrillicp 239
-\definecharacter cyrillicR 208
-\definecharacter cyrillicr 240
-\definecharacter cyrillicS 209
-\definecharacter cyrillics 241
-\definecharacter cyrillicT 210
-\definecharacter cyrillict 242
-\definecharacter cyrillicU 211
-\definecharacter cyrillicu 243
-\definecharacter cyrillicF 212
-\definecharacter cyrillicf 244
-\definecharacter cyrillicH 213
-\definecharacter cyrillich 245
-\definecharacter cyrillicC 214
-\definecharacter cyrillicc 246
-\definecharacter cyrillicCH 215
-\definecharacter cyrillicch 247
-\definecharacter cyrillicSH 216
-\definecharacter cyrillicsh 248
-\definecharacter cyrillicSHCH 217
-\definecharacter cyrillicshch 249
-\definecharacter cyrillicHRDSN 218
-\definecharacter cyrillichrdsn 250
-\definecharacter cyrillicERY 219
-\definecharacter cyrillicery 251
-\definecharacter cyrillicSFTSN 220
-\definecharacter cyrillicsftsn 252
-\definecharacter cyrillicEREV 221
-\definecharacter cyrillicerev 253
-\definecharacter cyrillicYU 222
-\definecharacter cyrillicyu 254
-\definecharacter cyrillicYA 223
-\definecharacter cyrillicya 255
-\definecharacter cyrillicGUP 128
-\definecharacter cyrillicgup 160
-\definecharacter cyrillicGHCRS 129
-\definecharacter cyrillicghcrs 161
-\definecharacter cyrillicGDSC 130
-\definecharacter cyrillicgdsc 162
-\definecharacter cyrillicGHK 131
-\definecharacter cyrillicghk 163
-\definecharacter cyrillicSHHA 132
-\definecharacter cyrillicshha 164
-\definecharacter cyrillicZHDSC 133
-\definecharacter cyrilliczhdsc 165
-\definecharacter cyrillicZDSC 134
-\definecharacter cyrilliczdsc 166
-\definecharacter cyrillicABHDZE 135
-\definecharacter cyrillicabhdze 167
-\definecharacter cyrillicYI 136
-\definecharacter cyrillicyi 168
-\definecharacter cyrillicKDSC 137
-\definecharacter cyrillickdsc 169
-\definecharacter cyrillicKBEAK 138
-\definecharacter cyrillickbeak 170
-\definecharacter cyrillicKHK 139
-\definecharacter cyrillickhk 171
-\definecharacter cyrillicLHK 140
-\definecharacter cyrilliclhk 172
-\definecharacter cyrillicNDSC 141
-\definecharacter cyrillicndsc 173
-\definecharacter cyrillicNG 142
-\definecharacter cyrillicng 174
-\definecharacter cyrillicNHK 143
-\definecharacter cyrillicnhk 175
-\definecharacter cyrillicOTLD 144
-\definecharacter cyrillicotld 176
-\definecharacter cyrillicSDSC 145
-\definecharacter cyrillicsdsc 177
-\definecharacter cyrillicUSHRT 146
-\definecharacter cyrillicushrt 178
-\definecharacter cyrillicY 147
-\definecharacter cyrillicy 179
-\definecharacter cyrillicYHCRS 148
-\definecharacter cyrillicyhcrs 180
-\definecharacter cyrillicHDSC 149
-\definecharacter cyrillichdsc 181
-\definecharacter cyrillicHHK 150
-\definecharacter cyrillichhk 182
-\definecharacter cyrillicCHLDSC 151
-\definecharacter cyrillicchldsc 183
-\definecharacter cyrillicCHRDSC 152
-\definecharacter cyrillicchrdsc 184
-\definecharacter cyrillicIE 153
-\definecharacter cyrillicie 185
-\definecharacter cyrillicSCHWA 154
-\definecharacter cyrillicschwa 186
-\definecharacter cyrillicEPS 155
-\definecharacter cyrilliceps 187
-\definecharacter cyrillicYO 156
-\definecharacter cyrillicyo 188
-\definecharacter cyrillicAE 65
-\definecharacter cyrillicae 97
-\definecharacter cyrillicDJE 66
-\definecharacter cyrillicdje 98
-\definecharacter cyrillicTSHE 67
-\definecharacter cyrillictshe 99
-\definecharacter cyrillicABHCH 68
-\definecharacter cyrillicabhch 100
-\definecharacter cyrillicABHCHDSC 69
-\definecharacter cyrillicabhchdsc 101
-\definecharacter cyrillicKVCRS 70
-\definecharacter cyrillickvcrs 102
-\definecharacter cyrillicKHCRS 71
-\definecharacter cyrillickhcrs 103
-\definecharacter cyrillicLDSC 72
-\definecharacter cyrillicldsc 104
-\definecharacter cyrillicII 73
-\definecharacter cyrillicii 105
-\definecharacter cyrillicJE 74
-\definecharacter cyrillicje 106
-\definecharacter cyrillicLJE 75
-\definecharacter cyrilliclje 107
-\definecharacter cyrillicMDSC 76
-\definecharacter cyrillicmdsc 108
-\definecharacter cyrillicNJE 77
-\definecharacter cyrillicnje 109
-\definecharacter cyrillicABHHA 78
-\definecharacter cyrillicabhha 110
-\definecharacter cyrillicPHK 79
-\definecharacter cyrillicphk 111
-\definecharacter cyrillicRDSC 80
-\definecharacter cyrillicrdsc 112
-\definecharacter cyrillicQ 81
-\definecharacter cyrillicq 113
-\definecharacter cyrillicTDSC 82
-\definecharacter cyrillictdsc 114
-\definecharacter cyrillicDZE 83
-\definecharacter cyrillicdze 115
-\definecharacter cyrillicTETSE 84
-\definecharacter cyrillictetse 116
-\definecharacter cyrillicDZHE 85
-\definecharacter cyrillicdzhe 117
-\definecharacter cyrillicCHVCRS 86
-\definecharacter cyrillicchvcrs 118
-\definecharacter cyrillicW 87
-\definecharacter cyrillicw 119
-\definecharacter cyrillicYAT 88
-\definecharacter cyrillicyat 120
-\definecharacter cyrillicBYUS 89
-\definecharacter cyrillicbyus 121
-\definecharacter cyrillicIZH 90
-\definecharacter cyrillicizh 122
-\definecharacter cyrillicNLHK 28
-\definecharacter cyrillicnlhk 29
-\definecharacter cyrillicDELTA 30
-\definecharacter cyrillicdelta 31
-
-\stopencoding
-
-\startmapping[lcy]
-
-\resetcaserange 128 to 255
-
-\definecasemaps 128 to 143 lc +32 uc 0
-\definecasemaps 160 to 175 lc 0 uc -32
-
-\definecasemaps 144 to 159 lc +80 uc 0
-\definecasemaps 224 to 239 lc 0 uc -80
-
-\definecasemap 240 241 240 \definecasemap 241 241 240 % cyrillicYO
-\definecasemap 242 243 242 \definecasemap 243 243 242 % cyrillicGUP
-\definecasemap 244 245 244 \definecasemap 245 245 244 % cyrillicIE
-\definecasemap 244 247 244 \definecasemap 247 247 244 % cyrillicII
-\definecasemap 248 249 248 \definecasemap 249 249 248 % cyrillicYI
-\definecasemap 250 251 240 \definecasemap 241 241 240 % cyrillicUSHRT
-
-\stopmapping
-
-\startencoding[lcy]
-
-%D Characters 0 to 127 are as in normal cmr slots
-
-\definecharacter cyrillicA 128
-\definecharacter cyrillicB 129
-\definecharacter cyrillicV 130
-\definecharacter cyrillicG 131
-\definecharacter cyrillicD 132
-\definecharacter cyrillicE 133
-\definecharacter cyrillicZH 134
-\definecharacter cyrillicZ 135
-\definecharacter cyrillicI 136
-\definecharacter cyrillicISHRT 137
-\definecharacter cyrillicK 138
-\definecharacter cyrillicL 139
-\definecharacter cyrillicM 140
-\definecharacter cyrillicN 141
-\definecharacter cyrillicO 142
-\definecharacter cyrillicP 143
-\definecharacter cyrillicR 144
-\definecharacter cyrillicS 145
-\definecharacter cyrillicT 146
-\definecharacter cyrillicU 147
-\definecharacter cyrillicF 148
-\definecharacter cyrillicH 149
-\definecharacter cyrillicC 150
-\definecharacter cyrillicCH 151
-\definecharacter cyrillicSH 152
-\definecharacter cyrillicSHCH 153
-\definecharacter cyrillicHRDSN 154
-\definecharacter cyrillicERY 155
-\definecharacter cyrillicSFTSN 156
-\definecharacter cyrillicEREV 157
-\definecharacter cyrillicYU 158
-\definecharacter cyrillicYA 159
-\definecharacter cyrillica 160
-\definecharacter cyrillicb 161
-\definecharacter cyrillicv 162
-\definecharacter cyrillicg 163
-\definecharacter cyrillicd 164
-\definecharacter cyrillice 165
-\definecharacter cyrilliczh 166
-\definecharacter cyrillicz 167
-\definecharacter cyrillici 168
-\definecharacter cyrillicishrt 169
-\definecharacter cyrillick 170
-\definecharacter cyrillicl 171
-\definecharacter cyrillicm 172
-\definecharacter cyrillicn 173
-\definecharacter cyrillico 174
-\definecharacter cyrillicp 175
-\definecharacter cyrillicr 224
-\definecharacter cyrillics 225
-\definecharacter cyrillict 226
-\definecharacter cyrillicu 227
-\definecharacter cyrillicf 228
-\definecharacter cyrillich 229
-\definecharacter cyrillicc 230
-\definecharacter cyrillicch 231
-\definecharacter cyrillicsh 232
-\definecharacter cyrillicshch 233
-\definecharacter cyrillichrdsn 234
-\definecharacter cyrillicery 235
-\definecharacter cyrillicsftsn 236
-\definecharacter cyrillicerev 237
-\definecharacter cyrillicyu 238
-\definecharacter cyrillicya 239
-\definecharacter cyrillicYO 240
-\definecharacter cyrillicyo 241
-\definecharacter cyrillicGUP 242
-\definecharacter cyrillicgup 243
-\definecharacter cyrillicIE 244
-\definecharacter cyrillicie 245
-\definecharacter cyrillicII 246
-\definecharacter cyrillicii 247
-\definecharacter cyrillicYI 248
-\definecharacter cyrillicyi 249
-\definecharacter cyrillicUSHRT 250
-\definecharacter cyrillicushrt 251
-
-\definecharacter emdash 196
-\definecharacter textcurrency 197
-\definecharacter textnumero 252
-\definecharacter leftguillemot 253
-\definecharacter rightguillemot 254
-\definecharacter quotedblbase 255
-
-\stopencoding
-
-\endinput
diff --git a/tex/context/base/enco-def.mkii b/tex/context/base/enco-def.mkii
new file mode 100644
index 000000000..b6d66bb6c
--- /dev/null
+++ b/tex/context/base/enco-def.mkii
@@ -0,0 +1,920 @@
+%D \module
+%D [ file=enco-def,
+%D version=2000.05.07, % 2000.20.12, % split from less verbose base file
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Default Character Definitions,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D Instead of overloading plain \TEX\ macros (and keeping them
+%D available as an escape), we now use the more verbose
+%D definitions in this file. Since memory is less a problem
+%D these days, this verbosity has only a small price, but we
+%D gain readability. The following definitions are based on
+%D usage of the the original \TEX\ fonts, where composed
+%D characters were not part of the design. So, occasionally
+%D we have to revert to hacks. Thanks to all those users who
+%D helped me to fill in the details.
+
+\startencoding[default]
+
+\definecharacter textcomma ,
+\definecharacter textperiod .
+
+\definecharacter textacute 19
+\definecharacter textbottomdot 46
+\definecharacter textbreve 21
+\definecharacter textcaron 20
+\definecharacter textcedilla 24
+\definecharacter textcircumflex 94
+\definecharacter textdiaeresis 127
+\definecharacter textdotaccent 95
+\definecharacter textgrave 18
+\definecharacter texthungarumlaut 125
+\definecharacter textmacron 22
+\definecharacter textogonek 24 % fake
+\definecharacter textring 23
+\definecharacter texttilde 126
+
+\definecharacter textbottomcomma {\hbox{\lower.35ex\hbox{\tx,}}} % for mojca
+
+\definecharacter dotlessi {\char"10 }
+\definecharacter dotlessj {\char"11 }
+\definecharacter dotlessI {I}
+\definecharacter dotlessJ {J}
+
+\definecharacter endash 123
+\definecharacter emdash 124
+
+\definecharacter aeligature {\char26 } % "1A
+\definecharacter AEligature {\char29 } % "1D
+\definecharacter ijligature {ij}
+\definecharacter IJligature {IJ}
+\definecharacter oeligature {\char27 } % "1B
+\definecharacter OEligature {\char30 } % "1E
+
+\definecharacter ssharp {\char25 } % "19
+\definecharacter Ssharp {SS}
+
+\definecharacter thorn {\unknownchar}
+\definecharacter Thorn {\unknownchar}
+
+\definecharacter eth {\unknownchar} % mojca prefers this (was \dstroke)
+%definecharacter Eth {\unknownchar}
+\definecharacter Eth {\Dstroke} % mojca prefers this too
+
+\definecharacter exclamdown 60
+\definecharacter questiondown 62
+
+\definecharacter copyright {\encircled{\txx C}}
+\definecharacter registered {\encircled{\txx R}}
+\definecharacter trademark {\high{\txx TM}}
+
+\definecharacter sectionmark {\mathematics{\mathhexbox278}}
+\definecharacter paragraphmark {\mathematics{\mathhexbox27B}}
+
+\definecharacter onequarter {\vulgarfraction{1}{4}}
+\definecharacter onehalf {\vulgarfraction{1}{2}}
+\definecharacter threequarter {\vulgarfraction{3}{4}}
+
+\definecharacter onesuperior {\high{1}}
+\definecharacter twosuperior {\high{2}}
+\definecharacter threesuperior {\high{3}}
+
+\definecharacter textcent {c}
+\definecharacter textcurrency {\unknownchar}
+\definecharacter textdollar {\fakedollar}
+\definecharacter texteuro {E}
+\definecharacter textflorin {\fakeflorin}
+\definecharacter textsterling {\fakesterling}
+\definecharacter textyen {Y}
+
+\definecharacter ordfeminine {\high{\txx a}}
+\definecharacter ordmasculine {\high{\txx o}}
+
+\definecharacter percent {\fakepercent}
+\definecharacter perthousand {\fakeperthousand}
+
+\definecharacter softhyphen 45
+\definecharacter periodcentered {\hbox{\mathematics\cdot}}
+\definecharacter compoundwordmark 23
+
+\definecharacter textasciicircum 94
+\definecharacter textasciitilde 126
+\definecharacter textslash 47
+\definecharacter textbackslash {\tex{}} % todo
+\definecharacter textbraceleft {\mathematics\{}
+\definecharacter textbraceright {\mathematics\}}
+\definecharacter textunderscore {\fakeunderscore}
+\definecharacter textvisiblespace {\fakevisiblespace}
+
+\definecharacter textbrokenbar {\mathematics\vert}
+\definecharacter textbullet {\mathematics\bullet}
+\definecharacter textdag {\mathematics\dag}
+\definecharacter textddag {\mathematics\ddag}
+\definecharacter textdegree {\mathematics{{}^{\circ}}}
+\definecharacter textdiv {\mathematics\div}
+\definecharacter textellipsis {\mathematics\cdots}
+\definecharacter textfraction {\mathematics/}
+\definecharacter textlognot {\mathematics\neg}
+\definecharacter textminus {\mathematics-}
+\definecharacter textmu {\mathematics\mu}
+\definecharacter textmultiply {\mathematics\times}
+\definecharacter textpm {\mathematics\pm}
+
+\definecharacter quotedbl {"}
+\definecharacter quotedblbase {,,}
+\definecharacter quotedblleft {``}
+\definecharacter quotedblright {''}
+
+\definecharacter quotesingle {`}
+\definecharacter quotesinglebase {,}
+
+\definecharacter quoteleft {`}
+\definecharacter quoteright {'}
+
+\definecharacter guilsingleleft {\fakeleftsubguillemot }
+\definecharacter guilsingleright {\fakerightsubguillemot}
+
+\definecharacter leftguillemot {\fakeleftguillemot }
+\definecharacter rightguillemot {\fakerightguillemot}
+
+\definecharacter Acircumflex {\buildtextaccent\textcircumflex A}
+\definecharacter acircumflex {\buildtextaccent\textcircumflex a}
+\definecharacter Ccircumflex {\buildtextaccent\textcircumflex C}
+\definecharacter ccircumflex {\buildtextaccent\textcircumflex c}
+\definecharacter Ecircumflex {\buildtextaccent\textcircumflex E}
+\definecharacter ecircumflex {\buildtextaccent\textcircumflex e}
+\definecharacter Gcircumflex {\buildtextaccent\textcircumflex G}
+\definecharacter gcircumflex {\buildtextaccent\textcircumflex g}
+\definecharacter Hcircumflex {\buildtextaccent\textcircumflex H}
+\definecharacter hcircumflex {\buildtextaccent\textcircumflex h}
+\definecharacter Icircumflex {\buildtextaccent\textcircumflex \dotlessI}
+\definecharacter icircumflex {\buildtextaccent\textcircumflex \dotlessi}
+\definecharacter Jcircumflex {\buildtextaccent\textcircumflex \dotlessJ}
+\definecharacter jcircumflex {\buildtextaccent\textcircumflex \dotlessj}
+\definecharacter Ocircumflex {\buildtextaccent\textcircumflex O}
+\definecharacter ocircumflex {\buildtextaccent\textcircumflex o}
+\definecharacter Scircumflex {\buildtextaccent\textcircumflex S}
+\definecharacter scircumflex {\buildtextaccent\textcircumflex s}
+\definecharacter Ucircumflex {\buildtextaccent\textcircumflex U}
+\definecharacter ucircumflex {\buildtextaccent\textcircumflex u}
+\definecharacter Wcircumflex {\buildtextaccent\textcircumflex W}
+\definecharacter wcircumflex {\buildtextaccent\textcircumflex w}
+\definecharacter Ycircumflex {\buildtextaccent\textcircumflex Y}
+\definecharacter ycircumflex {\buildtextaccent\textcircumflex y}
+
+\definecharacter Agrave {\buildtextaccent\textgrave A}
+\definecharacter agrave {\buildtextaccent\textgrave a}
+\definecharacter Egrave {\buildtextaccent\textgrave E}
+\definecharacter egrave {\buildtextaccent\textgrave e}
+\definecharacter Igrave {\buildtextaccent\textgrave \dotlessI}
+\definecharacter igrave {\buildtextaccent\textgrave \dotlessi}
+\definecharacter Ograve {\buildtextaccent\textgrave O}
+\definecharacter ograve {\buildtextaccent\textgrave o}
+\definecharacter Ugrave {\buildtextaccent\textgrave U}
+\definecharacter ugrave {\buildtextaccent\textgrave u}
+\definecharacter Ygrave {\buildtextaccent\textgrave Y}
+\definecharacter ygrave {\buildtextaccent\textgrave y}
+
+\definecharacter Atilde {\buildtextaccent\texttilde A}
+\definecharacter atilde {\buildtextaccent\texttilde a}
+\definecharacter Itilde {\buildtextaccent\texttilde \dotlessI}
+\definecharacter itilde {\buildtextaccent\texttilde \dotlessi}
+\definecharacter Ntilde {\buildtextaccent\texttilde N}
+\definecharacter ntilde {\buildtextaccent\texttilde n}
+\definecharacter Otilde {\buildtextaccent\texttilde O}
+\definecharacter otilde {\buildtextaccent\texttilde o}
+\definecharacter Utilde {\buildtextaccent\texttilde U}
+\definecharacter utilde {\buildtextaccent\texttilde u}
+\definecharacter Ytilde {\buildtextaccent\texttilde Y}
+\definecharacter ytilde {\buildtextaccent\texttilde y}
+
+\definecharacter Adiaeresis {\buildtextaccent\textdiaeresis A}
+\definecharacter adiaeresis {\buildtextaccent\textdiaeresis a}
+\definecharacter Ediaeresis {\buildtextaccent\textdiaeresis E}
+\definecharacter ediaeresis {\buildtextaccent\textdiaeresis e}
+\definecharacter Idiaeresis {\buildtextaccent\textdiaeresis \dotlessI}
+\definecharacter idiaeresis {\buildtextaccent\textdiaeresis \dotlessi}
+\definecharacter Odiaeresis {\buildtextaccent\textdiaeresis O}
+\definecharacter odiaeresis {\buildtextaccent\textdiaeresis o}
+\definecharacter Udiaeresis {\buildtextaccent\textdiaeresis U}
+\definecharacter udiaeresis {\buildtextaccent\textdiaeresis u}
+\definecharacter Ydiaeresis {\buildtextaccent\textdiaeresis Y}
+\definecharacter ydiaeresis {\buildtextaccent\textdiaeresis y}
+
+\definecharacter Aacute {\buildtextaccent\textacute A}
+\definecharacter aacute {\buildtextaccent\textacute a}
+\definecharacter Cacute {\buildtextaccent\textacute C}
+\definecharacter cacute {\buildtextaccent\textacute c}
+\definecharacter Eacute {\buildtextaccent\textacute E}
+\definecharacter eacute {\buildtextaccent\textacute e}
+\definecharacter Iacute {\buildtextaccent\textacute \dotlessI}
+\definecharacter iacute {\buildtextaccent\textacute \dotlessi}
+\definecharacter Lacute {\buildtextaccent\textacute L}
+\definecharacter lacute {\buildtextaccent\textacute l}
+\definecharacter Nacute {\buildtextaccent\textacute N}
+\definecharacter nacute {\buildtextaccent\textacute n}
+\definecharacter Oacute {\buildtextaccent\textacute O}
+\definecharacter oacute {\buildtextaccent\textacute o}
+\definecharacter Racute {\buildtextaccent\textacute R}
+\definecharacter racute {\buildtextaccent\textacute r}
+\definecharacter Sacute {\buildtextaccent\textacute S}
+\definecharacter sacute {\buildtextaccent\textacute s}
+\definecharacter Uacute {\buildtextaccent\textacute U}
+\definecharacter uacute {\buildtextaccent\textacute u}
+\definecharacter Yacute {\buildtextaccent\textacute Y}
+\definecharacter yacute {\buildtextaccent\textacute y}
+\definecharacter Zacute {\buildtextaccent\textacute Z}
+\definecharacter zacute {\buildtextaccent\textacute z}
+
+%definecharacter Dstroke {D}
+%definecharacter dstroke {d}
+
+\definecharacter dstroke {\pseudoencodeddj}
+\definecharacter Dstroke {\pseudoencodedDJ}
+\definecharacter Hstroke {H}
+\definecharacter hstroke {h}
+\definecharacter Tstroke {T}
+\definecharacter tstroke {t}
+
+\definecharacter Cdotaccent {\buildtextaccent\textdotaccent C}
+\definecharacter cdotaccent {\buildtextaccent\textdotaccent c}
+\definecharacter Edotaccent {\buildtextaccent\textdotaccent E}
+\definecharacter edotaccent {\buildtextaccent\textdotaccent e}
+\definecharacter Gdotaccent {\buildtextaccent\textdotaccent G}
+\definecharacter gdotaccent {\buildtextaccent\textdotaccent g}
+\definecharacter Idotaccent {\buildtextaccent\textdotaccent \dotlessI}
+\definecharacter idotaccent {\buildtextaccent\textdotaccent \dotlessi}
+\definecharacter Zdotaccent {\buildtextaccent\textdotaccent Z}
+\definecharacter zdotaccent {\buildtextaccent\textdotaccent z}
+
+\definecharacter Amacron {\buildtextaccent\textmacron A}
+\definecharacter amacron {\buildtextaccent\textmacron a}
+\definecharacter Emacron {\buildtextaccent\textmacron E}
+\definecharacter emacron {\buildtextaccent\textmacron e}
+\definecharacter Imacron {\buildtextaccent\textmacron \dotlessI}
+\definecharacter imacron {\buildtextaccent\textmacron \dotlessi}
+\definecharacter Omacron {\buildtextaccent\textmacron O}
+\definecharacter omacron {\buildtextaccent\textmacron o}
+\definecharacter Umacron {\buildtextaccent\textmacron U}
+\definecharacter umacron {\buildtextaccent\textmacron u}
+
+\definecharacter Ccedilla {\buildtextcedilla C}
+\definecharacter ccedilla {\buildtextcedilla c}
+\definecharacter Kcedilla {\buildtextcedilla K}
+\definecharacter kcedilla {\buildtextcedilla k}
+\definecharacter Lcedilla {\buildtextcedilla L}
+\definecharacter lcedilla {\buildtextcedilla l}
+\definecharacter Ncedilla {\buildtextcedilla N}
+\definecharacter ncedilla {\buildtextcedilla n}
+\definecharacter Rcedilla {\buildtextcedilla R}
+\definecharacter rcedilla {\buildtextcedilla r}
+\definecharacter Scedilla {\buildtextcedilla S}
+\definecharacter scedilla {\buildtextcedilla s}
+\definecharacter Tcedilla {\buildtextcedilla T}
+\definecharacter tcedilla {\buildtextcedilla t}
+
+\definecharacter Ohungarumlaut {\buildtextaccent\texthungarumlaut O}
+\definecharacter ohungarumlaut {\buildtextaccent\texthungarumlaut o}
+\definecharacter Uhungarumlaut {\buildtextaccent\texthungarumlaut U}
+\definecharacter uhungarumlaut {\buildtextaccent\texthungarumlaut u}
+
+\definecharacter Aogonek {\buildtextogonek A}
+\definecharacter aogonek {\buildtextogonek a}
+\definecharacter Eogonek {\buildtextogonek E}
+\definecharacter eogonek {\buildtextogonek e}
+\definecharacter Iogonek {\buildtextogonek I}
+\definecharacter iogonek {\buildtextogonek i}
+\definecharacter Uogonek {\buildtextogonek U}
+\definecharacter uogonek {\buildtextogonek u}
+
+\definecharacter Aring {\buildtextaccent\textring A}
+\definecharacter aring {\buildtextaccent\textring a}
+\definecharacter Uring {\buildtextaccent\textring U}
+\definecharacter uring {\buildtextaccent\textring u}
+
+\definecharacter Abreve {\buildtextaccent\textbreve A}
+\definecharacter abreve {\buildtextaccent\textbreve a}
+\definecharacter Ebreve {\buildtextaccent\textbreve E}
+\definecharacter ebreve {\buildtextaccent\textbreve e}
+\definecharacter Gbreve {\buildtextaccent\textbreve G}
+\definecharacter gbreve {\buildtextaccent\textbreve g}
+\definecharacter Ibreve {\buildtextaccent\textbreve \dotlessI}
+\definecharacter ibreve {\buildtextaccent\textbreve \dotlessi}
+\definecharacter Obreve {\buildtextaccent\textbreve O}
+\definecharacter obreve {\buildtextaccent\textbreve o}
+\definecharacter Ubreve {\buildtextaccent\textbreve U}
+\definecharacter ubreve {\buildtextaccent\textbreve u}
+
+\definecharacter Ccaron {\buildtextaccent\textcaron C}
+\definecharacter ccaron {\buildtextaccent\textcaron c}
+\definecharacter Dcaron {\buildtextaccent\textcaron D}
+\definecharacter dcaron {\buildtextaccent\textcaron d}
+\definecharacter Ecaron {\buildtextaccent\textcaron E}
+\definecharacter ecaron {\buildtextaccent\textcaron e}
+\definecharacter Lcaron {\buildtextaccent\textcaron L}
+\definecharacter lcaron {\buildtextaccent\textcaron l}
+\definecharacter Ncaron {\buildtextaccent\textcaron N}
+\definecharacter ncaron {\buildtextaccent\textcaron n}
+\definecharacter Rcaron {\buildtextaccent\textcaron R}
+\definecharacter rcaron {\buildtextaccent\textcaron r}
+\definecharacter Scaron {\buildtextaccent\textcaron S}
+\definecharacter scaron {\buildtextaccent\textcaron s}
+\definecharacter Tcaron {\buildtextaccent\textcaron T}
+\definecharacter tcaron {\buildtextaccent\textcaron t}
+\definecharacter Ycaron {\buildtextaccent\textcaron Y}
+\definecharacter ycaron {\buildtextaccent\textcaron y}
+\definecharacter Zcaron {\buildtextaccent\textcaron Z}
+\definecharacter zcaron {\buildtextaccent\textcaron z}
+
+\definecharacter Lstroke {\hsmash{\char32}L}
+\definecharacter lstroke {\hsmash{\char32}l}
+\definecharacter Ostroke {\char31 } % "1F
+\definecharacter ostroke {\char28 } % "1C
+
+\definecharacter aumlaut {\moveaccent{-.1ex}\adiaeresis}
+\definecharacter eumlaut {\moveaccent{-.1ex}\ediaeresis}
+\definecharacter iumlaut {\moveaccent{-.1ex}\idiaeresis}
+\definecharacter oumlaut {\moveaccent{-.1ex}\odiaeresis}
+\definecharacter uumlaut {\moveaccent{-.1ex}\udiaeresis}
+
+\definecharacter Aumlaut {\smashaccent\Adiaeresis}
+\definecharacter Eumlaut {\smashaccent\Ediaeresis}
+\definecharacter Iumlaut {\smashaccent\Idiaeresis}
+\definecharacter Oumlaut {\smashaccent\Odiaeresis}
+\definecharacter Uumlaut {\smashaccent\Udiaeresis}
+
+\definecharacter scommaaccent {\buildtextbottomcomma s}
+\definecharacter Scommaaccent {\buildtextbottomcomma S}
+\definecharacter tcommaaccent {\buildtextbottomcomma t}
+\definecharacter Tcommaaccent {\buildtextbottomcomma T}
+\definecharacter lcommaaccent {\buildtextbottomcomma l}
+\definecharacter Lcommaaccent {\buildtextbottomcomma L}
+
+\definecharacter Etilde {\buildtextaccent\texttilde E}
+\definecharacter etilde {\buildtextaccent\texttilde e}
+
+\definecharacter Ahook {A}
+\definecharacter ahook {a}
+\definecharacter Ehook {E}
+\definecharacter ehook {e}
+\definecharacter Ihook {I}
+\definecharacter ihook {i}
+\definecharacter Ohook {O}
+\definecharacter ohook {o}
+\definecharacter Uhook {U}
+\definecharacter uhook {u}
+\definecharacter Yhook {Y}
+\definecharacter yhook {y}
+
+\definecharacter Acircumflexgrave {\Acircumflex}
+\definecharacter Acircumflexacute {\Acircumflex}
+\definecharacter Acircumflextilde {\Acircumflex}
+\definecharacter Acircumflexhook {\Acircumflex}
+\definecharacter acircumflexgrave {\acircumflex}
+\definecharacter acircumflexacute {\acircumflex}
+\definecharacter acircumflextilde {\acircumflex}
+\definecharacter acircumflexhook {\acircumflex}
+\definecharacter Ecircumflexgrave {\Ecircumflex}
+\definecharacter Ecircumflexacute {\Ecircumflex}
+\definecharacter Ecircumflextilde {\Ecircumflex}
+\definecharacter Ecircumflexhook {\Ecircumflex}
+\definecharacter ecircumflexgrave {\ecircumflex}
+\definecharacter ecircumflexacute {\ecircumflex}
+\definecharacter ecircumflextilde {\ecircumflex}
+\definecharacter ecircumflexhook {\ecircumflex}
+\definecharacter Ocircumflexgrave {\Ocircumflex}
+\definecharacter Ocircumflexacute {\Ocircumflex}
+\definecharacter Ocircumflextilde {\Ocircumflex}
+\definecharacter Ocircumflexhook {\Ocircumflex}
+\definecharacter ocircumflexgrave {\ocircumflex}
+\definecharacter ocircumflexacute {\ocircumflex}
+\definecharacter ocircumflextilde {\ocircumflex}
+\definecharacter ocircumflexhook {\ocircumflex}
+
+\definecharacter Abrevegrave {\Abreve}
+\definecharacter Abreveacute {\Abreve}
+\definecharacter Abrevetilde {\Abreve}
+\definecharacter Abrevehook {\Abreve}
+\definecharacter abrevegrave {\abreve}
+\definecharacter abreveacute {\abreve}
+\definecharacter abrevetilde {\abreve}
+\definecharacter abrevehook {\abreve}
+
+\definecharacter Adotbelow {\buildtextbottomdot A}
+\definecharacter adotbelow {\buildtextbottomdot a}
+\definecharacter Edotbelow {\buildtextbottomdot E}
+\definecharacter edotbelow {\buildtextbottomdot e}
+\definecharacter Idotbelow {\buildtextbottomdot I}
+\definecharacter idotbelow {\buildtextbottomdot i}
+\definecharacter Odotbelow {\buildtextbottomdot O}
+\definecharacter odotbelow {\buildtextbottomdot o}
+\definecharacter Udotbelow {\buildtextbottomdot U}
+\definecharacter udotbelow {\buildtextbottomdot u}
+\definecharacter Ydotbelow {\buildtextbottomdot Y}
+\definecharacter ydotbelow {\buildtextbottomdot y}
+
+\definecharacter Ohorndotbelow {\buildtextbottomdot\Ohorn}
+\definecharacter ohorndotbelow {\buildtextbottomdot\ohorn}
+\definecharacter Uhorndotbelow {\buildtextbottomdot\Uhorn}
+\definecharacter uhorndotbelow {\buildtextbottomdot\uhorn}
+
+\definecharacter Acircumflexdotbelow {\buildtextbottomdot\Acircumflex}
+\definecharacter acircumflexdotbelow {\buildtextbottomdot\acircumflex}
+\definecharacter Ecircumflexdotbelow {\buildtextbottomdot\Ecircumflex}
+\definecharacter ecircumflexdotbelow {\buildtextbottomdot\ecircumflex}
+\definecharacter Ocircumflexdotbelow {\buildtextbottomdot\Ocircumflex}
+\definecharacter ocircumflexdotbelow {\buildtextbottomdot\ocircumflex}
+\definecharacter Abrevedotbelow {\buildtextbottomdot\Abreve}
+\definecharacter abrevedotbelow {\buildtextbottomdot\abreve}
+
+\definecharacter Ohorn {O}
+\definecharacter Ohorngrave {\Ograve}
+\definecharacter Ohornacute {\Oacute}
+\definecharacter Ohorntilde {\Otilde}
+\definecharacter Ohornhook {O}
+\definecharacter ohorn {o}
+\definecharacter ohorngrave {\ograve}
+\definecharacter ohornacute {\oacute}
+\definecharacter ohorntilde {\otilde}
+\definecharacter ohornhook {o}
+\definecharacter Uhorn {U}
+\definecharacter Uhorngrave {\Ugrave}
+\definecharacter Uhornacute {\Uacute}
+\definecharacter Uhorntilde {\Utilde}
+\definecharacter Uhornhook {U}
+\definecharacter uhorn {u}
+\definecharacter uhorngrave {\ugrave}
+\definecharacter uhornacute {\uacute}
+\definecharacter uhorntilde {\utilde}
+\definecharacter uhornhook {u}
+
+\stopencoding
+
+%D Needed for transliterated chinese (provided by Tobias Burnus).
+
+\startencoding[default]
+
+\definecharacter acaron {\buildtextaccent\textcaron a} % U+01CE
+\definecharacter icaron {\buildtextaccent\textcaron \dotlessi} % U+01D0
+\definecharacter ocaron {\buildtextaccent\textcaron o} % U+01D2
+\definecharacter ucaron {\buildtextaccent\textcaron u} % U+01D4
+
+\stopencoding
+
+%D Greek (moved to here):
+
+\startencoding[default]
+
+% Uppercase Greek letters
+
+\definecharacter greekAlpha {\Alpha}
+\definecharacter greekBeta {\Beta}
+\definecharacter greekGamma {\Gamma}
+\definecharacter greekDelta {\Delta}
+\definecharacter greekEpsilon {\Epsilon}
+\definecharacter greekZeta {\Zeta}
+\definecharacter greekEta {\Eta}
+\definecharacter greekTheta {\Theta}
+\definecharacter greekIota {\Iota}
+\definecharacter greekKappa {\Kappa}
+\definecharacter greekLambda {\Lambda}
+\definecharacter greekMu {\Mu}
+\definecharacter greekNu {\Nu}
+\definecharacter greekXi {\Xi}
+\definecharacter greekOmicron {\Omicron}
+\definecharacter greekPi {\Pi}
+\definecharacter greekRho {\Rho}
+\definecharacter greekSigma {\Sigma}
+\definecharacter greekTau {\Tau}
+\definecharacter greekUpsilon {\Upsilon}
+\definecharacter greekPhi {\Phi}
+\definecharacter greekChi {\Chi}
+\definecharacter greekPsi {\Psi}
+\definecharacter greekOmega {\Omega}
+
+% Lowercase Greek letters
+
+\definecharacter greekalpha {\alpha}
+\definecharacter greekbeta {\beta}
+\definecharacter greekgamma {\gamma}
+\definecharacter greekdelta {\delta}
+\definecharacter greekepsilon {\varepsilon}
+\definecharacter greekepsilonalt {\epsilon}
+\definecharacter greekzeta {\zeta}
+\definecharacter greeketa {\eta}
+\definecharacter greektheta {\theta}
+\definecharacter greekthetaalt {\vartheta}
+\definecharacter greekiota {\iota}
+\definecharacter greekkappa {\kappa}
+\definecharacter greeklambda {\lambda}
+\definecharacter greekmu {\mu}
+\definecharacter greeknu {\nu}
+\definecharacter greekxi {\xi}
+\definecharacter greekomicron {\omicron}
+\definecharacter greekpi {\pi}
+\definecharacter greekrho {\rho}
+\definecharacter greeksigma {\sigma}
+\definecharacter greekfinalsigma {\varsigma}
+\definecharacter greektau {\tau}
+\definecharacter greekupsilon {\upsilon}
+\definecharacter greekphi {\varphi}
+\definecharacter greekphialt {\phi}
+\definecharacter greekchi {\chi}
+\definecharacter greekpsi {\psi}
+\definecharacter greekomega {\omega}
+
+% Accented Uppercase Greek letters
+
+\definecharacter greekAlphatonos {'A}
+\definecharacter greekEpsilontonos {'E}
+\definecharacter greekEtatonos {'H}
+\definecharacter greekIotatonos {'I}
+\definecharacter greekOmicrontonos {'O}
+\definecharacter greekUpsilontonos {'U}
+\definecharacter greekOmegatonos {'W}
+\definecharacter greekIotadialytika {"I}
+\definecharacter greekUpsilondialytika {"U}
+
+% Accented Lowercase Greek letters
+
+\definecharacter greekalphatonos {'a}
+\definecharacter greekepsilontonos {'e}
+\definecharacter greeketatonos {'h}
+\definecharacter greekiotatonos {'i}
+\definecharacter greekomicrontonos {'o}
+\definecharacter greekupsilontonos {'u}
+\definecharacter greekomegatonos {'w}
+\definecharacter greekiotadialytika {"i}
+\definecharacter greekupsilondialytika {"u}
+\definecharacter greekiotadialytikatonos {'"i}
+\definecharacter greekupsilondialytikatonos {'"u}
+
+% Miscellaneous Greek symbols
+
+\definecharacter greekleftquot {((}
+\definecharacter greekrightquot {))}
+\definecharacter greektonos {'}
+\definecharacter greekdialytikatonos {'"}
+\definecharacter greekapostrophos {''}
+
+\stopencoding
+
+%D Cyrillic (moved to here):
+
+\startencoding[default]
+
+\definecharacter cyrillicA {A}
+\definecharacter cyrillicB {B}
+\definecharacter cyrillicV {V}
+\definecharacter cyrillicG {G}
+\definecharacter cyrillicD {D}
+\definecharacter cyrillicE {E}
+\definecharacter cyrillicZH {ZH}
+\definecharacter cyrillicZ {Z}
+\definecharacter cyrillicI {I}
+\definecharacter cyrillicISHRT {ISHRT}
+\definecharacter cyrillicK {K}
+\definecharacter cyrillicL {L}
+\definecharacter cyrillicM {M}
+\definecharacter cyrillicN {N}
+\definecharacter cyrillicO {O}
+\definecharacter cyrillicP {P}
+\definecharacter cyrillicR {R}
+\definecharacter cyrillicS {S}
+\definecharacter cyrillicT {T}
+\definecharacter cyrillicU {U}
+\definecharacter cyrillicF {F}
+\definecharacter cyrillicH {H}
+\definecharacter cyrillicC {C}
+\definecharacter cyrillicCH {CH}
+\definecharacter cyrillicSH {SH}
+\definecharacter cyrillicSHCH {SHCH}
+\definecharacter cyrillicHRDSN {HRDSN}
+\definecharacter cyrillicERY {ERY}
+\definecharacter cyrillicSFTSN {SFTSN}
+\definecharacter cyrillicEREV {EREV}
+\definecharacter cyrillicYU {YU}
+\definecharacter cyrillicYA {YA}
+\definecharacter cyrillicGUP {GUP}
+\definecharacter cyrillicGHCRS {GHCRS}
+\definecharacter cyrillicDJE {DJE}
+\definecharacter cyrillicTSHE {TSHE}
+\definecharacter cyrillicSHHA {SHHA}
+\definecharacter cyrillicZHDSC {ZHDSC}
+\definecharacter cyrillicZDSC {ZDSC}
+\definecharacter cyrillicLJE {LJE}
+\definecharacter cyrillicYI {YI}
+\definecharacter cyrillicKDSC {KDSC}
+\definecharacter cyrillicKBEAK {KBEAK}
+\definecharacter cyrillicKVCRS {KVCRS}
+\definecharacter cyrillicAE {AE}
+\definecharacter cyrillicNDSC {NDSC}
+\definecharacter cyrillicNG {NG}
+\definecharacter cyrillicDZE {DZE}
+\definecharacter cyrillicOTLD {OTLD}
+\definecharacter cyrillicSDSC {SDSC}
+\definecharacter cyrillicUSHRT {USHRT}
+\definecharacter cyrillicY {Y}
+\definecharacter cyrillicYHCRS {YHCRS}
+\definecharacter cyrillicHDSC {HDSC}
+\definecharacter cyrillicDZHE {DZHE}
+\definecharacter cyrillicCHVCRS {CHVCRS}
+\definecharacter cyrillicCHRDSC {CHRDSC}
+\definecharacter cyrillicIE {IE}
+\definecharacter cyrillicSCHWA {SCHWA}
+\definecharacter cyrillicNJE {NJE}
+\definecharacter cyrillicYO {YO}
+\definecharacter cyrillicII {II}
+\definecharacter cyrillicJE {JE}
+\definecharacter cyrillicQ {Q}
+\definecharacter cyrillicW {W}
+
+\definecharacter cyrillica {a}
+\definecharacter cyrillicb {b}
+\definecharacter cyrillicv {v}
+\definecharacter cyrillicg {g}
+\definecharacter cyrillicd {d}
+\definecharacter cyrillice {e}
+\definecharacter cyrilliczh {zh}
+\definecharacter cyrillicz {z}
+\definecharacter cyrillici {i}
+\definecharacter cyrillicishrt {ishrt}
+\definecharacter cyrillick {k}
+\definecharacter cyrillicl {l}
+\definecharacter cyrillicm {m}
+\definecharacter cyrillicn {n}
+\definecharacter cyrillico {o}
+\definecharacter cyrillicp {p}
+\definecharacter cyrillicr {r}
+\definecharacter cyrillics {s}
+\definecharacter cyrillict {t}
+\definecharacter cyrillicu {u}
+\definecharacter cyrillicf {f}
+\definecharacter cyrillich {h}
+\definecharacter cyrillicc {c}
+\definecharacter cyrillicch {ch}
+\definecharacter cyrillicsh {sh}
+\definecharacter cyrillicshch {shch}
+\definecharacter cyrillichrdsn {hrdsn}
+\definecharacter cyrillicery {ery}
+\definecharacter cyrillicsftsn {sftsn}
+\definecharacter cyrillicerev {erev}
+\definecharacter cyrillicyu {yu}
+\definecharacter cyrillicya {ya}
+\definecharacter cyrillicgup {gup}
+\definecharacter cyrillicghcrs {ghcrs}
+\definecharacter cyrillicdje {dje}
+\definecharacter cyrillictshe {tshe}
+\definecharacter cyrillicshha {shha}
+\definecharacter cyrilliczhdsc {zhdsc}
+\definecharacter cyrilliczdsc {zdsc}
+\definecharacter cyrilliclje {lje}
+\definecharacter cyrillicyi {yi}
+\definecharacter cyrillickdsc {kdsc}
+\definecharacter cyrillickbeak {kbeak}
+\definecharacter cyrillickvcrs {kvcrs}
+\definecharacter cyrillicae {ae}
+\definecharacter cyrillicndsc {ndsc}
+\definecharacter cyrillicng {ng}
+\definecharacter cyrillicdze {dze}
+\definecharacter cyrillicotld {otld}
+\definecharacter cyrillicsdsc {sdsc}
+\definecharacter cyrillicushrt {ushrt}
+\definecharacter cyrillicy {y}
+\definecharacter cyrillicyhcrs {yhcrs}
+\definecharacter cyrillichdsc {hdsc}
+\definecharacter cyrillicdzhe {dzhe}
+\definecharacter cyrillicchvcrs {chvcrs}
+\definecharacter cyrillicchrdsc {chrdsc}
+\definecharacter cyrillicie {ie}
+\definecharacter cyrillicschwa {schwa}
+\definecharacter cyrillicnje {nje}
+\definecharacter cyrillicyo {yo}
+\definecharacter cyrillicii {ii}
+\definecharacter cyrillicje {je}
+\definecharacter cyrillicq {q}
+\definecharacter cyrillicw {w}
+
+\definecharacter cyrillicGJE {\'\cyrillicG}
+\definecharacter cyrillicgje {\'\cyrillicg}
+\definecharacter cyrillicKJE {\'\cyrillicK}
+\definecharacter cyrillickje {\'\cyrillick}
+
+\stopencoding
+
+\def\cyrillicio{\cyrillicyo}
+\def\cyrillicIO{\cyrillicYO}
+
+%D Hebrew:
+
+\startencoding[default]
+
+\definecharacter hebrewAlef {'}
+\definecharacter hebrewBet {b}
+\definecharacter hebrewGimel {g}
+\definecharacter hebrewDalet {d}
+\definecharacter hebrewHe {h}
+\definecharacter hebrewVav {w}
+\definecharacter hebrewZayin {z}
+\definecharacter hebrewHet {\hstroke}
+\definecharacter hebrewTet {\tcedilla}
+\definecharacter hebrewYod {y}
+\definecharacter hebrewKaffinal {k}
+\definecharacter hebrewKaf {k}
+\definecharacter hebrewLamed {l}
+\definecharacter hebrewMemfinal {m}
+\definecharacter hebrewMem {m}
+\definecharacter hebrewNunfinal {n}
+\definecharacter hebrewNun {n}
+\definecharacter hebrewSamekh {s}
+\definecharacter hebrewAyin {\gdotaccent}
+\definecharacter hebrewPefinal {p}
+\definecharacter hebrewPe {p}
+\definecharacter hebrewTsadifinal {\scedilla}
+\definecharacter hebrewTsadi {\scedilla}
+\definecharacter hebrewQof {q}
+\definecharacter hebrewResh {r}
+\definecharacter hebrewShin {\scaron}
+\definecharacter hebrewTav {th}
+
+\stopencoding
+
+%D A few goodies:
+
+\def\eszett{\ssharp}
+\def\Eszett{\Ssharp}
+
+\def\lslash{\lstroke}
+\def\Lslash{\Lstroke}
+\def\dslash{\dstroke}
+\def\Dslash{\Dstroke}
+\def\oslash{\ostroke}
+\def\Oslash{\Ostroke}
+
+\def\dcroat{\dstroke}
+\def\Dcroat{\Dstroke}
+
+% \startencoding [default]
+%
+% \definecharacter scommaaccent {\scedilla}
+% \definecharacter Scommaaccent {\Scedilla}
+% \definecharacter tcommaaccent {\tcedilla}
+% \definecharacter Tcommaaccent {\Tcedilla}
+%
+% \stopencoding
+
+% for plain tex's sake
+
+\def\S {\sectionmark }
+\def\P {\paragraphmark}
+
+% for latex users sake
+
+\def\textS {\sectionmark }
+\def\textP {\paragraphmark}
+
+% for old times sake
+
+\def\florin {\textflorin } \def\florijn{\textflorin}
+\def\dollar {\textdollar }
+\def\pound {\textsterling}
+\def\sterling{\textsterling}
+
+% idem
+
+\def\promille{\perthousand}
+\def\permille{\perthousand}
+\def\procent {\percent }
+\def\permine {\fakepermine}
+
+% some more
+
+\def\hyphen {\softhyphen}
+\def\cwm {\compoundwordmark}
+\def\nonbreakinghyphen {\hyphen}
+\def\breakinghyphen {\hyphen\prewordbreak}
+
+% quotes
+
+\def\lowerleftsingleninequote {\quotesinglebase}
+\def\lowerleftdoubleninequote {\quotedblbase}
+\def\lowerrightsingleninequote {\quotesinglebase}
+\def\lowerrightdoubleninequote {\quotedblbase}
+
+\def\upperleftsingleninequote {\quoteright}
+\def\upperleftdoubleninequote {\quotedblright}
+\def\upperrightsingleninequote {\quoteright}
+\def\upperrightdoubleninequote {\quotedblright}
+
+\def\upperleftsinglesixquote {\quoteleft}
+\def\upperleftdoublesixquote {\quotedblleft}
+\def\upperrightsinglesixquote {\quoteleft}
+\def\upperrightdoublesixquote {\quotedblleft}
+
+\def\leftsubguillemot {\guilsingleleft}
+\def\rightsubguillemot {\guilsingleright}
+
+%D A couple of fallbacks suggestion by users, slightly
+%D adapted and obscured by memory saving hacks.
+
+\unprotect
+
+\startencoding[default]
+
+\definecharacter textcent {c\rlap{\hskip-.2\s!em
+ \vrule\!!width.2\s!pt\!!height1.2\s!ex\!!depth.2\s!ex}}
+
+\definecharacter texteuro {C\rlap{\hskip-.75\s!em
+ \vrule\!!width.4\s!em\!!height.85\s!ex\!!depth-.8\s!ex}}
+
+\definecharacter textblacksquare {\dontleavehmode\hbox{%
+ \vrule\!!width.3\s!em\!!height.4\s!em\!!depth-.1\s!em}}
+
+\definecharacter textbrokenbar {\dontleavehmode\hbox{\kern.05\s!em
+ \vrule\!!width.4\s!pt\!!height1.8\s!ex\!!depth-.85\s!ex
+ \llap{%
+ \vrule\!!width.4\s!pt\!!height.35\s!ex\!!depth.6\s!ex}%
+ \kern.05\s!em}}
+
+\stopencoding
+
+\protect
+
+%D We also use symbolic names for math accents.
+
+\startencoding[default]
+
+\definecharacter mathacute "7013
+\definecharacter mathgrave "7012
+\definecharacter mathddot "707F
+\definecharacter mathtilde "707E
+\definecharacter mathbar "7016
+\definecharacter mathbreve "7015
+\definecharacter mathcheck "7014
+\definecharacter mathhat "705E
+\definecharacter mathvec "017E
+\definecharacter mathdot "705F
+\definecharacter mathwidetilde "0365
+\definecharacter mathwidehat "0362
+
+\stopencoding
+
+% \startencoding [default]
+
+% \definecommand prime {\mathematics{'}}
+% \definecommand doubleprime {\mathematics{''}}
+% \definecommand tripleprime {\mathematics{'''}}
+
+% \stopencoding
+
+\ifx\zdot\undefined \def\zdot{\zdotaccent} \fi
+\ifx\Zdot\undefined \def\Zdot{\Zdotaccent} \fi
+
+\ifx\greeklamda\undefined \def\greeklamda{\greeklambda} \fi
+\ifx\greekLamda\undefined \def\greekLamda{\greekLambda} \fi
+
+\ifx\leftguillemet \undefined \def\leftguillemet {\leftguillemot } \fi
+\ifx\rightguillemet\undefined \def\rightguillemet{\rightguillemot} \fi
+
+%D New:
+
+\startencoding[\s!default]
+
+\definecharacter schwa {\hbox{\rotate[\c!rotation=180,\c!location=\v!high]{\hbox{e}}}}
+\definecharacter schwagrave {\buildtextgrave\schwa}
+
+\stopencoding
+
+%D Also new, from Taco, for Mojca, who wanted another 8~regimes.
+
+\startencoding[\s!default]
+
+\definecharacter texthorizontalbar {{\endash\kern\zeropoint\endash}}
+\definecharacter textdong {\underbar{\dstroke}}
+
+\stopencoding
+
+%D Goodie (makes more sense):
+
+\def\normalcontrolspace
+ {\getglyph{ComputerModernMono}{\char32}}
+
+\def\fakedcontrolspace % can be virtual in luatex
+ {\dontleavehmode\hbox
+ {\scratchdimen.1ex%
+ \kern\scratchdimen
+ \vrule \!!width\scratchdimen \!!height5.5\scratchdimen \!!depth3\scratchdimen
+ \vrule \!!width\dimexpr.5em-4\scratchdimen\relax \!!height-2\scratchdimen \!!depth3\scratchdimen
+ \vrule \!!width\scratchdimen \!!height5.5\scratchdimen \!!depth3\scratchdimen
+ \kern\scratchdimen}}
+
+\def\fakecontrolspace{\let\normalcontrolspace\fakedcontrolspace}
+
+\endinput
diff --git a/tex/context/base/enco-def.tex b/tex/context/base/enco-def.tex
deleted file mode 100644
index b6d66bb6c..000000000
--- a/tex/context/base/enco-def.tex
+++ /dev/null
@@ -1,920 +0,0 @@
-%D \module
-%D [ file=enco-def,
-%D version=2000.05.07, % 2000.20.12, % split from less verbose base file
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Default Character Definitions,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D Instead of overloading plain \TEX\ macros (and keeping them
-%D available as an escape), we now use the more verbose
-%D definitions in this file. Since memory is less a problem
-%D these days, this verbosity has only a small price, but we
-%D gain readability. The following definitions are based on
-%D usage of the the original \TEX\ fonts, where composed
-%D characters were not part of the design. So, occasionally
-%D we have to revert to hacks. Thanks to all those users who
-%D helped me to fill in the details.
-
-\startencoding[default]
-
-\definecharacter textcomma ,
-\definecharacter textperiod .
-
-\definecharacter textacute 19
-\definecharacter textbottomdot 46
-\definecharacter textbreve 21
-\definecharacter textcaron 20
-\definecharacter textcedilla 24
-\definecharacter textcircumflex 94
-\definecharacter textdiaeresis 127
-\definecharacter textdotaccent 95
-\definecharacter textgrave 18
-\definecharacter texthungarumlaut 125
-\definecharacter textmacron 22
-\definecharacter textogonek 24 % fake
-\definecharacter textring 23
-\definecharacter texttilde 126
-
-\definecharacter textbottomcomma {\hbox{\lower.35ex\hbox{\tx,}}} % for mojca
-
-\definecharacter dotlessi {\char"10 }
-\definecharacter dotlessj {\char"11 }
-\definecharacter dotlessI {I}
-\definecharacter dotlessJ {J}
-
-\definecharacter endash 123
-\definecharacter emdash 124
-
-\definecharacter aeligature {\char26 } % "1A
-\definecharacter AEligature {\char29 } % "1D
-\definecharacter ijligature {ij}
-\definecharacter IJligature {IJ}
-\definecharacter oeligature {\char27 } % "1B
-\definecharacter OEligature {\char30 } % "1E
-
-\definecharacter ssharp {\char25 } % "19
-\definecharacter Ssharp {SS}
-
-\definecharacter thorn {\unknownchar}
-\definecharacter Thorn {\unknownchar}
-
-\definecharacter eth {\unknownchar} % mojca prefers this (was \dstroke)
-%definecharacter Eth {\unknownchar}
-\definecharacter Eth {\Dstroke} % mojca prefers this too
-
-\definecharacter exclamdown 60
-\definecharacter questiondown 62
-
-\definecharacter copyright {\encircled{\txx C}}
-\definecharacter registered {\encircled{\txx R}}
-\definecharacter trademark {\high{\txx TM}}
-
-\definecharacter sectionmark {\mathematics{\mathhexbox278}}
-\definecharacter paragraphmark {\mathematics{\mathhexbox27B}}
-
-\definecharacter onequarter {\vulgarfraction{1}{4}}
-\definecharacter onehalf {\vulgarfraction{1}{2}}
-\definecharacter threequarter {\vulgarfraction{3}{4}}
-
-\definecharacter onesuperior {\high{1}}
-\definecharacter twosuperior {\high{2}}
-\definecharacter threesuperior {\high{3}}
-
-\definecharacter textcent {c}
-\definecharacter textcurrency {\unknownchar}
-\definecharacter textdollar {\fakedollar}
-\definecharacter texteuro {E}
-\definecharacter textflorin {\fakeflorin}
-\definecharacter textsterling {\fakesterling}
-\definecharacter textyen {Y}
-
-\definecharacter ordfeminine {\high{\txx a}}
-\definecharacter ordmasculine {\high{\txx o}}
-
-\definecharacter percent {\fakepercent}
-\definecharacter perthousand {\fakeperthousand}
-
-\definecharacter softhyphen 45
-\definecharacter periodcentered {\hbox{\mathematics\cdot}}
-\definecharacter compoundwordmark 23
-
-\definecharacter textasciicircum 94
-\definecharacter textasciitilde 126
-\definecharacter textslash 47
-\definecharacter textbackslash {\tex{}} % todo
-\definecharacter textbraceleft {\mathematics\{}
-\definecharacter textbraceright {\mathematics\}}
-\definecharacter textunderscore {\fakeunderscore}
-\definecharacter textvisiblespace {\fakevisiblespace}
-
-\definecharacter textbrokenbar {\mathematics\vert}
-\definecharacter textbullet {\mathematics\bullet}
-\definecharacter textdag {\mathematics\dag}
-\definecharacter textddag {\mathematics\ddag}
-\definecharacter textdegree {\mathematics{{}^{\circ}}}
-\definecharacter textdiv {\mathematics\div}
-\definecharacter textellipsis {\mathematics\cdots}
-\definecharacter textfraction {\mathematics/}
-\definecharacter textlognot {\mathematics\neg}
-\definecharacter textminus {\mathematics-}
-\definecharacter textmu {\mathematics\mu}
-\definecharacter textmultiply {\mathematics\times}
-\definecharacter textpm {\mathematics\pm}
-
-\definecharacter quotedbl {"}
-\definecharacter quotedblbase {,,}
-\definecharacter quotedblleft {``}
-\definecharacter quotedblright {''}
-
-\definecharacter quotesingle {`}
-\definecharacter quotesinglebase {,}
-
-\definecharacter quoteleft {`}
-\definecharacter quoteright {'}
-
-\definecharacter guilsingleleft {\fakeleftsubguillemot }
-\definecharacter guilsingleright {\fakerightsubguillemot}
-
-\definecharacter leftguillemot {\fakeleftguillemot }
-\definecharacter rightguillemot {\fakerightguillemot}
-
-\definecharacter Acircumflex {\buildtextaccent\textcircumflex A}
-\definecharacter acircumflex {\buildtextaccent\textcircumflex a}
-\definecharacter Ccircumflex {\buildtextaccent\textcircumflex C}
-\definecharacter ccircumflex {\buildtextaccent\textcircumflex c}
-\definecharacter Ecircumflex {\buildtextaccent\textcircumflex E}
-\definecharacter ecircumflex {\buildtextaccent\textcircumflex e}
-\definecharacter Gcircumflex {\buildtextaccent\textcircumflex G}
-\definecharacter gcircumflex {\buildtextaccent\textcircumflex g}
-\definecharacter Hcircumflex {\buildtextaccent\textcircumflex H}
-\definecharacter hcircumflex {\buildtextaccent\textcircumflex h}
-\definecharacter Icircumflex {\buildtextaccent\textcircumflex \dotlessI}
-\definecharacter icircumflex {\buildtextaccent\textcircumflex \dotlessi}
-\definecharacter Jcircumflex {\buildtextaccent\textcircumflex \dotlessJ}
-\definecharacter jcircumflex {\buildtextaccent\textcircumflex \dotlessj}
-\definecharacter Ocircumflex {\buildtextaccent\textcircumflex O}
-\definecharacter ocircumflex {\buildtextaccent\textcircumflex o}
-\definecharacter Scircumflex {\buildtextaccent\textcircumflex S}
-\definecharacter scircumflex {\buildtextaccent\textcircumflex s}
-\definecharacter Ucircumflex {\buildtextaccent\textcircumflex U}
-\definecharacter ucircumflex {\buildtextaccent\textcircumflex u}
-\definecharacter Wcircumflex {\buildtextaccent\textcircumflex W}
-\definecharacter wcircumflex {\buildtextaccent\textcircumflex w}
-\definecharacter Ycircumflex {\buildtextaccent\textcircumflex Y}
-\definecharacter ycircumflex {\buildtextaccent\textcircumflex y}
-
-\definecharacter Agrave {\buildtextaccent\textgrave A}
-\definecharacter agrave {\buildtextaccent\textgrave a}
-\definecharacter Egrave {\buildtextaccent\textgrave E}
-\definecharacter egrave {\buildtextaccent\textgrave e}
-\definecharacter Igrave {\buildtextaccent\textgrave \dotlessI}
-\definecharacter igrave {\buildtextaccent\textgrave \dotlessi}
-\definecharacter Ograve {\buildtextaccent\textgrave O}
-\definecharacter ograve {\buildtextaccent\textgrave o}
-\definecharacter Ugrave {\buildtextaccent\textgrave U}
-\definecharacter ugrave {\buildtextaccent\textgrave u}
-\definecharacter Ygrave {\buildtextaccent\textgrave Y}
-\definecharacter ygrave {\buildtextaccent\textgrave y}
-
-\definecharacter Atilde {\buildtextaccent\texttilde A}
-\definecharacter atilde {\buildtextaccent\texttilde a}
-\definecharacter Itilde {\buildtextaccent\texttilde \dotlessI}
-\definecharacter itilde {\buildtextaccent\texttilde \dotlessi}
-\definecharacter Ntilde {\buildtextaccent\texttilde N}
-\definecharacter ntilde {\buildtextaccent\texttilde n}
-\definecharacter Otilde {\buildtextaccent\texttilde O}
-\definecharacter otilde {\buildtextaccent\texttilde o}
-\definecharacter Utilde {\buildtextaccent\texttilde U}
-\definecharacter utilde {\buildtextaccent\texttilde u}
-\definecharacter Ytilde {\buildtextaccent\texttilde Y}
-\definecharacter ytilde {\buildtextaccent\texttilde y}
-
-\definecharacter Adiaeresis {\buildtextaccent\textdiaeresis A}
-\definecharacter adiaeresis {\buildtextaccent\textdiaeresis a}
-\definecharacter Ediaeresis {\buildtextaccent\textdiaeresis E}
-\definecharacter ediaeresis {\buildtextaccent\textdiaeresis e}
-\definecharacter Idiaeresis {\buildtextaccent\textdiaeresis \dotlessI}
-\definecharacter idiaeresis {\buildtextaccent\textdiaeresis \dotlessi}
-\definecharacter Odiaeresis {\buildtextaccent\textdiaeresis O}
-\definecharacter odiaeresis {\buildtextaccent\textdiaeresis o}
-\definecharacter Udiaeresis {\buildtextaccent\textdiaeresis U}
-\definecharacter udiaeresis {\buildtextaccent\textdiaeresis u}
-\definecharacter Ydiaeresis {\buildtextaccent\textdiaeresis Y}
-\definecharacter ydiaeresis {\buildtextaccent\textdiaeresis y}
-
-\definecharacter Aacute {\buildtextaccent\textacute A}
-\definecharacter aacute {\buildtextaccent\textacute a}
-\definecharacter Cacute {\buildtextaccent\textacute C}
-\definecharacter cacute {\buildtextaccent\textacute c}
-\definecharacter Eacute {\buildtextaccent\textacute E}
-\definecharacter eacute {\buildtextaccent\textacute e}
-\definecharacter Iacute {\buildtextaccent\textacute \dotlessI}
-\definecharacter iacute {\buildtextaccent\textacute \dotlessi}
-\definecharacter Lacute {\buildtextaccent\textacute L}
-\definecharacter lacute {\buildtextaccent\textacute l}
-\definecharacter Nacute {\buildtextaccent\textacute N}
-\definecharacter nacute {\buildtextaccent\textacute n}
-\definecharacter Oacute {\buildtextaccent\textacute O}
-\definecharacter oacute {\buildtextaccent\textacute o}
-\definecharacter Racute {\buildtextaccent\textacute R}
-\definecharacter racute {\buildtextaccent\textacute r}
-\definecharacter Sacute {\buildtextaccent\textacute S}
-\definecharacter sacute {\buildtextaccent\textacute s}
-\definecharacter Uacute {\buildtextaccent\textacute U}
-\definecharacter uacute {\buildtextaccent\textacute u}
-\definecharacter Yacute {\buildtextaccent\textacute Y}
-\definecharacter yacute {\buildtextaccent\textacute y}
-\definecharacter Zacute {\buildtextaccent\textacute Z}
-\definecharacter zacute {\buildtextaccent\textacute z}
-
-%definecharacter Dstroke {D}
-%definecharacter dstroke {d}
-
-\definecharacter dstroke {\pseudoencodeddj}
-\definecharacter Dstroke {\pseudoencodedDJ}
-\definecharacter Hstroke {H}
-\definecharacter hstroke {h}
-\definecharacter Tstroke {T}
-\definecharacter tstroke {t}
-
-\definecharacter Cdotaccent {\buildtextaccent\textdotaccent C}
-\definecharacter cdotaccent {\buildtextaccent\textdotaccent c}
-\definecharacter Edotaccent {\buildtextaccent\textdotaccent E}
-\definecharacter edotaccent {\buildtextaccent\textdotaccent e}
-\definecharacter Gdotaccent {\buildtextaccent\textdotaccent G}
-\definecharacter gdotaccent {\buildtextaccent\textdotaccent g}
-\definecharacter Idotaccent {\buildtextaccent\textdotaccent \dotlessI}
-\definecharacter idotaccent {\buildtextaccent\textdotaccent \dotlessi}
-\definecharacter Zdotaccent {\buildtextaccent\textdotaccent Z}
-\definecharacter zdotaccent {\buildtextaccent\textdotaccent z}
-
-\definecharacter Amacron {\buildtextaccent\textmacron A}
-\definecharacter amacron {\buildtextaccent\textmacron a}
-\definecharacter Emacron {\buildtextaccent\textmacron E}
-\definecharacter emacron {\buildtextaccent\textmacron e}
-\definecharacter Imacron {\buildtextaccent\textmacron \dotlessI}
-\definecharacter imacron {\buildtextaccent\textmacron \dotlessi}
-\definecharacter Omacron {\buildtextaccent\textmacron O}
-\definecharacter omacron {\buildtextaccent\textmacron o}
-\definecharacter Umacron {\buildtextaccent\textmacron U}
-\definecharacter umacron {\buildtextaccent\textmacron u}
-
-\definecharacter Ccedilla {\buildtextcedilla C}
-\definecharacter ccedilla {\buildtextcedilla c}
-\definecharacter Kcedilla {\buildtextcedilla K}
-\definecharacter kcedilla {\buildtextcedilla k}
-\definecharacter Lcedilla {\buildtextcedilla L}
-\definecharacter lcedilla {\buildtextcedilla l}
-\definecharacter Ncedilla {\buildtextcedilla N}
-\definecharacter ncedilla {\buildtextcedilla n}
-\definecharacter Rcedilla {\buildtextcedilla R}
-\definecharacter rcedilla {\buildtextcedilla r}
-\definecharacter Scedilla {\buildtextcedilla S}
-\definecharacter scedilla {\buildtextcedilla s}
-\definecharacter Tcedilla {\buildtextcedilla T}
-\definecharacter tcedilla {\buildtextcedilla t}
-
-\definecharacter Ohungarumlaut {\buildtextaccent\texthungarumlaut O}
-\definecharacter ohungarumlaut {\buildtextaccent\texthungarumlaut o}
-\definecharacter Uhungarumlaut {\buildtextaccent\texthungarumlaut U}
-\definecharacter uhungarumlaut {\buildtextaccent\texthungarumlaut u}
-
-\definecharacter Aogonek {\buildtextogonek A}
-\definecharacter aogonek {\buildtextogonek a}
-\definecharacter Eogonek {\buildtextogonek E}
-\definecharacter eogonek {\buildtextogonek e}
-\definecharacter Iogonek {\buildtextogonek I}
-\definecharacter iogonek {\buildtextogonek i}
-\definecharacter Uogonek {\buildtextogonek U}
-\definecharacter uogonek {\buildtextogonek u}
-
-\definecharacter Aring {\buildtextaccent\textring A}
-\definecharacter aring {\buildtextaccent\textring a}
-\definecharacter Uring {\buildtextaccent\textring U}
-\definecharacter uring {\buildtextaccent\textring u}
-
-\definecharacter Abreve {\buildtextaccent\textbreve A}
-\definecharacter abreve {\buildtextaccent\textbreve a}
-\definecharacter Ebreve {\buildtextaccent\textbreve E}
-\definecharacter ebreve {\buildtextaccent\textbreve e}
-\definecharacter Gbreve {\buildtextaccent\textbreve G}
-\definecharacter gbreve {\buildtextaccent\textbreve g}
-\definecharacter Ibreve {\buildtextaccent\textbreve \dotlessI}
-\definecharacter ibreve {\buildtextaccent\textbreve \dotlessi}
-\definecharacter Obreve {\buildtextaccent\textbreve O}
-\definecharacter obreve {\buildtextaccent\textbreve o}
-\definecharacter Ubreve {\buildtextaccent\textbreve U}
-\definecharacter ubreve {\buildtextaccent\textbreve u}
-
-\definecharacter Ccaron {\buildtextaccent\textcaron C}
-\definecharacter ccaron {\buildtextaccent\textcaron c}
-\definecharacter Dcaron {\buildtextaccent\textcaron D}
-\definecharacter dcaron {\buildtextaccent\textcaron d}
-\definecharacter Ecaron {\buildtextaccent\textcaron E}
-\definecharacter ecaron {\buildtextaccent\textcaron e}
-\definecharacter Lcaron {\buildtextaccent\textcaron L}
-\definecharacter lcaron {\buildtextaccent\textcaron l}
-\definecharacter Ncaron {\buildtextaccent\textcaron N}
-\definecharacter ncaron {\buildtextaccent\textcaron n}
-\definecharacter Rcaron {\buildtextaccent\textcaron R}
-\definecharacter rcaron {\buildtextaccent\textcaron r}
-\definecharacter Scaron {\buildtextaccent\textcaron S}
-\definecharacter scaron {\buildtextaccent\textcaron s}
-\definecharacter Tcaron {\buildtextaccent\textcaron T}
-\definecharacter tcaron {\buildtextaccent\textcaron t}
-\definecharacter Ycaron {\buildtextaccent\textcaron Y}
-\definecharacter ycaron {\buildtextaccent\textcaron y}
-\definecharacter Zcaron {\buildtextaccent\textcaron Z}
-\definecharacter zcaron {\buildtextaccent\textcaron z}
-
-\definecharacter Lstroke {\hsmash{\char32}L}
-\definecharacter lstroke {\hsmash{\char32}l}
-\definecharacter Ostroke {\char31 } % "1F
-\definecharacter ostroke {\char28 } % "1C
-
-\definecharacter aumlaut {\moveaccent{-.1ex}\adiaeresis}
-\definecharacter eumlaut {\moveaccent{-.1ex}\ediaeresis}
-\definecharacter iumlaut {\moveaccent{-.1ex}\idiaeresis}
-\definecharacter oumlaut {\moveaccent{-.1ex}\odiaeresis}
-\definecharacter uumlaut {\moveaccent{-.1ex}\udiaeresis}
-
-\definecharacter Aumlaut {\smashaccent\Adiaeresis}
-\definecharacter Eumlaut {\smashaccent\Ediaeresis}
-\definecharacter Iumlaut {\smashaccent\Idiaeresis}
-\definecharacter Oumlaut {\smashaccent\Odiaeresis}
-\definecharacter Uumlaut {\smashaccent\Udiaeresis}
-
-\definecharacter scommaaccent {\buildtextbottomcomma s}
-\definecharacter Scommaaccent {\buildtextbottomcomma S}
-\definecharacter tcommaaccent {\buildtextbottomcomma t}
-\definecharacter Tcommaaccent {\buildtextbottomcomma T}
-\definecharacter lcommaaccent {\buildtextbottomcomma l}
-\definecharacter Lcommaaccent {\buildtextbottomcomma L}
-
-\definecharacter Etilde {\buildtextaccent\texttilde E}
-\definecharacter etilde {\buildtextaccent\texttilde e}
-
-\definecharacter Ahook {A}
-\definecharacter ahook {a}
-\definecharacter Ehook {E}
-\definecharacter ehook {e}
-\definecharacter Ihook {I}
-\definecharacter ihook {i}
-\definecharacter Ohook {O}
-\definecharacter ohook {o}
-\definecharacter Uhook {U}
-\definecharacter uhook {u}
-\definecharacter Yhook {Y}
-\definecharacter yhook {y}
-
-\definecharacter Acircumflexgrave {\Acircumflex}
-\definecharacter Acircumflexacute {\Acircumflex}
-\definecharacter Acircumflextilde {\Acircumflex}
-\definecharacter Acircumflexhook {\Acircumflex}
-\definecharacter acircumflexgrave {\acircumflex}
-\definecharacter acircumflexacute {\acircumflex}
-\definecharacter acircumflextilde {\acircumflex}
-\definecharacter acircumflexhook {\acircumflex}
-\definecharacter Ecircumflexgrave {\Ecircumflex}
-\definecharacter Ecircumflexacute {\Ecircumflex}
-\definecharacter Ecircumflextilde {\Ecircumflex}
-\definecharacter Ecircumflexhook {\Ecircumflex}
-\definecharacter ecircumflexgrave {\ecircumflex}
-\definecharacter ecircumflexacute {\ecircumflex}
-\definecharacter ecircumflextilde {\ecircumflex}
-\definecharacter ecircumflexhook {\ecircumflex}
-\definecharacter Ocircumflexgrave {\Ocircumflex}
-\definecharacter Ocircumflexacute {\Ocircumflex}
-\definecharacter Ocircumflextilde {\Ocircumflex}
-\definecharacter Ocircumflexhook {\Ocircumflex}
-\definecharacter ocircumflexgrave {\ocircumflex}
-\definecharacter ocircumflexacute {\ocircumflex}
-\definecharacter ocircumflextilde {\ocircumflex}
-\definecharacter ocircumflexhook {\ocircumflex}
-
-\definecharacter Abrevegrave {\Abreve}
-\definecharacter Abreveacute {\Abreve}
-\definecharacter Abrevetilde {\Abreve}
-\definecharacter Abrevehook {\Abreve}
-\definecharacter abrevegrave {\abreve}
-\definecharacter abreveacute {\abreve}
-\definecharacter abrevetilde {\abreve}
-\definecharacter abrevehook {\abreve}
-
-\definecharacter Adotbelow {\buildtextbottomdot A}
-\definecharacter adotbelow {\buildtextbottomdot a}
-\definecharacter Edotbelow {\buildtextbottomdot E}
-\definecharacter edotbelow {\buildtextbottomdot e}
-\definecharacter Idotbelow {\buildtextbottomdot I}
-\definecharacter idotbelow {\buildtextbottomdot i}
-\definecharacter Odotbelow {\buildtextbottomdot O}
-\definecharacter odotbelow {\buildtextbottomdot o}
-\definecharacter Udotbelow {\buildtextbottomdot U}
-\definecharacter udotbelow {\buildtextbottomdot u}
-\definecharacter Ydotbelow {\buildtextbottomdot Y}
-\definecharacter ydotbelow {\buildtextbottomdot y}
-
-\definecharacter Ohorndotbelow {\buildtextbottomdot\Ohorn}
-\definecharacter ohorndotbelow {\buildtextbottomdot\ohorn}
-\definecharacter Uhorndotbelow {\buildtextbottomdot\Uhorn}
-\definecharacter uhorndotbelow {\buildtextbottomdot\uhorn}
-
-\definecharacter Acircumflexdotbelow {\buildtextbottomdot\Acircumflex}
-\definecharacter acircumflexdotbelow {\buildtextbottomdot\acircumflex}
-\definecharacter Ecircumflexdotbelow {\buildtextbottomdot\Ecircumflex}
-\definecharacter ecircumflexdotbelow {\buildtextbottomdot\ecircumflex}
-\definecharacter Ocircumflexdotbelow {\buildtextbottomdot\Ocircumflex}
-\definecharacter ocircumflexdotbelow {\buildtextbottomdot\ocircumflex}
-\definecharacter Abrevedotbelow {\buildtextbottomdot\Abreve}
-\definecharacter abrevedotbelow {\buildtextbottomdot\abreve}
-
-\definecharacter Ohorn {O}
-\definecharacter Ohorngrave {\Ograve}
-\definecharacter Ohornacute {\Oacute}
-\definecharacter Ohorntilde {\Otilde}
-\definecharacter Ohornhook {O}
-\definecharacter ohorn {o}
-\definecharacter ohorngrave {\ograve}
-\definecharacter ohornacute {\oacute}
-\definecharacter ohorntilde {\otilde}
-\definecharacter ohornhook {o}
-\definecharacter Uhorn {U}
-\definecharacter Uhorngrave {\Ugrave}
-\definecharacter Uhornacute {\Uacute}
-\definecharacter Uhorntilde {\Utilde}
-\definecharacter Uhornhook {U}
-\definecharacter uhorn {u}
-\definecharacter uhorngrave {\ugrave}
-\definecharacter uhornacute {\uacute}
-\definecharacter uhorntilde {\utilde}
-\definecharacter uhornhook {u}
-
-\stopencoding
-
-%D Needed for transliterated chinese (provided by Tobias Burnus).
-
-\startencoding[default]
-
-\definecharacter acaron {\buildtextaccent\textcaron a} % U+01CE
-\definecharacter icaron {\buildtextaccent\textcaron \dotlessi} % U+01D0
-\definecharacter ocaron {\buildtextaccent\textcaron o} % U+01D2
-\definecharacter ucaron {\buildtextaccent\textcaron u} % U+01D4
-
-\stopencoding
-
-%D Greek (moved to here):
-
-\startencoding[default]
-
-% Uppercase Greek letters
-
-\definecharacter greekAlpha {\Alpha}
-\definecharacter greekBeta {\Beta}
-\definecharacter greekGamma {\Gamma}
-\definecharacter greekDelta {\Delta}
-\definecharacter greekEpsilon {\Epsilon}
-\definecharacter greekZeta {\Zeta}
-\definecharacter greekEta {\Eta}
-\definecharacter greekTheta {\Theta}
-\definecharacter greekIota {\Iota}
-\definecharacter greekKappa {\Kappa}
-\definecharacter greekLambda {\Lambda}
-\definecharacter greekMu {\Mu}
-\definecharacter greekNu {\Nu}
-\definecharacter greekXi {\Xi}
-\definecharacter greekOmicron {\Omicron}
-\definecharacter greekPi {\Pi}
-\definecharacter greekRho {\Rho}
-\definecharacter greekSigma {\Sigma}
-\definecharacter greekTau {\Tau}
-\definecharacter greekUpsilon {\Upsilon}
-\definecharacter greekPhi {\Phi}
-\definecharacter greekChi {\Chi}
-\definecharacter greekPsi {\Psi}
-\definecharacter greekOmega {\Omega}
-
-% Lowercase Greek letters
-
-\definecharacter greekalpha {\alpha}
-\definecharacter greekbeta {\beta}
-\definecharacter greekgamma {\gamma}
-\definecharacter greekdelta {\delta}
-\definecharacter greekepsilon {\varepsilon}
-\definecharacter greekepsilonalt {\epsilon}
-\definecharacter greekzeta {\zeta}
-\definecharacter greeketa {\eta}
-\definecharacter greektheta {\theta}
-\definecharacter greekthetaalt {\vartheta}
-\definecharacter greekiota {\iota}
-\definecharacter greekkappa {\kappa}
-\definecharacter greeklambda {\lambda}
-\definecharacter greekmu {\mu}
-\definecharacter greeknu {\nu}
-\definecharacter greekxi {\xi}
-\definecharacter greekomicron {\omicron}
-\definecharacter greekpi {\pi}
-\definecharacter greekrho {\rho}
-\definecharacter greeksigma {\sigma}
-\definecharacter greekfinalsigma {\varsigma}
-\definecharacter greektau {\tau}
-\definecharacter greekupsilon {\upsilon}
-\definecharacter greekphi {\varphi}
-\definecharacter greekphialt {\phi}
-\definecharacter greekchi {\chi}
-\definecharacter greekpsi {\psi}
-\definecharacter greekomega {\omega}
-
-% Accented Uppercase Greek letters
-
-\definecharacter greekAlphatonos {'A}
-\definecharacter greekEpsilontonos {'E}
-\definecharacter greekEtatonos {'H}
-\definecharacter greekIotatonos {'I}
-\definecharacter greekOmicrontonos {'O}
-\definecharacter greekUpsilontonos {'U}
-\definecharacter greekOmegatonos {'W}
-\definecharacter greekIotadialytika {"I}
-\definecharacter greekUpsilondialytika {"U}
-
-% Accented Lowercase Greek letters
-
-\definecharacter greekalphatonos {'a}
-\definecharacter greekepsilontonos {'e}
-\definecharacter greeketatonos {'h}
-\definecharacter greekiotatonos {'i}
-\definecharacter greekomicrontonos {'o}
-\definecharacter greekupsilontonos {'u}
-\definecharacter greekomegatonos {'w}
-\definecharacter greekiotadialytika {"i}
-\definecharacter greekupsilondialytika {"u}
-\definecharacter greekiotadialytikatonos {'"i}
-\definecharacter greekupsilondialytikatonos {'"u}
-
-% Miscellaneous Greek symbols
-
-\definecharacter greekleftquot {((}
-\definecharacter greekrightquot {))}
-\definecharacter greektonos {'}
-\definecharacter greekdialytikatonos {'"}
-\definecharacter greekapostrophos {''}
-
-\stopencoding
-
-%D Cyrillic (moved to here):
-
-\startencoding[default]
-
-\definecharacter cyrillicA {A}
-\definecharacter cyrillicB {B}
-\definecharacter cyrillicV {V}
-\definecharacter cyrillicG {G}
-\definecharacter cyrillicD {D}
-\definecharacter cyrillicE {E}
-\definecharacter cyrillicZH {ZH}
-\definecharacter cyrillicZ {Z}
-\definecharacter cyrillicI {I}
-\definecharacter cyrillicISHRT {ISHRT}
-\definecharacter cyrillicK {K}
-\definecharacter cyrillicL {L}
-\definecharacter cyrillicM {M}
-\definecharacter cyrillicN {N}
-\definecharacter cyrillicO {O}
-\definecharacter cyrillicP {P}
-\definecharacter cyrillicR {R}
-\definecharacter cyrillicS {S}
-\definecharacter cyrillicT {T}
-\definecharacter cyrillicU {U}
-\definecharacter cyrillicF {F}
-\definecharacter cyrillicH {H}
-\definecharacter cyrillicC {C}
-\definecharacter cyrillicCH {CH}
-\definecharacter cyrillicSH {SH}
-\definecharacter cyrillicSHCH {SHCH}
-\definecharacter cyrillicHRDSN {HRDSN}
-\definecharacter cyrillicERY {ERY}
-\definecharacter cyrillicSFTSN {SFTSN}
-\definecharacter cyrillicEREV {EREV}
-\definecharacter cyrillicYU {YU}
-\definecharacter cyrillicYA {YA}
-\definecharacter cyrillicGUP {GUP}
-\definecharacter cyrillicGHCRS {GHCRS}
-\definecharacter cyrillicDJE {DJE}
-\definecharacter cyrillicTSHE {TSHE}
-\definecharacter cyrillicSHHA {SHHA}
-\definecharacter cyrillicZHDSC {ZHDSC}
-\definecharacter cyrillicZDSC {ZDSC}
-\definecharacter cyrillicLJE {LJE}
-\definecharacter cyrillicYI {YI}
-\definecharacter cyrillicKDSC {KDSC}
-\definecharacter cyrillicKBEAK {KBEAK}
-\definecharacter cyrillicKVCRS {KVCRS}
-\definecharacter cyrillicAE {AE}
-\definecharacter cyrillicNDSC {NDSC}
-\definecharacter cyrillicNG {NG}
-\definecharacter cyrillicDZE {DZE}
-\definecharacter cyrillicOTLD {OTLD}
-\definecharacter cyrillicSDSC {SDSC}
-\definecharacter cyrillicUSHRT {USHRT}
-\definecharacter cyrillicY {Y}
-\definecharacter cyrillicYHCRS {YHCRS}
-\definecharacter cyrillicHDSC {HDSC}
-\definecharacter cyrillicDZHE {DZHE}
-\definecharacter cyrillicCHVCRS {CHVCRS}
-\definecharacter cyrillicCHRDSC {CHRDSC}
-\definecharacter cyrillicIE {IE}
-\definecharacter cyrillicSCHWA {SCHWA}
-\definecharacter cyrillicNJE {NJE}
-\definecharacter cyrillicYO {YO}
-\definecharacter cyrillicII {II}
-\definecharacter cyrillicJE {JE}
-\definecharacter cyrillicQ {Q}
-\definecharacter cyrillicW {W}
-
-\definecharacter cyrillica {a}
-\definecharacter cyrillicb {b}
-\definecharacter cyrillicv {v}
-\definecharacter cyrillicg {g}
-\definecharacter cyrillicd {d}
-\definecharacter cyrillice {e}
-\definecharacter cyrilliczh {zh}
-\definecharacter cyrillicz {z}
-\definecharacter cyrillici {i}
-\definecharacter cyrillicishrt {ishrt}
-\definecharacter cyrillick {k}
-\definecharacter cyrillicl {l}
-\definecharacter cyrillicm {m}
-\definecharacter cyrillicn {n}
-\definecharacter cyrillico {o}
-\definecharacter cyrillicp {p}
-\definecharacter cyrillicr {r}
-\definecharacter cyrillics {s}
-\definecharacter cyrillict {t}
-\definecharacter cyrillicu {u}
-\definecharacter cyrillicf {f}
-\definecharacter cyrillich {h}
-\definecharacter cyrillicc {c}
-\definecharacter cyrillicch {ch}
-\definecharacter cyrillicsh {sh}
-\definecharacter cyrillicshch {shch}
-\definecharacter cyrillichrdsn {hrdsn}
-\definecharacter cyrillicery {ery}
-\definecharacter cyrillicsftsn {sftsn}
-\definecharacter cyrillicerev {erev}
-\definecharacter cyrillicyu {yu}
-\definecharacter cyrillicya {ya}
-\definecharacter cyrillicgup {gup}
-\definecharacter cyrillicghcrs {ghcrs}
-\definecharacter cyrillicdje {dje}
-\definecharacter cyrillictshe {tshe}
-\definecharacter cyrillicshha {shha}
-\definecharacter cyrilliczhdsc {zhdsc}
-\definecharacter cyrilliczdsc {zdsc}
-\definecharacter cyrilliclje {lje}
-\definecharacter cyrillicyi {yi}
-\definecharacter cyrillickdsc {kdsc}
-\definecharacter cyrillickbeak {kbeak}
-\definecharacter cyrillickvcrs {kvcrs}
-\definecharacter cyrillicae {ae}
-\definecharacter cyrillicndsc {ndsc}
-\definecharacter cyrillicng {ng}
-\definecharacter cyrillicdze {dze}
-\definecharacter cyrillicotld {otld}
-\definecharacter cyrillicsdsc {sdsc}
-\definecharacter cyrillicushrt {ushrt}
-\definecharacter cyrillicy {y}
-\definecharacter cyrillicyhcrs {yhcrs}
-\definecharacter cyrillichdsc {hdsc}
-\definecharacter cyrillicdzhe {dzhe}
-\definecharacter cyrillicchvcrs {chvcrs}
-\definecharacter cyrillicchrdsc {chrdsc}
-\definecharacter cyrillicie {ie}
-\definecharacter cyrillicschwa {schwa}
-\definecharacter cyrillicnje {nje}
-\definecharacter cyrillicyo {yo}
-\definecharacter cyrillicii {ii}
-\definecharacter cyrillicje {je}
-\definecharacter cyrillicq {q}
-\definecharacter cyrillicw {w}
-
-\definecharacter cyrillicGJE {\'\cyrillicG}
-\definecharacter cyrillicgje {\'\cyrillicg}
-\definecharacter cyrillicKJE {\'\cyrillicK}
-\definecharacter cyrillickje {\'\cyrillick}
-
-\stopencoding
-
-\def\cyrillicio{\cyrillicyo}
-\def\cyrillicIO{\cyrillicYO}
-
-%D Hebrew:
-
-\startencoding[default]
-
-\definecharacter hebrewAlef {'}
-\definecharacter hebrewBet {b}
-\definecharacter hebrewGimel {g}
-\definecharacter hebrewDalet {d}
-\definecharacter hebrewHe {h}
-\definecharacter hebrewVav {w}
-\definecharacter hebrewZayin {z}
-\definecharacter hebrewHet {\hstroke}
-\definecharacter hebrewTet {\tcedilla}
-\definecharacter hebrewYod {y}
-\definecharacter hebrewKaffinal {k}
-\definecharacter hebrewKaf {k}
-\definecharacter hebrewLamed {l}
-\definecharacter hebrewMemfinal {m}
-\definecharacter hebrewMem {m}
-\definecharacter hebrewNunfinal {n}
-\definecharacter hebrewNun {n}
-\definecharacter hebrewSamekh {s}
-\definecharacter hebrewAyin {\gdotaccent}
-\definecharacter hebrewPefinal {p}
-\definecharacter hebrewPe {p}
-\definecharacter hebrewTsadifinal {\scedilla}
-\definecharacter hebrewTsadi {\scedilla}
-\definecharacter hebrewQof {q}
-\definecharacter hebrewResh {r}
-\definecharacter hebrewShin {\scaron}
-\definecharacter hebrewTav {th}
-
-\stopencoding
-
-%D A few goodies:
-
-\def\eszett{\ssharp}
-\def\Eszett{\Ssharp}
-
-\def\lslash{\lstroke}
-\def\Lslash{\Lstroke}
-\def\dslash{\dstroke}
-\def\Dslash{\Dstroke}
-\def\oslash{\ostroke}
-\def\Oslash{\Ostroke}
-
-\def\dcroat{\dstroke}
-\def\Dcroat{\Dstroke}
-
-% \startencoding [default]
-%
-% \definecharacter scommaaccent {\scedilla}
-% \definecharacter Scommaaccent {\Scedilla}
-% \definecharacter tcommaaccent {\tcedilla}
-% \definecharacter Tcommaaccent {\Tcedilla}
-%
-% \stopencoding
-
-% for plain tex's sake
-
-\def\S {\sectionmark }
-\def\P {\paragraphmark}
-
-% for latex users sake
-
-\def\textS {\sectionmark }
-\def\textP {\paragraphmark}
-
-% for old times sake
-
-\def\florin {\textflorin } \def\florijn{\textflorin}
-\def\dollar {\textdollar }
-\def\pound {\textsterling}
-\def\sterling{\textsterling}
-
-% idem
-
-\def\promille{\perthousand}
-\def\permille{\perthousand}
-\def\procent {\percent }
-\def\permine {\fakepermine}
-
-% some more
-
-\def\hyphen {\softhyphen}
-\def\cwm {\compoundwordmark}
-\def\nonbreakinghyphen {\hyphen}
-\def\breakinghyphen {\hyphen\prewordbreak}
-
-% quotes
-
-\def\lowerleftsingleninequote {\quotesinglebase}
-\def\lowerleftdoubleninequote {\quotedblbase}
-\def\lowerrightsingleninequote {\quotesinglebase}
-\def\lowerrightdoubleninequote {\quotedblbase}
-
-\def\upperleftsingleninequote {\quoteright}
-\def\upperleftdoubleninequote {\quotedblright}
-\def\upperrightsingleninequote {\quoteright}
-\def\upperrightdoubleninequote {\quotedblright}
-
-\def\upperleftsinglesixquote {\quoteleft}
-\def\upperleftdoublesixquote {\quotedblleft}
-\def\upperrightsinglesixquote {\quoteleft}
-\def\upperrightdoublesixquote {\quotedblleft}
-
-\def\leftsubguillemot {\guilsingleleft}
-\def\rightsubguillemot {\guilsingleright}
-
-%D A couple of fallbacks suggestion by users, slightly
-%D adapted and obscured by memory saving hacks.
-
-\unprotect
-
-\startencoding[default]
-
-\definecharacter textcent {c\rlap{\hskip-.2\s!em
- \vrule\!!width.2\s!pt\!!height1.2\s!ex\!!depth.2\s!ex}}
-
-\definecharacter texteuro {C\rlap{\hskip-.75\s!em
- \vrule\!!width.4\s!em\!!height.85\s!ex\!!depth-.8\s!ex}}
-
-\definecharacter textblacksquare {\dontleavehmode\hbox{%
- \vrule\!!width.3\s!em\!!height.4\s!em\!!depth-.1\s!em}}
-
-\definecharacter textbrokenbar {\dontleavehmode\hbox{\kern.05\s!em
- \vrule\!!width.4\s!pt\!!height1.8\s!ex\!!depth-.85\s!ex
- \llap{%
- \vrule\!!width.4\s!pt\!!height.35\s!ex\!!depth.6\s!ex}%
- \kern.05\s!em}}
-
-\stopencoding
-
-\protect
-
-%D We also use symbolic names for math accents.
-
-\startencoding[default]
-
-\definecharacter mathacute "7013
-\definecharacter mathgrave "7012
-\definecharacter mathddot "707F
-\definecharacter mathtilde "707E
-\definecharacter mathbar "7016
-\definecharacter mathbreve "7015
-\definecharacter mathcheck "7014
-\definecharacter mathhat "705E
-\definecharacter mathvec "017E
-\definecharacter mathdot "705F
-\definecharacter mathwidetilde "0365
-\definecharacter mathwidehat "0362
-
-\stopencoding
-
-% \startencoding [default]
-
-% \definecommand prime {\mathematics{'}}
-% \definecommand doubleprime {\mathematics{''}}
-% \definecommand tripleprime {\mathematics{'''}}
-
-% \stopencoding
-
-\ifx\zdot\undefined \def\zdot{\zdotaccent} \fi
-\ifx\Zdot\undefined \def\Zdot{\Zdotaccent} \fi
-
-\ifx\greeklamda\undefined \def\greeklamda{\greeklambda} \fi
-\ifx\greekLamda\undefined \def\greekLamda{\greekLambda} \fi
-
-\ifx\leftguillemet \undefined \def\leftguillemet {\leftguillemot } \fi
-\ifx\rightguillemet\undefined \def\rightguillemet{\rightguillemot} \fi
-
-%D New:
-
-\startencoding[\s!default]
-
-\definecharacter schwa {\hbox{\rotate[\c!rotation=180,\c!location=\v!high]{\hbox{e}}}}
-\definecharacter schwagrave {\buildtextgrave\schwa}
-
-\stopencoding
-
-%D Also new, from Taco, for Mojca, who wanted another 8~regimes.
-
-\startencoding[\s!default]
-
-\definecharacter texthorizontalbar {{\endash\kern\zeropoint\endash}}
-\definecharacter textdong {\underbar{\dstroke}}
-
-\stopencoding
-
-%D Goodie (makes more sense):
-
-\def\normalcontrolspace
- {\getglyph{ComputerModernMono}{\char32}}
-
-\def\fakedcontrolspace % can be virtual in luatex
- {\dontleavehmode\hbox
- {\scratchdimen.1ex%
- \kern\scratchdimen
- \vrule \!!width\scratchdimen \!!height5.5\scratchdimen \!!depth3\scratchdimen
- \vrule \!!width\dimexpr.5em-4\scratchdimen\relax \!!height-2\scratchdimen \!!depth3\scratchdimen
- \vrule \!!width\scratchdimen \!!height5.5\scratchdimen \!!depth3\scratchdimen
- \kern\scratchdimen}}
-
-\def\fakecontrolspace{\let\normalcontrolspace\fakedcontrolspace}
-
-\endinput
diff --git a/tex/context/base/enco-ec.mkii b/tex/context/base/enco-ec.mkii
new file mode 100644
index 000000000..1ac41cadf
--- /dev/null
+++ b/tex/context/base/enco-ec.mkii
@@ -0,0 +1,295 @@
+%D \module
+%D [ file=enco-ec,
+%D version=2000.05.07, % 1999.16.07,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=\LATEX\ EC Encoding,
+%D author={Patrick Gundlach, Hans Hagen, Taco Hoekwater, Mojca Miklavec},
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This is \LATEX2e's T1 encoding vector. All standard \LATEX\
+%D accents will work, including \type{\k}. The only accent that
+%D does not work is \type{\t} (there is no tie in T1 encoding).
+%D
+%D Annoyingly, most \POSTSCRIPT\ fonts do not have \type
+%D {\dotlessj}, and T1 encoding does not make the various
+%D prebuilts with \type {j} available. When this is the case:
+%D
+%D \starttyping
+%D \startencoding[ec]
+%D \definecharacter dotlessj {j}
+%D \stopencoding
+%D \stoptyping
+%D
+%D is a way out.
+
+%D There is hardly a point in supporting TS1 encoding.
+
+\startmapping[ec]
+
+% a problem is that the uppercase of dstroke (158) and eth (240)
+% is the same glyph (208) so we cannot do lowercase mapping there
+
+\definecasemaps 128 to 156 lc +32 uc 0
+\definecasemap 157 `i 157 % Idotaccent i
+\definecasemap 158 158 208 % dstroke Eth
+\definecasemap 159 159 159 % sectionmark
+\definecasemaps 160 to 187 lc 0 uc -32
+\resetcaserange 189 to 191 % exclamdown, questiondown, textsterling
+\definecasemaps 192 to 223 lc +32 uc 0
+\definecasemaps 224 to 254 lc 0 uc -32
+\definecaseswap 255 223 % ssharp (else patterns fail)
+\definecaseswap 25 `I % dotless i
+
+% 156 vs. 188 IJligature
+
+%D Some languages need this:
+
+% \definecaseself 34 % quotedbl
+% \definecaseself 18 % quotedblbase
+% \definecaseself 16 % quotedblleft
+% \definecaseself 17 % quotedblright
+% \definecaseself 39 % quotesingle
+% \definecaseself 13 % quotesinglebase
+% \definecaseself 96 % quoteleft
+% \definecaseself 39 % quoteright
+
+%D So far for the mapping.
+
+%D The following characters are kind of dangerous,
+%D that is, they are normally not part of fonts, unless
+%D explicitly constructed.
+%D
+%D \startitemize[columns,two]
+%D \item \type{\dotlessj} - but then it may not be defined!!!!
+%D \item \type{\IJligature}
+%D \item \type{\ijligature}
+%D \item \type{\Ssharp}
+%D \item \type{\perthousand}
+%D \item \type{\compoundwordmark}
+% \item \type{\textvisiblespace}
+%D \stopitemize
+
+%D So, for the moment we nil them; we can always create
+%D another vector if needed.
+
+\stopmapping
+
+\startencoding[ec][ec] % second arg defines auto regime, needed here ?
+
+\definecharacter textgrave 0
+\definecharacter textacute 1
+\definecharacter textcircumflex 2
+\definecharacter texttilde 3
+\definecharacter textdiaeresis 4
+\definecharacter texthungarumlaut 5
+\definecharacter textring 6
+\definecharacter textcaron 7
+\definecharacter textbreve 8
+\definecharacter textmacron 9
+\definecharacter textdotaccent 10
+\definecharacter textcedilla 11
+\definecharacter textogonek 12
+\definecharacter quotesinglebase 13
+\definecharacter guilsingleleft 14
+\definecharacter guilsingleright 15
+\definecharacter quotedblleft 16
+\definecharacter quotedblright 17
+\definecharacter quotedblbase 18
+\definecharacter leftguillemot 19
+\definecharacter rightguillemot 20
+\definecharacter endash 21
+\definecharacter emdash 22
+%definecharacter compoundwordmark 23
+%definecharacter perthousand 24
+\definecharacter dotlessi 25 % or when missing: {j}
+\definecharacter dotlessj 26
+% ff 27
+% fi 28
+% fl 29
+% ffi 30
+% ffl 31
+%definecharacter textvisiblespace 32
+% exclam ! 33
+\definecharacter quotedbl 34
+% numbersign # 35
+% dollar $ 36
+\definecharacter percent 37
+% ampersand & 38
+%definecharacter quotesingle 39 % fake 'm TODO:enco-def!!!!
+\definecharacter quoteright 39
+% parenleft ( 40
+% parenright ) 41
+% asterisk * 42
+% plus + 43
+% comma , 44
+\definecharacter softhyphen 45
+% period . 46
+% slash / 47
+% 0-9 48-57
+% colon : 58
+% semicolon ; 59
+% less < 60
+% equal = 61
+% greater > 62
+% question ? 63
+% at @ 64
+% A-Z 65-90
+% bracketleft [ 91
+\definecharacter textbackslash 92
+% bracketright ] 93
+\definecharacter textasciicircum 94
+\definecharacter textunderscore 95
+\definecharacter quoteleft 96
+% a-z 97-122
+\definecharacter textbraceleft 123
+\definecharacter textbraceright 125
+\definecharacter textasciitilde 126
+%definecharacter softhyphen 127 % -> 45 (127 often undefined)
+\definecharacter Abreve 128 % abreve 160
+\definecharacter Aogonek 129 % aogonek 161
+\definecharacter Cacute 130 % cacute 162
+\definecharacter Ccaron 131 % ccaron 163
+\definecharacter Dcaron 132 % dcaron 164
+\definecharacter Ecaron 133 % ecaron 165
+\definecharacter Eogonek 134 % eogonek 166
+\definecharacter Gbreve 135 % gbreve 167
+\definecharacter Lacute 136 % lacute 168
+\definecharacter Lcaron 137 % lcaron 169
+\definecharacter Lstroke 138 % lstroke 170
+\definecharacter Nacute 139 % nacute 171
+\definecharacter Ncaron 140 % ncaron 172
+\definecharacter Eng 141 % eng 173
+\definecharacter Neng 141 % Neng 173
+\definecharacter Ohungarumlaut 142 % ohungarumlaut 174
+\definecharacter Racute 143 % racute 175
+\definecharacter Rcaron 144 % rcaron 176
+\definecharacter Sacute 145 % sacute 177
+\definecharacter Scaron 146 % scaron 178
+\definecharacter Scedilla 147 % scedilla 179
+\definecharacter Tcaron 148 % tcaron 180
+\definecharacter Tcedilla 149 % tcedilla 181
+\definecharacter Uhungarumlaut 150 % uhungarumlaut 182
+\definecharacter Uring 151 % uring 183
+\definecharacter Ydiaeresis 152 % ydiaeresis 184
+\definecharacter Zacute 153 % zacute 185
+\definecharacter Zcaron 154 % zcaron 186
+\definecharacter Zdotaccent 155 % zdotaccent 187
+\definecharacter IJligature 156 % ijligature 188
+\definecharacter Idotaccent 157
+\definecharacter dstroke 158 % Dstroke 208
+\definecharacter sectionmark 159
+\definecharacter abreve 160 % Abreve 128
+\definecharacter aogonek 161 % Aogonek 129
+\definecharacter cacute 162 % Cacute 130
+\definecharacter ccaron 163 % Ccaron 131
+\definecharacter dcaron 164 % Dcaron 132
+\definecharacter ecaron 165 % Ecaron 133
+\definecharacter eogonek 166 % Eogonek 134
+\definecharacter gbreve 167 % Gbreve 135
+\definecharacter lacute 168 % Lacute 136
+\definecharacter lcaron 169 % Lcaron 137
+\definecharacter lstroke 170 % Lstroke 138
+\definecharacter nacute 171 % Nacute 139
+\definecharacter ncaron 172 % Ncaron 140
+\definecharacter eng 173 % Eng 141
+\definecharacter ohungarumlaut 174 % Ohungarumlaut 142
+\definecharacter racute 175 % Racute 143
+\definecharacter rcaron 176 % Rcaron 144
+\definecharacter sacute 177 % Sacute 145
+\definecharacter scaron 178 % Scaron 146
+\definecharacter scedilla 179 % Scedilla 147
+\definecharacter tcaron 180 % Tcaron 148
+\definecharacter tcedilla 181 % Tcedilla 149
+\definecharacter uhungarumlaut 182 % Uhungarumlaut 150
+\definecharacter uring 183 % Uring 151
+\definecharacter ydiaeresis 184 % Ydiaeresis 152
+\definecharacter zacute 185 % Zacute 153
+\definecharacter zcaron 186 % Zcaron 154
+\definecharacter zdotaccent 187 % Zdotaccent 155
+\definecharacter ijligature 188 % IJligature 156
+\definecharacter exclamdown 189
+\definecharacter questiondown 190
+\definecharacter textsterling 191
+\definecharacter Agrave 192 % agrave 224
+\definecharacter Aacute 193 % aacute 225
+\definecharacter Acircumflex 194 % acircumflex 226
+\definecharacter Atilde 195 % atilde 227
+\definecharacter Adiaeresis 196 % adiaeresis 228
+\definecharacter Aring 197 % aring 229
+\definecharacter AEligature 198 % aeligature 230
+\definecharacter Ccedilla 199 % ccedilla 231
+\definecharacter Egrave 200 % egrave 232
+\definecharacter Eacute 201 % eacute 233
+\definecharacter Ecircumflex 202 % ecircumflex 234
+\definecharacter Ediaeresis 203 % ediaeresis 235
+\definecharacter Igrave 204 % igrave 236
+\definecharacter Iacute 205 % iacute 237
+\definecharacter Icircumflex 206 % icircumflex 238
+\definecharacter Idiaeresis 207 % idiaeresis 239
+\definecharacter Eth 208 % eth 240
+\definecharacter Dstroke 208 % dstroke 158
+\definecharacter Ntilde 209 % ntilde 241
+\definecharacter Ograve 210 % ograve 242
+\definecharacter Oacute 211 % oacute 243
+\definecharacter Ocircumflex 212 % ocircumflex 244
+\definecharacter Otilde 213 % otilde 245
+\definecharacter Odiaeresis 214 % odiaeresis 246
+\definecharacter OEligature 215 % oeligature 247
+\definecharacter Ostroke 216 % ostroke 248
+\definecharacter Ugrave 217 % ugrave 249
+\definecharacter Uacute 218 % uacute 250
+\definecharacter Ucircumflex 219 % ucircumflex 251
+\definecharacter Udiaeresis 220 % udiaeresis 252
+\definecharacter Yacute 221 % yacute 253
+\definecharacter Thorn 222 % thorn 254
+\definecharacter Ssharp 223 % ssharp 255
+\definecharacter agrave 224 % Agrave 192
+\definecharacter aacute 225 % Aacute 193
+\definecharacter acircumflex 226 % Acircumflex 194
+\definecharacter atilde 227 % Atilde 195
+\definecharacter adiaeresis 228 % Adiaeresis 196
+\definecharacter aring 229 % Aring 197
+\definecharacter aeligature 230 % AEligature 198
+\definecharacter ccedilla 231 % Ccedilla 199
+\definecharacter egrave 232 % Egrave 200
+\definecharacter eacute 233 % Eacute 201
+\definecharacter ecircumflex 234 % Ecircumflex 202
+\definecharacter ediaeresis 235 % Ediaeresis 203
+\definecharacter igrave 236 % Igrave 204
+\definecharacter iacute 237 % Iacute 205
+\definecharacter icircumflex 238 % Icircumflex 206
+\definecharacter idiaeresis 239 % Idiaeresis 207
+\definecharacter eth 240 % Eth 208
+\definecharacter ntilde 241 % Ntilde 209
+\definecharacter ograve 242 % Ograve 210
+\definecharacter oacute 243 % Oacute 211
+\definecharacter ocircumflex 244 % Ocircumflex 212
+\definecharacter otilde 245 % Otilde 213
+\definecharacter odiaeresis 246 % Odiaeresis 214
+\definecharacter oeligature 247 % OEligature 215
+\definecharacter ostroke 248 % Ostroke 216
+\definecharacter ugrave 249 % Ugrave 217
+\definecharacter uacute 250 % Uacute 218
+\definecharacter ucircumflex 251 % Ucircumflex 219
+\definecharacter udiaeresis 252 % Udiaeresis 220
+\definecharacter yacute 253 % Yacute 221
+\definecharacter thorn 254 % Thorn 222
+\definecharacter ssharp 255 % Ssharp 223
+
+\stopencoding
+
+\startencoding[ec]
+
+\definecharacter Scommaaccent {\Scedilla}
+\definecharacter scommaaccent {\scedilla}
+\definecharacter Tcommaaccent {\Tcedilla}
+\definecharacter tcommaaccent {\tcedilla}
+
+\stopencoding
+
+\endinput
diff --git a/tex/context/base/enco-ec.tex b/tex/context/base/enco-ec.tex
deleted file mode 100644
index 1ac41cadf..000000000
--- a/tex/context/base/enco-ec.tex
+++ /dev/null
@@ -1,295 +0,0 @@
-%D \module
-%D [ file=enco-ec,
-%D version=2000.05.07, % 1999.16.07,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=\LATEX\ EC Encoding,
-%D author={Patrick Gundlach, Hans Hagen, Taco Hoekwater, Mojca Miklavec},
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D This is \LATEX2e's T1 encoding vector. All standard \LATEX\
-%D accents will work, including \type{\k}. The only accent that
-%D does not work is \type{\t} (there is no tie in T1 encoding).
-%D
-%D Annoyingly, most \POSTSCRIPT\ fonts do not have \type
-%D {\dotlessj}, and T1 encoding does not make the various
-%D prebuilts with \type {j} available. When this is the case:
-%D
-%D \starttyping
-%D \startencoding[ec]
-%D \definecharacter dotlessj {j}
-%D \stopencoding
-%D \stoptyping
-%D
-%D is a way out.
-
-%D There is hardly a point in supporting TS1 encoding.
-
-\startmapping[ec]
-
-% a problem is that the uppercase of dstroke (158) and eth (240)
-% is the same glyph (208) so we cannot do lowercase mapping there
-
-\definecasemaps 128 to 156 lc +32 uc 0
-\definecasemap 157 `i 157 % Idotaccent i
-\definecasemap 158 158 208 % dstroke Eth
-\definecasemap 159 159 159 % sectionmark
-\definecasemaps 160 to 187 lc 0 uc -32
-\resetcaserange 189 to 191 % exclamdown, questiondown, textsterling
-\definecasemaps 192 to 223 lc +32 uc 0
-\definecasemaps 224 to 254 lc 0 uc -32
-\definecaseswap 255 223 % ssharp (else patterns fail)
-\definecaseswap 25 `I % dotless i
-
-% 156 vs. 188 IJligature
-
-%D Some languages need this:
-
-% \definecaseself 34 % quotedbl
-% \definecaseself 18 % quotedblbase
-% \definecaseself 16 % quotedblleft
-% \definecaseself 17 % quotedblright
-% \definecaseself 39 % quotesingle
-% \definecaseself 13 % quotesinglebase
-% \definecaseself 96 % quoteleft
-% \definecaseself 39 % quoteright
-
-%D So far for the mapping.
-
-%D The following characters are kind of dangerous,
-%D that is, they are normally not part of fonts, unless
-%D explicitly constructed.
-%D
-%D \startitemize[columns,two]
-%D \item \type{\dotlessj} - but then it may not be defined!!!!
-%D \item \type{\IJligature}
-%D \item \type{\ijligature}
-%D \item \type{\Ssharp}
-%D \item \type{\perthousand}
-%D \item \type{\compoundwordmark}
-% \item \type{\textvisiblespace}
-%D \stopitemize
-
-%D So, for the moment we nil them; we can always create
-%D another vector if needed.
-
-\stopmapping
-
-\startencoding[ec][ec] % second arg defines auto regime, needed here ?
-
-\definecharacter textgrave 0
-\definecharacter textacute 1
-\definecharacter textcircumflex 2
-\definecharacter texttilde 3
-\definecharacter textdiaeresis 4
-\definecharacter texthungarumlaut 5
-\definecharacter textring 6
-\definecharacter textcaron 7
-\definecharacter textbreve 8
-\definecharacter textmacron 9
-\definecharacter textdotaccent 10
-\definecharacter textcedilla 11
-\definecharacter textogonek 12
-\definecharacter quotesinglebase 13
-\definecharacter guilsingleleft 14
-\definecharacter guilsingleright 15
-\definecharacter quotedblleft 16
-\definecharacter quotedblright 17
-\definecharacter quotedblbase 18
-\definecharacter leftguillemot 19
-\definecharacter rightguillemot 20
-\definecharacter endash 21
-\definecharacter emdash 22
-%definecharacter compoundwordmark 23
-%definecharacter perthousand 24
-\definecharacter dotlessi 25 % or when missing: {j}
-\definecharacter dotlessj 26
-% ff 27
-% fi 28
-% fl 29
-% ffi 30
-% ffl 31
-%definecharacter textvisiblespace 32
-% exclam ! 33
-\definecharacter quotedbl 34
-% numbersign # 35
-% dollar $ 36
-\definecharacter percent 37
-% ampersand & 38
-%definecharacter quotesingle 39 % fake 'm TODO:enco-def!!!!
-\definecharacter quoteright 39
-% parenleft ( 40
-% parenright ) 41
-% asterisk * 42
-% plus + 43
-% comma , 44
-\definecharacter softhyphen 45
-% period . 46
-% slash / 47
-% 0-9 48-57
-% colon : 58
-% semicolon ; 59
-% less < 60
-% equal = 61
-% greater > 62
-% question ? 63
-% at @ 64
-% A-Z 65-90
-% bracketleft [ 91
-\definecharacter textbackslash 92
-% bracketright ] 93
-\definecharacter textasciicircum 94
-\definecharacter textunderscore 95
-\definecharacter quoteleft 96
-% a-z 97-122
-\definecharacter textbraceleft 123
-\definecharacter textbraceright 125
-\definecharacter textasciitilde 126
-%definecharacter softhyphen 127 % -> 45 (127 often undefined)
-\definecharacter Abreve 128 % abreve 160
-\definecharacter Aogonek 129 % aogonek 161
-\definecharacter Cacute 130 % cacute 162
-\definecharacter Ccaron 131 % ccaron 163
-\definecharacter Dcaron 132 % dcaron 164
-\definecharacter Ecaron 133 % ecaron 165
-\definecharacter Eogonek 134 % eogonek 166
-\definecharacter Gbreve 135 % gbreve 167
-\definecharacter Lacute 136 % lacute 168
-\definecharacter Lcaron 137 % lcaron 169
-\definecharacter Lstroke 138 % lstroke 170
-\definecharacter Nacute 139 % nacute 171
-\definecharacter Ncaron 140 % ncaron 172
-\definecharacter Eng 141 % eng 173
-\definecharacter Neng 141 % Neng 173
-\definecharacter Ohungarumlaut 142 % ohungarumlaut 174
-\definecharacter Racute 143 % racute 175
-\definecharacter Rcaron 144 % rcaron 176
-\definecharacter Sacute 145 % sacute 177
-\definecharacter Scaron 146 % scaron 178
-\definecharacter Scedilla 147 % scedilla 179
-\definecharacter Tcaron 148 % tcaron 180
-\definecharacter Tcedilla 149 % tcedilla 181
-\definecharacter Uhungarumlaut 150 % uhungarumlaut 182
-\definecharacter Uring 151 % uring 183
-\definecharacter Ydiaeresis 152 % ydiaeresis 184
-\definecharacter Zacute 153 % zacute 185
-\definecharacter Zcaron 154 % zcaron 186
-\definecharacter Zdotaccent 155 % zdotaccent 187
-\definecharacter IJligature 156 % ijligature 188
-\definecharacter Idotaccent 157
-\definecharacter dstroke 158 % Dstroke 208
-\definecharacter sectionmark 159
-\definecharacter abreve 160 % Abreve 128
-\definecharacter aogonek 161 % Aogonek 129
-\definecharacter cacute 162 % Cacute 130
-\definecharacter ccaron 163 % Ccaron 131
-\definecharacter dcaron 164 % Dcaron 132
-\definecharacter ecaron 165 % Ecaron 133
-\definecharacter eogonek 166 % Eogonek 134
-\definecharacter gbreve 167 % Gbreve 135
-\definecharacter lacute 168 % Lacute 136
-\definecharacter lcaron 169 % Lcaron 137
-\definecharacter lstroke 170 % Lstroke 138
-\definecharacter nacute 171 % Nacute 139
-\definecharacter ncaron 172 % Ncaron 140
-\definecharacter eng 173 % Eng 141
-\definecharacter ohungarumlaut 174 % Ohungarumlaut 142
-\definecharacter racute 175 % Racute 143
-\definecharacter rcaron 176 % Rcaron 144
-\definecharacter sacute 177 % Sacute 145
-\definecharacter scaron 178 % Scaron 146
-\definecharacter scedilla 179 % Scedilla 147
-\definecharacter tcaron 180 % Tcaron 148
-\definecharacter tcedilla 181 % Tcedilla 149
-\definecharacter uhungarumlaut 182 % Uhungarumlaut 150
-\definecharacter uring 183 % Uring 151
-\definecharacter ydiaeresis 184 % Ydiaeresis 152
-\definecharacter zacute 185 % Zacute 153
-\definecharacter zcaron 186 % Zcaron 154
-\definecharacter zdotaccent 187 % Zdotaccent 155
-\definecharacter ijligature 188 % IJligature 156
-\definecharacter exclamdown 189
-\definecharacter questiondown 190
-\definecharacter textsterling 191
-\definecharacter Agrave 192 % agrave 224
-\definecharacter Aacute 193 % aacute 225
-\definecharacter Acircumflex 194 % acircumflex 226
-\definecharacter Atilde 195 % atilde 227
-\definecharacter Adiaeresis 196 % adiaeresis 228
-\definecharacter Aring 197 % aring 229
-\definecharacter AEligature 198 % aeligature 230
-\definecharacter Ccedilla 199 % ccedilla 231
-\definecharacter Egrave 200 % egrave 232
-\definecharacter Eacute 201 % eacute 233
-\definecharacter Ecircumflex 202 % ecircumflex 234
-\definecharacter Ediaeresis 203 % ediaeresis 235
-\definecharacter Igrave 204 % igrave 236
-\definecharacter Iacute 205 % iacute 237
-\definecharacter Icircumflex 206 % icircumflex 238
-\definecharacter Idiaeresis 207 % idiaeresis 239
-\definecharacter Eth 208 % eth 240
-\definecharacter Dstroke 208 % dstroke 158
-\definecharacter Ntilde 209 % ntilde 241
-\definecharacter Ograve 210 % ograve 242
-\definecharacter Oacute 211 % oacute 243
-\definecharacter Ocircumflex 212 % ocircumflex 244
-\definecharacter Otilde 213 % otilde 245
-\definecharacter Odiaeresis 214 % odiaeresis 246
-\definecharacter OEligature 215 % oeligature 247
-\definecharacter Ostroke 216 % ostroke 248
-\definecharacter Ugrave 217 % ugrave 249
-\definecharacter Uacute 218 % uacute 250
-\definecharacter Ucircumflex 219 % ucircumflex 251
-\definecharacter Udiaeresis 220 % udiaeresis 252
-\definecharacter Yacute 221 % yacute 253
-\definecharacter Thorn 222 % thorn 254
-\definecharacter Ssharp 223 % ssharp 255
-\definecharacter agrave 224 % Agrave 192
-\definecharacter aacute 225 % Aacute 193
-\definecharacter acircumflex 226 % Acircumflex 194
-\definecharacter atilde 227 % Atilde 195
-\definecharacter adiaeresis 228 % Adiaeresis 196
-\definecharacter aring 229 % Aring 197
-\definecharacter aeligature 230 % AEligature 198
-\definecharacter ccedilla 231 % Ccedilla 199
-\definecharacter egrave 232 % Egrave 200
-\definecharacter eacute 233 % Eacute 201
-\definecharacter ecircumflex 234 % Ecircumflex 202
-\definecharacter ediaeresis 235 % Ediaeresis 203
-\definecharacter igrave 236 % Igrave 204
-\definecharacter iacute 237 % Iacute 205
-\definecharacter icircumflex 238 % Icircumflex 206
-\definecharacter idiaeresis 239 % Idiaeresis 207
-\definecharacter eth 240 % Eth 208
-\definecharacter ntilde 241 % Ntilde 209
-\definecharacter ograve 242 % Ograve 210
-\definecharacter oacute 243 % Oacute 211
-\definecharacter ocircumflex 244 % Ocircumflex 212
-\definecharacter otilde 245 % Otilde 213
-\definecharacter odiaeresis 246 % Odiaeresis 214
-\definecharacter oeligature 247 % OEligature 215
-\definecharacter ostroke 248 % Ostroke 216
-\definecharacter ugrave 249 % Ugrave 217
-\definecharacter uacute 250 % Uacute 218
-\definecharacter ucircumflex 251 % Ucircumflex 219
-\definecharacter udiaeresis 252 % Udiaeresis 220
-\definecharacter yacute 253 % Yacute 221
-\definecharacter thorn 254 % Thorn 222
-\definecharacter ssharp 255 % Ssharp 223
-
-\stopencoding
-
-\startencoding[ec]
-
-\definecharacter Scommaaccent {\Scedilla}
-\definecharacter scommaaccent {\scedilla}
-\definecharacter Tcommaaccent {\Tcedilla}
-\definecharacter tcommaaccent {\tcedilla}
-
-\stopencoding
-
-\endinput
diff --git a/tex/context/base/enco-ecm.mkii b/tex/context/base/enco-ecm.mkii
new file mode 100644
index 000000000..b74473960
--- /dev/null
+++ b/tex/context/base/enco-ecm.mkii
@@ -0,0 +1,33 @@
+%D \module
+%D [ file=enco-ec,
+%D version=2000.05.07,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Glyphs that may not be present in EC,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D The next typescript removes a few problematic characters
+%D from the ec encoding vector. So, in case of troubles, say
+%D
+%D \starttyping
+%D \useencoding[ecm] % ec minus
+%D \stoptyping
+
+\startencoding[ec][ec]
+
+\definecharacter ijligature {ij}
+\definecharacter IJligature {IJ}
+\definecharacter Ssharp {SS}
+\definecharacter tcaron {\buildtextaccent\textcaron t}
+\definecharacter Tcedilla {\buildtextcedilla T}
+\definecharacter tcedilla {\buildtextcedilla t}
+\definecharacter ydiaeresis {\buildtextaccent\textdiaeresis y}
+
+\stopencoding
+
+\endinput
diff --git a/tex/context/base/enco-ecm.tex b/tex/context/base/enco-ecm.tex
deleted file mode 100644
index b74473960..000000000
--- a/tex/context/base/enco-ecm.tex
+++ /dev/null
@@ -1,33 +0,0 @@
-%D \module
-%D [ file=enco-ec,
-%D version=2000.05.07,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Glyphs that may not be present in EC,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D The next typescript removes a few problematic characters
-%D from the ec encoding vector. So, in case of troubles, say
-%D
-%D \starttyping
-%D \useencoding[ecm] % ec minus
-%D \stoptyping
-
-\startencoding[ec][ec]
-
-\definecharacter ijligature {ij}
-\definecharacter IJligature {IJ}
-\definecharacter Ssharp {SS}
-\definecharacter tcaron {\buildtextaccent\textcaron t}
-\definecharacter Tcedilla {\buildtextcedilla T}
-\definecharacter tcedilla {\buildtextcedilla t}
-\definecharacter ydiaeresis {\buildtextaccent\textdiaeresis y}
-
-\stopencoding
-
-\endinput
diff --git a/tex/context/base/enco-el.mkii b/tex/context/base/enco-el.mkii
new file mode 100644
index 000000000..24729967b
--- /dev/null
+++ b/tex/context/base/enco-el.mkii
@@ -0,0 +1,272 @@
+%D \module
+%D [ file=enco-el,
+%D version=2005.08.24,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=EuroLetter,
+%D author={Several Users},
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This EuroLetter encoding vector, also known as Dense Encoding is
+%D the result of discussion among users, most noticably Adam Lindsay,
+%D Mojka Miklavec, Patrick Gundlach, Taco Hoekwater and \unknown.
+%D It was a follow up of a thread started long ago where we
+%D discussed an encoding without the weird, never used symbols, but
+%D with as many characters as possible in order to support the utf-8
+%D input regime.
+
+\startencoding[el]
+
+\definecasemaps 1 to 15 lc +16 uc 0
+\definecasemaps 17 to 31 lc 0 uc -16
+
+\definecasemaps 128 to 159 lc +32 uc 0
+\definecasemaps 160 to 191 lc 0 uc -32
+
+\definecasemaps 192 to 223 lc +32 uc 0
+\definecasemaps 224 to 255 lc 0 uc -32
+
+\definecasemap 92 92 124
+\definecasemap 92 124 92
+
+\definecharacter dotlessi 160
+\definecharacter endash 32
+\definecharacter emdash 16
+
+\definecharacter aeligature 230
+\definecharacter AEligature 198
+\definecharacter oeligature 247
+\definecharacter OEligature 215
+
+\definecharacter ssharp 38
+
+\definecharacter thorn 254
+\definecharacter Thorn 222
+
+\definecharacter eth 240
+\definecharacter Eth 208
+
+\definecharacter exclamdown 42
+\definecharacter questiondown 43
+
+\definecharacter quotedbl 35
+\definecharacter quotedblbase 36
+\definecharacter quotedblleft 34
+\definecharacter quotedblright 35
+
+\definecharacter quotesingle 39
+\definecharacter quotesinglebase 0
+
+\definecharacter quoteleft 96
+\definecharacter quoteright 39
+
+\definecharacter guilsingleleft 60
+\definecharacter guilsingleright 62
+
+\definecharacter leftguillemot 123
+\definecharacter rightguillemot 125
+
+\definecharacter Acircumflex 194
+\definecharacter acircumflex 226
+%definecharacter Ccircumflex {\buildtextaccent\textcircumflex C}
+%definecharacter ccircumflex {\buildtextaccent\textcircumflex c}
+\definecharacter Ecircumflex 202
+\definecharacter ecircumflex 234
+%definecharacter Gcircumflex {\buildtextaccent\textcircumflex G}
+%definecharacter gcircumflex {\buildtextaccent\textcircumflex g}
+%definecharacter Hcircumflex {\buildtextaccent\textcircumflex H}
+%definecharacter hcircumflex {\buildtextaccent\textcircumflex h}
+\definecharacter Icircumflex 206
+\definecharacter icircumflex 238
+%definecharacter Jcircumflex {\buildtextaccent\textcircumflex \dotlessJ}
+%definecharacter jcircumflex {\buildtextaccent\textcircumflex \dotlessj}
+\definecharacter Ocircumflex 212
+\definecharacter ocircumflex 244
+%definecharacter Scircumflex {\buildtextaccent\textcircumflex S}
+%definecharacter scircumflex {\buildtextaccent\textcircumflex s}
+\definecharacter Ucircumflex 219
+\definecharacter ucircumflex 251
+\definecharacter Wcircumflex 154
+\definecharacter wcircumflex 186
+\definecharacter Ycircumflex 156
+\definecharacter ycircumflex 188
+
+\definecharacter Agrave 192
+\definecharacter agrave 224
+\definecharacter Egrave 200
+\definecharacter egrave 232
+\definecharacter Igrave 204
+\definecharacter igrave 236
+\definecharacter Ograve 210
+\definecharacter ograve 242
+\definecharacter Ugrave 217
+\definecharacter ugrave 249
+\definecharacter Ygrave 155
+\definecharacter ygrave 187
+
+\definecharacter Atilde 195
+\definecharacter atilde 227
+%definecharacter Itilde {\buildtextaccent\texttilde \dotlessI}
+%definecharacter itilde {\buildtextaccent\texttilde \dotlessi}
+\definecharacter Ntilde 209
+\definecharacter ntilde 241
+\definecharacter Otilde 213
+\definecharacter otilde 245
+%definecharacter Utilde {\buildtextaccent\texttilde U}
+%definecharacter utilde {\buildtextaccent\texttilde u}
+%definecharacter Ytilde {\buildtextaccent\texttilde Y}
+%definecharacter ytilde {\buildtextaccent\texttilde y}
+
+\definecharacter Adiaeresis 196
+\definecharacter adiaeresis 228
+\definecharacter Ediaeresis 203
+\definecharacter ediaeresis 235
+\definecharacter Idiaeresis 207
+\definecharacter idiaeresis 239
+\definecharacter Odiaeresis 214
+\definecharacter odiaeresis 246
+\definecharacter Udiaeresis 220
+\definecharacter udiaeresis 252
+\definecharacter Ydiaeresis 223
+\definecharacter ydiaeresis 255
+
+\definecharacter Aacute 193
+\definecharacter aacute 225
+\definecharacter Cacute 4
+\definecharacter cacute 20
+\definecharacter Eacute 201
+\definecharacter eacute 233
+\definecharacter Iacute 205
+\definecharacter iacute 237
+\definecharacter Lacute 132
+\definecharacter lacute 164
+\definecharacter Nacute 136
+\definecharacter nacute 168
+\definecharacter Oacute 211
+\definecharacter oacute 243
+\definecharacter Racute 141
+\definecharacter racute 173
+\definecharacter Sacute 144
+\definecharacter sacute 176
+\definecharacter Uacute 218
+\definecharacter uacute 250
+\definecharacter Yacute 221
+\definecharacter yacute 253
+\definecharacter Zacute 157
+\definecharacter zacute 189
+
+\definecharacter Dstroke 8
+\definecharacter dstroke 24
+\definecharacter Hstroke 92
+\definecharacter hstroke 124
+%definecharacter Tstroke {T}
+%definecharacter tstroke {t}
+
+\definecharacter Cdotaccent 6
+\definecharacter cdotaccent 22
+\definecharacter Edotaccent 10
+\definecharacter edotaccent 26
+\definecharacter Gdotaccent 15
+\definecharacter gdotaccent 31
+\definecharacter Idotaccent 128
+%definecharacter idotaccent {\buildtextaccent\textdotaccent \dotlessi}
+\definecharacter Zdotaccent 159
+\definecharacter zdotaccent 191
+
+\definecharacter Amacron 2
+\definecharacter amacron 18
+\definecharacter Emacron 11
+\definecharacter emacron 27
+\definecharacter Imacron 129
+\definecharacter imacron 161
+\definecharacter Omacron 140
+\definecharacter omacron 172
+\definecharacter Umacron 152
+\definecharacter umacron 184
+
+\definecharacter Ccedilla 199
+\definecharacter ccedilla 231
+\definecharacter Scedilla 146
+\definecharacter scedilla 178
+
+\definecharacter Gcommaaccent 14
+\definecharacter gcommaaccent 30
+\definecharacter Kcommaaccent 131
+\definecharacter kcommaaccent 163
+\definecharacter Lcommaaccent 135
+\definecharacter lcommaaccent 167
+\definecharacter Ncommaaccent 138
+\definecharacter ncommaaccent 170
+\definecharacter Rcommaaccent 143
+\definecharacter rcommaaccent 175
+%definecharacter Tcedilla 149 % there is no tcedilla in encoding
+%definecharacter tcedilla 181
+
+\definecharacter Scommaaccent 147
+\definecharacter scommaaccent 179
+\definecharacter Tcommaaccent 149
+\definecharacter tcommaaccent 181
+
+\definecharacter Ohungarumlaut 139
+\definecharacter ohungarumlaut 171
+\definecharacter Uhungarumlaut 150
+\definecharacter uhungarumlaut 182
+
+\definecharacter Aogonek 3
+\definecharacter aogonek 19
+\definecharacter Eogonek 12
+\definecharacter eogonek 28
+\definecharacter Iogonek 130
+\definecharacter iogonek 162
+\definecharacter Uogonek 153
+\definecharacter uogonek 185
+
+\definecharacter Aring 197
+\definecharacter aring 229
+\definecharacter Uring 151
+\definecharacter uring 183
+
+\definecharacter Abreve 1
+\definecharacter abreve 17
+%definecharacter Ebreve {\buildtextaccent\textbreve E}
+%definecharacter ebreve {\buildtextaccent\textbreve e}
+\definecharacter Gbreve 13
+\definecharacter gbreve 29
+%definecharacter Ibreve {\buildtextaccent\textbreve \dotlessI}
+%definecharacter ibreve {\buildtextaccent\textbreve \dotlessi}
+%definecharacter Obreve {\buildtextaccent\textbreve O}
+%definecharacter obreve {\buildtextaccent\textbreve o}
+%definecharacter Ubreve {\buildtextaccent\textbreve U}
+%definecharacter ubreve {\buildtextaccent\textbreve u}
+
+\definecharacter Ccaron 5
+\definecharacter ccaron 21
+\definecharacter Dcaron 7
+\definecharacter dcaron 23
+\definecharacter Ecaron 9
+\definecharacter ecaron 25
+\definecharacter Lcaron 133
+\definecharacter lcaron 165
+\definecharacter Ncaron 137
+\definecharacter ncaron 169
+\definecharacter Rcaron 142
+\definecharacter rcaron 174
+\definecharacter Scaron 145
+\definecharacter scaron 177
+\definecharacter Tcaron 148
+\definecharacter tcaron 180
+%definecharacter Ycaron {\buildtextaccent\textcaron Y}
+%definecharacter ycaron {\buildtextaccent\textcaron y}
+\definecharacter Zcaron 158
+\definecharacter zcaron 190
+
+\definecharacter Lstroke 134
+\definecharacter lstroke 166
+\definecharacter Ostroke 216
+\definecharacter ostroke 248
+
+\stopencoding
diff --git a/tex/context/base/enco-el.tex b/tex/context/base/enco-el.tex
deleted file mode 100644
index 24729967b..000000000
--- a/tex/context/base/enco-el.tex
+++ /dev/null
@@ -1,272 +0,0 @@
-%D \module
-%D [ file=enco-el,
-%D version=2005.08.24,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=EuroLetter,
-%D author={Several Users},
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D This EuroLetter encoding vector, also known as Dense Encoding is
-%D the result of discussion among users, most noticably Adam Lindsay,
-%D Mojka Miklavec, Patrick Gundlach, Taco Hoekwater and \unknown.
-%D It was a follow up of a thread started long ago where we
-%D discussed an encoding without the weird, never used symbols, but
-%D with as many characters as possible in order to support the utf-8
-%D input regime.
-
-\startencoding[el]
-
-\definecasemaps 1 to 15 lc +16 uc 0
-\definecasemaps 17 to 31 lc 0 uc -16
-
-\definecasemaps 128 to 159 lc +32 uc 0
-\definecasemaps 160 to 191 lc 0 uc -32
-
-\definecasemaps 192 to 223 lc +32 uc 0
-\definecasemaps 224 to 255 lc 0 uc -32
-
-\definecasemap 92 92 124
-\definecasemap 92 124 92
-
-\definecharacter dotlessi 160
-\definecharacter endash 32
-\definecharacter emdash 16
-
-\definecharacter aeligature 230
-\definecharacter AEligature 198
-\definecharacter oeligature 247
-\definecharacter OEligature 215
-
-\definecharacter ssharp 38
-
-\definecharacter thorn 254
-\definecharacter Thorn 222
-
-\definecharacter eth 240
-\definecharacter Eth 208
-
-\definecharacter exclamdown 42
-\definecharacter questiondown 43
-
-\definecharacter quotedbl 35
-\definecharacter quotedblbase 36
-\definecharacter quotedblleft 34
-\definecharacter quotedblright 35
-
-\definecharacter quotesingle 39
-\definecharacter quotesinglebase 0
-
-\definecharacter quoteleft 96
-\definecharacter quoteright 39
-
-\definecharacter guilsingleleft 60
-\definecharacter guilsingleright 62
-
-\definecharacter leftguillemot 123
-\definecharacter rightguillemot 125
-
-\definecharacter Acircumflex 194
-\definecharacter acircumflex 226
-%definecharacter Ccircumflex {\buildtextaccent\textcircumflex C}
-%definecharacter ccircumflex {\buildtextaccent\textcircumflex c}
-\definecharacter Ecircumflex 202
-\definecharacter ecircumflex 234
-%definecharacter Gcircumflex {\buildtextaccent\textcircumflex G}
-%definecharacter gcircumflex {\buildtextaccent\textcircumflex g}
-%definecharacter Hcircumflex {\buildtextaccent\textcircumflex H}
-%definecharacter hcircumflex {\buildtextaccent\textcircumflex h}
-\definecharacter Icircumflex 206
-\definecharacter icircumflex 238
-%definecharacter Jcircumflex {\buildtextaccent\textcircumflex \dotlessJ}
-%definecharacter jcircumflex {\buildtextaccent\textcircumflex \dotlessj}
-\definecharacter Ocircumflex 212
-\definecharacter ocircumflex 244
-%definecharacter Scircumflex {\buildtextaccent\textcircumflex S}
-%definecharacter scircumflex {\buildtextaccent\textcircumflex s}
-\definecharacter Ucircumflex 219
-\definecharacter ucircumflex 251
-\definecharacter Wcircumflex 154
-\definecharacter wcircumflex 186
-\definecharacter Ycircumflex 156
-\definecharacter ycircumflex 188
-
-\definecharacter Agrave 192
-\definecharacter agrave 224
-\definecharacter Egrave 200
-\definecharacter egrave 232
-\definecharacter Igrave 204
-\definecharacter igrave 236
-\definecharacter Ograve 210
-\definecharacter ograve 242
-\definecharacter Ugrave 217
-\definecharacter ugrave 249
-\definecharacter Ygrave 155
-\definecharacter ygrave 187
-
-\definecharacter Atilde 195
-\definecharacter atilde 227
-%definecharacter Itilde {\buildtextaccent\texttilde \dotlessI}
-%definecharacter itilde {\buildtextaccent\texttilde \dotlessi}
-\definecharacter Ntilde 209
-\definecharacter ntilde 241
-\definecharacter Otilde 213
-\definecharacter otilde 245
-%definecharacter Utilde {\buildtextaccent\texttilde U}
-%definecharacter utilde {\buildtextaccent\texttilde u}
-%definecharacter Ytilde {\buildtextaccent\texttilde Y}
-%definecharacter ytilde {\buildtextaccent\texttilde y}
-
-\definecharacter Adiaeresis 196
-\definecharacter adiaeresis 228
-\definecharacter Ediaeresis 203
-\definecharacter ediaeresis 235
-\definecharacter Idiaeresis 207
-\definecharacter idiaeresis 239
-\definecharacter Odiaeresis 214
-\definecharacter odiaeresis 246
-\definecharacter Udiaeresis 220
-\definecharacter udiaeresis 252
-\definecharacter Ydiaeresis 223
-\definecharacter ydiaeresis 255
-
-\definecharacter Aacute 193
-\definecharacter aacute 225
-\definecharacter Cacute 4
-\definecharacter cacute 20
-\definecharacter Eacute 201
-\definecharacter eacute 233
-\definecharacter Iacute 205
-\definecharacter iacute 237
-\definecharacter Lacute 132
-\definecharacter lacute 164
-\definecharacter Nacute 136
-\definecharacter nacute 168
-\definecharacter Oacute 211
-\definecharacter oacute 243
-\definecharacter Racute 141
-\definecharacter racute 173
-\definecharacter Sacute 144
-\definecharacter sacute 176
-\definecharacter Uacute 218
-\definecharacter uacute 250
-\definecharacter Yacute 221
-\definecharacter yacute 253
-\definecharacter Zacute 157
-\definecharacter zacute 189
-
-\definecharacter Dstroke 8
-\definecharacter dstroke 24
-\definecharacter Hstroke 92
-\definecharacter hstroke 124
-%definecharacter Tstroke {T}
-%definecharacter tstroke {t}
-
-\definecharacter Cdotaccent 6
-\definecharacter cdotaccent 22
-\definecharacter Edotaccent 10
-\definecharacter edotaccent 26
-\definecharacter Gdotaccent 15
-\definecharacter gdotaccent 31
-\definecharacter Idotaccent 128
-%definecharacter idotaccent {\buildtextaccent\textdotaccent \dotlessi}
-\definecharacter Zdotaccent 159
-\definecharacter zdotaccent 191
-
-\definecharacter Amacron 2
-\definecharacter amacron 18
-\definecharacter Emacron 11
-\definecharacter emacron 27
-\definecharacter Imacron 129
-\definecharacter imacron 161
-\definecharacter Omacron 140
-\definecharacter omacron 172
-\definecharacter Umacron 152
-\definecharacter umacron 184
-
-\definecharacter Ccedilla 199
-\definecharacter ccedilla 231
-\definecharacter Scedilla 146
-\definecharacter scedilla 178
-
-\definecharacter Gcommaaccent 14
-\definecharacter gcommaaccent 30
-\definecharacter Kcommaaccent 131
-\definecharacter kcommaaccent 163
-\definecharacter Lcommaaccent 135
-\definecharacter lcommaaccent 167
-\definecharacter Ncommaaccent 138
-\definecharacter ncommaaccent 170
-\definecharacter Rcommaaccent 143
-\definecharacter rcommaaccent 175
-%definecharacter Tcedilla 149 % there is no tcedilla in encoding
-%definecharacter tcedilla 181
-
-\definecharacter Scommaaccent 147
-\definecharacter scommaaccent 179
-\definecharacter Tcommaaccent 149
-\definecharacter tcommaaccent 181
-
-\definecharacter Ohungarumlaut 139
-\definecharacter ohungarumlaut 171
-\definecharacter Uhungarumlaut 150
-\definecharacter uhungarumlaut 182
-
-\definecharacter Aogonek 3
-\definecharacter aogonek 19
-\definecharacter Eogonek 12
-\definecharacter eogonek 28
-\definecharacter Iogonek 130
-\definecharacter iogonek 162
-\definecharacter Uogonek 153
-\definecharacter uogonek 185
-
-\definecharacter Aring 197
-\definecharacter aring 229
-\definecharacter Uring 151
-\definecharacter uring 183
-
-\definecharacter Abreve 1
-\definecharacter abreve 17
-%definecharacter Ebreve {\buildtextaccent\textbreve E}
-%definecharacter ebreve {\buildtextaccent\textbreve e}
-\definecharacter Gbreve 13
-\definecharacter gbreve 29
-%definecharacter Ibreve {\buildtextaccent\textbreve \dotlessI}
-%definecharacter ibreve {\buildtextaccent\textbreve \dotlessi}
-%definecharacter Obreve {\buildtextaccent\textbreve O}
-%definecharacter obreve {\buildtextaccent\textbreve o}
-%definecharacter Ubreve {\buildtextaccent\textbreve U}
-%definecharacter ubreve {\buildtextaccent\textbreve u}
-
-\definecharacter Ccaron 5
-\definecharacter ccaron 21
-\definecharacter Dcaron 7
-\definecharacter dcaron 23
-\definecharacter Ecaron 9
-\definecharacter ecaron 25
-\definecharacter Lcaron 133
-\definecharacter lcaron 165
-\definecharacter Ncaron 137
-\definecharacter ncaron 169
-\definecharacter Rcaron 142
-\definecharacter rcaron 174
-\definecharacter Scaron 145
-\definecharacter scaron 177
-\definecharacter Tcaron 148
-\definecharacter tcaron 180
-%definecharacter Ycaron {\buildtextaccent\textcaron Y}
-%definecharacter ycaron {\buildtextaccent\textcaron y}
-\definecharacter Zcaron 158
-\definecharacter zcaron 190
-
-\definecharacter Lstroke 134
-\definecharacter lstroke 166
-\definecharacter Ostroke 216
-\definecharacter ostroke 248
-
-\stopencoding
diff --git a/tex/context/base/enco-fde.mkii b/tex/context/base/enco-fde.mkii
new file mode 100644
index 000000000..a7c11abfc
--- /dev/null
+++ b/tex/context/base/enco-fde.mkii
@@ -0,0 +1,128 @@
+%D \module
+%D [ file=enco-fde,
+%D version=2000.08.20,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=German Input Filter,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=Hans Hagen]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\doifmode{mkiv}{\endinput}
+
+\unprotect
+
+\installactivecharacter "
+
+\startlanguagespecifics[\s!de]
+
+ \installcompoundcharacter "a {\aumlaut\midworddiscretionary}
+ \installcompoundcharacter "e {\eumlaut\midworddiscretionary}
+ \installcompoundcharacter "i {\iumlaut\midworddiscretionary}
+ \installcompoundcharacter "o {\oumlaut\midworddiscretionary}
+ \installcompoundcharacter "u {\uumlaut\midworddiscretionary}
+ \installcompoundcharacter "s {\ssharp}
+ \installcompoundcharacter "z {\ssharp}
+
+ \installcompoundcharacter "A {\Aumlaut}
+ \installcompoundcharacter "E {\Eumlaut}
+ \installcompoundcharacter "I {\Iumlaut}
+ \installcompoundcharacter "O {\Oumlaut}
+ \installcompoundcharacter "U {\Uumlaut}
+ \installcompoundcharacter "Z {SZ}
+ \installcompoundcharacter "S {SS}
+
+\stoplanguagespecifics
+
+\startlanguagespecifics[\s!de]
+
+ \installcompoundcharacter "ck {\discretionary {k-}{k}{ck}}
+ \installcompoundcharacter "ff {\discretionary{ff-}{f}{ff}}
+ \installcompoundcharacter "ll {\discretionary{ll-}{l}{ll}}
+ \installcompoundcharacter "mm {\discretionary{mm-}{m}{mm}}
+ \installcompoundcharacter "nn {\discretionary{nn-}{n}{nn}}
+ \installcompoundcharacter "pp {\discretionary{pp-}{p}{pp}}
+ \installcompoundcharacter "rr {\discretionary{rr-}{r}{rr}}
+ \installcompoundcharacter "tt {\discretionary{tt-}{t}{tt}}
+
+ \installcompoundcharacter "CK {\discretionary {K-}{K}{CK}}
+ \installcompoundcharacter "FF {\discretionary{FF-}{F}{FF}}
+ \installcompoundcharacter "LL {\discretionary{LL-}{L}{LL}}
+ \installcompoundcharacter "MM {\discretionary{MM-}{M}{MM}}
+ \installcompoundcharacter "NN {\discretionary{NN-}{N}{NN}}
+ \installcompoundcharacter "PP {\discretionary{PP-}{P}{PP}}
+ \installcompoundcharacter "RR {\discretionary{RR-}{R}{RR}}
+ \installcompoundcharacter "TT {\discretionary{TT-}{T}{TT}}
+
+\stoplanguagespecifics
+
+\startlanguagespecifics[\s!de]
+
+ \installcompoundcharacter "` {\startdelimitedtext[\v!quotation]}
+ \installcompoundcharacter "' {\stopdelimitedtext}
+ \installcompoundcharacter ". {\kern.1em\ignorespaces}
+
+ %installcompoundcharacter "` {\languageparameter\c!leftquotation }
+ %installcompoundcharacter "' {\languageparameter\c!rightquotation}
+
+ \def\setupDElanguage
+ {\setuplanguage
+ [\s!de]
+ [\c!leftsentence=\leftguillemot,
+ \c!rightsentence=\rightguillemot,
+ \c!leftsubsentence=\leftsubguillemot,
+ \c!rightsubsentence=\rightsubguillemot]}
+
+ \installcompoundcharacter "< {{\setupDElanguage|<|}}
+ \installcompoundcharacter "> {{\setupDElanguage|>|}}
+ \installcompoundcharacter "| {|*|}
+
+\stoplanguagespecifics
+
+% \hyphenatedword{hinauff|*|liegen}
+% \hyphenatedword{hinauff"|liegen}
+
+%D An experimental hack:
+
+% no {\simplifiedcompoundcharacter"}
+
+% \startencoding[pdfdoc]
+% \startlanguagespecifics[\s!de]% hm, a % is needed
+% \defineactivecharacter " {\"}
+% \stoplanguagespecifics
+% \stopencoding
+
+\startencoding[ec]
+ \startlanguagespecifics[\s!de]%
+ \installcompoundcharacter "a {\adiaeresis}
+ \installcompoundcharacter "e {\ediaeresis}
+ \installcompoundcharacter "i {\idiaeresis}
+ \installcompoundcharacter "o {\odiaeresis}
+ \installcompoundcharacter "u {\udiaeresis}
+ \installcompoundcharacter "A {\Adiaeresis}
+ \installcompoundcharacter "E {\Ediaeresis}
+ \installcompoundcharacter "I {\Idiaeresis}
+ \installcompoundcharacter "O {\Odiaeresis}
+ \installcompoundcharacter "U {\Udiaeresis}
+ \stoplanguagespecifics
+\stopencoding
+
+\startencoding[texnansi]
+ \startlanguagespecifics[\s!de]%
+ \installcompoundcharacter "a {\adiaeresis}
+ \installcompoundcharacter "e {\ediaeresis}
+ \installcompoundcharacter "i {\idiaeresis}
+ \installcompoundcharacter "o {\odiaeresis}
+ \installcompoundcharacter "u {\udiaeresis}
+ \installcompoundcharacter "A {\Adiaeresis}
+ \installcompoundcharacter "E {\Ediaeresis}
+ \installcompoundcharacter "I {\Idiaeresis}
+ \installcompoundcharacter "O {\Odiaeresis}
+ \installcompoundcharacter "U {\Udiaeresis}
+ \stoplanguagespecifics
+\stopencoding
+
+\protect \endinput
diff --git a/tex/context/base/enco-fde.tex b/tex/context/base/enco-fde.tex
deleted file mode 100644
index a7c11abfc..000000000
--- a/tex/context/base/enco-fde.tex
+++ /dev/null
@@ -1,128 +0,0 @@
-%D \module
-%D [ file=enco-fde,
-%D version=2000.08.20,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=German Input Filter,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=Hans Hagen]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\doifmode{mkiv}{\endinput}
-
-\unprotect
-
-\installactivecharacter "
-
-\startlanguagespecifics[\s!de]
-
- \installcompoundcharacter "a {\aumlaut\midworddiscretionary}
- \installcompoundcharacter "e {\eumlaut\midworddiscretionary}
- \installcompoundcharacter "i {\iumlaut\midworddiscretionary}
- \installcompoundcharacter "o {\oumlaut\midworddiscretionary}
- \installcompoundcharacter "u {\uumlaut\midworddiscretionary}
- \installcompoundcharacter "s {\ssharp}
- \installcompoundcharacter "z {\ssharp}
-
- \installcompoundcharacter "A {\Aumlaut}
- \installcompoundcharacter "E {\Eumlaut}
- \installcompoundcharacter "I {\Iumlaut}
- \installcompoundcharacter "O {\Oumlaut}
- \installcompoundcharacter "U {\Uumlaut}
- \installcompoundcharacter "Z {SZ}
- \installcompoundcharacter "S {SS}
-
-\stoplanguagespecifics
-
-\startlanguagespecifics[\s!de]
-
- \installcompoundcharacter "ck {\discretionary {k-}{k}{ck}}
- \installcompoundcharacter "ff {\discretionary{ff-}{f}{ff}}
- \installcompoundcharacter "ll {\discretionary{ll-}{l}{ll}}
- \installcompoundcharacter "mm {\discretionary{mm-}{m}{mm}}
- \installcompoundcharacter "nn {\discretionary{nn-}{n}{nn}}
- \installcompoundcharacter "pp {\discretionary{pp-}{p}{pp}}
- \installcompoundcharacter "rr {\discretionary{rr-}{r}{rr}}
- \installcompoundcharacter "tt {\discretionary{tt-}{t}{tt}}
-
- \installcompoundcharacter "CK {\discretionary {K-}{K}{CK}}
- \installcompoundcharacter "FF {\discretionary{FF-}{F}{FF}}
- \installcompoundcharacter "LL {\discretionary{LL-}{L}{LL}}
- \installcompoundcharacter "MM {\discretionary{MM-}{M}{MM}}
- \installcompoundcharacter "NN {\discretionary{NN-}{N}{NN}}
- \installcompoundcharacter "PP {\discretionary{PP-}{P}{PP}}
- \installcompoundcharacter "RR {\discretionary{RR-}{R}{RR}}
- \installcompoundcharacter "TT {\discretionary{TT-}{T}{TT}}
-
-\stoplanguagespecifics
-
-\startlanguagespecifics[\s!de]
-
- \installcompoundcharacter "` {\startdelimitedtext[\v!quotation]}
- \installcompoundcharacter "' {\stopdelimitedtext}
- \installcompoundcharacter ". {\kern.1em\ignorespaces}
-
- %installcompoundcharacter "` {\languageparameter\c!leftquotation }
- %installcompoundcharacter "' {\languageparameter\c!rightquotation}
-
- \def\setupDElanguage
- {\setuplanguage
- [\s!de]
- [\c!leftsentence=\leftguillemot,
- \c!rightsentence=\rightguillemot,
- \c!leftsubsentence=\leftsubguillemot,
- \c!rightsubsentence=\rightsubguillemot]}
-
- \installcompoundcharacter "< {{\setupDElanguage|<|}}
- \installcompoundcharacter "> {{\setupDElanguage|>|}}
- \installcompoundcharacter "| {|*|}
-
-\stoplanguagespecifics
-
-% \hyphenatedword{hinauff|*|liegen}
-% \hyphenatedword{hinauff"|liegen}
-
-%D An experimental hack:
-
-% no {\simplifiedcompoundcharacter"}
-
-% \startencoding[pdfdoc]
-% \startlanguagespecifics[\s!de]% hm, a % is needed
-% \defineactivecharacter " {\"}
-% \stoplanguagespecifics
-% \stopencoding
-
-\startencoding[ec]
- \startlanguagespecifics[\s!de]%
- \installcompoundcharacter "a {\adiaeresis}
- \installcompoundcharacter "e {\ediaeresis}
- \installcompoundcharacter "i {\idiaeresis}
- \installcompoundcharacter "o {\odiaeresis}
- \installcompoundcharacter "u {\udiaeresis}
- \installcompoundcharacter "A {\Adiaeresis}
- \installcompoundcharacter "E {\Ediaeresis}
- \installcompoundcharacter "I {\Idiaeresis}
- \installcompoundcharacter "O {\Odiaeresis}
- \installcompoundcharacter "U {\Udiaeresis}
- \stoplanguagespecifics
-\stopencoding
-
-\startencoding[texnansi]
- \startlanguagespecifics[\s!de]%
- \installcompoundcharacter "a {\adiaeresis}
- \installcompoundcharacter "e {\ediaeresis}
- \installcompoundcharacter "i {\idiaeresis}
- \installcompoundcharacter "o {\odiaeresis}
- \installcompoundcharacter "u {\udiaeresis}
- \installcompoundcharacter "A {\Adiaeresis}
- \installcompoundcharacter "E {\Ediaeresis}
- \installcompoundcharacter "I {\Idiaeresis}
- \installcompoundcharacter "O {\Odiaeresis}
- \installcompoundcharacter "U {\Udiaeresis}
- \stoplanguagespecifics
-\stopencoding
-
-\protect \endinput
diff --git a/tex/context/base/enco-ffr.mkii b/tex/context/base/enco-ffr.mkii
new file mode 100644
index 000000000..c321153e8
--- /dev/null
+++ b/tex/context/base/enco-ffr.mkii
@@ -0,0 +1,53 @@
+%D \module
+%D [ file=enco-ffr,
+%D version=2002.05.07,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=French Input Filter,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=Hans Hagen]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\doifmode{mkiv}{\endinput}
+
+% \definehspace[fr][:][.25em]
+% \definehspace[fr][;][.25em]
+% \definehspace[fr][!][.25em]
+% \definehspace[fr][?][.25em]
+
+\enablemode[activecolon] \usemodule[tryout] % for the moment
+
+\installactivecharacter :
+\installactivecharacter ;
+\installactivecharacter ?
+\installactivecharacter !
+
+\unprotect
+
+\startlanguagespecifics[\s!fr]
+ \definetextmodediscretionary : {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentmainlanguage{:}:}
+ \definetextmodediscretionary ; {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentmainlanguage{;};}
+ \definetextmodediscretionary ? {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentmainlanguage{?}?}
+ \definetextmodediscretionary ! {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentmainlanguage{!}!}
+\stoplanguagespecifics
+
+\startlanguagespecifics[\s!fr]
+ \defineactivecharacter : {\mathortext{:}{\directdiscretionary{:}}}
+ \defineactivecharacter ; {\mathortext{;}{\directdiscretionary{;}}}
+ \defineactivecharacter ! {\mathortext{!}{\directdiscretionary{!}}}
+ \defineactivecharacter ? {\mathortext{?}{\directdiscretionary{?}}}
+\stoplanguagespecifics
+
+% maybe tricky due to possible name clashes:
+%
+% \def\ieme {\highordinalstr{e}}
+% \def\iemes{\highordinalstr{es}}
+% \def\ier {\highordinalstr{er}}
+% \def\iers {\highordinalstr{ers}}
+% \def\iere {\highordinalstr{re}}
+% \def\ieres{\highordinalstr{res}}
+
+\protect \endinput
diff --git a/tex/context/base/enco-ffr.tex b/tex/context/base/enco-ffr.tex
deleted file mode 100644
index c321153e8..000000000
--- a/tex/context/base/enco-ffr.tex
+++ /dev/null
@@ -1,53 +0,0 @@
-%D \module
-%D [ file=enco-ffr,
-%D version=2002.05.07,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=French Input Filter,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=Hans Hagen]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\doifmode{mkiv}{\endinput}
-
-% \definehspace[fr][:][.25em]
-% \definehspace[fr][;][.25em]
-% \definehspace[fr][!][.25em]
-% \definehspace[fr][?][.25em]
-
-\enablemode[activecolon] \usemodule[tryout] % for the moment
-
-\installactivecharacter :
-\installactivecharacter ;
-\installactivecharacter ?
-\installactivecharacter !
-
-\unprotect
-
-\startlanguagespecifics[\s!fr]
- \definetextmodediscretionary : {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentmainlanguage{:}:}
- \definetextmodediscretionary ; {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentmainlanguage{;};}
- \definetextmodediscretionary ? {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentmainlanguage{?}?}
- \definetextmodediscretionary ! {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentmainlanguage{!}!}
-\stoplanguagespecifics
-
-\startlanguagespecifics[\s!fr]
- \defineactivecharacter : {\mathortext{:}{\directdiscretionary{:}}}
- \defineactivecharacter ; {\mathortext{;}{\directdiscretionary{;}}}
- \defineactivecharacter ! {\mathortext{!}{\directdiscretionary{!}}}
- \defineactivecharacter ? {\mathortext{?}{\directdiscretionary{?}}}
-\stoplanguagespecifics
-
-% maybe tricky due to possible name clashes:
-%
-% \def\ieme {\highordinalstr{e}}
-% \def\iemes{\highordinalstr{es}}
-% \def\ier {\highordinalstr{er}}
-% \def\iers {\highordinalstr{ers}}
-% \def\iere {\highordinalstr{re}}
-% \def\ieres{\highordinalstr{res}}
-
-\protect \endinput
diff --git a/tex/context/base/enco-fpl.mkii b/tex/context/base/enco-fpl.mkii
new file mode 100644
index 000000000..14d102ff1
--- /dev/null
+++ b/tex/context/base/enco-fpl.mkii
@@ -0,0 +1,98 @@
+%D \module
+%D [ file=enco-fpl,
+%D version=2000.08.20,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Polish Input Filter,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=Hans Hagen]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D These definitions used to be part of lang-sla.tex.
+
+\unprotect
+
+% todo : named glyphs
+
+\installactivecharacter /
+
+\startlanguagespecifics[\s!pl]
+
+% \appendtoks \makecharacteractive / \to \everynormalcatcodes % obsolete
+
+ \installcompoundcharacter /a {\aogonek}
+ \installcompoundcharacter /c {\cacute}
+ \installcompoundcharacter /e {\eogonek}
+ \installcompoundcharacter /l {\lstroke}
+ \installcompoundcharacter /n {\nacute}
+ \installcompoundcharacter /o {\oacute}
+ \installcompoundcharacter /s {\sacute}
+ \installcompoundcharacter /x {\zacute}
+ \installcompoundcharacter /z {\zdotaccent}
+ \installcompoundcharacter /A {\Aogonek}
+ \installcompoundcharacter /C {\Cacute}
+ \installcompoundcharacter /E {\Eogonek}
+ \installcompoundcharacter /L {\Lstroke}
+ \installcompoundcharacter /N {\Nacute}
+ \installcompoundcharacter /O {\Oacute}
+ \installcompoundcharacter /S {\Sacute}
+ \installcompoundcharacter /X {\Zacute}
+ \installcompoundcharacter /Z {\Zdotaccent}
+
+\stoplanguagespecifics
+
+\startlanguagespecifics[\s!pl]
+
+ \installcompoundcharacter /, {\handlequotation\c!leftquotation}
+ \installcompoundcharacter /' {\handlequotation\c!rightquotation}
+
+ \def\setupPLlanguage%
+ {\setuplanguage
+ [\s!pl]
+ [\c!leftsentence=\leftguillemot,
+ \c!rightsentence=\rightguillemot,
+ \c!leftsubsentence=\leftsubguillemot,
+ \c!rightsubsentence=\rightsubguillemot]}
+
+ \installcompoundcharacter /< {{\setupPLlanguage|<|}}
+ \installcompoundcharacter /> {{\setupPLlanguage|>|}}
+
+ \installcompoundcharacter /- {|-|}
+
+\stoplanguagespecifics
+
+% obsolete
+%
+% \startlanguagespecifics[\s!pl]
+%
+% \definesortkey {/a}{a}{a}{\k a}
+% \definesortkey {/A}{a}{a}{\k a}
+% \definesortkey {/c}{c}{a}{\'c}
+% \definesortkey {/C}{c}{a}{\'c}
+% \definesortkey {/e}{e}{a}{\k e}
+% \definesortkey {/E}{e}{a}{\k e}
+% \definesortkey {/l}{l}{a}{\l }
+% \definesortkey {/L}{l}{a}{\l }
+% \definesortkey {/n}{n}{a}{\'n}
+% \definesortkey {/N}{n}{a}{\'n}
+% \definesortkey {/o}{o}{a}{\'o}
+% \definesortkey {/O}{o}{a}{\'o}
+% \definesortkey {/s}{s}{a}{\'s}
+% \definesortkey {/S}{s}{a}{\'s}
+% \definesortkey {/x}{z}{a}{\'x}
+% \definesortkey {/X}{z}{a}{\'x}
+% \definesortkey {/z}{z}{b}{\.z}
+% \definesortkey {/Z}{z}{b}{\.z}
+%
+% \stoplanguagespecifics
+
+\startencoding[pdfdoc]
+ \startlanguagespecifics[pl]% hm
+ \defineactivecharacter / {\simplifiedcompoundcharacter/}
+ \stoplanguagespecifics
+\stopencoding
+
+\protect \endinput
diff --git a/tex/context/base/enco-fpl.tex b/tex/context/base/enco-fpl.tex
deleted file mode 100644
index 14d102ff1..000000000
--- a/tex/context/base/enco-fpl.tex
+++ /dev/null
@@ -1,98 +0,0 @@
-%D \module
-%D [ file=enco-fpl,
-%D version=2000.08.20,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Polish Input Filter,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=Hans Hagen]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D These definitions used to be part of lang-sla.tex.
-
-\unprotect
-
-% todo : named glyphs
-
-\installactivecharacter /
-
-\startlanguagespecifics[\s!pl]
-
-% \appendtoks \makecharacteractive / \to \everynormalcatcodes % obsolete
-
- \installcompoundcharacter /a {\aogonek}
- \installcompoundcharacter /c {\cacute}
- \installcompoundcharacter /e {\eogonek}
- \installcompoundcharacter /l {\lstroke}
- \installcompoundcharacter /n {\nacute}
- \installcompoundcharacter /o {\oacute}
- \installcompoundcharacter /s {\sacute}
- \installcompoundcharacter /x {\zacute}
- \installcompoundcharacter /z {\zdotaccent}
- \installcompoundcharacter /A {\Aogonek}
- \installcompoundcharacter /C {\Cacute}
- \installcompoundcharacter /E {\Eogonek}
- \installcompoundcharacter /L {\Lstroke}
- \installcompoundcharacter /N {\Nacute}
- \installcompoundcharacter /O {\Oacute}
- \installcompoundcharacter /S {\Sacute}
- \installcompoundcharacter /X {\Zacute}
- \installcompoundcharacter /Z {\Zdotaccent}
-
-\stoplanguagespecifics
-
-\startlanguagespecifics[\s!pl]
-
- \installcompoundcharacter /, {\handlequotation\c!leftquotation}
- \installcompoundcharacter /' {\handlequotation\c!rightquotation}
-
- \def\setupPLlanguage%
- {\setuplanguage
- [\s!pl]
- [\c!leftsentence=\leftguillemot,
- \c!rightsentence=\rightguillemot,
- \c!leftsubsentence=\leftsubguillemot,
- \c!rightsubsentence=\rightsubguillemot]}
-
- \installcompoundcharacter /< {{\setupPLlanguage|<|}}
- \installcompoundcharacter /> {{\setupPLlanguage|>|}}
-
- \installcompoundcharacter /- {|-|}
-
-\stoplanguagespecifics
-
-% obsolete
-%
-% \startlanguagespecifics[\s!pl]
-%
-% \definesortkey {/a}{a}{a}{\k a}
-% \definesortkey {/A}{a}{a}{\k a}
-% \definesortkey {/c}{c}{a}{\'c}
-% \definesortkey {/C}{c}{a}{\'c}
-% \definesortkey {/e}{e}{a}{\k e}
-% \definesortkey {/E}{e}{a}{\k e}
-% \definesortkey {/l}{l}{a}{\l }
-% \definesortkey {/L}{l}{a}{\l }
-% \definesortkey {/n}{n}{a}{\'n}
-% \definesortkey {/N}{n}{a}{\'n}
-% \definesortkey {/o}{o}{a}{\'o}
-% \definesortkey {/O}{o}{a}{\'o}
-% \definesortkey {/s}{s}{a}{\'s}
-% \definesortkey {/S}{s}{a}{\'s}
-% \definesortkey {/x}{z}{a}{\'x}
-% \definesortkey {/X}{z}{a}{\'x}
-% \definesortkey {/z}{z}{b}{\.z}
-% \definesortkey {/Z}{z}{b}{\.z}
-%
-% \stoplanguagespecifics
-
-\startencoding[pdfdoc]
- \startlanguagespecifics[pl]% hm
- \defineactivecharacter / {\simplifiedcompoundcharacter/}
- \stoplanguagespecifics
-\stopencoding
-
-\protect \endinput
diff --git a/tex/context/base/enco-fro.mkii b/tex/context/base/enco-fro.mkii
new file mode 100644
index 000000000..e5f5e1257
--- /dev/null
+++ b/tex/context/base/enco-fro.mkii
@@ -0,0 +1,35 @@
+%D \module
+%D [ file=enco-fro,
+%D version=2000.08.20,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Romanian Input Filter,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=Hans Hagen]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D These definitions used to be part of lang-ita.tex.
+
+\unprotect
+
+\installactivecharacter "
+
+\startlanguagespecifics[\s!ro]
+
+ \installcompoundcharacter "a {\acircumflex}
+ \installcompoundcharacter "i {\icircumflex}
+ \installcompoundcharacter "s {\scedilla}
+ \installcompoundcharacter "t {\tcedilla}
+ \installcompoundcharacter "A {\Acircumflex}
+ \installcompoundcharacter "I {\Icircumflex}
+ \installcompoundcharacter "S {\Scedilla}
+ \installcompoundcharacter "T {\Tcedilla}
+ \installcompoundcharacter "` {\startdelimitedtext[\v!quotation]}
+ \installcompoundcharacter "' {\stopdelimitedtext}
+
+\stoplanguagespecifics
+
+\protect \endinput
diff --git a/tex/context/base/enco-fro.tex b/tex/context/base/enco-fro.tex
deleted file mode 100644
index e5f5e1257..000000000
--- a/tex/context/base/enco-fro.tex
+++ /dev/null
@@ -1,35 +0,0 @@
-%D \module
-%D [ file=enco-fro,
-%D version=2000.08.20,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Romanian Input Filter,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=Hans Hagen]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D These definitions used to be part of lang-ita.tex.
-
-\unprotect
-
-\installactivecharacter "
-
-\startlanguagespecifics[\s!ro]
-
- \installcompoundcharacter "a {\acircumflex}
- \installcompoundcharacter "i {\icircumflex}
- \installcompoundcharacter "s {\scedilla}
- \installcompoundcharacter "t {\tcedilla}
- \installcompoundcharacter "A {\Acircumflex}
- \installcompoundcharacter "I {\Icircumflex}
- \installcompoundcharacter "S {\Scedilla}
- \installcompoundcharacter "T {\Tcedilla}
- \installcompoundcharacter "` {\startdelimitedtext[\v!quotation]}
- \installcompoundcharacter "' {\stopdelimitedtext}
-
-\stoplanguagespecifics
-
-\protect \endinput
diff --git a/tex/context/base/enco-fsl.mkii b/tex/context/base/enco-fsl.mkii
new file mode 100644
index 000000000..86a41c88a
--- /dev/null
+++ b/tex/context/base/enco-fsl.mkii
@@ -0,0 +1,32 @@
+%D \module
+%D [ file=enco-fsl,
+%D version=2005.08.17,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Slovenian Specialities,
+%D author={Hans Hagen, Mojka Miklavec},
+%D date=\currentdate,
+%D copyright=Hans Hagen]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D Usage:
+%D
+%D \starttyping
+%D \useencoding[fsl]
+%D
+%D \starttext
+%D \dstroke \language[sl] \dstroke
+%D \stoptext
+%D \stoptyping
+
+\unprotect
+
+\startlanguagespecifics[\s!sl]
+ \startencoding[\s!default]
+ \definecharacter dstroke {d\zcaron} % hm, expects a space delimiter
+ \stopencoding
+\stoplanguagespecifics
+
+\protect \endinput
diff --git a/tex/context/base/enco-fsl.tex b/tex/context/base/enco-fsl.tex
deleted file mode 100644
index 86a41c88a..000000000
--- a/tex/context/base/enco-fsl.tex
+++ /dev/null
@@ -1,32 +0,0 @@
-%D \module
-%D [ file=enco-fsl,
-%D version=2005.08.17,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Slovenian Specialities,
-%D author={Hans Hagen, Mojka Miklavec},
-%D date=\currentdate,
-%D copyright=Hans Hagen]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D Usage:
-%D
-%D \starttyping
-%D \useencoding[fsl]
-%D
-%D \starttext
-%D \dstroke \language[sl] \dstroke
-%D \stoptext
-%D \stoptyping
-
-\unprotect
-
-\startlanguagespecifics[\s!sl]
- \startencoding[\s!default]
- \definecharacter dstroke {d\zcaron} % hm, expects a space delimiter
- \stopencoding
-\stoplanguagespecifics
-
-\protect \endinput
diff --git a/tex/context/base/enco-grk.mkii b/tex/context/base/enco-grk.mkii
new file mode 100644
index 000000000..882a3c9b0
--- /dev/null
+++ b/tex/context/base/enco-grk.mkii
@@ -0,0 +1,190 @@
+%D \module
+%D [ file=enco-grk,
+%D version=2003.03.01,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Greek,
+%D author=Apostolos Syropoulos,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmapping[iso-8859-7]
+
+% Uppercase Greek letters
+
+\definecasemap 193 193 225 % greekAlpha
+\definecasemap 194 194 226 % greekBeta
+\definecasemap 195 195 227 % greekGamma
+\definecasemap 196 196 228 % greekDelta
+\definecasemap 197 197 229 % greekEpsilon
+\definecasemap 198 198 230 % greekZeta
+\definecasemap 199 199 213 % greekEta
+\definecasemap 200 200 232 % greekTheta
+\definecasemap 201 201 233 % greekIota
+\definecasemap 202 202 234 % greekKappa
+\definecasemap 203 203 235 % greekLambda
+\definecasemap 204 204 236 % greekMu
+\definecasemap 205 205 237 % greekNu
+\definecasemap 206 206 238 % greekXi
+\definecasemap 207 207 239 % greekOmicron
+\definecasemap 208 208 240 % greekPi
+\definecasemap 209 209 241 % greekRho
+\definecasemap 211 211 243 % greekSigma
+\definecasemap 212 212 244 % greekTau
+\definecasemap 213 213 245 % greekUpsilon
+\definecasemap 214 214 246 % greekPhi
+\definecasemap 215 215 247 % greekChi
+\definecasemap 216 216 248 % greekPsi
+\definecasemap 217 217 249 % greekOmega
+
+% Lowercase Greek letters
+
+\definecasemap 225 193 225 % greekalpha
+\definecasemap 226 194 226 % greekbeta
+\definecasemap 227 195 227 % greekgamma
+\definecasemap 228 196 228 % greekdelta
+\definecasemap 229 197 229 % greekepsilon
+\definecasemap 230 198 230 % greekzeta
+\definecasemap 213 199 213 % greeketa
+\definecasemap 232 200 232 % greektheta
+\definecasemap 233 201 233 % greekiota
+\definecasemap 234 202 234 % greekkappa
+\definecasemap 235 203 235 % greeklambda
+\definecasemap 236 204 236 % greekmu
+\definecasemap 237 205 237 % greeknu
+\definecasemap 238 206 238 % greekxi
+\definecasemap 239 207 239 % greekomicron
+\definecasemap 240 208 240 % greekpi
+\definecasemap 241 209 241 % greekrho
+\definecasemap 242 211 242 % greekfinalsigma
+\definecasemap 243 211 243 % greekSigma
+\definecasemap 244 212 244 % greekTau
+\definecasemap 245 213 245 % greekUpsilon
+\definecasemap 246 214 246 % greekPhi
+\definecasemap 247 215 247 % greekChi
+\definecasemap 248 216 248 % greekPsi
+\definecasemap 249 217 249 % greekOmega
+
+% Accented Uppercase Greek letters
+
+\definecasemap 182 193 220 % greekAlphatonos
+\definecasemap 184 197 221 % greekEpsilontonos
+\definecasemap 185 199 222 % greekEtatonos
+\definecasemap 186 201 223 % greekIotatonos
+\definecasemap 188 207 252 % greekOmicrontonos
+\definecasemap 190 213 253 % greekUpsilontonos
+\definecasemap 191 217 254 % greekOmegatonos
+\definecasemap 218 218 250 % greekIotadialytika
+\definecasemap 219 219 251 % greekUpsilondialytika
+
+% Accented Lowercase Greek letters
+
+\definecasemap 220 193 220 % greekalphatonos
+\definecasemap 221 197 221 % greekepsilontonos
+\definecasemap 222 199 222 % greeketatonos
+\definecasemap 223 201 223 % greekiotatonos
+\definecasemap 252 207 252 % greekomicrontonos
+\definecasemap 253 213 253 % greekupsilontonos
+\definecasemap 254 217 254 % greekomegatonos
+\definecasemap 250 218 250 % greekiotadialytika
+\definecasemap 251 219 251 % greekupsilondialytika
+\definecasemap 192 218 192 % greekiotadialytikatonos
+\definecasemap 224 219 224 % greekupsilondialytikatonos
+
+\stopmapping
+
+\startencoding[iso-8859-7]
+
+% Uppercase Greek letters
+
+\definecharacter greekAlpha 193
+\definecharacter greekBeta 194
+\definecharacter greekGamma 195
+\definecharacter greekDelta 196
+\definecharacter greekEpsilon 197
+\definecharacter greekZeta 198
+\definecharacter greekEta 199
+\definecharacter greekTheta 200
+\definecharacter greekIota 201
+\definecharacter greekKappa 202
+\definecharacter greekLambda 203
+\definecharacter greekMu 204
+\definecharacter greekNu 205
+\definecharacter greekXi 206
+\definecharacter greekOmicron 207
+\definecharacter greekPi 208
+\definecharacter greekRho 209
+\definecharacter greekSigma 211
+\definecharacter greekTau 212
+\definecharacter greekUpsilon 213
+\definecharacter greekPhi 214
+\definecharacter greekChi 215
+\definecharacter greekPsi 216
+\definecharacter greekOmega 217
+
+% Lowercase Greek letters
+
+\definecharacter greekalpha 225
+\definecharacter greekbeta 226
+\definecharacter greekgamma 227
+\definecharacter greekdelta 228
+\definecharacter greekepsilon 229
+\definecharacter greekzeta 230
+\definecharacter greeketa 231
+\definecharacter greektheta 232
+\definecharacter greekiota 233
+\definecharacter greekkappa 234
+\definecharacter greeklambda 235
+\definecharacter greekmu 236
+\definecharacter greeknu 237
+\definecharacter greekxi 238
+\definecharacter greekomicron 239
+\definecharacter greekpi 240
+\definecharacter greekrho 241
+\definecharacter greekfinalsigma 242
+\definecharacter greeksigma 243
+\definecharacter greektau 244
+\definecharacter greekupsilon 245
+\definecharacter greekphi 246
+\definecharacter greekchi 247
+\definecharacter greekpsi 248
+\definecharacter greekomega 249
+
+% Accented Uppercase Greek letters
+
+\definecharacter greekAlphatonos 182
+\definecharacter greekEpsilontonos 184
+\definecharacter greekEtatonos 185
+\definecharacter greekIotatonos 186
+\definecharacter greekOmicrontonos 188
+\definecharacter greekUpsilontonos 190
+\definecharacter greekOmegatonos 191
+\definecharacter greekIotadialytika 218
+\definecharacter greekUpsilondialytika 219
+
+% Accented Lowercase Greek letters
+
+\definecharacter greekalphatonos 220
+\definecharacter greekepsilontonos 221
+\definecharacter greeketatonos 222
+\definecharacter greekiotatonos 223
+\definecharacter greekomicrontonos 252
+\definecharacter greekupsilontonos 253
+\definecharacter greekomegatonos 254
+\definecharacter greekiotadialytika 250
+\definecharacter greekupsilondialytika 251
+\definecharacter greekiotadialytikatonos 192
+\definecharacter greekupsilondialytikatonos 224
+
+% Miscellaneous Greek symbols
+
+\definecharacter greekleftquot 171
+\definecharacter greekrightquot 187
+\definecharacter greektonos 180
+\definecharacter greekdialytikatonos 181
+\definecharacter greekapostrophos 162
+
+\stopencoding
diff --git a/tex/context/base/enco-grk.tex b/tex/context/base/enco-grk.tex
deleted file mode 100644
index 882a3c9b0..000000000
--- a/tex/context/base/enco-grk.tex
+++ /dev/null
@@ -1,190 +0,0 @@
-%D \module
-%D [ file=enco-grk,
-%D version=2003.03.01,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Greek,
-%D author=Apostolos Syropoulos,
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\startmapping[iso-8859-7]
-
-% Uppercase Greek letters
-
-\definecasemap 193 193 225 % greekAlpha
-\definecasemap 194 194 226 % greekBeta
-\definecasemap 195 195 227 % greekGamma
-\definecasemap 196 196 228 % greekDelta
-\definecasemap 197 197 229 % greekEpsilon
-\definecasemap 198 198 230 % greekZeta
-\definecasemap 199 199 213 % greekEta
-\definecasemap 200 200 232 % greekTheta
-\definecasemap 201 201 233 % greekIota
-\definecasemap 202 202 234 % greekKappa
-\definecasemap 203 203 235 % greekLambda
-\definecasemap 204 204 236 % greekMu
-\definecasemap 205 205 237 % greekNu
-\definecasemap 206 206 238 % greekXi
-\definecasemap 207 207 239 % greekOmicron
-\definecasemap 208 208 240 % greekPi
-\definecasemap 209 209 241 % greekRho
-\definecasemap 211 211 243 % greekSigma
-\definecasemap 212 212 244 % greekTau
-\definecasemap 213 213 245 % greekUpsilon
-\definecasemap 214 214 246 % greekPhi
-\definecasemap 215 215 247 % greekChi
-\definecasemap 216 216 248 % greekPsi
-\definecasemap 217 217 249 % greekOmega
-
-% Lowercase Greek letters
-
-\definecasemap 225 193 225 % greekalpha
-\definecasemap 226 194 226 % greekbeta
-\definecasemap 227 195 227 % greekgamma
-\definecasemap 228 196 228 % greekdelta
-\definecasemap 229 197 229 % greekepsilon
-\definecasemap 230 198 230 % greekzeta
-\definecasemap 213 199 213 % greeketa
-\definecasemap 232 200 232 % greektheta
-\definecasemap 233 201 233 % greekiota
-\definecasemap 234 202 234 % greekkappa
-\definecasemap 235 203 235 % greeklambda
-\definecasemap 236 204 236 % greekmu
-\definecasemap 237 205 237 % greeknu
-\definecasemap 238 206 238 % greekxi
-\definecasemap 239 207 239 % greekomicron
-\definecasemap 240 208 240 % greekpi
-\definecasemap 241 209 241 % greekrho
-\definecasemap 242 211 242 % greekfinalsigma
-\definecasemap 243 211 243 % greekSigma
-\definecasemap 244 212 244 % greekTau
-\definecasemap 245 213 245 % greekUpsilon
-\definecasemap 246 214 246 % greekPhi
-\definecasemap 247 215 247 % greekChi
-\definecasemap 248 216 248 % greekPsi
-\definecasemap 249 217 249 % greekOmega
-
-% Accented Uppercase Greek letters
-
-\definecasemap 182 193 220 % greekAlphatonos
-\definecasemap 184 197 221 % greekEpsilontonos
-\definecasemap 185 199 222 % greekEtatonos
-\definecasemap 186 201 223 % greekIotatonos
-\definecasemap 188 207 252 % greekOmicrontonos
-\definecasemap 190 213 253 % greekUpsilontonos
-\definecasemap 191 217 254 % greekOmegatonos
-\definecasemap 218 218 250 % greekIotadialytika
-\definecasemap 219 219 251 % greekUpsilondialytika
-
-% Accented Lowercase Greek letters
-
-\definecasemap 220 193 220 % greekalphatonos
-\definecasemap 221 197 221 % greekepsilontonos
-\definecasemap 222 199 222 % greeketatonos
-\definecasemap 223 201 223 % greekiotatonos
-\definecasemap 252 207 252 % greekomicrontonos
-\definecasemap 253 213 253 % greekupsilontonos
-\definecasemap 254 217 254 % greekomegatonos
-\definecasemap 250 218 250 % greekiotadialytika
-\definecasemap 251 219 251 % greekupsilondialytika
-\definecasemap 192 218 192 % greekiotadialytikatonos
-\definecasemap 224 219 224 % greekupsilondialytikatonos
-
-\stopmapping
-
-\startencoding[iso-8859-7]
-
-% Uppercase Greek letters
-
-\definecharacter greekAlpha 193
-\definecharacter greekBeta 194
-\definecharacter greekGamma 195
-\definecharacter greekDelta 196
-\definecharacter greekEpsilon 197
-\definecharacter greekZeta 198
-\definecharacter greekEta 199
-\definecharacter greekTheta 200
-\definecharacter greekIota 201
-\definecharacter greekKappa 202
-\definecharacter greekLambda 203
-\definecharacter greekMu 204
-\definecharacter greekNu 205
-\definecharacter greekXi 206
-\definecharacter greekOmicron 207
-\definecharacter greekPi 208
-\definecharacter greekRho 209
-\definecharacter greekSigma 211
-\definecharacter greekTau 212
-\definecharacter greekUpsilon 213
-\definecharacter greekPhi 214
-\definecharacter greekChi 215
-\definecharacter greekPsi 216
-\definecharacter greekOmega 217
-
-% Lowercase Greek letters
-
-\definecharacter greekalpha 225
-\definecharacter greekbeta 226
-\definecharacter greekgamma 227
-\definecharacter greekdelta 228
-\definecharacter greekepsilon 229
-\definecharacter greekzeta 230
-\definecharacter greeketa 231
-\definecharacter greektheta 232
-\definecharacter greekiota 233
-\definecharacter greekkappa 234
-\definecharacter greeklambda 235
-\definecharacter greekmu 236
-\definecharacter greeknu 237
-\definecharacter greekxi 238
-\definecharacter greekomicron 239
-\definecharacter greekpi 240
-\definecharacter greekrho 241
-\definecharacter greekfinalsigma 242
-\definecharacter greeksigma 243
-\definecharacter greektau 244
-\definecharacter greekupsilon 245
-\definecharacter greekphi 246
-\definecharacter greekchi 247
-\definecharacter greekpsi 248
-\definecharacter greekomega 249
-
-% Accented Uppercase Greek letters
-
-\definecharacter greekAlphatonos 182
-\definecharacter greekEpsilontonos 184
-\definecharacter greekEtatonos 185
-\definecharacter greekIotatonos 186
-\definecharacter greekOmicrontonos 188
-\definecharacter greekUpsilontonos 190
-\definecharacter greekOmegatonos 191
-\definecharacter greekIotadialytika 218
-\definecharacter greekUpsilondialytika 219
-
-% Accented Lowercase Greek letters
-
-\definecharacter greekalphatonos 220
-\definecharacter greekepsilontonos 221
-\definecharacter greeketatonos 222
-\definecharacter greekiotatonos 223
-\definecharacter greekomicrontonos 252
-\definecharacter greekupsilontonos 253
-\definecharacter greekomegatonos 254
-\definecharacter greekiotadialytika 250
-\definecharacter greekupsilondialytika 251
-\definecharacter greekiotadialytikatonos 192
-\definecharacter greekupsilondialytikatonos 224
-
-% Miscellaneous Greek symbols
-
-\definecharacter greekleftquot 171
-\definecharacter greekrightquot 187
-\definecharacter greektonos 180
-\definecharacter greekdialytikatonos 181
-\definecharacter greekapostrophos 162
-
-\stopencoding
diff --git a/tex/context/base/enco-heb.mkii b/tex/context/base/enco-heb.mkii
new file mode 100644
index 000000000..443745752
--- /dev/null
+++ b/tex/context/base/enco-heb.mkii
@@ -0,0 +1,16 @@
+%D \module
+%D [ file=enco-heb,
+%D version=2005.01.27,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Hebrew,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D To be done.
+
+\endinput
diff --git a/tex/context/base/enco-heb.tex b/tex/context/base/enco-heb.tex
deleted file mode 100644
index 443745752..000000000
--- a/tex/context/base/enco-heb.tex
+++ /dev/null
@@ -1,16 +0,0 @@
-%D \module
-%D [ file=enco-heb,
-%D version=2005.01.27,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Hebrew,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D To be done.
-
-\endinput
diff --git a/tex/context/base/enco-ibm.mkii b/tex/context/base/enco-ibm.mkii
new file mode 100644
index 000000000..48695ca52
--- /dev/null
+++ b/tex/context/base/enco-ibm.mkii
@@ -0,0 +1,7 @@
+% temporary module, needed for downward compatibility
+
+%\input regi-ibm.tex
+
+\enableregime[ibm]
+
+\endinput
diff --git a/tex/context/base/enco-ibm.tex b/tex/context/base/enco-ibm.tex
deleted file mode 100644
index 48695ca52..000000000
--- a/tex/context/base/enco-ibm.tex
+++ /dev/null
@@ -1,7 +0,0 @@
-% temporary module, needed for downward compatibility
-
-%\input regi-ibm.tex
-
-\enableregime[ibm]
-
-\endinput
diff --git a/tex/context/base/enco-il2.mkii b/tex/context/base/enco-il2.mkii
new file mode 100644
index 000000000..9fb87b2fd
--- /dev/null
+++ b/tex/context/base/enco-il2.mkii
@@ -0,0 +1,157 @@
+%D \module
+%D [ file=enco-il2,
+%D version=2000.05.07, % 1998.12.01,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Czech and Slovak ISO Latin 2 Encoding,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% This encoding will go but the regime will remain.
+
+%D This Czech/Slovak encoding is dedicated to Han The Thanh.
+%D The numbers are derived from some files he sent me. This
+%D definition file is (still) sort of beta.
+
+\startmapping[il2]
+
+\resetcaserange 127 to 255 % we map them all to themselves
+
+\definecaseswap 184 152
+\definecaseswap 181 165
+\definecaseswap 185 169
+\definecaseswap 187 171
+\definecaseswap 190 174
+\definecaseswap 224 192
+\definecaseswap 225 193
+\definecaseswap 228 196
+\definecaseswap 229 197
+\definecaseswap 232 200
+\definecaseswap 233 201
+\definecaseswap 236 204
+\definecaseswap 237 205
+\definecaseswap 239 207
+\definecaseswap 242 210
+\definecaseswap 243 211
+\definecaseswap 244 212
+\definecaseswap 246 214
+\definecaseswap 248 216
+\definecaseswap 249 217
+\definecaseswap 250 218
+\definecaseswap 252 220
+\definecaseswap 253 221
+
+\stopmapping
+
+\startencoding[il2][il2]
+
+\definecharacter textgrave 18
+\definecharacter textacute 19
+\definecharacter textcaron 20
+\definecharacter textbreve 21
+\definecharacter textmacron 22
+\definecharacter textring 23
+\definecharacter textcedilla 24
+\definecharacter textcircumflex 94
+\definecharacter textdotaccent 95
+\definecharacter texthungarumlaut 125
+\definecharacter texttilde 126
+\definecharacter textdiaeresis 127
+
+\definecharacter dotlessi 16
+\definecharacter dotlessj 17
+
+\definecharacter aeligature 26
+\definecharacter AEligature 29
+\definecharacter oeligature 27
+\definecharacter OEligature 30
+
+\definecharacter ssharp 25
+
+\definecharacter Racute 192
+\definecharacter Aacute 193
+\definecharacter Lacute 197
+\definecharacter Eacute 201
+\definecharacter Iacute 205
+\definecharacter Oacute 211
+\definecharacter Uacute 218
+\definecharacter Yacute 221
+\definecharacter racute 224
+\definecharacter aacute 225
+\definecharacter lacute 229
+\definecharacter eacute 233
+\definecharacter iacute 237
+\definecharacter oacute 243
+\definecharacter uacute 250
+\definecharacter yacute 253
+
+\definecharacter Lcaron 165
+\definecharacter Scaron 169
+\definecharacter Tcaron 171
+\definecharacter Zcaron 174
+\definecharacter lcaron 181
+\definecharacter scaron 185
+\definecharacter tcaron 187
+\definecharacter zcaron 190
+\definecharacter Ccaron 200
+\definecharacter Ecaron 204
+\definecharacter Dcaron 207
+\definecharacter Ncaron 210
+\definecharacter Rcaron 216
+\definecharacter ccaron 232
+\definecharacter ecaron 236
+\definecharacter dcaron 239
+\definecharacter ncaron 242
+\definecharacter rcaron 248
+
+\definecharacter Ocircumflex 212
+\definecharacter ocircumflex 244
+
+\definecharacter Adiaeresis 196
+\definecharacter Odiaeresis 214
+\definecharacter Udiaeresis 220
+\definecharacter adiaeresis 228
+\definecharacter odiaeresis 246
+\definecharacter udiaeresis 252
+
+\definecharacter Agrave 152
+\definecharacter agrave 184
+
+\definecharacter Ohungarumlaut 213
+\definecharacter Uhungarumlaut 219
+\definecharacter ohungarumlaut 245
+\definecharacter uhungarumlaut 251
+
+\definecharacter Uring 217
+\definecharacter uring 249
+\definecharacter Aring {\ilencodedrA}
+
+\definecharacter ostroke 28
+\definecharacter Ostroke 31
+\definecharacter Lstroke {\ilencodedL}
+\definecharacter lstroke {\ilencodedl}
+
+\def\ilencodedrA
+ {\dontleavehmode\hbox\bgroup
+ \setbox0\hbox{h}%
+ \dimen0=\ht0
+ \advance\dimen0 by -1ex
+ \rlap{\raise.67\dimen0\hbox{\char'27}}A%
+ \egroup}
+
+\def\ilencodedl
+ {\dontleavehmode{\char32l}}
+
+\def\ilencodedL
+ {\dontleavehmode\hbox\bgroup
+ \setbox0\hbox{L}%
+ \hbox to\wd0{\hss\char32L}%
+ \egroup}
+
+\stopencoding
+
+\endinput
diff --git a/tex/context/base/enco-il2.tex b/tex/context/base/enco-il2.tex
deleted file mode 100644
index 9fb87b2fd..000000000
--- a/tex/context/base/enco-il2.tex
+++ /dev/null
@@ -1,157 +0,0 @@
-%D \module
-%D [ file=enco-il2,
-%D version=2000.05.07, % 1998.12.01,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Czech and Slovak ISO Latin 2 Encoding,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-% This encoding will go but the regime will remain.
-
-%D This Czech/Slovak encoding is dedicated to Han The Thanh.
-%D The numbers are derived from some files he sent me. This
-%D definition file is (still) sort of beta.
-
-\startmapping[il2]
-
-\resetcaserange 127 to 255 % we map them all to themselves
-
-\definecaseswap 184 152
-\definecaseswap 181 165
-\definecaseswap 185 169
-\definecaseswap 187 171
-\definecaseswap 190 174
-\definecaseswap 224 192
-\definecaseswap 225 193
-\definecaseswap 228 196
-\definecaseswap 229 197
-\definecaseswap 232 200
-\definecaseswap 233 201
-\definecaseswap 236 204
-\definecaseswap 237 205
-\definecaseswap 239 207
-\definecaseswap 242 210
-\definecaseswap 243 211
-\definecaseswap 244 212
-\definecaseswap 246 214
-\definecaseswap 248 216
-\definecaseswap 249 217
-\definecaseswap 250 218
-\definecaseswap 252 220
-\definecaseswap 253 221
-
-\stopmapping
-
-\startencoding[il2][il2]
-
-\definecharacter textgrave 18
-\definecharacter textacute 19
-\definecharacter textcaron 20
-\definecharacter textbreve 21
-\definecharacter textmacron 22
-\definecharacter textring 23
-\definecharacter textcedilla 24
-\definecharacter textcircumflex 94
-\definecharacter textdotaccent 95
-\definecharacter texthungarumlaut 125
-\definecharacter texttilde 126
-\definecharacter textdiaeresis 127
-
-\definecharacter dotlessi 16
-\definecharacter dotlessj 17
-
-\definecharacter aeligature 26
-\definecharacter AEligature 29
-\definecharacter oeligature 27
-\definecharacter OEligature 30
-
-\definecharacter ssharp 25
-
-\definecharacter Racute 192
-\definecharacter Aacute 193
-\definecharacter Lacute 197
-\definecharacter Eacute 201
-\definecharacter Iacute 205
-\definecharacter Oacute 211
-\definecharacter Uacute 218
-\definecharacter Yacute 221
-\definecharacter racute 224
-\definecharacter aacute 225
-\definecharacter lacute 229
-\definecharacter eacute 233
-\definecharacter iacute 237
-\definecharacter oacute 243
-\definecharacter uacute 250
-\definecharacter yacute 253
-
-\definecharacter Lcaron 165
-\definecharacter Scaron 169
-\definecharacter Tcaron 171
-\definecharacter Zcaron 174
-\definecharacter lcaron 181
-\definecharacter scaron 185
-\definecharacter tcaron 187
-\definecharacter zcaron 190
-\definecharacter Ccaron 200
-\definecharacter Ecaron 204
-\definecharacter Dcaron 207
-\definecharacter Ncaron 210
-\definecharacter Rcaron 216
-\definecharacter ccaron 232
-\definecharacter ecaron 236
-\definecharacter dcaron 239
-\definecharacter ncaron 242
-\definecharacter rcaron 248
-
-\definecharacter Ocircumflex 212
-\definecharacter ocircumflex 244
-
-\definecharacter Adiaeresis 196
-\definecharacter Odiaeresis 214
-\definecharacter Udiaeresis 220
-\definecharacter adiaeresis 228
-\definecharacter odiaeresis 246
-\definecharacter udiaeresis 252
-
-\definecharacter Agrave 152
-\definecharacter agrave 184
-
-\definecharacter Ohungarumlaut 213
-\definecharacter Uhungarumlaut 219
-\definecharacter ohungarumlaut 245
-\definecharacter uhungarumlaut 251
-
-\definecharacter Uring 217
-\definecharacter uring 249
-\definecharacter Aring {\ilencodedrA}
-
-\definecharacter ostroke 28
-\definecharacter Ostroke 31
-\definecharacter Lstroke {\ilencodedL}
-\definecharacter lstroke {\ilencodedl}
-
-\def\ilencodedrA
- {\dontleavehmode\hbox\bgroup
- \setbox0\hbox{h}%
- \dimen0=\ht0
- \advance\dimen0 by -1ex
- \rlap{\raise.67\dimen0\hbox{\char'27}}A%
- \egroup}
-
-\def\ilencodedl
- {\dontleavehmode{\char32l}}
-
-\def\ilencodedL
- {\dontleavehmode\hbox\bgroup
- \setbox0\hbox{L}%
- \hbox to\wd0{\hss\char32L}%
- \egroup}
-
-\stopencoding
-
-\endinput
diff --git a/tex/context/base/enco-ini.mkii b/tex/context/base/enco-ini.mkii
index 9379c3a7f..1ac491e62 100644
--- a/tex/context/base/enco-ini.mkii
+++ b/tex/context/base/enco-ini.mkii
@@ -93,7 +93,7 @@
{\letvalue{\c!file\f!encodingprefix#1}\empty
\makeshortfilename[\truefilename{\f!encodingprefix#1}]%
\startreadingfile
- \readsysfile\shortfilename
+ \readsysfile{\shortfilename.mkii}
{\showmessage\m!encodings2{#1}}
{\showmessage\m!encodings3{#1}}%
\stopreadingfile}}
@@ -747,11 +747,11 @@
%D can be used to check the correct loading of hyphenation
%D patterns.
-\fetchruntimecommand \showaccents {\f!encodingprefix\s!run}
-\fetchruntimecommand \showcharacters {\f!encodingprefix\s!run}
-\fetchruntimecommand \showcharacterbounds {\f!encodingprefix\s!run}
-\fetchruntimecommand \showhyphenations {\f!encodingprefix\s!run}
-\fetchruntimecommand \showmapping {\f!encodingprefix\s!run}
+\fetchruntimecommand \showaccents {\f!encodingprefix\s!run.mkii}
+\fetchruntimecommand \showcharacters {\f!encodingprefix\s!run.mkii}
+\fetchruntimecommand \showcharacterbounds {\f!encodingprefix\s!run.mkii}
+\fetchruntimecommand \showhyphenations {\f!encodingprefix\s!run.mkii}
+\fetchruntimecommand \showmapping {\f!encodingprefix\s!run.mkii}
%D \macros
%D {everyuppercase, EveryUppercase,
diff --git a/tex/context/base/enco-ini.mkiv b/tex/context/base/enco-ini.mkiv
index 5fd3d9cef..112c5596a 100644
--- a/tex/context/base/enco-ini.mkiv
+++ b/tex/context/base/enco-ini.mkiv
@@ -11,12 +11,12 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-%D This is s stripped down version of th eoriginal enco-ini.tex
+%D This is stripped down version of th eoriginal enco-ini.tex
%D file. For more details you might want to study the \MKII\ file
%D but since \LUATEX\ is unicode inside we need less code.
-% When dealing with characters we have four cases to take into account when moving
-% from mkii to mkiv:
+% When dealing with characters we have four cases to take into account
+% when moving from mkii to mkiv:
% 1. => ref to slot 200 in current font
% 2. \char 200 => ref to slot 200 in current font
@@ -36,36 +36,19 @@
\unprotect
-%D Quite some commands are now obsolete. These nillers will disappear soon.
-
-\def\currentencoding {utf}
-\def\currentmapping {utf}
-
-\let\defaultencoding \s!default
-\let\characterencoding \s!default
-\let\nocharacterencoding\s!default
-
-\def\setupencoding [#1]{}
-\def\startmapping [#1]{\gobbleuntil\stopmapping}
-\def\startencoding [#1]{}
-\let\stopencoding \relax
-\let\startcoding \startencoding
-\let\stopcoding \relax
-\def\optimizemapping [#1]{}
-\def\enablemapping [#1]{}
-\def\enableencoding [#1]{}
-\def\enablecoding [#1]{}
-\def\fastenableencoding #1{}
-\def\enablelanguagespecifics[#1]{}
-\def\useencoding [#1]{}
-
-\let\dontexpandencoding \relax
-\let\keepencodedtokens \relax
-\let\literateencodedtokens \relax
-\let\stringifyencodedtokens \relax
-\let\dontexpandencodedtokens\relax
-\let\convertencodedtokens \relax
-\let\ignoreencoding \relax
+%D Quite some commands are now obsolete. We keep only a few commands
+%D around, just in case they are used in styles (and in for instance
+%D symb and xtag files).
+
+\def\startencoding [#1]{} % used in symb
+\let\stopencoding \relax
+\def\setupencoding [#1]{}
+\def\enablemapping [#1]{}
+\def\enableencoding[#1]{}
+
+\def\currentencoding{utf}
+\def\currentmapping {utf}
+\let\defaultencoding\s!default
% todo:
@@ -78,14 +61,12 @@
%D \macros
%D {defineaccent, definecharacter, definecommand}
-\def\accentprefix{@acc@}
-
\def\defineaccent#1 #2 #3 %
{\setevalue{\string#1}{\noexpand\dohandleaccent{\string#1}}%
- \setvalue{\accentprefix\string#1\string#2}{#3}}
+ \setvalue{\??ac\string#1\string#2}{#3}}
\def\dohandleaccent#1#2%
- {\csname\accentprefix\string#1\string#2\endcsname}
+ {\csname\??ac\string#1\string#2\endcsname}
\def\definecharacter#1 #2 %
{\doifnumberelse{\string#2}
@@ -102,7 +83,7 @@
\newevery \everyuppercase \EveryUppercase
\newevery \everylowercase \EveryLowercase
-\newevery \everysanitize \EverySanitize
+\newevery \everysanitize \EverySanitize
%D Some saved meanings (not really needed):
@@ -371,21 +352,6 @@
\vrule \!!width\scratchdimen \!!height5.5\scratchdimen\!!depth3\scratchdimen
\kern\scratchdimen}}
-% what to do with these:
-%
-% \definecharacter mathacute "7013
-% \definecharacter mathgrave "7012
-% \definecharacter mathddot "707F
-% \definecharacter mathtilde "707E
-% \definecharacter mathbar "7016
-% \definecharacter mathbreve "7015
-% \definecharacter mathcheck "7014
-% \definecharacter mathhat "705E
-% \definecharacter mathvec "017E
-% \definecharacter mathdot "705F
-% \definecharacter mathwidetilde "0365
-% \definecharacter mathwidehat "0362
-
% from enco-acc:
\defineaccent ^ A {\Acircumflex} \defineaccent ^ a {\acircumflex}
@@ -412,6 +378,7 @@
\defineaccent ~ I {\Itilde} \defineaccent ~ i {\itilde} \defineaccent ~ {\i} {\itilde}
\defineaccent ~ O {\Otilde} \defineaccent ~ o {\otilde}
\defineaccent ~ U {\Utilde} \defineaccent ~ u {\utilde}
+\defineaccent ~ N {\Ntilde} \defineaccent ~ n {\ntilde}
\defineaccent " A {\Adiaeresis} \defineaccent " a {\adiaeresis}
\defineaccent " E {\Ediaeresis} \defineaccent " e {\ediaeresis}
@@ -512,7 +479,6 @@
\!!width \wd\scratchbox
\!!height\zeropoint}}
-
\def\fakeunderscores{\let\_\fakeunderscore}
\def\textunderscores{\let\_\textunderscore}
diff --git a/tex/context/base/enco-lat.mkii b/tex/context/base/enco-lat.mkii
new file mode 100644
index 000000000..2623aae8d
--- /dev/null
+++ b/tex/context/base/enco-lat.mkii
@@ -0,0 +1,7 @@
+% temporary module, needed for downward compatibility
+
+\input regi-lat.tex
+
+\enableregime[latin2]
+
+\endinput
diff --git a/tex/context/base/enco-lat.tex b/tex/context/base/enco-lat.tex
deleted file mode 100644
index 2623aae8d..000000000
--- a/tex/context/base/enco-lat.tex
+++ /dev/null
@@ -1,7 +0,0 @@
-% temporary module, needed for downward compatibility
-
-\input regi-lat.tex
-
-\enableregime[latin2]
-
-\endinput
diff --git a/tex/context/base/enco-mis.mkii b/tex/context/base/enco-mis.mkii
new file mode 100644
index 000000000..92dc61b3f
--- /dev/null
+++ b/tex/context/base/enco-mis.mkii
@@ -0,0 +1,188 @@
+%D \module
+%D [ file=enco-mis,
+%D version=2000.05.07, % 1999.11.11,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Missing Glyphs,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D In this file we collect some definitions that construct
+%D pseudo characters. Some day we will move some definitions
+%D from \type {plain.tex} to this file. Some definitions are
+%D derived from definitions in the \LATEX\ distribution,
+%D especially Johannes Braams' Babel system.
+
+\startmapping[\s!default]
+
+\defineuppercasecom \dj \DJ
+\defineuppercasecom \Dj \dj
+\defineuppercasecom \DJ \dj
+
+\definecharacter dstroke {\pseudoencodeddj}
+\definecharacter Dstroke {\pseudoencodedDJ}
+
+\stopmapping
+
+%D We need proper names like in enco-com.tex!
+
+\definecharacter dj {\dstroke} % {\pseudoencodeddj}
+\definecharacter Dj {\Dstroke} % {\pseudoencodedDJ}
+\definecharacter DJ {\Dstroke} % {\pseudoencodedDJ}
+
+\unprotect
+
+\def\pseudoencodeddj % like in babel, but safer
+ {\dontleavehmode\hbox\bgroup
+ \setbox\scratchbox\hbox{d}%
+ \scratchdimen\ht\scratchbox
+ \advance\scratchdimen 1ex
+ \scratchdimen.45\scratchdimen
+ \dimen2=\withoutpt\the\slantperpoint\dimen0
+ \advance\dimen2 .5ex
+ \hbox to \wd\scratchbox
+ {\box\scratchbox\hss
+ \raise\scratchdimen\hbox{\kern\dimen2\vbox{\hrule\!!height0.1ex\!!width0.3em}}}%
+ \egroup}
+
+\def\pseudoencodedDJ % design: taco; quality assurance: mojca; cleanup: hans
+ {\dontleavehmode
+ \hbox\bgroup
+ \setbox\scratchbox\hbox{D}%
+ \dimen2=1.1ex
+ \dimen2=\withoutpt\the\slantperpoint\dimen2
+ \hbox to \wd\scratchbox
+ {\rlap
+ {\raise.52\ht\scratchbox
+ \hbox
+ {\kern\dimen2
+ \vbox{\hrule\!!height.04ex\!!depth.04ex\!!width.4\wd\scratchbox}}}%
+ \box\scratchbox}%
+ \egroup}
+
+% currency
+
+\def\fakedollar % pretty cmr dependent
+ {\bgroup
+ \ifnum\fam=\itfam
+ \sl
+ \else\ifnum\fam=\bifam
+ \bs
+ \fi\fi
+ \$%
+ \egroup}
+
+\def\fakesterling % pretty cmr dependent
+ {\bgroup
+ \ifnum\fam=\bffam
+ \bi
+ \else\ifnum\fam=\bifam
+ \bi
+ \else\ifnum\fam=\bsfam
+ \bi
+ \else
+ \it
+ \fi\fi\fi
+ \$%
+ \egroup}
+
+\def\fakeflorin
+ {\bgroup
+ \ifnum\fam=\bffam
+ \bi
+ \else\ifnum\fam=\bifam
+ \bi
+ \else\ifnum\fam=\bsfam
+ \bi
+ \else
+ \it
+ \fi\fi\fi
+ f%
+ \egroup}
+
+% perthings
+
+\def\fakepercent
+ {\mathematics{^{\scriptscriptstyle0}\kern-.25em/\kern-.2em_{\scriptscriptstyle0}}}
+
+\def\fakeperthousand
+ {\mathematics{^{\scriptscriptstyle0}\kern-.25em/\kern-.2em_{\scriptscriptstyle00}}}
+
+\def\fakepermine
+ {\dontleavehmode
+ \bgroup
+ \setbox\scratchbox\hbox
+ {\mathematics{+}}%
+ \hbox to \wd\scratchbox
+ {\hss
+ \mathematics{^{\scriptscriptstyle-}\kern-.4em/\kern-.3em_{\scriptscriptstyle-}}%
+ \hss}%
+ \egroup}
+
+% guillemots
+
+%D Yes I know, they are ugly:
+
+\def\fakeleftguillemot
+ {\dontleavehmode\hbox{\raise.25ex\hbox{$\scriptscriptstyle\ll$}}}
+
+\def\fakerightguillemot
+ {\hbox{\raise.25ex\hbox{$\scriptscriptstyle\gg$}}}
+
+\def\fakeleftsubguillemot
+ {\dontleavehmode\hbox{\raise.25ex\hbox{$\scriptscriptstyle<$}}}
+
+\def\fakerightsubguillemot
+ {\hbox{\raise.25ex\hbox{$\scriptscriptstyle>$}}}
+
+%D Needed:
+
+\def\fakevisiblespace
+ {\leavevmode\hbox
+ {\setbox\scratchbox\hbox{(}%
+ \scratchdimen.1\dp\scratchbox
+ \setbox\scratchbox\hbox{\space}%
+ \hbox to \wd\scratchbox
+ {\vrule
+ \!!depth 5\scratchdimen
+ \!!width \scratchdimen
+ \!!height \zeropoint
+ \hss
+ \vrule
+ \!!depth 5\scratchdimen
+ \!!width \wd\scratchbox
+ \!!height-4\scratchdimen
+ \hss
+ \vrule
+ \!!depth 5\scratchdimen
+ \!!width \scratchdimen
+ \!!height \zeropoint}}}
+
+%\def\fakeunderscore{\leavevmode\kern.06em\vbox{\hrule\!!width.3em}}
+
+\def\fakeunderscore
+ {\leavevmode\hbox
+ {\setbox\scratchbox\hbox{(}%
+ \scratchdimen.2\dp\scratchbox
+ \setbox\scratchbox\hbox{\space}%
+ \vrule
+ \!!depth \scratchdimen
+ \!!width \wd\scratchbox
+ \!!height\zeropoint}}
+
+\ifx\mathunderscore\undefined \let\mathunderscore\fakeunderscore \fi
+\ifx\textunderscore\undefined \let\textunderscore\fakeunderscore \fi
+
+\unexpanded\def\normalunderscore{\ifmmode\mathunderscore\else\textunderscore\fi}
+
+\let\_\normalunderscore
+
+% Handy but obsolete, replaced by \unknownchar:
+%
+% \def\missingglyph{\ruledhbox{?}}
+
+\protect \endinput
diff --git a/tex/context/base/enco-mis.tex b/tex/context/base/enco-mis.tex
deleted file mode 100644
index 92dc61b3f..000000000
--- a/tex/context/base/enco-mis.tex
+++ /dev/null
@@ -1,188 +0,0 @@
-%D \module
-%D [ file=enco-mis,
-%D version=2000.05.07, % 1999.11.11,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Missing Glyphs,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D In this file we collect some definitions that construct
-%D pseudo characters. Some day we will move some definitions
-%D from \type {plain.tex} to this file. Some definitions are
-%D derived from definitions in the \LATEX\ distribution,
-%D especially Johannes Braams' Babel system.
-
-\startmapping[\s!default]
-
-\defineuppercasecom \dj \DJ
-\defineuppercasecom \Dj \dj
-\defineuppercasecom \DJ \dj
-
-\definecharacter dstroke {\pseudoencodeddj}
-\definecharacter Dstroke {\pseudoencodedDJ}
-
-\stopmapping
-
-%D We need proper names like in enco-com.tex!
-
-\definecharacter dj {\dstroke} % {\pseudoencodeddj}
-\definecharacter Dj {\Dstroke} % {\pseudoencodedDJ}
-\definecharacter DJ {\Dstroke} % {\pseudoencodedDJ}
-
-\unprotect
-
-\def\pseudoencodeddj % like in babel, but safer
- {\dontleavehmode\hbox\bgroup
- \setbox\scratchbox\hbox{d}%
- \scratchdimen\ht\scratchbox
- \advance\scratchdimen 1ex
- \scratchdimen.45\scratchdimen
- \dimen2=\withoutpt\the\slantperpoint\dimen0
- \advance\dimen2 .5ex
- \hbox to \wd\scratchbox
- {\box\scratchbox\hss
- \raise\scratchdimen\hbox{\kern\dimen2\vbox{\hrule\!!height0.1ex\!!width0.3em}}}%
- \egroup}
-
-\def\pseudoencodedDJ % design: taco; quality assurance: mojca; cleanup: hans
- {\dontleavehmode
- \hbox\bgroup
- \setbox\scratchbox\hbox{D}%
- \dimen2=1.1ex
- \dimen2=\withoutpt\the\slantperpoint\dimen2
- \hbox to \wd\scratchbox
- {\rlap
- {\raise.52\ht\scratchbox
- \hbox
- {\kern\dimen2
- \vbox{\hrule\!!height.04ex\!!depth.04ex\!!width.4\wd\scratchbox}}}%
- \box\scratchbox}%
- \egroup}
-
-% currency
-
-\def\fakedollar % pretty cmr dependent
- {\bgroup
- \ifnum\fam=\itfam
- \sl
- \else\ifnum\fam=\bifam
- \bs
- \fi\fi
- \$%
- \egroup}
-
-\def\fakesterling % pretty cmr dependent
- {\bgroup
- \ifnum\fam=\bffam
- \bi
- \else\ifnum\fam=\bifam
- \bi
- \else\ifnum\fam=\bsfam
- \bi
- \else
- \it
- \fi\fi\fi
- \$%
- \egroup}
-
-\def\fakeflorin
- {\bgroup
- \ifnum\fam=\bffam
- \bi
- \else\ifnum\fam=\bifam
- \bi
- \else\ifnum\fam=\bsfam
- \bi
- \else
- \it
- \fi\fi\fi
- f%
- \egroup}
-
-% perthings
-
-\def\fakepercent
- {\mathematics{^{\scriptscriptstyle0}\kern-.25em/\kern-.2em_{\scriptscriptstyle0}}}
-
-\def\fakeperthousand
- {\mathematics{^{\scriptscriptstyle0}\kern-.25em/\kern-.2em_{\scriptscriptstyle00}}}
-
-\def\fakepermine
- {\dontleavehmode
- \bgroup
- \setbox\scratchbox\hbox
- {\mathematics{+}}%
- \hbox to \wd\scratchbox
- {\hss
- \mathematics{^{\scriptscriptstyle-}\kern-.4em/\kern-.3em_{\scriptscriptstyle-}}%
- \hss}%
- \egroup}
-
-% guillemots
-
-%D Yes I know, they are ugly:
-
-\def\fakeleftguillemot
- {\dontleavehmode\hbox{\raise.25ex\hbox{$\scriptscriptstyle\ll$}}}
-
-\def\fakerightguillemot
- {\hbox{\raise.25ex\hbox{$\scriptscriptstyle\gg$}}}
-
-\def\fakeleftsubguillemot
- {\dontleavehmode\hbox{\raise.25ex\hbox{$\scriptscriptstyle<$}}}
-
-\def\fakerightsubguillemot
- {\hbox{\raise.25ex\hbox{$\scriptscriptstyle>$}}}
-
-%D Needed:
-
-\def\fakevisiblespace
- {\leavevmode\hbox
- {\setbox\scratchbox\hbox{(}%
- \scratchdimen.1\dp\scratchbox
- \setbox\scratchbox\hbox{\space}%
- \hbox to \wd\scratchbox
- {\vrule
- \!!depth 5\scratchdimen
- \!!width \scratchdimen
- \!!height \zeropoint
- \hss
- \vrule
- \!!depth 5\scratchdimen
- \!!width \wd\scratchbox
- \!!height-4\scratchdimen
- \hss
- \vrule
- \!!depth 5\scratchdimen
- \!!width \scratchdimen
- \!!height \zeropoint}}}
-
-%\def\fakeunderscore{\leavevmode\kern.06em\vbox{\hrule\!!width.3em}}
-
-\def\fakeunderscore
- {\leavevmode\hbox
- {\setbox\scratchbox\hbox{(}%
- \scratchdimen.2\dp\scratchbox
- \setbox\scratchbox\hbox{\space}%
- \vrule
- \!!depth \scratchdimen
- \!!width \wd\scratchbox
- \!!height\zeropoint}}
-
-\ifx\mathunderscore\undefined \let\mathunderscore\fakeunderscore \fi
-\ifx\textunderscore\undefined \let\textunderscore\fakeunderscore \fi
-
-\unexpanded\def\normalunderscore{\ifmmode\mathunderscore\else\textunderscore\fi}
-
-\let\_\normalunderscore
-
-% Handy but obsolete, replaced by \unknownchar:
-%
-% \def\missingglyph{\ruledhbox{?}}
-
-\protect \endinput
diff --git a/tex/context/base/enco-pdf.mkii b/tex/context/base/enco-pdf.mkii
new file mode 100644
index 000000000..a03e81df2
--- /dev/null
+++ b/tex/context/base/enco-pdf.mkii
@@ -0,0 +1,278 @@
+%D \module
+%D [ file=enco-pdf,
+%D version=1995.01.01,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=\YandY\ texnansi Encoding,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=Hans Hagen]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This is the \PDF\ document encoding.
+
+\startencoding[pdfdoc] % \rawcharacter{number}
+
+\definecharacter oeligature ^^9c
+
+\definecharacter leftguillemot ^^ab
+\definecharacter rightguillemot ^^bb
+
+\definecharacter Agrave ^^c0
+\definecharacter Aacute ^^c1
+\definecharacter Acircumflex ^^c2
+\definecharacter Atilde ^^c3
+\definecharacter Adiaeresis ^^c4
+\definecharacter OAligature ^^c5
+\definecharacter AEligature ^^c6
+\definecharacter Ccedilla ^^c7
+\definecharacter Egrave ^^c8
+\definecharacter Eacute ^^c9
+\definecharacter Ecircumflex ^^ca
+\definecharacter Ediaeresis ^^cb
+\definecharacter Igrave ^^cc
+\definecharacter Iacute ^^cd
+\definecharacter Icircumflex ^^ce
+\definecharacter Idiaeresis ^^cf
+
+\definecharacter Ntilde ^^d1
+\definecharacter Ograve ^^d2
+\definecharacter Oacute ^^d3
+\definecharacter Ocircumflex ^^d4
+\definecharacter Otilde ^^d5
+\definecharacter Odiaeresis ^^d6
+
+\definecharacter Ugrave ^^d9
+\definecharacter Uacute ^^da
+\definecharacter Ucircumflex ^^db
+\definecharacter Udiaeresis ^^dc
+\definecharacter Yacute ^^dd
+
+\definecharacter ssharp ^^df
+\definecharacter agrave ^^e0
+\definecharacter aacute ^^e1
+\definecharacter acircumflex ^^e2
+\definecharacter atilde ^^e3
+\definecharacter adiaeresis ^^e4
+\definecharacter oaligature ^^e5
+\definecharacter aeligature ^^e6
+\definecharacter ccedilla ^^e7
+\definecharacter egrave ^^e8
+\definecharacter eacute ^^e9
+\definecharacter ecircumflex ^^ea
+\definecharacter ediaeresis ^^eb
+\definecharacter igrave ^^ec
+\definecharacter iacute ^^ed
+\definecharacter icircumflex ^^ee
+\definecharacter idiaeresis ^^ef
+
+\definecharacter ntilde ^^f1
+\definecharacter ograve ^^f2
+\definecharacter oacute ^^f3
+\definecharacter ocircumflex ^^f4
+\definecharacter otilde ^^f5
+\definecharacter odiaeresis ^^f6
+
+\definecharacter ugrave ^^f9
+\definecharacter uacute ^^fa
+\definecharacter ucircumflex ^^fb
+\definecharacter udiaeresis ^^fc
+\definecharacter yacute ^^fd
+
+\definecharacter ydiaeresis ^^ff
+
+\definecharacter leftsubguillemot {\leftguillemot}
+\definecharacter rightsubguillemot {\rightguillemot}
+
+\definecharacter Uhungarumlaut {\Ucircumflex}
+\definecharacter uhungarumlaut {\ucircumflex}
+\definecharacter Ohungarumlaut {\Ocircumflex}
+\definecharacter ohungarumlaut {\ocircumflex}
+
+\definecharacter Aogonek {A}
+\definecharacter aogonek {a}
+\definecharacter Eogonek {E}
+\definecharacter eogonek {e}
+\definecharacter Iogonek {I}
+\definecharacter iogonek {i}
+\definecharacter Uogonek {U}
+\definecharacter uogonek {u}
+
+\definecharacter Aring {A}
+\definecharacter aring {a}
+\definecharacter Uring {U}
+\definecharacter uring {u}
+
+\definecharacter Abreve {A}
+\definecharacter abreve {a}
+\definecharacter Ebreve {E}
+\definecharacter ebreve {e}
+\definecharacter Gbreve {G}
+\definecharacter gbreve {g}
+\definecharacter Ibreve {I}
+\definecharacter ibreve {i}
+\definecharacter Obreve {O}
+\definecharacter obreve {o}
+\definecharacter Ubreve {U}
+\definecharacter ubreve {u}
+
+\definecharacter Ccaron {C}
+\definecharacter ccaron {c}
+\definecharacter Dcaron {D}
+\definecharacter dcaron {d}
+\definecharacter Ecaron {E}
+\definecharacter ecaron {e}
+\definecharacter Lcaron {L}
+\definecharacter lcaron {l}
+\definecharacter Ncaron {N}
+\definecharacter ncaron {n}
+\definecharacter Rcaron {R}
+\definecharacter rcaron {r}
+\definecharacter Scaron {S}
+\definecharacter scaron {s}
+\definecharacter Tcaron {T}
+\definecharacter tcaron {t}
+\definecharacter Ycaron {Y}
+\definecharacter ycaron {y}
+\definecharacter Zcaron {Z}
+\definecharacter zcaron {z}
+
+\definecharacter Lstroke {L}
+\definecharacter lstroke {l}
+\definecharacter Ostroke {O}
+\definecharacter ostroke {o}
+
+\definecharacter aumlaut {\adiaeresis}
+\definecharacter eumlaut {\ediaeresis}
+\definecharacter iumlaut {\idiaeresis}
+\definecharacter oumlaut {\odiaeresis}
+\definecharacter uumlaut {\udiaeresis}
+
+\definecharacter Aumlaut {\Adiaeresis}
+\definecharacter Eumlaut {\Ediaeresis}
+\definecharacter Iumlaut {\Idiaeresis}
+\definecharacter Oumlaut {\Odiaeresis}
+\definecharacter Uumlaut {\Udiaeresis}
+
+\definecharacter scommaaccent {s}
+\definecharacter Scommaaccent {S}
+\definecharacter tcommaaccent {t}
+\definecharacter Tcommaaccent {T}
+
+\definecharacter Etilde {E}
+\definecharacter etilde {e}
+
+\definecharacter Ahook {A}
+\definecharacter ahook {a}
+\definecharacter Ehook {E}
+\definecharacter ehook {e}
+\definecharacter Ihook {I}
+\definecharacter ihook {i}
+\definecharacter Ohook {O}
+\definecharacter ohook {o}
+\definecharacter Uhook {U}
+\definecharacter uhook {u}
+\definecharacter Yhook {Y}
+\definecharacter yhook {y}
+
+\definecharacter Acircumflexgrave {\Acircumflex}
+\definecharacter Acircumflexacute {\Acircumflex}
+\definecharacter Acircumflextilde {\Acircumflex}
+\definecharacter Acircumflexhook {\Acircumflex}
+\definecharacter acircumflexgrave {\acircumflex}
+\definecharacter acircumflexacute {\acircumflex}
+\definecharacter acircumflextilde {\acircumflex}
+\definecharacter acircumflexhook {\acircumflex}
+\definecharacter Ecircumflexgrave {\Ecircumflex}
+\definecharacter Ecircumflexacute {\Ecircumflex}
+\definecharacter Ecircumflextilde {\Ecircumflex}
+\definecharacter Ecircumflexhook {\Ecircumflex}
+\definecharacter ecircumflexgrave {\ecircumflex}
+\definecharacter ecircumflexacute {\ecircumflex}
+\definecharacter ecircumflextilde {\ecircumflex}
+\definecharacter ecircumflexhook {\ecircumflex}
+\definecharacter Ocircumflexgrave {\Ocircumflex}
+\definecharacter Ocircumflexacute {\Ocircumflex}
+\definecharacter Ocircumflextilde {\Ocircumflex}
+\definecharacter Ocircumflexhook {\Ocircumflex}
+\definecharacter ocircumflexgrave {\ocircumflex}
+\definecharacter ocircumflexacute {\ocircumflex}
+\definecharacter ocircumflextilde {\ocircumflex}
+\definecharacter ocircumflexhook {\ocircumflex}
+
+\definecharacter Abrevegrave {A}
+\definecharacter Abreveacute {A}
+\definecharacter Abrevetilde {A}
+\definecharacter Abrevehook {A}
+\definecharacter abrevegrave {a}
+\definecharacter abreveacute {a}
+\definecharacter abrevetilde {a}
+\definecharacter abrevehook {a}
+
+\definecharacter Adotbelow {A}
+\definecharacter adotbelow {a}
+\definecharacter Edotbelow {E}
+\definecharacter edotbelow {e}
+\definecharacter Idotbelow {I}
+\definecharacter idotbelow {i}
+\definecharacter Odotbelow {O}
+\definecharacter odotbelow {o}
+\definecharacter Udotbelow {U}
+\definecharacter udotbelow {u}
+\definecharacter Ydotbelow {Y}
+\definecharacter ydotbelow {y}
+\definecharacter Ohorndotbelow {O}
+\definecharacter ohorndotbelow {o}
+\definecharacter Uhorndotbelow {U}
+\definecharacter uhorndotbelow {u}
+
+\definecharacter Acircumflexdotbelow {\Acircumflex}
+\definecharacter acircumflexdotbelow {\acircumflex}
+\definecharacter Ecircumflexdotbelow {\Ecircumflex}
+\definecharacter ecircumflexdotbelow {\ecircumflex}
+\definecharacter Ocircumflexdotbelow {\Ocircumflex}
+\definecharacter ocircumflexdotbelow {\ocircumflex}
+\definecharacter Abrevedotbelow {\Abreve}
+\definecharacter abrevedotbelow {\abreve}
+
+\definecharacter Ohorn {O}
+\definecharacter Ohorngrave {O}
+\definecharacter Ohornacute {O}
+\definecharacter Ohorntilde {O}
+\definecharacter Ohornhook {O}
+
+\definecharacter ohorn {o}
+\definecharacter ohorngrave {o}
+\definecharacter ohornacute {o}
+\definecharacter ohorntilde {o}
+\definecharacter ohornhook {o}
+
+\definecharacter Uhorn {U}
+\definecharacter Uhorngrave {U}
+\definecharacter Uhornacute {U}
+\definecharacter Uhorntilde {U}
+\definecharacter Uhornhook {U}
+
+\definecharacter uhorn {u}
+\definecharacter uhorngrave {u}
+\definecharacter uhornacute {u}
+\definecharacter uhorntilde {u}
+\definecharacter uhornhook {u}
+
+\definecharacter Utilde {U}
+\definecharacter utilde {u}
+\definecharacter Itilde {I}
+\definecharacter itilde {i}
+\definecharacter Ygrave {Y}
+\definecharacter ygrave {y}
+\definecharacter Ytilde {Y}
+\definecharacter ytilde {y}
+
+\definecharacter dstroke {d}
+\definecharacter Dstroke {D}
+
+\stopencoding
+
+\endinput
diff --git a/tex/context/base/enco-pdf.tex b/tex/context/base/enco-pdf.tex
deleted file mode 100644
index a03e81df2..000000000
--- a/tex/context/base/enco-pdf.tex
+++ /dev/null
@@ -1,278 +0,0 @@
-%D \module
-%D [ file=enco-pdf,
-%D version=1995.01.01,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=\YandY\ texnansi Encoding,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=Hans Hagen]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D This is the \PDF\ document encoding.
-
-\startencoding[pdfdoc] % \rawcharacter{number}
-
-\definecharacter oeligature ^^9c
-
-\definecharacter leftguillemot ^^ab
-\definecharacter rightguillemot ^^bb
-
-\definecharacter Agrave ^^c0
-\definecharacter Aacute ^^c1
-\definecharacter Acircumflex ^^c2
-\definecharacter Atilde ^^c3
-\definecharacter Adiaeresis ^^c4
-\definecharacter OAligature ^^c5
-\definecharacter AEligature ^^c6
-\definecharacter Ccedilla ^^c7
-\definecharacter Egrave ^^c8
-\definecharacter Eacute ^^c9
-\definecharacter Ecircumflex ^^ca
-\definecharacter Ediaeresis ^^cb
-\definecharacter Igrave ^^cc
-\definecharacter Iacute ^^cd
-\definecharacter Icircumflex ^^ce
-\definecharacter Idiaeresis ^^cf
-
-\definecharacter Ntilde ^^d1
-\definecharacter Ograve ^^d2
-\definecharacter Oacute ^^d3
-\definecharacter Ocircumflex ^^d4
-\definecharacter Otilde ^^d5
-\definecharacter Odiaeresis ^^d6
-
-\definecharacter Ugrave ^^d9
-\definecharacter Uacute ^^da
-\definecharacter Ucircumflex ^^db
-\definecharacter Udiaeresis ^^dc
-\definecharacter Yacute ^^dd
-
-\definecharacter ssharp ^^df
-\definecharacter agrave ^^e0
-\definecharacter aacute ^^e1
-\definecharacter acircumflex ^^e2
-\definecharacter atilde ^^e3
-\definecharacter adiaeresis ^^e4
-\definecharacter oaligature ^^e5
-\definecharacter aeligature ^^e6
-\definecharacter ccedilla ^^e7
-\definecharacter egrave ^^e8
-\definecharacter eacute ^^e9
-\definecharacter ecircumflex ^^ea
-\definecharacter ediaeresis ^^eb
-\definecharacter igrave ^^ec
-\definecharacter iacute ^^ed
-\definecharacter icircumflex ^^ee
-\definecharacter idiaeresis ^^ef
-
-\definecharacter ntilde ^^f1
-\definecharacter ograve ^^f2
-\definecharacter oacute ^^f3
-\definecharacter ocircumflex ^^f4
-\definecharacter otilde ^^f5
-\definecharacter odiaeresis ^^f6
-
-\definecharacter ugrave ^^f9
-\definecharacter uacute ^^fa
-\definecharacter ucircumflex ^^fb
-\definecharacter udiaeresis ^^fc
-\definecharacter yacute ^^fd
-
-\definecharacter ydiaeresis ^^ff
-
-\definecharacter leftsubguillemot {\leftguillemot}
-\definecharacter rightsubguillemot {\rightguillemot}
-
-\definecharacter Uhungarumlaut {\Ucircumflex}
-\definecharacter uhungarumlaut {\ucircumflex}
-\definecharacter Ohungarumlaut {\Ocircumflex}
-\definecharacter ohungarumlaut {\ocircumflex}
-
-\definecharacter Aogonek {A}
-\definecharacter aogonek {a}
-\definecharacter Eogonek {E}
-\definecharacter eogonek {e}
-\definecharacter Iogonek {I}
-\definecharacter iogonek {i}
-\definecharacter Uogonek {U}
-\definecharacter uogonek {u}
-
-\definecharacter Aring {A}
-\definecharacter aring {a}
-\definecharacter Uring {U}
-\definecharacter uring {u}
-
-\definecharacter Abreve {A}
-\definecharacter abreve {a}
-\definecharacter Ebreve {E}
-\definecharacter ebreve {e}
-\definecharacter Gbreve {G}
-\definecharacter gbreve {g}
-\definecharacter Ibreve {I}
-\definecharacter ibreve {i}
-\definecharacter Obreve {O}
-\definecharacter obreve {o}
-\definecharacter Ubreve {U}
-\definecharacter ubreve {u}
-
-\definecharacter Ccaron {C}
-\definecharacter ccaron {c}
-\definecharacter Dcaron {D}
-\definecharacter dcaron {d}
-\definecharacter Ecaron {E}
-\definecharacter ecaron {e}
-\definecharacter Lcaron {L}
-\definecharacter lcaron {l}
-\definecharacter Ncaron {N}
-\definecharacter ncaron {n}
-\definecharacter Rcaron {R}
-\definecharacter rcaron {r}
-\definecharacter Scaron {S}
-\definecharacter scaron {s}
-\definecharacter Tcaron {T}
-\definecharacter tcaron {t}
-\definecharacter Ycaron {Y}
-\definecharacter ycaron {y}
-\definecharacter Zcaron {Z}
-\definecharacter zcaron {z}
-
-\definecharacter Lstroke {L}
-\definecharacter lstroke {l}
-\definecharacter Ostroke {O}
-\definecharacter ostroke {o}
-
-\definecharacter aumlaut {\adiaeresis}
-\definecharacter eumlaut {\ediaeresis}
-\definecharacter iumlaut {\idiaeresis}
-\definecharacter oumlaut {\odiaeresis}
-\definecharacter uumlaut {\udiaeresis}
-
-\definecharacter Aumlaut {\Adiaeresis}
-\definecharacter Eumlaut {\Ediaeresis}
-\definecharacter Iumlaut {\Idiaeresis}
-\definecharacter Oumlaut {\Odiaeresis}
-\definecharacter Uumlaut {\Udiaeresis}
-
-\definecharacter scommaaccent {s}
-\definecharacter Scommaaccent {S}
-\definecharacter tcommaaccent {t}
-\definecharacter Tcommaaccent {T}
-
-\definecharacter Etilde {E}
-\definecharacter etilde {e}
-
-\definecharacter Ahook {A}
-\definecharacter ahook {a}
-\definecharacter Ehook {E}
-\definecharacter ehook {e}
-\definecharacter Ihook {I}
-\definecharacter ihook {i}
-\definecharacter Ohook {O}
-\definecharacter ohook {o}
-\definecharacter Uhook {U}
-\definecharacter uhook {u}
-\definecharacter Yhook {Y}
-\definecharacter yhook {y}
-
-\definecharacter Acircumflexgrave {\Acircumflex}
-\definecharacter Acircumflexacute {\Acircumflex}
-\definecharacter Acircumflextilde {\Acircumflex}
-\definecharacter Acircumflexhook {\Acircumflex}
-\definecharacter acircumflexgrave {\acircumflex}
-\definecharacter acircumflexacute {\acircumflex}
-\definecharacter acircumflextilde {\acircumflex}
-\definecharacter acircumflexhook {\acircumflex}
-\definecharacter Ecircumflexgrave {\Ecircumflex}
-\definecharacter Ecircumflexacute {\Ecircumflex}
-\definecharacter Ecircumflextilde {\Ecircumflex}
-\definecharacter Ecircumflexhook {\Ecircumflex}
-\definecharacter ecircumflexgrave {\ecircumflex}
-\definecharacter ecircumflexacute {\ecircumflex}
-\definecharacter ecircumflextilde {\ecircumflex}
-\definecharacter ecircumflexhook {\ecircumflex}
-\definecharacter Ocircumflexgrave {\Ocircumflex}
-\definecharacter Ocircumflexacute {\Ocircumflex}
-\definecharacter Ocircumflextilde {\Ocircumflex}
-\definecharacter Ocircumflexhook {\Ocircumflex}
-\definecharacter ocircumflexgrave {\ocircumflex}
-\definecharacter ocircumflexacute {\ocircumflex}
-\definecharacter ocircumflextilde {\ocircumflex}
-\definecharacter ocircumflexhook {\ocircumflex}
-
-\definecharacter Abrevegrave {A}
-\definecharacter Abreveacute {A}
-\definecharacter Abrevetilde {A}
-\definecharacter Abrevehook {A}
-\definecharacter abrevegrave {a}
-\definecharacter abreveacute {a}
-\definecharacter abrevetilde {a}
-\definecharacter abrevehook {a}
-
-\definecharacter Adotbelow {A}
-\definecharacter adotbelow {a}
-\definecharacter Edotbelow {E}
-\definecharacter edotbelow {e}
-\definecharacter Idotbelow {I}
-\definecharacter idotbelow {i}
-\definecharacter Odotbelow {O}
-\definecharacter odotbelow {o}
-\definecharacter Udotbelow {U}
-\definecharacter udotbelow {u}
-\definecharacter Ydotbelow {Y}
-\definecharacter ydotbelow {y}
-\definecharacter Ohorndotbelow {O}
-\definecharacter ohorndotbelow {o}
-\definecharacter Uhorndotbelow {U}
-\definecharacter uhorndotbelow {u}
-
-\definecharacter Acircumflexdotbelow {\Acircumflex}
-\definecharacter acircumflexdotbelow {\acircumflex}
-\definecharacter Ecircumflexdotbelow {\Ecircumflex}
-\definecharacter ecircumflexdotbelow {\ecircumflex}
-\definecharacter Ocircumflexdotbelow {\Ocircumflex}
-\definecharacter ocircumflexdotbelow {\ocircumflex}
-\definecharacter Abrevedotbelow {\Abreve}
-\definecharacter abrevedotbelow {\abreve}
-
-\definecharacter Ohorn {O}
-\definecharacter Ohorngrave {O}
-\definecharacter Ohornacute {O}
-\definecharacter Ohorntilde {O}
-\definecharacter Ohornhook {O}
-
-\definecharacter ohorn {o}
-\definecharacter ohorngrave {o}
-\definecharacter ohornacute {o}
-\definecharacter ohorntilde {o}
-\definecharacter ohornhook {o}
-
-\definecharacter Uhorn {U}
-\definecharacter Uhorngrave {U}
-\definecharacter Uhornacute {U}
-\definecharacter Uhorntilde {U}
-\definecharacter Uhornhook {U}
-
-\definecharacter uhorn {u}
-\definecharacter uhorngrave {u}
-\definecharacter uhornacute {u}
-\definecharacter uhorntilde {u}
-\definecharacter uhornhook {u}
-
-\definecharacter Utilde {U}
-\definecharacter utilde {u}
-\definecharacter Itilde {I}
-\definecharacter itilde {i}
-\definecharacter Ygrave {Y}
-\definecharacter ygrave {y}
-\definecharacter Ytilde {Y}
-\definecharacter ytilde {y}
-
-\definecharacter dstroke {d}
-\definecharacter Dstroke {D}
-
-\stopencoding
-
-\endinput
diff --git a/tex/context/base/enco-pfr.mkii b/tex/context/base/enco-pfr.mkii
new file mode 100644
index 000000000..b279e40aa
--- /dev/null
+++ b/tex/context/base/enco-pfr.mkii
@@ -0,0 +1,305 @@
+%D \module
+%D [ file=enco-pfr,
+%D version=2000.12.10, % adapted 2005.08.14 to more delayed loading
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=PDF Resources,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\ifnum\texengine>\pdftexengine
+ \expandafter \endinput
+\fi
+
+\ifdefined\pdffontresource \else
+ \expandafter \endinput
+\fi
+
+\writestatus{loading}{ConTeXt Encoding Macros / PDF Resources}
+
+%D This is an experimental module in which we implement
+%D font resource inclusion in \PDF. One reason to include
+%D font resources is that it enables a search engine to
+%D perform a search (I'm told). This feature ws requested by
+%D Petr Ferdus from Czech.
+
+%D A simple test file may look like this (watch how we first
+%D load the encoding and then the font; previous font
+%D definitions are left untouched.)
+%D
+%D \starttyping
+%D % output=pdftex interface=en
+%D
+%D \useencoding[pfr]
+%D \setupbodyfont[csr]
+%D
+%D \starttext
+%D test \`z \'z \bf test \sl test \bs quite funny \`z \page
+%D test \`z \'z \bf test \sl test \bs quite funny \`z \page
+%D \stoptext
+%D \stoptyping
+%D
+%D We do our best to include a (often large) font resources
+%D only once. The current implementation is not that
+%D general which is also due to the fact that \type
+%D {\pdffontattr} is expanded instantly and persistent. A
+%D more versatile (but also slower) approach is to keep track
+%D of the fonts and either flush the information at shipout
+%D time, or at the end of the document.
+
+%D \macros
+%D {ifincludepdffontresources}
+%D
+%D You can turn of this feature using the following switch.
+
+\newif\ifincludepdffontresources \includepdffontresourcestrue
+
+\ifx\pdfglyphtounicode\undefined \else
+ \appendtoks
+ \doif\jobsuffix{pdf}{\readfile{pdfr-def.mkii}\donothing\donothing}%
+ \to \everystarttext
+\fi
+
+% somehow we cannot preload this beast; also, it's mk dependent
+%
+% \appendtoks
+% \doifelse{\jobsuffix}{pdf}{\loadmkiifile{pdfr-def.mkii}}%
+% \to \everystarttext
+
+% ugly, this should go to the driver spec-tpd
+
+\ifx\pdfgentounicode\undefined \else
+ \ifcase\pdfgentounicode \else
+ \expandafter \expandafter \expandafter \endinput
+ \fi
+\fi
+
+\unprotect
+
+% a problem is that there is always an ec vector added even when
+% we switch to texnansi early; this has to do with the fact that
+% we need to setup fonts at startup; this a pain when we have
+% textless documents, so we should have a way around, i.e. an
+% extension to pdftex where we can tag numbers inside user specs
+% and attributes.
+%
+% currently we need to use immediate so we end up with entries
+
+%D The name of the resource is stored in a macro, as is its
+%D object reference. A resource is only processed once. When
+%D done, the resource name is erased, and we use this fact to
+%D prevent redefinition as well as well as reloading. So, a
+%D macro defined with \type {\pdffontfileresource} can have
+%D three states:
+%D
+%D \startitemize[packed]
+%D \item undefined: not yet loaded, and not yet included
+%D \item some value: loaded, but not yet included
+%D \item empty: loaded, and already included
+%D \stopitemize
+
+\def\pdffontresource {pdfr:\currentencoding}
+\def\pdffontfileresource{pdff:\pdffontresource}
+
+%D A resource is defined in a file prefixed by \type {pdfr-}.
+%D The following \PDF\ code is composed by Ondrej Koala Vacha (I
+%D probably mispelled this name).
+%D
+%D \starttyping
+%D \startpdffontresource[il2]
+%D /CIDInit /ProcSet findresource begin
+%D 12 dict begin
+%D begincmap
+%D /CIDSystemInfo
+%D << /Registry (Adobe)
+%D /Ordering (T1UV)
+%D /Supplement 0
+%D >> def
+%D /CMapName /Adobe-Identity-UCS def
+%D /CMapType 1 def
+%D 1 begincodespacerange
+%D <00>
+%D endcodespacerange
+%D %%FontSpecificEncoding
+%D 191 beginbfrange
+%D <20> <20> <0020> % space dec: 32 oct:040 hex:20
+%D .... .... ...... . ........ .... .. ....... ......
+%D <00ff> % dotaccent dec:255 oct:377 hex:ff
+%D endbfrange
+%D endcmap
+%D CMapName currentdict /CMap defineresource pop end
+%D end
+%D \stoppdffontresource
+%D \stoptyping
+%D
+%D We don't preload such huge definitions, and process them
+%D run||time to save memory. Therefore, in the encoding
+%D vector, we only add an entry like:
+%D
+%D \starttyping
+%D \startencoding [il2]
+%D \usepdffontresource il2
+%D \stopencoding
+%D \stoptyping
+%D
+%D This macro is defined as follows.
+
+\def\usepdffontresource #1 %
+ {\doifundefinedelse\pdffontfileresource % okay, undefined, so either
+ {\setxvalue\pdffontfileresource{#1}} % brand new, or not yet loaded
+ {\doifvaluesomething\pdffontfileresource % only if not loaded in which
+ {\setxvalue\pdffontfileresource{#1}}}} % case it's made empty
+
+%D Watch how we check for duplicated loading. The resource
+%D itself, when asked for, is included immediately, after which
+%D we save its reference. Normally a document will have one
+%D such a resource.
+
+% \long\def\startpdffontresource[#1]#2\stoppdffontresource
+% {\doif{#1}\currentencoding
+% {\immediate\pdfobj useobjnum \getvalue{\pdffontresource} stream {#2}}}
+
+% alternatively we can use object references
+
+% fails when we switch back and forward between dvi/pdf mode
+%
+% \long\def\startpdffontresource[#1]#2\stoppdffontresource
+% {\doif{#1}\currentencoding{\doifdefined\pdffontresource
+% {\immediate\pdfobj useobjnum \getvalue{\pdffontresource} stream {#2}}}}
+
+\long\def\startpdffontresource[#1]#2\stoppdffontresource
+ {\doif{#1}\currentencoding{\doifdefined\pdffontresource
+ {\expanded{\doshipoutpdffontresource{\getvalue{\pdffontresource}}{#2}}}}}
+
+\def\doshipoutpdffontresource#1#2%
+ {\ifnum\realpageno<\plustwo
+ \doglobal\appendtoks
+ \ifcase\pdfoutput\else\immediate\pdfobj useobjnum #1 stream {#2}\fi
+ \to\everyfirstshipout
+ \else
+ \ifcase\pdfoutput\else\immediate\pdfobj useobjnum #1 stream {#2}\fi
+ \fi}
+
+% cleaner but not better:
+%
+% \newtoks \collectedpdffontresources
+%
+% \def\doshipoutpdffontresource#1#2%
+% {\doglobal\appendtoks
+% \ifcase\pdfoutput\else\immediate\pdfobj useobjnum #1 stream {#2}\fi
+% \to \collectedpdffontresources}
+%
+% \def\dofluspdffontresources
+% {\the\collectedpdffontresources
+% \global\collectedpdffontresources\emptytoks}
+%
+% \appendtoks \dofluspdffontresources \to \everybeforeshipout
+
+%D The reference to such a vector is to be handled at font
+%D definition time, which is why we hook it into the font
+%D loading routine. A little bit of indirectness speeds up
+%D the process when this feature is disabled and keeps the
+%D macros readable.
+
+% \newevery \everyfont \relax
+
+\appendtoksonce \includepdffontresource \to \everyfont
+
+% \def\includepdffontresource
+% {\ifincludepdffontresources
+% \ifx\pdffontattr\undefined
+% % we're not using (a recent version of) pdftex
+% \else\ifcase\pdfoutput
+% % we're not in pdf mode
+% \else
+% \doincludepdffontresource
+% \fi\fi
+% \fi}
+
+\def\includepdffontresource
+ {\ifx\pdfgentounicode\undefined
+ \expandafter\ifx\the\font\nullfont \else
+ \ifx\pdffontattr\undefined
+ % we're not using (a recent version of) pdftex
+ \else\ifcase\pdfoutput
+ % we're not in pdf mode
+ \else
+ \doincludepdffontresource
+ \fi\fi
+ \fi
+ \else\ifcase\pdfgentounicode
+ \ifincludepdffontresources
+ \expandafter\ifx\the\font\nullfont \else
+ \ifx\pdffontattr\undefined
+ % we're not using (a recent version of) pdftex
+ \else\ifcase\pdfoutput
+ % we're not in pdf mode
+ \else
+ \doincludepdffontresource
+ \fi\fi
+ \fi
+ \fi
+ \or
+ \global\let\includepdffontresource\relax % automatic, built in
+ \fi\fi}
+
+\def\dododoincludepdffontresource#1% encoding
+ {\bgroup
+ \edef\currentencoding{#1}%
+ \doifvaluesomething\pdffontfileresource
+ {\startreadingfile
+ \ignorelines % just in case \par is redefined; this thing can get called anywhere
+ \readsysfile{pdfr-\getvalue\pdffontfileresource.mkii}\donothing\donothing
+ \stopreadingfile
+ \letgvalue\pdffontfileresource\empty}%
+ \egroup}
+
+\def\doincludepdffontresource
+ {\ifcsname\s!ucmap\fontfile\endcsname\else
+ \dodoincludepdffontresource
+ \fi}
+
+\def\dodoincludepdffontresource
+ {% does this font has an encoding specified vector
+ \doifsomething\currentencoding % no \ifx
+ {% is there a pdf font encoding resource file defined
+ \ifcsname\pdffontresource\endcsname
+ % (fake) object defined
+ \else\ifcsname\pdffontfileresource\endcsname
+ % is there a resource already included
+ \doifsomething\pdffontfileresource
+ {\pdfobj reserveobjnum {}%
+ \setxvalue\pdffontresource{\the\pdflastobj}%
+ \flushatshipout{\dododoincludepdffontresource{\currentencoding}}}%
+% \doglobal\appendetoks
+% \noexpand\dododoincludepdffontresource{\currentencoding}%
+% \to \everybeforeshipout}% prevent multiple loading
+ \fi\fi
+ \ifcsname\pdffontresource\endcsname
+ \expanded{\pdffontattr\font{/ToUnicode \csname\pdffontresource\endcsname\space0 R}}%
+ % do it only once for each font
+ \letgvalue{\s!ucmap\fontfile}\empty
+ \fi}}
+
+%D For the moment, we keep this definition here, if only
+%D because \type {\usepdffontencoding} is not defined in the
+%D core. In the end, this will go to \type {enco-*.tex}.
+%D
+%D Test:
+%D
+%D \starttyping
+%D \useencoding[pfr] \usetypescript[palatino][ec] \setupbodyfont[palatino]
+%D
+%D \starttext
+%D fi ff ffi
+%D \stoptext
+%D \stoptyping
+
+\startencoding [il2] \usepdffontresource il2 \stopencoding
+\startencoding [ec] \usepdffontresource ec \stopencoding
+
+\protect \endinput
diff --git a/tex/context/base/enco-pfr.tex b/tex/context/base/enco-pfr.tex
deleted file mode 100644
index a90c62352..000000000
--- a/tex/context/base/enco-pfr.tex
+++ /dev/null
@@ -1,303 +0,0 @@
-%D \module
-%D [ file=enco-pfr,
-%D version=2000.12.10, % adapted 2005.08.14 to more delayed loading
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=PDF Resources,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\ifnum\texengine>\pdftexengine
- \endinput
-\fi
-
-\ifx\pdffontresource\undefined\else\endinput\fi
-
-\writestatus{loading}{ConTeXt Encoding Macros / PDF Resources}
-
-%D This is an experimental module in which we implement
-%D font resource inclusion in \PDF. One reason to include
-%D font resources is that it enables a search engine to
-%D perform a search (I'm told). This feature ws requested by
-%D Petr Ferdus from Czech.
-
-%D A simple test file may look like this (watch how we first
-%D load the encoding and then the font; previous font
-%D definitions are left untouched.)
-%D
-%D \starttyping
-%D % output=pdftex interface=en
-%D
-%D \useencoding[pfr]
-%D \setupbodyfont[csr]
-%D
-%D \starttext
-%D test \`z \'z \bf test \sl test \bs quite funny \`z \page
-%D test \`z \'z \bf test \sl test \bs quite funny \`z \page
-%D \stoptext
-%D \stoptyping
-%D
-%D We do our best to include a (often large) font resources
-%D only once. The current implementation is not that
-%D general which is also due to the fact that \type
-%D {\pdffontattr} is expanded instantly and persistent. A
-%D more versatile (but also slower) approach is to keep track
-%D of the fonts and either flush the information at shipout
-%D time, or at the end of the document.
-
-%D \macros
-%D {ifincludepdffontresources}
-%D
-%D You can turn of this feature using the following switch.
-
-\newif\ifincludepdffontresources \includepdffontresourcestrue
-
-\ifx\pdfglyphtounicode\undefined \else
- \appendtoks
- \doif\jobsuffix{pdf}{\readfile{pdfr-def.tex}\donothing\donothing}%
- \to \everystarttext
-\fi
-
-% somehow we cannot preload this beast; also, it's mk dependent
-%
-% \appendtoks
-% \doifelse{\jobsuffix}{pdf}{\loadmkiifile{pdfr-def.tex}}%
-% \to \everystarttext
-
-% ugly, this should go to the driver spec-tpd
-
-\ifx\pdfgentounicode\undefined \else
- \ifcase\pdfgentounicode \else
- \expandafter \expandafter \expandafter \endinput
- \fi
-\fi
-
-\unprotect
-
-% a problem is that there is always an ec vector added even when
-% we switch to texnansi early; this has to do with the fact that
-% we need to setup fonts at startup; this a pain when we have
-% textless documents, so we should have a way around, i.e. an
-% extension to pdftex where we can tag numbers inside user specs
-% and attributes.
-%
-% currently we need to use immediate so we end up with entries
-
-%D The name of the resource is stored in a macro, as is its
-%D object reference. A resource is only processed once. When
-%D done, the resource name is erased, and we use this fact to
-%D prevent redefinition as well as well as reloading. So, a
-%D macro defined with \type {\pdffontfileresource} can have
-%D three states:
-%D
-%D \startitemize[packed]
-%D \item undefined: not yet loaded, and not yet included
-%D \item some value: loaded, but not yet included
-%D \item empty: loaded, and already included
-%D \stopitemize
-
-\def\pdffontresource {pdfr:\currentencoding}
-\def\pdffontfileresource{pdff:\pdffontresource}
-
-%D A resource is defined in a file prefixed by \type {pdfr-}.
-%D The following \PDF\ code is composed by Ondrej Koala Vacha (I
-%D probably mispelled this name).
-%D
-%D \starttyping
-%D \startpdffontresource[il2]
-%D /CIDInit /ProcSet findresource begin
-%D 12 dict begin
-%D begincmap
-%D /CIDSystemInfo
-%D << /Registry (Adobe)
-%D /Ordering (T1UV)
-%D /Supplement 0
-%D >> def
-%D /CMapName /Adobe-Identity-UCS def
-%D /CMapType 1 def
-%D 1 begincodespacerange
-%D <00>
-%D endcodespacerange
-%D %%FontSpecificEncoding
-%D 191 beginbfrange
-%D <20> <20> <0020> % space dec: 32 oct:040 hex:20
-%D .... .... ...... . ........ .... .. ....... ......
-%D <00ff> % dotaccent dec:255 oct:377 hex:ff
-%D endbfrange
-%D endcmap
-%D CMapName currentdict /CMap defineresource pop end
-%D end
-%D \stoppdffontresource
-%D \stoptyping
-%D
-%D We don't preload such huge definitions, and process them
-%D run||time to save memory. Therefore, in the encoding
-%D vector, we only add an entry like:
-%D
-%D \starttyping
-%D \startencoding [il2]
-%D \usepdffontresource il2
-%D \stopencoding
-%D \stoptyping
-%D
-%D This macro is defined as follows.
-
-\def\usepdffontresource #1 %
- {\doifundefinedelse\pdffontfileresource % okay, undefined, so either
- {\setxvalue\pdffontfileresource{#1}} % brand new, or not yet loaded
- {\doifvaluesomething\pdffontfileresource % only if not loaded in which
- {\setxvalue\pdffontfileresource{#1}}}} % case it's made empty
-
-%D Watch how we check for duplicated loading. The resource
-%D itself, when asked for, is included immediately, after which
-%D we save its reference. Normally a document will have one
-%D such a resource.
-
-% \long\def\startpdffontresource[#1]#2\stoppdffontresource
-% {\doif{#1}\currentencoding
-% {\immediate\pdfobj useobjnum \getvalue{\pdffontresource} stream {#2}}}
-
-% alternatively we can use object references
-
-% fails when we switch back and forward between dvi/pdf mode
-%
-% \long\def\startpdffontresource[#1]#2\stoppdffontresource
-% {\doif{#1}\currentencoding{\doifdefined\pdffontresource
-% {\immediate\pdfobj useobjnum \getvalue{\pdffontresource} stream {#2}}}}
-
-\long\def\startpdffontresource[#1]#2\stoppdffontresource
- {\doif{#1}\currentencoding{\doifdefined\pdffontresource
- {\expanded{\doshipoutpdffontresource{\getvalue{\pdffontresource}}{#2}}}}}
-
-\def\doshipoutpdffontresource#1#2%
- {\ifnum\realpageno<\plustwo
- \doglobal\appendtoks
- \ifcase\pdfoutput\else\immediate\pdfobj useobjnum #1 stream {#2}\fi
- \to\everyfirstshipout
- \else
- \ifcase\pdfoutput\else\immediate\pdfobj useobjnum #1 stream {#2}\fi
- \fi}
-
-% cleaner but not better:
-%
-% \newtoks \collectedpdffontresources
-%
-% \def\doshipoutpdffontresource#1#2%
-% {\doglobal\appendtoks
-% \ifcase\pdfoutput\else\immediate\pdfobj useobjnum #1 stream {#2}\fi
-% \to \collectedpdffontresources}
-%
-% \def\dofluspdffontresources
-% {\the\collectedpdffontresources
-% \global\collectedpdffontresources\emptytoks}
-%
-% \appendtoks \dofluspdffontresources \to \everybeforeshipout
-
-%D The reference to such a vector is to be handled at font
-%D definition time, which is why we hook it into the font
-%D loading routine. A little bit of indirectness speeds up
-%D the process when this feature is disabled and keeps the
-%D macros readable.
-
-% \newevery \everyfont \relax
-
-\appendtoksonce \includepdffontresource \to \everyfont
-
-% \def\includepdffontresource
-% {\ifincludepdffontresources
-% \ifx\pdffontattr\undefined
-% % we're not using (a recent version of) pdftex
-% \else\ifcase\pdfoutput
-% % we're not in pdf mode
-% \else
-% \doincludepdffontresource
-% \fi\fi
-% \fi}
-
-\def\includepdffontresource
- {\ifx\pdfgentounicode\undefined
- \expandafter\ifx\the\font\nullfont \else
- \ifx\pdffontattr\undefined
- % we're not using (a recent version of) pdftex
- \else\ifcase\pdfoutput
- % we're not in pdf mode
- \else
- \doincludepdffontresource
- \fi\fi
- \fi
- \else\ifcase\pdfgentounicode
- \ifincludepdffontresources
- \expandafter\ifx\the\font\nullfont \else
- \ifx\pdffontattr\undefined
- % we're not using (a recent version of) pdftex
- \else\ifcase\pdfoutput
- % we're not in pdf mode
- \else
- \doincludepdffontresource
- \fi\fi
- \fi
- \fi
- \or
- \global\let\includepdffontresource\relax % automatic, built in
- \fi\fi}
-
-\def\dododoincludepdffontresource#1% encoding
- {\bgroup
- \edef\currentencoding{#1}%
- \doifvaluesomething\pdffontfileresource
- {\startreadingfile
- \ignorelines % just in case \par is redefined; this thing can get called anywhere
- \readsysfile{pdfr-\getvalue\pdffontfileresource}\donothing\donothing
- \stopreadingfile
- \letgvalue\pdffontfileresource\empty}%
- \egroup}
-
-\def\doincludepdffontresource
- {\ifcsname\s!ucmap\fontfile\endcsname\else
- \dodoincludepdffontresource
- \fi}
-
-\def\dodoincludepdffontresource
- {% does this font has an encoding specified vector
- \doifsomething\currentencoding % no \ifx
- {% is there a pdf font encoding resource file defined
- \ifcsname\pdffontresource\endcsname
- % (fake) object defined
- \else\ifcsname\pdffontfileresource\endcsname
- % is there a resource already included
- \doifsomething\pdffontfileresource
- {\pdfobj reserveobjnum {}%
- \setxvalue\pdffontresource{\the\pdflastobj}%
- \flushatshipout{\dododoincludepdffontresource{\currentencoding}}}%
-% \doglobal\appendetoks
-% \noexpand\dododoincludepdffontresource{\currentencoding}%
-% \to \everybeforeshipout}% prevent multiple loading
- \fi\fi
- \ifcsname\pdffontresource\endcsname
- \expanded{\pdffontattr\font{/ToUnicode \csname\pdffontresource\endcsname\space0 R}}%
- % do it only once for each font
- \letgvalue{\s!ucmap\fontfile}\empty
- \fi}}
-
-%D For the moment, we keep this definition here, if only
-%D because \type {\usepdffontencoding} is not defined in the
-%D core. In the end, this will go to \type {enco-*.tex}.
-%D
-%D Test:
-%D
-%D \starttyping
-%D \useencoding[pfr] \usetypescript[palatino][ec] \setupbodyfont[palatino]
-%D
-%D \starttext
-%D fi ff ffi
-%D \stoptext
-%D \stoptyping
-
-\startencoding [il2] \usepdffontresource il2 \stopencoding
-\startencoding [ec] \usepdffontresource ec \stopencoding
-
-\protect \endinput
diff --git a/tex/context/base/enco-pol.mkii b/tex/context/base/enco-pol.mkii
new file mode 100644
index 000000000..a012f0370
--- /dev/null
+++ b/tex/context/base/enco-pol.mkii
@@ -0,0 +1,276 @@
+%D \module
+%D [ file=enco-pol,
+%D version=2000.05.07, % 1999.28.8,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Polish Mixed Encoding,
+%D author={Taco Hoekwater \& Hans Hagen},
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% This encoding will go but the regime will remain.
+
+%D Polish native encoding; normally polish users will use
+%D translate=cp1250pl in combination with ec encoding.
+
+\startmapping[pl0]
+
+\resetcaserange 128 to 255
+
+\definecaseswap 161 129 % a ogonek
+\definecaseswap 162 130 % c acute
+\definecaseswap 166 134 % e ogonek
+\definecaseswap 170 138 % l crossed
+\definecaseswap 171 139 % n acute
+\definecaseswap 177 145 % s acute
+\definecaseswap 185 153 % z acute
+\definecaseswap 187 155 % z dotaccent
+\definecaseswap 243 211 % o acute
+
+% \definecasemap 161 161 129 % a ogonek
+% \definecasemap 162 162 130 % c acute
+% \definecasemap 166 166 134 % e ogonek
+% \definecasemap 170 170 138 % l crossed
+% \definecasemap 171 171 139 % n acute
+% \definecasemap 177 177 145 % s acute
+% \definecasemap 185 185 153 % z acute
+% \definecasemap 187 187 155 % z dotaccent
+% \definecasemap 243 243 211 % o acute
+
+% \definecasemap 129 161 129 % A ogonek
+% \definecasemap 130 162 130 % C acute
+% \definecasemap 134 166 134 % E ogonek
+% \definecasemap 138 170 138 % L crossed
+% \definecasemap 139 171 139 % N acute
+% \definecasemap 145 177 145 % S acute
+% \definecasemap 153 185 153 % Z acute
+% \definecasemap 155 187 155 % Z dotaccent
+% \definecasemap 211 243 211 % O acute
+
+\stopmapping
+
+\startmapping[pl0]
+
+\definespacemap 129 999 % A ogonek
+\definespacemap 130 999 % C acute
+\definespacemap 134 999 % E ogonek
+\definespacemap 138 999 % L crossed
+\definespacemap 139 999 % N acute
+\definespacemap 211 999 % O acute
+\definespacemap 145 999 % S acute
+\definespacemap 153 999 % Z acute
+\definespacemap 155 999 % Z dot
+
+\stopmapping
+
+\startencoding[pl0][pl0]
+
+\definecharacter Aogonek 129
+\definecharacter Cacute 130
+\definecharacter Eogonek 134
+\definecharacter Lstroke 138
+\definecharacter Nacute 139
+\definecharacter Sacute 145
+\definecharacter Zacute 153
+\definecharacter Zdotaccent 155
+\definecharacter aogonek 161
+\definecharacter cacute 162
+\definecharacter eogonek 166
+\definecharacter lstroke 170
+\definecharacter nacute 171
+\definecharacter sacute 177
+\definecharacter zacute 185
+\definecharacter zdotaccent 187
+\definecharacter Oacute 211
+\definecharacter oacute 243
+
+\stopencoding
+
+\startencoding[pl0][pl0]
+
+\definecharacter leftguillemot 174
+\definecharacter rightguillemot 175
+\definecharacter guilsingleleft 174
+\definecharacter guilsingleright 175
+
+\stopencoding
+
+% obsolete
+%
+% \startencoding[pl0]
+%
+% \definesortkey {161} {a}{a}{\k a} \definesortkey {129} {a}{a}{\k a}
+% \definesortkey {162} {c}{a}{\'c} \definesortkey {130} {c}{a}{\'c}
+% \definesortkey {166} {e}{a}{\k e} \definesortkey {134} {e}{a}{\k e}
+% \definesortkey {170} {l}{a}{\l } \definesortkey {138} {l}{a}{\l }
+% \definesortkey {171} {n}{a}{\'n} \definesortkey {139} {n}{a}{\'n}
+% \definesortkey {177} {s}{a}{\'s} \definesortkey {145} {s}{a}{\'s}
+% \definesortkey {185} {z}{a}{\'z} \definesortkey {153} {z}{a}{\'z}
+% \definesortkey {187} {z}{b}{\.z} \definesortkey {155} {z}{b}{\.z}
+% \definesortkey {243} {o}{a}{\'o} \definesortkey {211} {o}{a}{\'o}
+%
+% \definesortkey {\'c} {c}{a}{\'c} \definesortkey {\'C} {c}{a}{\'c}
+% \definesortkey {\'n} {n}{a}{\'n} \definesortkey {\'N} {n}{a}{\'n}
+% \definesortkey {\'o} {o}{a}{\'o} \definesortkey {\'O} {o}{a}{\'o}
+% \definesortkey {\'s} {s}{a}{\'s} \definesortkey {\'S} {s}{a}{\'s}
+% \definesortkey {\'z} {z}{a}{\'z} \definesortkey {\'Z} {z}{a}{\'z}
+% \definesortkey {\.z} {z}{b}{\.z} \definesortkey {\.Z} {z}{b}{\.z}
+% \definesortkey {\k a}{a}{a}{\k a} \definesortkey {\k A}{a}{a}{\k a}
+% \definesortkey {\k e}{e}{a}{\k e} \definesortkey {\k E}{e}{a}{\k e}
+% \definesortkey {\l } {l}{a}{\l} \definesortkey {\L } {l}{a}{\l}
+%
+% \stopencoding
+
+%D Polish CP-1250 encoding.
+
+% \startmapping[pl1]
+%
+%
+% \resetcaserange 128 to 255
+%
+% \definecasemap 185 185 165 % a ogonek
+% \definecasemap 230 230 198 % c acute
+% \definecasemap 234 234 202 % e ogonek
+% \definecasemap 179 179 163 % l crossed
+% \definecasemap 241 241 209 % n acute
+% \definecasemap 243 243 211 % o acute
+% \definecasemap 156 156 140 % s acute
+% \definecasemap 159 159 143 % z acute
+% \definecasemap 191 191 175 % z dot
+%
+% \definecasemap 165 165 185 % A ogonek
+% \definecasemap 198 198 230 % C acute
+% \definecasemap 202 202 234 % E ogonek
+% \definecasemap 163 163 179 % L crossed
+% \definecasemap 209 209 241 % N acute
+% \definecasemap 211 211 243 % O acute
+% \definecasemap 140 140 156 % S acute
+% \definecasemap 143 143 159 % Z acute
+% \definecasemap 175 175 191 % Z dot
+%
+% \stopmapping
+%
+% \startmapping[pl1]
+%
+% \definespacemap 165 999 % A ogonek
+% \definespacemap 198 999 % C acute
+% \definespacemap 202 999 % E ogonek
+% \definespacemap 163 999 % L crossed
+% \definespacemap 209 999 % N acute
+% \definespacemap 211 999 % O acute
+% \definespacemap 140 999 % S acute
+% \definespacemap 143 999 % Z acute
+% \definespacemap 175 999 % Z dot
+%
+% \stopmapping
+%
+% \startencoding[pl1]
+%
+% \definecharacter Sacute 140
+% \definecharacter Zacute 143
+% \definecharacter sacute 156
+% \definecharacter zacute 159
+% \definecharacter Lstroke 163
+% \definecharacter Aogonek 165
+% \definecharacter Zdotaccent 175
+% \definecharacter lstroke 179
+% \definecharacter aogonek 185
+% \definecharacter zdotaccent 191
+% \definecharacter Cacute 198
+% \definecharacter Eogonek 202
+% \definecharacter Nacute 209
+% \definecharacter Oacute 211
+% \definecharacter cacute 230
+% \definecharacter eogonek 234
+% \definecharacter nacute 241
+% \definecharacter oacute 243
+%
+% \stopencoding
+%
+% \startencoding[pl1]
+%
+% \definecharacter leftguillemot 174
+% \definecharacter rightguillemot 175
+% \definecharacter guilsingleleft 174
+% \definecharacter guilsingleright 175
+%
+% \stopencoding
+
+%D Polish ISO-8859-2 encoding.
+
+% \startmapping[pl2]
+%
+% \resetcaserange 128 to 255
+%
+% \definecasemap 177 177 161 % a ogonek
+% \definecasemap 230 230 198 % c acute
+% \definecasemap 234 234 202 % e ogonek
+% \definecasemap 179 179 163 % l crossed
+% \definecasemap 241 241 209 % n acute
+% \definecasemap 243 243 211 % o acute
+% \definecasemap 182 182 166 % s acute
+% \definecasemap 188 188 172 % z acute
+% \definecasemap 191 191 175 % z dotaccent
+%
+% \definecasemap 161 161 177 % A ogonek
+% \definecasemap 198 198 230 % C acute
+% \definecasemap 202 202 234 % E ogonek
+% \definecasemap 163 163 179 % L crossed
+% \definecasemap 209 209 241 % N acute
+% \definecasemap 211 211 243 % O acute
+% \definecasemap 166 166 182 % S acute
+% \definecasemap 172 172 188 % Z acute
+% \definecasemap 175 175 191 % Z dotaccent
+%
+% \stopmapping
+%
+% \startmapping[pl2]
+%
+% \definespacemap 161 999 % A ogonek
+% \definespacemap 198 999 % C acute
+% \definespacemap 202 999 % E ogonek
+% \definespacemap 163 999 % L crossed
+% \definespacemap 209 999 % N acute
+% \definespacemap 211 999 % O acute
+% \definespacemap 166 999 % S acute
+% \definespacemap 172 999 % Z acute
+% \definespacemap 175 999 % Z dot
+%
+% \stopmapping
+%
+% \startencoding[pl2]
+%
+% \definecharacter Aogonek 161
+% \definecharacter Lstroke 163
+% \definecharacter Sacute 166
+% \definecharacter Zacute 172
+% \definecharacter Zdotaccent 175
+% \definecharacter aogonek 177
+% \definecharacter lstroke 179
+% \definecharacter sacute 182
+% \definecharacter zacute 188
+% \definecharacter zdotaccent 191
+% \definecharacter Cacute 198
+% \definecharacter Eogonek 202
+% \definecharacter Nacute 209
+% \definecharacter Oacute 211
+% \definecharacter cacute 230
+% \definecharacter eogonek 234
+% \definecharacter nacute 241
+% \definecharacter oacute 243
+%
+% \stopencoding
+%
+% \startencoding[pl2]
+%
+% \definecharacter leftguillemot 174
+% \definecharacter rightguillemot 175
+% \definecharacter guilsingleleft 174
+% \definecharacter guilsingleright 175
+%
+% \stopencoding
+
+\endinput
diff --git a/tex/context/base/enco-pol.tex b/tex/context/base/enco-pol.tex
deleted file mode 100644
index a012f0370..000000000
--- a/tex/context/base/enco-pol.tex
+++ /dev/null
@@ -1,276 +0,0 @@
-%D \module
-%D [ file=enco-pol,
-%D version=2000.05.07, % 1999.28.8,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Polish Mixed Encoding,
-%D author={Taco Hoekwater \& Hans Hagen},
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-% This encoding will go but the regime will remain.
-
-%D Polish native encoding; normally polish users will use
-%D translate=cp1250pl in combination with ec encoding.
-
-\startmapping[pl0]
-
-\resetcaserange 128 to 255
-
-\definecaseswap 161 129 % a ogonek
-\definecaseswap 162 130 % c acute
-\definecaseswap 166 134 % e ogonek
-\definecaseswap 170 138 % l crossed
-\definecaseswap 171 139 % n acute
-\definecaseswap 177 145 % s acute
-\definecaseswap 185 153 % z acute
-\definecaseswap 187 155 % z dotaccent
-\definecaseswap 243 211 % o acute
-
-% \definecasemap 161 161 129 % a ogonek
-% \definecasemap 162 162 130 % c acute
-% \definecasemap 166 166 134 % e ogonek
-% \definecasemap 170 170 138 % l crossed
-% \definecasemap 171 171 139 % n acute
-% \definecasemap 177 177 145 % s acute
-% \definecasemap 185 185 153 % z acute
-% \definecasemap 187 187 155 % z dotaccent
-% \definecasemap 243 243 211 % o acute
-
-% \definecasemap 129 161 129 % A ogonek
-% \definecasemap 130 162 130 % C acute
-% \definecasemap 134 166 134 % E ogonek
-% \definecasemap 138 170 138 % L crossed
-% \definecasemap 139 171 139 % N acute
-% \definecasemap 145 177 145 % S acute
-% \definecasemap 153 185 153 % Z acute
-% \definecasemap 155 187 155 % Z dotaccent
-% \definecasemap 211 243 211 % O acute
-
-\stopmapping
-
-\startmapping[pl0]
-
-\definespacemap 129 999 % A ogonek
-\definespacemap 130 999 % C acute
-\definespacemap 134 999 % E ogonek
-\definespacemap 138 999 % L crossed
-\definespacemap 139 999 % N acute
-\definespacemap 211 999 % O acute
-\definespacemap 145 999 % S acute
-\definespacemap 153 999 % Z acute
-\definespacemap 155 999 % Z dot
-
-\stopmapping
-
-\startencoding[pl0][pl0]
-
-\definecharacter Aogonek 129
-\definecharacter Cacute 130
-\definecharacter Eogonek 134
-\definecharacter Lstroke 138
-\definecharacter Nacute 139
-\definecharacter Sacute 145
-\definecharacter Zacute 153
-\definecharacter Zdotaccent 155
-\definecharacter aogonek 161
-\definecharacter cacute 162
-\definecharacter eogonek 166
-\definecharacter lstroke 170
-\definecharacter nacute 171
-\definecharacter sacute 177
-\definecharacter zacute 185
-\definecharacter zdotaccent 187
-\definecharacter Oacute 211
-\definecharacter oacute 243
-
-\stopencoding
-
-\startencoding[pl0][pl0]
-
-\definecharacter leftguillemot 174
-\definecharacter rightguillemot 175
-\definecharacter guilsingleleft 174
-\definecharacter guilsingleright 175
-
-\stopencoding
-
-% obsolete
-%
-% \startencoding[pl0]
-%
-% \definesortkey {161} {a}{a}{\k a} \definesortkey {129} {a}{a}{\k a}
-% \definesortkey {162} {c}{a}{\'c} \definesortkey {130} {c}{a}{\'c}
-% \definesortkey {166} {e}{a}{\k e} \definesortkey {134} {e}{a}{\k e}
-% \definesortkey {170} {l}{a}{\l } \definesortkey {138} {l}{a}{\l }
-% \definesortkey {171} {n}{a}{\'n} \definesortkey {139} {n}{a}{\'n}
-% \definesortkey {177} {s}{a}{\'s} \definesortkey {145} {s}{a}{\'s}
-% \definesortkey {185} {z}{a}{\'z} \definesortkey {153} {z}{a}{\'z}
-% \definesortkey {187} {z}{b}{\.z} \definesortkey {155} {z}{b}{\.z}
-% \definesortkey {243} {o}{a}{\'o} \definesortkey {211} {o}{a}{\'o}
-%
-% \definesortkey {\'c} {c}{a}{\'c} \definesortkey {\'C} {c}{a}{\'c}
-% \definesortkey {\'n} {n}{a}{\'n} \definesortkey {\'N} {n}{a}{\'n}
-% \definesortkey {\'o} {o}{a}{\'o} \definesortkey {\'O} {o}{a}{\'o}
-% \definesortkey {\'s} {s}{a}{\'s} \definesortkey {\'S} {s}{a}{\'s}
-% \definesortkey {\'z} {z}{a}{\'z} \definesortkey {\'Z} {z}{a}{\'z}
-% \definesortkey {\.z} {z}{b}{\.z} \definesortkey {\.Z} {z}{b}{\.z}
-% \definesortkey {\k a}{a}{a}{\k a} \definesortkey {\k A}{a}{a}{\k a}
-% \definesortkey {\k e}{e}{a}{\k e} \definesortkey {\k E}{e}{a}{\k e}
-% \definesortkey {\l } {l}{a}{\l} \definesortkey {\L } {l}{a}{\l}
-%
-% \stopencoding
-
-%D Polish CP-1250 encoding.
-
-% \startmapping[pl1]
-%
-%
-% \resetcaserange 128 to 255
-%
-% \definecasemap 185 185 165 % a ogonek
-% \definecasemap 230 230 198 % c acute
-% \definecasemap 234 234 202 % e ogonek
-% \definecasemap 179 179 163 % l crossed
-% \definecasemap 241 241 209 % n acute
-% \definecasemap 243 243 211 % o acute
-% \definecasemap 156 156 140 % s acute
-% \definecasemap 159 159 143 % z acute
-% \definecasemap 191 191 175 % z dot
-%
-% \definecasemap 165 165 185 % A ogonek
-% \definecasemap 198 198 230 % C acute
-% \definecasemap 202 202 234 % E ogonek
-% \definecasemap 163 163 179 % L crossed
-% \definecasemap 209 209 241 % N acute
-% \definecasemap 211 211 243 % O acute
-% \definecasemap 140 140 156 % S acute
-% \definecasemap 143 143 159 % Z acute
-% \definecasemap 175 175 191 % Z dot
-%
-% \stopmapping
-%
-% \startmapping[pl1]
-%
-% \definespacemap 165 999 % A ogonek
-% \definespacemap 198 999 % C acute
-% \definespacemap 202 999 % E ogonek
-% \definespacemap 163 999 % L crossed
-% \definespacemap 209 999 % N acute
-% \definespacemap 211 999 % O acute
-% \definespacemap 140 999 % S acute
-% \definespacemap 143 999 % Z acute
-% \definespacemap 175 999 % Z dot
-%
-% \stopmapping
-%
-% \startencoding[pl1]
-%
-% \definecharacter Sacute 140
-% \definecharacter Zacute 143
-% \definecharacter sacute 156
-% \definecharacter zacute 159
-% \definecharacter Lstroke 163
-% \definecharacter Aogonek 165
-% \definecharacter Zdotaccent 175
-% \definecharacter lstroke 179
-% \definecharacter aogonek 185
-% \definecharacter zdotaccent 191
-% \definecharacter Cacute 198
-% \definecharacter Eogonek 202
-% \definecharacter Nacute 209
-% \definecharacter Oacute 211
-% \definecharacter cacute 230
-% \definecharacter eogonek 234
-% \definecharacter nacute 241
-% \definecharacter oacute 243
-%
-% \stopencoding
-%
-% \startencoding[pl1]
-%
-% \definecharacter leftguillemot 174
-% \definecharacter rightguillemot 175
-% \definecharacter guilsingleleft 174
-% \definecharacter guilsingleright 175
-%
-% \stopencoding
-
-%D Polish ISO-8859-2 encoding.
-
-% \startmapping[pl2]
-%
-% \resetcaserange 128 to 255
-%
-% \definecasemap 177 177 161 % a ogonek
-% \definecasemap 230 230 198 % c acute
-% \definecasemap 234 234 202 % e ogonek
-% \definecasemap 179 179 163 % l crossed
-% \definecasemap 241 241 209 % n acute
-% \definecasemap 243 243 211 % o acute
-% \definecasemap 182 182 166 % s acute
-% \definecasemap 188 188 172 % z acute
-% \definecasemap 191 191 175 % z dotaccent
-%
-% \definecasemap 161 161 177 % A ogonek
-% \definecasemap 198 198 230 % C acute
-% \definecasemap 202 202 234 % E ogonek
-% \definecasemap 163 163 179 % L crossed
-% \definecasemap 209 209 241 % N acute
-% \definecasemap 211 211 243 % O acute
-% \definecasemap 166 166 182 % S acute
-% \definecasemap 172 172 188 % Z acute
-% \definecasemap 175 175 191 % Z dotaccent
-%
-% \stopmapping
-%
-% \startmapping[pl2]
-%
-% \definespacemap 161 999 % A ogonek
-% \definespacemap 198 999 % C acute
-% \definespacemap 202 999 % E ogonek
-% \definespacemap 163 999 % L crossed
-% \definespacemap 209 999 % N acute
-% \definespacemap 211 999 % O acute
-% \definespacemap 166 999 % S acute
-% \definespacemap 172 999 % Z acute
-% \definespacemap 175 999 % Z dot
-%
-% \stopmapping
-%
-% \startencoding[pl2]
-%
-% \definecharacter Aogonek 161
-% \definecharacter Lstroke 163
-% \definecharacter Sacute 166
-% \definecharacter Zacute 172
-% \definecharacter Zdotaccent 175
-% \definecharacter aogonek 177
-% \definecharacter lstroke 179
-% \definecharacter sacute 182
-% \definecharacter zacute 188
-% \definecharacter zdotaccent 191
-% \definecharacter Cacute 198
-% \definecharacter Eogonek 202
-% \definecharacter Nacute 209
-% \definecharacter Oacute 211
-% \definecharacter cacute 230
-% \definecharacter eogonek 234
-% \definecharacter nacute 241
-% \definecharacter oacute 243
-%
-% \stopencoding
-%
-% \startencoding[pl2]
-%
-% \definecharacter leftguillemot 174
-% \definecharacter rightguillemot 175
-% \definecharacter guilsingleleft 174
-% \definecharacter guilsingleright 175
-%
-% \stopencoding
-
-\endinput
diff --git a/tex/context/base/enco-qx.mkii b/tex/context/base/enco-qx.mkii
new file mode 100644
index 000000000..407d60bd7
--- /dev/null
+++ b/tex/context/base/enco-qx.mkii
@@ -0,0 +1,266 @@
+%D \module
+%D [ file=enco-qx,
+%D version=2004.04.03,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Polish QX Encoding,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% to be done
+
+% 35 numbersign
+% 95 dotaccent
+% 132 greaterequal
+% 133 approxequal
+% 137 lessequal
+% 142 ell
+% 156 IJ
+% 173 infinity
+% 182 threequartersemdash
+% 188 ij
+% 247 anglearc
+% 248 diameter
+
+\startmapping[qx] % to be done
+
+\resetcaserange 128 to 128
+\resetcaserange 131 to 133
+\resetcaserange 136 to 137
+\resetcaserange 140 to 144
+\resetcaserange 148 to 148
+\resetcaserange 150 to 150
+\resetcaserange 157 to 160
+\resetcaserange 163 to 165
+\resetcaserange 168 to 169
+\resetcaserange 172 to 176
+\resetcaserange 180 to 180
+\resetcaserange 182 to 182
+\resetcaserange 189 to 191
+\resetcaserange 198 to 198
+\resetcaserange 215 to 216
+\resetcaserange 223 to 223
+\resetcaserange 230 to 230
+\resetcaserange 247 to 248
+\resetcaserange 255 to 255
+
+\definecaseswap 161 129
+\definecaseswap 162 130
+
+\definecaseswap 166 134
+\definecaseswap 167 135
+
+\definecaseswap 170 138
+\definecaseswap 171 139
+
+\definecaseswap 177 145
+\definecaseswap 178 146
+\definecaseswap 179 147
+
+\definecaseswap 181 149
+
+\definecasemaps 151 to 156 lc +32 uc 0
+\definecasemaps 183 to 188 lc 0 uc -32
+
+\definecasemaps 192 to 197 lc +32 uc 0
+\definecasemaps 224 to 229 lc 0 uc -32
+
+\definecasemaps 199 to 214 lc +32 uc 0
+\definecasemaps 231 to 246 lc 0 uc -32
+
+\definecasemaps 217 to 222 lc +32 uc 0
+\definecasemaps 249 to 254 lc 0 uc -32
+
+\stopmapping
+
+\startencoding[qx]
+
+\definecharacter textacute 19
+\definecharacter textbreve 21
+\definecharacter textcaron 20
+\definecharacter textcedilla 24
+\definecharacter textcircumflex 94
+\definecharacter textdiaeresis 127
+\definecharacter textdotaccent 94
+\definecharacter textgrave 18
+\definecharacter texthungarumlaut 125
+\definecharacter textmacron 22
+\definecharacter textogonek 150
+\definecharacter textring 23
+\definecharacter texttilde 126
+
+\definecharacter dotlessi 16
+\definecharacter dotlessj 17
+
+\definecharacter endash 123
+\definecharacter emdash 124
+
+\definecharacter aeligature 26
+\definecharacter AEligature 29
+\definecharacter oeligature 27
+\definecharacter OEligature 30
+
+\definecharacter ssharp 25
+%definecharacter Ssharp 25
+
+\definecharacter thorn 254
+\definecharacter Thorn 222
+
+\definecharacter Dstroke 208 % also Eth, mapped into enco-def
+\definecharacter eth 240
+
+\definecharacter exclamdown 60
+\definecharacter questiondown 62
+
+\definecharacter sectionmark 159
+
+\definecharacter percent 37
+\definecharacter perthousand 216
+
+\definecharacter textasciicircum 141
+\definecharacter textasciitilde 140
+\definecharacter textbackslash 198
+\definecharacter textbraceleft 157
+\definecharacter textbraceright 158
+\definecharacter textunderscore 230
+
+\definecharacter textcurrency 215
+\definecharacter textdollar 36
+\definecharacter texteuro 128
+
+\definecharacter periodcentered 189
+\definecharacter textdag 143
+\definecharacter textddag 144
+\definecharacter textdegree 148
+\definecharacter textbullet 180
+
+\definecharacter paragraphmark 176
+
+\definecharacter copyright 164
+\definecharacter registered 163
+
+\definecharacter textbrokenbar 223
+\definecharacter textellipsis 8
+\definecharacter textslash 47
+\definecharacter textpm 172
+\definecharacter textdiv 165
+\definecharacter textminus 168
+\definecharacter textmultiply 169
+\definecharacter textmu 7
+
+\definecharacter quotedbl 190
+\definecharacter quotedblbase 255
+\definecharacter quotedblleft 92
+\definecharacter quotedblright 34
+
+\definecharacter quotesingle 191
+
+\definecharacter quoteleft 96
+\definecharacter quoteright 39
+
+\definecharacter leftguillemot 174
+\definecharacter rightguillemot 175
+
+\definecharacter aacute 225
+\definecharacter Aacute 193
+\definecharacter cacute 162
+\definecharacter Cacute 130
+\definecharacter eacute 233
+\definecharacter Eacute 201
+\definecharacter iacute 237
+\definecharacter Iacute 205
+\definecharacter Nacute 139
+\definecharacter Oacute 211
+\definecharacter nacute 171
+\definecharacter oacute 243
+\definecharacter sacute 177
+\definecharacter Sacute 145
+\definecharacter uacute 250
+\definecharacter Uacute 218
+\definecharacter yacute 253
+\definecharacter Yacute 221
+\definecharacter zacute 185
+\definecharacter Zacute 153
+
+\definecharacter scaron 178
+\definecharacter Scaron 146
+\definecharacter zcaron 186
+\definecharacter Zcaron 154
+
+\definecharacter ccedilla 231
+\definecharacter Ccedilla 199
+
+\definecharacter acircumflex 226
+\definecharacter Acircumflex 194
+\definecharacter ecircumflex 234
+\definecharacter Ecircumflex 202
+\definecharacter icircumflex 238
+\definecharacter Icircumflex 206
+\definecharacter ocircumflex 244
+\definecharacter Ocircumflex 212
+\definecharacter ucircumflex 251
+\definecharacter Ucircumflex 219
+
+\definecharacter adiaeresis 228
+\definecharacter Adiaeresis 196
+\definecharacter ediaeresis 235
+\definecharacter Ediaeresis 203
+\definecharacter idiaeresis 239
+\definecharacter Idiaeresis 207
+\definecharacter odiaeresis 246
+\definecharacter Odiaeresis 214
+\definecharacter udiaeresis 252
+\definecharacter Udiaeresis 220
+\definecharacter ydiaeresis 184
+\definecharacter Ydiaeresis 152
+
+\definecharacter zdotaccent 187
+\definecharacter Zdotaccent 155
+
+\definecharacter agrave 224
+\definecharacter Agrave 192
+\definecharacter egrave 232
+\definecharacter Egrave 200
+\definecharacter igrave 236
+\definecharacter Igrave 204
+\definecharacter ograve 242
+\definecharacter Ograve 210
+\definecharacter ugrave 249
+\definecharacter Ugrave 217
+
+\definecharacter aogonek 161
+\definecharacter Aogonek 129
+\definecharacter eogonek 166
+\definecharacter Eogonek 134
+\definecharacter iogonek 167
+\definecharacter Iogonek 135
+\definecharacter uogonek 183
+\definecharacter Uogonek 151
+
+\definecharacter aring 229
+\definecharacter Aring 197
+
+\definecharacter lstroke 170
+\definecharacter Lstroke 138
+\definecharacter ostroke 28
+\definecharacter Ostroke 31
+
+\definecharacter atilde 227
+\definecharacter Atilde 195
+\definecharacter ntilde 241
+\definecharacter Ntilde 209
+\definecharacter otilde 245
+\definecharacter Otilde 213
+
+\definecharacter scommaaccent 179
+\definecharacter Scommaaccent 147
+\definecharacter tcommaaccent 181
+\definecharacter Tcommaaccent 149
+
+\stopencoding
+
+\endinput
diff --git a/tex/context/base/enco-qx.tex b/tex/context/base/enco-qx.tex
deleted file mode 100644
index 407d60bd7..000000000
--- a/tex/context/base/enco-qx.tex
+++ /dev/null
@@ -1,266 +0,0 @@
-%D \module
-%D [ file=enco-qx,
-%D version=2004.04.03,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Polish QX Encoding,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-% to be done
-
-% 35 numbersign
-% 95 dotaccent
-% 132 greaterequal
-% 133 approxequal
-% 137 lessequal
-% 142 ell
-% 156 IJ
-% 173 infinity
-% 182 threequartersemdash
-% 188 ij
-% 247 anglearc
-% 248 diameter
-
-\startmapping[qx] % to be done
-
-\resetcaserange 128 to 128
-\resetcaserange 131 to 133
-\resetcaserange 136 to 137
-\resetcaserange 140 to 144
-\resetcaserange 148 to 148
-\resetcaserange 150 to 150
-\resetcaserange 157 to 160
-\resetcaserange 163 to 165
-\resetcaserange 168 to 169
-\resetcaserange 172 to 176
-\resetcaserange 180 to 180
-\resetcaserange 182 to 182
-\resetcaserange 189 to 191
-\resetcaserange 198 to 198
-\resetcaserange 215 to 216
-\resetcaserange 223 to 223
-\resetcaserange 230 to 230
-\resetcaserange 247 to 248
-\resetcaserange 255 to 255
-
-\definecaseswap 161 129
-\definecaseswap 162 130
-
-\definecaseswap 166 134
-\definecaseswap 167 135
-
-\definecaseswap 170 138
-\definecaseswap 171 139
-
-\definecaseswap 177 145
-\definecaseswap 178 146
-\definecaseswap 179 147
-
-\definecaseswap 181 149
-
-\definecasemaps 151 to 156 lc +32 uc 0
-\definecasemaps 183 to 188 lc 0 uc -32
-
-\definecasemaps 192 to 197 lc +32 uc 0
-\definecasemaps 224 to 229 lc 0 uc -32
-
-\definecasemaps 199 to 214 lc +32 uc 0
-\definecasemaps 231 to 246 lc 0 uc -32
-
-\definecasemaps 217 to 222 lc +32 uc 0
-\definecasemaps 249 to 254 lc 0 uc -32
-
-\stopmapping
-
-\startencoding[qx]
-
-\definecharacter textacute 19
-\definecharacter textbreve 21
-\definecharacter textcaron 20
-\definecharacter textcedilla 24
-\definecharacter textcircumflex 94
-\definecharacter textdiaeresis 127
-\definecharacter textdotaccent 94
-\definecharacter textgrave 18
-\definecharacter texthungarumlaut 125
-\definecharacter textmacron 22
-\definecharacter textogonek 150
-\definecharacter textring 23
-\definecharacter texttilde 126
-
-\definecharacter dotlessi 16
-\definecharacter dotlessj 17
-
-\definecharacter endash 123
-\definecharacter emdash 124
-
-\definecharacter aeligature 26
-\definecharacter AEligature 29
-\definecharacter oeligature 27
-\definecharacter OEligature 30
-
-\definecharacter ssharp 25
-%definecharacter Ssharp 25
-
-\definecharacter thorn 254
-\definecharacter Thorn 222
-
-\definecharacter Dstroke 208 % also Eth, mapped into enco-def
-\definecharacter eth 240
-
-\definecharacter exclamdown 60
-\definecharacter questiondown 62
-
-\definecharacter sectionmark 159
-
-\definecharacter percent 37
-\definecharacter perthousand 216
-
-\definecharacter textasciicircum 141
-\definecharacter textasciitilde 140
-\definecharacter textbackslash 198
-\definecharacter textbraceleft 157
-\definecharacter textbraceright 158
-\definecharacter textunderscore 230
-
-\definecharacter textcurrency 215
-\definecharacter textdollar 36
-\definecharacter texteuro 128
-
-\definecharacter periodcentered 189
-\definecharacter textdag 143
-\definecharacter textddag 144
-\definecharacter textdegree 148
-\definecharacter textbullet 180
-
-\definecharacter paragraphmark 176
-
-\definecharacter copyright 164
-\definecharacter registered 163
-
-\definecharacter textbrokenbar 223
-\definecharacter textellipsis 8
-\definecharacter textslash 47
-\definecharacter textpm 172
-\definecharacter textdiv 165
-\definecharacter textminus 168
-\definecharacter textmultiply 169
-\definecharacter textmu 7
-
-\definecharacter quotedbl 190
-\definecharacter quotedblbase 255
-\definecharacter quotedblleft 92
-\definecharacter quotedblright 34
-
-\definecharacter quotesingle 191
-
-\definecharacter quoteleft 96
-\definecharacter quoteright 39
-
-\definecharacter leftguillemot 174
-\definecharacter rightguillemot 175
-
-\definecharacter aacute 225
-\definecharacter Aacute 193
-\definecharacter cacute 162
-\definecharacter Cacute 130
-\definecharacter eacute 233
-\definecharacter Eacute 201
-\definecharacter iacute 237
-\definecharacter Iacute 205
-\definecharacter Nacute 139
-\definecharacter Oacute 211
-\definecharacter nacute 171
-\definecharacter oacute 243
-\definecharacter sacute 177
-\definecharacter Sacute 145
-\definecharacter uacute 250
-\definecharacter Uacute 218
-\definecharacter yacute 253
-\definecharacter Yacute 221
-\definecharacter zacute 185
-\definecharacter Zacute 153
-
-\definecharacter scaron 178
-\definecharacter Scaron 146
-\definecharacter zcaron 186
-\definecharacter Zcaron 154
-
-\definecharacter ccedilla 231
-\definecharacter Ccedilla 199
-
-\definecharacter acircumflex 226
-\definecharacter Acircumflex 194
-\definecharacter ecircumflex 234
-\definecharacter Ecircumflex 202
-\definecharacter icircumflex 238
-\definecharacter Icircumflex 206
-\definecharacter ocircumflex 244
-\definecharacter Ocircumflex 212
-\definecharacter ucircumflex 251
-\definecharacter Ucircumflex 219
-
-\definecharacter adiaeresis 228
-\definecharacter Adiaeresis 196
-\definecharacter ediaeresis 235
-\definecharacter Ediaeresis 203
-\definecharacter idiaeresis 239
-\definecharacter Idiaeresis 207
-\definecharacter odiaeresis 246
-\definecharacter Odiaeresis 214
-\definecharacter udiaeresis 252
-\definecharacter Udiaeresis 220
-\definecharacter ydiaeresis 184
-\definecharacter Ydiaeresis 152
-
-\definecharacter zdotaccent 187
-\definecharacter Zdotaccent 155
-
-\definecharacter agrave 224
-\definecharacter Agrave 192
-\definecharacter egrave 232
-\definecharacter Egrave 200
-\definecharacter igrave 236
-\definecharacter Igrave 204
-\definecharacter ograve 242
-\definecharacter Ograve 210
-\definecharacter ugrave 249
-\definecharacter Ugrave 217
-
-\definecharacter aogonek 161
-\definecharacter Aogonek 129
-\definecharacter eogonek 166
-\definecharacter Eogonek 134
-\definecharacter iogonek 167
-\definecharacter Iogonek 135
-\definecharacter uogonek 183
-\definecharacter Uogonek 151
-
-\definecharacter aring 229
-\definecharacter Aring 197
-
-\definecharacter lstroke 170
-\definecharacter Lstroke 138
-\definecharacter ostroke 28
-\definecharacter Ostroke 31
-
-\definecharacter atilde 227
-\definecharacter Atilde 195
-\definecharacter ntilde 241
-\definecharacter Ntilde 209
-\definecharacter otilde 245
-\definecharacter Otilde 213
-
-\definecharacter scommaaccent 179
-\definecharacter Scommaaccent 147
-\definecharacter tcommaaccent 181
-\definecharacter Tcommaaccent 149
-
-\stopencoding
-
-\endinput
diff --git a/tex/context/base/enco-raw.mkii b/tex/context/base/enco-raw.mkii
new file mode 100644
index 000000000..e3a46e3d7
--- /dev/null
+++ b/tex/context/base/enco-raw.mkii
@@ -0,0 +1,119 @@
+% default instelbaar maken: \enableencoding[main][fallback]
+
+\startencoding[raw]
+
+\definecharacter Acircumflex {A} \definecharacter acircumflex {a}
+\definecharacter Ccircumflex {C} \definecharacter ccircumflex {c}
+\definecharacter Ecircumflex {E} \definecharacter ecircumflex {e}
+\definecharacter Gcircumflex {G} \definecharacter gcircumflex {g}
+\definecharacter Hcircumflex {H} \definecharacter hcircumflex {h}
+\definecharacter Icircumflex {I} \definecharacter icircumflex {i}
+\definecharacter Jcircumflex {J} \definecharacter jcircumflex {j}
+\definecharacter Ocircumflex {O} \definecharacter ocircumflex {o}
+\definecharacter Scircumflex {S} \definecharacter scircumflex {s}
+\definecharacter Ucircumflex {U} \definecharacter ucircumflex {u}
+\definecharacter Wcircumflex {W} \definecharacter wcircumflex {w}
+\definecharacter Ycircumflex {Y} \definecharacter ycircumflex {y}
+
+\definecharacter Agrave {A} \definecharacter agrave {a}
+\definecharacter Egrave {E} \definecharacter egrave {e}
+\definecharacter Igrave {I} \definecharacter igrave {i}
+\definecharacter Ograve {O} \definecharacter ograve {o}
+\definecharacter Ugrave {U} \definecharacter ugrave {u}
+\definecharacter Ygrave {Y} \definecharacter ygrave {y}
+
+\definecharacter Atilde {A} \definecharacter atilde {a}
+\definecharacter Itilde {I} \definecharacter itilde {i}
+\definecharacter Otilde {O} \definecharacter otilde {o}
+\definecharacter Utilde {U} \definecharacter utilde {u}
+\definecharacter Utilde {N} \definecharacter utilde {n}
+
+\definecharacter Adiaeresis {A} \definecharacter adiaeresis {a}
+\definecharacter Ediaeresis {E} \definecharacter ediaeresis {e}
+\definecharacter Idiaeresis {I} \definecharacter idiaeresis {i}
+\definecharacter Odiaeresis {O} \definecharacter odiaeresis {o}
+\definecharacter Udiaeresis {U} \definecharacter udiaeresis {u}
+\definecharacter Ydiaeresis {Y} \definecharacter ydiaeresis {y}
+
+\definecharacter Aacute {A} \definecharacter aacute {a}
+\definecharacter Cacute {C} \definecharacter cacute {c}
+\definecharacter Eacute {E} \definecharacter eacute {e}
+\definecharacter Iacute {I} \definecharacter iacute {i}
+\definecharacter Lacute {L} \definecharacter lacute {l}
+\definecharacter Nacute {N} \definecharacter nacute {n}
+\definecharacter Oacute {O} \definecharacter oacute {o}
+\definecharacter Racute {R} \definecharacter racute {r}
+\definecharacter Sacute {S} \definecharacter sacute {s}
+\definecharacter Uacute {U} \definecharacter uacute {u}
+\definecharacter Yacute {Y} \definecharacter yacute {y}
+\definecharacter Zacute {Z} \definecharacter zacute {z}
+
+\definecharacter Dstroke {D} \definecharacter dstroke {d}
+\definecharacter Hstroke {H} \definecharacter hstroke {h}
+\definecharacter Tstroke {T} \definecharacter tstroke {t}
+
+\definecharacter Cdotaccent {C} \definecharacter cdotaccent {c}
+\definecharacter Edotaccent {E} \definecharacter edotaccent {e}
+\definecharacter Gdotaccent {G} \definecharacter gdotaccent {g}
+\definecharacter Idotaccent {I} \definecharacter idotaccent {i}
+\definecharacter Zdotaccent {Z} \definecharacter zdotaccent {z}
+
+\definecharacter Amacron {A} \definecharacter amacron {a}
+\definecharacter Emacron {E} \definecharacter emacron {e}
+\definecharacter Imacron {I} \definecharacter imacron {i}
+\definecharacter Omacron {O} \definecharacter omacron {o}
+\definecharacter Umacron {U} \definecharacter umacron {u}
+
+\definecharacter Ccedilla {C} \definecharacter ccedilla {c}
+\definecharacter Kcedilla {K} \definecharacter kcedilla {k}
+\definecharacter Lcedilla {L} \definecharacter lcedilla {l}
+\definecharacter Ncedilla {N} \definecharacter ncedilla {n}
+\definecharacter Rcedilla {R} \definecharacter rcedilla {r}
+\definecharacter Scedilla {S} \definecharacter scedilla {s}
+\definecharacter Tcedilla {T} \definecharacter tcedilla {t}
+
+\definecharacter Ohungarumlaut {O} \definecharacter ohungarumlaut {o}
+\definecharacter Uhungarumlaut {U} \definecharacter uhungarumlaut {u}
+
+\definecharacter Aogonek {A} \definecharacter aogonek {a}
+\definecharacter Eogonek {E} \definecharacter eogonek {e}
+\definecharacter Iogonek {I} \definecharacter iogonek {i}
+\definecharacter Uogonek {U} \definecharacter uogonek {u}
+
+\definecharacter Aring {A} \definecharacter aring {a}
+\definecharacter Uring {U} \definecharacter uring {u}
+
+\definecharacter Abreve {A} \definecharacter abreve {a}
+\definecharacter Ebreve {E} \definecharacter ebreve {e}
+\definecharacter Gbreve {G} \definecharacter gbreve {g}
+\definecharacter Ibreve {I} \definecharacter ibreve {i}
+\definecharacter Obreve {O} \definecharacter obreve {o}
+\definecharacter Ubreve {U} \definecharacter ubreve {u}
+
+\definecharacter Ccaron {C} \definecharacter ccaron {c}
+\definecharacter Dcaron {D} \definecharacter dcaron {d}
+\definecharacter Ecaron {E} \definecharacter ecaron {e}
+\definecharacter Lcaron {L} \definecharacter lcaron {l}
+\definecharacter Ncaron {N} \definecharacter ncaron {n}
+\definecharacter Rcaron {R} \definecharacter rcaron {r}
+\definecharacter Scaron {S} \definecharacter scaron {s}
+\definecharacter Tcaron {T} \definecharacter tcaron {t}
+\definecharacter Zcaron {Z} \definecharacter zcaron {z}
+
+\definecharacter dotlessI {I} \definecharacter dotlessi {i}
+\definecharacter dotlessJ {J} \definecharacter dotlessj {j}
+
+\definecharacter AEligature {AE} \definecharacter aeligature {ae}
+\definecharacter Lstroke {L} \definecharacter lstroke {l}
+\definecharacter Ostroke {O} \definecharacter ostroke {o}
+\definecharacter OEligature {OE} \definecharacter oeligature {oe}
+\definecharacter Ssharp {SS} \definecharacter ssharp {ss}
+\definecharacter IJligature {IJ} \definecharacter ijligature {ij}
+
+\definecharacter Aumlaut {A} \definecharacter aumlaut {a}
+\definecharacter Eumlaut {E} \definecharacter eumlaut {e}
+\definecharacter Iumlaut {I} \definecharacter iumlaut {i}
+\definecharacter Oumlaut {O} \definecharacter oumlaut {o}
+\definecharacter Uumlaut {U} \definecharacter uumlaut {u}
+
+\stopencoding
diff --git a/tex/context/base/enco-raw.tex b/tex/context/base/enco-raw.tex
deleted file mode 100644
index e3a46e3d7..000000000
--- a/tex/context/base/enco-raw.tex
+++ /dev/null
@@ -1,119 +0,0 @@
-% default instelbaar maken: \enableencoding[main][fallback]
-
-\startencoding[raw]
-
-\definecharacter Acircumflex {A} \definecharacter acircumflex {a}
-\definecharacter Ccircumflex {C} \definecharacter ccircumflex {c}
-\definecharacter Ecircumflex {E} \definecharacter ecircumflex {e}
-\definecharacter Gcircumflex {G} \definecharacter gcircumflex {g}
-\definecharacter Hcircumflex {H} \definecharacter hcircumflex {h}
-\definecharacter Icircumflex {I} \definecharacter icircumflex {i}
-\definecharacter Jcircumflex {J} \definecharacter jcircumflex {j}
-\definecharacter Ocircumflex {O} \definecharacter ocircumflex {o}
-\definecharacter Scircumflex {S} \definecharacter scircumflex {s}
-\definecharacter Ucircumflex {U} \definecharacter ucircumflex {u}
-\definecharacter Wcircumflex {W} \definecharacter wcircumflex {w}
-\definecharacter Ycircumflex {Y} \definecharacter ycircumflex {y}
-
-\definecharacter Agrave {A} \definecharacter agrave {a}
-\definecharacter Egrave {E} \definecharacter egrave {e}
-\definecharacter Igrave {I} \definecharacter igrave {i}
-\definecharacter Ograve {O} \definecharacter ograve {o}
-\definecharacter Ugrave {U} \definecharacter ugrave {u}
-\definecharacter Ygrave {Y} \definecharacter ygrave {y}
-
-\definecharacter Atilde {A} \definecharacter atilde {a}
-\definecharacter Itilde {I} \definecharacter itilde {i}
-\definecharacter Otilde {O} \definecharacter otilde {o}
-\definecharacter Utilde {U} \definecharacter utilde {u}
-\definecharacter Utilde {N} \definecharacter utilde {n}
-
-\definecharacter Adiaeresis {A} \definecharacter adiaeresis {a}
-\definecharacter Ediaeresis {E} \definecharacter ediaeresis {e}
-\definecharacter Idiaeresis {I} \definecharacter idiaeresis {i}
-\definecharacter Odiaeresis {O} \definecharacter odiaeresis {o}
-\definecharacter Udiaeresis {U} \definecharacter udiaeresis {u}
-\definecharacter Ydiaeresis {Y} \definecharacter ydiaeresis {y}
-
-\definecharacter Aacute {A} \definecharacter aacute {a}
-\definecharacter Cacute {C} \definecharacter cacute {c}
-\definecharacter Eacute {E} \definecharacter eacute {e}
-\definecharacter Iacute {I} \definecharacter iacute {i}
-\definecharacter Lacute {L} \definecharacter lacute {l}
-\definecharacter Nacute {N} \definecharacter nacute {n}
-\definecharacter Oacute {O} \definecharacter oacute {o}
-\definecharacter Racute {R} \definecharacter racute {r}
-\definecharacter Sacute {S} \definecharacter sacute {s}
-\definecharacter Uacute {U} \definecharacter uacute {u}
-\definecharacter Yacute {Y} \definecharacter yacute {y}
-\definecharacter Zacute {Z} \definecharacter zacute {z}
-
-\definecharacter Dstroke {D} \definecharacter dstroke {d}
-\definecharacter Hstroke {H} \definecharacter hstroke {h}
-\definecharacter Tstroke {T} \definecharacter tstroke {t}
-
-\definecharacter Cdotaccent {C} \definecharacter cdotaccent {c}
-\definecharacter Edotaccent {E} \definecharacter edotaccent {e}
-\definecharacter Gdotaccent {G} \definecharacter gdotaccent {g}
-\definecharacter Idotaccent {I} \definecharacter idotaccent {i}
-\definecharacter Zdotaccent {Z} \definecharacter zdotaccent {z}
-
-\definecharacter Amacron {A} \definecharacter amacron {a}
-\definecharacter Emacron {E} \definecharacter emacron {e}
-\definecharacter Imacron {I} \definecharacter imacron {i}
-\definecharacter Omacron {O} \definecharacter omacron {o}
-\definecharacter Umacron {U} \definecharacter umacron {u}
-
-\definecharacter Ccedilla {C} \definecharacter ccedilla {c}
-\definecharacter Kcedilla {K} \definecharacter kcedilla {k}
-\definecharacter Lcedilla {L} \definecharacter lcedilla {l}
-\definecharacter Ncedilla {N} \definecharacter ncedilla {n}
-\definecharacter Rcedilla {R} \definecharacter rcedilla {r}
-\definecharacter Scedilla {S} \definecharacter scedilla {s}
-\definecharacter Tcedilla {T} \definecharacter tcedilla {t}
-
-\definecharacter Ohungarumlaut {O} \definecharacter ohungarumlaut {o}
-\definecharacter Uhungarumlaut {U} \definecharacter uhungarumlaut {u}
-
-\definecharacter Aogonek {A} \definecharacter aogonek {a}
-\definecharacter Eogonek {E} \definecharacter eogonek {e}
-\definecharacter Iogonek {I} \definecharacter iogonek {i}
-\definecharacter Uogonek {U} \definecharacter uogonek {u}
-
-\definecharacter Aring {A} \definecharacter aring {a}
-\definecharacter Uring {U} \definecharacter uring {u}
-
-\definecharacter Abreve {A} \definecharacter abreve {a}
-\definecharacter Ebreve {E} \definecharacter ebreve {e}
-\definecharacter Gbreve {G} \definecharacter gbreve {g}
-\definecharacter Ibreve {I} \definecharacter ibreve {i}
-\definecharacter Obreve {O} \definecharacter obreve {o}
-\definecharacter Ubreve {U} \definecharacter ubreve {u}
-
-\definecharacter Ccaron {C} \definecharacter ccaron {c}
-\definecharacter Dcaron {D} \definecharacter dcaron {d}
-\definecharacter Ecaron {E} \definecharacter ecaron {e}
-\definecharacter Lcaron {L} \definecharacter lcaron {l}
-\definecharacter Ncaron {N} \definecharacter ncaron {n}
-\definecharacter Rcaron {R} \definecharacter rcaron {r}
-\definecharacter Scaron {S} \definecharacter scaron {s}
-\definecharacter Tcaron {T} \definecharacter tcaron {t}
-\definecharacter Zcaron {Z} \definecharacter zcaron {z}
-
-\definecharacter dotlessI {I} \definecharacter dotlessi {i}
-\definecharacter dotlessJ {J} \definecharacter dotlessj {j}
-
-\definecharacter AEligature {AE} \definecharacter aeligature {ae}
-\definecharacter Lstroke {L} \definecharacter lstroke {l}
-\definecharacter Ostroke {O} \definecharacter ostroke {o}
-\definecharacter OEligature {OE} \definecharacter oeligature {oe}
-\definecharacter Ssharp {SS} \definecharacter ssharp {ss}
-\definecharacter IJligature {IJ} \definecharacter ijligature {ij}
-
-\definecharacter Aumlaut {A} \definecharacter aumlaut {a}
-\definecharacter Eumlaut {E} \definecharacter eumlaut {e}
-\definecharacter Iumlaut {I} \definecharacter iumlaut {i}
-\definecharacter Oumlaut {O} \definecharacter oumlaut {o}
-\definecharacter Uumlaut {U} \definecharacter uumlaut {u}
-
-\stopencoding
diff --git a/tex/context/base/enco-run.mkii b/tex/context/base/enco-run.mkii
new file mode 100644
index 000000000..50fb52e15
--- /dev/null
+++ b/tex/context/base/enco-run.mkii
@@ -0,0 +1,149 @@
+%D \module
+%D [ file=enco-run,
+%D version=2000.27.12, % moved to runtime module
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Runtime Macros,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=Hans Hagen \& Ton Otten]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+\gdef\visualizecharacters% {}'s needed
+ {\def\uchar##1##2{\hbox to 2.5em
+ {\ifcase##1\relax\red\or\blue\else\green\fi##1\hss##2}}%
+ \let\normalbuildtextaccent\buildtextaccent
+ \let\normalbottomaccent \bottomaccent
+ %\def\char{\green\normalchar}%
+ \def\char % can be used in \oalign
+ {\bgroup\def\char{\green\normalchar\scratchcounter\egroup}%
+ \afterassignment\char\scratchcounter}%
+ \def\buildtextaccent{\let\green\empty\blue\normalbuildtextaccent}%
+ \def\bottomaccent{\let\green\empty\red\normalbottomaccent}}
+
+\unexpanded\gdef\visualizecharacterslegend
+ {\hbox
+ {\edef\banner{\currentencoding\space\fontname\font}%
+ \tttf\banner:\space
+ {\blue composed}\space{\red bottom}\space{\green char}\space raw}}
+
+\gdef\showaccents
+ {\bgroup
+ \savefont
+ \setuptextrules[\c!bodyfont=,\c!style=]
+ \starttextrule{\visualizecharacterslegend}
+ \whitespace
+ \restorefont\setupinterlinespace
+ \visualizecharacters
+ \def\do##1%
+ {{\def\dodo####1%
+ {\hss\hbox to 1em{\hss\expanded{##1####1\recurselevel}\hss}}%
+ \hbox to \hsize
+ {\strut
+ \localcolortrue
+ \hbox to 2em{\tttf\string##1\hss}%
+ \dorecurse{26}{\dodo\character}}%
+ \hbox to \hsize
+ {\strut
+ \localcolortrue
+ \hskip2em
+ \dorecurse{26}{\dodo\Character}}}%
+ \par}
+ \do\'\do\`\do\^\do\~\do\"
+ \do\H\do\r\do\v\do\u\do\=
+ \do\.\do\b\do\d\do\k\do\c
+ \stoptextrule
+ \egroup}
+
+\gdef\showcharacters
+ {\bgroup
+ \savefont
+ \setuptextrules[\c!bodyfont=,\c!style=]
+ \starttextrule{\visualizecharacterslegend}
+ \whitespace
+ \dontcomplain
+ \forgetall
+ \def\startencoding[##1]{}
+ \def\stopencoding{\endinput}
+ \dimen0=\zeropoint
+ \dimen2=\zeropoint
+ \def\definecharacter ##1 ##2 %
+ {\setbox0=\hbox spread 1em{\getvalue{##1}}%
+ \ifdim\wd0>\dimen0 \dimen0=\wd0 \fi
+ \setbox2=\hbox spread 1em{\box0 \tttf##1}
+ \ifdim\wd2>\dimen2 \dimen2=\wd2 \fi}%
+ \readsysfile{\f!encodingprefix def}{}{}
+ \edef\encwidth{\the\dimen0}
+ \dimen0=\hsize
+ \advance\dimen0 2em
+ \advance\dimen2 2em
+ \divide \dimen0 by \dimen2 \advance\dimen0 1sp
+ \edef\enccols{\number\dimen0}
+ \visualizecharacters
+ \startcolumns[\c!n=\enccols,\c!distance=2em]
+ \restorefont\setupinterlinespace
+ \def\definecharacter ##1 ##2 %
+ {\setbox0=\hbox to \hsize{\localcolortrue\hbox to \encwidth{\getvalue{##1}\hss}\tttf##1}%
+ \ht0\strutheight \dp0\strutdepth \box0 \allowbreak}
+ \readsysfile{\f!encodingprefix def}{}{}
+ \stopcolumns
+ \stoptextrule
+ \egroup}
+
+% \hbox
+% {\font\test=uplr8t \test \ruledhbox{t}
+% \font\test=uplr8r \test \ruledhbox{t}}
+
+\ifnum\texengine=\pdftexengine
+
+ \gdef\showhyphenations#1%
+ {\starttabulate[|le|l|]
+ \NC language \NC \currentlanguage\ (internal code:\the\normallanguage) \NC \NR
+ \NC font \NC \fontname\font \NC \NR
+ \NC encoding \NC \ifx\@@fontencoding\empty not set\else\@@fontencoding\fi \NC \NR
+ \NC mapping \NC \ifx\@@fontmapping \empty not set\else\@@fontmapping \fi \NC \NR
+ \NC handling \NC \ifx\@@fonthandling\empty not set\else\@@fonthandling\fi \NC \NR
+ \NC sample \NC \hyphenatedword{#1} \NC \NR
+ \stoptabulate}
+
+ \gdef\showmapping
+ {\dostepwiserecurse{128}{255}{1}
+ {\hbox\bgroup
+ \hbox to 2em{\hss\recurselevel}%
+ \hbox to 2em{\hss\char\recurselevel\hss}%
+ \hbox to 3em{\hss\ifcase\lccode\recurselevel\else\the \lccode\recurselevel\fi}%
+ \hbox to 2em{\hss\ifcase\lccode\recurselevel\else\char\lccode\recurselevel\fi\hss}%
+ \hbox to 3em{\hss\ifcase\lccode\recurselevel\else\the \uccode\recurselevel\fi}%
+ \hbox to 2em{\hss\ifcase\uccode\recurselevel\else\char\uccode\recurselevel\fi\hss}%
+ \egroup
+ \endgraf}}
+
+ \gdef\showcharacterbounds
+ {\bgroup
+ \localcolortrue
+ \dorecurse{255}
+ {\ifdim\fontcharwd\font\recurselevel>\zeropoint
+ \noindent\ruledhbox{\darkgray\char\recurselevel}\space
+ \fi}\unskip
+ \egroup}
+
+\else
+
+ \gdef\showhyphenations#1%
+ {\starttabulate[|le|l|]
+ \NC language \NC \currentlanguage\ (internal code:\the\normallanguage) \NC \NR
+ \NC font \NC \fontname\font \NC \NR
+ \NC sample \NC \hyphenatedword{#1} \NC \NR
+ \stoptabulate}
+
+ \globallet\showmapping\relax
+
+ \globallet\showcharacterbounds\relax
+
+\fi
+
+\protect \endinput
diff --git a/tex/context/base/enco-run.tex b/tex/context/base/enco-run.tex
deleted file mode 100644
index 50fb52e15..000000000
--- a/tex/context/base/enco-run.tex
+++ /dev/null
@@ -1,149 +0,0 @@
-%D \module
-%D [ file=enco-run,
-%D version=2000.27.12, % moved to runtime module
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Runtime Macros,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=Hans Hagen \& Ton Otten]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\unprotect
-
-\gdef\visualizecharacters% {}'s needed
- {\def\uchar##1##2{\hbox to 2.5em
- {\ifcase##1\relax\red\or\blue\else\green\fi##1\hss##2}}%
- \let\normalbuildtextaccent\buildtextaccent
- \let\normalbottomaccent \bottomaccent
- %\def\char{\green\normalchar}%
- \def\char % can be used in \oalign
- {\bgroup\def\char{\green\normalchar\scratchcounter\egroup}%
- \afterassignment\char\scratchcounter}%
- \def\buildtextaccent{\let\green\empty\blue\normalbuildtextaccent}%
- \def\bottomaccent{\let\green\empty\red\normalbottomaccent}}
-
-\unexpanded\gdef\visualizecharacterslegend
- {\hbox
- {\edef\banner{\currentencoding\space\fontname\font}%
- \tttf\banner:\space
- {\blue composed}\space{\red bottom}\space{\green char}\space raw}}
-
-\gdef\showaccents
- {\bgroup
- \savefont
- \setuptextrules[\c!bodyfont=,\c!style=]
- \starttextrule{\visualizecharacterslegend}
- \whitespace
- \restorefont\setupinterlinespace
- \visualizecharacters
- \def\do##1%
- {{\def\dodo####1%
- {\hss\hbox to 1em{\hss\expanded{##1####1\recurselevel}\hss}}%
- \hbox to \hsize
- {\strut
- \localcolortrue
- \hbox to 2em{\tttf\string##1\hss}%
- \dorecurse{26}{\dodo\character}}%
- \hbox to \hsize
- {\strut
- \localcolortrue
- \hskip2em
- \dorecurse{26}{\dodo\Character}}}%
- \par}
- \do\'\do\`\do\^\do\~\do\"
- \do\H\do\r\do\v\do\u\do\=
- \do\.\do\b\do\d\do\k\do\c
- \stoptextrule
- \egroup}
-
-\gdef\showcharacters
- {\bgroup
- \savefont
- \setuptextrules[\c!bodyfont=,\c!style=]
- \starttextrule{\visualizecharacterslegend}
- \whitespace
- \dontcomplain
- \forgetall
- \def\startencoding[##1]{}
- \def\stopencoding{\endinput}
- \dimen0=\zeropoint
- \dimen2=\zeropoint
- \def\definecharacter ##1 ##2 %
- {\setbox0=\hbox spread 1em{\getvalue{##1}}%
- \ifdim\wd0>\dimen0 \dimen0=\wd0 \fi
- \setbox2=\hbox spread 1em{\box0 \tttf##1}
- \ifdim\wd2>\dimen2 \dimen2=\wd2 \fi}%
- \readsysfile{\f!encodingprefix def}{}{}
- \edef\encwidth{\the\dimen0}
- \dimen0=\hsize
- \advance\dimen0 2em
- \advance\dimen2 2em
- \divide \dimen0 by \dimen2 \advance\dimen0 1sp
- \edef\enccols{\number\dimen0}
- \visualizecharacters
- \startcolumns[\c!n=\enccols,\c!distance=2em]
- \restorefont\setupinterlinespace
- \def\definecharacter ##1 ##2 %
- {\setbox0=\hbox to \hsize{\localcolortrue\hbox to \encwidth{\getvalue{##1}\hss}\tttf##1}%
- \ht0\strutheight \dp0\strutdepth \box0 \allowbreak}
- \readsysfile{\f!encodingprefix def}{}{}
- \stopcolumns
- \stoptextrule
- \egroup}
-
-% \hbox
-% {\font\test=uplr8t \test \ruledhbox{t}
-% \font\test=uplr8r \test \ruledhbox{t}}
-
-\ifnum\texengine=\pdftexengine
-
- \gdef\showhyphenations#1%
- {\starttabulate[|le|l|]
- \NC language \NC \currentlanguage\ (internal code:\the\normallanguage) \NC \NR
- \NC font \NC \fontname\font \NC \NR
- \NC encoding \NC \ifx\@@fontencoding\empty not set\else\@@fontencoding\fi \NC \NR
- \NC mapping \NC \ifx\@@fontmapping \empty not set\else\@@fontmapping \fi \NC \NR
- \NC handling \NC \ifx\@@fonthandling\empty not set\else\@@fonthandling\fi \NC \NR
- \NC sample \NC \hyphenatedword{#1} \NC \NR
- \stoptabulate}
-
- \gdef\showmapping
- {\dostepwiserecurse{128}{255}{1}
- {\hbox\bgroup
- \hbox to 2em{\hss\recurselevel}%
- \hbox to 2em{\hss\char\recurselevel\hss}%
- \hbox to 3em{\hss\ifcase\lccode\recurselevel\else\the \lccode\recurselevel\fi}%
- \hbox to 2em{\hss\ifcase\lccode\recurselevel\else\char\lccode\recurselevel\fi\hss}%
- \hbox to 3em{\hss\ifcase\lccode\recurselevel\else\the \uccode\recurselevel\fi}%
- \hbox to 2em{\hss\ifcase\uccode\recurselevel\else\char\uccode\recurselevel\fi\hss}%
- \egroup
- \endgraf}}
-
- \gdef\showcharacterbounds
- {\bgroup
- \localcolortrue
- \dorecurse{255}
- {\ifdim\fontcharwd\font\recurselevel>\zeropoint
- \noindent\ruledhbox{\darkgray\char\recurselevel}\space
- \fi}\unskip
- \egroup}
-
-\else
-
- \gdef\showhyphenations#1%
- {\starttabulate[|le|l|]
- \NC language \NC \currentlanguage\ (internal code:\the\normallanguage) \NC \NR
- \NC font \NC \fontname\font \NC \NR
- \NC sample \NC \hyphenatedword{#1} \NC \NR
- \stoptabulate}
-
- \globallet\showmapping\relax
-
- \globallet\showcharacterbounds\relax
-
-\fi
-
-\protect \endinput
diff --git a/tex/context/base/enco-t5.mkii b/tex/context/base/enco-t5.mkii
new file mode 100644
index 000000000..251c68765
--- /dev/null
+++ b/tex/context/base/enco-t5.mkii
@@ -0,0 +1,244 @@
+%D \module
+%D [ file=enco-t5,
+%D version=2004.11.16,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=New Vietnamese Encoding,
+%D author=Hans Hagen \& Adam Lindsay,
+%D date=\currentdate,
+%D copyright=PRAGMA \& Adam Lindsay]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This module is derived from the enco-x5 encoding, but now
+%D approaches the world with named glyphs.
+
+\startencoding[t5]
+
+\definecasemaps 128 to 159 lc +32 uc 0
+
+\definecasemaps 160 to 191 lc 0 uc -32
+
+\definecasemaps 192 to 223 lc +32 uc 0
+
+\definecasemaps 224 to 225 lc 0 uc -32
+
+\definecasemap 26 26 27 \definecasemap 27 26 27
+\definecasemap 28 28 29 \definecasemap 29 28 29
+\definecasemap 30 30 31 \definecasemap 31 30 31
+
+\definecharacter textgrave 0
+\definecharacter textacute 1
+\definecharacter textcircumflex 2
+\definecharacter texttilde 3
+\definecharacter textdiaeresis 4
+\definecharacter textbottomdot 5
+\definecharacter textring 6
+\definecharacter textcaron 7
+\definecharacter textbreve 8
+\definecharacter textmacron 9
+\definecharacter textdotaccent 10
+\definecharacter textcedilla 11
+\definecharacter texthookabove 12
+\definecharacter textogonek {}
+
+\definecharacter quotesinglebase 13
+\definecharacter guilsingleleft 14
+\definecharacter guilsingleright 15
+\definecharacter quotedblleft 16
+\definecharacter quotedblright 17
+\definecharacter quotedblbase 18
+\definecharacter leftguillemot 19
+\definecharacter rightguillemot 20
+\definecharacter endash 21
+\definecharacter emdash 22
+
+\definecharacter cwm 23
+\definecharacter zeroinferior 24
+\definecharacter Yhook 26
+\definecharacter yhook 27
+\definecharacter Ydotbelow 28
+\definecharacter ydotbelow 29
+\definecharacter Dstroke 30
+\definecharacter dstroke 31
+\definecharacter textvisiblespace 32
+
+\definecharacter dotlessi 25
+%definecharacter DJ 30
+%definecharacter dj 31
+\definecharacter Agrave 128
+\definecharacter Aacute 129
+\definecharacter Atilde 130
+\definecharacter Ahook 131
+\definecharacter Adotbelow 132
+\definecharacter Acircumflex 133
+\definecharacter Acircumflexgrave 134
+\definecharacter Acircumflexacute 135
+\definecharacter Acircumflextilde 136
+\definecharacter Acircumflexhook 137
+\definecharacter Acircumflexdotbelow 138
+\definecharacter Abreve 139
+\definecharacter Abrevegrave 140
+\definecharacter Abreveacute 141
+\definecharacter Abrevetilde 142
+\definecharacter Abrevehook 143
+\definecharacter Abrevedotbelow 144
+\definecharacter Egrave 145
+\definecharacter Eacute 146
+\definecharacter Etilde 147
+\definecharacter Ehook 148
+\definecharacter Edotbelow 149
+\definecharacter Ecircumflex 150
+\definecharacter Ecircumflexgrave 151
+\definecharacter Ecircumflexacute 152
+\definecharacter Ecircumflextilde 153
+\definecharacter Ecircumflexhook 154
+\definecharacter Ecircumflexdotbelow 155
+\definecharacter Igrave 156
+\definecharacter Iacute 157
+\definecharacter Itilde 158
+\definecharacter Ihook 159
+\definecharacter agrave 160
+\definecharacter aacute 161
+\definecharacter atilde 162
+\definecharacter ahook 163
+\definecharacter adotbelow 164
+\definecharacter acircumflex 165
+\definecharacter acircumflexgrave 166
+\definecharacter acircumflexacute 167
+\definecharacter acircumflextilde 168
+\definecharacter acircumflexhook 169
+\definecharacter acircumflexdotbelow 170
+\definecharacter abreve 171
+\definecharacter abrevegrave 172
+\definecharacter abreveacute 173
+\definecharacter abrevetilde 174
+\definecharacter abrevehook 175
+\definecharacter abrevedotbelow 176
+\definecharacter egrave 177
+\definecharacter eacute 178
+\definecharacter etilde 179
+\definecharacter ehook 180
+\definecharacter edotbelow 181
+\definecharacter ecircumflex 182
+\definecharacter ecircumflexgrave 183
+\definecharacter ecircumflexacute 184
+\definecharacter ecircumflextilde 185
+\definecharacter ecircumflexhook 186
+\definecharacter ecircumflexdotbelow 187
+\definecharacter igrave 188
+\definecharacter iacute 189
+\definecharacter itilde 190
+\definecharacter ihook 191
+\definecharacter Idotbelow 192
+\definecharacter Ograve 193
+\definecharacter Oacute 194
+\definecharacter Otilde 195
+\definecharacter Ohook 196
+\definecharacter Odotbelow 197
+\definecharacter Ocircumflex 198
+\definecharacter Ocircumflexgrave 199
+\definecharacter Ocircumflexacute 200
+\definecharacter Ocircumflextilde 201
+\definecharacter Ocircumflexhook 202
+\definecharacter Ocircumflexdotbelow 203
+\definecharacter Ohorn 204
+\definecharacter Ohorngrave 205
+\definecharacter Ohornacute 206
+\definecharacter Ohorntilde 207
+\definecharacter Ohornhook 208
+\definecharacter Ohorndotbelow 209
+\definecharacter Ugrave 210
+\definecharacter Uacute 211
+\definecharacter Utilde 212
+\definecharacter Uhook 213
+\definecharacter Udotbelow 214
+\definecharacter Uhorn 215
+\definecharacter Uhorngrave 216
+\definecharacter Uhornacute 217
+\definecharacter Uhorntilde 218
+\definecharacter Uhornhook 219
+\definecharacter Uhorndotbelow 220
+\definecharacter Ytilde 223
+\definecharacter idotbelow 224
+\definecharacter ograve 225
+\definecharacter oacute 226
+\definecharacter otilde 227
+\definecharacter ohook 228
+\definecharacter odotbelow 229
+\definecharacter ocircumflex 230
+\definecharacter ocircumflexgrave 231
+\definecharacter ocircumflexacute 232
+\definecharacter ocircumflextilde 233
+\definecharacter ocircumflexhook 234
+\definecharacter ocircumflexdotbelow 235
+\definecharacter ohorn 236
+\definecharacter ohorngrave 237
+\definecharacter ohornacute 238
+\definecharacter ohorntilde 239
+\definecharacter ohornhook 240
+\definecharacter ohorndotbelow 241
+\definecharacter ugrave 242
+\definecharacter uacute 243
+\definecharacter utilde 244
+\definecharacter uhook 245
+\definecharacter udotbelow 246
+\definecharacter uhorn 247
+\definecharacter uhorngrave 248
+\definecharacter uhornacute 249
+\definecharacter uhorntilde 250
+\definecharacter uhornhook 251
+\definecharacter uhorndotbelow 252
+\definecharacter ygrave 253
+\definecharacter yacute 254
+\definecharacter ytilde 255
+
+\stopencoding
+
+\endinput
+
+% \startencoding [x5]
+%
+% \definecharacter aa {\xfiveencodedaa}
+% \definecharacter AA {\xfiveencodedAA}
+%
+% \stopencoding
+%
+% \def\xfiveencodedaa%
+% {\accent23a}
+%
+% \def\xfiveencodedAA%
+% {\leavevmode
+% \setbox\zerocount\hbox{h}%
+% \dimen@\ht\zerocount
+% \advance\dimen@ -1ex
+% \rlap{\raise.67\dimen@\hbox{\char23}}A}
+
+% \quotesinglbase 13
+% \guilsinglleft 14
+% \guilsinglright 15
+% \textquotedblleft 16
+% \textquotedblright 17
+% \quotedblbase 18
+% \guillemotleft 19
+% \guillemotright 20
+% \textendash 21
+% \textemdash 22
+% \textcompwordmark 23
+% \textperthousand \% \char 24
+% \textpertenthousand \%\char 24\char 24
+% \textvisiblespace 32
+% \textquotedbl `\"
+% \textdollar `\$
+% \textquoteright `\'
+% \textless `\<
+% \textgreater `\>
+% \textbackslash `\
+% \textasciicircum `\^
+% \textunderscore 95
+% \textquoteleft `\`
+% \textbraceleft `\{
+% \textbar `\|
+% \textbraceright `\}
+% \textasciitilde `\~
diff --git a/tex/context/base/enco-t5.tex b/tex/context/base/enco-t5.tex
deleted file mode 100644
index 251c68765..000000000
--- a/tex/context/base/enco-t5.tex
+++ /dev/null
@@ -1,244 +0,0 @@
-%D \module
-%D [ file=enco-t5,
-%D version=2004.11.16,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=New Vietnamese Encoding,
-%D author=Hans Hagen \& Adam Lindsay,
-%D date=\currentdate,
-%D copyright=PRAGMA \& Adam Lindsay]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D This module is derived from the enco-x5 encoding, but now
-%D approaches the world with named glyphs.
-
-\startencoding[t5]
-
-\definecasemaps 128 to 159 lc +32 uc 0
-
-\definecasemaps 160 to 191 lc 0 uc -32
-
-\definecasemaps 192 to 223 lc +32 uc 0
-
-\definecasemaps 224 to 225 lc 0 uc -32
-
-\definecasemap 26 26 27 \definecasemap 27 26 27
-\definecasemap 28 28 29 \definecasemap 29 28 29
-\definecasemap 30 30 31 \definecasemap 31 30 31
-
-\definecharacter textgrave 0
-\definecharacter textacute 1
-\definecharacter textcircumflex 2
-\definecharacter texttilde 3
-\definecharacter textdiaeresis 4
-\definecharacter textbottomdot 5
-\definecharacter textring 6
-\definecharacter textcaron 7
-\definecharacter textbreve 8
-\definecharacter textmacron 9
-\definecharacter textdotaccent 10
-\definecharacter textcedilla 11
-\definecharacter texthookabove 12
-\definecharacter textogonek {}
-
-\definecharacter quotesinglebase 13
-\definecharacter guilsingleleft 14
-\definecharacter guilsingleright 15
-\definecharacter quotedblleft 16
-\definecharacter quotedblright 17
-\definecharacter quotedblbase 18
-\definecharacter leftguillemot 19
-\definecharacter rightguillemot 20
-\definecharacter endash 21
-\definecharacter emdash 22
-
-\definecharacter cwm 23
-\definecharacter zeroinferior 24
-\definecharacter Yhook 26
-\definecharacter yhook 27
-\definecharacter Ydotbelow 28
-\definecharacter ydotbelow 29
-\definecharacter Dstroke 30
-\definecharacter dstroke 31
-\definecharacter textvisiblespace 32
-
-\definecharacter dotlessi 25
-%definecharacter DJ 30
-%definecharacter dj 31
-\definecharacter Agrave 128
-\definecharacter Aacute 129
-\definecharacter Atilde 130
-\definecharacter Ahook 131
-\definecharacter Adotbelow 132
-\definecharacter Acircumflex 133
-\definecharacter Acircumflexgrave 134
-\definecharacter Acircumflexacute 135
-\definecharacter Acircumflextilde 136
-\definecharacter Acircumflexhook 137
-\definecharacter Acircumflexdotbelow 138
-\definecharacter Abreve 139
-\definecharacter Abrevegrave 140
-\definecharacter Abreveacute 141
-\definecharacter Abrevetilde 142
-\definecharacter Abrevehook 143
-\definecharacter Abrevedotbelow 144
-\definecharacter Egrave 145
-\definecharacter Eacute 146
-\definecharacter Etilde 147
-\definecharacter Ehook 148
-\definecharacter Edotbelow 149
-\definecharacter Ecircumflex 150
-\definecharacter Ecircumflexgrave 151
-\definecharacter Ecircumflexacute 152
-\definecharacter Ecircumflextilde 153
-\definecharacter Ecircumflexhook 154
-\definecharacter Ecircumflexdotbelow 155
-\definecharacter Igrave 156
-\definecharacter Iacute 157
-\definecharacter Itilde 158
-\definecharacter Ihook 159
-\definecharacter agrave 160
-\definecharacter aacute 161
-\definecharacter atilde 162
-\definecharacter ahook 163
-\definecharacter adotbelow 164
-\definecharacter acircumflex 165
-\definecharacter acircumflexgrave 166
-\definecharacter acircumflexacute 167
-\definecharacter acircumflextilde 168
-\definecharacter acircumflexhook 169
-\definecharacter acircumflexdotbelow 170
-\definecharacter abreve 171
-\definecharacter abrevegrave 172
-\definecharacter abreveacute 173
-\definecharacter abrevetilde 174
-\definecharacter abrevehook 175
-\definecharacter abrevedotbelow 176
-\definecharacter egrave 177
-\definecharacter eacute 178
-\definecharacter etilde 179
-\definecharacter ehook 180
-\definecharacter edotbelow 181
-\definecharacter ecircumflex 182
-\definecharacter ecircumflexgrave 183
-\definecharacter ecircumflexacute 184
-\definecharacter ecircumflextilde 185
-\definecharacter ecircumflexhook 186
-\definecharacter ecircumflexdotbelow 187
-\definecharacter igrave 188
-\definecharacter iacute 189
-\definecharacter itilde 190
-\definecharacter ihook 191
-\definecharacter Idotbelow 192
-\definecharacter Ograve 193
-\definecharacter Oacute 194
-\definecharacter Otilde 195
-\definecharacter Ohook 196
-\definecharacter Odotbelow 197
-\definecharacter Ocircumflex 198
-\definecharacter Ocircumflexgrave 199
-\definecharacter Ocircumflexacute 200
-\definecharacter Ocircumflextilde 201
-\definecharacter Ocircumflexhook 202
-\definecharacter Ocircumflexdotbelow 203
-\definecharacter Ohorn 204
-\definecharacter Ohorngrave 205
-\definecharacter Ohornacute 206
-\definecharacter Ohorntilde 207
-\definecharacter Ohornhook 208
-\definecharacter Ohorndotbelow 209
-\definecharacter Ugrave 210
-\definecharacter Uacute 211
-\definecharacter Utilde 212
-\definecharacter Uhook 213
-\definecharacter Udotbelow 214
-\definecharacter Uhorn 215
-\definecharacter Uhorngrave 216
-\definecharacter Uhornacute 217
-\definecharacter Uhorntilde 218
-\definecharacter Uhornhook 219
-\definecharacter Uhorndotbelow 220
-\definecharacter Ytilde 223
-\definecharacter idotbelow 224
-\definecharacter ograve 225
-\definecharacter oacute 226
-\definecharacter otilde 227
-\definecharacter ohook 228
-\definecharacter odotbelow 229
-\definecharacter ocircumflex 230
-\definecharacter ocircumflexgrave 231
-\definecharacter ocircumflexacute 232
-\definecharacter ocircumflextilde 233
-\definecharacter ocircumflexhook 234
-\definecharacter ocircumflexdotbelow 235
-\definecharacter ohorn 236
-\definecharacter ohorngrave 237
-\definecharacter ohornacute 238
-\definecharacter ohorntilde 239
-\definecharacter ohornhook 240
-\definecharacter ohorndotbelow 241
-\definecharacter ugrave 242
-\definecharacter uacute 243
-\definecharacter utilde 244
-\definecharacter uhook 245
-\definecharacter udotbelow 246
-\definecharacter uhorn 247
-\definecharacter uhorngrave 248
-\definecharacter uhornacute 249
-\definecharacter uhorntilde 250
-\definecharacter uhornhook 251
-\definecharacter uhorndotbelow 252
-\definecharacter ygrave 253
-\definecharacter yacute 254
-\definecharacter ytilde 255
-
-\stopencoding
-
-\endinput
-
-% \startencoding [x5]
-%
-% \definecharacter aa {\xfiveencodedaa}
-% \definecharacter AA {\xfiveencodedAA}
-%
-% \stopencoding
-%
-% \def\xfiveencodedaa%
-% {\accent23a}
-%
-% \def\xfiveencodedAA%
-% {\leavevmode
-% \setbox\zerocount\hbox{h}%
-% \dimen@\ht\zerocount
-% \advance\dimen@ -1ex
-% \rlap{\raise.67\dimen@\hbox{\char23}}A}
-
-% \quotesinglbase 13
-% \guilsinglleft 14
-% \guilsinglright 15
-% \textquotedblleft 16
-% \textquotedblright 17
-% \quotedblbase 18
-% \guillemotleft 19
-% \guillemotright 20
-% \textendash 21
-% \textemdash 22
-% \textcompwordmark 23
-% \textperthousand \% \char 24
-% \textpertenthousand \%\char 24\char 24
-% \textvisiblespace 32
-% \textquotedbl `\"
-% \textdollar `\$
-% \textquoteright `\'
-% \textless `\<
-% \textgreater `\>
-% \textbackslash `\
-% \textasciicircum `\^
-% \textunderscore 95
-% \textquoteleft `\`
-% \textbraceleft `\{
-% \textbar `\|
-% \textbraceright `\}
-% \textasciitilde `\~
diff --git a/tex/context/base/enco-tbo.mkii b/tex/context/base/enco-tbo.mkii
new file mode 100644
index 000000000..475be4602
--- /dev/null
+++ b/tex/context/base/enco-tbo.mkii
@@ -0,0 +1,222 @@
+%D \module
+%D [ file=enco-tbo,
+%D version=2000.05.07, % 2001.8.4,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=TeXBaseOne Encoding,
+%D author={Patrick Gundlach, Hans Hagen},
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmapping[8r]
+
+\resetcaserange 128 to 255
+
+\definecasemap 228 228 196 \definecasemap 196 228 196
+\definecasemap 235 235 203 \definecasemap 203 235 203
+\definecasemap 239 239 207 \definecasemap 207 239 207
+\definecasemap 246 246 214 \definecasemap 214 246 214
+\definecasemap 252 252 220 \definecasemap 220 252 220
+\definecasemap 255 255 159 \definecasemap 159 255 159
+
+\definecasemap 225 225 193 \definecasemap 193 225 193
+\definecasemap 233 233 201 \definecasemap 201 233 201
+\definecasemap 237 237 205 \definecasemap 205 237 205
+\definecasemap 243 243 211 \definecasemap 211 243 211
+\definecasemap 250 250 218 \definecasemap 218 250 218
+\definecasemap 253 253 221 \definecasemap 221 253 221
+
+\definecasemap 224 224 192 \definecasemap 192 224 192
+\definecasemap 232 232 200 \definecasemap 200 232 200
+\definecasemap 236 236 204 \definecasemap 204 236 204
+\definecasemap 242 242 210 \definecasemap 210 242 210
+\definecasemap 249 249 217 \definecasemap 217 249 217
+
+\definecasemap 226 226 194 \definecasemap 194 226 194
+\definecasemap 234 234 202 \definecasemap 202 234 202
+\definecasemap 238 238 206 \definecasemap 206 238 206
+\definecasemap 244 244 212 \definecasemap 212 244 212
+\definecasemap 251 251 219 \definecasemap 219 251 219
+
+\definecasemap 227 227 195 \definecasemap 195 227 195
+\definecasemap 241 241 209 \definecasemap 209 241 209
+\definecasemap 245 245 213 \definecasemap 213 245 213
+
+\stopmapping
+
+\startencoding[8r]
+
+\definecharacter textacute 180
+\definecharacter textbreve 11
+\definecharacter textcaron 16
+\definecharacter textcedilla 184
+\definecharacter textcircumflex 136
+\definecharacter textdiaeresis 168
+\definecharacter textdotaccent 1
+\definecharacter textgrave 30
+\definecharacter texthungarumlaut 5
+\definecharacter textmacron 175
+\definecharacter textogonek 8
+\definecharacter textring 9
+\definecharacter texttilde 152
+
+\definecharacter dotlessi 17
+%definecharacter dotlessj 18
+
+\definecharacter endash 150
+\definecharacter emdash 151
+
+\definecharacter oeligature 156
+\definecharacter OEligature 140
+\definecharacter aeligature 230
+\definecharacter AEligature 198
+
+\definecharacter ssharp 223
+
+\definecharacter thorn 254
+\definecharacter Thorn 222
+
+\definecharacter exclamdown 161
+\definecharacter questiondown 191
+
+\definecharacter copyright 169
+\definecharacter registered 174
+\definecharacter trademark 153
+
+\definecharacter sectionmark 167
+\definecharacter paragraphmark 182
+
+\definecharacter onequarter 188
+\definecharacter onehalf 189
+\definecharacter threequarter 190
+\definecharacter onesuperior 185
+\definecharacter twosuperior 178
+\definecharacter threesuperior 179
+
+\definecharacter textcent 162
+\definecharacter textcurrency 164
+\definecharacter texteuro 128
+\definecharacter textflorin 131
+\definecharacter textsterling 163
+\definecharacter textyen 165
+
+\definecharacter percent 37
+\definecharacter perthousand 137
+
+\definecharacter periodcentered 183
+\definecharacter softhyphen 173
+
+\definecharacter textasciicircum 94
+\definecharacter textasciitilde 126
+\definecharacter textslash 47
+\definecharacter textbackslash 92
+\definecharacter textbraceleft 123
+\definecharacter textbraceright 125
+\definecharacter textunderscore 95
+
+\definecharacter textbrokenbar 166
+\definecharacter textbullet 149
+\definecharacter textdag 134
+\definecharacter textddag 135
+\definecharacter textdegree 176
+\definecharacter textdiv 247
+\definecharacter textellipsis 133
+\definecharacter textfraction 4
+\definecharacter textlognot 172
+\definecharacter textminus 12
+\definecharacter textmu 181
+\definecharacter textmultiply 215
+\definecharacter textpm 177
+
+\definecharacter quotedbl 34
+\definecharacter quotedblbase 132
+\definecharacter quotedblleft 147
+\definecharacter quotedblright 148
+
+\definecharacter quotesingle 31
+\definecharacter quotesinglebase 130
+
+\definecharacter quoteleft 96
+\definecharacter quoteright 39
+
+\definecharacter guilsingleleft 139
+\definecharacter guilsingleright 155
+\definecharacter leftguillemot 171
+\definecharacter rightguillemot 187
+
+\definecharacter aacute 225
+\definecharacter Aacute 193
+\definecharacter eacute 233
+\definecharacter Eacute 201
+\definecharacter iacute 237
+\definecharacter Iacute 205
+\definecharacter oacute 243
+\definecharacter Oacute 211
+\definecharacter uacute 250
+\definecharacter Uacute 218
+\definecharacter Yacute 221
+\definecharacter yacute 253
+
+\definecharacter scaron 154
+\definecharacter Scaron 138
+%definecharacter Zcaron 141
+
+\definecharacter ccedilla 231
+\definecharacter Ccedilla 199
+
+\definecharacter acircumflex 226
+\definecharacter Acircumflex 194
+\definecharacter ecircumflex 234
+\definecharacter Ecircumflex 202
+\definecharacter icircumflex 238
+\definecharacter Icircumflex 206
+\definecharacter ocircumflex 244
+\definecharacter Ocircumflex 212
+\definecharacter ucircumflex 251
+\definecharacter Ucircumflex 219
+
+\definecharacter adiaeresis 228
+\definecharacter Adiaeresis 196
+\definecharacter ediaeresis 235
+\definecharacter Ediaeresis 203
+\definecharacter idiaeresis 239
+\definecharacter Idiaeresis 207
+\definecharacter odiaeresis 246
+\definecharacter Odiaeresis 214
+\definecharacter udiaeresis 252
+\definecharacter Udiaeresis 220
+\definecharacter ydiaeresis 255
+\definecharacter Ydiaeresis 159
+
+\definecharacter agrave 224
+\definecharacter Agrave 192
+\definecharacter egrave 232
+\definecharacter Egrave 200
+\definecharacter igrave 236
+\definecharacter Igrave 204
+\definecharacter ograve 242
+\definecharacter Ograve 210
+\definecharacter ugrave 249
+\definecharacter Ugrave 217
+
+\definecharacter aring 229
+\definecharacter Aring 197
+
+\definecharacter lstroke 7
+\definecharacter Lstroke 6
+\definecharacter ostroke 248
+\definecharacter Ostroke 216
+
+\definecharacter atilde 227
+\definecharacter Atilde 195
+\definecharacter ntilde 241
+\definecharacter Ntilde 209
+\definecharacter otilde 245
+\definecharacter Otilde 213
+
+\stopencoding
+
+\endinput
diff --git a/tex/context/base/enco-tbo.tex b/tex/context/base/enco-tbo.tex
deleted file mode 100644
index 475be4602..000000000
--- a/tex/context/base/enco-tbo.tex
+++ /dev/null
@@ -1,222 +0,0 @@
-%D \module
-%D [ file=enco-tbo,
-%D version=2000.05.07, % 2001.8.4,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=TeXBaseOne Encoding,
-%D author={Patrick Gundlach, Hans Hagen},
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\startmapping[8r]
-
-\resetcaserange 128 to 255
-
-\definecasemap 228 228 196 \definecasemap 196 228 196
-\definecasemap 235 235 203 \definecasemap 203 235 203
-\definecasemap 239 239 207 \definecasemap 207 239 207
-\definecasemap 246 246 214 \definecasemap 214 246 214
-\definecasemap 252 252 220 \definecasemap 220 252 220
-\definecasemap 255 255 159 \definecasemap 159 255 159
-
-\definecasemap 225 225 193 \definecasemap 193 225 193
-\definecasemap 233 233 201 \definecasemap 201 233 201
-\definecasemap 237 237 205 \definecasemap 205 237 205
-\definecasemap 243 243 211 \definecasemap 211 243 211
-\definecasemap 250 250 218 \definecasemap 218 250 218
-\definecasemap 253 253 221 \definecasemap 221 253 221
-
-\definecasemap 224 224 192 \definecasemap 192 224 192
-\definecasemap 232 232 200 \definecasemap 200 232 200
-\definecasemap 236 236 204 \definecasemap 204 236 204
-\definecasemap 242 242 210 \definecasemap 210 242 210
-\definecasemap 249 249 217 \definecasemap 217 249 217
-
-\definecasemap 226 226 194 \definecasemap 194 226 194
-\definecasemap 234 234 202 \definecasemap 202 234 202
-\definecasemap 238 238 206 \definecasemap 206 238 206
-\definecasemap 244 244 212 \definecasemap 212 244 212
-\definecasemap 251 251 219 \definecasemap 219 251 219
-
-\definecasemap 227 227 195 \definecasemap 195 227 195
-\definecasemap 241 241 209 \definecasemap 209 241 209
-\definecasemap 245 245 213 \definecasemap 213 245 213
-
-\stopmapping
-
-\startencoding[8r]
-
-\definecharacter textacute 180
-\definecharacter textbreve 11
-\definecharacter textcaron 16
-\definecharacter textcedilla 184
-\definecharacter textcircumflex 136
-\definecharacter textdiaeresis 168
-\definecharacter textdotaccent 1
-\definecharacter textgrave 30
-\definecharacter texthungarumlaut 5
-\definecharacter textmacron 175
-\definecharacter textogonek 8
-\definecharacter textring 9
-\definecharacter texttilde 152
-
-\definecharacter dotlessi 17
-%definecharacter dotlessj 18
-
-\definecharacter endash 150
-\definecharacter emdash 151
-
-\definecharacter oeligature 156
-\definecharacter OEligature 140
-\definecharacter aeligature 230
-\definecharacter AEligature 198
-
-\definecharacter ssharp 223
-
-\definecharacter thorn 254
-\definecharacter Thorn 222
-
-\definecharacter exclamdown 161
-\definecharacter questiondown 191
-
-\definecharacter copyright 169
-\definecharacter registered 174
-\definecharacter trademark 153
-
-\definecharacter sectionmark 167
-\definecharacter paragraphmark 182
-
-\definecharacter onequarter 188
-\definecharacter onehalf 189
-\definecharacter threequarter 190
-\definecharacter onesuperior 185
-\definecharacter twosuperior 178
-\definecharacter threesuperior 179
-
-\definecharacter textcent 162
-\definecharacter textcurrency 164
-\definecharacter texteuro 128
-\definecharacter textflorin 131
-\definecharacter textsterling 163
-\definecharacter textyen 165
-
-\definecharacter percent 37
-\definecharacter perthousand 137
-
-\definecharacter periodcentered 183
-\definecharacter softhyphen 173
-
-\definecharacter textasciicircum 94
-\definecharacter textasciitilde 126
-\definecharacter textslash 47
-\definecharacter textbackslash 92
-\definecharacter textbraceleft 123
-\definecharacter textbraceright 125
-\definecharacter textunderscore 95
-
-\definecharacter textbrokenbar 166
-\definecharacter textbullet 149
-\definecharacter textdag 134
-\definecharacter textddag 135
-\definecharacter textdegree 176
-\definecharacter textdiv 247
-\definecharacter textellipsis 133
-\definecharacter textfraction 4
-\definecharacter textlognot 172
-\definecharacter textminus 12
-\definecharacter textmu 181
-\definecharacter textmultiply 215
-\definecharacter textpm 177
-
-\definecharacter quotedbl 34
-\definecharacter quotedblbase 132
-\definecharacter quotedblleft 147
-\definecharacter quotedblright 148
-
-\definecharacter quotesingle 31
-\definecharacter quotesinglebase 130
-
-\definecharacter quoteleft 96
-\definecharacter quoteright 39
-
-\definecharacter guilsingleleft 139
-\definecharacter guilsingleright 155
-\definecharacter leftguillemot 171
-\definecharacter rightguillemot 187
-
-\definecharacter aacute 225
-\definecharacter Aacute 193
-\definecharacter eacute 233
-\definecharacter Eacute 201
-\definecharacter iacute 237
-\definecharacter Iacute 205
-\definecharacter oacute 243
-\definecharacter Oacute 211
-\definecharacter uacute 250
-\definecharacter Uacute 218
-\definecharacter Yacute 221
-\definecharacter yacute 253
-
-\definecharacter scaron 154
-\definecharacter Scaron 138
-%definecharacter Zcaron 141
-
-\definecharacter ccedilla 231
-\definecharacter Ccedilla 199
-
-\definecharacter acircumflex 226
-\definecharacter Acircumflex 194
-\definecharacter ecircumflex 234
-\definecharacter Ecircumflex 202
-\definecharacter icircumflex 238
-\definecharacter Icircumflex 206
-\definecharacter ocircumflex 244
-\definecharacter Ocircumflex 212
-\definecharacter ucircumflex 251
-\definecharacter Ucircumflex 219
-
-\definecharacter adiaeresis 228
-\definecharacter Adiaeresis 196
-\definecharacter ediaeresis 235
-\definecharacter Ediaeresis 203
-\definecharacter idiaeresis 239
-\definecharacter Idiaeresis 207
-\definecharacter odiaeresis 246
-\definecharacter Odiaeresis 214
-\definecharacter udiaeresis 252
-\definecharacter Udiaeresis 220
-\definecharacter ydiaeresis 255
-\definecharacter Ydiaeresis 159
-
-\definecharacter agrave 224
-\definecharacter Agrave 192
-\definecharacter egrave 232
-\definecharacter Egrave 200
-\definecharacter igrave 236
-\definecharacter Igrave 204
-\definecharacter ograve 242
-\definecharacter Ograve 210
-\definecharacter ugrave 249
-\definecharacter Ugrave 217
-
-\definecharacter aring 229
-\definecharacter Aring 197
-
-\definecharacter lstroke 7
-\definecharacter Lstroke 6
-\definecharacter ostroke 248
-\definecharacter Ostroke 216
-
-\definecharacter atilde 227
-\definecharacter Atilde 195
-\definecharacter ntilde 241
-\definecharacter Ntilde 209
-\definecharacter otilde 245
-\definecharacter Otilde 213
-
-\stopencoding
-
-\endinput
diff --git a/tex/context/base/enco-uc.mkii b/tex/context/base/enco-uc.mkii
new file mode 100644
index 000000000..981eb6ae4
--- /dev/null
+++ b/tex/context/base/enco-uc.mkii
@@ -0,0 +1,1091 @@
+%D \module
+%D [ file=enco-uc,
+%D version=2000.xx.xx, % and later
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Unicode (backwards mapping),
+%D author={Adam Lindsay \& Hans Hagen},
+%D date=\currentdate,
+%D copyright=PRAGMA ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D An alternative approach would be to misuse the utf vectors, but they
+%D don't carry enough info around.
+
+% todo : \defineucharacter hebrewAlef 5 "D0
+
+\startencoding[uc]
+
+\definecharacter Agrave {\uchar0{192}}
+\definecharacter Aacute {\uchar0{193}}
+\definecharacter Acircumflex {\uchar0{194}}
+\definecharacter Atilde {\uchar0{195}}
+\definecharacter Adiaeresis {\uchar0{196}}
+\definecharacter Aring {\uchar0{197}}
+\definecharacter AEligature {\uchar0{198}}
+\definecharacter Ccedilla {\uchar0{199}}
+\definecharacter Egrave {\uchar0{200}}
+\definecharacter Eacute {\uchar0{201}}
+\definecharacter Ediaeresis {\uchar0{203}}
+\definecharacter Igrave {\uchar0{204}}
+\definecharacter Iacute {\uchar0{205}}
+\definecharacter Icircumflex {\uchar0{206}}
+\definecharacter Idiaeresis {\uchar0{207}}
+\definecharacter Eth {\uchar0{208}}
+\definecharacter Ntilde {\uchar0{209}}
+\definecharacter Ograve {\uchar0{210}}
+\definecharacter Oacute {\uchar0{211}}
+\definecharacter Ocircumflex {\uchar0{212}}
+\definecharacter Otilde {\uchar0{213}}
+\definecharacter Odiaeresis {\uchar0{214}}
+
+\definecharacter Ostroke {\uchar0{216}}
+\definecharacter Ugrave {\uchar0{217}}
+\definecharacter Uacute {\uchar0{218}}
+\definecharacter Uhungarumlaut {\uchar0{219}}
+\definecharacter Udiaeresis {\uchar0{220}}
+\definecharacter Yacute {\uchar0{221}}
+\definecharacter Thorn {\uchar0{222}}
+\definecharacter ssharp {\uchar0{223}}
+\definecharacter agrave {\uchar0{224}}
+\definecharacter aacute {\uchar0{225}}
+\definecharacter acircumflex {\uchar0{226}}
+\definecharacter atilde {\uchar0{227}}
+\definecharacter adiaeresis {\uchar0{228}}
+\definecharacter aring {\uchar0{229}}
+\definecharacter aeligature {\uchar0{230}}
+\definecharacter ccedilla {\uchar0{231}}
+\definecharacter egrave {\uchar0{232}}
+\definecharacter eacute {\uchar0{233}}
+\definecharacter ecircumflex {\uchar0{234}}
+\definecharacter ediaeresis {\uchar0{235}}
+\definecharacter igrave {\uchar0{236}}
+\definecharacter iacute {\uchar0{237}}
+\definecharacter icircumflex {\uchar0{238}}
+\definecharacter idiaeresis {\uchar0{239}}
+\definecharacter eth {\uchar0{240}}
+\definecharacter ntilde {\uchar0{241}}
+\definecharacter ograve {\uchar0{242}}
+\definecharacter oacute {\uchar0{243}}
+\definecharacter ocircumflex {\uchar0{244}}
+\definecharacter otilde {\uchar0{245}}
+\definecharacter odiaeresis {\uchar0{246}}
+
+\definecharacter ostroke {\uchar0{248}}
+\definecharacter ugrave {\uchar0{249}}
+\definecharacter uacute {\uchar0{250}}
+\definecharacter ucircumflex {\uchar0{251}}
+\definecharacter udiaeresis {\uchar0{252}}
+\definecharacter yacute {\uchar0{253}}
+\definecharacter thorn {\uchar0{254}}
+\definecharacter ydiaeresis {\uchar0{255}}
+
+\definecharacter Amacron {\uchar1{0}}
+\definecharacter amacron {\uchar1{1}}
+\definecharacter Abreve {\uchar1{2}}
+\definecharacter abreve {\uchar1{3}}
+\definecharacter Aogonek {\uchar1{4}}
+\definecharacter aogonek {\uchar1{5}}
+\definecharacter Cacute {\uchar1{6}}
+\definecharacter cacute {\uchar1{7}}
+\definecharacter Ccircumflex {\uchar1{8}}
+\definecharacter ccircumflex {\uchar1{9}}
+\definecharacter Cdotaccent {\uchar1{10}}
+\definecharacter cdotaccent {\uchar1{11}}
+\definecharacter Ccaron {\uchar1{12}}
+\definecharacter ccaron {\uchar1{13}}
+\definecharacter Dcaron {\uchar1{14}}
+\definecharacter dcaron {\uchar1{15}}
+\definecharacter Dstroke {\uchar1{16}}
+\definecharacter dstroke {\uchar1{17}}
+\definecharacter Emacron {\uchar1{18}}
+\definecharacter emacron {\uchar1{19}}
+\definecharacter Ebreve {\uchar1{20}}
+\definecharacter ebreve {\uchar1{21}}
+\definecharacter Edotaccent {\uchar1{22}}
+\definecharacter edotaccent {\uchar1{23}}
+\definecharacter Eogonek {\uchar1{24}}
+\definecharacter eogonek {\uchar1{25}}
+\definecharacter Ecaron {\uchar1{26}}
+\definecharacter ecaron {\uchar1{27}}
+\definecharacter Gcircumflex {\uchar1{28}}
+\definecharacter gcircumflex {\uchar1{29}}
+\definecharacter Gbreve {\uchar1{30}}
+\definecharacter gbreve {\uchar1{31}}
+\definecharacter Gdotaccent {\uchar1{32}}
+\definecharacter gdotaccent {\uchar1{33}}
+\definecharacter Gcommaaccent {\uchar1{34}}
+\definecharacter gcommaaccent {\uchar1{35}}
+\definecharacter Hcircumflex {\uchar1{36}}
+\definecharacter hcircumflex {\uchar1{37}}
+\definecharacter Hstroke {\uchar1{38}}
+\definecharacter hstroke {\uchar1{39}}
+\definecharacter Itilde {\uchar1{40}}
+\definecharacter itilde {\uchar1{41}}
+\definecharacter Imacron {\uchar1{42}}
+\definecharacter imacron {\uchar1{43}}
+\definecharacter Ibreve {\uchar1{44}}
+\definecharacter ibreve {\uchar1{45}}
+\definecharacter Iogonek {\uchar1{46}}
+\definecharacter iogonek {\uchar1{47}}
+\definecharacter Idotaccent {\uchar1{48}}
+\definecharacter dotlessi {\uchar1{49}}
+\definecharacter IJligature {\uchar1{50}}
+\definecharacter ijligature {\uchar1{51}}
+\definecharacter Jcircumflex {\uchar1{52}}
+\definecharacter jcircumflex {\uchar1{53}}
+\definecharacter Kcommaaccent {\uchar1{54}}
+\definecharacter kcommaaccent {\uchar1{55}}
+\definecharacter kkra {\uchar1{56}}
+\definecharacter Lacute {\uchar1{57}}
+\definecharacter lacute {\uchar1{58}}
+\definecharacter Lcommaaccent {\uchar1{59}}
+\definecharacter lcommaaccent {\uchar1{60}}
+\definecharacter Lcaron {\uchar1{61}}
+\definecharacter lcaron {\uchar1{62}}
+\definecharacter Ldotmiddle {\uchar1{63}}
+\definecharacter ldotmiddle {\uchar1{64}}
+\definecharacter Lstroke {\uchar1{65}}
+\definecharacter lstroke {\uchar1{66}}
+\definecharacter Nacute {\uchar1{67}}
+\definecharacter nacute {\uchar1{68}}
+\definecharacter Ncommaaccent {\uchar1{69}}
+\definecharacter ncommaaccent {\uchar1{70}}
+\definecharacter Ncaron {\uchar1{71}}
+\definecharacter ncaron {\uchar1{72}}
+\definecharacter napostrophe {\uchar1{73}}
+\definecharacter Neng {\uchar1{74}}
+\definecharacter neng {\uchar1{75}}
+\definecharacter Omacron {\uchar1{76}}
+\definecharacter omacron {\uchar1{77}}
+\definecharacter Obreve {\uchar1{78}}
+\definecharacter obreve {\uchar1{79}}
+\definecharacter Ohungarumlaut {\uchar1{80}}
+\definecharacter ohungarumlaut {\uchar1{81}}
+\definecharacter OEligature {\uchar1{82}}
+\definecharacter oeligature {\uchar1{83}}
+\definecharacter Racute {\uchar1{84}}
+\definecharacter racute {\uchar1{85}}
+\definecharacter Rcommaaccent {\uchar1{86}}
+\definecharacter rcommaaccent {\uchar1{87}}
+\definecharacter Rcaron {\uchar1{88}}
+\definecharacter rcaron {\uchar1{89}}
+\definecharacter Sacute {\uchar1{90}}
+\definecharacter sacute {\uchar1{91}}
+\definecharacter Scircumflex {\uchar1{92}}
+\definecharacter scircumflex {\uchar1{93}}
+\definecharacter Scedilla {\uchar1{94}}
+\definecharacter scedilla {\uchar1{95}}
+\definecharacter Scaron {\uchar1{96}}
+\definecharacter scaron {\uchar1{97}}
+\definecharacter Tcedilla {\uchar1{98}}
+\definecharacter tcedilla {\uchar1{99}}
+\definecharacter Tcaron {\uchar1{100}}
+\definecharacter tcaron {\uchar1{101}}
+\definecharacter Tstroke {\uchar1{102}}
+\definecharacter tstroke {\uchar1{103}}
+\definecharacter Utilde {\uchar1{104}}
+\definecharacter utilde {\uchar1{105}}
+\definecharacter Umacron {\uchar1{106}}
+\definecharacter umacron {\uchar1{107}}
+\definecharacter Ubreve {\uchar1{108}}
+\definecharacter ubreve {\uchar1{109}}
+\definecharacter Uring {\uchar1{110}}
+\definecharacter uring {\uchar1{111}}
+\definecharacter Uhungarumlaut {\uchar1{112}}
+\definecharacter uhungarumlaut {\uchar1{113}}
+\definecharacter Uogonek {\uchar1{114}}
+\definecharacter uogonek {\uchar1{115}}
+\definecharacter Wcircumflex {\uchar1{116}}
+\definecharacter wcircumflex {\uchar1{117}}
+\definecharacter Ycircumflex {\uchar1{118}}
+\definecharacter ycircumflex {\uchar1{119}}
+\definecharacter Ydiaeresis {\uchar1{120}}
+\definecharacter Zacute {\uchar1{121}}
+\definecharacter zacute {\uchar1{122}}
+\definecharacter Zdotaccent {\uchar1{123}}
+\definecharacter zdotaccent {\uchar1{124}}
+\definecharacter Zcaron {\uchar1{125}}
+\definecharacter zcaron {\uchar1{126}}
+\definecharacter slong {\uchar1{127}}
+
+\stopencoding
+
+\startencoding[uc]
+
+\definecharacter endash {\uchar{32}{19}}
+\definecharacter emdash {\uchar{32}{20}}
+\definecharacter quoteleft {\uchar{32}{24}}
+\definecharacter quoteright {\uchar{32}{25}}
+\definecharacter quotesinglebase {\uchar{32}{26}}
+
+\definecharacter quotedblleft {\uchar{32}{28}}
+\definecharacter quotedblright {\uchar{32}{29}}
+\definecharacter quotedblbase {\uchar{32}{30}}
+
+\definecharacter leftguillemot {\uchar0{171}}
+\definecharacter rightguillemot {\uchar0{187}}
+
+\definecharacter guilsingleleft {\uchar{32}{57}}
+\definecharacter guilsingleright {\uchar{32}{58}}
+
+\stopencoding
+
+%D Adam Lindsay's additions
+
+\startencoding[uc]
+
+\definecharacter exclamdown {\uchar0{161}}
+\definecharacter textcent {\uchar0{162}}
+\definecharacter textsterling {\uchar0{163}}
+\definecharacter textcurrency {\uchar0{164}}
+\definecharacter textyen {\uchar0{165}}
+\definecharacter textbrokenbar {\uchar0{166}}
+\definecharacter sectionmark {\uchar0{167}}
+\definecharacter textdiaresis {\uchar0{168}}
+\definecharacter copyright {\uchar0{169}}
+
+\definecharacter textlognot {\uchar0{172}}
+\definecharacter softhyphen {\uchar0{173}}
+\definecharacter registered {\uchar0{174}}
+\definecharacter textmacron {\uchar0{175}}
+\definecharacter textdegree {\uchar0{176}}
+\definecharacter textpm {\uchar0{177}}
+\definecharacter twosuperior {\uchar0{178}}
+\definecharacter threesuperior {\uchar0{179}}
+\definecharacter textacute {\uchar0{180}}
+\definecharacter textmu {\uchar0{181}}
+\definecharacter paragraphmark {\uchar0{182}}
+\definecharacter periodcentered {\uchar0{183}}
+\definecharacter textcedilla {\uchar0{184}}
+\definecharacter onesuperior {\uchar0{185}}
+
+\definecharacter textgrave {\uchar3{0}}
+\definecharacter textacute {\uchar3{1}}
+\definecharacter textcircumflex {\uchar3{2}}
+\definecharacter texttilde {\uchar3{3}}
+\definecharacter textmacron {\uchar3{4}}
+\definecharacter textbreve {\uchar3{6}}
+\definecharacter textdotaccent {\uchar3{7}}
+\definecharacter textdiaeresis {\uchar3{8}}
+\definecharacter textring {\uchar3{10}}
+\definecharacter texthungarumlaut {\uchar3{11}}
+\definecharacter textcaron {\uchar3{12}}
+\definecharacter textogonek {\uchar3{40}}
+
+\definecharacter percent {\uchar0{37}}
+\definecharacter textunderscore {\uchar0{95}}
+
+\definecharacter ordfeminine {\uchar0{170}}
+\definecharacter ordmasculine {\uchar0{186}}
+\definecharacter onequarter {\uchar0{188}}
+\definecharacter onehalf {\uchar0{189}}
+\definecharacter threequarter {\uchar0{190}}
+\definecharacter questiondown {\uchar0{191}}
+
+\definecharacter textmultiply {\uchar0{215}}
+\definecharacter textdiv {\uchar0{247}}
+
+\definecharacter textminus {\uchar{32}{18}}
+\definecharacter textdag {\uchar{32}{32}}
+\definecharacter textddag {\uchar{32}{33}}
+\definecharacter textbullet {\uchar{32}{34}}
+\definecharacter textellipsis {\uchar{32}{38}}
+\definecharacter perthousand {\uchar{32}{48}}
+
+%new:
+\definecharacter Scommaaccent {\uchar2{24}}
+\definecharacter scommaaccent {\uchar2{25}}
+\definecharacter Tcommaaccent {\uchar2{26}}
+\definecharacter tcommaaccent {\uchar2{27}}
+
+\stopencoding
+
+%D Mojca's and Taco's additions:
+
+\startencoding[uc]
+
+\definecharacter textasciicircum {\uchar{0}{94}} % 5e
+\definecharacter textgrave {\uchar{0}{96}} % 60
+\definecharacter textdiaeresis {\uchar{0}{168}} % a8
+%definecharacter textmacron {\uchar{0}{175}} % af
+%definecharacter textacute {\uchar{0}{180}} % b4
+%definecharacter textcedilla {\uchar{0}{184}} % b8
+\definecharacter textcircumflex {\uchar{2}{198}} % c6
+\definecharacter textcaron {\uchar{2}{199}} % c7
+\definecharacter textbreve {\uchar{2}{216}} % d8
+\definecharacter textdotaccent {\uchar{2}{217}} % d9
+\definecharacter textring {\uchar{2}{218}} % da
+\definecharacter textogonek {\uchar{2}{219}} % db
+\definecharacter texttilde {\uchar{2}{220}} % dc
+\definecharacter texthungarumlaut {\uchar{2}{221}} % dd
+
+\stopencoding
+
+%D Vietnamese:
+
+\startencoding[uc]
+
+\definecharacter Ohorn {\uchar1{160}}
+\definecharacter ohorn {\uchar1{161}}
+\definecharacter Uhorn {\uchar1{175}}
+\definecharacter uhorn {\uchar1{176}}
+
+\definecharacter Yhook {\uchar{30}{246}}
+\definecharacter yhook {\uchar{30}{247}}
+\definecharacter Ydotbelow {\uchar{30}{244}}
+\definecharacter ydotbelow {\uchar{30}{245}}
+\definecharacter Ahook {\uchar{30}{162}}
+\definecharacter Adotbelow {\uchar{30}{160}}
+\definecharacter Acircumflexgrave {\uchar{30}{166}}
+\definecharacter Acircumflexacute {\uchar{30}{164}}
+\definecharacter Acircumflextilde {\uchar{30}{170}}
+\definecharacter Acircumflexhook {\uchar{30}{168}}
+\definecharacter Acircumflexdotbelow {\uchar{30}{172}}
+\definecharacter Abrevegrave {\uchar{30}{176}}
+\definecharacter Abreveacute {\uchar{30}{174}}
+\definecharacter Abrevetilde {\uchar{30}{180}}
+\definecharacter Abrevehook {\uchar{30}{178}}
+\definecharacter Abrevedotbelow {\uchar{30}{182}}
+\definecharacter Ehook {\uchar{30}{186}}
+\definecharacter Edotbelow {\uchar{30}{184}}
+\definecharacter Ecircumflexgrave {\uchar{30}{192}}
+\definecharacter Ecircumflexacute {\uchar{30}{190}}
+\definecharacter Ecircumflextilde {\uchar{30}{196}}
+\definecharacter Ecircumflexhook {\uchar{30}{194}}
+\definecharacter Ecircumflexdotbelow {\uchar{30}{198}}
+\definecharacter Ihook {\uchar{30}{200}}
+\definecharacter ahook {\uchar{30}{163}}
+\definecharacter adotbelow {\uchar{30}{161}}
+\definecharacter acircumflexgrave {\uchar{30}{167}}
+\definecharacter acircumflexacute {\uchar{30}{165}}
+\definecharacter acircumflextilde {\uchar{30}{171}}
+\definecharacter acircumflexhook {\uchar{30}{169}}
+\definecharacter acircumflexdotbelow {\uchar{30}{173}}
+\definecharacter abrevegrave {\uchar{30}{177}}
+\definecharacter abreveacute {\uchar{30}{175}}
+\definecharacter abrevetilde {\uchar{30}{181}}
+\definecharacter abrevehook {\uchar{30}{179}}
+\definecharacter abrevedotbelow {\uchar{30}{183}}
+\definecharacter ehook {\uchar{30}{187}}
+\definecharacter edotbelow {\uchar{30}{185}}
+\definecharacter ecircumflexgrave {\uchar{30}{193}}
+\definecharacter ecircumflexacute {\uchar{30}{191}}
+\definecharacter ecircumflextilde {\uchar{30}{197}}
+\definecharacter ecircumflexhook {\uchar{30}{195}}
+\definecharacter ecircumflexdotbelow {\uchar{30}{199}}
+\definecharacter ihook {\uchar{30}{201}}
+\definecharacter Idotbelow {\uchar{30}{202}}
+\definecharacter Ohook {\uchar{30}{206}}
+\definecharacter Odotbelow {\uchar{30}{204}}
+\definecharacter Ocircumflexgrave {\uchar{30}{210}}
+\definecharacter Ocircumflexacute {\uchar{30}{208}}
+\definecharacter Ocircumflextilde {\uchar{30}{214}}
+\definecharacter Ocircumflexhook {\uchar{30}{212}}
+\definecharacter Ocircumflexdotbelow {\uchar{30}{216}}
+\definecharacter Ohorngrave {\uchar{30}{220}}
+\definecharacter Ohornacute {\uchar{30}{218}}
+\definecharacter Ohorntilde {\uchar{30}{224}}
+\definecharacter Ohornhook {\uchar{30}{222}}
+\definecharacter Ohorndotbelow {\uchar{30}{226}}
+\definecharacter Uhook {\uchar{30}{230}}
+\definecharacter Udotbelow {\uchar{30}{228}}
+\definecharacter Uhorngrave {\uchar{30}{234}}
+\definecharacter Uhornacute {\uchar{30}{232}}
+\definecharacter Uhorntilde {\uchar{30}{238}}
+\definecharacter Uhornhook {\uchar{30}{236}}
+\definecharacter Uhorndotbelow {\uchar{30}{240}}
+\definecharacter Ytilde {\uchar{30}{248}}
+\definecharacter idotbelow {\uchar{30}{203}}
+\definecharacter ohook {\uchar{30}{207}}
+\definecharacter odotbelow {\uchar{30}{205}}
+\definecharacter ocircumflexgrave {\uchar{30}{211}}
+\definecharacter ocircumflexacute {\uchar{30}{209}}
+\definecharacter ocircumflextilde {\uchar{30}{215}}
+\definecharacter ocircumflexhook {\uchar{30}{213}}
+\definecharacter ocircumflexdotbelow {\uchar{30}{217}}
+\definecharacter ohorngrave {\uchar{30}{221}}
+\definecharacter ohornacute {\uchar{30}{219}}
+\definecharacter ohorntilde {\uchar{30}{225}}
+\definecharacter ohornhook {\uchar{30}{223}}
+\definecharacter ohorndotbelow {\uchar{30}{227}}
+\definecharacter uhook {\uchar{30}{231}}
+\definecharacter udotbelow {\uchar{30}{229}}
+\definecharacter uhorngrave {\uchar{30}{235}}
+\definecharacter uhornacute {\uchar{30}{233}}
+\definecharacter uhorntilde {\uchar{30}{239}}
+\definecharacter uhornhook {\uchar{30}{237}}
+\definecharacter uhorndotbelow {\uchar{30}{241}}
+\definecharacter ytilde {\uchar{30}{249}}
+
+\definecharacter Etilde {\uchar{30}{188}}
+\definecharacter etilde {\uchar{30}{189}}
+\definecharacter Ygrave {\uchar{30}{242}}
+\definecharacter ygrave {\uchar{30}{243}}
+
+\stopencoding
+
+% Greek:
+
+\startencoding[uc]
+
+\definecharacter greekAlphatonos {\uchar3{134}}
+\definecharacter greekEpsilontonos {\uchar3{136}}
+\definecharacter greekEtatonos {\uchar3{137}}
+\definecharacter greekIotatonos {\uchar3{138}}
+\definecharacter greekOmicrontonos {\uchar3{140}}
+\definecharacter greekUpsilontonos {\uchar3{142}}
+\definecharacter greekOmegatonos {\uchar3{143}}
+\definecharacter greekiotadialytikatonos {\uchar3{144}}
+\definecharacter greekAlpha {\uchar3{145}}
+\definecharacter greekBeta {\uchar3{146}}
+\definecharacter greekGamma {\uchar3{147}}
+\definecharacter greekDelta {\uchar3{148}}
+\definecharacter greekEpsilon {\uchar3{149}}
+\definecharacter greekZeta {\uchar3{150}}
+\definecharacter greekEta {\uchar3{151}}
+\definecharacter greekTheta {\uchar3{152}}
+\definecharacter greekIota {\uchar3{153}}
+\definecharacter greekKappa {\uchar3{154}}
+\definecharacter greekLambda {\uchar3{155}}
+\definecharacter greekMu {\uchar3{156}}
+\definecharacter greekNu {\uchar3{157}}
+\definecharacter greekXi {\uchar3{158}}
+\definecharacter greekOmicron {\uchar3{159}}
+\definecharacter greekPi {\uchar3{160}}
+\definecharacter greekRho {\uchar3{161}}
+\definecharacter greekSigma {\uchar3{163}}
+\definecharacter greekTau {\uchar3{164}}
+\definecharacter greekUpsilon {\uchar3{165}}
+\definecharacter greekPhi {\uchar3{166}}
+\definecharacter greekChi {\uchar3{167}}
+\definecharacter greekPsi {\uchar3{168}}
+\definecharacter greekOmega {\uchar3{169}}
+
+\definecharacter greekalpha {\uchar3{177}}
+\definecharacter greekbeta {\uchar3{178}}
+\definecharacter greekgamma {\uchar3{179}}
+\definecharacter greekdelta {\uchar3{180}}
+\definecharacter greekepsilon {\uchar3{181}}
+\definecharacter greekzeta {\uchar3{182}}
+\definecharacter greeketa {\uchar3{183}}
+\definecharacter greektheta {\uchar3{184}}
+\definecharacter greekiota {\uchar3{185}}
+\definecharacter greekkappa {\uchar3{186}}
+\definecharacter greeklambda {\uchar3{187}}
+\definecharacter greekmu {\uchar3{188}}
+\definecharacter greeknu {\uchar3{189}}
+\definecharacter greekxi {\uchar3{190}}
+\definecharacter greekomicron {\uchar3{191}}
+\definecharacter greekpi {\uchar3{192}}
+\definecharacter greekrho {\uchar3{193}}
+\definecharacter greekfinalsigma {\uchar3{194}}
+\definecharacter greeksigma {\uchar3{195}}
+\definecharacter greektau {\uchar3{196}}
+\definecharacter greekupsilon {\uchar3{197}}
+\definecharacter greekphi {\uchar3{198}}
+\definecharacter greekchi {\uchar3{199}}
+\definecharacter greekpsi {\uchar3{200}}
+\definecharacter greekomega {\uchar3{201}}
+\definecharacter greekiotadialytika {\uchar3{202}}
+\definecharacter greekupsilondialytika {\uchar3{203}}
+\definecharacter greekomicrontonos {\uchar3{204}}
+\definecharacter greekupsilontonos {\uchar3{205}}
+\definecharacter greekomegatonos {\uchar3{206}}
+
+\definecharacter greekIotadialytika {\uchar3{170}}
+\definecharacter greekUpsilondialytika {\uchar3{171}}
+
+\definecharacter greekalphatonos {\uchar3{172}}
+\definecharacter greekepsilontonos {\uchar3{173}}
+\definecharacter greeketatonos {\uchar3{174}}
+\definecharacter greekiotatonos {\uchar3{175}}
+\definecharacter greekupsilondialytikatonos {\uchar3{176}}
+
+% new:
+\definecharacter greekthetaalt {\uchar3{209}}
+\definecharacter greekphialt {\uchar3{213}}
+\definecharacter greekpialt {\uchar3{214}}
+\definecharacter greekrhoalt {\uchar3{241}}
+\definecharacter greekepsilonalt {\uchar3{245}}
+
+\stopencoding
+
+% Cyrillic:
+
+\startencoding[uc]
+
+\definecharacter cyrillicA {\uchar4{16}}
+\definecharacter cyrillicB {\uchar4{17}}
+\definecharacter cyrillicV {\uchar4{18}}
+\definecharacter cyrillicG {\uchar4{19}}
+\definecharacter cyrillicD {\uchar4{20}}
+\definecharacter cyrillicE {\uchar4{21}}
+\definecharacter cyrillicZH {\uchar4{22}}
+\definecharacter cyrillicZ {\uchar4{23}}
+\definecharacter cyrillicI {\uchar4{24}}
+\definecharacter cyrillicISHRT {\uchar4{25}}
+\definecharacter cyrillicK {\uchar4{26}}
+\definecharacter cyrillicL {\uchar4{27}}
+\definecharacter cyrillicM {\uchar4{28}}
+\definecharacter cyrillicN {\uchar4{29}}
+\definecharacter cyrillicO {\uchar4{30}}
+\definecharacter cyrillicP {\uchar4{31}}
+\definecharacter cyrillicR {\uchar4{32}}
+\definecharacter cyrillicS {\uchar4{33}}
+\definecharacter cyrillicT {\uchar4{34}}
+\definecharacter cyrillicU {\uchar4{35}}
+\definecharacter cyrillicF {\uchar4{36}}
+\definecharacter cyrillicH {\uchar4{37}}
+\definecharacter cyrillicC {\uchar4{38}}
+\definecharacter cyrillicCH {\uchar4{39}}
+\definecharacter cyrillicSH {\uchar4{40}}
+\definecharacter cyrillicSHCH {\uchar4{41}}
+\definecharacter cyrillicHRDSN {\uchar4{42}}
+\definecharacter cyrillicERY {\uchar4{43}}
+\definecharacter cyrillicSFTSN {\uchar4{44}}
+\definecharacter cyrillicEREV {\uchar4{45}}
+\definecharacter cyrillicYU {\uchar4{46}}
+\definecharacter cyrillicYA {\uchar4{47}}
+
+\definecharacter cyrillica {\uchar4{48}}
+\definecharacter cyrillicb {\uchar4{49}}
+\definecharacter cyrillicv {\uchar4{50}}
+\definecharacter cyrillicg {\uchar4{51}}
+\definecharacter cyrillicd {\uchar4{52}}
+\definecharacter cyrillice {\uchar4{53}}
+\definecharacter cyrilliczh {\uchar4{54}}
+\definecharacter cyrillicz {\uchar4{55}}
+\definecharacter cyrillici {\uchar4{56}}
+\definecharacter cyrillicishrt {\uchar4{57}}
+\definecharacter cyrillick {\uchar4{58}}
+\definecharacter cyrillicl {\uchar4{59}}
+\definecharacter cyrillicm {\uchar4{60}}
+\definecharacter cyrillicn {\uchar4{61}}
+\definecharacter cyrillico {\uchar4{62}}
+\definecharacter cyrillicp {\uchar4{63}}
+\definecharacter cyrillicr {\uchar4{64}}
+\definecharacter cyrillics {\uchar4{65}}
+\definecharacter cyrillict {\uchar4{66}}
+\definecharacter cyrillicu {\uchar4{67}}
+\definecharacter cyrillicf {\uchar4{68}}
+\definecharacter cyrillich {\uchar4{69}}
+\definecharacter cyrillicc {\uchar4{70}}
+\definecharacter cyrillicch {\uchar4{71}}
+\definecharacter cyrillicsh {\uchar4{72}}
+\definecharacter cyrillicshch {\uchar4{73}}
+\definecharacter cyrillichrdsn {\uchar4{74}}
+\definecharacter cyrillicery {\uchar4{75}}
+\definecharacter cyrillicsftsn {\uchar4{76}}
+\definecharacter cyrillicerev {\uchar4{77}}
+\definecharacter cyrillicyu {\uchar4{78}}
+\definecharacter cyrillicya {\uchar4{79}}
+
+%D I tried to figure out what these were, but the unicode
+%D tables suggested they were the same as cyrillici, which was
+%D already defined! So, a temporary definition:
+
+% \def\cyrillicII{\cyrillicI}
+% \def\cyrillicii{\cyrillici}
+
+%D a guess derived from looking at enco-cyr suggests that this is
+%D identical to the Roman I/i pair. To me, that sounds like
+%D CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I in the UC tables!
+
+\definecharacter cyrillicII {\uchar4{6}}
+\definecharacter cyrillicii {\uchar4{86}}
+
+%D Guessing that tlir6a corresponds with t2a encoding as advertised,
+%D here are some more, cos I had some spare time: (AL)
+
+\definecharacter cyrillicDJE {\uchar4{2}}
+\definecharacter cyrillicTSHE {\uchar4{11}}
+%definecharacter cyrillicSHHA 132
+%definecharacter cyrillicZHDSC 133
+\definecharacter cyrillicZDSC {\uchar4{152}}
+\definecharacter cyrillicLJE {\uchar4{9}}
+\definecharacter cyrillicYI {\uchar4{7}}
+\definecharacter cyrillicAE {\uchar4{212}}
+%definecharacter cyrillicNDSC 141
+%definecharacter cyrillicNG 142
+\definecharacter cyrillicDZE {\uchar4{5}}
+%definecharacter cyrillicOTLD 144
+\definecharacter cyrillicSDSC {\uchar4{170}}
+\definecharacter cyrillicUSHRT {\uchar4{14}}
+%definecharacter cyrillicY 147
+%definecharacter cyrillicYHCRS 148
+%definecharacter cyrillicHDSC 149
+\definecharacter cyrillicDZHE {\uchar4{15}}
+\definecharacter cyrillicIE {\uchar4{4}}
+\definecharacter cyrillicNJE {\uchar4{10}}
+\definecharacter cyrillicYO {\uchar4{1}}
+
+\definecharacter cyrillicdje {\uchar4{82}}
+\definecharacter cyrillictshe {\uchar4{91}}
+%definecharacter cyrillicshha 164
+%definecharacter cyrilliczhdsc 165
+\definecharacter cyrilliczdsc {\uchar4{153}}
+\definecharacter cyrilliclje {\uchar4{89}}
+\definecharacter cyrillicyi {\uchar4{87}}
+\definecharacter cyrillicae {\uchar4{213}}
+%definecharacter cyrillicndsc 173
+%definecharacter cyrillicng 174
+\definecharacter cyrillicdze {\uchar4{85}}
+%definecharacter cyrillicotld 176
+\definecharacter cyrillicsdsc {\uchar4{171}}
+\definecharacter cyrillicushrt {\uchar4{94}}
+%definecharacter cyrillicy 179
+%definecharacter cyrillicyhcrs 180
+%definecharacter cyrillichdsc 181
+\definecharacter cyrillicdzhe {\uchar4{95}}
+\definecharacter cyrillicie {\uchar4{84}}
+\definecharacter cyrillicnje {\uchar4{90}}
+\definecharacter cyrillicyo {\uchar4{81}}
+
+% is there overlap with the above definitions
+
+\definecharacter cyrillicEgrave {\uchar4{0}}
+\definecharacter cyrillicGJE {\uchar4{3}}
+\definecharacter cyrillicJE {\uchar4{8}}
+\definecharacter cyrillicKJE {\uchar4{12}}
+\definecharacter cyrillicIgrave {\uchar4{13}}
+\definecharacter cyrillicegrave {\uchar4{80}}
+\definecharacter cyrillicgje {\uchar4{83}}
+\definecharacter cyrillicje {\uchar4{88}}
+\definecharacter cyrillickje {\uchar4{92}}
+\definecharacter cyrillicigrave {\uchar4{93}}
+\definecharacter cyrillicOMEGA {\uchar4{96}}
+\definecharacter cyrillicomega {\uchar4{97}}
+\definecharacter cyrillicYAT {\uchar4{98}}
+\definecharacter cyrillicyat {\uchar4{99}}
+\definecharacter cyrillicEiotified {\uchar4{100}}
+\definecharacter cyrilliceiotified {\uchar4{101}}
+\definecharacter cyrillicLITTLEYUS {\uchar4{102}}
+\definecharacter cyrilliclittleyus {\uchar4{103}}
+\definecharacter cyrillicLITTLEYUSiotified {\uchar4{104}}
+\definecharacter cyrilliclittleyusiotified {\uchar4{105}}
+\definecharacter cyrillicBIGYUS {\uchar4{106}}
+\definecharacter cyrillicbigyus {\uchar4{107}}
+\definecharacter cyrillicBIGYUSiotified {\uchar4{108}}
+\definecharacter cyrillicbigyusiotified {\uchar4{109}}
+\definecharacter cyrillicKSI {\uchar4{110}}
+\definecharacter cyrillicksi {\uchar4{111}}
+\definecharacter cyrillicPSI {\uchar4{112}}
+\definecharacter cyrillicpsi {\uchar4{113}}
+\definecharacter cyrillicFITA {\uchar4{114}}
+\definecharacter cyrillicfita {\uchar4{115}}
+\definecharacter cyrillicIZHITSA {\uchar4{116}}
+\definecharacter cyrillicizhitsa {\uchar4{117}}
+\definecharacter cyrillicIZHITSAdoublegrave {\uchar4{118}}
+\definecharacter cyrillicizhitsadoublegrave {\uchar4{119}}
+\definecharacter cyrillicUK {\uchar4{120}}
+\definecharacter cyrillicuk {\uchar4{121}}
+\definecharacter cyrillicOMEGAround {\uchar4{122}}
+\definecharacter cyrillicomegaround {\uchar4{123}}
+\definecharacter cyrillicOMEGAtitlo {\uchar4{124}}
+\definecharacter cyrillicomegatitlo {\uchar4{125}}
+\definecharacter cyrillicOT {\uchar4{126}}
+\definecharacter cyrillicot {\uchar4{127}}
+\definecharacter cyrillicKOPPA {\uchar4{128}}
+\definecharacter cyrillickoppa {\uchar4{129}}
+\definecharacter cyrillicTITLO {\uchar4{131}}
+\definecharacter cyrillicPALATALIZATION {\uchar4{132}}
+\definecharacter cyrillicDASIAPNEUMATA {\uchar4{133}}
+\definecharacter cyrillicPSILIPNEUMATA {\uchar4{134}}
+\definecharacter cyrillicISHRTtail {\uchar4{138}}
+\definecharacter cyrillicishrttail {\uchar4{139}}
+\definecharacter cyrillicSEMISOFT {\uchar4{140}}
+\definecharacter cyrillicsemisoft {\uchar4{141}}
+\definecharacter cyrillicERtick {\uchar4{142}}
+\definecharacter cyrillicertick {\uchar4{143}}
+\definecharacter cyrillicGHEupturn {\uchar4{144}}
+\definecharacter cyrillicgheupturn {\uchar4{145}}
+\definecharacter cyrillicGHEstroke {\uchar4{146}}
+\definecharacter cyrillicghestroke {\uchar4{147}}
+\definecharacter cyrillicGHEmidhook {\uchar4{148}}
+\definecharacter cyrillicghemidhook {\uchar4{149}}
+\definecharacter cyrillicZHEdescender {\uchar4{150}}
+\definecharacter cyrilliczhedescender {\uchar4{151}}
+\definecharacter cyrillicZDSC {\uchar4{152}}
+\definecharacter cyrilliczdsc {\uchar4{153}}
+\definecharacter cyrillicKADC {\uchar4{154}}
+\definecharacter cyrillickadc {\uchar4{155}}
+\definecharacter cyrillicKAvertstroke {\uchar4{156}}
+\definecharacter cyrillickavertstroke {\uchar4{157}}
+\definecharacter cyrillicKAstroke {\uchar4{158}}
+\definecharacter cyrillickastroke {\uchar4{159}}
+\definecharacter cyrillicKAbashkir {\uchar4{160}}
+\definecharacter cyrillickabashkir {\uchar4{161}}
+\definecharacter cyrillicENDC {\uchar4{162}}
+\definecharacter cyrillicendc {\uchar4{163}}
+\definecharacter cyrillicENGHE {\uchar4{164}}
+\definecharacter cyrillicenghe {\uchar4{165}}
+\definecharacter cyrillicPEmidhook {\uchar4{166}}
+\definecharacter cyrillicpemidhook {\uchar4{167}}
+\definecharacter cyrillicHA {\uchar4{168}}
+\definecharacter cyrillicha {\uchar4{169}}
+%definecharacter cyrillicSDSC {\uchar4{170}} % already defined
+%definecharacter cyrilliccdsc {\uchar4{171}} % already defined
+\definecharacter cyrillicTEDC {\uchar4{172}}
+\definecharacter cyrillictedc {\uchar4{173}}
+\definecharacter cyrillicYstr {\uchar4{174}}
+\definecharacter cyrillicystr {\uchar4{175}}
+\definecharacter cyrillicYstrstroke {\uchar4{176}}
+\definecharacter cyrillicystrstroke {\uchar4{177}}
+\definecharacter cyrillicHADC {\uchar4{178}}
+\definecharacter cyrillichadc {\uchar4{179}}
+\definecharacter cyrillicTETSE {\uchar4{180}}
+\definecharacter cyrillictetse {\uchar4{181}}
+\definecharacter cyrillicCHEDC {\uchar4{182}}
+\definecharacter cyrillicchedc {\uchar4{183}}
+\definecharacter cyrillicCHEvertstroke {\uchar4{184}}
+\definecharacter cyrillicchevertstroke {\uchar4{185}}
+\definecharacter cyrillicSHHA {\uchar4{186}}
+\definecharacter cyrillicshha {\uchar4{187}}
+\definecharacter cyrillicCHEabkhasian {\uchar4{188}}
+\definecharacter cyrilliccheabkhasian {\uchar4{189}}
+\definecharacter cyrillicCHEDCabkhasian {\uchar4{190}}
+\definecharacter cyrillicchedcabkhasian {\uchar4{191}}
+\definecharacter cyrillicPALOCHKA {\uchar4{192}}
+\definecharacter cyrillicZHEbreve {\uchar4{193}}
+\definecharacter cyrilliczhebreve {\uchar4{194}}
+\definecharacter cyrillicKAhook {\uchar4{195}}
+\definecharacter cyrillickahook {\uchar4{196}}
+\definecharacter cyrillicELtail {\uchar4{197}}
+\definecharacter cyrilliceltail {\uchar4{198}}
+\definecharacter cyrillicENhook {\uchar4{199}}
+\definecharacter cyrillicenhook {\uchar4{200}}
+\definecharacter cyrillicENtail {\uchar4{201}}
+\definecharacter cyrillicentail {\uchar4{202}}
+\definecharacter cyrillicCHEkhakassian {\uchar4{203}}
+\definecharacter cyrillicchekhakassian {\uchar4{204}}
+\definecharacter cyrillicEMtail {\uchar4{205}}
+\definecharacter cyrillicemtail {\uchar4{206}}
+\definecharacter cyrillicAbreve {\uchar4{208}}
+\definecharacter cyrillicabreve {\uchar4{209}}
+\definecharacter cyrillicAdiaeresis {\uchar4{210}}
+\definecharacter cyrillicadiaeresis {\uchar4{211}}
+%definecharacter cyrillicAE {\uchar4{212}} % already defined
+%definecharacter cyrillicae {\uchar4{213}} % already defined
+\definecharacter cyrillicEbreve {\uchar4{214}}
+\definecharacter cyrillicebreve {\uchar4{215}}
+\definecharacter cyrillicSCHWA {\uchar4{216}}
+\definecharacter cyrillicschwa {\uchar4{217}}
+\definecharacter cyrillicSCHWAdiaeresis {\uchar4{218}}
+\definecharacter cyrillicschwadiaeresis {\uchar4{219}}
+\definecharacter cyrillicZHEdiaeresis {\uchar4{220}}
+\definecharacter cyrilliczhediaeresis {\uchar4{221}}
+\definecharacter cyrillicZEdiaeresis {\uchar4{222}}
+\definecharacter cyrilliczediaeresis {\uchar4{223}}
+\definecharacter cyrillicDZEabkhasian {\uchar4{224}}
+\definecharacter cyrillicdzeabkhasian {\uchar4{225}}
+\definecharacter cyrillicImacron {\uchar4{226}}
+\definecharacter cyrillicimacron {\uchar4{227}}
+\definecharacter cyrillicIdiaeresis {\uchar4{228}}
+\definecharacter cyrillicidiaeresis {\uchar4{229}}
+\definecharacter cyrillicOdiaeresis {\uchar4{230}}
+\definecharacter cyrillicodiaeresis {\uchar4{231}}
+\definecharacter cyrillicObarred {\uchar4{232}}
+\definecharacter cyrillicobarred {\uchar4{233}}
+\definecharacter cyrillicObarreddiaeresis {\uchar4{234}}
+\definecharacter cyrillicobarreddiaeresis {\uchar4{235}}
+\definecharacter cyrillicEdiaeresis {\uchar4{236}}
+\definecharacter cyrillicediaeresis {\uchar4{237}}
+\definecharacter cyrillicUmacron {\uchar4{238}}
+\definecharacter cyrillicumacron {\uchar4{239}}
+\definecharacter cyrillicUdiaeresis {\uchar4{240}}
+\definecharacter cyrillicudiaeresis {\uchar4{241}}
+\definecharacter cyrillicUdoubleacute {\uchar4{242}}
+\definecharacter cyrillicudoubleacute {\uchar4{243}}
+\definecharacter cyrillicCHEdiaeresis {\uchar4{244}}
+\definecharacter cyrillicchediaeresis {\uchar4{245}}
+\definecharacter cyrillicYERUdiaeresis {\uchar4{248}}
+\definecharacter cyrillicyerudiaeresis {\uchar4{249}}
+
+\stopencoding
+
+% Greek Extended
+
+\startencoding[uc]
+
+\definecharacter greekalphapsili {\uchar{31}{0}}
+\definecharacter greekalphadasia {\uchar{31}{1}}
+\definecharacter greekalphapsilivaria {\uchar{31}{2}}
+\definecharacter greekalphadasiavaria {\uchar{31}{3}}
+\definecharacter greekalphapsilitonos {\uchar{31}{4}}
+\definecharacter greekalphadasiatonos {\uchar{31}{5}}
+\definecharacter greekalphapsiliperispomeni {\uchar{31}{6}}
+\definecharacter greekalphadasiaperispomeni {\uchar{31}{7}}
+\definecharacter greekAlphapsili {\uchar{31}{8}}
+\definecharacter greekAlphadasia {\uchar{31}{9}}
+\definecharacter greekAlphapsilivaria {\uchar{31}{10}}
+\definecharacter greekAlphadasiavaria {\uchar{31}{11}}
+\definecharacter greekAlphapsilitonos {\uchar{31}{12}}
+\definecharacter greekAlphadasiatonos {\uchar{31}{13}}
+\definecharacter greekAlphapsiliperispomeni {\uchar{31}{14}}
+\definecharacter greekAlphadasiaperispomeni {\uchar{31}{15}}
+\definecharacter greekepsilonpsili {\uchar{31}{16}} % 1f10
+\definecharacter greekepsilondasia {\uchar{31}{17}}
+\definecharacter greekepsilonpsilivaria {\uchar{31}{18}}
+\definecharacter greekepsilondasiavaria {\uchar{31}{19}}
+\definecharacter greekepsilonpsilitonos {\uchar{31}{20}}
+\definecharacter greekepsilondasiatonos {\uchar{31}{21}}
+\definecharacter greekEpsilonpsili {\uchar{31}{24}}
+\definecharacter greekEpsilondasia {\uchar{31}{25}}
+\definecharacter greekEpsilonpsilivaria {\uchar{31}{26}}
+\definecharacter greekEpsilondasiavaria {\uchar{31}{27}}
+\definecharacter greekEpsilonpsilitonos {\uchar{31}{28}}
+\definecharacter greekEpsilondasiatonos {\uchar{31}{29}}
+\definecharacter greeketapsili {\uchar{31}{32}} % 1f20
+\definecharacter greeketadasia {\uchar{31}{33}}
+\definecharacter greeketapsilivaria {\uchar{31}{34}}
+\definecharacter greeketadasiavaria {\uchar{31}{35}}
+\definecharacter greeketapsilitonos {\uchar{31}{36}}
+\definecharacter greeketadasiatonos {\uchar{31}{37}}
+\definecharacter greeketapsiliperispomeni {\uchar{31}{38}}
+\definecharacter greeketadasiaperispomeni {\uchar{31}{39}}
+\definecharacter greekEtapsili {\uchar{31}{40}}
+\definecharacter greekEtadasia {\uchar{31}{41}}
+\definecharacter greekEtapsilivaria {\uchar{31}{42}}
+\definecharacter greekEtadasiavaria {\uchar{31}{43}}
+\definecharacter greekEtapsilitonos {\uchar{31}{44}}
+\definecharacter greekEtadasiatonos {\uchar{31}{45}}
+\definecharacter greekEtapsiliperispomeni {\uchar{31}{46}}
+\definecharacter greekEtadasiaperispomeni {\uchar{31}{47}}
+\definecharacter greekiotapsili {\uchar{31}{48}} % 1f30
+\definecharacter greekiotadasia {\uchar{31}{49}}
+\definecharacter greekiotapsilivaria {\uchar{31}{50}}
+\definecharacter greekiotadasiavaria {\uchar{31}{51}}
+\definecharacter greekiotapsilitonos {\uchar{31}{52}}
+\definecharacter greekiotadasiatonos {\uchar{31}{53}}
+\definecharacter greekiotapsiliperispomeni {\uchar{31}{54}}
+\definecharacter greekiotadasiaperispomeni {\uchar{31}{55}}
+\definecharacter greekIotapsili {\uchar{31}{56}}
+\definecharacter greekIotadasia {\uchar{31}{57}}
+\definecharacter greekIotapsilivaria {\uchar{31}{58}}
+\definecharacter greekIotadasiavaria {\uchar{31}{59}}
+\definecharacter greekIotapsilitonos {\uchar{31}{60}}
+\definecharacter greekIotadasiatonos {\uchar{31}{61}}
+\definecharacter greekIotapsiliperispomeni {\uchar{31}{62}}
+\definecharacter greekIotadasiaperispomeni {\uchar{31}{63}}
+\definecharacter greekomicronpsili {\uchar{31}{64}} % 1f40
+\definecharacter greekomicrondasia {\uchar{31}{65}}
+\definecharacter greekomicronpsilivaria {\uchar{31}{66}}
+\definecharacter greekomicrondasiavaria {\uchar{31}{67}}
+\definecharacter greekomicronpsilitonos {\uchar{31}{68}}
+\definecharacter greekomicrondasiatonos {\uchar{31}{69}}
+\definecharacter greekOmicronpsili {\uchar{31}{72}}
+\definecharacter greekOmicrondasia {\uchar{31}{73}}
+\definecharacter greekOmicronpsilivaria {\uchar{31}{74}}
+\definecharacter greekOmicrondasiavaria {\uchar{31}{75}}
+\definecharacter greekOmicronpsilitonos {\uchar{31}{76}}
+\definecharacter greekOmicrondasiatonos {\uchar{31}{77}}
+\definecharacter greekupsilonpsili {\uchar{31}{80}} % 1f50
+\definecharacter greekupsilondasia {\uchar{31}{81}}
+\definecharacter greekupsilonpsilivaria {\uchar{31}{82}}
+\definecharacter greekupsilondasiavaria {\uchar{31}{83}}
+\definecharacter greekupsilonpsilitonos {\uchar{31}{84}}
+\definecharacter greekupsilondasiatonos {\uchar{31}{85}}
+\definecharacter greekupsilonpsiliperispomeni {\uchar{31}{86}}
+\definecharacter greekupsilondasiaperispomeni {\uchar{31}{87}}
+\definecharacter greekUpsilondasia {\uchar{31}{89}}
+\definecharacter greekUpsilondasiavaria {\uchar{31}{91}}
+\definecharacter greekUpsilondasiatonos {\uchar{31}{93}}
+\definecharacter greekUpsilondasiaperispomeni {\uchar{31}{95}}
+\definecharacter greekomegapsili {\uchar{31}{96}} % 1f60
+\definecharacter greekomegadasia {\uchar{31}{97}}
+\definecharacter greekomegapsilivaria {\uchar{31}{98}}
+\definecharacter greekomegadasiavaria {\uchar{31}{99}}
+\definecharacter greekomegapsilitonos {\uchar{31}{100}}
+\definecharacter greekomegadasiatonos {\uchar{31}{101}}
+\definecharacter greekomegapsiliperispomeni {\uchar{31}{102}}
+\definecharacter greekomegadasiaperispomeni {\uchar{31}{103}}
+\definecharacter greekOmegapsili {\uchar{31}{104}}
+\definecharacter greekOmegadasia {\uchar{31}{105}}
+\definecharacter greekOmegapsilivaria {\uchar{31}{106}}
+\definecharacter greekOmegadasiavaria {\uchar{31}{107}}
+\definecharacter greekOmegapsilitonos {\uchar{31}{108}}
+\definecharacter greekOmegadasiatonos {\uchar{31}{109}}
+\definecharacter greekOmegapsiliperispomeni {\uchar{31}{110}}
+\definecharacter greekOmegadasiaperispomeni {\uchar{31}{111}}
+\definecharacter greekalphavaria {\uchar{31}{112}} % 1f70
+\definecharacter greekalphaoxia {\uchar{31}{113}}
+\definecharacter greekepsilonvaria {\uchar{31}{114}}
+\definecharacter greekepsilonoxia {\uchar{31}{115}}
+\definecharacter greeketavaria {\uchar{31}{116}}
+\definecharacter greeketaoxia {\uchar{31}{117}}
+\definecharacter greekiotavaria {\uchar{31}{118}}
+\definecharacter greekiotaoxia {\uchar{31}{119}}
+\definecharacter greekomicronvaria {\uchar{31}{120}}
+\definecharacter greekomicronoxia {\uchar{31}{121}}
+\definecharacter greekupsilonvaria {\uchar{31}{122}}
+\definecharacter greekupsilonoxia {\uchar{31}{123}}
+\definecharacter greekomegavaria {\uchar{31}{124}}
+\definecharacter greekomegaoxia {\uchar{31}{125}}
+\definecharacter greekalphaiotasubpsili {\uchar{31}{128}} % 1f80
+\definecharacter greekalphaiotasubdasia {\uchar{31}{129}}
+\definecharacter greekalphaiotasubpsilivaria {\uchar{31}{130}}
+\definecharacter greekalphaiotasubdasiavaria {\uchar{31}{131}}
+\definecharacter greekalphaiotasubpsilitonos {\uchar{31}{132}}
+\definecharacter greekalphaiotasubdasiatonos {\uchar{31}{133}}
+\definecharacter greekalphaiotasubpsiliperispomeni {\uchar{31}{134}}
+\definecharacter greekalphaiotasubdasiaperispomeni {\uchar{31}{135}}
+\definecharacter greekAlphaiotasubpsili {\uchar{31}{136}}
+\definecharacter greekAlphaiotasubdasia {\uchar{31}{137}}
+\definecharacter greekAlphaiotasubpsilivaria {\uchar{31}{138}}
+\definecharacter greekAlphaiotasubdasiavaria {\uchar{31}{139}}
+\definecharacter greekAlphaiotasubpsilitonos {\uchar{31}{140}}
+\definecharacter greekAlphaiotasubdasiatonos {\uchar{31}{141}}
+\definecharacter greekAlphaiotasubpsiliperispomeni {\uchar{31}{142}}
+\definecharacter greekAlphaiotasubdasiaperispomeni {\uchar{31}{143}}
+\definecharacter greeketaiotasubpsili {\uchar{31}{144}} % 1f90
+\definecharacter greeketaiotasubdasia {\uchar{31}{145}}
+\definecharacter greeketaiotasubpsilivaria {\uchar{31}{146}}
+\definecharacter greeketaiotasubdasiavaria {\uchar{31}{147}}
+\definecharacter greeketaiotasubpsilitonos {\uchar{31}{148}}
+\definecharacter greeketaiotasubdasiatonos {\uchar{31}{149}}
+\definecharacter greeketaiotasubpsiliperispomeni {\uchar{31}{150}}
+\definecharacter greeketaiotasubdasiaperispomeni {\uchar{31}{151}}
+\definecharacter greekEtaiotasubpsili {\uchar{31}{152}}
+\definecharacter greekEtaiotasubdasia {\uchar{31}{153}}
+\definecharacter greekEtaiotasubpsilivaria {\uchar{31}{154}}
+\definecharacter greekEtaiotasubdasiavaria {\uchar{31}{155}}
+\definecharacter greekEtaiotasubpsilitonos {\uchar{31}{156}}
+\definecharacter greekEtaiotasubdasiatonos {\uchar{31}{157}}
+\definecharacter greekEtaiotasubpsiliperispomeni {\uchar{31}{158}}
+\definecharacter greekEtaiotasubdasiaperispomeni {\uchar{31}{159}}
+\definecharacter greekomegaiotasubpsili {\uchar{31}{160}} % 1fa0
+\definecharacter greekomegaiotasubdasia {\uchar{31}{161}}
+\definecharacter greekomegaiotasubpsilivaria {\uchar{31}{162}}
+\definecharacter greekomegaiotasubdasiavaria {\uchar{31}{163}}
+\definecharacter greekomegaiotasubpsilitonos {\uchar{31}{164}}
+\definecharacter greekomegaiotasubdasiatonos {\uchar{31}{165}}
+\definecharacter greekomegaiotasubpsiliperispomeni {\uchar{31}{166}}
+\definecharacter greekomegaiotasubdasiaperispomeni {\uchar{31}{167}}
+\definecharacter greekOmegaiotasubpsili {\uchar{31}{168}}
+\definecharacter greekOmegaiotasubdasia {\uchar{31}{169}}
+\definecharacter greekOmegaiotasubpsilivaria {\uchar{31}{170}}
+\definecharacter greekOmegaiotasubdasiavaria {\uchar{31}{171}}
+\definecharacter greekOmegaiotasubpsilitonos {\uchar{31}{172}}
+\definecharacter greekOmegaiotasubdasiatonos {\uchar{31}{173}}
+\definecharacter greekOmegaiotasubpsiliperispomeni {\uchar{31}{174}}
+\definecharacter greekOmegaiotasubdasiaperispomeni {\uchar{31}{175}}
+\definecharacter greekalphavrachy {\uchar{31}{176}} % 1fb0
+\definecharacter greekalphamacron {\uchar{31}{177}}
+\definecharacter greekalphaiotasubvaria {\uchar{31}{178}}
+\definecharacter greekalphaiotasub {\uchar{31}{179}}
+\definecharacter greekalphaiotasubtonos {\uchar{31}{180}}
+\definecharacter greekalphaperispomeni {\uchar{31}{182}}
+\definecharacter greekalphaiotasubperispomeni {\uchar{31}{183}}
+\definecharacter greekAlphavrachy {\uchar{31}{184}}
+\definecharacter greekAlphamacron {\uchar{31}{185}}
+\definecharacter greekAlphavaria {\uchar{31}{186}}
+\definecharacter greekAlphatonos {\uchar{31}{187}}
+\definecharacter greekAlphaiotasub {\uchar{31}{188}}
+\definecharacter greekCoronis {\uchar{31}{189}}
+\definecharacter greekprosgegrammeni {\uchar{31}{190}}
+\definecharacter greekpsili {\uchar{31}{191}}
+\definecharacter greekperispomeni {\uchar{31}{192}} % 1fc0
+\definecharacter greekdialytikaperispomeni {\uchar{31}{193}}
+\definecharacter greeketaiotasubvaria {\uchar{31}{194}}
+\definecharacter greeketaiotasub {\uchar{31}{195}}
+\definecharacter greeketaiotasubtonos {\uchar{31}{196}}
+\definecharacter greeketaperispomeni {\uchar{31}{198}}
+\definecharacter greeketaiotasubperispomeni {\uchar{31}{199}}
+\definecharacter greekEpsilonvaria {\uchar{31}{200}}
+\definecharacter greekEpsilontonos {\uchar{31}{201}}
+\definecharacter greekEtavaria {\uchar{31}{202}}
+\definecharacter greekEtatonos {\uchar{31}{203}}
+\definecharacter greekEtaiotasub {\uchar{31}{204}}
+\definecharacter greekpsilivaria {\uchar{31}{205}}
+\definecharacter greekpsilitonos {\uchar{31}{206}}
+\definecharacter greekpsiliperispomeni {\uchar{31}{207}}
+\definecharacter greekiotavrachy {\uchar{31}{208}} % 1fd0
+\definecharacter greekiotamacron {\uchar{31}{209}}
+\definecharacter greekiotadialytikavaria {\uchar{31}{210}}
+\definecharacter greekiotadialytikatonos {\uchar{31}{211}}
+\definecharacter greekiotaperispomeni {\uchar{31}{214}}
+\definecharacter greekiotadialytikaperispomeni {\uchar{31}{215}}
+\definecharacter greekIotavrachy {\uchar{31}{216}}
+\definecharacter greekIotamacron {\uchar{31}{217}}
+\definecharacter greekIotavaria {\uchar{31}{218}}
+\definecharacter greekIotatonos {\uchar{31}{219}}
+\definecharacter greekdasiavaria {\uchar{31}{221}}
+\definecharacter greekdasiatonos {\uchar{31}{222}}
+\definecharacter greekdasiaperispomeni {\uchar{31}{223}}
+\definecharacter greekupsilonvrachy {\uchar{31}{224}} % 1fe0
+\definecharacter greekupsilonmacron {\uchar{31}{225}}
+\definecharacter greekupsilondialytikavaria {\uchar{31}{226}}
+\definecharacter greekupsilondialytikatonos {\uchar{31}{227}}
+\definecharacter greekrhopsili {\uchar{31}{228}}
+\definecharacter greekrhodasia {\uchar{31}{229}}
+\definecharacter greekupsilonperispomeni {\uchar{31}{230}}
+\definecharacter greekupsilondialytikaperispomeni {\uchar{31}{231}}
+\definecharacter greekUpsilonvrachy {\uchar{31}{232}}
+\definecharacter greekUpsilonmacron {\uchar{31}{233}}
+\definecharacter greekUpsilonvaria {\uchar{31}{234}}
+\definecharacter greekUpsilontonos {\uchar{31}{235}}
+\definecharacter greekRhodasia {\uchar{31}{236}}
+\definecharacter greekdialytikavaria {\uchar{31}{237}}
+\definecharacter greekdialytikatonos {\uchar{31}{238}}
+\definecharacter greekvaria {\uchar{31}{239}}
+\definecharacter greekomegaiotasubvaria {\uchar{31}{242}}
+\definecharacter greekomegaiotasub {\uchar{31}{243}}
+\definecharacter greekomegaiotasubtonos {\uchar{31}{244}}
+\definecharacter greekomegaperispomeni {\uchar{31}{246}}
+\definecharacter greekomegaiotasubperispomeni {\uchar{31}{247}}
+\definecharacter greekOmicronvaria {\uchar{31}{248}}
+\definecharacter greekOmicrontonos {\uchar{31}{249}}
+\definecharacter greekOmegavaria {\uchar{31}{250}}
+\definecharacter greekOmegatonos {\uchar{31}{251}}
+\definecharacter greekOmegaiotasub {\uchar{31}{252}}
+\definecharacter greekoxia {\uchar{31}{253}}
+\definecharacter greekdasia {\uchar{31}{254}}
+\definecharacter greeksigmalunate {\uchar3{242}}
+\definecharacter greekSigmalunate {\uchar3{249}}
+\definecharacter greeksampi {\uchar3{225}}
+\definecharacter greekdigamma {\uchar3{221}}
+\definecharacter greekstigma {\uchar3{219}}
+\definecharacter greeknumkoppa {\uchar3{223}}
+\definecharacter greekkoppa {\uchar3{217}}
+\definecharacter greekupsilondiaeresis {\uchar3{203}}
+
+\stopencoding
+
+% Hebrew:
+
+\startencoding[uc]
+
+\definecharacter hebrewAlef {\uchar5{208}} % 05D0
+\definecharacter hebrewBet {\uchar5{209}}
+\definecharacter hebrewGimel {\uchar5{210}}
+\definecharacter hebrewDalet {\uchar5{211}}
+\definecharacter hebrewHe {\uchar5{212}}
+\definecharacter hebrewVav {\uchar5{213}}
+\definecharacter hebrewZayin {\uchar5{214}}
+\definecharacter hebrewHet {\uchar5{215}}
+\definecharacter hebrewTet {\uchar5{216}}
+\definecharacter hebrewYod {\uchar5{217}}
+\definecharacter hebrewKaffinal {\uchar5{218}}
+\definecharacter hebrewKaf {\uchar5{219}}
+\definecharacter hebrewLamed {\uchar5{220}}
+\definecharacter hebrewMemfinal {\uchar5{221}}
+\definecharacter hebrewMem {\uchar5{222}}
+\definecharacter hebrewNunfinal {\uchar5{223}}
+\definecharacter hebrewNun {\uchar5{224}}
+\definecharacter hebrewSamekh {\uchar5{225}}
+\definecharacter hebrewAyin {\uchar5{226}}
+\definecharacter hebrewPefinal {\uchar5{227}}
+\definecharacter hebrewPe {\uchar5{228}}
+\definecharacter hebrewTsadifinal {\uchar5{229}}
+\definecharacter hebrewTsadi {\uchar5{230}}
+\definecharacter hebrewQof {\uchar5{231}}
+\definecharacter hebrewResh {\uchar5{232}}
+\definecharacter hebrewShin {\uchar5{233}}
+\definecharacter hebrewTav {\uchar5{234}} % 05EA
+
+\stopencoding
+
+\endinput
diff --git a/tex/context/base/enco-uc.tex b/tex/context/base/enco-uc.tex
deleted file mode 100644
index 981eb6ae4..000000000
--- a/tex/context/base/enco-uc.tex
+++ /dev/null
@@ -1,1091 +0,0 @@
-%D \module
-%D [ file=enco-uc,
-%D version=2000.xx.xx, % and later
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Unicode (backwards mapping),
-%D author={Adam Lindsay \& Hans Hagen},
-%D date=\currentdate,
-%D copyright=PRAGMA ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D An alternative approach would be to misuse the utf vectors, but they
-%D don't carry enough info around.
-
-% todo : \defineucharacter hebrewAlef 5 "D0
-
-\startencoding[uc]
-
-\definecharacter Agrave {\uchar0{192}}
-\definecharacter Aacute {\uchar0{193}}
-\definecharacter Acircumflex {\uchar0{194}}
-\definecharacter Atilde {\uchar0{195}}
-\definecharacter Adiaeresis {\uchar0{196}}
-\definecharacter Aring {\uchar0{197}}
-\definecharacter AEligature {\uchar0{198}}
-\definecharacter Ccedilla {\uchar0{199}}
-\definecharacter Egrave {\uchar0{200}}
-\definecharacter Eacute {\uchar0{201}}
-\definecharacter Ediaeresis {\uchar0{203}}
-\definecharacter Igrave {\uchar0{204}}
-\definecharacter Iacute {\uchar0{205}}
-\definecharacter Icircumflex {\uchar0{206}}
-\definecharacter Idiaeresis {\uchar0{207}}
-\definecharacter Eth {\uchar0{208}}
-\definecharacter Ntilde {\uchar0{209}}
-\definecharacter Ograve {\uchar0{210}}
-\definecharacter Oacute {\uchar0{211}}
-\definecharacter Ocircumflex {\uchar0{212}}
-\definecharacter Otilde {\uchar0{213}}
-\definecharacter Odiaeresis {\uchar0{214}}
-
-\definecharacter Ostroke {\uchar0{216}}
-\definecharacter Ugrave {\uchar0{217}}
-\definecharacter Uacute {\uchar0{218}}
-\definecharacter Uhungarumlaut {\uchar0{219}}
-\definecharacter Udiaeresis {\uchar0{220}}
-\definecharacter Yacute {\uchar0{221}}
-\definecharacter Thorn {\uchar0{222}}
-\definecharacter ssharp {\uchar0{223}}
-\definecharacter agrave {\uchar0{224}}
-\definecharacter aacute {\uchar0{225}}
-\definecharacter acircumflex {\uchar0{226}}
-\definecharacter atilde {\uchar0{227}}
-\definecharacter adiaeresis {\uchar0{228}}
-\definecharacter aring {\uchar0{229}}
-\definecharacter aeligature {\uchar0{230}}
-\definecharacter ccedilla {\uchar0{231}}
-\definecharacter egrave {\uchar0{232}}
-\definecharacter eacute {\uchar0{233}}
-\definecharacter ecircumflex {\uchar0{234}}
-\definecharacter ediaeresis {\uchar0{235}}
-\definecharacter igrave {\uchar0{236}}
-\definecharacter iacute {\uchar0{237}}
-\definecharacter icircumflex {\uchar0{238}}
-\definecharacter idiaeresis {\uchar0{239}}
-\definecharacter eth {\uchar0{240}}
-\definecharacter ntilde {\uchar0{241}}
-\definecharacter ograve {\uchar0{242}}
-\definecharacter oacute {\uchar0{243}}
-\definecharacter ocircumflex {\uchar0{244}}
-\definecharacter otilde {\uchar0{245}}
-\definecharacter odiaeresis {\uchar0{246}}
-
-\definecharacter ostroke {\uchar0{248}}
-\definecharacter ugrave {\uchar0{249}}
-\definecharacter uacute {\uchar0{250}}
-\definecharacter ucircumflex {\uchar0{251}}
-\definecharacter udiaeresis {\uchar0{252}}
-\definecharacter yacute {\uchar0{253}}
-\definecharacter thorn {\uchar0{254}}
-\definecharacter ydiaeresis {\uchar0{255}}
-
-\definecharacter Amacron {\uchar1{0}}
-\definecharacter amacron {\uchar1{1}}
-\definecharacter Abreve {\uchar1{2}}
-\definecharacter abreve {\uchar1{3}}
-\definecharacter Aogonek {\uchar1{4}}
-\definecharacter aogonek {\uchar1{5}}
-\definecharacter Cacute {\uchar1{6}}
-\definecharacter cacute {\uchar1{7}}
-\definecharacter Ccircumflex {\uchar1{8}}
-\definecharacter ccircumflex {\uchar1{9}}
-\definecharacter Cdotaccent {\uchar1{10}}
-\definecharacter cdotaccent {\uchar1{11}}
-\definecharacter Ccaron {\uchar1{12}}
-\definecharacter ccaron {\uchar1{13}}
-\definecharacter Dcaron {\uchar1{14}}
-\definecharacter dcaron {\uchar1{15}}
-\definecharacter Dstroke {\uchar1{16}}
-\definecharacter dstroke {\uchar1{17}}
-\definecharacter Emacron {\uchar1{18}}
-\definecharacter emacron {\uchar1{19}}
-\definecharacter Ebreve {\uchar1{20}}
-\definecharacter ebreve {\uchar1{21}}
-\definecharacter Edotaccent {\uchar1{22}}
-\definecharacter edotaccent {\uchar1{23}}
-\definecharacter Eogonek {\uchar1{24}}
-\definecharacter eogonek {\uchar1{25}}
-\definecharacter Ecaron {\uchar1{26}}
-\definecharacter ecaron {\uchar1{27}}
-\definecharacter Gcircumflex {\uchar1{28}}
-\definecharacter gcircumflex {\uchar1{29}}
-\definecharacter Gbreve {\uchar1{30}}
-\definecharacter gbreve {\uchar1{31}}
-\definecharacter Gdotaccent {\uchar1{32}}
-\definecharacter gdotaccent {\uchar1{33}}
-\definecharacter Gcommaaccent {\uchar1{34}}
-\definecharacter gcommaaccent {\uchar1{35}}
-\definecharacter Hcircumflex {\uchar1{36}}
-\definecharacter hcircumflex {\uchar1{37}}
-\definecharacter Hstroke {\uchar1{38}}
-\definecharacter hstroke {\uchar1{39}}
-\definecharacter Itilde {\uchar1{40}}
-\definecharacter itilde {\uchar1{41}}
-\definecharacter Imacron {\uchar1{42}}
-\definecharacter imacron {\uchar1{43}}
-\definecharacter Ibreve {\uchar1{44}}
-\definecharacter ibreve {\uchar1{45}}
-\definecharacter Iogonek {\uchar1{46}}
-\definecharacter iogonek {\uchar1{47}}
-\definecharacter Idotaccent {\uchar1{48}}
-\definecharacter dotlessi {\uchar1{49}}
-\definecharacter IJligature {\uchar1{50}}
-\definecharacter ijligature {\uchar1{51}}
-\definecharacter Jcircumflex {\uchar1{52}}
-\definecharacter jcircumflex {\uchar1{53}}
-\definecharacter Kcommaaccent {\uchar1{54}}
-\definecharacter kcommaaccent {\uchar1{55}}
-\definecharacter kkra {\uchar1{56}}
-\definecharacter Lacute {\uchar1{57}}
-\definecharacter lacute {\uchar1{58}}
-\definecharacter Lcommaaccent {\uchar1{59}}
-\definecharacter lcommaaccent {\uchar1{60}}
-\definecharacter Lcaron {\uchar1{61}}
-\definecharacter lcaron {\uchar1{62}}
-\definecharacter Ldotmiddle {\uchar1{63}}
-\definecharacter ldotmiddle {\uchar1{64}}
-\definecharacter Lstroke {\uchar1{65}}
-\definecharacter lstroke {\uchar1{66}}
-\definecharacter Nacute {\uchar1{67}}
-\definecharacter nacute {\uchar1{68}}
-\definecharacter Ncommaaccent {\uchar1{69}}
-\definecharacter ncommaaccent {\uchar1{70}}
-\definecharacter Ncaron {\uchar1{71}}
-\definecharacter ncaron {\uchar1{72}}
-\definecharacter napostrophe {\uchar1{73}}
-\definecharacter Neng {\uchar1{74}}
-\definecharacter neng {\uchar1{75}}
-\definecharacter Omacron {\uchar1{76}}
-\definecharacter omacron {\uchar1{77}}
-\definecharacter Obreve {\uchar1{78}}
-\definecharacter obreve {\uchar1{79}}
-\definecharacter Ohungarumlaut {\uchar1{80}}
-\definecharacter ohungarumlaut {\uchar1{81}}
-\definecharacter OEligature {\uchar1{82}}
-\definecharacter oeligature {\uchar1{83}}
-\definecharacter Racute {\uchar1{84}}
-\definecharacter racute {\uchar1{85}}
-\definecharacter Rcommaaccent {\uchar1{86}}
-\definecharacter rcommaaccent {\uchar1{87}}
-\definecharacter Rcaron {\uchar1{88}}
-\definecharacter rcaron {\uchar1{89}}
-\definecharacter Sacute {\uchar1{90}}
-\definecharacter sacute {\uchar1{91}}
-\definecharacter Scircumflex {\uchar1{92}}
-\definecharacter scircumflex {\uchar1{93}}
-\definecharacter Scedilla {\uchar1{94}}
-\definecharacter scedilla {\uchar1{95}}
-\definecharacter Scaron {\uchar1{96}}
-\definecharacter scaron {\uchar1{97}}
-\definecharacter Tcedilla {\uchar1{98}}
-\definecharacter tcedilla {\uchar1{99}}
-\definecharacter Tcaron {\uchar1{100}}
-\definecharacter tcaron {\uchar1{101}}
-\definecharacter Tstroke {\uchar1{102}}
-\definecharacter tstroke {\uchar1{103}}
-\definecharacter Utilde {\uchar1{104}}
-\definecharacter utilde {\uchar1{105}}
-\definecharacter Umacron {\uchar1{106}}
-\definecharacter umacron {\uchar1{107}}
-\definecharacter Ubreve {\uchar1{108}}
-\definecharacter ubreve {\uchar1{109}}
-\definecharacter Uring {\uchar1{110}}
-\definecharacter uring {\uchar1{111}}
-\definecharacter Uhungarumlaut {\uchar1{112}}
-\definecharacter uhungarumlaut {\uchar1{113}}
-\definecharacter Uogonek {\uchar1{114}}
-\definecharacter uogonek {\uchar1{115}}
-\definecharacter Wcircumflex {\uchar1{116}}
-\definecharacter wcircumflex {\uchar1{117}}
-\definecharacter Ycircumflex {\uchar1{118}}
-\definecharacter ycircumflex {\uchar1{119}}
-\definecharacter Ydiaeresis {\uchar1{120}}
-\definecharacter Zacute {\uchar1{121}}
-\definecharacter zacute {\uchar1{122}}
-\definecharacter Zdotaccent {\uchar1{123}}
-\definecharacter zdotaccent {\uchar1{124}}
-\definecharacter Zcaron {\uchar1{125}}
-\definecharacter zcaron {\uchar1{126}}
-\definecharacter slong {\uchar1{127}}
-
-\stopencoding
-
-\startencoding[uc]
-
-\definecharacter endash {\uchar{32}{19}}
-\definecharacter emdash {\uchar{32}{20}}
-\definecharacter quoteleft {\uchar{32}{24}}
-\definecharacter quoteright {\uchar{32}{25}}
-\definecharacter quotesinglebase {\uchar{32}{26}}
-
-\definecharacter quotedblleft {\uchar{32}{28}}
-\definecharacter quotedblright {\uchar{32}{29}}
-\definecharacter quotedblbase {\uchar{32}{30}}
-
-\definecharacter leftguillemot {\uchar0{171}}
-\definecharacter rightguillemot {\uchar0{187}}
-
-\definecharacter guilsingleleft {\uchar{32}{57}}
-\definecharacter guilsingleright {\uchar{32}{58}}
-
-\stopencoding
-
-%D Adam Lindsay's additions
-
-\startencoding[uc]
-
-\definecharacter exclamdown {\uchar0{161}}
-\definecharacter textcent {\uchar0{162}}
-\definecharacter textsterling {\uchar0{163}}
-\definecharacter textcurrency {\uchar0{164}}
-\definecharacter textyen {\uchar0{165}}
-\definecharacter textbrokenbar {\uchar0{166}}
-\definecharacter sectionmark {\uchar0{167}}
-\definecharacter textdiaresis {\uchar0{168}}
-\definecharacter copyright {\uchar0{169}}
-
-\definecharacter textlognot {\uchar0{172}}
-\definecharacter softhyphen {\uchar0{173}}
-\definecharacter registered {\uchar0{174}}
-\definecharacter textmacron {\uchar0{175}}
-\definecharacter textdegree {\uchar0{176}}
-\definecharacter textpm {\uchar0{177}}
-\definecharacter twosuperior {\uchar0{178}}
-\definecharacter threesuperior {\uchar0{179}}
-\definecharacter textacute {\uchar0{180}}
-\definecharacter textmu {\uchar0{181}}
-\definecharacter paragraphmark {\uchar0{182}}
-\definecharacter periodcentered {\uchar0{183}}
-\definecharacter textcedilla {\uchar0{184}}
-\definecharacter onesuperior {\uchar0{185}}
-
-\definecharacter textgrave {\uchar3{0}}
-\definecharacter textacute {\uchar3{1}}
-\definecharacter textcircumflex {\uchar3{2}}
-\definecharacter texttilde {\uchar3{3}}
-\definecharacter textmacron {\uchar3{4}}
-\definecharacter textbreve {\uchar3{6}}
-\definecharacter textdotaccent {\uchar3{7}}
-\definecharacter textdiaeresis {\uchar3{8}}
-\definecharacter textring {\uchar3{10}}
-\definecharacter texthungarumlaut {\uchar3{11}}
-\definecharacter textcaron {\uchar3{12}}
-\definecharacter textogonek {\uchar3{40}}
-
-\definecharacter percent {\uchar0{37}}
-\definecharacter textunderscore {\uchar0{95}}
-
-\definecharacter ordfeminine {\uchar0{170}}
-\definecharacter ordmasculine {\uchar0{186}}
-\definecharacter onequarter {\uchar0{188}}
-\definecharacter onehalf {\uchar0{189}}
-\definecharacter threequarter {\uchar0{190}}
-\definecharacter questiondown {\uchar0{191}}
-
-\definecharacter textmultiply {\uchar0{215}}
-\definecharacter textdiv {\uchar0{247}}
-
-\definecharacter textminus {\uchar{32}{18}}
-\definecharacter textdag {\uchar{32}{32}}
-\definecharacter textddag {\uchar{32}{33}}
-\definecharacter textbullet {\uchar{32}{34}}
-\definecharacter textellipsis {\uchar{32}{38}}
-\definecharacter perthousand {\uchar{32}{48}}
-
-%new:
-\definecharacter Scommaaccent {\uchar2{24}}
-\definecharacter scommaaccent {\uchar2{25}}
-\definecharacter Tcommaaccent {\uchar2{26}}
-\definecharacter tcommaaccent {\uchar2{27}}
-
-\stopencoding
-
-%D Mojca's and Taco's additions:
-
-\startencoding[uc]
-
-\definecharacter textasciicircum {\uchar{0}{94}} % 5e
-\definecharacter textgrave {\uchar{0}{96}} % 60
-\definecharacter textdiaeresis {\uchar{0}{168}} % a8
-%definecharacter textmacron {\uchar{0}{175}} % af
-%definecharacter textacute {\uchar{0}{180}} % b4
-%definecharacter textcedilla {\uchar{0}{184}} % b8
-\definecharacter textcircumflex {\uchar{2}{198}} % c6
-\definecharacter textcaron {\uchar{2}{199}} % c7
-\definecharacter textbreve {\uchar{2}{216}} % d8
-\definecharacter textdotaccent {\uchar{2}{217}} % d9
-\definecharacter textring {\uchar{2}{218}} % da
-\definecharacter textogonek {\uchar{2}{219}} % db
-\definecharacter texttilde {\uchar{2}{220}} % dc
-\definecharacter texthungarumlaut {\uchar{2}{221}} % dd
-
-\stopencoding
-
-%D Vietnamese:
-
-\startencoding[uc]
-
-\definecharacter Ohorn {\uchar1{160}}
-\definecharacter ohorn {\uchar1{161}}
-\definecharacter Uhorn {\uchar1{175}}
-\definecharacter uhorn {\uchar1{176}}
-
-\definecharacter Yhook {\uchar{30}{246}}
-\definecharacter yhook {\uchar{30}{247}}
-\definecharacter Ydotbelow {\uchar{30}{244}}
-\definecharacter ydotbelow {\uchar{30}{245}}
-\definecharacter Ahook {\uchar{30}{162}}
-\definecharacter Adotbelow {\uchar{30}{160}}
-\definecharacter Acircumflexgrave {\uchar{30}{166}}
-\definecharacter Acircumflexacute {\uchar{30}{164}}
-\definecharacter Acircumflextilde {\uchar{30}{170}}
-\definecharacter Acircumflexhook {\uchar{30}{168}}
-\definecharacter Acircumflexdotbelow {\uchar{30}{172}}
-\definecharacter Abrevegrave {\uchar{30}{176}}
-\definecharacter Abreveacute {\uchar{30}{174}}
-\definecharacter Abrevetilde {\uchar{30}{180}}
-\definecharacter Abrevehook {\uchar{30}{178}}
-\definecharacter Abrevedotbelow {\uchar{30}{182}}
-\definecharacter Ehook {\uchar{30}{186}}
-\definecharacter Edotbelow {\uchar{30}{184}}
-\definecharacter Ecircumflexgrave {\uchar{30}{192}}
-\definecharacter Ecircumflexacute {\uchar{30}{190}}
-\definecharacter Ecircumflextilde {\uchar{30}{196}}
-\definecharacter Ecircumflexhook {\uchar{30}{194}}
-\definecharacter Ecircumflexdotbelow {\uchar{30}{198}}
-\definecharacter Ihook {\uchar{30}{200}}
-\definecharacter ahook {\uchar{30}{163}}
-\definecharacter adotbelow {\uchar{30}{161}}
-\definecharacter acircumflexgrave {\uchar{30}{167}}
-\definecharacter acircumflexacute {\uchar{30}{165}}
-\definecharacter acircumflextilde {\uchar{30}{171}}
-\definecharacter acircumflexhook {\uchar{30}{169}}
-\definecharacter acircumflexdotbelow {\uchar{30}{173}}
-\definecharacter abrevegrave {\uchar{30}{177}}
-\definecharacter abreveacute {\uchar{30}{175}}
-\definecharacter abrevetilde {\uchar{30}{181}}
-\definecharacter abrevehook {\uchar{30}{179}}
-\definecharacter abrevedotbelow {\uchar{30}{183}}
-\definecharacter ehook {\uchar{30}{187}}
-\definecharacter edotbelow {\uchar{30}{185}}
-\definecharacter ecircumflexgrave {\uchar{30}{193}}
-\definecharacter ecircumflexacute {\uchar{30}{191}}
-\definecharacter ecircumflextilde {\uchar{30}{197}}
-\definecharacter ecircumflexhook {\uchar{30}{195}}
-\definecharacter ecircumflexdotbelow {\uchar{30}{199}}
-\definecharacter ihook {\uchar{30}{201}}
-\definecharacter Idotbelow {\uchar{30}{202}}
-\definecharacter Ohook {\uchar{30}{206}}
-\definecharacter Odotbelow {\uchar{30}{204}}
-\definecharacter Ocircumflexgrave {\uchar{30}{210}}
-\definecharacter Ocircumflexacute {\uchar{30}{208}}
-\definecharacter Ocircumflextilde {\uchar{30}{214}}
-\definecharacter Ocircumflexhook {\uchar{30}{212}}
-\definecharacter Ocircumflexdotbelow {\uchar{30}{216}}
-\definecharacter Ohorngrave {\uchar{30}{220}}
-\definecharacter Ohornacute {\uchar{30}{218}}
-\definecharacter Ohorntilde {\uchar{30}{224}}
-\definecharacter Ohornhook {\uchar{30}{222}}
-\definecharacter Ohorndotbelow {\uchar{30}{226}}
-\definecharacter Uhook {\uchar{30}{230}}
-\definecharacter Udotbelow {\uchar{30}{228}}
-\definecharacter Uhorngrave {\uchar{30}{234}}
-\definecharacter Uhornacute {\uchar{30}{232}}
-\definecharacter Uhorntilde {\uchar{30}{238}}
-\definecharacter Uhornhook {\uchar{30}{236}}
-\definecharacter Uhorndotbelow {\uchar{30}{240}}
-\definecharacter Ytilde {\uchar{30}{248}}
-\definecharacter idotbelow {\uchar{30}{203}}
-\definecharacter ohook {\uchar{30}{207}}
-\definecharacter odotbelow {\uchar{30}{205}}
-\definecharacter ocircumflexgrave {\uchar{30}{211}}
-\definecharacter ocircumflexacute {\uchar{30}{209}}
-\definecharacter ocircumflextilde {\uchar{30}{215}}
-\definecharacter ocircumflexhook {\uchar{30}{213}}
-\definecharacter ocircumflexdotbelow {\uchar{30}{217}}
-\definecharacter ohorngrave {\uchar{30}{221}}
-\definecharacter ohornacute {\uchar{30}{219}}
-\definecharacter ohorntilde {\uchar{30}{225}}
-\definecharacter ohornhook {\uchar{30}{223}}
-\definecharacter ohorndotbelow {\uchar{30}{227}}
-\definecharacter uhook {\uchar{30}{231}}
-\definecharacter udotbelow {\uchar{30}{229}}
-\definecharacter uhorngrave {\uchar{30}{235}}
-\definecharacter uhornacute {\uchar{30}{233}}
-\definecharacter uhorntilde {\uchar{30}{239}}
-\definecharacter uhornhook {\uchar{30}{237}}
-\definecharacter uhorndotbelow {\uchar{30}{241}}
-\definecharacter ytilde {\uchar{30}{249}}
-
-\definecharacter Etilde {\uchar{30}{188}}
-\definecharacter etilde {\uchar{30}{189}}
-\definecharacter Ygrave {\uchar{30}{242}}
-\definecharacter ygrave {\uchar{30}{243}}
-
-\stopencoding
-
-% Greek:
-
-\startencoding[uc]
-
-\definecharacter greekAlphatonos {\uchar3{134}}
-\definecharacter greekEpsilontonos {\uchar3{136}}
-\definecharacter greekEtatonos {\uchar3{137}}
-\definecharacter greekIotatonos {\uchar3{138}}
-\definecharacter greekOmicrontonos {\uchar3{140}}
-\definecharacter greekUpsilontonos {\uchar3{142}}
-\definecharacter greekOmegatonos {\uchar3{143}}
-\definecharacter greekiotadialytikatonos {\uchar3{144}}
-\definecharacter greekAlpha {\uchar3{145}}
-\definecharacter greekBeta {\uchar3{146}}
-\definecharacter greekGamma {\uchar3{147}}
-\definecharacter greekDelta {\uchar3{148}}
-\definecharacter greekEpsilon {\uchar3{149}}
-\definecharacter greekZeta {\uchar3{150}}
-\definecharacter greekEta {\uchar3{151}}
-\definecharacter greekTheta {\uchar3{152}}
-\definecharacter greekIota {\uchar3{153}}
-\definecharacter greekKappa {\uchar3{154}}
-\definecharacter greekLambda {\uchar3{155}}
-\definecharacter greekMu {\uchar3{156}}
-\definecharacter greekNu {\uchar3{157}}
-\definecharacter greekXi {\uchar3{158}}
-\definecharacter greekOmicron {\uchar3{159}}
-\definecharacter greekPi {\uchar3{160}}
-\definecharacter greekRho {\uchar3{161}}
-\definecharacter greekSigma {\uchar3{163}}
-\definecharacter greekTau {\uchar3{164}}
-\definecharacter greekUpsilon {\uchar3{165}}
-\definecharacter greekPhi {\uchar3{166}}
-\definecharacter greekChi {\uchar3{167}}
-\definecharacter greekPsi {\uchar3{168}}
-\definecharacter greekOmega {\uchar3{169}}
-
-\definecharacter greekalpha {\uchar3{177}}
-\definecharacter greekbeta {\uchar3{178}}
-\definecharacter greekgamma {\uchar3{179}}
-\definecharacter greekdelta {\uchar3{180}}
-\definecharacter greekepsilon {\uchar3{181}}
-\definecharacter greekzeta {\uchar3{182}}
-\definecharacter greeketa {\uchar3{183}}
-\definecharacter greektheta {\uchar3{184}}
-\definecharacter greekiota {\uchar3{185}}
-\definecharacter greekkappa {\uchar3{186}}
-\definecharacter greeklambda {\uchar3{187}}
-\definecharacter greekmu {\uchar3{188}}
-\definecharacter greeknu {\uchar3{189}}
-\definecharacter greekxi {\uchar3{190}}
-\definecharacter greekomicron {\uchar3{191}}
-\definecharacter greekpi {\uchar3{192}}
-\definecharacter greekrho {\uchar3{193}}
-\definecharacter greekfinalsigma {\uchar3{194}}
-\definecharacter greeksigma {\uchar3{195}}
-\definecharacter greektau {\uchar3{196}}
-\definecharacter greekupsilon {\uchar3{197}}
-\definecharacter greekphi {\uchar3{198}}
-\definecharacter greekchi {\uchar3{199}}
-\definecharacter greekpsi {\uchar3{200}}
-\definecharacter greekomega {\uchar3{201}}
-\definecharacter greekiotadialytika {\uchar3{202}}
-\definecharacter greekupsilondialytika {\uchar3{203}}
-\definecharacter greekomicrontonos {\uchar3{204}}
-\definecharacter greekupsilontonos {\uchar3{205}}
-\definecharacter greekomegatonos {\uchar3{206}}
-
-\definecharacter greekIotadialytika {\uchar3{170}}
-\definecharacter greekUpsilondialytika {\uchar3{171}}
-
-\definecharacter greekalphatonos {\uchar3{172}}
-\definecharacter greekepsilontonos {\uchar3{173}}
-\definecharacter greeketatonos {\uchar3{174}}
-\definecharacter greekiotatonos {\uchar3{175}}
-\definecharacter greekupsilondialytikatonos {\uchar3{176}}
-
-% new:
-\definecharacter greekthetaalt {\uchar3{209}}
-\definecharacter greekphialt {\uchar3{213}}
-\definecharacter greekpialt {\uchar3{214}}
-\definecharacter greekrhoalt {\uchar3{241}}
-\definecharacter greekepsilonalt {\uchar3{245}}
-
-\stopencoding
-
-% Cyrillic:
-
-\startencoding[uc]
-
-\definecharacter cyrillicA {\uchar4{16}}
-\definecharacter cyrillicB {\uchar4{17}}
-\definecharacter cyrillicV {\uchar4{18}}
-\definecharacter cyrillicG {\uchar4{19}}
-\definecharacter cyrillicD {\uchar4{20}}
-\definecharacter cyrillicE {\uchar4{21}}
-\definecharacter cyrillicZH {\uchar4{22}}
-\definecharacter cyrillicZ {\uchar4{23}}
-\definecharacter cyrillicI {\uchar4{24}}
-\definecharacter cyrillicISHRT {\uchar4{25}}
-\definecharacter cyrillicK {\uchar4{26}}
-\definecharacter cyrillicL {\uchar4{27}}
-\definecharacter cyrillicM {\uchar4{28}}
-\definecharacter cyrillicN {\uchar4{29}}
-\definecharacter cyrillicO {\uchar4{30}}
-\definecharacter cyrillicP {\uchar4{31}}
-\definecharacter cyrillicR {\uchar4{32}}
-\definecharacter cyrillicS {\uchar4{33}}
-\definecharacter cyrillicT {\uchar4{34}}
-\definecharacter cyrillicU {\uchar4{35}}
-\definecharacter cyrillicF {\uchar4{36}}
-\definecharacter cyrillicH {\uchar4{37}}
-\definecharacter cyrillicC {\uchar4{38}}
-\definecharacter cyrillicCH {\uchar4{39}}
-\definecharacter cyrillicSH {\uchar4{40}}
-\definecharacter cyrillicSHCH {\uchar4{41}}
-\definecharacter cyrillicHRDSN {\uchar4{42}}
-\definecharacter cyrillicERY {\uchar4{43}}
-\definecharacter cyrillicSFTSN {\uchar4{44}}
-\definecharacter cyrillicEREV {\uchar4{45}}
-\definecharacter cyrillicYU {\uchar4{46}}
-\definecharacter cyrillicYA {\uchar4{47}}
-
-\definecharacter cyrillica {\uchar4{48}}
-\definecharacter cyrillicb {\uchar4{49}}
-\definecharacter cyrillicv {\uchar4{50}}
-\definecharacter cyrillicg {\uchar4{51}}
-\definecharacter cyrillicd {\uchar4{52}}
-\definecharacter cyrillice {\uchar4{53}}
-\definecharacter cyrilliczh {\uchar4{54}}
-\definecharacter cyrillicz {\uchar4{55}}
-\definecharacter cyrillici {\uchar4{56}}
-\definecharacter cyrillicishrt {\uchar4{57}}
-\definecharacter cyrillick {\uchar4{58}}
-\definecharacter cyrillicl {\uchar4{59}}
-\definecharacter cyrillicm {\uchar4{60}}
-\definecharacter cyrillicn {\uchar4{61}}
-\definecharacter cyrillico {\uchar4{62}}
-\definecharacter cyrillicp {\uchar4{63}}
-\definecharacter cyrillicr {\uchar4{64}}
-\definecharacter cyrillics {\uchar4{65}}
-\definecharacter cyrillict {\uchar4{66}}
-\definecharacter cyrillicu {\uchar4{67}}
-\definecharacter cyrillicf {\uchar4{68}}
-\definecharacter cyrillich {\uchar4{69}}
-\definecharacter cyrillicc {\uchar4{70}}
-\definecharacter cyrillicch {\uchar4{71}}
-\definecharacter cyrillicsh {\uchar4{72}}
-\definecharacter cyrillicshch {\uchar4{73}}
-\definecharacter cyrillichrdsn {\uchar4{74}}
-\definecharacter cyrillicery {\uchar4{75}}
-\definecharacter cyrillicsftsn {\uchar4{76}}
-\definecharacter cyrillicerev {\uchar4{77}}
-\definecharacter cyrillicyu {\uchar4{78}}
-\definecharacter cyrillicya {\uchar4{79}}
-
-%D I tried to figure out what these were, but the unicode
-%D tables suggested they were the same as cyrillici, which was
-%D already defined! So, a temporary definition:
-
-% \def\cyrillicII{\cyrillicI}
-% \def\cyrillicii{\cyrillici}
-
-%D a guess derived from looking at enco-cyr suggests that this is
-%D identical to the Roman I/i pair. To me, that sounds like
-%D CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I in the UC tables!
-
-\definecharacter cyrillicII {\uchar4{6}}
-\definecharacter cyrillicii {\uchar4{86}}
-
-%D Guessing that tlir6a corresponds with t2a encoding as advertised,
-%D here are some more, cos I had some spare time: (AL)
-
-\definecharacter cyrillicDJE {\uchar4{2}}
-\definecharacter cyrillicTSHE {\uchar4{11}}
-%definecharacter cyrillicSHHA 132
-%definecharacter cyrillicZHDSC 133
-\definecharacter cyrillicZDSC {\uchar4{152}}
-\definecharacter cyrillicLJE {\uchar4{9}}
-\definecharacter cyrillicYI {\uchar4{7}}
-\definecharacter cyrillicAE {\uchar4{212}}
-%definecharacter cyrillicNDSC 141
-%definecharacter cyrillicNG 142
-\definecharacter cyrillicDZE {\uchar4{5}}
-%definecharacter cyrillicOTLD 144
-\definecharacter cyrillicSDSC {\uchar4{170}}
-\definecharacter cyrillicUSHRT {\uchar4{14}}
-%definecharacter cyrillicY 147
-%definecharacter cyrillicYHCRS 148
-%definecharacter cyrillicHDSC 149
-\definecharacter cyrillicDZHE {\uchar4{15}}
-\definecharacter cyrillicIE {\uchar4{4}}
-\definecharacter cyrillicNJE {\uchar4{10}}
-\definecharacter cyrillicYO {\uchar4{1}}
-
-\definecharacter cyrillicdje {\uchar4{82}}
-\definecharacter cyrillictshe {\uchar4{91}}
-%definecharacter cyrillicshha 164
-%definecharacter cyrilliczhdsc 165
-\definecharacter cyrilliczdsc {\uchar4{153}}
-\definecharacter cyrilliclje {\uchar4{89}}
-\definecharacter cyrillicyi {\uchar4{87}}
-\definecharacter cyrillicae {\uchar4{213}}
-%definecharacter cyrillicndsc 173
-%definecharacter cyrillicng 174
-\definecharacter cyrillicdze {\uchar4{85}}
-%definecharacter cyrillicotld 176
-\definecharacter cyrillicsdsc {\uchar4{171}}
-\definecharacter cyrillicushrt {\uchar4{94}}
-%definecharacter cyrillicy 179
-%definecharacter cyrillicyhcrs 180
-%definecharacter cyrillichdsc 181
-\definecharacter cyrillicdzhe {\uchar4{95}}
-\definecharacter cyrillicie {\uchar4{84}}
-\definecharacter cyrillicnje {\uchar4{90}}
-\definecharacter cyrillicyo {\uchar4{81}}
-
-% is there overlap with the above definitions
-
-\definecharacter cyrillicEgrave {\uchar4{0}}
-\definecharacter cyrillicGJE {\uchar4{3}}
-\definecharacter cyrillicJE {\uchar4{8}}
-\definecharacter cyrillicKJE {\uchar4{12}}
-\definecharacter cyrillicIgrave {\uchar4{13}}
-\definecharacter cyrillicegrave {\uchar4{80}}
-\definecharacter cyrillicgje {\uchar4{83}}
-\definecharacter cyrillicje {\uchar4{88}}
-\definecharacter cyrillickje {\uchar4{92}}
-\definecharacter cyrillicigrave {\uchar4{93}}
-\definecharacter cyrillicOMEGA {\uchar4{96}}
-\definecharacter cyrillicomega {\uchar4{97}}
-\definecharacter cyrillicYAT {\uchar4{98}}
-\definecharacter cyrillicyat {\uchar4{99}}
-\definecharacter cyrillicEiotified {\uchar4{100}}
-\definecharacter cyrilliceiotified {\uchar4{101}}
-\definecharacter cyrillicLITTLEYUS {\uchar4{102}}
-\definecharacter cyrilliclittleyus {\uchar4{103}}
-\definecharacter cyrillicLITTLEYUSiotified {\uchar4{104}}
-\definecharacter cyrilliclittleyusiotified {\uchar4{105}}
-\definecharacter cyrillicBIGYUS {\uchar4{106}}
-\definecharacter cyrillicbigyus {\uchar4{107}}
-\definecharacter cyrillicBIGYUSiotified {\uchar4{108}}
-\definecharacter cyrillicbigyusiotified {\uchar4{109}}
-\definecharacter cyrillicKSI {\uchar4{110}}
-\definecharacter cyrillicksi {\uchar4{111}}
-\definecharacter cyrillicPSI {\uchar4{112}}
-\definecharacter cyrillicpsi {\uchar4{113}}
-\definecharacter cyrillicFITA {\uchar4{114}}
-\definecharacter cyrillicfita {\uchar4{115}}
-\definecharacter cyrillicIZHITSA {\uchar4{116}}
-\definecharacter cyrillicizhitsa {\uchar4{117}}
-\definecharacter cyrillicIZHITSAdoublegrave {\uchar4{118}}
-\definecharacter cyrillicizhitsadoublegrave {\uchar4{119}}
-\definecharacter cyrillicUK {\uchar4{120}}
-\definecharacter cyrillicuk {\uchar4{121}}
-\definecharacter cyrillicOMEGAround {\uchar4{122}}
-\definecharacter cyrillicomegaround {\uchar4{123}}
-\definecharacter cyrillicOMEGAtitlo {\uchar4{124}}
-\definecharacter cyrillicomegatitlo {\uchar4{125}}
-\definecharacter cyrillicOT {\uchar4{126}}
-\definecharacter cyrillicot {\uchar4{127}}
-\definecharacter cyrillicKOPPA {\uchar4{128}}
-\definecharacter cyrillickoppa {\uchar4{129}}
-\definecharacter cyrillicTITLO {\uchar4{131}}
-\definecharacter cyrillicPALATALIZATION {\uchar4{132}}
-\definecharacter cyrillicDASIAPNEUMATA {\uchar4{133}}
-\definecharacter cyrillicPSILIPNEUMATA {\uchar4{134}}
-\definecharacter cyrillicISHRTtail {\uchar4{138}}
-\definecharacter cyrillicishrttail {\uchar4{139}}
-\definecharacter cyrillicSEMISOFT {\uchar4{140}}
-\definecharacter cyrillicsemisoft {\uchar4{141}}
-\definecharacter cyrillicERtick {\uchar4{142}}
-\definecharacter cyrillicertick {\uchar4{143}}
-\definecharacter cyrillicGHEupturn {\uchar4{144}}
-\definecharacter cyrillicgheupturn {\uchar4{145}}
-\definecharacter cyrillicGHEstroke {\uchar4{146}}
-\definecharacter cyrillicghestroke {\uchar4{147}}
-\definecharacter cyrillicGHEmidhook {\uchar4{148}}
-\definecharacter cyrillicghemidhook {\uchar4{149}}
-\definecharacter cyrillicZHEdescender {\uchar4{150}}
-\definecharacter cyrilliczhedescender {\uchar4{151}}
-\definecharacter cyrillicZDSC {\uchar4{152}}
-\definecharacter cyrilliczdsc {\uchar4{153}}
-\definecharacter cyrillicKADC {\uchar4{154}}
-\definecharacter cyrillickadc {\uchar4{155}}
-\definecharacter cyrillicKAvertstroke {\uchar4{156}}
-\definecharacter cyrillickavertstroke {\uchar4{157}}
-\definecharacter cyrillicKAstroke {\uchar4{158}}
-\definecharacter cyrillickastroke {\uchar4{159}}
-\definecharacter cyrillicKAbashkir {\uchar4{160}}
-\definecharacter cyrillickabashkir {\uchar4{161}}
-\definecharacter cyrillicENDC {\uchar4{162}}
-\definecharacter cyrillicendc {\uchar4{163}}
-\definecharacter cyrillicENGHE {\uchar4{164}}
-\definecharacter cyrillicenghe {\uchar4{165}}
-\definecharacter cyrillicPEmidhook {\uchar4{166}}
-\definecharacter cyrillicpemidhook {\uchar4{167}}
-\definecharacter cyrillicHA {\uchar4{168}}
-\definecharacter cyrillicha {\uchar4{169}}
-%definecharacter cyrillicSDSC {\uchar4{170}} % already defined
-%definecharacter cyrilliccdsc {\uchar4{171}} % already defined
-\definecharacter cyrillicTEDC {\uchar4{172}}
-\definecharacter cyrillictedc {\uchar4{173}}
-\definecharacter cyrillicYstr {\uchar4{174}}
-\definecharacter cyrillicystr {\uchar4{175}}
-\definecharacter cyrillicYstrstroke {\uchar4{176}}
-\definecharacter cyrillicystrstroke {\uchar4{177}}
-\definecharacter cyrillicHADC {\uchar4{178}}
-\definecharacter cyrillichadc {\uchar4{179}}
-\definecharacter cyrillicTETSE {\uchar4{180}}
-\definecharacter cyrillictetse {\uchar4{181}}
-\definecharacter cyrillicCHEDC {\uchar4{182}}
-\definecharacter cyrillicchedc {\uchar4{183}}
-\definecharacter cyrillicCHEvertstroke {\uchar4{184}}
-\definecharacter cyrillicchevertstroke {\uchar4{185}}
-\definecharacter cyrillicSHHA {\uchar4{186}}
-\definecharacter cyrillicshha {\uchar4{187}}
-\definecharacter cyrillicCHEabkhasian {\uchar4{188}}
-\definecharacter cyrilliccheabkhasian {\uchar4{189}}
-\definecharacter cyrillicCHEDCabkhasian {\uchar4{190}}
-\definecharacter cyrillicchedcabkhasian {\uchar4{191}}
-\definecharacter cyrillicPALOCHKA {\uchar4{192}}
-\definecharacter cyrillicZHEbreve {\uchar4{193}}
-\definecharacter cyrilliczhebreve {\uchar4{194}}
-\definecharacter cyrillicKAhook {\uchar4{195}}
-\definecharacter cyrillickahook {\uchar4{196}}
-\definecharacter cyrillicELtail {\uchar4{197}}
-\definecharacter cyrilliceltail {\uchar4{198}}
-\definecharacter cyrillicENhook {\uchar4{199}}
-\definecharacter cyrillicenhook {\uchar4{200}}
-\definecharacter cyrillicENtail {\uchar4{201}}
-\definecharacter cyrillicentail {\uchar4{202}}
-\definecharacter cyrillicCHEkhakassian {\uchar4{203}}
-\definecharacter cyrillicchekhakassian {\uchar4{204}}
-\definecharacter cyrillicEMtail {\uchar4{205}}
-\definecharacter cyrillicemtail {\uchar4{206}}
-\definecharacter cyrillicAbreve {\uchar4{208}}
-\definecharacter cyrillicabreve {\uchar4{209}}
-\definecharacter cyrillicAdiaeresis {\uchar4{210}}
-\definecharacter cyrillicadiaeresis {\uchar4{211}}
-%definecharacter cyrillicAE {\uchar4{212}} % already defined
-%definecharacter cyrillicae {\uchar4{213}} % already defined
-\definecharacter cyrillicEbreve {\uchar4{214}}
-\definecharacter cyrillicebreve {\uchar4{215}}
-\definecharacter cyrillicSCHWA {\uchar4{216}}
-\definecharacter cyrillicschwa {\uchar4{217}}
-\definecharacter cyrillicSCHWAdiaeresis {\uchar4{218}}
-\definecharacter cyrillicschwadiaeresis {\uchar4{219}}
-\definecharacter cyrillicZHEdiaeresis {\uchar4{220}}
-\definecharacter cyrilliczhediaeresis {\uchar4{221}}
-\definecharacter cyrillicZEdiaeresis {\uchar4{222}}
-\definecharacter cyrilliczediaeresis {\uchar4{223}}
-\definecharacter cyrillicDZEabkhasian {\uchar4{224}}
-\definecharacter cyrillicdzeabkhasian {\uchar4{225}}
-\definecharacter cyrillicImacron {\uchar4{226}}
-\definecharacter cyrillicimacron {\uchar4{227}}
-\definecharacter cyrillicIdiaeresis {\uchar4{228}}
-\definecharacter cyrillicidiaeresis {\uchar4{229}}
-\definecharacter cyrillicOdiaeresis {\uchar4{230}}
-\definecharacter cyrillicodiaeresis {\uchar4{231}}
-\definecharacter cyrillicObarred {\uchar4{232}}
-\definecharacter cyrillicobarred {\uchar4{233}}
-\definecharacter cyrillicObarreddiaeresis {\uchar4{234}}
-\definecharacter cyrillicobarreddiaeresis {\uchar4{235}}
-\definecharacter cyrillicEdiaeresis {\uchar4{236}}
-\definecharacter cyrillicediaeresis {\uchar4{237}}
-\definecharacter cyrillicUmacron {\uchar4{238}}
-\definecharacter cyrillicumacron {\uchar4{239}}
-\definecharacter cyrillicUdiaeresis {\uchar4{240}}
-\definecharacter cyrillicudiaeresis {\uchar4{241}}
-\definecharacter cyrillicUdoubleacute {\uchar4{242}}
-\definecharacter cyrillicudoubleacute {\uchar4{243}}
-\definecharacter cyrillicCHEdiaeresis {\uchar4{244}}
-\definecharacter cyrillicchediaeresis {\uchar4{245}}
-\definecharacter cyrillicYERUdiaeresis {\uchar4{248}}
-\definecharacter cyrillicyerudiaeresis {\uchar4{249}}
-
-\stopencoding
-
-% Greek Extended
-
-\startencoding[uc]
-
-\definecharacter greekalphapsili {\uchar{31}{0}}
-\definecharacter greekalphadasia {\uchar{31}{1}}
-\definecharacter greekalphapsilivaria {\uchar{31}{2}}
-\definecharacter greekalphadasiavaria {\uchar{31}{3}}
-\definecharacter greekalphapsilitonos {\uchar{31}{4}}
-\definecharacter greekalphadasiatonos {\uchar{31}{5}}
-\definecharacter greekalphapsiliperispomeni {\uchar{31}{6}}
-\definecharacter greekalphadasiaperispomeni {\uchar{31}{7}}
-\definecharacter greekAlphapsili {\uchar{31}{8}}
-\definecharacter greekAlphadasia {\uchar{31}{9}}
-\definecharacter greekAlphapsilivaria {\uchar{31}{10}}
-\definecharacter greekAlphadasiavaria {\uchar{31}{11}}
-\definecharacter greekAlphapsilitonos {\uchar{31}{12}}
-\definecharacter greekAlphadasiatonos {\uchar{31}{13}}
-\definecharacter greekAlphapsiliperispomeni {\uchar{31}{14}}
-\definecharacter greekAlphadasiaperispomeni {\uchar{31}{15}}
-\definecharacter greekepsilonpsili {\uchar{31}{16}} % 1f10
-\definecharacter greekepsilondasia {\uchar{31}{17}}
-\definecharacter greekepsilonpsilivaria {\uchar{31}{18}}
-\definecharacter greekepsilondasiavaria {\uchar{31}{19}}
-\definecharacter greekepsilonpsilitonos {\uchar{31}{20}}
-\definecharacter greekepsilondasiatonos {\uchar{31}{21}}
-\definecharacter greekEpsilonpsili {\uchar{31}{24}}
-\definecharacter greekEpsilondasia {\uchar{31}{25}}
-\definecharacter greekEpsilonpsilivaria {\uchar{31}{26}}
-\definecharacter greekEpsilondasiavaria {\uchar{31}{27}}
-\definecharacter greekEpsilonpsilitonos {\uchar{31}{28}}
-\definecharacter greekEpsilondasiatonos {\uchar{31}{29}}
-\definecharacter greeketapsili {\uchar{31}{32}} % 1f20
-\definecharacter greeketadasia {\uchar{31}{33}}
-\definecharacter greeketapsilivaria {\uchar{31}{34}}
-\definecharacter greeketadasiavaria {\uchar{31}{35}}
-\definecharacter greeketapsilitonos {\uchar{31}{36}}
-\definecharacter greeketadasiatonos {\uchar{31}{37}}
-\definecharacter greeketapsiliperispomeni {\uchar{31}{38}}
-\definecharacter greeketadasiaperispomeni {\uchar{31}{39}}
-\definecharacter greekEtapsili {\uchar{31}{40}}
-\definecharacter greekEtadasia {\uchar{31}{41}}
-\definecharacter greekEtapsilivaria {\uchar{31}{42}}
-\definecharacter greekEtadasiavaria {\uchar{31}{43}}
-\definecharacter greekEtapsilitonos {\uchar{31}{44}}
-\definecharacter greekEtadasiatonos {\uchar{31}{45}}
-\definecharacter greekEtapsiliperispomeni {\uchar{31}{46}}
-\definecharacter greekEtadasiaperispomeni {\uchar{31}{47}}
-\definecharacter greekiotapsili {\uchar{31}{48}} % 1f30
-\definecharacter greekiotadasia {\uchar{31}{49}}
-\definecharacter greekiotapsilivaria {\uchar{31}{50}}
-\definecharacter greekiotadasiavaria {\uchar{31}{51}}
-\definecharacter greekiotapsilitonos {\uchar{31}{52}}
-\definecharacter greekiotadasiatonos {\uchar{31}{53}}
-\definecharacter greekiotapsiliperispomeni {\uchar{31}{54}}
-\definecharacter greekiotadasiaperispomeni {\uchar{31}{55}}
-\definecharacter greekIotapsili {\uchar{31}{56}}
-\definecharacter greekIotadasia {\uchar{31}{57}}
-\definecharacter greekIotapsilivaria {\uchar{31}{58}}
-\definecharacter greekIotadasiavaria {\uchar{31}{59}}
-\definecharacter greekIotapsilitonos {\uchar{31}{60}}
-\definecharacter greekIotadasiatonos {\uchar{31}{61}}
-\definecharacter greekIotapsiliperispomeni {\uchar{31}{62}}
-\definecharacter greekIotadasiaperispomeni {\uchar{31}{63}}
-\definecharacter greekomicronpsili {\uchar{31}{64}} % 1f40
-\definecharacter greekomicrondasia {\uchar{31}{65}}
-\definecharacter greekomicronpsilivaria {\uchar{31}{66}}
-\definecharacter greekomicrondasiavaria {\uchar{31}{67}}
-\definecharacter greekomicronpsilitonos {\uchar{31}{68}}
-\definecharacter greekomicrondasiatonos {\uchar{31}{69}}
-\definecharacter greekOmicronpsili {\uchar{31}{72}}
-\definecharacter greekOmicrondasia {\uchar{31}{73}}
-\definecharacter greekOmicronpsilivaria {\uchar{31}{74}}
-\definecharacter greekOmicrondasiavaria {\uchar{31}{75}}
-\definecharacter greekOmicronpsilitonos {\uchar{31}{76}}
-\definecharacter greekOmicrondasiatonos {\uchar{31}{77}}
-\definecharacter greekupsilonpsili {\uchar{31}{80}} % 1f50
-\definecharacter greekupsilondasia {\uchar{31}{81}}
-\definecharacter greekupsilonpsilivaria {\uchar{31}{82}}
-\definecharacter greekupsilondasiavaria {\uchar{31}{83}}
-\definecharacter greekupsilonpsilitonos {\uchar{31}{84}}
-\definecharacter greekupsilondasiatonos {\uchar{31}{85}}
-\definecharacter greekupsilonpsiliperispomeni {\uchar{31}{86}}
-\definecharacter greekupsilondasiaperispomeni {\uchar{31}{87}}
-\definecharacter greekUpsilondasia {\uchar{31}{89}}
-\definecharacter greekUpsilondasiavaria {\uchar{31}{91}}
-\definecharacter greekUpsilondasiatonos {\uchar{31}{93}}
-\definecharacter greekUpsilondasiaperispomeni {\uchar{31}{95}}
-\definecharacter greekomegapsili {\uchar{31}{96}} % 1f60
-\definecharacter greekomegadasia {\uchar{31}{97}}
-\definecharacter greekomegapsilivaria {\uchar{31}{98}}
-\definecharacter greekomegadasiavaria {\uchar{31}{99}}
-\definecharacter greekomegapsilitonos {\uchar{31}{100}}
-\definecharacter greekomegadasiatonos {\uchar{31}{101}}
-\definecharacter greekomegapsiliperispomeni {\uchar{31}{102}}
-\definecharacter greekomegadasiaperispomeni {\uchar{31}{103}}
-\definecharacter greekOmegapsili {\uchar{31}{104}}
-\definecharacter greekOmegadasia {\uchar{31}{105}}
-\definecharacter greekOmegapsilivaria {\uchar{31}{106}}
-\definecharacter greekOmegadasiavaria {\uchar{31}{107}}
-\definecharacter greekOmegapsilitonos {\uchar{31}{108}}
-\definecharacter greekOmegadasiatonos {\uchar{31}{109}}
-\definecharacter greekOmegapsiliperispomeni {\uchar{31}{110}}
-\definecharacter greekOmegadasiaperispomeni {\uchar{31}{111}}
-\definecharacter greekalphavaria {\uchar{31}{112}} % 1f70
-\definecharacter greekalphaoxia {\uchar{31}{113}}
-\definecharacter greekepsilonvaria {\uchar{31}{114}}
-\definecharacter greekepsilonoxia {\uchar{31}{115}}
-\definecharacter greeketavaria {\uchar{31}{116}}
-\definecharacter greeketaoxia {\uchar{31}{117}}
-\definecharacter greekiotavaria {\uchar{31}{118}}
-\definecharacter greekiotaoxia {\uchar{31}{119}}
-\definecharacter greekomicronvaria {\uchar{31}{120}}
-\definecharacter greekomicronoxia {\uchar{31}{121}}
-\definecharacter greekupsilonvaria {\uchar{31}{122}}
-\definecharacter greekupsilonoxia {\uchar{31}{123}}
-\definecharacter greekomegavaria {\uchar{31}{124}}
-\definecharacter greekomegaoxia {\uchar{31}{125}}
-\definecharacter greekalphaiotasubpsili {\uchar{31}{128}} % 1f80
-\definecharacter greekalphaiotasubdasia {\uchar{31}{129}}
-\definecharacter greekalphaiotasubpsilivaria {\uchar{31}{130}}
-\definecharacter greekalphaiotasubdasiavaria {\uchar{31}{131}}
-\definecharacter greekalphaiotasubpsilitonos {\uchar{31}{132}}
-\definecharacter greekalphaiotasubdasiatonos {\uchar{31}{133}}
-\definecharacter greekalphaiotasubpsiliperispomeni {\uchar{31}{134}}
-\definecharacter greekalphaiotasubdasiaperispomeni {\uchar{31}{135}}
-\definecharacter greekAlphaiotasubpsili {\uchar{31}{136}}
-\definecharacter greekAlphaiotasubdasia {\uchar{31}{137}}
-\definecharacter greekAlphaiotasubpsilivaria {\uchar{31}{138}}
-\definecharacter greekAlphaiotasubdasiavaria {\uchar{31}{139}}
-\definecharacter greekAlphaiotasubpsilitonos {\uchar{31}{140}}
-\definecharacter greekAlphaiotasubdasiatonos {\uchar{31}{141}}
-\definecharacter greekAlphaiotasubpsiliperispomeni {\uchar{31}{142}}
-\definecharacter greekAlphaiotasubdasiaperispomeni {\uchar{31}{143}}
-\definecharacter greeketaiotasubpsili {\uchar{31}{144}} % 1f90
-\definecharacter greeketaiotasubdasia {\uchar{31}{145}}
-\definecharacter greeketaiotasubpsilivaria {\uchar{31}{146}}
-\definecharacter greeketaiotasubdasiavaria {\uchar{31}{147}}
-\definecharacter greeketaiotasubpsilitonos {\uchar{31}{148}}
-\definecharacter greeketaiotasubdasiatonos {\uchar{31}{149}}
-\definecharacter greeketaiotasubpsiliperispomeni {\uchar{31}{150}}
-\definecharacter greeketaiotasubdasiaperispomeni {\uchar{31}{151}}
-\definecharacter greekEtaiotasubpsili {\uchar{31}{152}}
-\definecharacter greekEtaiotasubdasia {\uchar{31}{153}}
-\definecharacter greekEtaiotasubpsilivaria {\uchar{31}{154}}
-\definecharacter greekEtaiotasubdasiavaria {\uchar{31}{155}}
-\definecharacter greekEtaiotasubpsilitonos {\uchar{31}{156}}
-\definecharacter greekEtaiotasubdasiatonos {\uchar{31}{157}}
-\definecharacter greekEtaiotasubpsiliperispomeni {\uchar{31}{158}}
-\definecharacter greekEtaiotasubdasiaperispomeni {\uchar{31}{159}}
-\definecharacter greekomegaiotasubpsili {\uchar{31}{160}} % 1fa0
-\definecharacter greekomegaiotasubdasia {\uchar{31}{161}}
-\definecharacter greekomegaiotasubpsilivaria {\uchar{31}{162}}
-\definecharacter greekomegaiotasubdasiavaria {\uchar{31}{163}}
-\definecharacter greekomegaiotasubpsilitonos {\uchar{31}{164}}
-\definecharacter greekomegaiotasubdasiatonos {\uchar{31}{165}}
-\definecharacter greekomegaiotasubpsiliperispomeni {\uchar{31}{166}}
-\definecharacter greekomegaiotasubdasiaperispomeni {\uchar{31}{167}}
-\definecharacter greekOmegaiotasubpsili {\uchar{31}{168}}
-\definecharacter greekOmegaiotasubdasia {\uchar{31}{169}}
-\definecharacter greekOmegaiotasubpsilivaria {\uchar{31}{170}}
-\definecharacter greekOmegaiotasubdasiavaria {\uchar{31}{171}}
-\definecharacter greekOmegaiotasubpsilitonos {\uchar{31}{172}}
-\definecharacter greekOmegaiotasubdasiatonos {\uchar{31}{173}}
-\definecharacter greekOmegaiotasubpsiliperispomeni {\uchar{31}{174}}
-\definecharacter greekOmegaiotasubdasiaperispomeni {\uchar{31}{175}}
-\definecharacter greekalphavrachy {\uchar{31}{176}} % 1fb0
-\definecharacter greekalphamacron {\uchar{31}{177}}
-\definecharacter greekalphaiotasubvaria {\uchar{31}{178}}
-\definecharacter greekalphaiotasub {\uchar{31}{179}}
-\definecharacter greekalphaiotasubtonos {\uchar{31}{180}}
-\definecharacter greekalphaperispomeni {\uchar{31}{182}}
-\definecharacter greekalphaiotasubperispomeni {\uchar{31}{183}}
-\definecharacter greekAlphavrachy {\uchar{31}{184}}
-\definecharacter greekAlphamacron {\uchar{31}{185}}
-\definecharacter greekAlphavaria {\uchar{31}{186}}
-\definecharacter greekAlphatonos {\uchar{31}{187}}
-\definecharacter greekAlphaiotasub {\uchar{31}{188}}
-\definecharacter greekCoronis {\uchar{31}{189}}
-\definecharacter greekprosgegrammeni {\uchar{31}{190}}
-\definecharacter greekpsili {\uchar{31}{191}}
-\definecharacter greekperispomeni {\uchar{31}{192}} % 1fc0
-\definecharacter greekdialytikaperispomeni {\uchar{31}{193}}
-\definecharacter greeketaiotasubvaria {\uchar{31}{194}}
-\definecharacter greeketaiotasub {\uchar{31}{195}}
-\definecharacter greeketaiotasubtonos {\uchar{31}{196}}
-\definecharacter greeketaperispomeni {\uchar{31}{198}}
-\definecharacter greeketaiotasubperispomeni {\uchar{31}{199}}
-\definecharacter greekEpsilonvaria {\uchar{31}{200}}
-\definecharacter greekEpsilontonos {\uchar{31}{201}}
-\definecharacter greekEtavaria {\uchar{31}{202}}
-\definecharacter greekEtatonos {\uchar{31}{203}}
-\definecharacter greekEtaiotasub {\uchar{31}{204}}
-\definecharacter greekpsilivaria {\uchar{31}{205}}
-\definecharacter greekpsilitonos {\uchar{31}{206}}
-\definecharacter greekpsiliperispomeni {\uchar{31}{207}}
-\definecharacter greekiotavrachy {\uchar{31}{208}} % 1fd0
-\definecharacter greekiotamacron {\uchar{31}{209}}
-\definecharacter greekiotadialytikavaria {\uchar{31}{210}}
-\definecharacter greekiotadialytikatonos {\uchar{31}{211}}
-\definecharacter greekiotaperispomeni {\uchar{31}{214}}
-\definecharacter greekiotadialytikaperispomeni {\uchar{31}{215}}
-\definecharacter greekIotavrachy {\uchar{31}{216}}
-\definecharacter greekIotamacron {\uchar{31}{217}}
-\definecharacter greekIotavaria {\uchar{31}{218}}
-\definecharacter greekIotatonos {\uchar{31}{219}}
-\definecharacter greekdasiavaria {\uchar{31}{221}}
-\definecharacter greekdasiatonos {\uchar{31}{222}}
-\definecharacter greekdasiaperispomeni {\uchar{31}{223}}
-\definecharacter greekupsilonvrachy {\uchar{31}{224}} % 1fe0
-\definecharacter greekupsilonmacron {\uchar{31}{225}}
-\definecharacter greekupsilondialytikavaria {\uchar{31}{226}}
-\definecharacter greekupsilondialytikatonos {\uchar{31}{227}}
-\definecharacter greekrhopsili {\uchar{31}{228}}
-\definecharacter greekrhodasia {\uchar{31}{229}}
-\definecharacter greekupsilonperispomeni {\uchar{31}{230}}
-\definecharacter greekupsilondialytikaperispomeni {\uchar{31}{231}}
-\definecharacter greekUpsilonvrachy {\uchar{31}{232}}
-\definecharacter greekUpsilonmacron {\uchar{31}{233}}
-\definecharacter greekUpsilonvaria {\uchar{31}{234}}
-\definecharacter greekUpsilontonos {\uchar{31}{235}}
-\definecharacter greekRhodasia {\uchar{31}{236}}
-\definecharacter greekdialytikavaria {\uchar{31}{237}}
-\definecharacter greekdialytikatonos {\uchar{31}{238}}
-\definecharacter greekvaria {\uchar{31}{239}}
-\definecharacter greekomegaiotasubvaria {\uchar{31}{242}}
-\definecharacter greekomegaiotasub {\uchar{31}{243}}
-\definecharacter greekomegaiotasubtonos {\uchar{31}{244}}
-\definecharacter greekomegaperispomeni {\uchar{31}{246}}
-\definecharacter greekomegaiotasubperispomeni {\uchar{31}{247}}
-\definecharacter greekOmicronvaria {\uchar{31}{248}}
-\definecharacter greekOmicrontonos {\uchar{31}{249}}
-\definecharacter greekOmegavaria {\uchar{31}{250}}
-\definecharacter greekOmegatonos {\uchar{31}{251}}
-\definecharacter greekOmegaiotasub {\uchar{31}{252}}
-\definecharacter greekoxia {\uchar{31}{253}}
-\definecharacter greekdasia {\uchar{31}{254}}
-\definecharacter greeksigmalunate {\uchar3{242}}
-\definecharacter greekSigmalunate {\uchar3{249}}
-\definecharacter greeksampi {\uchar3{225}}
-\definecharacter greekdigamma {\uchar3{221}}
-\definecharacter greekstigma {\uchar3{219}}
-\definecharacter greeknumkoppa {\uchar3{223}}
-\definecharacter greekkoppa {\uchar3{217}}
-\definecharacter greekupsilondiaeresis {\uchar3{203}}
-
-\stopencoding
-
-% Hebrew:
-
-\startencoding[uc]
-
-\definecharacter hebrewAlef {\uchar5{208}} % 05D0
-\definecharacter hebrewBet {\uchar5{209}}
-\definecharacter hebrewGimel {\uchar5{210}}
-\definecharacter hebrewDalet {\uchar5{211}}
-\definecharacter hebrewHe {\uchar5{212}}
-\definecharacter hebrewVav {\uchar5{213}}
-\definecharacter hebrewZayin {\uchar5{214}}
-\definecharacter hebrewHet {\uchar5{215}}
-\definecharacter hebrewTet {\uchar5{216}}
-\definecharacter hebrewYod {\uchar5{217}}
-\definecharacter hebrewKaffinal {\uchar5{218}}
-\definecharacter hebrewKaf {\uchar5{219}}
-\definecharacter hebrewLamed {\uchar5{220}}
-\definecharacter hebrewMemfinal {\uchar5{221}}
-\definecharacter hebrewMem {\uchar5{222}}
-\definecharacter hebrewNunfinal {\uchar5{223}}
-\definecharacter hebrewNun {\uchar5{224}}
-\definecharacter hebrewSamekh {\uchar5{225}}
-\definecharacter hebrewAyin {\uchar5{226}}
-\definecharacter hebrewPefinal {\uchar5{227}}
-\definecharacter hebrewPe {\uchar5{228}}
-\definecharacter hebrewTsadifinal {\uchar5{229}}
-\definecharacter hebrewTsadi {\uchar5{230}}
-\definecharacter hebrewQof {\uchar5{231}}
-\definecharacter hebrewResh {\uchar5{232}}
-\definecharacter hebrewShin {\uchar5{233}}
-\definecharacter hebrewTav {\uchar5{234}} % 05EA
-
-\stopencoding
-
-\endinput
diff --git a/tex/context/base/enco-vis.mkii b/tex/context/base/enco-vis.mkii
new file mode 100644
index 000000000..3c1fd7765
--- /dev/null
+++ b/tex/context/base/enco-vis.mkii
@@ -0,0 +1,3 @@
+% temporary module, needed for downward compatibility
+
+\input regi-vis.tex \enableregime[viscii] \endinput
diff --git a/tex/context/base/enco-vis.tex b/tex/context/base/enco-vis.tex
deleted file mode 100644
index 3c1fd7765..000000000
--- a/tex/context/base/enco-vis.tex
+++ /dev/null
@@ -1,3 +0,0 @@
-% temporary module, needed for downward compatibility
-
-\input regi-vis.tex \enableregime[viscii] \endinput
diff --git a/tex/context/base/enco-vna.mkii b/tex/context/base/enco-vna.mkii
new file mode 100644
index 000000000..05753f37b
--- /dev/null
+++ b/tex/context/base/enco-vna.mkii
@@ -0,0 +1,145 @@
+%D \module
+%D [ file=enco-vna,
+%D version=1999.12.12,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Vietnamese Accents,
+%D author=Han The Thanh & Adam Lindsay & Hans Hagen,
+%D date=\currentdate,
+%D copyright=PRAGMA]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This module is originally derived from the some files Han The Thanh
+%D prepared for \LATEX. The dual accent support is still preliminary,
+%D but works ok. It's now adapted to named glyphs, and is activated by
+%D \type {\useencoding[thisfile]}.
+
+%D This was apparently buggy from the start: there is nothing to
+%D disambiguate \type {\ohorn} from \type {\ohook}. Both are entered
+%D with \type {\h{o}} (AL)!
+
+%D Once stable, this code will move to \type {enco-acc.tex}.
+
+\startencoding[default]
+
+\defineaccent h A {\Ahook}
+\defineaccent d A {\Adotbelow}
+\defineaccent ` ^A {\Acircumflexgrave}
+\defineaccent ' ^A {\Acircumflexacute}
+\defineaccent ~ ^A {\Acircumflextilde}
+\defineaccent h ^A {\Acircumflexhook}
+\defineaccent d ^A {\Acircumflexdotbelow}
+\defineaccent ` uA {\Abrevegrave}
+\defineaccent ' uA {\Abreveacute}
+\defineaccent ~ uA {\Abrevetilde}
+\defineaccent h uA {\Abrevehook}
+\defineaccent d uA {\Abrevedotbelow}
+\defineaccent h E {\Ehook}
+\defineaccent d E {\Edotbelow}
+\defineaccent ` ^E {\Ecircumflexgrave}
+\defineaccent ' ^E {\Ecircumflexacute}
+\defineaccent ~ ^E {\Ecircumflextilde}
+\defineaccent h ^E {\Ecircumflexhook}
+\defineaccent d ^E {\Ecircumflexdotbelow}
+\defineaccent h I {\Ihook}
+\defineaccent d I {\Idotbelow}
+\defineaccent h O {\Ohook}
+\defineaccent d O {\Odotbelow}
+\defineaccent ` ^O {\Ocircumflexgrave}
+\defineaccent ' ^O {\Ocircumflexacute}
+\defineaccent ~ ^O {\Ocircumflextilde}
+\defineaccent h ^O {\Ocircumflexhook}
+\defineaccent d ^O {\Ocircumflexdotbelow}
+%defineaccent h O {\Ohorn} % !!! conflict with \Ohook!
+\defineaccent ` hO {\Ohorngrave}
+\defineaccent ` {\Ohorn} {\Ohorngrave}
+\defineaccent ' hO {\Ohornacute}
+\defineaccent ' {\Ohorn} {\Ohornacute}
+\defineaccent ~ hO {\Ohorntilde}
+\defineaccent ~ {\Ohorn} {\Ohorntilde}
+\defineaccent h hO {\Ohornhook}
+\defineaccent h {\Ohorn} {\Ohornhook}
+\defineaccent d hO {\Ohorndotbelow}
+\defineaccent d {\Ohorn} {\Ohorndotbelow}
+\defineaccent h U {\Uhook}
+\defineaccent d U {\Udotbelow}
+%defineaccent h U {\Uhorn} % !!! conflict with \Uhook! honestly, people!
+\defineaccent ` hU {\Uhorngrave}
+\defineaccent ` {\Uhorn} {\Uhorngrave}
+\defineaccent ' hU {\Uhornacute}
+\defineaccent ' {\Uhorn} {\Uhornacute}
+\defineaccent ~ hU {\Uhorntilde}
+\defineaccent ~ {\Uhorn} {\Uhorntilde}
+\defineaccent h hU {\Uhornhook}
+\defineaccent h {\Uhorn} {\Uhornhook}
+\defineaccent d hU {\Uhorndotbelow}
+\defineaccent d {\Uhorn} {\Uhorndotbelow}
+\defineaccent ` Y {\Ygrave}
+\defineaccent ' Y {\Yacute}
+\defineaccent ~ Y {\Ytilde}
+\defineaccent h Y {\Yhook}
+\defineaccent d Y {\Ydotbelow}
+\defineaccent h a {\ahook}
+\defineaccent d a {\adotbelow}
+\defineaccent ` ^a {\acircumflexgrave}
+\defineaccent ' ^a {\acircumflexacute}
+\defineaccent ~ ^a {\acircumflextilde}
+\defineaccent h ^a {\acircumflexhook}
+\defineaccent d ^a {\acircumflexdotbelow}
+\defineaccent ` ua {\abrevegrave}
+\defineaccent ' ua {\abreveacute}
+\defineaccent ~ ua {\abrevetilde}
+\defineaccent h ua {\abrevehook}
+\defineaccent d ua {\abrevedotbelow}
+\defineaccent h e {\ehook}
+\defineaccent d e {\edotbelow}
+\defineaccent ` ^e {\ecircumflexgrave}
+\defineaccent ' ^e {\ecircumflexacute}
+\defineaccent ~ ^e {\ecircumflextilde}
+\defineaccent h ^e {\ecircumflexhook}
+\defineaccent d ^e {\ecircumflexdotbelow}
+\defineaccent h i {\ihook}
+\defineaccent d i {\idotbelow}
+\defineaccent h o {\ohook}
+\defineaccent d o {\odotbelow}
+\defineaccent ^ o {\ocircumflex}
+\defineaccent ` ^o {\ocircumflexgrave}
+\defineaccent ' ^o {\ocircumflexacute}
+\defineaccent ~ ^o {\ocircumflextilde}
+\defineaccent h ^o {\ocircumflexhook}
+\defineaccent d ^o {\ocircumflexdotbelow}
+%defineaccent h o {\ohorn} % !!!
+\defineaccent ` ho {\ohorngrave}
+\defineaccent ' ho {\ohornacute}
+\defineaccent ~ ho {\ohorntilde}
+\defineaccent h ho {\ohornhook}
+\defineaccent d ho {\ohorndotbelow}
+\defineaccent ` {\ohorn} {\ohorngrave}
+\defineaccent ' {\ohorn} {\ohornacute}
+\defineaccent ~ {\ohorn} {\ohorntilde}
+\defineaccent h {\ohorn} {\ohornhook}
+\defineaccent d {\ohorn} {\ohorndotbelow}
+\defineaccent h u {\uhook}
+\defineaccent d u {\udotbelow}
+%defineaccent h u {\uhorn} % !!!
+\defineaccent ` hu {\uhorngrave}
+\defineaccent ' hu {\uhornacute}
+\defineaccent ~ hu {\uhorntilde}
+\defineaccent h hu {\uhornhook}
+\defineaccent d hu {\uhorndotbelow}
+\defineaccent ` {\uhorn} {\uhorngrave}
+\defineaccent ' {\uhorn} {\uhornacute}
+\defineaccent ~ {\uhorn} {\uhorntilde}
+\defineaccent h {\uhorn} {\uhornhook}
+\defineaccent d {\uhorn} {\uhorndotbelow}
+\defineaccent ` y {\ygrave}
+\defineaccent ' y {\yacute}
+\defineaccent ~ y {\ytilde}
+\defineaccent h y {\yhook}
+\defineaccent d y {\ydotbelow}
+
+\stopencoding
+
+\endinput
diff --git a/tex/context/base/enco-vna.tex b/tex/context/base/enco-vna.tex
deleted file mode 100644
index 05753f37b..000000000
--- a/tex/context/base/enco-vna.tex
+++ /dev/null
@@ -1,145 +0,0 @@
-%D \module
-%D [ file=enco-vna,
-%D version=1999.12.12,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Vietnamese Accents,
-%D author=Han The Thanh & Adam Lindsay & Hans Hagen,
-%D date=\currentdate,
-%D copyright=PRAGMA]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D This module is originally derived from the some files Han The Thanh
-%D prepared for \LATEX. The dual accent support is still preliminary,
-%D but works ok. It's now adapted to named glyphs, and is activated by
-%D \type {\useencoding[thisfile]}.
-
-%D This was apparently buggy from the start: there is nothing to
-%D disambiguate \type {\ohorn} from \type {\ohook}. Both are entered
-%D with \type {\h{o}} (AL)!
-
-%D Once stable, this code will move to \type {enco-acc.tex}.
-
-\startencoding[default]
-
-\defineaccent h A {\Ahook}
-\defineaccent d A {\Adotbelow}
-\defineaccent ` ^A {\Acircumflexgrave}
-\defineaccent ' ^A {\Acircumflexacute}
-\defineaccent ~ ^A {\Acircumflextilde}
-\defineaccent h ^A {\Acircumflexhook}
-\defineaccent d ^A {\Acircumflexdotbelow}
-\defineaccent ` uA {\Abrevegrave}
-\defineaccent ' uA {\Abreveacute}
-\defineaccent ~ uA {\Abrevetilde}
-\defineaccent h uA {\Abrevehook}
-\defineaccent d uA {\Abrevedotbelow}
-\defineaccent h E {\Ehook}
-\defineaccent d E {\Edotbelow}
-\defineaccent ` ^E {\Ecircumflexgrave}
-\defineaccent ' ^E {\Ecircumflexacute}
-\defineaccent ~ ^E {\Ecircumflextilde}
-\defineaccent h ^E {\Ecircumflexhook}
-\defineaccent d ^E {\Ecircumflexdotbelow}
-\defineaccent h I {\Ihook}
-\defineaccent d I {\Idotbelow}
-\defineaccent h O {\Ohook}
-\defineaccent d O {\Odotbelow}
-\defineaccent ` ^O {\Ocircumflexgrave}
-\defineaccent ' ^O {\Ocircumflexacute}
-\defineaccent ~ ^O {\Ocircumflextilde}
-\defineaccent h ^O {\Ocircumflexhook}
-\defineaccent d ^O {\Ocircumflexdotbelow}
-%defineaccent h O {\Ohorn} % !!! conflict with \Ohook!
-\defineaccent ` hO {\Ohorngrave}
-\defineaccent ` {\Ohorn} {\Ohorngrave}
-\defineaccent ' hO {\Ohornacute}
-\defineaccent ' {\Ohorn} {\Ohornacute}
-\defineaccent ~ hO {\Ohorntilde}
-\defineaccent ~ {\Ohorn} {\Ohorntilde}
-\defineaccent h hO {\Ohornhook}
-\defineaccent h {\Ohorn} {\Ohornhook}
-\defineaccent d hO {\Ohorndotbelow}
-\defineaccent d {\Ohorn} {\Ohorndotbelow}
-\defineaccent h U {\Uhook}
-\defineaccent d U {\Udotbelow}
-%defineaccent h U {\Uhorn} % !!! conflict with \Uhook! honestly, people!
-\defineaccent ` hU {\Uhorngrave}
-\defineaccent ` {\Uhorn} {\Uhorngrave}
-\defineaccent ' hU {\Uhornacute}
-\defineaccent ' {\Uhorn} {\Uhornacute}
-\defineaccent ~ hU {\Uhorntilde}
-\defineaccent ~ {\Uhorn} {\Uhorntilde}
-\defineaccent h hU {\Uhornhook}
-\defineaccent h {\Uhorn} {\Uhornhook}
-\defineaccent d hU {\Uhorndotbelow}
-\defineaccent d {\Uhorn} {\Uhorndotbelow}
-\defineaccent ` Y {\Ygrave}
-\defineaccent ' Y {\Yacute}
-\defineaccent ~ Y {\Ytilde}
-\defineaccent h Y {\Yhook}
-\defineaccent d Y {\Ydotbelow}
-\defineaccent h a {\ahook}
-\defineaccent d a {\adotbelow}
-\defineaccent ` ^a {\acircumflexgrave}
-\defineaccent ' ^a {\acircumflexacute}
-\defineaccent ~ ^a {\acircumflextilde}
-\defineaccent h ^a {\acircumflexhook}
-\defineaccent d ^a {\acircumflexdotbelow}
-\defineaccent ` ua {\abrevegrave}
-\defineaccent ' ua {\abreveacute}
-\defineaccent ~ ua {\abrevetilde}
-\defineaccent h ua {\abrevehook}
-\defineaccent d ua {\abrevedotbelow}
-\defineaccent h e {\ehook}
-\defineaccent d e {\edotbelow}
-\defineaccent ` ^e {\ecircumflexgrave}
-\defineaccent ' ^e {\ecircumflexacute}
-\defineaccent ~ ^e {\ecircumflextilde}
-\defineaccent h ^e {\ecircumflexhook}
-\defineaccent d ^e {\ecircumflexdotbelow}
-\defineaccent h i {\ihook}
-\defineaccent d i {\idotbelow}
-\defineaccent h o {\ohook}
-\defineaccent d o {\odotbelow}
-\defineaccent ^ o {\ocircumflex}
-\defineaccent ` ^o {\ocircumflexgrave}
-\defineaccent ' ^o {\ocircumflexacute}
-\defineaccent ~ ^o {\ocircumflextilde}
-\defineaccent h ^o {\ocircumflexhook}
-\defineaccent d ^o {\ocircumflexdotbelow}
-%defineaccent h o {\ohorn} % !!!
-\defineaccent ` ho {\ohorngrave}
-\defineaccent ' ho {\ohornacute}
-\defineaccent ~ ho {\ohorntilde}
-\defineaccent h ho {\ohornhook}
-\defineaccent d ho {\ohorndotbelow}
-\defineaccent ` {\ohorn} {\ohorngrave}
-\defineaccent ' {\ohorn} {\ohornacute}
-\defineaccent ~ {\ohorn} {\ohorntilde}
-\defineaccent h {\ohorn} {\ohornhook}
-\defineaccent d {\ohorn} {\ohorndotbelow}
-\defineaccent h u {\uhook}
-\defineaccent d u {\udotbelow}
-%defineaccent h u {\uhorn} % !!!
-\defineaccent ` hu {\uhorngrave}
-\defineaccent ' hu {\uhornacute}
-\defineaccent ~ hu {\uhorntilde}
-\defineaccent h hu {\uhornhook}
-\defineaccent d hu {\uhorndotbelow}
-\defineaccent ` {\uhorn} {\uhorngrave}
-\defineaccent ' {\uhorn} {\uhornacute}
-\defineaccent ~ {\uhorn} {\uhorntilde}
-\defineaccent h {\uhorn} {\uhornhook}
-\defineaccent d {\uhorn} {\uhorndotbelow}
-\defineaccent ` y {\ygrave}
-\defineaccent ' y {\yacute}
-\defineaccent ~ y {\ytilde}
-\defineaccent h y {\yhook}
-\defineaccent d y {\ydotbelow}
-
-\stopencoding
-
-\endinput
diff --git a/tex/context/base/enco-win.mkii b/tex/context/base/enco-win.mkii
new file mode 100644
index 000000000..826371d8a
--- /dev/null
+++ b/tex/context/base/enco-win.mkii
@@ -0,0 +1,7 @@
+% temporary module, needed for downward compatibility
+
+%\input regi-win.tex
+
+\enableregime[windows]
+
+\endinput
diff --git a/tex/context/base/enco-win.tex b/tex/context/base/enco-win.tex
deleted file mode 100644
index 826371d8a..000000000
--- a/tex/context/base/enco-win.tex
+++ /dev/null
@@ -1,7 +0,0 @@
-% temporary module, needed for downward compatibility
-
-%\input regi-win.tex
-
-\enableregime[windows]
-
-\endinput
diff --git a/tex/context/base/enco-x5.mkii b/tex/context/base/enco-x5.mkii
new file mode 100644
index 000000000..f82ec6c5c
--- /dev/null
+++ b/tex/context/base/enco-x5.mkii
@@ -0,0 +1,218 @@
+%D \module
+%D [ file=enco-x5,
+%D version=1999.12.12,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=Vietnamese Encoding,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=Hans Hagen]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This module is derived from the some files Han The Thanh
+%D prepared for \LATEX. The dual accent support is still
+%D preliminary, but works ok.
+
+\startencoding[x5]
+
+\definecharacter textgrave 0
+\definecharacter textacute 1
+\definecharacter textcircumflex 2
+\definecharacter texttilde 3
+\definecharacter textdiaeresis 4
+\definecharacter texthungarumlaut 5
+\definecharacter textring 6
+\definecharacter textcaron 7
+\definecharacter textbreve 8
+\definecharacter textmacron 9
+\definecharacter textdotaccent 10
+\definecharacter textcedilla 11
+\definecharacter textogonek 12
+
+\definecharacter dotlessi 25
+\definecharacter DJ 30
+\definecharacter dj 31
+
+\defineaccent ` A 128
+\defineaccent ' A 129
+\defineaccent ~ A 130
+\defineaccent h A 131
+\defineaccent d A 132
+\defineaccent ^ A 133
+\defineaccent ` ^A 134
+\defineaccent ' ^A 135
+\defineaccent ~ ^A 136
+\defineaccent h ^A 137
+\defineaccent d ^A 138
+\defineaccent u A 139
+\defineaccent ` uA 140
+\defineaccent ' uA 141
+\defineaccent ~ uA 142
+\defineaccent h uA 143
+\defineaccent d uA 144
+\defineaccent ` E 145
+\defineaccent ' E 146
+\defineaccent ~ E 147
+\defineaccent h E 148
+\defineaccent d E 149
+\defineaccent ^ E 150
+\defineaccent ` ^E 151
+\defineaccent ' ^E 152
+\defineaccent ~ ^E 153
+\defineaccent h ^E 154
+\defineaccent d ^E 155
+\defineaccent ` I 156
+\defineaccent ' I 157
+\defineaccent ~ I 158
+\defineaccent h I 159
+\defineaccent d I 192
+\defineaccent ` O 193
+\defineaccent ' O 194
+\defineaccent ~ O 195
+\defineaccent h O 196
+\defineaccent d O 197
+\defineaccent ^ O 198
+\defineaccent ` ^O 199
+\defineaccent ' ^O 200
+\defineaccent ~ ^O 201
+\defineaccent h ^O 202
+\defineaccent d ^O 203
+\defineaccent h O 204
+\defineaccent ` hO 205
+\defineaccent ' hO 206
+\defineaccent ~ hO 207
+\defineaccent h hO 208
+\defineaccent d hO 209
+\defineaccent ` U 210
+\defineaccent ' U 211
+\defineaccent ~ U 212
+\defineaccent h U 213
+\defineaccent d U 214
+\defineaccent h U 215
+\defineaccent ` hU 216
+\defineaccent ' hU 217
+\defineaccent ~ hU 218
+\defineaccent h hU 219
+\defineaccent d hU 220
+\defineaccent ` Y 221
+\defineaccent ' Y 222
+\defineaccent ~ Y 223
+\defineaccent h Y 26
+\defineaccent d Y 28
+\defineaccent ` a 160
+\defineaccent ' a 161
+\defineaccent ~ a 162
+\defineaccent h a 163
+\defineaccent d a 164
+\defineaccent ^ a 165
+\defineaccent ` ^a 166
+\defineaccent ' ^a 167
+\defineaccent ~ ^a 168
+\defineaccent h ^a 169
+\defineaccent d ^a 170
+\defineaccent u a 171
+\defineaccent ` ua 172
+\defineaccent ' ua 173
+\defineaccent ~ ua 174
+\defineaccent h ua 175
+\defineaccent d ua 176
+\defineaccent ` e 177
+\defineaccent ' e 178
+\defineaccent ~ e 179
+\defineaccent h e 180
+\defineaccent d e 181
+\defineaccent ^ e 182
+\defineaccent ` ^e 183
+\defineaccent ' ^e 184
+\defineaccent ~ ^e 185
+\defineaccent h ^e 186
+\defineaccent d ^e 187
+\defineaccent ` i 188
+\defineaccent ' i 189
+\defineaccent ~ i 190
+\defineaccent h i 191
+\defineaccent d i 224
+\defineaccent ` o 225
+\defineaccent ' o 226
+\defineaccent ~ o 227
+\defineaccent h o 228
+\defineaccent d o 229
+\defineaccent ^ o 230
+\defineaccent ` ^o 231
+\defineaccent ' ^o 232
+\defineaccent ~ ^o 233
+\defineaccent h ^o 234
+\defineaccent d ^o 235
+\defineaccent h o 236
+\defineaccent ` ho 237
+\defineaccent ' ho 238
+\defineaccent ~ ho 239
+\defineaccent h ho 240
+\defineaccent d ho 241
+\defineaccent ` u 242
+\defineaccent ' u 243
+\defineaccent ~ u 244
+\defineaccent h u 245
+\defineaccent d u 246
+\defineaccent h u 247
+\defineaccent ` hu 248
+\defineaccent ' hu 249
+\defineaccent ~ hu 250
+\defineaccent h hu 251
+\defineaccent d hu 252
+\defineaccent ` y 253
+\defineaccent ' y 254
+\defineaccent ~ y 255
+\defineaccent h y 27
+\defineaccent d y 29
+
+\stopencoding
+
+\endinput
+
+% \startencoding [x5]
+%
+% \definecharacter aa {\xfiveencodedaa}
+% \definecharacter AA {\xfiveencodedAA}
+%
+% \stopencoding
+%
+% \def\xfiveencodedaa%
+% {\accent23a}
+%
+% \def\xfiveencodedAA%
+% {\leavevmode
+% \setbox\zerocount\hbox{h}%
+% \dimen@\ht\zerocount
+% \advance\dimen@ -1ex
+% \rlap{\raise.67\dimen@\hbox{\char23}}A}
+
+% \quotesinglbase 13
+% \guilsinglleft 14
+% \guilsinglright 15
+% \textquotedblleft 16
+% \textquotedblright 17
+% \quotedblbase 18
+% \guillemotleft 19
+% \guillemotright 20
+% \textendash 21
+% \textemdash 22
+% \textcompwordmark 23
+% \textperthousand \% \char 24
+% \textpertenthousand \%\char 24\char 24
+% \textvisiblespace 32
+% \textquotedbl `\"
+% \textdollar `\$
+% \textquoteright `\'
+% \textless `\<
+% \textgreater `\>
+% \textbackslash `\
+% \textasciicircum `\^
+% \textunderscore 95
+% \textquoteleft `\`
+% \textbraceleft `\{
+% \textbar `\|
+% \textbraceright `\}
+% \textasciitilde `\~
diff --git a/tex/context/base/enco-x5.tex b/tex/context/base/enco-x5.tex
deleted file mode 100644
index f82ec6c5c..000000000
--- a/tex/context/base/enco-x5.tex
+++ /dev/null
@@ -1,218 +0,0 @@
-%D \module
-%D [ file=enco-x5,
-%D version=1999.12.12,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Vietnamese Encoding,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=Hans Hagen]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D This module is derived from the some files Han The Thanh
-%D prepared for \LATEX. The dual accent support is still
-%D preliminary, but works ok.
-
-\startencoding[x5]
-
-\definecharacter textgrave 0
-\definecharacter textacute 1
-\definecharacter textcircumflex 2
-\definecharacter texttilde 3
-\definecharacter textdiaeresis 4
-\definecharacter texthungarumlaut 5
-\definecharacter textring 6
-\definecharacter textcaron 7
-\definecharacter textbreve 8
-\definecharacter textmacron 9
-\definecharacter textdotaccent 10
-\definecharacter textcedilla 11
-\definecharacter textogonek 12
-
-\definecharacter dotlessi 25
-\definecharacter DJ 30
-\definecharacter dj 31
-
-\defineaccent ` A 128
-\defineaccent ' A 129
-\defineaccent ~ A 130
-\defineaccent h A 131
-\defineaccent d A 132
-\defineaccent ^ A 133
-\defineaccent ` ^A 134
-\defineaccent ' ^A 135
-\defineaccent ~ ^A 136
-\defineaccent h ^A 137
-\defineaccent d ^A 138
-\defineaccent u A 139
-\defineaccent ` uA 140
-\defineaccent ' uA 141
-\defineaccent ~ uA 142
-\defineaccent h uA 143
-\defineaccent d uA 144
-\defineaccent ` E 145
-\defineaccent ' E 146
-\defineaccent ~ E 147
-\defineaccent h E 148
-\defineaccent d E 149
-\defineaccent ^ E 150
-\defineaccent ` ^E 151
-\defineaccent ' ^E 152
-\defineaccent ~ ^E 153
-\defineaccent h ^E 154
-\defineaccent d ^E 155
-\defineaccent ` I 156
-\defineaccent ' I 157
-\defineaccent ~ I 158
-\defineaccent h I 159
-\defineaccent d I 192
-\defineaccent ` O 193
-\defineaccent ' O 194
-\defineaccent ~ O 195
-\defineaccent h O 196
-\defineaccent d O 197
-\defineaccent ^ O 198
-\defineaccent ` ^O 199
-\defineaccent ' ^O 200
-\defineaccent ~ ^O 201
-\defineaccent h ^O 202
-\defineaccent d ^O 203
-\defineaccent h O 204
-\defineaccent ` hO 205
-\defineaccent ' hO 206
-\defineaccent ~ hO 207
-\defineaccent h hO 208
-\defineaccent d hO 209
-\defineaccent ` U 210
-\defineaccent ' U 211
-\defineaccent ~ U 212
-\defineaccent h U 213
-\defineaccent d U 214
-\defineaccent h U 215
-\defineaccent ` hU 216
-\defineaccent ' hU 217
-\defineaccent ~ hU 218
-\defineaccent h hU 219
-\defineaccent d hU 220
-\defineaccent ` Y 221
-\defineaccent ' Y 222
-\defineaccent ~ Y 223
-\defineaccent h Y 26
-\defineaccent d Y 28
-\defineaccent ` a 160
-\defineaccent ' a 161
-\defineaccent ~ a 162
-\defineaccent h a 163
-\defineaccent d a 164
-\defineaccent ^ a 165
-\defineaccent ` ^a 166
-\defineaccent ' ^a 167
-\defineaccent ~ ^a 168
-\defineaccent h ^a 169
-\defineaccent d ^a 170
-\defineaccent u a 171
-\defineaccent ` ua 172
-\defineaccent ' ua 173
-\defineaccent ~ ua 174
-\defineaccent h ua 175
-\defineaccent d ua 176
-\defineaccent ` e 177
-\defineaccent ' e 178
-\defineaccent ~ e 179
-\defineaccent h e 180
-\defineaccent d e 181
-\defineaccent ^ e 182
-\defineaccent ` ^e 183
-\defineaccent ' ^e 184
-\defineaccent ~ ^e 185
-\defineaccent h ^e 186
-\defineaccent d ^e 187
-\defineaccent ` i 188
-\defineaccent ' i 189
-\defineaccent ~ i 190
-\defineaccent h i 191
-\defineaccent d i 224
-\defineaccent ` o 225
-\defineaccent ' o 226
-\defineaccent ~ o 227
-\defineaccent h o 228
-\defineaccent d o 229
-\defineaccent ^ o 230
-\defineaccent ` ^o 231
-\defineaccent ' ^o 232
-\defineaccent ~ ^o 233
-\defineaccent h ^o 234
-\defineaccent d ^o 235
-\defineaccent h o 236
-\defineaccent ` ho 237
-\defineaccent ' ho 238
-\defineaccent ~ ho 239
-\defineaccent h ho 240
-\defineaccent d ho 241
-\defineaccent ` u 242
-\defineaccent ' u 243
-\defineaccent ~ u 244
-\defineaccent h u 245
-\defineaccent d u 246
-\defineaccent h u 247
-\defineaccent ` hu 248
-\defineaccent ' hu 249
-\defineaccent ~ hu 250
-\defineaccent h hu 251
-\defineaccent d hu 252
-\defineaccent ` y 253
-\defineaccent ' y 254
-\defineaccent ~ y 255
-\defineaccent h y 27
-\defineaccent d y 29
-
-\stopencoding
-
-\endinput
-
-% \startencoding [x5]
-%
-% \definecharacter aa {\xfiveencodedaa}
-% \definecharacter AA {\xfiveencodedAA}
-%
-% \stopencoding
-%
-% \def\xfiveencodedaa%
-% {\accent23a}
-%
-% \def\xfiveencodedAA%
-% {\leavevmode
-% \setbox\zerocount\hbox{h}%
-% \dimen@\ht\zerocount
-% \advance\dimen@ -1ex
-% \rlap{\raise.67\dimen@\hbox{\char23}}A}
-
-% \quotesinglbase 13
-% \guilsinglleft 14
-% \guilsinglright 15
-% \textquotedblleft 16
-% \textquotedblright 17
-% \quotedblbase 18
-% \guillemotleft 19
-% \guillemotright 20
-% \textendash 21
-% \textemdash 22
-% \textcompwordmark 23
-% \textperthousand \% \char 24
-% \textpertenthousand \%\char 24\char 24
-% \textvisiblespace 32
-% \textquotedbl `\"
-% \textdollar `\$
-% \textquoteright `\'
-% \textless `\<
-% \textgreater `\>
-% \textbackslash `\
-% \textasciicircum `\^
-% \textunderscore 95
-% \textquoteleft `\`
-% \textbraceleft `\{
-% \textbar `\|
-% \textbraceright `\}
-% \textasciitilde `\~
diff --git a/tex/context/base/filt-bas.mkii b/tex/context/base/filt-bas.mkii
new file mode 100644
index 000000000..ca3bc3d70
--- /dev/null
+++ b/tex/context/base/filt-bas.mkii
@@ -0,0 +1,63 @@
+%D \module
+%D [ file=filt-bas,
+%D version=2000.09.19,
+%D title=\CONTEXT\ Filter Macros,
+%D subtitle=A Base Collection,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% BEWARE: THIS IS A TEST MODULE, NAMES MAY CHANGE!
+
+\definefiltersynonym [utf8 to unicode16] [inutf8]
+
+\definefiltersynonym [persian fix] [FarsiToArabic]
+\definefiltersynonym [arabic analysis] [uni2cuni]
+\definefiltersynonym [arabic glyphs] [cuni2oar]
+
+\definefiltersequence
+ [farsi]
+ [utf8 to unicode16,
+ persian fix,
+ arabic analysis,
+ arabic glyphs]
+
+\definefiltersynonym [basic context analysis step1] [bcaa-1]
+\definefiltersynonym [basic context analysis step2] [bcaa-2]
+\definefiltersynonym [basic context analysis step3] [bcaa-3]
+\definefiltersynonym [farsi processing for uomarab] [uomarab-farsi]
+
+\definefiltersynonym [basic presentation forms to sf] [bpftosf]
+
+\definefiltersynonym [omega persian fix] [FarsiToArabic]
+\definefiltersynonym [omega arabic analysis] [uni2cuni]
+\definefiltersynonym [omega arabic glyphs] [cuni2oar]
+
+\definefiltersequence
+ [farsi-1]
+ [utf8 to unicode16,
+ omega persian fix,
+ omega arabic analysis,
+ omega arabic glyphs]
+
+\definefiltersequence
+ [farsi-2]
+ [utf8 to unicode16,
+ basic context analysis step1,
+ basic context analysis step2,
+ basic context analysis step3,
+ farsi processing for uomarab]
+
+\definefiltersequence
+ [farsi-3]
+ [utf8 to unicode16,
+ basic context analysis step1,
+ basic context analysis step2,
+ basic context analysis step3,
+ basic presentation forms to sf]
+
+\endinput
diff --git a/tex/context/base/filt-bas.tex b/tex/context/base/filt-bas.tex
deleted file mode 100644
index ca3bc3d70..000000000
--- a/tex/context/base/filt-bas.tex
+++ /dev/null
@@ -1,63 +0,0 @@
-%D \module
-%D [ file=filt-bas,
-%D version=2000.09.19,
-%D title=\CONTEXT\ Filter Macros,
-%D subtitle=A Base Collection,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-% BEWARE: THIS IS A TEST MODULE, NAMES MAY CHANGE!
-
-\definefiltersynonym [utf8 to unicode16] [inutf8]
-
-\definefiltersynonym [persian fix] [FarsiToArabic]
-\definefiltersynonym [arabic analysis] [uni2cuni]
-\definefiltersynonym [arabic glyphs] [cuni2oar]
-
-\definefiltersequence
- [farsi]
- [utf8 to unicode16,
- persian fix,
- arabic analysis,
- arabic glyphs]
-
-\definefiltersynonym [basic context analysis step1] [bcaa-1]
-\definefiltersynonym [basic context analysis step2] [bcaa-2]
-\definefiltersynonym [basic context analysis step3] [bcaa-3]
-\definefiltersynonym [farsi processing for uomarab] [uomarab-farsi]
-
-\definefiltersynonym [basic presentation forms to sf] [bpftosf]
-
-\definefiltersynonym [omega persian fix] [FarsiToArabic]
-\definefiltersynonym [omega arabic analysis] [uni2cuni]
-\definefiltersynonym [omega arabic glyphs] [cuni2oar]
-
-\definefiltersequence
- [farsi-1]
- [utf8 to unicode16,
- omega persian fix,
- omega arabic analysis,
- omega arabic glyphs]
-
-\definefiltersequence
- [farsi-2]
- [utf8 to unicode16,
- basic context analysis step1,
- basic context analysis step2,
- basic context analysis step3,
- farsi processing for uomarab]
-
-\definefiltersequence
- [farsi-3]
- [utf8 to unicode16,
- basic context analysis step1,
- basic context analysis step2,
- basic context analysis step3,
- basic presentation forms to sf]
-
-\endinput
diff --git a/tex/context/base/filt-ini.mkii b/tex/context/base/filt-ini.mkii
new file mode 100644
index 000000000..6e1a16e9a
--- /dev/null
+++ b/tex/context/base/filt-ini.mkii
@@ -0,0 +1,121 @@
+%D \module
+%D [ file=filt-ini,
+%D version=2000.09.19,
+%D title=\CONTEXT\ Filter Macros,
+%D subtitle=Initialization,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Filter Macros / Initialization}
+
+% \ifx\OmegaVersion\undefined
+
+% \let\definefiltersynonym \gobbledoubleempty
+% \let\definefiltersequence \gobbledoubleempty
+% \unexpanded\def\usefiltersequence {\gobblesingleempty}
+% \let\usefilter \gobblesingleempty
+% \let\truefiltername \gobbleoneargument
+
+% \expandafter \endinput
+% \fi
+
+\unprotect
+
+%D The real work starts here.
+
+% We need the {\??ot::#1} check because otherwise aleph will crash. Taco's
+% torture test:
+%
+% \ocp\ArabicContext = contextual
+%
+% \dorecurse {5000} {
+% \message{[\recurselevel]}
+% \ocplist\Arabic=\addbeforeocplist 1 \ArabicContext \nullocplist
+% }
+
+%D \macros
+%D {definefiltersynonym}
+
+\def\definefiltersynonym
+ {\dodoubleargument\dodefinefiltersynonym}
+
+\def\dodefinefiltersynonym[#1][#2]%
+ {\setvalue{\??or#1}{#2}}
+
+%D \macros
+%D {truefiltername}
+
+\def\truefiltername#1%
+ {\ifundefined{\??or#1}#1\else\truefiltername{\getvalue{\??or#1}}\fi}
+
+%D \macros
+%D {definefiltersequence}
+
+\def\definefiltersequence
+ {\dodoubleargument\dodefinefiltersequence}
+
+% \def\dodefinefiltersequence[#1][#2]%
+% {\setvalue{\??ot#1}{#2}}
+
+\def\dodefinefiltersequence[#1][#2]%
+ {\setxvalue{\??ot#1}{#2}%
+ \letgvalue{\??ot::#1}\v!stop}
+
+%D \macros
+%D {usefiltersequence}
+%D
+
+\def\magicocpnumber{1}
+
+% one can do:
+%
+% \definefiltersequence
+% [farsi]
+% [utf8 to unicode16=>5,
+% persian fix,
+% arabic analysis=>3,
+% arabic glyphs]
+%
+% so, => is used to signal a priority
+
+\def\dodousefiltersequence#1%
+ {\expandafter\ocp\csname\??or:#1\endcsname=\truefiltername{#1}\relax
+ \splitstring#1\at=>\to\!!stringa\and\!!stringb
+ \edef\!!stringb{\number\ifx\!!stringb\empty\magicocpnumber\else\!!stringb\fi}%
+ \appendetoks
+ \noexpand\addbeforeocplist
+ \!!stringb\space
+ \expandafter\noexpand\csname\??or:\!!stringa\endcsname
+ \to \scratchtoks}
+
+\unexpanded\def\usefiltersequence[#1]%
+ {\doifdefined{\??ot::#1}%
+ {\doifvalue{\??ot::#1}\v!stop
+ {\scratchtoks\emptytoks
+ \expanded{\processcommalist[\getvalue{\??ot#1}]}\dodousefiltersequence
+ \expanded{\global\ocplist\csname\??ot:#1\endcsname=\the\scratchtoks}\nullocplist
+ \letgvalue{\??ot::#1}\v!start}%
+ \expanded{\pushocplist\csname\??ot:#1\endcsname}\relax}}
+
+%D \macros
+%D {usefilter}
+
+\def\dousefilter#1%
+ {\doifundefined{\c!file\f!filterprefix#1}%
+ {\letvalue{\c!file\f!filterprefix#1}\empty
+ \makeshortfilename[\truefilename{\f!filterprefix#1}]%
+ \startreadingfile
+ \readsysfile{\shortfilename.mkii}
+ {\showmessage\m!filters1{#1}}
+ {\showmessage\m!filters2{#1}}%
+ \stopreadingfile}}
+
+\def\usefilter[#1]%
+ {\processcommalist[#1]\dousefilter}
+
+\protect \endinput
diff --git a/tex/context/base/filt-ini.tex b/tex/context/base/filt-ini.tex
deleted file mode 100644
index 49b32bdd8..000000000
--- a/tex/context/base/filt-ini.tex
+++ /dev/null
@@ -1,133 +0,0 @@
-%D \module
-%D [ file=filt-ini,
-%D version=2000.09.19,
-%D title=\CONTEXT\ Filter Macros,
-%D subtitle=Initialization,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Filter Macros / Initialization}
-
-% \ifx\OmegaVersion\undefined
-
-% \let\definefiltersynonym \gobbledoubleempty
-% \let\definefiltersequence \gobbledoubleempty
-% \unexpanded\def\usefiltersequence {\gobblesingleempty}
-% \let\usefilter \gobblesingleempty
-% \let\truefiltername \gobbleoneargument
-
-% \expandafter \endinput
-% \fi
-
-\unprotect
-
-%D The real work starts here.
-
-% messages moved
-
-% messages moved
-
-% messages moved
-
-% messages moved
-
-% messages moved
-
-% messages moved
-
-% We need the {\??ot::#1} check because otherwise aleph will crash. Taco's
-% torture test:
-%
-% \ocp\ArabicContext = contextual
-%
-% \dorecurse {5000} {
-% \message{[\recurselevel]}
-% \ocplist\Arabic=\addbeforeocplist 1 \ArabicContext \nullocplist
-% }
-
-%D \macros
-%D {definefiltersynonym}
-
-\def\definefiltersynonym
- {\dodoubleargument\dodefinefiltersynonym}
-
-\def\dodefinefiltersynonym[#1][#2]%
- {\setvalue{\??or#1}{#2}}
-
-%D \macros
-%D {truefiltername}
-
-\def\truefiltername#1%
- {\ifundefined{\??or#1}#1\else\truefiltername{\getvalue{\??or#1}}\fi}
-
-%D \macros
-%D {definefiltersequence}
-
-\def\definefiltersequence
- {\dodoubleargument\dodefinefiltersequence}
-
-% \def\dodefinefiltersequence[#1][#2]%
-% {\setvalue{\??ot#1}{#2}}
-
-\def\dodefinefiltersequence[#1][#2]%
- {\setxvalue{\??ot#1}{#2}%
- \letgvalue{\??ot::#1}\v!stop}
-
-%D \macros
-%D {usefiltersequence}
-%D
-
-\def\magicocpnumber{1}
-
-% one can do:
-%
-% \definefiltersequence
-% [farsi]
-% [utf8 to unicode16=>5,
-% persian fix,
-% arabic analysis=>3,
-% arabic glyphs]
-%
-% so, => is used to signal a priority
-
-\def\dodousefiltersequence#1%
- {\expandafter\ocp\csname\??or:#1\endcsname=\truefiltername{#1}\relax
- \splitstring#1\at=>\to\!!stringa\and\!!stringb
- \edef\!!stringb{\number\ifx\!!stringb\empty\magicocpnumber\else\!!stringb\fi}%
- \appendetoks
- \noexpand\addbeforeocplist
- \!!stringb\space
- \expandafter\noexpand\csname\??or:\!!stringa\endcsname
- \to \scratchtoks}
-
-\unexpanded\def\usefiltersequence[#1]%
- {\doifdefined{\??ot::#1}%
- {\doifvalue{\??ot::#1}\v!stop
- {\scratchtoks\emptytoks
- \expanded{\processcommalist[\getvalue{\??ot#1}]}\dodousefiltersequence
- \expanded{\global\ocplist\csname\??ot:#1\endcsname=\the\scratchtoks}\nullocplist
- \letgvalue{\??ot::#1}\v!start}%
- \expanded{\pushocplist\csname\??ot:#1\endcsname}\relax}}
-
-%D \macros
-%D {usefilter}
-
-\def\dousefilter#1%
- {\doifundefined{\c!file\f!filterprefix#1}%
- {\letvalue{\c!file\f!filterprefix#1}\empty
- \makeshortfilename[\truefilename{\f!filterprefix#1}]%
- \startreadingfile
- \readsysfile\shortfilename
- {\showmessage\m!filters1{#1}}
- {\showmessage\m!filters2{#1}}%
- \stopreadingfile}}
-
-\def\usefilter[#1]%
- {\processcommalist[#1]\dousefilter}
-
-\protect \endinput
diff --git a/tex/context/base/font-arb.mkii b/tex/context/base/font-arb.mkii
new file mode 100644
index 000000000..3ec0395f3
--- /dev/null
+++ b/tex/context/base/font-arb.mkii
@@ -0,0 +1,5 @@
+\unprotected \writestatus\m!systems{load ARABTEX as a module instead}
+
+\usemodule[arabtex]
+
+\endinput
diff --git a/tex/context/base/font-arb.tex b/tex/context/base/font-arb.tex
deleted file mode 100644
index 3ec0395f3..000000000
--- a/tex/context/base/font-arb.tex
+++ /dev/null
@@ -1,5 +0,0 @@
-\unprotected \writestatus\m!systems{load ARABTEX as a module instead}
-
-\usemodule[arabtex]
-
-\endinput
diff --git a/tex/context/base/font-bfm.mkii b/tex/context/base/font-bfm.mkii
new file mode 100644
index 000000000..23e3176c4
--- /dev/null
+++ b/tex/context/base/font-bfm.mkii
@@ -0,0 +1,196 @@
+%D \module
+%D [ file=font-bfm,
+%D version=2003.11.25,
+%D title=\CONTEXT\ Font Macros,
+%D subtitle=Mixed Normal and Bold Math,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Font Macros / Mixed Bold Math Support}
+
+%D The following example demonstrates how to use normal, bold, and mixed
+%D normal|/|bold math. Since not everyone has the Lucida on his|/|her
+%D machine we don't show the result.
+%D
+%D \starttyping
+%D \setupformulas
+%D [method=bold]
+%D
+%D \definetypeface [mainface] [rm] [serif] [lucida] [default] [encoding=texnansi]
+%D \definetypeface [mainface] [tt] [mono] [lucida] [default] [encoding=texnansi]
+%D \definetypeface [mainface] [ss] [sans] [lucida] [default] [encoding=texnansi]
+%D \definetypeface [mainface] [mm] [math] [lucida] [default] [encoding=texnansi]
+%D \definetypeface [mainface] [mm] [bfmath] [lucida] [default] [encoding=texnansi]
+%D
+%D \definetypeface [boldmath] [rm] [serif] [lucida] [default] [encoding=texnansi]
+%D \definetypeface [boldmath] [tt] [mono] [lucida] [default] [encoding=texnansi]
+%D \definetypeface [boldmath] [ss] [sans] [lucida] [default] [encoding=texnansi]
+%D \definetypeface [boldmath] [mm] [boldmath] [lucida] [default] [encoding=texnansi]
+%D
+%D \switchtobodyfont[mainface]
+%D
+%D \startlines
+%D $\mainface x=10 \Gamma \Delta \alpha \delta \zeta$
+%D $\boldmath x=10 \Gamma \Delta \alpha \delta \zeta$
+%D \stoplines
+%D
+%D \startformula
+%D x=12=\fontbody \Gamma \Delta \alpha \delta \zeta
+%D \stopformula
+%D
+%D \startformula[mainface]
+%D x=12=\fontbody \Gamma \Delta \alpha \delta \zeta
+%D \stopformula
+%D
+%D \startformula[boldmath]
+%D x=12=\fontbody \Gamma \Delta \alpha \delta \zeta
+%D \stopformula
+%D
+%D \startformula[boldmath,8pt]
+%D x=8=\fontbody \Gamma \Delta \alpha \delta \zeta
+%D \stopformula
+%D
+%D \startformula[boldmath,12pt,small]
+%D x=12s=\fontbody \Gamma \Delta \alpha \delta \zeta
+%D \stopformula
+%D
+%D \startformula[boldmath,small]
+%D x=s=\fontbody \Gamma \Delta \alpha \delta \zeta
+%D \stopformula
+%D
+%D \startformula[boldmath,10pt]
+%D x=10=\fontbody \Gamma \Delta \alpha \delta \zeta
+%D \stopformula
+%D
+%D \startformula[boldmath,11pt,small]
+%D x=11s=\fontbody \Gamma \Delta \alpha \delta \zeta
+%D \stopformula
+%D
+%D \startformula[boldmath,9pt]
+%D x=9=\fontbody \Gamma \Delta \alpha \delta \zeta
+%D \stopformula
+%D
+%D \startlines
+%D \formula{1=2x}
+%D \formula[boldmath]{1=2x}
+%D \formula[mainface]{1=2x}
+%D \formula[mainface]{1 \theta \Gamma = \bfm 1 \beta \hbox{\sl test}\Gamma \alpha ' x x}
+%D \formula[mainface]{1 \theta \Gamma = {\bfm 1 \beta \hbox{\sl test}\Gamma \alpha ' x} x}
+%D \stoplines
+%D \stoptyping
+
+\unprotect
+
+%D \TEX\ has some hard wired expectations about where to look for
+%D certain characters. This means that we cannot overload the families
+%D 0 upto~3. Also, since we use C upto~F for math as well, we are left
+%D with the range 4 upto~B.
+
+\chardef\mrbffam\itfam \edef\c!mrbf{\c!mr\c!bf} \let\hexmrbffam\hexitfam % 4 it
+\chardef\exbffam\slfam \edef\c!exbf{\c!ex\c!bf} \let\hexexbffam\hexslfam % 5 sl
+\chardef\mibffam\bffam \edef\c!mibf{\c!mi\c!bf} \let\hexmibffam\hexbffam % 6 bf
+\chardef\sybffam\nnfam \edef\c!sybf{\c!sy\c!bf} \let\hexsybffam\hexnnfam % 7 nn
+\chardef\mabffam\bsfam \edef\c!mabf{\c!ma\c!bf} \let\hexmabffam\hexbsfam % 8 bs
+\chardef\mbbffam\bifam \edef\c!mbbf{\c!mb\c!bf} \let\hexmbbffam\hexbifam % 9 bi
+\chardef\mcbffam\scfam \edef\c!mcbf{\c!mc\c!bf} \let\hexmcbffam\hexscfam % A sc
+\chardef\mdbffam\scfam \edef\c!mdbf{\c!mc\c!bf} \let\hexmdbffam\hexscfam % B tf % tricky
+
+%D The next bunch of code looks horrible and tricky but one has to keep in
+%D mind that because \TEX\ makes several passes over the math list we need to
+%D make sure that grouping is handled well. Later assignments to a family
+%D overload previous ones, the last one counts.
+
+\newtoks \boldmathstrategies
+\newtoks \boldsymbstrategies
+
+\appendtoks
+ \dosetmathfamily\mrbffam\textface\scriptface\scriptscriptface\c!mrbf\mrfallback
+ \dosetmathfamily\mibffam\textface\scriptface\scriptscriptface\c!mibf\empty
+ \dosetmathfamily\sybffam\textface\scriptface\scriptscriptface\c!sybf\empty
+ \dosetmathfamily\exbffam\textface\textface \textface \c!exbf\empty
+ \dosetmathfamily\mabffam\textface\scriptface\scriptscriptface\c!mabf\empty
+ \dosetmathfamily\mbbffam\textface\scriptface\scriptscriptface\c!mbbf\empty
+ \dosetmathfamily\mcbffam\textface\scriptface\scriptscriptface\c!mcbf\empty
+\to \boldmathstrategies
+
+\appendtoks
+ \dosetskewchar\mifam\defaultskewcharmi
+ \dosetskewchar\syfam\defaultskewcharsy
+\to \boldmathstrategies
+
+\appendtoks
+ \dosetsymbfamily\mrbffam\textface\scriptface\scriptscriptface\c!mrbf
+ \dosetsymbfamily\mibffam\textface\scriptface\scriptscriptface\c!mibf
+ \dosetsymbfamily\sybffam\textface\scriptface\scriptscriptface\c!sybf
+ \dosetsymbfamily\exbffam\textface\textface \textface \c!exbf
+ \dosetsymbfamily\mabffam\textface\scriptface\scriptscriptface\c!mabf
+ \dosetsymbfamily\mbbffam\textface\scriptface\scriptscriptface\c!mbbf
+ \dosetsymbfamily\mcbffam\textface\scriptface\scriptscriptface\c!mcbf
+\to \boldsymbstrategies
+
+%D Here comes the real mess (due to semi||global settings en multiple
+%D passes over the math list once the input is expanded.
+
+\newevery \everyboldfacemath \relax
+\chardef \boldfacemathmethod \zerocount
+
+\appendtoks
+ \ifcase\boldfacemathmethod \else \the\boldmathstrategies \fi
+\to \mathstrategies
+
+\appendtoks
+ \ifcase\boldfacemathmethod \else \the\boldsymbstrategies \fi
+\to \symbstrategies
+
+\appendtoks
+ \let\mrfam\mrbffam \let\c!mr\c!mrbf \let\hexmrfam\hexmrbffam
+ \let\mifam\mibffam \let\c!mi\c!mibf \let\hexmifam\hexmibffam
+ \let\syfam\sybffam \let\c!sy\c!sybf \let\hexsyfam\hexsybffam
+ \let\exfam\exbffam \let\c!ex\c!exbf \let\hexexfam\hexexbffam
+ \let\mafam\mabffam \let\c!ma\c!mabf \let\hexmafam\hexmabffam
+ \let\mbfam\mbbffam \let\c!mb\c!mbbf \let\hexmbfam\hexmbbffam
+ \let\mcfam\mcbffam \let\c!mc\c!mcbf \let\hexmcfam\hexmcbffam
+\to \everyboldfacemath
+
+\appendtoks
+ \let\mathsubfamily\c!bf
+\to \everyboldfacemath
+
+\appendtoks
+ \synchronizemath \aftergroup\synchronizemath
+\to \everyboldfacemath
+
+%D \macros
+%D {boldfacemath, bfm, autoboldfacemath}
+%D
+%D These are the user commands, with \type {\bfm} being the most comfortable.
+
+\def\boldfacemath {\ifcase\boldfacemathmethod\else\the\everyboldfacemath\fi}
+\def\bfm {\boldfacemath} % no \let, so that we can redefine
+\def\autoboldfacemath{\appendtoks\ifcase\boldfacemathmethod\else\let\bf\boldfacemath\fi\to\everymathematics}
+
+%D We hook this feature into the formula mechanism.
+
+\setupformulas
+ [\c!method=\v!normal]
+
+\appendtoks
+ \doifelse{\formulaparameter\c!method}\v!bold
+ {\chardef\boldfacemathmethod\plusone}
+ {\chardef\boldfacemathmethod\zerocount}%
+\to \everysetupformulas
+
+%D Of course this only works when bfmath fonts are set up (see example at
+%D the top of this file) and bold math is enabled:
+%D
+%D \starttyping
+%D \setupformulas
+%D [method=bold]
+%D \stoptyping
+
+\protect \endinput
diff --git a/tex/context/base/font-bfm.tex b/tex/context/base/font-bfm.tex
deleted file mode 100644
index 23e3176c4..000000000
--- a/tex/context/base/font-bfm.tex
+++ /dev/null
@@ -1,196 +0,0 @@
-%D \module
-%D [ file=font-bfm,
-%D version=2003.11.25,
-%D title=\CONTEXT\ Font Macros,
-%D subtitle=Mixed Normal and Bold Math,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Font Macros / Mixed Bold Math Support}
-
-%D The following example demonstrates how to use normal, bold, and mixed
-%D normal|/|bold math. Since not everyone has the Lucida on his|/|her
-%D machine we don't show the result.
-%D
-%D \starttyping
-%D \setupformulas
-%D [method=bold]
-%D
-%D \definetypeface [mainface] [rm] [serif] [lucida] [default] [encoding=texnansi]
-%D \definetypeface [mainface] [tt] [mono] [lucida] [default] [encoding=texnansi]
-%D \definetypeface [mainface] [ss] [sans] [lucida] [default] [encoding=texnansi]
-%D \definetypeface [mainface] [mm] [math] [lucida] [default] [encoding=texnansi]
-%D \definetypeface [mainface] [mm] [bfmath] [lucida] [default] [encoding=texnansi]
-%D
-%D \definetypeface [boldmath] [rm] [serif] [lucida] [default] [encoding=texnansi]
-%D \definetypeface [boldmath] [tt] [mono] [lucida] [default] [encoding=texnansi]
-%D \definetypeface [boldmath] [ss] [sans] [lucida] [default] [encoding=texnansi]
-%D \definetypeface [boldmath] [mm] [boldmath] [lucida] [default] [encoding=texnansi]
-%D
-%D \switchtobodyfont[mainface]
-%D
-%D \startlines
-%D $\mainface x=10 \Gamma \Delta \alpha \delta \zeta$
-%D $\boldmath x=10 \Gamma \Delta \alpha \delta \zeta$
-%D \stoplines
-%D
-%D \startformula
-%D x=12=\fontbody \Gamma \Delta \alpha \delta \zeta
-%D \stopformula
-%D
-%D \startformula[mainface]
-%D x=12=\fontbody \Gamma \Delta \alpha \delta \zeta
-%D \stopformula
-%D
-%D \startformula[boldmath]
-%D x=12=\fontbody \Gamma \Delta \alpha \delta \zeta
-%D \stopformula
-%D
-%D \startformula[boldmath,8pt]
-%D x=8=\fontbody \Gamma \Delta \alpha \delta \zeta
-%D \stopformula
-%D
-%D \startformula[boldmath,12pt,small]
-%D x=12s=\fontbody \Gamma \Delta \alpha \delta \zeta
-%D \stopformula
-%D
-%D \startformula[boldmath,small]
-%D x=s=\fontbody \Gamma \Delta \alpha \delta \zeta
-%D \stopformula
-%D
-%D \startformula[boldmath,10pt]
-%D x=10=\fontbody \Gamma \Delta \alpha \delta \zeta
-%D \stopformula
-%D
-%D \startformula[boldmath,11pt,small]
-%D x=11s=\fontbody \Gamma \Delta \alpha \delta \zeta
-%D \stopformula
-%D
-%D \startformula[boldmath,9pt]
-%D x=9=\fontbody \Gamma \Delta \alpha \delta \zeta
-%D \stopformula
-%D
-%D \startlines
-%D \formula{1=2x}
-%D \formula[boldmath]{1=2x}
-%D \formula[mainface]{1=2x}
-%D \formula[mainface]{1 \theta \Gamma = \bfm 1 \beta \hbox{\sl test}\Gamma \alpha ' x x}
-%D \formula[mainface]{1 \theta \Gamma = {\bfm 1 \beta \hbox{\sl test}\Gamma \alpha ' x} x}
-%D \stoplines
-%D \stoptyping
-
-\unprotect
-
-%D \TEX\ has some hard wired expectations about where to look for
-%D certain characters. This means that we cannot overload the families
-%D 0 upto~3. Also, since we use C upto~F for math as well, we are left
-%D with the range 4 upto~B.
-
-\chardef\mrbffam\itfam \edef\c!mrbf{\c!mr\c!bf} \let\hexmrbffam\hexitfam % 4 it
-\chardef\exbffam\slfam \edef\c!exbf{\c!ex\c!bf} \let\hexexbffam\hexslfam % 5 sl
-\chardef\mibffam\bffam \edef\c!mibf{\c!mi\c!bf} \let\hexmibffam\hexbffam % 6 bf
-\chardef\sybffam\nnfam \edef\c!sybf{\c!sy\c!bf} \let\hexsybffam\hexnnfam % 7 nn
-\chardef\mabffam\bsfam \edef\c!mabf{\c!ma\c!bf} \let\hexmabffam\hexbsfam % 8 bs
-\chardef\mbbffam\bifam \edef\c!mbbf{\c!mb\c!bf} \let\hexmbbffam\hexbifam % 9 bi
-\chardef\mcbffam\scfam \edef\c!mcbf{\c!mc\c!bf} \let\hexmcbffam\hexscfam % A sc
-\chardef\mdbffam\scfam \edef\c!mdbf{\c!mc\c!bf} \let\hexmdbffam\hexscfam % B tf % tricky
-
-%D The next bunch of code looks horrible and tricky but one has to keep in
-%D mind that because \TEX\ makes several passes over the math list we need to
-%D make sure that grouping is handled well. Later assignments to a family
-%D overload previous ones, the last one counts.
-
-\newtoks \boldmathstrategies
-\newtoks \boldsymbstrategies
-
-\appendtoks
- \dosetmathfamily\mrbffam\textface\scriptface\scriptscriptface\c!mrbf\mrfallback
- \dosetmathfamily\mibffam\textface\scriptface\scriptscriptface\c!mibf\empty
- \dosetmathfamily\sybffam\textface\scriptface\scriptscriptface\c!sybf\empty
- \dosetmathfamily\exbffam\textface\textface \textface \c!exbf\empty
- \dosetmathfamily\mabffam\textface\scriptface\scriptscriptface\c!mabf\empty
- \dosetmathfamily\mbbffam\textface\scriptface\scriptscriptface\c!mbbf\empty
- \dosetmathfamily\mcbffam\textface\scriptface\scriptscriptface\c!mcbf\empty
-\to \boldmathstrategies
-
-\appendtoks
- \dosetskewchar\mifam\defaultskewcharmi
- \dosetskewchar\syfam\defaultskewcharsy
-\to \boldmathstrategies
-
-\appendtoks
- \dosetsymbfamily\mrbffam\textface\scriptface\scriptscriptface\c!mrbf
- \dosetsymbfamily\mibffam\textface\scriptface\scriptscriptface\c!mibf
- \dosetsymbfamily\sybffam\textface\scriptface\scriptscriptface\c!sybf
- \dosetsymbfamily\exbffam\textface\textface \textface \c!exbf
- \dosetsymbfamily\mabffam\textface\scriptface\scriptscriptface\c!mabf
- \dosetsymbfamily\mbbffam\textface\scriptface\scriptscriptface\c!mbbf
- \dosetsymbfamily\mcbffam\textface\scriptface\scriptscriptface\c!mcbf
-\to \boldsymbstrategies
-
-%D Here comes the real mess (due to semi||global settings en multiple
-%D passes over the math list once the input is expanded.
-
-\newevery \everyboldfacemath \relax
-\chardef \boldfacemathmethod \zerocount
-
-\appendtoks
- \ifcase\boldfacemathmethod \else \the\boldmathstrategies \fi
-\to \mathstrategies
-
-\appendtoks
- \ifcase\boldfacemathmethod \else \the\boldsymbstrategies \fi
-\to \symbstrategies
-
-\appendtoks
- \let\mrfam\mrbffam \let\c!mr\c!mrbf \let\hexmrfam\hexmrbffam
- \let\mifam\mibffam \let\c!mi\c!mibf \let\hexmifam\hexmibffam
- \let\syfam\sybffam \let\c!sy\c!sybf \let\hexsyfam\hexsybffam
- \let\exfam\exbffam \let\c!ex\c!exbf \let\hexexfam\hexexbffam
- \let\mafam\mabffam \let\c!ma\c!mabf \let\hexmafam\hexmabffam
- \let\mbfam\mbbffam \let\c!mb\c!mbbf \let\hexmbfam\hexmbbffam
- \let\mcfam\mcbffam \let\c!mc\c!mcbf \let\hexmcfam\hexmcbffam
-\to \everyboldfacemath
-
-\appendtoks
- \let\mathsubfamily\c!bf
-\to \everyboldfacemath
-
-\appendtoks
- \synchronizemath \aftergroup\synchronizemath
-\to \everyboldfacemath
-
-%D \macros
-%D {boldfacemath, bfm, autoboldfacemath}
-%D
-%D These are the user commands, with \type {\bfm} being the most comfortable.
-
-\def\boldfacemath {\ifcase\boldfacemathmethod\else\the\everyboldfacemath\fi}
-\def\bfm {\boldfacemath} % no \let, so that we can redefine
-\def\autoboldfacemath{\appendtoks\ifcase\boldfacemathmethod\else\let\bf\boldfacemath\fi\to\everymathematics}
-
-%D We hook this feature into the formula mechanism.
-
-\setupformulas
- [\c!method=\v!normal]
-
-\appendtoks
- \doifelse{\formulaparameter\c!method}\v!bold
- {\chardef\boldfacemathmethod\plusone}
- {\chardef\boldfacemathmethod\zerocount}%
-\to \everysetupformulas
-
-%D Of course this only works when bfmath fonts are set up (see example at
-%D the top of this file) and bold math is enabled:
-%D
-%D \starttyping
-%D \setupformulas
-%D [method=bold]
-%D \stoptyping
-
-\protect \endinput
diff --git a/tex/context/base/font-chi.mkii b/tex/context/base/font-chi.mkii
new file mode 100644
index 000000000..0acf710d5
--- /dev/null
+++ b/tex/context/base/font-chi.mkii
@@ -0,0 +1,1156 @@
+%D \module
+%D [ file=font-chi,
+%D version=1999.10.10,
+%D title=\CONTEXT\ Font Macros,
+%D subtitle=Chinese,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D suggestions=Wang Lei,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\ifx\handlechineseunicodeglyph\undefined \else \endinput \fi
+
+% NOT YET ADAPTED TO THE NEW FONT MACROS
+
+%D The first implementation (most of which is here) is based on
+%D the specific font layout. This is because not all glyphs are
+%D available in uniciode, which means that we cannot use
+%D unicode codepoints (yet); if it were possible we could use
+%D just one table per input encoding.
+
+\writestatus{loading}{ConTeXt Font Macros / Chinese}
+
+% much will to typo-chi.tex
+
+%D Still to be implemented:
+%D
+%D \startitemize
+%D \item columns left right touch
+%D \item distance = (hsize-n*bodyfontsize)/(n-1)
+%D \item char grids
+%D \item char tables
+%D \item all kind of rotated combinations
+%D \item hanging puctuation
+%D \item a few more encodings
+%D \item rotation list
+%D \stopitemize
+
+%M \setupbodyfont[chi]
+%M
+%M \def\WangLei{\purechinese{\uchar{205}{245}\uchar{192}{218}}}
+
+\useencoding[chi]
+
+%D When \WangLei\ sent me a mail asking if \CONTEXT\ was able
+%D to support Chinese, I wasn't sure if the answer could be
+%D yes. I knew that those languages, rich of glyphs, were
+%D typeset by \TEX, so in principle it should be possible. I
+%D asked or some more input and was told that there were
+%D \LATEX\ styles regarding those languages. When I unzipped
+%D the accompanying files, it became clear that I had to
+%D implement support for Chinese from scratch. There was a
+%D multitude of font, with rather unfamiliar encodings, a
+%D large collection of files with |<|at least for me|>|
+%D unknown purposes, and worse, the documentation was mainly
+%D in Chinese.
+%D
+%D So, \WangLei\ and I started exchanging some emails and it
+%D soon became clear that supporting Chinese was not that
+%D complicated at all. It mostly came to dealing with handling
+%D \UNICODE\ fonts. It also became clear that everything
+%D Chinese took place in the upper region of the eight bit
+%D character set. I wrote some macros that could process the
+%D small \type {Hello World} file \WangLei\ had send me, and
+%D after some bug fixes real Chinese came out. I started to
+%D like the look and fel of Chinese glyphs, so on we went.
+%D
+%D The first comments concerned spacing. The mix of English
+%D and Chinese demands some rather deliberate handling of
+%D spacing. Breaking lines was not so much a problem, and
+%D could be solved by adding some glue between Chinese glyphs.
+%D
+%D In the meantime had asked \WangLei\ for some language bound
+%D labels and texts, and implementing these was rather
+%D straightforward. But, there were still some issues to deal
+%D with: conversion of numbers, date handling and index
+%D sorting.
+%D
+%D I consider(ed) writing Chinese support to be a nice puzzle,
+%D since I have to act on chinese \CONTEXT\ code, where I only
+%D understand the \CONTEXT\ part. The drawings \WangLei\ made
+%D me (in drawing packages) were of great help. Since I write
+%D these modules from scratch, although I fall back on some
+%D basic encoding and font modules, I consider them to be
+%D rather clean. This cannot be said of all \CONTEXT\ font
+%D modules \type {-)}.
+
+\unprotect
+
+%D Because Chinese glyphs have more height than the average
+%D Latin glyph, and at the same time don't have much depth,
+%D we adapt the scale.
+%D
+%D Before and after the glyph we have to deal with Chinese
+%D spacing. Special attention is given to punctuation.
+%D
+%D \starttyping
+%D [some short nice chinese text with () and english]
+%D \stoptyping
+%D
+%D We insert a bit of stretch and introduce a signal to
+%D keep track of previous characters. We use a similar
+%D method in the units module, which may be a nice
+%D introduction to using signals.
+
+%D \macros
+%D {chineseunicodescale, chineseinterglyphskip,
+%D chineseunicodeheight, chineseunicodedepth, chinesespace}
+%D
+%D There are a few variables, that can be (re|)|set
+%D depending on the current font. They default to:
+
+% hm, why don't we use the normal unicodestrut mechanism?
+
+\def\chineseunicodescale {1.00} % not smaller than .85
+\def\chineseunicodeheight {1.00}
+\def\chineseunicodedepth {1.00}
+\def\chineseinterglyphskip{0pt \!!plus .05em \!!minus .01em}
+\def\chinesesurroundskip {.25em \!!plus .15em \!!minus .05em}
+
+%D We define a few signals. As said, another example of
+%D using signals can be found in the module \type {m-units}.
+
+\newsignal\chineseLsignal % left boundary character
+\newsignal\chineseRsignal % right boundary character
+\newsignal\chineseSsignal % any other character (symbol)
+
+\chardef\chineseBstatus=0 % 0=unknown 1=left 2=right 3=chinese 4=nospace
+\chardef\chineseAstatus=0 % 0=unknown 1=left 2=right 3=space
+\chardef\chineseSstatus=0 % 0=unknown 1=left 2=right
+
+\sfcode`(=2000 % a temporary hack
+
+\def\chinesenobreak
+ {\relax
+ \iftracechinese
+ \nobreak
+ \kern-.5pt\color[red]{\vrule\!!width1pt}\kern-.5pt
+ \nobreak
+ \else
+ \nobreak
+ \fi}
+
+\newif\ifcorrectchineseboundarychars
+
+\def\chineseunskip
+ {\unskip\unskip\unskip\unskip}
+
+\def\insertchineseglyph
+ {\iftracechinese\tracedchineseglyph\else\insertunicodeglyph\fi}
+
+\newif\ifverticalchinese
+
+\def\handlechineseunicodeglyph
+ {\ifinpagebody
+ \horizontalchineseunicodeglyph
+ \else\ifverticalchinese
+ \verticalchineseunicodeglyph
+ \else
+ \horizontalchineseunicodeglyph
+ \fi\fi}
+
+% chinese classes: left=1|right=2|center=3
+
+\chardef\plusfour=4
+
+\def\analyzechineseunicodeglyph % beware, no zerocount !
+ {\chardef\chineseSstatus0\getvalue{uc\number\unicodeposition}\relax}
+
+\def\analyzechineseunicodeenviroment
+ {% left
+ \ifx (\nextutoken \chardef\chineseAstatus\plusone \else
+ \ifx [\nextutoken \chardef\chineseAstatus\plusone \else
+ % right
+ \ifx ,\nextutoken \chardef\chineseAstatus\plustwo \else
+ \ifx .\nextutoken \chardef\chineseAstatus\plustwo \else
+ \ifx ?\nextutoken \chardef\chineseAstatus\plustwo \else
+ \ifx ;\nextutoken \chardef\chineseAstatus\plustwo \else
+ \ifx :\nextutoken \chardef\chineseAstatus\plustwo \else
+ \ifx !\nextutoken \chardef\chineseAstatus\plustwo \else
+ \ifx )\nextutoken \chardef\chineseAstatus\plustwo \else
+ \ifx ]\nextutoken \chardef\chineseAstatus\plustwo \else
+ % space
+ \ifx\nextutoken\blankspace \chardef\chineseAstatus\plusthree \else
+ \ifx\nextutoken\space \chardef\chineseAstatus\plusthree \else
+ \chardef\chineseAstatus\zerocount
+ % unknown
+ \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi \fi\fi
+ % maybe save the last skip?
+ \chardef\chineseBstatus\ifdim\lastskip=\zeropoint\plusfour\else\zerocount\fi
+ \ifdim\lastskip=\chineseLsignal \chardef\chineseBstatus\plusone \else
+ \ifdim\lastskip=\chineseRsignal \chardef\chineseBstatus\plustwo \else
+ \ifdim\lastskip=\chineseSsignal \chardef\chineseBstatus\plusthree \else
+ \scratchskip=\lastskip \unskip
+ \ifdim\lastskip=\chineseLsignal \chardef\chineseBstatus\plusone \else
+ \ifdim\lastskip=\chineseRsignal \chardef\chineseBstatus\plustwo \else
+ \ifdim\lastskip=\chineseSsignal \chardef\chineseBstatus\plusthree \else
+ \space\scratchskip=\lastskip \unskip
+ \setbox\scratchbox=\hbox\bgroup
+ (\space
+ \ifdim\lastskip=\scratchskip
+ \egroup \chardef\chineseBstatus\plusone
+ \else
+ \egroup
+ \ifdim\scratchskip=\zeropoint \chardef\chineseBstatus\plusfour \fi
+ \fi
+ \fi\fi\fi
+ \fi\fi\fi}
+
+\def\horizontalchineseunicodeglyph
+ {\relax
+ \ifhmode\else\dontleavehmode\fi % added
+ \setunicodescale\chineseunicodescale % redundant
+ \setunicodestrut\chineseunicodeheight\chineseunicodedepth % redundant
+ \ifprocessingverbatim
+ \iftracechinese
+ \ruledhbox{\insertunicodeglyph}%
+ \else
+ \insertunicodeglyph
+ \fi
+ \else\ifx\nextutoken\relax
+ \insertunicodeglyph
+ \else
+ \analyzechineseunicodeglyph
+ \analyzechineseunicodeenviroment
+ \ifcase\chineseSstatus\relax
+ \ifcase\chineseBstatus\relax
+ \chineseunskip
+ \hskip\chinesesurroundskip % unknown
+ \or
+ \chineseunskip
+ \chinesenobreak % left
+ \or
+ \ifcorrectchineseboundarychars\else\chineseunskip\fi
+ \hskip\chineseinterglyphskip % right
+ \or
+ \chineseunskip
+ \hskip\chineseinterglyphskip % chinese
+ \or
+ % whatever
+ \fi
+ \insertchineseglyph
+ \ifcase\chineseAstatus\relax
+ \hskip\chineseinterglyphskip % unknown
+ \hskip\chinesesurroundskip
+ \ifcase\chineseSstatus
+ \hskip\chineseSsignal
+ \or
+ \hskip\chineseLsignal
+ \else
+ \hskip\chineseRsignal
+ \fi
+ \or
+ \hskip\chineseinterglyphskip % left
+ \chinesenobreak
+ \hskip\chineseLsignal
+ \or
+ \chinesenobreak % right
+ \hskip\chineseinterglyphskip
+ \chinesenobreak
+ \hskip\chineseRsignal
+ \or
+ \hskip\chineseinterglyphskip % space
+ \hskip\chinesesurroundskip
+ \hskip\chineseSsignal
+ \fi
+ \or % left
+ \ifcorrectchineseboundarychars
+ \let\unicodecharcommand\chineseleftcharcommand
+ \fi
+ \chineseunskip
+ \insertchineseglyph
+ \chinesenobreak
+ \hskip\chineseLsignal
+ \or % right
+ \ifcorrectchineseboundarychars
+ \let\unicodecharcommand\chineserightcharcommand
+ \fi
+ \chineseunskip
+ \chinesenobreak
+ \insertchineseglyph
+ \hskip\chineseRsignal
+ \else % center
+ \chineseunskip
+ \chinesenobreak
+ \insertchineseglyph
+ \hskip\chineseinterglyphskip
+ \hskip\chineseRsignal
+ \fi\fi
+ \aftergroup\ignorespaces % watch this
+ \fi}
+
+\def\verticalchineseunicodeglyph
+ {\relax
+ \ifprocessingverbatim % to do
+ \horizontalchineseunicodeglyph
+ \else
+ \setunicodescale\chineseunicodescale % redundant
+ \setunicodestrut\chineseunicodeheight\chineseunicodedepth % redundant
+ \ifx\nextutoken\relax
+ \insertchineseglyph
+ \ifvmode % catches \hbox{...}, actually \hbox should be \vbox -)
+ \nointerlineskip
+ \fi
+ \allowbreak
+ \else
+ \analyzechineseunicodeglyph
+ \setbox\scratchbox\hbox to \hsize
+ {\hss
+ \ifcase\chineseSstatus\relax
+ \insertchineseglyph
+ \else % left / right
+ \setbox\scratchbox\hbox{\insertchineseglyph}%
+ \rotate[\c!rotation=270]{\box\scratchbox}%
+ \fi
+ \hss}%
+ \ht\scratchbox\unicodeheight\strutht
+ \dp\scratchbox\unicodedepth \strutdp
+ \ifvmode % catches \hbox{...}, actually \hbox should be \vbox -)
+ \nointerlineskip
+ \fi
+ \ifcase\prevchineseSstatus\relax
+ \ifnum\chineseSstatus=\plustwo \par\nobreak\else\allowbreak\fi
+ \or % left
+ \par\nobreak
+ \or % right
+ \ifnum\chineseSstatus=\plustwo \par\nobreak\else\allowbreak\fi
+ \fi
+ \global\chardef\prevchineseSstatus\chineseSstatus % pagebody ...
+ \box\scratchbox\par
+ \fi
+ \aftergroup\ignorespaces % watch this
+ \fi}
+
+%D \macros
+%D {setupchinese,startvertical,nochinese}
+%D
+%D The previous macros implement horizontal as well as
+%D vertical typesetting. Vertical typesetting is implemented
+%D on top of the multi||column routines.
+
+\def\setupchinese
+ {\dodoubleargument\getparameters[\??vt]}
+
+\def\startvertical
+ {\dosingleempty\dostartvertical}
+
+\def\dostartvertical[#1]%
+ {\bgroup
+ \def\maxnofcolumns{25}%
+ \verticalchinesetrue
+ \global\chardef\prevchineseSstatus\zerocount
+ \let\nochinese\nochineseinvertical
+ \doif\@@vtn\v!fit
+ {\dimen0=\textwidth \advance\dimen0 \@@vtdistance
+ \dimen2=\bodyfontsize \advance\dimen2 \@@vtdistance
+ \divide\dimen0 \number\dimen2
+ \edef\@@vtn{\number\dimen0}}%
+ \startcolumns
+ [\c!direction=\@@vtdirection,
+ \c!balance=\@@vtbalance,
+ \c!distance=\@@vtdistance,
+ \c!n=\@@vtn,
+ #1]}
+
+\def\stopvertical
+ {\stopcolumns
+ \egroup}
+
+\setupchinese
+ [\c!direction=\v!left,
+ \c!balance=\v!no,
+ \c!n=\v!fit,
+ \c!distance=1.5\bodyfontsize]
+
+%D We can set up vertical typesetting with \type
+%D {\setupchinese}.
+
+%D \macros
+%D {nochineseinvertical}
+%D
+%D English (non chinese) text is typeset rotated:
+
+\def\nochineseinvertical#1%
+ {\par
+ \setbox\scratchbox\hbox{\strut#1}
+ \getnoflines{\wd\scratchbox}
+ \setbox\scratchbox\hbox to \noflines\openlineheight
+ {\hss\box\scratchbox\hss}
+ \hbox to \hsize
+ {\hss
+ \rotate
+ [\c!rotation=270]
+ {\vbox to \ht\scratchbox{\vss\box\scratchbox\vss}}%
+ \hss}
+ \par}
+
+%D \macros
+%D {correctchineseboundarychars}
+%D
+%D Careful reading of the previous macro learns that we
+%D treat left and right glyphs differently. When we say
+%D
+%D \starttyping
+%D \correctchineseboundarycharstrue
+%D \stoptyping
+%D
+%D For the moment correction in on by default.
+
+\correctchineseboundarycharstrue
+
+\def\chineserightcharcommand#1%
+ {\iftracechinese\ruledhbox\else\hbox\fi \!!to .5em{#1\hss}%
+ \hskip.25em\!!plus .25em\relax}%
+
+\def\chineseleftcharcommand#1%
+ {\ifnum\chineseBstatus<4 \hskip.25em \!!plus .25em\relax\fi
+ \iftracechinese\ruledhbox\else\hbox\fi \!!to .5em{\hss#1}}%
+
+% \def\chineserightcharcommand#1%
+% {\setbox\scratchbox=\hbox{#1}%
+% \scratchdimen=.5em
+% \ifdim\wd\scratchbox>\scratchdimen
+% \iftracechinese\ruledhbox\else\hbox\fi \!!to \scratchdimen
+% {\box\scratchbox\hss}%
+% \hskip.5\scratchdimen\!!plus.5\scratchdimen\relax
+% \else
+% \box\scratchbox
+% \fi}
+
+% \def\chineseleftcharcommand#1%
+% {\setbox\scratchbox=\hbox{#1}%
+% \scratchdimen=.5em
+% \ifdim\wd\scratchbox>\scratchdimen
+% \ifnum\chineseBstatus<4
+% \hskip.5\scratchdimen\!!plus.5\scratchdimen\relax
+% \fi
+% \iftracechinese\ruledhbox\else\hbox\fi \!!to \scratchdimen
+% {\hss\box\scratchbox}%
+% \else
+% \box\scratchbox
+% \fi}
+
+%D The long list of numbers in the previous macro identify the
+%D characters where special care is needed for breaking lines.
+%D A linebreak is not permitted before:
+%D
+%D \def\DoIt #1 #2 %
+%D {\hbox{\hbox to 2em{\uchar{#1}{#2}\hss}#1 #2}\par}
+%D
+%D \startcolumns[n=5]
+%D \DoIt 161 162 \DoIt 161 163 \DoIt 161 164 \DoIt 161 167 \DoIt 161 173
+%D \DoIt 161 175 \DoIt 161 177 \DoIt 161 179 \DoIt 161 181 \DoIt 161 183
+%D \DoIt 161 185 \DoIt 161 187 \DoIt 161 189 \DoIt 161 191 \DoIt 161 227
+%D \DoIt 161 228 \DoIt 161 229 \DoIt 163 161 \DoIt 163 162 \DoIt 163 167
+%D \DoIt 163 169 \DoIt 163 172 \DoIt 163 174 \DoIt 163 186 \DoIt 163 187
+%D \DoIt 163 190 \DoIt 163 191 \DoIt 163 221 \DoIt 163 253
+%D \stopcolumns
+%D
+%D A linebreak is not permitted after the following glyphs:
+%D
+%D \startcolumns[n=5]
+%D \DoIt 161 174 \DoIt 161 176 \DoIt 161 178 \DoIt 161 180 \DoIt 161 182
+%D \DoIt 161 184 \DoIt 161 186 \DoIt 161 188 \DoIt 161 190 \DoIt 163 168
+%D \DoIt 163 219 \DoIt 163 224 \DoIt 163 251
+%D \stopcolumns
+
+%D \macros
+%D {tracechinesetrue, showchinesetracelegend}
+%D
+%D When we say \type {\tracechinesetrue}, we get some
+%D insight in the way \CONTEXT\ handles the Chinese glyphs.
+%D The symbols and color used represent:
+%D
+%D \showchinesetracelegend
+
+\newif\iftracechinese
+
+\def\showchinesetracelegend
+ {\definetabulate[\s!dummy][|c|l|l|l|]%
+ \startdummy
+ \HL
+ \NC \bf key \NC \bf meaning \NC \bf glyph \NC \bf keys \NC\NR
+ \HL
+ \NC u \NC unknown character type \NC \color[green]{current} \NC u l r \NC\NR
+ \NC l \NC left boundary character \NC \color[red]{previous} \NC u l r c n \NC\NR
+ \NC r \NC right boundary character \NC \color[blue]{next} \NC u l r s \NC\NR
+ \NC c \NC chinese character \NC \NC \NC\NR
+ \NC s \NC following space \NC \NC \NC\NR
+ \NC n \NC no preceding space \NC \NC \NC\NR
+ \HL
+ \stopdummy}
+
+\def\tracedchineseglyph
+ {\dontleavehmode
+ \ruledhbox
+ {\setbox\scratchbox\hbox{\insertunicodeglyph}%
+ \hbox to \wd\scratchbox
+ {\localcolortrue
+ \copy\scratchbox
+ \infofont
+ \hskip-\wd\scratchbox
+ \hbox to \wd\scratchbox
+ {\hss
+ \color[green]{\ifcase\chineseSstatus\relax u\or l\or r\fi}%
+ \hss}%
+ \hskip-\wd\scratchbox
+ \lower\dp\scratchbox\hbox to \wd\scratchbox
+ {\hss
+ \color[red]{\ifcase\chineseBstatus\relax u\or l\or r\or c\or n\fi}%
+ \hss
+ \color[blue]{\ifcase\chineseAstatus\relax u\or l\or r\or s\fi}%
+ \hss}}}}
+
+%D The following example shows how tracing works.
+%D
+%D \start \tracechinesetrue
+%D һθǽܶĵ֧֡ĵ
+%D ѯ \nochinese{\CONTEXT} ǷܴʱѾԹ
+%D еĺ꼯ûеõζŶĵֻ֧û
+%D ʵ֡
+%D
+%D һ(θ) () ܶĵ֧֡ĵ,
+%D ѯ\nochinese{\CONTEXT}ǷܴʱѾ
+%D Թеĺ꼯ûеõζŶĵ֧
+%D ûʵ֡.
+%D \stop
+
+%D Because fonts are defined each time a \UNICODE\ is
+%D encountered |<|which is less inefficient than one would
+%D imagine, because \TEX\ is optimized quite well in this
+%D repect|>| we can define macros like this to take care of
+%D font switches. When available, one can add definitions
+%D for italic, slanted, bold fonts and combinations of these.
+
+%D \macros
+%D {chinesenumber}
+%D
+%D The chinese numbering systems rather straightforward. First
+%D there are the digits:
+%D
+%D \starttabulate[|c|c|c|c|c|c|c|c|c|c|]
+%D \NC 0 \NC 1 \NC 2 \NC 3 \NC 4 \NC 5 \NC 6 \NC 7 \NC 8 \NC 9 \NC\NR
+%D \NC \chinesenumber{0} \NC \chinesenumber{1} \NC \chinesenumber{2}
+%D \NC \chinesenumber{3} \NC \chinesenumber{4} \NC \chinesenumber{5}
+%D \NC \chinesenumber{6} \NC \chinesenumber{7} \NC \chinesenumber{8}
+%D \NC \chinesenumber{9} \NC\NR
+%D \stoptabulate
+%D
+%D Apart from these numbers, we have dedicated representations
+%D of some powers of~$10$.
+%D
+%D \starttabulate[|c|c|c|c|c|]
+%D \NC 10 \NC 100 \NC 1000 \NC 10000 \NC 100000000 \NC\NR
+%D \NC \chinesenumber{10} \NC \chinesenumber{100}
+%D \NC \chinesenumber{1000} \NC \chinesenumber{10000}
+%D \NC \chinesenumber{100000000} \NC\NR
+%D \stoptabulate
+%D
+%D The number~12 is a combination of $1\times10+2$, or:
+%D \chinesenumber {12}, while~22 becomes \chinesenumber {22}.
+%D The numbers below 20 are treated a bit different, just like
+%D numbers with series of $0$'s. So $2\times10$ comes out as
+%D two glyphs, but $1\times10$ as one, because in the latter
+%D case the~$1$ is redundant. The same is true for the powers
+%D of~10.
+%D
+%D \starttabulate[|r|r|r|r|r|r|]
+%D \NC 1 \NC \chinesenumber {1} \NC
+%D 9 \NC \chinesenumber {9} \NC
+%D 4 \NC \chinesenumber {4} \NC\NR
+%D \NC 11 \NC \chinesenumber {11} \NC
+%D 99 \NC \chinesenumber {99} \NC
+%D 16 \NC \chinesenumber {16} \NC\NR
+%D \NC 111 \NC \chinesenumber {111} \NC
+%D 999 \NC \chinesenumber {999} \NC
+%D 256 \NC \chinesenumber {256} \NC\NR
+%D \NC 1111 \NC \chinesenumber {1111} \NC
+%D 9999 \NC \chinesenumber {9999} \NC
+%D 65536 \NC \chinesenumber {65536} \NC\NR
+%D \stoptabulate
+%D
+%D The implementation is rather simple. For internal purposes,
+%D we let zero expand to~0. The digits $0-9$ and numbers $10$,
+%D $100$, $1000$, $10000$ and $100000000$ are hard coded.
+
+% This was the first implementation, before \WangLei\ asked
+% me to look into Big Five encoding, so, like everthing in
+% \TEX, things become a bit more complicated, but also more
+% versatile.
+%
+% \starttypen
+% \def\chinesedigit#1%
+% {\ifnum #1=100000000 \uchar{210}{218}% 100000000
+% \else\ifnum #1=10000 \uchar{205}{242}% 10000
+% \else\ifnum #1=1000 \uchar{199}{167}% 1000
+% \else\ifnum #1=100 \uchar{176}{217}% 100
+% \else\ifnum #1=10 \uchar{202}{174}% 10
+% \else\ifcase#1 \uchar{193}{227}% 0
+% \or \uchar{210}{187}% 1
+% \or \uchar{182}{254}% 2
+% \or \uchar{200}{253}% 3
+% \or \uchar{203}{196}% 4
+% \or \uchar{206}{229}% 5
+% \or \uchar{193}{249}% 6
+% \or \uchar{198}{223}% 7
+% \or \uchar{176}{203}% 8
+% \or \uchar{190}{197}% 9
+% \fi\fi\fi\fi\fi\fi}
+% \stoptypen
+
+%D We will implement four methods, the one described earlier,
+%D a derived one with capitalized characters, an extended
+%D version of the first method, and a rather Arabic method.
+%D
+%D \starttabulate[|l|l|]
+%D \HL
+%D \NC \bf command \NC \bf number 39 \NC\NR
+%D \HL
+%D \NC \type{\normalchinesenumber} \NC \normalchinesenumber {39} \NC\NR
+%D \NC \type{\capitalizedchinesenumber} \NC \capitalizedchinesenumber{39} \NC\NR
+%D \NC \type{\arabicchinesenumber} \NC \arabicchinesenumber {39} \NC\NR
+%D \NC \type{\extendedchinesenumber} \NC \extendedchinesenumber {39} \NC\NR
+%D \HL
+%D \stoptabulate
+%D
+%D We use a dirty trick to enable Chinese Capital Digits. In
+%D the encoding vectors, we define these by appending a suffix
+%D \type {*} to the digit, which in the following macro is
+%D appended or not (by passing \type {\empty}).
+
+\def\chinesedigit#1#2% #2: suffix, here * or \empty
+ {\udigit{\chineseencoding}{\number#1#2}}
+
+% Normal Chinese Number
+
+\def\normalchinesenumber#1%
+ {\expandafter\dochinesenumber\number#1\relax\empty}
+
+\def\dochinesenumber#1#2\relax#3%
+ {\ifnum#1#2<10 % 1-10
+ \chinesedigit{#1}#3%
+ \else\ifnum#1#2<20 % 11-99
+ \chinesedigit{10}#3%
+ \dodochinesenumberA#2\relax#3%
+ \else
+ \dodochinesenumber#1#2\relax#3%
+ \fi\fi}
+
+\def\dodochinesenumber#1#2\relax#3%
+ {\ifnum#1=0
+ \chinesedigit{0}#3%
+ \dododochinesenumber0#2\relax#3%
+ \else\ifnum#1#2<10 % 1-10
+ \chinesedigit{#1#2}#3%
+ \dodochinesenumberA#2\relax#3%
+ \else\ifnum#1#2<100 % 11-99
+ \dodochinesenumber#1\relax#3%
+ \chinesedigit{10}#3%
+ \dodochinesenumberA#2\relax#3%
+ \else\ifnum#1#2<1000 % 100-999
+ \dodochinesenumber#1\relax#3%
+ \chinesedigit{100}#3%
+ \dodochinesenumberA#2\relax#3%
+ \else\ifnum#1#2<10000 % 1000-9999
+ \dodochinesenumber#1\relax#3%
+ \chinesedigit{1000}#3%
+ \dodochinesenumberA#2\relax#3%
+ \else\ifnum#1#2<100000 % 10000-99999
+ \dodochinesenumber#1\relax#3%
+ \chinesedigit{10000}#3%
+ \dodochinesenumberA#2\relax#3%
+ \else\ifnum#1#2<1000000 % 100000-999999
+ \dodochinesenumberB#1#2\relax#3%
+ \else\ifnum#1#2<10000000 % 1000000-9999999
+ \dodochinesenumberC#1#2\relax#3%
+ \else\ifnum#1#2<100000000 % 10000000-99999999
+ \dodochinesenumberD#1#2\relax#3%
+ \else\ifnum#1#2<1000000000 % 10000000-99999999
+ \dochinesenumber#1\relax#3%
+ \chinesedigit{100000000}#3%
+ \dododochinesenumber#2\relax#3%
+ \else
+ \dodochinesenumberE#1#2\relax#3%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
+
+\def\dododochinesenumber#1#2\relax#3%
+ {\ifnum#1=0
+ \ifnum0#2>0 \dododochinesenumber#2\relax#3\fi
+ \else
+ \dodochinesenumber#1#2\relax#3%
+ \fi}
+
+\def\dodochinesenumberA#1\relax#2%
+ {\ifcase0#1 \else\dodochinesenumber#1\relax#2\fi}
+
+\def\dodochinesenumberB#1#2#3\relax#4%
+ {\dochinesenumber#1#2\relax#4%
+ \chinesedigit{10000}#4%
+ \dododochinesenumber#3\relax#4}
+
+\def\dodochinesenumberC#1#2#3#4\relax#5%
+ {\dochinesenumber#1#2#3\relax#5%
+ \chinesedigit{10000}#5%
+ \dododochinesenumber#4\relax#5}
+
+\def\dodochinesenumberD#1#2#3#4#5\relax#6%
+ {\dochinesenumber#1#2#3#4\relax#6%
+ \chinesedigit{10000}#6%
+ \dododochinesenumber#5\relax#6}
+
+\def\dodochinesenumberE#1#2#3\relax#4%
+ {\dochinesenumber#1#2\relax#4%
+ \chinesedigit{100000000}#4%
+ \dododochinesenumber#3\relax#4}
+
+% Capitalized Chinese Number
+
+\def\capitalizedchinesenumber#1%
+ {\expandafter\dochinesenumber\number#1\relax*}
+
+% Extended Chinese Number
+
+\def\extendedchinesenumber#1%
+ {\expandafter\doextendedchinesenumber\number#1\relax}
+
+\def\doextendedchinesenumber#1#2\relax%
+ {\ifnum #1#2<20 % 0-19
+ \dochinesenumber#1#2\relax\empty
+ \else\ifnum#1#2<30 % 20-29
+ \chinesedigit{20}\empty
+ \ifcase#2\else\chinesedigit{2#2}\fi
+ \else\ifnum#1#2<40 % 30-39
+ \chinesedigit{30}\empty
+ \ifcase#2\else\chinesedigit{3#2}\fi
+ \else
+ \dochinesenumber#1#2\relax\empty
+ \fi\fi\fi}
+
+% Arabic Chinese Number
+
+\def\arabicchinesenumber#1%
+ {\expandafter\doarabicchinesenumber\number#1@\relax}
+
+\def\doarabicchinesenumber#1#2\relax
+ {\if#1@\else
+ \chinesedigit{#1}\empty
+ \doarabicchinesenumber#2\relax
+ \fi}
+
+% The short call:
+
+\def\chinesenumber{\normalchinesenumber}
+
+% \dorecurse{40}
+% {\hbox
+% {\processingverbatimtrue
+% \hbox to 1cm{\hss\recurselevel}\quad
+% \hbox to 3cm{\hss\strut\normalchinesenumber {\recurselevel}}\quad
+% \hbox to 3cm{\hss\strut\capitalizedchinesenumber{\recurselevel}}\quad
+% \hbox to 3cm{\hss\strut\arabicchinesenumber {\recurselevel}}\quad
+% \hbox to 3cm{\hss\strut\extendedchinesenumber {\recurselevel}}\crlf}}
+
+%D The next table demonstates the correctness of the
+%D conversion macro.
+%D
+%D \startbuffer
+%D \starttable[|l|l|l|l|l|l|]
+%D \HL
+%D \NC number \NC converter \NC hard coded \NC
+%D number \NC converter \NC hard coded\NC \SR
+%D \HL
+%D \NC 1 \NC \chinesenumber{1} \NC һ \NC
+%D 0 \NC \chinesenumber{0} \NC \NC\FR
+%D \NC 11 \NC \chinesenumber{11} \NC ʮһ \NC
+%D 10 \NC \chinesenumber{10} \NC ʮ \NC\MR
+%D \NC 111 \NC \chinesenumber{111} \NC һһʮһ \NC
+%D 100 \NC \chinesenumber{100} \NC һ \NC\MR
+%D \NC 101 \NC \chinesenumber{101} \NC һһ \NC
+%D 120 \NC \chinesenumber{120} \NC һٶʮ \NC\MR
+%D \NC 1111 \NC \chinesenumber{1111} \NC һǧһһʮһ \NC
+%D 1000 \NC \chinesenumber{1000} \NC һǧ \NC\MR
+%D \NC 1001 \NC \chinesenumber{1001} \NC һǧһ \NC
+%D 1020 \NC \chinesenumber{1020} \NC һǧʮ \NC\MR
+%D \NC 11111 \NC \chinesenumber{11111} \NC һһǧһһʮһ \NC
+%D 10000 \NC \chinesenumber{10000} \NC һ \NC\MR
+%D \NC 10001 \NC \chinesenumber{10001} \NC һһ \NC
+%D 10200 \NC \chinesenumber{10200} \NC һ \NC\LR
+%D \HL
+%D \NC 111111 \NC \chinesenumber{111111} \NC ʮһһǧһһʮһ \NC
+%D 100000 \NC \chinesenumber{100000} \NC ʮ \NC\FR
+%D \NC 1111111 \NC \chinesenumber{1111111} \NC һһʮһһǧһһʮһ \NC
+%D 1000000 \NC \chinesenumber{1000000} \NC һ \NC\MR
+%D \NC 11111111 \NC \chinesenumber{11111111} \NC һǧһһʮһһǧһһʮһ \NC
+%D 10000000 \NC \chinesenumber{10000000} \NC һǧ \NC\MR
+%D \NC 111111111 \NC \chinesenumber{111111111} \NC һһǧһһʮһһǧһһʮһ \NC
+%D 100000000 \NC \chinesenumber{100000000} \NC һ \NC\MR
+%D \NC 1111111111 \NC \chinesenumber{1111111111} \NC ʮһһǧһһʮһһǧһһʮһ \NC
+%D 1000000000 \NC \chinesenumber{1000000000} \NC ʮ \NC\LR
+%D \HL
+%D \stoptable
+%D \stopbuffer
+%D
+%D \placetable{Some Chinese number examples.}{\getbuffer}
+
+%D Although the conversion can be hooked into most commands
+%D that deal with numbers |<|those familiar with \TEX\ macro
+%D programming will notice that the macro if fully
+%D expandable|>| in many cases Chinese documents use western
+%D digits. So, in practice, the change that the next example
+%D shows up, is minimal.
+%D
+%D \starttabulate[|r|r|c|]
+%D \NC 2546 \NC \chinesenumber {2546} \NC \NC\NR
+%D \NC 9258 \NC \chinesenumber {9258} \NC $+$ \NC\NR
+%D \HL
+%D \NC 11804 \NC \chinesenumber {11804} \NC \NC\NR
+%D \stoptabulate
+%D
+%D While in arabic arithmics addition leads to more digits, in
+%D Chinese the number of glyphs can (temporary) decrease.
+%D Given that the number of people dealing with Chinese is
+%D considerably larger than the number of latin speaking
+%D people, a successor of \TEX\ definitely must provide a
+%D \type {\chinesenumeral} primitive.
+
+\defineconversion [c] [\normalchinesenumber]
+\defineconversion [chinese] [\normalchinesenumber]
+\defineconversion [nc] [\normalchinesenumber]
+\defineconversion [normalchinese] [\normalchinesenumber]
+\defineconversion [cc] [\capitalizedchinesenumber]
+\defineconversion [capitalizedchinese] [\capitalizedchinesenumber]
+\defineconversion [ec] [\extendedchinesenumber]
+\defineconversion [extendedchinese] [\extendedchinesenumber]
+\defineconversion [ac] [\arabicchinesenumber]
+\defineconversion [arabicchinese] [\arabicchinesenumber]
+
+%D Date conversion:
+
+\defineconversion [cn] [\v!day] [\chinesenumber]
+\defineconversion [cn] [\v!month] [\chinesenumber]
+\defineconversion [cn] [\v!year] [\chinesenumber]
+
+%D \macros
+%D {SimChi, TraChi}
+%D
+%D These components enable us to construct dedicated Chinese
+%D font switches, like:
+
+\setupunicodefont
+ [chinese]
+ [ \c!scale=\chineseunicodescale,
+ \c!height=\chineseunicodeheight,
+ \c!depth=\chineseunicodedepth,
+ \c!strut=\v!yes,
+ \c!interlinespace=\v!yes,
+ \c!conversion=\chinesenumber,
+ \c!commands=\setchineseencoding, % needed for digits
+ \c!command=\handlechineseunicodeglyph]
+
+%D For the moment, this encoding is implemented rather ugly. The
+%D trick is to move the encoding value from the current font
+%D definition to the \type {\chineseencoding} macro.
+
+\let\chineseencoding\empty
+
+\def\setchineseencoding % normally SomeChineseRegular
+ {\getfontfileparameters\unicodestyle
+ \ifx\currentfontfileencoding\undefined \else
+ \let\chineseencoding\currentfontfileencoding
+ \fi}
+
+%D We could have said:
+%D
+%D \starttyping
+%D \defineunicodefont
+%D [SimChi]
+%D [SimplifiedChinese]
+%D [\c!scale=\chineseunicodescale,
+%D \c!height=\chineseunicodeheight,
+%D \c!depth=\chineseunicodedepth,
+%D \c!conversion=\chinesenumber,
+%D \c!commands=\setchineseencoding, % needed for digits
+%D \c!command=\handlechineseunicodeglyph]
+%D \stoptyping
+%D
+%D However, the former definitions is more general. Next we
+%D map a few fonts:
+
+\definefontsynonym [SimplifiedChineseRegular] [gbsong] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseSlanted] [gbsongsl] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseItalic] [gbsongsl] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseBold] [gbhei] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseBoldSlanted] [gbheisl] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseBoldItalic] [gbheisl] [encoding=gbk]
+
+\definefontsynonym [TraditionalChineseRegular] [b5song] [encoding=big5]
+\definefontsynonym [TraditionalChineseSlanted] [b5songsl] [encoding=big5]
+\definefontsynonym [TraditionalChineseItalic] [b5songsl] [encoding=big5]
+\definefontsynonym [TraditionalChineseBold] [b5hei] [encoding=big5]
+\definefontsynonym [TraditionalChineseBoldSlanted] [b5heisl] [encoding=big5]
+\definefontsynonym [TraditionalChineseBoldItalic] [b5heisl] [encoding=big5]
+
+% we need to move this to typescripts
+
+\doifelse \currentregime {utf} {
+
+ \definefontsynonym [SimplifiedChineseRegular] [ChineseRegular]
+ \definefontsynonym [SimplifiedChineseSlanted] [ChineseSlanted]
+ \definefontsynonym [SimplifiedChineseItalic] [ChineseItalic]
+ \definefontsynonym [SimplifiedChineseBold] [ChineseBold]
+ \definefontsynonym [SimplifiedChineseBoldSlanted] [ChineseBoldSlanted]
+ \definefontsynonym [SimplifiedChineseBoldItalic] [ChineseBoldItalic]
+
+ \definefontsynonym [TraditionalChineseRegular] [ChineseRegular]
+ \definefontsynonym [TraditionalChineseSlanted] [ChineseSlanted]
+ \definefontsynonym [TraditionalChineseItalic] [ChineseItalic]
+ \definefontsynonym [TraditionalChineseBold] [ChineseBold]
+ \definefontsynonym [TraditionalChineseBoldSlanted][ChineseBoldSlanted]
+ \definefontsynonym [TraditionalChineseBoldItalic] [ChineseBoldItalic]
+
+ \definefontsynonym [ChineseRegular] [uni-htsong-][encoding=cjk-uni]
+ \definefontsynonym [ChineseSlanted] [uni-htsong-][encoding=cjk-uni]
+ \definefontsynonym [ChineseItalic] [uni-htsong-][encoding=cjk-uni]
+ \definefontsynonym [ChineseBold] [uni-hthei-] [encoding=cjk-uni]
+ \definefontsynonym [ChineseBoldSlanted][uni-hthei-] [encoding=cjk-uni]
+ \definefontsynonym [ChineseBoldItalic] [uni-hthei-] [encoding=cjk-uni]
+
+ \loadmapfile[uni-htsong.map]
+ \loadmapfile[uni-htfs.map]
+ \loadmapfile[uni-hthei.map]
+ \loadmapfile[uni-htkai.map]
+
+} {
+
+ \loadmapfile[gbk]
+
+}
+
+\defineunicodefont [SimChi] [SimplifiedChinese] [chinese]
+\defineunicodefont [TraChi] [TraditionalChinese] [chinese]
+
+%D We default to these so called Simplified Chinese fonts.
+
+\SimChi
+
+%D In addition to these fonts, we (pre|)|define some commonly
+%D used fonts:
+
+\definefontsynonym [SimplifiedChineseSongTiRegular] [gbsong] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseSongTiSlanted] [gbsongsl] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseSongTiBold] [gbsong] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseSongTiBoldSlanted] [gbsongsl] [encoding=gbk]
+
+\definefontsynonym [TraditionalChineseSongTiRegular] [b5song] [encoding=big5]
+\definefontsynonym [TraditionalChineseSongTiSlanted] [b5songsl] [encoding=big5]
+\definefontsynonym [TraditionalChineseSongTiBold] [b5song] [encoding=big5]
+\definefontsynonym [TraditionalChineseSongTiBoldSlanted] [b5songsl] [encoding=big5]
+
+\definefontsynonym [SimplifiedChineseHeiTiRegular] [gbhei] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseHeiTiSlanted] [gbheisl] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseHeiTiBold] [gbhei] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseHeiTiBoldSlanted] [gbheisl] [encoding=gbk]
+
+\definefontsynonym [TraditionalChineseHeiTiRegular] [b5hei] [encoding=big5]
+\definefontsynonym [TraditionalChineseHeiTiSlanted] [b5heisl] [encoding=big5]
+\definefontsynonym [TraditionalChineseHeiTiBold] [b5hei] [encoding=big5]
+\definefontsynonym [TraditionalChineseHeiTiBoldSlanted] [b5heisl] [encoding=big5]
+
+\definefontsynonym [SimplifiedChineseKaiTiRegular] [gbkai] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseKaiTiSlanted] [gbkaisl] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseKaiTiBold] [gbkai] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseKaiTiBoldSlanted] [gbkaisl] [encoding=gbk]
+
+\definefontsynonym [TraditionalChineseKaiTiRegular] [b5kai] [encoding=big5]
+\definefontsynonym [TraditionalChineseKaiTiSlanted] [b5kaisl] [encoding=big5]
+\definefontsynonym [TraditionalChineseKaiTiBold] [b5kai] [encoding=big5]
+\definefontsynonym [TraditionalChineseKaiTiBoldSlanted] [b5kaisl] [encoding=big5]
+
+\definefontsynonym [SimplifiedChineseFangSongRegular] [gbfs] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseFangSongSlanted] [gbfssl] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseFangSongBold] [gbfs] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseFangSongBoldSlanted] [gbfssl] [encoding=gbk]
+
+\definefontsynonym [TraditionalChineseFangSongRegular] [b5fs] [encoding=big5]
+\definefontsynonym [TraditionalChineseFangSongSlanted] [b5fssl] [encoding=big5]
+\definefontsynonym [TraditionalChineseFangSongBold] [b5fs] [encoding=big5]
+\definefontsynonym [TraditionalChineseFangSongBoldSlanted] [b5fssl] [encoding=big5]
+
+\definefontsynonym [SimplifiedChineseLiShuRegular] [gbli] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseLiShuSlanted] [gblisl] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseLiShuBold] [gbli] [encoding=gbk]
+\definefontsynonym [SimplifiedChineseLiShuBoldSlanted] [gblisl] [encoding=gbk]
+
+\definefontsynonym [TraditionalChineseLiShuRegular] [b5li] [encoding=big5]
+\definefontsynonym [TraditionalChineseLiShuSlanted] [b5lisl] [encoding=big5]
+\definefontsynonym [TraditionalChineseLiShuBold] [b5li] [encoding=big5]
+\definefontsynonym [TraditionalChineseLiShuBoldSlanted] [b5lisl] [encoding=big5]
+
+%D The following definitions provide us the commands to switch
+%D to these fonts.
+
+\defineunicodefont [SimSongTi] [SimplifiedChineseSongTi] [chinese]
+\defineunicodefont [TraSongTi] [TraditionalChineseSongTi] [chinese]
+
+\defineunicodefont [SimHeiTi] [SimplifiedChineseHeiTi] [chinese]
+\defineunicodefont [TraHeiTi] [TraditionalChineseHeiTi] [chinese]
+
+\defineunicodefont [SimKaiTi] [SimplifiedChineseKaiTi] [chinese]
+\defineunicodefont [TraKaiTi] [TraditionalChineseKaiTi] [chinese]
+
+\defineunicodefont [SimFangSong] [SimplifiedChineseFangSong] [chinese]
+\defineunicodefont [TraFangSong] [TraditionalChineseFangSong] [chinese]
+
+\defineunicodefont [SimLiShu] [SimplifiedChineseLiShu] [chinese]
+\defineunicodefont [TraLiShu] [TraditionalChineseLiShu] [chinese]
+
+% \definealternativestyle [ChineseTitleFont] [\bfd\SimKaiTi] []
+
+%D \macros
+%D {purechinese}
+%D
+%D Use this macro to suppress spacing around Chinese text.
+
+\def\purechinese#1% evt geen rek
+ {\hskip\chineseSsignal\relax
+ #1\unskip\unskip\unskip
+ \hskip\chineseSsignal\relax}
+
+%D \macros
+%D {stillchinese}
+%D
+%D Use the next macro when you want the next item to be put
+%D tight to the previous chinese character.
+
+\def\stillchinese
+ {\hskip\chineseSsignal\relax}
+
+%D \macros
+%D {nochinese}
+%D
+%D When we want to be sure of non||Chinese inline text,
+%D we can package the for instance english text in \type
+%D {\nochinese}.
+
+\def\nochinese#1%
+ {\unskip\unskip\unskip
+ \hskip\chinesesurroundskip
+ \hskip\chineseinterglyphskip\relax
+ #1%
+ \hskip\chineseinterglyphskip\relax
+ \hskip\chinesesurroundskip
+ \ignorespaces}
+
+%D \macros
+%D {chisize}
+%D
+%D Chinese font sizes are specified in a different way,
+%D using positive and negative numbers:
+
+\def\chisize#1%
+ {\ifnum#11<0 % a trick to catch -0
+ \ifcase#1\space36\or24\or18\or15\or12\or9\or\else6.5\fi
+ \else
+ \ifcase#1\space42\or26\or22\or16\or14\or10.5\or7.5\or5.5\else5\fi
+ \fi pt}
+
+%D So:
+%D
+%D \startbuffer
+%D [\chisize{-1}] [\chisize{7}] [\chisize{+4}]
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D gives:
+%D
+%D \getbuffer
+%D
+%D The full range of sizes is:
+%D
+%D \starttabulate[|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|]
+%D \NC 8 \NC 7 \NC -6 \NC 6 \NC
+%D -5 \NC 5 \NC -4 \NC 4 \NC
+%D -3 \NC 3 \NC -2 \NC 2 \NC
+%D -1 \NC 1 \NC -0 \NC 0 \NC\NR
+%D \NC\chisize {8}\NC\chisize{7}\NC\chisize{-6}\NC\chisize{6}\NC
+%D \chisize{-5}\NC\chisize{5}\NC\chisize{-4}\NC\chisize{4}\NC
+%D \chisize{-3}\NC\chisize{3}\NC\chisize{-2}\NC\chisize{2}\NC
+%D \chisize{-1}\NC\chisize{1}\NC\chisize{-0}\NC\chisize{0}\NC\NR
+%D \stoptabulate
+
+%D Now it's time for some real Chinese. This example
+%D also shows that font switching is supported.
+%D
+%D \startnarrower
+%D \midaligned{\tfd ˮͷ}
+%D \blank
+%D \midaligned{\tfb ﵩƪ滳ɡ}
+%D \blank
+%D \midaligned{\tfb }
+%D \blank
+%D ¼ʱУѾ졣֪ϹڣϦǺꣿ˷ȥ
+%D ֿ¥ߴʤŪӰ˼䣿
+%D \blank
+%D תͻߡӦкޣƫʱԲбϣ
+%D Բȱ¹ȫԸ˳ãǧﹲ濾ꡣ
+%D \stopnarrower
+%D
+%D The english translation is:
+%D
+%D \startnarrower
+%D \midaligned{\tfd Tune: Prelude to the Melody of Water}
+%D \blank
+%D \midaligned{\tfb On the night of the Mid||Autumn Festival of
+%D 1076, I drank happily till dawn and wrote this in my cups
+%D while thinking of Zi||you.}
+%D \blank
+%D \midaligned{\tfb Su Shi}
+%D \blank
+%D How long will the bright moon appear? Wine||cup in hand, I
+%D ask the sky. I do not know waht time of year it would be
+%D tonight in the palace on high. Riding the wind, there I
+%D would fly, yet I fear the crystal palace would be far too
+%D high and cold for me. I rise and dance, with my shadow I
+%D play. On high as on earth, would it be as gay?
+%D \blank
+%D The moon goes round the mansion red though gauze||draped
+%D windows soft to shed her light upon the sleepless bed.
+%D Against man she should have no spite. Why then when people
+%D part is she oft full and bright? Men have sorrow and joy,
+%D they part or meet again; The moon may be bright or dim, she
+%D may wax or wane. There has been nothing perfect since the
+%D olden days. So let us wish that man will live long as he
+%D can! Though miles apart, we'll share the beauty she
+%D displays.
+%D \stopnarrower
+
+%D This package is written in the city of Hasselt, a pretty
+%D small town in the |<|compared to China real small|>|
+%D Netherlands. Like most dutch cities, even this small one
+%D has a chinese restaurant, run by chinese, speaking chinese,
+%D and |<|indeed|>| writing chinese. Eating there will never
+%D be the same, since now I can at least pretend to know the
+%D glyphs all around the place. The numbers should pose me no
+%D problems, but I fear I will never manage to recognize those
+%D scribles they draw on their pads when thay take your order.
+
+%D To make our lives more easy, we put it here (too):
+
+\setuptyping[\c!tab=\v!no]
+
+\protect \endinput
diff --git a/tex/context/base/font-chi.tex b/tex/context/base/font-chi.tex
deleted file mode 100644
index 0acf710d5..000000000
--- a/tex/context/base/font-chi.tex
+++ /dev/null
@@ -1,1156 +0,0 @@
-%D \module
-%D [ file=font-chi,
-%D version=1999.10.10,
-%D title=\CONTEXT\ Font Macros,
-%D subtitle=Chinese,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D suggestions=Wang Lei,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\ifx\handlechineseunicodeglyph\undefined \else \endinput \fi
-
-% NOT YET ADAPTED TO THE NEW FONT MACROS
-
-%D The first implementation (most of which is here) is based on
-%D the specific font layout. This is because not all glyphs are
-%D available in uniciode, which means that we cannot use
-%D unicode codepoints (yet); if it were possible we could use
-%D just one table per input encoding.
-
-\writestatus{loading}{ConTeXt Font Macros / Chinese}
-
-% much will to typo-chi.tex
-
-%D Still to be implemented:
-%D
-%D \startitemize
-%D \item columns left right touch
-%D \item distance = (hsize-n*bodyfontsize)/(n-1)
-%D \item char grids
-%D \item char tables
-%D \item all kind of rotated combinations
-%D \item hanging puctuation
-%D \item a few more encodings
-%D \item rotation list
-%D \stopitemize
-
-%M \setupbodyfont[chi]
-%M
-%M \def\WangLei{\purechinese{\uchar{205}{245}\uchar{192}{218}}}
-
-\useencoding[chi]
-
-%D When \WangLei\ sent me a mail asking if \CONTEXT\ was able
-%D to support Chinese, I wasn't sure if the answer could be
-%D yes. I knew that those languages, rich of glyphs, were
-%D typeset by \TEX, so in principle it should be possible. I
-%D asked or some more input and was told that there were
-%D \LATEX\ styles regarding those languages. When I unzipped
-%D the accompanying files, it became clear that I had to
-%D implement support for Chinese from scratch. There was a
-%D multitude of font, with rather unfamiliar encodings, a
-%D large collection of files with |<|at least for me|>|
-%D unknown purposes, and worse, the documentation was mainly
-%D in Chinese.
-%D
-%D So, \WangLei\ and I started exchanging some emails and it
-%D soon became clear that supporting Chinese was not that
-%D complicated at all. It mostly came to dealing with handling
-%D \UNICODE\ fonts. It also became clear that everything
-%D Chinese took place in the upper region of the eight bit
-%D character set. I wrote some macros that could process the
-%D small \type {Hello World} file \WangLei\ had send me, and
-%D after some bug fixes real Chinese came out. I started to
-%D like the look and fel of Chinese glyphs, so on we went.
-%D
-%D The first comments concerned spacing. The mix of English
-%D and Chinese demands some rather deliberate handling of
-%D spacing. Breaking lines was not so much a problem, and
-%D could be solved by adding some glue between Chinese glyphs.
-%D
-%D In the meantime had asked \WangLei\ for some language bound
-%D labels and texts, and implementing these was rather
-%D straightforward. But, there were still some issues to deal
-%D with: conversion of numbers, date handling and index
-%D sorting.
-%D
-%D I consider(ed) writing Chinese support to be a nice puzzle,
-%D since I have to act on chinese \CONTEXT\ code, where I only
-%D understand the \CONTEXT\ part. The drawings \WangLei\ made
-%D me (in drawing packages) were of great help. Since I write
-%D these modules from scratch, although I fall back on some
-%D basic encoding and font modules, I consider them to be
-%D rather clean. This cannot be said of all \CONTEXT\ font
-%D modules \type {-)}.
-
-\unprotect
-
-%D Because Chinese glyphs have more height than the average
-%D Latin glyph, and at the same time don't have much depth,
-%D we adapt the scale.
-%D
-%D Before and after the glyph we have to deal with Chinese
-%D spacing. Special attention is given to punctuation.
-%D
-%D \starttyping
-%D [some short nice chinese text with () and english]
-%D \stoptyping
-%D
-%D We insert a bit of stretch and introduce a signal to
-%D keep track of previous characters. We use a similar
-%D method in the units module, which may be a nice
-%D introduction to using signals.
-
-%D \macros
-%D {chineseunicodescale, chineseinterglyphskip,
-%D chineseunicodeheight, chineseunicodedepth, chinesespace}
-%D
-%D There are a few variables, that can be (re|)|set
-%D depending on the current font. They default to:
-
-% hm, why don't we use the normal unicodestrut mechanism?
-
-\def\chineseunicodescale {1.00} % not smaller than .85
-\def\chineseunicodeheight {1.00}
-\def\chineseunicodedepth {1.00}
-\def\chineseinterglyphskip{0pt \!!plus .05em \!!minus .01em}
-\def\chinesesurroundskip {.25em \!!plus .15em \!!minus .05em}
-
-%D We define a few signals. As said, another example of
-%D using signals can be found in the module \type {m-units}.
-
-\newsignal\chineseLsignal % left boundary character
-\newsignal\chineseRsignal % right boundary character
-\newsignal\chineseSsignal % any other character (symbol)
-
-\chardef\chineseBstatus=0 % 0=unknown 1=left 2=right 3=chinese 4=nospace
-\chardef\chineseAstatus=0 % 0=unknown 1=left 2=right 3=space
-\chardef\chineseSstatus=0 % 0=unknown 1=left 2=right
-
-\sfcode`(=2000 % a temporary hack
-
-\def\chinesenobreak
- {\relax
- \iftracechinese
- \nobreak
- \kern-.5pt\color[red]{\vrule\!!width1pt}\kern-.5pt
- \nobreak
- \else
- \nobreak
- \fi}
-
-\newif\ifcorrectchineseboundarychars
-
-\def\chineseunskip
- {\unskip\unskip\unskip\unskip}
-
-\def\insertchineseglyph
- {\iftracechinese\tracedchineseglyph\else\insertunicodeglyph\fi}
-
-\newif\ifverticalchinese
-
-\def\handlechineseunicodeglyph
- {\ifinpagebody
- \horizontalchineseunicodeglyph
- \else\ifverticalchinese
- \verticalchineseunicodeglyph
- \else
- \horizontalchineseunicodeglyph
- \fi\fi}
-
-% chinese classes: left=1|right=2|center=3
-
-\chardef\plusfour=4
-
-\def\analyzechineseunicodeglyph % beware, no zerocount !
- {\chardef\chineseSstatus0\getvalue{uc\number\unicodeposition}\relax}
-
-\def\analyzechineseunicodeenviroment
- {% left
- \ifx (\nextutoken \chardef\chineseAstatus\plusone \else
- \ifx [\nextutoken \chardef\chineseAstatus\plusone \else
- % right
- \ifx ,\nextutoken \chardef\chineseAstatus\plustwo \else
- \ifx .\nextutoken \chardef\chineseAstatus\plustwo \else
- \ifx ?\nextutoken \chardef\chineseAstatus\plustwo \else
- \ifx ;\nextutoken \chardef\chineseAstatus\plustwo \else
- \ifx :\nextutoken \chardef\chineseAstatus\plustwo \else
- \ifx !\nextutoken \chardef\chineseAstatus\plustwo \else
- \ifx )\nextutoken \chardef\chineseAstatus\plustwo \else
- \ifx ]\nextutoken \chardef\chineseAstatus\plustwo \else
- % space
- \ifx\nextutoken\blankspace \chardef\chineseAstatus\plusthree \else
- \ifx\nextutoken\space \chardef\chineseAstatus\plusthree \else
- \chardef\chineseAstatus\zerocount
- % unknown
- \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi \fi\fi
- % maybe save the last skip?
- \chardef\chineseBstatus\ifdim\lastskip=\zeropoint\plusfour\else\zerocount\fi
- \ifdim\lastskip=\chineseLsignal \chardef\chineseBstatus\plusone \else
- \ifdim\lastskip=\chineseRsignal \chardef\chineseBstatus\plustwo \else
- \ifdim\lastskip=\chineseSsignal \chardef\chineseBstatus\plusthree \else
- \scratchskip=\lastskip \unskip
- \ifdim\lastskip=\chineseLsignal \chardef\chineseBstatus\plusone \else
- \ifdim\lastskip=\chineseRsignal \chardef\chineseBstatus\plustwo \else
- \ifdim\lastskip=\chineseSsignal \chardef\chineseBstatus\plusthree \else
- \space\scratchskip=\lastskip \unskip
- \setbox\scratchbox=\hbox\bgroup
- (\space
- \ifdim\lastskip=\scratchskip
- \egroup \chardef\chineseBstatus\plusone
- \else
- \egroup
- \ifdim\scratchskip=\zeropoint \chardef\chineseBstatus\plusfour \fi
- \fi
- \fi\fi\fi
- \fi\fi\fi}
-
-\def\horizontalchineseunicodeglyph
- {\relax
- \ifhmode\else\dontleavehmode\fi % added
- \setunicodescale\chineseunicodescale % redundant
- \setunicodestrut\chineseunicodeheight\chineseunicodedepth % redundant
- \ifprocessingverbatim
- \iftracechinese
- \ruledhbox{\insertunicodeglyph}%
- \else
- \insertunicodeglyph
- \fi
- \else\ifx\nextutoken\relax
- \insertunicodeglyph
- \else
- \analyzechineseunicodeglyph
- \analyzechineseunicodeenviroment
- \ifcase\chineseSstatus\relax
- \ifcase\chineseBstatus\relax
- \chineseunskip
- \hskip\chinesesurroundskip % unknown
- \or
- \chineseunskip
- \chinesenobreak % left
- \or
- \ifcorrectchineseboundarychars\else\chineseunskip\fi
- \hskip\chineseinterglyphskip % right
- \or
- \chineseunskip
- \hskip\chineseinterglyphskip % chinese
- \or
- % whatever
- \fi
- \insertchineseglyph
- \ifcase\chineseAstatus\relax
- \hskip\chineseinterglyphskip % unknown
- \hskip\chinesesurroundskip
- \ifcase\chineseSstatus
- \hskip\chineseSsignal
- \or
- \hskip\chineseLsignal
- \else
- \hskip\chineseRsignal
- \fi
- \or
- \hskip\chineseinterglyphskip % left
- \chinesenobreak
- \hskip\chineseLsignal
- \or
- \chinesenobreak % right
- \hskip\chineseinterglyphskip
- \chinesenobreak
- \hskip\chineseRsignal
- \or
- \hskip\chineseinterglyphskip % space
- \hskip\chinesesurroundskip
- \hskip\chineseSsignal
- \fi
- \or % left
- \ifcorrectchineseboundarychars
- \let\unicodecharcommand\chineseleftcharcommand
- \fi
- \chineseunskip
- \insertchineseglyph
- \chinesenobreak
- \hskip\chineseLsignal
- \or % right
- \ifcorrectchineseboundarychars
- \let\unicodecharcommand\chineserightcharcommand
- \fi
- \chineseunskip
- \chinesenobreak
- \insertchineseglyph
- \hskip\chineseRsignal
- \else % center
- \chineseunskip
- \chinesenobreak
- \insertchineseglyph
- \hskip\chineseinterglyphskip
- \hskip\chineseRsignal
- \fi\fi
- \aftergroup\ignorespaces % watch this
- \fi}
-
-\def\verticalchineseunicodeglyph
- {\relax
- \ifprocessingverbatim % to do
- \horizontalchineseunicodeglyph
- \else
- \setunicodescale\chineseunicodescale % redundant
- \setunicodestrut\chineseunicodeheight\chineseunicodedepth % redundant
- \ifx\nextutoken\relax
- \insertchineseglyph
- \ifvmode % catches \hbox{...}, actually \hbox should be \vbox -)
- \nointerlineskip
- \fi
- \allowbreak
- \else
- \analyzechineseunicodeglyph
- \setbox\scratchbox\hbox to \hsize
- {\hss
- \ifcase\chineseSstatus\relax
- \insertchineseglyph
- \else % left / right
- \setbox\scratchbox\hbox{\insertchineseglyph}%
- \rotate[\c!rotation=270]{\box\scratchbox}%
- \fi
- \hss}%
- \ht\scratchbox\unicodeheight\strutht
- \dp\scratchbox\unicodedepth \strutdp
- \ifvmode % catches \hbox{...}, actually \hbox should be \vbox -)
- \nointerlineskip
- \fi
- \ifcase\prevchineseSstatus\relax
- \ifnum\chineseSstatus=\plustwo \par\nobreak\else\allowbreak\fi
- \or % left
- \par\nobreak
- \or % right
- \ifnum\chineseSstatus=\plustwo \par\nobreak\else\allowbreak\fi
- \fi
- \global\chardef\prevchineseSstatus\chineseSstatus % pagebody ...
- \box\scratchbox\par
- \fi
- \aftergroup\ignorespaces % watch this
- \fi}
-
-%D \macros
-%D {setupchinese,startvertical,nochinese}
-%D
-%D The previous macros implement horizontal as well as
-%D vertical typesetting. Vertical typesetting is implemented
-%D on top of the multi||column routines.
-
-\def\setupchinese
- {\dodoubleargument\getparameters[\??vt]}
-
-\def\startvertical
- {\dosingleempty\dostartvertical}
-
-\def\dostartvertical[#1]%
- {\bgroup
- \def\maxnofcolumns{25}%
- \verticalchinesetrue
- \global\chardef\prevchineseSstatus\zerocount
- \let\nochinese\nochineseinvertical
- \doif\@@vtn\v!fit
- {\dimen0=\textwidth \advance\dimen0 \@@vtdistance
- \dimen2=\bodyfontsize \advance\dimen2 \@@vtdistance
- \divide\dimen0 \number\dimen2
- \edef\@@vtn{\number\dimen0}}%
- \startcolumns
- [\c!direction=\@@vtdirection,
- \c!balance=\@@vtbalance,
- \c!distance=\@@vtdistance,
- \c!n=\@@vtn,
- #1]}
-
-\def\stopvertical
- {\stopcolumns
- \egroup}
-
-\setupchinese
- [\c!direction=\v!left,
- \c!balance=\v!no,
- \c!n=\v!fit,
- \c!distance=1.5\bodyfontsize]
-
-%D We can set up vertical typesetting with \type
-%D {\setupchinese}.
-
-%D \macros
-%D {nochineseinvertical}
-%D
-%D English (non chinese) text is typeset rotated:
-
-\def\nochineseinvertical#1%
- {\par
- \setbox\scratchbox\hbox{\strut#1}
- \getnoflines{\wd\scratchbox}
- \setbox\scratchbox\hbox to \noflines\openlineheight
- {\hss\box\scratchbox\hss}
- \hbox to \hsize
- {\hss
- \rotate
- [\c!rotation=270]
- {\vbox to \ht\scratchbox{\vss\box\scratchbox\vss}}%
- \hss}
- \par}
-
-%D \macros
-%D {correctchineseboundarychars}
-%D
-%D Careful reading of the previous macro learns that we
-%D treat left and right glyphs differently. When we say
-%D
-%D \starttyping
-%D \correctchineseboundarycharstrue
-%D \stoptyping
-%D
-%D For the moment correction in on by default.
-
-\correctchineseboundarycharstrue
-
-\def\chineserightcharcommand#1%
- {\iftracechinese\ruledhbox\else\hbox\fi \!!to .5em{#1\hss}%
- \hskip.25em\!!plus .25em\relax}%
-
-\def\chineseleftcharcommand#1%
- {\ifnum\chineseBstatus<4 \hskip.25em \!!plus .25em\relax\fi
- \iftracechinese\ruledhbox\else\hbox\fi \!!to .5em{\hss#1}}%
-
-% \def\chineserightcharcommand#1%
-% {\setbox\scratchbox=\hbox{#1}%
-% \scratchdimen=.5em
-% \ifdim\wd\scratchbox>\scratchdimen
-% \iftracechinese\ruledhbox\else\hbox\fi \!!to \scratchdimen
-% {\box\scratchbox\hss}%
-% \hskip.5\scratchdimen\!!plus.5\scratchdimen\relax
-% \else
-% \box\scratchbox
-% \fi}
-
-% \def\chineseleftcharcommand#1%
-% {\setbox\scratchbox=\hbox{#1}%
-% \scratchdimen=.5em
-% \ifdim\wd\scratchbox>\scratchdimen
-% \ifnum\chineseBstatus<4
-% \hskip.5\scratchdimen\!!plus.5\scratchdimen\relax
-% \fi
-% \iftracechinese\ruledhbox\else\hbox\fi \!!to \scratchdimen
-% {\hss\box\scratchbox}%
-% \else
-% \box\scratchbox
-% \fi}
-
-%D The long list of numbers in the previous macro identify the
-%D characters where special care is needed for breaking lines.
-%D A linebreak is not permitted before:
-%D
-%D \def\DoIt #1 #2 %
-%D {\hbox{\hbox to 2em{\uchar{#1}{#2}\hss}#1 #2}\par}
-%D
-%D \startcolumns[n=5]
-%D \DoIt 161 162 \DoIt 161 163 \DoIt 161 164 \DoIt 161 167 \DoIt 161 173
-%D \DoIt 161 175 \DoIt 161 177 \DoIt 161 179 \DoIt 161 181 \DoIt 161 183
-%D \DoIt 161 185 \DoIt 161 187 \DoIt 161 189 \DoIt 161 191 \DoIt 161 227
-%D \DoIt 161 228 \DoIt 161 229 \DoIt 163 161 \DoIt 163 162 \DoIt 163 167
-%D \DoIt 163 169 \DoIt 163 172 \DoIt 163 174 \DoIt 163 186 \DoIt 163 187
-%D \DoIt 163 190 \DoIt 163 191 \DoIt 163 221 \DoIt 163 253
-%D \stopcolumns
-%D
-%D A linebreak is not permitted after the following glyphs:
-%D
-%D \startcolumns[n=5]
-%D \DoIt 161 174 \DoIt 161 176 \DoIt 161 178 \DoIt 161 180 \DoIt 161 182
-%D \DoIt 161 184 \DoIt 161 186 \DoIt 161 188 \DoIt 161 190 \DoIt 163 168
-%D \DoIt 163 219 \DoIt 163 224 \DoIt 163 251
-%D \stopcolumns
-
-%D \macros
-%D {tracechinesetrue, showchinesetracelegend}
-%D
-%D When we say \type {\tracechinesetrue}, we get some
-%D insight in the way \CONTEXT\ handles the Chinese glyphs.
-%D The symbols and color used represent:
-%D
-%D \showchinesetracelegend
-
-\newif\iftracechinese
-
-\def\showchinesetracelegend
- {\definetabulate[\s!dummy][|c|l|l|l|]%
- \startdummy
- \HL
- \NC \bf key \NC \bf meaning \NC \bf glyph \NC \bf keys \NC\NR
- \HL
- \NC u \NC unknown character type \NC \color[green]{current} \NC u l r \NC\NR
- \NC l \NC left boundary character \NC \color[red]{previous} \NC u l r c n \NC\NR
- \NC r \NC right boundary character \NC \color[blue]{next} \NC u l r s \NC\NR
- \NC c \NC chinese character \NC \NC \NC\NR
- \NC s \NC following space \NC \NC \NC\NR
- \NC n \NC no preceding space \NC \NC \NC\NR
- \HL
- \stopdummy}
-
-\def\tracedchineseglyph
- {\dontleavehmode
- \ruledhbox
- {\setbox\scratchbox\hbox{\insertunicodeglyph}%
- \hbox to \wd\scratchbox
- {\localcolortrue
- \copy\scratchbox
- \infofont
- \hskip-\wd\scratchbox
- \hbox to \wd\scratchbox
- {\hss
- \color[green]{\ifcase\chineseSstatus\relax u\or l\or r\fi}%
- \hss}%
- \hskip-\wd\scratchbox
- \lower\dp\scratchbox\hbox to \wd\scratchbox
- {\hss
- \color[red]{\ifcase\chineseBstatus\relax u\or l\or r\or c\or n\fi}%
- \hss
- \color[blue]{\ifcase\chineseAstatus\relax u\or l\or r\or s\fi}%
- \hss}}}}
-
-%D The following example shows how tracing works.
-%D
-%D \start \tracechinesetrue
-%D һθǽܶĵ֧֡ĵ
-%D ѯ \nochinese{\CONTEXT} ǷܴʱѾԹ
-%D еĺ꼯ûеõζŶĵֻ֧û
-%D ʵ֡
-%D
-%D һ(θ) () ܶĵ֧֡ĵ,
-%D ѯ\nochinese{\CONTEXT}ǷܴʱѾ
-%D Թеĺ꼯ûеõζŶĵ֧
-%D ûʵ֡.
-%D \stop
-
-%D Because fonts are defined each time a \UNICODE\ is
-%D encountered |<|which is less inefficient than one would
-%D imagine, because \TEX\ is optimized quite well in this
-%D repect|>| we can define macros like this to take care of
-%D font switches. When available, one can add definitions
-%D for italic, slanted, bold fonts and combinations of these.
-
-%D \macros
-%D {chinesenumber}
-%D
-%D The chinese numbering systems rather straightforward. First
-%D there are the digits:
-%D
-%D \starttabulate[|c|c|c|c|c|c|c|c|c|c|]
-%D \NC 0 \NC 1 \NC 2 \NC 3 \NC 4 \NC 5 \NC 6 \NC 7 \NC 8 \NC 9 \NC\NR
-%D \NC \chinesenumber{0} \NC \chinesenumber{1} \NC \chinesenumber{2}
-%D \NC \chinesenumber{3} \NC \chinesenumber{4} \NC \chinesenumber{5}
-%D \NC \chinesenumber{6} \NC \chinesenumber{7} \NC \chinesenumber{8}
-%D \NC \chinesenumber{9} \NC\NR
-%D \stoptabulate
-%D
-%D Apart from these numbers, we have dedicated representations
-%D of some powers of~$10$.
-%D
-%D \starttabulate[|c|c|c|c|c|]
-%D \NC 10 \NC 100 \NC 1000 \NC 10000 \NC 100000000 \NC\NR
-%D \NC \chinesenumber{10} \NC \chinesenumber{100}
-%D \NC \chinesenumber{1000} \NC \chinesenumber{10000}
-%D \NC \chinesenumber{100000000} \NC\NR
-%D \stoptabulate
-%D
-%D The number~12 is a combination of $1\times10+2$, or:
-%D \chinesenumber {12}, while~22 becomes \chinesenumber {22}.
-%D The numbers below 20 are treated a bit different, just like
-%D numbers with series of $0$'s. So $2\times10$ comes out as
-%D two glyphs, but $1\times10$ as one, because in the latter
-%D case the~$1$ is redundant. The same is true for the powers
-%D of~10.
-%D
-%D \starttabulate[|r|r|r|r|r|r|]
-%D \NC 1 \NC \chinesenumber {1} \NC
-%D 9 \NC \chinesenumber {9} \NC
-%D 4 \NC \chinesenumber {4} \NC\NR
-%D \NC 11 \NC \chinesenumber {11} \NC
-%D 99 \NC \chinesenumber {99} \NC
-%D 16 \NC \chinesenumber {16} \NC\NR
-%D \NC 111 \NC \chinesenumber {111} \NC
-%D 999 \NC \chinesenumber {999} \NC
-%D 256 \NC \chinesenumber {256} \NC\NR
-%D \NC 1111 \NC \chinesenumber {1111} \NC
-%D 9999 \NC \chinesenumber {9999} \NC
-%D 65536 \NC \chinesenumber {65536} \NC\NR
-%D \stoptabulate
-%D
-%D The implementation is rather simple. For internal purposes,
-%D we let zero expand to~0. The digits $0-9$ and numbers $10$,
-%D $100$, $1000$, $10000$ and $100000000$ are hard coded.
-
-% This was the first implementation, before \WangLei\ asked
-% me to look into Big Five encoding, so, like everthing in
-% \TEX, things become a bit more complicated, but also more
-% versatile.
-%
-% \starttypen
-% \def\chinesedigit#1%
-% {\ifnum #1=100000000 \uchar{210}{218}% 100000000
-% \else\ifnum #1=10000 \uchar{205}{242}% 10000
-% \else\ifnum #1=1000 \uchar{199}{167}% 1000
-% \else\ifnum #1=100 \uchar{176}{217}% 100
-% \else\ifnum #1=10 \uchar{202}{174}% 10
-% \else\ifcase#1 \uchar{193}{227}% 0
-% \or \uchar{210}{187}% 1
-% \or \uchar{182}{254}% 2
-% \or \uchar{200}{253}% 3
-% \or \uchar{203}{196}% 4
-% \or \uchar{206}{229}% 5
-% \or \uchar{193}{249}% 6
-% \or \uchar{198}{223}% 7
-% \or \uchar{176}{203}% 8
-% \or \uchar{190}{197}% 9
-% \fi\fi\fi\fi\fi\fi}
-% \stoptypen
-
-%D We will implement four methods, the one described earlier,
-%D a derived one with capitalized characters, an extended
-%D version of the first method, and a rather Arabic method.
-%D
-%D \starttabulate[|l|l|]
-%D \HL
-%D \NC \bf command \NC \bf number 39 \NC\NR
-%D \HL
-%D \NC \type{\normalchinesenumber} \NC \normalchinesenumber {39} \NC\NR
-%D \NC \type{\capitalizedchinesenumber} \NC \capitalizedchinesenumber{39} \NC\NR
-%D \NC \type{\arabicchinesenumber} \NC \arabicchinesenumber {39} \NC\NR
-%D \NC \type{\extendedchinesenumber} \NC \extendedchinesenumber {39} \NC\NR
-%D \HL
-%D \stoptabulate
-%D
-%D We use a dirty trick to enable Chinese Capital Digits. In
-%D the encoding vectors, we define these by appending a suffix
-%D \type {*} to the digit, which in the following macro is
-%D appended or not (by passing \type {\empty}).
-
-\def\chinesedigit#1#2% #2: suffix, here * or \empty
- {\udigit{\chineseencoding}{\number#1#2}}
-
-% Normal Chinese Number
-
-\def\normalchinesenumber#1%
- {\expandafter\dochinesenumber\number#1\relax\empty}
-
-\def\dochinesenumber#1#2\relax#3%
- {\ifnum#1#2<10 % 1-10
- \chinesedigit{#1}#3%
- \else\ifnum#1#2<20 % 11-99
- \chinesedigit{10}#3%
- \dodochinesenumberA#2\relax#3%
- \else
- \dodochinesenumber#1#2\relax#3%
- \fi\fi}
-
-\def\dodochinesenumber#1#2\relax#3%
- {\ifnum#1=0
- \chinesedigit{0}#3%
- \dododochinesenumber0#2\relax#3%
- \else\ifnum#1#2<10 % 1-10
- \chinesedigit{#1#2}#3%
- \dodochinesenumberA#2\relax#3%
- \else\ifnum#1#2<100 % 11-99
- \dodochinesenumber#1\relax#3%
- \chinesedigit{10}#3%
- \dodochinesenumberA#2\relax#3%
- \else\ifnum#1#2<1000 % 100-999
- \dodochinesenumber#1\relax#3%
- \chinesedigit{100}#3%
- \dodochinesenumberA#2\relax#3%
- \else\ifnum#1#2<10000 % 1000-9999
- \dodochinesenumber#1\relax#3%
- \chinesedigit{1000}#3%
- \dodochinesenumberA#2\relax#3%
- \else\ifnum#1#2<100000 % 10000-99999
- \dodochinesenumber#1\relax#3%
- \chinesedigit{10000}#3%
- \dodochinesenumberA#2\relax#3%
- \else\ifnum#1#2<1000000 % 100000-999999
- \dodochinesenumberB#1#2\relax#3%
- \else\ifnum#1#2<10000000 % 1000000-9999999
- \dodochinesenumberC#1#2\relax#3%
- \else\ifnum#1#2<100000000 % 10000000-99999999
- \dodochinesenumberD#1#2\relax#3%
- \else\ifnum#1#2<1000000000 % 10000000-99999999
- \dochinesenumber#1\relax#3%
- \chinesedigit{100000000}#3%
- \dododochinesenumber#2\relax#3%
- \else
- \dodochinesenumberE#1#2\relax#3%
- \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
-
-\def\dododochinesenumber#1#2\relax#3%
- {\ifnum#1=0
- \ifnum0#2>0 \dododochinesenumber#2\relax#3\fi
- \else
- \dodochinesenumber#1#2\relax#3%
- \fi}
-
-\def\dodochinesenumberA#1\relax#2%
- {\ifcase0#1 \else\dodochinesenumber#1\relax#2\fi}
-
-\def\dodochinesenumberB#1#2#3\relax#4%
- {\dochinesenumber#1#2\relax#4%
- \chinesedigit{10000}#4%
- \dododochinesenumber#3\relax#4}
-
-\def\dodochinesenumberC#1#2#3#4\relax#5%
- {\dochinesenumber#1#2#3\relax#5%
- \chinesedigit{10000}#5%
- \dododochinesenumber#4\relax#5}
-
-\def\dodochinesenumberD#1#2#3#4#5\relax#6%
- {\dochinesenumber#1#2#3#4\relax#6%
- \chinesedigit{10000}#6%
- \dododochinesenumber#5\relax#6}
-
-\def\dodochinesenumberE#1#2#3\relax#4%
- {\dochinesenumber#1#2\relax#4%
- \chinesedigit{100000000}#4%
- \dododochinesenumber#3\relax#4}
-
-% Capitalized Chinese Number
-
-\def\capitalizedchinesenumber#1%
- {\expandafter\dochinesenumber\number#1\relax*}
-
-% Extended Chinese Number
-
-\def\extendedchinesenumber#1%
- {\expandafter\doextendedchinesenumber\number#1\relax}
-
-\def\doextendedchinesenumber#1#2\relax%
- {\ifnum #1#2<20 % 0-19
- \dochinesenumber#1#2\relax\empty
- \else\ifnum#1#2<30 % 20-29
- \chinesedigit{20}\empty
- \ifcase#2\else\chinesedigit{2#2}\fi
- \else\ifnum#1#2<40 % 30-39
- \chinesedigit{30}\empty
- \ifcase#2\else\chinesedigit{3#2}\fi
- \else
- \dochinesenumber#1#2\relax\empty
- \fi\fi\fi}
-
-% Arabic Chinese Number
-
-\def\arabicchinesenumber#1%
- {\expandafter\doarabicchinesenumber\number#1@\relax}
-
-\def\doarabicchinesenumber#1#2\relax
- {\if#1@\else
- \chinesedigit{#1}\empty
- \doarabicchinesenumber#2\relax
- \fi}
-
-% The short call:
-
-\def\chinesenumber{\normalchinesenumber}
-
-% \dorecurse{40}
-% {\hbox
-% {\processingverbatimtrue
-% \hbox to 1cm{\hss\recurselevel}\quad
-% \hbox to 3cm{\hss\strut\normalchinesenumber {\recurselevel}}\quad
-% \hbox to 3cm{\hss\strut\capitalizedchinesenumber{\recurselevel}}\quad
-% \hbox to 3cm{\hss\strut\arabicchinesenumber {\recurselevel}}\quad
-% \hbox to 3cm{\hss\strut\extendedchinesenumber {\recurselevel}}\crlf}}
-
-%D The next table demonstates the correctness of the
-%D conversion macro.
-%D
-%D \startbuffer
-%D \starttable[|l|l|l|l|l|l|]
-%D \HL
-%D \NC number \NC converter \NC hard coded \NC
-%D number \NC converter \NC hard coded\NC \SR
-%D \HL
-%D \NC 1 \NC \chinesenumber{1} \NC һ \NC
-%D 0 \NC \chinesenumber{0} \NC \NC\FR
-%D \NC 11 \NC \chinesenumber{11} \NC ʮһ \NC
-%D 10 \NC \chinesenumber{10} \NC ʮ \NC\MR
-%D \NC 111 \NC \chinesenumber{111} \NC һһʮһ \NC
-%D 100 \NC \chinesenumber{100} \NC һ \NC\MR
-%D \NC 101 \NC \chinesenumber{101} \NC һһ \NC
-%D 120 \NC \chinesenumber{120} \NC һٶʮ \NC\MR
-%D \NC 1111 \NC \chinesenumber{1111} \NC һǧһһʮһ \NC
-%D 1000 \NC \chinesenumber{1000} \NC һǧ \NC\MR
-%D \NC 1001 \NC \chinesenumber{1001} \NC һǧһ \NC
-%D 1020 \NC \chinesenumber{1020} \NC һǧʮ \NC\MR
-%D \NC 11111 \NC \chinesenumber{11111} \NC һһǧһһʮһ \NC
-%D 10000 \NC \chinesenumber{10000} \NC һ \NC\MR
-%D \NC 10001 \NC \chinesenumber{10001} \NC һһ \NC
-%D 10200 \NC \chinesenumber{10200} \NC һ \NC\LR
-%D \HL
-%D \NC 111111 \NC \chinesenumber{111111} \NC ʮһһǧһһʮһ \NC
-%D 100000 \NC \chinesenumber{100000} \NC ʮ \NC\FR
-%D \NC 1111111 \NC \chinesenumber{1111111} \NC һһʮһһǧһһʮһ \NC
-%D 1000000 \NC \chinesenumber{1000000} \NC һ \NC\MR
-%D \NC 11111111 \NC \chinesenumber{11111111} \NC һǧһһʮһһǧһһʮһ \NC
-%D 10000000 \NC \chinesenumber{10000000} \NC һǧ \NC\MR
-%D \NC 111111111 \NC \chinesenumber{111111111} \NC һһǧһһʮһһǧһһʮһ \NC
-%D 100000000 \NC \chinesenumber{100000000} \NC һ \NC\MR
-%D \NC 1111111111 \NC \chinesenumber{1111111111} \NC ʮһһǧһһʮһһǧһһʮһ \NC
-%D 1000000000 \NC \chinesenumber{1000000000} \NC ʮ \NC\LR
-%D \HL
-%D \stoptable
-%D \stopbuffer
-%D
-%D \placetable{Some Chinese number examples.}{\getbuffer}
-
-%D Although the conversion can be hooked into most commands
-%D that deal with numbers |<|those familiar with \TEX\ macro
-%D programming will notice that the macro if fully
-%D expandable|>| in many cases Chinese documents use western
-%D digits. So, in practice, the change that the next example
-%D shows up, is minimal.
-%D
-%D \starttabulate[|r|r|c|]
-%D \NC 2546 \NC \chinesenumber {2546} \NC \NC\NR
-%D \NC 9258 \NC \chinesenumber {9258} \NC $+$ \NC\NR
-%D \HL
-%D \NC 11804 \NC \chinesenumber {11804} \NC \NC\NR
-%D \stoptabulate
-%D
-%D While in arabic arithmics addition leads to more digits, in
-%D Chinese the number of glyphs can (temporary) decrease.
-%D Given that the number of people dealing with Chinese is
-%D considerably larger than the number of latin speaking
-%D people, a successor of \TEX\ definitely must provide a
-%D \type {\chinesenumeral} primitive.
-
-\defineconversion [c] [\normalchinesenumber]
-\defineconversion [chinese] [\normalchinesenumber]
-\defineconversion [nc] [\normalchinesenumber]
-\defineconversion [normalchinese] [\normalchinesenumber]
-\defineconversion [cc] [\capitalizedchinesenumber]
-\defineconversion [capitalizedchinese] [\capitalizedchinesenumber]
-\defineconversion [ec] [\extendedchinesenumber]
-\defineconversion [extendedchinese] [\extendedchinesenumber]
-\defineconversion [ac] [\arabicchinesenumber]
-\defineconversion [arabicchinese] [\arabicchinesenumber]
-
-%D Date conversion:
-
-\defineconversion [cn] [\v!day] [\chinesenumber]
-\defineconversion [cn] [\v!month] [\chinesenumber]
-\defineconversion [cn] [\v!year] [\chinesenumber]
-
-%D \macros
-%D {SimChi, TraChi}
-%D
-%D These components enable us to construct dedicated Chinese
-%D font switches, like:
-
-\setupunicodefont
- [chinese]
- [ \c!scale=\chineseunicodescale,
- \c!height=\chineseunicodeheight,
- \c!depth=\chineseunicodedepth,
- \c!strut=\v!yes,
- \c!interlinespace=\v!yes,
- \c!conversion=\chinesenumber,
- \c!commands=\setchineseencoding, % needed for digits
- \c!command=\handlechineseunicodeglyph]
-
-%D For the moment, this encoding is implemented rather ugly. The
-%D trick is to move the encoding value from the current font
-%D definition to the \type {\chineseencoding} macro.
-
-\let\chineseencoding\empty
-
-\def\setchineseencoding % normally SomeChineseRegular
- {\getfontfileparameters\unicodestyle
- \ifx\currentfontfileencoding\undefined \else
- \let\chineseencoding\currentfontfileencoding
- \fi}
-
-%D We could have said:
-%D
-%D \starttyping
-%D \defineunicodefont
-%D [SimChi]
-%D [SimplifiedChinese]
-%D [\c!scale=\chineseunicodescale,
-%D \c!height=\chineseunicodeheight,
-%D \c!depth=\chineseunicodedepth,
-%D \c!conversion=\chinesenumber,
-%D \c!commands=\setchineseencoding, % needed for digits
-%D \c!command=\handlechineseunicodeglyph]
-%D \stoptyping
-%D
-%D However, the former definitions is more general. Next we
-%D map a few fonts:
-
-\definefontsynonym [SimplifiedChineseRegular] [gbsong] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseSlanted] [gbsongsl] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseItalic] [gbsongsl] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseBold] [gbhei] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseBoldSlanted] [gbheisl] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseBoldItalic] [gbheisl] [encoding=gbk]
-
-\definefontsynonym [TraditionalChineseRegular] [b5song] [encoding=big5]
-\definefontsynonym [TraditionalChineseSlanted] [b5songsl] [encoding=big5]
-\definefontsynonym [TraditionalChineseItalic] [b5songsl] [encoding=big5]
-\definefontsynonym [TraditionalChineseBold] [b5hei] [encoding=big5]
-\definefontsynonym [TraditionalChineseBoldSlanted] [b5heisl] [encoding=big5]
-\definefontsynonym [TraditionalChineseBoldItalic] [b5heisl] [encoding=big5]
-
-% we need to move this to typescripts
-
-\doifelse \currentregime {utf} {
-
- \definefontsynonym [SimplifiedChineseRegular] [ChineseRegular]
- \definefontsynonym [SimplifiedChineseSlanted] [ChineseSlanted]
- \definefontsynonym [SimplifiedChineseItalic] [ChineseItalic]
- \definefontsynonym [SimplifiedChineseBold] [ChineseBold]
- \definefontsynonym [SimplifiedChineseBoldSlanted] [ChineseBoldSlanted]
- \definefontsynonym [SimplifiedChineseBoldItalic] [ChineseBoldItalic]
-
- \definefontsynonym [TraditionalChineseRegular] [ChineseRegular]
- \definefontsynonym [TraditionalChineseSlanted] [ChineseSlanted]
- \definefontsynonym [TraditionalChineseItalic] [ChineseItalic]
- \definefontsynonym [TraditionalChineseBold] [ChineseBold]
- \definefontsynonym [TraditionalChineseBoldSlanted][ChineseBoldSlanted]
- \definefontsynonym [TraditionalChineseBoldItalic] [ChineseBoldItalic]
-
- \definefontsynonym [ChineseRegular] [uni-htsong-][encoding=cjk-uni]
- \definefontsynonym [ChineseSlanted] [uni-htsong-][encoding=cjk-uni]
- \definefontsynonym [ChineseItalic] [uni-htsong-][encoding=cjk-uni]
- \definefontsynonym [ChineseBold] [uni-hthei-] [encoding=cjk-uni]
- \definefontsynonym [ChineseBoldSlanted][uni-hthei-] [encoding=cjk-uni]
- \definefontsynonym [ChineseBoldItalic] [uni-hthei-] [encoding=cjk-uni]
-
- \loadmapfile[uni-htsong.map]
- \loadmapfile[uni-htfs.map]
- \loadmapfile[uni-hthei.map]
- \loadmapfile[uni-htkai.map]
-
-} {
-
- \loadmapfile[gbk]
-
-}
-
-\defineunicodefont [SimChi] [SimplifiedChinese] [chinese]
-\defineunicodefont [TraChi] [TraditionalChinese] [chinese]
-
-%D We default to these so called Simplified Chinese fonts.
-
-\SimChi
-
-%D In addition to these fonts, we (pre|)|define some commonly
-%D used fonts:
-
-\definefontsynonym [SimplifiedChineseSongTiRegular] [gbsong] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseSongTiSlanted] [gbsongsl] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseSongTiBold] [gbsong] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseSongTiBoldSlanted] [gbsongsl] [encoding=gbk]
-
-\definefontsynonym [TraditionalChineseSongTiRegular] [b5song] [encoding=big5]
-\definefontsynonym [TraditionalChineseSongTiSlanted] [b5songsl] [encoding=big5]
-\definefontsynonym [TraditionalChineseSongTiBold] [b5song] [encoding=big5]
-\definefontsynonym [TraditionalChineseSongTiBoldSlanted] [b5songsl] [encoding=big5]
-
-\definefontsynonym [SimplifiedChineseHeiTiRegular] [gbhei] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseHeiTiSlanted] [gbheisl] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseHeiTiBold] [gbhei] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseHeiTiBoldSlanted] [gbheisl] [encoding=gbk]
-
-\definefontsynonym [TraditionalChineseHeiTiRegular] [b5hei] [encoding=big5]
-\definefontsynonym [TraditionalChineseHeiTiSlanted] [b5heisl] [encoding=big5]
-\definefontsynonym [TraditionalChineseHeiTiBold] [b5hei] [encoding=big5]
-\definefontsynonym [TraditionalChineseHeiTiBoldSlanted] [b5heisl] [encoding=big5]
-
-\definefontsynonym [SimplifiedChineseKaiTiRegular] [gbkai] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseKaiTiSlanted] [gbkaisl] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseKaiTiBold] [gbkai] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseKaiTiBoldSlanted] [gbkaisl] [encoding=gbk]
-
-\definefontsynonym [TraditionalChineseKaiTiRegular] [b5kai] [encoding=big5]
-\definefontsynonym [TraditionalChineseKaiTiSlanted] [b5kaisl] [encoding=big5]
-\definefontsynonym [TraditionalChineseKaiTiBold] [b5kai] [encoding=big5]
-\definefontsynonym [TraditionalChineseKaiTiBoldSlanted] [b5kaisl] [encoding=big5]
-
-\definefontsynonym [SimplifiedChineseFangSongRegular] [gbfs] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseFangSongSlanted] [gbfssl] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseFangSongBold] [gbfs] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseFangSongBoldSlanted] [gbfssl] [encoding=gbk]
-
-\definefontsynonym [TraditionalChineseFangSongRegular] [b5fs] [encoding=big5]
-\definefontsynonym [TraditionalChineseFangSongSlanted] [b5fssl] [encoding=big5]
-\definefontsynonym [TraditionalChineseFangSongBold] [b5fs] [encoding=big5]
-\definefontsynonym [TraditionalChineseFangSongBoldSlanted] [b5fssl] [encoding=big5]
-
-\definefontsynonym [SimplifiedChineseLiShuRegular] [gbli] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseLiShuSlanted] [gblisl] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseLiShuBold] [gbli] [encoding=gbk]
-\definefontsynonym [SimplifiedChineseLiShuBoldSlanted] [gblisl] [encoding=gbk]
-
-\definefontsynonym [TraditionalChineseLiShuRegular] [b5li] [encoding=big5]
-\definefontsynonym [TraditionalChineseLiShuSlanted] [b5lisl] [encoding=big5]
-\definefontsynonym [TraditionalChineseLiShuBold] [b5li] [encoding=big5]
-\definefontsynonym [TraditionalChineseLiShuBoldSlanted] [b5lisl] [encoding=big5]
-
-%D The following definitions provide us the commands to switch
-%D to these fonts.
-
-\defineunicodefont [SimSongTi] [SimplifiedChineseSongTi] [chinese]
-\defineunicodefont [TraSongTi] [TraditionalChineseSongTi] [chinese]
-
-\defineunicodefont [SimHeiTi] [SimplifiedChineseHeiTi] [chinese]
-\defineunicodefont [TraHeiTi] [TraditionalChineseHeiTi] [chinese]
-
-\defineunicodefont [SimKaiTi] [SimplifiedChineseKaiTi] [chinese]
-\defineunicodefont [TraKaiTi] [TraditionalChineseKaiTi] [chinese]
-
-\defineunicodefont [SimFangSong] [SimplifiedChineseFangSong] [chinese]
-\defineunicodefont [TraFangSong] [TraditionalChineseFangSong] [chinese]
-
-\defineunicodefont [SimLiShu] [SimplifiedChineseLiShu] [chinese]
-\defineunicodefont [TraLiShu] [TraditionalChineseLiShu] [chinese]
-
-% \definealternativestyle [ChineseTitleFont] [\bfd\SimKaiTi] []
-
-%D \macros
-%D {purechinese}
-%D
-%D Use this macro to suppress spacing around Chinese text.
-
-\def\purechinese#1% evt geen rek
- {\hskip\chineseSsignal\relax
- #1\unskip\unskip\unskip
- \hskip\chineseSsignal\relax}
-
-%D \macros
-%D {stillchinese}
-%D
-%D Use the next macro when you want the next item to be put
-%D tight to the previous chinese character.
-
-\def\stillchinese
- {\hskip\chineseSsignal\relax}
-
-%D \macros
-%D {nochinese}
-%D
-%D When we want to be sure of non||Chinese inline text,
-%D we can package the for instance english text in \type
-%D {\nochinese}.
-
-\def\nochinese#1%
- {\unskip\unskip\unskip
- \hskip\chinesesurroundskip
- \hskip\chineseinterglyphskip\relax
- #1%
- \hskip\chineseinterglyphskip\relax
- \hskip\chinesesurroundskip
- \ignorespaces}
-
-%D \macros
-%D {chisize}
-%D
-%D Chinese font sizes are specified in a different way,
-%D using positive and negative numbers:
-
-\def\chisize#1%
- {\ifnum#11<0 % a trick to catch -0
- \ifcase#1\space36\or24\or18\or15\or12\or9\or\else6.5\fi
- \else
- \ifcase#1\space42\or26\or22\or16\or14\or10.5\or7.5\or5.5\else5\fi
- \fi pt}
-
-%D So:
-%D
-%D \startbuffer
-%D [\chisize{-1}] [\chisize{7}] [\chisize{+4}]
-%D \stopbuffer
-%D
-%D \typebuffer
-%D
-%D gives:
-%D
-%D \getbuffer
-%D
-%D The full range of sizes is:
-%D
-%D \starttabulate[|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|]
-%D \NC 8 \NC 7 \NC -6 \NC 6 \NC
-%D -5 \NC 5 \NC -4 \NC 4 \NC
-%D -3 \NC 3 \NC -2 \NC 2 \NC
-%D -1 \NC 1 \NC -0 \NC 0 \NC\NR
-%D \NC\chisize {8}\NC\chisize{7}\NC\chisize{-6}\NC\chisize{6}\NC
-%D \chisize{-5}\NC\chisize{5}\NC\chisize{-4}\NC\chisize{4}\NC
-%D \chisize{-3}\NC\chisize{3}\NC\chisize{-2}\NC\chisize{2}\NC
-%D \chisize{-1}\NC\chisize{1}\NC\chisize{-0}\NC\chisize{0}\NC\NR
-%D \stoptabulate
-
-%D Now it's time for some real Chinese. This example
-%D also shows that font switching is supported.
-%D
-%D \startnarrower
-%D \midaligned{\tfd ˮͷ}
-%D \blank
-%D \midaligned{\tfb ﵩƪ滳ɡ}
-%D \blank
-%D \midaligned{\tfb }
-%D \blank
-%D ¼ʱУѾ졣֪ϹڣϦǺꣿ˷ȥ
-%D ֿ¥ߴʤŪӰ˼䣿
-%D \blank
-%D תͻߡӦкޣƫʱԲбϣ
-%D Բȱ¹ȫԸ˳ãǧﹲ濾ꡣ
-%D \stopnarrower
-%D
-%D The english translation is:
-%D
-%D \startnarrower
-%D \midaligned{\tfd Tune: Prelude to the Melody of Water}
-%D \blank
-%D \midaligned{\tfb On the night of the Mid||Autumn Festival of
-%D 1076, I drank happily till dawn and wrote this in my cups
-%D while thinking of Zi||you.}
-%D \blank
-%D \midaligned{\tfb Su Shi}
-%D \blank
-%D How long will the bright moon appear? Wine||cup in hand, I
-%D ask the sky. I do not know waht time of year it would be
-%D tonight in the palace on high. Riding the wind, there I
-%D would fly, yet I fear the crystal palace would be far too
-%D high and cold for me. I rise and dance, with my shadow I
-%D play. On high as on earth, would it be as gay?
-%D \blank
-%D The moon goes round the mansion red though gauze||draped
-%D windows soft to shed her light upon the sleepless bed.
-%D Against man she should have no spite. Why then when people
-%D part is she oft full and bright? Men have sorrow and joy,
-%D they part or meet again; The moon may be bright or dim, she
-%D may wax or wane. There has been nothing perfect since the
-%D olden days. So let us wish that man will live long as he
-%D can! Though miles apart, we'll share the beauty she
-%D displays.
-%D \stopnarrower
-
-%D This package is written in the city of Hasselt, a pretty
-%D small town in the |<|compared to China real small|>|
-%D Netherlands. Like most dutch cities, even this small one
-%D has a chinese restaurant, run by chinese, speaking chinese,
-%D and |<|indeed|>| writing chinese. Eating there will never
-%D be the same, since now I can at least pretend to know the
-%D glyphs all around the place. The numbers should pose me no
-%D problems, but I fear I will never manage to recognize those
-%D scribles they draw on their pads when thay take your order.
-
-%D To make our lives more easy, we put it here (too):
-
-\setuptyping[\c!tab=\v!no]
-
-\protect \endinput
diff --git a/tex/context/base/font-chk.lua b/tex/context/base/font-chk.lua
index 61f3f8ab5..382f671d8 100644
--- a/tex/context/base/font-chk.lua
+++ b/tex/context/base/font-chk.lua
@@ -18,6 +18,7 @@ local chardata = characters.data
local glyph = node.id('glyph')
local traverse_id = node.traverse_id
+local remove_node = nodes.remove
-- maybe in fonts namespace
-- deletion can be option
@@ -44,7 +45,7 @@ function fonts.register_message(font,char,message)
end
end
-function checkers.missing(head,tail)
+function checkers.missing(head)
if checkers.enabled then
local lastfont, characters, found = nil, nil, nil
for n in traverse_id(glyph,head) do
@@ -67,14 +68,9 @@ function checkers.missing(head,tail)
end
if found and checkers.delete then
for i=1,#found do
- local n = found[i]
- if n == tail then
- head, tail = nodes.remove(head,n,true)
- else
- head, _ = nodes.remove(head,n,true)
- end
+ head = remove_node(head,found[i],true)
end
end
end
- return head, tail, false
+ return head, false
end
diff --git a/tex/context/base/font-cid.lua b/tex/context/base/font-cid.lua
index b8dfc4294..13e9cce89 100644
--- a/tex/context/base/font-cid.lua
+++ b/tex/context/base/font-cid.lua
@@ -93,6 +93,7 @@ local function locate(registry,ordering,supplement)
logs.report("load otf","using cidmap file %s",filename)
end
fonts.cid.map[filename] = cidmap
+ cidmap.usedname = file.basename(filename)
return cidmap
end
end
diff --git a/tex/context/base/font-col.lua b/tex/context/base/font-col.lua
index 5d089fef2..f2ee3f1ae 100644
--- a/tex/context/base/font-col.lua
+++ b/tex/context/base/font-col.lua
@@ -187,7 +187,7 @@ function collections.message(message)
end
end
-function collections.process(head,tail)
+function collections.process(head)
if active then
local done = false
for n in traverse_id(glyph,head) do
@@ -211,5 +211,5 @@ function collections.process(head,tail)
end
end
end
- return head, tail, done
+ return head, done
end
diff --git a/tex/context/base/font-heb.mkii b/tex/context/base/font-heb.mkii
new file mode 100644
index 000000000..3ec0395f3
--- /dev/null
+++ b/tex/context/base/font-heb.mkii
@@ -0,0 +1,5 @@
+\unprotected \writestatus\m!systems{load ARABTEX as a module instead}
+
+\usemodule[arabtex]
+
+\endinput
diff --git a/tex/context/base/font-heb.tex b/tex/context/base/font-heb.tex
deleted file mode 100644
index 3ec0395f3..000000000
--- a/tex/context/base/font-heb.tex
+++ /dev/null
@@ -1,5 +0,0 @@
-\unprotected \writestatus\m!systems{load ARABTEX as a module instead}
-
-\usemodule[arabtex]
-
-\endinput
diff --git a/tex/context/base/font-ini.mkii b/tex/context/base/font-ini.mkii
index 658d06f70..f614a07cd 100644
--- a/tex/context/base/font-ini.mkii
+++ b/tex/context/base/font-ini.mkii
@@ -2457,7 +2457,7 @@
\fi
\makeshortfilename[\truefilename{\f!fontprefix#2}]%
\startreadingfile
- \readsysfile\shortfilename
+ \readsysfile{\shortfilename.mkii}
{\showmessage\m!fonts2{#2}}
{\showmessage\m!fonts3{#2}}%
\stopreadingfile}}
@@ -3778,7 +3778,7 @@
%D The implementation is rather straightforward in using
%D \type{\halign}.
-\fetchruntimecommand \showbodyfont {\f!fontprefix\s!run}
+\fetchruntimecommand \showbodyfont {\f!fontprefix\s!run.mkii}
%D \macros
%D {showfontstrip, testminimalbaseline, showminimalbaseline}
@@ -3789,9 +3789,9 @@
%D
%D \showfontstrip \blank \showminimalbaseline
-\fetchruntimecommand \showfontstrip {\f!fontprefix\s!run}
-\fetchruntimecommand \testminimalbaseline {\f!fontprefix\s!run}
-\fetchruntimecommand \showminimalbaseline {\f!fontprefix\s!run}
+\fetchruntimecommand \showfontstrip {\f!fontprefix\s!run.mkii}
+\fetchruntimecommand \testminimalbaseline {\f!fontprefix\s!run.mkii}
+\fetchruntimecommand \showminimalbaseline {\f!fontprefix\s!run.mkii}
%D \macros
%D {showkerning}
@@ -3800,7 +3800,7 @@
%D
%D \showkerning{Can you guess what kerning is?}
-\fetchruntimecommand \showkerning {\f!fontprefix\s!run}
+\fetchruntimecommand \showkerning {\f!fontprefix\s!run.mkii}
%D \macros
%D {showbodyfontenvironment}
@@ -3813,7 +3813,7 @@
%D
%D \showsetup{showbodyfontenvironment}
-\fetchruntimecommand \showbodyfontenvironment {\f!fontprefix\s!run}
+\fetchruntimecommand \showbodyfontenvironment {\f!fontprefix\s!run.mkii}
%D \macros
%D {showfont,showfontstyle,showligatures}
@@ -3834,11 +3834,11 @@
% to be internationalized
-\fetchruntimecommand \showfont {\f!fontprefix\s!run}
-\fetchruntimecommand \showfontstyle {\f!fontprefix\s!run}
-\fetchruntimecommand \showligature {\f!fontprefix\s!run}
-\fetchruntimecommand \showligatures {\f!fontprefix\s!run}
-\fetchruntimecommand \showcharratio {\f!fontprefix\s!run}
+\fetchruntimecommand \showfont {\f!fontprefix\s!run.mkii}
+\fetchruntimecommand \showfontstyle {\f!fontprefix\s!run.mkii}
+\fetchruntimecommand \showligature {\f!fontprefix\s!run.mkii}
+\fetchruntimecommand \showligatures {\f!fontprefix\s!run.mkii}
+\fetchruntimecommand \showcharratio {\f!fontprefix\s!run.mkii}
%D \macros
%D {getglyph, symbolicfont}
diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv
index 5ce6248ea..339e521a9 100644
--- a/tex/context/base/font-ini.mkiv
+++ b/tex/context/base/font-ini.mkiv
@@ -405,7 +405,7 @@
%D defining it here, we have at least an safeguard for utility
%D file reading.
-\ifx\uchar\undefined \unexpanded\def\uchar#1#2{[#1,#2]} \fi
+\ifdefined\uchar\else \unexpanded\def\uchar#1#2{[#1,#2]} \fi
%D We define some (very private) constants to improve speed,
%D memory usage and consistency.
@@ -459,7 +459,10 @@
%D tests but it does not help us when no math is defined.
\chardef\mrfam\zerocount % math regular
-\chardef\mbfam\zerocount % math bold
+\chardef\mbfam\plusone % math bold
+
+\unexpanded\def\mr{\ifmmode\fam\zerocount\else\setcurrentfontalternative\c!mr\fi} % \fam\csname\c!mr fam\endcsname
+\unexpanded\def\mb{\ifmmode\fam\plusone \else\setcurrentfontalternative\c!mb\fi} % \fam\csname\c!mb fam\endcsname
\def\mathtextsuffix {-text}
\def\mathscriptsuffix {-script}
@@ -508,7 +511,17 @@
\appendtoks
\dosetmathfamily\mrfam\c!mr
- %\dosetmathfamily\mbfam\c!mb % some day, only when defined, else equivalent to 0
+\to \mathstrategies
+
+% not official !
+
+\chardef\boldmathmode\zerocount % might change ... maybe \mathfontsupport 1 (normal) 2 (bold too)
+
+\def\enableboldmath {\chardef\boldmathmode\plusone } % todo: \setupbodyfont[boldmath,...]
+\def\disableboldmath{\chardef\boldmathmode\zerocount}
+
+\appendtoks
+ \ifcase\boldmathmode\or\dosetmathfamily\mbfam\c!mb\fi
\to \mathstrategies
%D All used styles, like rm, ss and tt, are saved in a comma
@@ -825,7 +838,6 @@
\def \defaultfontfile{\truefontname{Normal}} % was cmtt10, but that one is gone
\edef\nullfontname {\fontname\nullfont}
-\edef\dummyfontname {font\strippedcsname\\}
%D \macros
%D {everyfont,everyfontswitch}
@@ -1082,12 +1094,6 @@
\let\oldrawfontidentifier\rawfontidentifier
\let\oldnewfontidentifier\newfontidentifier
-% best we can add the style as well because otherwise we get math encoding mixups
-%
-% \setupbodyfont [8pt] [\currentencoding/\ccaron\scaron\zcaron]
-% \blank
-% \switchtobodyfont[7pt] [\currentencoding/\ccaron\scaron\zcaron]
-
\def\newfontidentifier{*\fontclass\lastfontidentifier\fontstyle\fontsize*}
\def\dododefinefont#1#2%
@@ -1176,7 +1182,7 @@
\let\fontalternativelist\empty
\let\fontstylelist \empty
-\def\checkfontnamecombinations
+\def\checkfontnamecombinations % we need to split math and text here ... todo (math only has mr and mb)
{\def\docommand##1%
{\def\dodocommand####1%
{\def\dododocommand########1{\checkbodyfont{########1}{####1}{##1}}%
@@ -1508,7 +1514,7 @@
\doifnumberelse{#1}
{\doifassignmentelse{#3}
{% [12pt] [style] [settings]
- \doifundefined{#2}{\normalexpanded{\noexpand\definefontstyle[#2][#2]}}% new
+ \ifcsname#2\endcsname\else\normalexpanded{\noexpand\definefontstyle[#2][#2]}\fi % new
\processcommalist[#1]{\dododefinebodyfont{#2}{#3}}}
{% [12pt] [style] [identifier]
\dodefinedefaultbodyfont[#1][#2][#3]}} % body style identifier
@@ -1517,10 +1523,14 @@
\else\ifsecondargument
\definebodyfont[#1][\c!rm][#2]%
\else
- \doifundefined{\@size@#1} % Maybe there are default dependancies
- {\defineunknownfont{#1}}% defined which we can use ([unknown])
- \doifundefined{\@size@#1} % and if not, then we have at least to
- {\definebodyfont[#1][\c!rm][]}% make sure some basics are set up.
+ % Maybe there are default dependencies defined which we can use ([unknown]) and
+ % if not, then we have at least to make sure some basics are set up.
+ \ifcsname\@size@#1\endcsname \else
+ \defineunknownfont{#1}%
+ \fi
+ \ifcsname\@size@#1\endcsname \else
+ \definebodyfont[#1][\c!rm][]%
+ \fi
\fi\fi}
\def\xdodefinebodyfont[#1][#2][#3]% body|identifier style defs|identifier
@@ -1588,18 +1598,19 @@
\normalprotected\@EA\fcxdef\csname\fontclass#2#1#3#4#53\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#53}{\normalunexpanded{#6}}}}
\def\checkbodyfont#1% tests for ttsl mmbf
- {\def\c!!mm{#1}%
+ {\edef\c!!mm{#1}%
\ifx\c!!mm\c!mm % prevents \max and alike (re)defs
\expandafter\checkmathbodyfont
\else
\expandafter\checktextbodyfont
\fi{#1}} % no \c!!mm, not expanded later on
+% some day we can do an auto-fam if needed
+
\def\checkmathbodyfont#1#2#3% style alt size / gdef % #3 can be empty
{%\message{!m #1 #2 #3!}%
% #1 #2 #3 = signal
- %unexpanded\setgvalue {#1#2#3}{\setcurrentfontstylealternativesize{#1}{#2}{#3}}% \mmsla
- \unexpanded\setgvalue {#2}{\setcurrentfontalternative {#2}}% \sl
+ %unexpanded\setgvalue {#2}{\setcurrentfontalternative {#2}}% \mr \mb
\unexpanded\setgvalue {#1}{\setcurrentfontstyle {#1}}}% \mm
\def\checktextbodyfont#1#2#3% style alt size / gdef % #3 can be empty
@@ -1619,9 +1630,10 @@
{\def\dododefinedefaultbodyfont##1%
{\def\dodododefinedefaultbodyfont####1%
{\def\dododododefinedefaultbodyfont########1%
- {\doifdefined{\s!default########1####1}
- {% [12pt] [style] [identifier]
- \getvalue{\s!default########1####1}{##1}{####1}}}%
+ {\ifcsname\s!default########1####1\endcsname
+ % [12pt] [style] [identifier]
+ \csname\s!default########1####1\endcsname{##1}{####1}%
+ \fi}%
\processcommalist[#3]\dododododefinedefaultbodyfont}%
\processcommalist[#2]\dodododefinedefaultbodyfont}%
\processcommalist[#1]\dododefinedefaultbodyfont}
@@ -1643,14 +1655,14 @@
\def\dodefineunknownbodyfont#1#2% see ***
{\ifcsname\s!default\s!default#2\endcsname % somehow related to */*
\donetrue
- \getvalue{\s!default\s!default#2}{#1}{#2}%
+ \csname\s!default\s!default#2\endcsname{#1}{#2}%
\fi}
\def\dodefineunknownsubfont#1#2%
- {\ifcsname\@size@\getvalue{\??ft#1#2}\endcsname
+ {\ifcsname\@size@\csname\??ft#1#2\endcsname\endcsname
\else
\donetrue
- \defineunknownfont{\getvalue{\??ft#1#2}}%
+ \defineunknownfont{\csname\??ft#1#2\endcsname}%
\fi}
\def\defineunknownfont#1%
@@ -1832,27 +1844,32 @@
% can be made faster (only used internally now)
\def\doswitchpoints[#1]%
- {\normalexpanded{\noexpand\dodoswitchpoints{#1}}}
+ {\normalexpanded{\dodoswitchpoints{#1}}}
-\def\dodoswitchpoints#1%
- {\doifundefined{\@size@#1}
- {\defineunknownfont{#1}}%
+\unexpanded \def\dodoswitchpoints#1%
+ {\ifcsname\@size@#1\endcsname \else
+ \defineunknownfont{#1}%
+ \fi%
%\defineunknownfontstyles{#1}%
- \doifdefinedelse{\@size@#1}
- {\getvalue{\@size@#1}%
- \localbodyfontsize#1\relax
- \normalizebodyfontsize\localbodyfontsize\to\normalizedbodyfontsize
-% \edef\fontbody{\fontbody}% to be tested but we can clean up mkiv further
- \checkbodyfontenvironment[\normalizedbodyfontsize]}
- {\showmessage\m!fonts4{#1}}}
-
-\unprotected \def\doswitchstyle[#1]%
- {\doifdefinedelse{\@style@#1}
- {\getvalue{\@style@#1}%
- \edef\fontstyle{#1}%
- \ifmmode\mr\fi % in order to be compatible with \rm in math mode
- }% \the\everybodyfont} % cleaner, in setting size as well as style
- {\showmessage\m!fonts5{#1}}}
+ \ifcsname\@size@#1\endcsname
+ \csname\@size@#1\endcsname
+ \localbodyfontsize#1\relax
+ \normalizebodyfontsize\localbodyfontsize\to\normalizedbodyfontsize
+ % \edef\fontbody{\fontbody}% to be tested but we can clean up mkiv further
+ \checkbodyfontenvironment[\normalizedbodyfontsize]%
+ \else
+ \showmessage\m!fonts4{#1}%
+ \fi}
+
+\unexpanded \def\doswitchstyle[#1]%
+ {\ifcsname\@style@#1\endcsname
+ \csname\@style@#1\endcsname
+ \edef\fontstyle{#1}%
+ \ifmmode\mr\fi % in order to be compatible with \rm in math mode
+ % \the\everybodyfont % cleaner, in setting size as well as style
+ \else
+ \showmessage\m!fonts5{#1}%
+ \fi}
%D \TEX\ loads font metric files like \type{cmr10.tfm} and
%D \type{tir.tfm} only once. In \PLAIN\ \TEX\ some font files
@@ -2450,9 +2467,11 @@
\unexpanded\def\switchtobodyfont[#1]%
{\doifsomething{#1}
- {\doifdefinedelse{\??ft\normalizedbodyfontsize\interfaced{#1}}
- {\setbodyfontstep{#1}} % so we have a fast [small] switch
- {\dosetfont0{#1}}%
+ {\ifcsname\??ft\normalizedbodyfontsize\interfaced{#1}\endcsname
+ \setbodyfontstep{#1}% so we have a fast [small] switch
+ \else
+ \dosetfont0{#1}%
+ \fi
\the\everybodyfont}} % indeed needed in case nothing is executed
%D The following alternative is meant for math||to||text
@@ -2513,6 +2532,10 @@
[%mode=node,%
liga=yes,kern=yes,tlig=yes,trep=yes,onum=yes] % texligatures=yes,texquotes=yes
+\definefontfeature % can be used for type1 fonts
+ [complete]
+ [liga=yes,kern=yes,compose=yes,tlig=yes,trep=yes]
+
\definefontfeature
[arabic]
[mode=node,language=dflt,script=arab,ccmp=yes,
@@ -2633,10 +2656,10 @@
\definecomplexorsimple\switchstyleonly
\def\simpleswitchstyleonly#1% stupid version
- {\complexswitchstyleonly[\strippedcsname#1]}
+ {\complexswitchstyleonly[\checkedstrippedcsname#1]}
\def\complexswitchstyleonly[#1]% todo : check
- {\setcurrentfontstyle{\getvalue{\@shortstyle@#1}}%
+ {\setcurrentfontstyle{\csname\@shortstyle@#1\endcsname}%
\the\everybodyfont} % needed ?
%D \macros
@@ -2814,7 +2837,7 @@
\def\dodefinealternativestyle[#1][#2][#3]%
{\def\docommand##1%
- {\doifundefined{##1}{\setvalue{##1}{\groupedcommand{#2}{}}}%
+ {\ifcsname##1\endcsname\else\setvalue{##1}{\groupedcommand{#2}{}}\fi
\setvalue{\@letter@ ##1}{#2}%
\setvalue{\@noletter@##1}{#3}}%
\processcommalist[#1]\docommand}
@@ -2947,37 +2970,37 @@
%D or even better:
-\def\doemphasistypeface#1#2% slow
- {\doifelsevalue{\??ft\fontclass\normalizedbodyfontsize\c!em}\v!slanted
- {#1}%
- {\doifelsevalue{\??ft\fontclass\normalizedbodyfontsize\c!em}\v!italic
- {#2}%
- {\doifelsevaluenothing{\??ft\fontclass\normalizedbodyfontsize\c!em}
- {\doifelsevalue{\??ft\normalizedbodyfontsize\c!em}\v!slanted
- {#1}%
- {\doifelsevalue{\??ft\normalizedbodyfontsize\c!em}\v!italic
- {#2}%
- {\getvalue{\??ft\normalizedbodyfontsize\c!em}}}}
- {\getvalue{\??ft\fontclass\normalizedbodyfontsize\c!em}}}}}
-
-% \def\doemphasistypeface#1#2%
-% {\edef\emphasizedtypeface{\csname\??ft\fontclass\normalizedbodyfontsize\c!em\endcsname}%
-% \ifx\emphasizedtypeface\v!slanted
-% #1%
-% \else\ifx\emphasizedtypeface\v!italic
-% #2%
-% \else\ifx\emphasizedtypeface\v!empty
-% \edef\emphasizedtypeface{\csname\??ft\normalizedbodyfontsize\c!em\endcsname}%
-% \ifx\emphasizedtypeface\v!slanted
-% #1%
-% \else\ifx\emphasizedtypeface\v!italic
-% #2%
-% \else
-% \getvalue\emphasizedtypeface
-% \fi\fi
-% \else
-% \getvalue\emphasizedtypeface
-% \fi\fi\fi}
+% \def\doemphasistypeface#1#2% slow
+% {\doifelsevalue{\??ft\fontclass\normalizedbodyfontsize\c!em}\v!slanted
+% {#1}%
+% {\doifelsevalue{\??ft\fontclass\normalizedbodyfontsize\c!em}\v!italic
+% {#2}%
+% {\doifelsevaluenothing{\??ft\fontclass\normalizedbodyfontsize\c!em}
+% {\doifelsevalue{\??ft\normalizedbodyfontsize\c!em}\v!slanted
+% {#1}%
+% {\doifelsevalue{\??ft\normalizedbodyfontsize\c!em}\v!italic
+% {#2}%
+% {\getvalue{\??ft\normalizedbodyfontsize\c!em}}}}
+% {\getvalue{\??ft\fontclass\normalizedbodyfontsize\c!em}}}}}
+
+\def\doemphasistypeface#1#2%
+ {\edef\emphasizedtypeface{\csname\??ft\fontclass\normalizedbodyfontsize\c!em\endcsname}%
+ \ifx\emphasizedtypeface\v!slanted
+ #1%
+ \else\ifx\emphasizedtypeface\v!italic
+ #2%
+ \else\ifx\emphasizedtypeface\v!empty
+ \edef\emphasizedtypeface{\csname\??ft\normalizedbodyfontsize\c!em\endcsname}%
+ \ifx\emphasizedtypeface\v!slanted
+ #1%
+ \else\ifx\emphasizedtypeface\v!italic
+ #2%
+ \else
+ \getvalue\emphasizedtypeface
+ \fi\fi
+ \else
+ \getvalue\emphasizedtypeface
+ \fi\fi\fi}
\def\emphasistypeface{\doemphasistypeface\sl\it}
\def\emphasisboldface{\doemphasistypeface\bs\bi}
@@ -3182,7 +3205,7 @@
%D The implementation is rather straightforward in using
%D \type{\halign}.
-\fetchruntimecommand \showbodyfont {\f!fontprefix\s!run}
+\fetchruntimecommand \showbodyfont {\f!fontprefix\s!run.mkii}
%D \macros
%D {showfontstrip, testminimalbaseline, showminimalbaseline}
@@ -3193,9 +3216,9 @@
%D
%D \showfontstrip \blank \showminimalbaseline
-\fetchruntimecommand \showfontstrip {\f!fontprefix\s!run}
-\fetchruntimecommand \testminimalbaseline {\f!fontprefix\s!run}
-\fetchruntimecommand \showminimalbaseline {\f!fontprefix\s!run}
+\fetchruntimecommand \showfontstrip {\f!fontprefix\s!run.mkii}
+\fetchruntimecommand \testminimalbaseline {\f!fontprefix\s!run.mkii}
+\fetchruntimecommand \showminimalbaseline {\f!fontprefix\s!run.mkii}
%D \macros
%D {showkerning}
@@ -3204,7 +3227,7 @@
%D
%D \showkerning{Can you guess what kerning is?}
-\fetchruntimecommand \showkerning {\f!fontprefix\s!run}
+\fetchruntimecommand \showkerning {\f!fontprefix\s!run.mkii}
%D \macros
%D {showbodyfontenvironment}
@@ -3217,7 +3240,7 @@
%D
%D \showsetup{showbodyfontenvironment}
-\fetchruntimecommand \showbodyfontenvironment {\f!fontprefix\s!run}
+\fetchruntimecommand \showbodyfontenvironment {\f!fontprefix\s!run.mkii}
%D \macros
%D {showfont,showfontstyle,showligatures}
@@ -3233,11 +3256,11 @@
% to be internationalized
-\fetchruntimecommand \showfont {\f!fontprefix\s!run}
-\fetchruntimecommand \showfontstyle {\f!fontprefix\s!run}
-\fetchruntimecommand \showligature {\f!fontprefix\s!run}
-\fetchruntimecommand \showligatures {\f!fontprefix\s!run}
-\fetchruntimecommand \showcharratio {\f!fontprefix\s!run}
+\fetchruntimecommand \showfont {\f!fontprefix\s!run.mkii}
+\fetchruntimecommand \showfontstyle {\f!fontprefix\s!run.mkii}
+\fetchruntimecommand \showligature {\f!fontprefix\s!run.mkii}
+\fetchruntimecommand \showligatures {\f!fontprefix\s!run.mkii}
+\fetchruntimecommand \showcharratio {\f!fontprefix\s!run.mkii}
%D \macros
%D {getglyph, symbolicfont}
@@ -3746,7 +3769,7 @@
\def\dodefinestyleinstance[#1][#2][#3][#4]% [name] [rm|ss|tt|..] [sl|bf|...] [whatever]
{\iffirstargument
- \doifundefined{#1}{\definestylecollection[#1]}%
+ \ifcsname#1\endcsname\else\definestylecollection[#1]\fi
\fi
\iffourthargument
\setvalue{\??sx#1:#2:#3}{#4}%
@@ -3756,7 +3779,7 @@
\letvalue{\??sx#1::#2}\empty
\fi\fi\fi}
-\unexpanded\def\styleinstance[#1]% will be faster
+\unexpanded\def\styleinstance[#1]% will be made faster
{%\begingroup\normalexpanded{\noexpand\infofont[#1:\fontstyle:\fontalternative]}\endgroup
\executeifdefined{\??sx#1:\fontstyle:\fontalternative}%
{\executeifdefined{\??sx#1:\fontstyle:\s!default}%
diff --git a/tex/context/base/font-jap.mkii b/tex/context/base/font-jap.mkii
new file mode 100644
index 000000000..42480df43
--- /dev/null
+++ b/tex/context/base/font-jap.mkii
@@ -0,0 +1,83 @@
+%D \module
+%D [ file=font-jap,
+%D version=2006.01.13,
+%D title=\CONTEXT\ Font Macros,
+%D subtitle=Japanese,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D suggestions=Wang Lei,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\ifx\handlejapaneseunicodeglyph\undefined \else \endinput \fi
+\ifx\handlechineseunicodeglyph \undefined \input font-chi.tex \fi
+
+\writestatus{loading}{ConTeXt Font Macros / Japanese}
+
+\unprotect
+
+\newif\iftracejapanese
+
+\let\japaneseencoding\empty
+
+\def\setjapaneseencoding
+ {\getfontfileparameters\unicodestyle
+ \ifx\currentfontfileencoding\undefined \else
+ \let\japaneseencoding\currentfontfileencoding
+ \fi}
+
+\def\japaneseunicodescale {\chineseunicodescale }
+\def\japaneseunicodeheight {\chineseunicodeheight }
+\def\japaneseunicodedepth {\chineseunicodedepth }
+\def\japaneseinterglyphskip{\chineseinterglyphskip}
+\def\japanesesurroundskip {\chinesesurroundskip }
+
+\setupunicodefont
+ [japanese]
+ [ \c!scale=\japaneseunicodescale,
+ \c!height=\japaneseunicodeheight,
+ \c!depth=\japaneseunicodedepth,
+ \c!strut=\v!yes,
+ \c!interlinespace=\v!yes,
+ \c!conversion=\japanesenumber,
+ \c!commands=\setjapaneseencoding, % needed for digits
+ \c!command=\handlejapaneseunicodeglyph]
+
+\def\japanesenumber{\numbers}
+
+\def\handlejapaneseunicodeglyph
+ {\begingroup
+% \let\chineseunicodescale \japaneseunicodescale
+% \let\chineseunicodeheight \japaneseunicodeheight
+% \let\chineseunicodedepth \japaneseunicodedepth
+% \let\chineseinterglyphskip\japaneseinterglyphskip
+% \let\chinesesurroundskip \japanesesurroundskip
+ \iftracejapanese\tracechinesetrue\else\tracechinesefalse\fi
+ \handlechineseunicodeglyph
+ \endgroup}
+
+\doifelse \currentregime {utf} {
+
+ % todo: typescripts
+
+ \definefontsynonym [JapaneseRegular] [uni-cybercjk-][encoding=cjk-uni]
+ \definefontsynonym [JapaneseSlanted] [uni-cybercjk-][encoding=cjk-uni]
+ \definefontsynonym [JapaneseItalic] [uni-cybercjk-][encoding=cjk-uni]
+ \definefontsynonym [JapaneseBold] [uni-cybercjk-][encoding=cjk-uni]
+ \definefontsynonym [JapaneseBoldSlanted][uni-cybercjk-][encoding=cjk-uni]
+ \definefontsynonym [JapaneseBoldItalic] [uni-cybercjk-][encoding=cjk-uni]
+
+ \loadmapfile[uni-cybercjk.map]
+
+ \defineunicodefont [Japanese] [Japanese] [japanese]
+
+} {
+ \writestatus{Japanese}{No fonts defined}
+}
+
+\Japanese
+
+\protect \endinput
diff --git a/tex/context/base/font-jap.tex b/tex/context/base/font-jap.tex
deleted file mode 100644
index 42480df43..000000000
--- a/tex/context/base/font-jap.tex
+++ /dev/null
@@ -1,83 +0,0 @@
-%D \module
-%D [ file=font-jap,
-%D version=2006.01.13,
-%D title=\CONTEXT\ Font Macros,
-%D subtitle=Japanese,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D suggestions=Wang Lei,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\ifx\handlejapaneseunicodeglyph\undefined \else \endinput \fi
-\ifx\handlechineseunicodeglyph \undefined \input font-chi.tex \fi
-
-\writestatus{loading}{ConTeXt Font Macros / Japanese}
-
-\unprotect
-
-\newif\iftracejapanese
-
-\let\japaneseencoding\empty
-
-\def\setjapaneseencoding
- {\getfontfileparameters\unicodestyle
- \ifx\currentfontfileencoding\undefined \else
- \let\japaneseencoding\currentfontfileencoding
- \fi}
-
-\def\japaneseunicodescale {\chineseunicodescale }
-\def\japaneseunicodeheight {\chineseunicodeheight }
-\def\japaneseunicodedepth {\chineseunicodedepth }
-\def\japaneseinterglyphskip{\chineseinterglyphskip}
-\def\japanesesurroundskip {\chinesesurroundskip }
-
-\setupunicodefont
- [japanese]
- [ \c!scale=\japaneseunicodescale,
- \c!height=\japaneseunicodeheight,
- \c!depth=\japaneseunicodedepth,
- \c!strut=\v!yes,
- \c!interlinespace=\v!yes,
- \c!conversion=\japanesenumber,
- \c!commands=\setjapaneseencoding, % needed for digits
- \c!command=\handlejapaneseunicodeglyph]
-
-\def\japanesenumber{\numbers}
-
-\def\handlejapaneseunicodeglyph
- {\begingroup
-% \let\chineseunicodescale \japaneseunicodescale
-% \let\chineseunicodeheight \japaneseunicodeheight
-% \let\chineseunicodedepth \japaneseunicodedepth
-% \let\chineseinterglyphskip\japaneseinterglyphskip
-% \let\chinesesurroundskip \japanesesurroundskip
- \iftracejapanese\tracechinesetrue\else\tracechinesefalse\fi
- \handlechineseunicodeglyph
- \endgroup}
-
-\doifelse \currentregime {utf} {
-
- % todo: typescripts
-
- \definefontsynonym [JapaneseRegular] [uni-cybercjk-][encoding=cjk-uni]
- \definefontsynonym [JapaneseSlanted] [uni-cybercjk-][encoding=cjk-uni]
- \definefontsynonym [JapaneseItalic] [uni-cybercjk-][encoding=cjk-uni]
- \definefontsynonym [JapaneseBold] [uni-cybercjk-][encoding=cjk-uni]
- \definefontsynonym [JapaneseBoldSlanted][uni-cybercjk-][encoding=cjk-uni]
- \definefontsynonym [JapaneseBoldItalic] [uni-cybercjk-][encoding=cjk-uni]
-
- \loadmapfile[uni-cybercjk.map]
-
- \defineunicodefont [Japanese] [Japanese] [japanese]
-
-} {
- \writestatus{Japanese}{No fonts defined}
-}
-
-\Japanese
-
-\protect \endinput
diff --git a/tex/context/base/font-map.lua b/tex/context/base/font-map.lua
index 35cfaf32f..c597d4855 100644
--- a/tex/context/base/font-map.lua
+++ b/tex/context/base/font-map.lua
@@ -6,13 +6,16 @@ if not modules then modules = { } end modules ['font-map'] = {
license = "see context related readme files"
}
-local match, format, find = string.match, string.format, string.find
+local match, format, find, concat = string.match, string.format, string.find, table.concat
+
+local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end)
local ctxcatcodes = tex.ctxcatcodes
--[[ldx--
Eventually this code will disappear because map files are kind
of obsolete. Some code may move to runtime or auxiliary modules.
+The name to unciode related code will stay of course.
--ldx]]--
fonts = fonts or { }
@@ -123,3 +126,93 @@ function fonts.map.load_file(filename, entries, encodings)
end
return entries, encodings
end
+
+function fonts.map.load_lum_table(filename)
+ local lumname = file.replacesuffix(file.basename(filename),"lum")
+ local lumfile = resolvers.find_file(lumname,"map") or ""
+ if lumfile ~= "" and lfs.isfile(lumfile) then
+ if trace_loading or trace_unimapping then
+ logs.report("load otf","enhance: loading %s ",lumfile)
+ end
+ lumunic = dofile(lumfile)
+ return lumunic, lumfile
+ end
+end
+
+local hex = lpeg.R("AF","09")
+local hexfour = (hex*hex*hex*hex) / function(s) return tonumber(s,16) end
+local dec = (lpeg.R("09")^1) / tonumber
+local period = lpeg.P(".")
+
+local unicode = lpeg.P("uni") * (hexfour * (period + lpeg.P(-1)) * lpeg.Cc(false) + lpeg.Ct(hexfour^1) * lpeg.Cc(true))
+local index = lpeg.P("index") * dec * lpeg.Cc(false)
+
+local parser = unicode + index
+
+local parsers = { }
+
+function fonts.map.make_name_parser(str)
+ if not str or str == "" then
+ return parser
+ else
+ local p = parsers[str]
+ if not p then
+ p = lpeg.P(str) * period * dec * lpeg.Cc(false)
+ parsers[str] = p
+ end
+ return p
+ end
+end
+
+--~ local parser = fonts.map.make_name_parser("Japan1")
+--~ local function test(str)
+--~ local b, a = parser:match(str)
+--~ print((a and table.serialize(b)) or b)
+--~ end
+--~ test("uni1234")
+--~ test("uni1234.xx")
+--~ test("uni12349876")
+--~ test("index1234")
+--~ test("Japan1.123")
+
+function fonts.map.tounicode16(unicode)
+ if unicode < 0x10000 then
+ return format("%04X",unicode)
+ else
+ return format("%04X%04X",unicode/1024+0xD800,unicode%1024+0xDC00)
+ end
+end
+
+function fonts.map.tounicode16sequence(unicodes)
+ local t = { }
+ for l=1,#unicodes do
+ local unicode = unicodes[l]
+ if unicode < 0x10000 then
+ t[l] = format("%04X",unicode)
+ else
+ t[l] = format("%04X%04X",unicode/1024+0xD800,unicode%1024+0xDC00)
+ end
+ end
+ return concat(t)
+end
+
+--~ This is quite a bit faster but at the cost of some memory but if we
+--~ do this we will also use it elsewhere so let's not follow this route
+--~ now. I might use this method in the plain variant (no caching there)
+--~ but then I need a flag that distinguishes between code branches.
+--~
+--~ local cache = { }
+--~
+--~ function fonts.map.tounicode16(unicode)
+--~ local s = cache[unicode]
+--~ if not s then
+--~ if unicode < 0x10000 then
+--~ s = format("%04X",unicode)
+--~ else
+--~ s = format("%04X%04X",unicode/1024+0xD800,unicode%1024+0xDC00)
+--~ end
+--~ cache[unicode] = s
+--~ end
+--~ return s
+--~ end
+
diff --git a/tex/context/base/font-mis.lua b/tex/context/base/font-mis.lua
index 520f9e7a6..cc20b9711 100644
--- a/tex/context/base/font-mis.lua
+++ b/tex/context/base/font-mis.lua
@@ -11,7 +11,7 @@ local lower, strip = string.lower, string.strip
fonts.otf = fonts.otf or { }
-fonts.otf.version = fonts.otf.version or 2.626
+fonts.otf.version = fonts.otf.version or 2.628
fonts.otf.pack = true
fonts.otf.cache = containers.define("fonts", "otf", fonts.otf.version, true)
diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua
index 00ac596cc..f3b3f5481 100644
--- a/tex/context/base/font-otf.lua
+++ b/tex/context/base/font-otf.lua
@@ -12,12 +12,13 @@ local concat, getn, utfbyte = table.concat, table.getn, utf.byte
local format, gmatch, gsub, find, match, lower, strip = string.format, string.gmatch, string.gsub, string.find, string.match, string.lower, string.strip
local type, next, tonumber, tostring = type, next, tonumber, tostring
-local trace_private = false trackers.register("otf.private", function(v) trace_private = v end)
-local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end)
-local trace_features = false trackers.register("otf.features", function(v) trace_features = v end)
-local trace_dynamics = false trackers.register("otf.dynamics", function(v) trace_dynamics = v end)
-local trace_sequences = false trackers.register("otf.sequences", function(v) trace_sequences = v end)
-local trace_math = false trackers.register("otf.math", function(v) trace_math = v end)
+local trace_private = false trackers.register("otf.private", function(v) trace_private = v end)
+local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end)
+local trace_features = false trackers.register("otf.features", function(v) trace_features = v end)
+local trace_dynamics = false trackers.register("otf.dynamics", function(v) trace_dynamics = v end)
+local trace_sequences = false trackers.register("otf.sequences", function(v) trace_sequences = v end)
+local trace_math = false trackers.register("otf.math", function(v) trace_math = v end)
+local trace_unimapping = false trackers.register("otf.unimapping", function(v) trace_unimapping = v end)
--~ trackers.enable("otf.loading")
@@ -81,7 +82,7 @@ otf.features.default = otf.features.default or { }
otf.enhancers = otf.enhancers or { }
otf.glists = { "gsub", "gpos" }
-otf.version = 2.626 -- beware: also sync font-mis.lua
+otf.version = 2.628 -- beware: also sync font-mis.lua
otf.pack = true -- beware: also sync font-mis.lua
otf.syncspace = true
otf.notdef = false
@@ -464,15 +465,18 @@ otf.enhancers["analyse marks"] = function(data,filename)
end
end
-local other = lpeg.C((1 - lpeg.S("_."))^0)
-local ligsplitter = lpeg.Ct(other * (lpeg.P("_") * other)^0)
+local separator = lpeg.S("_.")
+local other = lpeg.C((1 - separator)^1)
+local ligsplitter = lpeg.Ct(other * (separator * other)^0)
---~ print(splitter:match("this"))
---~ print(splitter:match("this.that"))
---~ print(splitter:match("such_so_more"))
---~ print(splitter:match("such_so_more.that"))
+--~ print(table.serialize(ligsplitter:match("this")))
+--~ print(table.serialize(ligsplitter:match("this.that")))
+--~ print(table.serialize(ligsplitter:match("japan1.123")))
+--~ print(table.serialize(ligsplitter:match("such_so_more")))
+--~ print(table.serialize(ligsplitter:match("such_so_more.that")))
otf.enhancers["analyse unicodes"] = function(data,filename)
+ local tounicode16, tounicode16sequence = fonts.map.tounicode16, fonts.map.tounicode16sequence
local unicodes = data.luatex.unicodes
-- we need to move this code
unicodes['space'] = unicodes['space'] or 32 -- handly later on
@@ -482,53 +486,113 @@ otf.enhancers["analyse unicodes"] = function(data,filename)
-- the tounicode mapping is sparse and only needed for alternatives
local tounicode, originals, ns, nl, private, unknown = { }, { }, 0, 0, fonts.private, format("%04X",utfbyte("?"))
data.luatex.tounicode, data.luatex.originals = tounicode, originals
+ local lumunic, uparser, oparser
+ if false then -- will become an option
+ lumunic = fonts.map.load_lum_table(filename)
+ lumunic = lumunic and lumunic.tounicode
+ end
+ local cidinfo, cidnames, cidcodes = data.cidinfo
+ local usedmap = cidinfo and cidinfo.usedname
+ usedmap = usedmap and fonts.cid.map[usedmap]
+ if usedmap then
+ oparser = usedmap and fonts.map.make_name_parser(cidinfo.ordering)
+ cidnames = usedmap.names
+ cidcodes = usedmap.unicodes
+ end
+ uparser = fonts.map.make_name_parser()
for index, glyph in next, data.glyphs do
local name, unic = glyph.name, glyph.unicode or -1 -- play safe
if unic == -1 or unic >= private or (unic >= 0xE000 and unic <= 0xF8FF) or unic == 0xFFFE or unic == 0xFFFF then
- -- a.whatever or a_b_c.whatever or a_b_c
- local split = ligsplitter:match(name)
- if #split == 0 then
- -- skip
- elseif #split == 1 then
- local u = unicodes[split[1]]
- if u then
- if type(u) == "table" then
- u = u[1]
- end
- if u < 0x10000 then
- originals[index], tounicode[index] = u, format("%04X",u)
- else
- originals[index], tounicode[index] = u, format("%04X%04X",u/1024+0xD800,u%1024+0xDC00)
+ local unicode = lumunic and lumunic[name]
+ if unicode then
+ originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1
+ end
+ -- cidmap heuristics, beware, there is no guarantee for a match unless
+ -- the chain resolves
+ if not unicode and usedmap then
+ local foundindex = oparser:match(name)
+ if foundindex then
+ unicode = cidcodes[foundindex] -- name to number
+ if not unicode then
+ local reference = cidnames[foundindex] -- number to name
+ if reference then
+ local foundindex = oparser:match(reference)
+ if foundindex then
+ unicode = cidcodes[foundindex]
+ if unicode then
+ originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1
+ end
+ end
+ if not unicode then
+ local foundcodes, multiple = uparser:match(reference)
+ if foundcodes then
+ if multiple then
+ originals[index], tounicode[index], nl, unicode = foundcodes, tounicode16sequence(foundcodes), nl + 1, true
+ else
+ originals[index], tounicode[index], ns, unicode = foundcodes, tounicode16(foundcodes), ns + 1, foundcodes
+ end
+ end
+ end
+ end
end
- ns = ns + 1
- else
- originals[index], tounicode[index] = 0xFFFD, "FFFD"
end
- else
- local as = { }
- for l=1,#split do
- local u = unicodes[split[l]]
- if not u then
- as[l], split[l] = 0xFFFD, "FFFD"
- else
- if type(u) == "table" then
- u = u[1]
+ end
+ -- a.whatever or a_b_c.whatever or a_b_c (no numbers)
+ if not unicode then
+ local split = ligsplitter:match(name)
+ local nplit = (split and #split) or 0
+ if nplit == 0 then
+ -- skip
+ elseif nplit == 1 then
+ unicode = unicodes[split[1]]
+ if unicode then
+ if type(unicode) == "table" then
+ unicode = unicode[1]
end
- if u < 0x10000 then
- as[l], split[l] = u, format("%04X",u)
+ originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1
+ end
+ else
+ local done = true
+ for l=1,nplit do
+ local u = unicodes[split[l]]
+ if not u then
+ done = false
+ break
+ elseif type(u) == "table" then
+ split[l] = u[1]
else
- as[l], split[l] = u, format("%04X%04X",u/1024+0xD800,u%1024+0xDC00)
+ split[l] = u
end
end
+ if done then
+ originals[index], tounicode[index], nl, unicode = split, tounicode16sequence(split), nl + 1, true
+ end
end
- split = concat(split)
- if split ~= "" then
- originals[index], tounicode[index] = as, split
- nl = nl + 1
- else
- originals[index], tounicode[index] = 0xFFFD, "FFFD"
+ end
+ -- last resort
+ if not unicode then
+ local foundcodes, multiple = uparser:match(name)
+ if foundcodes then
+ if multiple then
+ originals[index], tounicode[index], nl, unicode = foundcodes, tounicode16sequence(foundcodes), nl + 1, true
+ else
+ originals[index], tounicode[index], ns, unicode = foundcodes, tounicode16(foundcodes), ns + 1, foundcodes
+ end
end
end
+ if not unicode then
+ originals[index], tounicode[index] = 0xFFFD, "FFFD"
+ end
+ end
+ end
+ if trace_unimapping then
+ for index, glyph in table.sortedpairs(data.glyphs) do
+ local toun, name, unic = tounicode[index], glyph.name, glyph.unicode or -1 -- play safe
+ if toun then
+ logs.report("load otf","internal: 0x%05X, name: %s, unicode: 0x%05X, tounicode: %s",index,name,unic,toun)
+ else
+ logs.report("load otf","internal: 0x%05X, name: %s, unicode: 0x%05X",index,name,unic)
+ end
end
end
if trace_loading and (ns > 0 or nl > 0) then
@@ -546,16 +610,14 @@ otf.enhancers["analyse subtables"] = function(data,filename)
for _, g in next, { data.gsub, data.gpos } do
for k=1,#g do
local gk = g[k]
-
-local typ = gk.type
-if typ == "gsub_contextchain" or typ == "gpos_contextchain" then
- gk.chain = 1
-elseif typ == "gsub_reversecontextchain" or typ == "gpos_reversecontextchain" then
- gk.chain = -1
-else
- gk.chain = 0
-end
-
+ local typ = gk.type
+ if typ == "gsub_contextchain" or typ == "gpos_contextchain" then
+ gk.chain = 1
+ elseif typ == "gsub_reversecontextchain" or typ == "gpos_reversecontextchain" then
+ gk.chain = -1
+ else
+ gk.chain = 0
+ end
local features = gk.features
if features then
sequences[#sequences+1] = gk
@@ -610,8 +672,9 @@ otf.enhancers["merge cid fonts"] = function(data,filename)
local cidinfo = data.cidinfo
local verbose = fonts.verbose
if cidinfo.registry then
- local cidmap = fonts.cid.getmap and fonts.cid.getmap(cidinfo.registry,cidinfo.ordering,cidinfo.supplement)
+ local cidmap, cidname = fonts.cid.getmap(cidinfo.registry,cidinfo.ordering,cidinfo.supplement)
if cidmap then
+ cidinfo.usedname = cidmap.usedname
local glyphs, uni_to_int, int_to_uni, nofnames, nofunicodes = { }, { }, { }, 0, 0
local unicodes, names = cidmap.unicodes, cidmap.names
for n, subfont in next, data.subfonts do
@@ -1343,7 +1406,7 @@ function otf.copy_to_tfm(data,cache_id) -- we can save a copy when we reorder th
}
-- indices maps from unicodes to indices
for u, i in next, indices do
- characters[u] = { } -- we need this because for instance we add protruding info
+ characters[u] = { } -- we need this because for instance we add protruding info and loop over characters
descriptions[u] = glyphs[i]
end
-- math
diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua
index 719c0ca80..3c11b84f1 100644
--- a/tex/context/base/font-otn.lua
+++ b/tex/context/base/font-otn.lua
@@ -150,7 +150,7 @@ trackers.register("*otf.sample","otf.steps,otf.actions,otf.analyzing")
local insert_node_after = node.insert_after
local delete_node = nodes.delete
local copy_node = node.copy
-local slide_node_list = node.slide
+local find_node_tail = node.tail or node.slide
local set_attribute = node.set_attribute
local has_attribute = node.has_attribute
@@ -1905,7 +1905,7 @@ function fonts.methods.node.otf.features(head,font,attr)
local handler = handlers[typ]
local thecache = featuredata[typ] or { }
-- we need to get rid of this slide !
- start = slide_node_list(head) -- slow (we can store tail because there's always a skip at the end): todo
+ start = find_node_tail(head) -- slow (we can store tail because there's always a skip at the end): todo
while start do
local id = start.id
if id == glyph then
diff --git a/tex/context/base/font-run.mkii b/tex/context/base/font-run.mkii
new file mode 100644
index 000000000..0a0ddd057
--- /dev/null
+++ b/tex/context/base/font-run.mkii
@@ -0,0 +1,326 @@
+%D \module
+%D [ file=font-run,
+%D version=1998.09.11, % (second)
+%D version=2001.02.20, % (third)
+%D title=\CONTEXT\ Font Macros,
+%D subtitle=Runtime Macros,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D [This code is hooked into the core macros and saves some
+%D format space.]
+
+\unprotect
+
+\gdef\@@onlyenglish#1%
+ {\blank{\tttf \type {#1} is only available in the english interface}\blank}
+
+\gdef\dosetshowfonttitle#1%
+ {\tabskip\zeropoint
+ \parindent\zeropoint
+ \setlocalhsize
+ \doifelsenothing{#1}
+ {\def\title{[\the\bodyfontsize]}}
+ {\switchtobodyfont[#1]\def\title{[#1]}}
+ \doifsomething\fontclass
+ {\doifnot{[\fontclass]}\title
+ {\edef\title{[\fontclass]\space\title}}}}
+
+\gdef\showbodyfont
+ {\dosingleempty\doshowbodyfont}
+
+\gdef\doshowbodyfont[#1]%
+ {\ifinsidefloat\else\startbaselinecorrection\fi
+ \vbox
+ {\dosetshowfonttitle{#1}%
+ \def\bigstrut##1##2%
+ {\hbox{\vrule
+ \!!height##1\strutht
+ \!!depth ##2\strutdp
+ \!!width \zeropoint}}
+ \def\next##1##2##3%
+ {\tf##3\sc##3%
+ \sl##3\it##3\bf##3\bs##3\bi##3%
+ \tfx##3\tfxx##3%
+ \tfa##3\tfb##3\tfc##3\tfd##3&\cr}%
+ \halign to \localhsize
+ {\bigstrut{1.5}{2}##&\vrule##
+ \tabskip=\!!zeropoint \!!plus 1fill
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil#\vrule
+ \tabskip=\!!zeropoint\cr
+ \noalign{\hrule}
+ &\multispan{29}{\vrule\hfil\tttf\strut\title\hfil
+ \llap{\string\mr\hbox to 1em{\hss:\hss}$\mr \languageparameter\c!text$\quad}\vrule}\cr
+ \noalign{\hrule}\next{}{\tt\string}{}
+ \noalign{\hrule}\next{\tt\string\rm}\rm{\languageparameter\c!text}
+ \noalign{\hrule}\next{\tt\string\ss}\ss{\languageparameter\c!text}
+ \noalign{\hrule}\next{\tt\string\tt}\tt{\languageparameter\c!text}
+ \noalign{\hrule}}}
+ \ifinsidefloat\else\stopbaselinecorrection\fi}
+
+\gdef\showbodyfontenvironment
+ {\dosingleempty\doshowbodyfontenvironment}
+
+\gdef\doshowbodyfontenvironment[#1]%
+ {\ifinsidefloat\else\startbaselinecorrection\fi
+ \vbox
+ {\dosetshowfonttitle{#1}%
+ \def\next##1%
+ {&&\getvalue{\bodyfontvariable{##1\s!text}}%
+ &&\getvalue{\bodyfontvariable{##1\s!script}}%
+ &&\getvalue{\bodyfontvariable{##1\s!scriptscript}}%
+ &&\getvalue{\bodyfontvariable{##1\c!x}}%
+ &&\getvalue{\bodyfontvariable{##1\c!xx}}%
+ &&\getvalue{\bodyfontvariable{##1\interfaced\v!small}}%
+ &&\getvalue{\bodyfontvariable{##1\interfaced\v!big}}%
+ &&\edef\next{\getvalue{\bodyfontvariable{##1\c!interlinespace}}}\ifx\next\empty not set\else\next\fi&\cr
+ \noalign{\hrule}}
+ \halign to \localhsize
+ {##&\vrule##\strut
+ \tabskip=\!!zeropoint \!!plus 1fill
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil#\vrule
+ \tabskip\zeropoint\cr
+ \noalign{\hrule}
+ &\multispan{17}{\vrule\hfil\tttf\strut\title\hfil}\vrule\cr
+ \noalign{\hrule}
+ &&\tttf\tx\s!text&&\tttf\tx\s!script&&\tttf\tx\s!scriptscript
+ &&\tttf\tx\c!x&&\tttf\tx\c!xx&&\tttf\tx\v!small&&\tttf\tx\v!big
+ &&\tttf\tx\c!interlinespace&\cr
+ \noalign{\hrule}
+ \@EA\globalprocesscommalist\@EA[\bodyfontenvironmentlist]\next}}
+ \ifinsidefloat\else\stopbaselinecorrection\fi}
+
+\gdef\showfont
+ {\dodoubleempty\doshowfont}
+
+\gdef\doshowfont[#1][#2]%
+ {\bgroup
+ \boxrulewidth=.1pt
+ \setupcolors[\c!state=\v!local]%
+ \iffirstargument
+ \definefont[\s!dummy][#1]\dummy
+ \else\ifdim2.5em>.05\hsize \tx
+ \ifdim2.5em>.05\hsize \txx
+ \fi\fi\fi
+ \ifinsidefloat\else\startbaselinecorrection\fi
+ \vbox\bgroup
+ \forgetall
+ \startoverlay
+ {\vbox
+ {\tf \setstrut \dummy
+ \localcolortrue \offinterlineskip
+ \dostepwiserecurse{0}{15}{1}
+ {\let\row\recurselevel
+ \hbox
+ {\red
+ \dostepwiserecurse{0}{15}{1}
+ {\let\col\recurselevel
+ \@EA\scratchcounter\normaldblquote\hexnumber\row\hexnumber\col\relax
+ \edef\rowcol{\the\scratchcounter}%
+ \iffontchar\font\scratchcounter
+ \setbox\scratchbox\ruledhbox{\black\char\scratchcounter}%
+ \ifdim\wd\scratchbox>\zeropoint
+ \donetrue \else \donefalse
+ \fi
+ \else
+ \setbox\scratchbox\hbox{\gray\vrule\!!width1ex\!!height.5ex\!!depth.5ex}%
+ \fi
+ \startoverlay
+ {\tf\vbox to 2.5em
+ {\vss
+ \hbox to 2.5em
+ {\dummy\ifdim\interwordspace=\zeropoint
+ \setbox\scratchbox\hbox
+ {\raise.5\dp\scratchbox\hbox
+ {\lower.5\ht\scratchbox\copy\scratchbox}}%
+ \ht\scratchbox\zeropoint
+ \dp\scratchbox\zeropoint
+ \else
+ \ht\scratchbox\strutht
+ \dp\scratchbox\strutdp
+ \strut
+ \fi
+ \hss\copy\scratchbox\hss}
+ \vss}}
+ {\tf\vbox to 2.3em
+ {\ifdone
+ \hsize2.4em
+ \blue
+ \edef\theshowfontspecs
+ {\ifnum\hyphenchar\font=\rowcol hyph\else
+ \ifnum\skewchar \font=\rowcol skew\fi\fi}%
+ \tinyfont % after \edef, else wrong font analyzed
+ \doifnot\v!unknown{#2}{{\red\theshowfontspecs}}\hfill\number\rowcol
+ \vfill
+ \octnumber\rowcol\hfill\lchexnumbers\rowcol
+ \par
+ \fi}}
+ \stopoverlay}}}
+ \par}}
+ {\tf\basegrid[\c!nx=16,\c!ny=16,\c!dx=2.5,\c!dy=2.5,\c!unit=em]}
+ \stopoverlay
+ \nointerlineskip
+ \vskip2pt
+ % the \noexpand before \blank is needed for non etex
+ \edef\ascii{name: {\noexpand\black\fontname\font}}
+ \def\do##1##2{\ifx##1\undefined\else\ifx##1\empty\else##2\fi\fi}%
+ \doifelse\v!unknown{#2}
+ {\edef\theshowfontspecs
+ {name: {\noexpand\black\fontname\font}}}
+ {\edef\theshowfontspecs
+ {name: {\noexpand\black\fontname\font}\noexpand\quad
+ \do\currentencoding{encoding: {\noexpand\black\currentencoding\noexpand\quad}}%
+ \do\currentmapping {mapping: {\noexpand\black\currentmapping \noexpand\quad}}%
+ \do\fonthandling {handling: {\noexpand\black\fonthandling }}}}%
+ \tf % also sets em
+ \hbox to 40em{\blue\hfill\tinyfont\setstrut\strut\theshowfontspecs}
+ \egroup
+ \ifinsidefloat\else\stopbaselinecorrection\fi
+ \egroup}
+
+\gdef\showfontstyle
+ {\dotripleempty\doshowfontstyle}
+
+\gdef\doshowfontstyle[#1][#2][#3]%
+ {\ifthirdargument
+ \bgroup
+ \raggedright
+ \switchtobodyfont[#1]
+ \def\dodocommand##1##2%
+ {\starttextrule{\tttf #1 ##1 ##2}
+ \nobreak \getvalue{##2}%
+ \dorecurse{255}
+ {\iffontchar\font\recurselevel\relax
+ \char\recurselevel\relax\space
+ \fi}
+ \par \nobreak
+ \stoptextrule}
+ \def\docommand##1%
+ {\getvalue{##1}\processcommacommand[#3]{\dodocommand{##1}}}
+ \processcommalist[#2]\docommand
+ \egroup
+ \else\ifsecondargument
+ \showfontstyle[#1][#2][\fontalternativelist]% math is gone
+ \else
+ \showfontstyle[#1][\c!rm]\showfontstyle[#1][\c!ss]
+ \showfontstyle[#1][\c!tt]\showfontstyle[#1][\c!mm]
+ \fi\fi}
+
+\gdef\showligature#1%
+ {\hbox{\type{#1}\enspace\red\ruledhbox{\black#1}}}
+
+\gdef\showligatures[#1]%
+ {\ifx\starttabulate\undefined
+ \@@onlyenglish\showligatures
+ \else
+ \bgroup
+ \setupcolors[\c!state=\v!local]%
+ \def\show##1{\hbox{\red\ruledhbox{\black##1}}}%
+ \definefont[\s!dummy][#1]\dummy
+ \starttabulate[|*{9}{c|}]
+ \NC\type{ff}\NC\type{fi}\NC\type{fl}\NC\type{ffi}\NC\type{ffl}\NC
+ \type{``}\NC\type{''}\NC\type{--}\NC\type{---}\NC\NR
+ \NC\show{ff}\NC\show{fi}\NC\show{fl}\NC\show{ffi}\NC\show{ffl}\NC
+ \show{``}\NC\show{''}\NC\show{--}\NC\show{---}\NC\NR
+ \stoptabulate
+ \egroup
+ \fi}
+
+\gdef\showfontstrip
+ {\dosingleempty\doshowfontstrip}
+
+\gdef\doshowfontstrip[#1]%
+ {\ifx\starttabulate\undefined
+ \@@onlyenglish\showfontstrip
+ \else
+ \bgroup
+ \def\dofontstripa##1##2%
+ {\tttf\string##1}
+ \def\dofontstripb##1##2%
+ {\ruledhbox{\switchtobodyfont[#1]##1{##2}}}
+ \def\dofontstripc##1##2%
+ {\setbox\scratchbox\hbox{\switchtobodyfont[#1]##1{##2}}%
+ \tt\tfx\the\ht\scratchbox}%
+ \def\dofontstripd##1##2%
+ {\setbox\scratchbox\hbox{\switchtobodyfont[#1]##1{##2}}%
+ \tt\tfx\the\wd\scratchbox}%
+ \def\fontstrip##1##2##3%
+ {\NC##2\rm{##3}\NC
+ ##2\ss{##3}\NC
+ ##2\tt{##3}\NC
+ ##2\mathematics{##3}\NC
+ \tttf##1\NR}
+ \starttabulate[|c|c|c|c|c|]
+ \fontstrip\relax\dofontstripa\empty
+ \TB
+ \fontstrip\relax\dofontstripb{xxxx}
+ \fontstrip\relax\dofontstripb{12345}
+ \fontstrip\relax\dofontstripb{(Agw)}
+ \TB
+ \fontstrip{(x height)}\dofontstripc{x}
+ \fontstrip{(m width)}\dofontstripd{m}
+ \stoptabulate
+ \egroup
+ \fi}
+
+\ifx\databox\undefined \newbox\databox \fi
+
+\gdef\testminimalbaseline#1%
+ {\setbox\databox\ruledhbox{#1}%
+ \scratchdimen\ht\databox
+ \advance\scratchdimen\dp\databox
+ \scratchtoks{#1}%
+ \expanded
+ {\NC \ruledhbox{\the\scratchtoks}
+ \noexpand \NC ->
+ \noexpand \NC \the\scratchdimen
+ \noexpand \NC =
+ \noexpand \NC \the\ht\databox
+ \noexpand \NC +
+ \noexpand \NC \the\dp\databox
+ \noexpand \NC \ifdim\scratchdimen<\baselineskip <
+ \else\ifdim\scratchdimen=\baselineskip =
+ \else > \fi\fi
+ \noexpand \NC \the\baselineskip
+ \noexpand \NC (\ifdim\scratchdimen>\baselineskip not \fi ok)
+ \noexpand \NC \noexpand \NR }}
+
+\gdef\showminimalbaseline
+ {\ifx\starttabulate\undefined
+ \@@onlyenglish\showminimalbaseline
+ \else
+ \starttabulate[||T|T|T|T|T|T|T|T|T|]
+ \testminimalbaseline{\hbox to 1em{\hss\showstruts\strut\hss}}%
+ \testminimalbaseline{(/)}%
+ \testminimalbaseline{$\frac{1}{2}x^2_3$}
+ \stoptabulate
+ \fi}
+
+\gdef\showkerning#1%
+ {\bgroup
+ \let\MPfshowcommand\ruledhbox
+ \setMPtext\s!dummy{#1}%
+ \startMPcode draw textext(\MPstring\s!dummy);\stopMPcode
+ \egroup}
+
+\gdef\showcharratio
+ {\dowithnextboxcontent
+ {\switchtobodyfont[10pt]}%
+ {(\expanded{\withoutpt\the\nextboxht},%
+ \expanded{\withoutpt\the\nextboxdp})}%
+ \hbox}
+
+\protect \endinput
diff --git a/tex/context/base/font-run.mkiv b/tex/context/base/font-run.mkiv
new file mode 100644
index 000000000..5dd8d6086
--- /dev/null
+++ b/tex/context/base/font-run.mkiv
@@ -0,0 +1,326 @@
+%D \module
+%D [ file=font-run,
+%D version=1998.09.11, % (second)
+%D version=2001.02.20, % (third)
+%D title=\CONTEXT\ Font Macros,
+%D subtitle=Runtime Macros,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D [This code is hooked into the core macros and saves some
+%D format space.]
+
+\unprotect
+
+\gdef\@@onlyenglish#1%
+ {\blank{\tttf \type {#1} is only available in the english interface}\blank}
+
+\gdef\dosetshowfonttitle#1%
+ {\tabskip\zeropoint
+ \parindent\zeropoint
+ \setlocalhsize
+ \doifelsenothing{#1}
+ {\def\title{[\the\bodyfontsize]}}
+ {\switchtobodyfont[#1]\def\title{[#1]}}
+ \doifsomething\fontclass
+ {\doifnot{[\fontclass]}\title
+ {\edef\title{[\fontclass]\space\title}}}}
+
+\gdef\showbodyfont
+ {\dosingleempty\doshowbodyfont}
+
+\gdef\doshowbodyfont[#1]%
+ {\ifinsidefloat\else\startbaselinecorrection\fi
+ \vbox
+ {\dosetshowfonttitle{#1}%
+ \def\bigstrut##1##2%
+ {\hbox{\vrule
+ \!!height##1\strutht
+ \!!depth ##2\strutdp
+ \!!width \zeropoint}}
+ \def\next##1##2##3%
+ {\tf##3\sc##3%
+ \sl##3\it##3\bf##3\bs##3\bi##3%
+ \tfx##3\tfxx##3%
+ \tfa##3\tfb##3\tfc##3\tfd##3&\cr}%
+ \halign to \localhsize
+ {\bigstrut{1.5}{2}##&\vrule##
+ \tabskip=\!!zeropoint \!!plus 1fill
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil#\vrule
+ \tabskip=\!!zeropoint\cr
+ \noalign{\hrule}
+ &\multispan{29}{\vrule\hfil\tttf\strut\title\hfil
+ \llap{\string\mr\hbox to 1em{\hss:\hss}$\mr \languageparameter\c!text$\quad}\vrule}\cr
+ \noalign{\hrule}\next{}{\tt\string}{}
+ \noalign{\hrule}\next{\tt\string\rm}\rm{\languageparameter\c!text}
+ \noalign{\hrule}\next{\tt\string\ss}\ss{\languageparameter\c!text}
+ \noalign{\hrule}\next{\tt\string\tt}\tt{\languageparameter\c!text}
+ \noalign{\hrule}}}
+ \ifinsidefloat\else\stopbaselinecorrection\fi}
+
+\gdef\showbodyfontenvironment
+ {\dosingleempty\doshowbodyfontenvironment}
+
+\gdef\doshowbodyfontenvironment[#1]%
+ {\ifinsidefloat\else\startbaselinecorrection\fi
+ \vbox
+ {\dosetshowfonttitle{#1}%
+ \def\next##1%
+ {&&\getvalue{\bodyfontvariable{##1\s!text}}%
+ &&\getvalue{\bodyfontvariable{##1\s!script}}%
+ &&\getvalue{\bodyfontvariable{##1\s!scriptscript}}%
+ &&\getvalue{\bodyfontvariable{##1\c!x}}%
+ &&\getvalue{\bodyfontvariable{##1\c!xx}}%
+ &&\getvalue{\bodyfontvariable{##1\interfaced\v!small}}%
+ &&\getvalue{\bodyfontvariable{##1\interfaced\v!big}}%
+ &&\edef\next{\getvalue{\bodyfontvariable{##1\c!interlinespace}}}\ifx\next\empty not set\else\next\fi&\cr
+ \noalign{\hrule}}
+ \halign to \localhsize
+ {##&\vrule##\strut
+ \tabskip=\!!zeropoint \!!plus 1fill
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil#\vrule
+ \tabskip\zeropoint\cr
+ \noalign{\hrule}
+ &\multispan{17}{\vrule\hfil\tttf\strut\title\hfil}\vrule\cr
+ \noalign{\hrule}
+ &&\tttf\tx\s!text&&\tttf\tx\s!script&&\tttf\tx\s!scriptscript
+ &&\tttf\tx\c!x&&\tttf\tx\c!xx&&\tttf\tx\v!small&&\tttf\tx\v!big
+ &&\tttf\tx\c!interlinespace&\cr
+ \noalign{\hrule}
+ \@EA\globalprocesscommalist\@EA[\bodyfontenvironmentlist]\next}}
+ \ifinsidefloat\else\stopbaselinecorrection\fi}
+
+\gdef\showfont
+ {\dodoubleempty\doshowfont}
+
+\gdef\doshowfont[#1][#2]%
+ {\bgroup
+ \boxrulewidth=.1pt
+ \setupcolors[\c!state=\v!local]%
+ \iffirstargument
+ \definefont[\s!dummy][#1]\dummy
+ \else\ifdim2.5em>.05\hsize \tx
+ \ifdim2.5em>.05\hsize \txx
+ \fi\fi\fi
+ \ifinsidefloat\else\startbaselinecorrection\fi
+ \vbox\bgroup
+ \forgetall
+ \startoverlay
+ {\vbox
+ {\tf \setstrut \dummy
+ \offinterlineskip
+ \dostepwiserecurse{0}{15}{1}
+ {\let\row\recurselevel
+ \hbox
+ {\red
+ \dostepwiserecurse{0}{15}{1}
+ {\let\col\recurselevel
+ \@EA\scratchcounter\normaldblquote\hexnumber\row\hexnumber\col\relax
+ \edef\rowcol{\the\scratchcounter}%
+ \iffontchar\font\scratchcounter
+ \setbox\scratchbox\ruledhbox{\black\char\scratchcounter}%
+ \ifdim\wd\scratchbox>\zeropoint
+ \donetrue \else \donefalse
+ \fi
+ \else
+ \setbox\scratchbox\hbox{\gray\vrule\!!width1ex\!!height.5ex\!!depth.5ex}%
+ \fi
+ \startoverlay
+ {\tf\vbox to 2.5em
+ {\vss
+ \hbox to 2.5em
+ {\dummy\ifdim\interwordspace=\zeropoint
+ \setbox\scratchbox\hbox
+ {\raise.5\dp\scratchbox\hbox
+ {\lower.5\ht\scratchbox\copy\scratchbox}}%
+ \ht\scratchbox\zeropoint
+ \dp\scratchbox\zeropoint
+ \else
+ \ht\scratchbox\strutht
+ \dp\scratchbox\strutdp
+ \strut
+ \fi
+ \hss\copy\scratchbox\hss}
+ \vss}}
+ {\tf\vbox to 2.3em
+ {\ifdone
+ \hsize2.4em
+ \blue
+ \edef\theshowfontspecs
+ {\ifnum\hyphenchar\font=\rowcol hyph\else
+ \ifnum\skewchar \font=\rowcol skew\fi\fi}%
+ \tinyfont % after \edef, else wrong font analyzed
+ \doifnot\v!unknown{#2}{{\red\theshowfontspecs}}\hfill\number\rowcol
+ \vfill
+ \octnumber\rowcol\hfill\lchexnumbers\rowcol
+ \par
+ \fi}}
+ \stopoverlay}}}
+ \par}}
+ {\tf\basegrid[\c!nx=16,\c!ny=16,\c!dx=2.5,\c!dy=2.5,\c!unit=em]}
+ \stopoverlay
+ \nointerlineskip
+ \vskip2pt
+ % the \noexpand before \blank is needed for non etex
+ \edef\ascii{name: {\noexpand\black\fontname\font}}
+ \def\do##1##2{\ifx##1\undefined\else\ifx##1\empty\else##2\fi\fi}%
+ \doifelse\v!unknown{#2}
+ {\edef\theshowfontspecs
+ {name: {\noexpand\black\fontname\font}}}
+ {\edef\theshowfontspecs
+ {name: {\noexpand\black\fontname\font}\noexpand\quad
+ \do\currentencoding{encoding: {\noexpand\black\currentencoding\noexpand\quad}}%
+ \do\currentmapping {mapping: {\noexpand\black\currentmapping \noexpand\quad}}%
+ \do\fonthandling {handling: {\noexpand\black\fonthandling }}}}%
+ \tf % also sets em
+ \hbox to 40em{\blue\hfill\tinyfont\setstrut\strut\theshowfontspecs}
+ \egroup
+ \ifinsidefloat\else\stopbaselinecorrection\fi
+ \egroup}
+
+\gdef\showfontstyle
+ {\dotripleempty\doshowfontstyle}
+
+\gdef\doshowfontstyle[#1][#2][#3]%
+ {\ifthirdargument
+ \bgroup
+ \raggedright
+ \switchtobodyfont[#1]
+ \def\dodocommand##1##2%
+ {\starttextrule{\tttf #1 ##1 ##2}
+ \nobreak \getvalue{##2}%
+ \dorecurse{255}
+ {\iffontchar\font\recurselevel\relax
+ \char\recurselevel\relax\space
+ \fi}
+ \par \nobreak
+ \stoptextrule}
+ \def\docommand##1%
+ {\getvalue{##1}\processcommacommand[#3]{\dodocommand{##1}}}
+ \processcommalist[#2]\docommand
+ \egroup
+ \else\ifsecondargument
+ \showfontstyle[#1][#2][\fontalternativelist]% math is gone
+ \else
+ \showfontstyle[#1][\c!rm]\showfontstyle[#1][\c!ss]
+ \showfontstyle[#1][\c!tt]\showfontstyle[#1][\c!mm]
+ \fi\fi}
+
+\gdef\showligature#1%
+ {\hbox{\type{#1}\enspace\red\ruledhbox{\black#1}}}
+
+\gdef\showligatures[#1]%
+ {\ifx\starttabulate\undefined
+ \@@onlyenglish\showligatures
+ \else
+ \bgroup
+ \setupcolors[\c!state=\v!local]%
+ \def\show##1{\hbox{\red\ruledhbox{\black##1}}}%
+ \definefont[\s!dummy][#1]\dummy
+ \starttabulate[|*{9}{c|}]
+ \NC\type{ff}\NC\type{fi}\NC\type{fl}\NC\type{ffi}\NC\type{ffl}\NC
+ \type{``}\NC\type{''}\NC\type{--}\NC\type{---}\NC\NR
+ \NC\show{ff}\NC\show{fi}\NC\show{fl}\NC\show{ffi}\NC\show{ffl}\NC
+ \show{``}\NC\show{''}\NC\show{--}\NC\show{---}\NC\NR
+ \stoptabulate
+ \egroup
+ \fi}
+
+\gdef\showfontstrip
+ {\dosingleempty\doshowfontstrip}
+
+\gdef\doshowfontstrip[#1]%
+ {\ifx\starttabulate\undefined
+ \@@onlyenglish\showfontstrip
+ \else
+ \bgroup
+ \def\dofontstripa##1##2%
+ {\tttf\string##1}
+ \def\dofontstripb##1##2%
+ {\ruledhbox{\switchtobodyfont[#1]##1{##2}}}
+ \def\dofontstripc##1##2%
+ {\setbox\scratchbox\hbox{\switchtobodyfont[#1]##1{##2}}%
+ \tt\tfx\the\ht\scratchbox}%
+ \def\dofontstripd##1##2%
+ {\setbox\scratchbox\hbox{\switchtobodyfont[#1]##1{##2}}%
+ \tt\tfx\the\wd\scratchbox}%
+ \def\fontstrip##1##2##3%
+ {\NC##2\rm{##3}\NC
+ ##2\ss{##3}\NC
+ ##2\tt{##3}\NC
+ ##2\mathematics{##3}\NC
+ \tttf##1\NR}
+ \starttabulate[|c|c|c|c|c|]
+ \fontstrip\relax\dofontstripa\empty
+ \TB
+ \fontstrip\relax\dofontstripb{xxxx}
+ \fontstrip\relax\dofontstripb{12345}
+ \fontstrip\relax\dofontstripb{(Agw)}
+ \TB
+ \fontstrip{(x height)}\dofontstripc{x}
+ \fontstrip{(m width)}\dofontstripd{m}
+ \stoptabulate
+ \egroup
+ \fi}
+
+\ifx\databox\undefined \newbox\databox \fi
+
+\gdef\testminimalbaseline#1%
+ {\setbox\databox\ruledhbox{#1}%
+ \scratchdimen\ht\databox
+ \advance\scratchdimen\dp\databox
+ \scratchtoks{#1}%
+ \expanded
+ {\NC \ruledhbox{\the\scratchtoks}
+ \noexpand \NC ->
+ \noexpand \NC \the\scratchdimen
+ \noexpand \NC =
+ \noexpand \NC \the\ht\databox
+ \noexpand \NC +
+ \noexpand \NC \the\dp\databox
+ \noexpand \NC \ifdim\scratchdimen<\baselineskip <
+ \else\ifdim\scratchdimen=\baselineskip =
+ \else > \fi\fi
+ \noexpand \NC \the\baselineskip
+ \noexpand \NC (\ifdim\scratchdimen>\baselineskip not \fi ok)
+ \noexpand \NC \noexpand \NR }}
+
+\gdef\showminimalbaseline
+ {\ifx\starttabulate\undefined
+ \@@onlyenglish\showminimalbaseline
+ \else
+ \starttabulate[||T|T|T|T|T|T|T|T|T|]
+ \testminimalbaseline{\hbox to 1em{\hss\showstruts\strut\hss}}%
+ \testminimalbaseline{(/)}%
+ \testminimalbaseline{$\frac{1}{2}x^2_3$}
+ \stoptabulate
+ \fi}
+
+\gdef\showkerning#1%
+ {\bgroup
+ \let\MPfshowcommand\ruledhbox
+ \setMPtext\s!dummy{#1}%
+ \startMPcode draw textext(\MPstring\s!dummy);\stopMPcode
+ \egroup}
+
+\gdef\showcharratio
+ {\dowithnextboxcontent
+ {\switchtobodyfont[10pt]}%
+ {(\expanded{\withoutpt\the\nextboxht},%
+ \expanded{\withoutpt\the\nextboxdp})}%
+ \hbox}
+
+\protect \endinput
diff --git a/tex/context/base/font-run.tex b/tex/context/base/font-run.tex
deleted file mode 100644
index 0a0ddd057..000000000
--- a/tex/context/base/font-run.tex
+++ /dev/null
@@ -1,326 +0,0 @@
-%D \module
-%D [ file=font-run,
-%D version=1998.09.11, % (second)
-%D version=2001.02.20, % (third)
-%D title=\CONTEXT\ Font Macros,
-%D subtitle=Runtime Macros,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D [This code is hooked into the core macros and saves some
-%D format space.]
-
-\unprotect
-
-\gdef\@@onlyenglish#1%
- {\blank{\tttf \type {#1} is only available in the english interface}\blank}
-
-\gdef\dosetshowfonttitle#1%
- {\tabskip\zeropoint
- \parindent\zeropoint
- \setlocalhsize
- \doifelsenothing{#1}
- {\def\title{[\the\bodyfontsize]}}
- {\switchtobodyfont[#1]\def\title{[#1]}}
- \doifsomething\fontclass
- {\doifnot{[\fontclass]}\title
- {\edef\title{[\fontclass]\space\title}}}}
-
-\gdef\showbodyfont
- {\dosingleempty\doshowbodyfont}
-
-\gdef\doshowbodyfont[#1]%
- {\ifinsidefloat\else\startbaselinecorrection\fi
- \vbox
- {\dosetshowfonttitle{#1}%
- \def\bigstrut##1##2%
- {\hbox{\vrule
- \!!height##1\strutht
- \!!depth ##2\strutdp
- \!!width \zeropoint}}
- \def\next##1##2##3%
- {\tf##3\sc##3%
- \sl##3\it##3\bf##3\bs##3\bi##3%
- \tfx##3\tfxx##3%
- \tfa##3\tfb##3\tfc##3\tfd##3&\cr}%
- \halign to \localhsize
- {\bigstrut{1.5}{2}##&\vrule##
- \tabskip=\!!zeropoint \!!plus 1fill
- &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
- &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
- &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
- &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
- &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
- &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
- &\hfil##\hfil&\vrule##&\hfil##\hfil#\vrule
- \tabskip=\!!zeropoint\cr
- \noalign{\hrule}
- &\multispan{29}{\vrule\hfil\tttf\strut\title\hfil
- \llap{\string\mr\hbox to 1em{\hss:\hss}$\mr \languageparameter\c!text$\quad}\vrule}\cr
- \noalign{\hrule}\next{}{\tt\string}{}
- \noalign{\hrule}\next{\tt\string\rm}\rm{\languageparameter\c!text}
- \noalign{\hrule}\next{\tt\string\ss}\ss{\languageparameter\c!text}
- \noalign{\hrule}\next{\tt\string\tt}\tt{\languageparameter\c!text}
- \noalign{\hrule}}}
- \ifinsidefloat\else\stopbaselinecorrection\fi}
-
-\gdef\showbodyfontenvironment
- {\dosingleempty\doshowbodyfontenvironment}
-
-\gdef\doshowbodyfontenvironment[#1]%
- {\ifinsidefloat\else\startbaselinecorrection\fi
- \vbox
- {\dosetshowfonttitle{#1}%
- \def\next##1%
- {&&\getvalue{\bodyfontvariable{##1\s!text}}%
- &&\getvalue{\bodyfontvariable{##1\s!script}}%
- &&\getvalue{\bodyfontvariable{##1\s!scriptscript}}%
- &&\getvalue{\bodyfontvariable{##1\c!x}}%
- &&\getvalue{\bodyfontvariable{##1\c!xx}}%
- &&\getvalue{\bodyfontvariable{##1\interfaced\v!small}}%
- &&\getvalue{\bodyfontvariable{##1\interfaced\v!big}}%
- &&\edef\next{\getvalue{\bodyfontvariable{##1\c!interlinespace}}}\ifx\next\empty not set\else\next\fi&\cr
- \noalign{\hrule}}
- \halign to \localhsize
- {##&\vrule##\strut
- \tabskip=\!!zeropoint \!!plus 1fill
- &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
- &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
- &\hfil##\hfil&\vrule##&\hfil##\hfil#\vrule
- \tabskip\zeropoint\cr
- \noalign{\hrule}
- &\multispan{17}{\vrule\hfil\tttf\strut\title\hfil}\vrule\cr
- \noalign{\hrule}
- &&\tttf\tx\s!text&&\tttf\tx\s!script&&\tttf\tx\s!scriptscript
- &&\tttf\tx\c!x&&\tttf\tx\c!xx&&\tttf\tx\v!small&&\tttf\tx\v!big
- &&\tttf\tx\c!interlinespace&\cr
- \noalign{\hrule}
- \@EA\globalprocesscommalist\@EA[\bodyfontenvironmentlist]\next}}
- \ifinsidefloat\else\stopbaselinecorrection\fi}
-
-\gdef\showfont
- {\dodoubleempty\doshowfont}
-
-\gdef\doshowfont[#1][#2]%
- {\bgroup
- \boxrulewidth=.1pt
- \setupcolors[\c!state=\v!local]%
- \iffirstargument
- \definefont[\s!dummy][#1]\dummy
- \else\ifdim2.5em>.05\hsize \tx
- \ifdim2.5em>.05\hsize \txx
- \fi\fi\fi
- \ifinsidefloat\else\startbaselinecorrection\fi
- \vbox\bgroup
- \forgetall
- \startoverlay
- {\vbox
- {\tf \setstrut \dummy
- \localcolortrue \offinterlineskip
- \dostepwiserecurse{0}{15}{1}
- {\let\row\recurselevel
- \hbox
- {\red
- \dostepwiserecurse{0}{15}{1}
- {\let\col\recurselevel
- \@EA\scratchcounter\normaldblquote\hexnumber\row\hexnumber\col\relax
- \edef\rowcol{\the\scratchcounter}%
- \iffontchar\font\scratchcounter
- \setbox\scratchbox\ruledhbox{\black\char\scratchcounter}%
- \ifdim\wd\scratchbox>\zeropoint
- \donetrue \else \donefalse
- \fi
- \else
- \setbox\scratchbox\hbox{\gray\vrule\!!width1ex\!!height.5ex\!!depth.5ex}%
- \fi
- \startoverlay
- {\tf\vbox to 2.5em
- {\vss
- \hbox to 2.5em
- {\dummy\ifdim\interwordspace=\zeropoint
- \setbox\scratchbox\hbox
- {\raise.5\dp\scratchbox\hbox
- {\lower.5\ht\scratchbox\copy\scratchbox}}%
- \ht\scratchbox\zeropoint
- \dp\scratchbox\zeropoint
- \else
- \ht\scratchbox\strutht
- \dp\scratchbox\strutdp
- \strut
- \fi
- \hss\copy\scratchbox\hss}
- \vss}}
- {\tf\vbox to 2.3em
- {\ifdone
- \hsize2.4em
- \blue
- \edef\theshowfontspecs
- {\ifnum\hyphenchar\font=\rowcol hyph\else
- \ifnum\skewchar \font=\rowcol skew\fi\fi}%
- \tinyfont % after \edef, else wrong font analyzed
- \doifnot\v!unknown{#2}{{\red\theshowfontspecs}}\hfill\number\rowcol
- \vfill
- \octnumber\rowcol\hfill\lchexnumbers\rowcol
- \par
- \fi}}
- \stopoverlay}}}
- \par}}
- {\tf\basegrid[\c!nx=16,\c!ny=16,\c!dx=2.5,\c!dy=2.5,\c!unit=em]}
- \stopoverlay
- \nointerlineskip
- \vskip2pt
- % the \noexpand before \blank is needed for non etex
- \edef\ascii{name: {\noexpand\black\fontname\font}}
- \def\do##1##2{\ifx##1\undefined\else\ifx##1\empty\else##2\fi\fi}%
- \doifelse\v!unknown{#2}
- {\edef\theshowfontspecs
- {name: {\noexpand\black\fontname\font}}}
- {\edef\theshowfontspecs
- {name: {\noexpand\black\fontname\font}\noexpand\quad
- \do\currentencoding{encoding: {\noexpand\black\currentencoding\noexpand\quad}}%
- \do\currentmapping {mapping: {\noexpand\black\currentmapping \noexpand\quad}}%
- \do\fonthandling {handling: {\noexpand\black\fonthandling }}}}%
- \tf % also sets em
- \hbox to 40em{\blue\hfill\tinyfont\setstrut\strut\theshowfontspecs}
- \egroup
- \ifinsidefloat\else\stopbaselinecorrection\fi
- \egroup}
-
-\gdef\showfontstyle
- {\dotripleempty\doshowfontstyle}
-
-\gdef\doshowfontstyle[#1][#2][#3]%
- {\ifthirdargument
- \bgroup
- \raggedright
- \switchtobodyfont[#1]
- \def\dodocommand##1##2%
- {\starttextrule{\tttf #1 ##1 ##2}
- \nobreak \getvalue{##2}%
- \dorecurse{255}
- {\iffontchar\font\recurselevel\relax
- \char\recurselevel\relax\space
- \fi}
- \par \nobreak
- \stoptextrule}
- \def\docommand##1%
- {\getvalue{##1}\processcommacommand[#3]{\dodocommand{##1}}}
- \processcommalist[#2]\docommand
- \egroup
- \else\ifsecondargument
- \showfontstyle[#1][#2][\fontalternativelist]% math is gone
- \else
- \showfontstyle[#1][\c!rm]\showfontstyle[#1][\c!ss]
- \showfontstyle[#1][\c!tt]\showfontstyle[#1][\c!mm]
- \fi\fi}
-
-\gdef\showligature#1%
- {\hbox{\type{#1}\enspace\red\ruledhbox{\black#1}}}
-
-\gdef\showligatures[#1]%
- {\ifx\starttabulate\undefined
- \@@onlyenglish\showligatures
- \else
- \bgroup
- \setupcolors[\c!state=\v!local]%
- \def\show##1{\hbox{\red\ruledhbox{\black##1}}}%
- \definefont[\s!dummy][#1]\dummy
- \starttabulate[|*{9}{c|}]
- \NC\type{ff}\NC\type{fi}\NC\type{fl}\NC\type{ffi}\NC\type{ffl}\NC
- \type{``}\NC\type{''}\NC\type{--}\NC\type{---}\NC\NR
- \NC\show{ff}\NC\show{fi}\NC\show{fl}\NC\show{ffi}\NC\show{ffl}\NC
- \show{``}\NC\show{''}\NC\show{--}\NC\show{---}\NC\NR
- \stoptabulate
- \egroup
- \fi}
-
-\gdef\showfontstrip
- {\dosingleempty\doshowfontstrip}
-
-\gdef\doshowfontstrip[#1]%
- {\ifx\starttabulate\undefined
- \@@onlyenglish\showfontstrip
- \else
- \bgroup
- \def\dofontstripa##1##2%
- {\tttf\string##1}
- \def\dofontstripb##1##2%
- {\ruledhbox{\switchtobodyfont[#1]##1{##2}}}
- \def\dofontstripc##1##2%
- {\setbox\scratchbox\hbox{\switchtobodyfont[#1]##1{##2}}%
- \tt\tfx\the\ht\scratchbox}%
- \def\dofontstripd##1##2%
- {\setbox\scratchbox\hbox{\switchtobodyfont[#1]##1{##2}}%
- \tt\tfx\the\wd\scratchbox}%
- \def\fontstrip##1##2##3%
- {\NC##2\rm{##3}\NC
- ##2\ss{##3}\NC
- ##2\tt{##3}\NC
- ##2\mathematics{##3}\NC
- \tttf##1\NR}
- \starttabulate[|c|c|c|c|c|]
- \fontstrip\relax\dofontstripa\empty
- \TB
- \fontstrip\relax\dofontstripb{xxxx}
- \fontstrip\relax\dofontstripb{12345}
- \fontstrip\relax\dofontstripb{(Agw)}
- \TB
- \fontstrip{(x height)}\dofontstripc{x}
- \fontstrip{(m width)}\dofontstripd{m}
- \stoptabulate
- \egroup
- \fi}
-
-\ifx\databox\undefined \newbox\databox \fi
-
-\gdef\testminimalbaseline#1%
- {\setbox\databox\ruledhbox{#1}%
- \scratchdimen\ht\databox
- \advance\scratchdimen\dp\databox
- \scratchtoks{#1}%
- \expanded
- {\NC \ruledhbox{\the\scratchtoks}
- \noexpand \NC ->
- \noexpand \NC \the\scratchdimen
- \noexpand \NC =
- \noexpand \NC \the\ht\databox
- \noexpand \NC +
- \noexpand \NC \the\dp\databox
- \noexpand \NC \ifdim\scratchdimen<\baselineskip <
- \else\ifdim\scratchdimen=\baselineskip =
- \else > \fi\fi
- \noexpand \NC \the\baselineskip
- \noexpand \NC (\ifdim\scratchdimen>\baselineskip not \fi ok)
- \noexpand \NC \noexpand \NR }}
-
-\gdef\showminimalbaseline
- {\ifx\starttabulate\undefined
- \@@onlyenglish\showminimalbaseline
- \else
- \starttabulate[||T|T|T|T|T|T|T|T|T|]
- \testminimalbaseline{\hbox to 1em{\hss\showstruts\strut\hss}}%
- \testminimalbaseline{(/)}%
- \testminimalbaseline{$\frac{1}{2}x^2_3$}
- \stoptabulate
- \fi}
-
-\gdef\showkerning#1%
- {\bgroup
- \let\MPfshowcommand\ruledhbox
- \setMPtext\s!dummy{#1}%
- \startMPcode draw textext(\MPstring\s!dummy);\stopMPcode
- \egroup}
-
-\gdef\showcharratio
- {\dowithnextboxcontent
- {\switchtobodyfont[10pt]}%
- {(\expanded{\withoutpt\the\nextboxht},%
- \expanded{\withoutpt\the\nextboxdp})}%
- \hbox}
-
-\protect \endinput
diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua
index 472f69c8c..8b799df5a 100644
--- a/tex/context/base/font-tfm.lua
+++ b/tex/context/base/font-tfm.lua
@@ -245,7 +245,7 @@ function tfm.do_scale(tfmtable, scaledpoints)
end
-- status
local isvirtual = tfmtable.type == "virtual" or tfmtable.virtualized
- local hasmath = tfmtable.math_parameters ~= nil or tfmtable.MathConstants ~= nil
+ local hasmath = (tfmtable.math_parameters ~= nil and next(tfmtable.math_parameters) ~= nil) or (tfmtable.MathConstants ~= nil and next(tfmtable.MathConstants) ~= nil)
local nodemode = tfmtable.mode == "node"
local hasquality = tfmtable.auto_expand or tfmtable.auto_protrude
local hasitalic = tfmtable.has_italic
@@ -293,6 +293,7 @@ function tfm.do_scale(tfmtable, scaledpoints)
local scaledheight = defaultheight * delta
local scaleddepth = defaultdepth * delta
local stackmath = tfmtable.ignore_stack_math ~= true
+local private = fonts.private
for k,v in next, characters do
local chr, description, index
if ischanged then
@@ -355,7 +356,7 @@ function tfm.do_scale(tfmtable, scaledpoints)
-- logs.report("define font","t=%s, u=%s, i=%s, n=%s c=%s",k,chr.tounicode or k,description.index,description.name or '-',description.class or '-')
-- end
if tounicode then
- local tu = tounicode[index]
+ local tu = tounicode[index] -- nb: index!
if tu then
chr.tounicode = tu
end
@@ -528,6 +529,7 @@ function tfm.do_scale(tfmtable, scaledpoints)
end
-- needed for \high cum suis
local tpx = tp.x_height
+if hasmath then
if not tp[13] then tp[13] = .86*tpx end -- mathsupdisplay
if not tp[14] then tp[14] = .86*tpx end -- mathsupnormal
if not tp[15] then tp[15] = .86*tpx end -- mathsupcramped
@@ -535,11 +537,22 @@ function tfm.do_scale(tfmtable, scaledpoints)
if not tp[17] then tp[17] = .48*tpx end -- mathsubcombined
if not tp[22] then tp[22] = 0 end -- mathaxisheight
if t.MathConstants then t.MathConstants.AccentBaseHeight = nil end -- safeguard
+end
t.tounicode = 1
t.cidinfo = tfmtable.cidinfo
-- we have t.name=metricfile and t.fullname=RealName and t.filename=diskfilename
-- when collapsing fonts, luatex looks as both t.name and t.fullname as ttc files
-- can have multiple subfonts
+ if hasmath then
+ if trace_defining then
+ logs.report("define font","math enabled for: %s %s %s",t.name or "noname",t.fullname or "nofullname",t.filename or "nofilename")
+ end
+ else
+ if trace_defining then
+ logs.report("define font","math disabled for: %s %s %s",t.name or "noname",t.fullname or "nofullname",t.filename or "nofilename")
+ end
+ t.nomath, t.MathConstants = true, nil
+ end
return t, delta
end
@@ -714,7 +727,7 @@ function tfm.set_features(tfmdata)
local value = features[f]
if value and fi.tfm[f] then -- brr
if tfm.trace_features then
- logs.report("define tfm","initializing feature %s to %s for mode %s for font %s",f,tostring(value),mode or 'unknown',tfmdata.name or 'unknown')
+ logs.report("define font","initializing feature %s to %s for mode %s for font %s",f,tostring(value),mode or 'unknown',tfmdata.name or 'unknown')
end
fi.tfm[f](tfmdata,value)
mode = tfmdata.mode or fonts.mode
diff --git a/tex/context/base/font-uni.mkii b/tex/context/base/font-uni.mkii
index 1b8ce8e43..02ab6ce2c 100644
--- a/tex/context/base/font-uni.mkii
+++ b/tex/context/base/font-uni.mkii
@@ -19,7 +19,7 @@
\ifnum\texengine=\xetexengine
\unexpanded\def\uchar#1#2{\char\numexpr#2+#1*\pluscclvi\relax}
\let\uc\uchar
- \endinput
+ \expandafter \endinput
\fi
%D Now comes the more traditional 8 bit \TEX\ hackery.
diff --git a/tex/context/base/font-xtx.mkii b/tex/context/base/font-xtx.mkii
new file mode 100644
index 000000000..5f4b85879
--- /dev/null
+++ b/tex/context/base/font-xtx.mkii
@@ -0,0 +1,357 @@
+%D \module
+%D [ file=font-xtx,
+%D version=2004.09.11,
+%D title=\CONTEXT\ Font Macros,
+%D subtitle=\XETEX\ Hacks,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=\PRAGMA]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\ifnum\texengine=\xetexengine
+ \writestatus{loading}{ConTeXt Font Macros / XeTeX Hacks}
+\else
+ \endinput
+\fi
+
+\unprotect
+
+%D Loading:
+
+%D for some reason xetex does not support [filename] for tfm files and
+%D quotes also behave kind of strange " vs ' vs [ vs ...
+%D
+%D \starttyping
+%D \font\myfont = msam7 % ok
+%D \font\myfont = "msam7" % also ok
+%D \font\myfont = "msam7" at 8pt % error
+%D \stoptyping
+
+\newconditional\tracexetexfonts
+
+%D Because \XETEX\ is not that fast on locating fonts we cache lookups so
+%D that we minimize the test. It saves a little bit of runtime, depending
+%D on the number of fonts loaded (which is normally not that much).
+
+\def\doiffoundXTXfontelse#1#2%
+ {\ifcsname xtx@fnt@#2\somefontspec\endcsname
+ \ifconditional\tracexetexfonts
+ \writestatus\m!fonts{already checked #1: #2\somefontspec\space (state: \number\csname xtx@fnt@#2\somefontspec\endcsname)}%
+ \fi
+ \else
+ \suppressfontnotfounderror\plusone
+ \font\xetextempfont=#2\somefontspec\relax
+ \suppressfontnotfounderror\zerocount
+ \edef\xetextempfont{\fontname\xetextempfont}%
+ \global\expandafter\chardef\csname xtx@fnt@#2\somefontspec\endcsname
+ \ifx\xetextempfont\nullfontname
+ \zerocount \ifconditional\tracexetexfonts
+ \writestatus\m!fonts{not found #1: #2\somefontspec}%
+ \fi
+ \else
+ \plusone \ifconditional\tracexetexfonts
+ \writestatus\m!fonts{found #1: #2\somefontspec}%
+ \fi
+ \fi
+ \fi
+ \ifcase\csname xtx@fnt@#2\somefontspec\endcsname
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
+
+\def\docheckfontfilenameprefix#1:#2:#3#4\relax
+ {\edef\!!stringa{#1}%
+ \edef\!!stringb{#2}%
+ \ifx\!!stringb\empty
+ % no prefix
+ \let\checkedfontfile\!!stringa
+ \doiffoundXTXfontelse{1a}{\checkedfontfile\checkedfontfeatures}
+ {\edef\checkedfontfile{\checkedfontfile\checkedfontfeatures}}
+ {\doiffoundXTXfontelse{1b}{"\checkedfontfile\checkedfontfeatures"}
+ {\edef\checkedfontfile{"\checkedfontfile\checkedfontfeatures"}}
+ {\doiffoundXTXfontelse{1c}{"[\checkedfontfile]\checkedfontfeatures"}
+ {\edef\checkedfontfile{"[\checkedfontfile]\checkedfontfeatures"}}
+ {}}}%
+ \else\ifx\!!stringa\v!file
+ % force file, only file check when no spaces
+ \let\checkedfontfile\!!stringb
+ \doiffoundXTXfontelse{2a}{"[\checkedfontfile]\checkedfontfeatures"}
+ {\edef\checkedfontfile{"[\checkedfontfile]\checkedfontfeatures"}}
+ {\doiffoundXTXfontelse{2b}{"\checkedfontfile\checkedfontfeatures"}
+ {\edef\checkedfontfile{"\checkedfontfile\checkedfontfeatures"}}
+ {}}%
+ \else\ifx\!!stringa\v!name
+ % force name, always lookup by xetex itself, "" forces otf/ttf/type1
+ \edef\checkedfontfile{"\!!stringb\checkedfontfeatures"}%
+ \ifconditional\tracexetexfonts
+ \writestatus\m!fonts{no checking 3a: \checkedfontfile}%
+ \fi
+ \else
+ % whatever, maybe even xetex spec, forget about features
+ \edef\checkedfontfile{"\!!stringa\!!stringb"}%
+ \ifconditional\tracexetexfonts
+ \writestatus\m!fonts{no checking 3b: \checkedfontfile}%
+ \fi
+ \fi\fi\fi}
+
+\def\checkfontfilename% -- todo: integrate so that we call do.. directly
+ {\expandafter\docheckfontfilename\fontfile*\empty*\relax}
+
+\def\docheckfontfilename#1*#2#3*#4\relax % class overrules file
+ {\edef\checkedfontfeatures
+ {\expandafter\ifx\csname\fontclass\s!features\endcsname\empty
+ \ifx\@@fontfeatures\empty\ifx#2\empty\else#2#3\fi\else\@@fontfeatures\fi
+ \else\expandafter\ifx\csname\fontclass\s!features\endcsname\relax % redundant, will go away
+ \ifx\@@fontfeatures\empty\ifx#2\empty\else#2#3\fi\else\@@fontfeatures\fi
+ \else
+ \csname\fontclass\s!features\endcsname
+ \fi\fi}%
+ \ifx\checkedfontfeatures\empty
+ % done
+ \else
+ \edef\checkedfontfeatures{\executeifdefined{\??fa\checkedfontfeatures}\empty}%
+ \ifx\checkedfontfeatures\empty
+ % done
+ \else
+ \let\convertedfontfeatures\empty
+ \processcommacommand[\checkedfontfeatures]\doconvertfontfeatures % raw
+ \ifx\convertedfontfeatures\empty
+ \let\checkedfontfeatures\empty
+ \else
+ \edef\checkedfontfeatures{:\convertedfontfeatures}%
+ \fi
+ \fi
+ \fi
+ \docheckfontfilenameprefix#1:\empty:\empty\relax
+ \doshowcheckedfontfeatures}
+
+\def\dodoconvertfontfeatures#1=#2#3=#4\relax
+ {\ifx#2\empty
+ % invalid feature
+ \else\ifcsname @xtx@#1@#2#3\endcsname
+ \expandafter\ifx\csname @xtx@#1@#2#3\endcsname\empty\else
+ \edef\convertedfontfeatures{\convertedfontfeatures\csname @xtx@#1@#2#3\endcsname;}%
+ \fi
+ \else
+ \edef\!!stringa{#1}%
+ \edef\!!stringb{#2#3}%
+ \edef\convertedfontfeatures
+ {\convertedfontfeatures
+ \ifx\!!stringb\v!yes
+ +\!!stringa
+ \else\ifx\!!stringb\v!no
+ -\!!stringa
+ \else
+ \!!stringa=\!!stringb
+ \fi\fi;}%
+ \fi\fi}
+
+\def\doconvertfontfeatures#1%
+ {\dodoconvertfontfeatures#1=\empty=\relax}
+
+\def\remapfontfeature #1 #2 #3 {\setevalue{@xtx@#1@#2}{#3}}
+
+% this may move to another file, maybe font-xtx
+
+\remapfontfeature tlig yes mapping=tlig
+%remapfontfeature tlig no mapping=
+\remapfontfeature trep yes {}
+\remapfontfeature trep no {}
+\remapfontfeature texligatures yes mapping=tlig
+%remapfontfeature texligatures no mapping=
+%remapfontfeature texquotes yes mapping=tex-text
+%remapfontfeature texquotes no mapping=
+
+%D Variants:
+
+\unexpanded\def\variant[#1]%
+ {\dosetscaledfont
+ \font\variantfont\truefontname{\fontstringA\fontstylesuffix\fontvariant\fontstringA{#1}} at \scaledfont
+ \variantfont}
+
+%D Possible optimizations:
+
+% \def\updatefontparameters
+% {\edef\@@fontfeatures{\truefontdata\fontfile\s!features}%
+% \edef\@@fontskewchar{\truefontdata\fontfile\s!skewchar}}
+
+% \def\setfontcharacteristics
+% {\updatefontparameters % redundant, will go away, faster too
+% \the\everyfont}
+
+% \let\synchronizepatternswithfont\relax
+
+%D Names:
+
+% We need to move the feature into the filename else it may be
+% overloaded by another reference. For instance the definition of
+% a regular and caps variant can use the same font.
+
+% We could use an indirect method ... store in 'array' and refer to
+% slot.
+
+\def\definefontsynonym[#1]#2[#3]%
+ {\edef\@@fontname{#1}%
+ \edef\@@fontfile{#3}%
+ \doifnextoptionalelse\dodefinefontsynonym\nodefinefontsynonym}
+
+\def\nodefinefontsynonym
+ {\@EA\let\csname\??ff\fontclass\@@fontname\endcsname\@@fontfile}
+
+\def\dodefinefontsynonym[#1]%
+ {\edef\@@fontdata{#1}%
+ \ifx\@@fontdata\empty
+ \nodefinefontsynonym
+ \else
+ \ifx\fontclass\empty
+ \getfontparameters
+ \else
+ \getglobalfontparameters
+ \fi
+ \ifcsname\??ff\@@fontfile\s!features\endcsname
+ \@EA\edef\csname\??ff\fontclass\@@fontname\endcsname{\@@fontfile*\csname\??ff\@@fontfile\s!features\endcsname}%
+ \@EA\let\csname\??ff\@@fontfile\s!features\endcsname\undefined
+ \else
+ \nodefinefontsynonym
+ \fi
+ \fi}
+
+\let\definefontfile\definefontsynonym % dedicated to Taco Hoekwater
+
+% simple version
+%
+% \def\truefontname#1%
+% {\@EA\dotruefontname#1*\relax}
+%
+% \def\dotruefontname#1*#2\relax
+% {\ifcsname\??ff\fontclass#1\endcsname
+% \@EA\truefontname\csname\??ff\fontclass#1\endcsname
+% \else\ifcsname\??ff#1\endcsname
+% \@EA\truefontname\csname\??ff#1\endcsname
+% \else
+% #1%
+% \fi\fi}
+%
+% last counts
+%
+% \def\truefontname#1%
+% {\@EA\dotruefontname#1*\empty*\relax}
+%
+% \def\dotruefontname#1*#2#3*#4\relax
+% {\ifcsname\??ff\fontclass#1\endcsname
+% \ifx#2\empty
+% \@EA\truefontname\csname\??ff\fontclass#1\endcsname
+% \else
+% \@EA\truefontname\csname\??ff\fontclass#1\endcsname*#2#3%
+% \fi
+% \else\ifcsname\??ff#1\endcsname
+% \ifx#2\empty
+% \@EA\truefontname\csname\??ff#1\endcsname
+% \else
+% \@EA\truefontname\csname\??ff#1\endcsname*#2#3%
+% \fi
+% \else
+% \ifx#2\empty
+% #1%
+% \else
+% #1*#2#3%
+% \fi
+% \fi\fi}
+%
+% first counts
+
+\def\truefontname#1%
+ {\@EA\dotruefontname#1*\empty*\relax}
+
+\def\dotruefontname#1*#2#3*#4\relax
+ {\ifcsname\??ff\fontclass#1\endcsname
+ \ifx#2\empty
+ \@EA\truefontname\csname\??ff\fontclass#1\endcsname
+ \else
+ \@EA\redotruefontname\csname\??ff\fontclass#1\endcsname*#2#3%
+ \fi
+ \else\ifcsname\??ff#1\endcsname
+ \ifx#2\empty
+ \@EA\truefontname\csname\??ff#1\endcsname
+ \else
+ \@EA\redotruefontname\csname\??ff#1\endcsname*#2#3%
+ \fi
+ \else
+ #1\ifx#2\empty\else*#2#3\fi
+ \fi\fi}
+
+\def\redotruefontname#1%
+ {\@EA\dodotruefontname#1*\relax}
+
+\def\dodotruefontname#1*#2\relax
+ {\ifcsname\??ff\fontclass#1\endcsname
+ \@EA\redotruefontname\csname\??ff\fontclass#1\endcsname
+ \else\ifcsname\??ff#1\endcsname
+ \@EA\redotruefontname\csname\??ff#1\endcsname
+ \else
+ #1%
+ \fi\fi}
+
+%D Default:
+
+\def\defaultfontfile{file:lmmono10-regular}
+
+%D Maybe:
+
+% \def\updatefontparameters
+% {\edef\@@fontfeatures{\truefontdata\fontfile \s!features}%
+% \edef\@@fontskewchar{\truefontdata\fontfile \s!skewchar}}
+
+% \def\setfontcharacteristics
+% {%\updatefontparameters % redundant, will go away, faster too
+% \the\everyfont
+% \synchronizepatternswithfont}
+
+\protect \endinput
+
+% \starttypescript[serif] [myzhfont]
+% \definefontsynonym [Serif] [file:SimSun]
+% \definefontsynonym [SerifBold] [file:SimSun]
+% \definefontsynonym [SerifItalic] [file:SimSun]
+% \definefontsynonym [SerifBoldItalic] [file:SimSun]
+% \stoptypescript
+% \starttypescript[sans] [myzhfont]
+% \definefontsynonym [Sans] [file:SimSun]
+% \definefontsynonym [SansBold] [file:SimSun]
+% \definefontsynonym [SansItalic] [file:SimSun]
+% \definefontsynonym [SansBoldItalic] [file:SimSun]
+% \stoptypescript
+% \starttypescript[mono] [myzhfont]
+% \definefontsynonym [Mono] [file:SimSun]
+% \definefontsynonym [MonoBold] [file:SimSun]
+% \definefontsynonym [MonoItalic] [file:SimSun]
+% \definefontsynonym [MonoBoldItalic] [file:SimSun]
+% \stoptypescript
+% \definetypeface [myzhfont] [rm] [serif][myzhfont] [default]
+% \definetypeface [myzhfont] [ss] [sans] [myzhfont] [default]
+% \definetypeface [myzhfont] [tt] [mono] [myzhfont] [default]
+
+% \starttext
+% % on windows: make sure fonts.conf has no cache mentioned
+% %
+% % 64 sec xetex, 11 sec luatex (56 sec xetex when \nobigmath)
+% %
+% \setupbodyfont[myzhfont] \dorecurse{10000}{{hello {\switchtobodyfont[myzhfont] 你好}}\par}
+% %
+% % 67 sec xetex, 11.5 sec luatex
+% %
+% % \dorecurse{10000}{{hello {\switchtobodyfont[myzhfont] 你好}}\par}
+% %
+% % 5 sec xetex, 7 sec luatex
+% %
+% % \setupbodyfont[myzhfont] \dorecurse{10000}{{hello {你好}}\par}
+% %
+% % 5 sec xetex, 7 sec luatex
+% %
+% % \setupbodyfont[myzhfont] \dorecurse{10000}{{\bf hello {你好}}\par}
+% \stoptext
+
diff --git a/tex/context/base/font-xtx.tex b/tex/context/base/font-xtx.tex
deleted file mode 100644
index 5f4b85879..000000000
--- a/tex/context/base/font-xtx.tex
+++ /dev/null
@@ -1,357 +0,0 @@
-%D \module
-%D [ file=font-xtx,
-%D version=2004.09.11,
-%D title=\CONTEXT\ Font Macros,
-%D subtitle=\XETEX\ Hacks,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=\PRAGMA]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\ifnum\texengine=\xetexengine
- \writestatus{loading}{ConTeXt Font Macros / XeTeX Hacks}
-\else
- \endinput
-\fi
-
-\unprotect
-
-%D Loading:
-
-%D for some reason xetex does not support [filename] for tfm files and
-%D quotes also behave kind of strange " vs ' vs [ vs ...
-%D
-%D \starttyping
-%D \font\myfont = msam7 % ok
-%D \font\myfont = "msam7" % also ok
-%D \font\myfont = "msam7" at 8pt % error
-%D \stoptyping
-
-\newconditional\tracexetexfonts
-
-%D Because \XETEX\ is not that fast on locating fonts we cache lookups so
-%D that we minimize the test. It saves a little bit of runtime, depending
-%D on the number of fonts loaded (which is normally not that much).
-
-\def\doiffoundXTXfontelse#1#2%
- {\ifcsname xtx@fnt@#2\somefontspec\endcsname
- \ifconditional\tracexetexfonts
- \writestatus\m!fonts{already checked #1: #2\somefontspec\space (state: \number\csname xtx@fnt@#2\somefontspec\endcsname)}%
- \fi
- \else
- \suppressfontnotfounderror\plusone
- \font\xetextempfont=#2\somefontspec\relax
- \suppressfontnotfounderror\zerocount
- \edef\xetextempfont{\fontname\xetextempfont}%
- \global\expandafter\chardef\csname xtx@fnt@#2\somefontspec\endcsname
- \ifx\xetextempfont\nullfontname
- \zerocount \ifconditional\tracexetexfonts
- \writestatus\m!fonts{not found #1: #2\somefontspec}%
- \fi
- \else
- \plusone \ifconditional\tracexetexfonts
- \writestatus\m!fonts{found #1: #2\somefontspec}%
- \fi
- \fi
- \fi
- \ifcase\csname xtx@fnt@#2\somefontspec\endcsname
- \expandafter\secondoftwoarguments
- \else
- \expandafter\firstoftwoarguments
- \fi}
-
-\def\docheckfontfilenameprefix#1:#2:#3#4\relax
- {\edef\!!stringa{#1}%
- \edef\!!stringb{#2}%
- \ifx\!!stringb\empty
- % no prefix
- \let\checkedfontfile\!!stringa
- \doiffoundXTXfontelse{1a}{\checkedfontfile\checkedfontfeatures}
- {\edef\checkedfontfile{\checkedfontfile\checkedfontfeatures}}
- {\doiffoundXTXfontelse{1b}{"\checkedfontfile\checkedfontfeatures"}
- {\edef\checkedfontfile{"\checkedfontfile\checkedfontfeatures"}}
- {\doiffoundXTXfontelse{1c}{"[\checkedfontfile]\checkedfontfeatures"}
- {\edef\checkedfontfile{"[\checkedfontfile]\checkedfontfeatures"}}
- {}}}%
- \else\ifx\!!stringa\v!file
- % force file, only file check when no spaces
- \let\checkedfontfile\!!stringb
- \doiffoundXTXfontelse{2a}{"[\checkedfontfile]\checkedfontfeatures"}
- {\edef\checkedfontfile{"[\checkedfontfile]\checkedfontfeatures"}}
- {\doiffoundXTXfontelse{2b}{"\checkedfontfile\checkedfontfeatures"}
- {\edef\checkedfontfile{"\checkedfontfile\checkedfontfeatures"}}
- {}}%
- \else\ifx\!!stringa\v!name
- % force name, always lookup by xetex itself, "" forces otf/ttf/type1
- \edef\checkedfontfile{"\!!stringb\checkedfontfeatures"}%
- \ifconditional\tracexetexfonts
- \writestatus\m!fonts{no checking 3a: \checkedfontfile}%
- \fi
- \else
- % whatever, maybe even xetex spec, forget about features
- \edef\checkedfontfile{"\!!stringa\!!stringb"}%
- \ifconditional\tracexetexfonts
- \writestatus\m!fonts{no checking 3b: \checkedfontfile}%
- \fi
- \fi\fi\fi}
-
-\def\checkfontfilename% -- todo: integrate so that we call do.. directly
- {\expandafter\docheckfontfilename\fontfile*\empty*\relax}
-
-\def\docheckfontfilename#1*#2#3*#4\relax % class overrules file
- {\edef\checkedfontfeatures
- {\expandafter\ifx\csname\fontclass\s!features\endcsname\empty
- \ifx\@@fontfeatures\empty\ifx#2\empty\else#2#3\fi\else\@@fontfeatures\fi
- \else\expandafter\ifx\csname\fontclass\s!features\endcsname\relax % redundant, will go away
- \ifx\@@fontfeatures\empty\ifx#2\empty\else#2#3\fi\else\@@fontfeatures\fi
- \else
- \csname\fontclass\s!features\endcsname
- \fi\fi}%
- \ifx\checkedfontfeatures\empty
- % done
- \else
- \edef\checkedfontfeatures{\executeifdefined{\??fa\checkedfontfeatures}\empty}%
- \ifx\checkedfontfeatures\empty
- % done
- \else
- \let\convertedfontfeatures\empty
- \processcommacommand[\checkedfontfeatures]\doconvertfontfeatures % raw
- \ifx\convertedfontfeatures\empty
- \let\checkedfontfeatures\empty
- \else
- \edef\checkedfontfeatures{:\convertedfontfeatures}%
- \fi
- \fi
- \fi
- \docheckfontfilenameprefix#1:\empty:\empty\relax
- \doshowcheckedfontfeatures}
-
-\def\dodoconvertfontfeatures#1=#2#3=#4\relax
- {\ifx#2\empty
- % invalid feature
- \else\ifcsname @xtx@#1@#2#3\endcsname
- \expandafter\ifx\csname @xtx@#1@#2#3\endcsname\empty\else
- \edef\convertedfontfeatures{\convertedfontfeatures\csname @xtx@#1@#2#3\endcsname;}%
- \fi
- \else
- \edef\!!stringa{#1}%
- \edef\!!stringb{#2#3}%
- \edef\convertedfontfeatures
- {\convertedfontfeatures
- \ifx\!!stringb\v!yes
- +\!!stringa
- \else\ifx\!!stringb\v!no
- -\!!stringa
- \else
- \!!stringa=\!!stringb
- \fi\fi;}%
- \fi\fi}
-
-\def\doconvertfontfeatures#1%
- {\dodoconvertfontfeatures#1=\empty=\relax}
-
-\def\remapfontfeature #1 #2 #3 {\setevalue{@xtx@#1@#2}{#3}}
-
-% this may move to another file, maybe font-xtx
-
-\remapfontfeature tlig yes mapping=tlig
-%remapfontfeature tlig no mapping=
-\remapfontfeature trep yes {}
-\remapfontfeature trep no {}
-\remapfontfeature texligatures yes mapping=tlig
-%remapfontfeature texligatures no mapping=
-%remapfontfeature texquotes yes mapping=tex-text
-%remapfontfeature texquotes no mapping=
-
-%D Variants:
-
-\unexpanded\def\variant[#1]%
- {\dosetscaledfont
- \font\variantfont\truefontname{\fontstringA\fontstylesuffix\fontvariant\fontstringA{#1}} at \scaledfont
- \variantfont}
-
-%D Possible optimizations:
-
-% \def\updatefontparameters
-% {\edef\@@fontfeatures{\truefontdata\fontfile\s!features}%
-% \edef\@@fontskewchar{\truefontdata\fontfile\s!skewchar}}
-
-% \def\setfontcharacteristics
-% {\updatefontparameters % redundant, will go away, faster too
-% \the\everyfont}
-
-% \let\synchronizepatternswithfont\relax
-
-%D Names:
-
-% We need to move the feature into the filename else it may be
-% overloaded by another reference. For instance the definition of
-% a regular and caps variant can use the same font.
-
-% We could use an indirect method ... store in 'array' and refer to
-% slot.
-
-\def\definefontsynonym[#1]#2[#3]%
- {\edef\@@fontname{#1}%
- \edef\@@fontfile{#3}%
- \doifnextoptionalelse\dodefinefontsynonym\nodefinefontsynonym}
-
-\def\nodefinefontsynonym
- {\@EA\let\csname\??ff\fontclass\@@fontname\endcsname\@@fontfile}
-
-\def\dodefinefontsynonym[#1]%
- {\edef\@@fontdata{#1}%
- \ifx\@@fontdata\empty
- \nodefinefontsynonym
- \else
- \ifx\fontclass\empty
- \getfontparameters
- \else
- \getglobalfontparameters
- \fi
- \ifcsname\??ff\@@fontfile\s!features\endcsname
- \@EA\edef\csname\??ff\fontclass\@@fontname\endcsname{\@@fontfile*\csname\??ff\@@fontfile\s!features\endcsname}%
- \@EA\let\csname\??ff\@@fontfile\s!features\endcsname\undefined
- \else
- \nodefinefontsynonym
- \fi
- \fi}
-
-\let\definefontfile\definefontsynonym % dedicated to Taco Hoekwater
-
-% simple version
-%
-% \def\truefontname#1%
-% {\@EA\dotruefontname#1*\relax}
-%
-% \def\dotruefontname#1*#2\relax
-% {\ifcsname\??ff\fontclass#1\endcsname
-% \@EA\truefontname\csname\??ff\fontclass#1\endcsname
-% \else\ifcsname\??ff#1\endcsname
-% \@EA\truefontname\csname\??ff#1\endcsname
-% \else
-% #1%
-% \fi\fi}
-%
-% last counts
-%
-% \def\truefontname#1%
-% {\@EA\dotruefontname#1*\empty*\relax}
-%
-% \def\dotruefontname#1*#2#3*#4\relax
-% {\ifcsname\??ff\fontclass#1\endcsname
-% \ifx#2\empty
-% \@EA\truefontname\csname\??ff\fontclass#1\endcsname
-% \else
-% \@EA\truefontname\csname\??ff\fontclass#1\endcsname*#2#3%
-% \fi
-% \else\ifcsname\??ff#1\endcsname
-% \ifx#2\empty
-% \@EA\truefontname\csname\??ff#1\endcsname
-% \else
-% \@EA\truefontname\csname\??ff#1\endcsname*#2#3%
-% \fi
-% \else
-% \ifx#2\empty
-% #1%
-% \else
-% #1*#2#3%
-% \fi
-% \fi\fi}
-%
-% first counts
-
-\def\truefontname#1%
- {\@EA\dotruefontname#1*\empty*\relax}
-
-\def\dotruefontname#1*#2#3*#4\relax
- {\ifcsname\??ff\fontclass#1\endcsname
- \ifx#2\empty
- \@EA\truefontname\csname\??ff\fontclass#1\endcsname
- \else
- \@EA\redotruefontname\csname\??ff\fontclass#1\endcsname*#2#3%
- \fi
- \else\ifcsname\??ff#1\endcsname
- \ifx#2\empty
- \@EA\truefontname\csname\??ff#1\endcsname
- \else
- \@EA\redotruefontname\csname\??ff#1\endcsname*#2#3%
- \fi
- \else
- #1\ifx#2\empty\else*#2#3\fi
- \fi\fi}
-
-\def\redotruefontname#1%
- {\@EA\dodotruefontname#1*\relax}
-
-\def\dodotruefontname#1*#2\relax
- {\ifcsname\??ff\fontclass#1\endcsname
- \@EA\redotruefontname\csname\??ff\fontclass#1\endcsname
- \else\ifcsname\??ff#1\endcsname
- \@EA\redotruefontname\csname\??ff#1\endcsname
- \else
- #1%
- \fi\fi}
-
-%D Default:
-
-\def\defaultfontfile{file:lmmono10-regular}
-
-%D Maybe:
-
-% \def\updatefontparameters
-% {\edef\@@fontfeatures{\truefontdata\fontfile \s!features}%
-% \edef\@@fontskewchar{\truefontdata\fontfile \s!skewchar}}
-
-% \def\setfontcharacteristics
-% {%\updatefontparameters % redundant, will go away, faster too
-% \the\everyfont
-% \synchronizepatternswithfont}
-
-\protect \endinput
-
-% \starttypescript[serif] [myzhfont]
-% \definefontsynonym [Serif] [file:SimSun]
-% \definefontsynonym [SerifBold] [file:SimSun]
-% \definefontsynonym [SerifItalic] [file:SimSun]
-% \definefontsynonym [SerifBoldItalic] [file:SimSun]
-% \stoptypescript
-% \starttypescript[sans] [myzhfont]
-% \definefontsynonym [Sans] [file:SimSun]
-% \definefontsynonym [SansBold] [file:SimSun]
-% \definefontsynonym [SansItalic] [file:SimSun]
-% \definefontsynonym [SansBoldItalic] [file:SimSun]
-% \stoptypescript
-% \starttypescript[mono] [myzhfont]
-% \definefontsynonym [Mono] [file:SimSun]
-% \definefontsynonym [MonoBold] [file:SimSun]
-% \definefontsynonym [MonoItalic] [file:SimSun]
-% \definefontsynonym [MonoBoldItalic] [file:SimSun]
-% \stoptypescript
-% \definetypeface [myzhfont] [rm] [serif][myzhfont] [default]
-% \definetypeface [myzhfont] [ss] [sans] [myzhfont] [default]
-% \definetypeface [myzhfont] [tt] [mono] [myzhfont] [default]
-
-% \starttext
-% % on windows: make sure fonts.conf has no cache mentioned
-% %
-% % 64 sec xetex, 11 sec luatex (56 sec xetex when \nobigmath)
-% %
-% \setupbodyfont[myzhfont] \dorecurse{10000}{{hello {\switchtobodyfont[myzhfont] 你好}}\par}
-% %
-% % 67 sec xetex, 11.5 sec luatex
-% %
-% % \dorecurse{10000}{{hello {\switchtobodyfont[myzhfont] 你好}}\par}
-% %
-% % 5 sec xetex, 7 sec luatex
-% %
-% % \setupbodyfont[myzhfont] \dorecurse{10000}{{hello {你好}}\par}
-% %
-% % 5 sec xetex, 7 sec luatex
-% %
-% % \setupbodyfont[myzhfont] \dorecurse{10000}{{\bf hello {你好}}\par}
-% \stoptext
-
diff --git a/tex/context/base/grph-fig.mkiv b/tex/context/base/grph-fig.mkiv
index 61f78f09e..415a2aa76 100644
--- a/tex/context/base/grph-fig.mkiv
+++ b/tex/context/base/grph-fig.mkiv
@@ -43,8 +43,7 @@
{\bgroup
\pushmacro\textunderscore
\edef\textunderscore{\string_}% brrr, temp hack, still needed?
- \calculateexternalfigure [][#1][#2][#3][#4][#5]% [] is dummy dwcomp
- \calculateexternalscreenfigure[][#1][#2][#3][#4][#5]% [] is dummy dwcomp
+ \calculateexternalfigure[][#1][#2][#3][#4][#5]% [] is dummy dwcomp
\popmacro\textunderscore
\box\foundexternalfigure
\egroup}
@@ -56,14 +55,16 @@
[\??ef]
[\c!width=\figurewidth,
\c!height=\figureheight,
- \c!background=\v!screen,
- \c!backgroundscreen=.8,
+ \c!background=\v!color,
+ \c!backgroundcolor=missingfigurecolor,
\c!frame=\@@efframe]}%
{\tt\tfxx \nohyphens
name: \expanded{\verbatimstring{#1}}\\%
file: \expanded{\verbatimstring{#2}}\\%
state: \expanded{\verbatimstring{#3}}}}
+\definecolor[missingfigurecolor][s=.8]
+
\def\externalfigureplaceholder#1#2#3%
{\localframed
[\??ef]
@@ -186,89 +187,91 @@
%D Still undocumented! No one uses it I think, better be done with layers.
-\newcount\efreference
-\newdimen\efxsteps
-\newdimen\efysteps
-
-\def\calculateefsteps
- {\ifnum0\@@exxmax=\zerocount
- \ifnum0\@@exymax=\zerocount
- \def\@@exymax{24}%
- \fi
- \efysteps\figureheight \divide\efysteps \@@exymax
- \efxsteps\efysteps
- \dimen0=\figurewidth
- \advance\dimen0 \efysteps
- \divide \dimen0 \efysteps
- \edef\@@exxmax{\number\dimen0}%
- \else
- \efxsteps\figurewidth \divide\efxsteps \@@exxmax
- \efysteps\figureheight \divide\efysteps \@@exymax
- \fi}
-
-\def\efcomment#1(#2,#3)#4(#5,#6)% {kader}(x,y)(h,b)[...]{tekst}
- {\def\complexefdocomment[##1]##2%
- {\position(#2,#3)%
- {\setnostrut
- \framed
- [\c!width=#5\efxsteps,
- \c!height=#6\exysteps,
- \c!offset=\v!none,
- \c!frame=#1,
- ##1]%
- {##2}}}%
- \complexorsimpleempty\efdocomment}
-
-\def\efnocomment(#1,#2)#3(#4,#5)% (x,y)(h,b)[...]{tekst}
- {\def\complexefdonocomment[##1]##2{}%
- \complexorsimpleempty\efdonocomment}
-
-\def\efdomarker(#1,#2)#3#4% (h,b){kader}{tekst}
- {\framed
- [\c!width=#1\efxsteps,
- \c!height=#2\efysteps,
- \c!offset=\v!none,
- \c!frame=#3]%
- {#4}}
-
-\def\effigure#1%
- {\position(0,0){\getvalue{#1}}}
-
-\def\efdoarea(#1,#2)#3#4% (h,b){kader}{tekst}
- {\bgroup
- \setnostrut
- \framed
- [\c!width=#1\efxsteps,
- \c!height=#2\efysteps,
- \c!offset=\!!zeropoint,
- \c!frame=#3]
- {#4}%
- \egroup}
-
-\def\efgoto(#1,#2)#3[#4]% (h,b)kader[ref]
- {\setbox0=\vbox{\efdoarea(#1,#2)#3{}}%
- \gotobox{\copy0}[#4]}
-
-\def\efmark(#1,#2)#3(#4,#5)#6[#7]%
- {\advance\efreference \plusone
- \position(#1,#2)
- {\hbox{\the\efreference}}%
- \position(#1,#2)
- {\gotosomeinternal\s!vwb{#7}\realfolio
- {\efdomarker(#4,#5)\v!on{\thisissomeinternal\s!vwa{#7}}}}}
-
-\def\eftext#1(#2,#3)#4(#5,#6)#7[#8]%
- {\advance\efreference \plusone
- \hbox
- {\quad
- \thisissomeinternal\s!vwb{#8}%
- \gotosomeinternal \s!vwa{#8}\realfolio
- {\hbox to 1.5em{\the\efreference\presetgoto\hfill}}%
- \quad#1 (#2,#3) (#5,#6) [#8]\hfill}%
- \endgraf}
-
-\def\efthisis(#1,#2)#3[#4]%
- {\efdoarea(#1,#2){#3}{\pagereference[#4]}}
+% when there is need for this i'll reimplement it
+%
+% \newcount\efreference
+% \newdimen\efxsteps
+% \newdimen\efysteps
+%
+% \def\calculateefsteps
+% {\ifnum0\@@exxmax=\zerocount
+% \ifnum0\@@exymax=\zerocount
+% \def\@@exymax{24}%
+% \fi
+% \efysteps\figureheight \divide\efysteps \@@exymax
+% \efxsteps\efysteps
+% \dimen0=\figurewidth
+% \advance\dimen0 \efysteps
+% \divide \dimen0 \efysteps
+% \edef\@@exxmax{\number\dimen0}%
+% \else
+% \efxsteps\figurewidth \divide\efxsteps \@@exxmax
+% \efysteps\figureheight \divide\efysteps \@@exymax
+% \fi}
+%
+% \def\efcomment#1(#2,#3)#4(#5,#6)% {kader}(x,y)(h,b)[...]{tekst}
+% {\def\complexefdocomment[##1]##2%
+% {\position(#2,#3)%
+% {\setnostrut
+% \framed
+% [\c!width=#5\efxsteps,
+% \c!height=#6\exysteps,
+% \c!offset=\v!none,
+% \c!frame=#1,
+% ##1]%
+% {##2}}}%
+% \complexorsimpleempty\efdocomment}
+%
+% \def\efnocomment(#1,#2)#3(#4,#5)% (x,y)(h,b)[...]{tekst}
+% {\def\complexefdonocomment[##1]##2{}%
+% \complexorsimpleempty\efdonocomment}
+%
+% \def\efdomarker(#1,#2)#3#4% (h,b){kader}{tekst}
+% {\framed
+% [\c!width=#1\efxsteps,
+% \c!height=#2\efysteps,
+% \c!offset=\v!none,
+% \c!frame=#3]%
+% {#4}}
+%
+% \def\effigure#1%
+% {\position(0,0){\getvalue{#1}}}
+%
+% \def\efdoarea(#1,#2)#3#4% (h,b){kader}{tekst}
+% {\bgroup
+% \setnostrut
+% \framed
+% [\c!width=#1\efxsteps,
+% \c!height=#2\efysteps,
+% \c!offset=\!!zeropoint,
+% \c!frame=#3]
+% {#4}%
+% \egroup}
+%
+% \def\efgoto(#1,#2)#3[#4]% (h,b)kader[ref]
+% {\setbox0=\vbox{\efdoarea(#1,#2)#3{}}%
+% \gotobox{\copy0}[#4]}
+%
+% \def\efmark(#1,#2)#3(#4,#5)#6[#7]%
+% {\advance\efreference \plusone
+% \position(#1,#2)
+% {\hbox{\the\efreference}}%
+% \position(#1,#2)
+% {\gotosomeinternal\s!vwb{#7}\realfolio
+% {\efdomarker(#4,#5)\v!on{\thisissomeinternal\s!vwa{#7}}}}}
+%
+% \def\eftext#1(#2,#3)#4(#5,#6)#7[#8]%
+% {\advance\efreference \plusone
+% \hbox
+% {\quad
+% \thisissomeinternal\s!vwb{#8}%
+% \gotosomeinternal \s!vwa{#8}\realfolio
+% {\hbox to 1.5em{\the\efreference\presetgoto\hfill}}%
+% \quad#1 (#2,#3) (#5,#6) [#8]\hfill}%
+% \endgraf}
+%
+% \def\efthisis(#1,#2)#3[#4]%
+% {\efdoarea(#1,#2){#3}{\pagereference[#4]}}
\newbox\colorbarbox
@@ -402,41 +405,6 @@
\def\startfigure
{\grabuntil{\e!stop\v!figure}\dostartfigure}
-%D defining sound tracks:
-%D
-%D \starttyping
-%D \useexternalsoundtrack[label][file]
-%D \stoptyping
-%D
-%D associated actions: StartSound StopSound PauseSound ResumeSound
-%D
-%D Todo: like external figures, also search on path,
-%D although, they need to be present ar viewing time, so ...
-
-\def\useexternalsoundtrack
- {\dodoubleargument\douseexternalsoundtrack}
-
-\def\douseexternalsoundtrack[#1][#2]%
- {\setgvalue{\??sd:#1}{#2}}
-
-\def\checksoundtrack#1%
- {\iflocation
- \doifdefined{\??sd:#1}{\doifvaluesomething{\??sd:#1}
- {\doinsertsoundtrack{\getvalue{\??sd:#1}}{#1}\@@sdoption
- % brr, \..empty not really needed and maybe even wrong;
- % also, not here but in driver
- % well, no: sounds need to be reinitialize each time (i.e., be on page), so no
- }}% \letgvalueempty{\??sd:#1}}}%
- \fi}
-
-\setexecutecommandcheck {startsound} \checksoundtrack
-
-\def\setupexternalsoundtracks
- {\dodoubleargument\getparameters[\??sd]}
-
-\setupexternalsoundtracks
- [\c!option=]
-
%D NEW: used in styledesign manual
% \setbuffer[typeset-b]\endbuffer
diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua
index 5b3bff36c..3dfcee739 100644
--- a/tex/context/base/grph-inc.lua
+++ b/tex/context/base/grph-inc.lua
@@ -36,6 +36,7 @@ run TeX code from within Lua. Some more functionality will move to Lua.
local texsprint, format, lower, find, match = tex.sprint, string.format, string.lower, string.find, string.match
local ctxcatcodes = tex.ctxcatcodes
+local variables = interfaces.variables
local trace_figures = false trackers.register("figures.locating",function(v) trace_figures = v end)
@@ -107,16 +108,16 @@ figures.order = {
}
figures.formats = {
- ["pdf"] = { },
- ["mps"] = { patterns = { "%d+" } },
+ ["pdf"] = { list = { "pdf" } },
+ ["mps"] = { patterns = { "mps", "%d+" } },
["jpg"] = { list = { "jpg", "jpeg" } },
- ["png"] = { } ,
+ ["png"] = { list = { "png" } },
["jbig"] = { list = { "jbig", "jbig2", "jb2" } },
["svg"] = { list = { "svg", "svgz" } },
["eps"] = { list = { "eps", "ai" } },
["mov"] = { list = { "mov", "avi" } },
["buffer"] = { list = { "tmp", "buffer", "buf" } },
- ["tex"] = { },
+ ["tex"] = { list = { "tex" } },
}
function figures.setlookups()
@@ -142,16 +143,19 @@ end
figures.setlookups()
local function register(tag,target,what)
- local data = figures.formats[target]
- if data then
- local d = data[tag]
- if d and not table.contains(d,what) then
- d[#d+1] = what
- else
- data[tag] = { what }
- end
+ local data = figures.formats[target] -- resolver etc
+ if not data then
+ data = { }
+ figures.formats[target] = data
+ end
+ local d = data[tag] -- list or pattern
+ if d and not table.contains(d,what) then
+ d[#d+1] = what -- suffix or patternspec
else
- figures.formats[target] = { }
+ data[tag] = { what }
+ end
+ if not table.contains(figures.order,target) then
+ figures.order[#figures.order+1] = target
end
figures.setlookups()
end
@@ -208,7 +212,7 @@ end
--~ end
function figures.hash(data)
- return tostring(data.status.private) -- the
+ return data.status.hash or tostring(data.status.private) -- the
-- return data.status.fullname .. "+".. (data.status.page or data.request.page or 1) -- img is still not perfect
end
@@ -267,9 +271,9 @@ do
--~ local w, h = tonumber(request.width), tonumber(request.height)
request.page = math.max(tonumber(request.page) or 1,1)
request.size = img.check_size(request.size)
- request.object = iv[request.object] == "yes"
- request["repeat"] = iv[request["repeat"]] == "yes"
- request.preview = iv[request.preview] == "yes"
+ request.object = iv[request.object] == variables.yes
+ request["repeat"] = iv[request["repeat"]] == variables.yes
+ request.preview = iv[request.preview] == variables.yes
request.cache = request.cache ~= "" and request.cache
request.prefix = request.prefix ~= "" and request.prefix
request.format = request.format ~= "" and request.format
@@ -603,12 +607,15 @@ function figures.existers.generic(askedname)
end
function figures.checkers.generic(data)
local dr, du, ds = data.request, data.used, data.status
- local name, page, size = du.fullname or "unknown generic", du.page or dr.page, dr.size or "crop"
- local hash = name .. "->" .. page .. "->" .. size
+ local name, page, size, color = du.fullname or "unknown generic", du.page or dr.page, dr.size or "crop", dr.color or "natural"
+ local hash = name .. "->" .. page .. "->" .. size .. "->" .. color
local figure = figures.loaded[hash]
if figure == nil then
figure = img.new { filename = name, page = page, pagebox = dr.size }
+ backends.codeinjections.setfigurecolorspace(data,figure)
figure = (figure and img.scan(figure)) or false
+ local f, d = backends.codeinjections.setfigurealternative(data,figure)
+ figure, data = f or figure, d or data
figures.loaded[hash] = figure
end
if figure then
@@ -616,6 +623,7 @@ function figures.checkers.generic(data)
du.height = figure.height
du.pages = figure.pages
ds.private = figure
+ ds.hash = hash
end
return data
end
@@ -629,7 +637,6 @@ function figures.includers.generic(data)
if figure == nil then
figure = ds.private
if figure then
---~ figure.page = dr.page or '1'
figure = img.copy(figure)
figure = (figure and img.clone(figure,data.request)) or false
end
diff --git a/tex/context/base/grph-inc.mkii b/tex/context/base/grph-inc.mkii
index 231ce902e..acb5ae7e9 100644
--- a/tex/context/base/grph-inc.mkii
+++ b/tex/context/base/grph-inc.mkii
@@ -1212,4 +1212,28 @@
\setanalyzedfiguredimensions\plustwo
\fi}
+%D This is \MKII\ only and comes from cont-new (maybe used in a project).
+
+% maybe to be integrated (option=...)
+
+\def\directexternalfigure
+ {\dodoubleempty\dodirectexternalfigure}
+
+\def\dodirectexternalfigure[#1][#2]%
+ {\bgroup
+ \getparameters[\??ef][\c!type=\splitofftype,\c!page=1,#2]%
+ \sanitizefilename#1\to\expandedfigurename
+ \splitfilename\expandedfigurename
+ \let\@@DriverImageWidth \!!zeropoint
+ \let\@@DriverImageHeight \!!zeropoint
+ \let\@@DriverImageFile \splitofffull
+ \let\@@DriverImageType \@@eftype
+ \let\@@DriverImageMethod \@@eftype
+ \let\@@DriverImageLabel \empty
+ \let\@@DriverImagePage \@@efpage
+ \doinsertfile
+ \egroup}
+
+% \directexternalfigure[cow.pdf]
+
\protect \endinput
diff --git a/tex/context/base/grph-inc.mkiv b/tex/context/base/grph-inc.mkiv
index 96ea2d74a..d5151c521 100644
--- a/tex/context/base/grph-inc.mkiv
+++ b/tex/context/base/grph-inc.mkiv
@@ -21,6 +21,7 @@
%D - a few more obscure things
\registerctxluafile{grph-inc}{1.001}
+\registerctxluafile{grph-u3d}{1.001} % this will change
\unprotect
@@ -198,12 +199,7 @@
% a transparent color is used
\doifsomething\@@efforegroundcolor
{\def\@@efbackground{\v!foreground,\v!color}%
- \def\@@efbackgroundcolor{\@@efforegroundcolor}}%
- \doifsomething\@@efcolor
- {\doifcolorelse\@@efcolor
- {\checkpredefinedcolor[\@@efcolor]%
- \doregisterfigurecolor\@@efcolor}}%
- \donothing}
+ \def\@@efbackgroundcolor{\@@efforegroundcolor}}}
\appendtoks
\checkfigureusersettings
@@ -237,6 +233,9 @@
\resetfigurevariables
\dosetefparameters{#4}{#5}{#6}%
\checkfigurevariables
+% \begingroup
+% \color[\@@efcolor]{\xdef\globcolorattr{\internalspotcolorname}}
+% \endgroup
\ctxlua{figures.push {
name="#3",
label="#2", % todo: \@eflabel
@@ -250,6 +249,7 @@
controls="\@@efcontrols",
preview="\@@efpreview",
display="\@@efdisplay",
+ color="\internalspotcolorparent\@@efcolor", % hack is needed
["repeat"]="\@@efrepeat",
width="\@@efwidth", % can be crap
height="\@@efheight", % can be crap
@@ -361,25 +361,6 @@
\let\feedbackexternalfigure\relax % \gobblefourarguments
\let\dowithfigure \relax
-% \let\lastfigureobjectname\empty
-
-\def\calculateexternalscreenfigure[#1][#2][#3][#4][#5][#6]%
- {\ifx\@@efdisplay\empty\else
-% \doifnot\@@efobject\v!no
-% {\doifobjectssupportedelse
-% {\doifspecialavailableelse\doregisterfigure
-% {\doshowfigurestate{screen alternative : start}%
-% \bgroup
-% \dosetefparameters{#4}{#5}{#6}%
-% \doregisterfigure{FIG}{\lastfigureobjectname}%
-% \let\@@ef@@scherm\@@efdisplay
-% \calculateexternalfigure[#1][\@@ef@@scherm][\@@ef@@scherm][#4,\c!display=][#5][#6]%
-% \doshowfigurestate{screen alternative : stop}%
-% \egroup}
-% {}}
-% {}}%
- \fi}
-
\def\getfiguredimensions
{\dodoubleempty\dogetfiguredimensions}
@@ -416,3 +397,49 @@
{\ctxlua{figures.bases.use("#1")}}
\protect \endinput
+
+% \startbuffer
+% \definecolor [blue] [c=1,m=.38,y=0,k=.64]
+% \definecolor [yellow] [c=0,m=.28,y=1,k=.06]
+%
+% \definespotcolor [blue-100] [blue] [p=1]
+% \definespotcolor [yellow-100] [yellow] [p=1]
+%
+% \definemultitonecolor [combicolor] [blue=.12,yellow=.28] [c=.1,m=.1,y=.3,k=.1]
+%
+% \definemultitonecolor [combicolor-b] [blue=1] [c=1,m=.38,y=0,k=.64] % force multitone
+% \definemultitonecolor [combicolor-y] [yellow=1] [c=0,m=.28,y=1,k=.06] % force multitone
+%
+% \useexternalfigure[demo-a][mill.png] [object=no,width=.2\textwidth]
+% \useexternalfigure[demo-b][hacker-bw.jpg][object=no,width=.2\textwidth]
+%
+% \startbaselinecorrection \startcombination[4*1]
+% {\externalfigure[demo-a]} {no color}
+% {\externalfigure[demo-a][color=combicolor]} {indexed duotone}
+% {\externalfigure[demo-a][color=combicolor-b]} {spot color}
+% {\externalfigure[demo-a][color=combicolor-y]} {spot color}
+% \stopcombination \stopbaselinecorrection
+%
+% \startbaselinecorrection \startcombination[4*1]
+% {\externalfigure[demo-b]} {no color}
+% {\externalfigure[demo-b][color=combicolor]} {indexed duotone}
+% {\externalfigure[demo-b][color=combicolor-b]} {spot color}
+% {\externalfigure[demo-b][color=combicolor-y]} {spot color}
+% \stopcombination \stopbaselinecorrection
+%
+% \startbaselinecorrection \startcombination[4*1]
+% {\externalfigure[demo-a]} {no color}
+% {\externalfigure[demo-a][color=combicolor]} {indexed duotone}
+% {\externalfigure[demo-a][color=blue-100]} {spot color}
+% {\externalfigure[demo-a][color=yellow-100]} {spot color}
+% \stopcombination \stopbaselinecorrection
+%
+% \startbaselinecorrection \startcombination[4*1]
+% {\externalfigure[demo-b]} {no color}
+% {\externalfigure[demo-b][color=combicolor]} {indexed duotone}
+% {\externalfigure[demo-b][color=blue-100]} {spot color}
+% {\externalfigure[demo-b][color=yellow-100]} {spot color}
+% \stopcombination \stopbaselinecorrection
+% \stopbuffer
+%
+% \getbuffer \typebuffer
diff --git a/tex/context/base/grph-u3d.lua b/tex/context/base/grph-u3d.lua
new file mode 100644
index 000000000..e5944691c
--- /dev/null
+++ b/tex/context/base/grph-u3d.lua
@@ -0,0 +1,45 @@
+if not modules then modules = { } end modules ['grph-u3d'] = {
+ version = 1.001,
+ comment = "companion to grph-inc.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- see lpdf-u3d.lua for comment
+
+local format = string.format
+
+local texsprint = tex.sprint
+local ctxcatcodes = tex.ctxcatcodes
+
+function figures.checkers.u3d(data)
+ local dr, du, ds = data.request, data.used, data.status
+ local width = (dr.width or figures.defaultwidth):todimen()
+ local height = (dr.height or figures.defaultheight):todimen()
+ local foundname = du.fullname
+ dr.width, dr.height = width, height
+ du.width, du.height, du.foundname = width, height, foundname
+ texsprint(ctxcatcodes,format("\\startfoundexternalfigure{%ssp}{%ssp}",width,height))
+ local annot, preview, ref = backends.pdf.helpers.insert3d {
+ foundname = foundname,
+ width = width,
+ height = height,
+ factor = number.dimenfactors.bp,
+ display = dr.display,
+ controls = dr.controls,
+ label = dr.label,
+ }
+ -- node.write(nodes.pdfannot(width,-height,0,annot()))
+ texsprint(ctxcatcodes,format("\\pdfannot width %ssp height %ssp {%s}",width,height,annot())) -- brrrr
+--~ if ref then -- wrong ! a direct ref should work
+--~ texsprint(ctxcatcodes,format("\\smash{\\pdfrefximage%s\\relax}",ref)) -- brrrr
+--~ end
+ texsprint(ctxcatcodes,"\\stopfoundexternalfigure")
+ return data
+end
+
+figures.includers.u3d = figures.includers.nongeneric
+
+figures.registersuffix("u3d","u3d")
+figures.registersuffix("prc","u3d")
diff --git a/tex/context/base/hand-def.mkii b/tex/context/base/hand-def.mkii
new file mode 100644
index 000000000..0a19ce270
--- /dev/null
+++ b/tex/context/base/hand-def.mkii
@@ -0,0 +1,577 @@
+%D \module
+%D [ file=hand-def, % was enco-pro
+%D version=2000.29.09,
+%D title=\CONTEXT\ Handling Macros,
+%D subtitle=Default Protruding Factors,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=Hans Hagen]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This is an experimental definition file. The protruding
+%D values we use here are those found from \THANH's thesis.
+
+\startfonthandling [pure]
+
+ \defineprotrudefactor , 0 1
+ \defineprotrudefactor . 0 1
+ \defineprotrudefactor : 0 1
+ \defineprotrudefactor ; 0 1
+ \defineprotrudefactor - 0 1
+
+ \defineprotrudefactor hyphen 0 1
+ \defineprotrudefactor endash 0 .5
+ \defineprotrudefactor emdash 0 .33 % .5
+
+\stopfonthandling
+
+\startfonthandling [punctuation]
+
+ \defineprotrudefactor ! 0 .2
+ \defineprotrudefactor ' 0 .7
+ \defineprotrudefactor ` .7 0
+ \defineprotrudefactor ( .05 0
+ \defineprotrudefactor ) 0 .05
+ \defineprotrudefactor [ .05 0
+ \defineprotrudefactor ] 0 .05
+ \defineprotrudefactor , 0 .7
+ \defineprotrudefactor - 0 .7
+ \defineprotrudefactor . 0 .7
+ \defineprotrudefactor : 0 .5
+ \defineprotrudefactor ; 0 .5
+
+ \defineprotrudefactor rightupperninequote 0 .5
+ \defineprotrudefactor leftupperninequote .5 0
+ \defineprotrudefactor endash 0 .3
+ \defineprotrudefactor emdash 0 .2
+
+ \defineprotrudefactor hyphen 0 .7
+
+\stopfonthandling
+
+\startfonthandling [alpha]
+
+ \defineprotrudefactor A .05 .05
+ \defineprotrudefactor F 0 .05
+ \defineprotrudefactor J .05 0
+ \defineprotrudefactor K 0 .05
+ \defineprotrudefactor L 0 .05
+ \defineprotrudefactor T .05 .05
+ \defineprotrudefactor V .05 .05
+ \defineprotrudefactor W .05 .05
+ \defineprotrudefactor X .05 .05
+ \defineprotrudefactor Y .05 .05
+
+ \defineprotrudefactor k 0 .05
+ \defineprotrudefactor r 0 .05
+ \defineprotrudefactor t 0 .05
+ \defineprotrudefactor v .05 .05
+ \defineprotrudefactor w .05 .05
+ \defineprotrudefactor x .05 .05
+ \defineprotrudefactor y .05 .05
+
+\stopfonthandling
+
+% ogoneks may need another treatment
+
+\startfonthandling [extended]
+
+ \inherithandling Acircumflex A
+ \inherithandling acircumflex a
+ \inherithandling Ccircumflex C
+ \inherithandling ccircumflex c
+ \inherithandling Ecircumflex E
+ \inherithandling ecircumflex e
+ \inherithandling Gcircumflex G
+ \inherithandling gcircumflex g
+ \inherithandling Hcircumflex H
+ \inherithandling hcircumflex h
+ \inherithandling Icircumflex I
+ \inherithandling icircumflex i
+ \inherithandling Jcircumflex J
+ \inherithandling jcircumflex j
+ \inherithandling Ocircumflex O
+ \inherithandling ocircumflex o
+ \inherithandling Scircumflex S
+ \inherithandling scircumflex s
+ \inherithandling Ucircumflex U
+ \inherithandling ucircumflex u
+ \inherithandling Wcircumflex W
+ \inherithandling wcircumflex w
+ \inherithandling Ycircumflex Y
+ \inherithandling ycircumflex y
+
+ \inherithandling Agrave A
+ \inherithandling agrave a
+ \inherithandling Egrave E
+ \inherithandling egrave e
+ \inherithandling Igrave I
+ \inherithandling igrave i
+ \inherithandling Ograve O
+ \inherithandling ograve o
+ \inherithandling Ugrave U
+ \inherithandling ugrave u
+ \inherithandling Ygrave Y
+ \inherithandling ygrave y
+
+ \inherithandling Atilde A
+ \inherithandling atilde a
+ \inherithandling Itilde I
+ \inherithandling itilde i
+ \inherithandling Ntilde N
+ \inherithandling ntilde n
+ \inherithandling Otilde O
+ \inherithandling otilde o
+ \inherithandling Utilde U
+ \inherithandling utilde u
+
+ \inherithandling Adiaeresis A
+ \inherithandling adiaeresis a
+ \inherithandling Ediaeresis E
+ \inherithandling ediaeresis e
+ \inherithandling Idiaeresis I
+ \inherithandling idiaeresis i
+ \inherithandling Odiaeresis O
+ \inherithandling odiaeresis o
+ \inherithandling Udiaeresis U
+ \inherithandling udiaeresis u
+ \inherithandling Ydiaeresis Y
+ \inherithandling ydiaeresis y
+
+ \inherithandling Aacute A
+ \inherithandling aacute a
+ \inherithandling Cacute C
+ \inherithandling cacute c
+ \inherithandling Eacute E
+ \inherithandling eacute e
+ \inherithandling Iacute I
+ \inherithandling iacute i
+ \inherithandling Lacute L
+ \inherithandling lacute l
+ \inherithandling Nacute N
+ \inherithandling nacute n
+ \inherithandling Oacute O
+ \inherithandling oacute o
+ \inherithandling Racute R
+ \inherithandling racute r
+ \inherithandling Sacute s
+ \inherithandling sacute s
+ \inherithandling Uacute U
+ \inherithandling uacute u
+ \inherithandling Yacute Y
+ \inherithandling yacute y
+ \inherithandling Zacute Z
+ \inherithandling zacute z
+
+ \inherithandling Dstroke D
+ \inherithandling dstroke d
+ \inherithandling Hstroke H
+ \inherithandling hstroke h
+ \inherithandling Tstroke T
+ \inherithandling tstroke t
+
+ \inherithandling Cdotaccent C
+ \inherithandling cdotaccent c
+ \inherithandling Edotaccent E
+ \inherithandling edotaccent e
+ \inherithandling Gdotaccent G
+ \inherithandling gdotaccent g
+ \inherithandling Idotaccent I
+ \inherithandling idotaccent i
+ \inherithandling Zdotaccent Z
+ \inherithandling zdotaccent z
+
+ \inherithandling Amacron A
+ \inherithandling amacron a
+ \inherithandling Emacron E
+ \inherithandling emacron e
+ \inherithandling Imacron I
+ \inherithandling imacron i
+ \inherithandling Omacron O
+ \inherithandling omacron o
+ \inherithandling Umacron U
+ \inherithandling umacron u
+
+ \inherithandling Ccedilla C
+ \inherithandling ccedilla c
+ \inherithandling Kcedilla K
+ \inherithandling kcedilla k
+ \inherithandling Lcedilla L
+ \inherithandling lcedilla l
+ \inherithandling Ncedilla N
+ \inherithandling ncedilla n
+ \inherithandling Rcedilla R
+ \inherithandling rcedilla r
+ \inherithandling Scedilla S
+ \inherithandling scedilla s
+ \inherithandling Tcedilla T
+ \inherithandling tcedilla t
+
+ \inherithandling Ohungarumlaut O
+ \inherithandling ohungarumlaut o
+ \inherithandling Uhungarumlaut U
+ \inherithandling uhungarumlaut u
+
+ \inherithandling Aogonek A
+ \inherithandling aogonek a
+ \inherithandling Eogonek E
+ \inherithandling eogonek e
+ \inherithandling Iogonek I
+ \inherithandling iogonek i
+ \inherithandling Uogonek U
+ \inherithandling uogonek u
+
+ \inherithandling Aring A
+ \inherithandling aring a
+ \inherithandling Uring U
+ \inherithandling uring u
+
+ \inherithandling Abreve A
+ \inherithandling abreve a
+ \inherithandling Ebreve E
+ \inherithandling ebreve e
+ \inherithandling Gbreve G
+ \inherithandling gbreve g
+ \inherithandling Ibreve I
+ \inherithandling ibreve i
+ \inherithandling Obreve O
+ \inherithandling obreve o
+ \inherithandling Ubreve U
+ \inherithandling ubreve u
+
+ \inherithandling Ccaron C
+ \inherithandling ccaron c
+ \inherithandling Dcaron D
+ \inherithandling dcaron d
+ \inherithandling Ecaron E
+ \inherithandling ecaron e
+ \inherithandling Lcaron L
+ \inherithandling lcaron l
+ \inherithandling Ncaron N
+ \inherithandling ncaron n
+ \inherithandling Rcaron R
+ \inherithandling rcaron r
+ \inherithandling Scaron S
+ \inherithandling scaron s
+ \inherithandling Tcaron T
+ \inherithandling tcaron t
+ \inherithandling Ycaron Y
+ \inherithandling ycaron y
+ \inherithandling Zcaron Z
+ \inherithandling zcaron z
+
+ \inherithandling AEligature E
+ \inherithandling aeligature e
+ \inherithandling Lstroke I
+ \inherithandling lstroke o
+ \inherithandling Ostroke O
+ \inherithandling ostroke o
+ \inherithandling OEligature O
+ \inherithandling oeligature o
+
+ \inherithandling Ssharp S
+ \inherithandling ssharp s
+ \inherithandling IJligature J
+ \inherithandling ijligature j
+
+ \inherithandling aumlaut a
+ \inherithandling eumlaut e
+ \inherithandling iumlaut i
+ \inherithandling oumlaut o
+ \inherithandling uumlaut u
+
+ \inherithandling Aumlaut A
+ \inherithandling Eumlaut E
+ \inherithandling Iumlaut I
+ \inherithandling Oumlaut O
+ \inherithandling Uumlaut U
+
+ \inherithandling Lslash L
+ \inherithandling lslash l
+ \inherithandling Dslash D
+ \inherithandling dslash d
+ \inherithandling Oslash O
+ \inherithandling oslash o
+
+ \inherithandling Eszett S
+ \inherithandling eszett s
+
+ \inherithandling Thorn P
+ \inherithandling thorn p
+
+ % vietnamese
+
+ \inherithandling Ahook A
+ \inherithandling ahook a
+ \inherithandling Ehook E
+ \inherithandling ehook e
+ \inherithandling Ihook I
+ \inherithandling ihook i
+ \inherithandling Ohook O
+ \inherithandling ohook o
+ \inherithandling Uhook U
+ \inherithandling uhook u
+ \inherithandling Yhook Y
+ \inherithandling yhook y
+
+ \inherithandling Acircumflexgrave A
+ \inherithandling Acircumflexacute A
+ \inherithandling Acircumflextilde A
+ \inherithandling Acircumflexhook A
+ \inherithandling acircumflexgrave a
+ \inherithandling acircumflexacute a
+ \inherithandling acircumflextilde a
+ \inherithandling acircumflexhook a
+ \inherithandling Ecircumflexgrave E
+ \inherithandling Ecircumflexacute E
+ \inherithandling Ecircumflextilde E
+ \inherithandling Ecircumflexhook E
+ \inherithandling ecircumflexgrave e
+ \inherithandling ecircumflexacute e
+ \inherithandling ecircumflextilde e
+ \inherithandling ecircumflexhook e
+ \inherithandling Ocircumflexgrave O
+ \inherithandling Ocircumflexacute O
+ \inherithandling Ocircumflextilde O
+ \inherithandling Ocircumflexhook O
+ \inherithandling ocircumflexgrave o
+ \inherithandling ocircumflexacute o
+ \inherithandling ocircumflextilde o
+ \inherithandling ocircumflexhook o
+
+ \inherithandling Abrevegrave A
+ \inherithandling Abreveacute A
+ \inherithandling Abrevetilde A
+ \inherithandling Abrevehook A
+ \inherithandling abrevegrave a
+ \inherithandling abreveacute a
+ \inherithandling abrevetilde a
+ \inherithandling abrevehook a
+
+ \inherithandling Adotbelow A
+ \inherithandling adotbelow a
+ \inherithandling Edotbelow E
+ \inherithandling edotbelow e
+ \inherithandling Idotbelow I
+ \inherithandling idotbelow i
+ \inherithandling Odotbelow O
+ \inherithandling odotbelow o
+ \inherithandling Udotbelow U
+ \inherithandling udotbelow u
+ \inherithandling Ydotbelow Y
+ \inherithandling ydotbelow y
+
+ \inherithandling Ohorndotbelow O
+ \inherithandling ohorndotbelow o
+ \inherithandling Uhorndotbelow U
+ \inherithandling uhorndotbelow u
+
+ \inherithandling Acircumflexdotbelow A
+ \inherithandling acircumflexdotbelow a
+ \inherithandling Ecircumflexdotbelow E
+ \inherithandling ecircumflexdotbelow e
+ \inherithandling Ocircumflexdotbelow O
+ \inherithandling ocircumflexdotbelow o
+
+ \inherithandling Abrevedotbelow A
+ \inherithandling abrevedotbelow a
+
+ \inherithandling Ohorn O
+ \inherithandling Ohorngrave O
+ \inherithandling Ohornacute O
+ \inherithandling Ohorntilde O
+ \inherithandling Ohornhook O
+ \inherithandling ohorn o
+ \inherithandling ohorngrave o
+ \inherithandling ohornacute o
+ \inherithandling ohorntilde o
+ \inherithandling ohornhook o
+ \inherithandling Uhorn U
+ \inherithandling Uhorngrave U
+ \inherithandling Uhornacute U
+ \inherithandling Uhorntilde U
+ \inherithandling Uhornhook U
+ \inherithandling uhorn u
+ \inherithandling uhorngrave u
+ \inherithandling uhornacute u
+ \inherithandling uhorntilde u
+ \inherithandling uhornhook u
+
+ \inherithandling Ytilde Y
+ \inherithandling ytilde y
+ \inherithandling Etilde E
+ \inherithandling etilde e
+
+\stopfonthandling
+
+\startfonthandling [hz]
+
+ \defineadjustfactor A .5
+ \defineadjustfactor B .7
+ \defineadjustfactor C .7
+ \defineadjustfactor D .5
+ \defineadjustfactor E .7
+ \defineadjustfactor F .7
+ \defineadjustfactor G .5
+ \defineadjustfactor H .7
+ \defineadjustfactor K .7
+ \defineadjustfactor M .7
+ \defineadjustfactor N .7
+ \defineadjustfactor O .5
+ \defineadjustfactor P .7
+ \defineadjustfactor Q .5
+ \defineadjustfactor R .7
+ \defineadjustfactor S .7
+ \defineadjustfactor U .7
+ \defineadjustfactor W .7
+ \defineadjustfactor Z .7
+
+ \defineadjustfactor a .7
+ \defineadjustfactor b .7
+ \defineadjustfactor c .7
+ \defineadjustfactor d .7
+ \defineadjustfactor e .7
+ \defineadjustfactor g .7
+ \defineadjustfactor h .7
+ \defineadjustfactor k .7
+ \defineadjustfactor m .7
+ \defineadjustfactor n .7
+ \defineadjustfactor o .7
+ \defineadjustfactor p .7
+ \defineadjustfactor q .7
+ \defineadjustfactor s .7
+ \defineadjustfactor u .7
+ \defineadjustfactor w .7
+ \defineadjustfactor z .7
+
+ \defineadjustfactor 2 .7
+ \defineadjustfactor 3 .7
+ \defineadjustfactor 6 .7
+ \defineadjustfactor 8 .7
+ \defineadjustfactor 9 .7
+
+% \defineadjustfactor hyphen ?
+% \defineadjustfactor endash ?
+% \defineadjustfactor emdash ?
+
+\stopfonthandling
+
+% no ligs other than fi fl etc, no --- and ''
+
+\startfonthandling[noligs]
+
+ \settagcode - {\notagcode}
+ \settagcode ' {\notagcode}
+ \settagcode ` {\notagcode}
+ \settagcode ? {\notagcode}
+ \settagcode ! {\notagcode}
+
+\stopfonthandling
+
+% \startfonthandling[noligs]
+% \dostepwiserecurse{0}{255}{1}{\expanded{\settagcode \recurselevel\space\notagcode\space}}
+% \stopfonthandling
+
+% \definefonthandling [noligs] [noligs] [type=tag]
+ % \setupfontsynonym[Serif][handling=noligs]
+% \definefont[test][Serif at 12.34pt]
+%
+% {``fi--ffl---ffi'' \test ``fi--ffl---ffi''}
+
+\unprotect
+
+% beware: extended extends the preceding vector (both protruding and
+% adjusting) but as long as the normal ascii characters are not set
+% beforehand, they default to normal
+
+% protruding variants -- slanted/italic is yet incomplete
+
+\definefonthandling [pure] [pure] [\c!type=\v!hanging]
+\definefonthandling [purebold] [pure] [\c!type=\v!hanging]
+\definefonthandling [pureslanted] [pure] [\c!type=\v!hanging,\c!right=1.5]
+\definefonthandling [pureitalic] [pure] [\c!type=\v!hanging,\c!right=1.5]
+\definefonthandling [pureboldslanted] [pure] [\c!type=\v!hanging,\c!right=1.5]
+\definefonthandling [purebolditalic] [pure] [\c!type=\v!hanging,\c!right=1.5]
+
+\definefonthandling [normal] [punctuation,alpha,extended] [\c!type=\v!hanging]
+\definefonthandling [normalbold] [punctuation,alpha,extended] [\c!type=\v!hanging]
+\definefonthandling [normalslanted] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
+\definefonthandling [normalitalic] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
+\definefonthandling [normalboldslanted] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
+\definefonthandling [normalbolditalic] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
+
+% for old times sake
+
+\definefonthandling [bold] [punctuation,alpha,extended] [\c!type=\v!hanging]
+\definefonthandling [slanted] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
+\definefonthandling [italic] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
+\definefonthandling [boldslanted] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
+\definefonthandling [bolditalic] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
+
+% hz variants
+
+\definefonthandling [hz] [hz,extended] [\c!type=\v!hz] % min=20 max=20 step=5
+
+% combined variants
+
+\definefonthandling [quality] [hz,pure]
+\definefonthandling [highquality] [hz,normal]
+
+% noligs (xml) : \definefonthandling [default] [noligs]
+
+\definefonthandling [noligs] [noligs] [\c!type=tag]
+
+% experimental values !
+%
+% \definefontsynonym[myfont][Serif][handling=prespacing]
+% \definefont[whatever][myfont sa 1]
+% \setupalign[spacing]
+%
+% \whatever look at this: we now have a proper spacing feature and, hurray,
+% get rid of active punctuation!
+
+\startfonthandling [flexspacing]
+
+ \definespacefactor : 0 1.25 .25 .25
+
+ \definespacefactor , 0 1 .25 .25
+ \inheritspacefactor ; ,
+
+ \definespacefactor . 0 1.5 .25 .25
+ \inheritspacefactor ! .
+ \inheritspacefactor ? .
+
+\stopfonthandling
+
+\definefonthandling[flexspacing][flexspacing][\c!type=\v!spacing]
+
+\startfonthandling [prespacing] % better name needed
+
+ \definespacefactor : .25 .25 0 0
+ \inheritspacefactor ; :
+ \inheritspacefactor ! :
+ \inheritspacefactor ? :
+
+\stopfonthandling
+
+\definefonthandling[prespacing][prespacing][\c!type=\v!spacing] % factor=.5
+
+% A special case of guillemots, beware: when used ungrouped,
+% it overloads all successive (current) encoding vector
+% instances! Will be obsolete soon.
+
+\startfonthandling [glm]
+
+ \overloadcharacter guilsingleleft {\defaultcharacter\guilsingleleft }
+ \overloadcharacter guilsingleright {\defaultcharacter\guilsingleright}
+ \overloadcharacter leftguillemot {\defaultcharacter\leftguillemot }
+ \overloadcharacter rightguillemot {\defaultcharacter\rightguillemot }
+
+\stopfonthandling
+
+\definefonthandling [glm] [glm]
+
+\protect \endinput
diff --git a/tex/context/base/hand-def.tex b/tex/context/base/hand-def.tex
deleted file mode 100644
index 0a19ce270..000000000
--- a/tex/context/base/hand-def.tex
+++ /dev/null
@@ -1,577 +0,0 @@
-%D \module
-%D [ file=hand-def, % was enco-pro
-%D version=2000.29.09,
-%D title=\CONTEXT\ Handling Macros,
-%D subtitle=Default Protruding Factors,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright=Hans Hagen]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D This is an experimental definition file. The protruding
-%D values we use here are those found from \THANH's thesis.
-
-\startfonthandling [pure]
-
- \defineprotrudefactor , 0 1
- \defineprotrudefactor . 0 1
- \defineprotrudefactor : 0 1
- \defineprotrudefactor ; 0 1
- \defineprotrudefactor - 0 1
-
- \defineprotrudefactor hyphen 0 1
- \defineprotrudefactor endash 0 .5
- \defineprotrudefactor emdash 0 .33 % .5
-
-\stopfonthandling
-
-\startfonthandling [punctuation]
-
- \defineprotrudefactor ! 0 .2
- \defineprotrudefactor ' 0 .7
- \defineprotrudefactor ` .7 0
- \defineprotrudefactor ( .05 0
- \defineprotrudefactor ) 0 .05
- \defineprotrudefactor [ .05 0
- \defineprotrudefactor ] 0 .05
- \defineprotrudefactor , 0 .7
- \defineprotrudefactor - 0 .7
- \defineprotrudefactor . 0 .7
- \defineprotrudefactor : 0 .5
- \defineprotrudefactor ; 0 .5
-
- \defineprotrudefactor rightupperninequote 0 .5
- \defineprotrudefactor leftupperninequote .5 0
- \defineprotrudefactor endash 0 .3
- \defineprotrudefactor emdash 0 .2
-
- \defineprotrudefactor hyphen 0 .7
-
-\stopfonthandling
-
-\startfonthandling [alpha]
-
- \defineprotrudefactor A .05 .05
- \defineprotrudefactor F 0 .05
- \defineprotrudefactor J .05 0
- \defineprotrudefactor K 0 .05
- \defineprotrudefactor L 0 .05
- \defineprotrudefactor T .05 .05
- \defineprotrudefactor V .05 .05
- \defineprotrudefactor W .05 .05
- \defineprotrudefactor X .05 .05
- \defineprotrudefactor Y .05 .05
-
- \defineprotrudefactor k 0 .05
- \defineprotrudefactor r 0 .05
- \defineprotrudefactor t 0 .05
- \defineprotrudefactor v .05 .05
- \defineprotrudefactor w .05 .05
- \defineprotrudefactor x .05 .05
- \defineprotrudefactor y .05 .05
-
-\stopfonthandling
-
-% ogoneks may need another treatment
-
-\startfonthandling [extended]
-
- \inherithandling Acircumflex A
- \inherithandling acircumflex a
- \inherithandling Ccircumflex C
- \inherithandling ccircumflex c
- \inherithandling Ecircumflex E
- \inherithandling ecircumflex e
- \inherithandling Gcircumflex G
- \inherithandling gcircumflex g
- \inherithandling Hcircumflex H
- \inherithandling hcircumflex h
- \inherithandling Icircumflex I
- \inherithandling icircumflex i
- \inherithandling Jcircumflex J
- \inherithandling jcircumflex j
- \inherithandling Ocircumflex O
- \inherithandling ocircumflex o
- \inherithandling Scircumflex S
- \inherithandling scircumflex s
- \inherithandling Ucircumflex U
- \inherithandling ucircumflex u
- \inherithandling Wcircumflex W
- \inherithandling wcircumflex w
- \inherithandling Ycircumflex Y
- \inherithandling ycircumflex y
-
- \inherithandling Agrave A
- \inherithandling agrave a
- \inherithandling Egrave E
- \inherithandling egrave e
- \inherithandling Igrave I
- \inherithandling igrave i
- \inherithandling Ograve O
- \inherithandling ograve o
- \inherithandling Ugrave U
- \inherithandling ugrave u
- \inherithandling Ygrave Y
- \inherithandling ygrave y
-
- \inherithandling Atilde A
- \inherithandling atilde a
- \inherithandling Itilde I
- \inherithandling itilde i
- \inherithandling Ntilde N
- \inherithandling ntilde n
- \inherithandling Otilde O
- \inherithandling otilde o
- \inherithandling Utilde U
- \inherithandling utilde u
-
- \inherithandling Adiaeresis A
- \inherithandling adiaeresis a
- \inherithandling Ediaeresis E
- \inherithandling ediaeresis e
- \inherithandling Idiaeresis I
- \inherithandling idiaeresis i
- \inherithandling Odiaeresis O
- \inherithandling odiaeresis o
- \inherithandling Udiaeresis U
- \inherithandling udiaeresis u
- \inherithandling Ydiaeresis Y
- \inherithandling ydiaeresis y
-
- \inherithandling Aacute A
- \inherithandling aacute a
- \inherithandling Cacute C
- \inherithandling cacute c
- \inherithandling Eacute E
- \inherithandling eacute e
- \inherithandling Iacute I
- \inherithandling iacute i
- \inherithandling Lacute L
- \inherithandling lacute l
- \inherithandling Nacute N
- \inherithandling nacute n
- \inherithandling Oacute O
- \inherithandling oacute o
- \inherithandling Racute R
- \inherithandling racute r
- \inherithandling Sacute s
- \inherithandling sacute s
- \inherithandling Uacute U
- \inherithandling uacute u
- \inherithandling Yacute Y
- \inherithandling yacute y
- \inherithandling Zacute Z
- \inherithandling zacute z
-
- \inherithandling Dstroke D
- \inherithandling dstroke d
- \inherithandling Hstroke H
- \inherithandling hstroke h
- \inherithandling Tstroke T
- \inherithandling tstroke t
-
- \inherithandling Cdotaccent C
- \inherithandling cdotaccent c
- \inherithandling Edotaccent E
- \inherithandling edotaccent e
- \inherithandling Gdotaccent G
- \inherithandling gdotaccent g
- \inherithandling Idotaccent I
- \inherithandling idotaccent i
- \inherithandling Zdotaccent Z
- \inherithandling zdotaccent z
-
- \inherithandling Amacron A
- \inherithandling amacron a
- \inherithandling Emacron E
- \inherithandling emacron e
- \inherithandling Imacron I
- \inherithandling imacron i
- \inherithandling Omacron O
- \inherithandling omacron o
- \inherithandling Umacron U
- \inherithandling umacron u
-
- \inherithandling Ccedilla C
- \inherithandling ccedilla c
- \inherithandling Kcedilla K
- \inherithandling kcedilla k
- \inherithandling Lcedilla L
- \inherithandling lcedilla l
- \inherithandling Ncedilla N
- \inherithandling ncedilla n
- \inherithandling Rcedilla R
- \inherithandling rcedilla r
- \inherithandling Scedilla S
- \inherithandling scedilla s
- \inherithandling Tcedilla T
- \inherithandling tcedilla t
-
- \inherithandling Ohungarumlaut O
- \inherithandling ohungarumlaut o
- \inherithandling Uhungarumlaut U
- \inherithandling uhungarumlaut u
-
- \inherithandling Aogonek A
- \inherithandling aogonek a
- \inherithandling Eogonek E
- \inherithandling eogonek e
- \inherithandling Iogonek I
- \inherithandling iogonek i
- \inherithandling Uogonek U
- \inherithandling uogonek u
-
- \inherithandling Aring A
- \inherithandling aring a
- \inherithandling Uring U
- \inherithandling uring u
-
- \inherithandling Abreve A
- \inherithandling abreve a
- \inherithandling Ebreve E
- \inherithandling ebreve e
- \inherithandling Gbreve G
- \inherithandling gbreve g
- \inherithandling Ibreve I
- \inherithandling ibreve i
- \inherithandling Obreve O
- \inherithandling obreve o
- \inherithandling Ubreve U
- \inherithandling ubreve u
-
- \inherithandling Ccaron C
- \inherithandling ccaron c
- \inherithandling Dcaron D
- \inherithandling dcaron d
- \inherithandling Ecaron E
- \inherithandling ecaron e
- \inherithandling Lcaron L
- \inherithandling lcaron l
- \inherithandling Ncaron N
- \inherithandling ncaron n
- \inherithandling Rcaron R
- \inherithandling rcaron r
- \inherithandling Scaron S
- \inherithandling scaron s
- \inherithandling Tcaron T
- \inherithandling tcaron t
- \inherithandling Ycaron Y
- \inherithandling ycaron y
- \inherithandling Zcaron Z
- \inherithandling zcaron z
-
- \inherithandling AEligature E
- \inherithandling aeligature e
- \inherithandling Lstroke I
- \inherithandling lstroke o
- \inherithandling Ostroke O
- \inherithandling ostroke o
- \inherithandling OEligature O
- \inherithandling oeligature o
-
- \inherithandling Ssharp S
- \inherithandling ssharp s
- \inherithandling IJligature J
- \inherithandling ijligature j
-
- \inherithandling aumlaut a
- \inherithandling eumlaut e
- \inherithandling iumlaut i
- \inherithandling oumlaut o
- \inherithandling uumlaut u
-
- \inherithandling Aumlaut A
- \inherithandling Eumlaut E
- \inherithandling Iumlaut I
- \inherithandling Oumlaut O
- \inherithandling Uumlaut U
-
- \inherithandling Lslash L
- \inherithandling lslash l
- \inherithandling Dslash D
- \inherithandling dslash d
- \inherithandling Oslash O
- \inherithandling oslash o
-
- \inherithandling Eszett S
- \inherithandling eszett s
-
- \inherithandling Thorn P
- \inherithandling thorn p
-
- % vietnamese
-
- \inherithandling Ahook A
- \inherithandling ahook a
- \inherithandling Ehook E
- \inherithandling ehook e
- \inherithandling Ihook I
- \inherithandling ihook i
- \inherithandling Ohook O
- \inherithandling ohook o
- \inherithandling Uhook U
- \inherithandling uhook u
- \inherithandling Yhook Y
- \inherithandling yhook y
-
- \inherithandling Acircumflexgrave A
- \inherithandling Acircumflexacute A
- \inherithandling Acircumflextilde A
- \inherithandling Acircumflexhook A
- \inherithandling acircumflexgrave a
- \inherithandling acircumflexacute a
- \inherithandling acircumflextilde a
- \inherithandling acircumflexhook a
- \inherithandling Ecircumflexgrave E
- \inherithandling Ecircumflexacute E
- \inherithandling Ecircumflextilde E
- \inherithandling Ecircumflexhook E
- \inherithandling ecircumflexgrave e
- \inherithandling ecircumflexacute e
- \inherithandling ecircumflextilde e
- \inherithandling ecircumflexhook e
- \inherithandling Ocircumflexgrave O
- \inherithandling Ocircumflexacute O
- \inherithandling Ocircumflextilde O
- \inherithandling Ocircumflexhook O
- \inherithandling ocircumflexgrave o
- \inherithandling ocircumflexacute o
- \inherithandling ocircumflextilde o
- \inherithandling ocircumflexhook o
-
- \inherithandling Abrevegrave A
- \inherithandling Abreveacute A
- \inherithandling Abrevetilde A
- \inherithandling Abrevehook A
- \inherithandling abrevegrave a
- \inherithandling abreveacute a
- \inherithandling abrevetilde a
- \inherithandling abrevehook a
-
- \inherithandling Adotbelow A
- \inherithandling adotbelow a
- \inherithandling Edotbelow E
- \inherithandling edotbelow e
- \inherithandling Idotbelow I
- \inherithandling idotbelow i
- \inherithandling Odotbelow O
- \inherithandling odotbelow o
- \inherithandling Udotbelow U
- \inherithandling udotbelow u
- \inherithandling Ydotbelow Y
- \inherithandling ydotbelow y
-
- \inherithandling Ohorndotbelow O
- \inherithandling ohorndotbelow o
- \inherithandling Uhorndotbelow U
- \inherithandling uhorndotbelow u
-
- \inherithandling Acircumflexdotbelow A
- \inherithandling acircumflexdotbelow a
- \inherithandling Ecircumflexdotbelow E
- \inherithandling ecircumflexdotbelow e
- \inherithandling Ocircumflexdotbelow O
- \inherithandling ocircumflexdotbelow o
-
- \inherithandling Abrevedotbelow A
- \inherithandling abrevedotbelow a
-
- \inherithandling Ohorn O
- \inherithandling Ohorngrave O
- \inherithandling Ohornacute O
- \inherithandling Ohorntilde O
- \inherithandling Ohornhook O
- \inherithandling ohorn o
- \inherithandling ohorngrave o
- \inherithandling ohornacute o
- \inherithandling ohorntilde o
- \inherithandling ohornhook o
- \inherithandling Uhorn U
- \inherithandling Uhorngrave U
- \inherithandling Uhornacute U
- \inherithandling Uhorntilde U
- \inherithandling Uhornhook U
- \inherithandling uhorn u
- \inherithandling uhorngrave u
- \inherithandling uhornacute u
- \inherithandling uhorntilde u
- \inherithandling uhornhook u
-
- \inherithandling Ytilde Y
- \inherithandling ytilde y
- \inherithandling Etilde E
- \inherithandling etilde e
-
-\stopfonthandling
-
-\startfonthandling [hz]
-
- \defineadjustfactor A .5
- \defineadjustfactor B .7
- \defineadjustfactor C .7
- \defineadjustfactor D .5
- \defineadjustfactor E .7
- \defineadjustfactor F .7
- \defineadjustfactor G .5
- \defineadjustfactor H .7
- \defineadjustfactor K .7
- \defineadjustfactor M .7
- \defineadjustfactor N .7
- \defineadjustfactor O .5
- \defineadjustfactor P .7
- \defineadjustfactor Q .5
- \defineadjustfactor R .7
- \defineadjustfactor S .7
- \defineadjustfactor U .7
- \defineadjustfactor W .7
- \defineadjustfactor Z .7
-
- \defineadjustfactor a .7
- \defineadjustfactor b .7
- \defineadjustfactor c .7
- \defineadjustfactor d .7
- \defineadjustfactor e .7
- \defineadjustfactor g .7
- \defineadjustfactor h .7
- \defineadjustfactor k .7
- \defineadjustfactor m .7
- \defineadjustfactor n .7
- \defineadjustfactor o .7
- \defineadjustfactor p .7
- \defineadjustfactor q .7
- \defineadjustfactor s .7
- \defineadjustfactor u .7
- \defineadjustfactor w .7
- \defineadjustfactor z .7
-
- \defineadjustfactor 2 .7
- \defineadjustfactor 3 .7
- \defineadjustfactor 6 .7
- \defineadjustfactor 8 .7
- \defineadjustfactor 9 .7
-
-% \defineadjustfactor hyphen ?
-% \defineadjustfactor endash ?
-% \defineadjustfactor emdash ?
-
-\stopfonthandling
-
-% no ligs other than fi fl etc, no --- and ''
-
-\startfonthandling[noligs]
-
- \settagcode - {\notagcode}
- \settagcode ' {\notagcode}
- \settagcode ` {\notagcode}
- \settagcode ? {\notagcode}
- \settagcode ! {\notagcode}
-
-\stopfonthandling
-
-% \startfonthandling[noligs]
-% \dostepwiserecurse{0}{255}{1}{\expanded{\settagcode \recurselevel\space\notagcode\space}}
-% \stopfonthandling
-
-% \definefonthandling [noligs] [noligs] [type=tag]
- % \setupfontsynonym[Serif][handling=noligs]
-% \definefont[test][Serif at 12.34pt]
-%
-% {``fi--ffl---ffi'' \test ``fi--ffl---ffi''}
-
-\unprotect
-
-% beware: extended extends the preceding vector (both protruding and
-% adjusting) but as long as the normal ascii characters are not set
-% beforehand, they default to normal
-
-% protruding variants -- slanted/italic is yet incomplete
-
-\definefonthandling [pure] [pure] [\c!type=\v!hanging]
-\definefonthandling [purebold] [pure] [\c!type=\v!hanging]
-\definefonthandling [pureslanted] [pure] [\c!type=\v!hanging,\c!right=1.5]
-\definefonthandling [pureitalic] [pure] [\c!type=\v!hanging,\c!right=1.5]
-\definefonthandling [pureboldslanted] [pure] [\c!type=\v!hanging,\c!right=1.5]
-\definefonthandling [purebolditalic] [pure] [\c!type=\v!hanging,\c!right=1.5]
-
-\definefonthandling [normal] [punctuation,alpha,extended] [\c!type=\v!hanging]
-\definefonthandling [normalbold] [punctuation,alpha,extended] [\c!type=\v!hanging]
-\definefonthandling [normalslanted] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
-\definefonthandling [normalitalic] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
-\definefonthandling [normalboldslanted] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
-\definefonthandling [normalbolditalic] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
-
-% for old times sake
-
-\definefonthandling [bold] [punctuation,alpha,extended] [\c!type=\v!hanging]
-\definefonthandling [slanted] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
-\definefonthandling [italic] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
-\definefonthandling [boldslanted] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
-\definefonthandling [bolditalic] [punctuation,alpha,extended] [\c!type=\v!hanging,\c!right=1.5]
-
-% hz variants
-
-\definefonthandling [hz] [hz,extended] [\c!type=\v!hz] % min=20 max=20 step=5
-
-% combined variants
-
-\definefonthandling [quality] [hz,pure]
-\definefonthandling [highquality] [hz,normal]
-
-% noligs (xml) : \definefonthandling [default] [noligs]
-
-\definefonthandling [noligs] [noligs] [\c!type=tag]
-
-% experimental values !
-%
-% \definefontsynonym[myfont][Serif][handling=prespacing]
-% \definefont[whatever][myfont sa 1]
-% \setupalign[spacing]
-%
-% \whatever look at this: we now have a proper spacing feature and, hurray,
-% get rid of active punctuation!
-
-\startfonthandling [flexspacing]
-
- \definespacefactor : 0 1.25 .25 .25
-
- \definespacefactor , 0 1 .25 .25
- \inheritspacefactor ; ,
-
- \definespacefactor . 0 1.5 .25 .25
- \inheritspacefactor ! .
- \inheritspacefactor ? .
-
-\stopfonthandling
-
-\definefonthandling[flexspacing][flexspacing][\c!type=\v!spacing]
-
-\startfonthandling [prespacing] % better name needed
-
- \definespacefactor : .25 .25 0 0
- \inheritspacefactor ; :
- \inheritspacefactor ! :
- \inheritspacefactor ? :
-
-\stopfonthandling
-
-\definefonthandling[prespacing][prespacing][\c!type=\v!spacing] % factor=.5
-
-% A special case of guillemots, beware: when used ungrouped,
-% it overloads all successive (current) encoding vector
-% instances! Will be obsolete soon.
-
-\startfonthandling [glm]
-
- \overloadcharacter guilsingleleft {\defaultcharacter\guilsingleleft }
- \overloadcharacter guilsingleright {\defaultcharacter\guilsingleright}
- \overloadcharacter leftguillemot {\defaultcharacter\leftguillemot }
- \overloadcharacter rightguillemot {\defaultcharacter\rightguillemot }
-
-\stopfonthandling
-
-\definefonthandling [glm] [glm]
-
-\protect \endinput
diff --git a/tex/context/base/hand-ini.mkii b/tex/context/base/hand-ini.mkii
index 42d248df6..ac8a94696 100644
--- a/tex/context/base/hand-ini.mkii
+++ b/tex/context/base/hand-ini.mkii
@@ -16,22 +16,6 @@
\unprotect
-% messages moved
-
-% messages moved
-
-% messages moved
-
-% messages moved
-
-% messages moved
-
-% messages moved
-
-% messages moved
-
-% messages moved
-
\newif\iftracefonthandling % \tracefonthandlingtrue
\newif\ifskiphandlingdef \skiphandlingdeffalse
@@ -452,7 +436,7 @@
{\letvalueempty{\c!file\f!handlingprefix#1}%
\makeshortfilename[\truefilename{\f!handlingprefix#1}]%
\startreadingfile
- \readsysfile\shortfilename
+ \readsysfile{\shortfilename.mkii}
{\showmessage\m!handlings2{#1}}
{\showmessage\m!handlings3{#1}}%
\stopreadingfile}}
diff --git a/tex/context/base/java-fld.tex b/tex/context/base/java-fld.tex
index e6e5ee03a..4fdf41ce4 100644
--- a/tex/context/base/java-fld.tex
+++ b/tex/context/base/java-fld.tex
@@ -19,15 +19,7 @@
function Sanitized_TeX_String (value)
{ var v = value ;
- % v = v.replace(/\\\\\\/L/g,"\\225") ; % problematic
- % v = v.replace( /\\\\OE/g,"\\226") ; % problematic
- % v = v.replace( /\\\\vS/g,"\\227") ; % problematic
- % v = v.replace( /\\\\"Y/g,"\\230") ; % problematic
- % v = v.replace( /\\\\vZ/g,"\\231") ; % problematic
- % v = v.replace(/\\\\\\/l/g,"\\233") ; % problematic
v = v.replace( /\\\\oe/g,"\\234") ;
- % v = v.replace( /\\\\vs/g,"\\235") ; % problematic
- % v = v.replace( /\\\\vz/g,"\\236") ; % problematic
v = v.replace( /\\\\<>/g,"\\273") ;
v = v.replace( /\\\\`A/g,"\\300") ;
@@ -52,7 +44,6 @@
v = v.replace( /\\\\^O/g,"\\324") ;
v = v.replace( /\\\\~O/g,"\\325") ;
v = v.replace( /\\\\"O/g,"\\326") ;
- % v = v.replace(/\\\\\\/O/g,"\\330") ; % problematic
v = v.replace( /\\\\`U/g,"\\331") ;
v = v.replace( /\\\\'U/g,"\\332") ;
v = v.replace( /\\\\^U/g,"\\333") ;
@@ -81,7 +72,6 @@
v = v.replace( /\\\\^o/g,"\\364") ;
v = v.replace( /\\\\~o/g,"\\365") ;
v = v.replace( /\\\\"o/g,"\\366") ;
- % v = v.replace(/\\\\\\/o/g,"\\370") ; % problematic
v = v.replace( /\\\\`u/g,"\\371") ;
v = v.replace( /\\\\'u/g,"\\372") ;
v = v.replace( /\\\\^u/g,"\\373") ;
@@ -129,7 +119,7 @@
\startJSpreamble fields_1 used now
-var visible_field = new Array() ; % no garbage collection !
+var visible_field = new Array() ;
var visible_fields = 0 ;
function PresetFields ( )
@@ -140,13 +130,11 @@ function Preset_Fields ( )
function Hide_When_Down ( )
{ event.target.hidden = true }
-% { event.target.display = display.hidden }
function Hide_Field ( Name )
{ var v = this.getField(Name) ;
if (v)
{ v.hidden = true ;
- % { v.display = display.hidden ;
v.readonly = true ;
this.dirty = false } }
@@ -173,11 +161,11 @@ function Hide_Fields ()
{ Hide_Field(visible_field[visible_fields]) ;
--visible_fields } }
-function Vide_Fields ( Name ) % show only one field
+function Vide_Fields ( Name )
{ Hide_Fields () ;
Vide_Field ( Name) }
-function Vide_Hide_Fields ( Name ) % show only one field
+function Vide_Hide_Fields ( Name )
{ Hide_Fields () ;
Vide_Hide_Field ( Name) }
@@ -185,10 +173,6 @@ function Toggle_Hide ( Name )
{ var v = this.getField(Name) ;
if (v)
{ v.hidden = !v.hidden ;
- % if v.display == display.hidden
- % { v.display = display.visible }
- % else
- % { v.display = display.hidden }
this.dirty = false } }
function Field_On ( Name )
@@ -218,10 +202,6 @@ function Flip_Fields ( Name )
{ v = this.getField(Names[i]) ;
if (v)
{ v.hidden = !v.hidden ;
- % if v.display == display.hidden
- % { v.display = display.visible }
- % else
- % { v.display = display.hidden }
v.value = "On" } } }
function Forget_Changes ()
@@ -229,7 +209,6 @@ function Forget_Changes ()
function ForgetChanges ()
{ this.dirty = false }
-
\stopJSpreamble
%\startJScode{Hide_When_Down} Hide_When_Down() \stopJScode
diff --git a/tex/context/base/java-ini.lua b/tex/context/base/java-ini.lua
new file mode 100644
index 000000000..0fe7d3d29
--- /dev/null
+++ b/tex/context/base/java-ini.lua
@@ -0,0 +1,112 @@
+if not modules then modules = { } end modules ['java-ini'] = {
+ version = 1.001,
+ comment = "companion to java-ini.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+javascripts = javascripts or { }
+javascripts.codes = javascripts.codes or { }
+javascripts.preambles = javascripts.preambles or { }
+javascripts.functions = javascripts.functions or { }
+
+local codes, preambles, functions = javascripts.codes, javascripts.preambles, javascripts.functions
+
+local preambled = { }
+
+local function storefunction(s)
+ functions[s] = true
+end
+
+local uses = lpeg.P("uses")
+local used = lpeg.P("used")
+local left = lpeg.P("{")
+local right = lpeg.P("}")
+local space = lpeg.S(" \r\n")
+local spaces = space^0
+local braced = left * lpeg.C((1-right-space)^1) * right
+local unbraced = lpeg.C((1-space)^1)
+local name = spaces * (braced + unbraced) * spaces
+local any = lpeg.P(1)
+local script = lpeg.C(any^1)
+local funct = lpeg.P("function")
+local leftp = lpeg.P("(")
+local rightp = lpeg.P(")")
+local fname = spaces * funct * spaces * (((1-space-left)^1)/storefunction) * spaces * leftp
+
+local parsecode = name * ((uses * name) + lpeg.Cc("")) * spaces * script
+local parsepreamble = name * ((used * name) + lpeg.Cc("")) * spaces * script
+local parsefunctions = (fname + any)^0
+
+function javascripts.storecode(str)
+ local name, uses, script = parsecode:match(str)
+ if name and name ~= "" then
+ javascripts.codes[name] = { uses, script }
+ end
+end
+
+function javascripts.storepreamble(str) -- now later
+ local name, used, script = parsepreamble:match(str)
+ if name and name ~= "" then
+ preambles[#preambles+1] = { name, used, script }
+ preambled[name] = #preambles
+ parsefunctions:match(script)
+ end
+end
+
+function javascripts.setpreamble(name,script) -- now later
+ if name and name ~= "" then
+ preambles[#preambles+1] = { name, "now", script }
+ preambled[name] = #preambles
+ parsefunctions:match(script)
+ end
+end
+
+function javascripts.addtopreamble(name,script) -- now later
+ if name and name ~= "" then
+ local p = preambled[name]
+ if p then
+ preambles[p] = { "now", preambles[p] .. " ;\n" .. script }
+ else
+ preambles[#preambles+1] = { name, "now", script }
+ preambled[name] = #preambles
+ parsefunctions:match(script)
+ end
+ end
+end
+
+function javascripts.usepreamblenow(name) -- now later
+ if name and name ~= "" and preambled[name] then
+ preambles[preambled[name]][2] = "now"
+ end
+end
+
+function javascripts.code(name,arguments)
+ local c = codes[name]
+ if c then
+ local u, code = c[1], c[2]
+ if u ~= "" then
+ local p = preambled[u]
+ if p then
+ preambles[p][1] = "now"
+ end
+ end
+ return code
+ end
+ local f = functions[name]
+ if f then
+ return string.format("%s(%s)",name,arguments or "")
+ end
+end
+
+function javascripts.flushpreambles()
+ local t = { }
+ for i=1,#preambles do
+ local preamble = preambles[i]
+ if preamble[2] == "now" then
+ t[#t+1] = { preamble[1], preamble[3] }
+ end
+ end
+ return t
+end
diff --git a/tex/context/base/java-ini.mkiv b/tex/context/base/java-ini.mkiv
index 53c36d65f..6536ced48 100644
--- a/tex/context/base/java-ini.mkiv
+++ b/tex/context/base/java-ini.mkiv
@@ -13,47 +13,10 @@
\writestatus{loading}{ConTeXt JavaScript Macros / Initialization}
-% BUG: preamble zonder used/used en split
-
-% todo: lua sanitizer
-
-% JavaScript support is under development. In the near future
-% a slightly different model will be used. The JScode stuff
-% will probably become just auto function inclusion and the
-% JS_* things will disappear. First I have to find a way to
-% deal with global variables so the 'uses' thing will remain.
-
-% ook p{ref}
-% documentation should be corrected to JS(
-
-% Also, obeylines will be supported.
+\registerctxluafile{java-ini}{1.001}
\unprotect
-%D \JAVA\ support is not implemented as a generic support
-%D module. The main reason for this is that passing system
-%D variables to a \JAVASCRIPT\ is closely related to other core
-%D macros. First some messages:
-
-%D \TEX\ is not the right tool to check the \JAVA\ code; the
-%D most we can do is reporting some passed variables:
-
-\newif\iftraceJScode \traceJScodefalse
-
-\let\traceJScode\traceJScodetrue
-
-%D A bit out of place, but not dangerous:
-
-\bgroup
-\catcode127=\@@letter
-\gdef\delcharacter{^^7f}
-\egroup
-
-%D The number of passed variables is minimalized by setting the
-%D next switch.
-
-\newif\ifminimalizeJScode \minimalizeJScodetrue
-
%D \macros
%D {JS*}
%D
@@ -74,50 +37,7 @@
%D \starttyping
%D \goto{calculate total}[Sum(1.5,2.3)]
%D \stoptyping
-%D
-%D References are passed by using the \type{R{}} classifier.
-%D
-%D \starttyping
-%D \goto{calculate total}[Sum(1.5,2.3,R{overflow})]
-%D \stoptyping
-%D
-%D The last call calls the script \type{Sum} and passes the
-%D next set of variables:
-%D
-%D \starttyping
-%D JS_S_1="1.5";
-%D JS_S_2="2.3";
-%D JS_R_3="overflow";
-%D JS_P_3=3;
-%D \stoptyping
-%D
-%D The first two parameters are just strings, the third one
-%D however is treated as a reference and results in passing the
-%D reference (if needed this references is prefixed) and the
-%D (real) page number. The alternative:
-%D
-%D \starttyping
-%D \goto{calculate total}[JS(Sum{V{1.5},V{2.3},R{overflow}})]
-%D \stoptyping
-%D
-%D does a verbose passing:
-%D
-%D \starttyping
-%D JS_V_1=1.5;
-%D JS_V_2=2.3;
-%D JS_R_3="overflow";
-%D JS_P_3=3;
-%D \stoptyping
-% %D
-% %D Finally we have a counter that tells\JAVA\ how many
-% %D arguments were passed,
-% %D
-% %D \starttyping
-% %D JS_N
-% %D \stoptyping
-%D We will also support direct function calls. In that case
-%D no intermediate variables are used.
%D \macros
%D {startJScode}
@@ -125,32 +45,12 @@
%D A piece of \JAVASCRIPT\ code is defined by saying:
%D
%D \starttyping
-%D \startJScode{SomeScript}
-%D var Item=this.getField("item");
-%D N=Item.getArray();
-%D Total=this.getField("total");
-%D Total.value=0;
-%D for (j=0; j0) && (JS_R_1!=""))
-%D { gotoNamedDest(JS_R_1) };
-%D \stopJScode
-%D \stoptyping
-%D
-%D Such a piece of code is closely related to the interpreter
-%D used. Watch the last two lines, here the script adapts
-%D itself to the presence of a reference.
-%D
-%D While
-%D
-%D \starttyping
%D \startJScode{name}
%D name = 4 ;
%D \stopJScode
%D \stoptyping
%D
-%D assumes uses no preamble or presumes that the preamble is
+%D This assumes uses no preamble or presumes that the preamble is
%D always loaded, the next definition also tells \CONTEXT\ to
%D actually include the preamble needed.
%D
@@ -159,109 +59,9 @@
%D uses = 6 ;
%D \stopJScode
%D \stoptyping
-
-\long\def\startJScode#1 #2
- {\doifelse{#2}{uses}
- {\dostartJScodeA{#1}}
- {\dostartJScodeB{#1} #2 }}
-
-\long\def\dostartJScodeA#1#2 #3\stopJScode
- {\long\setgvalue{\r!java#1}{\do{#2}{#3}}}
-
-\long\def\dostartJScodeB#1#2\stopJScode
- {\long\setgvalue{\r!java#1}{\do{}{#2}}}
-
-\let\stopJScode\relax
-
-%D \macros
-%D {presetJScode}
-%D
-%D The code can be retrieved by saying
-%D
-%D \starttyping
-%D \presetJScode{SomeScript}{template}
-%D \stoptyping
%D
-%D Such a template is a comma separated list, where
-%D individual entries can optionally be transformed by
-%D \type{R{}} and \type{V{}}.
-%D
-%D After this call, the code is available in \type{\JScode}.
-
-\newif\ifdirectJScode
-
-\def\presetJScode#1#2% #1=operation #2=arguments
- {\setverbosecscharacters
- \def\par{\delcharacter}% was: { }
- \scratchcounter\zerocount
- \globallet\JScode\empty
- \def\do##1##2%
- {\doifelse{##2}{!}\directJScodetrue\directJScodefalse}%
- \getvalue{\r!java#1}%
- \edef\!!stringa{#2}%
- \ifx\!!stringa\empty \else
- \processcommacommand[\!!stringa]\dopresetJSvariables
- \fi
- \def\docommand##1%
- {\doifundefinedelse{\r!java\r!java##1}
- {\showmessage\m!javascript2{##1}}
- {\useJSpreamblenow{##1}}}%
-% {\doglobal\increment\currentJSpreamble
-% \doglobal\addtocommalist{##1}\allJSpreambles}}%
- \def\do##1##2%
- {\xdef\JScode{\ifdirectJScode#1(\JScode)\else\JScode##2\fi}%
- %\xdef\JScode{JS\string_N=\the\scratchcounter;\JScode}%
- \processcommalist[##1]\docommand}%
- \getvalue{\r!java#1}}
-
-\def\dopresetJSvariables#1%
- {\advance\scratchcounter \plusone
- \donefalse
- \dodopresetJSvariables#1\end}%
-
-\def\dodopresetJSvariables
- {\doifnextcharelse R\dodopresetJSrefvariables
- {\doifnextcharelse V\dodopresetJSvervariables
- {\doifnextcharelse S\dodopresetJSstrvariables
- \dodopresetJSrawvariables}}}
-
-\def\dodopresetJSrefvariables R#1\end
- {\doifreferencefoundelse{#1}
- {\donetrue \dododopresetJSvariables R{\referenceprefix#1}%
- \donefalse\dododopresetJSvariables P{\currentrealreference}}
- {\unknownreference{#1}}%
- \ifminimalizeJScode \else
- \donetrue\dododopresetJSvariables S{#1}%
- \fi}
-
-\def\dodopresetJSvervariables V#1\end
- {\donefalse\dododopresetJSvariables V{#1}%
- \ifminimalizeJScode \else
- \donetrue\dododopresetJSvariables S{#1}%
- \fi}
-
-\def\dodopresetJSstrvariables S#1\end
- {\donetrue\dododopresetJSvariables S{#1}}
-
-\def\dodopresetJSrawvariables #1\end
- {\donetrue\dododopresetJSvariables S{#1}}
-
-\def\JSprefix#1%
- {JS\string_#1\string_\the\scratchcounter}
-
-\def\dododopresetJSvariables#1#2%
- {\iftraceJScode
- \writestatus{JavaScript}{\JSprefix#1=#2}
- \xdef\JScode{\JScode console.println("\JSprefix#1=#2"); }%
- \fi
- \ifdirectJScode
- \xdef\JScode{\ifx\JScode\empty\else\JScode,\fi\ifdone"#2"\else#2\fi}%
- \else
- \xdef\JScode{\JScode\JSprefix#1=\ifdone"#2"\else#2\fi; }%
- \fi}
-
%D \macros
-%D {startJSpreamble, flushJSpreamble}
+%D {startJSpreamble}
%D
%D One can define insert \JAVASCRIPT\ code at the document level
%D by using:
@@ -291,365 +91,40 @@
%D
%D This command may be used more that once, but always before
%D the first page is shipped out.
-
-\newif\ifoneJSpreamble \oneJSpreamblefalse
-
-\let\allJSpreambles\empty
-\newcounter\nofJSpreambles
-\newcounter\currentJSpreamble
-
-\long\def\startJSpreamble#1 #2 %
- {\bgroup % we need to restore the catcodes
- \restoreendofline % just in case it happens while reading lists
- \doifelse{#2}{used}
- {\dostartJSpreamble#1 }
- {\dostartJSpreamble#1 now #2 }}
-
-\long\def\dostartJSpreamble#1 #2 %
- {\processaction
- [#2]
- [ later=>\chardef\JSstatus\zerocount,%
- now=>\chardef\JSstatus\plusone ,%
- \s!default=>\chardef\JSstatus\plustwo ,%
- \s!unknown=>\chardef\JSstatus\plustwo ]%
- \ifaddJSlinebreaks
- \obeylines \let\obeyedline \normalpar
- \obeyspaces \let\obeyedspace\normalspace
- \fi
- \dodostartJSpreamble{#1}}
-
-\long\def\dodostartJSpreamble#1#2\stopJSpreamble
- {\presetJSfunctions #2function ()\end
- \long\setgvalue{\r!java\r!java#1}{#2}%
- \ifcase\JSstatus \else
- \useJSpreamblenow{#1}%
- \fi
- \egroup}
-
+%D
%D \macros
%D {setJSpreamble, addtoJSpreamble}
%D
%D In addition to the previous preamble definitions, we can
%D set a preamble \quote {in||line} and add tokens to a
%D preamble.
-
-\def\setJSpreamble#1#2%
- {\doifundefined{\r!java\r!java#1}
- {\setgvalue{\r!java\r!java#1}{#2;}%
- \doglobal\increment\currentJSpreamble
- \doglobal\addtocommalist{#1}\allJSpreambles}}
-
-\def\addtoJSpreamble#1#2%
- {\doifdefinedelse{\r!java\r!java#1}
- {\edef\!!stringa{\r!java\r!java#1}%
- \edef\!!stringb{\csname\!!stringa\endcsname}%
- \@EA\setgvalue\@EA\!!stringa\@EA{\!!stringb #2;}}
- {\setJSpreamble{#1}{#2}}}
-
+%D
%D \macros
%D {useJSpreamblenow}
%D
-%D The next macro can be used to force inclusion of postponed
+%D This macro can be used to force inclusion of postponed
%D \JAVASCRIPT\ preambles.
-\def\useJSpreamblenow#1%
- {\doglobal\increment\currentJSpreamble
- \doglobal\addtocommalist{#1}\allJSpreambles}
-
-%D Because we want to check for valid calls, we preload the
-%D functions. This means that we can call them directly as
-%D well as indirectly when defined by \type {\startJScode} etc.
-
-% \long\def\presetJSfunctions#1function #2(#3)%
-% {\doifelsenothing{#2}
-% {\long\def\presetJSfunctions##1\end{}}
-% {\stripspaces\from#2\to\ascii
-% \doifundefined{\r!java\ascii}{\setgvalue{\r!java\ascii}{\do{}{!}}}}%
-% \presetJSfunctions}
-
-\long\def\presetJSfunctions#1function#2(#3)%
- {\doifelse{#2}\space
- {\long\def\presetJSfunctions##1\end{}}
- {\stripspaces\from#2\to\ascii
- \doifundefined{\r!java\ascii}{\setgvalue{\r!java\ascii}{\do{}{!}}}}%
- \presetJSfunctions}
-
-\def\getJSpreamble#1%
- {\getvalue{\r!java\r!java#1}}
+\unexpanded\def\startJScode
+ {\begingroup\obeylualines\obeyluatokens\dostartJScode}
-\def\presetJSpreamble
- {\ifx\allJSpreambles\empty\else
- \bgroup
- \setverbosecscharacters
- \obeyspaces \let\obeyedspace\normalspace
- \def\par{\delcharacter}% was: { }
- \globallet\JSpreamble\empty
- \def\@@collectedJSpreamble{\r!java\r!java collected}%
- \letvalue{\@@collectedJSpreamble}=\empty
- \def\docommand##1%
- {\xdef\JScode{\getvalue{\r!java\r!java##1}}%
- \ifoneJSpreamble % \global\letcdcsname
- \@EA\setxvalue\@EA\@@collectedJSpreamble\@EA
- {\csname\@@collectedJSpreamble\endcsname\JScode}%
- \else
- \setxvalue{\r!java\r!java##1}{\JScode}%
- \fi}%
- \processcommacommand[\allJSpreambles]\docommand
- \ifoneJSpreamble
- \gdef\allJSpreambles{collected}%
- \fi
- \globallet\presetJSpreamble\relax
- \egroup
- \fi}
+\long\def\dostartJScode#1\stopJScode
+ {\normalexpanded{\endgroup\ctxlua{javascripts.storecode(\!!bs#1\!!es)}}}
-\def\flushJSpreamble
- {\iflocation\ifx\allJSpreambles\empty\else
- \ifcase\nofJSpreambles\else\ifnum\nofJSpreambles=\currentJSpreamble
- \bgroup
- \presetJSpreamble
- \expanded{\doflushJSpreamble{\allJSpreambles}}%
- \globallet\flushJSpreamble\relax
- \globallet\allJSpreambles\empty
- \egroup
- \fi\fi
- \fi\fi}
-
-\def\finalflushJSpreamble
- {\iflocation
- \flushJSpreamble
- \ifcase\currentJSpreamble\relax\else
- \savecurrentvalue\nofJSpreambles\currentJSpreamble
- \globallet\currentJSpreamble\nofJSpreambles
- \fi
- \fi}
-
-%D \macros
-%D {doPSsanitizeJScode}
-%D
-%D Before the code can be passed to the (\POSTSCRIPT\ or \PDF)
-%D output file, some precautions must be made concerning the
-%D use of \type{(} and~\type{)}. Here we use a beautiful
-%D \type{\aftergroup} trick I discovered in the \TABLE\ format.
-
-\def\doPSsanitizeJScode#1\to#2%
- {\begingroup
- \scratchcounter\zerocount % \aftergroup counter
- \aftergroup\xdef
- \aftergroup#2%
- \aftergroup{%
- \expanded{\defconvertedargument\noexpand\JScode{#1}}%
- \expandafter\handletokens\JScode\with\dodoPSsanitizeJScode
- \aftergroup}%
- \endgroup
- \iftraceJScode
- \writestatus{JS trace}{#2}%
- \fi}
-
-%D I started with:
-%D
-%D \starttyping
-%D \def\dodoPSsanitizeJScode#1%
-%D {\aftergroup\string
-%D \if#1(%
-%D \expandafter\aftergroup\csname#1\endcsname
-%D \else\if#1)%
-%D \expandafter\aftergroup\csname#1\endcsname
-%D \else\if#1;%
-%D \aftergroup;\aftergroup\string\expandafter\aftergroup\
-%D \else
-%D \expandafter\aftergroup#1%
-%D \fi\fi\fi
-%D \advance\scratchcounter by 1
-%D \ifnum\scratchcounter=500
-%D \expandafter\dododoPSsanitizeJScode
-%D \fi}
-%D \stoptyping
-%D
-%D For pretty printing purposes, we need some way to signal
-%D \TEX\ macros. Therefore we introduce a special keyword
-%D \type{TEX}. When followed by a space, this keyword is
-%D ignored, that is, filtered from the stream. Now we have:
-
-\chardef\JSisTEX \zerocount
-\chardef\JScomment\zerocount
-
-\newif\ifaddJSlinebreaks \addJSlinebreakstrue
-
-\def\flushJSisTEX
- {\ifcase\JSisTEX
- \or \aftergroup T%
- \or \aftergroup T\aftergroup E%
- \or \aftergroup T\aftergroup E\aftergroup X%
- \fi
- \chardef\JSisTEX\zerocount}
-
-% \def\doJSlinebreak
-% {\ifaddJSlinebreaks
-% \aftergroup\string\aftergroup\n%
-% \fi}
-%
-% \def\dodoPSsanitizeJScode#1% % input stack>500 & TEX check
-% {\if#1/%
-% \ifnum\JScomment=0
-% \chardef\JScomment\plusone
-% \else\ifnum\JScomment=1
-% \chardef\JScomment\plustwo
-% \fi\fi
-% \else
-% \ifnum\JScomment=1
-% \aftergroup/%
-% \chardef\JScomment\zerocount
-% \fi
-% \ifnum\JScomment=2
-% \if#1\delcharacter
-% \chardef\JScomment\zerocount
-% \fi
-% \else
-% \if#1\delcharacter
-% \flushJSisTEX\doJSlinebreak
-% \else\if#1(%
-% \flushJSisTEX\aftergroup\string\expandafter\aftergroup\csname#1\endcsname
-% \else\if#1)%
-% \flushJSisTEX\aftergroup\string\expandafter\aftergroup\csname#1\endcsname
-% \else\if#1;%
-% \flushJSisTEX\aftergroup;\doJSlinebreak
-% \else\if#1T%
-% \ifnum\JSisTEX=0 \chardef\JSisTEX\plusone \else\flushJSisTEX\aftergroup T\fi
-% \else\if#1E%
-% \ifnum\JSisTEX=1 \chardef\JSisTEX\plustwo \else\flushJSisTEX\aftergroup E\fi
-% \else\if#1X%
-% \ifnum\JSisTEX=2 \chardef\JSisTEX\plusthree \else\flushJSisTEX\aftergroup X\fi
-% \else\if#1\normalspace
-% \ifnum\JSisTEX=3 \chardef\JSisTEX\zerocount \else\flushJSisTEX\aftergroup#1\fi
-% \else
-% \flushJSisTEX\aftergroup\string\expandafter\aftergroup#1%
-% \fi\fi\fi\fi\fi\fi\fi\fi
-% \fi
-% \fi
-% \dododoPSsanitizeJScode}
-
-% todo: "http:\\" -> simple. maar wel \" afvangen
-%
-% use new pdftex escape mechanism or make fully expandable version, not used that often btw
-
-\chardef\JSstring\zerocount
-
-\def\doJSlinebreak
- {\chardef\JScomment\zerocount
- \chardef\JSstring\zerocount
- \ifaddJSlinebreaks
- \aftergroup\string\aftergroup\n%
- \fi}
-
-\def\dodoPSsanitizeJScode#1% % input stack>500 & TEX check
- {\if#1/%
- \ifnum\JSstring=0
- \ifnum\JScomment=0
- \chardef\JScomment\plusone
- \else\ifnum\JScomment=1
- \chardef\JScomment\plustwo
- \fi\fi
- \else
- \aftergroup/%
- \fi
- \else
- \ifnum\JScomment=1
- \aftergroup/%
- \chardef\JScomment\zerocount
- \fi
- % is the delchar trick still needed?
- \ifnum\JScomment=2
- \ifnum`#1=13 % brrr
- \doJSlinebreak
- \else\if#1\par
- \doJSlinebreak
- \else\if#1\delcharacter
- \doJSlinebreak
- \fi\fi\fi
- \else
- \ifnum`#1=13 % brrr
- \flushJSisTEX\doJSlinebreak
- \else\if#1\par
- \flushJSisTEX\doJSlinebreak
- \else\if#1\delcharacter
- \flushJSisTEX\doJSlinebreak
- \else\if#1(%
- \flushJSisTEX\aftergroup\string\expandafter\aftergroup\csname#1\endcsname
- \else\if#1)%
- \flushJSisTEX\aftergroup\string\expandafter\aftergroup\csname#1\endcsname
- %\else\if#1;%
- % \flushJSisTEX\aftergroup;\doJSlinebreak
- \else\if#1T%
- \ifnum\JSisTEX=0 \chardef\JSisTEX\plusone \else\flushJSisTEX\aftergroup T\fi
- \else\if#1E%
- \ifnum\JSisTEX=1 \chardef\JSisTEX\plustwo \else\flushJSisTEX\aftergroup E\fi
- \else\if#1X%
- \ifnum\JSisTEX=2 \chardef\JSisTEX\plusthree \else\flushJSisTEX\aftergroup X\fi
- \else\if#1\normalspace
- \ifnum\JSisTEX=3 \chardef\JSisTEX\zerocount \else\flushJSisTEX\aftergroup#1\fi
- \else
- % todo: "test\"test"
- \if#1"%
- \ifcase\JSstring
- \chardef\JSstring\plusone
- \else
- \chardef\JSstring\zerocount
- \fi
- \fi
- \flushJSisTEX\aftergroup\string\expandafter\aftergroup#1%
- \fi\fi\fi\fi\fi\fi\fi\fi\fi % \fi
- \fi
- \fi
- \dododoPSsanitizeJScode}
-
-%D Close reading learns that one line comments (\type{// ...})
-%D are removed from the stream. This permits switching in
-%D pretty printing \JAVASCRIPT\ sources as well as saves
-%D some bytes.
-
-%D The magic 500 in the next hack prevents the input stack from
-%D overflowing when large scripts are sanitized.
-
-\def\dododoPSsanitizeJScode
- {\ifcase\JSisTEX\ifcase\JScomment
- \advance\scratchcounter \plusone
- \fi\fi
- \ifnum\scratchcounter=500
- \expandafter\dodododoPSsanitizeJScode
- \fi}
-
-\def\dodododoPSsanitizeJScode
- {\let\next={%
- \aftergroup}%
- \endgroup
- \begingroup
- \aftergroup\xdef
- \aftergroup\sanitizedJScode
- \aftergroup{%
- \aftergroup\sanitizedJScode
- \let\next=}}
+\let\stopJScode\relax
-%D The macro \type{\doPSsanitizeJScode} converts its argument
-%D into the macro \type{\sanitizedJScode}, thereby prefixing
-%D each \type{(} and \type{)} by a slash.
+\unexpanded\def\startJSpreamble
+ {\begingroup\obeylualines\obeyluatokens\dostartJSpreamble}
-%D Hooking this mechanism into the general \CONTEXT\ reference
-%D mechanism does not take much effort:
+\long\def\dostartJSpreamble#1\stopJSpreamble
+ {\normalexpanded{\endgroup\ctxlua{javascripts.storepreamble(\!!bs#1\!!es)}}}
-\definespecialtest{JS}%
- {\doifdefinedelse{\r!java\currentreferenceoperation}}
+\let\stopJSpreamble\relax
-\def\gotojavascriptspecial#1#2#3#4% special operation arguments data
- {\begingroup
- \iflocation
- \bgroup
- \presetJScode{#2}{#3}%
- \egroup
- \dohandlegoto{#4}{\dostartgotoJS\buttonwidth\buttonheight\JScode}{\dostopgotoJS}%
- \else
- #4%
- \fi
- \endgroup}
+\def\setJSpreamble #1#2{\ctxlua{javascripts.storepreamble ("#1",\!!bs#2\!!es)}}
+\def\addtoJSpreamble #1#2{\ctxlua{javascripts.addtopreamble ("#1",\!!bs#2\!!es)}}
+\def\useJSpreamblenow #1{\ctxlua{javascripts.usepreamblenow("#1")}}
+\def\finalflushJSpreamble{\iflocation\ctxlua{javascripts.flushpreambles()}\fi}
%D \macros
%D {useJSscripts}
@@ -669,14 +144,15 @@
\def\dodouseJSscripts#1%
{\doifelse{#1}\v!reset
{\let\allJSpreambles\empty}
- {\doifundefined{\c!file\f!javascriptprefix#1}
- {\startnointerference
- \letgvalueempty{\c!file\f!javascriptprefix#1}%
- \makeshortfilename[\f!javascriptprefix#1]%
- \startreadingfile
- \readsysfile\shortfilename{\showmessage\m!javascript1{#1}}\donothing
- \stopreadingfile
- \stopnointerference}}}
+ {\ifcsname\c!file\f!javascriptprefix#1\endcsname \else
+ \startnointerference
+ \letgvalueempty{\c!file\f!javascriptprefix#1}%
+ \makeshortfilename[\f!javascriptprefix#1]%
+ \startreadingfile
+ \readsysfile\shortfilename{\showmessage\m!javascript1{#1}}\donothing
+ \stopreadingfile
+ \stopnointerference
+ \fi}}
\def\douseJSscripts[#1][#2]%
{\processcommalist[#1]\dodouseJSscripts
diff --git a/tex/context/base/java-stp.tex b/tex/context/base/java-stp.tex
index fcb9d4f22..df4fbcc2f 100644
--- a/tex/context/base/java-stp.tex
+++ b/tex/context/base/java-stp.tex
@@ -11,13 +11,13 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\startJSpreamble Steps used now
+% we define ocglist global, otherwise we quickly run into a memory hog (even
+% out of memory in a 512 Meg machine)
- % we define ocglist global, otherwise we quickly run into a memory hog (even
- % out of memory in a 512 Meg machine)
+% we cannot use doc_visited[this.pageNum] instead of doc_currentstep because
+% of some funny side effect (i.e. dup or so)
- % we cannot use doc_visited[this.pageNum] instead of doc_currentstep because
- % of some funny side effect (i.e. dup or so)
+\startJSpreamble Steps used now
var doc_ocglist = this.getOCGs() ;
var doc_stepname = "step" ;
@@ -26,9 +26,6 @@
var doc_visited = new Array() ;
var doc_busy = new Array() ;
- % for some reason, this function is not seen in time (funny initialization
- % order again?) ...
-
function SetupStepper ( layername, laststep ) {
doc_stepname = layername ;
doc_maxstep = laststep ;
@@ -38,8 +35,6 @@
}
}
- % so, we do it the ugly way
-
for (var i=0; i<=this.numPages; i++) {
doc_visited[i] = 0 ;
doc_busy[i] = 0 ;
@@ -96,7 +91,6 @@
function InvokeStepper ( ) {
try {
-% console.println("INVOKE "+doc_currentstep+" "+doc_busy[this.pageNum]) ;
if (doc_currentstep
do
- function copy(old,tables)
+ local function copy(old,tables)
if old then
tables = tables or { }
local new = { }
diff --git a/tex/context/base/lang-ara.mkiv b/tex/context/base/lang-ara.mkiv
new file mode 100644
index 000000000..3c4d3c522
--- /dev/null
+++ b/tex/context/base/lang-ara.mkiv
@@ -0,0 +1,150 @@
+%D \module
+%D [ file=lang-ara,
+%D version=2008.06.20,
+%D title=\CONTEXT\ Language Macros,
+%D subtitle=Arabic Languages,
+%D author=Khaled Hosny,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Language Macros / Arabic Languages}
+
+\unprotect
+
+\definesystemconstant {arabic}
+\definesystemvariable {ar}
+
+\installlanguage
+ [\s!ar]
+ [\c!spacing=\v!broad,
+ \c!leftsentence=---,
+ \c!rightsentence=---,
+ \c!leftsubsentence=---,
+ \c!rightsubsentence=---,
+ \c!leftquote=\upperleftsinglesixquote,
+ \c!rightquote=\upperrightsingleninequote,
+ \c!leftquotation=\upperleftdoublesixquote,
+ \c!rightquotation=\upperrightdoubleninequote,
+ \c!date={\v!day,\ ,\v!month,{،\ },\v!year}]
+
+\installlanguage [\s!arabic] [\s!ar]
+
+% Just aliases to "ar" for now
+
+\installlanguage[\s!ar-ae][\c!default=\s!ar] % U.A.E.
+\installlanguage[\s!ar-bh][\c!default=\s!ar] % Bahrain
+\installlanguage[\s!ar-eg][\c!default=\s!ar] % Egypt
+\installlanguage[\s!ar-in][\c!default=\s!ar] % India?
+\installlanguage[\s!ar-kw][\c!default=\s!ar] % Kuwait
+\installlanguage[\s!ar-ly][\c!default=\s!ar] % Libya
+\installlanguage[\s!ar-om][\c!default=\s!ar] % Oman
+\installlanguage[\s!ar-qa][\c!default=\s!ar] % Qatar
+\installlanguage[\s!ar-sa][\c!default=\s!ar] % Saudi Arabia
+\installlanguage[\s!ar-sd][\c!default=\s!ar] % Sudan
+\installlanguage[\s!ar-tn][\c!default=\s!ar] % Tunisia
+\installlanguage[\s!ar-ye][\c!default=\s!ar] % Yemen
+
+% Syriac months
+
+\installlanguage[\s!ar-sy][\c!default=\s!ar] % Syria
+\installlanguage[\s!ar-iq][\c!default=\s!ar-sy] % Iraq
+\installlanguage[\s!ar-jo][\c!default=\s!ar-sy] % Jordan
+\installlanguage[\s!ar-lb][\c!default=\s!ar-sy] % Lebanon
+
+% Maghribi months
+
+\installlanguage[\s!ar-dz][\c!default=\s!ar] % Algeria
+\installlanguage[\s!ar-ma][\c!default=\s!ar] % Morocco
+
+\setupheadtext [\s!ar] [\v!content=المحتويات]
+\setupheadtext [\s!ar] [\v!tables=الجداول]
+\setupheadtext [\s!ar] [\v!figures=الأشكال]
+\setupheadtext [\s!ar] [\v!graphics=الرسوم]
+\setupheadtext [\s!ar] [\v!intermezzi=فسح]
+\setupheadtext [\s!ar] [\v!index=الفهرس]
+\setupheadtext [\s!ar] [\v!abbreviations=الاختصارات]
+\setupheadtext [\s!ar] [\v!logos=الشعارات]
+\setupheadtext [\s!ar] [\v!units=الوحدات]
+\setuplabeltext [\s!ar] [\v!table=جدول ]
+\setuplabeltext [\s!ar] [\v!figure=شكل ]
+\setuplabeltext [\s!ar] [\v!intermezzo=فسحة ]
+\setuplabeltext [\s!ar] [\v!graphic=رسم ]
+
+%D We don't set these here. One can do that in a style.
+
+\setuplabeltext [\s!ar] [\v!chapter=] % باب
+\setuplabeltext [\s!ar] [\v!section=] % فصل or قسم
+\setuplabeltext [\s!ar] [\v!subsection=] % فصل أدنى
+\setuplabeltext [\s!ar] [\v!subsubsection=] % فصل أ دنى أدنى
+\setuplabeltext [\s!ar] [\v!subsubsubsection=] % فصل أدنى أدنى أدنى
+\setuplabeltext [\s!ar] [\v!appendix=] % ملحق
+\setuplabeltext [\s!ar] [\v!part=جزء ]
+\setuplabeltext [\s!ar] [\v!line=سطر ]
+\setuplabeltext [\s!ar] [\v!lines=السطور ]
+
+\setuplabeltext [\s!ar] [\v!january=يناير]
+\setuplabeltext [\s!ar] [\v!february=فبراير]
+\setuplabeltext [\s!ar] [\v!march=مارس]
+\setuplabeltext [\s!ar] [\v!april=أبريل]
+\setuplabeltext [\s!ar] [\v!may=مايو]
+\setuplabeltext [\s!ar] [\v!june=يونيو]
+\setuplabeltext [\s!ar] [\v!july=يوليو]
+\setuplabeltext [\s!ar] [\v!august=أغسطس]
+\setuplabeltext [\s!ar] [\v!september=سبتمبر]
+\setuplabeltext [\s!ar] [\v!october=أكتوبر]
+\setuplabeltext [\s!ar] [\v!november=نوفمبر]
+\setuplabeltext [\s!ar] [\v!december=ديسمبر]
+
+\setuplabeltext [\s!ar-sy] [\v!january=كانون الثاني]
+\setuplabeltext [\s!ar-sy] [\v!february=شباط]
+\setuplabeltext [\s!ar-sy] [\v!march=آذار]
+\setuplabeltext [\s!ar-sy] [\v!april=نيسان]
+\setuplabeltext [\s!ar-sy] [\v!may=أيار]
+\setuplabeltext [\s!ar-sy] [\v!june=حزيران]
+\setuplabeltext [\s!ar-sy] [\v!july=تموز]
+\setuplabeltext [\s!ar-sy] [\v!august=آب]
+\setuplabeltext [\s!ar-sy] [\v!september=أيلول]
+\setuplabeltext [\s!ar-sy] [\v!october=تشرين الأول]
+\setuplabeltext [\s!ar-sy] [\v!november=تشرين الثاني]
+\setuplabeltext [\s!ar-sy] [\v!december=كانون الأول]
+
+\setuplabeltext [\s!ar-ma] [\v!may=ماي]
+\setuplabeltext [\s!ar-ma] [\v!july=يوليوز]
+\setuplabeltext [\s!ar-ma] [\v!august=غشت]
+\setuplabeltext [\s!ar-ma] [\v!september=شتنبر]
+\setuplabeltext [\s!ar-ma] [\v!november=نونبر]
+\setuplabeltext [\s!ar-ma] [\v!december=دجنبر]
+
+\setuplabeltext [\s!ar-dz] [\v!january=جانفي]
+\setuplabeltext [\s!ar-dz] [\v!february=فيفري]
+\setuplabeltext [\s!ar-dz] [\v!april=أفريل]
+\setuplabeltext [\s!ar-dz] [\v!may=ماي]
+\setuplabeltext [\s!ar-dz] [\v!june=جوان]
+\setuplabeltext [\s!ar-dz] [\v!july=جويلة]
+\setuplabeltext [\s!ar-dz] [\v!august=أوت]
+
+\setuplabeltext [\s!ar] [\v!sunday=الأحد]
+\setuplabeltext [\s!ar] [\v!monday=الاثنين]
+\setuplabeltext [\s!ar] [\v!tuesday=الثلاثاء]
+\setuplabeltext [\s!ar] [\v!wednesday=الأربعاء]
+\setuplabeltext [\s!ar] [\v!thursday=الخميس]
+\setuplabeltext [\s!ar] [\v!friday=الجمعة]
+\setuplabeltext [\s!ar] [\v!saturday=السبت]
+
+%D Rather new ...
+
+\setuplabeltext [\s!ar] [\v!page=صفحة ]
+\setuplabeltext [\s!ar] [\v!atpage=في صفحة ]
+\setuplabeltext [\s!ar] [\v!hencefore=كما وضحنا سابقا]
+\setuplabeltext [\s!ar] [\v!hereafter=كما نوضح لاحقا]
+\setuplabeltext [\s!ar] [\v!see=انظر ]
+
+%D ... and to be completed!
+
+%D \ShowAllLanguageValues [\s!ar] [arabic] {Arabic} {horn} % engelse humor
+
+\protect \endinput
diff --git a/tex/context/base/lang-ara.tex b/tex/context/base/lang-ara.tex
deleted file mode 100644
index 3c4d3c522..000000000
--- a/tex/context/base/lang-ara.tex
+++ /dev/null
@@ -1,150 +0,0 @@
-%D \module
-%D [ file=lang-ara,
-%D version=2008.06.20,
-%D title=\CONTEXT\ Language Macros,
-%D subtitle=Arabic Languages,
-%D author=Khaled Hosny,
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Language Macros / Arabic Languages}
-
-\unprotect
-
-\definesystemconstant {arabic}
-\definesystemvariable {ar}
-
-\installlanguage
- [\s!ar]
- [\c!spacing=\v!broad,
- \c!leftsentence=---,
- \c!rightsentence=---,
- \c!leftsubsentence=---,
- \c!rightsubsentence=---,
- \c!leftquote=\upperleftsinglesixquote,
- \c!rightquote=\upperrightsingleninequote,
- \c!leftquotation=\upperleftdoublesixquote,
- \c!rightquotation=\upperrightdoubleninequote,
- \c!date={\v!day,\ ,\v!month,{،\ },\v!year}]
-
-\installlanguage [\s!arabic] [\s!ar]
-
-% Just aliases to "ar" for now
-
-\installlanguage[\s!ar-ae][\c!default=\s!ar] % U.A.E.
-\installlanguage[\s!ar-bh][\c!default=\s!ar] % Bahrain
-\installlanguage[\s!ar-eg][\c!default=\s!ar] % Egypt
-\installlanguage[\s!ar-in][\c!default=\s!ar] % India?
-\installlanguage[\s!ar-kw][\c!default=\s!ar] % Kuwait
-\installlanguage[\s!ar-ly][\c!default=\s!ar] % Libya
-\installlanguage[\s!ar-om][\c!default=\s!ar] % Oman
-\installlanguage[\s!ar-qa][\c!default=\s!ar] % Qatar
-\installlanguage[\s!ar-sa][\c!default=\s!ar] % Saudi Arabia
-\installlanguage[\s!ar-sd][\c!default=\s!ar] % Sudan
-\installlanguage[\s!ar-tn][\c!default=\s!ar] % Tunisia
-\installlanguage[\s!ar-ye][\c!default=\s!ar] % Yemen
-
-% Syriac months
-
-\installlanguage[\s!ar-sy][\c!default=\s!ar] % Syria
-\installlanguage[\s!ar-iq][\c!default=\s!ar-sy] % Iraq
-\installlanguage[\s!ar-jo][\c!default=\s!ar-sy] % Jordan
-\installlanguage[\s!ar-lb][\c!default=\s!ar-sy] % Lebanon
-
-% Maghribi months
-
-\installlanguage[\s!ar-dz][\c!default=\s!ar] % Algeria
-\installlanguage[\s!ar-ma][\c!default=\s!ar] % Morocco
-
-\setupheadtext [\s!ar] [\v!content=المحتويات]
-\setupheadtext [\s!ar] [\v!tables=الجداول]
-\setupheadtext [\s!ar] [\v!figures=الأشكال]
-\setupheadtext [\s!ar] [\v!graphics=الرسوم]
-\setupheadtext [\s!ar] [\v!intermezzi=فسح]
-\setupheadtext [\s!ar] [\v!index=الفهرس]
-\setupheadtext [\s!ar] [\v!abbreviations=الاختصارات]
-\setupheadtext [\s!ar] [\v!logos=الشعارات]
-\setupheadtext [\s!ar] [\v!units=الوحدات]
-\setuplabeltext [\s!ar] [\v!table=جدول ]
-\setuplabeltext [\s!ar] [\v!figure=شكل ]
-\setuplabeltext [\s!ar] [\v!intermezzo=فسحة ]
-\setuplabeltext [\s!ar] [\v!graphic=رسم ]
-
-%D We don't set these here. One can do that in a style.
-
-\setuplabeltext [\s!ar] [\v!chapter=] % باب
-\setuplabeltext [\s!ar] [\v!section=] % فصل or قسم
-\setuplabeltext [\s!ar] [\v!subsection=] % فصل أدنى
-\setuplabeltext [\s!ar] [\v!subsubsection=] % فصل أ دنى أدنى
-\setuplabeltext [\s!ar] [\v!subsubsubsection=] % فصل أدنى أدنى أدنى
-\setuplabeltext [\s!ar] [\v!appendix=] % ملحق
-\setuplabeltext [\s!ar] [\v!part=جزء ]
-\setuplabeltext [\s!ar] [\v!line=سطر ]
-\setuplabeltext [\s!ar] [\v!lines=السطور ]
-
-\setuplabeltext [\s!ar] [\v!january=يناير]
-\setuplabeltext [\s!ar] [\v!february=فبراير]
-\setuplabeltext [\s!ar] [\v!march=مارس]
-\setuplabeltext [\s!ar] [\v!april=أبريل]
-\setuplabeltext [\s!ar] [\v!may=مايو]
-\setuplabeltext [\s!ar] [\v!june=يونيو]
-\setuplabeltext [\s!ar] [\v!july=يوليو]
-\setuplabeltext [\s!ar] [\v!august=أغسطس]
-\setuplabeltext [\s!ar] [\v!september=سبتمبر]
-\setuplabeltext [\s!ar] [\v!october=أكتوبر]
-\setuplabeltext [\s!ar] [\v!november=نوفمبر]
-\setuplabeltext [\s!ar] [\v!december=ديسمبر]
-
-\setuplabeltext [\s!ar-sy] [\v!january=كانون الثاني]
-\setuplabeltext [\s!ar-sy] [\v!february=شباط]
-\setuplabeltext [\s!ar-sy] [\v!march=آذار]
-\setuplabeltext [\s!ar-sy] [\v!april=نيسان]
-\setuplabeltext [\s!ar-sy] [\v!may=أيار]
-\setuplabeltext [\s!ar-sy] [\v!june=حزيران]
-\setuplabeltext [\s!ar-sy] [\v!july=تموز]
-\setuplabeltext [\s!ar-sy] [\v!august=آب]
-\setuplabeltext [\s!ar-sy] [\v!september=أيلول]
-\setuplabeltext [\s!ar-sy] [\v!october=تشرين الأول]
-\setuplabeltext [\s!ar-sy] [\v!november=تشرين الثاني]
-\setuplabeltext [\s!ar-sy] [\v!december=كانون الأول]
-
-\setuplabeltext [\s!ar-ma] [\v!may=ماي]
-\setuplabeltext [\s!ar-ma] [\v!july=يوليوز]
-\setuplabeltext [\s!ar-ma] [\v!august=غشت]
-\setuplabeltext [\s!ar-ma] [\v!september=شتنبر]
-\setuplabeltext [\s!ar-ma] [\v!november=نونبر]
-\setuplabeltext [\s!ar-ma] [\v!december=دجنبر]
-
-\setuplabeltext [\s!ar-dz] [\v!january=جانفي]
-\setuplabeltext [\s!ar-dz] [\v!february=فيفري]
-\setuplabeltext [\s!ar-dz] [\v!april=أفريل]
-\setuplabeltext [\s!ar-dz] [\v!may=ماي]
-\setuplabeltext [\s!ar-dz] [\v!june=جوان]
-\setuplabeltext [\s!ar-dz] [\v!july=جويلة]
-\setuplabeltext [\s!ar-dz] [\v!august=أوت]
-
-\setuplabeltext [\s!ar] [\v!sunday=الأحد]
-\setuplabeltext [\s!ar] [\v!monday=الاثنين]
-\setuplabeltext [\s!ar] [\v!tuesday=الثلاثاء]
-\setuplabeltext [\s!ar] [\v!wednesday=الأربعاء]
-\setuplabeltext [\s!ar] [\v!thursday=الخميس]
-\setuplabeltext [\s!ar] [\v!friday=الجمعة]
-\setuplabeltext [\s!ar] [\v!saturday=السبت]
-
-%D Rather new ...
-
-\setuplabeltext [\s!ar] [\v!page=صفحة ]
-\setuplabeltext [\s!ar] [\v!atpage=في صفحة ]
-\setuplabeltext [\s!ar] [\v!hencefore=كما وضحنا سابقا]
-\setuplabeltext [\s!ar] [\v!hereafter=كما نوضح لاحقا]
-\setuplabeltext [\s!ar] [\v!see=انظر ]
-
-%D ... and to be completed!
-
-%D \ShowAllLanguageValues [\s!ar] [arabic] {Arabic} {horn} % engelse humor
-
-\protect \endinput
diff --git a/tex/context/base/lang-chi.mkii b/tex/context/base/lang-chi.mkii
new file mode 100644
index 000000000..278e10745
--- /dev/null
+++ b/tex/context/base/lang-chi.mkii
@@ -0,0 +1,305 @@
+%D \module
+%D [ file=lang-chi,
+%D version=2002.06.25, % 1998.10.10,
+%D title=\CONTEXT\ Language Macros,
+%D subtitle=Chinese,
+%D author={Hans Hagen \& Wang Lei},
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Language Macros / Chinese}
+
+%D This module is coded using the \UNICODE\ support built in
+%D \CONTEXT. Therefore, \type {\uchar} is used instead of latin
+%D characters.
+
+\unprotect
+
+\definesystemconstant {chinese} \definesystemconstant {cn}
+
+\installlanguage
+ [\s!cn]
+ [\c!leftsentence=\cnencoding\cnleftsentence,
+ \c!rightsentence=\cnencoding\cnrightsentence,
+ \c!leftsubsentence=\cnencoding\cnleftsubsentence,
+ \c!rightsubsentence=\cnencoding\cnrightsubsentence,
+ \c!leftquote=\cnencoding\cnupperleftsinglequote,
+ \c!rightquote=\cnencoding\cnupperrightsinglequote,
+ \c!leftquotation=\cnencoding\cnupperleftdoublequote,
+ \c!rightquotation=\cnencoding\cnupperrightdoublequote,
+ \c!date={\v!year,\cnyear,\ ,\v!month,\v!day,\cnday}]
+
+\setupheadtext [\s!cn] [\v!content={\cnencoding\cnencodedcontents}]
+\setupheadtext [\s!cn] [\v!tables={\cnencoding\cnencodedtables}]
+\setupheadtext [\s!cn] [\v!figures={\cnencoding\cnencodedfigures}]
+\setupheadtext [\s!cn] [\v!graphics={\cnencoding\cnencodedgraphics}]% RG & XJF
+\setupheadtext [\s!cn] [\v!intermezzi={\cnencoding\cnencodedintermezzo}]% RG & XJF
+\setupheadtext [\s!cn] [\v!index={\cnencoding\cnencodedindex}]
+\setupheadtext [\s!cn] [\v!abbreviations={\cnencoding\cnencodedabbreviations}]
+\setupheadtext [\s!cn] [\v!logos={\cnencoding\cnencodedlogos}]
+\setupheadtext [\s!cn] [\v!units={\cnencoding\cnencodedunits}]
+
+\setuplabeltext [\s!cn] [\v!table={\cnencoding\cnencodedtable}]
+\setuplabeltext [\s!cn] [\v!figure={\cnencoding\cnencodedfigure}]
+\setuplabeltext [\s!cn] [\v!intermezzo={\cnencoding\cnencodedintermezzo}]% RG & XJF
+\setuplabeltext [\s!cn] [\v!graphic={\cnencoding\cnencodedillustration}]% RG & XJF
+\setuplabeltext [\s!cn] [\v!appendix={\cnencoding\cnencodedappendix}]% RG
+\setuplabeltext [\s!cn] [\v!part={\cnencoding\cnencodedintro,\cnencoding\cnencodedpart}]
+\setuplabeltext [\s!cn] [\v!chapter={\cnencoding\cnencodedintro,\cnencoding\cnencodedchapter}]
+\setuplabeltext [\s!cn] [\v!section={\cnencoding\cnencodedintro,\cnencoding\cnencodedsection}]
+\setuplabeltext [\s!cn] [\v!line={\cnencoding\cnencodedline}]% RG & XJF
+\setuplabeltext [\s!cn] [\v!lines={\cnencoding\cnencodedline}]% RG & XJF
+
+\setuplabeltext [\s!cn] [\v!subsection=]
+\setuplabeltext [\s!cn] [\v!subsubsection=]
+\setuplabeltext [\s!cn] [\v!subsubsubsection=]
+
+%D From this definition one can deduce that language, input
+%D encoding, font encoding, and glyph meaning form a pretty
+%D complex four dimensional space.
+
+\startlanguagespecifics[\s!cn]
+
+\setuplabeltext [\s!cn] [\v!january=\cnencoding\cnencodedjanuary ]
+\setuplabeltext [\s!cn] [\v!february=\cnencoding\cnencodedfebrary ]
+\setuplabeltext [\s!cn] [\v!march=\cnencoding\cnencodedmarch ]
+\setuplabeltext [\s!cn] [\v!april=\cnencoding\cnencodedapril ]
+\setuplabeltext [\s!cn] [\v!may=\cnencoding\cnencodedmay ]
+\setuplabeltext [\s!cn] [\v!june=\cnencoding\cnencodedjune ]
+\setuplabeltext [\s!cn] [\v!july=\cnencoding\cnencodedjuly ]
+\setuplabeltext [\s!cn] [\v!august=\cnencoding\cnencodedaugust ]
+\setuplabeltext [\s!cn] [\v!september=\cnencoding\cnencodedseptember]
+\setuplabeltext [\s!cn] [\v!october=\cnencoding\cnencodedoctober ]
+\setuplabeltext [\s!cn] [\v!november=\cnencoding\cnencodednovember ]
+\setuplabeltext [\s!cn] [\v!december=\cnencoding\cnencodeddecember ]
+
+\setuplabeltext [\s!cn] [\v!sunday=\cnencoding\cnencodedsunday ]
+\setuplabeltext [\s!cn] [\v!monday=\cnencoding\cnencodedmonday ]
+\setuplabeltext [\s!cn] [\v!tuesday=\cnencoding\cnencodedtuesday ]
+\setuplabeltext [\s!cn] [\v!wednesday=\cnencoding\cnencodedwednesday]
+\setuplabeltext [\s!cn] [\v!thursday=\cnencoding\cnencodedthursday ]
+\setuplabeltext [\s!cn] [\v!friday=\cnencoding\cnencodedfriday ]
+\setuplabeltext [\s!cn] [\v!saturday=\cnencoding\cnencodedsaturday ]
+
+\stoplanguagespecifics
+
+%D One can specify a split labeltext, as demonstrated in
+%D the definition of the \type {part} label. Unfortunately
+%D the glyphs of both part depend on the encoding. Therefore,
+%D we have an encoding section here.
+
+\unexpanded\def\cnencoding{\enableencoding[\chineseencoding]} % ugly and temporary
+
+\startencoding[cjk-uni]
+ \definecommand cnleftsentence {\uchar{32}{20}\uchar{32}{20}}
+ \definecommand cnrightsentence {\uchar{32}{20}\uchar{32}{20}}
+ \definecommand cnleftsubsentence {\uchar{32}{20}\uchar{32}{20}}
+ \definecommand cnrightsubsentence {\uchar{32}{20}\uchar{32}{20}}
+ \definecommand cnupperleftsinglequote {\uchar{32}{24}}
+ \definecommand cnupperrightsinglequote {\uchar{32}{25}}
+ \definecommand cnupperleftdoublequote {\uchar{32}{28}}
+ \definecommand cnupperrightdoublequote {\uchar{32}{29}}
+ \definecommand cnupperleftsinglequote-v {\uchar{48}{12}}
+ \definecommand cnupperrightsinglequote-v {\uchar{48}{13}}
+ \definecommand cnupperleftdoublequote-v {\uchar{48}{14}}
+ \definecommand cnupperrightdoublequote-v {\uchar{48}{15}}
+ \definecommand cnencodedcontents {\uchar{118}{238}\uchar{95}{85}}
+ \definecommand cnencodedtables {\uchar{136}{104}\uchar{104}{60}}
+ \definecommand cnencodedfigures {\uchar{86}{254}\uchar{95}{98}}
+ \definecommand cnencodedindex {\uchar{125}{34}\uchar{95}{21}}
+ \definecommand cnencodedabbreviations {\uchar{127}{41}\uchar{117}{101}\uchar{139}{237}}
+ \definecommand cnencodedlogos {\uchar{95}{189}\uchar{141}{44}}
+ \definecommand cnencodedunits {\uchar{139}{161}\uchar{145}{207}\uchar{83}{85}\uchar{79}{77}}
+ \definecommand cnencodedtable {\uchar{136}{104}}
+ \definecommand cnencodedfigure {\uchar{86}{254}}
+ \definecommand cnencodedintro {\uchar{123}{44}}
+ \definecommand cnencodedpart {\uchar{144}{232}\uchar{82}{6}}
+ \definecommand cnencodedchapter {\uchar{122}{224}}
+ \definecommand cnencodedsection {\uchar{130}{130}}
+ \definecommand cnencodedjanuary {\uchar{78}{0}\uchar{103}{8}}
+ \definecommand cnencodedfebrary {\uchar{78}{140}\uchar{103}{8}}
+ \definecommand cnencodedmarch {\uchar{78}{9}\uchar{103}{8}}
+ \definecommand cnencodedapril {\uchar{86}{219}\uchar{103}{8}}
+ \definecommand cnencodedmay {\uchar{78}{148}\uchar{103}{8}}
+ \definecommand cnencodedjune {\uchar{81}{109}\uchar{103}{8}}
+ \definecommand cnencodedjuly {\uchar{78}{3}\uchar{103}{8}}
+ \definecommand cnencodedaugust {\uchar{81}{107}\uchar{103}{8}}
+ \definecommand cnencodedseptember {\uchar{78}{93}\uchar{103}{8}}
+ \definecommand cnencodedoctober {\uchar{83}{65}\uchar{103}{8}}
+ \definecommand cnencodednovember {\uchar{83}{65}\uchar{78}{0}\uchar{103}{8}}
+ \definecommand cnencodeddecember {\uchar{83}{65}\uchar{78}{140}\uchar{103}{8}}
+ \definecommand cnencodedsunday {\uchar{102}{31}\uchar{103}{31}\uchar{101}{229}}
+ \definecommand cnencodedmonday {\uchar{102}{31}\uchar{103}{31}\uchar{78}{0}}
+ \definecommand cnencodedtuesday {\uchar{102}{31}\uchar{103}{31}\uchar{78}{140}}
+ \definecommand cnencodedwednesday {\uchar{102}{31}\uchar{103}{31}\uchar{78}{9}}
+ \definecommand cnencodedthursday {\uchar{102}{31}\uchar{103}{31}\uchar{86}{219}}
+ \definecommand cnencodedfriday {\uchar{102}{31}\uchar{103}{31}\uchar{78}{148}}
+ \definecommand cnencodedsaturday {\uchar{102}{31}\uchar{103}{31}\uchar{81}{109}}
+ % RG & XJF
+ \definecommand cnencodedgraphics {\uchar{86}{254}}
+ \definecommand cnencodedintermezzo {\uchar{210}{99}\uchar{242}{102}}
+ \definecommand cnencodedillustration {\uchar{99}{210}\uchar{86}{254}}
+ \definecommand cnencodedappendix {\uchar{150}{68}\uchar{95}{85}}
+ \definecommand cnencodedline {\uchar{136}{76}}
+ % Tobias Burnus & XJF
+ \definecommand cnyear {\uchar{94}{116}}
+ \definecommand cnmonth {\uchar{103}{8}}
+ \definecommand cnday {\uchar{101}{229}}
+\stopencoding
+
+\startencoding[gbk]
+ \definecommand cnleftsentence {\uchar{161}{170}\uchar{161}{170}}
+ \definecommand cnrightsentence {\uchar{161}{170}\uchar{161}{170}}
+ \definecommand cnleftsubsentence {\uchar{161}{170}\uchar{161}{170}}
+ \definecommand cnrightsubsentence {\uchar{161}{170}\uchar{161}{170}}
+ \definecommand cnupperleftsinglequote {\uchar{161}{174}}
+ \definecommand cnupperrightsinglequote {\uchar{161}{175}}
+ \definecommand cnupperleftdoublequote {\uchar{161}{176}}
+ \definecommand cnupperrightdoublequote {\uchar{161}{177}}
+ \definecommand cnupperleftsinglequote-v {\uchar{161}{184}}
+ \definecommand cnupperrightsinglequote-v {\uchar{161}{185}}
+ \definecommand cnupperleftdoublequote-v {\uchar{161}{186}}
+ \definecommand cnupperrightdoublequote-v {\uchar{161}{187}}
+ \definecommand cnencodedcontents {\uchar{196}{191}\uchar{194}{188}}
+ \definecommand cnencodedtables {\uchar{177}{237}\uchar{184}{241}}
+ \definecommand cnencodedfigures {\uchar{205}{188}\uchar{208}{206}}
+ \definecommand cnencodedindex {\uchar{203}{247}\uchar{210}{253}}
+ \definecommand cnencodedabbreviations {\uchar{203}{245}\uchar{194}{212}\uchar{211}{239}}
+ \definecommand cnencodedlogos {\uchar{187}{213}\uchar{177}{225}}
+ \definecommand cnencodedunits {\uchar{188}{198}\uchar{193}{191}\uchar{181}{165}\uchar{206}{187}}
+ \definecommand cnencodedtable {\uchar{177}{237}}
+ \definecommand cnencodedfigure {\uchar{205}{188}}
+ \definecommand cnencodedintro {\uchar{181}{218}}
+ \definecommand cnencodedpart {\uchar{178}{191}\uchar{183}{214}}
+ \definecommand cnencodedchapter {\uchar{213}{194}}
+ \definecommand cnencodedsection {\uchar{189}{218}}
+ \definecommand cnencodedjanuary {\uchar{210}{187}\uchar{212}{194}}
+ \definecommand cnencodedfebrary {\uchar{182}{254}\uchar{212}{194}}
+ \definecommand cnencodedmarch {\uchar{200}{253}\uchar{212}{194}}
+ \definecommand cnencodedapril {\uchar{203}{196}\uchar{212}{194}}
+ \definecommand cnencodedmay {\uchar{206}{229}\uchar{212}{194}}
+ \definecommand cnencodedjune {\uchar{193}{249}\uchar{212}{194}}
+ \definecommand cnencodedjuly {\uchar{198}{223}\uchar{212}{194}}
+ \definecommand cnencodedaugust {\uchar{176}{203}\uchar{212}{194}}
+ \definecommand cnencodedseptember {\uchar{190}{197}\uchar{212}{194}}
+ \definecommand cnencodedoctober {\uchar{202}{174}\uchar{212}{194}}
+ \definecommand cnencodednovember {\uchar{202}{174}\uchar{210}{187}\uchar{212}{194}}
+ \definecommand cnencodeddecember {\uchar{202}{174}\uchar{182}{254}\uchar{212}{194}}
+ \definecommand cnencodedsunday {\uchar{208}{199}\uchar{198}{218}\uchar{200}{213}}
+ \definecommand cnencodedmonday {\uchar{208}{199}\uchar{198}{218}\uchar{210}{187}}
+ \definecommand cnencodedtuesday {\uchar{208}{199}\uchar{198}{218}\uchar{182}{254}}
+ \definecommand cnencodedwednesday {\uchar{208}{199}\uchar{198}{218}\uchar{200}{253}}
+ \definecommand cnencodedthursday {\uchar{208}{199}\uchar{198}{218}\uchar{203}{196}}
+ \definecommand cnencodedfriday {\uchar{208}{199}\uchar{198}{218}\uchar{206}{229}}
+ \definecommand cnencodedsaturday {\uchar{208}{199}\uchar{198}{218}\uchar{193}{249}}
+ % RG & XJF
+ \definecommand cnencodedgraphics {\uchar{205}{188}}
+ \definecommand cnencodedintermezzo {\uchar{178}{229}\uchar{199}{250}}
+ \definecommand cnencodedillustration {\uchar{178}{229}\uchar{205}{188}}
+ \definecommand cnencodedappendix {\uchar{184}{189}\uchar{194}{188}}
+ \definecommand cnencodedline {\uchar{208}{208}}
+ % Tobias Burnus & XJF
+ \definecommand cnyear {\uchar{196}{234}}
+ \definecommand cnmonth {\uchar{212}{194}}
+ \definecommand cnday {\uchar{200}{213}}
+\stopencoding
+
+\startencoding[big5]
+ \definecommand cnleftsentence {\uchar{162}{119}\uchar{162}{119}}
+ \definecommand cnrightsentence {\uchar{162}{119}\uchar{162}{119}}
+ \definecommand cnleftsubsentence {\uchar{162}{119}\uchar{162}{119}}
+ \definecommand cnrightsubsentence {\uchar{162}{119}\uchar{162}{119}}
+ \definecommand cnupperleftsinglequote {\uchar{161}{165}}
+ \definecommand cnupperrightsinglequote {\uchar{161}{166}}
+ \definecommand cnupperleftdoublequote {\uchar{161}{167}}
+ \definecommand cnupperrightdoublequote {\uchar{161}{168}}
+ \definecommand cnupperleftsinglequote-v {\uchar{161}{117}}
+ \definecommand cnupperrightsinglequote-v {\uchar{161}{118}}
+ \definecommand cnupperleftdoublequote-v {\uchar{161}{121}}
+ \definecommand cnupperrightdoublequote-v {\uchar{161}{122}}
+ \definecommand cnencodecontents {\uchar{165}{216}\uchar{191}{253}}
+ \definecommand cnencodetables {\uchar{170}{237}\uchar{174}{230}}
+ \definecommand cnencodefigures {\uchar{185}{207}\uchar{167}{206}}
+ \definecommand cnencodeindex {\uchar{175}{193}\uchar{174}{222}}
+ \definecommand cnencodeabbreviations {\uchar{191}{89}\uchar{178}{164}\uchar{187}{121}}
+ \definecommand cnencodelogos {\uchar{192}{178}\uchar{188}{208}}
+ \definecommand cnencodeunits {\uchar{173}{112}\uchar{182}{113}\uchar{179}{230}\uchar{166}{236}}
+ \definecommand cnencodetable {\uchar{170}{237}}
+ \definecommand cnencodefigure {\uchar{185}{207}}
+ \definecommand cnencodedintro {\uchar{178}{196}}
+ \definecommand cnencodedpart {\uchar{179}{161}\uchar{164}{192}}
+ \definecommand cnencodedchapter {\uchar{179}{185}}
+ \definecommand cnencodedsection {\uchar{184} {96}}
+ \definecommand cnencodedjanuary {\uchar{164} {64}\uchar{164}{235}}
+ \definecommand cnencodedfebrary {\uchar{164} {71}\uchar{164}{235}}
+ \definecommand cnencodedmarch {\uchar{164} {84}\uchar{164}{235}}
+ \definecommand cnencodedapril {\uchar{165}{124}\uchar{164}{235}}
+ \definecommand cnencodedmay {\uchar{164}{173}\uchar{164}{235}}
+ \definecommand cnencodedjune {\uchar{164}{187}\uchar{164}{235}}
+ \definecommand cnencodedjuly {\uchar{164} {67}\uchar{164}{235}}
+ \definecommand cnencodedaugust {\uchar{164} {75}\uchar{164}{235}}
+ \definecommand cnencodedseptember {\uchar{164} {69}\uchar{164}{235}}
+ \definecommand cnencodedoctober {\uchar{164} {81}\uchar{164}{235}}
+ \definecommand cnencodednovember {\uchar{164} {81}\uchar{164} {64}\uchar{164}{235}}
+ \definecommand cnencodeddecember {\uchar{164} {81}\uchar{164} {71}\uchar{164}{235}}
+ \definecommand cnencodedsunday {\uchar{172} {80}\uchar{180}{193}\uchar{164}{233}}
+ \definecommand cnencodedmonday {\uchar{172} {80}\uchar{180}{193}\uchar{164} {64}}
+ \definecommand cnencodedtuesday {\uchar{172} {80}\uchar{180}{193}\uchar{164} {71}}
+ \definecommand cnencodedwednesday {\uchar{172} {80}\uchar{180}{193}\uchar{164} {84}}
+ \definecommand cnencodedthursday {\uchar{172} {80}\uchar{180}{193}\uchar{165}{124}}
+ \definecommand cnencodedfriday {\uchar{172} {80}\uchar{180}{193}\uchar{164}{173}}
+ \definecommand cnencodedsaturday {\uchar{172} {80}\uchar{180}{193}\uchar{164}{187}}
+ % Tobias Burnus &\XJF
+ \definecommand cnyear {\uchar{166}{126}}
+ \definecommand cnmonth {\uchar{164}{235}}
+ \definecommand cnday {\uchar{164}{233}}
+
+% Traditional Chinese characters (only where they differ to the
+% simplified ones) for lang-chi.tex and font-chi.tex.
+
+% \startencoding[cjk-uni]
+% \defineudigit 10000 132 44
+% \defineudigit 100000000 81 4
+
+% \definecommand cnencodedsection {\uchar{123}{192}}
+% \definecommand cnencodedfigure {\uchar{87}{22}}
+% \definecommand cnencodedunits {\uchar{138}{8}\uchar{145}{207}\uchar{85}{174}\uchar{79}{77}}
+% \definecommand cnencodedlogos {\uchar{95}{189}\uchar{140}{182}}
+% \definecommand cnencodedabbreviations {\uchar{126}{46}\uchar{117}{101}\uchar{138}{158}}
+% \definecommand cnencodedfigures {\uchar{87}{22}\uchar{95}{98}}
+% \definecommand cnencodedcontents {\uchar{118}{238}\uchar{147}{4}}
+% \stopencoding
+
+% \startencoding[gbk]
+% \defineudigit 10000 200 102
+% \defineudigit 100000000 131 124
+
+% \definecommand cnencodedsection {\uchar{185}{157}}
+% \definecommand cnencodedfigure {\uchar{136}{68}}
+% \definecommand cnencodedunits {\uchar{211}{139}\uchar{193}{191}\uchar{134}{206}\uchar{206}{187}}
+% \definecommand cnencodedlogos {\uchar{187}{213}\uchar{217}{72}
+% \definecommand cnencodedabbreviations {\uchar{191}{115}\uchar{194}{212}\uchar{213}{90}}
+% \definecommand cnencodedfigures {\uchar{136}{68}\uchar{208}{206}}
+% \definecommand cnencodedcontents {\uchar{196}{191}\uchar{228}{155}}
+% \stopencoding
+
+% \startencoding[big5]
+% \defineudigit 10000 184 85
+% \defineudigit 100000000 187 245
+
+% \definecommand cnencodedsection {\uchar{184}{96}}
+% \definecommand cnencodedfigure {\uchar{185}{207}}
+% \definecommand cnencodedunits {\uchar{173}{112}\uchar{182}{113}\uchar{179}{230}\uchar{166}{236}}
+% \definecommand cnencodedlogos {\uchar{192}{178}\uchar{182}{83}}
+% \definecommand cnencodedabbreviations {\uchar{193}{89}\uchar{178}{164}\uchar{187}{121}}
+% \definecommand cnencodedfigures {\uchar{185}{207}\uchar{167}{206}}
+% \definecommand cnencodedcontents {\uchar{165}{216}\uchar{191}{253}}
+% \stopencoding
+
+\stopencoding
+
+\protect \endinput
diff --git a/tex/context/base/lang-chi.tex b/tex/context/base/lang-chi.tex
deleted file mode 100644
index 278e10745..000000000
--- a/tex/context/base/lang-chi.tex
+++ /dev/null
@@ -1,305 +0,0 @@
-%D \module
-%D [ file=lang-chi,
-%D version=2002.06.25, % 1998.10.10,
-%D title=\CONTEXT\ Language Macros,
-%D subtitle=Chinese,
-%D author={Hans Hagen \& Wang Lei},
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Language Macros / Chinese}
-
-%D This module is coded using the \UNICODE\ support built in
-%D \CONTEXT. Therefore, \type {\uchar} is used instead of latin
-%D characters.
-
-\unprotect
-
-\definesystemconstant {chinese} \definesystemconstant {cn}
-
-\installlanguage
- [\s!cn]
- [\c!leftsentence=\cnencoding\cnleftsentence,
- \c!rightsentence=\cnencoding\cnrightsentence,
- \c!leftsubsentence=\cnencoding\cnleftsubsentence,
- \c!rightsubsentence=\cnencoding\cnrightsubsentence,
- \c!leftquote=\cnencoding\cnupperleftsinglequote,
- \c!rightquote=\cnencoding\cnupperrightsinglequote,
- \c!leftquotation=\cnencoding\cnupperleftdoublequote,
- \c!rightquotation=\cnencoding\cnupperrightdoublequote,
- \c!date={\v!year,\cnyear,\ ,\v!month,\v!day,\cnday}]
-
-\setupheadtext [\s!cn] [\v!content={\cnencoding\cnencodedcontents}]
-\setupheadtext [\s!cn] [\v!tables={\cnencoding\cnencodedtables}]
-\setupheadtext [\s!cn] [\v!figures={\cnencoding\cnencodedfigures}]
-\setupheadtext [\s!cn] [\v!graphics={\cnencoding\cnencodedgraphics}]% RG & XJF
-\setupheadtext [\s!cn] [\v!intermezzi={\cnencoding\cnencodedintermezzo}]% RG & XJF
-\setupheadtext [\s!cn] [\v!index={\cnencoding\cnencodedindex}]
-\setupheadtext [\s!cn] [\v!abbreviations={\cnencoding\cnencodedabbreviations}]
-\setupheadtext [\s!cn] [\v!logos={\cnencoding\cnencodedlogos}]
-\setupheadtext [\s!cn] [\v!units={\cnencoding\cnencodedunits}]
-
-\setuplabeltext [\s!cn] [\v!table={\cnencoding\cnencodedtable}]
-\setuplabeltext [\s!cn] [\v!figure={\cnencoding\cnencodedfigure}]
-\setuplabeltext [\s!cn] [\v!intermezzo={\cnencoding\cnencodedintermezzo}]% RG & XJF
-\setuplabeltext [\s!cn] [\v!graphic={\cnencoding\cnencodedillustration}]% RG & XJF
-\setuplabeltext [\s!cn] [\v!appendix={\cnencoding\cnencodedappendix}]% RG
-\setuplabeltext [\s!cn] [\v!part={\cnencoding\cnencodedintro,\cnencoding\cnencodedpart}]
-\setuplabeltext [\s!cn] [\v!chapter={\cnencoding\cnencodedintro,\cnencoding\cnencodedchapter}]
-\setuplabeltext [\s!cn] [\v!section={\cnencoding\cnencodedintro,\cnencoding\cnencodedsection}]
-\setuplabeltext [\s!cn] [\v!line={\cnencoding\cnencodedline}]% RG & XJF
-\setuplabeltext [\s!cn] [\v!lines={\cnencoding\cnencodedline}]% RG & XJF
-
-\setuplabeltext [\s!cn] [\v!subsection=]
-\setuplabeltext [\s!cn] [\v!subsubsection=]
-\setuplabeltext [\s!cn] [\v!subsubsubsection=]
-
-%D From this definition one can deduce that language, input
-%D encoding, font encoding, and glyph meaning form a pretty
-%D complex four dimensional space.
-
-\startlanguagespecifics[\s!cn]
-
-\setuplabeltext [\s!cn] [\v!january=\cnencoding\cnencodedjanuary ]
-\setuplabeltext [\s!cn] [\v!february=\cnencoding\cnencodedfebrary ]
-\setuplabeltext [\s!cn] [\v!march=\cnencoding\cnencodedmarch ]
-\setuplabeltext [\s!cn] [\v!april=\cnencoding\cnencodedapril ]
-\setuplabeltext [\s!cn] [\v!may=\cnencoding\cnencodedmay ]
-\setuplabeltext [\s!cn] [\v!june=\cnencoding\cnencodedjune ]
-\setuplabeltext [\s!cn] [\v!july=\cnencoding\cnencodedjuly ]
-\setuplabeltext [\s!cn] [\v!august=\cnencoding\cnencodedaugust ]
-\setuplabeltext [\s!cn] [\v!september=\cnencoding\cnencodedseptember]
-\setuplabeltext [\s!cn] [\v!october=\cnencoding\cnencodedoctober ]
-\setuplabeltext [\s!cn] [\v!november=\cnencoding\cnencodednovember ]
-\setuplabeltext [\s!cn] [\v!december=\cnencoding\cnencodeddecember ]
-
-\setuplabeltext [\s!cn] [\v!sunday=\cnencoding\cnencodedsunday ]
-\setuplabeltext [\s!cn] [\v!monday=\cnencoding\cnencodedmonday ]
-\setuplabeltext [\s!cn] [\v!tuesday=\cnencoding\cnencodedtuesday ]
-\setuplabeltext [\s!cn] [\v!wednesday=\cnencoding\cnencodedwednesday]
-\setuplabeltext [\s!cn] [\v!thursday=\cnencoding\cnencodedthursday ]
-\setuplabeltext [\s!cn] [\v!friday=\cnencoding\cnencodedfriday ]
-\setuplabeltext [\s!cn] [\v!saturday=\cnencoding\cnencodedsaturday ]
-
-\stoplanguagespecifics
-
-%D One can specify a split labeltext, as demonstrated in
-%D the definition of the \type {part} label. Unfortunately
-%D the glyphs of both part depend on the encoding. Therefore,
-%D we have an encoding section here.
-
-\unexpanded\def\cnencoding{\enableencoding[\chineseencoding]} % ugly and temporary
-
-\startencoding[cjk-uni]
- \definecommand cnleftsentence {\uchar{32}{20}\uchar{32}{20}}
- \definecommand cnrightsentence {\uchar{32}{20}\uchar{32}{20}}
- \definecommand cnleftsubsentence {\uchar{32}{20}\uchar{32}{20}}
- \definecommand cnrightsubsentence {\uchar{32}{20}\uchar{32}{20}}
- \definecommand cnupperleftsinglequote {\uchar{32}{24}}
- \definecommand cnupperrightsinglequote {\uchar{32}{25}}
- \definecommand cnupperleftdoublequote {\uchar{32}{28}}
- \definecommand cnupperrightdoublequote {\uchar{32}{29}}
- \definecommand cnupperleftsinglequote-v {\uchar{48}{12}}
- \definecommand cnupperrightsinglequote-v {\uchar{48}{13}}
- \definecommand cnupperleftdoublequote-v {\uchar{48}{14}}
- \definecommand cnupperrightdoublequote-v {\uchar{48}{15}}
- \definecommand cnencodedcontents {\uchar{118}{238}\uchar{95}{85}}
- \definecommand cnencodedtables {\uchar{136}{104}\uchar{104}{60}}
- \definecommand cnencodedfigures {\uchar{86}{254}\uchar{95}{98}}
- \definecommand cnencodedindex {\uchar{125}{34}\uchar{95}{21}}
- \definecommand cnencodedabbreviations {\uchar{127}{41}\uchar{117}{101}\uchar{139}{237}}
- \definecommand cnencodedlogos {\uchar{95}{189}\uchar{141}{44}}
- \definecommand cnencodedunits {\uchar{139}{161}\uchar{145}{207}\uchar{83}{85}\uchar{79}{77}}
- \definecommand cnencodedtable {\uchar{136}{104}}
- \definecommand cnencodedfigure {\uchar{86}{254}}
- \definecommand cnencodedintro {\uchar{123}{44}}
- \definecommand cnencodedpart {\uchar{144}{232}\uchar{82}{6}}
- \definecommand cnencodedchapter {\uchar{122}{224}}
- \definecommand cnencodedsection {\uchar{130}{130}}
- \definecommand cnencodedjanuary {\uchar{78}{0}\uchar{103}{8}}
- \definecommand cnencodedfebrary {\uchar{78}{140}\uchar{103}{8}}
- \definecommand cnencodedmarch {\uchar{78}{9}\uchar{103}{8}}
- \definecommand cnencodedapril {\uchar{86}{219}\uchar{103}{8}}
- \definecommand cnencodedmay {\uchar{78}{148}\uchar{103}{8}}
- \definecommand cnencodedjune {\uchar{81}{109}\uchar{103}{8}}
- \definecommand cnencodedjuly {\uchar{78}{3}\uchar{103}{8}}
- \definecommand cnencodedaugust {\uchar{81}{107}\uchar{103}{8}}
- \definecommand cnencodedseptember {\uchar{78}{93}\uchar{103}{8}}
- \definecommand cnencodedoctober {\uchar{83}{65}\uchar{103}{8}}
- \definecommand cnencodednovember {\uchar{83}{65}\uchar{78}{0}\uchar{103}{8}}
- \definecommand cnencodeddecember {\uchar{83}{65}\uchar{78}{140}\uchar{103}{8}}
- \definecommand cnencodedsunday {\uchar{102}{31}\uchar{103}{31}\uchar{101}{229}}
- \definecommand cnencodedmonday {\uchar{102}{31}\uchar{103}{31}\uchar{78}{0}}
- \definecommand cnencodedtuesday {\uchar{102}{31}\uchar{103}{31}\uchar{78}{140}}
- \definecommand cnencodedwednesday {\uchar{102}{31}\uchar{103}{31}\uchar{78}{9}}
- \definecommand cnencodedthursday {\uchar{102}{31}\uchar{103}{31}\uchar{86}{219}}
- \definecommand cnencodedfriday {\uchar{102}{31}\uchar{103}{31}\uchar{78}{148}}
- \definecommand cnencodedsaturday {\uchar{102}{31}\uchar{103}{31}\uchar{81}{109}}
- % RG & XJF
- \definecommand cnencodedgraphics {\uchar{86}{254}}
- \definecommand cnencodedintermezzo {\uchar{210}{99}\uchar{242}{102}}
- \definecommand cnencodedillustration {\uchar{99}{210}\uchar{86}{254}}
- \definecommand cnencodedappendix {\uchar{150}{68}\uchar{95}{85}}
- \definecommand cnencodedline {\uchar{136}{76}}
- % Tobias Burnus & XJF
- \definecommand cnyear {\uchar{94}{116}}
- \definecommand cnmonth {\uchar{103}{8}}
- \definecommand cnday {\uchar{101}{229}}
-\stopencoding
-
-\startencoding[gbk]
- \definecommand cnleftsentence {\uchar{161}{170}\uchar{161}{170}}
- \definecommand cnrightsentence {\uchar{161}{170}\uchar{161}{170}}
- \definecommand cnleftsubsentence {\uchar{161}{170}\uchar{161}{170}}
- \definecommand cnrightsubsentence {\uchar{161}{170}\uchar{161}{170}}
- \definecommand cnupperleftsinglequote {\uchar{161}{174}}
- \definecommand cnupperrightsinglequote {\uchar{161}{175}}
- \definecommand cnupperleftdoublequote {\uchar{161}{176}}
- \definecommand cnupperrightdoublequote {\uchar{161}{177}}
- \definecommand cnupperleftsinglequote-v {\uchar{161}{184}}
- \definecommand cnupperrightsinglequote-v {\uchar{161}{185}}
- \definecommand cnupperleftdoublequote-v {\uchar{161}{186}}
- \definecommand cnupperrightdoublequote-v {\uchar{161}{187}}
- \definecommand cnencodedcontents {\uchar{196}{191}\uchar{194}{188}}
- \definecommand cnencodedtables {\uchar{177}{237}\uchar{184}{241}}
- \definecommand cnencodedfigures {\uchar{205}{188}\uchar{208}{206}}
- \definecommand cnencodedindex {\uchar{203}{247}\uchar{210}{253}}
- \definecommand cnencodedabbreviations {\uchar{203}{245}\uchar{194}{212}\uchar{211}{239}}
- \definecommand cnencodedlogos {\uchar{187}{213}\uchar{177}{225}}
- \definecommand cnencodedunits {\uchar{188}{198}\uchar{193}{191}\uchar{181}{165}\uchar{206}{187}}
- \definecommand cnencodedtable {\uchar{177}{237}}
- \definecommand cnencodedfigure {\uchar{205}{188}}
- \definecommand cnencodedintro {\uchar{181}{218}}
- \definecommand cnencodedpart {\uchar{178}{191}\uchar{183}{214}}
- \definecommand cnencodedchapter {\uchar{213}{194}}
- \definecommand cnencodedsection {\uchar{189}{218}}
- \definecommand cnencodedjanuary {\uchar{210}{187}\uchar{212}{194}}
- \definecommand cnencodedfebrary {\uchar{182}{254}\uchar{212}{194}}
- \definecommand cnencodedmarch {\uchar{200}{253}\uchar{212}{194}}
- \definecommand cnencodedapril {\uchar{203}{196}\uchar{212}{194}}
- \definecommand cnencodedmay {\uchar{206}{229}\uchar{212}{194}}
- \definecommand cnencodedjune {\uchar{193}{249}\uchar{212}{194}}
- \definecommand cnencodedjuly {\uchar{198}{223}\uchar{212}{194}}
- \definecommand cnencodedaugust {\uchar{176}{203}\uchar{212}{194}}
- \definecommand cnencodedseptember {\uchar{190}{197}\uchar{212}{194}}
- \definecommand cnencodedoctober {\uchar{202}{174}\uchar{212}{194}}
- \definecommand cnencodednovember {\uchar{202}{174}\uchar{210}{187}\uchar{212}{194}}
- \definecommand cnencodeddecember {\uchar{202}{174}\uchar{182}{254}\uchar{212}{194}}
- \definecommand cnencodedsunday {\uchar{208}{199}\uchar{198}{218}\uchar{200}{213}}
- \definecommand cnencodedmonday {\uchar{208}{199}\uchar{198}{218}\uchar{210}{187}}
- \definecommand cnencodedtuesday {\uchar{208}{199}\uchar{198}{218}\uchar{182}{254}}
- \definecommand cnencodedwednesday {\uchar{208}{199}\uchar{198}{218}\uchar{200}{253}}
- \definecommand cnencodedthursday {\uchar{208}{199}\uchar{198}{218}\uchar{203}{196}}
- \definecommand cnencodedfriday {\uchar{208}{199}\uchar{198}{218}\uchar{206}{229}}
- \definecommand cnencodedsaturday {\uchar{208}{199}\uchar{198}{218}\uchar{193}{249}}
- % RG & XJF
- \definecommand cnencodedgraphics {\uchar{205}{188}}
- \definecommand cnencodedintermezzo {\uchar{178}{229}\uchar{199}{250}}
- \definecommand cnencodedillustration {\uchar{178}{229}\uchar{205}{188}}
- \definecommand cnencodedappendix {\uchar{184}{189}\uchar{194}{188}}
- \definecommand cnencodedline {\uchar{208}{208}}
- % Tobias Burnus & XJF
- \definecommand cnyear {\uchar{196}{234}}
- \definecommand cnmonth {\uchar{212}{194}}
- \definecommand cnday {\uchar{200}{213}}
-\stopencoding
-
-\startencoding[big5]
- \definecommand cnleftsentence {\uchar{162}{119}\uchar{162}{119}}
- \definecommand cnrightsentence {\uchar{162}{119}\uchar{162}{119}}
- \definecommand cnleftsubsentence {\uchar{162}{119}\uchar{162}{119}}
- \definecommand cnrightsubsentence {\uchar{162}{119}\uchar{162}{119}}
- \definecommand cnupperleftsinglequote {\uchar{161}{165}}
- \definecommand cnupperrightsinglequote {\uchar{161}{166}}
- \definecommand cnupperleftdoublequote {\uchar{161}{167}}
- \definecommand cnupperrightdoublequote {\uchar{161}{168}}
- \definecommand cnupperleftsinglequote-v {\uchar{161}{117}}
- \definecommand cnupperrightsinglequote-v {\uchar{161}{118}}
- \definecommand cnupperleftdoublequote-v {\uchar{161}{121}}
- \definecommand cnupperrightdoublequote-v {\uchar{161}{122}}
- \definecommand cnencodecontents {\uchar{165}{216}\uchar{191}{253}}
- \definecommand cnencodetables {\uchar{170}{237}\uchar{174}{230}}
- \definecommand cnencodefigures {\uchar{185}{207}\uchar{167}{206}}
- \definecommand cnencodeindex {\uchar{175}{193}\uchar{174}{222}}
- \definecommand cnencodeabbreviations {\uchar{191}{89}\uchar{178}{164}\uchar{187}{121}}
- \definecommand cnencodelogos {\uchar{192}{178}\uchar{188}{208}}
- \definecommand cnencodeunits {\uchar{173}{112}\uchar{182}{113}\uchar{179}{230}\uchar{166}{236}}
- \definecommand cnencodetable {\uchar{170}{237}}
- \definecommand cnencodefigure {\uchar{185}{207}}
- \definecommand cnencodedintro {\uchar{178}{196}}
- \definecommand cnencodedpart {\uchar{179}{161}\uchar{164}{192}}
- \definecommand cnencodedchapter {\uchar{179}{185}}
- \definecommand cnencodedsection {\uchar{184} {96}}
- \definecommand cnencodedjanuary {\uchar{164} {64}\uchar{164}{235}}
- \definecommand cnencodedfebrary {\uchar{164} {71}\uchar{164}{235}}
- \definecommand cnencodedmarch {\uchar{164} {84}\uchar{164}{235}}
- \definecommand cnencodedapril {\uchar{165}{124}\uchar{164}{235}}
- \definecommand cnencodedmay {\uchar{164}{173}\uchar{164}{235}}
- \definecommand cnencodedjune {\uchar{164}{187}\uchar{164}{235}}
- \definecommand cnencodedjuly {\uchar{164} {67}\uchar{164}{235}}
- \definecommand cnencodedaugust {\uchar{164} {75}\uchar{164}{235}}
- \definecommand cnencodedseptember {\uchar{164} {69}\uchar{164}{235}}
- \definecommand cnencodedoctober {\uchar{164} {81}\uchar{164}{235}}
- \definecommand cnencodednovember {\uchar{164} {81}\uchar{164} {64}\uchar{164}{235}}
- \definecommand cnencodeddecember {\uchar{164} {81}\uchar{164} {71}\uchar{164}{235}}
- \definecommand cnencodedsunday {\uchar{172} {80}\uchar{180}{193}\uchar{164}{233}}
- \definecommand cnencodedmonday {\uchar{172} {80}\uchar{180}{193}\uchar{164} {64}}
- \definecommand cnencodedtuesday {\uchar{172} {80}\uchar{180}{193}\uchar{164} {71}}
- \definecommand cnencodedwednesday {\uchar{172} {80}\uchar{180}{193}\uchar{164} {84}}
- \definecommand cnencodedthursday {\uchar{172} {80}\uchar{180}{193}\uchar{165}{124}}
- \definecommand cnencodedfriday {\uchar{172} {80}\uchar{180}{193}\uchar{164}{173}}
- \definecommand cnencodedsaturday {\uchar{172} {80}\uchar{180}{193}\uchar{164}{187}}
- % Tobias Burnus &\XJF
- \definecommand cnyear {\uchar{166}{126}}
- \definecommand cnmonth {\uchar{164}{235}}
- \definecommand cnday {\uchar{164}{233}}
-
-% Traditional Chinese characters (only where they differ to the
-% simplified ones) for lang-chi.tex and font-chi.tex.
-
-% \startencoding[cjk-uni]
-% \defineudigit 10000 132 44
-% \defineudigit 100000000 81 4
-
-% \definecommand cnencodedsection {\uchar{123}{192}}
-% \definecommand cnencodedfigure {\uchar{87}{22}}
-% \definecommand cnencodedunits {\uchar{138}{8}\uchar{145}{207}\uchar{85}{174}\uchar{79}{77}}
-% \definecommand cnencodedlogos {\uchar{95}{189}\uchar{140}{182}}
-% \definecommand cnencodedabbreviations {\uchar{126}{46}\uchar{117}{101}\uchar{138}{158}}
-% \definecommand cnencodedfigures {\uchar{87}{22}\uchar{95}{98}}
-% \definecommand cnencodedcontents {\uchar{118}{238}\uchar{147}{4}}
-% \stopencoding
-
-% \startencoding[gbk]
-% \defineudigit 10000 200 102
-% \defineudigit 100000000 131 124
-
-% \definecommand cnencodedsection {\uchar{185}{157}}
-% \definecommand cnencodedfigure {\uchar{136}{68}}
-% \definecommand cnencodedunits {\uchar{211}{139}\uchar{193}{191}\uchar{134}{206}\uchar{206}{187}}
-% \definecommand cnencodedlogos {\uchar{187}{213}\uchar{217}{72}
-% \definecommand cnencodedabbreviations {\uchar{191}{115}\uchar{194}{212}\uchar{213}{90}}
-% \definecommand cnencodedfigures {\uchar{136}{68}\uchar{208}{206}}
-% \definecommand cnencodedcontents {\uchar{196}{191}\uchar{228}{155}}
-% \stopencoding
-
-% \startencoding[big5]
-% \defineudigit 10000 184 85
-% \defineudigit 100000000 187 245
-
-% \definecommand cnencodedsection {\uchar{184}{96}}
-% \definecommand cnencodedfigure {\uchar{185}{207}}
-% \definecommand cnencodedunits {\uchar{173}{112}\uchar{182}{113}\uchar{179}{230}\uchar{166}{236}}
-% \definecommand cnencodedlogos {\uchar{192}{178}\uchar{182}{83}}
-% \definecommand cnencodedabbreviations {\uchar{193}{89}\uchar{178}{164}\uchar{187}{121}}
-% \definecommand cnencodedfigures {\uchar{185}{207}\uchar{167}{206}}
-% \definecommand cnencodedcontents {\uchar{165}{216}\uchar{191}{253}}
-% \stopencoding
-
-\stopencoding
-
-\protect \endinput
diff --git a/tex/context/base/lang-cjk.mkiv b/tex/context/base/lang-cjk.mkiv
new file mode 100644
index 000000000..138f6d263
--- /dev/null
+++ b/tex/context/base/lang-cjk.mkiv
@@ -0,0 +1,328 @@
+%D \module
+%D [ file=lang-chi,
+%D version=2009.03.02,
+%D title=\CONTEXT\ Language Macros,
+%D subtitle=Chinese,
+%D author={Hans Hagen \& Wang Lei},
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D Derived from \MKII\ files.
+
+\writestatus{loading}{ConTeXt Language Macros / CJK}
+
+\definesystemconstant {chinese} \definesystemconstant {cn}
+\definesystemconstant {japanese} \definesystemconstant {ja}
+\definesystemconstant {korean} \definesystemconstant {kr}
+
+\unprotect
+
+% Chinese
+
+\installlanguage
+ [\s!cn]
+ [\c!leftsentence=——,
+ \c!rightsentence=——,
+ \c!leftsubsentence=——,
+ \c!rightsubsentence=——,
+ \c!leftquote=‘,
+ \c!rightquote=’,
+ \c!leftquotation=“,
+ \c!rightquotation=”,
+ \c!date={\v!year,年,\ ,\v!month,\v!day,日}]
+
+\setupheadtext [\s!cn] [\v!content=目录]
+\setupheadtext [\s!cn] [\v!tables=表格]
+\setupheadtext [\s!cn] [\v!figures=图形]
+\setupheadtext [\s!cn] [\v!graphics=图]
+\setupheadtext [\s!cn] [\v!intermezzi=퉣]
+\setupheadtext [\s!cn] [\v!index=索引]
+\setupheadtext [\s!cn] [\v!abbreviations=缩略语]
+\setupheadtext [\s!cn] [\v!logos=徽贬]
+\setupheadtext [\s!cn] [\v!units=计量单位]
+
+\setuplabeltext [\s!cn] [\v!table=表]
+\setuplabeltext [\s!cn] [\v!figure=图]
+\setuplabeltext [\s!cn] [\v!intermezzo=퉣]
+\setuplabeltext [\s!cn] [\v!graphic=插图]
+\setuplabeltext [\s!cn] [\v!appendix=附录]
+\setuplabeltext [\s!cn] [\v!part={第,部分}]
+\setuplabeltext [\s!cn] [\v!chapter={第,章}]
+\setuplabeltext [\s!cn] [\v!section={第,节}]
+\setuplabeltext [\s!cn] [\v!line=行]
+\setuplabeltext [\s!cn] [\v!lines=行]
+
+\setuplabeltext [\s!cn] [\v!subsection=]
+\setuplabeltext [\s!cn] [\v!subsubsection=]
+\setuplabeltext [\s!cn] [\v!subsubsubsection=]
+
+\setuplabeltext [\s!cn] [\v!january=一月]
+\setuplabeltext [\s!cn] [\v!february=二月]
+\setuplabeltext [\s!cn] [\v!march=三月]
+\setuplabeltext [\s!cn] [\v!april=四月]
+\setuplabeltext [\s!cn] [\v!may=五月]
+\setuplabeltext [\s!cn] [\v!june=六月]
+\setuplabeltext [\s!cn] [\v!july=七月]
+\setuplabeltext [\s!cn] [\v!august=八月]
+\setuplabeltext [\s!cn] [\v!september=九月]
+\setuplabeltext [\s!cn] [\v!october=十月]
+\setuplabeltext [\s!cn] [\v!november=十一月]
+\setuplabeltext [\s!cn] [\v!december=十二月]
+
+\setuplabeltext [\s!cn] [\v!sunday=星期日]
+\setuplabeltext [\s!cn] [\v!monday=星期一]
+\setuplabeltext [\s!cn] [\v!tuesday=星期二]
+\setuplabeltext [\s!cn] [\v!wednesday=星期三]
+\setuplabeltext [\s!cn] [\v!thursday=星期四]
+\setuplabeltext [\s!cn] [\v!friday=星期五]
+\setuplabeltext [\s!cn] [\v!saturday=星期六]
+
+%D Japanese
+
+\installlanguage
+ [\s!ja]
+ [\c!leftsentence=——,
+ \c!rightsentence=——,
+ \c!leftsubsentence=——,
+ \c!rightsubsentence=——,
+ \c!leftquote=‘,
+ \c!rightquote=’,
+ \c!leftquotation=「,
+ \c!rightquotation=」,
+ \c!date={西暦,\v!year,年,\v!month,月,\v!day,日}]
+
+\setupheadtext [\s!ja] [\v!content=目次]
+\setupheadtext [\s!ja] [\v!tables=机]
+\setupheadtext [\s!ja] [\v!figures=図]
+\setupheadtext [\s!ja] [\v!graphics=グラフ]
+\setupheadtext [\s!ja] [\v!intermezzi=間奏曲]
+\setupheadtext [\s!ja] [\v!index=目次]
+\setupheadtext [\s!ja] [\v!abbreviations=略語]
+\setupheadtext [\s!ja] [\v!logos=理性]
+\setupheadtext [\s!ja] [\v!units=ユニッツ]
+
+\setuplabeltext [\s!ja] [\v!table=表]
+\setuplabeltext [\s!ja] [\v!figure=図]
+\setuplabeltext [\s!ja] [\v!intermezzo=間奏曲]
+\setuplabeltext [\s!ja] [\v!graphic=イラスト]
+\setuplabeltext [\s!ja] [\v!appendix=付録]
+\setuplabeltext [\s!ja] [\v!part={第,パート}]
+\setuplabeltext [\s!ja] [\v!chapter={第,章}]
+\setuplabeltext [\s!ja] [\v!section={第,項}]
+\setuplabeltext [\s!ja] [\v!line=線]
+\setuplabeltext [\s!ja] [\v!lines=線]
+
+\setuplabeltext [\s!ja] [\v!subsection=]
+\setuplabeltext [\s!ja] [\v!subsubsection=]
+\setuplabeltext [\s!ja] [\v!subsubsubsection=]
+
+\setuplabeltext [\s!ja] [\v!january=1]
+\setuplabeltext [\s!ja] [\v!february=2]
+\setuplabeltext [\s!ja] [\v!march=3]
+\setuplabeltext [\s!ja] [\v!april=4]
+\setuplabeltext [\s!ja] [\v!may=5]
+\setuplabeltext [\s!ja] [\v!june=6]
+\setuplabeltext [\s!ja] [\v!july=7]
+\setuplabeltext [\s!ja] [\v!august=8]
+\setuplabeltext [\s!ja] [\v!september=9]
+\setuplabeltext [\s!ja] [\v!october=10]
+\setuplabeltext [\s!ja] [\v!november=11]
+\setuplabeltext [\s!ja] [\v!december=12]
+
+\setuplabeltext [\s!ja] [\v!sunday=月曜日]
+\setuplabeltext [\s!ja] [\v!monday=火曜日]
+\setuplabeltext [\s!ja] [\v!tuesday=水曜日]
+\setuplabeltext [\s!ja] [\v!wednesday=木曜日]
+\setuplabeltext [\s!ja] [\v!thursday=金曜日]
+\setuplabeltext [\s!ja] [\v!friday=土曜日]
+\setuplabeltext [\s!ja] [\v!saturday=日曜日]
+
+%D Korean
+
+% todo
+
+\protect \endinput
+
+cn={
+ ["abbreviations"]="缩略语",
+ ["appendix"]="附录",
+ ["april"]="四月",
+ ["august"]="八月",
+ ["chapter"]="章",
+ ["contents"]="目录",
+ ["day"]="日",
+ ["december"]="十二月",
+ ["febrary"]="二月",
+ ["figure"]="图",
+ ["figures"]="图形",
+ ["friday"]="星期五",
+ ["graphics"]="图",
+ ["illustration"]="插图",
+ ["index"]="索引",
+ ["intermezzo"]="퉣",
+ ["intro"]="第",
+ ["january"]="一月",
+ ["july"]="七月",
+ ["june"]="六月",
+ ["leftsentence"]="——",
+ ["leftsubsentence"]="——",
+ ["line"]="行",
+ ["logos"]="徽贬",
+ ["march"]="三月",
+ ["may"]="五月",
+ ["monday"]="星期一",
+ ["month"]="月",
+ ["november"]="十一月",
+ ["october"]="十月",
+ ["part"]="部分",
+ ["rightsentence"]="——",
+ ["rightsubsentence"]="——",
+ ["saturday"]="星期六",
+ ["section"]="节",
+ ["september"]="九月",
+ ["sunday"]="星期日",
+ ["table"]="表",
+ ["tables"]="表格",
+ ["thursday"]="星期四",
+ ["tuesday"]="星期二",
+ ["units"]="计量单位",
+ ["upperleftdoublequote"]="“",
+ ["upperleftdoublequote-v"]="『",
+ ["upperleftsinglequote"]="‘",
+ ["upperleftsinglequote-v"]="「",
+ ["upperrightdoublequote"]="”",
+ ["upperrightdoublequote-v"]="』",
+ ["upperrightsinglequote"]="’",
+ ["upperrightsinglequote-v"]="」",
+ ["wednesday"]="星期三",
+ ["year"]="年",
+}
+
+ja={
+ ["abbreviations"]="略語",
+ ["abstract"]="概要",
+ ["and"]="、",
+ ["answer"]="答:",
+ ["appendix"]="付録",
+ ["april"]="四月",
+ ["article"]="項目",
+ ["august"]="八月",
+ ["bibliography"]="参考文献",
+ ["book"]="ブック",
+ ["bridgehead"]="項",
+ ["bullet"]="●",
+ ["by"]=":",
+ ["caution"]="注意",
+ ["chapter"]="章",
+ ["christiandate"]="西暦",
+ ["colophon"]="奥付",
+ ["copyright"]="製作著作",
+ ["day"]="日",
+ ["december"]="十二月",
+ ["dedication"]="謝辞",
+ ["edited"]="編者",
+ ["editedby"]="編者:",
+ ["edition"]="編集",
+ ["endquote"]="」",
+ ["equation"]="式",
+ ["example"]="例",
+ ["february"]="二月",
+ ["figure"]="図",
+ ["figures"]="図",
+ ["friday"]="土曜日",
+ ["glossary"]="用語集",
+ ["glosssee"]="参照",
+ ["glossseealso"]="参照",
+ ["graphics"]="グラフ",
+ ["illustration"]="イラスト",
+ ["important"]="重要項目",
+ ["index"]="目次",
+ ["indexsymbols"]="シンボル",
+ ["intermezzo"]="間奏曲",
+ ["intermezzos"]="間奏曲",
+ ["intro"]="第",
+ ["january"]="一月",
+ ["july"]="七月",
+ ["june"]="六月",
+ ["leftsentence"]="——",
+ ["leftsubsentence"]="——",
+ ["line"]="線",
+ ["lines"]="線",
+ ["listofequations"]="式目次",
+ ["listofexamples"]="例目次",
+ ["listoffigures"]="図目次",
+ ["listoftables"]="表目次",
+ ["listofunknown"]="不明目次",
+ ["logos"]="理性",
+ ["march"]="三月",
+ ["may"]="五月",
+ ["monday"]="火曜日",
+ ["month"]="月",
+ ["msgaud"]="対象者",
+ ["msglevel"]="レベル",
+ ["msgorig"]="発信元",
+ ["navhome"]="ホーム",
+ ["navnext"]="次のページ",
+ ["navnextsibling"]="早送り",
+ ["navprev"]="前のページ",
+ ["navprevsibling"]="巻戻し",
+ ["navup"]="上に戻る",
+ ["nestedendquote"]="』",
+ ["nestedstartquote"]="『",
+ ["nonexistantelement"]="要素が存在しません",
+ ["note"]="注意",
+ ["notes"]="注意",
+ ["november"]="十一月",
+ ["october"]="十月",
+ ["pages"]="偧献",
+ ["part"]="パート",
+ ["preface"]="序文",
+ ["procedure"]="手順",
+ ["procedureformal"]="手順",
+ ["productionset"]="プロダクション",
+ ["productionsetformal"]="プロダクション",
+ ["published"]="発行",
+ ["qandadiv"]="問:、答:",
+ ["qandaentry"]="問:",
+ ["question"]="問:",
+ ["reference"]="参照",
+ ["refname"]="名前",
+ ["refsection"]="項",
+ ["refsynopsisdiv"]="概要",
+ ["revhistory"]="改訂履歴",
+ ["revision"]="改訂",
+ ["rightsentence"]="——",
+ ["rightsubsentence"]="——",
+ ["saturday"]="日曜日",
+ ["section"]="項",
+ ["see"]="参照",
+ ["seealso"]="参照",
+ ["separator"]="、",
+ ["september"]="九月",
+ ["set"]="設定",
+ ["setindex"]="目次設定",
+ ["sidebar"]="サイドバー",
+ ["simplesect"]="項",
+ ["singleendquote"]="’",
+ ["singlestartquote"]="‘",
+ ["startquote"]="「",
+ ["step"]="ステップ",
+ ["sunday"]="月曜日",
+ ["table"]="表",
+ ["tablenotes"]="注意",
+ ["tableofcontents"]="目次",
+ ["tables"]="机",
+ ["thursday"]="金曜日",
+ ["tip"]="ティップ",
+ ["tuesday"]="水曜日",
+ ["unexpectedelementname"]="不明な要素名",
+ ["units"]="ユニッツ",
+ ["unsupported"]="サポートしません",
+ ["warning"]="警告",
+ ["wednesday"]="木曜日",
+ ["year"]="年",
+}
diff --git a/tex/context/base/lang-cjk.tex b/tex/context/base/lang-cjk.tex
deleted file mode 100644
index 138f6d263..000000000
--- a/tex/context/base/lang-cjk.tex
+++ /dev/null
@@ -1,328 +0,0 @@
-%D \module
-%D [ file=lang-chi,
-%D version=2009.03.02,
-%D title=\CONTEXT\ Language Macros,
-%D subtitle=Chinese,
-%D author={Hans Hagen \& Wang Lei},
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D Derived from \MKII\ files.
-
-\writestatus{loading}{ConTeXt Language Macros / CJK}
-
-\definesystemconstant {chinese} \definesystemconstant {cn}
-\definesystemconstant {japanese} \definesystemconstant {ja}
-\definesystemconstant {korean} \definesystemconstant {kr}
-
-\unprotect
-
-% Chinese
-
-\installlanguage
- [\s!cn]
- [\c!leftsentence=——,
- \c!rightsentence=——,
- \c!leftsubsentence=——,
- \c!rightsubsentence=——,
- \c!leftquote=‘,
- \c!rightquote=’,
- \c!leftquotation=“,
- \c!rightquotation=”,
- \c!date={\v!year,年,\ ,\v!month,\v!day,日}]
-
-\setupheadtext [\s!cn] [\v!content=目录]
-\setupheadtext [\s!cn] [\v!tables=表格]
-\setupheadtext [\s!cn] [\v!figures=图形]
-\setupheadtext [\s!cn] [\v!graphics=图]
-\setupheadtext [\s!cn] [\v!intermezzi=퉣]
-\setupheadtext [\s!cn] [\v!index=索引]
-\setupheadtext [\s!cn] [\v!abbreviations=缩略语]
-\setupheadtext [\s!cn] [\v!logos=徽贬]
-\setupheadtext [\s!cn] [\v!units=计量单位]
-
-\setuplabeltext [\s!cn] [\v!table=表]
-\setuplabeltext [\s!cn] [\v!figure=图]
-\setuplabeltext [\s!cn] [\v!intermezzo=퉣]
-\setuplabeltext [\s!cn] [\v!graphic=插图]
-\setuplabeltext [\s!cn] [\v!appendix=附录]
-\setuplabeltext [\s!cn] [\v!part={第,部分}]
-\setuplabeltext [\s!cn] [\v!chapter={第,章}]
-\setuplabeltext [\s!cn] [\v!section={第,节}]
-\setuplabeltext [\s!cn] [\v!line=行]
-\setuplabeltext [\s!cn] [\v!lines=行]
-
-\setuplabeltext [\s!cn] [\v!subsection=]
-\setuplabeltext [\s!cn] [\v!subsubsection=]
-\setuplabeltext [\s!cn] [\v!subsubsubsection=]
-
-\setuplabeltext [\s!cn] [\v!january=一月]
-\setuplabeltext [\s!cn] [\v!february=二月]
-\setuplabeltext [\s!cn] [\v!march=三月]
-\setuplabeltext [\s!cn] [\v!april=四月]
-\setuplabeltext [\s!cn] [\v!may=五月]
-\setuplabeltext [\s!cn] [\v!june=六月]
-\setuplabeltext [\s!cn] [\v!july=七月]
-\setuplabeltext [\s!cn] [\v!august=八月]
-\setuplabeltext [\s!cn] [\v!september=九月]
-\setuplabeltext [\s!cn] [\v!october=十月]
-\setuplabeltext [\s!cn] [\v!november=十一月]
-\setuplabeltext [\s!cn] [\v!december=十二月]
-
-\setuplabeltext [\s!cn] [\v!sunday=星期日]
-\setuplabeltext [\s!cn] [\v!monday=星期一]
-\setuplabeltext [\s!cn] [\v!tuesday=星期二]
-\setuplabeltext [\s!cn] [\v!wednesday=星期三]
-\setuplabeltext [\s!cn] [\v!thursday=星期四]
-\setuplabeltext [\s!cn] [\v!friday=星期五]
-\setuplabeltext [\s!cn] [\v!saturday=星期六]
-
-%D Japanese
-
-\installlanguage
- [\s!ja]
- [\c!leftsentence=——,
- \c!rightsentence=——,
- \c!leftsubsentence=——,
- \c!rightsubsentence=——,
- \c!leftquote=‘,
- \c!rightquote=’,
- \c!leftquotation=「,
- \c!rightquotation=」,
- \c!date={西暦,\v!year,年,\v!month,月,\v!day,日}]
-
-\setupheadtext [\s!ja] [\v!content=目次]
-\setupheadtext [\s!ja] [\v!tables=机]
-\setupheadtext [\s!ja] [\v!figures=図]
-\setupheadtext [\s!ja] [\v!graphics=グラフ]
-\setupheadtext [\s!ja] [\v!intermezzi=間奏曲]
-\setupheadtext [\s!ja] [\v!index=目次]
-\setupheadtext [\s!ja] [\v!abbreviations=略語]
-\setupheadtext [\s!ja] [\v!logos=理性]
-\setupheadtext [\s!ja] [\v!units=ユニッツ]
-
-\setuplabeltext [\s!ja] [\v!table=表]
-\setuplabeltext [\s!ja] [\v!figure=図]
-\setuplabeltext [\s!ja] [\v!intermezzo=間奏曲]
-\setuplabeltext [\s!ja] [\v!graphic=イラスト]
-\setuplabeltext [\s!ja] [\v!appendix=付録]
-\setuplabeltext [\s!ja] [\v!part={第,パート}]
-\setuplabeltext [\s!ja] [\v!chapter={第,章}]
-\setuplabeltext [\s!ja] [\v!section={第,項}]
-\setuplabeltext [\s!ja] [\v!line=線]
-\setuplabeltext [\s!ja] [\v!lines=線]
-
-\setuplabeltext [\s!ja] [\v!subsection=]
-\setuplabeltext [\s!ja] [\v!subsubsection=]
-\setuplabeltext [\s!ja] [\v!subsubsubsection=]
-
-\setuplabeltext [\s!ja] [\v!january=1]
-\setuplabeltext [\s!ja] [\v!february=2]
-\setuplabeltext [\s!ja] [\v!march=3]
-\setuplabeltext [\s!ja] [\v!april=4]
-\setuplabeltext [\s!ja] [\v!may=5]
-\setuplabeltext [\s!ja] [\v!june=6]
-\setuplabeltext [\s!ja] [\v!july=7]
-\setuplabeltext [\s!ja] [\v!august=8]
-\setuplabeltext [\s!ja] [\v!september=9]
-\setuplabeltext [\s!ja] [\v!october=10]
-\setuplabeltext [\s!ja] [\v!november=11]
-\setuplabeltext [\s!ja] [\v!december=12]
-
-\setuplabeltext [\s!ja] [\v!sunday=月曜日]
-\setuplabeltext [\s!ja] [\v!monday=火曜日]
-\setuplabeltext [\s!ja] [\v!tuesday=水曜日]
-\setuplabeltext [\s!ja] [\v!wednesday=木曜日]
-\setuplabeltext [\s!ja] [\v!thursday=金曜日]
-\setuplabeltext [\s!ja] [\v!friday=土曜日]
-\setuplabeltext [\s!ja] [\v!saturday=日曜日]
-
-%D Korean
-
-% todo
-
-\protect \endinput
-
-cn={
- ["abbreviations"]="缩略语",
- ["appendix"]="附录",
- ["april"]="四月",
- ["august"]="八月",
- ["chapter"]="章",
- ["contents"]="目录",
- ["day"]="日",
- ["december"]="十二月",
- ["febrary"]="二月",
- ["figure"]="图",
- ["figures"]="图形",
- ["friday"]="星期五",
- ["graphics"]="图",
- ["illustration"]="插图",
- ["index"]="索引",
- ["intermezzo"]="퉣",
- ["intro"]="第",
- ["january"]="一月",
- ["july"]="七月",
- ["june"]="六月",
- ["leftsentence"]="——",
- ["leftsubsentence"]="——",
- ["line"]="行",
- ["logos"]="徽贬",
- ["march"]="三月",
- ["may"]="五月",
- ["monday"]="星期一",
- ["month"]="月",
- ["november"]="十一月",
- ["october"]="十月",
- ["part"]="部分",
- ["rightsentence"]="——",
- ["rightsubsentence"]="——",
- ["saturday"]="星期六",
- ["section"]="节",
- ["september"]="九月",
- ["sunday"]="星期日",
- ["table"]="表",
- ["tables"]="表格",
- ["thursday"]="星期四",
- ["tuesday"]="星期二",
- ["units"]="计量单位",
- ["upperleftdoublequote"]="“",
- ["upperleftdoublequote-v"]="『",
- ["upperleftsinglequote"]="‘",
- ["upperleftsinglequote-v"]="「",
- ["upperrightdoublequote"]="”",
- ["upperrightdoublequote-v"]="』",
- ["upperrightsinglequote"]="’",
- ["upperrightsinglequote-v"]="」",
- ["wednesday"]="星期三",
- ["year"]="年",
-}
-
-ja={
- ["abbreviations"]="略語",
- ["abstract"]="概要",
- ["and"]="、",
- ["answer"]="答:",
- ["appendix"]="付録",
- ["april"]="四月",
- ["article"]="項目",
- ["august"]="八月",
- ["bibliography"]="参考文献",
- ["book"]="ブック",
- ["bridgehead"]="項",
- ["bullet"]="●",
- ["by"]=":",
- ["caution"]="注意",
- ["chapter"]="章",
- ["christiandate"]="西暦",
- ["colophon"]="奥付",
- ["copyright"]="製作著作",
- ["day"]="日",
- ["december"]="十二月",
- ["dedication"]="謝辞",
- ["edited"]="編者",
- ["editedby"]="編者:",
- ["edition"]="編集",
- ["endquote"]="」",
- ["equation"]="式",
- ["example"]="例",
- ["february"]="二月",
- ["figure"]="図",
- ["figures"]="図",
- ["friday"]="土曜日",
- ["glossary"]="用語集",
- ["glosssee"]="参照",
- ["glossseealso"]="参照",
- ["graphics"]="グラフ",
- ["illustration"]="イラスト",
- ["important"]="重要項目",
- ["index"]="目次",
- ["indexsymbols"]="シンボル",
- ["intermezzo"]="間奏曲",
- ["intermezzos"]="間奏曲",
- ["intro"]="第",
- ["january"]="一月",
- ["july"]="七月",
- ["june"]="六月",
- ["leftsentence"]="——",
- ["leftsubsentence"]="——",
- ["line"]="線",
- ["lines"]="線",
- ["listofequations"]="式目次",
- ["listofexamples"]="例目次",
- ["listoffigures"]="図目次",
- ["listoftables"]="表目次",
- ["listofunknown"]="不明目次",
- ["logos"]="理性",
- ["march"]="三月",
- ["may"]="五月",
- ["monday"]="火曜日",
- ["month"]="月",
- ["msgaud"]="対象者",
- ["msglevel"]="レベル",
- ["msgorig"]="発信元",
- ["navhome"]="ホーム",
- ["navnext"]="次のページ",
- ["navnextsibling"]="早送り",
- ["navprev"]="前のページ",
- ["navprevsibling"]="巻戻し",
- ["navup"]="上に戻る",
- ["nestedendquote"]="』",
- ["nestedstartquote"]="『",
- ["nonexistantelement"]="要素が存在しません",
- ["note"]="注意",
- ["notes"]="注意",
- ["november"]="十一月",
- ["october"]="十月",
- ["pages"]="偧献",
- ["part"]="パート",
- ["preface"]="序文",
- ["procedure"]="手順",
- ["procedureformal"]="手順",
- ["productionset"]="プロダクション",
- ["productionsetformal"]="プロダクション",
- ["published"]="発行",
- ["qandadiv"]="問:、答:",
- ["qandaentry"]="問:",
- ["question"]="問:",
- ["reference"]="参照",
- ["refname"]="名前",
- ["refsection"]="項",
- ["refsynopsisdiv"]="概要",
- ["revhistory"]="改訂履歴",
- ["revision"]="改訂",
- ["rightsentence"]="——",
- ["rightsubsentence"]="——",
- ["saturday"]="日曜日",
- ["section"]="項",
- ["see"]="参照",
- ["seealso"]="参照",
- ["separator"]="、",
- ["september"]="九月",
- ["set"]="設定",
- ["setindex"]="目次設定",
- ["sidebar"]="サイドバー",
- ["simplesect"]="項",
- ["singleendquote"]="’",
- ["singlestartquote"]="‘",
- ["startquote"]="「",
- ["step"]="ステップ",
- ["sunday"]="月曜日",
- ["table"]="表",
- ["tablenotes"]="注意",
- ["tableofcontents"]="目次",
- ["tables"]="机",
- ["thursday"]="金曜日",
- ["tip"]="ティップ",
- ["tuesday"]="水曜日",
- ["unexpectedelementname"]="不明な要素名",
- ["units"]="ユニッツ",
- ["unsupported"]="サポートしません",
- ["warning"]="警告",
- ["wednesday"]="木曜日",
- ["year"]="年",
-}
diff --git a/tex/context/base/lang-ctx.mkii b/tex/context/base/lang-ctx.mkii
new file mode 100644
index 000000000..09f28dda1
--- /dev/null
+++ b/tex/context/base/lang-ctx.mkii
@@ -0,0 +1,53 @@
+%D \module
+%D [ file=lang-ctx,
+%D version=2005.02.12,
+%D title=\CONTEXT\ Language Macros,
+%D subtitle=Generic Patterns,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Language Macros / Generic Patterns}
+
+\unprotect
+
+%D The \CONTEXT\ specific patterns are more generic and
+%D are more or less encoding independent. They are generated
+%D from the ones shipped with distributions using:
+%D
+%D \starttyping
+%D ctxtools --pattern --all
+%D \stoptyping
+
+%D In order to get 8 bit characters hyphenated, we need to load
+%D patterns under the right circumstances. In some countries, more
+%D than one font encoding is in use. I can add more defaults here
+%D if users let me know what encoding they use.
+
+% \installlanguage [\s!nl] [\s!mapping={texnansi,ec},\s!encoding={texnansi,ec}]
+% \installlanguage [\s!fr] [\s!mapping={texnansi,ec},\s!encoding={texnansi,ec}]
+% \installlanguage [\s!de] [\s!mapping={texnansi,ec},\s!encoding={texnansi,ec}]
+% \installlanguage [\s!it] [\s!mapping={texnansi,ec},\s!encoding={texnansi,ec}]
+% \installlanguage [\s!pt] [\s!mapping={texnansi,ec},\s!encoding={texnansi,ec}]
+% \installlanguage [\s!hr] [\s!mapping=ec,\s!encoding=ec] % no il2, misses cacute characters
+% \installlanguage [\s!pl] [\s!mapping={pl0,ec,qx},\s!encoding={pl0,ec,qx}] % pl0 may go
+% \installlanguage [\s!cs] [\s!mapping={il2,ec},\s!encoding={il2,ec}] % il2 may go
+% \installlanguage [\s!sk] [\s!mapping={il2,ec},\s!encoding={il2,ec}] % il2 may go
+% \installlanguage [\s!sl] [\s!mapping=ec,\s!encoding=ec] % il2 has gone
+% \installlanguage [\s!vi] [\s!mapping=t5,\s!encoding=t5]
+% \installlanguage [\s!ru] [\s!mapping=t2a,\s!encoding=t2a]
+
+% beware, don't use \setuplanguage here
+
+% \installlanguage[\s!gb][\s!lefthyphenmin=3,\s!righthyphenmin=3] % patterns can only handle this
+% \installlanguage[\s!us][\s!lefthyphenmin=2,\s!righthyphenmin=3] % patterns can only handle this
+
+% greek
+
+% \installlanguage[\s!agr][\s!mapping=\s!agr,\s!encoding=\s!agr]
+
+\protect \endinput
diff --git a/tex/context/base/lang-ctx.tex b/tex/context/base/lang-ctx.tex
deleted file mode 100644
index 09f28dda1..000000000
--- a/tex/context/base/lang-ctx.tex
+++ /dev/null
@@ -1,53 +0,0 @@
-%D \module
-%D [ file=lang-ctx,
-%D version=2005.02.12,
-%D title=\CONTEXT\ Language Macros,
-%D subtitle=Generic Patterns,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Language Macros / Generic Patterns}
-
-\unprotect
-
-%D The \CONTEXT\ specific patterns are more generic and
-%D are more or less encoding independent. They are generated
-%D from the ones shipped with distributions using:
-%D
-%D \starttyping
-%D ctxtools --pattern --all
-%D \stoptyping
-
-%D In order to get 8 bit characters hyphenated, we need to load
-%D patterns under the right circumstances. In some countries, more
-%D than one font encoding is in use. I can add more defaults here
-%D if users let me know what encoding they use.
-
-% \installlanguage [\s!nl] [\s!mapping={texnansi,ec},\s!encoding={texnansi,ec}]
-% \installlanguage [\s!fr] [\s!mapping={texnansi,ec},\s!encoding={texnansi,ec}]
-% \installlanguage [\s!de] [\s!mapping={texnansi,ec},\s!encoding={texnansi,ec}]
-% \installlanguage [\s!it] [\s!mapping={texnansi,ec},\s!encoding={texnansi,ec}]
-% \installlanguage [\s!pt] [\s!mapping={texnansi,ec},\s!encoding={texnansi,ec}]
-% \installlanguage [\s!hr] [\s!mapping=ec,\s!encoding=ec] % no il2, misses cacute characters
-% \installlanguage [\s!pl] [\s!mapping={pl0,ec,qx},\s!encoding={pl0,ec,qx}] % pl0 may go
-% \installlanguage [\s!cs] [\s!mapping={il2,ec},\s!encoding={il2,ec}] % il2 may go
-% \installlanguage [\s!sk] [\s!mapping={il2,ec},\s!encoding={il2,ec}] % il2 may go
-% \installlanguage [\s!sl] [\s!mapping=ec,\s!encoding=ec] % il2 has gone
-% \installlanguage [\s!vi] [\s!mapping=t5,\s!encoding=t5]
-% \installlanguage [\s!ru] [\s!mapping=t2a,\s!encoding=t2a]
-
-% beware, don't use \setuplanguage here
-
-% \installlanguage[\s!gb][\s!lefthyphenmin=3,\s!righthyphenmin=3] % patterns can only handle this
-% \installlanguage[\s!us][\s!lefthyphenmin=2,\s!righthyphenmin=3] % patterns can only handle this
-
-% greek
-
-% \installlanguage[\s!agr][\s!mapping=\s!agr,\s!encoding=\s!agr]
-
-\protect \endinput
diff --git a/tex/context/base/lang-dis.mkii b/tex/context/base/lang-dis.mkii
new file mode 100644
index 000000000..f081bf4a9
--- /dev/null
+++ b/tex/context/base/lang-dis.mkii
@@ -0,0 +1,59 @@
+%D \module
+%D [ file=lang-dis,
+%D version=2005.02.12,
+%D title=\CONTEXT\ Language Macros,
+%D subtitle=Distribution Patterns,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This code used to be part of cont-usr.tex but now that we
+%D use more generic pattern files, we decided to isolate these
+%D mappings.
+
+\writestatus{loading}{ConTeXt Language Macros / Distribution Patterns}
+
+%D Hyphenation patterns are normally sought in filed named
+%D \type {lang-xx.pat}. When present on the system, those
+%D patterns take precedence. This list will be adapted to
+%D the actual situation, given that it's noticed.
+
+%D The us/uk hyph 1/2 files will go
+
+\unprotect
+
+% \definefilefallback [lang-ca.pat] [cahyph.tex]
+% \definefilefallback [lang-da.pat] [dkhyph.tex]
+% \definefilefallback [lang-de.pat] [dehyphn.tex]
+% \definefilefallback [lang-es.pat] [eshyph.tex]
+% \definefilefallback [lang-fi.pat] [fihyph.tex]
+% \definefilefallback [lang-fr.pat] [frhyph.tex]
+% \definefilefallback [lang-hr.pat] [hrhyph.tex]
+% \definefilefallback [lang-hu.pat] [huhyph.tex]
+% \definefilefallback [lang-it.pat] [ithyph.tex]
+% \definefilefallback [lang-la.pat] [lahyph7.tex]
+% \definefilefallback [lang-no.pat] [nohyph.tex]
+% \definefilefallback [lang-pl.pat] [plhyph.tex]
+% \definefilefallback [lang-pt.pat] [pthyph.tex]
+% \definefilefallback [lang-ro.pat] [rohyph.tex]
+% \definefilefallback [lang-ru.pat] [ruenhyph.tex]
+% \definefilefallback [lang-sl.pat] [sihyph.tex,slhyph.tex]
+% \definefilefallback [lang-sv.pat] [svhyph.tex,sehyph.tex]
+% \definefilefallback [lang-tr.pat] [tkhyph.tex,trhyph.tex]
+% \definefilefallback [lang-ua.pat] [ukrenhyp.tex]
+% \definefilefallback [lang-uk.pat] [ukhyphen.tex,ukhyph.tex]
+% \definefilefallback [lang-us.pat] [ushyphmax.tex,ushyph.tex,ushyph1.tex,ushyph2.tex,hyphen.tex]
+% \definefilefallback [lang-nl.pat] [nehyph96.tex,dutch96.pat,nehyph.tex]
+% \definefilefallback [lang-cz.pat] [czhyphen.tex,czhyph.pat]
+% \definefilefallback [lang-sk.pat] [skhyphen.tex,skhyph.pat]
+% \definefilefallback [lang-deo.pat] [dehypht.tex]
+
+% \definefilesynonym [lang-af.pat] [lang-nl.pat]
+% \definefilesynonym [lang-en.pat] [lang-us.pat]
+% \definefilesynonym [lang-en.hyp] [lang-us.hyp]
+
+\protect \endinput
diff --git a/tex/context/base/lang-dis.tex b/tex/context/base/lang-dis.tex
deleted file mode 100644
index f081bf4a9..000000000
--- a/tex/context/base/lang-dis.tex
+++ /dev/null
@@ -1,59 +0,0 @@
-%D \module
-%D [ file=lang-dis,
-%D version=2005.02.12,
-%D title=\CONTEXT\ Language Macros,
-%D subtitle=Distribution Patterns,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D This code used to be part of cont-usr.tex but now that we
-%D use more generic pattern files, we decided to isolate these
-%D mappings.
-
-\writestatus{loading}{ConTeXt Language Macros / Distribution Patterns}
-
-%D Hyphenation patterns are normally sought in filed named
-%D \type {lang-xx.pat}. When present on the system, those
-%D patterns take precedence. This list will be adapted to
-%D the actual situation, given that it's noticed.
-
-%D The us/uk hyph 1/2 files will go
-
-\unprotect
-
-% \definefilefallback [lang-ca.pat] [cahyph.tex]
-% \definefilefallback [lang-da.pat] [dkhyph.tex]
-% \definefilefallback [lang-de.pat] [dehyphn.tex]
-% \definefilefallback [lang-es.pat] [eshyph.tex]
-% \definefilefallback [lang-fi.pat] [fihyph.tex]
-% \definefilefallback [lang-fr.pat] [frhyph.tex]
-% \definefilefallback [lang-hr.pat] [hrhyph.tex]
-% \definefilefallback [lang-hu.pat] [huhyph.tex]
-% \definefilefallback [lang-it.pat] [ithyph.tex]
-% \definefilefallback [lang-la.pat] [lahyph7.tex]
-% \definefilefallback [lang-no.pat] [nohyph.tex]
-% \definefilefallback [lang-pl.pat] [plhyph.tex]
-% \definefilefallback [lang-pt.pat] [pthyph.tex]
-% \definefilefallback [lang-ro.pat] [rohyph.tex]
-% \definefilefallback [lang-ru.pat] [ruenhyph.tex]
-% \definefilefallback [lang-sl.pat] [sihyph.tex,slhyph.tex]
-% \definefilefallback [lang-sv.pat] [svhyph.tex,sehyph.tex]
-% \definefilefallback [lang-tr.pat] [tkhyph.tex,trhyph.tex]
-% \definefilefallback [lang-ua.pat] [ukrenhyp.tex]
-% \definefilefallback [lang-uk.pat] [ukhyphen.tex,ukhyph.tex]
-% \definefilefallback [lang-us.pat] [ushyphmax.tex,ushyph.tex,ushyph1.tex,ushyph2.tex,hyphen.tex]
-% \definefilefallback [lang-nl.pat] [nehyph96.tex,dutch96.pat,nehyph.tex]
-% \definefilefallback [lang-cz.pat] [czhyphen.tex,czhyph.pat]
-% \definefilefallback [lang-sk.pat] [skhyphen.tex,skhyph.pat]
-% \definefilefallback [lang-deo.pat] [dehypht.tex]
-
-% \definefilesynonym [lang-af.pat] [lang-nl.pat]
-% \definefilesynonym [lang-en.pat] [lang-us.pat]
-% \definefilesynonym [lang-en.hyp] [lang-us.hyp]
-
-\protect \endinput
diff --git a/tex/context/base/lang-ini.mkii b/tex/context/base/lang-ini.mkii
index e5759bc84..a55748a78 100644
--- a/tex/context/base/lang-ini.mkii
+++ b/tex/context/base/lang-ini.mkii
@@ -265,7 +265,7 @@
\fi
\egroup}
-\fetchruntimecommand \showpatterns {\f!languageprefix\s!run}
+\fetchruntimecommand \showpatterns {\f!languageprefix\s!run.mkii}
%D Since we can only load patterns in ini\TeX, we nil the
%D loading before dumping (which saves a bit of memory, but
diff --git a/tex/context/base/lang-ini.mkiv b/tex/context/base/lang-ini.mkiv
index 7cb945ef9..f88281a60 100644
--- a/tex/context/base/lang-ini.mkiv
+++ b/tex/context/base/lang-ini.mkiv
@@ -76,14 +76,18 @@
\def\setupcurrentlanguage[#1]{\setcurrentlanguage\currentmainlanguage{#1}}
\def\setcurrentlanguage#1#2% sets modes: **id (currentmain) *id (current)
- {\doifsomething{#1}
- {\ifx\currentmainlanguage\empty\else\resetsystemmode{\systemmodeprefix\currentmainlanguage}\fi
- \edef\currentmainlanguage{#1}%
- \setsystemmode{\systemmodeprefix\currentmainlanguage}}%
- \doifsomething{#2}
- {\ifx\currentlanguage\empty\else\resetsystemmode\currentlanguage\fi
- \edef\currentlanguage{#2}%
- \setsystemmode\currentlanguage}}
+ {\edef\xaskedlanguage{#1}% otherwise clash with \askedlanguage
+ \ifx\xaskedlanguage\empty \else
+ \ifx\currentmainlanguage\empty\else\resetsystemmode{\systemmodeprefix\currentmainlanguage}\fi
+ \let\currentmainlanguage\xaskedlanguage
+ \setsystemmode{\systemmodeprefix\currentmainlanguage}%
+ \fi
+ \edef\xaskedlanguage{#2}%
+ \ifx\xaskedlanguage\empty \else
+ \ifx\currentlanguage\empty\else\resetsystemmode\currentlanguage\fi
+ \let\currentlanguage\xaskedlanguage
+ \setsystemmode\currentlanguage
+ \fi}
%D The internal macros will be defined later.
@@ -120,9 +124,9 @@
%D preloaded format).
\def\dodoinstalllanguage#1#2% #2 added
- {\doifundefined{#1}{\setvalue{#1}{\complexlanguage[#2]}}%
- \expanded{\noexpand\uppercase{\noexpand\edef\noexpand\ascii{#1}}}%
- \doifundefined\ascii{\setvalue\ascii{\complexlanguage[#2]}}}
+ {\expanded{\noexpand\uppercase{\noexpand\edef\noexpand\ascii{#1}}}%
+ \ifcsname #1\endcsname\else\setvalue {#1}{\complexlanguage[#2]}\fi
+ \ifcsname\ascii\endcsname\else\setvalue\ascii{\complexlanguage[#2]}\fi}
%D \macros
%D {preloadlanguages}
@@ -145,11 +149,6 @@
"\truefilename{\f!languageprefix#2.\f!hyphensextension }")
}}
-% \def\doloadlanguagefiles#1%
-% {\doifelsevaluenothing{\??la#1\s!patterns}
-% {\doloadpatterns{#1}{#1}}
-% {\doloadpatterns{#1}{\getvalue{\??la#1\s!patterns}}}}
-
\def\doloadlanguagefiles#1%
{\edef\languagesuffix{\specificlanguageparameter{#1}\s!patterns}%
\ifx\languagesuffix\empty
@@ -318,9 +317,6 @@
\newtoks \everylanguage
-\def\disablelanguagespecifics
- {\ignorecompoundcharacter}
-
\def\sethyphenationvariables
{\lefthyphenmin 0\languageparameter\s!lefthyphenmin \relax
\righthyphenmin0\languageparameter\s!righthyphenmin\relax
@@ -331,21 +327,14 @@
{\edef\currentdefaultlanguage{\defaultlanguage\currentlanguage}%
\setnormallanguage\currentlanguage\currentdefaultlanguage
\the\everylanguage
- \enablelanguagespecifics[\currentlanguage]%
\sethyphenationvariables
\relax
% will be definable and move to core-spa !
\doifelse{\languageparameter\c!spacing}\v!broad\nonfrenchspacing\frenchspacing}
-\ifx\enablelanguagespecifics\undefined \def\enablelanguagespecifics[#1]{} \fi
-
% The following may be a solution for the fact that one cannot
% change catcodes of characters like : and ; inside an environment.
-\appendtoks
- \enablelanguagespecifics[\currentlanguage]%
-\to \everystarttext
-
\def\complexlanguage[#1]%
{\edef\askedlanguage{#1}%
\ifx\askedlanguage\empty \else
@@ -586,4 +575,6 @@
\uchyph=1
+\exhyphenchar=45 % to permit breaking at explicit hyphens
+
\protect \endinput
diff --git a/tex/context/base/lang-ita.tex b/tex/context/base/lang-ita.tex
index ae3b7a514..c714be775 100644
--- a/tex/context/base/lang-ita.tex
+++ b/tex/context/base/lang-ita.tex
@@ -478,12 +478,18 @@
%D Rather new \unknown
-\setuplabeltext [\s!it] [\v!page=pagina ]
-\setuplabeltext [\s!it] [\v!atpage=a pagina ]
+\setuplabeltext [\s!it] [\v!page=pagina ]
+\setuplabeltext [\s!it] [\v!atpage=a pagina ]
\setuplabeltext [\s!it] [\v!hencefore=come mostrato sopra]
\setuplabeltext [\s!it] [\v!hereafter=come mostrato sotto]
\setuplabeltext [\s!it] [\v!see=cf. ]
+\setuplabeltext [\s!fr] [\v!page=page ]
+\setuplabeltext [\s!fr] [\v!atpage=à la page ]
+\setuplabeltext [\s!fr] [\v!hencefore=ci-dessus]
+\setuplabeltext [\s!fr] [\v!hereafter=ci-dessous]
+\setuplabeltext [\s!fr] [\v!see=cf. ]
+
%D Ordinal converters:
\def\frordinaldaynumber#1% date is masculine
diff --git a/tex/context/base/lang-jap.mkii b/tex/context/base/lang-jap.mkii
new file mode 100644
index 000000000..05c9b1d41
--- /dev/null
+++ b/tex/context/base/lang-jap.mkii
@@ -0,0 +1,234 @@
+%D \module
+%D [ file=lang-jap,
+%D version=2006.01.13,
+%D title=\CONTEXT\ Language Macros,
+%D subtitle=Japanese,
+%D author={Richard Gabriel},
+%D date=\currentdate,
+%D copyright={PRAGMA / RG}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% rgabriel@kerio.com
+
+\writestatus{loading}{ConTeXt Language Macros / Japanese}
+
+\unprotect
+
+\definesystemconstant {japanese} \definesystemconstant {ja}
+
+\installlanguage
+ [\s!ja]
+ [\c!leftsentence=\jaencoding\jaleftsentence,
+ \c!rightsentence=\jaencoding\jarightsentence,
+ \c!leftsubsentence=\jaencoding\jaleftsubsentence,
+ \c!rightsubsentence=\jaencoding\jarightsubsentence,
+ \c!leftquote=\jaencoding\jaencodedsinglestartquote,
+ \c!rightquote=\jaencoding\jaencodedsingleendquote,
+ \c!leftquotation=\jaencoding\jaencodedstartquote,
+ \c!rightquotation=\jaencoding\jaencodedendquote,
+ \c!date={\jaencodedchristiandate,\v!year,\jaencodedyear,\v!month,\jaencodedmonth,\v!day,\jaencodedday}]
+
+\setupheadtext [\s!ja] [\v!content={\jaencoding\jaencodedtableofcontents}]
+\setupheadtext [\s!ja] [\v!tables={\jaencoding\jaencodedtables}]
+\setupheadtext [\s!ja] [\v!figures={\jaencoding\jaencodedfigures}]
+\setupheadtext [\s!ja] [\v!graphics={\jaencoding\jaencodedgraphics}]
+\setupheadtext [\s!ja] [\v!intermezzi={\jaencoding\jaencodedintermezzos}]
+\setupheadtext [\s!ja] [\v!index={\jaencoding\jaencodedindex}]
+\setupheadtext [\s!ja] [\v!abbreviations={\jaencoding\jaencodedabbreviations}]
+\setupheadtext [\s!ja] [\v!logos={\jaencoding\jaencodedlogos}]
+\setupheadtext [\s!ja] [\v!units={\jaencoding\jaencodedunits}]
+
+\setuplabeltext [\s!ja] [\v!table={\jaencoding\jaencodedtable}]
+\setuplabeltext [\s!ja] [\v!figure={\jaencoding\jaencodedfigure}]
+\setuplabeltext [\s!ja] [\v!intermezzo={\jaencoding\jaencodedintermezzo}]
+\setuplabeltext [\s!ja] [\v!graphic={\jaencoding\jaencodedillustration}]
+\setuplabeltext [\s!ja] [\v!appendix={\jaencoding\jaencodedappendix}]
+\setuplabeltext [\s!ja] [\v!part={\jaencoding\jaencodedintro,\jaencoding\jaencodedpart}]
+\setuplabeltext [\s!ja] [\v!chapter={\jaencoding\jaencodedintro,\jaencoding\jaencodedchapter}]
+\setuplabeltext [\s!ja] [\v!section={\jaencoding\jaencodedintro,\jaencoding\jaencodedsection}]
+\setuplabeltext [\s!ja] [\v!line={\jaencoding\jaencodedline}]
+\setuplabeltext [\s!ja] [\v!lines={\jaencoding\jaencodedline}]
+
+\setuplabeltext [\s!ja] [\v!subsection=]
+\setuplabeltext [\s!ja] [\v!subsubsection=]
+\setuplabeltext [\s!ja] [\v!subsubsubsection=]
+
+%D Why are these languagespecifics ?
+
+\setuplabeltext [\s!ja] [\v!january=1]
+\setuplabeltext [\s!ja] [\v!february=2]
+\setuplabeltext [\s!ja] [\v!march=3]
+\setuplabeltext [\s!ja] [\v!april=4]
+\setuplabeltext [\s!ja] [\v!may=5]
+\setuplabeltext [\s!ja] [\v!june=6]
+\setuplabeltext [\s!ja] [\v!july=7]
+\setuplabeltext [\s!ja] [\v!august=8]
+\setuplabeltext [\s!ja] [\v!september=9]
+\setuplabeltext [\s!ja] [\v!october=10]
+\setuplabeltext [\s!ja] [\v!november=11]
+\setuplabeltext [\s!ja] [\v!december=12]
+
+\setuplabeltext [\s!ja] [\v!sunday=\jaencoding\jaencodedsunday ]
+\setuplabeltext [\s!ja] [\v!monday=\jaencoding\jaencodedmonday ]
+\setuplabeltext [\s!ja] [\v!tuesday=\jaencoding\jaencodedtuesday ]
+\setuplabeltext [\s!ja] [\v!wednesday=\jaencoding\jaencodedwednesday]
+\setuplabeltext [\s!ja] [\v!thursday=\jaencoding\jaencodedthursday ]
+\setuplabeltext [\s!ja] [\v!friday=\jaencoding\jaencodedfriday ]
+\setuplabeltext [\s!ja] [\v!saturday=\jaencoding\jaencodedsaturday ]
+
+% Hardcoded - \japaneseencoding should be defined similarly to \chineseencoding
+
+\unexpanded\def\jaencoding{\enableencoding[cjk-uni]}
+
+%D This list is taken from DocBook XSL stylesheets (http://docbook.sourceforge.net/).
+
+\startencoding[cjk-uni]
+
+ \definecommand jaencodedabstract {\uchar{105}{130}\uchar{137}{129}}
+ \definecommand jaencodedand {\uchar{48}{1}}
+ \definecommand jaencodedanswer {\uchar{123}{84}\uchar{255}{26}}
+ \definecommand jaencodedappendix {\uchar{78}{216}\uchar{147}{50}}
+ \definecommand jaencodedarticle {\uchar{152}{5}\uchar{118}{238}}
+ \definecommand jaencodedbibliography {\uchar{83}{194}\uchar{128}{3}\uchar{101}{135}\uchar{115}{46}}
+ \definecommand jaencodedbook {\uchar{48}{214}\uchar{48}{195}\uchar{48}{175}}
+ \definecommand jaencodedbridgehead {\uchar{152}{5}}
+ \definecommand jaencodedbullet {\uchar{37}{207}}
+ \definecommand jaencodedby {\uchar{255}{26}}
+ \definecommand jaencodedcaution {\uchar{108}{232}\uchar{97}{15}}
+ \definecommand jaencodedcolophon {\uchar{89}{101}\uchar{78}{216}}
+ \definecommand jaencodedcopyright {\uchar{136}{253}\uchar{79}{92}\uchar{132}{87}\uchar{79}{92}}
+ \definecommand jaencodeddedication {\uchar{139}{29}\uchar{143}{158}}
+ \definecommand jaencodededited {\uchar{125}{232}\uchar{128}{5}}
+ \definecommand jaencodededitedby {\uchar{125}{232}\uchar{128}{5}\uchar{255}{26}}
+ \definecommand jaencodededition {\uchar{125}{232}\uchar{150}{198}}
+ \definecommand jaencodedendquote {\uchar{48}{13}}
+ \definecommand jaencodedequation {\uchar{95}{15}}
+ \definecommand jaencodedexample {\uchar{79}{139}}
+ \definecommand jaencodedfigure {\uchar{86}{243}}
+ \definecommand jaencodedglossary {\uchar{117}{40}\uchar{138}{158}\uchar{150}{198}}
+ \definecommand jaencodedglosssee {\uchar{83}{194}\uchar{113}{103}}
+ \definecommand jaencodedglossseealso {\uchar{83}{194}\uchar{113}{103}}
+ \definecommand jaencodedchapter {\uchar{122}{224}}
+ \definecommand jaencodedimportant {\uchar{145}{205}\uchar{137}{129}\uchar{152}{5}\uchar{118}{238}}
+ \definecommand jaencodedindex {\uchar{118}{238}\uchar{107}{33}}
+ \definecommand jaencodedindexsymbols {\uchar{48}{183}\uchar{48}{243}\uchar{48}{220}\uchar{48}{235}}
+ \definecommand jaencodedintro {\uchar{123}{44}}
+ \definecommand jaencodedlistofequations {\uchar{95}{15}\uchar{118}{238}\uchar{107}{33}}
+ \definecommand jaencodedlistofexamples {\uchar{79}{139}\uchar{118}{238}\uchar{107}{33}}
+ \definecommand jaencodedlistoffigures {\uchar{86}{243}\uchar{118}{238}\uchar{107}{33}}
+ \definecommand jaencodedlistoftables {\uchar{136}{104}\uchar{118}{238}\uchar{107}{33}}
+ \definecommand jaencodedlistofunknown {\uchar{78}{13}\uchar{102}{14}\uchar{118}{238}\uchar{107}{33}}
+ \definecommand jaencodedmsgaud {\uchar{91}{254}\uchar{140}{97}\uchar{128}{5}}
+ \definecommand jaencodedmsglevel {\uchar{48}{236}\uchar{48}{217}\uchar{48}{235}}
+ \definecommand jaencodedmsgorig {\uchar{118}{122}\uchar{79}{225}\uchar{81}{67}}
+ \definecommand jaencodednavhome {\uchar{48}{219}\uchar{48}{252}\uchar{48}{224}}
+ \definecommand jaencodednavnext {\uchar{107}{33}\uchar{48}{110}\uchar{48}{218}\uchar{48}{252}\uchar{48}{184}}
+ \definecommand jaencodednavnextsibling {\uchar{101}{233}\uchar{144}{1}\uchar{48}{138}}
+ \definecommand jaencodednavprev {\uchar{82}{77}\uchar{48}{110}\uchar{48}{218}\uchar{48}{252}\uchar{48}{184}}
+ \definecommand jaencodednavprevsibling {\uchar{93}{251}\uchar{98}{59}\uchar{48}{87}}
+ \definecommand jaencodednavup {\uchar{78}{10}\uchar{48}{107}\uchar{98}{59}\uchar{48}{139}}
+ \definecommand jaencodednestedendquote {\uchar{48}{15}}
+ \definecommand jaencodednestedstartquote {\uchar{48}{14}}
+ \definecommand jaencodednonexistantelement {\uchar{137}{129}\uchar{125}{32}\uchar{48}{76}\uchar{91}{88}\uchar{87}{40}\uchar{48}{87}\uchar{48}{126}\uchar{48}{91}\uchar{48}{147}}
+ \definecommand jaencodednote {\uchar{108}{232}\uchar{97}{15}}
+ \definecommand jaencodednotes {\uchar{108}{232}\uchar{97}{15}}
+ \definecommand jaencodedpages {\uchar{80}{103}\uchar{115}{46}}
+ \definecommand jaencodedpart {\uchar{48}{209}\uchar{48}{252}\uchar{48}{200}}
+ \definecommand jaencodedpreface {\uchar{94}{143}\uchar{101}{135}}
+ \definecommand jaencodedprocedure {\uchar{98}{75}\uchar{152}{6}}
+ \definecommand jaencodedprocedureformal {\uchar{98}{75}\uchar{152}{6}}
+ \definecommand jaencodedproductionset {\uchar{48}{215}\uchar{48}{237}\uchar{48}{192}\uchar{48}{175}\uchar{48}{183}\uchar{48}{231}\uchar{48}{243}}
+ \definecommand jaencodedproductionsetformal {\uchar{48}{215}\uchar{48}{237}\uchar{48}{192}\uchar{48}{175}\uchar{48}{183}\uchar{48}{231}\uchar{48}{243}}
+ \definecommand jaencodedpublished {\uchar{118}{122}\uchar{136}{76}}
+ \definecommand jaencodedqandadiv {\uchar{85}{79}\uchar{255}{26}\uchar{48}{1}\uchar{123}{84}\uchar{255}{26}}
+ \definecommand jaencodedqandaentry {\uchar{85}{79}\uchar{255}{26}}
+ \definecommand jaencodedquestion {\uchar{85}{79}\uchar{255}{26}}
+ \definecommand jaencodedreference {\uchar{83}{194}\uchar{113}{103}}
+ \definecommand jaencodedrefname {\uchar{84}{13}\uchar{82}{77}}
+ \definecommand jaencodedrefsection {\uchar{152}{5}}
+ \definecommand jaencodedrefsynopsisdiv {\uchar{105}{130}\uchar{137}{129}}
+ \definecommand jaencodedrevhistory {\uchar{101}{57}\uchar{138}{2}\uchar{92}{101}\uchar{107}{116}}
+ \definecommand jaencodedrevision {\uchar{101}{57}\uchar{138}{2}}
+ \definecommand jaencodedsection {\uchar{152}{5}}
+ \definecommand jaencodedsee {\uchar{83}{194}\uchar{113}{103}}
+ \definecommand jaencodedseealso {\uchar{83}{194}\uchar{113}{103}}
+ \definecommand jaencodedseparator {\uchar{48}{1}}
+ \definecommand jaencodedset {\uchar{138}{45}\uchar{91}{154}}
+ \definecommand jaencodedsetindex {\uchar{118}{238}\uchar{107}{33}\uchar{138}{45}\uchar{91}{154}}
+ \definecommand jaencodedsidebar {\uchar{48}{181}\uchar{48}{164}\uchar{48}{201}\uchar{48}{208}\uchar{48}{252}}
+ \definecommand jaencodedsimplesect {\uchar{152}{5}}
+ \definecommand jaencodedsingleendquote {\uchar{32}{25}}
+ \definecommand jaencodedsinglestartquote {\uchar{32}{24}}
+ \definecommand jaencodedstartquote {\uchar{48}{12}}
+ \definecommand jaencodedstep {\uchar{48}{185}\uchar{48}{198}\uchar{48}{195}\uchar{48}{215}}
+ \definecommand jaencodedtable {\uchar{136}{104}}
+ \definecommand jaencodedtablenotes {\uchar{108}{232}\uchar{97}{15}}
+ \definecommand jaencodedtableofcontents {\uchar{118}{238}\uchar{107}{33}}
+ \definecommand jaencodedtip {\uchar{48}{198}\uchar{48}{163}\uchar{48}{195}\uchar{48}{215}}
+ \definecommand jaencodedunexpectedelementname {\uchar{78}{13}\uchar{102}{14}\uchar{48}{106}\uchar{137}{129}\uchar{125}{32}\uchar{84}{13}}
+ \definecommand jaencodedunsupported {\uchar{48}{181}\uchar{48}{221}\uchar{48}{252}\uchar{48}{200}\uchar{48}{87}\uchar{48}{126}\uchar{48}{91}\uchar{48}{147}}
+ \definecommand jaencodedwarning {\uchar{139}{102}\uchar{84}{74}}
+
+ \definecommand jaencodedyear {\uchar{94}{116}}
+ \definecommand jaencodedmonth {\uchar{103}{8}}
+ \definecommand jaencodedday {\uchar{101}{229}}
+
+\stopencoding
+
+%D Taken from Chinese (will be investigated yet...)
+
+\startencoding[cjk-uni]
+
+ \definecommand jaencodedleftsentence {\uchar{32}{20}\uchar{32}{20}}
+ \definecommand jaencodedrightsentence {\uchar{32}{20}\uchar{32}{20}}
+ \definecommand jaencodedleftsubsentence {\uchar{32}{20}\uchar{32}{20}}
+ \definecommand jaencodedrightsubsentence {\uchar{32}{20}\uchar{32}{20}}
+
+\stopencoding
+
+%D Special thanxx to Eizo Tsuchihashi (eizo@arcbrain.jp) for the following stuff
+
+\startencoding[cjk-uni]
+
+ \definecommand jaencodedchristiandate {\uchar{137}{127}\uchar{102}{166}}
+
+ \definecommand jaencodedtables {\uchar{103}{58}}
+ \definecommand jaencodedfigures {\uchar{86}{243}}
+ \definecommand jaencodedabbreviations {\uchar{117}{101}\uchar{138}{158}}
+ \definecommand jaencodedlogos {\uchar{116}{6}\uchar{96}{39}}
+ \definecommand jaencodedunits {\uchar{48}{230}\uchar{48}{203}\uchar{48}{195}\uchar{48}{196}}
+
+ \definecommand jaencodedgraphics {\uchar{48}{176}\uchar{48}{233}\uchar{48}{213}}
+ \definecommand jaencodedintermezzo {\uchar{149}{147}\uchar{89}{79}\uchar{102}{242}}
+ \definecommand jaencodedintermezzos {\uchar{149}{147}\uchar{89}{79}\uchar{102}{242}}
+ \definecommand jaencodedillustration {\uchar{48}{164}\uchar{48}{233}\uchar{48}{185}\uchar{48}{200}}
+ \definecommand jaencodedline {\uchar{125}{218}}
+ \definecommand jaencodedlines {\uchar{125}{218}}
+
+ \definecommand jaencodedjanuary {\uchar{78}{0}\uchar{103}{8}}
+ \definecommand jaencodedfebruary {\uchar{78}{140}\uchar{103}{8}}
+ \definecommand jaencodedmarch {\uchar{78}{9}\uchar{103}{8}}
+ \definecommand jaencodedapril {\uchar{86}{219}\uchar{103}{8}}
+ \definecommand jaencodedmay {\uchar{78}{148}\uchar{103}{8}}
+ \definecommand jaencodedjune {\uchar{81}{109}\uchar{103}{8}}
+ \definecommand jaencodedjuly {\uchar{78}{3}\uchar{103}{8}}
+ \definecommand jaencodedaugust {\uchar{81}{107}\uchar{103}{8}}
+ \definecommand jaencodedseptember {\uchar{78}{93}\uchar{103}{8}}
+ \definecommand jaencodedoctober {\uchar{83}{65}\uchar{103}{8}}
+ \definecommand jaencodednovember {\uchar{83}{65}\uchar{78}{0}\uchar{103}{8}}
+ \definecommand jaencodeddecember {\uchar{83}{65}\uchar{78}{140}\uchar{103}{8}}
+
+ \definecommand jaencodedsunday {\uchar{103}{8}\uchar{102}{220}\uchar{101}{229}}
+ \definecommand jaencodedmonday {\uchar{112}{107}\uchar{102}{220}\uchar{101}{229}}
+ \definecommand jaencodedtuesday {\uchar{108}{52}\uchar{102}{220}\uchar{101}{229}}
+ \definecommand jaencodedwednesday {\uchar{103}{40}\uchar{102}{220}\uchar{101}{229}}
+ \definecommand jaencodedthursday {\uchar{145}{209}\uchar{102}{220}\uchar{101}{229}}
+ \definecommand jaencodedfriday {\uchar{87}{31}\uchar{102}{220}\uchar{101}{229}}
+ \definecommand jaencodedsaturday {\uchar{101}{229}\uchar{102}{220}\uchar{101}{229}}
+
+\stopencoding
+
+\protect \endinput
diff --git a/tex/context/base/lang-jap.tex b/tex/context/base/lang-jap.tex
deleted file mode 100644
index 05c9b1d41..000000000
--- a/tex/context/base/lang-jap.tex
+++ /dev/null
@@ -1,234 +0,0 @@
-%D \module
-%D [ file=lang-jap,
-%D version=2006.01.13,
-%D title=\CONTEXT\ Language Macros,
-%D subtitle=Japanese,
-%D author={Richard Gabriel},
-%D date=\currentdate,
-%D copyright={PRAGMA / RG}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-% rgabriel@kerio.com
-
-\writestatus{loading}{ConTeXt Language Macros / Japanese}
-
-\unprotect
-
-\definesystemconstant {japanese} \definesystemconstant {ja}
-
-\installlanguage
- [\s!ja]
- [\c!leftsentence=\jaencoding\jaleftsentence,
- \c!rightsentence=\jaencoding\jarightsentence,
- \c!leftsubsentence=\jaencoding\jaleftsubsentence,
- \c!rightsubsentence=\jaencoding\jarightsubsentence,
- \c!leftquote=\jaencoding\jaencodedsinglestartquote,
- \c!rightquote=\jaencoding\jaencodedsingleendquote,
- \c!leftquotation=\jaencoding\jaencodedstartquote,
- \c!rightquotation=\jaencoding\jaencodedendquote,
- \c!date={\jaencodedchristiandate,\v!year,\jaencodedyear,\v!month,\jaencodedmonth,\v!day,\jaencodedday}]
-
-\setupheadtext [\s!ja] [\v!content={\jaencoding\jaencodedtableofcontents}]
-\setupheadtext [\s!ja] [\v!tables={\jaencoding\jaencodedtables}]
-\setupheadtext [\s!ja] [\v!figures={\jaencoding\jaencodedfigures}]
-\setupheadtext [\s!ja] [\v!graphics={\jaencoding\jaencodedgraphics}]
-\setupheadtext [\s!ja] [\v!intermezzi={\jaencoding\jaencodedintermezzos}]
-\setupheadtext [\s!ja] [\v!index={\jaencoding\jaencodedindex}]
-\setupheadtext [\s!ja] [\v!abbreviations={\jaencoding\jaencodedabbreviations}]
-\setupheadtext [\s!ja] [\v!logos={\jaencoding\jaencodedlogos}]
-\setupheadtext [\s!ja] [\v!units={\jaencoding\jaencodedunits}]
-
-\setuplabeltext [\s!ja] [\v!table={\jaencoding\jaencodedtable}]
-\setuplabeltext [\s!ja] [\v!figure={\jaencoding\jaencodedfigure}]
-\setuplabeltext [\s!ja] [\v!intermezzo={\jaencoding\jaencodedintermezzo}]
-\setuplabeltext [\s!ja] [\v!graphic={\jaencoding\jaencodedillustration}]
-\setuplabeltext [\s!ja] [\v!appendix={\jaencoding\jaencodedappendix}]
-\setuplabeltext [\s!ja] [\v!part={\jaencoding\jaencodedintro,\jaencoding\jaencodedpart}]
-\setuplabeltext [\s!ja] [\v!chapter={\jaencoding\jaencodedintro,\jaencoding\jaencodedchapter}]
-\setuplabeltext [\s!ja] [\v!section={\jaencoding\jaencodedintro,\jaencoding\jaencodedsection}]
-\setuplabeltext [\s!ja] [\v!line={\jaencoding\jaencodedline}]
-\setuplabeltext [\s!ja] [\v!lines={\jaencoding\jaencodedline}]
-
-\setuplabeltext [\s!ja] [\v!subsection=]
-\setuplabeltext [\s!ja] [\v!subsubsection=]
-\setuplabeltext [\s!ja] [\v!subsubsubsection=]
-
-%D Why are these languagespecifics ?
-
-\setuplabeltext [\s!ja] [\v!january=1]
-\setuplabeltext [\s!ja] [\v!february=2]
-\setuplabeltext [\s!ja] [\v!march=3]
-\setuplabeltext [\s!ja] [\v!april=4]
-\setuplabeltext [\s!ja] [\v!may=5]
-\setuplabeltext [\s!ja] [\v!june=6]
-\setuplabeltext [\s!ja] [\v!july=7]
-\setuplabeltext [\s!ja] [\v!august=8]
-\setuplabeltext [\s!ja] [\v!september=9]
-\setuplabeltext [\s!ja] [\v!october=10]
-\setuplabeltext [\s!ja] [\v!november=11]
-\setuplabeltext [\s!ja] [\v!december=12]
-
-\setuplabeltext [\s!ja] [\v!sunday=\jaencoding\jaencodedsunday ]
-\setuplabeltext [\s!ja] [\v!monday=\jaencoding\jaencodedmonday ]
-\setuplabeltext [\s!ja] [\v!tuesday=\jaencoding\jaencodedtuesday ]
-\setuplabeltext [\s!ja] [\v!wednesday=\jaencoding\jaencodedwednesday]
-\setuplabeltext [\s!ja] [\v!thursday=\jaencoding\jaencodedthursday ]
-\setuplabeltext [\s!ja] [\v!friday=\jaencoding\jaencodedfriday ]
-\setuplabeltext [\s!ja] [\v!saturday=\jaencoding\jaencodedsaturday ]
-
-% Hardcoded - \japaneseencoding should be defined similarly to \chineseencoding
-
-\unexpanded\def\jaencoding{\enableencoding[cjk-uni]}
-
-%D This list is taken from DocBook XSL stylesheets (http://docbook.sourceforge.net/).
-
-\startencoding[cjk-uni]
-
- \definecommand jaencodedabstract {\uchar{105}{130}\uchar{137}{129}}
- \definecommand jaencodedand {\uchar{48}{1}}
- \definecommand jaencodedanswer {\uchar{123}{84}\uchar{255}{26}}
- \definecommand jaencodedappendix {\uchar{78}{216}\uchar{147}{50}}
- \definecommand jaencodedarticle {\uchar{152}{5}\uchar{118}{238}}
- \definecommand jaencodedbibliography {\uchar{83}{194}\uchar{128}{3}\uchar{101}{135}\uchar{115}{46}}
- \definecommand jaencodedbook {\uchar{48}{214}\uchar{48}{195}\uchar{48}{175}}
- \definecommand jaencodedbridgehead {\uchar{152}{5}}
- \definecommand jaencodedbullet {\uchar{37}{207}}
- \definecommand jaencodedby {\uchar{255}{26}}
- \definecommand jaencodedcaution {\uchar{108}{232}\uchar{97}{15}}
- \definecommand jaencodedcolophon {\uchar{89}{101}\uchar{78}{216}}
- \definecommand jaencodedcopyright {\uchar{136}{253}\uchar{79}{92}\uchar{132}{87}\uchar{79}{92}}
- \definecommand jaencodeddedication {\uchar{139}{29}\uchar{143}{158}}
- \definecommand jaencodededited {\uchar{125}{232}\uchar{128}{5}}
- \definecommand jaencodededitedby {\uchar{125}{232}\uchar{128}{5}\uchar{255}{26}}
- \definecommand jaencodededition {\uchar{125}{232}\uchar{150}{198}}
- \definecommand jaencodedendquote {\uchar{48}{13}}
- \definecommand jaencodedequation {\uchar{95}{15}}
- \definecommand jaencodedexample {\uchar{79}{139}}
- \definecommand jaencodedfigure {\uchar{86}{243}}
- \definecommand jaencodedglossary {\uchar{117}{40}\uchar{138}{158}\uchar{150}{198}}
- \definecommand jaencodedglosssee {\uchar{83}{194}\uchar{113}{103}}
- \definecommand jaencodedglossseealso {\uchar{83}{194}\uchar{113}{103}}
- \definecommand jaencodedchapter {\uchar{122}{224}}
- \definecommand jaencodedimportant {\uchar{145}{205}\uchar{137}{129}\uchar{152}{5}\uchar{118}{238}}
- \definecommand jaencodedindex {\uchar{118}{238}\uchar{107}{33}}
- \definecommand jaencodedindexsymbols {\uchar{48}{183}\uchar{48}{243}\uchar{48}{220}\uchar{48}{235}}
- \definecommand jaencodedintro {\uchar{123}{44}}
- \definecommand jaencodedlistofequations {\uchar{95}{15}\uchar{118}{238}\uchar{107}{33}}
- \definecommand jaencodedlistofexamples {\uchar{79}{139}\uchar{118}{238}\uchar{107}{33}}
- \definecommand jaencodedlistoffigures {\uchar{86}{243}\uchar{118}{238}\uchar{107}{33}}
- \definecommand jaencodedlistoftables {\uchar{136}{104}\uchar{118}{238}\uchar{107}{33}}
- \definecommand jaencodedlistofunknown {\uchar{78}{13}\uchar{102}{14}\uchar{118}{238}\uchar{107}{33}}
- \definecommand jaencodedmsgaud {\uchar{91}{254}\uchar{140}{97}\uchar{128}{5}}
- \definecommand jaencodedmsglevel {\uchar{48}{236}\uchar{48}{217}\uchar{48}{235}}
- \definecommand jaencodedmsgorig {\uchar{118}{122}\uchar{79}{225}\uchar{81}{67}}
- \definecommand jaencodednavhome {\uchar{48}{219}\uchar{48}{252}\uchar{48}{224}}
- \definecommand jaencodednavnext {\uchar{107}{33}\uchar{48}{110}\uchar{48}{218}\uchar{48}{252}\uchar{48}{184}}
- \definecommand jaencodednavnextsibling {\uchar{101}{233}\uchar{144}{1}\uchar{48}{138}}
- \definecommand jaencodednavprev {\uchar{82}{77}\uchar{48}{110}\uchar{48}{218}\uchar{48}{252}\uchar{48}{184}}
- \definecommand jaencodednavprevsibling {\uchar{93}{251}\uchar{98}{59}\uchar{48}{87}}
- \definecommand jaencodednavup {\uchar{78}{10}\uchar{48}{107}\uchar{98}{59}\uchar{48}{139}}
- \definecommand jaencodednestedendquote {\uchar{48}{15}}
- \definecommand jaencodednestedstartquote {\uchar{48}{14}}
- \definecommand jaencodednonexistantelement {\uchar{137}{129}\uchar{125}{32}\uchar{48}{76}\uchar{91}{88}\uchar{87}{40}\uchar{48}{87}\uchar{48}{126}\uchar{48}{91}\uchar{48}{147}}
- \definecommand jaencodednote {\uchar{108}{232}\uchar{97}{15}}
- \definecommand jaencodednotes {\uchar{108}{232}\uchar{97}{15}}
- \definecommand jaencodedpages {\uchar{80}{103}\uchar{115}{46}}
- \definecommand jaencodedpart {\uchar{48}{209}\uchar{48}{252}\uchar{48}{200}}
- \definecommand jaencodedpreface {\uchar{94}{143}\uchar{101}{135}}
- \definecommand jaencodedprocedure {\uchar{98}{75}\uchar{152}{6}}
- \definecommand jaencodedprocedureformal {\uchar{98}{75}\uchar{152}{6}}
- \definecommand jaencodedproductionset {\uchar{48}{215}\uchar{48}{237}\uchar{48}{192}\uchar{48}{175}\uchar{48}{183}\uchar{48}{231}\uchar{48}{243}}
- \definecommand jaencodedproductionsetformal {\uchar{48}{215}\uchar{48}{237}\uchar{48}{192}\uchar{48}{175}\uchar{48}{183}\uchar{48}{231}\uchar{48}{243}}
- \definecommand jaencodedpublished {\uchar{118}{122}\uchar{136}{76}}
- \definecommand jaencodedqandadiv {\uchar{85}{79}\uchar{255}{26}\uchar{48}{1}\uchar{123}{84}\uchar{255}{26}}
- \definecommand jaencodedqandaentry {\uchar{85}{79}\uchar{255}{26}}
- \definecommand jaencodedquestion {\uchar{85}{79}\uchar{255}{26}}
- \definecommand jaencodedreference {\uchar{83}{194}\uchar{113}{103}}
- \definecommand jaencodedrefname {\uchar{84}{13}\uchar{82}{77}}
- \definecommand jaencodedrefsection {\uchar{152}{5}}
- \definecommand jaencodedrefsynopsisdiv {\uchar{105}{130}\uchar{137}{129}}
- \definecommand jaencodedrevhistory {\uchar{101}{57}\uchar{138}{2}\uchar{92}{101}\uchar{107}{116}}
- \definecommand jaencodedrevision {\uchar{101}{57}\uchar{138}{2}}
- \definecommand jaencodedsection {\uchar{152}{5}}
- \definecommand jaencodedsee {\uchar{83}{194}\uchar{113}{103}}
- \definecommand jaencodedseealso {\uchar{83}{194}\uchar{113}{103}}
- \definecommand jaencodedseparator {\uchar{48}{1}}
- \definecommand jaencodedset {\uchar{138}{45}\uchar{91}{154}}
- \definecommand jaencodedsetindex {\uchar{118}{238}\uchar{107}{33}\uchar{138}{45}\uchar{91}{154}}
- \definecommand jaencodedsidebar {\uchar{48}{181}\uchar{48}{164}\uchar{48}{201}\uchar{48}{208}\uchar{48}{252}}
- \definecommand jaencodedsimplesect {\uchar{152}{5}}
- \definecommand jaencodedsingleendquote {\uchar{32}{25}}
- \definecommand jaencodedsinglestartquote {\uchar{32}{24}}
- \definecommand jaencodedstartquote {\uchar{48}{12}}
- \definecommand jaencodedstep {\uchar{48}{185}\uchar{48}{198}\uchar{48}{195}\uchar{48}{215}}
- \definecommand jaencodedtable {\uchar{136}{104}}
- \definecommand jaencodedtablenotes {\uchar{108}{232}\uchar{97}{15}}
- \definecommand jaencodedtableofcontents {\uchar{118}{238}\uchar{107}{33}}
- \definecommand jaencodedtip {\uchar{48}{198}\uchar{48}{163}\uchar{48}{195}\uchar{48}{215}}
- \definecommand jaencodedunexpectedelementname {\uchar{78}{13}\uchar{102}{14}\uchar{48}{106}\uchar{137}{129}\uchar{125}{32}\uchar{84}{13}}
- \definecommand jaencodedunsupported {\uchar{48}{181}\uchar{48}{221}\uchar{48}{252}\uchar{48}{200}\uchar{48}{87}\uchar{48}{126}\uchar{48}{91}\uchar{48}{147}}
- \definecommand jaencodedwarning {\uchar{139}{102}\uchar{84}{74}}
-
- \definecommand jaencodedyear {\uchar{94}{116}}
- \definecommand jaencodedmonth {\uchar{103}{8}}
- \definecommand jaencodedday {\uchar{101}{229}}
-
-\stopencoding
-
-%D Taken from Chinese (will be investigated yet...)
-
-\startencoding[cjk-uni]
-
- \definecommand jaencodedleftsentence {\uchar{32}{20}\uchar{32}{20}}
- \definecommand jaencodedrightsentence {\uchar{32}{20}\uchar{32}{20}}
- \definecommand jaencodedleftsubsentence {\uchar{32}{20}\uchar{32}{20}}
- \definecommand jaencodedrightsubsentence {\uchar{32}{20}\uchar{32}{20}}
-
-\stopencoding
-
-%D Special thanxx to Eizo Tsuchihashi (eizo@arcbrain.jp) for the following stuff
-
-\startencoding[cjk-uni]
-
- \definecommand jaencodedchristiandate {\uchar{137}{127}\uchar{102}{166}}
-
- \definecommand jaencodedtables {\uchar{103}{58}}
- \definecommand jaencodedfigures {\uchar{86}{243}}
- \definecommand jaencodedabbreviations {\uchar{117}{101}\uchar{138}{158}}
- \definecommand jaencodedlogos {\uchar{116}{6}\uchar{96}{39}}
- \definecommand jaencodedunits {\uchar{48}{230}\uchar{48}{203}\uchar{48}{195}\uchar{48}{196}}
-
- \definecommand jaencodedgraphics {\uchar{48}{176}\uchar{48}{233}\uchar{48}{213}}
- \definecommand jaencodedintermezzo {\uchar{149}{147}\uchar{89}{79}\uchar{102}{242}}
- \definecommand jaencodedintermezzos {\uchar{149}{147}\uchar{89}{79}\uchar{102}{242}}
- \definecommand jaencodedillustration {\uchar{48}{164}\uchar{48}{233}\uchar{48}{185}\uchar{48}{200}}
- \definecommand jaencodedline {\uchar{125}{218}}
- \definecommand jaencodedlines {\uchar{125}{218}}
-
- \definecommand jaencodedjanuary {\uchar{78}{0}\uchar{103}{8}}
- \definecommand jaencodedfebruary {\uchar{78}{140}\uchar{103}{8}}
- \definecommand jaencodedmarch {\uchar{78}{9}\uchar{103}{8}}
- \definecommand jaencodedapril {\uchar{86}{219}\uchar{103}{8}}
- \definecommand jaencodedmay {\uchar{78}{148}\uchar{103}{8}}
- \definecommand jaencodedjune {\uchar{81}{109}\uchar{103}{8}}
- \definecommand jaencodedjuly {\uchar{78}{3}\uchar{103}{8}}
- \definecommand jaencodedaugust {\uchar{81}{107}\uchar{103}{8}}
- \definecommand jaencodedseptember {\uchar{78}{93}\uchar{103}{8}}
- \definecommand jaencodedoctober {\uchar{83}{65}\uchar{103}{8}}
- \definecommand jaencodednovember {\uchar{83}{65}\uchar{78}{0}\uchar{103}{8}}
- \definecommand jaencodeddecember {\uchar{83}{65}\uchar{78}{140}\uchar{103}{8}}
-
- \definecommand jaencodedsunday {\uchar{103}{8}\uchar{102}{220}\uchar{101}{229}}
- \definecommand jaencodedmonday {\uchar{112}{107}\uchar{102}{220}\uchar{101}{229}}
- \definecommand jaencodedtuesday {\uchar{108}{52}\uchar{102}{220}\uchar{101}{229}}
- \definecommand jaencodedwednesday {\uchar{103}{40}\uchar{102}{220}\uchar{101}{229}}
- \definecommand jaencodedthursday {\uchar{145}{209}\uchar{102}{220}\uchar{101}{229}}
- \definecommand jaencodedfriday {\uchar{87}{31}\uchar{102}{220}\uchar{101}{229}}
- \definecommand jaencodedsaturday {\uchar{101}{229}\uchar{102}{220}\uchar{101}{229}}
-
-\stopencoding
-
-\protect \endinput
diff --git a/tex/context/base/lang-lab.mkiv b/tex/context/base/lang-lab.mkiv
index 60408f787..0be27b4ca 100644
--- a/tex/context/base/lang-lab.mkiv
+++ b/tex/context/base/lang-lab.mkiv
@@ -37,41 +37,65 @@
%D \showsetup{setupheadtext}
%D \showsetup{setuplabeltext}
%D
-%D In a few paragraphs we'll show quite a lot of examples
-%D of its use.
+%D A regular \CONTEXT\ stores some 1500 labels at most.
\let\handletextprefix\relax
-\def\setupheadtext {\dosetupsometextprefix[\c!title]}
-\def\setuplabeltext{\dosetupsometextprefix[\c!label]}
-
-\def\dosetupsometextprefix
- {\let\dodocommand\xdosetupsometextprefix
- \dotripleempty\dodosetupsometextprefix}
-
-% \def\dodosetupsometextprefix[#1][#2][#3]%
-% {\ifthirdargument
-% \def\docommand##1{\dodocommand[#1#2][##1]}%
-% \processcommalist[#3]\docommand
-% \else
-% \def\docommand##1{\dodocommand[#1\currentmainlanguage][##1]}%
-% \processcommalist[#2]\docommand
-% \fi}
-
-\def\dodosetupsometextprefix[#1][#2][#3]%
- {\ifthirdargument
- \def\docommand##1{\expanded{\dodocommand[#1\reallanguagetag{#2}]}[##1]}%
- \processcommalist[#3]\docommand
+\newconditional\protecttextprefixes
+
+\let\currenttextprefixtag \s!unknown
+\let\currenttextprefixclass\s!unknown
+
+\def\setupheadtext {\setfalse\protecttextprefixes\let\currenttextprefixclass\??mh\dodoubleempty\dosetupsometextprefix}
+\def\setuplabeltext{\setfalse\protecttextprefixes\let\currenttextprefixclass\??ml\dodoubleempty\dosetupsometextprefix}
+
+\def\dosetupsometextprefix[#1][#2]%
+ {\ifsecondargument
+ \edef\currenttextprefixtag{\reallanguagetag{#1}}%
+ \processcommalist[#2]\dodosetupsometextprefix
\else
- \def\docommand##1{\expanded{\dodocommand[#1\reallanguagetag\currentmainlanguage]}[##1]}%
- \processcommalist[#2]\docommand
+ \edef\currenttextprefixtag{\reallanguagetag\currentmainlanguage}%
+ \processcommalist[#1]\dodosetupsometextprefix
\fi}
-\def\doassignsometextprefix[#1][#2,#3,#4]%
- {\setvalue{#1}{\handletextprefix{#2}{#3}}}
+\def\dodosetupsometextprefix#1%
+ {\dododosetupsometextprefix[#1]}
-\def\xdosetupsometextprefix[#1][#2=#3]%
- {\doassignsometextprefix[#1#2][#3,,]}
+\def\dododosetupsometextprefix[#1=#2]%
+ {\doassignsometextprefix{#1}[#2,,]}
+
+\def\doassignsometextprefix#1%
+ {\ifconditional\protecttextprefixes
+ \ifcsname\currenttextprefixclass\currenttextprefixtag#1\endcsname
+ \expandafter\expandafter\expandafter\doassignsometextprefixnop
+ \else
+ \expandafter\expandafter\expandafter\doassignsometextprefixyes
+ \fi
+ \else
+ \expandafter\doassignsometextprefixyes
+ \fi{#1}}
+
+\ifdefined\Word\else \let\Word\relax \fi
+
+% Checking saves some 8K in the compressed format and getting rid of the embedded
+% \handletextprefix was good for another 6K. In the end the new solution is not
+% even that inefficient. And the checking is done at format generation time anyway.
+
+\def\doassignsometextprefixyes#1[#2,#3,#4]%
+ {\edef\!!stringa{#2}%
+ \edef\!!stringb{#3}%
+ \ifx\!!stringb\empty
+ \ifx\!!stringa\empty
+ \expandafter\def\csname\currenttextprefixclass\currenttextprefixtag#1\endcsname{\empty\empty}%
+ \else
+ \expandafter\def\csname\currenttextprefixclass\currenttextprefixtag#1\endcsname{{#2}\empty}%
+ \fi
+ \else
+ \expandafter\def\csname\currenttextprefixclass\currenttextprefixtag#1\endcsname{{#2}{#3}}%
+ \fi}
+
+\def\doassignsometextprefixnop[#1][#2]%
+ {}
%D By changing the meaning of \type {\handletextprefix} we
%D can filter the left and right labeltext as well as convert
@@ -100,86 +124,61 @@
%D
%D The latter one has an upcased alternative \type{\LABELTEXT}.
-% \def\labellanguage{\currentmainlanguage}
-% \def\headlanguage {\currentmainlanguage}
-
-% \def\labellanguage{\defaultlanguage\currentmainlanguage}
-% \def\headlanguage {\defaultlanguage\currentmainlanguage}
-
\def\labellanguage{\reallanguagetag{\defaultlanguage\currentmainlanguage}}
\def\headlanguage {\reallanguagetag{\defaultlanguage\currentmainlanguage}}
\appendtoks \let\labellanguage\currentlanguage \to \everycurrentdate
-\unexpanded\def\headtext
- {\let\handletextprefix\firstoftwoarguments
- \let\reporttextprefixerror\doreporttextprefixerror
- \global\labeltextdonetrue
- \dogetupsometextprefix\headlanguage\c!title}
-
-\unexpanded\def\leftlabeltext
- {\let\handletextprefix\firstoftwoarguments
- \let\reporttextprefixerror\doreporttextprefixerror
- \global\labeltextdonetrue
- \dogetupsometextprefix\labellanguage\c!label}
-
-\unexpanded\def\rightlabeltext
- {\let\handletextprefix\secondoftwoarguments
- \let\reporttextprefixerror\doreporttextprefixerror
- \global\labeltextdonetrue
- \dogetupsometextprefix\labellanguage\c!label}
-
-\unexpanded\def\LEFTLABELTEXT
- {\def\handletextprefix##1##2{\uppercase{##1}}\DOLABELTEXT}
-
-\unexpanded\def\RIGHTLABELTEXT
- {\def\handletextprefix##1##2{\uppercase{##2}}\DOLABELTEXT}
-
-\def\DOLABELTEXT#1%
- {\bgroup
- \the\everyuppercase
- \let\reporttextprefixerror\doreporttextprefixerror
- \global\labeltextdonetrue
- \dogetupsometextprefix\labellanguage\c!label{#1}% not \labeltext (see \MONTH)
- \egroup}
-
-\let\labeltext \leftlabeltext
-\let\LABELTEXT \LEFTLABELTEXT
-
-\unexpanded\def\labeltexts#1#2{\leftlabeltext{#1}#2\rightlabeltext{#1}}
-\unexpanded\def\LABELTEXTS#1#2{\LEFTLABELTEXT{#1}#2\RIGHTLABELTEXT{#1}}
-
-\newif\iflabeltextdone % needs to be reset elsewhere
-\newif\iftracelabels % shows missing labels
-
-\def\doreporttextprefixerror#1#2#3%
- {\iftracelabels{\tttf[#2:~#3/#1]~}\fi}
-
-\def\dosetexpandedheadlabeltext#1#2#3%
- {\bgroup
- \let\handletextprefix\firstoftwoarguments
- \let\reporttextprefixerror\gobblethreearguments
- \keepencodedtokens % test on multilingual pascal, ok in stretched
- %\dontexpandencodedtokens % not usable in token handler
- \expanded
- {\egroup\noexpand\def\noexpand#2% watch out, no \edef
- {\dogetupsometextprefix{\headlanguage}{#1}{#3}}}}
-
-\def\setexpandedheadtext {\dosetexpandedheadlabeltext\c!title}
-\def\setexpandedlabeltext{\dosetexpandedheadlabeltext\c!label}
-
-\def\dogetupsometextprefix#1#2#3% must be expandable ! #1 == language
- {\ifcsname#2#1#3\endcsname
- \csname#2#1#3\endcsname
- \else\ifcsname\??la#1\s!default\endcsname
- \expandafter\dogetupsometextprefix\csname\??la#1\s!default\endcsname{#2}{#3}%
- \else\ifcsname#2#3\endcsname
- \csname#2#3\endcsname
- \else\ifcsname#1\s!en#3\endcsname
- \csname#2\s!en#3\endcsname
+\def\dummytextprefix{\empty\empty}
+
+\def\dogetupsomelabeltext#1%
+ {\ifcsname\??ml\labellanguage#1\endcsname
+ \expandafter\let\expandafter\thetextprefix\csname\??ml\labellanguage#1\endcsname
+ \else\ifcsname\??la\labellanguage\s!default\endcsname
+ \expandafter\dogetupsometextprefix\csname\??la\labellanguage\s!default\endcsname\??ml#1%
+ \else\ifcsname\??ml#1\endcsname
+ \expandafter\let\expandafter\thetextprefix\csname\??ml#1\endcsname
+ \else\ifcsname\??ml\s!en#1\endcsname
+ \expandafter\let\expandafter\thetextprefix\csname\??ml\s!en#1\endcsname
\else
- % \doreporttextprefixerror{#1}{#2}{#3}%
+ \let\thetextprefix\dummytextprefix
\fi\fi\fi\fi}
+
+\def\dogetupsomeheadtext#1%
+ {\ifcsname\??mh\headlanguage#1\endcsname
+ \expandafter\let\expandafter\thetextprefix\csname\??mh\headlanguage#1\endcsname
+ \else\ifcsname\??la\headlanguage\s!default\endcsname
+ \expandafter\dogetupsometextprefix\csname\??la\headlanguage\s!default\endcsname\??mh#1%
+ \else\ifcsname\??mh#1\endcsname
+ \expandafter\let\expandafter\thetextprefix\csname\??mh#1\endcsname
+ \else\ifcsname\??mh\s!en#1\endcsname
+ \expandafter\let\expandafter\thetextprefix\csname\??mh\s!en#1\endcsname
+ \else
+ \let\thetextprefix\dummytextprefix
+ \fi\fi\fi\fi}
+
+% The WORD variants are a bit inefficient when #1/#2 are empty but they are
+% seldom used (one can better set the style).
+
+\let\flushleftlabeltext \firstoftwoarguments
+\let\flushrightlabeltext\secondoftwoarguments
+
+\def\flushleftlabelWORD #1#2{\WORD{#1}}
+\def\flushrightlabelWORD#1#2{\WORD{#2}}
+
+\def\flushbothlabeltexts#1#2#3{#1#3#2}
+\def\flushbothlabelTEXTS#1#2#3{\WORD{#1}#3\WORD{#2}}
+
+\unexpanded\def\headtext #1{\dogetupsomeheadtext {#1}\expandafter\flushleftlabeltext \thetextprefix}
+\unexpanded\def\leftlabeltext #1{\dogetupsomelabeltext{#1}\expandafter\flushleftlabeltext \thetextprefix}
+\unexpanded\def\rightlabeltext#1{\dogetupsomelabeltext{#1}\expandafter\flushrightlabeltext\thetextprefix}
+\unexpanded\def\LEFTLABELTEXT #1{\dogetupsomelabeltext{#1}\expandafter\flushleftlabelWORD \thetextprefix}
+\unexpanded\def\RIGHTLABELTEXT#1{\dogetupsomelabeltext{#1}\expandafter\flushrightlabelWORD\thetextprefix}
+\unexpanded\def\labeltexts #1{\dogetupsomelabeltext{#1}\expandafter\flushbothlabeltexts\thetextprefix} % #2
+\unexpanded\def\LABELTEXTS #1{\dogetupsomelabeltext{#1}\expandafter\flushbothlabelTEXTS\thetextprefix} % #2
+
+\let\labeltext\leftlabeltext
+\let\LABELTEXT\LEFTLABELTEXT
\ifx\simplifiedcommands\undefined \newtoks\simplifiedcommands \fi
@@ -201,15 +200,8 @@
%D head and label texts without replacing predefined ones.
%D These are internal macros.
-\def\xdopresetsometextprefix[#1][#2=#3]%
- {\ifundefined{#1#2}\doassignsometextprefix[#1\reallanguagetag{#2}][#3,,]\fi}
-
-\def\dopresetsometextprefix
- {\let\dodocommand\xdopresetsometextprefix
- \dotripleempty\dodosetupsometextprefix}
-
-\def\presetheadtext {\dopresetsometextprefix[\c!title]}
-\def\presetlabeltext{\dopresetsometextprefix[\c!label]}
+\def\presetheadtext {\settrue\protecttextprefixes\let\currenttextprefixclass\??mh\dodoubleempty\dosetupsometextprefix}
+\def\presetlabeltext{\settrue\protecttextprefixes\let\currenttextprefixclass\??ml\dodoubleempty\dosetupsometextprefix}
%D \macros
%D {translate}
diff --git a/tex/context/base/lang-mis.mkii b/tex/context/base/lang-mis.mkii
new file mode 100644
index 000000000..eb7bb1a04
--- /dev/null
+++ b/tex/context/base/lang-mis.mkii
@@ -0,0 +1,683 @@
+%D \module
+%D [ file=lang-mis,
+%D version=1997.03.20, % used to be supp-lan.tex
+%D title=\CONTEXT\ Language Macros,
+%D subtitle=Compounds,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Language Macros / Compounds}
+
+%D \gdef\starttest
+%D {\blank
+%D \noindent
+%D \halign\bgroup\tt##\hskip2em#\hskip2em#\cr}
+%D
+%D \gdef\stoptest
+%D {\egroup
+%D \blank}
+%D
+%D \gdef\test#1%
+%D {\defconvertedargument\ascii{#1}\ascii&\hyphenatedword{#1}\cr}
+
+\unprotect
+
+%D One of \TEX's strong points in building paragraphs is the way
+%D hyphenations are handled. Although for real good hyphenation
+%D of non||english languages some extensions to the program are
+%D needed, fairly good results can be reached with the standard
+%D mechanisms and an additional macro, at least in Dutch.
+
+%D \CONTEXT\ originates in the wish to typeset educational
+%D materials, especially in a technical environment. In
+%D production oriented environments, a lot of compound words
+%D are used. Because the Dutch language poses no limits on
+%D combining words, we often favor putting dashes between those
+%D words, because it facilitates reading, at least for those
+%D who are not that accustomed to it.
+%D
+%D In \TEX\ compound words, separated by a hyphen, are not
+%D hyphenated at all. In spite of the multiple pass paragraph
+%D typesetting this can lead to parts of words sticking into
+%D the margin. The solution lays in saying \type
+%D {spoelwater||terugwinunit} instead of \type
+%D {spoelwater-terugwinunit}. By using a one character command
+%D like \type {|}, delimited by the same character \type {|},
+%D we get ourselves both a decent visualization (in \TEXEDIT\
+%D and colored verbatim we color these commands yellow) and an
+%D efficient way of combining words.
+%D
+%D The sequence \type{||} simply leads to two words connected by
+%D a hyphen. Because we want to distinguish such a hyphen from
+%D the one inserted when \TEX\ hyphenates a word, we use a bit
+%D longer one.
+%D
+%D \hyphenation {spoel-wa-ter te-rug-win-unit}
+%D
+%D \starttest
+%D \test {spoelwater||terugwinunit}
+%D \stoptest
+%D
+%D As we already said, the \type{|} is a command. This commands
+%D accepts an optional argument before it's delimiter, which is
+%D also a \type{|}.
+%D
+%D \hyphenation {po-ly-meer che-mie}
+%D
+%D \starttest
+%D \test {polymeer|*|chemie}
+%D \stoptest
+%D
+%D Arguments like \type{*} are not interpreted and inserted
+%D directly, in contrary to arguments like:
+%D
+%D \starttest
+%D \test {polymeer|~|chemie}
+%D \test {|(|polymeer|)|chemie}
+%D \test {polymeer|(|chemie|)| }
+%D \stoptest
+%D
+%D Although such situations seldom occur |<|we typeset thousands
+%D of pages before we encountered one that forced us to enhance
+%D this mechanism|>| we also have to take care of comma's.
+%D
+%D \hyphenation {uit-stel-len}
+%D
+%D \starttest
+%D \test {op||, in|| en uitstellen}
+%D \stoptest
+%D
+%D The next special case (concerning quotes) was brought to my
+%D attention by Piet Tutelaers, one of the driving forces
+%D behind rebuilding hyphenation patterns for the dutch
+%D language.\footnote{In 1996 the spelling of the dutch
+%D language has been slightly reformed which made this topic
+%D actual again.} We'll also take care of this case.
+%D
+%D \starttest
+%D \test {AOW|'|er}
+%D \test {cd|'|tje}
+%D \test {ex|-|PTT|'|er}
+%D \test {rock|-|'n|-|roller}
+%D \stoptest
+%D
+%D Tobias Burnus pointed out that I should also support
+%D something like
+%D
+%D \starttest
+%D \test {well|_|known}
+%D \stoptest
+%D
+%D to stress the compoundness of hyphenated words.
+%D
+%D Of course we also have to take care of the special case:
+%D
+%D \starttest
+%D \test {text||color and ||font}
+%D \stoptest
+
+%D \macros
+%D {installdiscretionaries}
+%D
+%D The mechanism described here is one of the older inner parts
+%D of \CONTEXT. The most recent extensions concerns some
+%D special cases as well as the possibility to install other
+%D characters as delimiters. The prefered way of specifying
+%D compound words is using \type{||}, which is installed by:
+%D
+%D \starttyping
+%D \installdiscretionaries || -
+%D \stoptyping
+%D
+%D Some alternative definitions are:
+%D
+%D \startbuffer
+%D \installdiscretionaries ** -
+%D \installdiscretionaries ++ -
+%D \installdiscretionaries // -
+%D \installdiscretionaries ~~ -
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D after which we can say:
+%D
+%D \bgroup
+%D \getbuffer
+%D \starttest
+%D \test {test**test**test}
+%D \test {test++test++test}
+%D \test {test//test//test}
+%D \test {test~~test~~test}
+%D \stoptest
+%D \egroup
+
+%D \macros
+%D {compoundhyphen,
+%D beginofsubsentence,endofsubsentence}
+%D
+%D Now let's go to the macros. First we define some variables.
+%D In the main \CONTEXT\ modules these can be tuned by a setup
+%D command. Watch the (maybe) better looking compound hyphen.
+
+\ifx\compoundhyphen \undefined \def\compoundhyphen{\hbox{-\kern-.25ex-}} \fi
+
+\ifx\beginofsubsentence \undefined \def\beginofsubsentence{\hbox{---}} \fi
+\ifx\endofsubsentence \undefined \def\endofsubsentence {\hbox{---}} \fi
+
+%D The last two variables are needed for subsentences
+%D |<|like this one|>| which we did not yet mention.
+%D
+%D We want to enable breaking but at the same time don't want
+%D compound characters like |-| or || to be separated from the
+%D words. \TEX\ hackers will recognise the next two macro's:
+
+\ifx\prewordbreak \undefined \def\prewordbreak {\penalty\plustenthousand\hskip\zeropoint\relax} \fi
+%ifx\postwordbreak \undefined \def\postwordbreak{\penalty\zerocount \prewordbreak } \fi
+\ifx\postwordbreak \undefined \def\postwordbreak{\penalty\zerocount \hskip\zeropoint\relax} \fi
+
+\ifx\hspaceamount \undefined \def\hspaceamount#1#2{.16667em} \fi % language specific
+
+%D \macros
+%D {beginofsubsentencespacing,endofsubsentencespacing}
+%D
+%D In the previous macros we provided two hooks which can be
+%D used to support nested sub||sentences. In \CONTEXT\ these
+%D hooks are used to insert a small space when needed.
+
+\ifx\beginofsubsentencespacing\undefined \let\beginofsubsentencespacing\relax \fi
+\ifx\endofsubsentencespacing \undefined \let\endofsubsentencespacing \relax \fi
+
+%D The following piece of code is a torture test compound
+%D hndling. The \type {\relax} before the \type {\ifmmode} is
+%D needed because of the alignment scanner (in \ETEX\ this
+%D problem is not present because there a protected macro is
+%D not expanded. Thanks to Tobias Burnus for providing this
+%D example.
+%D
+%D \startformula
+%D \left|f(x_n)-{1\over2}\right| =
+%D {\cases{|{1\over2}-x_n| &for $0\le x_n < {1\over2}$\cr
+%D |x_n-{1\over2}| &for ${1\over2}\zeropoint
+ (\prewordbreak
+ \else
+ \prewordbreak\discretionary{}{(-}{(}\prewordbreak
+ \fi}
+
+\definetextmodediscretionary ~
+ {\prewordbreak\discretionary{-}{}{\thinspace}\postwordbreak}
+
+\definetextmodediscretionary '
+ {\prewordbreak\discretionary{-}{}{'}\postwordbreak}
+
+\definetextmodediscretionary ^
+ {\prewordbreak\discretionary{\hbox{$|$}}{}{\hbox{$|$}}%
+ \allowbreak\postwordbreak} % bugged
+
+\definetextmodediscretionary <
+ {\beginofsubsentence\prewordbreak\beginofsubsentencespacing}
+
+\definetextmodediscretionary >
+ {\endofsubsentencespacing\prewordbreak\endofsubsentence}
+
+\definetextmodediscretionary =
+ {\prewordbreak\midsentence\prewordbreak} % {\prewordbreak\compoundhyphen}
+
+% french
+
+\definetextmodediscretionary : {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{:}:}
+\definetextmodediscretionary ; {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{;};}
+\definetextmodediscretionary ? {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{?}?}
+\definetextmodediscretionary ! {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{!}!}
+
+\definetextmodediscretionary *
+ {\prewordbreak\discretionary{-}{}{\kern.05em}\prewordbreak}
+
+% spanish
+
+\definetextmodediscretionary ?? {\prewordbreak\questiondown}
+\definetextmodediscretionary !! {\prewordbreak\exclamdown}
+
+% \ifx\normalcompound\undefined \let\normalcompound=| \fi
+
+%D \installdiscretionary | +
+%D \installdiscretionary + =
+
+\def\defaultdiscretionaryhyphen{\compoundhyphen}
+
+\installdiscretionary | \defaultdiscretionaryhyphen % installs in ctx and prt will fall back on it
+
+%D \macros
+%D {fakecompoundhyphen}
+%D
+%D In headers and footers as well as in active pieces of text
+%D we need a dirty hack. Try to imagine what is needed to
+%D savely break the next text across a line and at the same
+%D time make the words interactive.
+%D
+%D \starttyping
+%D \goto{Some||Long||Word}
+%D \stoptyping
+
+\def\fakecompoundhyphen
+ {\def\|{\mathortext\vert\dofakecompoundhyphen}}
+
+\def\dofakecompoundhyphen
+ {\def##1|%
+ {\doifelsenothing{##1}\compoundhyphen{##1}%
+ \kern\compoundbreakpoint\allowbreak}}
+
+%D \macros
+%D {midworddiscretionary}
+%D
+%D If needed, one can add a discretionary hyphen using \type
+%D {\midworddiscretionary}. This macro does the same as
+%D \PLAIN\ \TEX's \type {\-}, but, like the ones implemented
+%D earlier, this one also looks ahead for spaces and grouping
+%D tokens.
+
+\def\midworddiscretionary
+ {\futurelet\next\domidworddiscretionary}
+
+\def\domidworddiscretionary
+ {\ifx\next\blankspace\else
+ \ifx\next\bgroup \else
+ \ifx\next\egroup \else
+ \discretionary{-}{}{}%
+ \fi\fi\fi}
+
+%D \macros
+%D {installcompoundcharacter}
+%D
+%D When Tobias Burnus started translating the dutch manual of
+%D \PPCHTEX\ into german, he suggested to let \CONTEXT\ support
+%D the \type{german.sty} method of handling compound
+%D characters, especially the umlaut. This package is meant for
+%D use with \PLAIN\ \TEX\ as well as \LATEX.
+%D
+%D I decided to implement compound character support as
+%D versatile as possible. As a result one can define his own
+%D compound character support, like:
+%D
+%D \starttyping
+%D \installcompoundcharacter "a {\"a}
+%D \installcompoundcharacter "e {\"e}
+%D \installcompoundcharacter "i {\"i}
+%D \installcompoundcharacter "u {\"u}
+%D \installcompoundcharacter "o {\"o}
+%D \installcompoundcharacter "s {\SS}
+%D \stoptyping
+%D
+%D or even
+%D
+%D \starttyping
+%D \installcompoundcharacter "ck {\discretionary {k-}{k}{ck}}
+%D \installcompoundcharacter "ff {\discretionary{ff-}{f}{ff}}
+%D \stoptyping
+%D
+%D The support is not limited to alphabetic characters, so the
+%D next definition is also valid.
+%D
+%D \starttyping
+%D \installcompoundcharacter ". {.\doifnextcharelse{\spacetoken}{}{\kern.125em}}
+%D \stoptyping
+%D
+%D The implementation looks familiar and uses the same tricks as
+%D mentioned earlier in this module. We take care of two
+%D arguments, which complicates things a bit.
+
+\def\@nc@{@nc@} % normal character
+\def\@cc@{@cc@} % compound character
+\def\@cs@{@cs@} % compound characters
+\def\@cx@{@cx@} % compound definition
+
+%D When we started working on MK IV code, we needed a different
+%D approach for defining the active character itself. In MK II as
+%D well as in MK IV we now use the catcode vectors.
+
+\chardef\compoundcharactermode\plusone
+
+\def\installcompoundcharacter #1#2#3 #4% {#4} no grouping
+ {\ifcase\compoundcharactermode
+ % ignore mode
+ \else
+ \chardef\thecompoundcharacter`#1%
+ \@EA\chardef\csname\@nc@\string#1\endcsname\thecompoundcharacter
+ \def\!!stringa{#3}%
+ \@EA\def\csname\ifx\!!stringa\empty\@cc@\else\@cs@\fi\detokenize{#1#2#3}\endcsname{#4}%
+ \setevalue{\@cx@\detokenize{#1}}{\noexpand\handlecompoundcharacter{\detokenize{#1}}}% beter nr's
+% \@EA\letcatcodecommand\@EA\prtcatcodes\@EA\thecompoundcharacter\csname\@cx@\detokenize{#1}\endcsname
+% \@EA\letcatcodecommand\@EA\texcatcodes\@EA\thecompoundcharacter\csname\@cx@\detokenize{#1}\endcsname
+ \@EA\letcatcodecommand\@EA\ctxcatcodes\@EA\thecompoundcharacter\csname\@cx@\detokenize{#1}\endcsname
+ \fi}
+
+%D In order to serve the language specific well, we will introduce
+%D a namespace:
+
+% \ifx\currentlanguage\undefined
+ \let\compoundcharacterclass\empty
+% \else
+% \def\compoundcharacterclass{\currentlanguage}
+% \fi
+
+\def\@cc@{@cc@\compoundcharacterclass} % compound character
+\def\@cs@{@cs@\compoundcharacterclass} % compound characters
+
+%D We can also ignore definitions (needed in for instance \XML). Beware,
+%D this macro is supposed to be used grouped!
+
+\def\ignorecompoundcharacter
+ {\chardef\compoundcharactermode\zerocount}
+
+\let\restorecompoundcharacter \gobbleoneargument % obsolete
+\let\enableactivediscretionaries\relax % obsolete
+
+%D In handling the compound characters we have to take care of
+%D \type{\bgroup} and \type{\egroup} tokens, so we end up with
+%D a multi||step interpretation macro. We look ahead for a
+%D \type{\bgroup}, \type{\egroup} or \type{\blankspace}. Being
+%D no user of this mechanism, the credits for testing them goes
+%D to Tobias Burnus, the first german user of \CONTEXT.
+%D
+%D We define these macros as \type{\long} because we can
+%D expect \type{\par} tokens. We need to look into the future
+%D with \type{\futurelet} to prevent spaces from
+%D disappearing.
+
+\def\handlecompoundcharacter#1%
+ {\def\xhandlecompoundcharacter{\dohandlecompoundcharacter{#1}}%
+ \futurelet\next\xhandlecompoundcharacter}
+
+\def\dohandlecompoundcharacter
+ {\ifx\next\bgroup
+ %\@EA\dodohandlecompoundcharacter % handle "{ee} -> \"ee
+ %\@EA\gobbleoneargument % forget "{ee} -> ee
+ \@EA\handlecompoundcharacterone % ignore "{ee} -> "ee
+ \else\ifx\next\egroup
+ \@EAEAEA\donohandlecompoundcharacter
+ \else\ifx\next\blankspace
+ \@EA\@EAEAEA\@EA\donohandlecompoundcharacter
+ \else
+ \@EA\@EAEAEA\@EA\dodohandlecompoundcharacter
+ \fi\fi\fi}
+
+\def\donohandlecompoundcharacter#1{\csname\@nc@\string#1\endcsname}
+
+\def\dododohandlecompoundcharacter
+ {\ifx\next\bgroup
+ \@EA\handlecompoundcharacterone
+ \else\ifx\next\egroup
+ \@EAEAEA\handlecompoundcharacterone
+ \else\ifx\next\blankspace
+ \@EA\@EAEAEA\@EA\handlecompoundcharacterone
+ \else
+ \@EA\@EAEAEA\@EA\handlecompoundcharactertwo
+ \fi\fi\fi}
+
+\def\dodohandlecompoundcharacter#1#2% preserve space
+ {\def\xdodohandlecompoundcharacter{\dododohandlecompoundcharacter#1#2}%
+ \futurelet\next\xdodohandlecompoundcharacter}
+
+%D Besides taken care of the grouping and space tokens, we have
+%D to deal with three situations. First we look if the next
+%D character equals the first one, if so, then we just insert
+%D the original. Next we look if indeed a compound character is
+%D defined. We either execute the compound character or just
+%D insert the first. So we have
+%D
+%D \starttyping
+%D
+%D \stoptyping
+%D
+%D In later modules we will see how these commands are used.
+
+\long\def\handlecompoundcharacterone#1#2%
+ {\if\string#1\string#2% was: \ifx#1#2%
+ \def\next{\csname\@nc@\string#1\endcsname}%
+ \else\ifcsname\@cc@\string#1\string#2\endcsname
+ \def\next{\csname\@cc@\string#1\string#2\endcsname}%
+ \else
+ \def\next{\csname\@nc@\string#1\endcsname#2}%
+ \fi\fi
+ \next}
+
+\long\def\handlecompoundcharactertwo#1#2#3%
+ {\if\string#1\string#2%
+ \def\next{\csname\@nc@\string#1\endcsname#3}%
+ \else\ifcsname\@cs@\string#1\string#2\string#3\endcsname
+ \def\next{\csname\@cs@\string#1\string#2\string#3\endcsname}%
+ \else\ifcsname\@cc@\string#1\string#2\endcsname
+ \def\next{\csname\@cc@\string#1\string#2\endcsname#3}%
+ \else
+ \def\next{\csname\@nc@\string#1\endcsname#2#3}%
+ \fi\fi\fi
+ \next}
+
+%D For very obscure applications (see for an application \type
+%D {lang-sla.tex}) we provide:
+
+\def\simplifiedcompoundcharacter#1#2%
+ {\ifcsname\@cc@\string#1\string#2\endcsname
+ \@EA\@EA\@EA\firstofoneargument\csname\@cc@\string#1\string#2\endcsname
+ \else
+ #2%
+ \fi}
+
+%D \macros
+%D {disablediscretionaries,disablecompoundcharacter}
+%D
+%D Occasionally we need to disable this mechanism. For the
+%D moment we assume that \type {|} is used.
+
+\let\disablediscretionaries \ignorediscretionaries
+\let\disablecompoundcharacters\ignorecompoundcharacter
+
+%D \macros
+%D {normalcompound}
+%D
+%D Handy in for instance XML. (Kind of obsolete)
+
+\ifx\normalcompound\undefined \let\normalcompound=| \fi
+
+\protect \endinput
diff --git a/tex/context/base/lang-mis.mkiv b/tex/context/base/lang-mis.mkiv
new file mode 100644
index 000000000..eb7bb1a04
--- /dev/null
+++ b/tex/context/base/lang-mis.mkiv
@@ -0,0 +1,683 @@
+%D \module
+%D [ file=lang-mis,
+%D version=1997.03.20, % used to be supp-lan.tex
+%D title=\CONTEXT\ Language Macros,
+%D subtitle=Compounds,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Language Macros / Compounds}
+
+%D \gdef\starttest
+%D {\blank
+%D \noindent
+%D \halign\bgroup\tt##\hskip2em#\hskip2em#\cr}
+%D
+%D \gdef\stoptest
+%D {\egroup
+%D \blank}
+%D
+%D \gdef\test#1%
+%D {\defconvertedargument\ascii{#1}\ascii&\hyphenatedword{#1}\cr}
+
+\unprotect
+
+%D One of \TEX's strong points in building paragraphs is the way
+%D hyphenations are handled. Although for real good hyphenation
+%D of non||english languages some extensions to the program are
+%D needed, fairly good results can be reached with the standard
+%D mechanisms and an additional macro, at least in Dutch.
+
+%D \CONTEXT\ originates in the wish to typeset educational
+%D materials, especially in a technical environment. In
+%D production oriented environments, a lot of compound words
+%D are used. Because the Dutch language poses no limits on
+%D combining words, we often favor putting dashes between those
+%D words, because it facilitates reading, at least for those
+%D who are not that accustomed to it.
+%D
+%D In \TEX\ compound words, separated by a hyphen, are not
+%D hyphenated at all. In spite of the multiple pass paragraph
+%D typesetting this can lead to parts of words sticking into
+%D the margin. The solution lays in saying \type
+%D {spoelwater||terugwinunit} instead of \type
+%D {spoelwater-terugwinunit}. By using a one character command
+%D like \type {|}, delimited by the same character \type {|},
+%D we get ourselves both a decent visualization (in \TEXEDIT\
+%D and colored verbatim we color these commands yellow) and an
+%D efficient way of combining words.
+%D
+%D The sequence \type{||} simply leads to two words connected by
+%D a hyphen. Because we want to distinguish such a hyphen from
+%D the one inserted when \TEX\ hyphenates a word, we use a bit
+%D longer one.
+%D
+%D \hyphenation {spoel-wa-ter te-rug-win-unit}
+%D
+%D \starttest
+%D \test {spoelwater||terugwinunit}
+%D \stoptest
+%D
+%D As we already said, the \type{|} is a command. This commands
+%D accepts an optional argument before it's delimiter, which is
+%D also a \type{|}.
+%D
+%D \hyphenation {po-ly-meer che-mie}
+%D
+%D \starttest
+%D \test {polymeer|*|chemie}
+%D \stoptest
+%D
+%D Arguments like \type{*} are not interpreted and inserted
+%D directly, in contrary to arguments like:
+%D
+%D \starttest
+%D \test {polymeer|~|chemie}
+%D \test {|(|polymeer|)|chemie}
+%D \test {polymeer|(|chemie|)| }
+%D \stoptest
+%D
+%D Although such situations seldom occur |<|we typeset thousands
+%D of pages before we encountered one that forced us to enhance
+%D this mechanism|>| we also have to take care of comma's.
+%D
+%D \hyphenation {uit-stel-len}
+%D
+%D \starttest
+%D \test {op||, in|| en uitstellen}
+%D \stoptest
+%D
+%D The next special case (concerning quotes) was brought to my
+%D attention by Piet Tutelaers, one of the driving forces
+%D behind rebuilding hyphenation patterns for the dutch
+%D language.\footnote{In 1996 the spelling of the dutch
+%D language has been slightly reformed which made this topic
+%D actual again.} We'll also take care of this case.
+%D
+%D \starttest
+%D \test {AOW|'|er}
+%D \test {cd|'|tje}
+%D \test {ex|-|PTT|'|er}
+%D \test {rock|-|'n|-|roller}
+%D \stoptest
+%D
+%D Tobias Burnus pointed out that I should also support
+%D something like
+%D
+%D \starttest
+%D \test {well|_|known}
+%D \stoptest
+%D
+%D to stress the compoundness of hyphenated words.
+%D
+%D Of course we also have to take care of the special case:
+%D
+%D \starttest
+%D \test {text||color and ||font}
+%D \stoptest
+
+%D \macros
+%D {installdiscretionaries}
+%D
+%D The mechanism described here is one of the older inner parts
+%D of \CONTEXT. The most recent extensions concerns some
+%D special cases as well as the possibility to install other
+%D characters as delimiters. The prefered way of specifying
+%D compound words is using \type{||}, which is installed by:
+%D
+%D \starttyping
+%D \installdiscretionaries || -
+%D \stoptyping
+%D
+%D Some alternative definitions are:
+%D
+%D \startbuffer
+%D \installdiscretionaries ** -
+%D \installdiscretionaries ++ -
+%D \installdiscretionaries // -
+%D \installdiscretionaries ~~ -
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D after which we can say:
+%D
+%D \bgroup
+%D \getbuffer
+%D \starttest
+%D \test {test**test**test}
+%D \test {test++test++test}
+%D \test {test//test//test}
+%D \test {test~~test~~test}
+%D \stoptest
+%D \egroup
+
+%D \macros
+%D {compoundhyphen,
+%D beginofsubsentence,endofsubsentence}
+%D
+%D Now let's go to the macros. First we define some variables.
+%D In the main \CONTEXT\ modules these can be tuned by a setup
+%D command. Watch the (maybe) better looking compound hyphen.
+
+\ifx\compoundhyphen \undefined \def\compoundhyphen{\hbox{-\kern-.25ex-}} \fi
+
+\ifx\beginofsubsentence \undefined \def\beginofsubsentence{\hbox{---}} \fi
+\ifx\endofsubsentence \undefined \def\endofsubsentence {\hbox{---}} \fi
+
+%D The last two variables are needed for subsentences
+%D |<|like this one|>| which we did not yet mention.
+%D
+%D We want to enable breaking but at the same time don't want
+%D compound characters like |-| or || to be separated from the
+%D words. \TEX\ hackers will recognise the next two macro's:
+
+\ifx\prewordbreak \undefined \def\prewordbreak {\penalty\plustenthousand\hskip\zeropoint\relax} \fi
+%ifx\postwordbreak \undefined \def\postwordbreak{\penalty\zerocount \prewordbreak } \fi
+\ifx\postwordbreak \undefined \def\postwordbreak{\penalty\zerocount \hskip\zeropoint\relax} \fi
+
+\ifx\hspaceamount \undefined \def\hspaceamount#1#2{.16667em} \fi % language specific
+
+%D \macros
+%D {beginofsubsentencespacing,endofsubsentencespacing}
+%D
+%D In the previous macros we provided two hooks which can be
+%D used to support nested sub||sentences. In \CONTEXT\ these
+%D hooks are used to insert a small space when needed.
+
+\ifx\beginofsubsentencespacing\undefined \let\beginofsubsentencespacing\relax \fi
+\ifx\endofsubsentencespacing \undefined \let\endofsubsentencespacing \relax \fi
+
+%D The following piece of code is a torture test compound
+%D hndling. The \type {\relax} before the \type {\ifmmode} is
+%D needed because of the alignment scanner (in \ETEX\ this
+%D problem is not present because there a protected macro is
+%D not expanded. Thanks to Tobias Burnus for providing this
+%D example.
+%D
+%D \startformula
+%D \left|f(x_n)-{1\over2}\right| =
+%D {\cases{|{1\over2}-x_n| &for $0\le x_n < {1\over2}$\cr
+%D |x_n-{1\over2}| &for ${1\over2}\zeropoint
+ (\prewordbreak
+ \else
+ \prewordbreak\discretionary{}{(-}{(}\prewordbreak
+ \fi}
+
+\definetextmodediscretionary ~
+ {\prewordbreak\discretionary{-}{}{\thinspace}\postwordbreak}
+
+\definetextmodediscretionary '
+ {\prewordbreak\discretionary{-}{}{'}\postwordbreak}
+
+\definetextmodediscretionary ^
+ {\prewordbreak\discretionary{\hbox{$|$}}{}{\hbox{$|$}}%
+ \allowbreak\postwordbreak} % bugged
+
+\definetextmodediscretionary <
+ {\beginofsubsentence\prewordbreak\beginofsubsentencespacing}
+
+\definetextmodediscretionary >
+ {\endofsubsentencespacing\prewordbreak\endofsubsentence}
+
+\definetextmodediscretionary =
+ {\prewordbreak\midsentence\prewordbreak} % {\prewordbreak\compoundhyphen}
+
+% french
+
+\definetextmodediscretionary : {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{:}:}
+\definetextmodediscretionary ; {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{;};}
+\definetextmodediscretionary ? {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{?}?}
+\definetextmodediscretionary ! {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{!}!}
+
+\definetextmodediscretionary *
+ {\prewordbreak\discretionary{-}{}{\kern.05em}\prewordbreak}
+
+% spanish
+
+\definetextmodediscretionary ?? {\prewordbreak\questiondown}
+\definetextmodediscretionary !! {\prewordbreak\exclamdown}
+
+% \ifx\normalcompound\undefined \let\normalcompound=| \fi
+
+%D \installdiscretionary | +
+%D \installdiscretionary + =
+
+\def\defaultdiscretionaryhyphen{\compoundhyphen}
+
+\installdiscretionary | \defaultdiscretionaryhyphen % installs in ctx and prt will fall back on it
+
+%D \macros
+%D {fakecompoundhyphen}
+%D
+%D In headers and footers as well as in active pieces of text
+%D we need a dirty hack. Try to imagine what is needed to
+%D savely break the next text across a line and at the same
+%D time make the words interactive.
+%D
+%D \starttyping
+%D \goto{Some||Long||Word}
+%D \stoptyping
+
+\def\fakecompoundhyphen
+ {\def\|{\mathortext\vert\dofakecompoundhyphen}}
+
+\def\dofakecompoundhyphen
+ {\def##1|%
+ {\doifelsenothing{##1}\compoundhyphen{##1}%
+ \kern\compoundbreakpoint\allowbreak}}
+
+%D \macros
+%D {midworddiscretionary}
+%D
+%D If needed, one can add a discretionary hyphen using \type
+%D {\midworddiscretionary}. This macro does the same as
+%D \PLAIN\ \TEX's \type {\-}, but, like the ones implemented
+%D earlier, this one also looks ahead for spaces and grouping
+%D tokens.
+
+\def\midworddiscretionary
+ {\futurelet\next\domidworddiscretionary}
+
+\def\domidworddiscretionary
+ {\ifx\next\blankspace\else
+ \ifx\next\bgroup \else
+ \ifx\next\egroup \else
+ \discretionary{-}{}{}%
+ \fi\fi\fi}
+
+%D \macros
+%D {installcompoundcharacter}
+%D
+%D When Tobias Burnus started translating the dutch manual of
+%D \PPCHTEX\ into german, he suggested to let \CONTEXT\ support
+%D the \type{german.sty} method of handling compound
+%D characters, especially the umlaut. This package is meant for
+%D use with \PLAIN\ \TEX\ as well as \LATEX.
+%D
+%D I decided to implement compound character support as
+%D versatile as possible. As a result one can define his own
+%D compound character support, like:
+%D
+%D \starttyping
+%D \installcompoundcharacter "a {\"a}
+%D \installcompoundcharacter "e {\"e}
+%D \installcompoundcharacter "i {\"i}
+%D \installcompoundcharacter "u {\"u}
+%D \installcompoundcharacter "o {\"o}
+%D \installcompoundcharacter "s {\SS}
+%D \stoptyping
+%D
+%D or even
+%D
+%D \starttyping
+%D \installcompoundcharacter "ck {\discretionary {k-}{k}{ck}}
+%D \installcompoundcharacter "ff {\discretionary{ff-}{f}{ff}}
+%D \stoptyping
+%D
+%D The support is not limited to alphabetic characters, so the
+%D next definition is also valid.
+%D
+%D \starttyping
+%D \installcompoundcharacter ". {.\doifnextcharelse{\spacetoken}{}{\kern.125em}}
+%D \stoptyping
+%D
+%D The implementation looks familiar and uses the same tricks as
+%D mentioned earlier in this module. We take care of two
+%D arguments, which complicates things a bit.
+
+\def\@nc@{@nc@} % normal character
+\def\@cc@{@cc@} % compound character
+\def\@cs@{@cs@} % compound characters
+\def\@cx@{@cx@} % compound definition
+
+%D When we started working on MK IV code, we needed a different
+%D approach for defining the active character itself. In MK II as
+%D well as in MK IV we now use the catcode vectors.
+
+\chardef\compoundcharactermode\plusone
+
+\def\installcompoundcharacter #1#2#3 #4% {#4} no grouping
+ {\ifcase\compoundcharactermode
+ % ignore mode
+ \else
+ \chardef\thecompoundcharacter`#1%
+ \@EA\chardef\csname\@nc@\string#1\endcsname\thecompoundcharacter
+ \def\!!stringa{#3}%
+ \@EA\def\csname\ifx\!!stringa\empty\@cc@\else\@cs@\fi\detokenize{#1#2#3}\endcsname{#4}%
+ \setevalue{\@cx@\detokenize{#1}}{\noexpand\handlecompoundcharacter{\detokenize{#1}}}% beter nr's
+% \@EA\letcatcodecommand\@EA\prtcatcodes\@EA\thecompoundcharacter\csname\@cx@\detokenize{#1}\endcsname
+% \@EA\letcatcodecommand\@EA\texcatcodes\@EA\thecompoundcharacter\csname\@cx@\detokenize{#1}\endcsname
+ \@EA\letcatcodecommand\@EA\ctxcatcodes\@EA\thecompoundcharacter\csname\@cx@\detokenize{#1}\endcsname
+ \fi}
+
+%D In order to serve the language specific well, we will introduce
+%D a namespace:
+
+% \ifx\currentlanguage\undefined
+ \let\compoundcharacterclass\empty
+% \else
+% \def\compoundcharacterclass{\currentlanguage}
+% \fi
+
+\def\@cc@{@cc@\compoundcharacterclass} % compound character
+\def\@cs@{@cs@\compoundcharacterclass} % compound characters
+
+%D We can also ignore definitions (needed in for instance \XML). Beware,
+%D this macro is supposed to be used grouped!
+
+\def\ignorecompoundcharacter
+ {\chardef\compoundcharactermode\zerocount}
+
+\let\restorecompoundcharacter \gobbleoneargument % obsolete
+\let\enableactivediscretionaries\relax % obsolete
+
+%D In handling the compound characters we have to take care of
+%D \type{\bgroup} and \type{\egroup} tokens, so we end up with
+%D a multi||step interpretation macro. We look ahead for a
+%D \type{\bgroup}, \type{\egroup} or \type{\blankspace}. Being
+%D no user of this mechanism, the credits for testing them goes
+%D to Tobias Burnus, the first german user of \CONTEXT.
+%D
+%D We define these macros as \type{\long} because we can
+%D expect \type{\par} tokens. We need to look into the future
+%D with \type{\futurelet} to prevent spaces from
+%D disappearing.
+
+\def\handlecompoundcharacter#1%
+ {\def\xhandlecompoundcharacter{\dohandlecompoundcharacter{#1}}%
+ \futurelet\next\xhandlecompoundcharacter}
+
+\def\dohandlecompoundcharacter
+ {\ifx\next\bgroup
+ %\@EA\dodohandlecompoundcharacter % handle "{ee} -> \"ee
+ %\@EA\gobbleoneargument % forget "{ee} -> ee
+ \@EA\handlecompoundcharacterone % ignore "{ee} -> "ee
+ \else\ifx\next\egroup
+ \@EAEAEA\donohandlecompoundcharacter
+ \else\ifx\next\blankspace
+ \@EA\@EAEAEA\@EA\donohandlecompoundcharacter
+ \else
+ \@EA\@EAEAEA\@EA\dodohandlecompoundcharacter
+ \fi\fi\fi}
+
+\def\donohandlecompoundcharacter#1{\csname\@nc@\string#1\endcsname}
+
+\def\dododohandlecompoundcharacter
+ {\ifx\next\bgroup
+ \@EA\handlecompoundcharacterone
+ \else\ifx\next\egroup
+ \@EAEAEA\handlecompoundcharacterone
+ \else\ifx\next\blankspace
+ \@EA\@EAEAEA\@EA\handlecompoundcharacterone
+ \else
+ \@EA\@EAEAEA\@EA\handlecompoundcharactertwo
+ \fi\fi\fi}
+
+\def\dodohandlecompoundcharacter#1#2% preserve space
+ {\def\xdodohandlecompoundcharacter{\dododohandlecompoundcharacter#1#2}%
+ \futurelet\next\xdodohandlecompoundcharacter}
+
+%D Besides taken care of the grouping and space tokens, we have
+%D to deal with three situations. First we look if the next
+%D character equals the first one, if so, then we just insert
+%D the original. Next we look if indeed a compound character is
+%D defined. We either execute the compound character or just
+%D insert the first. So we have
+%D
+%D \starttyping
+%D
+%D \stoptyping
+%D
+%D In later modules we will see how these commands are used.
+
+\long\def\handlecompoundcharacterone#1#2%
+ {\if\string#1\string#2% was: \ifx#1#2%
+ \def\next{\csname\@nc@\string#1\endcsname}%
+ \else\ifcsname\@cc@\string#1\string#2\endcsname
+ \def\next{\csname\@cc@\string#1\string#2\endcsname}%
+ \else
+ \def\next{\csname\@nc@\string#1\endcsname#2}%
+ \fi\fi
+ \next}
+
+\long\def\handlecompoundcharactertwo#1#2#3%
+ {\if\string#1\string#2%
+ \def\next{\csname\@nc@\string#1\endcsname#3}%
+ \else\ifcsname\@cs@\string#1\string#2\string#3\endcsname
+ \def\next{\csname\@cs@\string#1\string#2\string#3\endcsname}%
+ \else\ifcsname\@cc@\string#1\string#2\endcsname
+ \def\next{\csname\@cc@\string#1\string#2\endcsname#3}%
+ \else
+ \def\next{\csname\@nc@\string#1\endcsname#2#3}%
+ \fi\fi\fi
+ \next}
+
+%D For very obscure applications (see for an application \type
+%D {lang-sla.tex}) we provide:
+
+\def\simplifiedcompoundcharacter#1#2%
+ {\ifcsname\@cc@\string#1\string#2\endcsname
+ \@EA\@EA\@EA\firstofoneargument\csname\@cc@\string#1\string#2\endcsname
+ \else
+ #2%
+ \fi}
+
+%D \macros
+%D {disablediscretionaries,disablecompoundcharacter}
+%D
+%D Occasionally we need to disable this mechanism. For the
+%D moment we assume that \type {|} is used.
+
+\let\disablediscretionaries \ignorediscretionaries
+\let\disablecompoundcharacters\ignorecompoundcharacter
+
+%D \macros
+%D {normalcompound}
+%D
+%D Handy in for instance XML. (Kind of obsolete)
+
+\ifx\normalcompound\undefined \let\normalcompound=| \fi
+
+\protect \endinput
diff --git a/tex/context/base/lang-mis.tex b/tex/context/base/lang-mis.tex
deleted file mode 100644
index eb7bb1a04..000000000
--- a/tex/context/base/lang-mis.tex
+++ /dev/null
@@ -1,683 +0,0 @@
-%D \module
-%D [ file=lang-mis,
-%D version=1997.03.20, % used to be supp-lan.tex
-%D title=\CONTEXT\ Language Macros,
-%D subtitle=Compounds,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Language Macros / Compounds}
-
-%D \gdef\starttest
-%D {\blank
-%D \noindent
-%D \halign\bgroup\tt##\hskip2em#\hskip2em#\cr}
-%D
-%D \gdef\stoptest
-%D {\egroup
-%D \blank}
-%D
-%D \gdef\test#1%
-%D {\defconvertedargument\ascii{#1}\ascii&\hyphenatedword{#1}\cr}
-
-\unprotect
-
-%D One of \TEX's strong points in building paragraphs is the way
-%D hyphenations are handled. Although for real good hyphenation
-%D of non||english languages some extensions to the program are
-%D needed, fairly good results can be reached with the standard
-%D mechanisms and an additional macro, at least in Dutch.
-
-%D \CONTEXT\ originates in the wish to typeset educational
-%D materials, especially in a technical environment. In
-%D production oriented environments, a lot of compound words
-%D are used. Because the Dutch language poses no limits on
-%D combining words, we often favor putting dashes between those
-%D words, because it facilitates reading, at least for those
-%D who are not that accustomed to it.
-%D
-%D In \TEX\ compound words, separated by a hyphen, are not
-%D hyphenated at all. In spite of the multiple pass paragraph
-%D typesetting this can lead to parts of words sticking into
-%D the margin. The solution lays in saying \type
-%D {spoelwater||terugwinunit} instead of \type
-%D {spoelwater-terugwinunit}. By using a one character command
-%D like \type {|}, delimited by the same character \type {|},
-%D we get ourselves both a decent visualization (in \TEXEDIT\
-%D and colored verbatim we color these commands yellow) and an
-%D efficient way of combining words.
-%D
-%D The sequence \type{||} simply leads to two words connected by
-%D a hyphen. Because we want to distinguish such a hyphen from
-%D the one inserted when \TEX\ hyphenates a word, we use a bit
-%D longer one.
-%D
-%D \hyphenation {spoel-wa-ter te-rug-win-unit}
-%D
-%D \starttest
-%D \test {spoelwater||terugwinunit}
-%D \stoptest
-%D
-%D As we already said, the \type{|} is a command. This commands
-%D accepts an optional argument before it's delimiter, which is
-%D also a \type{|}.
-%D
-%D \hyphenation {po-ly-meer che-mie}
-%D
-%D \starttest
-%D \test {polymeer|*|chemie}
-%D \stoptest
-%D
-%D Arguments like \type{*} are not interpreted and inserted
-%D directly, in contrary to arguments like:
-%D
-%D \starttest
-%D \test {polymeer|~|chemie}
-%D \test {|(|polymeer|)|chemie}
-%D \test {polymeer|(|chemie|)| }
-%D \stoptest
-%D
-%D Although such situations seldom occur |<|we typeset thousands
-%D of pages before we encountered one that forced us to enhance
-%D this mechanism|>| we also have to take care of comma's.
-%D
-%D \hyphenation {uit-stel-len}
-%D
-%D \starttest
-%D \test {op||, in|| en uitstellen}
-%D \stoptest
-%D
-%D The next special case (concerning quotes) was brought to my
-%D attention by Piet Tutelaers, one of the driving forces
-%D behind rebuilding hyphenation patterns for the dutch
-%D language.\footnote{In 1996 the spelling of the dutch
-%D language has been slightly reformed which made this topic
-%D actual again.} We'll also take care of this case.
-%D
-%D \starttest
-%D \test {AOW|'|er}
-%D \test {cd|'|tje}
-%D \test {ex|-|PTT|'|er}
-%D \test {rock|-|'n|-|roller}
-%D \stoptest
-%D
-%D Tobias Burnus pointed out that I should also support
-%D something like
-%D
-%D \starttest
-%D \test {well|_|known}
-%D \stoptest
-%D
-%D to stress the compoundness of hyphenated words.
-%D
-%D Of course we also have to take care of the special case:
-%D
-%D \starttest
-%D \test {text||color and ||font}
-%D \stoptest
-
-%D \macros
-%D {installdiscretionaries}
-%D
-%D The mechanism described here is one of the older inner parts
-%D of \CONTEXT. The most recent extensions concerns some
-%D special cases as well as the possibility to install other
-%D characters as delimiters. The prefered way of specifying
-%D compound words is using \type{||}, which is installed by:
-%D
-%D \starttyping
-%D \installdiscretionaries || -
-%D \stoptyping
-%D
-%D Some alternative definitions are:
-%D
-%D \startbuffer
-%D \installdiscretionaries ** -
-%D \installdiscretionaries ++ -
-%D \installdiscretionaries // -
-%D \installdiscretionaries ~~ -
-%D \stopbuffer
-%D
-%D \typebuffer
-%D
-%D after which we can say:
-%D
-%D \bgroup
-%D \getbuffer
-%D \starttest
-%D \test {test**test**test}
-%D \test {test++test++test}
-%D \test {test//test//test}
-%D \test {test~~test~~test}
-%D \stoptest
-%D \egroup
-
-%D \macros
-%D {compoundhyphen,
-%D beginofsubsentence,endofsubsentence}
-%D
-%D Now let's go to the macros. First we define some variables.
-%D In the main \CONTEXT\ modules these can be tuned by a setup
-%D command. Watch the (maybe) better looking compound hyphen.
-
-\ifx\compoundhyphen \undefined \def\compoundhyphen{\hbox{-\kern-.25ex-}} \fi
-
-\ifx\beginofsubsentence \undefined \def\beginofsubsentence{\hbox{---}} \fi
-\ifx\endofsubsentence \undefined \def\endofsubsentence {\hbox{---}} \fi
-
-%D The last two variables are needed for subsentences
-%D |<|like this one|>| which we did not yet mention.
-%D
-%D We want to enable breaking but at the same time don't want
-%D compound characters like |-| or || to be separated from the
-%D words. \TEX\ hackers will recognise the next two macro's:
-
-\ifx\prewordbreak \undefined \def\prewordbreak {\penalty\plustenthousand\hskip\zeropoint\relax} \fi
-%ifx\postwordbreak \undefined \def\postwordbreak{\penalty\zerocount \prewordbreak } \fi
-\ifx\postwordbreak \undefined \def\postwordbreak{\penalty\zerocount \hskip\zeropoint\relax} \fi
-
-\ifx\hspaceamount \undefined \def\hspaceamount#1#2{.16667em} \fi % language specific
-
-%D \macros
-%D {beginofsubsentencespacing,endofsubsentencespacing}
-%D
-%D In the previous macros we provided two hooks which can be
-%D used to support nested sub||sentences. In \CONTEXT\ these
-%D hooks are used to insert a small space when needed.
-
-\ifx\beginofsubsentencespacing\undefined \let\beginofsubsentencespacing\relax \fi
-\ifx\endofsubsentencespacing \undefined \let\endofsubsentencespacing \relax \fi
-
-%D The following piece of code is a torture test compound
-%D hndling. The \type {\relax} before the \type {\ifmmode} is
-%D needed because of the alignment scanner (in \ETEX\ this
-%D problem is not present because there a protected macro is
-%D not expanded. Thanks to Tobias Burnus for providing this
-%D example.
-%D
-%D \startformula
-%D \left|f(x_n)-{1\over2}\right| =
-%D {\cases{|{1\over2}-x_n| &for $0\le x_n < {1\over2}$\cr
-%D |x_n-{1\over2}| &for ${1\over2}\zeropoint
- (\prewordbreak
- \else
- \prewordbreak\discretionary{}{(-}{(}\prewordbreak
- \fi}
-
-\definetextmodediscretionary ~
- {\prewordbreak\discretionary{-}{}{\thinspace}\postwordbreak}
-
-\definetextmodediscretionary '
- {\prewordbreak\discretionary{-}{}{'}\postwordbreak}
-
-\definetextmodediscretionary ^
- {\prewordbreak\discretionary{\hbox{$|$}}{}{\hbox{$|$}}%
- \allowbreak\postwordbreak} % bugged
-
-\definetextmodediscretionary <
- {\beginofsubsentence\prewordbreak\beginofsubsentencespacing}
-
-\definetextmodediscretionary >
- {\endofsubsentencespacing\prewordbreak\endofsubsentence}
-
-\definetextmodediscretionary =
- {\prewordbreak\midsentence\prewordbreak} % {\prewordbreak\compoundhyphen}
-
-% french
-
-\definetextmodediscretionary : {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{:}:}
-\definetextmodediscretionary ; {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{;};}
-\definetextmodediscretionary ? {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{?}?}
-\definetextmodediscretionary ! {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{!}!}
-
-\definetextmodediscretionary *
- {\prewordbreak\discretionary{-}{}{\kern.05em}\prewordbreak}
-
-% spanish
-
-\definetextmodediscretionary ?? {\prewordbreak\questiondown}
-\definetextmodediscretionary !! {\prewordbreak\exclamdown}
-
-% \ifx\normalcompound\undefined \let\normalcompound=| \fi
-
-%D \installdiscretionary | +
-%D \installdiscretionary + =
-
-\def\defaultdiscretionaryhyphen{\compoundhyphen}
-
-\installdiscretionary | \defaultdiscretionaryhyphen % installs in ctx and prt will fall back on it
-
-%D \macros
-%D {fakecompoundhyphen}
-%D
-%D In headers and footers as well as in active pieces of text
-%D we need a dirty hack. Try to imagine what is needed to
-%D savely break the next text across a line and at the same
-%D time make the words interactive.
-%D
-%D \starttyping
-%D \goto{Some||Long||Word}
-%D \stoptyping
-
-\def\fakecompoundhyphen
- {\def\|{\mathortext\vert\dofakecompoundhyphen}}
-
-\def\dofakecompoundhyphen
- {\def##1|%
- {\doifelsenothing{##1}\compoundhyphen{##1}%
- \kern\compoundbreakpoint\allowbreak}}
-
-%D \macros
-%D {midworddiscretionary}
-%D
-%D If needed, one can add a discretionary hyphen using \type
-%D {\midworddiscretionary}. This macro does the same as
-%D \PLAIN\ \TEX's \type {\-}, but, like the ones implemented
-%D earlier, this one also looks ahead for spaces and grouping
-%D tokens.
-
-\def\midworddiscretionary
- {\futurelet\next\domidworddiscretionary}
-
-\def\domidworddiscretionary
- {\ifx\next\blankspace\else
- \ifx\next\bgroup \else
- \ifx\next\egroup \else
- \discretionary{-}{}{}%
- \fi\fi\fi}
-
-%D \macros
-%D {installcompoundcharacter}
-%D
-%D When Tobias Burnus started translating the dutch manual of
-%D \PPCHTEX\ into german, he suggested to let \CONTEXT\ support
-%D the \type{german.sty} method of handling compound
-%D characters, especially the umlaut. This package is meant for
-%D use with \PLAIN\ \TEX\ as well as \LATEX.
-%D
-%D I decided to implement compound character support as
-%D versatile as possible. As a result one can define his own
-%D compound character support, like:
-%D
-%D \starttyping
-%D \installcompoundcharacter "a {\"a}
-%D \installcompoundcharacter "e {\"e}
-%D \installcompoundcharacter "i {\"i}
-%D \installcompoundcharacter "u {\"u}
-%D \installcompoundcharacter "o {\"o}
-%D \installcompoundcharacter "s {\SS}
-%D \stoptyping
-%D
-%D or even
-%D
-%D \starttyping
-%D \installcompoundcharacter "ck {\discretionary {k-}{k}{ck}}
-%D \installcompoundcharacter "ff {\discretionary{ff-}{f}{ff}}
-%D \stoptyping
-%D
-%D The support is not limited to alphabetic characters, so the
-%D next definition is also valid.
-%D
-%D \starttyping
-%D \installcompoundcharacter ". {.\doifnextcharelse{\spacetoken}{}{\kern.125em}}
-%D \stoptyping
-%D
-%D The implementation looks familiar and uses the same tricks as
-%D mentioned earlier in this module. We take care of two
-%D arguments, which complicates things a bit.
-
-\def\@nc@{@nc@} % normal character
-\def\@cc@{@cc@} % compound character
-\def\@cs@{@cs@} % compound characters
-\def\@cx@{@cx@} % compound definition
-
-%D When we started working on MK IV code, we needed a different
-%D approach for defining the active character itself. In MK II as
-%D well as in MK IV we now use the catcode vectors.
-
-\chardef\compoundcharactermode\plusone
-
-\def\installcompoundcharacter #1#2#3 #4% {#4} no grouping
- {\ifcase\compoundcharactermode
- % ignore mode
- \else
- \chardef\thecompoundcharacter`#1%
- \@EA\chardef\csname\@nc@\string#1\endcsname\thecompoundcharacter
- \def\!!stringa{#3}%
- \@EA\def\csname\ifx\!!stringa\empty\@cc@\else\@cs@\fi\detokenize{#1#2#3}\endcsname{#4}%
- \setevalue{\@cx@\detokenize{#1}}{\noexpand\handlecompoundcharacter{\detokenize{#1}}}% beter nr's
-% \@EA\letcatcodecommand\@EA\prtcatcodes\@EA\thecompoundcharacter\csname\@cx@\detokenize{#1}\endcsname
-% \@EA\letcatcodecommand\@EA\texcatcodes\@EA\thecompoundcharacter\csname\@cx@\detokenize{#1}\endcsname
- \@EA\letcatcodecommand\@EA\ctxcatcodes\@EA\thecompoundcharacter\csname\@cx@\detokenize{#1}\endcsname
- \fi}
-
-%D In order to serve the language specific well, we will introduce
-%D a namespace:
-
-% \ifx\currentlanguage\undefined
- \let\compoundcharacterclass\empty
-% \else
-% \def\compoundcharacterclass{\currentlanguage}
-% \fi
-
-\def\@cc@{@cc@\compoundcharacterclass} % compound character
-\def\@cs@{@cs@\compoundcharacterclass} % compound characters
-
-%D We can also ignore definitions (needed in for instance \XML). Beware,
-%D this macro is supposed to be used grouped!
-
-\def\ignorecompoundcharacter
- {\chardef\compoundcharactermode\zerocount}
-
-\let\restorecompoundcharacter \gobbleoneargument % obsolete
-\let\enableactivediscretionaries\relax % obsolete
-
-%D In handling the compound characters we have to take care of
-%D \type{\bgroup} and \type{\egroup} tokens, so we end up with
-%D a multi||step interpretation macro. We look ahead for a
-%D \type{\bgroup}, \type{\egroup} or \type{\blankspace}. Being
-%D no user of this mechanism, the credits for testing them goes
-%D to Tobias Burnus, the first german user of \CONTEXT.
-%D
-%D We define these macros as \type{\long} because we can
-%D expect \type{\par} tokens. We need to look into the future
-%D with \type{\futurelet} to prevent spaces from
-%D disappearing.
-
-\def\handlecompoundcharacter#1%
- {\def\xhandlecompoundcharacter{\dohandlecompoundcharacter{#1}}%
- \futurelet\next\xhandlecompoundcharacter}
-
-\def\dohandlecompoundcharacter
- {\ifx\next\bgroup
- %\@EA\dodohandlecompoundcharacter % handle "{ee} -> \"ee
- %\@EA\gobbleoneargument % forget "{ee} -> ee
- \@EA\handlecompoundcharacterone % ignore "{ee} -> "ee
- \else\ifx\next\egroup
- \@EAEAEA\donohandlecompoundcharacter
- \else\ifx\next\blankspace
- \@EA\@EAEAEA\@EA\donohandlecompoundcharacter
- \else
- \@EA\@EAEAEA\@EA\dodohandlecompoundcharacter
- \fi\fi\fi}
-
-\def\donohandlecompoundcharacter#1{\csname\@nc@\string#1\endcsname}
-
-\def\dododohandlecompoundcharacter
- {\ifx\next\bgroup
- \@EA\handlecompoundcharacterone
- \else\ifx\next\egroup
- \@EAEAEA\handlecompoundcharacterone
- \else\ifx\next\blankspace
- \@EA\@EAEAEA\@EA\handlecompoundcharacterone
- \else
- \@EA\@EAEAEA\@EA\handlecompoundcharactertwo
- \fi\fi\fi}
-
-\def\dodohandlecompoundcharacter#1#2% preserve space
- {\def\xdodohandlecompoundcharacter{\dododohandlecompoundcharacter#1#2}%
- \futurelet\next\xdodohandlecompoundcharacter}
-
-%D Besides taken care of the grouping and space tokens, we have
-%D to deal with three situations. First we look if the next
-%D character equals the first one, if so, then we just insert
-%D the original. Next we look if indeed a compound character is
-%D defined. We either execute the compound character or just
-%D insert the first. So we have
-%D
-%D \starttyping
-%D
-%D \stoptyping
-%D
-%D In later modules we will see how these commands are used.
-
-\long\def\handlecompoundcharacterone#1#2%
- {\if\string#1\string#2% was: \ifx#1#2%
- \def\next{\csname\@nc@\string#1\endcsname}%
- \else\ifcsname\@cc@\string#1\string#2\endcsname
- \def\next{\csname\@cc@\string#1\string#2\endcsname}%
- \else
- \def\next{\csname\@nc@\string#1\endcsname#2}%
- \fi\fi
- \next}
-
-\long\def\handlecompoundcharactertwo#1#2#3%
- {\if\string#1\string#2%
- \def\next{\csname\@nc@\string#1\endcsname#3}%
- \else\ifcsname\@cs@\string#1\string#2\string#3\endcsname
- \def\next{\csname\@cs@\string#1\string#2\string#3\endcsname}%
- \else\ifcsname\@cc@\string#1\string#2\endcsname
- \def\next{\csname\@cc@\string#1\string#2\endcsname#3}%
- \else
- \def\next{\csname\@nc@\string#1\endcsname#2#3}%
- \fi\fi\fi
- \next}
-
-%D For very obscure applications (see for an application \type
-%D {lang-sla.tex}) we provide:
-
-\def\simplifiedcompoundcharacter#1#2%
- {\ifcsname\@cc@\string#1\string#2\endcsname
- \@EA\@EA\@EA\firstofoneargument\csname\@cc@\string#1\string#2\endcsname
- \else
- #2%
- \fi}
-
-%D \macros
-%D {disablediscretionaries,disablecompoundcharacter}
-%D
-%D Occasionally we need to disable this mechanism. For the
-%D moment we assume that \type {|} is used.
-
-\let\disablediscretionaries \ignorediscretionaries
-\let\disablecompoundcharacters\ignorecompoundcharacter
-
-%D \macros
-%D {normalcompound}
-%D
-%D Handy in for instance XML. (Kind of obsolete)
-
-\ifx\normalcompound\undefined \let\normalcompound=| \fi
-
-\protect \endinput
diff --git a/tex/context/base/lang-run.mkii b/tex/context/base/lang-run.mkii
new file mode 100644
index 000000000..4b332cfb9
--- /dev/null
+++ b/tex/context/base/lang-run.mkii
@@ -0,0 +1,36 @@
+%D \module
+%D [ file=lang-run,
+%D version=2005.09.08,
+%D title=\CONTEXT\ Language Macros,
+%D subtitle=Runtime Macros,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D [This code is hooked into the core macros and saves some
+%D format space.]
+
+\unprotect
+
+\gdef\showpatterns
+ {\bgroup
+ \def\doshowpatterns##1##2##3##4% language number encoding mapping
+ {\NC##1\NC##3\NC##4\NC##2\NC
+ \specificlanguageparameter{##1}\s!lefthyphenmin \NC
+ \specificlanguageparameter{##1}\s!righthyphenmin\NC\NR}%
+ \starttabulate[|c|c|c|c|c|c|]
+ \HL
+ \NC \bf language \NC \bf encoding \NC \bf mapping \NC \bf number \NC
+ \bf left\low{min} \NC
+ \bf right\low{min} \NC \NR
+ \HL
+ \preloadedpmessage
+ \HL
+ \stoptabulate
+ \egroup}
+
+\protect \endinput
diff --git a/tex/context/base/lang-run.tex b/tex/context/base/lang-run.tex
deleted file mode 100644
index 4b332cfb9..000000000
--- a/tex/context/base/lang-run.tex
+++ /dev/null
@@ -1,36 +0,0 @@
-%D \module
-%D [ file=lang-run,
-%D version=2005.09.08,
-%D title=\CONTEXT\ Language Macros,
-%D subtitle=Runtime Macros,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D [This code is hooked into the core macros and saves some
-%D format space.]
-
-\unprotect
-
-\gdef\showpatterns
- {\bgroup
- \def\doshowpatterns##1##2##3##4% language number encoding mapping
- {\NC##1\NC##3\NC##4\NC##2\NC
- \specificlanguageparameter{##1}\s!lefthyphenmin \NC
- \specificlanguageparameter{##1}\s!righthyphenmin\NC\NR}%
- \starttabulate[|c|c|c|c|c|c|]
- \HL
- \NC \bf language \NC \bf encoding \NC \bf mapping \NC \bf number \NC
- \bf left\low{min} \NC
- \bf right\low{min} \NC \NR
- \HL
- \preloadedpmessage
- \HL
- \stoptabulate
- \egroup}
-
-\protect \endinput
diff --git a/tex/context/base/lang-sla.tex b/tex/context/base/lang-sla.tex
index 0832e3f46..cd3c75b61 100644
--- a/tex/context/base/lang-sla.tex
+++ b/tex/context/base/lang-sla.tex
@@ -184,28 +184,6 @@
\installlanguage [cz] [\s!cs]
-% If this is really needed we should make an enco-fhr.
-%
-% \startlanguagespecifics[\s!hr]
-%
-% %\installcompoundcharacter /, {\handlequotation\c!leftquotation}
-% %\installcompoundcharacter /' {\handlequotation\c!rightquotation}
-%
-% \def\setupHRlanguage%
-% {\setuplanguage
-% [\s!hr]
-% [\c!leftsentence=\leftguillemot,
-% \c!rightsentence=\rightguillemot,
-% \c!leftsubsentence=\leftsubguillemot,
-% \c!rightsubsentence=\rightsubguillemot]}
-%
-% \installcompoundcharacter /< {{\setupHRlanguage|<|}}
-% \installcompoundcharacter /> {{\setupHRlanguage|>|}}
-%
-% \installcompoundcharacter /- {|-|}
-%
-% \stoplanguagespecifics
-
% labels
\setupheadtext [\s!pl] [\v!content=Spis tre\sacute ci]
diff --git a/tex/context/base/lang-spe.mkiv b/tex/context/base/lang-spe.mkiv
deleted file mode 100644
index 6f32888e6..000000000
--- a/tex/context/base/lang-spe.mkiv
+++ /dev/null
@@ -1,111 +0,0 @@
-%D \module
-%D [ file=lang-spe,
-%D version=2002.05.07, % 1996.01.25,
-%D title=\CONTEXT\ Language Macros,
-%D subtitle=Specifics,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt Language Macros / Specifics}
-
-%D In \MKIV\ we will get away from this feature. See \MKII\ file
-%D for comments. So, consider this a temporary feature.
-
-\unprotect
-
-%D \macros
-%D {everyresetlanguagespecifics,resetlanguagespecifics}
-%D
-%D Cleanup macros.
-
-\newevery \everyresetlanguagespecifics \relax
-
-\def\resetlanguagespecifics
- {\ifcase\protectionlevel
- \the\everyresetlanguagespecifics
- \fi}
-
-\appendtoks
- \resetlanguagespecifics
-\to \everycleanupfeatures
-
-%D \macros
-%D {startlanguagespecifics,enablelanguagespecifics}
-
-\def\startlanguagespecifics
- {\bgroup
- \catcode`\^^I=\@@ignore
- \catcode`\^^M=\@@ignore
- \catcode`\^^L=\@@ignore
- \dodoubleempty\dostartlanguagespecifics} % get rid of spaces
-
-\long\def\dostartlanguagespecifics[#1][#2]#3\stoplanguagespecifics
- {\egroup
- \processcommalist[#1]{\dosetlanguagespecifics{#3}}}
-
-\long\def\dosetlanguagespecifics#1#2% specifics language
- {\ifcsname\??la#2\??la\endcsname \else
- \expandafter\newtoks\csname\??la#2\??la\endcsname
- \fi
- \csname\??la#2\??la\endcsname\@EA{\the\csname\??la#2\??la\endcsname#1}%
- \bgroup
- \setbox\scratchbox\hbox{\enablelanguagespecifics[#2]}%
- \ifdim\wd\scratchbox>\zeropoint
- \showmessage\m!linguals7{#2,\the\wd\scratchbox\space}\wait
- \else
- \showmessage\m!linguals8{#2}%
- \fi
- \egroup
- \doif{#2}\currentmainlanguage{\enablelanguagespecifics[#2]}}
-
-\def\forgetlanguagespecifics[#1]%
- {\ifcsname\??la#1\??la\endcsname
- \csname\??la#1\??la\endcsname\emptytoks
- \fi}
-
-% \def\enablelanguagespecifics[#1]% no default language fallback (yet)
-% {\ifcsname\??la#1\??la\endcsname
-% \the\csname\??la#1\??la\endcsname\relax
-% \fi}
-
-\def\enablelanguagespecifics[#1]%
- {\edef\askedlanguagespecificslanguage{\defaultlanguage{#1}}%
- \ifcsname\??la\askedlanguagespecificslanguage\??la\endcsname
- \the\csname\??la\askedlanguagespecificslanguage\??la\endcsname
- \fi}
-
-%D \macros
-%D {ordinaldaynumber, highordinalstr, ordinalstr}
-%D
-%D Efficient general ordinal number converters are sometimes
-%D difficult to implement. Fortunately dates never exceed the
-%D number~31.
-
-\ifx\high \undefined \let\high \firstofoneargument \fi % todo
-\ifx\notsmallcapped\undefined \let\notsmallcapped\firstofoneargument \fi % todo
-
-\def\highordinalstr#1{\high{\notsmallcapped{#1}}}
-\def\ordinalstr #1{\notsmallcapped{#1}}
-
-\def\ordinaldaynumber#1% \strippedcsname\ordinaldaynumber
- {\expanded{\executeifdefined{\currentlanguage ordinaldaynumber}%
- \noexpand\firstofoneargument{\number#1}}}
-
-%D Language specific converters have definitions like:
-%D
-%D \starttyping
-%D \def\enordinaldaynumber#1{...}
-%D \stoptyping
-%D
-%D Examples can be found in the other \type {lang} modules.
-
-\appendtoks
- \ifprocessingXML \else \resetlanguagespecifics \fi
-\to \everylanguage
-
-\protect \endinput
diff --git a/tex/context/base/lpdf-ano.lua b/tex/context/base/lpdf-ano.lua
new file mode 100644
index 000000000..4f136ad79
--- /dev/null
+++ b/tex/context/base/lpdf-ano.lua
@@ -0,0 +1,573 @@
+if not modules then modules = { } end modules ['lpdf-ano'] = {
+ version = 1.001,
+ comment = "companion to lpdf-ini.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local tostring, format, rep = tostring, string.rep, string.format
+local texcount = tex.count
+
+local trace_references = false trackers.register("references.references", function(v) trace_references = v end)
+local trace_destinations = false trackers.register("references.destinations", function(v) trace_destinations = v end)
+local trace_bookmarks = false trackers.register("references.bookmarks", function(v) trace_bookmarks = v end)
+
+local variables = interfaces.variables
+local constants = interfaces.constants
+
+local nodeinjections = backends.pdf.nodeinjections
+local codeinjections = backends.pdf.codeinjections
+local registrations = backends.pdf.registrations
+
+jobreferences = jobreferences or { }
+jobreferences.runners = jobreferences.runners or { }
+jobreferences.specials = jobreferences.specials or { }
+jobreferences.handlers = jobreferences.handlers or { }
+jobreferences.executers = jobreferences.executers or { }
+
+local runners = jobreferences.runners
+local specials = jobreferences.specials
+local handlers = jobreferences.handlers
+local executers = jobreferences.executers
+
+local pdfdictionary = lpdf.dictionary
+local pdfarray = lpdf.array
+local pdfreference = lpdf.reference
+local pdfunicode = lpdf.unicode
+local pdfconstant = lpdf.constant
+
+local pdfreserveobj = pdf.reserveobj
+local pdfimmediateobj = pdf.immediateobj
+local pdfpageref = tex.pdfpageref
+
+local pdfannot = nodes.pdfannot
+local pdfdest = nodes.pdfdest
+
+local pdf_uri = pdfconstant("URI")
+local pdf_gotor = pdfconstant("GoToR")
+local pdf_goto = pdfconstant("GoTo")
+local pdf_launch = pdfconstant("Launch")
+local pdf_javascript = pdfconstant("JavaScript")
+local pdf_link = pdfconstant("Link")
+local pdf_n = pdfconstant("N")
+local pdf_t = pdfconstant("T")
+local pdf_border = pdfarray { 0, 0, 0 }
+
+local cache = { }
+
+local function pagedest(n)
+ local pd = cache[n]
+ if not pd then
+ local a = pdfarray {
+ pdfreference(pdfpageref(n)),
+ pdfconstant("Fit")
+ }
+ pd = pdfreference(pdfimmediateobj(tostring(a)))
+ cache[n] = pd
+ end
+ return pd
+end
+
+lpdf.pagedest = pagedest
+
+local function link(url,filename,destination,page,actions)
+ if filename and filename ~= "" then
+ if file.basename(filename) == tex.jobname then
+ return false
+ else
+ filename = file.addsuffix(filename,"pdf")
+ end
+ end
+ if url and url ~= "" then
+ if filename and filename ~= "" then
+ if destination and destination ~= "" then
+ url = file.join(url,filename).."#"..destination
+ else
+ url = file.join(url,filename)
+ end
+ end
+ return pdfdictionary {
+ S = pdf_uri,
+ URI = url,
+ }
+ elseif filename and filename ~= "" then
+ return pdfdictionary {
+ S = pdf_gotor,
+ F = pdffile,
+ D = destination and destination ~= "" and destination,
+ NewWindow = (actions.newwindow and true) or nil,
+ }
+ elseif destination and destination ~= "" then
+ local realpage, p = texcount.realpageno, tonumber(page)
+ if not p then
+ -- sorry
+ elseif p > realpage then
+ texcount.referencepagestate = 3
+ elseif p < realpage then
+ texcount.referencepagestate = 2
+ else
+ texcount.referencepagestate = 1
+ end
+ return pdfdictionary {
+ S = pdf_goto,
+ D = destination,
+ }
+ elseif page and page ~= "" then
+ local realpage, p = texcount.realpageno, tonumber(page)
+ if p then
+ if p > realpage then
+ texcount.referencepagestate = 3
+ elseif p < realpage then
+ texcount.referencepagestate = 2
+ else
+ texcount.referencepagestate = 1
+ end
+ return pdfdictionary {
+ S = pdf_goto,
+ D = pagedest(p),
+ }
+ else
+ commands.writestatus("references","invalid page reference: %s",page or "?")
+ end
+ end
+ return false
+end
+
+lpdf.link = link
+
+function lpdf.launch(program,parameters)
+ if program and program ~= "" then
+ local d = pdfdictionary {
+ S = pdf_launch,
+ F = program,
+ D = ".",
+ }
+ if parameters and parameters ~= "" then
+ d.P = parameters
+ end
+ return d
+ end
+end
+
+function lpdf.javascript(name,arguments)
+ local script = javascripts.code(name,arguments) -- make into object (hash)
+ if script then
+ return pdfdictionary {
+ S = pdf_javascript,
+ JS = script,
+ }
+ end
+end
+
+local function pdfaction(actions)
+ local nofactions = #actions
+ texcount.referencepagestate = 0 -- goodie, as we do all in the backend, we need to set it here too
+ if nofactions > 0 then
+ local a = actions[1]
+ local action = runners[a.kind]
+ if action then
+ action = action(a,actions)
+ end
+ if action then
+ local first = action
+ for i=2,nofactions do
+ local a = actions[i]
+ local what = runners[a.kind]
+ if what then
+ what = what(a,actions)
+ end
+ if what then
+ action.next = what
+ action = what
+ else
+ -- error
+ return nil
+ end
+ end
+ return first
+ end
+ end
+end
+
+lpdf.pdfaction = pdfaction
+
+function codeinjections.prerollreference(actions)
+ local main = actions and pdfaction(actions)
+ if main then
+ main = pdfdictionary {
+ Subtype = pdf_link,
+ Border = pdf_border,
+ H = (not actions.highlight and pdf_n) or nil,
+ A = main,
+ -- does not work at all in spite of specification
+ -- OC = (actions.layer and lpdf.layerreferences[actions.layer]) or nil,
+ -- OC = backends.pdf.layerreference(actions.layer),
+ }
+ return main("A") -- todo: cache this, maybe weak
+ end
+end
+
+-- local cache = { } -- no real gain in thsi
+--
+-- function codeinjections.prerollreference(actions)
+-- local main = actions and pdfaction(actions)
+-- if main then
+-- main = pdfdictionary {
+-- Subtype = pdf_link,
+-- Border = pdf_border,
+-- H = (not actions.highlight and pdf_n) or nil,
+-- A = main,
+-- }
+-- local cm = cache[main]
+-- if not cm then
+-- cm = "/A ".. tostring(pdfreference(pdfimmediateobj(tostring(main))))
+-- cache[main] = cm
+-- end
+-- return cm
+-- end
+-- end
+
+function nodeinjections.reference(width,height,depth,prerolled)
+ if prerolled then
+ if swapdir then
+ width = - width
+ end
+ if trace_references then
+ logs.report("references","w=%s, h=%s, d=%s, a=%s",width,height,depth,prerolled)
+ end
+ return pdfannot(width,height,depth,prerolled)
+ end
+end
+
+function nodeinjections.destination(width,height,depth,name,view)
+ if swapdir then
+ width = - width
+ end
+ if trace_destinations then
+ logs.report("destinations","w=%s, h=%s, d=%s, n=%s, v=%s",width,height,depth,name,view or "no view")
+ end
+ return pdfdest(width,height,depth,name,view)
+end
+
+-- runners and specials
+
+local method = "internal"
+
+runners["inner"] = function(var,actions)
+ if method == "internal" then
+ local vir = var.i.references
+ local internal = vir and vir.internal
+ if internal then
+ var.inner = "aut:"..internal
+ end
+ end
+ return link(nil,nil,var.inner,var.r,actions)
+end
+
+runners["inner with arguments"] = function(var,actions)
+ return false
+end
+
+runners["outer"] = function(var,actions)
+ return link(nil,var.o,nil,nil,actions) -- var.o ?
+end
+
+runners["outer with inner"] = function(var,actions)
+ -- todo: resolve url/file name
+ return link(nil,var.f,var.inner,var.r,actions)
+end
+
+runners["special outer with operation"] = function(var,actions)
+ return false
+end
+
+runners["special outer"] = function(var,actions)
+ return false
+end
+
+runners["special"] = function(var,actions)
+ local handler = specials[var.special]
+ return handler and handler(var,actions)
+end
+
+runners["outer with inner with arguments"] = function(var,actions)
+ return false
+end
+
+runners["outer with special and operation and arguments"] = function(var,actions)
+ return false
+end
+
+runners["outer with special"] = function(var,actions)
+ return false
+end
+
+runners["outer with special and operation"] = function(var,actions)
+ return false
+end
+
+runners["special operation"] = runners["special"]
+runners["special operation with arguments"] = runners["special"]
+
+function specials.internal(var,actions)
+ local i = tonumber(var.operation)
+ local v = jobreferences.internals[i]
+ if not v then
+ -- error
+ elseif method == "internal" then
+ -- named
+ return link(nil,nil,"aut:"..i,v.references.realpage,actions)
+ else
+ -- page
+ return link(nil,nil,nil,v.references.realpage,actions)
+ end
+end
+
+specials.i = specials.internal
+
+function specials.page(var,actions)
+ local p = jobreferences.pages[var.operation]
+ if type(p) == "function" then
+ p = p()
+ end
+ return link(nil,nil,nil,p or var.operation,actions)
+end
+
+function specials.url(var,actions)
+ local url = var.operation
+ if url then
+ local u = urls[url]
+ if u then
+ local u, f = u[1], u[2]
+ if f and f ~= "" then
+ url = u .. "/" .. f
+ else
+ url = u
+ end
+ end
+ end
+ return link(url,nil,var.arguments,nil,actions)
+end
+
+function specials.file(var,actions)
+ local file = var.operation
+ if file then
+ local f = files[file]
+ if f then
+ file = f[1]
+ end
+ end
+ return link(nil,file,var.arguments,nil,actions)
+end
+
+function specials.program(var,content)
+ local program = var.operation
+ if program then
+ local p = programs[program]
+ if p then
+ program = p[1]
+ end
+ end
+ return lpdf.launch(program,var.arguments)
+end
+
+function specials.javascript(var)
+ return lpdf.javascript(var.operation,var.arguments)
+end
+
+specials.JS = specials.javascript
+
+local pdf_named = pdfconstant("Named")
+
+executers.importform = pdfdictionary { S = pdf_named, N = pdfconstant("AcroForm:ImportFDF") }
+executers.exportform = pdfdictionary { S = pdf_named, N = pdfconstant("AcroForm:ExportFDF") }
+executers.first = pdfdictionary { S = pdf_named, N = pdfconstant("FirstPage") }
+executers.previous = pdfdictionary { S = pdf_named, N = pdfconstant("PrevPage") }
+executers.next = pdfdictionary { S = pdf_named, N = pdfconstant("NextPage") }
+executers.last = pdfdictionary { S = pdf_named, N = pdfconstant("LastPage") }
+executers.backward = pdfdictionary { S = pdf_named, N = pdfconstant("GoBack") }
+executers.forward = pdfdictionary { S = pdf_named, N = pdfconstant("GoForward") }
+executers.print = pdfdictionary { S = pdf_named, N = pdfconstant("Print") }
+executers.exit = pdfdictionary { S = pdf_named, N = pdfconstant("Quit") }
+executers.close = pdfdictionary { S = pdf_named, N = pdfconstant("Close") }
+executers.save = pdfdictionary { S = pdf_named, N = pdfconstant("Save") }
+executers.savenamed = pdfdictionary { S = pdf_named, N = pdfconstant("SaveAs") }
+executers.opennamed = pdfdictionary { S = pdf_named, N = pdfconstant("Open") }
+executers.help = pdfdictionary { S = pdf_named, N = pdfconstant("HelpUserGuide") }
+executers.toggle = pdfdictionary { S = pdf_named, N = pdfconstant("FullScreen") }
+executers.search = pdfdictionary { S = pdf_named, N = pdfconstant("Find") }
+executers.searchagain = pdfdictionary { S = pdf_named, N = pdfconstant("FindAgain") }
+executers.gotopage = pdfdictionary { S = pdf_named, N = pdfconstant("GoToPage") }
+executers.query = pdfdictionary { S = pdf_named, N = pdfconstant("AcroSrch:Query") }
+executers.queryagain = pdfdictionary { S = pdf_named, N = pdfconstant("AcroSrch:NextHit") }
+executers.fitwidth = pdfdictionary { S = pdf_named, N = pdfconstant("FitWidth") }
+executers.fitheight = pdfdictionary { S = pdf_named, N = pdfconstant("FitHeight") }
+
+local function fieldset(arguments)
+ -- [\dogetfieldset{#1}]
+ return nil
+end
+
+function executers.resetform(arguments)
+ arguments = (type(arguments) == "table" and arguments) or aux.settings_to_array(arguments)
+ return pdfdictionary {
+ S = pdfconstant("ResetForm"),
+ Field = fieldset(arguments[1])
+ }
+end
+
+local formmethod = "post" -- "get" "post"
+local formformat = "xml" -- "xml" "html" "fdf"
+
+-- bit 3 = html bit 6 = xml bit 4 = get
+
+local flags = {
+ get = {
+ html = 12, fdf = 8, xml = 40,
+ },
+ post = {
+ html = 4, fdf = 0, xml = 32,
+ }
+}
+
+function executers.submitform(arguments)
+ arguments = (type(arguments) == "table" and arguments) or aux.settings_to_array(arguments)
+ local flag = flags[formmethod] or flags.post
+ flag = (flag and (flag[formformat] or flag.xml)) or 32 -- default: post, xml
+ return pdfdictionary {
+ S = pdfconstant("ResetForm"),
+ F = fieldset(arguments[1]),
+ Field = fieldset(arguments[2]),
+ Flags = flag,
+ -- \PDFsubmitfiller
+ }
+end
+
+function executers.hide(arguments)
+ return pdfdictionary {
+ S = pdfconstant("Hide"),
+ H = true,
+ T = arguments,
+ }
+end
+
+function executers.show(arguments)
+ return pdfdictionary {
+ S = pdfconstant("Hide"),
+ H = false,
+ T = arguments,
+ }
+end
+
+local pdf_movie = pdfconstant("Movie")
+local pdf_start = pdfconstant("Start")
+local pdf_stop = pdfconstant("Stop")
+local pdf_resume = pdfconstant("Resume")
+local pdf_pause = pdfconstant("Pause")
+
+local function movie_or_sound(operation,arguments)
+ arguments = (type(arguments) == "table" and arguments) or aux.settings_to_array(arguments)
+ return pdfdictionary {
+ S = pdf_movie,
+ T = format("movie %s",arguments[1] or "noname"),
+ Operation = operation,
+ }
+end
+
+function executers.startmovie (arguments) return movie_or_sound(pdf_start ,arguments) end
+function executers.stopmovie (arguments) return movie_or_sound(pdf_stop ,arguments) end
+function executers.resumemovie(arguments) return movie_or_sound(pdf_resume,arguments) end
+function executers.pausemovie (arguments) return movie_or_sound(pdf_pause ,arguments) end
+
+function executers.startsound (arguments) return movie_or_sound(pdf_start ,arguments) end
+function executers.stopsound (arguments) return movie_or_sound(pdf_stop ,arguments) end
+function executers.resumesound(arguments) return movie_or_sound(pdf_resume,arguments) end
+function executers.pausesound (arguments) return movie_or_sound(pdf_pause ,arguments) end
+
+function specials.action(var)
+ local operation = var.operation
+ if var.operation and operation ~= "" then
+ local e = executers[operation]
+ if type(e) == "table" then
+ return e
+ elseif type(e) == "function" then
+ return e(var.arguments)
+ end
+ end
+end
+
+--~ entry.A = pdfdictionary {
+--~ S = pdfconstant("GoTo"),
+--~ D = ....
+--~ }
+
+local function build(levels,start,parent,method)
+ local startlevel = levels[start][1]
+ local i, n = start, 0
+ local child, entry, m, prev, first, last, f, l
+-- to be tested: i can be nil
+ while i and i <= #levels do
+ local li = levels[i]
+ local level, title, reference, open = li[1], li[2], li[3], li[4]
+ if level == startlevel then
+ if trace_bookmarks then
+ logs.report("bookmark","%3i %s%s %s",realpage,rep(" ",level-1),(open and "+") or "-",title)
+ end
+ local prev = child
+ child = pdfreserveobj()
+ if entry then
+ entry.Next = child and pdfreference(child)
+ pdfimmediateobj(prev,tostring(entry))
+ end
+ entry = pdfdictionary {
+ Title = pdfunicode(title),
+ Parent = parent,
+ Prev = prev and pdfreference(prev),
+ }
+ if method == "internal" then
+ entry.Dest = "aut:" .. reference.internal
+ else -- if method == "page" then
+ entry.Dest = pagedest(reference.realpage)
+ end
+ if not first then first, last = child, child end
+ prev = child
+ last = prev
+ n = n + 1
+ i = i + 1
+ elseif level < startlevel then
+ pdfimmediateobj(child,tostring(entry))
+ return i, n, first, last
+ elseif i < #levels and level > startlevel then
+ i, m, f, l = build(levels,i,pdfreference(child),method)
+ entry.Count = (open and m) or -m
+ if m > 0 then
+ entry.First, entry.Last = pdfreference(f), pdfreference(l)
+ end
+ else
+ -- missing intermediate level but ok
+ i, m, f, l = build(levels,i,pdfreference(child),method)
+ entry.Count = (open and m) or -m
+ if m > 0 then
+ entry.First, entry.Last = pdfreference(f), pdfreference(l)
+ end
+ pdfimmediateobj(child,tostring(entry))
+ return i, n, first, last
+ end
+ end
+ pdfimmediateobj(child,tostring(entry))
+ return _, n, first, last
+end
+
+function codeinjections.addbookmarks(levels,method)
+ local parent = pdfreserveobj()
+ local _, m, first, last = build(levels,1,pdfreference(parent),method or "internal")
+ local dict = pdfdictionary {
+ Type = pdfconstant("Outlines"),
+ First = pdfreference(first),
+ Last = pdfreference(last),
+ Count = m,
+ }
+ pdfimmediateobj(parent,tostring(dict))
+ lpdf.addtocatalog("Outlines",lpdf.reference(parent))
+end
diff --git a/tex/context/base/lpdf-col.lua b/tex/context/base/lpdf-col.lua
new file mode 100644
index 000000000..219188369
--- /dev/null
+++ b/tex/context/base/lpdf-col.lua
@@ -0,0 +1,150 @@
+if not modules then modules = { } end modules ['lpdf-mis'] = {
+ version = 1.001,
+ comment = "companion to back-pdf.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local type = type
+local format, gsub = string.format, string.gsub
+
+-- colors = colors or { }
+-- transparencies = transparencies or { }
+
+local registercolor = colors.register
+local registertransparancy = transparencies.register
+local colorsvalue = colors.value
+local transparenciesvalue = transparencies.value
+
+-- Literals needed to inject code in the mp stream, we cannot use attributes there
+-- since literals may have qQ's, much may go away once we have mplib code in place.
+--
+-- This module assumes that some functions are defined in the colors namespace
+-- which mostlikely will be loaded later.
+
+function lpdf.color(model,ca,default) -- todo: use gray when no color
+ local cv = colorsvalue(ca)
+ if cv then
+ if model == 1 then
+ model = cv[1]
+ end
+ if model == 2 then
+ local s = cv[2]
+ return format("%s g %s G",s,s)
+ elseif model == 3 then
+ local r, g, b = cv[3], cv[4], cv[5]
+ return format("%s %s %s rg %s %s %s RG",r,g,b,r,g,b)
+ elseif model == 4 then
+ local c, m, y, k = cv[6],cv[7],cv[8],cv[9]
+ return format("%s %s %s %s k %s %s %s %s K",c,m,y,k,c,m,y,k)
+ else
+ local n,f,d,p = cv[10],cv[11],cv[12],cv[13]
+ if type(p) == "string" then
+ p = gsub(p,","," ") -- brr misuse of spot
+ end
+ return format("/%s cs /%s CS %s SCN %s scn",n,n,p,p)
+ end
+ else
+ return format("%s g %s G",default or 0,default or 0)
+ end
+end
+
+function lpdf.transparency(ct,default)
+ -- beware, we need this hack because normally transparencies are not
+ -- yet registered and therefore the number is not not known ... we
+ -- might use the attribute number itself in the future
+ local ct = transparenciesvalue(ct)
+ if ct then
+ return format("/Tr%s gs",registertransparancy(nil,ct[1],ct[2]))
+ else
+ return "/Tr0 gs"
+ end
+end
+
+function lpdf.colorvalue(model,ca,default)
+ local cv = colorsvalue(ca)
+ if cv then
+ if model == 1 then
+ model = cv[1]
+ end
+ if model == 2 then
+ return format("%s",cv[2])
+ elseif model == 3 then
+ return format("%s %s %s",cv[3],cv[4],cv[5])
+ elseif model == 4 then
+ return format("%s %s %s %s",cv[6],cv[7],cv[8],cv[9])
+ else
+ return format("%s",cv[13])
+ end
+ else
+ return format("%s",default or 0)
+ end
+end
+
+function lpdf.fdfcolor(model,ca,default)
+ local cv = colorsvalue(ca)
+ if cv then
+ if model == 1 then
+ model = cv[1]
+ end
+ if model == 2 then
+ return format("[%s]",cv[2])
+ elseif model == 3 then
+ return format("[%s %s %s]",cv[3],cv[4],cv[5])
+ elseif model == 4 then
+ return format("[%s %s %s %s]",cv[6],cv[7],cv[8],cv[9])
+ elseif model == 4 then
+ return format("[%s]",cv[13])
+ end
+ else
+ return format("[%s]",default or 0)
+ end
+end
+
+function lpdf.colorspace(model,ca)
+ local cv = colorsvalue(ca)
+ if cv then
+ if model == 1 then
+ model = cv[1]
+ end
+ if model == 2 then
+ return "DeviceGray"
+ elseif model == 3 then
+ return "DeviceRGB"
+ elseif model == 4 then
+ return "DeviceCMYK"
+ end
+ end
+ return "DeviceGRAY"
+end
+
+-- by registering we getconversion for free (ok, at the cost of overhead)
+
+local intransparency = false
+local pdfcolor = lpdf.color
+
+function lpdf.rgbcode(model,r,g,b)
+ return pdfcolor(model,registercolor('color',nil,'rgb',r,g,b))
+end
+function lpdf.cmykcode(model,c,m,y,k)
+ return pdfcolor(model,registercolor('color',nil,'cmyk',c,m,y,k))
+end
+function lpdf.graycode(model,s)
+ return pdfcolor(model,registercolor('color',nil,'gray',s))
+end
+function lpdf.spotcode(model,n,f,d,p)
+ return pdfcolor(model,registercolor('color',nil,'spot',n,f,d,p)) -- incorrect
+end
+function lpdf.transparencycode(a,t)
+ intransparency = true
+ return format("/Tr%s gs",registertransparancy(nil,a,t))
+end
+function lpdf.finishtransparencycode()
+ if intransparency then
+ intransparency = false
+ return "/Tr0 gs" -- we happen to know this -)
+ else
+ return ""
+ end
+end
diff --git a/tex/context/base/lpdf-fld.lua b/tex/context/base/lpdf-fld.lua
new file mode 100644
index 000000000..b9c63347f
--- /dev/null
+++ b/tex/context/base/lpdf-fld.lua
@@ -0,0 +1,747 @@
+if not modules then modules = { } end modules ['lpdf-fld'] = {
+ version = 1.001,
+ comment = "companion to lpdf-ini.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- cleaned up, e.g. no longer older viewers
+-- always kids so no longer explicit main / clone / copy
+-- some optimizations removed (will come bakc if needed)
+
+local gmatch, lower, format = string.gmatch, string.lower, string.format
+
+local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes
+
+local variables = interfaces.variables
+
+local nodeinjections = backends.pdf.nodeinjections
+local codeinjections = backends.pdf.codeinjections
+local registrations = backends.pdf.registrations
+
+local registeredsymbol = codeinjections.registeredsymbol
+
+local pdfstream = lpdf.stream
+local pdfdictionary = lpdf.dictionary
+local pdfarray = lpdf.array
+local pdfreference = lpdf.reference
+local pdfunicode = lpdf.unicode
+local pdfstring = lpdf.string
+local pdfconstant = lpdf.constant
+local pdftoeight = lpdf.toeight
+
+local pdfimmediateobj = pdf.immediateobj
+local pdfreserveobj = pdf.reserveobj
+
+local submitoutputformat = 0 -- 0=unknown 1=HTML 2=FDF 3=XML => not yet used, needs to be checked
+
+local splitter = lpeg.splitat("=>")
+
+local formats = {
+ html = 1, fdf = 2, xml = 3,
+}
+
+function codeinjections.setformsmethod(name)
+ submitoutputformat = formats[lower(name)] or 3
+end
+
+local flag = {
+ MultiLine = 4096, -- 13
+ NoToggleToOff = 16384, -- 15
+ Radio = 32768, -- 16
+ PushButton = 65536, -- 17
+ PopUp = 131072, -- 18
+ Edit = 262144, -- 19
+ RadiosInUnison = 33554432, -- 26
+ DoNotSpellCheck = 4194304, -- 23
+ DoNotScroll = 8388608, -- 24
+ ReadOnly = 1, -- 1
+ Required = 2, -- 2
+ NoExport = 4, -- 3
+ Password = 8192, -- 14
+ Sort = 524288, -- 20
+ FileSelect = 1048576, -- 21
+}
+
+local plus = {
+ Invisible = 1, -- 1
+ Hidden = 2, -- 2
+ Printable = 4, -- 3
+ NoView = 32, -- 6
+ ToggleNoView = 256, -- 9
+ AutoView = 256, -- 288 (6+9)
+}
+
+flag.readonly = flag.ReadOnly
+flag.required = flag.Required
+flag.protected = flag.Password
+flag.sorted = flag.Sort
+flag.unavailable = flag.NoExport
+flag.nocheck = flag.DoNotSpellCheck
+flag.fixed = flag.DoNotScroll
+flag.file = flag.FileSelect
+
+plus.hidden = plus.Hidden
+plus.printable = plus.Printable
+plus.auto = plus.AutoView
+
+-- some day .. lpeg with function
+
+local function fieldflag(specification)
+ local o, n = specification.options, 0
+ if o and o ~= "" then
+ for f in gmatch(o,"[^, ]+") do
+ n = n + (flag[f] or 0)
+ end
+ end
+ return n
+end
+
+local function fieldplus(specification)
+ local o, n = specification.options, 0
+ if o and o ~= "" then
+ for p in gmatch(o,"[^, ]") do
+ n = n + (plus[p] or 0)
+ end
+ end
+ return n
+end
+
+
+local function checked(what)
+ if what and what ~= "" then
+ local set, bug = jobreferences.identify("",what)
+ return not bug and #set > 0 and lpdf.pdfaction(set)
+ end
+end
+
+local function fieldactions(specification) -- share actions
+ local d, a = { }, nil
+ a = specification.mousedown if a and a ~= "" then d.D = checked(a) end
+ a = specification.mouseup if a and a ~= "" then d.U = checked(a) end
+ a = specification.enterregion if a and a ~= "" then d.E = checked(a) end
+ a = specification.exitregion if a and a ~= "" then d.X = checked(a) end
+ a = specification.afterkeystroke if a and a ~= "" then d.K = checked(a) end
+ a = specification.formatresult if a and a ~= "" then d.F = checked(a) end
+ a = specification.validateresult if a and a ~= "" then d.V = checked(a) end
+ a = specification.calculatewhatever if a and a ~= "" then d.C = checked(a) end
+ a = specification.focusin if a and a ~= "" then d.Fo = checked(a) end
+ a = specification.focusout if a and a ~= "" then d.Bl = checked(a) end
+ -- a = specification.openpage if a and a ~= "" then d.PO = checked(a) end
+ -- a = specification.closepage if a and a ~= "" then d.PC = checked(a) end
+ -- a = specification.visiblepage if a and a ~= "" then d.PV = checked(a) end
+ -- a = specification.invisiblepage if a and a ~= "" then d.PI = checked(a) end
+ return next(d) and pdfdictionary(d)
+end
+
+-- fonts and color
+
+local fontnames = {
+ rmtf = "Times-Roman", rmbf = "Times-Bold",
+ rmit = "Times-Italic", rmsl = "Times-Italic",
+ rmbi = "Times-BoldItalic", rmbs = "Times-BoldItalic",
+ sstf = "Helvetica", ssbf = "Helvetica-Bold",
+ ssit = "Helvetica-Oblique", sssl = "Helvetica-Oblique",
+ ssbi = "Helvetica-BoldOblique", ssbs = "Helvetica-BoldOblique",
+ tttf = "Courier", ttbf = "Courier-Bold",
+ ttit = "Courier-Oblique", ttsl = "Courier-Oblique",
+ ttbi = "Courier-BoldOblique", ttbs = "Courier-BoldOblique",
+}
+
+local usedfonts = { }
+
+local function fieldsurrounding(specification)
+ local tag = (specification.fontstyle or "tt") .. (specification.fontalternative or "tf")
+ if not fontnames[tag] then
+ tag = "tttf"
+ end
+ local size = specification.fontsize
+ local stream = pdfstream {
+ pdfconstant(tag),
+ format("%s Tf",(size and (number.dimenfactors.bp * size)) or 12),
+ }
+ usedfonts[tag] = true
+ -- add color to stream: 0 g
+ -- move up with "x.y Ts"
+ return tostring(stream)
+end
+
+local function registerfonts()
+ if next(usedfonts) then
+ local d = pdfdictionary()
+ for tag, _ in next, usedfonts do
+ local f = pdfdictionary {
+ Type = pdfconstant("Font"),
+ Subtype = pdfconstant("Type1"), -- todo
+ Name = pdfconstant(tag),
+ BaseFont = pdfconstant(fontnames[tag]),
+ }
+ d[tag] = pdfreference(pdfimmediateobj(tostring(f)))
+ end
+ return d
+ end
+end
+
+-- cache
+
+local function fieldattributes(specification)
+--~ return pdfarray {
+--~ -- BG = -- backgroundcolor
+--~ -- BC = -- framecolor
+--~ }
+ return nil
+end
+
+-- symbols
+
+local function fieldappearances(specification)
+ -- todo: caching
+ local values = specification.values
+ local default = specification.default
+ if not values then
+ -- error
+ return
+ end
+ local v = aux.settings_to_array(values)
+ local n, r, d
+ if #v == 1 then
+ n, r, d = v[1], v[1], v[1]
+ elseif #v == 2 then
+ n, r, d = v[1], v[1], v[2]
+ else
+ n, r, d = v[1], v[2], v[3]
+ end
+ local appearance = pdfdictionary { -- cache this one
+ N = registeredsymbol(n), R = registeredsymbol(r), D = registeredsymbol(d),
+ }
+ return lpdf.sharedobj(tostring(appearance))
+end
+
+local function fieldstates(specification)
+ -- splitter not needed, wil go
+ -- todo: caching
+ local values, default = specification.values, specification.default
+ if not values then
+ -- error
+ return
+ end
+ local v = aux.settings_to_array(values)
+ local yes, off
+ if #v == 1 then
+ yes, off = v[1], v[1]
+ else
+ yes, off = v[1], v[2]
+ end
+ local yesshown, yesvalue = splitter:match(yes)
+ if not (yesshown and yesvalue) then
+ yesshown = yes, yes
+ end
+ yes = aux.settings_to_array(yesshown)
+ local offshown, offvalue = splitter:match(off)
+ if not (offshown and offvalue) then
+ offshown = off, off
+ end
+ off = aux.settings_to_array(offshown)
+ if #yes == 1 then
+ yesn, yesr, yesd = yes[1], yes[1], yes[1]
+ elseif #yes == 2 then
+ yesn, yesr, yesd = yes[1], yes[1], yes[2]
+ else
+ yesn, yesr, yesd = yes[1], yes[2], yes[3]
+ end
+ if #off == 1 then
+ offn, offr, offd = off[1], off[1], off[1]
+ elseif #off == 2 then
+ offn, offr, offd = off[1], off[1], off[2]
+ else
+ offn, offr, offd = off[1], off[2], off[3]
+ end
+ if not yesvalue then
+ yesvalue = yesn
+ end
+ if not offvalue then
+ offvalue = offn
+ end
+ if default == yesn then
+ default = pdfconstant(yesn)
+ else
+ default = pdfconstant("Off")
+ end
+ local appearance = pdfdictionary { -- mayeb also cache components
+ N = pdfdictionary { [yesn] = registeredsymbol(yesn), Off = registeredsymbol(offn) },
+ R = pdfdictionary { [yesr] = registeredsymbol(yesr), Off = registeredsymbol(offr) },
+ D = pdfdictionary { [yesd] = registeredsymbol(yesd), Off = registeredsymbol(offd) }
+ }
+ local appearanceref = lpdf.sharedobj(tostring(appearance))
+ return appearanceref, default
+end
+
+local function fieldoptions(specification)
+ local values = specification.values
+ local default = specification.default
+ if values then
+ local v = aux.settings_to_array(values)
+ for i=1,#v do
+ local vi = v[i]
+ local shown, value = splitter:match(vi)
+ if shown and value then
+ v[i] = pdfarray { pdfunicode(value), shown }
+ else
+ v[i] = pdfunicode(v[i])
+ end
+ end
+ return pdfarray(v)
+ end
+end
+
+local function radiodefault(parent,field)
+ local default, values = parent.default, parent.values
+ if not default or default == "" then
+ values = aux.settings_to_array(values)
+ default = values[1]
+ end
+ local name = field.name
+ local fieldvalues = aux.settings_to_array(field.values)
+ local yes, off = fieldvalues[1], fieldvalues[2] or fieldvalues[1]
+ if not default then
+ return pdfconstant(yes)
+ elseif default == name then
+ return pdfconstant(default)
+ else
+ return pdfconstant("Off")
+ end
+end
+
+-- layers
+
+local function fieldlayer(specification) -- we can move this in line
+ local layer = specification.layer
+ return (layer and lpdf.layerreferences[layer]) or nil
+end
+
+-- defining
+
+local fields, radios, fieldsets, calculationset = { }, { }, { }, nil
+
+function codeinjections.definefieldset(tag,list)
+ fieldsets[tag] = list
+end
+
+function codeinjections.getfieldset(tag)
+ return fieldsets[tag]
+end
+
+local function fieldsetlist(tag)
+ if tag then
+ local ft = fieldsets[tag]
+ if ft then
+ local a = pdfarray()
+ for name in gmatch(list,"[^, ]+") do
+ local f = field[name]
+ if f and f.pobj then
+ a[#a+1] = pdfreference(f.pobj)
+ end
+ end
+ return a
+ end
+ end
+end
+
+function codeinjections.setfieldcalculationset(tag)
+ calculationset = tag
+end
+
+local function predefinesymbols(specification)
+ local values = specification.values
+ if values then
+ local a, b = splitter:match(values)
+ codeinjections.presetsymbollist(a or values)
+ end
+end
+
+function codeinjections.getdefaultfieldvalue(name)
+ local f = fields[name]
+ if f then
+ local values = f.values
+ local default = f.default
+ if not default or default == "" then
+ local a, b = splitter:match(values)
+ values = a or values
+ for name in gmatch(list,"[^, ]+") do
+ default = name
+ break
+ end
+ end
+ if default then
+ tex.sprint(ctxcatcodes,default)
+ end
+ end
+end
+
+
+function codeinjections.definefield(specification)
+ local n = specification.name
+ local f = fields[n]
+ if not f then
+ local kind = specification.kind
+ if not kind then
+ -- name and kind are mandate
+ elseif kind == "radio" then
+ local values = specification.values
+ if values and values ~= "" then
+ values = aux.settings_to_array(values)
+ for v=1,#values do
+ radios[values[v]] = { parent = n }
+ end
+ fields[n] = specification
+ else
+ -- invalid radio specification
+ end
+ elseif kind == "sub" then
+ -- not in main field list !
+ local radio = radios[n]
+ if radio then
+ -- merge specification
+ for key, value in next, specification do
+ radio[key] = value
+ end
+ end
+ predefinesymbols(specification)
+ else
+ fields[n] = specification
+ predefinesymbols(specification)
+ end
+ else
+ -- already done
+ end
+end
+
+function codeinjections.clonefield(specification)
+ local p = specification.parent
+ local c = specification.children
+ if not p or not c then
+ -- parent and children are mandate
+ else
+ for n in gmatch(c,"[^, ]+") do
+ local f = fields[n]
+ if f and not f.done then
+ -- already done
+ else
+ fields[n] = specification
+ end
+ end
+ end
+end
+
+function codeinjections.getfieldgroup(name)
+ local f = fields[name]
+ if f and f.group then
+ texsprint(ctxcatcodes,f.group)
+ end
+end
+
+--
+
+function codeinjections.doiffieldset(tag)
+ commands.testcase(fieldsets[tag])
+end
+
+function codeinjections.doiffieldelse(name)
+ commands.testcase(fields[name])
+end
+
+--
+
+local alignments = {
+ flushleft = 0, right = 0,
+ center = 1, middle = 1,
+ flushright = 2, left = 2,
+}
+
+local function fieldalignment(specification)
+ return alignments[specification.align] or 0
+end
+
+local function enhance(specification,option)
+ local so = specification.options
+ if so and so ~= "" then
+ specification.options = so .. "," .. option
+ else
+ specification.options = option
+ end
+ return specification
+end
+
+-- finish
+
+local collected = pdfarray()
+
+function codeinjections.finishfields()
+ for name, field in next, fields do
+ local kids = field.kids
+ if kids then
+ pdfimmediateobj(field.kobj,tostring(kids))
+ end
+ local pobj = field.pobj
+ end
+ for name, field in next, radios do
+ local kids = field.kids
+ if kids then
+ pdfimmediateobj(field.kobj,tostring(kids))
+ end
+ end
+ if #collected > 0 then
+ local acroform = pdfdictionary {
+ NeedAppearances = true,
+ Fields = pdfreference(pdfimmediateobj(tostring(collected))),
+ DR = pdfdictionary { Font = registerfonts() },
+ CO = fieldsetlist(calculationset),
+ DA = "/tttf 12 Tf 0 g",
+ }
+ lpdf.addtocatalog("AcroForm",pdfreference(pdfimmediateobj(tostring(acroform))))
+ end
+ lpdf.finishfields = function() end
+end
+
+local pdf_widget = pdfconstant("Widget")
+local pdf_tx = pdfconstant("Tx")
+local pdf_ch = pdfconstant("Ch")
+local pdf_btn = pdfconstant("Btn")
+local pdf_yes = pdfconstant("Yes")
+local pdf_p = pdfconstant("P") -- None Invert Outline Push
+local pdf_n = pdfconstant("N") -- None Invert Outline Push
+--
+local pdf_no_rect = pdfarray { 0, 0, 0, 0 }
+
+local methods = { }
+
+function codeinjections.typesetfield(name,specification)
+ local field = fields[name] or radios[name]
+ if not field then
+ tex.write("error: " .. name)
+ -- unknown field
+ return
+ end
+ local method = methods[field.kind]
+ if method then
+ method(name,specification)
+ end
+end
+
+-- can be optional multipass optimization (share objects)
+
+local function save_parent(field,specification,d)
+ local kn = pdfreserveobj()
+ d.Kids = pdfreference(kn)
+ field.kobj = kn
+ field.kids = pdfarray()
+ local pn = pdfimmediateobj(tostring(d))
+ field.pobj = pn
+ collected[#collected+1] = pdfreference(pn)
+end
+
+local function save_kid(field,specification,d)
+ local kn = pdfreserveobj()
+ field.kids[#field.kids+1] = pdfreference(kn)
+ node.write(nodes.pdfannot(specification.width,specification.height,0,d(),kn))
+end
+
+function methods.line(name,specification,extras)
+ local field = fields[name]
+ local kind = field.kind
+ if not field.pobj then
+ if extras then
+ enhance(specification,extras)
+ end
+ local text = pdfunicode(specification.default)
+ local d = pdfdictionary {
+ Subtype = pdf_widget,
+ T = pdfunicode(specification.title),
+ F = fieldplus(specification),
+ Ff = fieldflag(specification),
+ OC = fieldlayer(specification),
+ MK = fieldsurrounding(specification),
+ AA = fieldactions(specification),
+ FT = pdf_tx,
+ Q = fieldalignment(specification),
+ MaxLen = (specification.length == 0 and 1000) or specification.length,
+ DV = text,
+ V = text,
+ }
+ save_parent(field,specification,d)
+ field.specification = specification
+ end
+ specification = field.specification or { } -- todo: radio spec
+ local d = pdfdictionary {
+ Subtype = pdf_widget,
+ Parent = pdfreference(field.pobj),
+ F = fieldplus(specification),
+ DA = fieldattributes(specification),
+ OC = fieldlayer(specification),
+ MK = fieldsurrounding(specification),
+ AA = fieldactions(specification),
+ Q = fieldalignment(specification)
+ }
+ save_kid(field,specification,d)
+end
+
+function methods.text(name,specification)
+ methods.line(name,specification,"MultiLine")
+end
+
+function methods.choice(name,specification,extras)
+ local field = fields[name]
+ local kind = field.kind
+ local d
+ if not field.pobj then
+ if extras then
+ enhance(specification,extras)
+ end
+ local d = pdfdictionary {
+ Subtype = pdf_widget,
+ T = pdfunicode(specification.title),
+ F = fieldplus(specification),
+ Ff = fieldflag(specification),
+ OC = fieldlayer(specification),
+ AA = fieldactions(specification),
+ FT = pdf_ch,
+ Opt = fieldoptions(field),
+ }
+ save_parent(field,specification,d)
+ field.specification = specification
+ end
+ specification = field.specification or { }
+ local d = pdfdictionary {
+ Subtype = pdf_widget,
+ Parent = pdfreference(field.pobj),
+ F = fieldplus(specification),
+ DA = fieldattributes(specification),
+ OC = fieldlayer(specification),
+ AA = fieldactions(specification),
+ }
+ save_kid(field,specification,d)
+end
+
+function methods.popup(name,specification)
+ methods.choice(name,specification,"PopUp")
+end
+function methods.combo(name,specification)
+ methods.choice(name,specification,"PopUp,Edit")
+end
+
+-- probably no default appearance needed for first kid
+
+function methods.check(name,specification)
+ -- no /Opt because (1) it's messy - see pdf spec, (2) it discouples kids and
+ -- contrary to radio there is no way to associate then
+ local field = fields[name]
+ local kind = field.kind
+ local appearance, default = fieldstates(field)
+ if not field.pobj then
+ local d = pdfdictionary {
+ Subtype = pdf_widget,
+ T = pdfunicode(specification.title),
+ F = fieldplus(specification),
+ Ff = fieldflag(specification),
+ OC = fieldlayer(specification),
+ AA = fieldactions(specification),
+ FT = pdf_btn,
+ DV = default,
+ V = default,
+ AS = default,
+ AP = appearance,
+ H = pdf_n,
+ }
+ save_parent(field,specification,d)
+ field.specification = specification
+ end
+ specification = field.specification or { } -- todo: radio spec
+ local d = pdfdictionary {
+ Subtype = pdf_widget,
+ Parent = pdfreference(field.pobj),
+ F = fieldplus(specification),
+ DA = fieldattributes(specification),
+ OC = fieldlayer(specification),
+ AA = fieldactions(specification),
+ DV = default,
+ V = default,
+ AS = default,
+ AP = appearance,
+ H = pdf_n,
+ }
+ save_kid(field,specification,d)
+end
+
+function methods.push(name,specification)
+ local field = fields[name]
+ local kind = field.kind
+ if not field.pobj then
+ enhance(specification,"PushButton")
+ local d = pdfdictionary {
+ Subtype = pdf_widget,
+ T = pdfunicode(specification.title),
+ F = fieldplus(specification),
+ Ff = fieldflag(specification),
+ OC = fieldlayer(specification),
+ AA = fieldactions(specification),
+ FT = pdf_btn,
+ AP = fieldappearances(field),
+ H = pdf_p,
+ }
+ save_parent(field,specification,d)
+ field.specification = specification
+ end
+ specification = field.specification or { } -- todo: radio spec
+ local d = pdfdictionary {
+ Subtype = pdf_widget,
+ Parent = pdfreference(field.pobj),
+ F = fieldplus(specification),
+ DA = fieldattributes(specification),
+ OC = fieldlayer(specification),
+ AA = fieldactions(specification),
+ AP = fieldappearances(field),
+ H = pdf_p,
+ }
+ save_kid(field,specification,d)
+end
+
+function methods.sub(name,specification)
+ local field = radios[name]
+ if not field then
+ return
+ end
+ local parent = fields[field.parent]
+ if not parent then
+ return
+ end
+ if not parent.pobj then
+ local specification = parent.specification or { }
+ enhance(specification,"Radio,RadiosInUnison")
+ local d = pdfdictionary {
+ T = parent.name,
+ FT = pdf_btn,
+ Rect = pdf_no_rect,
+ F = fieldplus(specification),
+ Ff = fieldflag(specification),
+ H = pdf_n,
+ }
+ save_parent(parent,specification,d)
+ end
+ local appearance = fieldstates(field)
+ local default = radiodefault(parent,field)
+ local d = pdfdictionary {
+ Subtype = pdf_widget,
+ Parent = pdfreference(parent.pobj),
+ F = fieldplus(specification),
+ DA = fieldattributes(specification),
+ OC = fieldlayer(specification),
+ AA = fieldactions(specification),
+ DV = default,
+ V = default,
+ AS = default,
+ AP = appearance,
+ H = pdf_n,
+ }
+ save_kid(parent,specification,d)
+end
diff --git a/tex/context/base/lpdf-grp.lua b/tex/context/base/lpdf-grp.lua
new file mode 100644
index 000000000..119d25ee4
--- /dev/null
+++ b/tex/context/base/lpdf-grp.lua
@@ -0,0 +1,70 @@
+if not modules then modules = { } end modules ['lpdf-grp'] = {
+ version = 1.001,
+ comment = "companion to lpdf-ini.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local format = string.format
+
+local nodeinjections = backends.pdf.nodeinjections
+local codeinjections = backends.pdf.codeinjections
+local registrations = backends.pdf.registrations
+
+local pdfdictionary = lpdf.dictionary
+local pdfarray = lpdf.array
+local pdfconstant = lpdf.constant
+local pdfreference = lpdf.reference
+
+local pdfreserveobj = pdf.reserveobj
+local pdfimmediateobj = pdf.immediateobj
+
+local function shade(stype,name,domain,color_a,color_b,n,colorspace,coordinates)
+ local f = pdfdictionary {
+ FunctionType = 2,
+ Domain = pdfarray(domain), -- domain is actually a string
+ C0 = pdfarray(color_a),
+ C1 = pdfarray(color_b),
+ N = tonumber(n),
+ }
+ local s = pdfdictionary {
+ ShadingType = stype,
+ ColorSpace = pdfconstant(colorspace),
+ Function = pdfreference(pdfimmediateobj(tostring(f))),
+ Coords = pdfarray(coordinates),
+ Extend = pdfarray { true, true },
+ }
+ lpdf.adddocumentshade(name,pdfreference(pdfimmediateobj(tostring(s))))
+end
+
+function lpdf.circularshade(name,domain,color_a,color_b,n,colorspace,coordinates)
+ shade(3,name,domain,color_a,color_b,n,colorspace,coordinates)
+end
+
+function lpdf.linearshade(name,domain,color_a,color_b,n,colorspace,coordinates)
+ shade(2,name,domain,color_a,color_b,n,colorspace,coordinates)
+end
+
+function lpdf.colorspec(model,ca,default)
+ if ca and ca > 0 then
+ local cv = colors.value(ca)
+ if cv then
+ if model == 1 then
+ model = cv[1]
+ end
+ if model == 2 then
+ return pdfarray { cv[2] }
+ elseif model == 3 then
+ return pdfarray { cv[3],cv[4],cv[5] }
+ elseif model == 4 then
+ return pdfarray { cv[6],cv[7],cv[8],cv[9] }
+ elseif model == 5 then
+ return pdfarray { cv[13] }
+ end
+ end
+ end
+ if default then
+ return default
+ end
+end
diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua
index 92207d728..bc89c4872 100644
--- a/tex/context/base/lpdf-ini.lua
+++ b/tex/context/base/lpdf-ini.lua
@@ -8,9 +8,11 @@ if not modules then modules = { } end modules ['back-pdf'] = {
-- This code is very experimental !
-local setmetatable, getmetatable, type, next, tostring, tonumber = setmetatable, getmetatable, type, next, tostring, tonumber
+local setmetatable, getmetatable, type, next, tostring, tonumber, rawset = setmetatable, getmetatable, type, next, tostring, tonumber, rawset
local char, byte, format, gsub, concat = string.char, string.byte, string.format, string.gsub, table.concat
local utfvalues = string.utfvalues
+local texwrite = tex.write
+local sind, cosd = math.sind, math.cosd
lpdf = lpdf or { }
@@ -31,6 +33,47 @@ local function tosixteen(str)
end
end
+lpdf.tosixteen = tosixteen
+
+-- lpeg is some 5 times faster than gsub (in test) on escaping
+
+local escapes = {
+ ["\\"] = "\\\\",
+ ["/"] = "\\/", ["#"] = "\\#",
+ ["<"] = "\\<", [">"] = "\\>",
+ ["["] = "\\[", ["]"] = "\\]",
+ ["("] = "\\(", [")"] = "\\)",
+}
+
+local escaped = lpeg.Cs(lpeg.Cc("(") * (lpeg.S("\\/#<>[]()")/escapes + lpeg.P(1))^0 * lpeg.Cc(")"))
+
+local function toeight(str)
+ -- if not str or str == "" then
+ -- return "()"
+ -- else
+ -- return escaped:match(str)
+ -- end
+ --
+ -- no need for escaping .. just use unicode instead
+ return "(" .. str .. ")"
+end
+
+lpdf.toeight = toeight
+
+local escapes = "-"
+
+local escaped = lpeg.Cs(lpeg.Cc("(") * (lpeg.S("\\/#<>[]()")/escapes + lpeg.P(1))^0 * lpeg.Cc(")"))
+
+local function cleaned(str)
+ if not str or str == "" then
+ return "()"
+ else
+ return escaped:match(str)
+ end
+end
+
+lpdf.cleaned = cleaned
+
local function merge_t(a,b)
local t = { }
for k,v in next, a do t[k] = v end
@@ -40,14 +83,20 @@ end
local tostring_a, tostring_d
-tostring_d = function(t)
+tostring_d = function(t,contentonly,key)
if not next(t) then
- return "<< >>"
+ if contentonly then
+ return ""
+ else
+ return "<< >>"
+ end
else
- local r = { "<<" }
+ local r = { }
for k, v in next, t do
local tv = type(v)
if tv == "string" then
+ r[#r+1] = format("/%s %s",k,toeight(v))
+ elseif tv == "unicode" then
r[#r+1] = format("/%s %s",k,tosixteen(v))
elseif tv == "table" then
local mv = getmetatable(v)
@@ -62,19 +111,30 @@ tostring_d = function(t)
r[#r+1] = format("/%s %s",k,tostring(v))
end
end
- r[#r+1] = ">>"
- return concat(r, " ")
+ if contentonly then
+ return concat(r, " ")
+ elseif key then
+ return format("/%s << %s >>", key, concat(r, " "))
+ else
+ return format("<< %s >>", concat(r, " "))
+ end
end
end
-tostring_a = function(t)
+tostring_a = function(t,contentonly,key)
if #t == 0 then
- return "[ ]"
+ if contentonly then
+ return ""
+ else
+ return "[ ]"
+ end
else
- local r = { "[" }
+ local r = { }
for k, v in next, t do
local tv = type(v)
if tv == "string" then
+ r[#r+1] = toeight(v)
+ elseif tv == "unicode" then
r[#r+1] = tosixteen(v)
elseif tv == "table" then
local mv = getmetatable(v)
@@ -89,54 +149,82 @@ tostring_a = function(t)
r[#r+1] = tostring(v)
end
end
- r[#r+1] = "]"
- return concat(r, " ")
+ if contentonly then
+ return concat(r, " ")
+ elseif key then
+ return format("/%s [ %s ]", key, concat(r, " "))
+ else
+ return format("[ %s ]", concat(r, " "))
+ end
end
end
-local tostring_s = function(t) return tosixteen(t[1]) end
+local tostring_x = function(t) return concat(t, " ") end
+local tostring_s = function(t) return toeight(t[1]) end
+local tostring_u = function(t) return tosixteen(t[1]) end
local tostring_n = function(t) return tostring(t[1]) end -- tostring not needed
local tostring_c = function(t) return t[1] end -- already prefixed (hashed)
local tostring_z = function() return "null" end
local tostring_t = function() return "true" end
local tostring_f = function() return "false" end
-
-local function value_s(t) return t[1] end -- the call is experimental
-local function value_n(t) return t[1] end -- the call is experimental
-local function value_c(t) return sub(t[1],2) end -- the call is experimental
-local function value_d(t) return t end -- the call is experimental
-local function value_a(t) return t end -- the call is experimental
-local function value_z() return nil end -- the call is experimental
-local function value_t() return true end -- the call is experimental
-local function value_b() return false end -- the call is experimental
-
+local tostring_r = function(t) return t[1] .. " 0 R" end
+local tostring_v = function(t) return concat(t, "") end
+
+local function value_x(t) return t end -- the call is experimental
+local function value_s(t,key) return t[1] end -- the call is experimental
+local function value_u(t,key) return t[1] end -- the call is experimental
+local function value_n(t,key) return t[1] end -- the call is experimental
+local function value_c(t) return sub(t[1],2) end -- the call is experimental
+local function value_d(t) return tostring_d(t,true,key) end -- the call is experimental
+local function value_a(t) return tostring_a(t,true,key) end -- the call is experimental
+local function value_z() return nil end -- the call is experimental
+local function value_t() return true end -- the call is experimental
+local function value_b() return false end -- the call is experimental
+local function value_r() return t[1] end -- the call is experimental
+local function value_v() return t end -- the call is experimental
+
+local function add_x(t,k,v) rawset(t,k,tostring(v)) end
+
+local mt_x = { __lpdftype = "stream", __tostring = tostring_x, __call = value_x, __newindex = add_x }
local mt_d = { __lpdftype = "dictionary", __tostring = tostring_d, __call = value_d }
local mt_a = { __lpdftype = "array", __tostring = tostring_a, __call = value_a }
+local mt_u = { __lpdftype = "unicode", __tostring = tostring_u, __call = value_u }
local mt_s = { __lpdftype = "string", __tostring = tostring_s, __call = value_s }
local mt_n = { __lpdftype = "number", __tostring = tostring_n, __call = value_n }
local mt_c = { __lpdftype = "constant", __tostring = tostring_c, __call = value_c }
local mt_z = { __lpdftype = "null", __tostring = tostring_z, __call = value_z }
local mt_t = { __lpdftype = "true", __tostring = tostring_t, __call = value_t }
local mt_f = { __lpdftype = "false", __tostring = tostring_f, __call = value_f }
+local mt_r = { __lpdftype = "reference", __tostring = tostring_r, __call = value_r }
+local mt_v = { __lpdftype = "verbose", __tostring = tostring_v, __call = value_v }
+
+function lpdf.stream(t)
+ if t then
+ for i=1,#t do
+ t[i] = tostring(t[i])
+ end
+ end
+ return setmetatable(t or { },mt_x)
+end
function lpdf.dictionary(t)
return setmetatable(t or { },mt_d)
end
function lpdf.array(t)
- return setmetatable(t or { },mt_a)
+ if type(t) == "string"then
+ return setmetatable({ t },mt_a)
+ else
+ return setmetatable(t or { },mt_a)
+ end
end
-local cache = { } -- can be weak
-
function lpdf.string(str,default)
- str = str or default or ""
- local c = cache[str]
- if not c then
- c = setmetatable({ str },mt_s)
- cache[str] = c
- end
- return c
+ return setmetatable({ str or default or "" },mt_s)
+end
+
+function lpdf.unicode(str,default)
+ return setmetatable({ str or default or "" },mt_u)
end
local cache = { } -- can be weak
@@ -181,6 +269,14 @@ function lpdf.boolean(b,default)
end
end
+function lpdf.reference(r)
+ return setmetatable({ r or 0 },mt_r)
+end
+
+function lpdf.verbose(t)
+ return setmetatable(t or { },mt_v)
+end
+
--~ local d = lpdf.dictionary()
--~ local e = lpdf.dictionary { ["e"] = "abc" }
--~ local f = lpdf.dictionary { ["f"] = "ABC" }
@@ -266,3 +362,157 @@ function lpdf.limited(n,min,max,default)
end
end
end
+
+-- there will be more of this
+
+local pdfreference = lpdf.reference
+local pdfdictionary = lpdf.dictionary
+local pdfreserveobj = pdf.reserveobj
+local pdfimmediateobj = pdf.immediateobj
+
+local texset, texsprint, ctxcatcodes = tex.set, tex.sprint, tex.ctxcatcodes
+
+local pdfobjcache = { }
+
+function lpdf.sharedobj(content)
+ local r = pdfobjcache[content]
+ if not r then
+ r = pdfreference(pdfimmediateobj(content))
+ pdfobjcache[content] = r
+ end
+ return r
+end
+
+-- saves definitions later on
+
+backends = backends or { }
+backends.pdf = backends.pdf or {
+ comment = "backend for directly generating pdf output",
+ nodeinjections = { },
+ codeinjections = { },
+ registrations = { },
+ helpers = { },
+}
+
+--
+
+local pagefinalizers, documentfinalizers = { }, { }
+
+local pageresources, pageattributes, pagesattributes
+
+local function resetpageproperties()
+ pageresources = pdfdictionary()
+ pageattributes = pdfdictionary()
+ pagesattributes = pdfdictionary()
+end
+
+local function setpageproperties()
+ texset("global", "pdfpageresources", pageresources ())
+ texset("global", "pdfpageattr", pageattributes ())
+ texset("global", "pdfpagesattr", pagesattributes())
+end
+
+function lpdf.addtopageresources (k,v) pageresources [k] = v end
+function lpdf.addtopageattributes (k,v) pageattributes [k] = v end
+function lpdf.addtopagesattributes(k,v) pagesattributes[k] = v end
+
+local function set(where, f)
+ where[#where+1] = f
+end
+
+local function run(where)
+ for i=1,#where do
+ where[i]()
+ end
+end
+
+function lpdf.registerpagefinalizer(f)
+ set(pagefinalizers,f)
+end
+
+function lpdf.registerdocumentfinalizer(f)
+ set(documentfinalizers,f)
+end
+
+function lpdf.finalizepage()
+ if not environment.initex then
+ resetpageproperties()
+ run(pagefinalizers)
+ setpageproperties()
+ end
+end
+
+function lpdf.finalizedocument()
+ if not environment.initex then
+ run(documentfinalizers)
+ end
+end
+
+local c_template = "\\normalpdfcatalog{/%s %s}"
+local i_template = "\\normalpdfinfo{/%s %s}"
+local n_template = "\\normalpdfnames{/%s %s}"
+
+function lpdf.addtocatalog(k,v) if not environment.initex then texsprint(ctxcatcodes,format(c_template,k,tostring(v))) end end
+function lpdf.addtoinfo (k,v) if not environment.initex then texsprint(ctxcatcodes,format(i_template,k,tostring(v))) end end
+function lpdf.addtonames (k,v) if not environment.initex then texsprint(ctxcatcodes,format(n_template,k,tostring(v))) end end
+
+local r_extgstates, d_extgstates = pdfreserveobj(), pdfdictionary() local p_extgstates = pdfreference(r_extgstates)
+local r_colorspaces, d_colorspaces = pdfreserveobj(), pdfdictionary() local p_colorspaces = pdfreference(r_colorspaces)
+local r_patterns, d_patterns = pdfreserveobj(), pdfdictionary() local p_patterns = pdfreference(r_patterns)
+local r_shades, d_shades = pdfreserveobj(), pdfdictionary() local p_shades = pdfreference(r_shades)
+
+local function checkextgstates () if next(d_extgstates ) then lpdf.addtopageresources("ExtGState", p_extgstates ) end end
+local function checkcolorspaces() if next(d_colorspaces) then lpdf.addtopageresources("ColorSpace",p_colorspaces) end end
+local function checkpatterns () if next(d_patterns ) then lpdf.addtopageresources("Pattern", p_patterns ) end end
+local function checkshades () if next(d_shades ) then lpdf.addtopageresources("Shading", p_shades ) end end
+
+local function flushextgstates () pdfimmediateobj(r_extgstates, tostring(d_extgstates )) end
+local function flushcolorspaces() pdfimmediateobj(r_colorspaces,tostring(d_colorspaces)) end
+local function flushpatterns () pdfimmediateobj(r_patterns, tostring(d_patterns )) end
+local function flushshades () pdfimmediateobj(r_shades, tostring(d_shades )) end
+
+--~ function lpdf.collectedresources()
+--~ local collected = pdfdictionary {
+--~ ExtGState = (next(d_extgstates) and p_extgstates ) or nil,
+--~ ColorSpace = (next(d_colorspaces) and p_colorspaces) or nil,
+--~ Pattern = (next(d_patterns) and p_patterns ) or nil,
+--~ Shading = (next(d_shades) and p_shades ) or nil,
+--~ }
+--~ if next(collected) then
+--~ tex.sprint(tex.ctxcatcodes,collected())
+--~ end
+--~ end
+
+local collected = pdfdictionary {
+ ExtGState = p_extgstates,
+ ColorSpace = p_colorspaces,
+ Pattern = p_patterns,
+ Shading = p_shades,
+} ; collected = collected()
+
+function lpdf.collectedresources()
+ tex.sprint(tex.ctxcatcodes,collected)
+end
+
+function lpdf.adddocumentextgstate (k,v) d_extgstates [k] = v end
+function lpdf.adddocumentcolorspace(k,v) d_colorspaces[k] = v end
+function lpdf.adddocumentpattern (k,v) d_patterns [k] = v end
+function lpdf.adddocumentshade (k,v) d_shades [k] = v end
+
+lpdf.registerdocumentfinalizer(flushextgstates)
+lpdf.registerdocumentfinalizer(flushcolorspaces)
+lpdf.registerdocumentfinalizer(flushpatterns)
+lpdf.registerdocumentfinalizer(flushshades)
+
+lpdf.registerpagefinalizer(checkextgstates)
+lpdf.registerpagefinalizer(checkcolorspaces)
+lpdf.registerpagefinalizer(checkpatterns)
+lpdf.registerpagefinalizer(checkshades)
+
+--
+
+function lpdf.rotationcm(a)
+ local s, c = sind(a), cosd(a)
+ texwrite(format("%s %s %s %s 0 0 cm",c,s,-s,c))
+end
+
diff --git a/tex/context/base/lpdf-ini.mkiv b/tex/context/base/lpdf-ini.mkiv
index 23a81cfec..52ed6c383 100644
--- a/tex/context/base/lpdf-ini.mkiv
+++ b/tex/context/base/lpdf-ini.mkiv
@@ -14,5 +14,246 @@
\writestatus{loading}{ConTeXt Backend Macros / PDF}
\registerctxluafile{lpdf-ini}{1.001}
+\registerctxluafile{lpdf-nod}{1.001}
+%registerctxluafile{lpdf-col}{1.001} % will be loaded later
+\registerctxluafile{lpdf-mis}{1.001}
+\registerctxluafile{lpdf-ano}{1.001}
+\registerctxluafile{lpdf-ren}{1.001}
+\registerctxluafile{lpdf-grp}{1.001}
+\registerctxluafile{lpdf-wid}{1.001}
+\registerctxluafile{lpdf-fld}{1.001}
+\registerctxluafile{lpdf-u3d}{1.001}
-\endinput
+\unprotect
+
+% for the moment here
+
+%D \macros
+%D {doovalbox}
+%D
+%D Drawing frames with round corners is inherited from the
+%D main module.
+%D
+%D For drawing ovals we use quite raw \PDF\ code. The next
+%D implementation does not differ that much from the one
+%D implemented in the \POSTSCRIPT\ driver.
+
+\def\doPDFovalcalc#1#2#3%
+ {\PointsToBigPoints{\dimexpr#1+#2\relax}#3}
+
+\def\doovalbox#1#2#3#4#5#6#7#8% todo: \scratchdimen/\scatchbox
+ {\forcecolorhack
+ \bgroup
+ \dimen0=#4\divide\dimen0 \plustwo
+ \doPDFovalcalc{0pt}{+\dimen0}\xmin
+ \doPDFovalcalc{#1}{-\dimen0}\xmax
+ \doPDFovalcalc{#2}{-\dimen0}\ymax
+ \doPDFovalcalc{-#3}{+\dimen0}\ymin
+ \advance\dimen0 by #5%
+ \doPDFovalcalc{0pt}{+\dimen0}\xxmin
+ \doPDFovalcalc{#1}{-\dimen0}\xxmax
+ \doPDFovalcalc{#2}{-\dimen0}\yymax
+ \doPDFovalcalc{-#3}{+\dimen0}\yymin
+ \doPDFovalcalc{#4}{\zeropoint}\stroke
+ \doPDFovalcalc{#5}{\zeropoint}\radius
+ \edef\dostroke{#6}%
+ \edef\dofill{#7}%
+ \edef\mode{\number#8 \space}%
+ % no \ifcase, else \relax in pdfcode
+ \setbox\scratchbox\hbox
+ {\ifnum\dostroke\dofill>\zerocount
+ \pdfliteral
+ {q
+ \stroke\space w
+ \ifcase\mode
+ \xxmin\space \ymin \space m
+ \xxmax\space \ymin \space l
+ \xmax \space \ymin \space \xmax \space \yymin\space y
+ \xmax \space \yymax\space l
+ \xmax \space \ymax \space \xxmax\space \ymax \space y
+ \xxmin\space \ymax \space l
+ \xmin \space \ymax \space \xmin \space \yymax\space y
+ \xmin \space \yymin\space l
+ \xmin \space \ymin \space \xxmin\space \ymin \space y
+ h
+ \or % 1
+ \xxmin\space \ymin \space m
+ \xxmax\space \ymin \space l
+ \xmax \space \ymin \space \xmax \space \yymin\space y
+ \xmax \space \ymax \space l
+ \xmin \space \ymax \space l
+ \xmin \space \yymin\space l
+ \xmin \space \ymin \space \xxmin\space \ymin \space y
+ h
+ \or % 2
+ \xxmin\space \ymin \space m
+ \xmax \space \ymin \space l
+ \xmax \space \ymax \space l
+ \xxmin\space \ymax \space l
+ \xmin \space \ymax \space \xmin \space \yymax\space y
+ \xmin \space \yymin\space l
+ \xmin \space \ymin \space \xxmin\space \ymin \space y
+ h
+ \or % 3
+ \xmin \space \ymin \space m
+ \xmax \space \ymin \space l
+ \xmax \space \yymax\space l
+ \xmax \space \ymax \space \xxmax\space \ymax \space y
+ \xxmin\space \ymax \space l
+ \xmin \space \ymax \space \xmin \space \yymax\space y
+ \xmin \space \ymin \space l
+ h
+ \or % 4
+ \xmin \space \ymin \space m
+ \xxmax\space \ymin \space l
+ \xmax \space \ymin \space \xmax \space \yymin\space y
+ \xmax \space \yymax\space l
+ \xmax \space \ymax \space \xxmax\space \ymax \space y
+ \xmin \space \ymax \space l
+ \xmin \space \ymin\space l
+ h
+ \or % 5
+ \xmin \space \ymin \space m
+ \xmax \space \ymin \space l
+ \xmax \space \yymax\space l
+ \xmax \space \ymax \space \xxmax\space \ymax \space y
+ \xmin \space \ymax \space l
+ \xmin \space \ymin \space l
+ h
+ \or % 6
+ \xmin \space \ymin \space m
+ \xxmax\space \ymin \space l
+ \xmax \space \ymin \space \xmax \space \yymin\space y
+ \xmax \space \ymax \space l
+ \xmin \space \ymax \space l
+ \xmin \space \ymin \space l
+ h
+ \or
+ \xxmin\space \ymin \space m
+ \xmax \space \ymin \space l
+ \xmax \space \ymax \space l
+ \xmin \space \ymax \space l
+ \xmin \space \yymin\space l
+ \xmin \space \ymin \space \xxmin\space \ymin \space y
+ h
+ \or
+ \xmin \space \ymin \space m
+ \xmax \space \ymin \space l
+ \xmax \space \ymax \space l
+ \xxmin\space \ymax \space l
+ \xmin \space \ymax \space \xmin \space \yymax\space y
+ \xmin \space \ymin \space l
+ h
+ \or % 9 top open
+ \xmin \space \ymax \space m
+ \xmin \space \yymin\space l
+ \xmin \space \ymin \space \xxmin\space \ymin \space y
+ \xxmax\space \ymin \space l
+ \xmax \space \ymin \space \xmax \space \yymin\space y
+ \xmax \space \ymax \space l
+ \or % 10 right open
+ \xmax \space \ymax \space m
+ \xxmin\space \ymax \space l
+ \xmin \space \ymax \space \xmin \space \yymax\space y
+ \xmin \space \yymin\space l
+ \xmin \space \ymin \space \xxmin\space \ymin \space y
+ \xmax\space \ymin \space l
+ \or % 11 bottom open
+ \xmax \space \ymin \space m
+ \xmax \space \yymax\space l
+ \xmax \space \ymax \space \xxmax \space \ymax\space y
+ \xxmin\space \ymax \space l
+ \xmin \space \ymax \space \xmin \space \yymax\space y
+ \xmin \space \ymin \space l
+ \or % 12 left open
+ \xmin \space \ymax \space m
+ \xxmax\space \ymax \space l
+ \xmax \space \ymax \space \xmax \space \yymax\space y
+ \xmax \space \yymin\space l
+ \xmax \space \ymin \space \xxmax\space \ymin \space y
+ \xmin \space \ymin \space l
+ \or % 13
+ \xmin \space \ymax \space m
+ \xxmax\space \ymax \space l
+ \xmax \space \ymax \space \xmax \space \yymax\space y
+ \xmax\space \ymin \space l
+ \or % 14
+ \xmax \space \ymax \space m
+ \xmax \space \yymin\space l
+ \xmax \space \ymin \space \xxmax\space \ymin \space y
+ \xmin \space \ymin \space l
+ \or % 15
+ \xmax \space \ymin \space m
+ \xxmin\space \ymin \space l
+ \xmin \space \ymin \space \xmin \space \yymin\space y
+ \xmin \space \ymax \space l
+ \or % 16
+ \xmin \space \ymin \space m
+ \xmin \space \yymax\space l
+ \xmin \space \ymax \space \xxmin\space \ymax \space y
+ \xmax \space \ymax \space l
+ \or % 17
+ \xxmax\space \ymax \space m
+ \xmax \space \ymax \space \xmax \space \yymax\space y
+ \or % 18
+ \xmax \space \yymin\space m
+ \xmax \space \ymin \space \xxmax\space \ymin \space y
+ \or % 19
+ \xxmin\space \ymin \space m
+ \xmin \space \ymin \space \xmin \space \yymin\space y
+ \or % 20
+ \xmin \space \yymax\space m
+ \xmin \space \ymax \space \xxmin\space \ymax \space y
+ \or % 21
+ \xxmax\space \ymax \space m
+ \xmax \space \ymax \space \xmax \space \yymax\space y
+ \xmin \space \yymax\space m
+ \xmin \space \ymax \space \xxmin\space \ymax \space y
+ \or % 22
+ \xxmax\space \ymax \space m
+ \xmax \space \ymax \space \xmax \space \yymax\space y
+ \xmax \space \yymin\space m
+ \xmax \space \ymin \space \xxmax\space \ymin \space y
+ \or % 23
+ \xmax \space \yymin\space m
+ \xmax \space \ymin \space \xxmax\space \ymin \space y
+ \xxmin\space \ymin \space m
+ \xmin \space \ymin \space \xmin \space \yymin\space y
+ \or % 24
+ \xxmin\space \ymin \space m
+ \xmin \space \ymin \space \xmin \space \yymin\space y
+ \xmin \space \yymax\space m
+ \xmin \space \ymax \space \xxmin\space \ymax \space y
+ \or % 25
+ \xxmax\space \ymax \space m
+ \xmax \space \ymax \space \xmax \space \yymax\space y
+ \xmax \space \yymin\space m
+ \xmax \space \ymin \space \xxmax\space \ymin \space y
+ \xxmin\space \ymin \space m
+ \xmin \space \ymin \space \xmin \space \yymin\space y
+ \xmin \space \yymax\space m
+ \xmin \space \ymax \space \xxmin\space \ymax \space y
+ \or % 26
+ \xmax \space \yymin\space m
+ \xmax \space \ymin \space \xxmax\space \ymin \space y
+ \xmin \space \yymax\space m
+ \xmin \space \ymax \space \xxmin\space \ymax \space y
+ \or % 27
+ \xxmax\space \ymax \space m
+ \xmax \space \ymax \space \xmax \space \yymax\space y
+ \xxmin\space \ymin \space m
+ \xmin \space \ymin \space \xmin \space \yymin\space y
+ \or % 28
+ \fi
+ \ifnum\mode>8
+ S
+ \else
+ \ifnum\dostroke=\plusone S \fi
+ \ifnum\dofill =\plusone f \fi
+ \fi
+ Q}%
+ \fi}%
+ \wd\scratchbox#1\ht\scratchbox#2\dp\scratchbox#3\box\scratchbox
+ \egroup}
+
+\protect \endinput
diff --git a/tex/context/base/lpdf-mis.lua b/tex/context/base/lpdf-mis.lua
new file mode 100644
index 000000000..4a8a097ff
--- /dev/null
+++ b/tex/context/base/lpdf-mis.lua
@@ -0,0 +1,230 @@
+if not modules then modules = { } end modules ['lpdf-mis'] = {
+ version = 1.001,
+ comment = "companion to back-pdf.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- Although we moved most pdf handling to the lua end, we didn't change
+-- the overall approach. For instance we share all resources i.e. we
+-- don't make subsets for each xform or page. The current approach is
+-- quite efficient. A big difference between MkII and MkIV is that we
+-- now use forward references. In this respect the MkII code shows that
+-- it evolved over a long period, when backends didn't provide forward
+-- referencing and references had to be tracked in multiple passes. Of
+-- course there are a couple of more changes.
+
+local next, tostring = next, tostring
+local format = string.format
+local texsprint, texset = tex.sprint, tex.set
+local ctxcatcodes = tex.ctxcatcodes
+
+local nodeinjections = backends.pdf.nodeinjections
+local codeinjections = backends.pdf.codeinjections
+local registrations = backends.pdf.registrations
+
+local pdfdictionary = lpdf.dictionary
+local pdfarray = lpdf.array
+local pdfboolean = lpdf.boolean
+local pdfconstant = lpdf.constant
+local pdfreference = lpdf.reference
+local pdfunicode = lpdf.unicode
+local pdfstring = lpdf.string
+
+local pdfreserveobj = pdf.reserveobj
+local pdfimmediateobj = pdf.immediateobj
+
+local tobasepoints = number.tobasepoints
+
+lpdf.addtoinfo ("Trapped", pdfboolean(false))
+lpdf.addtocatalog("Version", pdfconstant(format("1.%s",tex.pdfminorversion)))
+
+-- we could do this selectively
+
+local function initializenegative()
+ local a = pdfarray { 0, 1 }
+ local g = pdfconstant("ExtGState")
+ local d = pdfdictionary {
+ FunctionType = 4,
+ Range = a,
+ Domain = a,
+ }
+ local negative = pdfdictionary { Type = g, TR = pdfreference(pdf.immediateobj("stream","1 exch sub",d())) }
+ local positive = pdfdictionary { Type = g, TR = pdfconstant("Identity") }
+ lpdf.adddocumentextgstate("GSnegative", pdfreference(pdfimmediateobj(tostring(negative))))
+ lpdf.adddocumentextgstate("GSPositive", pdfreference(pdfimmediateobj(tostring(positive))))
+end
+
+local function initializeoverprint()
+ local g = pdfconstant("ExtGState")
+ local knockout = pdfdictionary { Type = g, OP = false, OPM = 0 }
+ local overprint = pdfdictionary { Type = g, OP = true, OPM = 1 }
+ lpdf.adddocumentextgstate("GSknockout", pdfreference(pdfimmediateobj(tostring(knockout ))))
+ lpdf.adddocumentextgstate("GSoverprint", pdfreference(pdfimmediateobj(tostring(overprint))))
+end
+
+lpdf.registerdocumentfinalizer(initializenegative)
+lpdf.registerdocumentfinalizer(initializeoverprint)
+
+function codeinjections.addtransparencygroup()
+ -- png: /CS /DeviceRGB /I true
+ local d = tostring ( pdfdictionary {
+ S = pdfconstant("Transparency"),
+ I = true,
+ K = true,
+ } )
+ lpdf.registerpagefinalizer(function() lpdf.addtopageattributes("Group",d) end)
+end
+
+-- actions (todo: store and update when changed)
+
+local openpage, closepage, opendocument, closedocument
+
+function codeinjections.flushdocumentactions(open,close)
+ opendocument, closedocument = open, close
+end
+
+function codeinjections.flushpageactions(open,close)
+ openpage, closepage = open, close
+end
+
+local function flushdocumentactions()
+ if opendocument then
+ lpdf.addtocatalog("OpenAction",lpdf.pdfaction(opendocument))
+ end
+ if closedocument then
+ lpdf.addtocatalog("CloseAction",lpdf.pdfaction(closedocument))
+ end
+end
+
+local function flushpageactions()
+ if openpage or closepage then
+ local d = pdfdictionary()
+ if openpage then
+ d.O = lpdf.pdfaction(openpage)
+ end
+ if closepage then
+ d.C = lpdf.pdfaction(closepage)
+ end
+ lpdf.addtopageattributes("AA",d)
+ end
+end
+
+lpdf.registerpagefinalizer(flushpageactions)
+lpdf.registerdocumentfinalizer(flushdocumentactions)
+
+--- info
+
+function codeinjections.setupidentity(specification)
+ local title = specification.title or "" if title ~= "" then
+ lpdf.addtoinfo("Title", pdfunicode(title))
+ end
+ local subject = specification.subject or "" if subject ~= "" then
+ lpdf.addtoinfo("Subject", pdfunicode(subject))
+ end
+ local author = specification.author or "" if author ~= "" then
+ lpdf.addtoinfo("Author", pdfunicode(author))
+ end
+ local creator = specification.creator or "" if creator ~= "" then
+ lpdf.addtoinfo("Creator", pdfunicode(creator))
+ end
+ local date = specification.date or "" if date ~= "" then
+ lpdf.addtoinfo("ModDate", pdfstring(date))
+ end
+ local keywords = specification.keywords or "" if keywords ~= "" then
+ keywords = string.gsub("[%s,]+", " ")
+ lpdf.addtoinfo("Keywords",pdfunicode(keywords))
+ end
+ lpdf.addtoinfo("ID", pdfstring(format("%s.%s",tex.jobname,os.date("%Y%m%d.%H%M")))) -- needed for pdf/x
+end
+
+local function flushjavascripts()
+ local t = javascripts.flushpreambles()
+ local a = pdfarray()
+ local pdf_javascript = pdfconstant("JavaScript")
+ for i=1,#t do
+ local name, script = t[i][1], t[i][2]
+ local j = pdfdictionary {
+ S = pdf_javascript,
+ JS = pdfreference(pdfimmediateobj("stream",script)),
+ }
+ a[#a+1] = pdfstring(name)
+ a[#a+1] = pdfreference(pdfimmediateobj(tostring(j)))
+ end
+ lpdf.addtonames("JavaScript",pdfreference(pdfimmediateobj(tostring(pdfdictionary{ Names = a }))))
+end
+
+lpdf.registerdocumentfinalizer(flushjavascripts)
+
+-- -- --
+
+local pagespecs = {
+ max = { "FullScreen", false, false },
+ bookmark = { "UseOutlines", false, false },
+ fit = { "UseNone", false, true },
+ doublesided = { "UseNone", "TwoColumnRight", true },
+ default = { "UseNone", "auto", false },
+}
+
+local pagespec, topoffset, leftoffset, height, width, doublesided = "default", 0, 0, 0, 0, false
+
+function codeinjections.setupcanvas(specification)
+ local paperheight = specification.paperheight
+ local paperwidth = specification.paperwidth
+ local paperdouble = specification.doublesided
+ if paperheight then
+ texset('global','pdfpageheight',paperheight)
+ end
+ if paperwidth then
+ texset('global','pdfpagewidth',paperwidth)
+ end
+ pagespec = specification.mode or pagespec
+ topoffset = specification.topoffset or 0
+ leftoffset = specification.leftoffset or 0
+ height = specification.height or tex.pdfpageheight
+ width = specification.width or tex.pdfpagewidth
+ if paperdouble ~= nil then
+ doublesided = paperdouble
+ end
+end
+
+local function documentspecification()
+ local spec = pagespecs[pagespec] or pagespecs.default
+ local mode, layout, fit = spec[1], spec[2], spec[3]
+ if layout == "auto" and doublesided then
+ spec = pagespecs.doublesided
+ mode, layout, fit = spec[1], spec[2], spec[3]
+ end
+ mode = mode and pdfconstant(mode)
+ layout = layout and pdfconstant(layout)
+ fit = fit and pdfdictionary { FitWindow = true }
+ if layout then
+ lpdf.addtocatalog("PageLayout",layout)
+ end
+ if mode then
+ lpdf.addtocatalog("PageMode",mode)
+ end
+ if fit then
+ lpdf.addtocatalog("ViewerPreferences",fit)
+ end
+end
+
+local factor = number.dimenfactors.bp
+
+local function pagespecification()
+ local pageheight = tex.pdfpageheight
+ local box = pdfarray { -- can be cached
+ factor * (leftoffset),
+ factor * (pageheight-topoffset-height),
+ factor * (width-leftoffset),
+ factor * (pageheight-topoffset),
+ }
+ lpdf.addtopageattributes("CropBox",box) -- mandate for rendering
+ lpdf.addtopageattributes("TrimBox",box) -- mandate for pdf/x
+ -- lpdf.addtopageattributes("BleedBox",box)
+ -- lpdf.addtopageattributes("ArtBox",box)
+end
+
+lpdf.registerpagefinalizer(pagespecification)
+lpdf.registerdocumentfinalizer(documentspecification)
diff --git a/tex/context/base/lpdf-nod.lua b/tex/context/base/lpdf-nod.lua
new file mode 100644
index 000000000..f40039b94
--- /dev/null
+++ b/tex/context/base/lpdf-nod.lua
@@ -0,0 +1,53 @@
+if not modules then modules = { } end modules ['lpdf-nod'] = {
+ version = 1.001,
+ comment = "companion to lpdf-ini.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local copy_node, new_node = node.copy, node.new
+
+local pdfliteral = nodes.register(new_node("whatsit", 8)) pdfliteral.mode = 1
+local pdfdest = nodes.register(new_node("whatsit",19)) pdfdest.named_id = 1 -- xyz_zoom untouched
+local pdfannot = nodes.register(new_node("whatsit",15))
+
+local variables = interfaces.variables
+
+local views = { -- beware, we do support the pdf keys but this is *not* official
+ xyz = 0, [variables.standard] = 0,
+ fit = 1, [variables.fit] = 1,
+ fith = 2, [variables.width] = 2,
+ fitv = 3, [variables.height] = 3,
+ fitb = 4,
+ fitbh = 5, [variables.minheight] = 5,
+ fitbv = 6, [variables.minheight] = 6,
+ fitr = 7,
+}
+
+function nodes.pdfliteral(str)
+ local t = copy_node(pdfliteral)
+ t.data = str
+ return t
+end
+
+function nodes.pdfannot(w,h,d,data,n)
+ local t = copy_node(pdfannot)
+ if w and w ~= 0 then t.width = w end
+ if h and h ~= 0 then t.height = h end
+ if d and d ~= 0 then t.depth = d end
+ if n then t.objnum = n end
+ if data and data ~= "" then t.data = data end
+ return t
+end
+
+function nodes.pdfdest(w,h,d,name,view,n)
+ local t = copy_node(pdfdest)
+ if w and w ~= 0 then t.width = w end
+ if h and h ~= 0 then t.height = h end
+ if d and d ~= 0 then t.depth = d end
+ if n then t.objnum = n end
+ t.dest_id = name
+ t.dest_type = views[view] or view or 1 -- fit is default
+ return t
+end
diff --git a/tex/context/base/lpdf-ren.lua b/tex/context/base/lpdf-ren.lua
new file mode 100644
index 000000000..05a6658e7
--- /dev/null
+++ b/tex/context/base/lpdf-ren.lua
@@ -0,0 +1,210 @@
+if not modules then modules = { } end modules ['lpdf-ren'] = {
+ version = 1.001,
+ comment = "companion to lpdf-ini.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- rendering
+
+local tostring, tonumber, next = tostring, tonumber, next
+local format = string.format
+local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes
+
+local nodeinjections = backends.pdf.nodeinjections
+local codeinjections = backends.pdf.codeinjections
+local registrations = backends.pdf.registrations
+
+jobreferences = jobreferences or { }
+--~ jobreferences.runners = jobreferences.runners or { }
+--~ jobreferences.specials = jobreferences.specials or { }
+--~ jobreferences.handlers = jobreferences.handlers or { }
+jobreferences.executers = jobreferences.executers or { }
+
+--~ local runners = jobreferences.runners
+--~ local specials = jobreferences.specials
+--~ local handlers = jobreferences.handlers
+local executers = jobreferences.executers
+
+local variables = interfaces.variables
+
+local pdfconstant = lpdf.constant
+local pdfdictionary = lpdf.dictionary
+local pdfarray = lpdf.array
+local pdfreference = lpdf.reference
+
+local pdfreserveobj = pdf.reserveobj
+local pdfimmediateobj = pdf.immediateobj
+
+local pdf_ocg = pdfconstant("OCG")
+local pdf_ocmd = pdfconstant("OCMD")
+local pdf_off = pdfconstant("OFF")
+local pdf_on = pdfconstant("ON")
+local pdf_toggle = pdfconstant("Toggle")
+local pdf_setocgstate = pdfconstant("SetOCGState")
+
+local lpdf_usage = pdfdictionary { Print = pdfdictionary { PrintState = pdfconstant("OFF") } }
+
+local pdfln, pdfld = { }, { }
+local textlayers, hidelayers, videlayers = pdfarray(), pdfarray(), pdfarray()
+local pagelayers = pdfdictionary()
+
+lpdf.layerreferences = pdfln
+
+function backends.pdf.layerreference(name)
+ return pdfln[name]
+end
+
+
+function codeinjections.defineviewerlayer(specification)
+ if textlayers then
+ local tag = specification.tag
+ -- todo: reserve
+ local n = pdfdictionary {
+ Type = pdf_ocg,
+ Name = specification.title or "unknown",
+ Intent = ((specification.kind > 0) and pdf_design) or nil, -- disable layer hiding by user
+ Usage = ((specification.printable == variables.no) and lpdf_usage) or nil , -- printable or not
+ }
+ local nr = pdfreference(pdfimmediateobj(tostring(n)))
+ pdfln[tag] = nr -- was n
+ local d = pdfdictionary {
+ Type = pdf_ocmd,
+ OCGs = pdfarray { nr },
+ }
+ local dr = pdfreference(pdfimmediateobj(tostring(d)))
+ pdfld[tag] = dr
+ textlayers[#textlayers+1] = nr
+ if specification.visible == variables.start then
+ videlayers[#videlayers+1] = nr
+ else
+ hidelayers[#hidelayers+1] = nr
+ end
+ pagelayers[tag] = dr -- check
+ end
+end
+
+local function flushtextlayers()
+ if textlayers and #textlayers > 0 then
+ local d = pdfdictionary {
+ OCGs = textlayers,
+ D = pdfdictionary {
+ Order = textlayers,
+ ON = videlayers,
+ OFF = hidelayers,
+ },
+ }
+ lpdf.addtocatalog("OCProperties",d)
+ textlayers = nil
+ end
+end
+
+local function flushpagelayers()
+ if next(pagelayers) then
+ lpdf.addtopageresources("Properties",pagelayers)
+ end
+end
+
+lpdf.registerpagefinalizer (flushpagelayers)
+lpdf.registerdocumentfinalizer(flushtextlayers)
+
+local function setlayer(what,arguments)
+ -- maybe just a gmatch of even better, earlier in lpeg
+ arguments = (type(arguments) == "table" and arguments) or aux.settings_to_array(arguments)
+ local state = pdfarray { what }
+ for i=1,#arguments do
+ local p = pdfln[arguments[i]]
+ if p then
+ state[#state+1] = p
+ end
+ end
+ return pdfdictionary {
+ S = pdf_setocgstate,
+ State = state,
+ }
+end
+
+function executers.hidelayer (arguments) setlayer(pdf_off, arguments) end
+function executers.videlayer (arguments) setlayer(pdf_on, arguments) end
+function executers.togglelayer(arguments) setlayer(pdf_toggle,arguments) end
+
+-- transitions
+
+local pagetransitions = {
+ {"split","in","vertical"}, {"split","in","horizontal"},
+ {"split","out","vertical"}, {"split","out","horizontal"},
+ {"blinds","horizontal"}, {"blinds","vertical"},
+ {"box","in"}, {"box","out"},
+ {"wipe","east"}, {"wipe","west"}, {"wipe","north"}, {"wipe","south"},
+ {"dissolve"},
+ {"glitter","east"}, {"glitter","south"},
+ {"fly","in","east"}, {"fly","in","west"}, {"fly","in","north"}, {"fly","in","south"},
+ {"fly","out","east"}, {"fly","out","west"}, {"fly","out","north"}, {"fly","out","south"},
+ {"push","east"}, {"push","west"}, {"push","north"}, {"push","south"},
+ {"cover","east"}, {"cover","west"}, {"cover","north"}, {"cover","south"},
+ {"uncover","east"}, {"uncover","west"}, {"uncover","north"}, {"uncover","south"},
+ {"fade"},
+}
+
+local mapping = {
+ split = { "S" , pdfconstant("Split") },
+ blinds = { "S" , pdfconstant("Blinds") },
+ box = { "S" , pdfconstant("Box") },
+ wipe = { "S" , pdfconstant("Wipe") },
+ dissolve = { "S" , pdfconstant("Dissolve") },
+ glitter = { "S" , pdfconstant("Glitter") },
+ replace = { "S" , pdfconstant("R") },
+ fly = { "S" , pdfconstant("Fly") },
+ push = { "S" , pdfconstant("Push") },
+ cover = { "S" , pdfconstant("Cover") },
+ uncover = { "S" , pdfconstant("Uncover") },
+ fade = { "S" , pdfconstant("Fade") },
+ horizontal = { "Dm" , pdfconstant("H") },
+ vertical = { "Dm" , pdfconstant("V") },
+ ["in"] = { "M" , pdfconstant("I") },
+ out = { "M" , pdfconstant("O") },
+ east = { "Di" , 0 },
+ north = { "Di" , 90 },
+ west = { "Di" , 180 },
+ south = { "Di" , 270 },
+}
+
+local last = 0
+
+-- n: number, "stop", "reset", "random", "a,b,c" delay: number, "none"
+
+function codeinjections.setpagetransition(specification)
+ local n, delay = specification.n, specification.delay
+ if n == variables.auto then
+ if last >= #pagetransitions then
+ last = 0
+ end
+ n = last + 1
+ elseif n == variables.stop then
+ return
+ elseif n == variables.reset then
+ last = 0
+ return
+ elseif n == variables.random then
+ n = math.random(1,#pagetransitions)
+ else
+ n = tonumber(n)
+ end
+ local t = n and pagetransitions[n] or pagetransitions[1]
+ if not t then
+ t = aux.settings_to_array(n)
+ end
+ if t and #t > 0 then
+ local d = pdfdictionary()
+ for i=1,#t do
+ local m = mapping[t[i]]
+ d[m[1]] = m[2]
+ end
+ delay = tonumber(delay)
+ if delay and delay > 0 then
+ lpdf.addtopageattributes("Dur",delay)
+ end
+ lpdf.addtopageattributes("Trans",d)
+ end
+end
diff --git a/tex/context/base/lpdf-u3d.lua b/tex/context/base/lpdf-u3d.lua
new file mode 100644
index 000000000..5f7a770b1
--- /dev/null
+++ b/tex/context/base/lpdf-u3d.lua
@@ -0,0 +1,427 @@
+if not modules then modules = { } end modules ['lpdf-u3d'] = {
+ version = 1.001,
+ comment = "companion to lpdf-ini.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- The following code is based on a working prototype provided
+-- by Michael Vidiassov. It is rewritten using the lpdf library
+-- and different checking is used. The macro calls are adapted
+-- (and will eventually be removed). The user interface needs
+-- an overhaul. There are some messy leftovers that will be
+-- removed in future versions.
+
+local format = string.format
+local cos, sin, sqrt, pi, atan2, abs = math.cos, math.sin, math.sqrt, math.pi, math.atan2, math.abs
+
+local pdfconstant = lpdf.constant
+local pdfboolean = lpdf.boolean
+local pdfunicode = lpdf.unicode
+local pdfdictionary = lpdf.dictionary
+local pdfarray = lpdf.array
+local pdfnull = lpdf.null
+local pdfreference = lpdf.reference
+
+local checkedkey = lpdf.checkedkey
+local limited = lpdf.limited
+
+local schemes = table.tohash {
+ "Artwork", "None", "White", "Day", "Night", "Hard",
+ "Primary", "Blue", "Red", "Cube", "CAD", "Headlamp",
+}
+
+local modes = table.tohash {
+ "Solid", "SolidWireframe", "Transparent", "TransparentWireframe", "BoundingBox",
+ "TransparentBoundingBox", "TransparentBoundingBoxOutline", "Wireframe",
+ "ShadedWireframe", "HiddenWireframe", "Vertices", "ShadedVertices", "Illustration",
+ "SolidOutline", "ShadedIllustration",
+}
+
+local function normalize(x, y, z)
+ local modulo = sqrt(x*x + y*y + z*z);
+ if modulo ~= 0 then
+ return x/modulo, y/modulo, z/modulo
+ else
+ return x, y, z
+ end
+end
+
+local function rotate(vect_x,vect_y,vect_z, tet, axis_x,axis_y,axis_z)
+ -- rotate vect by tet about axis counterclockwise
+ local c, s = cos(tet*pi/180), sin(tet*pi/180)
+ local r = 1 - c
+ local n = sqrt(axis_x*axis_x+axis_y*axis_y+axis_z*axis_z)
+ axis_x, axis_y, axis_z = axis_x/n, axis_y/n, axis_z/n
+ return
+ (axis_x*axis_x*r+c )*vect_x + (axis_x*axis_y*r-axis_z*s)*vect_y + (axis_x*axis_z*r+axis_y*s)*vect_z,
+ (axis_x*axis_y*r+axis_z*s)*vect_x + (axis_y*axis_y*r+c )*vect_y + (axis_y*axis_z*r-axis_x*s)*vect_z,
+ (axis_x*axis_z*r-axis_y*s)*vect_x + (axis_y*axis_z*r+axis_x*s)*vect_y + (axis_z*axis_z*r+c )*vect_z
+end
+
+local function make3dview(view)
+
+ local name = viewname
+ local name = pdfunicode((view.name ~= "" and name) or "unknown view")
+
+ local viewdict = pdfdictionary {
+ Type = pdfconstant("3DView"),
+ XN = name,
+ IN = name,
+ }
+
+ local bg = checkedkey(view,"bg","table")
+ if bg then
+ viewdict.BG = pdfdictionary {
+ Type = pdfconstant("3DBG"),
+ C = pdfarray { limited(bg[1],1,1,1), limited(bg[2],1,1,1), limited(bg[3],1,1,1) },
+ }
+ end
+
+ local lights = checkedkey(view,"lights","string")
+ if lights and schemes[lights] then
+ viewdict.LS = pdfdictionary {
+ Type = pdfconstant("3DLightingScheme"),
+ Subtype = pdfconstant(lights),
+ }
+ end
+
+ -- camera position is taken from 3d model
+
+ local u3dview = checkedkey(view, "u3dview", "string")
+ if u3dview then
+ viewdict.MS = pdfconstant("U3D")
+ viewdict.U3DPath = u3dview
+ end
+
+ -- position the camera as given
+
+ local c2c = checkedkey(view, "c2c", "table")
+ local coo = checkedkey(view, "coo", "table")
+ local roo = checkedkey(view, "roo", "number")
+ local azimuth = checkedkey(view, "azimuth", "number")
+ local altitude = checkedkey(view, "altitude", "number")
+
+ if c2c or coo or roo or azimuth or altitude then
+
+ local pos = checkedkey(view, "pos", "table")
+ local dir = checkedkey(view, "dir", "table")
+ local upv = checkedkey(view, "upv", "table")
+ local roll = checkedkey(view, "roll", "table")
+
+ local coo_x, coo_y, coo_z = 0, 0, 0
+ local dir_x, dir_y, dir_z = 0, 0, 0
+ local trans_x, trans_y, trans_z = 0, 0, 0
+ local left_x, left_y, left_z = 0, 0, 0
+ local up_x, up_y, up_z = 0, 0, 0
+
+ -- point camera is aimed at
+
+ if coo then
+ coo_x, coo_y, coo_z = tonumber(coo[1]) or 0, tonumber(coo[2]) or 0, tonumber(coo[3]) or 0
+ end
+
+ -- distance from camera to target
+
+ if roo then
+ roo = abs(roo)
+ end
+ if not roo or roo == 0 then
+ roo = 0.000000000000000001
+ end
+
+ -- set it via camera position
+
+ if pos then
+ dir_x = coo_x - (tonumber(pos[1]) or 0)
+ dir_y = coo_y - (tonumber(pos[2]) or 0)
+ dir_z = coo_z - (tonumber(pos[3]) or 0)
+ if not roo then
+ roo = sqrt(dir_x*dir_x + dir_y*dir_y + dir_z*dir_z)
+ end
+ if dir_x == 0 and dir_y == 0 and dir_z == 0 then dir_y = 1 end
+ dir_x, dir_y, dir_z = normalize(dir_x,dir_y,dir_z)
+ end
+
+ -- set it directly
+
+ if dir then
+ dir_x, dir_y, dir_z = tonumber(dir[1] or 0), tonumber(dir[2] or 0), tonumber(dir[3] or 0)
+ if dir_x == 0 and dir_y == 0 and dir_z == 0 then dir_y = 1 end
+ dir_x, dir_y, dir_z = normalize(dir_x,dir_y,dir_z)
+ end
+
+ -- set it movie15 style with vector from target to camera
+
+ if c2c then
+ dir_x, dir_y, dir_z = - tonumber(c2c[1] or 0), - tonumber(c2c[2] or 0), - tonumber(c2c[3] or 0)
+ if dir_x == 0 and dir_y == 0 and dir_z == 0 then dir_y = 1 end
+ dir_x, dir_y, dir_z = normalize(dir_x,dir_y,dir_z)
+ end
+
+ -- set it with azimuth and altitutde
+
+ if altitude or azimuth then
+ dir_x, dir_y, dir_z = -1, 0, 0
+ if altitude then dir_x, dir_y, dir_z = rotate(dir_x,dir_y,dir_z, -altitude, 0,1,0) end
+ if azimuth then dir_x, dir_y, dir_z = rotate(dir_x,dir_y,dir_z, azimuth, 0,0,1) end
+ end
+
+ -- set it with rotation like in MathGL
+
+ if rot then
+ if dir_x == 0 and dir_y == 0 and dir_z == 0 then dir_z = -1 end
+ dir_x,dir_y,dir_z = rotate(dir_x,dir_y,dir_z, tonumber(rot[1]) or 0, 1,0,0)
+ dir_x,dir_y,dir_z = rotate(dir_x,dir_y,dir_z, tonumber(rot[2]) or 0, 0,1,0)
+ dir_x,dir_y,dir_z = rotate(dir_x,dir_y,dir_z, tonumber(rot[3]) or 0, 0,0,1)
+ end
+
+ -- set it with default movie15 orientation looking up y axis
+
+ if dir_x == 0 and dir_y == 0 and dir_z == 0 then dir_y = 1 end
+
+ -- left-vector
+ -- up-vector
+
+ if upv then
+ up_x, up_y, up_z = tonumber(upv[1]) or 0, tonumber(upv[2]) or 0, tonumber(upv[3]) or 0
+ else
+ -- set default up-vector
+ if abs(dir_x) == 0 and abs(dir_y) == 0 then
+ if dir_z < 0 then
+ up_y = 1 -- top view
+ else
+ up_y = -1 -- bottom view
+ end
+ else
+ -- other camera positions than top and bottom, up-vector = up_world - (up_world dot dir) dir
+ up_x, up_y, up_z = - dir_z*dir_x, - dir_z*dir_y, - dir_z*dir_z + 1
+ end
+ end
+
+ -- normalize up-vector
+
+ up_x, up_y, up_z = normalize(up_x,up_y,up_z)
+
+ -- left vector = up x dir
+
+ left_x, left_y, left_z = dir_z*up_y - dir_y*up_z, dir_x*up_z - dir_z*up_x, dir_y*up_x - dir_x*up_y
+
+ -- normalize left vector
+
+ left_x, left_y, left_z = normalize(left_x,left_y,left_z)
+
+ -- apply camera roll
+
+ if roll then
+ local sinroll = sin((roll/180.0)*pi)
+ local cosroll = cos((roll/180.0)*pi)
+ left_x = left_x*cosroll + up_x*sinroll
+ left_y = left_y*cosroll + up_y*sinroll
+ left_z = left_z*cosroll + up_z*sinroll
+ up_x = up_x*cosroll + left_x*sinroll
+ up_y = up_y*cosroll + left_y*sinroll
+ up_z = up_z*cosroll + left_z*sinroll
+ end
+
+ -- translation vector
+
+ trans_x, trans_y, trans_z = coo_x - roo*dir_x, coo_y - roo*dir_y, coo_z - roo*dir_z
+
+ viewdict.MS = pdfconstant("M")
+ viewdict.CO = roo
+ viewdict.C2W = pdfarray {
+ left_x, left_y, left_z,
+ up_x, up_y, up_z,
+ dir_x, dir_y, dir_z,
+ trans_x, trans_y, trans_z,
+ }
+
+ end
+
+ local aac = tonumber(view.aac) -- perspective projection
+ local mag = tonumber(view.mag) -- ortho projection
+
+ if aac and aac > 0 and aac < 180 then
+ viewdict.P = pdfdictionary {
+ Subtype = pdfconstant("P"),
+ PS = pdfconstant("Min"),
+ FOV = aac,
+ }
+ elseif mag and mag > 0 then
+ viewdict.P = pdfdictionary {
+ Subtype = pdfconstant("O"),
+ OS = mag,
+ }
+ end
+
+ local mode = modes[view.rendermode]
+ if mode then
+ pdfdictionary {
+ Type = pdfconstant("3DRenderMode"),
+ Subtype = pdfconstant(mode),
+ }
+ end
+
+ -- crosssection
+
+ local crosssection = checkedkey(view,"crosssection","table")
+ if crosssection then
+ local crossdict = pdfdictionary {
+ Type = pdfconstant("3DCrossSection")
+ }
+
+ local c = checkedkey(crosssection,"point","table") or checkedkey(crosssection,"center","table")
+ if c then
+ crossdict.C = pdfarray { tonumber(c[1]) or 0, tonumber(c[2]) or 0, tonumber(c[3]) or 0 }
+ end
+
+ local normal = checkedkey(crosssection,"normal","table")
+ if normal then
+ local x, y, z = tonumber(normal[1] or 0), tonumber(normal[2] or 0), tonumber(normal[3] or 0)
+ if sqrt(x*x + y*y + z*z) == 0 then
+ x, y, z = 1, 0, 0
+ end
+ crossdict.O = pdfarray {
+ pdfnull,
+ atan2(-z,sqrt(x*x + y*y))*180/pi,
+ atan2(y,x)*180/pi,
+ }
+ end
+
+ local orient = checkedkey(crosssection,"orient","table")
+ if orient then
+ crossdict.O = pdfarray {
+ tonumber(orient[1]) or 1,
+ tonumber(orient[2]) or 0,
+ tonumber(orient[3]) or 0,
+ }
+ end
+
+ crossdict.IV = cross.intersection or false
+ crossdict.ST = cross.transparent or false
+
+ viewdict.SA = next(crossdict) and pdfarray { crossdict } -- maybe test if # > 1
+ end
+
+ local nodes = checkedkey(view,"nodes","table")
+ if nodes then
+ local nodelist = pdfarray()
+ for i=1,#nodes do
+ local node = checkedkey(nodes,i,"table")
+ if node then
+ local position = checkedkey(node,"position","table")
+ position = position and #position == 12 and pdfarray(position)
+ if position then
+ nodelist[#nodelist+1] = pdfdictionary {
+ Type = pdfconstant("3DNode"),
+ N = node.name or ("node_" .. i), -- pdfunicode ?
+ V = node.visible or true,
+ O = node.opacity or 0,
+ RM = pdfdictionary {
+ Type = pdfconstant("3DRenderMode"),
+ Subtype = pdfconstant(node.rendermode or "Solid"),
+ },
+ M = position,
+ }
+ end
+ end
+ end
+ viewdict.NR = true
+ viewdict.NA = nodelist
+ end
+
+ return viewdict
+
+end
+
+local stored_js, stored_3d, stored_pr, streams = { }, { }, { }, { }
+
+function backends.pdf.helpers.insert3d(spec) -- width, height, factor, display, controls, label, foundname
+
+ local width, height, factor = spec.width, spec.height, spec.factor or number.dimenfactors.bp
+ local display, controls, label, foundname = spec.display, spec.controls, spec.label, spec.foundname
+
+ local param = (display and parametersets[display]) or { }
+ local streamparam = (controls and parametersets[controls]) or { }
+ local name = "3D Artwork " .. (param.name or label or "Unknown")
+
+ local activationdict = pdfdictionary {
+ TB = pdfboolean(param.toolbar,true),
+ NP = pdfboolean(param.tree,true),
+ }
+
+ local stream = streams[label]
+ if not stream then
+ local attr = pdfdictionary {
+ Type = pdfconstant("3D"),
+ Subtype = pdfconstant("U3D"),
+ }
+ local streamviews = checkedkey(streamparam, "views", "table")
+ if streamviews then
+ local list = pdfarray()
+ for i=1,#streamviews do
+ local v = checkedkey(streamviews, i, "table")
+ if v then
+ list[#list+1] = make3dview(v)
+ end
+ end
+ attr.VA = list
+ end
+ if checkedkey(streamparam, "view", "table") then
+ attr.DV = make3dview(streamparam.view)
+ elseif checkedkey(streamparam, "view", "string") then
+ attr.DV = streamparam.view
+ end
+ local js = checkedkey(streamparam, "js", "string")
+ if js then
+ local jsref = stored_js[js]
+ if not jsref then
+ jsref = pdf.immediateobj("streamfile",js)
+ stored_js[js] = jsref
+ end
+ attr.OnInstantiate = pdfreference(jsref)
+ end
+ stored_3d[label] = pdf.immediateobj("streamfile",foundname,attr())
+ stream = 1
+ else
+ stream = stream + 1
+ end
+ streams[label] = stream
+
+ local name = pdfunicode(name)
+
+ local annot = pdfdictionary {
+ Subtype = pdfconstant("3D"),
+ T = name,
+ Contents = name,
+ NM = name,
+ ["3DD"] = pdfreference(stored_3d[label]),
+ ["3DA"] = activationdict,
+ }
+ if checkedkey(param,"view","table") then
+ annot["3DV"] = make3dview(param.view)
+ elseif checkedkey(param,"view","string") then
+ annot["3DV"] = param.view
+ end
+
+ local preview = checkedkey(param,"preview","string")
+ if preview then
+ activationdict.A = pdfconstant("XA")
+ local tag = format("%s:%s:%s",label,stream,preview)
+ local ref = stored_pr[tag]
+ if not ref then
+ -- weird, has to be a /Form and not an /Image so we need a wrap = true key
+ -- local figure = img.immediatewrite { filename = preview, width = width, height = height }
+ local figure = img.immediatewrite { stream = ".5 .75 .75 rg 0 0 20 10 re f", bbox = {0,0,20,10 } }
+ ref = figure.objnum
+ stored_pr[tag] = ref
+ end
+ annot.AP = ref and pdfdictionary { N = pdfreference(ref) }
+ return annot, figure, ref
+ else
+ activationdict.A = pdfconstant("PV")
+ return annot, nil, nil
+ end
+end
diff --git a/tex/context/base/lpdf-wid.lua b/tex/context/base/lpdf-wid.lua
new file mode 100644
index 000000000..cc61a4f96
--- /dev/null
+++ b/tex/context/base/lpdf-wid.lua
@@ -0,0 +1,328 @@
+if not modules then modules = { } end modules ['lpdf-wid'] = {
+ version = 1.001,
+ comment = "companion to lpdf-ini.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local format, gmatch, gsub, find = string.format, string.gmatch, string.gsub, string.find
+local texsprint, ctxcatcodes, texbox, texcount = tex.sprint, tex.ctxcatcodes, tex.box, tex.count
+
+local nodeinjections = backends.pdf.nodeinjections
+local codeinjections = backends.pdf.codeinjections
+local registrations = backends.pdf.registrations
+
+local executers = jobreferences.executers
+local variables = interfaces.variables
+
+local pdfconstant = lpdf.constant
+local pdfdictionary = lpdf.dictionary
+local pdfarray = lpdf.array
+local pdfreference = lpdf.reference
+local pdfunicode = lpdf.unicode
+local pdfcolorspec = lpdf.colorspec
+
+local pdfreserveobj = pdf.reserveobj
+local pdfimmediateobj = pdf.immediateobj
+
+-- symbols
+
+local presets = { } -- xforms
+
+function codeinjections.registersymbol(name,n)
+ presets[name] = pdfreference(n)
+end
+
+function codeinjections.registeredsymbol(name)
+ return presets[name]
+end
+
+function codeinjections.presetsymbollist(list)
+ if list then
+ for s in gmatch(list,"[^, ]+") do
+ if not presets[s] then
+ texsprint(ctxcatcodes,format("\\predefinesymbol[%s]",s))
+ end
+ end
+ end
+end
+
+-- comments
+
+local symbols = {
+ New = pdfconstant("Insert"),
+ Insert = pdfconstant("Insert"),
+ Balloon = pdfconstant("Comment"),
+ Comment = pdfconstant("Comment"),
+ Text = pdfconstant("Note"),
+ Addition = pdfconstant("NewParagraph"),
+ NewParagraph = pdfconstant("NewParagraph"),
+ Help = pdfconstant("Help"),
+ Paragraph = pdfconstant("Paragraph"),
+ Key = pdfconstant("Key"),
+ Graph = pdfconstant("Graph"),
+ Paperclip = pdfconstant("Paperclip"),
+ Attachment = pdfconstant("Attachment"),
+ Tag = pdfconstant("Tag"),
+}
+
+symbols[variables.normal] = pdfconstant("Note")
+
+local nofcomments, usepopupcomments, stripleading = 0, true, true
+
+local function analyzesymbol(symbol)
+ if not symbol or symbol == "" then
+ return symbols.normal, nil
+ elseif symbols[symbol] then
+ return symbols[symbol], nil
+ else
+ local set = aux.settings_to_array(symbol)
+ local normal, down = set[1], set[2]
+ if normal then
+ normal = codeinjections.registeredsymbol(down or normal)
+ end
+ if down then
+ down = codeinjections.registeredsymbol(normal)
+ end
+ if down or normal then
+ return nil, pdfdictionary {
+ N = normal,
+ D = down,
+ }
+ end
+ end
+end
+
+local function analyzelayer(layer)
+ -- todo: (specification.layer ~= "" and pdfreference(specification.layer)) or nil, -- todo: ref to layer
+end
+
+function codeinjections.registercomment(specification)
+ nofcomments = nofcomments + 1
+ local text = buffers.collect(specification.buffer)
+ if stripleading then
+ text = gsub(text,"[\n\r] *","\n")
+ end
+ local name, appearance = analyzesymbol(specification.symbol)
+ local d = pdfdictionary {
+ Subtype = pdfconstant("Text"),
+ Open = specification.open,
+ Contents = pdfunicode(text),
+ T = (specification.title ~= "" and pdfunicode(specification.title)) or nil,
+ C = pdfcolorspec(specification.colormodel,specification.colorvalue),
+ OC = analyzelayer(specification.layer),
+ Name = name,
+ AP = appearance,
+ }
+ -- watch the nice feed back to tex hack
+ if usepopupcomments then
+ local nd = pdfreserveobj()
+ local nc = pdfreserveobj()
+ local c = pdfdictionary {
+ Subtype = pdfconstant("Popup"),
+ Parent = pdfreference(nd),
+ }
+ d.Popup = pdfreference(nc)
+ texbox["commentboxone"] = node.hpack(nodes.pdfannot(0,0,0,d(),nd))
+ texbox["commentboxtwo"] = node.hpack(nodes.pdfannot(specification.width,specification.height,0,c(),nc))
+ else
+ texbox["commentboxone"] = node.hpack(nodes.pdfannot(0,0,0,d()))
+ texbox["commentboxtwo"] = nil
+ end
+end
+
+--
+
+local nofattachments, attachments, filestreams = 0, { }, { }
+
+function codeinjections.attachfile(specification)
+ local attachment = interactions.attachment(specification.label)
+ if not attachment then
+ -- todo: message
+ return
+ end
+ local filename = attachment.filename
+ if not filename or filename == "" then
+ -- todo: message
+ return
+ end
+ nofattachments = nofattachments + 1
+ local label = attachment.label or ""
+ local title = attachment.title or ""
+ local newname = attachment.newname or ""
+ if label == "" then label = filename end
+ if title == "" then title = label end
+ if newname == "" then newname = filename end
+ local aref = attachments[label]
+ if not aref then
+ if not lfs.isfile(filename) then
+ interfaces.showmessage("interactions",5,filename)
+ return -- todo: message
+ else
+ local f = pdf.immediateobj("streamfile",filename)
+ filestreams[filename] = f
+ local d = pdfdictionary {
+ Type = pdfconstant("Filespec"),
+ F = newname,
+ EF = pdfdictionary { F = pdfreference(d) },
+ }
+ aref = pdfreference(pdfimmediateobj(tostring(d)))
+ attachments[label] = aref
+ end
+ end
+ local name, appearance = analyzesymbol(specification.symbol)
+ local d = pdfdictionary {
+ Subtype = pdfconstant("FileAttachment"),
+ FS = aref,
+ Contents = pdfunicode(title),
+ Name = name,
+ AP = appearance,
+ OC = analyzelayer(specification.layer),
+ C = pdfcolorspec(specification.colormodel,specification.colorvalue),
+ }
+ local width = specification.width or 0
+ local height = specification.height or 0
+ local depth = specification.depth or 0
+ node.write(nodes.pdfannot(width,height,depth,d()))
+end
+
+function codeinjections.attachmentid(filename)
+ return filestreams[filename]
+end
+
+-- rendering stuff
+--
+-- object_1 -> <> >>
+-- object_2 -> <> >>
+-- rendering -> <>
+--
+-- we only work foreward here
+-- annotation is to be packed at the tex end
+
+-- aiff audio/aiff
+-- au audio/basic
+-- avi video/avi
+-- mid audio/midi
+-- mov video/quicktime
+-- mp3 audio/x-mp3 (mpeg)
+-- mp4 audio/mp4
+-- mp4 video/mp4
+-- mpeg video/mpeg
+-- smil application/smil
+-- swf application/x-shockwave-flash
+
+local ms, mu, mf = { }, { }, { }
+
+local delayed = { }
+
+local function insertrenderingwindow(label,width,height,specification)
+ if options == variables.auto then
+ if openpageaction then
+ -- \handlereferenceactions{\v!StartRendering{#2}}
+ end
+ if closepageaction then
+ -- \handlereferenceactions{\v!StopRendering {#2}}
+ end
+ end
+ local actions = nil
+ if openpage or closepage then
+ actions = pdfdictionary {
+ PO = (openpage and lpdf.pdfaction(openpage )) or nil,
+ PC = (closepage and lpdf.pdfaction(closepage)) or nil,
+ }
+ end
+ local page = tonumber(specification.page) or texcount.realpageno
+ local d = pdfdictionary {
+ Subtype = pdfconstant("Screen"),
+ P = pdfreference(tex.pdfpageref(page)),
+ A = mf[label],
+ Border = pdfarray { 0, 0, 0 } ,
+ AA = actions,
+ }
+ local r = pdfreserveobj("annot")
+ node.write(nodes.pdfannot(label,width,height,d(),r)) -- save ref
+ return pdfreference(r)
+end
+
+local function insertrendering(specification)
+ local label = specification.label
+ if not mf[label] then
+ local filename = specification.filename
+ local isurl = find(filename,"://")
+ local d = pdfdictionary {
+ Type = pdfconstant("Rendition"),
+ S = pdfconstant("MR"),
+ C = pdfdictionary {
+ Type = pdfconstant("MediaClip"),
+ S = pdfconstant("MCD"),
+ N = label,
+ CT = specification.mime,
+ Alt = pdfarray {
+ "", "file not found", -- language id + message
+ },
+ D = pdfdictionary {
+ Type = pdfconstant("Filespec"),
+ F = filename,
+ FS = (isurl and pdfconstant("URL")) or nil,
+ }
+ }
+ }
+ mf[label] = pdfreference(pdfimmediateobj(tostring(d)))
+ if not ms[label] then
+ mu[label] = insertrenderingwindow(label,0,0,specification.options)
+ end
+ end
+end
+
+local function insertrenderingobject(specification)
+ local label = specification.label
+ if not mf[label] then
+ local d = pdfdictionary {
+ Type = pdfconstant("Rendition"),
+ S = pdfconstant("MR"),
+ C = pdfdictionary {
+ Type = pdfconstant("MediaClip"),
+ S = pdfconstant("MCD"),
+ N = label,
+ D = pdfreference(unknown), -- not label but objectname, hm
+ }
+ }
+ mf[label] = pdfreference(pdfimmediateobj(tostring(d)))
+ if ms[label] then
+ insertrenderingwindow(label,0,0,specification)
+ end
+ end
+end
+
+function codeinjections.insertrenderingwindow(specification)
+ local label = specification.label
+ codeinjections.processrendering(label) -- was check at tex end
+ ms[label] = insertrenderingwindow(label,specification.width,specification.height,specification)
+end
+
+function codeinjections.processrendering(label)
+ local specification = interactions.rendering(label)
+ if specification then
+ if specification.kind == "external" then
+ insertrendering(specification)
+ else
+ insertrenderingobject(specification)
+ end
+ end
+end
+
+local function set(operation,arguments)
+ codeinjections.processrendering(arguments) -- was check at the tex end
+ return pdfdictionary {
+ S = pdfconstant("Rendition"),
+ OP = operation,
+ R = mf[arguments],
+ AN = ms[arguments] or mu[arguments],
+ }
+end
+
+function executers.startrendering (arguments) return set(0,arguments) end
+function executers.stoprendering (arguments) return set(1,arguments) end
+function executers.pauserendering (arguments) return set(2,arguments) end
+function executers.resumerendering(arguments) return set(3,arguments) end
diff --git a/tex/context/base/luat-bas.mkiv b/tex/context/base/luat-bas.mkiv
index a78455173..581a5d95a 100644
--- a/tex/context/base/luat-bas.mkiv
+++ b/tex/context/base/luat-bas.mkiv
@@ -51,6 +51,7 @@
\registerctxluafile{l-dimen} {1.001}
\registerctxluafile{l-url} {1.001}
\registerctxluafile{l-set} {1.001}
+\registerctxluafile{l-dimen} {1.001}
% \registerctxluafile{socket.lua}{}
% \registerctxluafile{ltn12.lua} {}
diff --git a/tex/context/base/luat-cod.mkiv b/tex/context/base/luat-cod.mkiv
index 07db36483..001cc2aa9 100644
--- a/tex/context/base/luat-cod.mkiv
+++ b/tex/context/base/luat-cod.mkiv
@@ -60,7 +60,7 @@
%D Here we operate in the \TEX\ catcode regime as we haven't yet defined
%D catcode regimes. A chicken or egg problem.
-\long\def\startruntimeluacode#1\stopruntimeluacode % only simple code (load +init)
+\normalprotected\long\def\startruntimeluacode#1\stopruntimeluacode % only simple code (load +init)
{\ifproductionrun
\global\let\startruntimeluacode\relax
\global\let\stopruntimeluacode \relax
@@ -69,7 +69,7 @@
\fi
#1} % maybe no interference
-\long\def\startruntimectxluacode#1\stopruntimectxluacode
+\normalprotected\long\def\startruntimectxluacode#1\stopruntimectxluacode
{\startruntimeluacode\ctxlua{#1}\stopruntimeluacode}
%D Next we load the initialization code.
@@ -133,7 +133,7 @@
\def\ctxluabyteload#1#2% registers and compiles chunk
{\global\advance\luabytecodecounter \plusone
- \expanded{\startruntimectxluacode
+ \normalexpanded{\startruntimectxluacode
lua.bytedata[\the\luabytecodecounter] = { "#1", "#2" }
\stopruntimectxluacode}%
\ctxlua {
diff --git a/tex/context/base/luat-ini.mkiv b/tex/context/base/luat-ini.mkiv
index 2a132c38e..84214ea73 100644
--- a/tex/context/base/luat-ini.mkiv
+++ b/tex/context/base/luat-ini.mkiv
@@ -134,24 +134,12 @@
\obeyluatokens
\csname dodostartnamed#1\v!code\endcsname}
-\ifdefined\closelua
-
- \def\definenamedlua[#1]#2[#3]% no optional arg handling here yet
- {\expanded{\long\def\csname dodostartnamed#1\v!code\endcsname####1\csname\e!stop#1\v!code\endcsname}%
- {\normalexpanded{\endgroup\noexpand\directlua\!!name{#3}\zerocount{protect("#1\s!data")##1}}}%
- \long\expandafter\def\csname\e!start#1\v!code\endcsname {\dostartnamedluacode{#1}}%
- \long\expandafter\def\csname #1\v!code\endcsname##1{\directlua\!!name{#3}\zerocount{protect("#1\s!data")##1}}}
-
-\else
-
- \def\definenamedlua[#1]#2[#3]% no optional arg handling here yet
- {\scratchcounter\ctxlua{lua.registername("#1","#3")}%
- \expanded{\long\edef\csname dodostartnamed#1\v!code\endcsname####1\csname\e!stop#1\v!code\endcsname}%
- {\endgroup\noexpand\directlua\the\scratchcounter{protect("#1\s!data")##1}}%
- \long\expandafter\def \csname\e!start#1\v!code\endcsname {\dostartnamedluacode{#1}}%
- \long\expandafter\edef\csname #1\v!code\endcsname##1{\noexpand\directlua\the\scratchcounter{protect("#1\s!data")##1}}}
-
-\fi
+\def\definenamedlua[#1]#2[#3]% no optional arg handling here yet
+ {\scratchcounter\ctxlua{lua.registername("#1","#3")}%
+ \normalexpanded{\long\edef\csname dodostartnamed#1\v!code\endcsname##1\csname\e!stop#1\v!code\endcsname}%
+ {\endgroup\noexpand\directlua\the\scratchcounter{protect("#1\s!data")##1}}%
+ \long\expandafter\def \csname\e!start#1\v!code\endcsname {\dostartnamedluacode{#1}}%
+ \long\expandafter\edef\csname #1\v!code\endcsname##1{\noexpand\directlua\the\scratchcounter{protect("#1\s!data")##1}}}
%D We predefine a few.
@@ -244,4 +232,8 @@
%
% options=\luaparameterset{u3d:myset:display:1}{toolbar=false,tree=true}
+%D A Handy helper:
+
+\def\luaconditional#1{\ifcase#1tru\else fals\fi e}
+
\protect \endinput
diff --git a/tex/context/base/luat-lib.mkiv b/tex/context/base/luat-lib.mkiv
index 1905ee67d..f8f71dd0a 100644
--- a/tex/context/base/luat-lib.mkiv
+++ b/tex/context/base/luat-lib.mkiv
@@ -42,7 +42,7 @@
\registerctxluafile{luat-ini} {1.001}
\registerctxluafile{luat-env} {1.001}
-\registerctxluafile{l-xml} {1.001} % we want tracking
+\registerctxluafile{l-xml} {1.001} % we need to load lxml-tab earlier so this will change !
\startruntimeluacode
\edef\asciia{\ctxlua{tex.sprint(logs.mode)}}
diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv
new file mode 100644
index 000000000..494e4f0b7
--- /dev/null
+++ b/tex/context/base/lxml-ini.mkiv
@@ -0,0 +1,408 @@
+%D \module
+%D [ file=lxml-ini,
+%D version=2007.08.17,
+%D title=\CONTEXT\ \XML\ Support,
+%D subtitle=Initialization,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt XML Support / Initialization}
+
+\registerctxluafile{lxml-tab}{1.001}
+\registerctxluafile{lxml-pth}{1.001}
+\registerctxluafile{lxml-ent}{1.001}
+\registerctxluafile{lxml-mis}{1.001}
+\registerctxluafile{lxml-ini}{1.001}
+
+\unprotect
+
+\def\xmlmain #1{\ctxlua{lxml.main("#1")}}
+\def\xmlall #1#2{\ctxlua{lxml.all("#1","#2")}}
+\def\xmlatt #1#2{\ctxlua{lxml.attribute("#1","/","#2")}}
+\def\xmlattdef #1#2#3{\ctxlua{lxml.attribute("#1","/","#2","#3")}}
+\def\xmlattribute #1#2#3{\ctxlua{lxml.attribute("#1","#2","#3")}}
+\def\xmlattributedef #1#2#3#4{\ctxlua{lxml.attribute("#1","#2","#3","#4")}}
+\def\xmlcommand #1#2#3{\ctxlua{lxml.command("#1","#2","#3")}}
+\def\xmlconcat #1#2#3{\ctxlua{lxml.concat("#1","#2",[[\detokenize{#3}]])}}
+\def\xmlconcatrange#1#2#3#4#5{\ctxlua{lxml.concatrange("#1","#2","#3","#4",[[\detokenize{#5}]])}}
+\def\xmlcount #1#2{\ctxlua{lxml.count("#1","#2")}}
+\def\xmldelete #1#2{\ctxlua{xml.delete(lxml.id("#1"),"#2")}}
+\def\xmldirectives #1{\ctxlua{lxml.directives.setup("#1")}}
+\def\xmldirectivesbefore #1{\ctxlua{lxml.directives.before("#1")}}
+\def\xmldirectivesafter #1{\ctxlua{lxml.directives.after("#1")}}
+\def\xmlfilter #1#2{\ctxlua{lxml.filter("#1",\!!bs#2\!!es)}}
+\def\xmlfirst #1#2{\ctxlua{lxml.first("#1","#2")}}
+\def\xmlflush #1{\ctxlua{lxml.flush("#1")}}
+% \def\xmlcontent #1{\ctxlua{lxml.content("#1")}}
+% \def\xmlstrip #1{\ctxlua{lxml.strip("#1")}}
+% \def\xmlflushstripped #1{\ctxlua{lxml.strip("#1",true)}}
+\def\xmldirect #1{\ctxlua{lxml.direct("#1")}} % in loops, not dt but root
+\def\xmlidx #1#2#3{\ctxlua{lxml.idx("#1","#2",\number#3)}}
+\def\xmlinclude #1#2#3{\ctxlua{lxml.include("#1","#2","#3",true)}}
+\def\xmlindex #1#2#3{\ctxlua{lxml.index("#1","#2",\number#3)}}
+\def\xmlinfo #1{\hbox{\ttxx[\ctxlua{lxml.info("#1")}]}}
+\def\xmlshow #1{\startpacked\ttx\xmlverbatim{#1}\stoppacked}
+\def\xmllast #1#2{\ctxlua{lxml.last("#1","#2")}}
+\def\xmlload #1#2{\ctxlua{lxml.load("#1","#2")}}
+\def\xmlloadbuffer #1#2{\ctxlua{lxml.loadbuffer("#1","#2")}}
+\def\xmlloaddata #1#2{\ctxlua{lxml.loaddata("#1",\!!bs#2\!!es)}}
+\def\xmlloadregistered #1#2{\ctxlua{lxml.loadregistered("#1")}}
+\def\xmlloaddirectives #1{\ctxlua{lxml.directives.load("#1")}}
+\def\xmlname #1{\ctxlua{lxml.name("#1")}}
+\def\xmlnamespace #1{\ctxlua{lxml.namespace("#1")}}
+\def\xmlnonspace #1#2{\ctxlua{lxml.nonspace("#1","#2")}}
+\def\xmlraw #1#2{\ctxlua{lxml.raw("#1","#2")}}
+\def\xmlsnippet #1#2{\ctxlua{lxml.snippet("#1",#2)}}
+\def\xmlelement #1#2{\ctxlua{lxml.element("#1",#2)}}
+\def\xmlnofelements #1{\ctxlua{lxml.nofelements("#1")}}
+\def\xmlregisterns #1#2{\ctxlua{xml.registerns("#1","#2")}} % document
+\def\xmlremapname #1#2#3#4{\ctxlua{xml.remapname(lxml.id("#1"),"#2","#3","#4")}} % element
+\def\xmlremapnamespace #1#2#3{\ctxlua{xml.rename_space(lxml.id("#1"),"#2","#3")}} % document
+\def\xmlchecknamespace #1#2#3{\ctxlua{xml.check_namespace(lxml.id("#1"),"#2","#3")}} % element
+\def\xmlsetfunction #1#2#3{\ctxlua{lxml.setaction("#1","#2",#3)}}
+\def\xmlsetsetup #1#2#3{\ctxlua{lxml.setsetup("#1","#2","#3")}}
+\def\xmlstrip #1#2{\ctxlua{lxml.strip("#1","#2")}}
+\def\xmlstripped #1#2{\ctxlua{lxml.stripped("#1","#2")}}
+\def\xmlstripnolines #1#2{\ctxlua{lxml.strip("#1","#2",true)}}
+\def\xmlstrippednolines #1#2{\ctxlua{lxml.stripped("#1","#2",true)}}
+\def\xmltag #1{\ctxlua{lxml.tag("#1")}}
+\def\xmltext #1#2{\ctxlua{lxml.text("#1","#2")}}
+\def\xmltags #1#2{\ctxlua{lxml.tags("#1","#2")}}
+\def\xmlutfize #1{\ctxlua{lxml.utfize("#1")}}
+\def\xmlverbatim #1{\ctxlua{lxml.verbatim("#1")}}
+\def\xmldisplayverbatim #1{\ctxlua{lxml.displayverbatim("#1")}}
+\def\xmlinlineverbatim #1{\ctxlua{lxml.inlineverbatim("#1")}}
+
+%def\xmldoifelse #1#2{\ctxlua{cs.testcase(xml.found(lxml.id("#1"),"#2",false))}}
+%def\xmldoifelsetext #1#2{\ctxlua{cs.testcase(xml.found(lxml.id("#1"),"#2",true ))}}
+
+% kind of special:
+
+\def\xmlstartraw{\ctxlua{lxml.startraw()}}
+\def\xmlstopraw {\ctxlua{lxml.stopraw()}}
+
+% todo: \xmldoifelseattribute
+
+\def\xmldoif #1#2{\ctxlua{lxml.doif("#1","#2")}}
+\def\xmldoifnot #1#2{\ctxlua{lxml.doifnot("#1","#2")}}
+\def\xmldoifelse #1#2{\ctxlua{lxml.doifelse("#1","#2")}}
+\def\xmldoiftext #1#2{\ctxlua{lxml.doiftext("#1","#2")}}
+\def\xmldoifnottext #1#2{\ctxlua{lxml.doifnottext("#1","#2")}}
+\def\xmldoifelsetext #1#2{\ctxlua{lxml.doifelsetext("#1","#2")}}
+\def\xmldoifelseempty #1#2{\ctxlua{lxml.doifelseempty("#1","#2")}} % #2, "*" or "" == self not yet implemented
+\def\xmldoifelseselfempty #1{\ctxlua{lxml.doifelseempty("#1")}}
+
+\def\xmldefaulttotext #1{\ifcase\xmlprocessingmode\or\or \ctxlua{lxml.set_command_to_text("#1")}\fi}
+\def\xmldefaulttonone #1{\ifcase\xmlprocessingmode\or\or\or\ctxlua{lxml.set_command_to_none("#1")}\fi}
+
+% \startxmlsetups xml:include
+% \xmlinclude{main}{include}{filename|href}
+% \stopxmlsetups
+%
+% \xmlprependsetup{xml:include}
+
+\let\xmlgrab\xmlsetsetup
+
+\def\xmlsetup#1#2% % we pass the reference so that we have access to the frozen number
+ {\def\xmlself{#1}% % by using #1 inside a setup
+ \setupwithargument{#2}{#1}}
+
+\newtoks \registeredxmlsetups
+
+% todo: 1:xml:whatever alwas before 3:xml:something
+
+\def\xmlprependsetup #1{\ctxlua{lxml.installsetup(1,"*","#1")}}
+\def\xmlappendsetup #1{\ctxlua{lxml.installsetup(2,"*","#1")}}
+\def\xmlbeforesetup #1#2{\ctxlua{lxml.installsetup(3,"*","#1","#2"))}}
+\def\xmlaftersetup #1#2{\ctxlua{lxml.installsetup(4,"*","#1","#2"))}}
+
+\def\xmlprependdocumentsetup #1#2{\ctxlua{lxml.installsetup(1,"#1","#2")}}
+\def\xmlappenddocumentsetup #1#2{\ctxlua{lxml.installsetup(2,"#1","#2")}}
+\def\xmlbeforedocumentsetup#1#2#3{\ctxlua{lxml.installsetup(3,"#1","#2","#3"))}}
+\def\xmlafterdocumentsetup #1#2#3{\ctxlua{lxml.installsetup(4,"#1","#2","#3"))}}
+
+\def\xmlremovesetup #1{\ctxlua{lxml.removesetup("*","#1")}}
+\def\xmlremovedocumentsetup #1#2{\ctxlua{lxml.removesetup("#1","#2")}}
+
+\def\xmlflushdocumentsetups #1{\ctxlua{lxml.flushsetups("*","#1")}}
+\def\xmlresetdocumentsetups #1{\ctxlua{lxml.resetsetups("#1")}}
+
+\let\xmlregistersetup \xmlappendsetup
+\let\xmlregisterdocumentsetup\xmlappenddocumentsetup
+
+\def\xmldocument{main}
+
+\def\xmlregisteredsetups
+ {\xmlstarttiming
+ \xmlflushsetups
+ \xmldefaulttotext\xmldocument % after include
+ \xmlstoptiming}
+
+\def\xmlregistereddocumentsetups#1%
+ {\xmlstarttiming
+ % todo: test for duplicates !
+ \xmlflushdocumentsetups{#1}%
+ \xmldefaulttotext{#1}% after include
+ \xmlstoptiming}
+
+\def\xmlstarttiming{\ctxlua{statistics.starttiming(lxml)}}
+\def\xmlstoptiming {\ctxlua{statistics.stoptiming (lxml)}}
+
+\def\doxmlprocess#1#2#3#4%
+ {\begingroup
+ \edef\xmldocument{#2}% #2 can be \xmldocument and set as such
+ #1{#2}{#3}%
+ \ifcase\xmlprocessingmode
+ \enableXML
+ \else
+ \setcatcodetable\notcatcodes
+ \fi
+ \doifelsenothing{#4}
+ {\directsetup{xml:process}}
+ {\directsetup{#4}}%
+ \endgroup}
+
+\def\xmlprocessfile {\doxmlprocess\xmlload}
+\def\xmlprocessdata {\doxmlprocess\xmlloaddata}
+\def\xmlprocessbuffer {\doxmlprocess\xmlloadbuffer}
+\def\xmlprocessregistered{\doxmlprocess\xmlloadregistered}
+\let\xmlprocess \xmlprocessfile
+
+% beware: \xmlmain takes the real root, so also processing
+% instructions preceding the root element; well, in some
+% sense that is the root
+
+\startsetups xml:process
+ \xmlregistereddocumentsetups\xmldocument
+ \xmlmain\xmldocument
+\stopsetups
+
+\long\def\xmlloop#1#2#3%
+ {\def\xmli##1##2{\xmlidx{#1}{#2/##1}{##2}}%
+ \dorecurse{\xmlcount{#1}{#2}}{#3}}
+
+\long\def\xmlconnect#1#2#3% inefficient
+ {\scratchcounter\xmlcount{#1}{#2}\relax
+ \ifcase\scratchcounter \or
+ \xmlall{#1}{#2}%
+ \else
+ \dorecurse \scratchcounter {
+ \ifnum\recurselevel>\plusone#3\fi
+ \xmlidx{#1}{#2}{\recurselevel}
+ }
+ \fi}
+
+\def\xmlcdataobeyedline {\obeyedline}
+\def\xmlcdataobeyedspace{\strut\obeyedspace}
+\def\xmlcdatabefore {\bgroup\tt}
+\def\xmlcdataafter {\egroup}
+
+% verbatim (dodo:pre/post whitespace, maybe splot verbatim and
+% cdata commands), experimental:
+%
+% \xmlsetfunction{main}{verbatim}{lxml.displayverbatim}
+% \xmlsetfunction{main}{verb} {lxml.inlineverbatim}
+
+% \def\startxmldisplayverbatim[#1]{}
+% \def\stopxmldisplayverbatim {}
+% \def\startxmlinlineverbatim [#1]{}
+% \def\stopxmlinlineverbatim {}
+
+% we use an xml: namespace so one has to define a suitable verbatim, say
+%
+% \definetyping[xml:verbatim][typing]
+%
+% this is experimental!
+
+\def\startxmldisplayverbatim[#1]%
+ {\startpacked % \begingroup
+ \let\currenttypingclass\??tp
+ \edef\currenttyping{xml:#1}%
+ \def\stopxmldisplayverbatim
+ {\endofverbatimlines
+ \stoppacked} % \endgroup
+ \mkinitializeverbatim
+ \beginofverbatimlines}
+
+\def\startxmlinlineverbatim[#1]%
+ {\begingroup
+ \let\currenttypingclass\??ty
+ \edef\currenttyping{xml:#1}%
+ \let\stopxmldisplayverbatim\endgroup
+ \mkinitializeverbatim}
+
+% will move but is developed for xml
+
+\newtoks \collectingtoks
+
+\def\startcollect#1\stopcollect
+ {\collectingtoks\@EA{\the\collectingtoks#1}}
+
+\def\startexpandedcollect#1\stopexpandedcollect
+ {\expanded{\collectingtoks{\the\collectingtoks#1}}}
+
+\def\startcollecting{\collectingtoks\emptytoks}
+\def\stopcollecting {\the\collectingtoks}
+
+\def\inlinemessage #1{\dontleavehmode{\tttf#1}}
+\def\displaymessage#1{\blank\inlinemessage{#1}\blank}
+
+\def\xmltraceentities
+ {\ctxlua{xml.set_text_cleanup(lxml.trace_text_entities)}%
+ \appendtoks\ctxlua{lxml.show_text_entities()}\to\everygoodbye}
+
+% processing instructions
+
+\def\xmlcontextdirective#1% kind class key value
+ {\executeifdefined{xml#1directive}\gobblethreearguments}
+
+% setting up xml:
+%
+% \setupxml[\c!method=mkii] % mixed mkiv and mkii
+% \setupxml[\c!method=mkiv,\c!default=] % mkiv only
+% \setupxml[\c!method=mkiv,\c!default=\v!none] % mkiv only, undefined -> hidden
+% \setupxml[\c!method=mkiv,\c!default=\v!text] % mkiv only, undefined -> text
+
+% \def\xmlctxdirective#1#2#3{\doif{#1}{clue}{\doif{#2}{page}}{\page[#3]}}
+
+\chardef\xmlprocessingmode=0 % 0=mixed, 1=mkivonly, 2=mkivonly-default-text, 3=mkivonly-default-none
+
+% \setupxml[method=mkiv,strip=yes,entities=yes,default=text]
+
+\newtoks\everysetupxml
+
+\def\setupxml[#1]{\getparameters[\??xm][#1]\the\everysetupxml}
+
+\def\c!entities{entities} % to be internationalized
+\def\s!mkiv {mkiv}
+\def\s!mkii {mkii}
+
+% entities
+
+\newif\ifautoXMLentities
+
+\def\xmlkeepentities{\ctxlua{lxml.reset_entityhandler()}}
+\def\xmlmkiientities{\ctxlua{lxml.set_mkii_entityhandler()}\autoXMLentitiestrue}
+\def\xmlmkiventities{\ctxlua{lxml.set_mkiv_entityhandler()}}
+
+\let\xmlresolveentities\xmlmkiventities % will become \xmlmkiventities
+
+\letvalue{\??xm:1:\s!mkii }\zerocount
+\letvalue{\??xm:1:\s!mkiv }\plusone
+
+\letvalue{\??xm:2:\v!none }\plusone
+\letvalue{\??xm:2:\v!text }\plustwo
+\letvalue{\??xm:2:\v!hidden}\plusthree
+
+\letvalue{\??xm:ii:\v!yes }\xmlresolveentities
+\letvalue{\??xm:ii:\v!no }\xmlkeepentities
+\letvalue{\??xm:ii:\s!mkii}\xmlmkiientities
+\letvalue{\??xm:ii:\s!mkiv}\xmlmkiventities
+
+\letvalue{\??xm:iv:\v!yes }\xmlresolveentities
+\letvalue{\??xm:iv:\v!no }\xmlkeepentities
+\letvalue{\??xm:iv:\s!mkii}\xmlmkiventities
+\letvalue{\??xm:iv:\s!mkiv}\xmlmkiventities
+
+\appendtoks
+ \chardef\xmlprocessingmode\executeifdefined{\??xm:1:\@@xmmethod}\zerocount
+ \ifcase\xmlprocessingmode
+ % mkii, permits both methods
+ \executeifdefined{\??xm:ii:\@@xmentities}\xmlkeepentities
+ \or
+ % mkiv, mkiv exclusively
+ \chardef\xmlprocessingmode\executeifdefined{\??xm:2:\@@xmdefault}\plusone
+ \executeifdefined{\??xm:iv:\@@xmentities}\xmlresolveentities
+ \else
+ % unset
+ \fi
+ \ifcase\xmlprocessingmode
+ \ctxlua{characters.setmkiientities()}%
+ \else
+ \ctxlua{characters.setmkiventities()}%
+ \fi
+ \doifelse\@@xmcompress\v!yes % this key may change, maybe compress=yes|no
+ {\ctxlua{xml.strip_cm_and_dt=true}}
+ {\ctxlua{xml.strip_cm_and_dt=false}}%
+\to \everysetupxml
+
+\def\xmlinitialize{\the\everysetupxml}
+
+\newcount\charactersactiveoffset \charactersactiveoffset="10000
+
+\startextendcatcodetable\ctxcatcodes
+ \catcode\numexpr\charactersactiveoffset+`<\relax=13
+ \catcode\numexpr\charactersactiveoffset+`&\relax=13
+ \catcode\numexpr\charactersactiveoffset+`>\relax=13
+\stopextendcatcodetable
+\startextendcatcodetable\xmlcatcodes
+ \catcode\numexpr\charactersactiveoffset+`<\relax=13
+ \catcode\numexpr\charactersactiveoffset+`&\relax=13
+ \catcode\numexpr\charactersactiveoffset+`>\relax=13
+\stopextendcatcodetable
+
+\ctxlua { % entities are remembered in the format
+ characters.remapentity("<",characters.active_offset + utf.byte("<"))
+ characters.remapentity("&",characters.active_offset + utf.byte("&"))
+ characters.remapentity(">",characters.active_offset + utf.byte(">"))
+}
+
+\setupxml
+ [\c!method=mkii, % mixed mode
+ \c!default=\v!hidden, % ignore elements that are not defined
+ \c!compress=\v!no, % strip comment
+ \c!entities=\v!yes] % replace entities
+
+% \defineXMLenvironment[y]{(}{)}
+%
+% \startxmlsetups x
+% /\xmlflush{#1}/
+% \stopxmlsetups
+%
+% \startxmlsetups xx
+% \xmlsetsetup{main}{x}{*}
+% \stopxmlsetups
+%
+% \xmlregistersetup{xx}
+%
+% \startbuffer
+% a <&>{b} c
+% \stopbuffer
+%
+% mkii: [\processXMLbuffer]\quad mkiv: [\xmlprocessbuffer{main}{}{}]
+
+% some mkii commands, but mkiv-ified
+
+\def\xmlmapvalue#1#2#3{\setvalue{\??xm:v:#1:#2}{#3}} % keep #3 to grab spaces
+\def\xmlvalue #1#2#3{\executeifdefined{\??xm:v:#1:#2}{#3}}
+
+\let\xmlmapval\xmlmapvalue
+\let\xmlval \xmlvalue
+
+% brrrr, give this at the top of a style that needs to stub mkiv loading
+
+\def\remapXMLtoMKIV
+ {\ifx\xmldocument\undefined\def\xmldocument{main}\fi
+ \def\processXMLfile ##1{\xmlprocessfile \xmldocument{##1}{}}%
+ \def\processXMLfilegrouped ##1{\xmlprocessfile \xmldocument{##1}{}}% maybe still grouped?
+ \def\processXMLbuffer {\dosingleempty\doprocessXMLbuffer}%
+ \def\doprocessXMLbuffer [##1]{\xmlprocessbuffer\xmldocument{##1}{}}%
+ \def\XMLdata ##1{\xmlprocessdata \xmldocument{##1}{}}%
+ \def\startXMLdata##1\stopXMLdata{\xmlprocessdata \xmldocument{##1}{}}}
+
+\let\normalprocessXMLfilegrouped\processXMLfilegrouped
+
+\def\processXMLfileMKIV % one-shot, will become obsolete, personal hack
+ {\dosingleempty\doprocessXMLfileMKIV}
+
+\def\doprocessXMLfileMKIV[#1]%
+ {\def\processXMLfilegrouped##1%
+ {\let\processXMLfilegrouped\normalprocessXMLfilegrouped
+ \doifelsenothing{#1}{\xmlprocess{main}{##1}{}}{\xmlprocess{#1}{##1}{}}}}
+
+\protect \endinput
diff --git a/tex/context/base/lxml-ini.tex b/tex/context/base/lxml-ini.tex
deleted file mode 100644
index 494e4f0b7..000000000
--- a/tex/context/base/lxml-ini.tex
+++ /dev/null
@@ -1,408 +0,0 @@
-%D \module
-%D [ file=lxml-ini,
-%D version=2007.08.17,
-%D title=\CONTEXT\ \XML\ Support,
-%D subtitle=Initialization,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\writestatus{loading}{ConTeXt XML Support / Initialization}
-
-\registerctxluafile{lxml-tab}{1.001}
-\registerctxluafile{lxml-pth}{1.001}
-\registerctxluafile{lxml-ent}{1.001}
-\registerctxluafile{lxml-mis}{1.001}
-\registerctxluafile{lxml-ini}{1.001}
-
-\unprotect
-
-\def\xmlmain #1{\ctxlua{lxml.main("#1")}}
-\def\xmlall #1#2{\ctxlua{lxml.all("#1","#2")}}
-\def\xmlatt #1#2{\ctxlua{lxml.attribute("#1","/","#2")}}
-\def\xmlattdef #1#2#3{\ctxlua{lxml.attribute("#1","/","#2","#3")}}
-\def\xmlattribute #1#2#3{\ctxlua{lxml.attribute("#1","#2","#3")}}
-\def\xmlattributedef #1#2#3#4{\ctxlua{lxml.attribute("#1","#2","#3","#4")}}
-\def\xmlcommand #1#2#3{\ctxlua{lxml.command("#1","#2","#3")}}
-\def\xmlconcat #1#2#3{\ctxlua{lxml.concat("#1","#2",[[\detokenize{#3}]])}}
-\def\xmlconcatrange#1#2#3#4#5{\ctxlua{lxml.concatrange("#1","#2","#3","#4",[[\detokenize{#5}]])}}
-\def\xmlcount #1#2{\ctxlua{lxml.count("#1","#2")}}
-\def\xmldelete #1#2{\ctxlua{xml.delete(lxml.id("#1"),"#2")}}
-\def\xmldirectives #1{\ctxlua{lxml.directives.setup("#1")}}
-\def\xmldirectivesbefore #1{\ctxlua{lxml.directives.before("#1")}}
-\def\xmldirectivesafter #1{\ctxlua{lxml.directives.after("#1")}}
-\def\xmlfilter #1#2{\ctxlua{lxml.filter("#1",\!!bs#2\!!es)}}
-\def\xmlfirst #1#2{\ctxlua{lxml.first("#1","#2")}}
-\def\xmlflush #1{\ctxlua{lxml.flush("#1")}}
-% \def\xmlcontent #1{\ctxlua{lxml.content("#1")}}
-% \def\xmlstrip #1{\ctxlua{lxml.strip("#1")}}
-% \def\xmlflushstripped #1{\ctxlua{lxml.strip("#1",true)}}
-\def\xmldirect #1{\ctxlua{lxml.direct("#1")}} % in loops, not dt but root
-\def\xmlidx #1#2#3{\ctxlua{lxml.idx("#1","#2",\number#3)}}
-\def\xmlinclude #1#2#3{\ctxlua{lxml.include("#1","#2","#3",true)}}
-\def\xmlindex #1#2#3{\ctxlua{lxml.index("#1","#2",\number#3)}}
-\def\xmlinfo #1{\hbox{\ttxx[\ctxlua{lxml.info("#1")}]}}
-\def\xmlshow #1{\startpacked\ttx\xmlverbatim{#1}\stoppacked}
-\def\xmllast #1#2{\ctxlua{lxml.last("#1","#2")}}
-\def\xmlload #1#2{\ctxlua{lxml.load("#1","#2")}}
-\def\xmlloadbuffer #1#2{\ctxlua{lxml.loadbuffer("#1","#2")}}
-\def\xmlloaddata #1#2{\ctxlua{lxml.loaddata("#1",\!!bs#2\!!es)}}
-\def\xmlloadregistered #1#2{\ctxlua{lxml.loadregistered("#1")}}
-\def\xmlloaddirectives #1{\ctxlua{lxml.directives.load("#1")}}
-\def\xmlname #1{\ctxlua{lxml.name("#1")}}
-\def\xmlnamespace #1{\ctxlua{lxml.namespace("#1")}}
-\def\xmlnonspace #1#2{\ctxlua{lxml.nonspace("#1","#2")}}
-\def\xmlraw #1#2{\ctxlua{lxml.raw("#1","#2")}}
-\def\xmlsnippet #1#2{\ctxlua{lxml.snippet("#1",#2)}}
-\def\xmlelement #1#2{\ctxlua{lxml.element("#1",#2)}}
-\def\xmlnofelements #1{\ctxlua{lxml.nofelements("#1")}}
-\def\xmlregisterns #1#2{\ctxlua{xml.registerns("#1","#2")}} % document
-\def\xmlremapname #1#2#3#4{\ctxlua{xml.remapname(lxml.id("#1"),"#2","#3","#4")}} % element
-\def\xmlremapnamespace #1#2#3{\ctxlua{xml.rename_space(lxml.id("#1"),"#2","#3")}} % document
-\def\xmlchecknamespace #1#2#3{\ctxlua{xml.check_namespace(lxml.id("#1"),"#2","#3")}} % element
-\def\xmlsetfunction #1#2#3{\ctxlua{lxml.setaction("#1","#2",#3)}}
-\def\xmlsetsetup #1#2#3{\ctxlua{lxml.setsetup("#1","#2","#3")}}
-\def\xmlstrip #1#2{\ctxlua{lxml.strip("#1","#2")}}
-\def\xmlstripped #1#2{\ctxlua{lxml.stripped("#1","#2")}}
-\def\xmlstripnolines #1#2{\ctxlua{lxml.strip("#1","#2",true)}}
-\def\xmlstrippednolines #1#2{\ctxlua{lxml.stripped("#1","#2",true)}}
-\def\xmltag #1{\ctxlua{lxml.tag("#1")}}
-\def\xmltext #1#2{\ctxlua{lxml.text("#1","#2")}}
-\def\xmltags #1#2{\ctxlua{lxml.tags("#1","#2")}}
-\def\xmlutfize #1{\ctxlua{lxml.utfize("#1")}}
-\def\xmlverbatim #1{\ctxlua{lxml.verbatim("#1")}}
-\def\xmldisplayverbatim #1{\ctxlua{lxml.displayverbatim("#1")}}
-\def\xmlinlineverbatim #1{\ctxlua{lxml.inlineverbatim("#1")}}
-
-%def\xmldoifelse #1#2{\ctxlua{cs.testcase(xml.found(lxml.id("#1"),"#2",false))}}
-%def\xmldoifelsetext #1#2{\ctxlua{cs.testcase(xml.found(lxml.id("#1"),"#2",true ))}}
-
-% kind of special:
-
-\def\xmlstartraw{\ctxlua{lxml.startraw()}}
-\def\xmlstopraw {\ctxlua{lxml.stopraw()}}
-
-% todo: \xmldoifelseattribute
-
-\def\xmldoif #1#2{\ctxlua{lxml.doif("#1","#2")}}
-\def\xmldoifnot #1#2{\ctxlua{lxml.doifnot("#1","#2")}}
-\def\xmldoifelse #1#2{\ctxlua{lxml.doifelse("#1","#2")}}
-\def\xmldoiftext #1#2{\ctxlua{lxml.doiftext("#1","#2")}}
-\def\xmldoifnottext #1#2{\ctxlua{lxml.doifnottext("#1","#2")}}
-\def\xmldoifelsetext #1#2{\ctxlua{lxml.doifelsetext("#1","#2")}}
-\def\xmldoifelseempty #1#2{\ctxlua{lxml.doifelseempty("#1","#2")}} % #2, "*" or "" == self not yet implemented
-\def\xmldoifelseselfempty #1{\ctxlua{lxml.doifelseempty("#1")}}
-
-\def\xmldefaulttotext #1{\ifcase\xmlprocessingmode\or\or \ctxlua{lxml.set_command_to_text("#1")}\fi}
-\def\xmldefaulttonone #1{\ifcase\xmlprocessingmode\or\or\or\ctxlua{lxml.set_command_to_none("#1")}\fi}
-
-% \startxmlsetups xml:include
-% \xmlinclude{main}{include}{filename|href}
-% \stopxmlsetups
-%
-% \xmlprependsetup{xml:include}
-
-\let\xmlgrab\xmlsetsetup
-
-\def\xmlsetup#1#2% % we pass the reference so that we have access to the frozen number
- {\def\xmlself{#1}% % by using #1 inside a setup
- \setupwithargument{#2}{#1}}
-
-\newtoks \registeredxmlsetups
-
-% todo: 1:xml:whatever alwas before 3:xml:something
-
-\def\xmlprependsetup #1{\ctxlua{lxml.installsetup(1,"*","#1")}}
-\def\xmlappendsetup #1{\ctxlua{lxml.installsetup(2,"*","#1")}}
-\def\xmlbeforesetup #1#2{\ctxlua{lxml.installsetup(3,"*","#1","#2"))}}
-\def\xmlaftersetup #1#2{\ctxlua{lxml.installsetup(4,"*","#1","#2"))}}
-
-\def\xmlprependdocumentsetup #1#2{\ctxlua{lxml.installsetup(1,"#1","#2")}}
-\def\xmlappenddocumentsetup #1#2{\ctxlua{lxml.installsetup(2,"#1","#2")}}
-\def\xmlbeforedocumentsetup#1#2#3{\ctxlua{lxml.installsetup(3,"#1","#2","#3"))}}
-\def\xmlafterdocumentsetup #1#2#3{\ctxlua{lxml.installsetup(4,"#1","#2","#3"))}}
-
-\def\xmlremovesetup #1{\ctxlua{lxml.removesetup("*","#1")}}
-\def\xmlremovedocumentsetup #1#2{\ctxlua{lxml.removesetup("#1","#2")}}
-
-\def\xmlflushdocumentsetups #1{\ctxlua{lxml.flushsetups("*","#1")}}
-\def\xmlresetdocumentsetups #1{\ctxlua{lxml.resetsetups("#1")}}
-
-\let\xmlregistersetup \xmlappendsetup
-\let\xmlregisterdocumentsetup\xmlappenddocumentsetup
-
-\def\xmldocument{main}
-
-\def\xmlregisteredsetups
- {\xmlstarttiming
- \xmlflushsetups
- \xmldefaulttotext\xmldocument % after include
- \xmlstoptiming}
-
-\def\xmlregistereddocumentsetups#1%
- {\xmlstarttiming
- % todo: test for duplicates !
- \xmlflushdocumentsetups{#1}%
- \xmldefaulttotext{#1}% after include
- \xmlstoptiming}
-
-\def\xmlstarttiming{\ctxlua{statistics.starttiming(lxml)}}
-\def\xmlstoptiming {\ctxlua{statistics.stoptiming (lxml)}}
-
-\def\doxmlprocess#1#2#3#4%
- {\begingroup
- \edef\xmldocument{#2}% #2 can be \xmldocument and set as such
- #1{#2}{#3}%
- \ifcase\xmlprocessingmode
- \enableXML
- \else
- \setcatcodetable\notcatcodes
- \fi
- \doifelsenothing{#4}
- {\directsetup{xml:process}}
- {\directsetup{#4}}%
- \endgroup}
-
-\def\xmlprocessfile {\doxmlprocess\xmlload}
-\def\xmlprocessdata {\doxmlprocess\xmlloaddata}
-\def\xmlprocessbuffer {\doxmlprocess\xmlloadbuffer}
-\def\xmlprocessregistered{\doxmlprocess\xmlloadregistered}
-\let\xmlprocess \xmlprocessfile
-
-% beware: \xmlmain takes the real root, so also processing
-% instructions preceding the root element; well, in some
-% sense that is the root
-
-\startsetups xml:process
- \xmlregistereddocumentsetups\xmldocument
- \xmlmain\xmldocument
-\stopsetups
-
-\long\def\xmlloop#1#2#3%
- {\def\xmli##1##2{\xmlidx{#1}{#2/##1}{##2}}%
- \dorecurse{\xmlcount{#1}{#2}}{#3}}
-
-\long\def\xmlconnect#1#2#3% inefficient
- {\scratchcounter\xmlcount{#1}{#2}\relax
- \ifcase\scratchcounter \or
- \xmlall{#1}{#2}%
- \else
- \dorecurse \scratchcounter {
- \ifnum\recurselevel>\plusone#3\fi
- \xmlidx{#1}{#2}{\recurselevel}
- }
- \fi}
-
-\def\xmlcdataobeyedline {\obeyedline}
-\def\xmlcdataobeyedspace{\strut\obeyedspace}
-\def\xmlcdatabefore {\bgroup\tt}
-\def\xmlcdataafter {\egroup}
-
-% verbatim (dodo:pre/post whitespace, maybe splot verbatim and
-% cdata commands), experimental:
-%
-% \xmlsetfunction{main}{verbatim}{lxml.displayverbatim}
-% \xmlsetfunction{main}{verb} {lxml.inlineverbatim}
-
-% \def\startxmldisplayverbatim[#1]{}
-% \def\stopxmldisplayverbatim {}
-% \def\startxmlinlineverbatim [#1]{}
-% \def\stopxmlinlineverbatim {}
-
-% we use an xml: namespace so one has to define a suitable verbatim, say
-%
-% \definetyping[xml:verbatim][typing]
-%
-% this is experimental!
-
-\def\startxmldisplayverbatim[#1]%
- {\startpacked % \begingroup
- \let\currenttypingclass\??tp
- \edef\currenttyping{xml:#1}%
- \def\stopxmldisplayverbatim
- {\endofverbatimlines
- \stoppacked} % \endgroup
- \mkinitializeverbatim
- \beginofverbatimlines}
-
-\def\startxmlinlineverbatim[#1]%
- {\begingroup
- \let\currenttypingclass\??ty
- \edef\currenttyping{xml:#1}%
- \let\stopxmldisplayverbatim\endgroup
- \mkinitializeverbatim}
-
-% will move but is developed for xml
-
-\newtoks \collectingtoks
-
-\def\startcollect#1\stopcollect
- {\collectingtoks\@EA{\the\collectingtoks#1}}
-
-\def\startexpandedcollect#1\stopexpandedcollect
- {\expanded{\collectingtoks{\the\collectingtoks#1}}}
-
-\def\startcollecting{\collectingtoks\emptytoks}
-\def\stopcollecting {\the\collectingtoks}
-
-\def\inlinemessage #1{\dontleavehmode{\tttf#1}}
-\def\displaymessage#1{\blank\inlinemessage{#1}\blank}
-
-\def\xmltraceentities
- {\ctxlua{xml.set_text_cleanup(lxml.trace_text_entities)}%
- \appendtoks\ctxlua{lxml.show_text_entities()}\to\everygoodbye}
-
-% processing instructions
-
-\def\xmlcontextdirective#1% kind class key value
- {\executeifdefined{xml#1directive}\gobblethreearguments}
-
-% setting up xml:
-%
-% \setupxml[\c!method=mkii] % mixed mkiv and mkii
-% \setupxml[\c!method=mkiv,\c!default=] % mkiv only
-% \setupxml[\c!method=mkiv,\c!default=\v!none] % mkiv only, undefined -> hidden
-% \setupxml[\c!method=mkiv,\c!default=\v!text] % mkiv only, undefined -> text
-
-% \def\xmlctxdirective#1#2#3{\doif{#1}{clue}{\doif{#2}{page}}{\page[#3]}}
-
-\chardef\xmlprocessingmode=0 % 0=mixed, 1=mkivonly, 2=mkivonly-default-text, 3=mkivonly-default-none
-
-% \setupxml[method=mkiv,strip=yes,entities=yes,default=text]
-
-\newtoks\everysetupxml
-
-\def\setupxml[#1]{\getparameters[\??xm][#1]\the\everysetupxml}
-
-\def\c!entities{entities} % to be internationalized
-\def\s!mkiv {mkiv}
-\def\s!mkii {mkii}
-
-% entities
-
-\newif\ifautoXMLentities
-
-\def\xmlkeepentities{\ctxlua{lxml.reset_entityhandler()}}
-\def\xmlmkiientities{\ctxlua{lxml.set_mkii_entityhandler()}\autoXMLentitiestrue}
-\def\xmlmkiventities{\ctxlua{lxml.set_mkiv_entityhandler()}}
-
-\let\xmlresolveentities\xmlmkiventities % will become \xmlmkiventities
-
-\letvalue{\??xm:1:\s!mkii }\zerocount
-\letvalue{\??xm:1:\s!mkiv }\plusone
-
-\letvalue{\??xm:2:\v!none }\plusone
-\letvalue{\??xm:2:\v!text }\plustwo
-\letvalue{\??xm:2:\v!hidden}\plusthree
-
-\letvalue{\??xm:ii:\v!yes }\xmlresolveentities
-\letvalue{\??xm:ii:\v!no }\xmlkeepentities
-\letvalue{\??xm:ii:\s!mkii}\xmlmkiientities
-\letvalue{\??xm:ii:\s!mkiv}\xmlmkiventities
-
-\letvalue{\??xm:iv:\v!yes }\xmlresolveentities
-\letvalue{\??xm:iv:\v!no }\xmlkeepentities
-\letvalue{\??xm:iv:\s!mkii}\xmlmkiventities
-\letvalue{\??xm:iv:\s!mkiv}\xmlmkiventities
-
-\appendtoks
- \chardef\xmlprocessingmode\executeifdefined{\??xm:1:\@@xmmethod}\zerocount
- \ifcase\xmlprocessingmode
- % mkii, permits both methods
- \executeifdefined{\??xm:ii:\@@xmentities}\xmlkeepentities
- \or
- % mkiv, mkiv exclusively
- \chardef\xmlprocessingmode\executeifdefined{\??xm:2:\@@xmdefault}\plusone
- \executeifdefined{\??xm:iv:\@@xmentities}\xmlresolveentities
- \else
- % unset
- \fi
- \ifcase\xmlprocessingmode
- \ctxlua{characters.setmkiientities()}%
- \else
- \ctxlua{characters.setmkiventities()}%
- \fi
- \doifelse\@@xmcompress\v!yes % this key may change, maybe compress=yes|no
- {\ctxlua{xml.strip_cm_and_dt=true}}
- {\ctxlua{xml.strip_cm_and_dt=false}}%
-\to \everysetupxml
-
-\def\xmlinitialize{\the\everysetupxml}
-
-\newcount\charactersactiveoffset \charactersactiveoffset="10000
-
-\startextendcatcodetable\ctxcatcodes
- \catcode\numexpr\charactersactiveoffset+`<\relax=13
- \catcode\numexpr\charactersactiveoffset+`&\relax=13
- \catcode\numexpr\charactersactiveoffset+`>\relax=13
-\stopextendcatcodetable
-\startextendcatcodetable\xmlcatcodes
- \catcode\numexpr\charactersactiveoffset+`<\relax=13
- \catcode\numexpr\charactersactiveoffset+`&\relax=13
- \catcode\numexpr\charactersactiveoffset+`>\relax=13
-\stopextendcatcodetable
-
-\ctxlua { % entities are remembered in the format
- characters.remapentity("<",characters.active_offset + utf.byte("<"))
- characters.remapentity("&",characters.active_offset + utf.byte("&"))
- characters.remapentity(">",characters.active_offset + utf.byte(">"))
-}
-
-\setupxml
- [\c!method=mkii, % mixed mode
- \c!default=\v!hidden, % ignore elements that are not defined
- \c!compress=\v!no, % strip comment
- \c!entities=\v!yes] % replace entities
-
-% \defineXMLenvironment[y]{(}{)}
-%
-% \startxmlsetups x
-% /\xmlflush{#1}/
-% \stopxmlsetups
-%
-% \startxmlsetups xx
-% \xmlsetsetup{main}{x}{*}
-% \stopxmlsetups
-%
-% \xmlregistersetup{xx}
-%
-% \startbuffer
-% a <&>{b} c
-% \stopbuffer
-%
-% mkii: [\processXMLbuffer]\quad mkiv: [\xmlprocessbuffer{main}{}{}]
-
-% some mkii commands, but mkiv-ified
-
-\def\xmlmapvalue#1#2#3{\setvalue{\??xm:v:#1:#2}{#3}} % keep #3 to grab spaces
-\def\xmlvalue #1#2#3{\executeifdefined{\??xm:v:#1:#2}{#3}}
-
-\let\xmlmapval\xmlmapvalue
-\let\xmlval \xmlvalue
-
-% brrrr, give this at the top of a style that needs to stub mkiv loading
-
-\def\remapXMLtoMKIV
- {\ifx\xmldocument\undefined\def\xmldocument{main}\fi
- \def\processXMLfile ##1{\xmlprocessfile \xmldocument{##1}{}}%
- \def\processXMLfilegrouped ##1{\xmlprocessfile \xmldocument{##1}{}}% maybe still grouped?
- \def\processXMLbuffer {\dosingleempty\doprocessXMLbuffer}%
- \def\doprocessXMLbuffer [##1]{\xmlprocessbuffer\xmldocument{##1}{}}%
- \def\XMLdata ##1{\xmlprocessdata \xmldocument{##1}{}}%
- \def\startXMLdata##1\stopXMLdata{\xmlprocessdata \xmldocument{##1}{}}}
-
-\let\normalprocessXMLfilegrouped\processXMLfilegrouped
-
-\def\processXMLfileMKIV % one-shot, will become obsolete, personal hack
- {\dosingleempty\doprocessXMLfileMKIV}
-
-\def\doprocessXMLfileMKIV[#1]%
- {\def\processXMLfilegrouped##1%
- {\let\processXMLfilegrouped\normalprocessXMLfilegrouped
- \doifelsenothing{#1}{\xmlprocess{main}{##1}{}}{\xmlprocess{#1}{##1}{}}}}
-
-\protect \endinput
diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua
index 6ceadb678..77c28f8d3 100644
--- a/tex/context/base/lxml-tab.lua
+++ b/tex/context/base/lxml-tab.lua
@@ -445,7 +445,7 @@ generic table copier. Since we know what we're dealing with we
can speed up things a bit. The second argument is not to be used!
--ldx]]--
-function copy(old,tables)
+local function copy(old,tables)
if old then
tables = tables or { }
local new = { }
diff --git a/tex/context/base/m-format.tex b/tex/context/base/m-format.tex
new file mode 100644
index 000000000..0f274b236
--- /dev/null
+++ b/tex/context/base/m-format.tex
@@ -0,0 +1,409 @@
+%D \module
+%D [ file=m-formay,
+%D version=ancient,
+%D title=\CONTEXT\ Modules,
+%D subtitle=Ancient Formatting Code,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D Here is some code that I had laying around and had forgotten
+%D about. Let's make it a module and see if there is interest in
+%D such things.
+
+% \defineformatblock [poem]
+% \defineformatsegment [verse] % [poem]
+% \defineformatline [line] % [verse]
+%
+% \startpoem [title] [author]
+% \startverse [ref]
+% \startline [ref]
+%
+% block : voor na tussen *tekstletter *tekstkleur
+%
+% segment : voor na tussen *tekstletter *tekstkleur
+% : links rechts linkeroffset rechteroffset
+% : ?marge *evenmarge *onevenmarge breedte
+% : nummer *nummercommando *conversie
+% : nummerletter nummerkleur *label
+%
+% line : voor na tussen *tekstletter *tekstkleur
+% : nummer *nummercommando *conversie
+% : nummerletter nummerkleur *label
+%
+% * = todo
+
+\unprotect
+
+\definesystemvariable {fx} % format block
+\definesystemvariable {fy} % format segment
+\definesystemvariable {fz} % format line
+
+\def\defineformatblock
+ {\dodoubleempty\dodefineformatblock}
+
+\def\dodefineformatblock[#1][#2]%
+ {\setupformatblock
+ [#1]
+ [\c!before=\blank,\c!after=\blank,\c!inbetween=\blank,
+ \c!textstyle=,\c!textcolor=,#2]%
+ \setvalue{\e!start#1}{\startformatblock[#1]}%
+ \setvalue{\e!stop #1}{\stopformatblock}}
+
+\def\setupformatblock
+ {\dodoubleempty\dosetupformatblock}
+
+\def\setupformatblock[#1]%
+ {\getparameters[\??fx#1]}
+
+\def\startformatblock[#1]%
+ {\dotriplegroupempty\dostartformatblock{#1}}
+
+\def\dostartformatblock#1#2#3
+ {\bgroup
+ \getvalue{\??fx#1\c!before}
+ \doglobal\newcounter\formatsegmentcounter
+ \doglobal\newcounter\formatlinecounter
+ \doglobal\newcounter\formatlinesubcounter
+ \doglobal\newcounter\formatlinemaxcounter
+ \doifsomething{#2}{\leftaligned{#2}\getvalue{\??fx#1\c!inbetween}}
+ \def\stopformatblock%
+ {\doifsomething{#3}{\getvalue{\??fx#1\c!inbetween}\leftaligned{#3}}
+ \getvalue{\??fx#1\c!after}
+ \egroup}}
+
+\def\defineformatsegment
+ {\dodoubleempty\dodefineformatsegment}
+
+\def\dodefineformatsegment[#1][#2]%
+ {\setupformatsegment
+ [#1]
+ [\c!before=\blank,\c!after=\blank,\c!inbetween=\blank,
+ \c!textstyle=,\c!textcolor=,\c!left=,\c!right=,
+ \c!leftoffset=\!!zeropoint,\c!rightoffset=\!!zeropoint,
+ %\c!margin=\!!zeropoint,\c!evenmargin=\!!zeropoint,\c!oddmargin=\hsize,
+ \c!width=\hsize,\c!numberstyle=,\c!numbercolor=,\c!number=\v!no,
+ \c!numbercommand=,\c!conversion=,\c!label=,
+ #2]%
+ \setvalue{\e!start#1}{\startformatsegment[#1]}%
+ \setvalue{\e!stop #1}{\stopformatsegment}}
+
+\def\setupformatsegment
+ {\dodoubleempty\dosetupformatsegment}
+
+\def\setupformatsegment[#1]%
+ {\getparameters[\??fy#1]}
+
+\def\placeformatsegmentcounter
+ {\formatsegmentcounter\quad\hphantom{\placeformatlinecounter}}
+
+\def\placeformatlinecounter
+ {\formatlinecounter}
+
+\def\startformatsegment[#1]%
+ {\bgroup
+ \doifelsevalue{\??fy#1\c!number}\v!yes
+ {\def\doplaceformatsegmentcounter
+ {\inleftmargin
+ {\doattributes{\??fy#1}\c!numberstyle\c!numbercolor
+ {\placeformatsegmentcounter}}}}
+ {\let\doplaceformatsegmentcounter\relax}%
+ \getvalue{\??fy#1\c!before}
+ \doglobal\increment\formatsegmentcounter
+ \def\formatrightoffset{\getvalue{\??fy#1\c!rightoffset}}
+ \def\formatleftoffset {\getvalue{\??fy#1\c!leftoffset}}
+ \def\formatminwidth {\getvalue{\??fy#1\c!minwidth}}
+ \def\formatwidth {\getvalue{\??fy#1\c!width}}
+ %\def\formatmargin {\getvalue{\??fy#1\c!margin}}
+ \def\formatbefore {\getvalue{\??fy#1\c!before}}
+ \def\formatinbetween {\getvalue{\??fy#1\c!inbetween}}
+ \def\formatafter {\getvalue{\??fy#1\c!after}}
+ \def\formatleft {\getvalue{\??fy#1\c!left}}
+ \def\formatright {\getvalue{\??fy#1\c!right}}
+ \@@segmentvarianta
+ \getvalue{@@segmentvariant\getvalue{\??fy#1\c!alternative}}
+ \def\stopformatsegment
+ {\getvalue{\??fy#1\c!after}
+ \egroup}}
+
+\newif\iftraceformatblock
+
+\def\@@segmentvarianta % ragged right, symbols
+ {\let\formatraggedness\raggedright
+ \let\dostartformatline\dostartformatlineab
+ \let\formatleftfirst\relax \let\formatrightfirst\hfill
+ \let\formatleftnext \hfill \let\formatrightnext \relax}
+
+\def\@@segmentvariantb % ragged right, equal parts, symbols
+ {\let\formatraggedness\raggedcenter
+ \let\dostartformatline\dostartformatlineab
+ \let\formatleftfirst\relax \let\formatrightfirst\hfill
+ \let\formatleftnext \hfill \let\formatrightnext \relax}
+
+\def\@@segmentvariantc % ragged right
+ {\let\formatraggedness\veryraggedright
+ \let\dostartformatline\dostartformatlinecde
+ \let\formatleftnext\relax \let\formatrightnext\hfill}
+
+\def\@@segmentvariantd % ragged center
+ {\let\formatraggedness\veryraggedcenter
+ \let\dostartformatline\dostartformatlinecde
+ \let\formatleftnext\hfill \let\formatrightnext\hfill}
+
+\def\@@segmentvariante % ragged left
+ {\let\formatraggedness\veryraggedleft
+ \let\dostartformatline\dostartformatlinecde
+ \let\formatleftnext\hfill \let\formatrightnext\relax}
+
+\def\defineformatline
+ {\dodoubleempty\dodefineformatline}
+
+\def\dodefineformatline[#1][#2]%
+ {\setupformatline
+ [#1]
+ [\c!before=\blank,\c!after=\blank,\c!inbetween=\blank,
+ \c!textstyle=,\c!textcolor=,
+ \c!number=\v!no,\c!numbercommand=,\c!conversion=,
+ \c!numberstyle=,\c!numbercolor=,\c!label=,
+ #2]%
+ \setvalue{\e!start#1}{\startformatline[#1]}%
+ \setvalue{\e!stop #1}{\stopformatline}}
+
+\def\setupformatline
+ {\dodoubleempty\dosetupformatline}
+
+\def\setupformatline[#1]%
+ {\getparameters[\??fz#1]}
+
+\newconditional\formatforcedbreak
+
+\def\startformatline[#1]%
+ {\bgroup
+ \doifelsevalue{\??fz#1\c!number}\v!yes
+ {\def\doplaceformatlinecounter
+ {\inleftmargin
+ {\doattributes{\??fz#1}\c!numberstyle\c!numbercolor
+ {\placeformatlinecounter}}}}
+ {\let\doplaceformatlinecounter\relax}%
+ \global\setfalse\formatforcedbreak
+ \def\\{\break\global\settrue\formatforcedbreak}%
+ \hsize\formatwidth
+ \doglobal\increment\formatlinecounter
+ \par
+ \nobreak
+ \def\stopformatline
+ {\unskip\unskip\unskip\unskip\unskip\egroup
+ \let\doplaceformatsegmentcounter\relax}
+ \postponenotes
+ \dowithnextbox{\dostartformatline}\hbox\bgroup\ignorespaces}
+
+\def\dostartformatlineab
+ {%\dosetleftskipadaption\formatmargin
+ %\advance\hsize-\leftskipadaption\relax
+ \ifdim\nextboxwd>\hsize
+ \beginofshapebox
+ \forgetall
+ \hangafter\plusone
+ \hangindent\formatleftoffset
+ \formatraggedness
+ \hskip\formatrightoffset
+ \unhbox\nextbox\par
+ \endofshapebox
+ %\advance\hsize \leftskipadaption
+ \doglobal\newcounter\formatlinesubcounter
+ \reshapebox
+ {\doglobal\increment\formatlinesubcounter}
+ \global\let\formatlinemaxcounter\formatlinesubcounter
+ \reshapebox
+ {\doglobal\decrement\formatlinesubcounter
+ \ifnum\formatlinesubcounter=\zerocount
+ \doplaceformatsegmentcounter
+ \doplaceformatlinecounter
+ \hskip-\formatrightoffset
+ %\hskip\leftskipadaption
+ \formatleftfirst
+ \unhbox\shapebox
+ \ifnum\formatlinemaxcounter>\plusone
+ \ifx\formatright\empty\else
+ \shapedhbox to \zeropoint{\formatright\hss}%
+ \fi
+ \fi
+ \formatrightfirst
+ \iftraceformatblock
+ \ruledhskip\formatrightoffset\hskip-\formatrightoffset
+ \fi
+ \else
+ %\hskip\leftskipadaption
+ \iftraceformatblock
+ \ruledhskip\formatleftoffset\hskip-\formatleftoffset
+ \fi
+ \formatleftnext
+ \ifx\formatleft\empty\else
+ \shapedhbox to \zeropoint{\hss\formatleft}%
+ \fi
+ \unhbox\shapebox
+ \formatrightnext
+ \fi}
+ \flushshapebox
+ \else
+ \dontleavehmode\hbox
+ {\doplaceformatsegmentcounter
+ \doplaceformatlinecounter
+ %\hskip\leftskipadaption
+ \formatleftfirst
+ \unhbox\nextbox
+ \formatrightfirst}
+ \fi
+ \par
+ \egroup}
+
+\def\dostartformatlinecde
+ {%\dosetleftskipadaption\formatmargin
+ %\advance\hsize -\leftskipadaption\relax
+ \dimen0=\hsize
+ \ifconditional\formatforcedbreak\else
+ \ifdim\formatminwidth>\zeropoint\relax
+ \ifdim\nextboxwd>\hsize
+ \doloop
+ {\global\dimen1=\dimen0
+ \beginofshapebox
+ \hsize\dimen0
+ \forgetall
+ \formatraggedness
+ \unhcopy\nextbox\par
+ \endofshapebox
+ \reshapebox
+ {\setbox\scratchbox=\hbox{\unhbox\shapebox}%
+ \ifdim\wd\scratchbox<\dimen1
+ \global\dimen1=\wd\scratchbox
+ \fi}
+ \ifdim\dimen1<\formatminwidth\relax
+ \advance\dimen0 by -.25em
+ \else
+ \exitloop
+ \fi
+ \ifdim\dimen0<10em
+ \dimen0=\hsize
+ \exitloop
+ \fi}
+ \fi
+ \fi
+ \fi
+ \beginofshapebox
+ \hsize\dimen0
+ \forgetall
+ \formatraggedness
+ \unhcopy\nextbox\par
+ \endofshapebox
+ %\advance\hsize \leftskipadaption
+ \doglobal\newcounter\formatlinesubcounter
+ \reshapebox
+ {\doglobal\increment\formatlinesubcounter}%
+ \global\let\formatlinemaxcounter\formatlinesubcounter
+ \reshapebox
+ {\doglobal\decrement\formatlinesubcounter
+ \ifnum\formatlinesubcounter=\zerocount
+ \doplaceformatsegmentcounter
+ \doplaceformatlinecounter
+ \fi
+ %\hskip\leftskipadaption
+ \formatleftnext
+ \unhbox\shapebox
+ \formatrightnext\strut}% strut prevents unskip
+ \flushshapebox
+ \par
+ \egroup}
+
+\defineformatblock[poem]
+ [\c!before=\blank,
+ \c!inbetween={\blank[\v!medium]},
+ \c!after=\blank]
+
+\defineformatsegment[verse]
+ [\c!alternative=\v!left,
+ \c!width=\hsize,
+ %\c!margin=\!!zeropoint,
+ \c!before={\blank[\v!medium]},
+ \c!after={\blank[\v!medium]},
+ \c!inbetween={\blank[\v!medium]},
+ \c!leftoffset=3em,
+ \c!rightoffset=2em,
+ \c!minwidth=5em,
+ \c!left={$[$\enspace},
+ \c!right={\enspace$]$}]
+
+\defineformatline[line]
+ []
+
+\protect \doifnotmode{demo} {\endinput}
+
+% evt defineblank[formatbefore,formatinbetween,formatafter]
+
+%\showframe \traceformatblocktrue
+
+\usemodule[visual]
+
+\setuplayout[height=middle,topspace=1cm,header=0pt,footer=0pt]
+\setupbodyfont[10pt]
+
+% All interfaces supported, but testing with english; todo:
+% more options, more alternatives, inheritance and mixed
+% definitions, and so.
+
+\starttext
+
+\startbuffer
+\startbuffer[poem]
+\startpoem{A Random Poem}{Hans Hagen}
+ \startverse
+ \startline \fakewords{4}{8} \stopline
+ \startline \fakewords{4}{8} \stopline
+ \startline \fakewords{4}{8} \stopline
+ \startline \fakewords{4}{8} \stopline
+ \stopverse
+ \startverse
+ \startline \fakewords{4}{8} \stopline
+ \startline \fakewords{4}{8} \stopline
+ \startline \fakewords{4}{8} \stopline
+ \startline \fakewords{4}{8} \stopline
+ \stopverse
+\stoppoem
+\stopbuffer
+
+\setupformatsegment[verse][width=.4\hsize,number=yes,numberstyle=slanted]
+\setupformatline [line] [number=yes,numberstyle=smallslanted]
+
+\startbuffer[x]
+\setupformatsegment[verse][leftoffset=0pt,rightoffset=0pt,left=,right=]
+\stopbuffer
+
+\section{Alternative A}
+
+\setupformatsegment[verse][alternative=a] {\getbuffer[poem]}
+\setupformatsegment[verse][alternative=a] {\getbuffer[x,poem]}
+
+\section{Alternative B}
+
+\setupformatsegment[verse][alternative=b] {\getbuffer[poem]}
+\setupformatsegment[verse][alternative=b] {\getbuffer[x,poem]}
+
+\section{Alternative C}
+
+\setupformatsegment[verse][alternative=c] {\getbuffer[poem]}
+
+\section{Alternative D}
+
+\setupformatsegment[verse][alternative=d] {\getbuffer[poem]}
+
+\section{Alternative E}
+
+\setupformatsegment[verse][alternative=e] {\getbuffer[poem]}
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\stoptext
diff --git a/tex/context/base/math-ams.mkii b/tex/context/base/math-ams.mkii
new file mode 100644
index 000000000..83070d01a
--- /dev/null
+++ b/tex/context/base/math-ams.mkii
@@ -0,0 +1,336 @@
+%D \module
+%D [ file=math-ams,
+%D version=2001.04.12,
+%D title=\CONTEXT\ Math Macros,
+%D subtitle=AMS Specials,
+%D author={Hans Hagen \& Taco Hoekwater},
+%D date=\currentdate,
+%D copyright=\PRAGMA]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+% maybe we should just include these into the default tex one
+
+\definefamilysynonym [default] [blackboard] [mb]
+
+\startmathcollection [default]
+
+\definemathsymbol [varGamma] [ord] [letters] ["00]
+\definemathsymbol [varDelta] [ord] [letters] ["01]
+\definemathsymbol [varTheta] [ord] [letters] ["02]
+\definemathsymbol [varLambda] [ord] [letters] ["03]
+\definemathsymbol [varXi] [ord] [letters] ["04]
+\definemathsymbol [varPi] [ord] [letters] ["05]
+\definemathsymbol [varSigma] [ord] [letters] ["06]
+\definemathsymbol [varUpsilon] [ord] [letters] ["07]
+\definemathsymbol [varPhi] [ord] [letters] ["08]
+\definemathsymbol [varPsi] [ord] [letters] ["09]
+\definemathsymbol [varOmega] [ord] [letters] ["0A]
+
+\stopmathcollection
+
+\startmathcollection[default]
+
+\definemathsymbol [internalAnd] [rel] [operators] ["26]
+
+\stopmathcollection
+
+\startmathcollection [default]
+
+\definemathsymbol [boxdot] [bin] [ma] ["00]
+\definemathsymbol [boxplus] [bin] [ma] ["01]
+\definemathsymbol [boxtimes] [bin] [ma] ["02]
+\definemathsymbol [square] [ord] [ma] ["03]
+\definemathsymbol [Box] [ord] [ma] ["03] % square
+\definemathsymbol [blacksquare] [ord] [ma] ["04]
+\definemathsymbol [centerdot] [bin] [ma] ["05]
+\definemathsymbol [Diamond] [ord] [ma] ["06]
+\definemathsymbol [lozenge] [ord] [ma] ["06] % Diamond
+\definemathsymbol [blacklozenge] [ord] [ma] ["07]
+\definemathsymbol [circlearrowright] [rel] [ma] ["08]
+\definemathsymbol [circlearrowleft] [rel] [ma] ["09]
+\definemathsymbol [rightleftharpoons] [rel] [ma] ["0A]
+\definemathsymbol [leftrightharpoons] [rel] [ma] ["0B]
+\definemathsymbol [boxminus] [bin] [ma] ["0C]
+\definemathsymbol [Vdash] [rel] [ma] ["0D]
+\definemathsymbol [Vvdash] [rel] [ma] ["0E]
+\definemathsymbol [vDash] [rel] [ma] ["0F]
+\definemathsymbol [twoheadrightarrow] [rel] [ma] ["10]
+\definemathsymbol [twoheadleftarrow] [rel] [ma] ["11]
+\definemathsymbol [leftleftarrows] [rel] [ma] ["12]
+\definemathsymbol [rightrightarrows] [rel] [ma] ["13]
+\definemathsymbol [upuparrows] [rel] [ma] ["14]
+\definemathsymbol [downdownarrows] [rel] [ma] ["15]
+\definemathsymbol [upharpoonright] [rel] [ma] ["16]
+\definemathsymbol [restriction] [rel] [ma] ["16]
+\definemathsymbol [downharpoonright] [rel] [ma] ["17]
+\definemathsymbol [upharpoonleft] [rel] [ma] ["18]
+\definemathsymbol [downharpoonleft] [rel] [ma] ["19]
+\definemathsymbol [rightarrowtail] [rel] [ma] ["1A]
+\definemathsymbol [leftarrowtail] [rel] [ma] ["1B]
+\definemathsymbol [leftrightarrows] [rel] [ma] ["1C]
+\definemathsymbol [rightleftarrows] [rel] [ma] ["1D]
+\definemathsymbol [Lsh] [rel] [ma] ["1E]
+\definemathsymbol [Rsh] [rel] [ma] ["1F]
+\definemathsymbol [rightsquigarrow] [rel] [ma] ["20]
+\definemathsymbol [leadsto] [rel] [ma] ["20] % rightsquigarrow
+\definemathsymbol [leftrightsquigarrow] [rel] [ma] ["21]
+\definemathsymbol [looparrowleft] [rel] [ma] ["22]
+\definemathsymbol [looparrowright] [rel] [ma] ["23]
+\definemathsymbol [circeq] [rel] [ma] ["24]
+\definemathsymbol [succsim] [rel] [ma] ["25]
+\definemathsymbol [gtrsim] [rel] [ma] ["26]
+\definemathsymbol [gtrapprox] [rel] [ma] ["27]
+\definemathsymbol [multimap] [rel] [ma] ["28]
+\definemathsymbol [therefore] [rel] [ma] ["29]
+\definemathsymbol [because] [rel] [ma] ["2A]
+\definemathsymbol [doteqdot] [rel] [ma] ["2B]
+\definemathsymbol [Doteq] [rel] [ma] ["2B] % doteqdot
+\definemathsymbol [triangleq] [rel] [ma] ["2C]
+\definemathsymbol [precsim] [rel] [ma] ["2D]
+\definemathsymbol [lesssim] [rel] [ma] ["2E]
+\definemathsymbol [lessapprox] [rel] [ma] ["2F]
+\definemathsymbol [eqslantless] [rel] [ma] ["30]
+\definemathsymbol [eqslantgtr] [rel] [ma] ["31]
+\definemathsymbol [curlyeqprec] [rel] [ma] ["32]
+\definemathsymbol [curlyeqsucc] [rel] [ma] ["33]
+\definemathsymbol [preccurlyeq] [rel] [ma] ["34]
+\definemathsymbol [leqq] [rel] [ma] ["35]
+\definemathsymbol [leqslant] [rel] [ma] ["36]
+\definemathsymbol [lessgtr] [rel] [ma] ["37]
+\definemathsymbol [backprime] [ord] [ma] ["38]
+\definemathsymbol [dabar@] [ord] [ma] ["39] % @
+\definemathsymbol [risingdotseq] [rel] [ma] ["3A]
+\definemathsymbol [fallingdotseq] [rel] [ma] ["3B]
+\definemathsymbol [succcurlyeq] [rel] [ma] ["3C]
+\definemathsymbol [geqq] [rel] [ma] ["3D]
+\definemathsymbol [geqslant] [rel] [ma] ["3E]
+\definemathsymbol [gtrless] [rel] [ma] ["3F]
+\definemathsymbol [sqsubset] [rel] [ma] ["40]
+\definemathsymbol [sqsupset] [rel] [ma] ["41]
+\definemathsymbol [vartriangleright] [rel] [ma] ["42]
+\definemathsymbol [rhd] [bin] [ma] ["42]
+\definemathsymbol [lhd] [bin] [ma] ["43]
+\definemathsymbol [vartriangleleft] [rel] [ma] ["43]
+\definemathsymbol [trianglerighteq] [rel] [ma] ["44]
+\definemathsymbol [unrhd] [bin] [ma] ["44] % trianglerighteq
+\definemathsymbol [trianglelefteq] [rel] [ma] ["45]
+\definemathsymbol [unlhd] [bin] [ma] ["45] % trianglelefteq
+\definemathsymbol [bigstar] [ord] [ma] ["46]
+\definemathsymbol [between] [rel] [ma] ["47]
+\definemathsymbol [blacktriangledown] [ord] [ma] ["48]
+\definemathsymbol [blacktriangleright] [rel] [ma] ["49]
+\definemathsymbol [blacktriangleleft] [rel] [ma] ["4A]
+\definemathsymbol [vartriangle] [rel] [ma] ["4D]
+\definemathsymbol [triangleup] [ord] [ma] ["4D] % vartriangle
+\definemathsymbol [blacktriangle] [ord] [ma] ["4E]
+\definemathsymbol [triangledown] [ord] [ma] ["4F]
+\definemathsymbol [eqcirc] [rel] [ma] ["50]
+\definemathsymbol [lesseqgtr] [rel] [ma] ["51]
+\definemathsymbol [gtreqless] [rel] [ma] ["52]
+\definemathsymbol [lesseqqgtr] [rel] [ma] ["53]
+\definemathsymbol [gtreqqless] [rel] [ma] ["54]
+\definemathsymbol [Rrightarrow] [rel] [ma] ["56]
+\definemathsymbol [Lleftarrow] [rel] [ma] ["57]
+\definemathsymbol [veebar] [bin] [ma] ["59]
+\definemathsymbol [barwedge] [bin] [ma] ["5A]
+\definemathsymbol [doublebarwedge] [bin] [ma] ["5B]
+\definemathsymbol [angle] [ord] [ma] ["5C]
+\definemathsymbol [measuredangle] [ord] [ma] ["5D]
+\definemathsymbol [sphericalangle] [ord] [ma] ["5E]
+\definemathsymbol [varpropto] [rel] [ma] ["5F]
+\definemathsymbol [smallsmile] [rel] [ma] ["60]
+\definemathsymbol [smallfrown] [rel] [ma] ["61]
+\definemathsymbol [Subset] [rel] [ma] ["62]
+\definemathsymbol [Supset] [rel] [ma] ["63]
+\definemathsymbol [Cup] [bin] [ma] ["64]
+\definemathsymbol [doublecup] [bin] [ma] ["64] % Cup
+\definemathsymbol [Cap] [bin] [ma] ["65]
+\definemathsymbol [doublecap] [bin] [ma] ["65]
+\definemathsymbol [curlywedge] [bin] [ma] ["66]
+\definemathsymbol [curlyvee] [bin] [ma] ["67]
+\definemathsymbol [leftthreetimes] [bin] [ma] ["68]
+\definemathsymbol [rightthreetimes] [bin] [ma] ["69]
+\definemathsymbol [subseteqq] [rel] [ma] ["6A]
+\definemathsymbol [supseteqq] [rel] [ma] ["6B]
+\definemathsymbol [bumpeq] [rel] [ma] ["6C]
+\definemathsymbol [Bumpeq] [rel] [ma] ["6D]
+\definemathsymbol [llless] [rel] [ma] ["6E]
+\definemathsymbol [lll] [rel] [ma] ["6E] % llless
+\definemathsymbol [gggtr] [rel] [ma] ["6F]
+\definemathsymbol [ggg] [rel] [ma] ["6F] % gggtr
+\definemathsymbol [ulcorner] [open] [ma] ["70] [ma] ["70]
+\definemathsymbol [urcorner] [close] [ma] ["71] [ma] ["71]
+\definemathsymbol [circledS] [ord] [ma] ["73]
+\definemathsymbol [pitchfork] [rel] [ma] ["74]
+\definemathsymbol [dotplus] [bin] [ma] ["75]
+\definemathsymbol [backsim] [rel] [ma] ["76]
+\definemathsymbol [backsimeq] [rel] [ma] ["77]
+\definemathsymbol [llcorner] [open] [ma] ["78] [ma] ["78]
+\definemathsymbol [lrcorner] [close] [ma] ["79] [ma] ["79]
+\definemathsymbol [complement] [ord] [ma] ["7B]
+\definemathsymbol [intercal] [bin] [ma] ["7C]
+\definemathsymbol [circledcirc] [bin] [ma] ["7D]
+\definemathsymbol [circledast] [bin] [ma] ["7E]
+\definemathsymbol [circleddash] [bin] [ma] ["7F]
+
+\stopmathcollection
+
+\startmathcollection [default]
+
+\definemathcommand [integers] {\blackboard{Z}}
+\definemathcommand [reals] {\blackboard{R}}
+\definemathcommand [rationals] {\blackboard{Q}}
+\definemathcommand [naturalnumbers] {\blackboard{N}}
+\definemathcommand [complexes] {\blackboard{C}}
+\definemathcommand [primes] {\blackboard{P}}
+
+\stopmathcollection
+
+\startmathcollection [default]
+
+\definemathsymbol [lvertneqq] [rel] [mb] ["00]
+\definemathsymbol [gvertneqq] [rel] [mb] ["01]
+\definemathsymbol [nleq] [rel] [mb] ["02]
+\definemathsymbol [ngeq] [rel] [mb] ["03]
+\definemathsymbol [nless] [rel] [mb] ["04]
+\definemathsymbol [ngtr] [rel] [mb] ["05]
+\definemathsymbol [nprec] [rel] [mb] ["06]
+\definemathsymbol [nsucc] [rel] [mb] ["07]
+\definemathsymbol [lneqq] [rel] [mb] ["08]
+\definemathsymbol [gneqq] [rel] [mb] ["09]
+\definemathsymbol [nleqslant] [rel] [mb] ["0A]
+\definemathsymbol [ngeqslant] [rel] [mb] ["0B]
+\definemathsymbol [lneq] [rel] [mb] ["0C]
+\definemathsymbol [gneq] [rel] [mb] ["0D]
+\definemathsymbol [npreceq] [rel] [mb] ["0E]
+\definemathsymbol [nsucceq] [rel] [mb] ["0F]
+\definemathsymbol [precnsim] [rel] [mb] ["10]
+\definemathsymbol [succnsim] [rel] [mb] ["11]
+\definemathsymbol [lnsim] [rel] [mb] ["12]
+\definemathsymbol [gnsim] [rel] [mb] ["13]
+\definemathsymbol [nleqq] [rel] [mb] ["14]
+\definemathsymbol [ngeqq] [rel] [mb] ["15]
+\definemathsymbol [precneqq] [rel] [mb] ["16]
+\definemathsymbol [succneqq] [rel] [mb] ["17]
+\definemathsymbol [precnapprox] [rel] [mb] ["18]
+\definemathsymbol [succnapprox] [rel] [mb] ["19]
+\definemathsymbol [lnapprox] [rel] [mb] ["1A]
+\definemathsymbol [gnapprox] [rel] [mb] ["1B]
+\definemathsymbol [nsim] [rel] [mb] ["1C]
+\definemathsymbol [ncong] [rel] [mb] ["1D]
+\definemathsymbol [diagup] [ord] [mb] ["1E]
+\definemathsymbol [diagdown] [ord] [mb] ["1F]
+\definemathsymbol [varsubsetneq] [rel] [mb] ["20]
+\definemathsymbol [varsupsetneq] [rel] [mb] ["21]
+\definemathsymbol [nsubseteqq] [rel] [mb] ["22]
+\definemathsymbol [nsupseteqq] [rel] [mb] ["23]
+\definemathsymbol [subsetneqq] [rel] [mb] ["24]
+\definemathsymbol [supsetneqq] [rel] [mb] ["25]
+\definemathsymbol [varsubsetneqq] [rel] [mb] ["26]
+\definemathsymbol [varsupsetneqq] [rel] [mb] ["27]
+\definemathsymbol [subsetneq] [rel] [mb] ["28]
+\definemathsymbol [supsetneq] [rel] [mb] ["29]
+\definemathsymbol [nsubseteq] [rel] [mb] ["2A]
+\definemathsymbol [nsupseteq] [rel] [mb] ["2B]
+\definemathsymbol [nparallel] [rel] [mb] ["2C]
+\definemathsymbol [nmid] [rel] [mb] ["2D]
+\definemathsymbol [nshortmid] [rel] [mb] ["2E]
+\definemathsymbol [nshortparallel] [rel] [mb] ["2F]
+\definemathsymbol [nvdash] [rel] [mb] ["30]
+\definemathsymbol [nVdash] [rel] [mb] ["31]
+\definemathsymbol [nvDash] [rel] [mb] ["32]
+\definemathsymbol [nVDash] [rel] [mb] ["33]
+\definemathsymbol [ntrianglerighteq] [rel] [mb] ["34]
+\definemathsymbol [ntrianglelefteq] [rel] [mb] ["35]
+\definemathsymbol [ntriangleleft] [rel] [mb] ["36]
+\definemathsymbol [ntriangleright] [rel] [mb] ["37]
+\definemathsymbol [nleftarrow] [rel] [mb] ["38]
+\definemathsymbol [nrightarrow] [rel] [mb] ["39]
+\definemathsymbol [nLeftarrow] [rel] [mb] ["3A]
+\definemathsymbol [nRightarrow] [rel] [mb] ["3B]
+\definemathsymbol [nLeftrightarrow] [rel] [mb] ["3C]
+\definemathsymbol [nleftrightarrow] [rel] [mb] ["3D]
+\definemathsymbol [divideontimes] [bin] [mb] ["3E]
+\definemathsymbol [varnothing] [ord] [mb] ["3F]
+\definemathsymbol [nexists] [ord] [mb] ["40]
+\definemathsymbol [Finv] [ord] [mb] ["60]
+\definemathsymbol [Game] [ord] [mb] ["61]
+\definemathsymbol [mho] [ord] [mb] ["66]
+\definemathsymbol [eth] [ord] [mb] ["67]
+\definemathsymbol [eqsim] [rel] [mb] ["68]
+\definemathsymbol [beth] [ord] [mb] ["69]
+\definemathsymbol [gimel] [ord] [mb] ["6A]
+\definemathsymbol [daleth] [ord] [mb] ["6B]
+\definemathsymbol [lessdot] [bin] [mb] ["6C]
+\definemathsymbol [gtrdot] [bin] [mb] ["6D]
+\definemathsymbol [ltimes] [bin] [mb] ["6E]
+\definemathsymbol [rtimes] [bin] [mb] ["6F]
+\definemathsymbol [shortmid] [rel] [mb] ["70]
+\definemathsymbol [shortparallel] [rel] [mb] ["71]
+\definemathsymbol [smallsetminus] [bin] [mb] ["72]
+\definemathsymbol [thicksim] [rel] [mb] ["73]
+\definemathsymbol [thickapprox] [rel] [mb] ["74]
+\definemathsymbol [approxeq] [rel] [mb] ["75]
+\definemathsymbol [succapprox] [rel] [mb] ["76]
+\definemathsymbol [precapprox] [rel] [mb] ["77]
+\definemathsymbol [curvearrowleft] [rel] [mb] ["78]
+\definemathsymbol [curvearrowright] [rel] [mb] ["79]
+\definemathsymbol [digamma] [ord] [mb] ["7A]
+\definemathsymbol [varkappa] [ord] [mb] ["7B]
+\definemathsymbol [Bbbk] [ord] [mb] ["7C]
+\definemathsymbol [hslash] [ord] [mb] ["7D]
+\definemathsymbol [hbar] [ord] [mb] ["7E]
+\definemathsymbol [backepsilon] [rel] [mb] ["7F]
+
+\stopmathcollection
+
+\startmathcollection [default]
+
+\definemathcommand [yen] [nothing] {\mathhexbox{\hexmafam}55}
+\definemathcommand [checkmark] [nothing] {\mathhexbox{\hexmafam}58}
+\definemathcommand [circledR] [nothing] {\mathhexbox{\hexmafam}72}
+\definemathcommand [maltese] [nothing] {\mathhexbox{\hexmafam}7A}
+
+\stopmathcollection
+
+\startmathcollection [default]
+
+\definemathcommand [dashrightarrow] [rel] {\dabar@\dabar@ \mathchar"0C4B}
+\definemathcommand [dashleftarrow] [rel] {\mathchar"0C4C\dabar@ \dabar@}
+\definemathcommand [dasharrow] [rel] {\dabar@\dabar@ \mathchar"0C4B}
+\definemathcommand [Join] [rel] {\mathchar"0D6F\mkern-13.8mu\mathchar"0D6E}
+\definemathcommand [implies] [rel] {\;\Longrightarrow\;}
+\definemathcommand [impliedby] [rel] {\;\Longleftarrow\;}
+\definemathcommand [And] [rel] {\;\internalAnd\;}
+
+\stopmathcollection
+
+\def\AMSwidehat#1%
+ {\setbox\scratchbox\hbox{$\mathsurround\zeropoint#1$}%
+ \ifdim\wd\scratchbox>2em
+ \mathaccent"0\purefamilyhex{mb}5B{#1}%
+ \else
+ \mathaccent"0\purefamilyhex{ex}62{#1}%
+ \fi}
+
+\def\AMSwidetilde#1%
+ {\setbox\scratchbox\hbox{$\mathsurround\zeropoint#1$}%
+ \ifdim\wd\scratchbox>2em
+ \mathaccent"0\purefamilyhex{mb}5D{#1}%
+ \else
+ \mathaccent"0\purefamilyhex{ex}65{#1}%
+ \fi}
+
+\startmathcollection [default]
+
+\definemathcommand [widehat] {\AMSwidehat}
+\definemathcommand [widetilde] {\AMSwidetilde}
+
+\stopmathcollection
+
+\protect \endinput
diff --git a/tex/context/base/math-ams.tex b/tex/context/base/math-ams.tex
deleted file mode 100644
index 83070d01a..000000000
--- a/tex/context/base/math-ams.tex
+++ /dev/null
@@ -1,336 +0,0 @@
-%D \module
-%D [ file=math-ams,
-%D version=2001.04.12,
-%D title=\CONTEXT\ Math Macros,
-%D subtitle=AMS Specials,
-%D author={Hans Hagen \& Taco Hoekwater},
-%D date=\currentdate,
-%D copyright=\PRAGMA]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\unprotect
-
-% maybe we should just include these into the default tex one
-
-\definefamilysynonym [default] [blackboard] [mb]
-
-\startmathcollection [default]
-
-\definemathsymbol [varGamma] [ord] [letters] ["00]
-\definemathsymbol [varDelta] [ord] [letters] ["01]
-\definemathsymbol [varTheta] [ord] [letters] ["02]
-\definemathsymbol [varLambda] [ord] [letters] ["03]
-\definemathsymbol [varXi] [ord] [letters] ["04]
-\definemathsymbol [varPi] [ord] [letters] ["05]
-\definemathsymbol [varSigma] [ord] [letters] ["06]
-\definemathsymbol [varUpsilon] [ord] [letters] ["07]
-\definemathsymbol [varPhi] [ord] [letters] ["08]
-\definemathsymbol [varPsi] [ord] [letters] ["09]
-\definemathsymbol [varOmega] [ord] [letters] ["0A]
-
-\stopmathcollection
-
-\startmathcollection[default]
-
-\definemathsymbol [internalAnd] [rel] [operators] ["26]
-
-\stopmathcollection
-
-\startmathcollection [default]
-
-\definemathsymbol [boxdot] [bin] [ma] ["00]
-\definemathsymbol [boxplus] [bin] [ma] ["01]
-\definemathsymbol [boxtimes] [bin] [ma] ["02]
-\definemathsymbol [square] [ord] [ma] ["03]
-\definemathsymbol [Box] [ord] [ma] ["03] % square
-\definemathsymbol [blacksquare] [ord] [ma] ["04]
-\definemathsymbol [centerdot] [bin] [ma] ["05]
-\definemathsymbol [Diamond] [ord] [ma] ["06]
-\definemathsymbol [lozenge] [ord] [ma] ["06] % Diamond
-\definemathsymbol [blacklozenge] [ord] [ma] ["07]
-\definemathsymbol [circlearrowright] [rel] [ma] ["08]
-\definemathsymbol [circlearrowleft] [rel] [ma] ["09]
-\definemathsymbol [rightleftharpoons] [rel] [ma] ["0A]
-\definemathsymbol [leftrightharpoons] [rel] [ma] ["0B]
-\definemathsymbol [boxminus] [bin] [ma] ["0C]
-\definemathsymbol [Vdash] [rel] [ma] ["0D]
-\definemathsymbol [Vvdash] [rel] [ma] ["0E]
-\definemathsymbol [vDash] [rel] [ma] ["0F]
-\definemathsymbol [twoheadrightarrow] [rel] [ma] ["10]
-\definemathsymbol [twoheadleftarrow] [rel] [ma] ["11]
-\definemathsymbol [leftleftarrows] [rel] [ma] ["12]
-\definemathsymbol [rightrightarrows] [rel] [ma] ["13]
-\definemathsymbol [upuparrows] [rel] [ma] ["14]
-\definemathsymbol [downdownarrows] [rel] [ma] ["15]
-\definemathsymbol [upharpoonright] [rel] [ma] ["16]
-\definemathsymbol [restriction] [rel] [ma] ["16]
-\definemathsymbol [downharpoonright] [rel] [ma] ["17]
-\definemathsymbol [upharpoonleft] [rel] [ma] ["18]
-\definemathsymbol [downharpoonleft] [rel] [ma] ["19]
-\definemathsymbol [rightarrowtail] [rel] [ma] ["1A]
-\definemathsymbol [leftarrowtail] [rel] [ma] ["1B]
-\definemathsymbol [leftrightarrows] [rel] [ma] ["1C]
-\definemathsymbol [rightleftarrows] [rel] [ma] ["1D]
-\definemathsymbol [Lsh] [rel] [ma] ["1E]
-\definemathsymbol [Rsh] [rel] [ma] ["1F]
-\definemathsymbol [rightsquigarrow] [rel] [ma] ["20]
-\definemathsymbol [leadsto] [rel] [ma] ["20] % rightsquigarrow
-\definemathsymbol [leftrightsquigarrow] [rel] [ma] ["21]
-\definemathsymbol [looparrowleft] [rel] [ma] ["22]
-\definemathsymbol [looparrowright] [rel] [ma] ["23]
-\definemathsymbol [circeq] [rel] [ma] ["24]
-\definemathsymbol [succsim] [rel] [ma] ["25]
-\definemathsymbol [gtrsim] [rel] [ma] ["26]
-\definemathsymbol [gtrapprox] [rel] [ma] ["27]
-\definemathsymbol [multimap] [rel] [ma] ["28]
-\definemathsymbol [therefore] [rel] [ma] ["29]
-\definemathsymbol [because] [rel] [ma] ["2A]
-\definemathsymbol [doteqdot] [rel] [ma] ["2B]
-\definemathsymbol [Doteq] [rel] [ma] ["2B] % doteqdot
-\definemathsymbol [triangleq] [rel] [ma] ["2C]
-\definemathsymbol [precsim] [rel] [ma] ["2D]
-\definemathsymbol [lesssim] [rel] [ma] ["2E]
-\definemathsymbol [lessapprox] [rel] [ma] ["2F]
-\definemathsymbol [eqslantless] [rel] [ma] ["30]
-\definemathsymbol [eqslantgtr] [rel] [ma] ["31]
-\definemathsymbol [curlyeqprec] [rel] [ma] ["32]
-\definemathsymbol [curlyeqsucc] [rel] [ma] ["33]
-\definemathsymbol [preccurlyeq] [rel] [ma] ["34]
-\definemathsymbol [leqq] [rel] [ma] ["35]
-\definemathsymbol [leqslant] [rel] [ma] ["36]
-\definemathsymbol [lessgtr] [rel] [ma] ["37]
-\definemathsymbol [backprime] [ord] [ma] ["38]
-\definemathsymbol [dabar@] [ord] [ma] ["39] % @
-\definemathsymbol [risingdotseq] [rel] [ma] ["3A]
-\definemathsymbol [fallingdotseq] [rel] [ma] ["3B]
-\definemathsymbol [succcurlyeq] [rel] [ma] ["3C]
-\definemathsymbol [geqq] [rel] [ma] ["3D]
-\definemathsymbol [geqslant] [rel] [ma] ["3E]
-\definemathsymbol [gtrless] [rel] [ma] ["3F]
-\definemathsymbol [sqsubset] [rel] [ma] ["40]
-\definemathsymbol [sqsupset] [rel] [ma] ["41]
-\definemathsymbol [vartriangleright] [rel] [ma] ["42]
-\definemathsymbol [rhd] [bin] [ma] ["42]
-\definemathsymbol [lhd] [bin] [ma] ["43]
-\definemathsymbol [vartriangleleft] [rel] [ma] ["43]
-\definemathsymbol [trianglerighteq] [rel] [ma] ["44]
-\definemathsymbol [unrhd] [bin] [ma] ["44] % trianglerighteq
-\definemathsymbol [trianglelefteq] [rel] [ma] ["45]
-\definemathsymbol [unlhd] [bin] [ma] ["45] % trianglelefteq
-\definemathsymbol [bigstar] [ord] [ma] ["46]
-\definemathsymbol [between] [rel] [ma] ["47]
-\definemathsymbol [blacktriangledown] [ord] [ma] ["48]
-\definemathsymbol [blacktriangleright] [rel] [ma] ["49]
-\definemathsymbol [blacktriangleleft] [rel] [ma] ["4A]
-\definemathsymbol [vartriangle] [rel] [ma] ["4D]
-\definemathsymbol [triangleup] [ord] [ma] ["4D] % vartriangle
-\definemathsymbol [blacktriangle] [ord] [ma] ["4E]
-\definemathsymbol [triangledown] [ord] [ma] ["4F]
-\definemathsymbol [eqcirc] [rel] [ma] ["50]
-\definemathsymbol [lesseqgtr] [rel] [ma] ["51]
-\definemathsymbol [gtreqless] [rel] [ma] ["52]
-\definemathsymbol [lesseqqgtr] [rel] [ma] ["53]
-\definemathsymbol [gtreqqless] [rel] [ma] ["54]
-\definemathsymbol [Rrightarrow] [rel] [ma] ["56]
-\definemathsymbol [Lleftarrow] [rel] [ma] ["57]
-\definemathsymbol [veebar] [bin] [ma] ["59]
-\definemathsymbol [barwedge] [bin] [ma] ["5A]
-\definemathsymbol [doublebarwedge] [bin] [ma] ["5B]
-\definemathsymbol [angle] [ord] [ma] ["5C]
-\definemathsymbol [measuredangle] [ord] [ma] ["5D]
-\definemathsymbol [sphericalangle] [ord] [ma] ["5E]
-\definemathsymbol [varpropto] [rel] [ma] ["5F]
-\definemathsymbol [smallsmile] [rel] [ma] ["60]
-\definemathsymbol [smallfrown] [rel] [ma] ["61]
-\definemathsymbol [Subset] [rel] [ma] ["62]
-\definemathsymbol [Supset] [rel] [ma] ["63]
-\definemathsymbol [Cup] [bin] [ma] ["64]
-\definemathsymbol [doublecup] [bin] [ma] ["64] % Cup
-\definemathsymbol [Cap] [bin] [ma] ["65]
-\definemathsymbol [doublecap] [bin] [ma] ["65]
-\definemathsymbol [curlywedge] [bin] [ma] ["66]
-\definemathsymbol [curlyvee] [bin] [ma] ["67]
-\definemathsymbol [leftthreetimes] [bin] [ma] ["68]
-\definemathsymbol [rightthreetimes] [bin] [ma] ["69]
-\definemathsymbol [subseteqq] [rel] [ma] ["6A]
-\definemathsymbol [supseteqq] [rel] [ma] ["6B]
-\definemathsymbol [bumpeq] [rel] [ma] ["6C]
-\definemathsymbol [Bumpeq] [rel] [ma] ["6D]
-\definemathsymbol [llless] [rel] [ma] ["6E]
-\definemathsymbol [lll] [rel] [ma] ["6E] % llless
-\definemathsymbol [gggtr] [rel] [ma] ["6F]
-\definemathsymbol [ggg] [rel] [ma] ["6F] % gggtr
-\definemathsymbol [ulcorner] [open] [ma] ["70] [ma] ["70]
-\definemathsymbol [urcorner] [close] [ma] ["71] [ma] ["71]
-\definemathsymbol [circledS] [ord] [ma] ["73]
-\definemathsymbol [pitchfork] [rel] [ma] ["74]
-\definemathsymbol [dotplus] [bin] [ma] ["75]
-\definemathsymbol [backsim] [rel] [ma] ["76]
-\definemathsymbol [backsimeq] [rel] [ma] ["77]
-\definemathsymbol [llcorner] [open] [ma] ["78] [ma] ["78]
-\definemathsymbol [lrcorner] [close] [ma] ["79] [ma] ["79]
-\definemathsymbol [complement] [ord] [ma] ["7B]
-\definemathsymbol [intercal] [bin] [ma] ["7C]
-\definemathsymbol [circledcirc] [bin] [ma] ["7D]
-\definemathsymbol [circledast] [bin] [ma] ["7E]
-\definemathsymbol [circleddash] [bin] [ma] ["7F]
-
-\stopmathcollection
-
-\startmathcollection [default]
-
-\definemathcommand [integers] {\blackboard{Z}}
-\definemathcommand [reals] {\blackboard{R}}
-\definemathcommand [rationals] {\blackboard{Q}}
-\definemathcommand [naturalnumbers] {\blackboard{N}}
-\definemathcommand [complexes] {\blackboard{C}}
-\definemathcommand [primes] {\blackboard{P}}
-
-\stopmathcollection
-
-\startmathcollection [default]
-
-\definemathsymbol [lvertneqq] [rel] [mb] ["00]
-\definemathsymbol [gvertneqq] [rel] [mb] ["01]
-\definemathsymbol [nleq] [rel] [mb] ["02]
-\definemathsymbol [ngeq] [rel] [mb] ["03]
-\definemathsymbol [nless] [rel] [mb] ["04]
-\definemathsymbol [ngtr] [rel] [mb] ["05]
-\definemathsymbol [nprec] [rel] [mb] ["06]
-\definemathsymbol [nsucc] [rel] [mb] ["07]
-\definemathsymbol [lneqq] [rel] [mb] ["08]
-\definemathsymbol [gneqq] [rel] [mb] ["09]
-\definemathsymbol [nleqslant] [rel] [mb] ["0A]
-\definemathsymbol [ngeqslant] [rel] [mb] ["0B]
-\definemathsymbol [lneq] [rel] [mb] ["0C]
-\definemathsymbol [gneq] [rel] [mb] ["0D]
-\definemathsymbol [npreceq] [rel] [mb] ["0E]
-\definemathsymbol [nsucceq] [rel] [mb] ["0F]
-\definemathsymbol [precnsim] [rel] [mb] ["10]
-\definemathsymbol [succnsim] [rel] [mb] ["11]
-\definemathsymbol [lnsim] [rel] [mb] ["12]
-\definemathsymbol [gnsim] [rel] [mb] ["13]
-\definemathsymbol [nleqq] [rel] [mb] ["14]
-\definemathsymbol [ngeqq] [rel] [mb] ["15]
-\definemathsymbol [precneqq] [rel] [mb] ["16]
-\definemathsymbol [succneqq] [rel] [mb] ["17]
-\definemathsymbol [precnapprox] [rel] [mb] ["18]
-\definemathsymbol [succnapprox] [rel] [mb] ["19]
-\definemathsymbol [lnapprox] [rel] [mb] ["1A]
-\definemathsymbol [gnapprox] [rel] [mb] ["1B]
-\definemathsymbol [nsim] [rel] [mb] ["1C]
-\definemathsymbol [ncong] [rel] [mb] ["1D]
-\definemathsymbol [diagup] [ord] [mb] ["1E]
-\definemathsymbol [diagdown] [ord] [mb] ["1F]
-\definemathsymbol [varsubsetneq] [rel] [mb] ["20]
-\definemathsymbol [varsupsetneq] [rel] [mb] ["21]
-\definemathsymbol [nsubseteqq] [rel] [mb] ["22]
-\definemathsymbol [nsupseteqq] [rel] [mb] ["23]
-\definemathsymbol [subsetneqq] [rel] [mb] ["24]
-\definemathsymbol [supsetneqq] [rel] [mb] ["25]
-\definemathsymbol [varsubsetneqq] [rel] [mb] ["26]
-\definemathsymbol [varsupsetneqq] [rel] [mb] ["27]
-\definemathsymbol [subsetneq] [rel] [mb] ["28]
-\definemathsymbol [supsetneq] [rel] [mb] ["29]
-\definemathsymbol [nsubseteq] [rel] [mb] ["2A]
-\definemathsymbol [nsupseteq] [rel] [mb] ["2B]
-\definemathsymbol [nparallel] [rel] [mb] ["2C]
-\definemathsymbol [nmid] [rel] [mb] ["2D]
-\definemathsymbol [nshortmid] [rel] [mb] ["2E]
-\definemathsymbol [nshortparallel] [rel] [mb] ["2F]
-\definemathsymbol [nvdash] [rel] [mb] ["30]
-\definemathsymbol [nVdash] [rel] [mb] ["31]
-\definemathsymbol [nvDash] [rel] [mb] ["32]
-\definemathsymbol [nVDash] [rel] [mb] ["33]
-\definemathsymbol [ntrianglerighteq] [rel] [mb] ["34]
-\definemathsymbol [ntrianglelefteq] [rel] [mb] ["35]
-\definemathsymbol [ntriangleleft] [rel] [mb] ["36]
-\definemathsymbol [ntriangleright] [rel] [mb] ["37]
-\definemathsymbol [nleftarrow] [rel] [mb] ["38]
-\definemathsymbol [nrightarrow] [rel] [mb] ["39]
-\definemathsymbol [nLeftarrow] [rel] [mb] ["3A]
-\definemathsymbol [nRightarrow] [rel] [mb] ["3B]
-\definemathsymbol [nLeftrightarrow] [rel] [mb] ["3C]
-\definemathsymbol [nleftrightarrow] [rel] [mb] ["3D]
-\definemathsymbol [divideontimes] [bin] [mb] ["3E]
-\definemathsymbol [varnothing] [ord] [mb] ["3F]
-\definemathsymbol [nexists] [ord] [mb] ["40]
-\definemathsymbol [Finv] [ord] [mb] ["60]
-\definemathsymbol [Game] [ord] [mb] ["61]
-\definemathsymbol [mho] [ord] [mb] ["66]
-\definemathsymbol [eth] [ord] [mb] ["67]
-\definemathsymbol [eqsim] [rel] [mb] ["68]
-\definemathsymbol [beth] [ord] [mb] ["69]
-\definemathsymbol [gimel] [ord] [mb] ["6A]
-\definemathsymbol [daleth] [ord] [mb] ["6B]
-\definemathsymbol [lessdot] [bin] [mb] ["6C]
-\definemathsymbol [gtrdot] [bin] [mb] ["6D]
-\definemathsymbol [ltimes] [bin] [mb] ["6E]
-\definemathsymbol [rtimes] [bin] [mb] ["6F]
-\definemathsymbol [shortmid] [rel] [mb] ["70]
-\definemathsymbol [shortparallel] [rel] [mb] ["71]
-\definemathsymbol [smallsetminus] [bin] [mb] ["72]
-\definemathsymbol [thicksim] [rel] [mb] ["73]
-\definemathsymbol [thickapprox] [rel] [mb] ["74]
-\definemathsymbol [approxeq] [rel] [mb] ["75]
-\definemathsymbol [succapprox] [rel] [mb] ["76]
-\definemathsymbol [precapprox] [rel] [mb] ["77]
-\definemathsymbol [curvearrowleft] [rel] [mb] ["78]
-\definemathsymbol [curvearrowright] [rel] [mb] ["79]
-\definemathsymbol [digamma] [ord] [mb] ["7A]
-\definemathsymbol [varkappa] [ord] [mb] ["7B]
-\definemathsymbol [Bbbk] [ord] [mb] ["7C]
-\definemathsymbol [hslash] [ord] [mb] ["7D]
-\definemathsymbol [hbar] [ord] [mb] ["7E]
-\definemathsymbol [backepsilon] [rel] [mb] ["7F]
-
-\stopmathcollection
-
-\startmathcollection [default]
-
-\definemathcommand [yen] [nothing] {\mathhexbox{\hexmafam}55}
-\definemathcommand [checkmark] [nothing] {\mathhexbox{\hexmafam}58}
-\definemathcommand [circledR] [nothing] {\mathhexbox{\hexmafam}72}
-\definemathcommand [maltese] [nothing] {\mathhexbox{\hexmafam}7A}
-
-\stopmathcollection
-
-\startmathcollection [default]
-
-\definemathcommand [dashrightarrow] [rel] {\dabar@\dabar@ \mathchar"0C4B}
-\definemathcommand [dashleftarrow] [rel] {\mathchar"0C4C\dabar@ \dabar@}
-\definemathcommand [dasharrow] [rel] {\dabar@\dabar@ \mathchar"0C4B}
-\definemathcommand [Join] [rel] {\mathchar"0D6F\mkern-13.8mu\mathchar"0D6E}
-\definemathcommand [implies] [rel] {\;\Longrightarrow\;}
-\definemathcommand [impliedby] [rel] {\;\Longleftarrow\;}
-\definemathcommand [And] [rel] {\;\internalAnd\;}
-
-\stopmathcollection
-
-\def\AMSwidehat#1%
- {\setbox\scratchbox\hbox{$\mathsurround\zeropoint#1$}%
- \ifdim\wd\scratchbox>2em
- \mathaccent"0\purefamilyhex{mb}5B{#1}%
- \else
- \mathaccent"0\purefamilyhex{ex}62{#1}%
- \fi}
-
-\def\AMSwidetilde#1%
- {\setbox\scratchbox\hbox{$\mathsurround\zeropoint#1$}%
- \ifdim\wd\scratchbox>2em
- \mathaccent"0\purefamilyhex{mb}5D{#1}%
- \else
- \mathaccent"0\purefamilyhex{ex}65{#1}%
- \fi}
-
-\startmathcollection [default]
-
-\definemathcommand [widehat] {\AMSwidehat}
-\definemathcommand [widetilde] {\AMSwidetilde}
-
-\stopmathcollection
-
-\protect \endinput
diff --git a/tex/context/base/math-cow.mkii b/tex/context/base/math-cow.mkii
new file mode 100644
index 000000000..f0fc811c8
--- /dev/null
+++ b/tex/context/base/math-cow.mkii
@@ -0,0 +1,31 @@
+%D \module
+%D [ file=math-cow,
+%D version=2006.06.23,
+%D title=\CONTEXT\ Math Macros,
+%D subtitle=Cow Math,
+%D author={Hans Hagen \& Taco Hoekwater},
+%D date=\currentdate,
+%D copyright=\PRAGMA]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+\def\COWsqrt {\mthsqrt{\char"7A}{\char"7B}}
+\def\COWfrac {\mthfrac{\char"7C}{\char"7A}{\char"7B}}
+\def\COWarrowfill{\mtharrowfill 1001}
+
+\startmathcollection [cow]
+ % todo
+\stopmathcollection
+
+\startrawmathcollection[cow]
+ \definemathcommand [frac] {\COWfrac}
+ \definemathcommand [sqrt] {\COWsqrt}
+ %definemathcommand [r@@t] {\COWroot}
+ %definemathcommand [matrix] {\COWmatrix}
+\stoprawmathcollection
+
+\protect \endinput
diff --git a/tex/context/base/math-cow.tex b/tex/context/base/math-cow.tex
deleted file mode 100644
index f0fc811c8..000000000
--- a/tex/context/base/math-cow.tex
+++ /dev/null
@@ -1,31 +0,0 @@
-%D \module
-%D [ file=math-cow,
-%D version=2006.06.23,
-%D title=\CONTEXT\ Math Macros,
-%D subtitle=Cow Math,
-%D author={Hans Hagen \& Taco Hoekwater},
-%D date=\currentdate,
-%D copyright=\PRAGMA]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\unprotect
-
-\def\COWsqrt {\mthsqrt{\char"7A}{\char"7B}}
-\def\COWfrac {\mthfrac{\char"7C}{\char"7A}{\char"7B}}
-\def\COWarrowfill{\mtharrowfill 1001}
-
-\startmathcollection [cow]
- % todo
-\stopmathcollection
-
-\startrawmathcollection[cow]
- \definemathcommand [frac] {\COWfrac}
- \definemathcommand [sqrt] {\COWsqrt}
- %definemathcommand [r@@t] {\COWroot}
- %definemathcommand [matrix] {\COWmatrix}
-\stoprawmathcollection
-
-\protect \endinput
diff --git a/tex/context/base/math-def.mkiv b/tex/context/base/math-def.mkiv
index 9e6ad28c1..0438777fa 100644
--- a/tex/context/base/math-def.mkiv
+++ b/tex/context/base/math-def.mkiv
@@ -132,7 +132,7 @@
\def\setoperatorlimits#1#2% operator limits
{\savenormalmeaning{#1}%
- \def#1{\getvalue{normal\strippedcsname#1}#2}}
+ \def#1{\csname normal\strippedcsname#1\endcsname#2}}
\setoperatorlimits\int \intlimits
\setoperatorlimits\iint \intlimits
diff --git a/tex/context/base/math-eul.mkii b/tex/context/base/math-eul.mkii
new file mode 100644
index 000000000..7552957a8
--- /dev/null
+++ b/tex/context/base/math-eul.mkii
@@ -0,0 +1,277 @@
+%D \module
+%D [ file=math-eul,
+%D version=2003.02.03,
+%D title=\CONTEXT\ Math Macros,
+%D subtitle=Virtual Euler Specials,
+%D author={Hans Hagen \& Taco Hoekwater \& Adam Lindsay},
+%D date=\currentdate,
+%D copyright=\PRAGMA]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details. Further modified by Adam Lindsay.
+
+\unprotect
+
+%D We follow the following mappings from type-eul:
+%D
+%D mr [MathRoman] [Euler-Roman] [zeurm10]
+
+%D mi [MathItalic] [Euler-Italic] [eufm10]
+
+%D ex [MathExtension] [Euler-Extension] [zeuex10]
+%D sy [MathSymbol] [Euler-Symbol] [zeusm10]
+
+%D mb [MathBeta] [Charter-Roman] [bchr8r] XXX
+%D mc [MathGamma] [Euler-Fraktur] [eufm10] XXX
+%D
+%D The inclusion of Bitstream Charter was originally for the text accents.
+%D Obviously, it's not a proper ``MathBeta'' font.
+
+%D The varrho and varsigma characters don't exist in eulervm,
+%D so we point at the normal types.
+
+\definefamilysynonym [eul] [calligraphic] [sy]
+\definefamilysynonym [eul] [oldstyle] [mi]
+\definefamilysynonym [eul] [gothic] [mi]
+\definefamilysynonym [eul] [fraktur] [mi]
+
+\definefamilysynonym [eul] [lcgreek] [mr]
+\definefamilysynonym [eul] [ucgreek] [mr]
+\definefamilysynonym [eul] [vargreek] [mr]
+
+%% Well, you don't know until you try!
+%\definefamilysynonym [eul] [accents] [Serif]
+
+\startmathcollection [eul]
+
+\definemathsymbol [varrho] [nothing] [vargreek] ["1A]
+\definemathsymbol [varsigma] [nothing] [vargreek] ["1B]
+
+%D Changes necessitated by collapsing mr \& mi into one:
+\definemathsymbol [imath] [nothing] [mr] ["7B]
+\definemathsymbol [jmath] [nothing] [mr] ["7C]
+\definemathsymbol [ell] [nothing] [mr] ["60]
+\definemathsymbol [wp] [nothing] [mr] ["7D]
+\definemathsymbol [partial] [nothing] [mr] ["40]
+
+\definemathsymbol [flat] [ord] [mr] ["5B]
+\definemathsymbol [natural] [ord] [mr] ["5C]
+\definemathsymbol [sharp] [ord] [mr] ["5D]
+
+\definemathsymbol [triangleleft] [bin] [mr] ["2F]
+\definemathsymbol [triangleright][bin] [mr] ["2E]
+
+\definemathsymbol [star] [bin] [mr] ["3F]
+
+\definemathsymbol [smile] [rel] [mr] ["5E]
+\definemathsymbol [frown] [rel] [mr] ["5F]
+\definemathsymbol [leftharpoonup] [rel] [mr] ["28]
+\definemathsymbol [leftharpoondown] [rel] [mr] ["29]
+\definemathsymbol [rightharpoonup] [rel] [mr] ["2A]
+\definemathsymbol [rightharpoondown] [rel] [mr] ["2B]
+\definemathsymbol [lhook] [rel] [mr] ["2C]
+\definemathsymbol [rhook] [rel] [mr] ["2D]
+
+\definemathsymbol [mathperiod] [ord] [mr] ["3A]
+\definemathsymbol [textperiod] [punct] [mr] ["3A]
+
+\definemathsymbol [mathcomma] [ord] [mr] ["3B]
+\definemathsymbol [textcomma] [punct] [mr] ["3B]
+
+\definemathsymbol [ldotp] [punct] [mr] ["3A]
+
+% extras from AMS:
+\definemathsymbol [hslash] [ord] [mr] ["80] %beauty over truth
+
+\stopmathcollection
+
+\startmathcollection [eul]
+% Ugh. no way around this to keep it compact in the font defs.
+
+\definemathcharacter [a] [alpha] [mr] ["61]
+\definemathcharacter [b] [alpha] [mr] ["62]
+\definemathcharacter [c] [alpha] [mr] ["63]
+\definemathcharacter [d] [alpha] [mr] ["64]
+\definemathcharacter [e] [alpha] [mr] ["65]
+\definemathcharacter [f] [alpha] [mr] ["66]
+\definemathcharacter [g] [alpha] [mr] ["67]
+\definemathcharacter [h] [alpha] [mr] ["68]
+\definemathcharacter [i] [alpha] [mr] ["69]
+\definemathcharacter [j] [alpha] [mr] ["6A]
+\definemathcharacter [k] [alpha] [mr] ["6B]
+\definemathcharacter [l] [alpha] [mr] ["6C]
+\definemathcharacter [m] [alpha] [mr] ["6D]
+\definemathcharacter [n] [alpha] [mr] ["6E]
+\definemathcharacter [o] [alpha] [mr] ["6F]
+\definemathcharacter [p] [alpha] [mr] ["70]
+\definemathcharacter [q] [alpha] [mr] ["71]
+\definemathcharacter [r] [alpha] [mr] ["72]
+\definemathcharacter [s] [alpha] [mr] ["73]
+\definemathcharacter [t] [alpha] [mr] ["74]
+\definemathcharacter [u] [alpha] [mr] ["75]
+\definemathcharacter [v] [alpha] [mr] ["76]
+\definemathcharacter [w] [alpha] [mr] ["77]
+\definemathcharacter [x] [alpha] [mr] ["78]
+\definemathcharacter [y] [alpha] [mr] ["79]
+\definemathcharacter [z] [alpha] [mr] ["7A]
+
+\definemathcharacter [A] [alpha] [mr] ["41]
+\definemathcharacter [B] [alpha] [mr] ["42]
+\definemathcharacter [C] [alpha] [mr] ["43]
+\definemathcharacter [D] [alpha] [mr] ["44]
+\definemathcharacter [E] [alpha] [mr] ["45]
+\definemathcharacter [F] [alpha] [mr] ["46]
+\definemathcharacter [G] [alpha] [mr] ["47]
+\definemathcharacter [H] [alpha] [mr] ["48]
+\definemathcharacter [I] [alpha] [mr] ["49]
+\definemathcharacter [J] [alpha] [mr] ["4A]
+\definemathcharacter [K] [alpha] [mr] ["4B]
+\definemathcharacter [L] [alpha] [mr] ["4C]
+\definemathcharacter [M] [alpha] [mr] ["4D]
+\definemathcharacter [N] [alpha] [mr] ["4E]
+\definemathcharacter [O] [alpha] [mr] ["4F]
+\definemathcharacter [P] [alpha] [mr] ["50]
+\definemathcharacter [Q] [alpha] [mr] ["51]
+\definemathcharacter [R] [alpha] [mr] ["52]
+\definemathcharacter [S] [alpha] [mr] ["53]
+\definemathcharacter [T] [alpha] [mr] ["54]
+\definemathcharacter [U] [alpha] [mr] ["55]
+\definemathcharacter [V] [alpha] [mr] ["56]
+\definemathcharacter [W] [alpha] [mr] ["57]
+\definemathcharacter [X] [alpha] [mr] ["58]
+\definemathcharacter [Y] [alpha] [mr] ["59]
+\definemathcharacter [Z] [alpha] [mr] ["5A]
+
+\stopmathcollection
+
+\startmathcollection [eul]
+
+\definemathcharacter [!] [close] [sy] ["A1]
+\definemathcharacter [(] [open] [sy] ["A8]
+\definemathcharacter [)] [close] [sy] ["A9]
+\definemathcharacter [+] [bin] [sy] ["AB]
+\definemathcharacter [:] [rel] [sy] ["BA]
+\definemathcharacter [;] [punct] [sy] ["BB]
+\definemathcharacter [=] [rel] [sy] ["BD]
+\definemathcharacter [?] [close] [sy] ["BF]
+\definemathcharacter [91] [open] [sy] ["DB] % [
+\definemathcharacter [93] [close] [sy] ["DD] % ]
+
+\definemathcharacter [,] [punct] [mr] ["3B]
+\definemathcharacter [.] [ord] [mr] ["3A]
+\definemathcharacter [/] [ord] [mr] ["3D]
+\definemathcharacter [<] [rel] [mr] ["3C]
+\definemathcharacter [>] [rel] [mr] ["3E]
+
+\stopmathcollection
+
+\startmathcollection [eul]
+
+\definemathcharacter [(] [nothing] [sy] ["A8] [ex] ["00]
+\definemathcharacter [)] [nothing] [sy] ["A9] [ex] ["01]
+\definemathcharacter [91] [nothing] [sy] ["DB] [ex] ["02] % [
+\definemathcharacter [93] [nothing] [sy] ["DD] [ex] ["03] % ]
+\definemathcharacter [/] [nothing] [mr] ["3D] [ex] ["0E]
+
+\stopmathcollection
+
+\startmathcollection [eul]
+
+\definemathsymbol [hbar] [nothing] [mr] ["80]
+
+\stopmathcollection
+
+\startmathcollection [eul]
+
+\definemathsymbol [ddagger] [bin] [sy] ["7A]
+\definemathsymbol [dagger] [bin] [sy] ["79]
+
+\stopmathcollection
+
+\startmathcollection [eul]
+
+\definemathsymbol [colon] [punct] [sy] ["BA]
+
+\stopmathcollection
+
+%D This used to be very hackish; it brought in text
+%D accents from the well-matched Bitstream Charter.
+
+%D But now, these characters don't exist. I would prefer to pull
+%D them from the text font, but I don't know how.
+%D Instead, I'm just pointing to null characters!
+
+\startmathcollection [eul]
+
+\definemathsymbol [acute] [accent] [mr] ["90]
+\definemathsymbol [grave] [accent] [mr] ["91]
+\definemathsymbol [ddot] [accent] [mr] ["92]
+\definemathsymbol [tilde] [accent] [mr] ["93]
+\definemathsymbol [bar] [accent] [mr] ["94]
+\definemathsymbol [breve] [accent] [mr] ["95]
+\definemathsymbol [check] [accent] [mr] ["96]
+\definemathsymbol [hat] [accent] [mr] ["97]
+\definemathsymbol [dot] [accent] [mr] ["98]
+%\definemathsymbol [acute] [accent] [accents] ["B4]
+%\definemathsymbol [grave] [accent] [accents] ["1E]
+%\definemathsymbol [ddot] [accent] [accents] ["A8]
+%\definemathsymbol [tilde] [accent] [accents] ["98]
+%\definemathsymbol [bar] [accent] [accents] ["AF]
+%\definemathsymbol [breve] [accent] [accents] ["0B]
+%\definemathsymbol [check] [accent] [accents] ["10]
+%\definemathsymbol [hat] [accent] [accents] ["5E]
+%\definemathsymbol [dot] [accent] [accents] ["01]
+
+\definemathsymbol [vec] [accent] [mr] ["7E] % [ord]
+\definemathsymbol [hat] [accent] [sy] ["DE]
+
+\stopmathcollection
+
+\startmathcollection [eul]
+
+\definemathsymbol [lgroup] [open] [sy] ["A8] [ex] ["3A] % ?
+\definemathsymbol [rgroup] [close] [sy] ["A9] [ex] ["3B] % ?
+
+\stopmathcollection
+
+\startmathcollection [eul]
+
+\definemathsymbol [dag] [box] [sy] ["79]
+\definemathsymbol [ddag] [box] [sy] ["7A]
+\definemathsymbol [S] [box] [sy] ["78]
+\definemathsymbol [P] [box] [sy] ["7B]
+
+\stopmathcollection
+
+%D Aditya's additionl definitions:
+
+\startmathcollection[eul:texnansi]
+ \definemathsymbol [acute] [accent] [tf] ["13]
+ \definemathsymbol [grave] [accent] [tf] ["12]
+ \definemathsymbol [ddot] [accent] [tf] ["A8]
+ \definemathsymbol [tilde] [accent] [tf] ["98]
+ \definemathsymbol [bar] [accent] [tf] ["16]
+ \definemathsymbol [breve] [accent] [tf] ["15]
+ \definemathsymbol [check] [accent] [tf] ["14]
+ \definemathsymbol [hat] [accent] [tf] ["88]
+ \definemathsymbol [dot] [accent] [tf] ["5]
+ % Why is mathring not defined??
+ \definemathsymbol [mathring] [accent] [tf] ["17]
+\stopmathcollection
+
+\startmathcollection[eul:ec]
+ \definemathsymbol [acute] [accent] [tf] ["1]
+ \definemathsymbol [grave] [accent] [tf] ["0]
+ \definemathsymbol [ddot] [accent] [tf] ["4]
+ \definemathsymbol [tilde] [accent] [tf] ["3]
+ \definemathsymbol [bar] [accent] [tf] ["9]
+ \definemathsymbol [breve] [accent] [tf] ["8]
+ \definemathsymbol [check] [accent] [tf] ["7]
+ \definemathsymbol [hat] [accent] [tf] ["2]
+ \definemathsymbol [dot] [accent] [tf] ["A]
+ % Why is mathring not defined??
+ \definemathsymbol [mathring] [accent] [tf] ["6]
+\stopmathcollection
+
+\protect \endinput
diff --git a/tex/context/base/math-eul.tex b/tex/context/base/math-eul.tex
deleted file mode 100644
index 7552957a8..000000000
--- a/tex/context/base/math-eul.tex
+++ /dev/null
@@ -1,277 +0,0 @@
-%D \module
-%D [ file=math-eul,
-%D version=2003.02.03,
-%D title=\CONTEXT\ Math Macros,
-%D subtitle=Virtual Euler Specials,
-%D author={Hans Hagen \& Taco Hoekwater \& Adam Lindsay},
-%D date=\currentdate,
-%D copyright=\PRAGMA]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details. Further modified by Adam Lindsay.
-
-\unprotect
-
-%D We follow the following mappings from type-eul:
-%D
-%D mr [MathRoman] [Euler-Roman] [zeurm10]
-
-%D mi [MathItalic] [Euler-Italic] [eufm10]
-
-%D ex [MathExtension] [Euler-Extension] [zeuex10]
-%D sy [MathSymbol] [Euler-Symbol] [zeusm10]
-
-%D mb [MathBeta] [Charter-Roman] [bchr8r] XXX
-%D mc [MathGamma] [Euler-Fraktur] [eufm10] XXX
-%D
-%D The inclusion of Bitstream Charter was originally for the text accents.
-%D Obviously, it's not a proper ``MathBeta'' font.
-
-%D The varrho and varsigma characters don't exist in eulervm,
-%D so we point at the normal types.
-
-\definefamilysynonym [eul] [calligraphic] [sy]
-\definefamilysynonym [eul] [oldstyle] [mi]
-\definefamilysynonym [eul] [gothic] [mi]
-\definefamilysynonym [eul] [fraktur] [mi]
-
-\definefamilysynonym [eul] [lcgreek] [mr]
-\definefamilysynonym [eul] [ucgreek] [mr]
-\definefamilysynonym [eul] [vargreek] [mr]
-
-%% Well, you don't know until you try!
-%\definefamilysynonym [eul] [accents] [Serif]
-
-\startmathcollection [eul]
-
-\definemathsymbol [varrho] [nothing] [vargreek] ["1A]
-\definemathsymbol [varsigma] [nothing] [vargreek] ["1B]
-
-%D Changes necessitated by collapsing mr \& mi into one:
-\definemathsymbol [imath] [nothing] [mr] ["7B]
-\definemathsymbol [jmath] [nothing] [mr] ["7C]
-\definemathsymbol [ell] [nothing] [mr] ["60]
-\definemathsymbol [wp] [nothing] [mr] ["7D]
-\definemathsymbol [partial] [nothing] [mr] ["40]
-
-\definemathsymbol [flat] [ord] [mr] ["5B]
-\definemathsymbol [natural] [ord] [mr] ["5C]
-\definemathsymbol [sharp] [ord] [mr] ["5D]
-
-\definemathsymbol [triangleleft] [bin] [mr] ["2F]
-\definemathsymbol [triangleright][bin] [mr] ["2E]
-
-\definemathsymbol [star] [bin] [mr] ["3F]
-
-\definemathsymbol [smile] [rel] [mr] ["5E]
-\definemathsymbol [frown] [rel] [mr] ["5F]
-\definemathsymbol [leftharpoonup] [rel] [mr] ["28]
-\definemathsymbol [leftharpoondown] [rel] [mr] ["29]
-\definemathsymbol [rightharpoonup] [rel] [mr] ["2A]
-\definemathsymbol [rightharpoondown] [rel] [mr] ["2B]
-\definemathsymbol [lhook] [rel] [mr] ["2C]
-\definemathsymbol [rhook] [rel] [mr] ["2D]
-
-\definemathsymbol [mathperiod] [ord] [mr] ["3A]
-\definemathsymbol [textperiod] [punct] [mr] ["3A]
-
-\definemathsymbol [mathcomma] [ord] [mr] ["3B]
-\definemathsymbol [textcomma] [punct] [mr] ["3B]
-
-\definemathsymbol [ldotp] [punct] [mr] ["3A]
-
-% extras from AMS:
-\definemathsymbol [hslash] [ord] [mr] ["80] %beauty over truth
-
-\stopmathcollection
-
-\startmathcollection [eul]
-% Ugh. no way around this to keep it compact in the font defs.
-
-\definemathcharacter [a] [alpha] [mr] ["61]
-\definemathcharacter [b] [alpha] [mr] ["62]
-\definemathcharacter [c] [alpha] [mr] ["63]
-\definemathcharacter [d] [alpha] [mr] ["64]
-\definemathcharacter [e] [alpha] [mr] ["65]
-\definemathcharacter [f] [alpha] [mr] ["66]
-\definemathcharacter [g] [alpha] [mr] ["67]
-\definemathcharacter [h] [alpha] [mr] ["68]
-\definemathcharacter [i] [alpha] [mr] ["69]
-\definemathcharacter [j] [alpha] [mr] ["6A]
-\definemathcharacter [k] [alpha] [mr] ["6B]
-\definemathcharacter [l] [alpha] [mr] ["6C]
-\definemathcharacter [m] [alpha] [mr] ["6D]
-\definemathcharacter [n] [alpha] [mr] ["6E]
-\definemathcharacter [o] [alpha] [mr] ["6F]
-\definemathcharacter [p] [alpha] [mr] ["70]
-\definemathcharacter [q] [alpha] [mr] ["71]
-\definemathcharacter [r] [alpha] [mr] ["72]
-\definemathcharacter [s] [alpha] [mr] ["73]
-\definemathcharacter [t] [alpha] [mr] ["74]
-\definemathcharacter [u] [alpha] [mr] ["75]
-\definemathcharacter [v] [alpha] [mr] ["76]
-\definemathcharacter [w] [alpha] [mr] ["77]
-\definemathcharacter [x] [alpha] [mr] ["78]
-\definemathcharacter [y] [alpha] [mr] ["79]
-\definemathcharacter [z] [alpha] [mr] ["7A]
-
-\definemathcharacter [A] [alpha] [mr] ["41]
-\definemathcharacter [B] [alpha] [mr] ["42]
-\definemathcharacter [C] [alpha] [mr] ["43]
-\definemathcharacter [D] [alpha] [mr] ["44]
-\definemathcharacter [E] [alpha] [mr] ["45]
-\definemathcharacter [F] [alpha] [mr] ["46]
-\definemathcharacter [G] [alpha] [mr] ["47]
-\definemathcharacter [H] [alpha] [mr] ["48]
-\definemathcharacter [I] [alpha] [mr] ["49]
-\definemathcharacter [J] [alpha] [mr] ["4A]
-\definemathcharacter [K] [alpha] [mr] ["4B]
-\definemathcharacter [L] [alpha] [mr] ["4C]
-\definemathcharacter [M] [alpha] [mr] ["4D]
-\definemathcharacter [N] [alpha] [mr] ["4E]
-\definemathcharacter [O] [alpha] [mr] ["4F]
-\definemathcharacter [P] [alpha] [mr] ["50]
-\definemathcharacter [Q] [alpha] [mr] ["51]
-\definemathcharacter [R] [alpha] [mr] ["52]
-\definemathcharacter [S] [alpha] [mr] ["53]
-\definemathcharacter [T] [alpha] [mr] ["54]
-\definemathcharacter [U] [alpha] [mr] ["55]
-\definemathcharacter [V] [alpha] [mr] ["56]
-\definemathcharacter [W] [alpha] [mr] ["57]
-\definemathcharacter [X] [alpha] [mr] ["58]
-\definemathcharacter [Y] [alpha] [mr] ["59]
-\definemathcharacter [Z] [alpha] [mr] ["5A]
-
-\stopmathcollection
-
-\startmathcollection [eul]
-
-\definemathcharacter [!] [close] [sy] ["A1]
-\definemathcharacter [(] [open] [sy] ["A8]
-\definemathcharacter [)] [close] [sy] ["A9]
-\definemathcharacter [+] [bin] [sy] ["AB]
-\definemathcharacter [:] [rel] [sy] ["BA]
-\definemathcharacter [;] [punct] [sy] ["BB]
-\definemathcharacter [=] [rel] [sy] ["BD]
-\definemathcharacter [?] [close] [sy] ["BF]
-\definemathcharacter [91] [open] [sy] ["DB] % [
-\definemathcharacter [93] [close] [sy] ["DD] % ]
-
-\definemathcharacter [,] [punct] [mr] ["3B]
-\definemathcharacter [.] [ord] [mr] ["3A]
-\definemathcharacter [/] [ord] [mr] ["3D]
-\definemathcharacter [<] [rel] [mr] ["3C]
-\definemathcharacter [>] [rel] [mr] ["3E]
-
-\stopmathcollection
-
-\startmathcollection [eul]
-
-\definemathcharacter [(] [nothing] [sy] ["A8] [ex] ["00]
-\definemathcharacter [)] [nothing] [sy] ["A9] [ex] ["01]
-\definemathcharacter [91] [nothing] [sy] ["DB] [ex] ["02] % [
-\definemathcharacter [93] [nothing] [sy] ["DD] [ex] ["03] % ]
-\definemathcharacter [/] [nothing] [mr] ["3D] [ex] ["0E]
-
-\stopmathcollection
-
-\startmathcollection [eul]
-
-\definemathsymbol [hbar] [nothing] [mr] ["80]
-
-\stopmathcollection
-
-\startmathcollection [eul]
-
-\definemathsymbol [ddagger] [bin] [sy] ["7A]
-\definemathsymbol [dagger] [bin] [sy] ["79]
-
-\stopmathcollection
-
-\startmathcollection [eul]
-
-\definemathsymbol [colon] [punct] [sy] ["BA]
-
-\stopmathcollection
-
-%D This used to be very hackish; it brought in text
-%D accents from the well-matched Bitstream Charter.
-
-%D But now, these characters don't exist. I would prefer to pull
-%D them from the text font, but I don't know how.
-%D Instead, I'm just pointing to null characters!
-
-\startmathcollection [eul]
-
-\definemathsymbol [acute] [accent] [mr] ["90]
-\definemathsymbol [grave] [accent] [mr] ["91]
-\definemathsymbol [ddot] [accent] [mr] ["92]
-\definemathsymbol [tilde] [accent] [mr] ["93]
-\definemathsymbol [bar] [accent] [mr] ["94]
-\definemathsymbol [breve] [accent] [mr] ["95]
-\definemathsymbol [check] [accent] [mr] ["96]
-\definemathsymbol [hat] [accent] [mr] ["97]
-\definemathsymbol [dot] [accent] [mr] ["98]
-%\definemathsymbol [acute] [accent] [accents] ["B4]
-%\definemathsymbol [grave] [accent] [accents] ["1E]
-%\definemathsymbol [ddot] [accent] [accents] ["A8]
-%\definemathsymbol [tilde] [accent] [accents] ["98]
-%\definemathsymbol [bar] [accent] [accents] ["AF]
-%\definemathsymbol [breve] [accent] [accents] ["0B]
-%\definemathsymbol [check] [accent] [accents] ["10]
-%\definemathsymbol [hat] [accent] [accents] ["5E]
-%\definemathsymbol [dot] [accent] [accents] ["01]
-
-\definemathsymbol [vec] [accent] [mr] ["7E] % [ord]
-\definemathsymbol [hat] [accent] [sy] ["DE]
-
-\stopmathcollection
-
-\startmathcollection [eul]
-
-\definemathsymbol [lgroup] [open] [sy] ["A8] [ex] ["3A] % ?
-\definemathsymbol [rgroup] [close] [sy] ["A9] [ex] ["3B] % ?
-
-\stopmathcollection
-
-\startmathcollection [eul]
-
-\definemathsymbol [dag] [box] [sy] ["79]
-\definemathsymbol [ddag] [box] [sy] ["7A]
-\definemathsymbol [S] [box] [sy] ["78]
-\definemathsymbol [P] [box] [sy] ["7B]
-
-\stopmathcollection
-
-%D Aditya's additionl definitions:
-
-\startmathcollection[eul:texnansi]
- \definemathsymbol [acute] [accent] [tf] ["13]
- \definemathsymbol [grave] [accent] [tf] ["12]
- \definemathsymbol [ddot] [accent] [tf] ["A8]
- \definemathsymbol [tilde] [accent] [tf] ["98]
- \definemathsymbol [bar] [accent] [tf] ["16]
- \definemathsymbol [breve] [accent] [tf] ["15]
- \definemathsymbol [check] [accent] [tf] ["14]
- \definemathsymbol [hat] [accent] [tf] ["88]
- \definemathsymbol [dot] [accent] [tf] ["5]
- % Why is mathring not defined??
- \definemathsymbol [mathring] [accent] [tf] ["17]
-\stopmathcollection
-
-\startmathcollection[eul:ec]
- \definemathsymbol [acute] [accent] [tf] ["1]
- \definemathsymbol [grave] [accent] [tf] ["0]
- \definemathsymbol [ddot] [accent] [tf] ["4]
- \definemathsymbol [tilde] [accent] [tf] ["3]
- \definemathsymbol [bar] [accent] [tf] ["9]
- \definemathsymbol [breve] [accent] [tf] ["8]
- \definemathsymbol [check] [accent] [tf] ["7]
- \definemathsymbol [hat] [accent] [tf] ["2]
- \definemathsymbol [dot] [accent] [tf] ["A]
- % Why is mathring not defined??
- \definemathsymbol [mathring] [accent] [tf] ["6]
-\stopmathcollection
-
-\protect \endinput
diff --git a/tex/context/base/math-fou.mkii b/tex/context/base/math-fou.mkii
new file mode 100644
index 000000000..8a72f1288
--- /dev/null
+++ b/tex/context/base/math-fou.mkii
@@ -0,0 +1,196 @@
+%D \module
+%D [ file=math-fou,
+%D version=2001.04.12,
+%D title=\CONTEXT\ Math Macros,
+%D subtitle=Fourier Specials,
+%D author={Michel Biovani \& Hans Hagen},
+%D date=\currentdate,
+%D copyright=\PRAGMA]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% see end of file for todo
+
+\unprotect
+
+\startmathcollection [fou]
+
+ \definemathsymbol [Gamma] [alpha] [mi] ["00]
+ \definemathsymbol [Delta] [alpha] [mi] ["01]
+ \definemathsymbol [Theta] [alpha] [mi] ["02]
+ \definemathsymbol [Lambda] [alpha] [mi] ["03]
+ \definemathsymbol [Xi] [alpha] [mi] ["04]
+ \definemathsymbol [Pi] [alpha] [mi] ["05]
+ \definemathsymbol [Sigma] [alpha] [mi] ["06]
+ \definemathsymbol [Upsilon] [alpha] [mi] ["07]
+ \definemathsymbol [Phi] [alpha] [mi] ["08]
+ \definemathsymbol [Psi] [alpha] [mi] ["09]
+ \definemathsymbol [Omega] [alpha] [mi] ["0A]
+
+\stopmathcollection
+
+\startmathcollection [fou]
+
+ \definemathcharacter [+] [bin] [sy] ["80]
+ \definemathcharacter [=] [rel] [sy] ["81]
+ \definemathcharacter [<] [rel] [sy] ["82]
+ \definemathcharacter [>] [rel] [sy] ["83]
+
+\stopmathcollection
+
+\startmathcollection [fou]
+
+ \definemathsymbol [leqslant] [rel] [sy] ["84]
+ \definemathsymbol [geqslant] [rel] [sy] ["85]
+ \definemathsymbol [parallelslant] [rel] [sy] ["86]
+ \definemathsymbol [thething] [ord] [sy] ["87]
+ \definemathsymbol [vDash] [rel] [sy] ["88]
+ \definemathsymbol [blacktriangleleft] [rel] [sy] ["89]
+ \definemathsymbol [blacktriangleright] [rel] [sy] ["8A]
+ \definemathsymbol [nleqslant] [rel] [sy] ["8B]
+ \definemathsymbol [ngeqslant] [rel] [sy] ["8C]
+ \definemathsymbol [parallel] [rel] [sy] ["8D]
+ \definemathsymbol [nparallel] [rel] [sy] ["8E]
+ \definemathsymbol [nparallelslant] [rel] [sy] ["8F]
+ \definemathsymbol [nvDash] [rel] [sy] ["90]
+ \definemathsymbol [intercal] [bin] [sy] ["91]
+ \definemathsymbol [hslash] [ord] [sy] ["92]
+ \definemathsymbol [nexists] [ord] [sy] ["93]
+ \definemathsymbol [varsubsetneq] [rel] [sy] ["93]
+
+\stopmathcollection
+
+\startmathcollection [fou]
+
+ \definemathcharacter [(] [nothing] [mr] ["28] [ex] ["A1]
+ \definemathcharacter [)] [nothing] [mr] ["29] [ex] ["A2]
+ \definemathcharacter [91] [nothing] [mr] ["5B] [ex] ["A3] % [
+ \definemathcharacter [93] [nothing] [mr] ["5D] [ex] ["A4] % ]
+ \definemathcharacter [/] [nothing] [mr] ["2F] [ex] ["B1]
+
+ \definemathcharacter [124] [nothing] [sy] ["6A] [ex] ["AF] % |
+ \definemathcharacter [92] [nothing] [sy] ["6E] [ex] ["B2] % \
+
+\stopmathcollection
+
+\startmathcollection [fou]
+
+ \definemathsymbol [Vert] [nothing] [sy] ["6B] [ex] ["B0]
+ \definemathsymbol [vert] [nothing] [sy] ["6A] [ex] ["AF]
+ \definemathsymbol [VERT] [nothing] [sy] ["98] [ex] ["93]
+ \definemathsymbol [Downarrow] [rel] [sy] ["2B] [ex] ["C4]
+ \definemathsymbol [backslash] [nothing] [sy] ["6E] [ex] ["B2]
+ \definemathsymbol [rangle] [close] [sy] ["69] [ex] ["AE]
+ \definemathsymbol [langle] [open] [sy] ["68] [ex] ["AD]
+ \definemathsymbol [rbrace] [close] [sy] ["67] [ex] ["AA]
+ \definemathsymbol [lbrace] [open] [sy] ["66] [ex] ["A9]
+ \definemathsymbol [rceil] [close] [sy] ["65] [ex] ["A8]
+ \definemathsymbol [lceil] [open] [sy] ["64] [ex] ["A7]
+ \definemathsymbol [rfloor] [close] [sy] ["63] [ex] ["A6]
+ \definemathsymbol [lfloor] [open] [sy] ["62] [ex] ["A5]
+ \definemathsymbol [dblbrackleft] [open] [sy] ["99] [ex] ["85]
+ \definemathsymbol [dblbrackright] [close] [sy] ["9A] [ex] ["86]
+
+\stopmathcollection
+
+\startmathcollection [fou]
+
+ \definemathsymbol [varkappa] [ord] [mi] ["80] % check this
+ \definemathsymbol [varvarrho] [ord] [mi] ["81] % check this
+ \definemathsymbol [xswordsup] [ord] [sy] ["96]
+ \definemathsymbol [xswordsdown] [ord] [sy] ["97]
+ \definemathsymbol [notowns] [rel] [sy] ["9C]
+ \definemathsymbol [hbar] [ord] [sy] ["9D]
+ \definemathsymbol [smallsetminus] [bin] [sy] ["9E]
+
+\stopmathcollection
+
+\startmathcollection [fou]
+
+ \definemathsymbol [notin] [rel] [sy] ["9B]
+
+\stopmathcollection
+
+\startmathcollection [fou]
+
+ \definemathsymbol [iintop] [op] [ex] ["CE]
+ \definemathsymbol [iiintop] [op] [ex] ["D0]
+ \definemathsymbol [oiintop] [op] [ex] ["D2]
+ \definemathsymbol [oiiintop] [op] [ex] ["D4]
+ \definemathsymbol [slashintop] [op] [ex] ["D6]
+
+\stopmathcollection
+
+\startmathcollection [fou]
+
+ \definemathcommand [iint] {\iintop \nolimits}
+ \definemathcommand [iiint] {\iiintop \nolimits}
+ \definemathcommand [oiint] {\oiintop \nolimits}
+ \definemathcommand [oiiint] {\oiiintop \nolimits}
+ \definemathcommand [slashint] {\slashintop\nolimits}
+
+\stopmathcollection
+
+\startmathcollection [fou]
+
+ \definemathsymbol [acute] [accent] [mr] ["1]
+ \definemathsymbol [grave] [accent] [mr] ["0]
+ \definemathsymbol [ddot] [accent] [mr] ["4]
+ \definemathsymbol [tilde] [accent] [mr] ["3]
+ \definemathsymbol [bar] [accent] [mr] ["9]
+ \definemathsymbol [breve] [accent] [mr] ["8]
+ \definemathsymbol [check] [accent] [mr] ["7]
+ \definemathsymbol [hat] [accent] [mr] ["2]
+ \definemathsymbol [dot] [accent] [mr] ["A]
+ \definemathsymbol [mathring] [accent] [mr] ["6]
+
+\stopmathcollection
+
+\startmathcollection [fou]
+
+ \definemathsymbol [otheralpha] [ord] [mi] ["0B]
+ \definemathsymbol [otherbeta] [ord] [mi] ["0C]
+ \definemathsymbol [othergamma] [ord] [mi] ["0D]
+ \definemathsymbol [otherdelta] [ord] [mi] ["0E]
+ \definemathsymbol [otherepsilon] [ord] [mi] ["0F]
+ \definemathsymbol [otherzeta] [ord] [mi] ["10]
+
+\stopmathcollection
+
+\protect \endinput
+
+% from a mail of Michel B / todo
+
+% \definemathsymbol [acute] [accent] [operators] ["1]
+% \definemathsymbol [grave] [accent] [operators] ["0]
+% \definemathsymbol [ddot] [accent] [operators] ["4]
+% \definemathsymbol [tilde] [accent] [operators] ["3]
+% \definemathsymbol [bar] [accent] [operators] ["9]
+% \definemathsymbol [breve] [accent] [operators] ["8]
+% \definemathsymbol [check] [accent] [operators] ["7]
+% \definemathsymbol [hat] [accent] [operators] ["2]
+% \definemathsymbol [dot] [accent] [operators] ["A]
+% \definemathsymbol [mathring] [accent] [operators] ["6]
+
+% \definemathsymbol [wideparen] [ord] [largesymbols] ["94]
+% \definemathsymbol [widearc] [accent] [largesymbols] ["D8]
+
+% check for definition of \overset (ams)
+
+% \def\FOUwidering#1%
+% {\overset{\smash{\vbox to .2ex{\hbox{$\mathring{}$}}}}{\wideparen{#1}}}
+
+% \startmathcollection [default] % [ams]
+%
+% \definemathcommand [widering] {\FOUwidering}
+%
+% \stopmathcollection
+
+% \definemathsymbol [otheralpha] [ord] [otherletters] ["0B]
+% \definemathsymbol [otherbeta] [ord] [otherletters] ["0C]
+% \definemathsymbol [othergamma] [ord] [otherletters] ["0D]
+% \definemathsymbol [otherdelta] [ord] [otherletters] ["0E]
+% \definemathsymbol [otherepsilon] [ord] [otherletters] ["0F]
+% \definemathsymbol [otherzeta] [ord] [otherletters] ["10]
diff --git a/tex/context/base/math-fou.tex b/tex/context/base/math-fou.tex
deleted file mode 100644
index 8a72f1288..000000000
--- a/tex/context/base/math-fou.tex
+++ /dev/null
@@ -1,196 +0,0 @@
-%D \module
-%D [ file=math-fou,
-%D version=2001.04.12,
-%D title=\CONTEXT\ Math Macros,
-%D subtitle=Fourier Specials,
-%D author={Michel Biovani \& Hans Hagen},
-%D date=\currentdate,
-%D copyright=\PRAGMA]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-% see end of file for todo
-
-\unprotect
-
-\startmathcollection [fou]
-
- \definemathsymbol [Gamma] [alpha] [mi] ["00]
- \definemathsymbol [Delta] [alpha] [mi] ["01]
- \definemathsymbol [Theta] [alpha] [mi] ["02]
- \definemathsymbol [Lambda] [alpha] [mi] ["03]
- \definemathsymbol [Xi] [alpha] [mi] ["04]
- \definemathsymbol [Pi] [alpha] [mi] ["05]
- \definemathsymbol [Sigma] [alpha] [mi] ["06]
- \definemathsymbol [Upsilon] [alpha] [mi] ["07]
- \definemathsymbol [Phi] [alpha] [mi] ["08]
- \definemathsymbol [Psi] [alpha] [mi] ["09]
- \definemathsymbol [Omega] [alpha] [mi] ["0A]
-
-\stopmathcollection
-
-\startmathcollection [fou]
-
- \definemathcharacter [+] [bin] [sy] ["80]
- \definemathcharacter [=] [rel] [sy] ["81]
- \definemathcharacter [<] [rel] [sy] ["82]
- \definemathcharacter [>] [rel] [sy] ["83]
-
-\stopmathcollection
-
-\startmathcollection [fou]
-
- \definemathsymbol [leqslant] [rel] [sy] ["84]
- \definemathsymbol [geqslant] [rel] [sy] ["85]
- \definemathsymbol [parallelslant] [rel] [sy] ["86]
- \definemathsymbol [thething] [ord] [sy] ["87]
- \definemathsymbol [vDash] [rel] [sy] ["88]
- \definemathsymbol [blacktriangleleft] [rel] [sy] ["89]
- \definemathsymbol [blacktriangleright] [rel] [sy] ["8A]
- \definemathsymbol [nleqslant] [rel] [sy] ["8B]
- \definemathsymbol [ngeqslant] [rel] [sy] ["8C]
- \definemathsymbol [parallel] [rel] [sy] ["8D]
- \definemathsymbol [nparallel] [rel] [sy] ["8E]
- \definemathsymbol [nparallelslant] [rel] [sy] ["8F]
- \definemathsymbol [nvDash] [rel] [sy] ["90]
- \definemathsymbol [intercal] [bin] [sy] ["91]
- \definemathsymbol [hslash] [ord] [sy] ["92]
- \definemathsymbol [nexists] [ord] [sy] ["93]
- \definemathsymbol [varsubsetneq] [rel] [sy] ["93]
-
-\stopmathcollection
-
-\startmathcollection [fou]
-
- \definemathcharacter [(] [nothing] [mr] ["28] [ex] ["A1]
- \definemathcharacter [)] [nothing] [mr] ["29] [ex] ["A2]
- \definemathcharacter [91] [nothing] [mr] ["5B] [ex] ["A3] % [
- \definemathcharacter [93] [nothing] [mr] ["5D] [ex] ["A4] % ]
- \definemathcharacter [/] [nothing] [mr] ["2F] [ex] ["B1]
-
- \definemathcharacter [124] [nothing] [sy] ["6A] [ex] ["AF] % |
- \definemathcharacter [92] [nothing] [sy] ["6E] [ex] ["B2] % \
-
-\stopmathcollection
-
-\startmathcollection [fou]
-
- \definemathsymbol [Vert] [nothing] [sy] ["6B] [ex] ["B0]
- \definemathsymbol [vert] [nothing] [sy] ["6A] [ex] ["AF]
- \definemathsymbol [VERT] [nothing] [sy] ["98] [ex] ["93]
- \definemathsymbol [Downarrow] [rel] [sy] ["2B] [ex] ["C4]
- \definemathsymbol [backslash] [nothing] [sy] ["6E] [ex] ["B2]
- \definemathsymbol [rangle] [close] [sy] ["69] [ex] ["AE]
- \definemathsymbol [langle] [open] [sy] ["68] [ex] ["AD]
- \definemathsymbol [rbrace] [close] [sy] ["67] [ex] ["AA]
- \definemathsymbol [lbrace] [open] [sy] ["66] [ex] ["A9]
- \definemathsymbol [rceil] [close] [sy] ["65] [ex] ["A8]
- \definemathsymbol [lceil] [open] [sy] ["64] [ex] ["A7]
- \definemathsymbol [rfloor] [close] [sy] ["63] [ex] ["A6]
- \definemathsymbol [lfloor] [open] [sy] ["62] [ex] ["A5]
- \definemathsymbol [dblbrackleft] [open] [sy] ["99] [ex] ["85]
- \definemathsymbol [dblbrackright] [close] [sy] ["9A] [ex] ["86]
-
-\stopmathcollection
-
-\startmathcollection [fou]
-
- \definemathsymbol [varkappa] [ord] [mi] ["80] % check this
- \definemathsymbol [varvarrho] [ord] [mi] ["81] % check this
- \definemathsymbol [xswordsup] [ord] [sy] ["96]
- \definemathsymbol [xswordsdown] [ord] [sy] ["97]
- \definemathsymbol [notowns] [rel] [sy] ["9C]
- \definemathsymbol [hbar] [ord] [sy] ["9D]
- \definemathsymbol [smallsetminus] [bin] [sy] ["9E]
-
-\stopmathcollection
-
-\startmathcollection [fou]
-
- \definemathsymbol [notin] [rel] [sy] ["9B]
-
-\stopmathcollection
-
-\startmathcollection [fou]
-
- \definemathsymbol [iintop] [op] [ex] ["CE]
- \definemathsymbol [iiintop] [op] [ex] ["D0]
- \definemathsymbol [oiintop] [op] [ex] ["D2]
- \definemathsymbol [oiiintop] [op] [ex] ["D4]
- \definemathsymbol [slashintop] [op] [ex] ["D6]
-
-\stopmathcollection
-
-\startmathcollection [fou]
-
- \definemathcommand [iint] {\iintop \nolimits}
- \definemathcommand [iiint] {\iiintop \nolimits}
- \definemathcommand [oiint] {\oiintop \nolimits}
- \definemathcommand [oiiint] {\oiiintop \nolimits}
- \definemathcommand [slashint] {\slashintop\nolimits}
-
-\stopmathcollection
-
-\startmathcollection [fou]
-
- \definemathsymbol [acute] [accent] [mr] ["1]
- \definemathsymbol [grave] [accent] [mr] ["0]
- \definemathsymbol [ddot] [accent] [mr] ["4]
- \definemathsymbol [tilde] [accent] [mr] ["3]
- \definemathsymbol [bar] [accent] [mr] ["9]
- \definemathsymbol [breve] [accent] [mr] ["8]
- \definemathsymbol [check] [accent] [mr] ["7]
- \definemathsymbol [hat] [accent] [mr] ["2]
- \definemathsymbol [dot] [accent] [mr] ["A]
- \definemathsymbol [mathring] [accent] [mr] ["6]
-
-\stopmathcollection
-
-\startmathcollection [fou]
-
- \definemathsymbol [otheralpha] [ord] [mi] ["0B]
- \definemathsymbol [otherbeta] [ord] [mi] ["0C]
- \definemathsymbol [othergamma] [ord] [mi] ["0D]
- \definemathsymbol [otherdelta] [ord] [mi] ["0E]
- \definemathsymbol [otherepsilon] [ord] [mi] ["0F]
- \definemathsymbol [otherzeta] [ord] [mi] ["10]
-
-\stopmathcollection
-
-\protect \endinput
-
-% from a mail of Michel B / todo
-
-% \definemathsymbol [acute] [accent] [operators] ["1]
-% \definemathsymbol [grave] [accent] [operators] ["0]
-% \definemathsymbol [ddot] [accent] [operators] ["4]
-% \definemathsymbol [tilde] [accent] [operators] ["3]
-% \definemathsymbol [bar] [accent] [operators] ["9]
-% \definemathsymbol [breve] [accent] [operators] ["8]
-% \definemathsymbol [check] [accent] [operators] ["7]
-% \definemathsymbol [hat] [accent] [operators] ["2]
-% \definemathsymbol [dot] [accent] [operators] ["A]
-% \definemathsymbol [mathring] [accent] [operators] ["6]
-
-% \definemathsymbol [wideparen] [ord] [largesymbols] ["94]
-% \definemathsymbol [widearc] [accent] [largesymbols] ["D8]
-
-% check for definition of \overset (ams)
-
-% \def\FOUwidering#1%
-% {\overset{\smash{\vbox to .2ex{\hbox{$\mathring{}$}}}}{\wideparen{#1}}}
-
-% \startmathcollection [default] % [ams]
-%
-% \definemathcommand [widering] {\FOUwidering}
-%
-% \stopmathcollection
-
-% \definemathsymbol [otheralpha] [ord] [otherletters] ["0B]
-% \definemathsymbol [otherbeta] [ord] [otherletters] ["0C]
-% \definemathsymbol [othergamma] [ord] [otherletters] ["0D]
-% \definemathsymbol [otherdelta] [ord] [otherletters] ["0E]
-% \definemathsymbol [otherepsilon] [ord] [otherletters] ["0F]
-% \definemathsymbol [otherzeta] [ord] [otherletters] ["10]
diff --git a/tex/context/base/math-frc.mkiv b/tex/context/base/math-frc.mkiv
index d40306199..2305cec30 100644
--- a/tex/context/base/math-frc.mkiv
+++ b/tex/context/base/math-frc.mkiv
@@ -126,21 +126,21 @@
% let's see who complains ... \mathstyle is now a primitive
%
% \unexpanded\def\ch#1%
-% {\ifundefined\@@chemicalletter
-% \mathstyle{\rm#1}%
-% \else
+% {\ifdefined\@@chemicalletter
% \dosetsubscripts
% \mathstyle{\@@chemicalletter{#1}}%
% \doresetsubscripts
+% \else
+% \mathstyle{\rm#1}%
% \fi}
% \unexpanded\def\ch#1%
-% {\ifundefined\@@chemicalletter
-% \mathematics{\rm#1}%
-% \else
+% {\ifdefined\@@chemicalletter
% \dosetsubscripts
% \mathematics{\@@chemicalletter{#1}}%
% \doresetsubscripts
+% \else
+% \mathematics{\rm#1}%
% \fi}
%D \macros
diff --git a/tex/context/base/math-ini.mkii b/tex/context/base/math-ini.mkii
index 7d87fb365..6713987f7 100644
--- a/tex/context/base/math-ini.mkii
+++ b/tex/context/base/math-ini.mkii
@@ -386,7 +386,7 @@
\else
\edef\mathclass{#1}%
\fi
- \doinputonce{\truefilename{\f!mathprefix\mathclass}}%
+ \doinputonce{\truefilename{\f!mathprefix\mathclass}.mkii}%
\doifsomething\fontclass{\setevalue{\@mc@\fontclass\@mc@}{\mathclass}}%
\popmacro\mathclass
\popmacro\fontclass}
@@ -410,7 +410,7 @@
\def\resetmathcollection[#1]%
{\def\mathcollection{#1}%
- \forgetdoingonce{\f!mathprefix\mathcollection}%
+ \forgetdoingonce{\f!mathprefix\mathcollection.mkii}%
\setmathtoks
\ifx\mathtoks\relax\else\mathtoks\emptytoks\fi}
diff --git a/tex/context/base/math-inl.mkiv b/tex/context/base/math-inl.mkiv
index acbf02de7..93168b885 100644
--- a/tex/context/base/math-inl.mkiv
+++ b/tex/context/base/math-inl.mkiv
@@ -94,8 +94,7 @@
\setbox\nextbox\hbox{$#2$}%
\iftracegridsnapping
\setbox\nextbox\ruledhbox
- {\incolortrue\localcolortrue
- \backgroundline[gray]{\showstruts\strut\flushnextbox}}%
+ {\backgroundline[gray]{\showstruts\strut\flushnextbox}}%
\fi
\def\docommand##1%
{\doif{##1}-{\settrue \halfcrazymathlines}%
@@ -187,9 +186,7 @@
\forgetall
\crazymathindent
\iftracegridsnapping
- \setbox\scratchbox\hbox
- {\incolortrue\localcolortrue\green
- \ruledhbox{\box\scratchbox}}%
+ \setbox\scratchbox\hbox{\green\ruledhbox{\box\scratchbox}}%
\fi
\box\scratchbox
\endgraf
@@ -240,8 +237,7 @@
{\forgetall
\crazymathindent
\iftracegridsnapping
- \setbox\scratchbox\hbox
- {\incolortrue\localcolortrue\color[blue]{\ruledhbox{\box\scratchbox}}}%
+ \setbox\scratchbox\hbox{\blue\ruledhbox{\box\scratchbox}}%
\fi
\box\scratchbox
\endgraf
diff --git a/tex/context/base/math-lbr.mkii b/tex/context/base/math-lbr.mkii
new file mode 100644
index 000000000..7ac7c3aff
--- /dev/null
+++ b/tex/context/base/math-lbr.mkii
@@ -0,0 +1,450 @@
+%D \module
+%D [ file=math-lbr,
+%D version=2001.04.12,
+%D title=\CONTEXT\ Math Macros,
+%D subtitle=Lucida Specials,
+%D author={Hans Hagen \& Taco Hoekwater},
+%D date=\currentdate,
+%D copyright=\PRAGMA]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+\definefamilysynonym [lbr] [calligrapahy] [sy]
+\definefamilysynonym [lbr] [oldstyle] [mi]
+
+\definefamilysynonym [lbr] [blackboard] [ma]
+\definefamilysynonym [lbr] [ucgreek] [mb]
+\definefamilysynonym [lbr] [vargreek] [mi]
+
+\startmathcollection[lbr]
+
+\definemathsymbol [boxdot] [bin] [sy] ["ED]
+\definemathsymbol [boxplus] [bin] [sy] ["EA]
+\definemathsymbol [boxtimes] [bin] [sy] ["EC]
+\definemathsymbol [square] [ord] [ma] ["02]
+\definemathsymbol [Box] [ord] [ma] ["02] % square
+\definemathsymbol [blacksquare] [ord] [ma] ["03]
+\definemathsymbol [centerdot] [bin] [ma] ["E1] % [sy] ["01]
+\definemathsymbol [Diamond] [ord] [sy] ["05]
+\definemathsymbol [lozenge] [ord] [sy] ["05] % Diamond
+\definemathsymbol [blacklozenge] [ord] [ma] ["09]
+\definemathsymbol [circlearrowright] [rel] [ma] ["8C]
+\definemathsymbol [circlearrowleft] [rel] [ma] ["8B]
+\definemathsymbol [rightleftharpoons] [rel] [sy] ["8E]
+\definemathsymbol [leftrightharpoons] [rel] [sy] ["8D]
+\definemathsymbol [boxminus] [bin] [sy] ["EB]
+\definemathsymbol [Vdash] [rel] [sy] ["F0]
+\definemathsymbol [Vvdash] [rel] [mb] ["D3]
+\definemathsymbol [vDash] [rel] [mb] ["D6]
+\definemathsymbol [twoheadrightarrow] [rel] [ma] ["25]
+\definemathsymbol [twoheadleftarrow] [rel] [ma] ["23]
+\definemathsymbol [leftleftarrows] [rel] [ma] ["71]
+\definemathsymbol [rightrightarrows] [rel] [ma] ["73]
+\definemathsymbol [upuparrows] [rel] [ma] ["72]
+\definemathsymbol [downdownarrows] [rel] [ma] ["74]
+\definemathsymbol [upharpoonright] [rel] [ma] ["75]
+\definemathsymbol [restriction] [rel] [ma] ["77]
+\definemathsymbol [downharpoonright] [rel] [ma] ["77]
+\definemathsymbol [upharpoonleft] [rel] [ma] ["76]
+\definemathsymbol [downharpoonleft] [rel] [ma] ["78]
+\definemathsymbol [rightarrowtail] [rel] [ma] ["29]
+\definemathsymbol [leftarrowtail] [rel] [ma] ["28]
+\definemathsymbol [leftrightarrows] [rel] [ma] ["6E]
+\definemathsymbol [rightleftarrows] [rel] [ma] ["6D]
+\definemathsymbol [Lsh] [rel] [ma] ["7B]
+\definemathsymbol [Rsh] [rel] [ma] ["7D]
+\definemathsymbol [rightsquigarrow] [rel] [ma] ["8E]
+\definemathsymbol [leadsto] [rel] [ma] ["8E] % rightsquigarrow
+\definemathsymbol [leftrightsquigarrow] [rel] [ma] ["91]
+\definemathsymbol [looparrowleft] [rel] [ma] ["3F]
+\definemathsymbol [looparrowright] [rel] [ma] ["40]
+\definemathsymbol [circeq] [rel] [sy] ["D0]
+\definemathsymbol [succsim] [rel] [sy] ["E1]
+\definemathsymbol [gtrsim] [rel] [sy] ["DD]
+\definemathsymbol [gtrapprox] [rel] [mb] ["DB]
+\definemathsymbol [multimap] [rel] [mb] ["C7]
+\definemathsymbol [therefore] [rel] [sy] ["90]
+\definemathsymbol [because] [rel] [sy] ["91]
+\definemathsymbol [doteqdot] [rel] [sy] ["CA]
+\definemathsymbol [Doteq] [rel] [sy] ["CA] % doteqdot
+\definemathsymbol [triangleq] [rel] [sy] ["D5]
+\definemathsymbol [precsim] [rel] [sy] ["E0]
+\definemathsymbol [lesssim] [rel] [sy] ["DC]
+\definemathsymbol [lessapprox] [rel] [mb] ["DA]
+\definemathsymbol [eqslantless] [rel] [mb] ["E2]
+\definemathsymbol [eqslantgtr] [rel] [mb] ["E3]
+\definemathsymbol [curlyeqprec] [rel] [mb] ["E6]
+\definemathsymbol [curlyeqsucc] [rel] [mb] ["E7]
+\definemathsymbol [preccurlyeq] [rel] [mb] ["E4]
+\definemathsymbol [leqq] [rel] [sy] ["DA]
+\definemathsymbol [leqslant] [rel] [mb] ["E0]
+\definemathsymbol [lessgtr] [rel] [sy] ["DE]
+\definemathsymbol [backprime] [ord] [mb] ["C8]
+\definemathsymbol [dabar@] [ord] [ma] ["03] % !! @
+\definemathsymbol [risingdotseq] [rel] [sy] ["CC]
+\definemathsymbol [fallingdotseq] [rel] [sy] ["CB]
+\definemathsymbol [succcurlyeq] [rel] [mb] ["E5]
+\definemathsymbol [geqq] [rel] [sy] ["DB]
+\definemathsymbol [geqslant] [rel] [mb] ["E1]
+\definemathsymbol [gtrless] [rel] [sy] ["DF]
+\definemathsymbol [sqsubset] [rel] [sy] ["E4]
+\definemathsymbol [sqsupset] [rel] [sy] ["E5]
+\definemathsymbol [vartriangleright] [rel] [mb] ["2E]
+\definemathsymbol [rhd] [bin] [mb] ["2E]
+\definemathsymbol [lhd] [bin] [mb] ["2F]
+\definemathsymbol [vartriangleleft] [rel] [mb] ["2F]
+\definemathsymbol [trianglerighteq] [rel] [sy] ["F5]
+\definemathsymbol [unrhd] [bin] [sy] ["F5] % trianglerighteq
+\definemathsymbol [trianglelefteq] [rel] [sy] ["F4]
+\definemathsymbol [unlhd] [bin] [sy] ["F4] % trianglelefteq
+\definemathsymbol [bigstar] [ord] [ma] ["AB]
+\definemathsymbol [between] [rel] [mb] ["F2]
+\definemathsymbol [blacktriangledown] [ord] [ma] ["07]
+\definemathsymbol [blacktriangleright] [rel] [mb] ["F1]
+\definemathsymbol [blacktriangleleft] [rel] [mb] ["F0]
+\definemathsymbol [vartriangle] [rel] [ma] ["04]
+\definemathsymbol [triangleup] [ord] [ma] ["04] % vartriangle
+\definemathsymbol [blacktriangle] [ord] [ma] ["05]
+\definemathsymbol [triangledown] [ord] [ma] ["06]
+\definemathsymbol [eqcirc] [rel] [sy] ["CF]
+\definemathsymbol [lesseqgtr] [rel] [mb] ["E8]
+\definemathsymbol [gtreqless] [rel] [mb] ["E9]
+\definemathsymbol [lesseqqgtr] [rel] [mb] ["EA]
+\definemathsymbol [gtreqqless] [rel] [mb] ["EB]
+\definemathsymbol [Rrightarrow] [rel] [ma] ["6C]
+\definemathsymbol [Lleftarrow] [rel] [ma] ["6A]
+\definemathsymbol [veebar] [bin] [mb] ["D2]
+\definemathsymbol [barwedge] [bin] [sy] ["F6]
+\definemathsymbol [doublebarwedge] [bin] [sy] ["D4]
+\definemathsymbol [angle] [ord] [sy] ["8B]
+\definemathsymbol [measuredangle] [ord] [sy] ["8C]
+\definemathsymbol [sphericalangle] [ord] [sy] ["8D]
+\definemathsymbol [varpropto] [rel] [sy] ["2F]
+\definemathsymbol [smallsmile] [rel] [mb] ["5E]
+\definemathsymbol [smallfrown] [rel] [mb] ["5F]
+\definemathsymbol [Subset] [rel] [sy] ["F8]
+\definemathsymbol [Supset] [rel] [sy] ["F9]
+\definemathsymbol [Cup] [bin] [sy] ["FA]
+\definemathsymbol [doublecup] [bin] [sy] ["FA] % Cup
+\definemathsymbol [Cap] [bin] [sy] ["FB]
+\definemathsymbol [doublecap] [bin] [sy] ["FB]
+\definemathsymbol [curlywedge] [bin] [sy] ["84]
+\definemathsymbol [curlyvee] [bin] [sy] ["85]
+\definemathsymbol [leftthreetimes] [bin] [mb] ["D0]
+\definemathsymbol [rightthreetimes] [bin] [mb] ["D1]
+\definemathsymbol [subseteqq] [rel] [mb] ["EE]
+\definemathsymbol [supseteqq] [rel] [mb] ["EF]
+\definemathsymbol [bumpeq] [rel] [sy] ["C8]
+\definemathsymbol [Bumpeq] [rel] [sy] ["C7]
+\definemathsymbol [llless] [rel] [mb] ["DE]
+\definemathsymbol [lll] [rel] [mb] ["DE] % llless
+\definemathsymbol [gggtr] [rel] [mb] ["DF]
+\definemathsymbol [ggg] [rel] [mb] ["DF] % gggtr
+\definemathsymbol [ulcorner] [open] [ma] ["5B] [ma] ["5B]
+\definemathsymbol [urcorner] [close] [ma] ["5C] [ma] ["5C]
+\definemathsymbol [circledS] [ord] [mb] ["CA]
+\definemathsymbol [pitchfork] [rel] [ma] ["F3]
+\definemathsymbol [dotplus] [bin] [sy] ["89]
+\definemathsymbol [backsim] [rel] [sy] ["24]
+\definemathsymbol [backsimeq] [rel] [sy] ["27]
+\definemathsymbol [llcorner] [open] [ma] ["5D] [ma] ["5D]
+\definemathsymbol [lrcorner] [close] [ma] ["5E] [ma] ["5E]
+\definemathsymbol [complement] [ord] [mb] ["94]
+\definemathsymbol [intercal] [bin] [ma] ["03] % !!
+\definemathsymbol [circledcirc] [bin] [sy] ["E6]
+\definemathsymbol [circledast] [bin] [sy] ["E7]
+\definemathsymbol [circleddash] [bin] [mb] ["CC]
+
+\stopmathcollection
+
+\startmathcollection [lbr]
+
+\definemathsymbol [lvertneqq] [rel] [ma] ["DE]
+\definemathsymbol [gvertneqq] [rel] [ma] ["DE]
+\definemathsymbol [nleq] [rel] [ma] ["9C]
+\definemathsymbol [ngeq] [rel] [ma] ["9D]
+\definemathsymbol [nless] [rel] [ma] ["9A]
+\definemathsymbol [ngtr] [rel] [ma] ["9B]
+\definemathsymbol [nprec] [rel] [ma] ["E5]
+\definemathsymbol [nsucc] [rel] [ma] ["E6]
+\definemathsymbol [lneqq] [rel] [ma] ["DC]
+\definemathsymbol [gneqq] [rel] [ma] ["DE]
+\definemathsymbol [nleqslant] [rel] [ma] ["D6]
+\definemathsymbol [ngeqslant] [rel] [ma] ["D7]
+\definemathsymbol [lneq] [rel] [ma] ["DA]
+\definemathsymbol [gneq] [rel] [ma] ["DB]
+\definemathsymbol [npreceq] [rel] [ma] ["E7]
+\definemathsymbol [nsucceq] [rel] [ma] ["E8]
+\definemathsymbol [precnsim] [rel] [ma] ["EB]
+\definemathsymbol [succnsim] [rel] [ma] ["EC]
+\definemathsymbol [lnsim] [rel] [ma] ["E0]
+\definemathsymbol [gnsim] [rel] [ma] ["E2]
+\definemathsymbol [nleqq] [rel] [ma] ["D8]
+\definemathsymbol [ngeqq] [rel] [ma] ["D9]
+\definemathsymbol [precneqq] [rel] [ma] ["E9]
+\definemathsymbol [succneqq] [rel] [ma] ["EA]
+\definemathsymbol [precnapprox] [rel] [ma] ["ED]
+\definemathsymbol [succnapprox] [rel] [ma] ["EE]
+\definemathsymbol [lnapprox] [rel] [ma] ["E4]
+\definemathsymbol [gnapprox] [rel] [ma] ["E3]
+\definemathsymbol [nsim] [rel] [ma] ["96]
+\definemathsymbol [ncong] [rel] [ma] ["99]
+\definemathsymbol [diagup] [ord] [mb] ["CD]
+\definemathsymbol [diagdown] [ord] [mb] ["D8]
+\definemathsymbol [varsubsetneq] [rel] [ma] ["D0]
+\definemathsymbol [varsupsetneq] [rel] [ma] ["D1]
+\definemathsymbol [nsubseteqq] [rel] [ma] ["CA]
+\definemathsymbol [nsupseteqq] [rel] [ma] ["CB]
+\definemathsymbol [subsetneqq] [rel] [ma] ["CE]
+\definemathsymbol [supsetneqq] [rel] [ma] ["CF]
+\definemathsymbol [varsubsetneqq] [rel] [ma] ["D2]
+\definemathsymbol [varsupsetneqq] [rel] [ma] ["D3]
+\definemathsymbol [subsetneq] [rel] [ma] ["CC]
+\definemathsymbol [supsetneq] [rel] [ma] ["CD]
+\definemathsymbol [nsubseteq] [rel] [ma] ["C8]
+\definemathsymbol [nsupseteq] [rel] [ma] ["C9]
+\definemathsymbol [nparallel] [rel] [ma] ["F7]
+\definemathsymbol [nmid] [rel] [ma] ["F6]
+\definemathsymbol [nshortmid] [rel] [ma] ["F4]
+\definemathsymbol [nshortparallel] [rel] [ma] ["F5]
+\definemathsymbol [nvdash] [rel] [ma] ["F8]
+\definemathsymbol [nVdash] [rel] [ma] ["F9]
+\definemathsymbol [nvDash] [rel] [ma] ["FA]
+\definemathsymbol [nVDash] [rel] [ma] ["FB]
+\definemathsymbol [ntrianglerighteq] [rel] [ma] ["F2]
+\definemathsymbol [ntrianglelefteq] [rel] [ma] ["F1]
+\definemathsymbol [ntriangleleft] [rel] [ma] ["EF]
+\definemathsymbol [ntriangleright] [rel] [ma] ["F0]
+\definemathsymbol [nleftarrow] [rel] [ma] ["32]
+\definemathsymbol [nrightarrow] [rel] [ma] ["33]
+\definemathsymbol [nLeftarrow] [rel] [ma] ["66]
+\definemathsymbol [nRightarrow] [rel] [ma] ["68]
+\definemathsymbol [nLeftrightarrow] [rel] [ma] ["67]
+\definemathsymbol [nleftrightarrow] [rel] [ma] ["34]
+\definemathsymbol [divideontimes] [bin] [mb] ["F7]
+\definemathsymbol [varnothing] [ord] [sy] ["53]
+\definemathsymbol [nexists] [ord] [ma] ["20]
+\definemathsymbol [Finv] [ord] [mb] ["90]
+\definemathsymbol [Game] [ord] [mb] ["91]
+\definemathsymbol [mho] [ord] [mb] ["92]
+\definemathsymbol [eth] [ord] [ma] ["03] % !!
+\definemathsymbol [eqsim] [rel] [sy] ["99]
+\definemathsymbol [beth] [ord] [mb] ["95]
+\definemathsymbol [gimel] [ord] [mb] ["96]
+\definemathsymbol [daleth] [ord] [mb] ["97]
+\definemathsymbol [lessdot] [bin] [mb] ["DC]
+\definemathsymbol [gtrdot] [bin] [mb] ["DD]
+\definemathsymbol [ltimes] [bin] [mb] ["CF]
+\definemathsymbol [rtimes] [bin] [mb] ["CE]
+\definemathsymbol [shortmid] [rel] [mb] ["F4]
+\definemathsymbol [shortparallel] [rel] [mb] ["F5]
+\definemathsymbol [smallsetminus] [bin] [mb] ["D8]
+\definemathsymbol [thicksim] [rel] [sy] ["18] % not that thick
+\definemathsymbol [thickapprox] [rel] [sy] ["19] % not that thick
+\definemathsymbol [approxeq] [rel] [sy] ["9D]
+\definemathsymbol [succapprox] [rel] [mb] ["ED]
+\definemathsymbol [precapprox] [rel] [mb] ["EC]
+\definemathsymbol [curvearrowleft] [rel] [ma] ["87]
+\definemathsymbol [curvearrowright] [rel] [ma] ["88]
+\definemathsymbol [digamma] [ord] [ma] ["03] % !!
+\definemathsymbol [varkappa] [ord] [mb] ["9B]
+\definemathsymbol [Bbbk] [ord] [ma] ["6B]
+\definemathsymbol [hslash] [ord] [mb] ["9D]
+\definemathsymbol [hbar] [ord] [ma] ["1B]
+\definemathsymbol [backepsilon] [rel] [ma] ["03] % !!
+
+\stopmathcollection
+
+\startmathcollection [lbr]
+
+\definemathsymbol [yen] [nothing] [ma] ["03] % !!
+\definemathsymbol [checkmark] [nothing] [ma] ["AC]
+\definemathsymbol [circledR] [nothing] [mb] ["C9]
+\definemathsymbol [maltese] [nothing] [mb] ["CB]
+
+\stopmathcollection
+
+\startmathcollection [lbr]
+
+\definemathsymbol [dashrightarrow] [rel] [ma] ["3A]
+\definemathsymbol [dashleftarrow] [rel] [ma] ["38]
+\definemathcommand [dasharrow] [rel] {\dashleftarrow\mkern-15.8mu\dashrightarrow}
+%definemathcommand [Join] [rel] {\mathchar"0D6F\mkern-15.8mu\mathchar"0D6E} % !!
+
+\stopmathcollection
+
+\startmathcollection[lbr]
+
+\definemathcharacter [91] [open] [mi] ["86]
+\definemathcharacter [93] [close] [mi] ["87]
+\definemathcharacter [(] [open] [mi] ["84]
+\definemathcharacter [)] [close] [mi] ["85]
+\definemathcharacter [/] [nothing] [mi] ["3D]
+\definemathcharacter [=] [rel] [sy] ["83]
+\definemathcharacter [+] [bin] [sy] ["82]
+
+\definemathcharacter [91] [nothing] [mi] ["86] [ex] ["02]
+\definemathcharacter [93] [nothing] [mi] ["87] [ex] ["03]
+\definemathcharacter [(] [nothing] [mi] ["84] [ex] ["00]
+\definemathcharacter [)] [nothing] [mi] ["85] [ex] ["01]
+\definemathcharacter [/] [nothing] [mi] ["3D] [ex] ["0E]
+
+\stopmathcollection
+
+% \startmathcollection[lbr]
+%
+% \definemathcharacter [:] [punct] [tf] ["3A] % unbelievable
+% \definemathcharacter [;] [punct] [tf] ["3B] % unbelievable
+%
+% \stopmathcollection
+
+\startmathcollection[lbr]
+
+\definemathsymbol [ldbrack] [open] [mi] ["82] [ex] ["82]
+\definemathsymbol [rdbrack] [close] [mi] ["83] [ex] ["83]
+\definemathsymbol [surfintop] [op] [ex] ["90]
+\definemathsymbol [midintop] [op] [ex] ["92]
+\definemathsymbol [midointop] [op] [ex] ["93]
+\definemathsymbol [midsurfintop] [op] [ex] ["94]
+\definemathsymbol [largeint] [op] [ex] ["5A] [ex] ["95]
+
+% \definemathcommand [surfint] [nolop] {\surfintop}
+% \definemathcommand [midint] [nolop] {\midintop}
+% \definemathcommand [midoint] [nolop] {\midointop}
+% \definemathcommand [midsurfint] [nolop] {\midsurfintop}
+
+\definemathsymbol [surfint] [nolop] [ex] ["90]
+\definemathsymbol [midint] [nolop] [ex] ["92]
+\definemathsymbol [midoint] [nolop] [ex] ["93]
+\definemathsymbol [midsurfint] [nolop] [ex] ["94]
+
+\definemathsymbol [dblint] [ord] [mi] ["88]
+\definemathsymbol [trplint] [ord] [mi] ["89]
+\definemathsymbol [contint] [ord] [mi] ["8A]
+\definemathsymbol [surfint] [ord] [mi] ["8B]
+\definemathsymbol [volint] [ord] [mi] ["8C]
+\definemathsymbol [clwint] [ord] [mi] ["8D]
+\definemathsymbol [cclwcint] [ord] [mi] ["8E]
+\definemathsymbol [clwcint] [ord] [mi] ["8F]
+\definemathsymbol [bowtie] [rel] [mi] ["F6]
+\definemathsymbol [models] [rel] [sy] ["EE]
+\definemathsymbol [doteq] [rel] [sy] ["C9]
+\definemathsymbol [cong] [rel] [sy] ["9B]
+\definemathsymbol [hbar] [ord] [mi] ["9D]
+\definemathsymbol [neq] [rel] [ma] ["94]
+\definemathsymbol [rightleftharpoons] [rel] [ma] ["7A]
+\definemathsymbol [leftrightharpoons] [rel] [ma] ["79]
+\definemathsymbol [hookleftarrow] [rel] [ma] ["3C]
+\definemathsymbol [hookrightarrow] [rel] [ma] ["3E]
+\definemathsymbol [mapsto] [rel] [ma] ["2C]
+
+\definemathcommand [longmapsto] {\mapstochar\longrightarrow}
+
+\stopmathcollection
+
+\startmathcollection[lbr]
+
+\definemathsymbol [Gamma] [alpha] [ucgreek] ["00]
+\definemathsymbol [Delta] [alpha] [ucgreek] ["01]
+\definemathsymbol [Theta] [alpha] [ucgreek] ["02]
+\definemathsymbol [Lambda] [alpha] [ucgreek] ["03]
+\definemathsymbol [Xi] [alpha] [ucgreek] ["04]
+\definemathsymbol [Pi] [alpha] [ucgreek] ["05]
+\definemathsymbol [Sigma] [alpha] [ucgreek] ["06]
+\definemathsymbol [Upsilon] [alpha] [ucgreek] ["07]
+\definemathsymbol [Phi] [alpha] [ucgreek] ["08]
+\definemathsymbol [Psi] [alpha] [ucgreek] ["09]
+\definemathsymbol [Omega] [alpha] [ucgreek] ["0A]
+
+\definemathsymbol [varGamma] [ord] [vargreek] ["00]
+\definemathsymbol [varDelta] [ord] [vargreek] ["01]
+\definemathsymbol [varTheta] [ord] [vargreek] ["02]
+\definemathsymbol [varLambda] [ord] [vargreek] ["03]
+\definemathsymbol [varXi] [ord] [vargreek] ["04]
+\definemathsymbol [varPi] [ord] [vargreek] ["05]
+\definemathsymbol [varSigma] [ord] [vargreek] ["06]
+\definemathsymbol [varUpsilon] [ord] [vargreek] ["07]
+\definemathsymbol [varPhi] [ord] [vargreek] ["08]
+\definemathsymbol [varPsi] [ord] [vargreek] ["09]
+\definemathsymbol [varOmega] [ord] [vargreek] ["0A]
+
+\stopmathcollection
+
+% we define the whole lot, although only a few differ (esp dot)
+
+\startmathcollection[lbr]
+
+\definemathsymbol [acute] [accent] [tf] ["13] % mr -> tf
+\definemathsymbol [grave] [accent] [tf] ["12] % mr -> tf
+\definemathsymbol [ddot] [accent] [tf] ["7F] % mr -> tf
+\definemathsymbol [tilde] [accent] [tf] ["7E] % mr -> tf
+\definemathsymbol [bar] [accent] [tf] ["16] % mr -> tf
+\definemathsymbol [breve] [accent] [tf] ["15] % mr -> tf
+\definemathsymbol [check] [accent] [tf] ["14] % mr -> tf
+\definemathsymbol [hat] [accent] [tf] ["5E] % mr -> tf
+\definemathsymbol [vec] [accent] [mi] ["7E] % [ord]
+\definemathsymbol [dot] [accent] [tf] ["05] % mr -> tf, 5F -> 05
+\definemathsymbol [widetilde] [accent] [ex] ["65] % [ord]
+\definemathsymbol [widehat] [accent] [ex] ["62] % [ord]
+
+\stopmathcollection
+
+\def\LBRroot#1#2%
+ {\setbox\zerocount\hbox{$\mathsurround\zeropoint#1\sqrt{#2}$}
+ \dimen@\ht\zerocount \advance\dimen@-\dp\zerocount
+ \mkern5mu\raise.6\dimen@\copy\rootbox \mkern-7.5mu \box\zerocount}
+
+\def\LBRmatrix#1%
+ {\null\,\vcenter{\normalbaselines\mathsurround\zeropoint
+ \ialign{\hfil$##$\hfil&&\quad\hfil$##$\hfil\crcr
+ \mathstrut\crcr\noalign{\kern-0.9\baselineskip}
+ #1\crcr\mathstrut\crcr\noalign{\kern-0.9\baselineskip}}}\,}
+
+\startrawmathcollection[lbr]
+
+\definemathcommand [mathstrut] {\vphantom{f}}
+\definemathcommand [joinrel] {\mathrel{\mkern-4mu}}
+\definemathcommand [r@@t] {\LBRroot}
+\definemathcommand [matrix] {\LBRmatrix}
+
+\stoprawmathcollection
+
+\def\LBRbig {\@@dobig{8.20}}
+\def\LBRBig {\@@dobig{10.80}}
+\def\LBRbigg {\@@dobig{13.42}}
+\def\LBRBigg {\@@dobig{16.03}}
+\def\LBRbiggg{\@@dobig{17.72}}
+\def\LBRBiggg{\@@dobig{21.25}}
+
+% \def\LBRbig {\@@dobig{0.820}}
+% \def\LBRBig {\@@dobig{1.080}}
+% \def\LBRbigg {\@@dobig{1.342}}
+% \def\LBRBigg {\@@dobig{1.603}}
+% \def\LBRbiggg{\@@dobig{1.772}}
+% \def\LBRBiggg{\@@dobig{2.125}}
+
+\startrawmathcollection[lbr]
+
+\definemathcommand [big] {\LBRbig}
+\definemathcommand [Big] {\LBRBig}
+\definemathcommand [bigg] {\LBRbigg}
+\definemathcommand [Bigg] {\LBRBigg}
+\definemathcommand [biggg] {\LBRbiggg}
+\definemathcommand [Biggg] {\LBRBiggg}
+
+\stoprawmathcollection
+
+\startrawmathcollection[lbr]
+
+\definemathcommand [bigggl] [open] {\biggg}
+\definemathcommand [bigggr] [close] {\biggg}
+\definemathcommand [Bigggl] [open] {\Biggg}
+\definemathcommand [Bigggr] [close] {\Biggg}
+
+\stoprawmathcollection
+
+\protect \endinput
diff --git a/tex/context/base/math-lbr.tex b/tex/context/base/math-lbr.tex
deleted file mode 100644
index 7ac7c3aff..000000000
--- a/tex/context/base/math-lbr.tex
+++ /dev/null
@@ -1,450 +0,0 @@
-%D \module
-%D [ file=math-lbr,
-%D version=2001.04.12,
-%D title=\CONTEXT\ Math Macros,
-%D subtitle=Lucida Specials,
-%D author={Hans Hagen \& Taco Hoekwater},
-%D date=\currentdate,
-%D copyright=\PRAGMA]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\unprotect
-
-\definefamilysynonym [lbr] [calligrapahy] [sy]
-\definefamilysynonym [lbr] [oldstyle] [mi]
-
-\definefamilysynonym [lbr] [blackboard] [ma]
-\definefamilysynonym [lbr] [ucgreek] [mb]
-\definefamilysynonym [lbr] [vargreek] [mi]
-
-\startmathcollection[lbr]
-
-\definemathsymbol [boxdot] [bin] [sy] ["ED]
-\definemathsymbol [boxplus] [bin] [sy] ["EA]
-\definemathsymbol [boxtimes] [bin] [sy] ["EC]
-\definemathsymbol [square] [ord] [ma] ["02]
-\definemathsymbol [Box] [ord] [ma] ["02] % square
-\definemathsymbol [blacksquare] [ord] [ma] ["03]
-\definemathsymbol [centerdot] [bin] [ma] ["E1] % [sy] ["01]
-\definemathsymbol [Diamond] [ord] [sy] ["05]
-\definemathsymbol [lozenge] [ord] [sy] ["05] % Diamond
-\definemathsymbol [blacklozenge] [ord] [ma] ["09]
-\definemathsymbol [circlearrowright] [rel] [ma] ["8C]
-\definemathsymbol [circlearrowleft] [rel] [ma] ["8B]
-\definemathsymbol [rightleftharpoons] [rel] [sy] ["8E]
-\definemathsymbol [leftrightharpoons] [rel] [sy] ["8D]
-\definemathsymbol [boxminus] [bin] [sy] ["EB]
-\definemathsymbol [Vdash] [rel] [sy] ["F0]
-\definemathsymbol [Vvdash] [rel] [mb] ["D3]
-\definemathsymbol [vDash] [rel] [mb] ["D6]
-\definemathsymbol [twoheadrightarrow] [rel] [ma] ["25]
-\definemathsymbol [twoheadleftarrow] [rel] [ma] ["23]
-\definemathsymbol [leftleftarrows] [rel] [ma] ["71]
-\definemathsymbol [rightrightarrows] [rel] [ma] ["73]
-\definemathsymbol [upuparrows] [rel] [ma] ["72]
-\definemathsymbol [downdownarrows] [rel] [ma] ["74]
-\definemathsymbol [upharpoonright] [rel] [ma] ["75]
-\definemathsymbol [restriction] [rel] [ma] ["77]
-\definemathsymbol [downharpoonright] [rel] [ma] ["77]
-\definemathsymbol [upharpoonleft] [rel] [ma] ["76]
-\definemathsymbol [downharpoonleft] [rel] [ma] ["78]
-\definemathsymbol [rightarrowtail] [rel] [ma] ["29]
-\definemathsymbol [leftarrowtail] [rel] [ma] ["28]
-\definemathsymbol [leftrightarrows] [rel] [ma] ["6E]
-\definemathsymbol [rightleftarrows] [rel] [ma] ["6D]
-\definemathsymbol [Lsh] [rel] [ma] ["7B]
-\definemathsymbol [Rsh] [rel] [ma] ["7D]
-\definemathsymbol [rightsquigarrow] [rel] [ma] ["8E]
-\definemathsymbol [leadsto] [rel] [ma] ["8E] % rightsquigarrow
-\definemathsymbol [leftrightsquigarrow] [rel] [ma] ["91]
-\definemathsymbol [looparrowleft] [rel] [ma] ["3F]
-\definemathsymbol [looparrowright] [rel] [ma] ["40]
-\definemathsymbol [circeq] [rel] [sy] ["D0]
-\definemathsymbol [succsim] [rel] [sy] ["E1]
-\definemathsymbol [gtrsim] [rel] [sy] ["DD]
-\definemathsymbol [gtrapprox] [rel] [mb] ["DB]
-\definemathsymbol [multimap] [rel] [mb] ["C7]
-\definemathsymbol [therefore] [rel] [sy] ["90]
-\definemathsymbol [because] [rel] [sy] ["91]
-\definemathsymbol [doteqdot] [rel] [sy] ["CA]
-\definemathsymbol [Doteq] [rel] [sy] ["CA] % doteqdot
-\definemathsymbol [triangleq] [rel] [sy] ["D5]
-\definemathsymbol [precsim] [rel] [sy] ["E0]
-\definemathsymbol [lesssim] [rel] [sy] ["DC]
-\definemathsymbol [lessapprox] [rel] [mb] ["DA]
-\definemathsymbol [eqslantless] [rel] [mb] ["E2]
-\definemathsymbol [eqslantgtr] [rel] [mb] ["E3]
-\definemathsymbol [curlyeqprec] [rel] [mb] ["E6]
-\definemathsymbol [curlyeqsucc] [rel] [mb] ["E7]
-\definemathsymbol [preccurlyeq] [rel] [mb] ["E4]
-\definemathsymbol [leqq] [rel] [sy] ["DA]
-\definemathsymbol [leqslant] [rel] [mb] ["E0]
-\definemathsymbol [lessgtr] [rel] [sy] ["DE]
-\definemathsymbol [backprime] [ord] [mb] ["C8]
-\definemathsymbol [dabar@] [ord] [ma] ["03] % !! @
-\definemathsymbol [risingdotseq] [rel] [sy] ["CC]
-\definemathsymbol [fallingdotseq] [rel] [sy] ["CB]
-\definemathsymbol [succcurlyeq] [rel] [mb] ["E5]
-\definemathsymbol [geqq] [rel] [sy] ["DB]
-\definemathsymbol [geqslant] [rel] [mb] ["E1]
-\definemathsymbol [gtrless] [rel] [sy] ["DF]
-\definemathsymbol [sqsubset] [rel] [sy] ["E4]
-\definemathsymbol [sqsupset] [rel] [sy] ["E5]
-\definemathsymbol [vartriangleright] [rel] [mb] ["2E]
-\definemathsymbol [rhd] [bin] [mb] ["2E]
-\definemathsymbol [lhd] [bin] [mb] ["2F]
-\definemathsymbol [vartriangleleft] [rel] [mb] ["2F]
-\definemathsymbol [trianglerighteq] [rel] [sy] ["F5]
-\definemathsymbol [unrhd] [bin] [sy] ["F5] % trianglerighteq
-\definemathsymbol [trianglelefteq] [rel] [sy] ["F4]
-\definemathsymbol [unlhd] [bin] [sy] ["F4] % trianglelefteq
-\definemathsymbol [bigstar] [ord] [ma] ["AB]
-\definemathsymbol [between] [rel] [mb] ["F2]
-\definemathsymbol [blacktriangledown] [ord] [ma] ["07]
-\definemathsymbol [blacktriangleright] [rel] [mb] ["F1]
-\definemathsymbol [blacktriangleleft] [rel] [mb] ["F0]
-\definemathsymbol [vartriangle] [rel] [ma] ["04]
-\definemathsymbol [triangleup] [ord] [ma] ["04] % vartriangle
-\definemathsymbol [blacktriangle] [ord] [ma] ["05]
-\definemathsymbol [triangledown] [ord] [ma] ["06]
-\definemathsymbol [eqcirc] [rel] [sy] ["CF]
-\definemathsymbol [lesseqgtr] [rel] [mb] ["E8]
-\definemathsymbol [gtreqless] [rel] [mb] ["E9]
-\definemathsymbol [lesseqqgtr] [rel] [mb] ["EA]
-\definemathsymbol [gtreqqless] [rel] [mb] ["EB]
-\definemathsymbol [Rrightarrow] [rel] [ma] ["6C]
-\definemathsymbol [Lleftarrow] [rel] [ma] ["6A]
-\definemathsymbol [veebar] [bin] [mb] ["D2]
-\definemathsymbol [barwedge] [bin] [sy] ["F6]
-\definemathsymbol [doublebarwedge] [bin] [sy] ["D4]
-\definemathsymbol [angle] [ord] [sy] ["8B]
-\definemathsymbol [measuredangle] [ord] [sy] ["8C]
-\definemathsymbol [sphericalangle] [ord] [sy] ["8D]
-\definemathsymbol [varpropto] [rel] [sy] ["2F]
-\definemathsymbol [smallsmile] [rel] [mb] ["5E]
-\definemathsymbol [smallfrown] [rel] [mb] ["5F]
-\definemathsymbol [Subset] [rel] [sy] ["F8]
-\definemathsymbol [Supset] [rel] [sy] ["F9]
-\definemathsymbol [Cup] [bin] [sy] ["FA]
-\definemathsymbol [doublecup] [bin] [sy] ["FA] % Cup
-\definemathsymbol [Cap] [bin] [sy] ["FB]
-\definemathsymbol [doublecap] [bin] [sy] ["FB]
-\definemathsymbol [curlywedge] [bin] [sy] ["84]
-\definemathsymbol [curlyvee] [bin] [sy] ["85]
-\definemathsymbol [leftthreetimes] [bin] [mb] ["D0]
-\definemathsymbol [rightthreetimes] [bin] [mb] ["D1]
-\definemathsymbol [subseteqq] [rel] [mb] ["EE]
-\definemathsymbol [supseteqq] [rel] [mb] ["EF]
-\definemathsymbol [bumpeq] [rel] [sy] ["C8]
-\definemathsymbol [Bumpeq] [rel] [sy] ["C7]
-\definemathsymbol [llless] [rel] [mb] ["DE]
-\definemathsymbol [lll] [rel] [mb] ["DE] % llless
-\definemathsymbol [gggtr] [rel] [mb] ["DF]
-\definemathsymbol [ggg] [rel] [mb] ["DF] % gggtr
-\definemathsymbol [ulcorner] [open] [ma] ["5B] [ma] ["5B]
-\definemathsymbol [urcorner] [close] [ma] ["5C] [ma] ["5C]
-\definemathsymbol [circledS] [ord] [mb] ["CA]
-\definemathsymbol [pitchfork] [rel] [ma] ["F3]
-\definemathsymbol [dotplus] [bin] [sy] ["89]
-\definemathsymbol [backsim] [rel] [sy] ["24]
-\definemathsymbol [backsimeq] [rel] [sy] ["27]
-\definemathsymbol [llcorner] [open] [ma] ["5D] [ma] ["5D]
-\definemathsymbol [lrcorner] [close] [ma] ["5E] [ma] ["5E]
-\definemathsymbol [complement] [ord] [mb] ["94]
-\definemathsymbol [intercal] [bin] [ma] ["03] % !!
-\definemathsymbol [circledcirc] [bin] [sy] ["E6]
-\definemathsymbol [circledast] [bin] [sy] ["E7]
-\definemathsymbol [circleddash] [bin] [mb] ["CC]
-
-\stopmathcollection
-
-\startmathcollection [lbr]
-
-\definemathsymbol [lvertneqq] [rel] [ma] ["DE]
-\definemathsymbol [gvertneqq] [rel] [ma] ["DE]
-\definemathsymbol [nleq] [rel] [ma] ["9C]
-\definemathsymbol [ngeq] [rel] [ma] ["9D]
-\definemathsymbol [nless] [rel] [ma] ["9A]
-\definemathsymbol [ngtr] [rel] [ma] ["9B]
-\definemathsymbol [nprec] [rel] [ma] ["E5]
-\definemathsymbol [nsucc] [rel] [ma] ["E6]
-\definemathsymbol [lneqq] [rel] [ma] ["DC]
-\definemathsymbol [gneqq] [rel] [ma] ["DE]
-\definemathsymbol [nleqslant] [rel] [ma] ["D6]
-\definemathsymbol [ngeqslant] [rel] [ma] ["D7]
-\definemathsymbol [lneq] [rel] [ma] ["DA]
-\definemathsymbol [gneq] [rel] [ma] ["DB]
-\definemathsymbol [npreceq] [rel] [ma] ["E7]
-\definemathsymbol [nsucceq] [rel] [ma] ["E8]
-\definemathsymbol [precnsim] [rel] [ma] ["EB]
-\definemathsymbol [succnsim] [rel] [ma] ["EC]
-\definemathsymbol [lnsim] [rel] [ma] ["E0]
-\definemathsymbol [gnsim] [rel] [ma] ["E2]
-\definemathsymbol [nleqq] [rel] [ma] ["D8]
-\definemathsymbol [ngeqq] [rel] [ma] ["D9]
-\definemathsymbol [precneqq] [rel] [ma] ["E9]
-\definemathsymbol [succneqq] [rel] [ma] ["EA]
-\definemathsymbol [precnapprox] [rel] [ma] ["ED]
-\definemathsymbol [succnapprox] [rel] [ma] ["EE]
-\definemathsymbol [lnapprox] [rel] [ma] ["E4]
-\definemathsymbol [gnapprox] [rel] [ma] ["E3]
-\definemathsymbol [nsim] [rel] [ma] ["96]
-\definemathsymbol [ncong] [rel] [ma] ["99]
-\definemathsymbol [diagup] [ord] [mb] ["CD]
-\definemathsymbol [diagdown] [ord] [mb] ["D8]
-\definemathsymbol [varsubsetneq] [rel] [ma] ["D0]
-\definemathsymbol [varsupsetneq] [rel] [ma] ["D1]
-\definemathsymbol [nsubseteqq] [rel] [ma] ["CA]
-\definemathsymbol [nsupseteqq] [rel] [ma] ["CB]
-\definemathsymbol [subsetneqq] [rel] [ma] ["CE]
-\definemathsymbol [supsetneqq] [rel] [ma] ["CF]
-\definemathsymbol [varsubsetneqq] [rel] [ma] ["D2]
-\definemathsymbol [varsupsetneqq] [rel] [ma] ["D3]
-\definemathsymbol [subsetneq] [rel] [ma] ["CC]
-\definemathsymbol [supsetneq] [rel] [ma] ["CD]
-\definemathsymbol [nsubseteq] [rel] [ma] ["C8]
-\definemathsymbol [nsupseteq] [rel] [ma] ["C9]
-\definemathsymbol [nparallel] [rel] [ma] ["F7]
-\definemathsymbol [nmid] [rel] [ma] ["F6]
-\definemathsymbol [nshortmid] [rel] [ma] ["F4]
-\definemathsymbol [nshortparallel] [rel] [ma] ["F5]
-\definemathsymbol [nvdash] [rel] [ma] ["F8]
-\definemathsymbol [nVdash] [rel] [ma] ["F9]
-\definemathsymbol [nvDash] [rel] [ma] ["FA]
-\definemathsymbol [nVDash] [rel] [ma] ["FB]
-\definemathsymbol [ntrianglerighteq] [rel] [ma] ["F2]
-\definemathsymbol [ntrianglelefteq] [rel] [ma] ["F1]
-\definemathsymbol [ntriangleleft] [rel] [ma] ["EF]
-\definemathsymbol [ntriangleright] [rel] [ma] ["F0]
-\definemathsymbol [nleftarrow] [rel] [ma] ["32]
-\definemathsymbol [nrightarrow] [rel] [ma] ["33]
-\definemathsymbol [nLeftarrow] [rel] [ma] ["66]
-\definemathsymbol [nRightarrow] [rel] [ma] ["68]
-\definemathsymbol [nLeftrightarrow] [rel] [ma] ["67]
-\definemathsymbol [nleftrightarrow] [rel] [ma] ["34]
-\definemathsymbol [divideontimes] [bin] [mb] ["F7]
-\definemathsymbol [varnothing] [ord] [sy] ["53]
-\definemathsymbol [nexists] [ord] [ma] ["20]
-\definemathsymbol [Finv] [ord] [mb] ["90]
-\definemathsymbol [Game] [ord] [mb] ["91]
-\definemathsymbol [mho] [ord] [mb] ["92]
-\definemathsymbol [eth] [ord] [ma] ["03] % !!
-\definemathsymbol [eqsim] [rel] [sy] ["99]
-\definemathsymbol [beth] [ord] [mb] ["95]
-\definemathsymbol [gimel] [ord] [mb] ["96]
-\definemathsymbol [daleth] [ord] [mb] ["97]
-\definemathsymbol [lessdot] [bin] [mb] ["DC]
-\definemathsymbol [gtrdot] [bin] [mb] ["DD]
-\definemathsymbol [ltimes] [bin] [mb] ["CF]
-\definemathsymbol [rtimes] [bin] [mb] ["CE]
-\definemathsymbol [shortmid] [rel] [mb] ["F4]
-\definemathsymbol [shortparallel] [rel] [mb] ["F5]
-\definemathsymbol [smallsetminus] [bin] [mb] ["D8]
-\definemathsymbol [thicksim] [rel] [sy] ["18] % not that thick
-\definemathsymbol [thickapprox] [rel] [sy] ["19] % not that thick
-\definemathsymbol [approxeq] [rel] [sy] ["9D]
-\definemathsymbol [succapprox] [rel] [mb] ["ED]
-\definemathsymbol [precapprox] [rel] [mb] ["EC]
-\definemathsymbol [curvearrowleft] [rel] [ma] ["87]
-\definemathsymbol [curvearrowright] [rel] [ma] ["88]
-\definemathsymbol [digamma] [ord] [ma] ["03] % !!
-\definemathsymbol [varkappa] [ord] [mb] ["9B]
-\definemathsymbol [Bbbk] [ord] [ma] ["6B]
-\definemathsymbol [hslash] [ord] [mb] ["9D]
-\definemathsymbol [hbar] [ord] [ma] ["1B]
-\definemathsymbol [backepsilon] [rel] [ma] ["03] % !!
-
-\stopmathcollection
-
-\startmathcollection [lbr]
-
-\definemathsymbol [yen] [nothing] [ma] ["03] % !!
-\definemathsymbol [checkmark] [nothing] [ma] ["AC]
-\definemathsymbol [circledR] [nothing] [mb] ["C9]
-\definemathsymbol [maltese] [nothing] [mb] ["CB]
-
-\stopmathcollection
-
-\startmathcollection [lbr]
-
-\definemathsymbol [dashrightarrow] [rel] [ma] ["3A]
-\definemathsymbol [dashleftarrow] [rel] [ma] ["38]
-\definemathcommand [dasharrow] [rel] {\dashleftarrow\mkern-15.8mu\dashrightarrow}
-%definemathcommand [Join] [rel] {\mathchar"0D6F\mkern-15.8mu\mathchar"0D6E} % !!
-
-\stopmathcollection
-
-\startmathcollection[lbr]
-
-\definemathcharacter [91] [open] [mi] ["86]
-\definemathcharacter [93] [close] [mi] ["87]
-\definemathcharacter [(] [open] [mi] ["84]
-\definemathcharacter [)] [close] [mi] ["85]
-\definemathcharacter [/] [nothing] [mi] ["3D]
-\definemathcharacter [=] [rel] [sy] ["83]
-\definemathcharacter [+] [bin] [sy] ["82]
-
-\definemathcharacter [91] [nothing] [mi] ["86] [ex] ["02]
-\definemathcharacter [93] [nothing] [mi] ["87] [ex] ["03]
-\definemathcharacter [(] [nothing] [mi] ["84] [ex] ["00]
-\definemathcharacter [)] [nothing] [mi] ["85] [ex] ["01]
-\definemathcharacter [/] [nothing] [mi] ["3D] [ex] ["0E]
-
-\stopmathcollection
-
-% \startmathcollection[lbr]
-%
-% \definemathcharacter [:] [punct] [tf] ["3A] % unbelievable
-% \definemathcharacter [;] [punct] [tf] ["3B] % unbelievable
-%
-% \stopmathcollection
-
-\startmathcollection[lbr]
-
-\definemathsymbol [ldbrack] [open] [mi] ["82] [ex] ["82]
-\definemathsymbol [rdbrack] [close] [mi] ["83] [ex] ["83]
-\definemathsymbol [surfintop] [op] [ex] ["90]
-\definemathsymbol [midintop] [op] [ex] ["92]
-\definemathsymbol [midointop] [op] [ex] ["93]
-\definemathsymbol [midsurfintop] [op] [ex] ["94]
-\definemathsymbol [largeint] [op] [ex] ["5A] [ex] ["95]
-
-% \definemathcommand [surfint] [nolop] {\surfintop}
-% \definemathcommand [midint] [nolop] {\midintop}
-% \definemathcommand [midoint] [nolop] {\midointop}
-% \definemathcommand [midsurfint] [nolop] {\midsurfintop}
-
-\definemathsymbol [surfint] [nolop] [ex] ["90]
-\definemathsymbol [midint] [nolop] [ex] ["92]
-\definemathsymbol [midoint] [nolop] [ex] ["93]
-\definemathsymbol [midsurfint] [nolop] [ex] ["94]
-
-\definemathsymbol [dblint] [ord] [mi] ["88]
-\definemathsymbol [trplint] [ord] [mi] ["89]
-\definemathsymbol [contint] [ord] [mi] ["8A]
-\definemathsymbol [surfint] [ord] [mi] ["8B]
-\definemathsymbol [volint] [ord] [mi] ["8C]
-\definemathsymbol [clwint] [ord] [mi] ["8D]
-\definemathsymbol [cclwcint] [ord] [mi] ["8E]
-\definemathsymbol [clwcint] [ord] [mi] ["8F]
-\definemathsymbol [bowtie] [rel] [mi] ["F6]
-\definemathsymbol [models] [rel] [sy] ["EE]
-\definemathsymbol [doteq] [rel] [sy] ["C9]
-\definemathsymbol [cong] [rel] [sy] ["9B]
-\definemathsymbol [hbar] [ord] [mi] ["9D]
-\definemathsymbol [neq] [rel] [ma] ["94]
-\definemathsymbol [rightleftharpoons] [rel] [ma] ["7A]
-\definemathsymbol [leftrightharpoons] [rel] [ma] ["79]
-\definemathsymbol [hookleftarrow] [rel] [ma] ["3C]
-\definemathsymbol [hookrightarrow] [rel] [ma] ["3E]
-\definemathsymbol [mapsto] [rel] [ma] ["2C]
-
-\definemathcommand [longmapsto] {\mapstochar\longrightarrow}
-
-\stopmathcollection
-
-\startmathcollection[lbr]
-
-\definemathsymbol [Gamma] [alpha] [ucgreek] ["00]
-\definemathsymbol [Delta] [alpha] [ucgreek] ["01]
-\definemathsymbol [Theta] [alpha] [ucgreek] ["02]
-\definemathsymbol [Lambda] [alpha] [ucgreek] ["03]
-\definemathsymbol [Xi] [alpha] [ucgreek] ["04]
-\definemathsymbol [Pi] [alpha] [ucgreek] ["05]
-\definemathsymbol [Sigma] [alpha] [ucgreek] ["06]
-\definemathsymbol [Upsilon] [alpha] [ucgreek] ["07]
-\definemathsymbol [Phi] [alpha] [ucgreek] ["08]
-\definemathsymbol [Psi] [alpha] [ucgreek] ["09]
-\definemathsymbol [Omega] [alpha] [ucgreek] ["0A]
-
-\definemathsymbol [varGamma] [ord] [vargreek] ["00]
-\definemathsymbol [varDelta] [ord] [vargreek] ["01]
-\definemathsymbol [varTheta] [ord] [vargreek] ["02]
-\definemathsymbol [varLambda] [ord] [vargreek] ["03]
-\definemathsymbol [varXi] [ord] [vargreek] ["04]
-\definemathsymbol [varPi] [ord] [vargreek] ["05]
-\definemathsymbol [varSigma] [ord] [vargreek] ["06]
-\definemathsymbol [varUpsilon] [ord] [vargreek] ["07]
-\definemathsymbol [varPhi] [ord] [vargreek] ["08]
-\definemathsymbol [varPsi] [ord] [vargreek] ["09]
-\definemathsymbol [varOmega] [ord] [vargreek] ["0A]
-
-\stopmathcollection
-
-% we define the whole lot, although only a few differ (esp dot)
-
-\startmathcollection[lbr]
-
-\definemathsymbol [acute] [accent] [tf] ["13] % mr -> tf
-\definemathsymbol [grave] [accent] [tf] ["12] % mr -> tf
-\definemathsymbol [ddot] [accent] [tf] ["7F] % mr -> tf
-\definemathsymbol [tilde] [accent] [tf] ["7E] % mr -> tf
-\definemathsymbol [bar] [accent] [tf] ["16] % mr -> tf
-\definemathsymbol [breve] [accent] [tf] ["15] % mr -> tf
-\definemathsymbol [check] [accent] [tf] ["14] % mr -> tf
-\definemathsymbol [hat] [accent] [tf] ["5E] % mr -> tf
-\definemathsymbol [vec] [accent] [mi] ["7E] % [ord]
-\definemathsymbol [dot] [accent] [tf] ["05] % mr -> tf, 5F -> 05
-\definemathsymbol [widetilde] [accent] [ex] ["65] % [ord]
-\definemathsymbol [widehat] [accent] [ex] ["62] % [ord]
-
-\stopmathcollection
-
-\def\LBRroot#1#2%
- {\setbox\zerocount\hbox{$\mathsurround\zeropoint#1\sqrt{#2}$}
- \dimen@\ht\zerocount \advance\dimen@-\dp\zerocount
- \mkern5mu\raise.6\dimen@\copy\rootbox \mkern-7.5mu \box\zerocount}
-
-\def\LBRmatrix#1%
- {\null\,\vcenter{\normalbaselines\mathsurround\zeropoint
- \ialign{\hfil$##$\hfil&&\quad\hfil$##$\hfil\crcr
- \mathstrut\crcr\noalign{\kern-0.9\baselineskip}
- #1\crcr\mathstrut\crcr\noalign{\kern-0.9\baselineskip}}}\,}
-
-\startrawmathcollection[lbr]
-
-\definemathcommand [mathstrut] {\vphantom{f}}
-\definemathcommand [joinrel] {\mathrel{\mkern-4mu}}
-\definemathcommand [r@@t] {\LBRroot}
-\definemathcommand [matrix] {\LBRmatrix}
-
-\stoprawmathcollection
-
-\def\LBRbig {\@@dobig{8.20}}
-\def\LBRBig {\@@dobig{10.80}}
-\def\LBRbigg {\@@dobig{13.42}}
-\def\LBRBigg {\@@dobig{16.03}}
-\def\LBRbiggg{\@@dobig{17.72}}
-\def\LBRBiggg{\@@dobig{21.25}}
-
-% \def\LBRbig {\@@dobig{0.820}}
-% \def\LBRBig {\@@dobig{1.080}}
-% \def\LBRbigg {\@@dobig{1.342}}
-% \def\LBRBigg {\@@dobig{1.603}}
-% \def\LBRbiggg{\@@dobig{1.772}}
-% \def\LBRBiggg{\@@dobig{2.125}}
-
-\startrawmathcollection[lbr]
-
-\definemathcommand [big] {\LBRbig}
-\definemathcommand [Big] {\LBRBig}
-\definemathcommand [bigg] {\LBRbigg}
-\definemathcommand [Bigg] {\LBRBigg}
-\definemathcommand [biggg] {\LBRbiggg}
-\definemathcommand [Biggg] {\LBRBiggg}
-
-\stoprawmathcollection
-
-\startrawmathcollection[lbr]
-
-\definemathcommand [bigggl] [open] {\biggg}
-\definemathcommand [bigggr] [close] {\biggg}
-\definemathcommand [Bigggl] [open] {\Biggg}
-\definemathcommand [Bigggr] [close] {\Biggg}
-
-\stoprawmathcollection
-
-\protect \endinput
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index bbbd5285e..7985834f2 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -192,7 +192,7 @@ noads.processors.relocate[math_delim] = function(pointer)
end
end
-function noads.relocate_characters(head,tail,style,penalties)
+function noads.relocate_characters(head,style,penalties)
process(head,noads.processors.relocate)
return true
end
@@ -227,7 +227,7 @@ noads.processors.resize[math_fence] = function(pointer)
end
end
-function noads.resize_characters(head,tail,style,penalties)
+function noads.resize_characters(head,style,penalties)
process(head,noads.processors.resize)
return true
end
@@ -290,14 +290,14 @@ noads.processors.respace[math_noad] = function(pointer)
end
-function noads.respace_characters(head,tail,style,penalties)
+function noads.respace_characters(head,style,penalties)
noads.process(head,noads.processors.respace)
return true
end
-- the normal builder
-function noads.mlist_to_hlist(head,tail,style,penalties)
+function noads.mlist_to_hlist(head,style,penalties)
return mlist_to_hlist(head,style,penalties), true
end
@@ -309,12 +309,7 @@ tasks.new (
}
)
---~ tasks.appendaction("math", "normalizers", "noads.relocate_characters", nil, "nohead")
---~ tasks.appendaction("math", "normalizers", "noads.resize_characters", nil, "nohead")
---~ tasks.appendaction("math", "normalizers", "noads.respace_characters", nil, "nohead")
---~ tasks.appendaction("math", "builders", "noads.mlist_to_hlist", nil, "notail")
-
-local actions = tasks.actions("math",2) -- head, tail, style, penalties
+local actions = tasks.actions("math",2) -- head, style, penalties
local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming
diff --git a/tex/context/base/math-tex.mkii b/tex/context/base/math-tex.mkii
new file mode 100644
index 000000000..c833db956
--- /dev/null
+++ b/tex/context/base/math-tex.mkii
@@ -0,0 +1,718 @@
+%D \module
+%D [ file=math-tex,
+%D version=2001.04.12,
+%D subtitle=Plain Specials,
+%D author={Hans Hagen, Taco Hoekwater \& Aditya Mahajan},
+%D date=\currentdate,
+%D copyright=\PRAGMA]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% beware: in mkiv we will do it differently
+
+\unprotect
+
+\mathcode`\ ="8000 \mathcode`\_="8000 \mathcode`\'="8000
+
+\definefamilysynonym [default] [calligraphic] [sy]
+\definefamilysynonym [default] [oldstyle] [mi]
+\definefamilysynonym [default] [blackboard] [mr]
+\definefamilysynonym [default] [gothic] [mr]
+\definefamilysynonym [default] [fraktur] [mr]
+
+\definefamilysynonym [default] [lcgreek] [mi]
+\definefamilysynonym [default] [ucgreek] [mr]
+\definefamilysynonym [default] [vargreek] [mi]
+
+
+%D \macros
+%D {\setupmathematics}
+%D
+%D Configuration for integrals. (If needed we can speed this up and make it
+%D installable; no processaction is needed then).
+
+\chardef\intlimitcode\zerocount % 0 nolimits 1 displaylimits 2 limits
+
+\def\intlimits
+ {\ifcase\intlimitcode \nolimits \or \displaylimits \or \limits \fi}
+
+\def\setupmathematics
+ {\dosingleargument\dosetupmathematics}
+
+\def\dosetupmathematics[#1]%
+ {\getparameters[\??mo][#1]
+ \processaction[\@@mointegral]
+ [ nolimits=>\chardef\intlimitcode\zerocount,
+ displaylimits=>\chardef\intlimitcode\plusone,
+ limits=>\chardef\intlimitcode\plustwo]}
+
+%D \startbuffer
+%D $\int_a^b f(x) dx$ and also
+%D $\iint_a^b f(x,y) dxdy$, $\iiint_a^b f(x,y) dxdy$,
+%D $\iiiint_a^b f(x) dx$
+%D \startformula
+%D \int_a^b f(x) dx \quad
+%D \iint_a^b f(x) dx \quad
+%D \iiint_a^b f(x) dx \quad
+%D \iiiint_a^b f(x) dx \quad
+%D \stopformula
+%D \stopbuffer
+%D
+%D Default: \getbuffer
+%D
+%D Displaylimits: \setupmathematics[integral=displaylimits] \getbuffer
+%D
+%D Limits: \setupmathematics[integral=limits] \getbuffer
+
+\startmathcollection [default]
+
+\definemathsymbol [alpha] [nothing] [lcgreek] ["0B]
+\definemathsymbol [beta] [nothing] [lcgreek] ["0C]
+\definemathsymbol [gamma] [nothing] [lcgreek] ["0D]
+\definemathsymbol [delta] [nothing] [lcgreek] ["0E]
+\definemathsymbol [epsilon] [nothing] [lcgreek] ["0F]
+\definemathsymbol [zeta] [nothing] [lcgreek] ["10]
+\definemathsymbol [eta] [nothing] [lcgreek] ["11]
+\definemathsymbol [theta] [nothing] [lcgreek] ["12]
+\definemathsymbol [iota] [nothing] [lcgreek] ["13]
+\definemathsymbol [kappa] [nothing] [lcgreek] ["14]
+\definemathsymbol [lambda] [nothing] [lcgreek] ["15]
+\definemathsymbol [mu] [nothing] [lcgreek] ["16]
+\definemathsymbol [nu] [nothing] [lcgreek] ["17]
+\definemathsymbol [xi] [nothing] [lcgreek] ["18]
+\definemathsymbol [omicron] [nothing] [lcgreek] ["6F]
+\definemathsymbol [pi] [nothing] [lcgreek] ["19]
+\definemathsymbol [rho] [nothing] [lcgreek] ["1A]
+\definemathsymbol [sigma] [nothing] [lcgreek] ["1B]
+\definemathsymbol [tau] [nothing] [lcgreek] ["1C]
+\definemathsymbol [upsilon] [nothing] [lcgreek] ["1D]
+\definemathsymbol [phi] [nothing] [lcgreek] ["1E]
+\definemathsymbol [chi] [nothing] [lcgreek] ["1F]
+\definemathsymbol [psi] [nothing] [lcgreek] ["20]
+\definemathsymbol [omega] [nothing] [lcgreek] ["21]
+
+\stopmathcollection
+
+\startmathcollection [default]
+
+\definemathsymbol [varepsilon] [nothing] [vargreek] ["22]
+\definemathsymbol [vartheta] [nothing] [vargreek] ["23]
+\definemathsymbol [varpi] [nothing] [vargreek] ["24]
+\definemathsymbol [varrho] [nothing] [vargreek] ["25]
+\definemathsymbol [varsigma] [nothing] [vargreek] ["26]
+\definemathsymbol [varphi] [nothing] [vargreek] ["27]
+
+\stopmathcollection
+
+\startmathcollection [default]
+
+\definemathsymbol [Alpha] [alpha] [ucgreek] ["41] % A
+\definemathsymbol [Beta] [alpha] [ucgreek] ["42] % B
+\definemathsymbol [Gamma] [alpha] [ucgreek] ["00]
+\definemathsymbol [Delta] [alpha] [ucgreek] ["01]
+\definemathsymbol [Epsilon] [alpha] [ucgreek] ["45] % E
+\definemathsymbol [Zeta] [alpha] [ucgreek] ["5A] % Z
+\definemathsymbol [Eta] [alpha] [ucgreek] ["48] % H
+\definemathsymbol [Theta] [alpha] [ucgreek] ["02]
+\definemathsymbol [Iota] [alpha] [ucgreek] ["49] % I
+\definemathsymbol [Kappa] [alpha] [ucgreek] ["4B] % K
+\definemathsymbol [Lambda] [alpha] [ucgreek] ["03]
+\definemathsymbol [Mu] [alpha] [ucgreek] ["4D] % M
+\definemathsymbol [Nu] [alpha] [ucgreek] ["4E] % N
+\definemathsymbol [Xi] [alpha] [ucgreek] ["04]
+\definemathsymbol [Omicron] [alpha] [ucgreek] ["4F] % O
+\definemathsymbol [Pi] [alpha] [ucgreek] ["05]
+\definemathsymbol [Rho] [alpha] [ucgreek] ["52] % R
+\definemathsymbol [Sigma] [alpha] [ucgreek] ["06]
+\definemathsymbol [Tau] [alpha] [ucgreek] ["54] % T
+\definemathsymbol [Upsilon] [alpha] [ucgreek] ["07]
+\definemathsymbol [Phi] [alpha] [ucgreek] ["08]
+\definemathsymbol [Chi] [alpha] [ucgreek] ["58] % X
+\definemathsymbol [Psi] [alpha] [ucgreek] ["09]
+\definemathsymbol [Omega] [alpha] [ucgreek] ["0A]
+
+\stopmathcollection
+
+% The \mfunction macro is an alternative for \hbox with a
+% controlable font switch.
+
+\startmathcollection[default]
+
+\definemathcommand [arccos] [nolop] {\mfunction{arccos}}
+\definemathcommand [arcsin] [nolop] {\mfunction{arcsin}}
+\definemathcommand [arctan] [nolop] {\mfunction{arctan}}
+\definemathcommand [arg] [nolop] {\mfunction{arg}}
+\definemathcommand [cosh] [nolop] {\mfunction{cosh}}
+\definemathcommand [cos] [nolop] {\mfunction{cos}}
+\definemathcommand [coth] [nolop] {\mfunction{coth}}
+\definemathcommand [cot] [nolop] {\mfunction{cot}}
+\definemathcommand [csc] [nolop] {\mfunction{csc}}
+\definemathcommand [deg] [nolop] {\mfunction{deg}}
+\definemathcommand [det] [limop] {\mfunction{det}}
+\definemathcommand [dim] [nolop] {\mfunction{dim}}
+\definemathcommand [exp] [nolop] {\mfunction{exp}}
+\definemathcommand [gcd] [limop] {\mfunction{gcd}}
+\definemathcommand [hom] [nolop] {\mfunction{hom}}
+\definemathcommand [inf] [limop] {\mfunction{inf}}
+\definemathcommand [injlim] [limop] {\mfunction{inj\,lim}}
+\definemathcommand [ker] [nolop] {\mfunction{ker}}
+\definemathcommand [lg] [nolop] {\mfunction{lg}}
+\definemathcommand [liminf] [limop] {\mfunction{lim\,inf}}
+\definemathcommand [limsup] [limop] {\mfunction{lim\,sup}}
+\definemathcommand [lim] [limop] {\mfunction{lim}}
+\definemathcommand [ln] [nolop] {\mfunction{ln}}
+\definemathcommand [log] [nolop] {\mfunction{log}}
+\definemathcommand [median] [limop] {\mfunction{median}}
+\definemathcommand [max] [limop] {\mfunction{max}}
+\definemathcommand [min] [limop] {\mfunction{min}}
+\definemathcommand [mod] [limop] {\mfunction{mod}}
+\definemathcommand [div] [limop] {\mfunction{div}}
+\definemathcommand [projlim] [limop] {\mfunction{proj\,lim}}
+\definemathcommand [Pr] [limop] {\mfunction{Pr}}
+\definemathcommand [sec] [nolop] {\mfunction{sec}}
+\definemathcommand [sinh] [nolop] {\mfunction{sinh}}
+\definemathcommand [sin] [nolop] {\mfunction{sin}}
+\definemathcommand [sup] [limop] {\mfunction{sup}}
+\definemathcommand [tanh] [nolop] {\mfunction{tanh}}
+\definemathcommand [tan] [nolop] {\mfunction{tan}}
+
+\stopmathcollection
+
+\startmathcollection[default]
+
+\definemathcommand [integers] {\mfunction{Z}}
+\definemathcommand [reals] {\mfunction{R}}
+\definemathcommand [rationals] {\mfunction{Q}}
+\definemathcommand [naturalnumbers] {\mfunction{N}}
+\definemathcommand [complexes] {\mfunction{C}}
+\definemathcommand [primes] {\mfunction{P}}
+
+\stopmathcollection
+
+\startmathcollection[default]
+
+\definemathcharacter [!] [close] [mr] ["21]
+\definemathcharacter [(] [open] [mr] ["28]
+\definemathcharacter [)] [close] [mr] ["29]
+\definemathcharacter [*] [bin] [sy] ["03]
+\definemathcharacter [+] [bin] [mr] ["2B]
+\definemathcharacter [,] [punct] [mi] ["3B]
+\definemathcharacter [-] [bin] [sy] ["00]
+\definemathcharacter [.] [ord] [mi] ["3A]
+\definemathcharacter [/] [ord] [mi] ["3D]
+\definemathcharacter [:] [rel] [mr] ["3A]
+\definemathcharacter [;] [punct] [mr] ["3B]
+\definemathcharacter [<] [rel] [mi] ["3C]
+\definemathcharacter [=] [rel] [mr] ["3D]
+\definemathcharacter [>] [rel] [mi] ["3E]
+\definemathcharacter [?] [close] [mr] ["3F]
+\definemathcharacter [91] [open] [mr] ["5B] % [
+\definemathcharacter [92] [ord] [sy] ["6E] % \
+\definemathcharacter [93] [close] [mr] ["5D] % ]
+\definemathcharacter [123] [open] [sy] ["66] % {
+\definemathcharacter [124] [ord] [sy] ["6A] % |
+\definemathcharacter [125] [close] [sy] ["67] % }
+
+\stopmathcollection
+
+\startmathcollection[default]
+
+\definemathcharacter [(] [nothing] [mr] ["28] [ex] ["00]
+\definemathcharacter [)] [nothing] [mr] ["29] [ex] ["01]
+\definemathcharacter [91] [nothing] [mr] ["5B] [ex] ["02] % [
+\definemathcharacter [93] [nothing] [mr] ["5D] [ex] ["03] % ]
+\definemathcharacter [<] [nothing] [sy] ["68] [ex] ["0A]
+\definemathcharacter [>] [nothing] [sy] ["69] [ex] ["0B]
+\definemathcharacter [/] [nothing] [mr] ["2F] [ex] ["0E]
+\definemathcharacter [124] [nothing] [sy] ["6A] [ex] ["0C] % |
+\definemathcharacter [92] [nothing] [sy] ["6E] [ex] ["0F] % \
+
+\stopmathcollection
+
+\def\PLAINangle
+ {{\vbox{\ialign{$\mathsurround\zeropoint\scriptstyle##$\crcr
+ \not\mathrel{\mkern14mu}\crcr
+ \noalign{\nointerlineskip}
+ \mkern2.5mu\leaders\hrule height.34pt\hfill\mkern2.5mu\crcr}}}}
+
+\startmathcollection[default]
+
+\definemathsymbol [aleph] [nothing] [sy] ["40]
+\definemathsymbol [imath] [nothing] [mi] ["7B]
+\definemathsymbol [jmath] [nothing] [mi] ["7C]
+\definemathsymbol [ell] [nothing] [mi] ["60]
+\definemathsymbol [wp] [nothing] [mi] ["7D]
+\definemathsymbol [Re] [nothing] [sy] ["3C]
+\definemathsymbol [Im] [nothing] [sy] ["3D]
+\definemathsymbol [partial] [nothing] [mi] ["40]
+\definemathsymbol [infty] [nothing] [sy] ["31]
+\definemathsymbol [prime] [nothing] [sy] ["30]
+\definemathsymbol [emptyset] [nothing] [sy] ["3B]
+\definemathsymbol [nabla] [nothing] [sy] ["72]
+\definemathsymbol [top] [nothing] [sy] ["3E]
+\definemathsymbol [bot] [nothing] [sy] ["3F]
+
+\definemathcommand [hbar] {{\mathchar'26\mkern-9muh}}
+\definemathcommand [surd] {{\mathchar"1270}} % ?
+\definemathcommand [angle] {\PLAINangle}
+
+\stopmathcollection
+
+\startmathcollection[default]
+
+\definemathsymbol [triangle] [ord] [sy] ["34]
+\definemathsymbol [forall] [ord] [sy] ["38]
+\definemathsymbol [exists] [ord] [sy] ["39]
+\definemathsymbol [neg] [ord] [sy] ["3A]
+\definemathsymbol [flat] [ord] [mi] ["5B]
+\definemathsymbol [natural] [ord] [mi] ["5C]
+\definemathsymbol [sharp] [ord] [mi] ["5D]
+\definemathsymbol [clubsuit] [ord] [sy] ["7C]
+\definemathsymbol [diamondsuit] [ord] [sy] ["7D]
+\definemathsymbol [heartsuit] [ord] [sy] ["7E]
+\definemathsymbol [spadesuit] [ord] [sy] ["7F]
+
+\stopmathcollection
+
+\startmathcollection[default]
+
+\definemathcommand [square] {\hbox{\hsmash{$\sqcup$}$\sqcap$}}
+
+\stopmathcollection
+
+\startmathcollection[default]
+
+\definemathsymbol [coprod] [op] [ex] ["60]
+\definemathsymbol [bigvee] [op] [ex] ["57]
+\definemathsymbol [bigwedge] [op] [ex] ["56]
+\definemathsymbol [biguplus] [op] [ex] ["55]
+\definemathsymbol [bigcap] [op] [ex] ["54]
+\definemathsymbol [bigcup] [op] [ex] ["53]
+\definemathsymbol [intop] [op] [ex] ["52]
+\definemathsymbol [prod] [op] [ex] ["51]
+\definemathsymbol [sum] [op] [ex] ["50]
+\definemathsymbol [bigotimes] [op] [ex] ["4E]
+\definemathsymbol [bigoplus] [op] [ex] ["4C]
+\definemathsymbol [bigodot] [op] [ex] ["4A]
+\definemathsymbol [ointop] [op] [ex] ["48]
+\definemathsymbol [bigsqcup] [op] [ex] ["46]
+\definemathsymbol [smallint] [op] [sy] ["73]
+
+\stopmathcollection
+
+\startmathcollection[default]
+
+\definemathsymbol [triangleleft] [bin] [mi] ["2F]
+\definemathsymbol [triangleright] [bin] [mi] ["2E]
+\definemathsymbol [bigtriangleup] [bin] [sy] ["34]
+\definemathsymbol [bigtriangledown] [bin] [sy] ["35]
+\definemathsymbol [wedge] [bin] [sy] ["5E]
+\definemathsymbol [vee] [bin] [sy] ["5F]
+\definemathsymbol [cap] [bin] [sy] ["5C]
+\definemathsymbol [cup] [bin] [sy] ["5B]
+\definemathsymbol [ddagger] [bin] [sy] ["7A]
+\definemathsymbol [dagger] [bin] [sy] ["79]
+\definemathsymbol [sqcap] [bin] [sy] ["75]
+\definemathsymbol [sqcup] [bin] [sy] ["74]
+\definemathsymbol [uplus] [bin] [sy] ["5D]
+\definemathsymbol [amalg] [bin] [sy] ["71]
+\definemathsymbol [diamond] [bin] [sy] ["05]
+\definemathsymbol [bullet] [bin] [sy] ["0F]
+\definemathsymbol [wr] [bin] [sy] ["6F]
+\definemathsymbol [div] [bin] [sy] ["04]
+\definemathsymbol [odot] [bin] [sy] ["0C]
+\definemathsymbol [oslash] [bin] [sy] ["0B]
+\definemathsymbol [otimes] [bin] [sy] ["0A]
+\definemathsymbol [ominus] [bin] [sy] ["09]
+\definemathsymbol [oplus] [bin] [sy] ["08]
+\definemathsymbol [mp] [bin] [sy] ["07]
+\definemathsymbol [pm] [bin] [sy] ["06]
+\definemathsymbol [circ] [bin] [sy] ["0E]
+\definemathsymbol [bigcirc] [bin] [sy] ["0D]
+\definemathsymbol [setminus] [bin] [sy] ["6E]
+\definemathsymbol [cdot] [bin] [sy] ["01]
+\definemathsymbol [ast] [bin] [sy] ["03]
+\definemathsymbol [times] [bin] [sy] ["02]
+\definemathsymbol [star] [bin] [mi] ["3F]
+
+\stopmathcollection
+
+\startmathcollection[default]
+
+\definemathsymbol [propto] [rel] [sy] ["2F]
+\definemathsymbol [sqsubseteq] [rel] [sy] ["76]
+\definemathsymbol [sqsupseteq] [rel] [sy] ["77]
+\definemathsymbol [parallel] [rel] [sy] ["6B]
+\definemathsymbol [mid] [rel] [sy] ["6A]
+\definemathsymbol [dashv] [rel] [sy] ["61]
+\definemathsymbol [vdash] [rel] [sy] ["60]
+\definemathsymbol [nearrow] [rel] [sy] ["25]
+\definemathsymbol [searrow] [rel] [sy] ["26]
+\definemathsymbol [nwarrow] [rel] [sy] ["2D]
+\definemathsymbol [swarrow] [rel] [sy] ["2E]
+\definemathsymbol [Leftrightarrow] [rel] [sy] ["2C]
+\definemathsymbol [Leftarrow] [rel] [sy] ["28]
+\definemathsymbol [Rightarrow] [rel] [sy] ["29]
+
+\stopmathcollection
+
+\startmathcollection[default]
+
+\definemathcommand [lnot] {\neg}
+\definemathcommand [int] {\intop \intlimits}
+\definemathcommand [oint] {\ointop\intlimits}
+\definemathcommand [land] {\wedge}
+\definemathcommand [lor] {\vee}
+\definemathcommand [neq] {\not=}
+\definemathcommand [ne] {\neq}
+\definemathcommand [le] {\leq}
+\definemathcommand [ge] {\geq}
+\definemathcommand [eq] {=}
+\definemathcommand [gt] {>}
+\definemathcommand [lt] {<}
+\definemathcommand [gets] {\leftarrow}
+\definemathcommand [owns] {\ni}
+\definemathcommand [to] {\rightarrow}
+\definemathcommand [mapsto] {\mapstochar\rightarrow}
+
+\stopmathcollection
+
+\startmathcollection[default]
+
+\definemathsymbol [leq] [rel] [sy] ["14]
+\definemathsymbol [geq] [rel] [sy] ["15]
+\definemathsymbol [succ] [rel] [sy] ["1F]
+\definemathsymbol [prec] [rel] [sy] ["1E]
+\definemathsymbol [approx] [rel] [sy] ["19]
+\definemathsymbol [succeq] [rel] [sy] ["17]
+\definemathsymbol [preceq] [rel] [sy] ["16]
+\definemathsymbol [supset] [rel] [sy] ["1B]
+\definemathsymbol [subset] [rel] [sy] ["1A]
+\definemathsymbol [supseteq] [rel] [sy] ["13]
+\definemathsymbol [subseteq] [rel] [sy] ["12]
+\definemathsymbol [in] [rel] [sy] ["32]
+\definemathsymbol [ni] [rel] [sy] ["33]
+\definemathsymbol [gg] [rel] [sy] ["1D]
+\definemathsymbol [ll] [rel] [sy] ["1C]
+\definemathsymbol [not] [rel] [sy] ["36]
+\definemathsymbol [leftrightarrow] [rel] [sy] ["24]
+\definemathsymbol [leftarrow] [rel] [sy] ["20]
+\definemathsymbol [rightarrow] [rel] [sy] ["21]
+\definemathsymbol [mapstochar] [rel] [sy] ["37]
+\definemathsymbol [sim] [rel] [sy] ["18]
+\definemathsymbol [simeq] [rel] [sy] ["27]
+\definemathsymbol [perp] [rel] [sy] ["3F]
+\definemathsymbol [equiv] [rel] [sy] ["11]
+\definemathsymbol [asymp] [rel] [sy] ["10]
+\definemathsymbol [smile] [rel] [mi] ["5E]
+\definemathsymbol [frown] [rel] [mi] ["5F]
+\definemathsymbol [leftharpoonup] [rel] [mi] ["28]
+\definemathsymbol [leftharpoondown] [rel] [mi] ["29]
+\definemathsymbol [rightharpoonup] [rel] [mi] ["2A]
+\definemathsymbol [rightharpoondown] [rel] [mi] ["2B]
+\definemathsymbol [lhook] [rel] [mi] ["2C]
+\definemathsymbol [rhook] [rel] [mi] ["2D]
+
+\stopmathcollection
+
+\def\PLAINldots
+ {\ldotp\ldotp\ldotp}
+
+\def\PLAINcdots
+ {\cdotp\cdotp\cdotp}
+
+\def\PLAINvdots
+ {\vbox{\baselineskip.4\bodyfontsize\lineskiplimit\zeropoint
+ \kern.6\bodyfontsize\hbox{.}\hbox{.}\hbox{.}}}
+
+\def\PLAINddots
+ {\mkern1mu\raise.7\bodyfontsize\vbox{\kern.7\bodyfontsize\hbox{.}}\mkern2mu
+ \raise.4\bodyfontsize\hbox{.}\mkern2mu\raise.1\bodyfontsize\hbox{.}\mkern1mu}
+
+\startmathcollection[default]
+
+\definemathcommand [hookrightarrow] {\lhook\joinrel\rightarrow}
+\definemathcommand [hookleftarrow] {\leftarrow\joinrel\rhook}
+\definemathcommand [bowtie] {\mathrel\triangleright\joinrel\mathrel\triangleleft}
+\definemathcommand [models] {\mathrel|\joinrel=}
+\definemathcommand [iff] {\;\Longleftrightarrow\;}
+
+\definemathsymbol [ldotp] [punct] [mi] ["3A]
+\definemathsymbol [cdotp] [punct] [sy] ["01]
+\definemathsymbol [colon] [punct] [mr] ["3A]
+
+\definemathcommand [ldots] [inner] {\PLAINldots}
+\definemathcommand [cdots] [inner] {\PLAINcdots}
+\definemathcommand [vdots] [nothing] {\PLAINvdots}
+\definemathcommand [ddots] [inner] {\PLAINddots}
+
+\stopmathcollection
+
+\startmathcollection[default]
+
+\definemathsymbol [acute] [accent] [mr] ["13]
+\definemathsymbol [grave] [accent] [mr] ["12]
+\definemathsymbol [ddot] [accent] [mr] ["7F]
+\definemathsymbol [tilde] [accent] [mr] ["7E]
+\definemathsymbol [mathring] [accent] [mr] ["17]
+\definemathsymbol [bar] [accent] [mr] ["16]
+\definemathsymbol [breve] [accent] [mr] ["15]
+\definemathsymbol [check] [accent] [mr] ["14]
+\definemathsymbol [hat] [accent] [mr] ["5E]
+\definemathsymbol [vec] [accent] [mi] ["7E] % [ord]
+\definemathsymbol [dot] [accent] [mr] ["5F]
+\definemathsymbol [widetilde] [accent] [ex] ["65] % [ord]
+\definemathsymbol [widehat] [accent] [ex] ["62] % [ord]
+
+\stopmathcollection
+
+\startmathcollection[default]
+
+\definemathsymbol [lmoustache] [open] [ex] ["7A] [ex] ["40]
+\definemathsymbol [rmoustache] [close] [ex] ["7B] [ex] ["41]
+\definemathsymbol [lgroup] [open] [mr] ["28] [ex] ["3A] % ?
+\definemathsymbol [rgroup] [close] [mr] ["29] [ex] ["3B] % ?
+\definemathsymbol [arrowvert] [nothing] [sy] ["6A] [ex] ["3C]
+\definemathsymbol [Arrowvert] [nothing] [sy] ["6B] [ex] ["3D]
+\definemathsymbol [bracevert] [nothing] [ex] ["3E] % ?
+\definemathsymbol [Vert] [nothing] [sy] ["6B] [ex] ["0D]
+\definemathsymbol [vert] [nothing] [sy] ["6A] [ex] ["0C]
+\definemathsymbol [uparrow] [rel] [sy] ["22] [ex] ["78]
+\definemathsymbol [downarrow] [rel] [sy] ["23] [ex] ["79]
+\definemathsymbol [updownarrow] [rel] [sy] ["6C] [ex] ["3F]
+\definemathsymbol [Uparrow] [rel] [sy] ["2A] [ex] ["7E]
+\definemathsymbol [Downarrow] [rel] [sy] ["2B] [ex] ["7F]
+\definemathsymbol [Updownarrow] [rel] [sy] ["6D] [ex] ["77]
+\definemathsymbol [backslash] [nothing] [sy] ["6E] [ex] ["0F]
+\definemathsymbol [langle] [open] [sy] ["68] [ex] ["0A]
+\definemathsymbol [rangle] [close] [sy] ["69] [ex] ["0B]
+\definemathsymbol [lbrace] [open] [sy] ["66] [ex] ["08]
+\definemathsymbol [rbrace] [close] [sy] ["67] [ex] ["09]
+\definemathsymbol [lceil] [open] [sy] ["64] [ex] ["06]
+\definemathsymbol [rceil] [close] [sy] ["65] [ex] ["07]
+\definemathsymbol [lfloor] [open] [sy] ["62] [ex] ["04]
+\definemathsymbol [rfloor] [close] [sy] ["63] [ex] ["05]
+
+\definemathsymbol [sqrt] [radical] [sy] ["70] [ex] ["70]
+
+\stopmathcollection
+
+%D By request:
+
+\startmathcollection[default]
+
+\definemathsymbol [lvert] [open] [sy] ["6A] [ex] ["0C]
+\definemathsymbol [rvert] [close] [sy] ["6A] [ex] ["0C]
+
+\definemathsymbol [lVert] [open] [sy] ["6B] [ex] ["0D]
+\definemathsymbol [rVert] [close] [sy] ["6B] [ex] ["0D]
+
+\stopmathcollection
+
+%D For brooks:
+%D
+%D \starttyping
+%D $\sqrt[3]{10}$
+%D \stoptyping
+
+\ifx\normalsqrt\undefined \let\normalsqrt\sqrt \fi % just set to: \dohandlemathtoken {sqrt}
+
+\def\notsosqrt[#1]{\root#1\of}
+
+\unexpanded\def\sqrt{\doifnextoptionalelse\notsosqrt\normalsqrt}
+
+\def\PLAINbig {\@@dobig{0.85}}
+\def\PLAINBig {\@@dobig{1.15}}
+\def\PLAINbigg{\@@dobig{1.45}}
+\def\PLAINBigg{\@@dobig{1.75}}
+
+\startrawmathcollection [default]
+
+\definemathcommand [bigl] [open] [one] {\big}
+\definemathcommand [bigm] [rel] [one] {\big}
+\definemathcommand [bigr] [close] [one] {\big}
+\definemathcommand [Bigl] [open] [one] {\Big}
+\definemathcommand [Bigm] [rel] [one] {\Big}
+\definemathcommand [Bigr] [close] [one] {\Big}
+\definemathcommand [biggl] [open] [one] {\bigg}
+\definemathcommand [biggm] [rel] [one] {\bigg}
+\definemathcommand [biggr] [close] [one] {\bigg}
+\definemathcommand [Biggl] [open] [one] {\Bigg}
+\definemathcommand [Biggm] [rel] [one] {\Bigg}
+\definemathcommand [Biggr] [close] [one] {\Bigg}
+
+\definemathcommand [big] {\PLAINbig}
+\definemathcommand [Big] {\PLAINBig}
+\definemathcommand [bigg] {\PLAINbigg}
+\definemathcommand [Bigg] {\PLAINBigg}
+
+\stoprawmathcollection
+
+\startmathcollection[default]
+
+\definemathsymbol [dag] [box] [sy] ["79]
+\definemathsymbol [ddag] [box] [sy] ["7A]
+\definemathsymbol [S] [box] [sy] ["78]
+\definemathsymbol [P] [box] [sy] ["7B]
+\definemathsymbol [Orb] [box] [sy] ["0D]
+
+\stopmathcollection
+
+\def\PLAINroot#1#2%
+ {\setbox\zerocount\hbox{$\mathsurround\zeropoint#1\sqrt{#2}$}\dimen@\ht\zerocount
+ \advance\dimen@-\dp\zerocount
+ \mkern5mu\raise.6\dimen@\copy\rootbox \mkern-10mu\box\zerocount}
+
+\def\PLAINmatrix#1%
+ {\null\,\vcenter{\normalbaselines\mathsurround\zeropoint
+ \ialign{\hfil$##$\hfil&&\quad\hfil$##$\hfil\crcr
+ \mathstrut\crcr\noalign{\kern-\baselineskip}
+ #1\crcr\mathstrut\crcr\noalign{\kern-\baselineskip}}}\,}
+
+\startrawmathcollection[default]
+
+\definemathcommand [mathstrut] {\vphantom{(}}
+\definemathcommand [joinrel] {\mathrel{\mkern-3mu}}
+\definemathcommand [r@@t] {\PLAINroot}
+\definemathcommand [matrix] {\PLAINmatrix}
+
+\definemathcommand [over] {\normalover} % hack, to do
+
+\stoprawmathcollection
+
+\def\{{\lbrace}
+\def\}{\rbrace}
+
+%def\bbd{\fam\purefamily{blackboard}}
+%def\cal{\fam\purefamily{calfamily}}
+
+\def\mit{\fam\purefamily{mitfamily}}
+
+\def\Bbb{\blackboard} % conforming amstex
+
+\startmathcollection[default]
+
+ \definemathsymbol [mathperiod] [ord] [mi] ["3A]
+ \definemathsymbol [textperiod] [punct] [mi] ["3A]
+
+ \definemathsymbol [mathcomma] [ord] [mi] ["3B]
+ \definemathsymbol [textcomma] [punct] [mi] ["3B]
+
+\stopmathcollection
+
+\definemathpunctuation . mathperiod textperiod
+\definemathpunctuation , mathcomma textcomma
+
+%D The following colon related definitions are provided by Aditya
+%D Mahajan who derived them from \type {mathtools.sty} and \type
+%D {colonequals.sty}.
+
+%D \macros
+%D {centercolon, colonminus, minuscolon, colonequals, equalscolon,
+%D colonapprox, approxcolon, colonsim, simcolon, coloncolon,
+%D coloncolonminus, minuscoloncolon, coloncolonequals,
+%D equalscoloncolon, coloncolonapprox, approxcoloncolon,
+%D colonsim, simcoloncolon}
+%D
+%D In $a := b$ the colon is not vertically centered with the equal
+%D to. Also the distance between colon and equal to is a bit large.
+%D So, we define a vertically centered colon \tex {centercolon} and
+%D a few macros for colon and double colon relation symbols.
+%D
+%D \startlines
+%D \formula {A \centercolon B}
+%D \formula {A \colonminus B}
+%D \formula {A \minuscolon B}
+%D \formula {A \colonequals B}
+%D \formula {A \equalscolon B}
+%D \formula {A \colonapprox B}
+%D \formula {A \approxcolon B}
+%D \formula {A \colonsim B}
+%D \formula {A \simcolon B}
+%D \formula {A \coloncolon B}
+%D \formula {A \coloncolonminus B}
+%D \formula {A \minuscoloncolon B}
+%D \formula {A \coloncolonequals B}
+%D \formula {A \equalscoloncolon B}
+%D \formula {A \coloncolonapprox B}
+%D \formula {A \approxcoloncolon B}
+%D \formula {A \colonsim B}
+%D \formula {A \simcoloncolon B}
+%D \stoplines
+
+%D The next macros take care of the space between the colon and the
+%D relation symbol.
+
+\definemathcommand [colonsep] {\mkern-1.2mu}
+\definemathcommand [doublecolonsep] {\mkern-0.9mu}
+
+%D The next macro vertically centeres its contents.
+
+\def\@center@math#1%
+ {\vcenter{\hbox{$\mathsurround\zeropoint#1$}}}
+
+\def\@center@colon
+ {\mathpalette\@center@math{\colon}}
+
+%D Now we define all the colon relations.
+
+\definemathcommand [centercolon] [rel] {\@center@colon}
+\definemathcommand [colonminus] [rel] {\centercolon\colonsep\mathrel{-}}
+\definemathcommand [minuscolon] [rel] {\mathrel{-}\colonsep\centercolon}
+\definemathcommand [colonequals] [rel] {\centercolon\colonsep=}
+\definemathcommand [equalscolon] [rel] {=\centercolon\colonsep}
+\definemathcommand [colonapprox] [rel] {\centercolon\colonsep\approx}
+\definemathcommand [approxcolon] [rel] {\approx\centercolon\colonsep}
+\definemathcommand [colonsim] [rel] {\centercolon\colonsep\sim}
+\definemathcommand [simcolon] [rel] {\sim\centercolon\colonsep}
+
+\definemathcommand [coloncolon] [rel] {\centercolon\doublecolonsep\centercolon}
+\definemathcommand [coloncolonminus] [rel] {\coloncolon\colonsep\mathrel{-}}
+\definemathcommand [minuscoloncolon] [rel] {\mathrel{-}\colonsep\coloncolon}
+\definemathcommand [coloncolonequals] [rel] {\coloncolon\colonsep=}
+\definemathcommand [equalscoloncolon] [rel] {=\coloncolon\colonsep}
+\definemathcommand [coloncolonapprox] [rel] {\coloncolon\colonsep\approx}
+\definemathcommand [approxcoloncolon] [rel] {\approx\coloncolon\colonsep}
+\definemathcommand [colonsim] [rel] {\coloncolon\colonsep\sim}
+\definemathcommand [simcoloncolon] [rel] {\sim\coloncolon\colonsep}
+
+%D More integrals (AM):
+
+\def\dointkern{\mkern-6mu\mathchoice{\mkern-3mu}{}{}{}}
+
+\definemathcommand [iint] {\repeatintegral\plusone }
+\definemathcommand [iiint] {\repeatintegral\plustwo }
+\definemathcommand [iiiint] {\repeatintegral\plusthree}
+
+\def\repeatintegral#1%
+ {\scratchtoks\emptytoks
+ \let\dointlimits\donothing
+ \let\dodointlimits\intlimits
+ \dorecurse{#1}{\appendtoks \intop \dointkern \to \scratchtoks}
+ \appendtoks \intop \dointlimits \dodointlimits \to \scratchtoks
+ \edef\dodorepeatintegral{\the\scratchtoks}%
+ \futurelet\next\dorepeatintegral}
+
+%D If the \type{\limits} option is used after \type{\iint}, use
+%D \type{\mathop} and fudge the left hand space a bit to make the
+%D subscript visually centered.
+
+\def\dorepeatintegral
+ {\ifx\next\limits \dointlimitcorrection \else
+ \ifx\next\displaylimits \dointlimitcorrection \else
+ \ifx\next\nolimits \donothing \else
+ \ifcase\intlimitcode\else \dointlimitcorrection \fi\fi\fi\fi
+ \dodorepeatintegral}
+
+\def\dointlimitcorrection
+ {\mkern-7mu\mathchoice{\mkern-2mu}{}{}{}%
+ \mathop\bgroup
+ \mkern7mu\mathchoice{\mkern2mu}{}{}{}%
+ \let\dointlimits\egroup}
+
+\setupmathematics
+ [integral=nolimits]
+
+\protect \endinput
diff --git a/tex/context/base/math-tex.tex b/tex/context/base/math-tex.tex
deleted file mode 100644
index c833db956..000000000
--- a/tex/context/base/math-tex.tex
+++ /dev/null
@@ -1,718 +0,0 @@
-%D \module
-%D [ file=math-tex,
-%D version=2001.04.12,
-%D subtitle=Plain Specials,
-%D author={Hans Hagen, Taco Hoekwater \& Aditya Mahajan},
-%D date=\currentdate,
-%D copyright=\PRAGMA]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-% beware: in mkiv we will do it differently
-
-\unprotect
-
-\mathcode`\ ="8000 \mathcode`\_="8000 \mathcode`\'="8000
-
-\definefamilysynonym [default] [calligraphic] [sy]
-\definefamilysynonym [default] [oldstyle] [mi]
-\definefamilysynonym [default] [blackboard] [mr]
-\definefamilysynonym [default] [gothic] [mr]
-\definefamilysynonym [default] [fraktur] [mr]
-
-\definefamilysynonym [default] [lcgreek] [mi]
-\definefamilysynonym [default] [ucgreek] [mr]
-\definefamilysynonym [default] [vargreek] [mi]
-
-
-%D \macros
-%D {\setupmathematics}
-%D
-%D Configuration for integrals. (If needed we can speed this up and make it
-%D installable; no processaction is needed then).
-
-\chardef\intlimitcode\zerocount % 0 nolimits 1 displaylimits 2 limits
-
-\def\intlimits
- {\ifcase\intlimitcode \nolimits \or \displaylimits \or \limits \fi}
-
-\def\setupmathematics
- {\dosingleargument\dosetupmathematics}
-
-\def\dosetupmathematics[#1]%
- {\getparameters[\??mo][#1]
- \processaction[\@@mointegral]
- [ nolimits=>\chardef\intlimitcode\zerocount,
- displaylimits=>\chardef\intlimitcode\plusone,
- limits=>\chardef\intlimitcode\plustwo]}
-
-%D \startbuffer
-%D $\int_a^b f(x) dx$ and also
-%D $\iint_a^b f(x,y) dxdy$, $\iiint_a^b f(x,y) dxdy$,
-%D $\iiiint_a^b f(x) dx$
-%D \startformula
-%D \int_a^b f(x) dx \quad
-%D \iint_a^b f(x) dx \quad
-%D \iiint_a^b f(x) dx \quad
-%D \iiiint_a^b f(x) dx \quad
-%D \stopformula
-%D \stopbuffer
-%D
-%D Default: \getbuffer
-%D
-%D Displaylimits: \setupmathematics[integral=displaylimits] \getbuffer
-%D
-%D Limits: \setupmathematics[integral=limits] \getbuffer
-
-\startmathcollection [default]
-
-\definemathsymbol [alpha] [nothing] [lcgreek] ["0B]
-\definemathsymbol [beta] [nothing] [lcgreek] ["0C]
-\definemathsymbol [gamma] [nothing] [lcgreek] ["0D]
-\definemathsymbol [delta] [nothing] [lcgreek] ["0E]
-\definemathsymbol [epsilon] [nothing] [lcgreek] ["0F]
-\definemathsymbol [zeta] [nothing] [lcgreek] ["10]
-\definemathsymbol [eta] [nothing] [lcgreek] ["11]
-\definemathsymbol [theta] [nothing] [lcgreek] ["12]
-\definemathsymbol [iota] [nothing] [lcgreek] ["13]
-\definemathsymbol [kappa] [nothing] [lcgreek] ["14]
-\definemathsymbol [lambda] [nothing] [lcgreek] ["15]
-\definemathsymbol [mu] [nothing] [lcgreek] ["16]
-\definemathsymbol [nu] [nothing] [lcgreek] ["17]
-\definemathsymbol [xi] [nothing] [lcgreek] ["18]
-\definemathsymbol [omicron] [nothing] [lcgreek] ["6F]
-\definemathsymbol [pi] [nothing] [lcgreek] ["19]
-\definemathsymbol [rho] [nothing] [lcgreek] ["1A]
-\definemathsymbol [sigma] [nothing] [lcgreek] ["1B]
-\definemathsymbol [tau] [nothing] [lcgreek] ["1C]
-\definemathsymbol [upsilon] [nothing] [lcgreek] ["1D]
-\definemathsymbol [phi] [nothing] [lcgreek] ["1E]
-\definemathsymbol [chi] [nothing] [lcgreek] ["1F]
-\definemathsymbol [psi] [nothing] [lcgreek] ["20]
-\definemathsymbol [omega] [nothing] [lcgreek] ["21]
-
-\stopmathcollection
-
-\startmathcollection [default]
-
-\definemathsymbol [varepsilon] [nothing] [vargreek] ["22]
-\definemathsymbol [vartheta] [nothing] [vargreek] ["23]
-\definemathsymbol [varpi] [nothing] [vargreek] ["24]
-\definemathsymbol [varrho] [nothing] [vargreek] ["25]
-\definemathsymbol [varsigma] [nothing] [vargreek] ["26]
-\definemathsymbol [varphi] [nothing] [vargreek] ["27]
-
-\stopmathcollection
-
-\startmathcollection [default]
-
-\definemathsymbol [Alpha] [alpha] [ucgreek] ["41] % A
-\definemathsymbol [Beta] [alpha] [ucgreek] ["42] % B
-\definemathsymbol [Gamma] [alpha] [ucgreek] ["00]
-\definemathsymbol [Delta] [alpha] [ucgreek] ["01]
-\definemathsymbol [Epsilon] [alpha] [ucgreek] ["45] % E
-\definemathsymbol [Zeta] [alpha] [ucgreek] ["5A] % Z
-\definemathsymbol [Eta] [alpha] [ucgreek] ["48] % H
-\definemathsymbol [Theta] [alpha] [ucgreek] ["02]
-\definemathsymbol [Iota] [alpha] [ucgreek] ["49] % I
-\definemathsymbol [Kappa] [alpha] [ucgreek] ["4B] % K
-\definemathsymbol [Lambda] [alpha] [ucgreek] ["03]
-\definemathsymbol [Mu] [alpha] [ucgreek] ["4D] % M
-\definemathsymbol [Nu] [alpha] [ucgreek] ["4E] % N
-\definemathsymbol [Xi] [alpha] [ucgreek] ["04]
-\definemathsymbol [Omicron] [alpha] [ucgreek] ["4F] % O
-\definemathsymbol [Pi] [alpha] [ucgreek] ["05]
-\definemathsymbol [Rho] [alpha] [ucgreek] ["52] % R
-\definemathsymbol [Sigma] [alpha] [ucgreek] ["06]
-\definemathsymbol [Tau] [alpha] [ucgreek] ["54] % T
-\definemathsymbol [Upsilon] [alpha] [ucgreek] ["07]
-\definemathsymbol [Phi] [alpha] [ucgreek] ["08]
-\definemathsymbol [Chi] [alpha] [ucgreek] ["58] % X
-\definemathsymbol [Psi] [alpha] [ucgreek] ["09]
-\definemathsymbol [Omega] [alpha] [ucgreek] ["0A]
-
-\stopmathcollection
-
-% The \mfunction macro is an alternative for \hbox with a
-% controlable font switch.
-
-\startmathcollection[default]
-
-\definemathcommand [arccos] [nolop] {\mfunction{arccos}}
-\definemathcommand [arcsin] [nolop] {\mfunction{arcsin}}
-\definemathcommand [arctan] [nolop] {\mfunction{arctan}}
-\definemathcommand [arg] [nolop] {\mfunction{arg}}
-\definemathcommand [cosh] [nolop] {\mfunction{cosh}}
-\definemathcommand [cos] [nolop] {\mfunction{cos}}
-\definemathcommand [coth] [nolop] {\mfunction{coth}}
-\definemathcommand [cot] [nolop] {\mfunction{cot}}
-\definemathcommand [csc] [nolop] {\mfunction{csc}}
-\definemathcommand [deg] [nolop] {\mfunction{deg}}
-\definemathcommand [det] [limop] {\mfunction{det}}
-\definemathcommand [dim] [nolop] {\mfunction{dim}}
-\definemathcommand [exp] [nolop] {\mfunction{exp}}
-\definemathcommand [gcd] [limop] {\mfunction{gcd}}
-\definemathcommand [hom] [nolop] {\mfunction{hom}}
-\definemathcommand [inf] [limop] {\mfunction{inf}}
-\definemathcommand [injlim] [limop] {\mfunction{inj\,lim}}
-\definemathcommand [ker] [nolop] {\mfunction{ker}}
-\definemathcommand [lg] [nolop] {\mfunction{lg}}
-\definemathcommand [liminf] [limop] {\mfunction{lim\,inf}}
-\definemathcommand [limsup] [limop] {\mfunction{lim\,sup}}
-\definemathcommand [lim] [limop] {\mfunction{lim}}
-\definemathcommand [ln] [nolop] {\mfunction{ln}}
-\definemathcommand [log] [nolop] {\mfunction{log}}
-\definemathcommand [median] [limop] {\mfunction{median}}
-\definemathcommand [max] [limop] {\mfunction{max}}
-\definemathcommand [min] [limop] {\mfunction{min}}
-\definemathcommand [mod] [limop] {\mfunction{mod}}
-\definemathcommand [div] [limop] {\mfunction{div}}
-\definemathcommand [projlim] [limop] {\mfunction{proj\,lim}}
-\definemathcommand [Pr] [limop] {\mfunction{Pr}}
-\definemathcommand [sec] [nolop] {\mfunction{sec}}
-\definemathcommand [sinh] [nolop] {\mfunction{sinh}}
-\definemathcommand [sin] [nolop] {\mfunction{sin}}
-\definemathcommand [sup] [limop] {\mfunction{sup}}
-\definemathcommand [tanh] [nolop] {\mfunction{tanh}}
-\definemathcommand [tan] [nolop] {\mfunction{tan}}
-
-\stopmathcollection
-
-\startmathcollection[default]
-
-\definemathcommand [integers] {\mfunction{Z}}
-\definemathcommand [reals] {\mfunction{R}}
-\definemathcommand [rationals] {\mfunction{Q}}
-\definemathcommand [naturalnumbers] {\mfunction{N}}
-\definemathcommand [complexes] {\mfunction{C}}
-\definemathcommand [primes] {\mfunction{P}}
-
-\stopmathcollection
-
-\startmathcollection[default]
-
-\definemathcharacter [!] [close] [mr] ["21]
-\definemathcharacter [(] [open] [mr] ["28]
-\definemathcharacter [)] [close] [mr] ["29]
-\definemathcharacter [*] [bin] [sy] ["03]
-\definemathcharacter [+] [bin] [mr] ["2B]
-\definemathcharacter [,] [punct] [mi] ["3B]
-\definemathcharacter [-] [bin] [sy] ["00]
-\definemathcharacter [.] [ord] [mi] ["3A]
-\definemathcharacter [/] [ord] [mi] ["3D]
-\definemathcharacter [:] [rel] [mr] ["3A]
-\definemathcharacter [;] [punct] [mr] ["3B]
-\definemathcharacter [<] [rel] [mi] ["3C]
-\definemathcharacter [=] [rel] [mr] ["3D]
-\definemathcharacter [>] [rel] [mi] ["3E]
-\definemathcharacter [?] [close] [mr] ["3F]
-\definemathcharacter [91] [open] [mr] ["5B] % [
-\definemathcharacter [92] [ord] [sy] ["6E] % \
-\definemathcharacter [93] [close] [mr] ["5D] % ]
-\definemathcharacter [123] [open] [sy] ["66] % {
-\definemathcharacter [124] [ord] [sy] ["6A] % |
-\definemathcharacter [125] [close] [sy] ["67] % }
-
-\stopmathcollection
-
-\startmathcollection[default]
-
-\definemathcharacter [(] [nothing] [mr] ["28] [ex] ["00]
-\definemathcharacter [)] [nothing] [mr] ["29] [ex] ["01]
-\definemathcharacter [91] [nothing] [mr] ["5B] [ex] ["02] % [
-\definemathcharacter [93] [nothing] [mr] ["5D] [ex] ["03] % ]
-\definemathcharacter [<] [nothing] [sy] ["68] [ex] ["0A]
-\definemathcharacter [>] [nothing] [sy] ["69] [ex] ["0B]
-\definemathcharacter [/] [nothing] [mr] ["2F] [ex] ["0E]
-\definemathcharacter [124] [nothing] [sy] ["6A] [ex] ["0C] % |
-\definemathcharacter [92] [nothing] [sy] ["6E] [ex] ["0F] % \
-
-\stopmathcollection
-
-\def\PLAINangle
- {{\vbox{\ialign{$\mathsurround\zeropoint\scriptstyle##$\crcr
- \not\mathrel{\mkern14mu}\crcr
- \noalign{\nointerlineskip}
- \mkern2.5mu\leaders\hrule height.34pt\hfill\mkern2.5mu\crcr}}}}
-
-\startmathcollection[default]
-
-\definemathsymbol [aleph] [nothing] [sy] ["40]
-\definemathsymbol [imath] [nothing] [mi] ["7B]
-\definemathsymbol [jmath] [nothing] [mi] ["7C]
-\definemathsymbol [ell] [nothing] [mi] ["60]
-\definemathsymbol [wp] [nothing] [mi] ["7D]
-\definemathsymbol [Re] [nothing] [sy] ["3C]
-\definemathsymbol [Im] [nothing] [sy] ["3D]
-\definemathsymbol [partial] [nothing] [mi] ["40]
-\definemathsymbol [infty] [nothing] [sy] ["31]
-\definemathsymbol [prime] [nothing] [sy] ["30]
-\definemathsymbol [emptyset] [nothing] [sy] ["3B]
-\definemathsymbol [nabla] [nothing] [sy] ["72]
-\definemathsymbol [top] [nothing] [sy] ["3E]
-\definemathsymbol [bot] [nothing] [sy] ["3F]
-
-\definemathcommand [hbar] {{\mathchar'26\mkern-9muh}}
-\definemathcommand [surd] {{\mathchar"1270}} % ?
-\definemathcommand [angle] {\PLAINangle}
-
-\stopmathcollection
-
-\startmathcollection[default]
-
-\definemathsymbol [triangle] [ord] [sy] ["34]
-\definemathsymbol [forall] [ord] [sy] ["38]
-\definemathsymbol [exists] [ord] [sy] ["39]
-\definemathsymbol [neg] [ord] [sy] ["3A]
-\definemathsymbol [flat] [ord] [mi] ["5B]
-\definemathsymbol [natural] [ord] [mi] ["5C]
-\definemathsymbol [sharp] [ord] [mi] ["5D]
-\definemathsymbol [clubsuit] [ord] [sy] ["7C]
-\definemathsymbol [diamondsuit] [ord] [sy] ["7D]
-\definemathsymbol [heartsuit] [ord] [sy] ["7E]
-\definemathsymbol [spadesuit] [ord] [sy] ["7F]
-
-\stopmathcollection
-
-\startmathcollection[default]
-
-\definemathcommand [square] {\hbox{\hsmash{$\sqcup$}$\sqcap$}}
-
-\stopmathcollection
-
-\startmathcollection[default]
-
-\definemathsymbol [coprod] [op] [ex] ["60]
-\definemathsymbol [bigvee] [op] [ex] ["57]
-\definemathsymbol [bigwedge] [op] [ex] ["56]
-\definemathsymbol [biguplus] [op] [ex] ["55]
-\definemathsymbol [bigcap] [op] [ex] ["54]
-\definemathsymbol [bigcup] [op] [ex] ["53]
-\definemathsymbol [intop] [op] [ex] ["52]
-\definemathsymbol [prod] [op] [ex] ["51]
-\definemathsymbol [sum] [op] [ex] ["50]
-\definemathsymbol [bigotimes] [op] [ex] ["4E]
-\definemathsymbol [bigoplus] [op] [ex] ["4C]
-\definemathsymbol [bigodot] [op] [ex] ["4A]
-\definemathsymbol [ointop] [op] [ex] ["48]
-\definemathsymbol [bigsqcup] [op] [ex] ["46]
-\definemathsymbol [smallint] [op] [sy] ["73]
-
-\stopmathcollection
-
-\startmathcollection[default]
-
-\definemathsymbol [triangleleft] [bin] [mi] ["2F]
-\definemathsymbol [triangleright] [bin] [mi] ["2E]
-\definemathsymbol [bigtriangleup] [bin] [sy] ["34]
-\definemathsymbol [bigtriangledown] [bin] [sy] ["35]
-\definemathsymbol [wedge] [bin] [sy] ["5E]
-\definemathsymbol [vee] [bin] [sy] ["5F]
-\definemathsymbol [cap] [bin] [sy] ["5C]
-\definemathsymbol [cup] [bin] [sy] ["5B]
-\definemathsymbol [ddagger] [bin] [sy] ["7A]
-\definemathsymbol [dagger] [bin] [sy] ["79]
-\definemathsymbol [sqcap] [bin] [sy] ["75]
-\definemathsymbol [sqcup] [bin] [sy] ["74]
-\definemathsymbol [uplus] [bin] [sy] ["5D]
-\definemathsymbol [amalg] [bin] [sy] ["71]
-\definemathsymbol [diamond] [bin] [sy] ["05]
-\definemathsymbol [bullet] [bin] [sy] ["0F]
-\definemathsymbol [wr] [bin] [sy] ["6F]
-\definemathsymbol [div] [bin] [sy] ["04]
-\definemathsymbol [odot] [bin] [sy] ["0C]
-\definemathsymbol [oslash] [bin] [sy] ["0B]
-\definemathsymbol [otimes] [bin] [sy] ["0A]
-\definemathsymbol [ominus] [bin] [sy] ["09]
-\definemathsymbol [oplus] [bin] [sy] ["08]
-\definemathsymbol [mp] [bin] [sy] ["07]
-\definemathsymbol [pm] [bin] [sy] ["06]
-\definemathsymbol [circ] [bin] [sy] ["0E]
-\definemathsymbol [bigcirc] [bin] [sy] ["0D]
-\definemathsymbol [setminus] [bin] [sy] ["6E]
-\definemathsymbol [cdot] [bin] [sy] ["01]
-\definemathsymbol [ast] [bin] [sy] ["03]
-\definemathsymbol [times] [bin] [sy] ["02]
-\definemathsymbol [star] [bin] [mi] ["3F]
-
-\stopmathcollection
-
-\startmathcollection[default]
-
-\definemathsymbol [propto] [rel] [sy] ["2F]
-\definemathsymbol [sqsubseteq] [rel] [sy] ["76]
-\definemathsymbol [sqsupseteq] [rel] [sy] ["77]
-\definemathsymbol [parallel] [rel] [sy] ["6B]
-\definemathsymbol [mid] [rel] [sy] ["6A]
-\definemathsymbol [dashv] [rel] [sy] ["61]
-\definemathsymbol [vdash] [rel] [sy] ["60]
-\definemathsymbol [nearrow] [rel] [sy] ["25]
-\definemathsymbol [searrow] [rel] [sy] ["26]
-\definemathsymbol [nwarrow] [rel] [sy] ["2D]
-\definemathsymbol [swarrow] [rel] [sy] ["2E]
-\definemathsymbol [Leftrightarrow] [rel] [sy] ["2C]
-\definemathsymbol [Leftarrow] [rel] [sy] ["28]
-\definemathsymbol [Rightarrow] [rel] [sy] ["29]
-
-\stopmathcollection
-
-\startmathcollection[default]
-
-\definemathcommand [lnot] {\neg}
-\definemathcommand [int] {\intop \intlimits}
-\definemathcommand [oint] {\ointop\intlimits}
-\definemathcommand [land] {\wedge}
-\definemathcommand [lor] {\vee}
-\definemathcommand [neq] {\not=}
-\definemathcommand [ne] {\neq}
-\definemathcommand [le] {\leq}
-\definemathcommand [ge] {\geq}
-\definemathcommand [eq] {=}
-\definemathcommand [gt] {>}
-\definemathcommand [lt] {<}
-\definemathcommand [gets] {\leftarrow}
-\definemathcommand [owns] {\ni}
-\definemathcommand [to] {\rightarrow}
-\definemathcommand [mapsto] {\mapstochar\rightarrow}
-
-\stopmathcollection
-
-\startmathcollection[default]
-
-\definemathsymbol [leq] [rel] [sy] ["14]
-\definemathsymbol [geq] [rel] [sy] ["15]
-\definemathsymbol [succ] [rel] [sy] ["1F]
-\definemathsymbol [prec] [rel] [sy] ["1E]
-\definemathsymbol [approx] [rel] [sy] ["19]
-\definemathsymbol [succeq] [rel] [sy] ["17]
-\definemathsymbol [preceq] [rel] [sy] ["16]
-\definemathsymbol [supset] [rel] [sy] ["1B]
-\definemathsymbol [subset] [rel] [sy] ["1A]
-\definemathsymbol [supseteq] [rel] [sy] ["13]
-\definemathsymbol [subseteq] [rel] [sy] ["12]
-\definemathsymbol [in] [rel] [sy] ["32]
-\definemathsymbol [ni] [rel] [sy] ["33]
-\definemathsymbol [gg] [rel] [sy] ["1D]
-\definemathsymbol [ll] [rel] [sy] ["1C]
-\definemathsymbol [not] [rel] [sy] ["36]
-\definemathsymbol [leftrightarrow] [rel] [sy] ["24]
-\definemathsymbol [leftarrow] [rel] [sy] ["20]
-\definemathsymbol [rightarrow] [rel] [sy] ["21]
-\definemathsymbol [mapstochar] [rel] [sy] ["37]
-\definemathsymbol [sim] [rel] [sy] ["18]
-\definemathsymbol [simeq] [rel] [sy] ["27]
-\definemathsymbol [perp] [rel] [sy] ["3F]
-\definemathsymbol [equiv] [rel] [sy] ["11]
-\definemathsymbol [asymp] [rel] [sy] ["10]
-\definemathsymbol [smile] [rel] [mi] ["5E]
-\definemathsymbol [frown] [rel] [mi] ["5F]
-\definemathsymbol [leftharpoonup] [rel] [mi] ["28]
-\definemathsymbol [leftharpoondown] [rel] [mi] ["29]
-\definemathsymbol [rightharpoonup] [rel] [mi] ["2A]
-\definemathsymbol [rightharpoondown] [rel] [mi] ["2B]
-\definemathsymbol [lhook] [rel] [mi] ["2C]
-\definemathsymbol [rhook] [rel] [mi] ["2D]
-
-\stopmathcollection
-
-\def\PLAINldots
- {\ldotp\ldotp\ldotp}
-
-\def\PLAINcdots
- {\cdotp\cdotp\cdotp}
-
-\def\PLAINvdots
- {\vbox{\baselineskip.4\bodyfontsize\lineskiplimit\zeropoint
- \kern.6\bodyfontsize\hbox{.}\hbox{.}\hbox{.}}}
-
-\def\PLAINddots
- {\mkern1mu\raise.7\bodyfontsize\vbox{\kern.7\bodyfontsize\hbox{.}}\mkern2mu
- \raise.4\bodyfontsize\hbox{.}\mkern2mu\raise.1\bodyfontsize\hbox{.}\mkern1mu}
-
-\startmathcollection[default]
-
-\definemathcommand [hookrightarrow] {\lhook\joinrel\rightarrow}
-\definemathcommand [hookleftarrow] {\leftarrow\joinrel\rhook}
-\definemathcommand [bowtie] {\mathrel\triangleright\joinrel\mathrel\triangleleft}
-\definemathcommand [models] {\mathrel|\joinrel=}
-\definemathcommand [iff] {\;\Longleftrightarrow\;}
-
-\definemathsymbol [ldotp] [punct] [mi] ["3A]
-\definemathsymbol [cdotp] [punct] [sy] ["01]
-\definemathsymbol [colon] [punct] [mr] ["3A]
-
-\definemathcommand [ldots] [inner] {\PLAINldots}
-\definemathcommand [cdots] [inner] {\PLAINcdots}
-\definemathcommand [vdots] [nothing] {\PLAINvdots}
-\definemathcommand [ddots] [inner] {\PLAINddots}
-
-\stopmathcollection
-
-\startmathcollection[default]
-
-\definemathsymbol [acute] [accent] [mr] ["13]
-\definemathsymbol [grave] [accent] [mr] ["12]
-\definemathsymbol [ddot] [accent] [mr] ["7F]
-\definemathsymbol [tilde] [accent] [mr] ["7E]
-\definemathsymbol [mathring] [accent] [mr] ["17]
-\definemathsymbol [bar] [accent] [mr] ["16]
-\definemathsymbol [breve] [accent] [mr] ["15]
-\definemathsymbol [check] [accent] [mr] ["14]
-\definemathsymbol [hat] [accent] [mr] ["5E]
-\definemathsymbol [vec] [accent] [mi] ["7E] % [ord]
-\definemathsymbol [dot] [accent] [mr] ["5F]
-\definemathsymbol [widetilde] [accent] [ex] ["65] % [ord]
-\definemathsymbol [widehat] [accent] [ex] ["62] % [ord]
-
-\stopmathcollection
-
-\startmathcollection[default]
-
-\definemathsymbol [lmoustache] [open] [ex] ["7A] [ex] ["40]
-\definemathsymbol [rmoustache] [close] [ex] ["7B] [ex] ["41]
-\definemathsymbol [lgroup] [open] [mr] ["28] [ex] ["3A] % ?
-\definemathsymbol [rgroup] [close] [mr] ["29] [ex] ["3B] % ?
-\definemathsymbol [arrowvert] [nothing] [sy] ["6A] [ex] ["3C]
-\definemathsymbol [Arrowvert] [nothing] [sy] ["6B] [ex] ["3D]
-\definemathsymbol [bracevert] [nothing] [ex] ["3E] % ?
-\definemathsymbol [Vert] [nothing] [sy] ["6B] [ex] ["0D]
-\definemathsymbol [vert] [nothing] [sy] ["6A] [ex] ["0C]
-\definemathsymbol [uparrow] [rel] [sy] ["22] [ex] ["78]
-\definemathsymbol [downarrow] [rel] [sy] ["23] [ex] ["79]
-\definemathsymbol [updownarrow] [rel] [sy] ["6C] [ex] ["3F]
-\definemathsymbol [Uparrow] [rel] [sy] ["2A] [ex] ["7E]
-\definemathsymbol [Downarrow] [rel] [sy] ["2B] [ex] ["7F]
-\definemathsymbol [Updownarrow] [rel] [sy] ["6D] [ex] ["77]
-\definemathsymbol [backslash] [nothing] [sy] ["6E] [ex] ["0F]
-\definemathsymbol [langle] [open] [sy] ["68] [ex] ["0A]
-\definemathsymbol [rangle] [close] [sy] ["69] [ex] ["0B]
-\definemathsymbol [lbrace] [open] [sy] ["66] [ex] ["08]
-\definemathsymbol [rbrace] [close] [sy] ["67] [ex] ["09]
-\definemathsymbol [lceil] [open] [sy] ["64] [ex] ["06]
-\definemathsymbol [rceil] [close] [sy] ["65] [ex] ["07]
-\definemathsymbol [lfloor] [open] [sy] ["62] [ex] ["04]
-\definemathsymbol [rfloor] [close] [sy] ["63] [ex] ["05]
-
-\definemathsymbol [sqrt] [radical] [sy] ["70] [ex] ["70]
-
-\stopmathcollection
-
-%D By request:
-
-\startmathcollection[default]
-
-\definemathsymbol [lvert] [open] [sy] ["6A] [ex] ["0C]
-\definemathsymbol [rvert] [close] [sy] ["6A] [ex] ["0C]
-
-\definemathsymbol [lVert] [open] [sy] ["6B] [ex] ["0D]
-\definemathsymbol [rVert] [close] [sy] ["6B] [ex] ["0D]
-
-\stopmathcollection
-
-%D For brooks:
-%D
-%D \starttyping
-%D $\sqrt[3]{10}$
-%D \stoptyping
-
-\ifx\normalsqrt\undefined \let\normalsqrt\sqrt \fi % just set to: \dohandlemathtoken {sqrt}
-
-\def\notsosqrt[#1]{\root#1\of}
-
-\unexpanded\def\sqrt{\doifnextoptionalelse\notsosqrt\normalsqrt}
-
-\def\PLAINbig {\@@dobig{0.85}}
-\def\PLAINBig {\@@dobig{1.15}}
-\def\PLAINbigg{\@@dobig{1.45}}
-\def\PLAINBigg{\@@dobig{1.75}}
-
-\startrawmathcollection [default]
-
-\definemathcommand [bigl] [open] [one] {\big}
-\definemathcommand [bigm] [rel] [one] {\big}
-\definemathcommand [bigr] [close] [one] {\big}
-\definemathcommand [Bigl] [open] [one] {\Big}
-\definemathcommand [Bigm] [rel] [one] {\Big}
-\definemathcommand [Bigr] [close] [one] {\Big}
-\definemathcommand [biggl] [open] [one] {\bigg}
-\definemathcommand [biggm] [rel] [one] {\bigg}
-\definemathcommand [biggr] [close] [one] {\bigg}
-\definemathcommand [Biggl] [open] [one] {\Bigg}
-\definemathcommand [Biggm] [rel] [one] {\Bigg}
-\definemathcommand [Biggr] [close] [one] {\Bigg}
-
-\definemathcommand [big] {\PLAINbig}
-\definemathcommand [Big] {\PLAINBig}
-\definemathcommand [bigg] {\PLAINbigg}
-\definemathcommand [Bigg] {\PLAINBigg}
-
-\stoprawmathcollection
-
-\startmathcollection[default]
-
-\definemathsymbol [dag] [box] [sy] ["79]
-\definemathsymbol [ddag] [box] [sy] ["7A]
-\definemathsymbol [S] [box] [sy] ["78]
-\definemathsymbol [P] [box] [sy] ["7B]
-\definemathsymbol [Orb] [box] [sy] ["0D]
-
-\stopmathcollection
-
-\def\PLAINroot#1#2%
- {\setbox\zerocount\hbox{$\mathsurround\zeropoint#1\sqrt{#2}$}\dimen@\ht\zerocount
- \advance\dimen@-\dp\zerocount
- \mkern5mu\raise.6\dimen@\copy\rootbox \mkern-10mu\box\zerocount}
-
-\def\PLAINmatrix#1%
- {\null\,\vcenter{\normalbaselines\mathsurround\zeropoint
- \ialign{\hfil$##$\hfil&&\quad\hfil$##$\hfil\crcr
- \mathstrut\crcr\noalign{\kern-\baselineskip}
- #1\crcr\mathstrut\crcr\noalign{\kern-\baselineskip}}}\,}
-
-\startrawmathcollection[default]
-
-\definemathcommand [mathstrut] {\vphantom{(}}
-\definemathcommand [joinrel] {\mathrel{\mkern-3mu}}
-\definemathcommand [r@@t] {\PLAINroot}
-\definemathcommand [matrix] {\PLAINmatrix}
-
-\definemathcommand [over] {\normalover} % hack, to do
-
-\stoprawmathcollection
-
-\def\{{\lbrace}
-\def\}{\rbrace}
-
-%def\bbd{\fam\purefamily{blackboard}}
-%def\cal{\fam\purefamily{calfamily}}
-
-\def\mit{\fam\purefamily{mitfamily}}
-
-\def\Bbb{\blackboard} % conforming amstex
-
-\startmathcollection[default]
-
- \definemathsymbol [mathperiod] [ord] [mi] ["3A]
- \definemathsymbol [textperiod] [punct] [mi] ["3A]
-
- \definemathsymbol [mathcomma] [ord] [mi] ["3B]
- \definemathsymbol [textcomma] [punct] [mi] ["3B]
-
-\stopmathcollection
-
-\definemathpunctuation . mathperiod textperiod
-\definemathpunctuation , mathcomma textcomma
-
-%D The following colon related definitions are provided by Aditya
-%D Mahajan who derived them from \type {mathtools.sty} and \type
-%D {colonequals.sty}.
-
-%D \macros
-%D {centercolon, colonminus, minuscolon, colonequals, equalscolon,
-%D colonapprox, approxcolon, colonsim, simcolon, coloncolon,
-%D coloncolonminus, minuscoloncolon, coloncolonequals,
-%D equalscoloncolon, coloncolonapprox, approxcoloncolon,
-%D colonsim, simcoloncolon}
-%D
-%D In $a := b$ the colon is not vertically centered with the equal
-%D to. Also the distance between colon and equal to is a bit large.
-%D So, we define a vertically centered colon \tex {centercolon} and
-%D a few macros for colon and double colon relation symbols.
-%D
-%D \startlines
-%D \formula {A \centercolon B}
-%D \formula {A \colonminus B}
-%D \formula {A \minuscolon B}
-%D \formula {A \colonequals B}
-%D \formula {A \equalscolon B}
-%D \formula {A \colonapprox B}
-%D \formula {A \approxcolon B}
-%D \formula {A \colonsim B}
-%D \formula {A \simcolon B}
-%D \formula {A \coloncolon B}
-%D \formula {A \coloncolonminus B}
-%D \formula {A \minuscoloncolon B}
-%D \formula {A \coloncolonequals B}
-%D \formula {A \equalscoloncolon B}
-%D \formula {A \coloncolonapprox B}
-%D \formula {A \approxcoloncolon B}
-%D \formula {A \colonsim B}
-%D \formula {A \simcoloncolon B}
-%D \stoplines
-
-%D The next macros take care of the space between the colon and the
-%D relation symbol.
-
-\definemathcommand [colonsep] {\mkern-1.2mu}
-\definemathcommand [doublecolonsep] {\mkern-0.9mu}
-
-%D The next macro vertically centeres its contents.
-
-\def\@center@math#1%
- {\vcenter{\hbox{$\mathsurround\zeropoint#1$}}}
-
-\def\@center@colon
- {\mathpalette\@center@math{\colon}}
-
-%D Now we define all the colon relations.
-
-\definemathcommand [centercolon] [rel] {\@center@colon}
-\definemathcommand [colonminus] [rel] {\centercolon\colonsep\mathrel{-}}
-\definemathcommand [minuscolon] [rel] {\mathrel{-}\colonsep\centercolon}
-\definemathcommand [colonequals] [rel] {\centercolon\colonsep=}
-\definemathcommand [equalscolon] [rel] {=\centercolon\colonsep}
-\definemathcommand [colonapprox] [rel] {\centercolon\colonsep\approx}
-\definemathcommand [approxcolon] [rel] {\approx\centercolon\colonsep}
-\definemathcommand [colonsim] [rel] {\centercolon\colonsep\sim}
-\definemathcommand [simcolon] [rel] {\sim\centercolon\colonsep}
-
-\definemathcommand [coloncolon] [rel] {\centercolon\doublecolonsep\centercolon}
-\definemathcommand [coloncolonminus] [rel] {\coloncolon\colonsep\mathrel{-}}
-\definemathcommand [minuscoloncolon] [rel] {\mathrel{-}\colonsep\coloncolon}
-\definemathcommand [coloncolonequals] [rel] {\coloncolon\colonsep=}
-\definemathcommand [equalscoloncolon] [rel] {=\coloncolon\colonsep}
-\definemathcommand [coloncolonapprox] [rel] {\coloncolon\colonsep\approx}
-\definemathcommand [approxcoloncolon] [rel] {\approx\coloncolon\colonsep}
-\definemathcommand [colonsim] [rel] {\coloncolon\colonsep\sim}
-\definemathcommand [simcoloncolon] [rel] {\sim\coloncolon\colonsep}
-
-%D More integrals (AM):
-
-\def\dointkern{\mkern-6mu\mathchoice{\mkern-3mu}{}{}{}}
-
-\definemathcommand [iint] {\repeatintegral\plusone }
-\definemathcommand [iiint] {\repeatintegral\plustwo }
-\definemathcommand [iiiint] {\repeatintegral\plusthree}
-
-\def\repeatintegral#1%
- {\scratchtoks\emptytoks
- \let\dointlimits\donothing
- \let\dodointlimits\intlimits
- \dorecurse{#1}{\appendtoks \intop \dointkern \to \scratchtoks}
- \appendtoks \intop \dointlimits \dodointlimits \to \scratchtoks
- \edef\dodorepeatintegral{\the\scratchtoks}%
- \futurelet\next\dorepeatintegral}
-
-%D If the \type{\limits} option is used after \type{\iint}, use
-%D \type{\mathop} and fudge the left hand space a bit to make the
-%D subscript visually centered.
-
-\def\dorepeatintegral
- {\ifx\next\limits \dointlimitcorrection \else
- \ifx\next\displaylimits \dointlimitcorrection \else
- \ifx\next\nolimits \donothing \else
- \ifcase\intlimitcode\else \dointlimitcorrection \fi\fi\fi\fi
- \dodorepeatintegral}
-
-\def\dointlimitcorrection
- {\mkern-7mu\mathchoice{\mkern-2mu}{}{}{}%
- \mathop\bgroup
- \mkern7mu\mathchoice{\mkern2mu}{}{}{}%
- \let\dointlimits\egroup}
-
-\setupmathematics
- [integral=nolimits]
-
-\protect \endinput
diff --git a/tex/context/base/math-tim.mkii b/tex/context/base/math-tim.mkii
new file mode 100644
index 000000000..3b9aea103
--- /dev/null
+++ b/tex/context/base/math-tim.mkii
@@ -0,0 +1,371 @@
+%D \module
+%D [ file=math-tim,
+%D version=2001.04.12,
+%D title=\CONTEXT\ Math Macros,
+%D subtitle=Mathtime Specials,
+%D author={Hans Hagen \& Taco Hoekwater},
+%D date=\currentdate,
+%D copyright=\PRAGMA]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\endinput % i will clean this up after taco has gone over it
+
+%D With thanks to Berthold Horn from YandY for providing me
+%D evaluation copies of the MathTimePlus fonts.
+
+% version 0 : Michael Spivak
+% version 1 : Taco Hoekwater
+% version 2 : Hans Hagen
+% version 3 : etc etc etc
+
+\unprotect
+
+%D We use the predefined spare families \type {\mcfam} and
+%D \type {\mdfam}.
+
+\let\cafam\mcfam \let\hexcafam\hexmcfam
+\let\gbfam\mdfam \let\hexgbfam\hexmdfam
+\let\gkfam\mdfam \let\hexgkfam\hexmdfam
+
+% Why is this needed?
+
+% \font\tenmd =mtgu at 10pt
+% \font\sevenmd=mtgu at 7.6pt
+% \font\fivemd =mtgu at 6pt
+% \font\tenmc =mtms at 10pt
+% \font\sevenmc=mtms at 7.6pt
+% \font\fivemc =mtms at 6pt
+%
+% \textfont \mcfam\tenmc \textfont \mdfam\tenmd
+% \scriptfont \mcfam\sevenmc \scriptfont \mdfam\sevenmd
+% \scriptscriptfont\mcfam\fivemc \scriptscriptfont\mdfam\fivemd
+
+% \addtocommalist{gk}\familylist
+% \addtocommalist{gb}\familylist
+%
+% \defineinterfaceconstant {ca} {ca} % boohoo!
+% \defineinterfaceconstant {gk} {gk} % boohoo!
+% \defineinterfaceconstant {gb} {gb} % boohoo!
+
+% \definealternativestyle[script] [\ca][\ca]
+% \definealternativestyle[greek] [\gk][\gk]
+% \definealternativestyle[boldgreek][\gb][\gb]
+
+% \definebodyfont
+% [5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,14.4pt] [rm]
+% [ca=mtms sa 1,
+% gk=mtgu sa 1,
+% gb=mtgub sa 1]
+
+%D Since a font size is a rather fuzzy thing, it will be no
+%D surprise that the Math Times fonts have different specs
+%D than the Computer Modern Roman fonts.
+%D
+%D \starttabulate[|Bl|c|c|c|c|c|c|c|c|c|c|]
+%D \NC Computer Modern\NC
+%D 5 \NC6 \NC7 \NC8 \NC9 \NC10 \NC11 \NC12 \NC14 \NC18\NC\NR
+%D \NC Math Times \NC
+%D 6.0\NC6.8\NC7.6\NC8.4\NC9.2\NC10.0\NC10.8\NC11.6\NC13.2\NC--\NC\NR
+%D \stoptabulate
+%D
+%D The following definitions presume the existence of \type
+%D {tio} and \type {tibio} font alternatives. Definitions for
+%D \type {\tf.} etc and \type {\sc} are left as they are.
+
+%D moved code
+
+%D The next lines set up coding dependant versions of math
+%D accents (for \type {texnansi} of course). These are needed
+%D in commands like \type {\bf} and \type {\it} (which use the
+%D text font encoding) a opposed to \type {_no spec_} and
+%D \type {mi} that use the math font encoding. This stuff
+%D should be made more general!
+
+% \daghex, \ddaghex and \dothex were wrong in my version of mtmacs
+
+\def\daghex {86} % to do
+\def\ddaghex {87}
+\def\Shex {A7}
+\def\Phex {B6}
+\def\barhex {16}
+\def\gravehex{12}
+\def\acutehex{13}
+\def\checkhex{14}
+\def\brevehex{15}
+\def\hathex {5E}
+\def\dothex {05}
+\def\tildehex{7E}
+\def\ddothex {7F}
+
+%D The \type {mtex} fonts need a recalculation of \type
+%D {\p@renwd}, which in \CONTEXT\ is done automatically.
+
+%D The following definitions are mostly copied from the file
+%D \type {mtmacs.tex}, which banner said:
+%D
+%D \starttyping
+%D MTMACS.TEX VERSION 1.1.1 (1996 Dec 8)
+%D COPYRIGHT (C) 1992, 1993, 1996 BY THE TEXPLORATORS CORPORATION
+%D ALL RIGHTS RESERVED
+%D \stoptyping
+%D
+%D We reformatted the macros and changed a few bits and
+%D pieces. A further cleanup with regards to the scratch
+%D registers will be done later.
+
+\mathchardef\Gamma = "0130
+\mathchardef\Delta = "0131
+\mathchardef\Theta = "0132
+\mathchardef\Lambda = "0133
+\mathchardef\Xi = "0134
+\mathchardef\Pi = "0135
+\mathchardef\Sigma = "0136
+\mathchardef\Upsilon = "0137
+\mathchardef\Phi = "0138
+\mathchardef\Psi = "0139
+\mathchardef\Omega = "017F
+\mathchardef\varGamma = "0100
+\mathchardef\varDelta = "0101
+\mathchardef\varTheta = "0102
+\mathchardef\varLambda = "0103
+\mathchardef\varXi = "0104
+\mathchardef\varPi = "0105
+\mathchardef\varSigma = "0106
+\mathchardef\varUpsilon = "0107
+\mathchardef\varPhi = "0108
+\mathchardef\varPsi = "0109
+\mathchardef\varOmega = "010A
+\mathchardef\varkappa = "017E
+
+\mathchardef\ldotp = "613A
+
+\mathchardef\triangleleft = "2247
+\mathchardef\triangleright = "2246
+\mathchardef\comp = "2242
+
+\mathchardef\Relbar = "3248
+\mathchardef\dagger = "20\daghex % to do
+\mathchardef\ddagger = "20\ddaghex % to do
+\mathchardef\dotacc = "0250
+
+\mathcode`\( = "412E
+\mathcode`\) = "512F
+\mathcode`\. = "013A
+\mathcode`\, = "613B
+\mathcode`\+ = "2243
+\mathcode`\= = "3244
+\mathcode`\; = "6249
+
+\delcode `\( = "12E300
+\delcode `\) = "12F301
+
+\let\mit=\undefined % to do
+
+\def\vec{\mathaccent"0245 }
+\def\t#1{{\edef\next{\the\font}\the\textfont2\accent"41\next#1}}
+
+% fam equals -1 unless the user has said something
+% like \rm (cf. the texbook page 290)
+
+\def\ifdefaultfamelse#1#2%
+ {\ifnum\fam=\minusone\mathaccent#1\else\mathaccent#2\fi}
+
+\let\noaccents@\relax
+
+\def\grave {\ifdefaultfamelse{"024A}{"70\gravehex}}
+\def\acute {\ifdefaultfamelse{"024B}{"70\acutehex}}
+\def\check {\ifdefaultfamelse{"024C}{"70\checkhex}}
+\def\breve {\ifdefaultfamelse{"024D}{"70\brevehex}}
+\def\bar {\ifdefaultfamelse{"024E}{"70\barhex }}
+\def\hat {\ifdefaultfamelse{"024F}{"70\hathex }}
+\def\dot {\ifdefaultfamelse{"0250}{"70\dothex }}
+\def\tilde {\ifdefaultfamelse{"0251}{"70\tildehex}}
+\def\ddot {\ifdefaultfamelse{"0252}{"70\ddothex }}
+
+\def\widebar{\mathaccent"0253 }
+
+\def\mathhexbox@#1#2#3%
+ {\relax
+ \ifmmode
+ \mathpalette{}{\mathsurround\zeropoint\rm\mathchar"#1#2#3}%
+ \else
+ \leavevmode
+ \hbox{$\mathsurround\zeropoint\rm\mathchar"#1#2#3$}%
+ \fi}
+
+\def\dag {\edef\next@{0\daghex }\expandafter\mathhexbox@\next@}
+\def\ddag{\edef\next@{0\ddaghex}\expandafter\mathhexbox@\next@}
+
+\def\S{\edef\next@{0\Shex}\expandafter\mathhexbox@\next@}
+\def\P{\edef\next@{0\Phex}\expandafter\mathhexbox@\next@}
+
+\def\vdots%
+ {\vbox
+ {\baselineskip4\points
+ \lineskiplimit\zeropoint
+ \kern6\points\hbox{$\mathsurround\zeropoint.$}\hbox{$\mathsurround\zeropoint.$}\hbox{$\mathsurround\zeropoint.$}}}
+
+\def\ddots%
+ {\mathinner
+ {\mkern1mu
+ \raise7\points\vbox{\kern 7\points\hbox{$\mathsurround\zeropoint.$}}\mkern2mu
+ \raise4\points\hbox{$\mathsurround\zeropoint.$}\mkern2mu
+ \raise \points\hbox{$\mathsurround\zeropoint.$}\mkern1mu}}
+
+\def\hbar
+ {{\mathchoice
+ {\hbox{\lower.07em \hbox{$\mathchar"\barhex$}}}
+ {\hbox{\lower.07em \hbox{$\mathchar"\barhex$}}}
+ {\hbox{\lower.049em\hbox{$\scriptstyle\mathchar"\barhex$}}}
+ {\hbox{\lower.035em\hbox{$\scriptscriptstyle\mathchar"\barhex$}}}%
+ \mkern-6.3muh}}
+
+\def\angle%
+ {{\vbox{\ialign{$\mathsurround\zeropoint\scriptstyle##$\crcr
+ \not\mathrel{\mkern14mu}\crcr
+ \noalign{\nointerlineskip}
+ \mkern2.5mu\leaders\hrule height.48\points\hfill\mkern2.5mu\crcr}}}}
+
+\newdimen\amstexex
+
+\amstexex = .2326ex
+
+\def\varinjlim%
+ {\mathop{\vtop{\ialign{##\crcr
+ \hfil\the\textfont\zerocount lim\hfil\crcr
+ \noalign{\nointerlineskip}\rightarrowfill\crcr
+ \noalign{\nointerlineskip\kern-\amstexex}\crcr}}}}
+
+\def\varprojlim%
+ {\mathop{\vtop{\ialign{##\crcr
+ \hfil\the\textfont\zerocount lim\hfil\crcr
+ \noalign{\nointerlineskip}\leftarrowfill\crcr
+ \noalign{\nointerlineskip\kern-\amstexex}\crcr}}}}
+
+\def\varliminf{\mathop{\underbar {lim}}} % context-ified
+\def\varlimsup{\mathop{\overstrike{lim}}} % context-ified
+
+\def\spdot {^{\hbox{\raise\amstexex\hbox{\the\textfont\zerocount .}}}}
+\def\spddot {^{\hbox{\raise\amstexex\hbox{\the\textfont\zerocount ..}}}}
+\def\spdddot {^{\hbox{\raise\amstexex\hbox{\the\textfont\zerocount ...}}}}
+\def\spddddot{^{\hbox{\raise\amstexex\hbox{\the\textfont\zerocount....}}}}
+
+%D Here some code is merged in order to save strings.
+
+\def\domultidot#1#2%
+ {\setbox0\hbox{$#1#2$}%
+ \setbox2\hbox{$#1\infty$}%
+ \dimen0\ht2
+ \ifdim\ht0<\dimen0 \dimen0\ht0 \fi
+ \setbox2\hbox{$#1#2\mathchar"012D$}%
+ \dimen2\wd2
+ \advance\dimen2-\wd0
+ \setbox0\hbox{$#1\rhook$}%
+ \advance\dimen2-\wd0
+ \vbox
+ {\offinterlineskip
+ \ialign{\hfil$#1##$\hfil\cr
+ \kern\dimen2\dotacc\mkern-2.5mu\dotacc\mkern-2.5mu\dotacc\thirddot\cr
+ \noalign{\vskip-\dimen0}%
+ #2\cr}}}
+
+\def\dddot%
+ {\def\thirddot{}%
+ \mathpalette\domultidot}
+
+\def\ddddot%
+ {\def\thirddot{\mkern-2.5mu\dotacc}%
+ \mathpalette\domultidot}
+
+\newcount\uproot@
+\newcount\leftroot@
+
+\def\nonmatherr#1%
+ {\errmessage{\noexpand#1allowed only in math mode}}
+
+\def\uproot#1%
+ {\relax
+ \ifmmode
+ \uproot@#1\relax
+ \else
+ \nonmatherr\uproot
+ \fi}
+
+\def\leftroot#1%
+ {\relax
+ \ifmmode
+ \leftroot@#1\relax
+ \else
+ \nonmatherr\leftroot
+ \fi}
+
+\def\root#1\of#2%
+ {\setbox\rootbox=\hbox{$\mathsurround\zeropoint\scriptscriptstyle{#1}$}%
+ \mathpalette\r@@t{#2}}
+
+\def\r@@t#1#2%
+ {\setbox\zerocount\hbox{$\uproot@\zerocount\leftroot\zerocount\mathsurround\zeropoint#1\sqrt{#2}$}%
+ \dimen@\ht\zerocount\advance\dimen@-\dp\zerocount
+ \dimen@ii\dimen@
+ \ifdim\dimen@>30\points \advance\dimen@ii-16\points \else
+ \ifdim\dimen@>24\points \advance\dimen@ii -8\points \else
+ \ifdim\dimen@>18\points \advance\dimen@ii -6\points \else
+ \ifdim\dimen@>12\points \advance\dimen@ii -4\points \else
+ \ifdim\dimen@>10\points \advance\dimen@ii -2\points \fi\fi\fi\fi\fi
+ \setbox\plustwo=\hbox{$\mathsurround\zeropoint#1\mskip\uproot@ mu$}%
+ \advance\dimen@ii by1.667\wd\plustwo
+ \mkern-\leftroot@ mu\mkern5mu\raise.6\dimen@ii\copy\rootbox
+ \mkern-8mu\mkern\leftroot@ mu\box\zerocount\leftroot\zerocount\uproot\zerocount}
+
+\def\space@.{\futurelet\space@\relax} \space@. % really needed ?
+
+\def\jadjust%
+ {\mkern-\plustwo mu}
+
+%D For the moment the following code is left unchanged. It is
+%D not used anyway.
+
+\newif\ifsubscriptcorrection \subscriptcorrectionfalse
+
+\ifsubscriptcorrection
+
+ \expandafter\let\csname subscript character \string_\endcsname_
+
+ \catcode`\_=\active
+
+ \def_%
+ {\ifmmode
+ \expandafter\sb@
+ \else
+ \expandafter\csname subscript character \string_\endcsname
+ \fi}
+
+ \let\sb_
+
+ \ifnum\catcode`\^^A=8 \catcode`\^^A\active\let^^A_\fi
+
+ \def\sb@#1%
+ {\csname subscript character \string_\endcsname
+ {\futurelet\next\sb@@#1}}
+
+ \def\sb@@%
+ {\ifx\next\space@
+ \def\next@. %
+ {\futurelet\next\sb@@}%
+ \else
+ \def\next@.%
+ {\ifx\next j%
+ \mkern-\plustwo mu\else
+ \ifx\next f%
+ \mkern-\plustwo mu\else
+ \ifx\next p%
+ \mkern-\plusone mu\fi\fi\fi}%
+ \fi
+ \next@.}
+
+\fi
+
+\protect
diff --git a/tex/context/base/math-tim.tex b/tex/context/base/math-tim.tex
deleted file mode 100644
index 3b9aea103..000000000
--- a/tex/context/base/math-tim.tex
+++ /dev/null
@@ -1,371 +0,0 @@
-%D \module
-%D [ file=math-tim,
-%D version=2001.04.12,
-%D title=\CONTEXT\ Math Macros,
-%D subtitle=Mathtime Specials,
-%D author={Hans Hagen \& Taco Hoekwater},
-%D date=\currentdate,
-%D copyright=\PRAGMA]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\endinput % i will clean this up after taco has gone over it
-
-%D With thanks to Berthold Horn from YandY for providing me
-%D evaluation copies of the MathTimePlus fonts.
-
-% version 0 : Michael Spivak
-% version 1 : Taco Hoekwater
-% version 2 : Hans Hagen
-% version 3 : etc etc etc
-
-\unprotect
-
-%D We use the predefined spare families \type {\mcfam} and
-%D \type {\mdfam}.
-
-\let\cafam\mcfam \let\hexcafam\hexmcfam
-\let\gbfam\mdfam \let\hexgbfam\hexmdfam
-\let\gkfam\mdfam \let\hexgkfam\hexmdfam
-
-% Why is this needed?
-
-% \font\tenmd =mtgu at 10pt
-% \font\sevenmd=mtgu at 7.6pt
-% \font\fivemd =mtgu at 6pt
-% \font\tenmc =mtms at 10pt
-% \font\sevenmc=mtms at 7.6pt
-% \font\fivemc =mtms at 6pt
-%
-% \textfont \mcfam\tenmc \textfont \mdfam\tenmd
-% \scriptfont \mcfam\sevenmc \scriptfont \mdfam\sevenmd
-% \scriptscriptfont\mcfam\fivemc \scriptscriptfont\mdfam\fivemd
-
-% \addtocommalist{gk}\familylist
-% \addtocommalist{gb}\familylist
-%
-% \defineinterfaceconstant {ca} {ca} % boohoo!
-% \defineinterfaceconstant {gk} {gk} % boohoo!
-% \defineinterfaceconstant {gb} {gb} % boohoo!
-
-% \definealternativestyle[script] [\ca][\ca]
-% \definealternativestyle[greek] [\gk][\gk]
-% \definealternativestyle[boldgreek][\gb][\gb]
-
-% \definebodyfont
-% [5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,14.4pt] [rm]
-% [ca=mtms sa 1,
-% gk=mtgu sa 1,
-% gb=mtgub sa 1]
-
-%D Since a font size is a rather fuzzy thing, it will be no
-%D surprise that the Math Times fonts have different specs
-%D than the Computer Modern Roman fonts.
-%D
-%D \starttabulate[|Bl|c|c|c|c|c|c|c|c|c|c|]
-%D \NC Computer Modern\NC
-%D 5 \NC6 \NC7 \NC8 \NC9 \NC10 \NC11 \NC12 \NC14 \NC18\NC\NR
-%D \NC Math Times \NC
-%D 6.0\NC6.8\NC7.6\NC8.4\NC9.2\NC10.0\NC10.8\NC11.6\NC13.2\NC--\NC\NR
-%D \stoptabulate
-%D
-%D The following definitions presume the existence of \type
-%D {tio} and \type {tibio} font alternatives. Definitions for
-%D \type {\tf.} etc and \type {\sc} are left as they are.
-
-%D moved code
-
-%D The next lines set up coding dependant versions of math
-%D accents (for \type {texnansi} of course). These are needed
-%D in commands like \type {\bf} and \type {\it} (which use the
-%D text font encoding) a opposed to \type {_no spec_} and
-%D \type {mi} that use the math font encoding. This stuff
-%D should be made more general!
-
-% \daghex, \ddaghex and \dothex were wrong in my version of mtmacs
-
-\def\daghex {86} % to do
-\def\ddaghex {87}
-\def\Shex {A7}
-\def\Phex {B6}
-\def\barhex {16}
-\def\gravehex{12}
-\def\acutehex{13}
-\def\checkhex{14}
-\def\brevehex{15}
-\def\hathex {5E}
-\def\dothex {05}
-\def\tildehex{7E}
-\def\ddothex {7F}
-
-%D The \type {mtex} fonts need a recalculation of \type
-%D {\p@renwd}, which in \CONTEXT\ is done automatically.
-
-%D The following definitions are mostly copied from the file
-%D \type {mtmacs.tex}, which banner said:
-%D
-%D \starttyping
-%D MTMACS.TEX VERSION 1.1.1 (1996 Dec 8)
-%D COPYRIGHT (C) 1992, 1993, 1996 BY THE TEXPLORATORS CORPORATION
-%D ALL RIGHTS RESERVED
-%D \stoptyping
-%D
-%D We reformatted the macros and changed a few bits and
-%D pieces. A further cleanup with regards to the scratch
-%D registers will be done later.
-
-\mathchardef\Gamma = "0130
-\mathchardef\Delta = "0131
-\mathchardef\Theta = "0132
-\mathchardef\Lambda = "0133
-\mathchardef\Xi = "0134
-\mathchardef\Pi = "0135
-\mathchardef\Sigma = "0136
-\mathchardef\Upsilon = "0137
-\mathchardef\Phi = "0138
-\mathchardef\Psi = "0139
-\mathchardef\Omega = "017F
-\mathchardef\varGamma = "0100
-\mathchardef\varDelta = "0101
-\mathchardef\varTheta = "0102
-\mathchardef\varLambda = "0103
-\mathchardef\varXi = "0104
-\mathchardef\varPi = "0105
-\mathchardef\varSigma = "0106
-\mathchardef\varUpsilon = "0107
-\mathchardef\varPhi = "0108
-\mathchardef\varPsi = "0109
-\mathchardef\varOmega = "010A
-\mathchardef\varkappa = "017E
-
-\mathchardef\ldotp = "613A
-
-\mathchardef\triangleleft = "2247
-\mathchardef\triangleright = "2246
-\mathchardef\comp = "2242
-
-\mathchardef\Relbar = "3248
-\mathchardef\dagger = "20\daghex % to do
-\mathchardef\ddagger = "20\ddaghex % to do
-\mathchardef\dotacc = "0250
-
-\mathcode`\( = "412E
-\mathcode`\) = "512F
-\mathcode`\. = "013A
-\mathcode`\, = "613B
-\mathcode`\+ = "2243
-\mathcode`\= = "3244
-\mathcode`\; = "6249
-
-\delcode `\( = "12E300
-\delcode `\) = "12F301
-
-\let\mit=\undefined % to do
-
-\def\vec{\mathaccent"0245 }
-\def\t#1{{\edef\next{\the\font}\the\textfont2\accent"41\next#1}}
-
-% fam equals -1 unless the user has said something
-% like \rm (cf. the texbook page 290)
-
-\def\ifdefaultfamelse#1#2%
- {\ifnum\fam=\minusone\mathaccent#1\else\mathaccent#2\fi}
-
-\let\noaccents@\relax
-
-\def\grave {\ifdefaultfamelse{"024A}{"70\gravehex}}
-\def\acute {\ifdefaultfamelse{"024B}{"70\acutehex}}
-\def\check {\ifdefaultfamelse{"024C}{"70\checkhex}}
-\def\breve {\ifdefaultfamelse{"024D}{"70\brevehex}}
-\def\bar {\ifdefaultfamelse{"024E}{"70\barhex }}
-\def\hat {\ifdefaultfamelse{"024F}{"70\hathex }}
-\def\dot {\ifdefaultfamelse{"0250}{"70\dothex }}
-\def\tilde {\ifdefaultfamelse{"0251}{"70\tildehex}}
-\def\ddot {\ifdefaultfamelse{"0252}{"70\ddothex }}
-
-\def\widebar{\mathaccent"0253 }
-
-\def\mathhexbox@#1#2#3%
- {\relax
- \ifmmode
- \mathpalette{}{\mathsurround\zeropoint\rm\mathchar"#1#2#3}%
- \else
- \leavevmode
- \hbox{$\mathsurround\zeropoint\rm\mathchar"#1#2#3$}%
- \fi}
-
-\def\dag {\edef\next@{0\daghex }\expandafter\mathhexbox@\next@}
-\def\ddag{\edef\next@{0\ddaghex}\expandafter\mathhexbox@\next@}
-
-\def\S{\edef\next@{0\Shex}\expandafter\mathhexbox@\next@}
-\def\P{\edef\next@{0\Phex}\expandafter\mathhexbox@\next@}
-
-\def\vdots%
- {\vbox
- {\baselineskip4\points
- \lineskiplimit\zeropoint
- \kern6\points\hbox{$\mathsurround\zeropoint.$}\hbox{$\mathsurround\zeropoint.$}\hbox{$\mathsurround\zeropoint.$}}}
-
-\def\ddots%
- {\mathinner
- {\mkern1mu
- \raise7\points\vbox{\kern 7\points\hbox{$\mathsurround\zeropoint.$}}\mkern2mu
- \raise4\points\hbox{$\mathsurround\zeropoint.$}\mkern2mu
- \raise \points\hbox{$\mathsurround\zeropoint.$}\mkern1mu}}
-
-\def\hbar
- {{\mathchoice
- {\hbox{\lower.07em \hbox{$\mathchar"\barhex$}}}
- {\hbox{\lower.07em \hbox{$\mathchar"\barhex$}}}
- {\hbox{\lower.049em\hbox{$\scriptstyle\mathchar"\barhex$}}}
- {\hbox{\lower.035em\hbox{$\scriptscriptstyle\mathchar"\barhex$}}}%
- \mkern-6.3muh}}
-
-\def\angle%
- {{\vbox{\ialign{$\mathsurround\zeropoint\scriptstyle##$\crcr
- \not\mathrel{\mkern14mu}\crcr
- \noalign{\nointerlineskip}
- \mkern2.5mu\leaders\hrule height.48\points\hfill\mkern2.5mu\crcr}}}}
-
-\newdimen\amstexex
-
-\amstexex = .2326ex
-
-\def\varinjlim%
- {\mathop{\vtop{\ialign{##\crcr
- \hfil\the\textfont\zerocount lim\hfil\crcr
- \noalign{\nointerlineskip}\rightarrowfill\crcr
- \noalign{\nointerlineskip\kern-\amstexex}\crcr}}}}
-
-\def\varprojlim%
- {\mathop{\vtop{\ialign{##\crcr
- \hfil\the\textfont\zerocount lim\hfil\crcr
- \noalign{\nointerlineskip}\leftarrowfill\crcr
- \noalign{\nointerlineskip\kern-\amstexex}\crcr}}}}
-
-\def\varliminf{\mathop{\underbar {lim}}} % context-ified
-\def\varlimsup{\mathop{\overstrike{lim}}} % context-ified
-
-\def\spdot {^{\hbox{\raise\amstexex\hbox{\the\textfont\zerocount .}}}}
-\def\spddot {^{\hbox{\raise\amstexex\hbox{\the\textfont\zerocount ..}}}}
-\def\spdddot {^{\hbox{\raise\amstexex\hbox{\the\textfont\zerocount ...}}}}
-\def\spddddot{^{\hbox{\raise\amstexex\hbox{\the\textfont\zerocount....}}}}
-
-%D Here some code is merged in order to save strings.
-
-\def\domultidot#1#2%
- {\setbox0\hbox{$#1#2$}%
- \setbox2\hbox{$#1\infty$}%
- \dimen0\ht2
- \ifdim\ht0<\dimen0 \dimen0\ht0 \fi
- \setbox2\hbox{$#1#2\mathchar"012D$}%
- \dimen2\wd2
- \advance\dimen2-\wd0
- \setbox0\hbox{$#1\rhook$}%
- \advance\dimen2-\wd0
- \vbox
- {\offinterlineskip
- \ialign{\hfil$#1##$\hfil\cr
- \kern\dimen2\dotacc\mkern-2.5mu\dotacc\mkern-2.5mu\dotacc\thirddot\cr
- \noalign{\vskip-\dimen0}%
- #2\cr}}}
-
-\def\dddot%
- {\def\thirddot{}%
- \mathpalette\domultidot}
-
-\def\ddddot%
- {\def\thirddot{\mkern-2.5mu\dotacc}%
- \mathpalette\domultidot}
-
-\newcount\uproot@
-\newcount\leftroot@
-
-\def\nonmatherr#1%
- {\errmessage{\noexpand#1allowed only in math mode}}
-
-\def\uproot#1%
- {\relax
- \ifmmode
- \uproot@#1\relax
- \else
- \nonmatherr\uproot
- \fi}
-
-\def\leftroot#1%
- {\relax
- \ifmmode
- \leftroot@#1\relax
- \else
- \nonmatherr\leftroot
- \fi}
-
-\def\root#1\of#2%
- {\setbox\rootbox=\hbox{$\mathsurround\zeropoint\scriptscriptstyle{#1}$}%
- \mathpalette\r@@t{#2}}
-
-\def\r@@t#1#2%
- {\setbox\zerocount\hbox{$\uproot@\zerocount\leftroot\zerocount\mathsurround\zeropoint#1\sqrt{#2}$}%
- \dimen@\ht\zerocount\advance\dimen@-\dp\zerocount
- \dimen@ii\dimen@
- \ifdim\dimen@>30\points \advance\dimen@ii-16\points \else
- \ifdim\dimen@>24\points \advance\dimen@ii -8\points \else
- \ifdim\dimen@>18\points \advance\dimen@ii -6\points \else
- \ifdim\dimen@>12\points \advance\dimen@ii -4\points \else
- \ifdim\dimen@>10\points \advance\dimen@ii -2\points \fi\fi\fi\fi\fi
- \setbox\plustwo=\hbox{$\mathsurround\zeropoint#1\mskip\uproot@ mu$}%
- \advance\dimen@ii by1.667\wd\plustwo
- \mkern-\leftroot@ mu\mkern5mu\raise.6\dimen@ii\copy\rootbox
- \mkern-8mu\mkern\leftroot@ mu\box\zerocount\leftroot\zerocount\uproot\zerocount}
-
-\def\space@.{\futurelet\space@\relax} \space@. % really needed ?
-
-\def\jadjust%
- {\mkern-\plustwo mu}
-
-%D For the moment the following code is left unchanged. It is
-%D not used anyway.
-
-\newif\ifsubscriptcorrection \subscriptcorrectionfalse
-
-\ifsubscriptcorrection
-
- \expandafter\let\csname subscript character \string_\endcsname_
-
- \catcode`\_=\active
-
- \def_%
- {\ifmmode
- \expandafter\sb@
- \else
- \expandafter\csname subscript character \string_\endcsname
- \fi}
-
- \let\sb_
-
- \ifnum\catcode`\^^A=8 \catcode`\^^A\active\let^^A_\fi
-
- \def\sb@#1%
- {\csname subscript character \string_\endcsname
- {\futurelet\next\sb@@#1}}
-
- \def\sb@@%
- {\ifx\next\space@
- \def\next@. %
- {\futurelet\next\sb@@}%
- \else
- \def\next@.%
- {\ifx\next j%
- \mkern-\plustwo mu\else
- \ifx\next f%
- \mkern-\plustwo mu\else
- \ifx\next p%
- \mkern-\plusone mu\fi\fi\fi}%
- \fi
- \next@.}
-
-\fi
-
-\protect
diff --git a/tex/context/base/math-uni.mkii b/tex/context/base/math-uni.mkii
new file mode 100644
index 000000000..e8fd3f05d
--- /dev/null
+++ b/tex/context/base/math-uni.mkii
@@ -0,0 +1,237 @@
+%D \module
+%D [ file=math-uni,
+%D version=2005.06.11,
+%D title=\CONTEXT\ Math Macros,
+%D subtitle=unicode support,
+%D author={Nikolai Weibull \& Taco Hoekwater},
+%D date=\currentdate,
+%D copyright=PRAGMA]
+
+\unprotect
+
+% needed for unic-032 % TH
+
+\startmathcollection[default]
+
+ \definemathcommand [unic@doubleverticalline] {\mathord{\parallel}}
+ \definemathcommand [unic@doublelowline] {\underline{\textunderscore}}
+
+ \definemathcommand [unic@doubleprime] {''}
+ \definemathcommand [unic@tripleprime] {'''}
+
+ \definemathcommand [unic@reverseddoubleprime] {\mathord{\backprime\backprime}}
+ \definemathcommand [unic@reversedtripleprime] {\mathord{\backprime\backprime\backprime}}
+
+ \definemathcommand [unic@fractionslash] {\vulgarfraction{}{}}
+ \definemathcommand [unic@lowasterisk] {\mathord{\lower-.2em\hbox{$\ast$}}}
+
+ \definemathcommand [unic@functionapplication] {\mathop{}}
+ \definemathcommand [unic@invisibletimes] {\mathbin{}}
+ \definemathcommand [unic@invisibleseparator] {\mathpunct{}}
+
+\stopmathcollection
+
+% needed for unic-033 % TH
+
+\def\unic@vulgarfraction#1#2%
+ {\hbox
+ {\high{{\tfx\it #1}\kern -.2em}%
+ \symbol[vulgarfraction]%
+ \kern -.2em\low{{\tfx\it #2}}}}
+
+\startmathcollection[default]
+
+ \definemathcommand [unic@accountof] {\unic@vulgarfraction{a}{c}}
+ \definemathcommand [unic@addressedtothesubject] {\unic@vulgarfraction{a}{s}}
+ \definemathcommand [unic@doublestruckC] {{\Bbb C}}
+ \definemathcommand [unic@degreecelsius] {{\textdegree \tf C}}
+ \definemathcommand [unic@centrelinesymbol] {\unknownchar}
+ \definemathcommand [unic@careof] {\unic@vulgarfraction{c}{o}}
+ \definemathcommand [unic@cadauna] {\unic@vulgarfraction{c}{u}}
+ \definemathcommand [unic@eulerconstant] {{\rm e}}
+ \definemathcommand [unic@scruple] {\unknownchar}
+ \definemathcommand [unic@degreefahrenheit] {{\textdegree \tf F}}
+ \definemathcommand [unic@scriptg] {\unknownchar}
+ \definemathcommand [unic@scriptH] {{\cal H}}
+ \definemathcommand [unic@blackletterH] {{\fraktur H}}
+ \definemathcommand [unic@doublestruckH] {{\Bbb H}}
+ \definemathcommand [unic@planckconstant] {h}
+ \definemathcommand [unic@planckconstantovertwopi] {\hslash}
+ \definemathcommand [unic@scriptI] {{\cal I}}
+ \definemathcommand [unic@blackletterI] {{\fraktur I}}
+ \definemathcommand [unic@scriptL] {{\cal L}}
+ \definemathcommand [unic@scriptl] {\ell}
+ \definemathcommand [unic@lbbarsymbol] {\unknownchar}
+ \definemathcommand [unic@doublestruckN] {{\Bbb N}}
+ \definemathcommand [unic@numerosign] {\hbox{\symbol[numero]}}
+ \definemathcommand [unic@soundrecordingcopyright] {\encircled{{\tfx P}}}
+ \definemathcommand [unic@scriptP] {{\cal P}}
+ \definemathcommand [unic@doublestruckP] {{\Bbb P}}
+ \definemathcommand [unic@doublestruckQ] {{\Bbb Q}}
+ \definemathcommand [unic@scriptR] {{\cal R}}
+ \definemathcommand [unic@blackletterR] {{\fraktur R}}
+ \definemathcommand [unic@doublestruckR] {{\Bbb R}}
+ \definemathcommand [unic@prescriptiontake] {\unknownchar}
+ \definemathcommand [unic@response] {\unknownchar}
+ \definemathcommand [unic@servicemark] {\high{\txx SM}}
+ \definemathcommand [unic@telephonesign] {\high{\txx TEL}}
+ \definemathcommand [unic@trademarksign] {\trademark}
+ \definemathcommand [unic@versickle] {\unknownchar}
+ \definemathcommand [unic@doublestruckZ] {{\Bbb Z}}
+ \definemathcommand [unic@ouncesign] {\unknownchar}
+ \definemathcommand [unic@ohmsign] {\Omega}
+ \definemathcommand [unic@invertedohmsign] {\rotate[\c!rotation=180]{\Omega}}
+ \definemathcommand [unic@blackletterZ] {{\fraktur Z}}
+ \definemathcommand [unic@turnedgreekletteriota] {\rotate[\c!rotation=180]{\iota}}
+ \definemathcommand [unic@kelvinsign] {{\tf K}}
+ \definemathcommand [unic@angstromsign] {\Angstrom}
+ \definemathcommand [unic@scriptB] {{\cal B}}
+ \definemathcommand [unic@blackletterC] {{\fraktur C}}
+ \definemathcommand [unic@estimatedsymbol] {\unknownchar}
+ \definemathcommand [unic@scripte] {\unknownchar}
+ \definemathcommand [unic@scriptE] {{\cal E}}
+ \definemathcommand [unic@scriptF] {{\cal F}}
+ \definemathcommand [unic@turnedF] {\rotate[\c!rotation=180]{{\tf F}}}
+ \definemathcommand [unic@scriptM] {{\cal M}}
+ \definemathcommand [unic@scripto] {\unknownchar}
+
+ \definemathcommand [unic@informationsource] {{\bf i}}
+ \definemathcommand [unic@rotatedQ] {\rotate[\c!rotation=90]{{\tf Q}}}
+ \definemathcommand [unic@facsimilesign] {\unknownchar}
+ \definemathcommand [unic@doublestruckpi] {\pi}%{\unknownchar}
+ \definemathcommand [unic@doublestruckgamma] {\gamma}%{\unknownchar}
+ \definemathcommand [unic@doublestruckGamma] {\Gamma}%{\unknownchar}
+ \definemathcommand [unic@doublestruckPi] {\Pi}%{\unknownchar}
+ \definemathcommand [unic@doublestrucknarysummation] {\unknownchar}
+ \definemathcommand [unic@turnedsansserifG] {\rotate[\c!rotation=180]{{\ss G}}}
+ \definemathcommand [unic@turnedsansserifL] {\rotate[\c!rotation=180]{{\ss L}}}
+ \definemathcommand [unic@reversedsansserifL] {\mirror{{\ss L}}}
+ \definemathcommand [unic@turnedsansserifY] {\rotate[\c!rotation=180]{{\ss Y}}}
+ \definemathcommand [unic@doublestruckitalicD] {D}%{\unknownchar}
+ \definemathcommand [unic@doublestruckitalicd] {d}%{\unknownchar}
+ \definemathcommand [unic@doublestruckitalice] {e}%{\unknownchar}
+ \definemathcommand [unic@doublestruckitalici] {i}%{\unknownchar}
+ \definemathcommand [unic@doublestruckitalicj] {j}%{\unknownchar}
+ \definemathcommand [unic@propertyline] {\unknownchar}
+ \definemathcommand [unic@turnedampersand] {\rotate[\c!rotation=180]{\&}}
+ \definemathcommand [unic@persign] {\unknownchar}
+
+ \definemathcommand [unic@fractiononethird] {\vulgarfraction{1}{3}}
+ \definemathcommand [unic@fractiontwothirds] {\vulgarfraction{2}{3}}
+ \definemathcommand [unic@fractiononefifth] {\vulgarfraction{1}{5}}
+ \definemathcommand [unic@fractiontwofifths] {\vulgarfraction{2}{5}}
+ \definemathcommand [unic@fractionthreefifths] {\vulgarfraction{3}{5}}
+ \definemathcommand [unic@fractionfourfifths] {\vulgarfraction{4}{5}}
+ \definemathcommand [unic@fractiononesixth] {\vulgarfraction{1}{6}}
+ \definemathcommand [unic@fractionfivesixths] {\vulgarfraction{5}{6}}
+ \definemathcommand [unic@fractiononeeighth] {\vulgarfraction{1}{8}}
+ \definemathcommand [unic@fractionthreeeighths] {\vulgarfraction{3}{8}}
+ \definemathcommand [unic@fractionfiveeighths] {\vulgarfraction{5}{8}}
+ \definemathcommand [unic@fractionseveneighths] {\vulgarfraction{7}{8}}
+ \definemathcommand [unic@fractionnumeratorone] {\vulgarfraction{1}{}}
+ \definemathcommand [unic@romannumeralOne] {{\tf I}}
+ \definemathcommand [unic@romannumeralTwo] {{\tf II}}
+ \definemathcommand [unic@romannumeralThree] {{\tf III}}
+ \definemathcommand [unic@romannumeralFour] {{\tf IV}}
+ \definemathcommand [unic@romannumeralFive] {{\tf V}}
+ \definemathcommand [unic@romannumeralSix] {{\tf VI}}
+ \definemathcommand [unic@romannumeralSeven] {{\tf VII}}
+ \definemathcommand [unic@romannumeralEight] {{\tf VIII}}
+ \definemathcommand [unic@romannumeralNine] {{\tf IX}}
+ \definemathcommand [unic@romannumeralTen] {{\tf X}}
+ \definemathcommand [unic@romannumeralEleven] {{\tf XI}}
+ \definemathcommand [unic@romannumeralTwelve] {{\tf XII}}
+ \definemathcommand [unic@romannumeralFifty] {{\tf L}}
+ \definemathcommand [unic@romannumeralOnehundred] {{\tf C}}
+ \definemathcommand [unic@romannumeralFivehundred] {{\tf D}}
+ \definemathcommand [unic@romannumeralOnethousand] {{\tf M}}
+ \definemathcommand [unic@romannumeralone] {{\tf i}}
+ \definemathcommand [unic@romannumeraltwo] {{\tf ii}}
+ \definemathcommand [unic@romannumeralthree] {{\tf iii}}
+ \definemathcommand [unic@romannumeralfour] {{\tf iv}}
+ \definemathcommand [unic@romannumeralfive] {{\tf v}}
+ \definemathcommand [unic@romannumeralsix] {{\tf vi}}
+ \definemathcommand [unic@romannumeralseven] {{\tf vii}}
+ \definemathcommand [unic@romannumeraleight] {{\tf viii}}
+ \definemathcommand [unic@romannumeralnine] {{\tf ix}}
+ \definemathcommand [unic@romannumeralten] {{\tf x}}
+ \definemathcommand [unic@romannumeraleleven] {{\tf xi}}
+ \definemathcommand [unic@romannumeraltwelve] {{\tf xii}}
+ \definemathcommand [unic@romannumeralfifty] {{\tf l}}
+ \definemathcommand [unic@romannumeralonehundred] {{\tf c}}
+ \definemathcommand [unic@romannumeralfivehundred] {{\tf d}}
+ \definemathcommand [unic@romannumeralonethousand] {{\tf m}}
+ \definemathcommand [unic@romannumeralonethousandCD] {\unknownchar}
+ \definemathcommand [unic@romannumeralfivethousand] {\unknownchar}
+ \definemathcommand [unic@romannumeraltenthousand] {\unknownchar}
+ \definemathcommand [unic@romannumeralreversedonehundred] {\mirror{C}}
+
+\stopmathcollection
+
+% needed for unic-033 % NW
+
+\startmathcollection[default]
+
+ \definemathcommand [unic@leftarrowtobar] {\mapstochar\leftarrow}
+
+\stopmathcollection
+
+% needed for unic-034 % NW
+
+\startmathcollection[default]
+
+ \definemathcommand [unic@in] {\in}
+ \definemathcommand [unic@nin] {\not\in}
+ \definemathcommand [unic@nni] {\not\ni}
+ \definemathcommand [unic@minus] {-}
+ \definemathcommand [unic@divisionslash] {/}
+ \definemathcommand [unic@sqrt] {\sqrt{}}
+ \definemathcommand [unic@cubesqrt] {\root 3 \of {}}
+ \definemathcommand [unic@fourthsqrt] {\root 4 \of {}}
+ \definemathcommand [unic@divides] [op] {|} % TODO
+ \definemathcommand [unic@ndivides] [rel] {\mathop{\not|}} % TODO: horrible
+ \definemathcommand [unic@cap] {\cap}
+ \definemathcommand [unic@dblint] {\int\!\!\!\int}
+ \definemathcommand [unic@triint] {\int\!\!\!\int\!\!\!\int}
+ \definemathcommand [unic@ratio] [rel] {:}
+ \definemathcommand [unic@proportion] [rel] {::}
+ \definemathcommand [unic@excess] [op] {-\!\!:}
+ \definemathcommand [unic@geomprop] [op] {:\!\!\!-\!\!\!:}
+ \definemathcommand [unic@homothetic] [op] {\sim\!\!\!:}
+ \definemathcommand [unic@nsimeq] {\not\simeq}
+ \definemathcommand [unic@cong] {\cong}
+ \definemathcommand [unic@napproxeq] {\not\approxeq}
+ \definemathcommand [unic@napprox] {\not\approx}
+ \definemathcommand [unic@doteq] {\doteq}
+ \definemathcommand [unic@correspondsto] {\buildrel \frown \over =}
+ \definemathcommand [unic@estimates] {\buildrel \wedge \over =}
+ \definemathcommand [unic@equiangularto] {\buildrel \vee \over =}
+ \definemathcommand [unic@stareq] {\buildrel \star \over =}
+ \definemathcommand [unic@eqbydef] {\buildrel \rm def \over =}
+ \definemathcommand [unic@measuredby] {\buildrel \rm m \over =}
+ \definemathcommand [unic@questionedeq] {\buildrel \rm ? \over =}
+ \definemathcommand [unic@nequiv] {\not\equiv}
+ \definemathcommand [unic@nasymp] {\not\asymp}
+ \definemathcommand [unic@nlesssim] {\not\lesssim}
+ \definemathcommand [unic@ngtrsim] {\not\gtrsim}
+ \definemathcommand [unic@nlessgtr] {\not\lessgtr}
+ \definemathcommand [unic@ngtrless] {\not\gtrless}
+ \definemathcommand [unic@nsubset] {\not\subset}
+ \definemathcommand [unic@nsupset] {\not\supset}
+ \definemathcommand [unic@nsqsubseteq] {\not\sqsubseteq}
+ \definemathcommand [unic@nsqsupseteq] {\not\sqsupseteq}
+
+\stopmathcollection
+
+% needed for unic-039 % NW
+
+\startmathcollection[default]
+
+ \definemathcommand [unic@Lbracket] [open] {[\![}
+ \definemathcommand [unic@Rbracket] [close] {]\!]}
+ \definemathcommand [unic@Langle] [open] {\langle\!\langle}
+ \definemathcommand [unic@Rangle] [close] {\rangle\!\rangle}
+
+\stopmathcollection
+
+\protect \endinput
diff --git a/tex/context/base/math-uni.tex b/tex/context/base/math-uni.tex
deleted file mode 100644
index e8fd3f05d..000000000
--- a/tex/context/base/math-uni.tex
+++ /dev/null
@@ -1,237 +0,0 @@
-%D \module
-%D [ file=math-uni,
-%D version=2005.06.11,
-%D title=\CONTEXT\ Math Macros,
-%D subtitle=unicode support,
-%D author={Nikolai Weibull \& Taco Hoekwater},
-%D date=\currentdate,
-%D copyright=PRAGMA]
-
-\unprotect
-
-% needed for unic-032 % TH
-
-\startmathcollection[default]
-
- \definemathcommand [unic@doubleverticalline] {\mathord{\parallel}}
- \definemathcommand [unic@doublelowline] {\underline{\textunderscore}}
-
- \definemathcommand [unic@doubleprime] {''}
- \definemathcommand [unic@tripleprime] {'''}
-
- \definemathcommand [unic@reverseddoubleprime] {\mathord{\backprime\backprime}}
- \definemathcommand [unic@reversedtripleprime] {\mathord{\backprime\backprime\backprime}}
-
- \definemathcommand [unic@fractionslash] {\vulgarfraction{}{}}
- \definemathcommand [unic@lowasterisk] {\mathord{\lower-.2em\hbox{$\ast$}}}
-
- \definemathcommand [unic@functionapplication] {\mathop{}}
- \definemathcommand [unic@invisibletimes] {\mathbin{}}
- \definemathcommand [unic@invisibleseparator] {\mathpunct{}}
-
-\stopmathcollection
-
-% needed for unic-033 % TH
-
-\def\unic@vulgarfraction#1#2%
- {\hbox
- {\high{{\tfx\it #1}\kern -.2em}%
- \symbol[vulgarfraction]%
- \kern -.2em\low{{\tfx\it #2}}}}
-
-\startmathcollection[default]
-
- \definemathcommand [unic@accountof] {\unic@vulgarfraction{a}{c}}
- \definemathcommand [unic@addressedtothesubject] {\unic@vulgarfraction{a}{s}}
- \definemathcommand [unic@doublestruckC] {{\Bbb C}}
- \definemathcommand [unic@degreecelsius] {{\textdegree \tf C}}
- \definemathcommand [unic@centrelinesymbol] {\unknownchar}
- \definemathcommand [unic@careof] {\unic@vulgarfraction{c}{o}}
- \definemathcommand [unic@cadauna] {\unic@vulgarfraction{c}{u}}
- \definemathcommand [unic@eulerconstant] {{\rm e}}
- \definemathcommand [unic@scruple] {\unknownchar}
- \definemathcommand [unic@degreefahrenheit] {{\textdegree \tf F}}
- \definemathcommand [unic@scriptg] {\unknownchar}
- \definemathcommand [unic@scriptH] {{\cal H}}
- \definemathcommand [unic@blackletterH] {{\fraktur H}}
- \definemathcommand [unic@doublestruckH] {{\Bbb H}}
- \definemathcommand [unic@planckconstant] {h}
- \definemathcommand [unic@planckconstantovertwopi] {\hslash}
- \definemathcommand [unic@scriptI] {{\cal I}}
- \definemathcommand [unic@blackletterI] {{\fraktur I}}
- \definemathcommand [unic@scriptL] {{\cal L}}
- \definemathcommand [unic@scriptl] {\ell}
- \definemathcommand [unic@lbbarsymbol] {\unknownchar}
- \definemathcommand [unic@doublestruckN] {{\Bbb N}}
- \definemathcommand [unic@numerosign] {\hbox{\symbol[numero]}}
- \definemathcommand [unic@soundrecordingcopyright] {\encircled{{\tfx P}}}
- \definemathcommand [unic@scriptP] {{\cal P}}
- \definemathcommand [unic@doublestruckP] {{\Bbb P}}
- \definemathcommand [unic@doublestruckQ] {{\Bbb Q}}
- \definemathcommand [unic@scriptR] {{\cal R}}
- \definemathcommand [unic@blackletterR] {{\fraktur R}}
- \definemathcommand [unic@doublestruckR] {{\Bbb R}}
- \definemathcommand [unic@prescriptiontake] {\unknownchar}
- \definemathcommand [unic@response] {\unknownchar}
- \definemathcommand [unic@servicemark] {\high{\txx SM}}
- \definemathcommand [unic@telephonesign] {\high{\txx TEL}}
- \definemathcommand [unic@trademarksign] {\trademark}
- \definemathcommand [unic@versickle] {\unknownchar}
- \definemathcommand [unic@doublestruckZ] {{\Bbb Z}}
- \definemathcommand [unic@ouncesign] {\unknownchar}
- \definemathcommand [unic@ohmsign] {\Omega}
- \definemathcommand [unic@invertedohmsign] {\rotate[\c!rotation=180]{\Omega}}
- \definemathcommand [unic@blackletterZ] {{\fraktur Z}}
- \definemathcommand [unic@turnedgreekletteriota] {\rotate[\c!rotation=180]{\iota}}
- \definemathcommand [unic@kelvinsign] {{\tf K}}
- \definemathcommand [unic@angstromsign] {\Angstrom}
- \definemathcommand [unic@scriptB] {{\cal B}}
- \definemathcommand [unic@blackletterC] {{\fraktur C}}
- \definemathcommand [unic@estimatedsymbol] {\unknownchar}
- \definemathcommand [unic@scripte] {\unknownchar}
- \definemathcommand [unic@scriptE] {{\cal E}}
- \definemathcommand [unic@scriptF] {{\cal F}}
- \definemathcommand [unic@turnedF] {\rotate[\c!rotation=180]{{\tf F}}}
- \definemathcommand [unic@scriptM] {{\cal M}}
- \definemathcommand [unic@scripto] {\unknownchar}
-
- \definemathcommand [unic@informationsource] {{\bf i}}
- \definemathcommand [unic@rotatedQ] {\rotate[\c!rotation=90]{{\tf Q}}}
- \definemathcommand [unic@facsimilesign] {\unknownchar}
- \definemathcommand [unic@doublestruckpi] {\pi}%{\unknownchar}
- \definemathcommand [unic@doublestruckgamma] {\gamma}%{\unknownchar}
- \definemathcommand [unic@doublestruckGamma] {\Gamma}%{\unknownchar}
- \definemathcommand [unic@doublestruckPi] {\Pi}%{\unknownchar}
- \definemathcommand [unic@doublestrucknarysummation] {\unknownchar}
- \definemathcommand [unic@turnedsansserifG] {\rotate[\c!rotation=180]{{\ss G}}}
- \definemathcommand [unic@turnedsansserifL] {\rotate[\c!rotation=180]{{\ss L}}}
- \definemathcommand [unic@reversedsansserifL] {\mirror{{\ss L}}}
- \definemathcommand [unic@turnedsansserifY] {\rotate[\c!rotation=180]{{\ss Y}}}
- \definemathcommand [unic@doublestruckitalicD] {D}%{\unknownchar}
- \definemathcommand [unic@doublestruckitalicd] {d}%{\unknownchar}
- \definemathcommand [unic@doublestruckitalice] {e}%{\unknownchar}
- \definemathcommand [unic@doublestruckitalici] {i}%{\unknownchar}
- \definemathcommand [unic@doublestruckitalicj] {j}%{\unknownchar}
- \definemathcommand [unic@propertyline] {\unknownchar}
- \definemathcommand [unic@turnedampersand] {\rotate[\c!rotation=180]{\&}}
- \definemathcommand [unic@persign] {\unknownchar}
-
- \definemathcommand [unic@fractiononethird] {\vulgarfraction{1}{3}}
- \definemathcommand [unic@fractiontwothirds] {\vulgarfraction{2}{3}}
- \definemathcommand [unic@fractiononefifth] {\vulgarfraction{1}{5}}
- \definemathcommand [unic@fractiontwofifths] {\vulgarfraction{2}{5}}
- \definemathcommand [unic@fractionthreefifths] {\vulgarfraction{3}{5}}
- \definemathcommand [unic@fractionfourfifths] {\vulgarfraction{4}{5}}
- \definemathcommand [unic@fractiononesixth] {\vulgarfraction{1}{6}}
- \definemathcommand [unic@fractionfivesixths] {\vulgarfraction{5}{6}}
- \definemathcommand [unic@fractiononeeighth] {\vulgarfraction{1}{8}}
- \definemathcommand [unic@fractionthreeeighths] {\vulgarfraction{3}{8}}
- \definemathcommand [unic@fractionfiveeighths] {\vulgarfraction{5}{8}}
- \definemathcommand [unic@fractionseveneighths] {\vulgarfraction{7}{8}}
- \definemathcommand [unic@fractionnumeratorone] {\vulgarfraction{1}{}}
- \definemathcommand [unic@romannumeralOne] {{\tf I}}
- \definemathcommand [unic@romannumeralTwo] {{\tf II}}
- \definemathcommand [unic@romannumeralThree] {{\tf III}}
- \definemathcommand [unic@romannumeralFour] {{\tf IV}}
- \definemathcommand [unic@romannumeralFive] {{\tf V}}
- \definemathcommand [unic@romannumeralSix] {{\tf VI}}
- \definemathcommand [unic@romannumeralSeven] {{\tf VII}}
- \definemathcommand [unic@romannumeralEight] {{\tf VIII}}
- \definemathcommand [unic@romannumeralNine] {{\tf IX}}
- \definemathcommand [unic@romannumeralTen] {{\tf X}}
- \definemathcommand [unic@romannumeralEleven] {{\tf XI}}
- \definemathcommand [unic@romannumeralTwelve] {{\tf XII}}
- \definemathcommand [unic@romannumeralFifty] {{\tf L}}
- \definemathcommand [unic@romannumeralOnehundred] {{\tf C}}
- \definemathcommand [unic@romannumeralFivehundred] {{\tf D}}
- \definemathcommand [unic@romannumeralOnethousand] {{\tf M}}
- \definemathcommand [unic@romannumeralone] {{\tf i}}
- \definemathcommand [unic@romannumeraltwo] {{\tf ii}}
- \definemathcommand [unic@romannumeralthree] {{\tf iii}}
- \definemathcommand [unic@romannumeralfour] {{\tf iv}}
- \definemathcommand [unic@romannumeralfive] {{\tf v}}
- \definemathcommand [unic@romannumeralsix] {{\tf vi}}
- \definemathcommand [unic@romannumeralseven] {{\tf vii}}
- \definemathcommand [unic@romannumeraleight] {{\tf viii}}
- \definemathcommand [unic@romannumeralnine] {{\tf ix}}
- \definemathcommand [unic@romannumeralten] {{\tf x}}
- \definemathcommand [unic@romannumeraleleven] {{\tf xi}}
- \definemathcommand [unic@romannumeraltwelve] {{\tf xii}}
- \definemathcommand [unic@romannumeralfifty] {{\tf l}}
- \definemathcommand [unic@romannumeralonehundred] {{\tf c}}
- \definemathcommand [unic@romannumeralfivehundred] {{\tf d}}
- \definemathcommand [unic@romannumeralonethousand] {{\tf m}}
- \definemathcommand [unic@romannumeralonethousandCD] {\unknownchar}
- \definemathcommand [unic@romannumeralfivethousand] {\unknownchar}
- \definemathcommand [unic@romannumeraltenthousand] {\unknownchar}
- \definemathcommand [unic@romannumeralreversedonehundred] {\mirror{C}}
-
-\stopmathcollection
-
-% needed for unic-033 % NW
-
-\startmathcollection[default]
-
- \definemathcommand [unic@leftarrowtobar] {\mapstochar\leftarrow}
-
-\stopmathcollection
-
-% needed for unic-034 % NW
-
-\startmathcollection[default]
-
- \definemathcommand [unic@in] {\in}
- \definemathcommand [unic@nin] {\not\in}
- \definemathcommand [unic@nni] {\not\ni}
- \definemathcommand [unic@minus] {-}
- \definemathcommand [unic@divisionslash] {/}
- \definemathcommand [unic@sqrt] {\sqrt{}}
- \definemathcommand [unic@cubesqrt] {\root 3 \of {}}
- \definemathcommand [unic@fourthsqrt] {\root 4 \of {}}
- \definemathcommand [unic@divides] [op] {|} % TODO
- \definemathcommand [unic@ndivides] [rel] {\mathop{\not|}} % TODO: horrible
- \definemathcommand [unic@cap] {\cap}
- \definemathcommand [unic@dblint] {\int\!\!\!\int}
- \definemathcommand [unic@triint] {\int\!\!\!\int\!\!\!\int}
- \definemathcommand [unic@ratio] [rel] {:}
- \definemathcommand [unic@proportion] [rel] {::}
- \definemathcommand [unic@excess] [op] {-\!\!:}
- \definemathcommand [unic@geomprop] [op] {:\!\!\!-\!\!\!:}
- \definemathcommand [unic@homothetic] [op] {\sim\!\!\!:}
- \definemathcommand [unic@nsimeq] {\not\simeq}
- \definemathcommand [unic@cong] {\cong}
- \definemathcommand [unic@napproxeq] {\not\approxeq}
- \definemathcommand [unic@napprox] {\not\approx}
- \definemathcommand [unic@doteq] {\doteq}
- \definemathcommand [unic@correspondsto] {\buildrel \frown \over =}
- \definemathcommand [unic@estimates] {\buildrel \wedge \over =}
- \definemathcommand [unic@equiangularto] {\buildrel \vee \over =}
- \definemathcommand [unic@stareq] {\buildrel \star \over =}
- \definemathcommand [unic@eqbydef] {\buildrel \rm def \over =}
- \definemathcommand [unic@measuredby] {\buildrel \rm m \over =}
- \definemathcommand [unic@questionedeq] {\buildrel \rm ? \over =}
- \definemathcommand [unic@nequiv] {\not\equiv}
- \definemathcommand [unic@nasymp] {\not\asymp}
- \definemathcommand [unic@nlesssim] {\not\lesssim}
- \definemathcommand [unic@ngtrsim] {\not\gtrsim}
- \definemathcommand [unic@nlessgtr] {\not\lessgtr}
- \definemathcommand [unic@ngtrless] {\not\gtrless}
- \definemathcommand [unic@nsubset] {\not\subset}
- \definemathcommand [unic@nsupset] {\not\supset}
- \definemathcommand [unic@nsqsubseteq] {\not\sqsubseteq}
- \definemathcommand [unic@nsqsupseteq] {\not\sqsupseteq}
-
-\stopmathcollection
-
-% needed for unic-039 % NW
-
-\startmathcollection[default]
-
- \definemathcommand [unic@Lbracket] [open] {[\![}
- \definemathcommand [unic@Rbracket] [close] {]\!]}
- \definemathcommand [unic@Langle] [open] {\langle\!\langle}
- \definemathcommand [unic@Rangle] [close] {\rangle\!\rangle}
-
-\stopmathcollection
-
-\protect \endinput
diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua
index 35d18d77a..0e06d3757 100644
--- a/tex/context/base/math-vfu.lua
+++ b/tex/context/base/math-vfu.lua
@@ -240,6 +240,8 @@ function fonts.basecopy(tfmtable)
return t
end
+local reported = { }
+
function fonts.vf.math.define(specification,set)
if not reverse then
reverse = { }
@@ -335,9 +337,16 @@ function fonts.vf.math.define(specification,set)
for unicode, index in next, vector do
local fci = fc[index]
if not fci then
- -- if trace_virtual then
- logs.report("math virtual", "unicode point U+%04X has no index %04X in %s",unicode,index,vectorname)
- -- end
+ local fontname = fs.name
+ local rf = reported[fontname]
+ if not rf then rf = { } reported[fontname] = rf end
+ local rv = rf[vectorname]
+ if not rv then rv = { } rf[vectorname] = rv end
+ local ru = rv[unicode]
+ if not ru then
+ logs.report("math virtual", "unicode point U+%05X has no index %04X in vector %s for font %s",unicode,index,vectorname,fontname)
+ rv[unicode] = true
+ end
else
local ref = si[index]
if not ref then
@@ -503,6 +512,7 @@ function fonts.vf.math.define(specification,set)
main.has_italic = true
main.type = "virtual" -- not needed
mathematics.scaleparameters(main,main,1)
+main.nomath = false
return main
end
@@ -1327,8 +1337,8 @@ mathematics.make_font ( "lmroman6-math", {
{ name = "lmmib5.tfm", vector = "tex-bi", skewchar=0x7F } ,
{ name = "lmsans8-regular.otf", vector = "tex-ss", optional=true },
{ name = "lmmono8-regular.otf", vector = "tex-tt", optional=true },
- { name = "eufm6.tfm", vector = "tex-fraktur", optional=true },
- { name = "eufb6.tfm", vector = "tex-fraktur-bold", optional=true },
+ { name = "eufm5.tfm", vector = "tex-fraktur", optional=true },
+ { name = "eufb5.tfm", vector = "tex-fraktur-bold", optional=true },
} )
-- rm-lmr7 : LMMathRoman7-Regular
@@ -1373,8 +1383,8 @@ mathematics.make_font ( "lmroman8-math", {
{ name = "lmmib7.tfm", vector = "tex-bi", skewchar=0x7F } ,
{ name = "lmsans8-regular.otf", vector = "tex-ss", optional=true },
{ name = "lmmono8-regular.otf", vector = "tex-tt", optional=true },
- { name = "eufm8.tfm", vector = "tex-fraktur", optional=true },
- { name = "eufb8.tfm", vector = "tex-fraktur-bold", optional=true },
+ { name = "eufm7.tfm", vector = "tex-fraktur", optional=true },
+ { name = "eufb7.tfm", vector = "tex-fraktur-bold", optional=true },
} )
-- rm-lmr9 : LMMathRoman9-Regular
@@ -1395,8 +1405,8 @@ mathematics.make_font ( "lmroman9-math", {
{ name = "lmmib10.tfm", vector = "tex-bi", skewchar=0x7F } ,
{ name = "lmsans9-regular.otf", vector = "tex-ss", optional=true },
{ name = "lmmono9-regular.otf", vector = "tex-tt", optional=true },
- { name = "eufm9.tfm", vector = "tex-fraktur", optional=true },
- { name = "eufb9.tfm", vector = "tex-fraktur-bold", optional=true },
+ { name = "eufm10.tfm", vector = "tex-fraktur", optional=true },
+ { name = "eufb10.tfm", vector = "tex-fraktur-bold", optional=true },
} )
-- rm-lmr10 : LMMathRoman10-Regular
@@ -1424,6 +1434,24 @@ mathematics.make_font ( "lmroman10-math", {
{ name = "eufb10.tfm", vector = "tex-fraktur-bold", optional=true },
} )
+mathematics.make_font ( "lmroman10-boldmath", {
+ { name = "lmroman10-bold.otf", features = "virtualmath", main = true },
+ -- { name = "rm-lmr10.tfm", vector = "tex-mr" } ,
+ { name = "lmmib10.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "lmbsy10.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } ,
+ { name = "lmex10.tfm", vector = "tex-ex", extension = true } ,
+-- copied from roman:
+ { name = "msam10.tfm", vector = "tex-ma" },
+ { name = "msbm10.tfm", vector = "tex-mb" },
+ -- { name = "rm-lmbx10.tfm", vector = "tex-bf" } ,
+ { name = "lmroman10-bold.otf", "tex-bf" } ,
+ { name = "lmmib10.tfm", vector = "tex-bi", skewchar=0x7F } ,
+ { name = "lmsans10-regular.otf", vector = "tex-ss", optional=true },
+ { name = "lmmono10-regular.otf", vector = "tex-tt", optional=true },
+ { name = "eufm10.tfm", vector = "tex-fraktur", optional=true },
+ { name = "eufb10.tfm", vector = "tex-fraktur-bold", optional=true },
+} )
+
-- rm-lmr12 : LMMathRoman12-Regular
-- rm-lmbx12 : LMMathRoman12-Bold
-- lmmi12 : LMMathItalic12-Italic
@@ -1468,8 +1496,8 @@ mathematics.make_font ( "lmroman17-math", {
mathematics.make_font ( "px-math", {
{ name = "texgyrepagella-regular.otf", features = "virtualmath", main = true },
- { name = "pxr.tfm", vector = "tex-mr" } ,
- { name = "pxmi.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "rpxr.tfm", vector = "tex-mr" } ,
+ { name = "rpxmi.tfm", vector = "tex-mi", skewchar=0x7F },
{ name = "pxsy.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } ,
{ name = "pxex.tfm", vector = "tex-ex", extension = true } ,
{ name = "pxsya.tfm", vector = "tex-ma" },
@@ -1478,8 +1506,8 @@ mathematics.make_font ( "px-math", {
mathematics.make_font ( "tx-math", {
{ name = "texgyretermes-regular.otf", features = "virtualmath", main = true },
- { name = "txr.tfm", vector = "tex-mr" } ,
- { name = "txmi.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "rtxr.tfm", vector = "tex-mr" } ,
+ { name = "rtxmi.tfm", vector = "tex-mi", skewchar=0x7F },
{ name = "txsy.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } ,
{ name = "txex.tfm", vector = "tex-ex", extension = true } ,
{ name = "txsya.tfm", vector = "tex-ma" },
diff --git a/tex/context/base/meta-ini.mkii b/tex/context/base/meta-ini.mkii
index ee7e8a38b..f9d097049 100644
--- a/tex/context/base/meta-ini.mkii
+++ b/tex/context/base/meta-ini.mkii
@@ -20,22 +20,6 @@
\unprotect
-% messages moved
-
-% messages moved
-
-% messages moved
-
-% messages moved
-
-% messages moved
-
-% messages moved
-
-% messages moved
-
-% messages moved
-
%D This module extends the functionality of the support module
%D \type {supp-mps}, the module that is responsible for
%D \METAPOST\ inclusion in \CONTEXT. Some basic macros will be
@@ -151,6 +135,19 @@
\def\MPrawvar#1#2{\csname#1:#2\endcsname}
+\def\presetMPvariable
+ {\dodoubleargument\dopresetMPvariable}
+
+\def\dopresetMPvariable[#1][#2=#3]%
+ {\doifundefined{#1:#2}{\setvalue{#1:#2}{#3}}}
+
+\def\useMPvariables
+ {\dodoubleargument\douseMPvariables}
+
+\def\douseMPvariables[#1][#2]%
+ {\def\@@meta{#1:}%
+ \prepareMPvariables{#2}}
+
%D \macros
%D {startuniqueMPgraphic, uniqueMPgraphic}
%D
diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv
index 0e0adc54f..042f7247e 100644
--- a/tex/context/base/meta-ini.mkiv
+++ b/tex/context/base/meta-ini.mkiv
@@ -74,10 +74,6 @@
{\doifnot{#1}{+}{\global\MPuserinclusions\emptytoks}%
\global\MPuserinclusions\expandafter{\the\MPuserinclusions#2}}
-% \ifx \overlaywidth \undefined \def \overlaywidth {4cm} \fi
-% \ifx \overlayheight \undefined \def \overlayheight {3cm} \fi
-% \ifx \overlaylinewidth \undefined \def \overlaylinewidth {0pt} \fi
-
\def\presetMPdefinitions
{\edef\overlaywidth {\overlaywidth \space}%
\edef\overlayheight {\overlayheight \space}%
@@ -87,53 +83,6 @@
\def\currentMPformat{metafun}
-% todo:
-%
-% \splitMPgraphicname[a::b] (\currentMPgraphicformat,\currentMPgraphicname)
-% \splitMPgraphicname[a] (\currentMPgraphicformat,\currentMPgraphicname)
-% \splitMPgraphicname[a::b::c] (\currentMPgraphicformat,\currentMPgraphicname)
-%
-% \resetMPformat[extrafun]
-%
-% MPinclusions etc only for metafun, randomseed for all
-%
-% todo: \resetMPformat[instance] -> unload and nil
-% todo: geen page stats
-% todo: textext in plain mp
-
-% \startMPdefinitions{metafun}
-% color MyColor ; MyColor = red ;
-% \stopMPdefinitions
-% \startuseMPgraphic{test1}
-% fill fullcircle scaled 1cm withcolor MyColor ;
-% \stopuseMPgraphic
-% \startuseMPgraphic{test2}
-% color MyColor ; MyColor = green ;
-% fill fullcircle scaled 1cm withcolor MyColor ;
-% \stopuseMPgraphic
-% \startuseMPgraphic{test3}
-% fill fullcircle scaled 1cm withcolor MyColor ;
-% \stopuseMPgraphic
-% \startuseMPgraphic{test4}
-% color MyColor ; MyColor = blue ;
-% \stopuseMPgraphic
-%
-% \useMPgraphic{metafun::test1}
-% \useMPgraphic{metafun::test2}
-% \useMPgraphic{metafun::test3}
-% \useMPgraphic{extrafun::test4}
-% \useMPgraphic{extrafun::test3}
-% \useMPgraphic{metafun::test3}
-% \useMPgraphic{nofun::test4}
-% \useMPgraphic{nofun::test3}
-%
-% \startMPcode
-% fill fullsquare scaled 1cm ;
-% \stopMPcode
-% \startMPcode{metafun}
-% fill fullsquare scaled 1cm withcolor MyColor ;
-% \stopMPcode
-
\def\@@MPF{@MPF@}
\def\MPinstancetoks{\csname\@@MPF::\currentMPgraphicinstance\endcsname}
@@ -180,40 +129,13 @@
\def\endMPgraphicgroup
{\endgroup}
-%
-
\newconditional \METAFUNinitialized
\def\MPaskedfigure{false}
-% maybe we need to force black, i.e. fake nodes
-
-\long\def\processMPgraphic#1% todo: extensions and inclusions outside beginfig
- {\begingroup
- \enableincludeMPgraphics
- \the\everyMPgraphic
- \presetMPdefinitions
- \setMPrandomseed % this has to change
- % we need to preexpand the token lists
- \setbox\MPgraphicbox\hbox\bgroup
- \ctxlua{metapost.graphic("\currentMPformat", "\currentMPformat",
- \@EA\!!bs\the\MPinitializations;\theMPrandomseed;#1;\!!es, % code
- \@EA\@EA\@EA\!!bs\@EA\the\@EA\MPextensions\@EA;\the\MPuserinclusions;\!!es, % optional preamble
- \MPaskedfigure
- )}%
- \global\settrue\METAFUNinitialized
- \global\MPextensions\emptytoks
- \global\MPuserinclusions\emptytoks
- \egroup
- \placeMPgraphic
- \endgroup}
-
-% ! ! ! ! begin temporary ! ! ! !
-
-\let\normalprocessMPgraphic\processMPgraphic
-
\long\def\processMPgraphic#1% todo: extensions and inclusions outside beginfig
{\begingroup % needed?
+\forgetall
\enableincludeMPgraphics
\the\everyMPgraphic
\presetMPdefinitions
@@ -223,7 +145,7 @@
{\settrue\includeMPextensions\letgvalue{\@@MPF\currentMPgraphicinstance\s!extensions}\v!no}
{\setfalse\includeMPextensions}%
\doifelsevalue{\@@MPF\currentMPgraphicinstance\s!initializations}\v!yes
- {\settrue\includeMPinitializations}% \letgvalue{\@@MPF\currentMPgraphicinstance\s!initializations}\v!no}
+ {\settrue\includeMPinitializations }%
{\setfalse\includeMPinitializations}%
\setbox\MPgraphicbox\hbox\bgroup
\normalexpanded{\noexpand\ctxlua{metapost.graphic("\currentMPgraphicinstance", "\currentMPgraphicformat",
@@ -234,18 +156,9 @@
\egroup
\global\MPinstancetoks\emptytoks
\global\settrue\METAFUNinitialized % becomes obsolete
- %\global\MPextensions\emptytoks % multipls instances
- %\global\MPuserinclusions\emptytoks % multipls instances
\placeMPgraphic
\endgroup}
-\let\extendedprocessMPgraphic\processMPgraphic
-
-% \let\processMPgraphic\normalprocessMPgraphic
-\let\processMPgraphic\extendedprocessMPgraphic
-
-% ! ! ! ! end temporary ! ! ! !
-
\newif\ifsetMPrandomseed \setMPrandomseedtrue % false by default
\def\setMPrandomseed
@@ -286,25 +199,6 @@
\def\getMPdrawing{\dosinglegroupempty\dogetMPdrawing}
-% \def\nodogetMPdrawing#1%
-% {\ifMPdrawingdone
-% \expandafter\processMPgraphic\expandafter{\MPdrawingdata}%
-% \fi}
-%
-% \def\dostartMPcode
-% {\iffirstargument
-% \expandafter\dodogetMPdrawing
-% \else
-% \expandafter\nodogetMPdrawing
-% \fi}
-%
-% \def\dodogetMPdrawing#1%
-% {\ifMPdrawingdone
-% \beginMPgraphicgroup{#1::\s!dummy}% name does not matter
-% \expandafter\processMPgraphic\expandafter{\MPdrawingdata}%
-% \endMPgraphicgroup
-% \fi}
-
\def\startMPdrawing
{\dosingleempty\dostartMPdrawing}
@@ -395,14 +289,6 @@
defaultfont:="rm-lmtt10";
\stopMPinitializations
-%D In order to support fancy text features (like outline
-%D fonts), we set:
-
-% \startMPextensions
-% graphictextformat:="context";
-% graphictextdirective "\the\everyMPTEXgraphic";
-% \stopMPextensions
-
%D A signal that we're in combines \CONTEXT||\METAFUN mode:
\startMPextensions
@@ -423,16 +309,6 @@
\prependtoks \MPstaticgraphictrue \to \everyoverlay
\prependtoks \MPstaticgraphictrue \to \everypagebody
-% %D We save the number of graphics for the sake of \TEXEXEC.
-%
-% \newcounter\totalnofMPgraphics
-%
-% \def\thenofMPgraphics{\the\nofMPgraphics} % from supp-mps
-%
-% \appendtoks
-% \savecurrentvalue\totalnofMPgraphics\thenofMPgraphics
-% \to \everybye
-
%D \macros
%D {setupMPvariables}
%D
@@ -472,6 +348,19 @@
\def\MPrawvar#1#2{\csname#1:#2\endcsname}
+\def\presetMPvariable
+ {\dodoubleargument\dopresetMPvariable}
+
+\def\dopresetMPvariable[#1][#2=#3]%
+ {\ifcsname#1:#2\endcsname\else\setvalue{#1:#2}{#3}\fi}
+
+\def\useMPvariables
+ {\dodoubleargument\douseMPvariables}
+
+\def\douseMPvariables[#1][#2]%
+ {\def\@@meta{#1:}%
+ \prepareMPvariables{#2}}
+
%D \macros
%D {startuniqueMPgraphic, uniqueMPgraphic}
%D
@@ -510,7 +399,6 @@
\newcount\MPobjectcounter
\newbox \MPgraphicbox
-%newif \ifMPshiftdrawing \MPshiftdrawingfalse
\chardef\MPboxmode\zerocount
@@ -555,7 +443,7 @@
\extendMPoverlaystamp{#2}% incl prepare
\ifcsname\@@MPG\overlaystamp:#1\endcsname\else
\enableincludeMPgraphics
- \forgetall
+% \forgetall
\global\advance\MPobjectcounter\plusone
\setobject{MP}{\number\MPobjectcounter}\hbox{\processMPgraphic{#3}}% was vbox, graphic must end up as hbox
\setxvalue{\@@MPG\overlaystamp:#1}{\noexpand\reuseMPbox{\number\MPobjectcounter}{\MPllx}{\MPlly}{\MPurx}{\MPury}}%
@@ -582,7 +470,7 @@
\long\def\handleuseMPgraphic#1#2#3%
{\begingroup
- \forgetall % check this
+% \forgetall % check this
\def\@@meta{#1:}%
\prepareMPvariables{#2}%
\enableincludeMPgraphics
@@ -810,25 +698,6 @@
%D A more general way of passing environments is:
-% \def\startMPenvironment % second arg gobbles spaces, so that reset gives \emptytoks
-% {\bgroup
-% \catcode`\^^M=\@@space
-% \dodoubleempty\dostartMPenvironment}
-
-% \long\def\dostartMPenvironment[#1][#2]#3\stopMPenvironment
-% {\egroup
-% \doif{#1}\s!reset\resetMPenvironment % reset mp toks
-% \doif{#1}\v!global{#3}% % use in main doc too
-% \doif{#1}+{#3}% % use in main doc too
-% \defconvertedargument\ascii{#3}%
-% \expandafter\appendtoks\ascii\to\everyMPTEXgraphic}
-
-% \def\resetMPenvironment
-% {\everyMPTEXgraphic\emptytoks % = is really needed !
-% \startMPenvironment
-% \global\loadfontfileoncetrue
-% \stopMPenvironment}
-
\def\startMPenvironment % second arg gobbles spaces, so that reset gives \emptytoks
{\dodoubleempty\dostartMPenvironment}
@@ -846,8 +715,6 @@
\def\useMPenvironmentbuffer[#1]%
{\ctxlua{metapost.tex.set(buffers.content("#1"))}}
-% \useMPenvironmentbuffer[mp] % hm, what is this?
-
%D This command takes \type {[reset]} as optional
%D argument.
%D
@@ -892,20 +759,6 @@
\let\MPruninstance\defaultMPgraphicinstance
-% \def\useMPrun#1#2% name n
-% {\begingroup
-% \def\MPaskedfigure{#2}%
-% \doifelsenothing{#1}
-% {\useMPgraphic{\MPruninstance::mprun}}%
-% {\useMPgraphic{\MPruninstance::#1}}%
-% \endgroup}
-% \def\startMPrun
-% {\dosinglegroupempty\dostartMPrun}
-% \long\def\dostartMPrun#1#2\stopMPrun
-% {\edef\MPruninstance{\iffirstargument#1\else\defaultMPgraphicinstance\fi}%
-% \startuseMPgraphic{mprun}#2\stopuseMPgraphic}
-
-
\def\useMPrun#1#2% name n
{\begingroup
\def\MPaskedfigure{#2}%
@@ -1087,22 +940,11 @@
\let \} \letterclosebrace
\to \everyMPgraphic
-%D Alas, the prologue settings differ per driver.
-
-\ifx\undefined\MPprologues \def\MPprologues{0} \fi
-
-% hm, not needed more than once so can be extensions
-
\startMPinitializations
- prologues:=\MPprologues;
+ prologues:=0;
mpprocset:=1;
\stopMPinitializations
-\appendtoks
- \def\MPprologues{0}%
- \def\MPOSTdriver{dvips}%
-\to \everyresetspecials
-
%D \macros
%D {PDFMPformoffset}
%D
@@ -1112,63 +954,68 @@
\def\PDFMPformoffset{\objectoffset}
-%D \macros
-%D {insertMPfile}
-%D
-%D Bypassing the special driver and figure mechanism is not
-%D that nice but saves upto 5\% time in embedding \METAPOST\
-%D graphics by using the low level \PDF\ converter directly,
-%D given of course that we use \PDFTEX. As a result we need to
-%D fool around with the object trigger.
+% %D \macros
+% %D {insertMPfile}
+% %D
+% %D Bypassing the special driver and figure mechanism is not
+% %D that nice but saves upto 5\% time in embedding \METAPOST\
+% %D graphics by using the low level \PDF\ converter directly,
+% %D given of course that we use \PDFTEX. As a result we need to
+% %D fool around with the object trigger.
\newtoks\everyinsertMPfile
-\let\insertMPfileARG\insertMPfile
-
-\def\insertMPfile#1#2% in context #2 is empty
- {\doifelsenothing{#2}{\doinsertMPfile{#1}}{\insertMPfileARG{#1}{#2}}}
-
-\def\includeMPasEPS#1% untested !!
- {\bgroup
- \message{[MP as EPS #1]}%
- \the\everyinsertMPfile
- \dogetEPSboundingbox{#1}\!!widtha\!!heighta\!!widthb\!!heightb
- \setbox\scratchbox\vbox to \!!heightb
- {\vfill
- \let \@@DriverImageType \c!mps
- \def \@@DriverImageFile {#1}%
- \edef\@@DriverImageWidth {\the\!!widthb }%
- \edef\@@DriverImageHeight{\the\!!heightb}%
- \doinsertfile}%
- \wd\scratchbox\!!widthb
- \dp\scratchbox\zeropoint
- \box\scratchbox
- \egroup}
-
-\def\includeMPasPDF#1%
- {\bgroup
- \the\everyinsertMPfile
- \ifinobject \else \chardef\makeMPintoPDFobject\plustwo \fi % when needed
- \convertMPtoPDF{#1}{1}{1}% no \plusone !
- \egroup}
-
-%D So, using a low level approach (thereby avoiding the slower
-%D figure analysis macros) pays off. This kind of
-%D optimizations are a bit tricky since we must make sure that
-%D special resources end up in the (PDF) files. Because the
-%D \METAPOST\ to \PDF\ can handle objects itself, it is not
-%D that complicated.
-
-%D We hook a couple of initializations into the graphic
-%D macros.
-
-\appendtoks
- \let\figuretypes\c!mps
- \runutilityfilefalse
- \consultutilityfilefalse
-\to \everyinsertMPfile
-
-%D One more: (still needed?)
+% removed in backend:
+%
+% \def\doinsertMPfile#1%
+% {\doiffileelse{./#1}{\includeMPasPDF{./#1}}{\message{[MP #1]}}}
+%
+% \let\insertMPfileARG\insertMPfile
+%
+% \def\insertMPfile#1#2% in context #2 is empty
+% {\doifelsenothing{#2}{\doinsertMPfile{#1}}{\insertMPfileARG{#1}{#2}}}
+%
+% \def\includeMPasEPS#1% untested !!
+% {\bgroup
+% \message{[MP as EPS #1]}%
+% \the\everyinsertMPfile
+% \dogetEPSboundingbox{#1}\!!widtha\!!heighta\!!widthb\!!heightb
+% \setbox\scratchbox\vbox to \!!heightb
+% {\vfill
+% \let \@@DriverImageType \c!mps
+% \def \@@DriverImageFile {#1}%
+% \edef\@@DriverImageWidth {\the\!!widthb }%
+% \edef\@@DriverImageHeight{\the\!!heightb}%
+% \doinsertfile}%
+% \wd\scratchbox\!!widthb
+% \dp\scratchbox\zeropoint
+% \box\scratchbox
+% \egroup}
+%
+% \def\includeMPasPDF#1%
+% {\bgroup
+% \the\everyinsertMPfile
+% \ifinobject \else \chardef\makeMPintoPDFobject\plustwo \fi % when needed
+% \convertMPtoPDF{#1}{1}{1}% no \plusone !
+% \egroup}
+%
+% %D So, using a low level approach (thereby avoiding the slower
+% %D figure analysis macros) pays off. This kind of
+% %D optimizations are a bit tricky since we must make sure that
+% %D special resources end up in the (PDF) files. Because the
+% %D \METAPOST\ to \PDF\ can handle objects itself, it is not
+% %D that complicated.
+%
+% %D We hook a couple of initializations into the graphic
+% %D macros.
+%
+% \appendtoks
+% \let\figuretypes\c!mps
+% \runutilityfilefalse
+% \consultutilityfilefalse
+% \to \everyinsertMPfile
+%
+% %D One more: (still needed?)
\startMPextensions
def initialize_form_numbers =
@@ -1343,12 +1190,6 @@
_special_div_ := 1000\ifconditional\manyMPspecials0\fi ;
\to \MPextensions
-%D Needed (will become default):
-
-\prependtoks
- \resetlanguagespecifics
-\to \everyMPgraphic
-
%D Needed too.
\let\initializeMPgraphics\relax
@@ -1395,8 +1236,11 @@
\chardef\MPcolormethod\zerocount
+% can be faster, just
+
\appendtoks
- \ctxlua{metapost.set_outer_color(\number\MPcolormethod,"\PDFcolor{\currentcolorname}","")}%
+% \ctxlua{metapost.set_outer_color(\number\MPcolormethod,"\PDFcolor{\currentcolorname}","")}%
+ \ctxlua{metapost.set_outer_color(\number\MPcolormethod,\number\currentcolormodel,\number\dogetattribute{color},\number\dogetattribute{transparency})}%
\to \everyMPgraphic
\startMPinitializations
diff --git a/tex/context/base/meta-pag.mkii b/tex/context/base/meta-pag.mkii
new file mode 100644
index 000000000..000e56a2e
--- /dev/null
+++ b/tex/context/base/meta-pag.mkii
@@ -0,0 +1,226 @@
+%D \module
+%D [ file=meta-pag,
+%D version=1999.07.10,
+%D title=\METAPOST\ Graphics,
+%D subtitle=Initialization,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D These definitions used to be part of the old \type
+%D {core-mps} file, later changed into \type {meta-ini}, but
+%D keeping them separate is cleaner.
+
+\writestatus{loading}{MetaPost Graphics / Page Data Management}
+
+\unprotect
+
+\startMPextensions
+ if unknown context_page: input mp-page; fi;
+\stopMPextensions
+
+%D The next few macros tell \METAPOST\ how the \CONTEXT\
+%D pagebody looks.
+
+\startMPextensions
+ boolean PageStateAvailable,OnRightPage,InPageBody;
+ PageStateAvailable:=true;
+\stopMPextensions
+
+\startMPinitializations
+ OnRightPage:=true;
+ InPageBody:=\ifinpagebody true \else false \fi;
+\stopMPinitializations
+
+\startMPinitializations
+ def LoadPageState =
+ OnRightPage:=\MPonrightpage;
+ OnOddPage:=\MPonoddpage;
+ RealPageNumber:=\the\realpageno;
+ PageNumber:=\the\pageno;
+ NOfPages:=\lastpage;
+ PaperHeight:=\the\paperheight;
+ PaperWidth:=\the\paperwidth;
+ PrintPaperHeight:=\the\printpaperheight;
+ PrintPaperWidth:=\the\printpaperwidth;
+ TopSpace:=\the\topspace;
+ BottomSpace:=\the\bottomspace;
+ BackSpace:=\the\backspace;
+ CutSpace:=\the\cutspace;
+ MakeupHeight:=\the\makeupheight;
+ MakeupWidth:=\the\makeupwidth;
+ TopHeight:=\the\topheight;
+ TopDistance:=\the\topdistance;
+ HeaderHeight:=\the\headerheight;
+ HeaderDistance:=\the\headerdistance;
+ TextHeight:=\the\textheight;
+ FooterDistance:=\the\footerdistance;
+ FooterHeight:=\the\footerheight;
+ BottomDistance:=\the\bottomdistance;
+ BottomHeight:=\the\bottomheight;
+ LeftEdgeWidth:=\the\leftedgewidth;
+ LeftEdgeDistance:=\the\leftedgedistance;
+ LeftMarginWidth:=\the\leftmarginwidth;
+ LeftMarginDistance:=\the\leftmargindistance;
+ TextWidth:=\the\textwidth ;
+ RightMarginDistance:=\the\rightmargindistance;
+ RightMarginWidth:=\the\rightmarginwidth;
+ RightEdgeDistance:=\the\rightedgedistance;
+ RightEdgeWidth:=\the\rightedgewidth;
+ InnerMarginDistance:=\the\innermargindistance;
+ InnerMarginWidth:=\the\innermarginwidth;
+ OuterMarginDistance:=\the\outermargindistance;
+ OuterMarginWidth:=\the\outermarginwidth;
+ InnerEdgeDistance:=\the\inneredgedistance;
+ InnerEdgeWidth:=\the\inneredgewidth;
+ OuterEdgeDistance:=\the\outeredgedistance;
+ OuterEdgeWidth:=\the\outeredgewidth;
+ PageOffset:=\the\pageoffset;
+ PageDepth:=\the\pagedepth;
+ LayoutColumns:=\the\layoutcolumns;
+ LayoutColumnDistance:=\the\layoutcolumndistance;
+ LayoutColumnWidth:=\the\layoutcolumnwidth;
+ enddef;
+\stopMPinitializations
+
+\def\MPonrightpage{true}
+\def\MPonoddpage {true}
+
+\def\freezeMPpagelayout
+ {\doifbothsides
+ {\def\MPonrightpage{true}}
+ {\def\MPonrightpage{true}}
+ {\def\MPonrightpage{false}}%
+ \edef\MPonoddpage{\doifoddpageelse{true}{false}}}
+
+\let\freezeMPlayout\relax % obsolete
+
+%D We need to freeze the pagelayout before the backgrounds
+%D are build, because the overlay will temporarily become
+%D zero (overlay).
+
+\appendtoks
+ \freezeMPpagelayout
+\to \everybeforepagebody
+
+%D By freezing these value every graphic, we can use layout
+%D variables that change halfways a page, whatever use that
+%D has.
+
+\prependtoks
+ \calculatereducedvsizes % this is really needed
+ \freezeMPpagelayout
+ \freezeMPlayout % to be used grouped
+\to \everyMPgraphic
+
+%D The next feature provides information about for instance
+%D column positions. This is an experimental feature,
+%D introduced when we needed backgrounds in columns (fill||in
+%D questions as implemented in a private module).
+%D
+%D See \type {mp-page.mp} for the definition of the macros:
+%D
+%D \starttabulate[|tl|l|p|]
+%D \NC ResetTextAreas \NC no arguments \NC
+%D reset areas on page \NC \NR
+%D \NC RegisterTextArea \NC x, y, w, h \NC
+%D adds area to the list \NC \NR
+%D \NC TextAreaX,Y,W,H,XY,WH \NC x and/or y \NC
+%D reports offsets and dimensions \NC \NR
+%D \stoptabulate
+%D
+%D The \type {TextArea*} macros can be used to determine
+%D overlap.
+
+\newcount\currentMPtextareadata
+
+\newtoks\MPsavedtextareadata
+\newtoks\MPtextareadata
+\newtoks\MPlocaltextareadata
+
+% optimaliseren voor herhaling
+
+\def\registerMPtextarea#1%
+ {\ifpositioning
+ \bgroup
+ \global\advance\currentMPtextareadata\plusone
+ %\hpos{gbd:\the\currentMPtextareadata}{#1}%
+ \hpos{gbd:\the\currentMPtextareadata}%
+ {\iftracetextareas\boxrulewidth1.5pt\ruledhbox\fi{#1}}%
+ \edef\!!stringa{gbd:\the\currentMPtextareadata}%
+ \edef\!!stringa{RegisterTextArea(%
+ \MPx\!!stringa,\MPy\!!stringa,%
+ \MPw\!!stringa,\MPh\!!stringa,\MPd\!!stringa);}%
+ \@EA \doglobal \@EA \appendtoks \!!stringa \to \MPtextareadata
+ \egroup
+ \else
+ \hbox{#1}%
+ \fi}
+
+\def\registerMPlocaltextarea#1%
+ {\ifpositioning
+ \bgroup
+ \global\advance\currentMPtextareadata\plusone
+ %\hpos{gbd:\the\currentMPtextareadata}{#1}%
+ \hpos{gbd:\the\currentMPtextareadata}%
+ {\iftracetextareas\boxrulewidth3pt\ruledhbox\fi{#1}}%
+ \edef\!!stringa{gbd:\the\currentMPtextareadata}%
+ \edef\!!stringa{RegisterLocalTextArea(%
+ \MPx\!!stringa,\MPy\!!stringa,%
+ \MPw\!!stringa,\MPh\!!stringa,\MPd\!!stringa);}%
+ \global\MPlocaltextareadata\@EA{\!!stringa}%
+ \egroup
+ \else
+ \hbox{#1}%
+ \fi}
+
+% better, so that we can force a key and share with e.g. renumbering
+%
+% \let\namedtextarea\empty
+%
+% \def\registerMPlocaltextarea#1%
+% {\ifpositioning
+% \bgroup
+% \ifx\namedtextarea\empty
+% \global\advance\currentMPtextareadata\plusone
+% \edef\namedtextarea{gbd:\the\currentMPtextareadata}%
+% \fi
+% \hpos\namedtextarea{\iftracetextareas\boxrulewidth3pt\ruledhbox\fi{#1}}%
+% \edef\ascii{RegisterLocalTextArea(%
+% \MPx\namedtextarea,\MPy\namedtextarea,%
+% \MPw\namedtextarea,\MPh\namedtextarea,\MPd\namedtextarea);}%
+% \global\MPlocaltextareadata\@EA{\ascii}%
+% \egroup
+% \else
+% \hbox{#1}%
+% \fi}
+
+\def\resetMPlocaltextarea
+ {\global\MPlocaltextareadata\emptytoks}
+
+\startMPextensions
+ path PlainTextArea;
+\stopMPextensions
+
+\startMPinitializations
+ ResetTextAreas;
+ \the\MPsavedtextareadata;
+ SaveTextAreas;
+ ResetTextAreas;
+ \the\MPtextareadata;
+ \the\MPlocaltextareadata;
+ PlainTextArea:=boundingbox(\MPxy{text:\realfolio}--\MPxy{text:\realfolio}
+ shifted (\MPw{text:\realfolio},\MPh{text:\realfolio}));
+\stopMPinitializations
+
+\appendtoks
+ \global\MPsavedtextareadata\MPtextareadata
+ \global\MPtextareadata \emptytoks
+ \global\MPlocaltextareadata\emptytoks
+\to \everyshipout
+
+\protect \endinput
diff --git a/tex/context/base/meta-pag.mkiv b/tex/context/base/meta-pag.mkiv
new file mode 100644
index 000000000..ef3817721
--- /dev/null
+++ b/tex/context/base/meta-pag.mkiv
@@ -0,0 +1,223 @@
+%D \module
+%D [ file=meta-pag,
+%D version=1999.07.10,
+%D title=\METAPOST\ Graphics,
+%D subtitle=Initialization,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D These definitions used to be part of the old \type
+%D {core-mps} file, later changed into \type {meta-ini}, but
+%D keeping them separate is cleaner.
+
+\writestatus{loading}{MetaPost Graphics / Page Data Management}
+
+\unprotect
+
+\startMPextensions
+ if unknown context_page: input mp-page; fi;
+\stopMPextensions
+
+%D The next few macros tell \METAPOST\ how the \CONTEXT\
+%D pagebody looks.
+
+\startMPextensions
+ boolean PageStateAvailable,OnRightPage,InPageBody;
+ PageStateAvailable:=true;
+\stopMPextensions
+
+\startMPinitializations
+ OnRightPage:=true;
+ InPageBody:=\ifinpagebody true \else false \fi;
+\stopMPinitializations
+
+\startMPinitializations
+ def LoadPageState =
+ OnRightPage:=\MPonrightpage;
+ OnOddPage:=\MPonoddpage;
+ RealPageNumber:=\the\realpageno;
+ PageNumber:=\the\pageno;
+ NOfPages:=\lastpage;
+ PaperHeight:=\the\paperheight;
+ PaperWidth:=\the\paperwidth;
+ PrintPaperHeight:=\the\printpaperheight;
+ PrintPaperWidth:=\the\printpaperwidth;
+ TopSpace:=\the\topspace;
+ BottomSpace:=\the\bottomspace;
+ BackSpace:=\the\backspace;
+ CutSpace:=\the\cutspace;
+ MakeupHeight:=\the\makeupheight;
+ MakeupWidth:=\the\makeupwidth;
+ TopHeight:=\the\topheight;
+ TopDistance:=\the\topdistance;
+ HeaderHeight:=\the\headerheight;
+ HeaderDistance:=\the\headerdistance;
+ TextHeight:=\the\textheight;
+ FooterDistance:=\the\footerdistance;
+ FooterHeight:=\the\footerheight;
+ BottomDistance:=\the\bottomdistance;
+ BottomHeight:=\the\bottomheight;
+ LeftEdgeWidth:=\the\leftedgewidth;
+ LeftEdgeDistance:=\the\leftedgedistance;
+ LeftMarginWidth:=\the\leftmarginwidth;
+ LeftMarginDistance:=\the\leftmargindistance;
+ TextWidth:=\the\textwidth ;
+ RightMarginDistance:=\the\rightmargindistance;
+ RightMarginWidth:=\the\rightmarginwidth;
+ RightEdgeDistance:=\the\rightedgedistance;
+ RightEdgeWidth:=\the\rightedgewidth;
+ InnerMarginDistance:=\the\innermargindistance;
+ InnerMarginWidth:=\the\innermarginwidth;
+ OuterMarginDistance:=\the\outermargindistance;
+ OuterMarginWidth:=\the\outermarginwidth;
+ InnerEdgeDistance:=\the\inneredgedistance;
+ InnerEdgeWidth:=\the\inneredgewidth;
+ OuterEdgeDistance:=\the\outeredgedistance;
+ OuterEdgeWidth:=\the\outeredgewidth;
+ PageOffset:=\the\pageoffset;
+ PageDepth:=\the\pagedepth;
+ LayoutColumns:=\the\layoutcolumns;
+ LayoutColumnDistance:=\the\layoutcolumndistance;
+ LayoutColumnWidth:=\the\layoutcolumnwidth;
+ enddef;
+\stopMPinitializations
+
+\def\MPonrightpage{true}
+\def\MPonoddpage {true}
+
+\def\freezeMPpagelayout
+ {\edef\MPonrightpage{\doifbothsides {tru}{tru}{fals}e}%
+ \edef\MPonoddpage {\doifoddpageelse {tru}{fals}e}}
+
+\let\freezeMPlayout\relax % obsolete
+
+%D We need to freeze the pagelayout before the backgrounds
+%D are build, because the overlay will temporarily become
+%D zero (overlay).
+
+\appendtoks
+ \freezeMPpagelayout
+\to \everybeforepagebody
+
+%D By freezing these value every graphic, we can use layout
+%D variables that change halfways a page, whatever use that
+%D has.
+
+\prependtoks
+ \calculatereducedvsizes % this is really needed
+ \freezeMPpagelayout
+ \freezeMPlayout % to be used grouped
+\to \everyMPgraphic
+
+%D The next feature provides information about for instance
+%D column positions. This is an experimental feature,
+%D introduced when we needed backgrounds in columns (fill||in
+%D questions as implemented in a private module).
+%D
+%D See \type {mp-page.mp} for the definition of the macros:
+%D
+%D \starttabulate[|tl|l|p|]
+%D \NC ResetTextAreas \NC no arguments \NC
+%D reset areas on page \NC \NR
+%D \NC RegisterTextArea \NC x, y, w, h \NC
+%D adds area to the list \NC \NR
+%D \NC TextAreaX,Y,W,H,XY,WH \NC x and/or y \NC
+%D reports offsets and dimensions \NC \NR
+%D \stoptabulate
+%D
+%D The \type {TextArea*} macros can be used to determine
+%D overlap.
+
+\newcount\currentMPtextareadata
+
+\newtoks\MPsavedtextareadata
+\newtoks\MPtextareadata
+\newtoks\MPlocaltextareadata
+
+% optimaliseren voor herhaling
+
+\def\registerMPtextarea#1%
+ {\ifpositioning
+ \bgroup
+ \global\advance\currentMPtextareadata\plusone
+ %\hpos{gbd:\the\currentMPtextareadata}{#1}%
+ \hpos{gbd:\the\currentMPtextareadata}%
+ {\iftracetextareas\boxrulewidth1.5pt\ruledhbox\fi{#1}}%
+ \edef\!!stringa{gbd:\the\currentMPtextareadata}%
+ \edef\!!stringa{RegisterTextArea(%
+ \MPx\!!stringa,\MPy\!!stringa,%
+ \MPw\!!stringa,\MPh\!!stringa,\MPd\!!stringa);}%
+ \@EA \doglobal \@EA \appendtoks \!!stringa \to \MPtextareadata
+ \egroup
+ \else
+ \hbox{#1}%
+ \fi}
+
+\def\registerMPlocaltextarea#1%
+ {\ifpositioning
+ \bgroup
+ \global\advance\currentMPtextareadata\plusone
+ %\hpos{gbd:\the\currentMPtextareadata}{#1}%
+ \hpos{gbd:\the\currentMPtextareadata}%
+ {\iftracetextareas\boxrulewidth3pt\ruledhbox\fi{#1}}%
+ \edef\!!stringa{gbd:\the\currentMPtextareadata}%
+ \edef\!!stringa{RegisterLocalTextArea(%
+ \MPx\!!stringa,\MPy\!!stringa,%
+ \MPw\!!stringa,\MPh\!!stringa,\MPd\!!stringa);}%
+ \global\MPlocaltextareadata\@EA{\!!stringa}%
+ \egroup
+ \else
+ \hbox{#1}%
+ \fi}
+
+% better, so that we can force a key and share with e.g. renumbering
+%
+% \let\namedtextarea\empty
+%
+% \def\registerMPlocaltextarea#1%
+% {\ifpositioning
+% \bgroup
+% \ifx\namedtextarea\empty
+% \global\advance\currentMPtextareadata\plusone
+% \edef\namedtextarea{gbd:\the\currentMPtextareadata}%
+% \fi
+% \hpos\namedtextarea{\iftracetextareas\boxrulewidth3pt\ruledhbox\fi{#1}}%
+% \edef\ascii{RegisterLocalTextArea(%
+% \MPx\namedtextarea,\MPy\namedtextarea,%
+% \MPw\namedtextarea,\MPh\namedtextarea,\MPd\namedtextarea);}%
+% \global\MPlocaltextareadata\@EA{\ascii}%
+% \egroup
+% \else
+% \hbox{#1}%
+% \fi}
+
+\def\resetMPlocaltextarea
+ {\global\MPlocaltextareadata\emptytoks}
+
+\startMPextensions
+ path PlainTextArea;
+\stopMPextensions
+
+\startMPinitializations
+ ResetTextAreas;
+ \the\MPsavedtextareadata;
+ SaveTextAreas;
+ ResetTextAreas;
+ \the\MPtextareadata;
+ \the\MPlocaltextareadata;
+ PlainTextArea:=boundingbox(\MPxy{text:\realfolio}--\MPxy{text:\realfolio}
+ shifted (\MPw{text:\realfolio},\MPh{text:\realfolio}));
+\stopMPinitializations
+
+\appendtoks
+ \global\MPsavedtextareadata\MPtextareadata
+ \global\MPtextareadata \emptytoks
+ \global\MPlocaltextareadata\emptytoks
+\to \everyshipout
+
+\protect \endinput
diff --git a/tex/context/base/meta-pag.tex b/tex/context/base/meta-pag.tex
deleted file mode 100644
index 000e56a2e..000000000
--- a/tex/context/base/meta-pag.tex
+++ /dev/null
@@ -1,226 +0,0 @@
-%D \module
-%D [ file=meta-pag,
-%D version=1999.07.10,
-%D title=\METAPOST\ Graphics,
-%D subtitle=Initialization,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D These definitions used to be part of the old \type
-%D {core-mps} file, later changed into \type {meta-ini}, but
-%D keeping them separate is cleaner.
-
-\writestatus{loading}{MetaPost Graphics / Page Data Management}
-
-\unprotect
-
-\startMPextensions
- if unknown context_page: input mp-page; fi;
-\stopMPextensions
-
-%D The next few macros tell \METAPOST\ how the \CONTEXT\
-%D pagebody looks.
-
-\startMPextensions
- boolean PageStateAvailable,OnRightPage,InPageBody;
- PageStateAvailable:=true;
-\stopMPextensions
-
-\startMPinitializations
- OnRightPage:=true;
- InPageBody:=\ifinpagebody true \else false \fi;
-\stopMPinitializations
-
-\startMPinitializations
- def LoadPageState =
- OnRightPage:=\MPonrightpage;
- OnOddPage:=\MPonoddpage;
- RealPageNumber:=\the\realpageno;
- PageNumber:=\the\pageno;
- NOfPages:=\lastpage;
- PaperHeight:=\the\paperheight;
- PaperWidth:=\the\paperwidth;
- PrintPaperHeight:=\the\printpaperheight;
- PrintPaperWidth:=\the\printpaperwidth;
- TopSpace:=\the\topspace;
- BottomSpace:=\the\bottomspace;
- BackSpace:=\the\backspace;
- CutSpace:=\the\cutspace;
- MakeupHeight:=\the\makeupheight;
- MakeupWidth:=\the\makeupwidth;
- TopHeight:=\the\topheight;
- TopDistance:=\the\topdistance;
- HeaderHeight:=\the\headerheight;
- HeaderDistance:=\the\headerdistance;
- TextHeight:=\the\textheight;
- FooterDistance:=\the\footerdistance;
- FooterHeight:=\the\footerheight;
- BottomDistance:=\the\bottomdistance;
- BottomHeight:=\the\bottomheight;
- LeftEdgeWidth:=\the\leftedgewidth;
- LeftEdgeDistance:=\the\leftedgedistance;
- LeftMarginWidth:=\the\leftmarginwidth;
- LeftMarginDistance:=\the\leftmargindistance;
- TextWidth:=\the\textwidth ;
- RightMarginDistance:=\the\rightmargindistance;
- RightMarginWidth:=\the\rightmarginwidth;
- RightEdgeDistance:=\the\rightedgedistance;
- RightEdgeWidth:=\the\rightedgewidth;
- InnerMarginDistance:=\the\innermargindistance;
- InnerMarginWidth:=\the\innermarginwidth;
- OuterMarginDistance:=\the\outermargindistance;
- OuterMarginWidth:=\the\outermarginwidth;
- InnerEdgeDistance:=\the\inneredgedistance;
- InnerEdgeWidth:=\the\inneredgewidth;
- OuterEdgeDistance:=\the\outeredgedistance;
- OuterEdgeWidth:=\the\outeredgewidth;
- PageOffset:=\the\pageoffset;
- PageDepth:=\the\pagedepth;
- LayoutColumns:=\the\layoutcolumns;
- LayoutColumnDistance:=\the\layoutcolumndistance;
- LayoutColumnWidth:=\the\layoutcolumnwidth;
- enddef;
-\stopMPinitializations
-
-\def\MPonrightpage{true}
-\def\MPonoddpage {true}
-
-\def\freezeMPpagelayout
- {\doifbothsides
- {\def\MPonrightpage{true}}
- {\def\MPonrightpage{true}}
- {\def\MPonrightpage{false}}%
- \edef\MPonoddpage{\doifoddpageelse{true}{false}}}
-
-\let\freezeMPlayout\relax % obsolete
-
-%D We need to freeze the pagelayout before the backgrounds
-%D are build, because the overlay will temporarily become
-%D zero (overlay).
-
-\appendtoks
- \freezeMPpagelayout
-\to \everybeforepagebody
-
-%D By freezing these value every graphic, we can use layout
-%D variables that change halfways a page, whatever use that
-%D has.
-
-\prependtoks
- \calculatereducedvsizes % this is really needed
- \freezeMPpagelayout
- \freezeMPlayout % to be used grouped
-\to \everyMPgraphic
-
-%D The next feature provides information about for instance
-%D column positions. This is an experimental feature,
-%D introduced when we needed backgrounds in columns (fill||in
-%D questions as implemented in a private module).
-%D
-%D See \type {mp-page.mp} for the definition of the macros:
-%D
-%D \starttabulate[|tl|l|p|]
-%D \NC ResetTextAreas \NC no arguments \NC
-%D reset areas on page \NC \NR
-%D \NC RegisterTextArea \NC x, y, w, h \NC
-%D adds area to the list \NC \NR
-%D \NC TextAreaX,Y,W,H,XY,WH \NC x and/or y \NC
-%D reports offsets and dimensions \NC \NR
-%D \stoptabulate
-%D
-%D The \type {TextArea*} macros can be used to determine
-%D overlap.
-
-\newcount\currentMPtextareadata
-
-\newtoks\MPsavedtextareadata
-\newtoks\MPtextareadata
-\newtoks\MPlocaltextareadata
-
-% optimaliseren voor herhaling
-
-\def\registerMPtextarea#1%
- {\ifpositioning
- \bgroup
- \global\advance\currentMPtextareadata\plusone
- %\hpos{gbd:\the\currentMPtextareadata}{#1}%
- \hpos{gbd:\the\currentMPtextareadata}%
- {\iftracetextareas\boxrulewidth1.5pt\ruledhbox\fi{#1}}%
- \edef\!!stringa{gbd:\the\currentMPtextareadata}%
- \edef\!!stringa{RegisterTextArea(%
- \MPx\!!stringa,\MPy\!!stringa,%
- \MPw\!!stringa,\MPh\!!stringa,\MPd\!!stringa);}%
- \@EA \doglobal \@EA \appendtoks \!!stringa \to \MPtextareadata
- \egroup
- \else
- \hbox{#1}%
- \fi}
-
-\def\registerMPlocaltextarea#1%
- {\ifpositioning
- \bgroup
- \global\advance\currentMPtextareadata\plusone
- %\hpos{gbd:\the\currentMPtextareadata}{#1}%
- \hpos{gbd:\the\currentMPtextareadata}%
- {\iftracetextareas\boxrulewidth3pt\ruledhbox\fi{#1}}%
- \edef\!!stringa{gbd:\the\currentMPtextareadata}%
- \edef\!!stringa{RegisterLocalTextArea(%
- \MPx\!!stringa,\MPy\!!stringa,%
- \MPw\!!stringa,\MPh\!!stringa,\MPd\!!stringa);}%
- \global\MPlocaltextareadata\@EA{\!!stringa}%
- \egroup
- \else
- \hbox{#1}%
- \fi}
-
-% better, so that we can force a key and share with e.g. renumbering
-%
-% \let\namedtextarea\empty
-%
-% \def\registerMPlocaltextarea#1%
-% {\ifpositioning
-% \bgroup
-% \ifx\namedtextarea\empty
-% \global\advance\currentMPtextareadata\plusone
-% \edef\namedtextarea{gbd:\the\currentMPtextareadata}%
-% \fi
-% \hpos\namedtextarea{\iftracetextareas\boxrulewidth3pt\ruledhbox\fi{#1}}%
-% \edef\ascii{RegisterLocalTextArea(%
-% \MPx\namedtextarea,\MPy\namedtextarea,%
-% \MPw\namedtextarea,\MPh\namedtextarea,\MPd\namedtextarea);}%
-% \global\MPlocaltextareadata\@EA{\ascii}%
-% \egroup
-% \else
-% \hbox{#1}%
-% \fi}
-
-\def\resetMPlocaltextarea
- {\global\MPlocaltextareadata\emptytoks}
-
-\startMPextensions
- path PlainTextArea;
-\stopMPextensions
-
-\startMPinitializations
- ResetTextAreas;
- \the\MPsavedtextareadata;
- SaveTextAreas;
- ResetTextAreas;
- \the\MPtextareadata;
- \the\MPlocaltextareadata;
- PlainTextArea:=boundingbox(\MPxy{text:\realfolio}--\MPxy{text:\realfolio}
- shifted (\MPw{text:\realfolio},\MPh{text:\realfolio}));
-\stopMPinitializations
-
-\appendtoks
- \global\MPsavedtextareadata\MPtextareadata
- \global\MPtextareadata \emptytoks
- \global\MPlocaltextareadata\emptytoks
-\to \everyshipout
-
-\protect \endinput
diff --git a/tex/context/base/meta-pdf.lua b/tex/context/base/meta-pdf.lua
index 240778bfa..056d1052f 100644
--- a/tex/context/base/meta-pdf.lua
+++ b/tex/context/base/meta-pdf.lua
@@ -7,55 +7,77 @@ if not modules then modules = { } end modules ['meta-pdf'] = {
}
-- Finally we used an optimized version. The test code can be found in
--- meta-pdh.lua but since we no longer want to overload functione we
--- use more locals now.
+-- meta-pdh.lua but since we no longer want to overload functione we use
+-- more locals now. This module keeps changing as it is also a testbed.
local concat, format, gsub, find = table.concat, string.format, string.gsub, string.find
-local byte = string.byte
+local byte, round = string.byte, math.round
local texsprint = tex.sprint
-
local ctxcatcodes = tex.ctxcatcodes
+local pdfrgbcode = lpdf.rgbcode
+local pdfcmykcode = lpdf.cmykcode
+local pdfgraycode = lpdf.graycode
+local pdfspotcode = lpdf.spotcode
+local pdftransparencycode = lpdf.transparencycode
+local pdffinishtransparencycode = lpdf.finishtransparencycode
+
mptopdf = { }
mptopdf.n = 0
local m_path, m_stack, m_texts, m_version, m_date, m_shortcuts = { }, { }, { }, 0, 0, false
local m_stack_close, m_stack_path, m_stack_concat = false, { }, nil
+local extra_path_code, ignore_path = nil, false
+local specials = { }
local function resetpath()
- m_stack_close = false
- m_stack_path = { }
- m_stack_concat = nil
+ m_stack_close, m_stack_path, m_stack_concat = false, { }, nil
end
local function resetall()
m_path, m_stack, m_texts, m_version, m_shortcuts = { }, { }, { }, 0, false
+ extra_path_code, ignore_path = nil, false
+ specials = { }
resetpath()
end
resetall()
--- code injection, todo: collect and flush packed using node injection
+-- todo: collect and flush packed using pdfliteral node injection but we're
+-- in no hurry as this kind of conversion does not happen that often in mkiv
-local function pdfcode(str) -- not used
- texsprint(ctxcatcodes,"\\MPScode{",str,"}")
+local function pdfcode(str)
+ texsprint(ctxcatcodes,"\\pdfliteral{" .. str .. "}")
end
+
local function texcode(str)
texsprint(ctxcatcodes,str)
end
+function mpscode(str)
+ if ignore_path then
+ pdfcode("h W n")
+ if extra_path_code then
+ pdfcode(extra_path_code)
+ extra_path_code = nil
+ end
+ ignore_path = false
+ else
+ pdfcode(str)
+ end
+end
+
-- auxiliary functions
local function flushconcat()
if m_stack_concat then
- texsprint(ctxcatcodes,"\\MPScode{",concat(m_stack_concat," ")," cm}")
+ mpscode(concat(m_stack_concat," ") .. " cm")
m_stack_concat = nil
end
end
local function flushpath(cmd)
- -- faster: no local function
if #m_stack_path > 0 then
local path = { }
if m_stack_concat then
@@ -63,9 +85,6 @@ local function flushpath(cmd)
local rx, ry = m_stack_concat[2], m_stack_concat[3]
local tx, ty = m_stack_concat[5], m_stack_concat[6]
local d = (sx*sy) - (rx*ry)
- -- local function mpconcat(px, py) -- move this inline
- -- return (sy*(px-tx)-ry*(py-ty))/d, (sx*(py-ty)-rx*(px-tx))/d
- -- end
for k=1,#m_stack_path do
local v = m_stack_path[k]
local px, py = v[1], v[2] ; v[1], v[2] = (sy*(px-tx)-ry*(py-ty))/d, (sx*(py-ty)-rx*(px-tx))/d -- mpconcat(v[1],v[2])
@@ -81,11 +100,11 @@ local function flushpath(cmd)
end
end
flushconcat()
- texcode("\\MPSpath{" .. concat(path," ") .. "}")
+ pdfcode(concat(path," "))
if m_stack_close then
- texcode("\\MPScode{h " .. cmd .. "}")
+ mpscode("h " .. cmd)
else
- texcode("\\MPScode{" .. cmd .."}")
+ mpscode(cmd)
end
end
resetpath()
@@ -132,7 +151,7 @@ function mps.rlineto(x,y)
end
function mps.translate(tx,ty)
- texsprint(ctxcatcodes,"\\MPScode{1 0 0 0 1 ",tx," ",ty," cm}")
+ mpscode("1 0 0 0 1 " .. tx .. " " .. ty .. " cm")
end
function mps.scale(sx,sy)
@@ -144,36 +163,36 @@ function mps.concat(sx, rx, ry, sy, tx, ty)
end
function mps.setlinejoin(d)
- texsprint(ctxcatcodes,"\\MPScode{",d," j}")
+ mpscode(d .. " j")
end
function mps.setlinecap(d)
- texsprint(ctxcatcodes,"\\MPScode{",d," J}")
+ mpscode(d .. " J")
end
function mps.setmiterlimit(d)
- texsprint(ctxcatcodes,"\\MPScode{",d," M}")
+ mpscode(d .. " M")
end
function mps.gsave()
- texsprint(ctxcatcodes,"\\MPScode{q}")
+ mpscode("q")
end
function mps.grestore()
- texsprint(ctxcatcodes,"\\MPScode{Q}")
+ mpscode("Q")
end
function mps.setdash(...) -- can be made faster, operate on t = { ... }
local n = select("#",...)
- texsprint(ctxcatcodes,"\\MPScode{","[",concat({...}," ",1,n-1),"] ",select(n,...)," d}")
+ mpscode("[" .. concat({...}," ",1,n-1) .. "] " .. select(n,...) .. " d")
end
function mps.resetdash()
- texsprint(ctxcatcodes,"\\MPScode{[ ] 0 d}")
+ mpscode("[ ] 0 d")
end
function mps.setlinewidth(d)
- texsprint(ctxcatcodes,"\\MPScode{",d," w}")
+ mpscode(d .. " w")
end
function mps.closepath()
@@ -206,31 +225,136 @@ function mps.textext(font, scale, str) -- old parser
resetpath()
end
+local handlers = { }
+
+handlers[1] = function(s)
+ pdfcode(pdffinishtransparencycode())
+ pdfcode(pdfcmykcode(mps.colormodel,s[3],s[4],s[5],s[6]))
+end
+handlers[2] = function(s)
+ pdfcode(pdffinishtransparencycode())
+ pdfcode(pdfspotcode(mps.colormodel,s[3],s[4],s[5],s[6]))
+end
+handlers[3] = function(s)
+ pdfcode(pdfrgbcode(mps.colormodel,s[4],s[5],s[6]))
+ pdfcode(pdftransparencycode(s[2],s[3]))
+end
+handlers[4] = function(s)
+ pdfcode(pdfcmykcode(mps.colormodel,s[4],s[5],s[6],s[7]))
+ pdfcode(pdftransparencycode(s[2],s[3]))
+end
+handlers[5] = function(s)
+ pdfcode(pdfspotcode(mps.colormodel,s[4],s[5],s[6],s[7]))
+ pdfcode(pdftransparencycode(s[2],s[3]))
+end
+
+-- todo: color conversion
+
+local nofshades, tn = 0, tonumber
+
+local function linearshade(colorspace,domain,ca,cb,coordinates)
+ pdfcode(pdffinishtransparencycode())
+ nofshades = nofshades + 1
+ local name = format("MpsSh%s",nofshades)
+ lpdf.linearshade(name,domain,ca,cb,1,colorspace,coordinates)
+ extra_path_code, ignore_path = format("/%s sh Q",name), true
+ pdfcode("q /Pattern cs")
+end
+
+local function circularshade(colorspace,domain,ca,cb,coordinates)
+ pdfcode(pdffinishtransparencycode())
+ nofshades = nofshades + 1
+ local name = format("MpsSh%s",nofshades)
+ lpdf.circularshade(name,domain,ca,cb,1,colorspace,coordinates)
+ extra_path_code, ignore_path = format("/%s sh Q",name), true
+ pdfcode("q /Pattern cs")
+end
+
+handlers[30] = function(s)
+ linearshade("DeviceRGB", { tn(s[ 2]), tn(s[ 3]) },
+ { tn(s[ 5]), tn(s[ 6]), tn(s[ 7]) }, { tn(s[10]), tn(s[11]), tn(s[12]) },
+ { tn(s[ 8]), tn(s[ 9]), tn(s[13]), tn(s[14]) } )
+end
+
+handlers[31] = function(s)
+ circularshade("DeviceRGB", { tn(s[ 2]), tn(s[ 3]) },
+ { tn(s[ 5]), tn(s[ 6]), tn(s[ 7]) }, { tn(s[11]), tn(s[12]), tn(s[13]) },
+ { tn(s[ 8]), tn(s[ 9]), tn(s[10]), tn(s[14]), tn(s[15]), tn(s[16]) } )
+end
+
+handlers[32] = function(s)
+ linearshade("DeviceCMYK", { tn(s[ 2]), tn(s[ 3]) },
+ { tn(s[ 5]), tn(s[ 6]), tn(s[ 7]), tn(s[ 8]) }, { tn(s[11]), tn(s[12]), tn(s[13]), tn(s[14]) },
+ { tn(s[ 9]), tn(s[10]), tn(s[15]), tn(s[16]) } )
+end
+
+handlers[33] = function(s)
+ circularshade("DeviceCMYK", { tn(s[ 2]), tn(s[ 3]) },
+ { tn(s[ 5]), tn(s[ 6]), tn(s[ 7]), tn(s[ 8]) }, { tn(s[12]), tn(s[13]), tn(s[14]), tn(s[15]) },
+ { tn(s[ 9]), tn(s[10]), tn(s[11]), tn(s[16]), tn(s[17]), tn(s[18]) } )
+end
+
+handlers[34] = function(s) -- todo (after further cleanup)
+ linearshade("DeviceGray", { tn(s[ 2]), tn(s[ 3]) }, { 0 }, { 1 }, { tn(s[9]), tn(s[10]), tn(s[15]), tn(s[16]) } )
+end
+
+handlers[35] = function(s) -- todo (after further cleanup)
+ circularshade("DeviceGray", { tn(s[ 2]), tn(s[ 3]) }, { 0 }, { 1 }, { tn(s[9]), tn(s[10]), tn(s[15]), tn(s[16]) } )
+end
+
+-- not supported in mkiv , use mplib instead
+
+handlers[10] = function() logs.report("mptopdf","skipping special %s",10) end
+handlers[20] = function() logs.report("mptopdf","skipping special %s",20) end
+handlers[50] = function() logs.report("mptopdf","skipping special %s",50) end
+
+--end of not supported
+
function mps.setrgbcolor(r,g,b) -- extra check
r, g = tonumber(r), tonumber(g) -- needed when we use lpeg
if r == 0.0123 and g < 0.1 then
- texcode("\\MPSspecial{" .. g*10000 .. "}{" .. b*10000 .. "}")
+ g, b = round(g*10000), round(b*10000)
+ local s = specials[b]
+ local h = round(s[#s])
+ local handler = handlers[h]
+ if handler then
+ handler(s)
+ else
+ logs.report("mptopdf","unknown special handler %s (1)",h)
+ end
elseif r == 0.123 and g < 0.1 then
- texcode("\\MPSspecial{" .. g* 1000 .. "}{" .. b* 1000 .. "}")
+ g, b = round(g*1000), round(b*1000)
+ local s = specials[b]
+ local h = round(s[#s])
+ local handler = handlers[h]
+ if handler then
+ handler(s)
+ else
+ logs.report("mptopdf","unknown special handler %s (2)",h)
+ end
else
- texcode("\\MPSrgb{" .. r .. "}{" .. g .. "}{" .. b .. "}")
+ pdfcode(pdffinishtransparencycode())
+ pdfcode(pdfrgbcode(mps.colormodel,r,g,b))
end
end
function mps.setcmykcolor(c,m,y,k)
- texcode("\\MPScmyk{" .. c .. "}{" .. m .. "}{" .. y .. "}{" .. k .. "}")
+ pdfcode(pdffinishtransparencycode())
+ pdfcode(pdfcmykcode(mps.colormodel,c,m,y,k))
end
function mps.setgray(s)
- texcode("\\MPSgray{" .. s .. "}")
+ pdfcode(pdffinishtransparencycode())
+ pdfcode(pdfgrayliteral(mps.colormodel,s))
end
function mps.specials(version,signal,factor) -- 2.0 123 1000
end
function mps.special(...) -- 7 1 0.5 1 0 0 1 3
- local n = select("#",...)
- texcode("\\MPSbegin\\MPSset{" .. concat({...},"}\\MPSset{",2,n) .. "}\\MPSend")
+ local t = { ... }
+ local n = tonumber(t[#t-1])
+ specials[n] = t
end
function mps.begindata()
@@ -242,10 +366,6 @@ end
function mps.showpage()
end
-function mps.attribute(id,value)
- texcode("\\attribute " .. id .. "=" .. value .. " ")
-end
-
-- lpeg parser
-- The lpeg based parser is rather optimized for the kind of output
@@ -350,9 +470,6 @@ local t = (lpegP("[") * (cnumber * sp^0)^6 * lpegP("]") * sp * lpegP("t") ) /
-- experimental
-local attribute = ((cnumber * sp)^2 * lpegP("attribute")) / mps.attribute
-local A = ((cnumber * sp)^2 * lpegP("A")) / mps.attribute
-
local preamble = (
prolog + setup +
boundingbox + highresboundingbox + specials + special +
@@ -362,7 +479,6 @@ local preamble = (
local procset = (
lj + ml + lc +
c + l + m + n + p + r +
- A +
R + C + G +
S + F + B + W +
vlw + hlw +
@@ -376,7 +492,6 @@ local procset = (
local verbose = (
curveto + lineto + moveto + newpath + closepath + rlineto +
setrgbcolor + setcmykcolor + setgray +
- attribute +
setlinejoin + setmiterlimit + setlinecap +
stroke + fill + clip + both +
setlinewidth_x + setlinewidth_y +
@@ -390,7 +505,8 @@ local verbose = (
-- order matters in terms of speed / we could check for procset first
local captures_old = ( space + verbose + preamble )^0
-local captures_new = ( space + procset + preamble + verbose )^0
+--~ local captures_new = ( space + procset + preamble + verbose )^0
+local captures_new = ( space + verbose + procset + preamble )^0
local function parse(m_data)
if find(m_data,"%%%%BeginResource: procset mpost") then
@@ -402,17 +518,25 @@ end
-- main converter
+local a_colorspace = attributes.private('colormodel')
+
function mptopdf.convertmpstopdf(name)
resetall()
local ok, m_data, n = resolvers.loadbinfile(name, 'tex') -- we need a binary load !
if ok then
+ mps.colormodel = tex.attribute[a_colorspace]
statistics.starttiming(mptopdf)
mptopdf.n = mptopdf.n + 1
+ pdfcode(format("\\letterpercent\\space mptopdf begin: n=%s, file=%s",mptopdf.n,file.basename(name)))
+ pdfcode("q 1 0 0 1 0 0 cm")
parse(m_data)
+ pdfcode(pdffinishtransparencycode())
+ pdfcode("Q")
+ pdfcode("\\letterpercent\\space mptopdf end")
resetall()
statistics.stoptiming(mptopdf)
else
- tex.print("file " .. name .. " not found")
+ commands.writestatus("mptopdf","file '%s' not found",name)
end
end
diff --git a/tex/context/base/meta-pdf.mkiv b/tex/context/base/meta-pdf.mkiv
index 906633802..fa9627fbe 100644
--- a/tex/context/base/meta-pdf.mkiv
+++ b/tex/context/base/meta-pdf.mkiv
@@ -11,17 +11,6 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-%D Formerly known as supp-pdf.tex and supp-mpe.tex.
-
-% \useMPgraphic{1}
-% \testfeatureonce{250}{\setbox0\hbox{\convertMPtoPDF{test-mps-mpgraph.1}{1}{1}}}
-%
-% 8.4 : mkii, direct parsing by tex
-% 11.8 : mkiv, dirty conversion (10.8 with dirty tricks)
-% 14.5 : mkiv, clean conversion
-% 7.4 : mkiv, simulated clean direct lua from mp
-% 0.3 : time taken by tex to handle converted code
-
\registerctxluafile{meta-pdf}{1.003}
%D We will clean up the color mess later.
@@ -30,13 +19,6 @@
\unprotect
-\ifx\PDFcode \undefined \let\PDFcode \gobbleoneargument \fi
-\ifx\PDFcomment\undefined \def\PDFcomment#1{\PDFcode{\letterpercent\space#1}} \fi
-
-%D First we define a handy constant:
-
-\bgroup \catcode`\%=\@@other \xdef\letterpercent{\string%} \egroup
-
%D \macros
%D {convertMPtoPDF}
%D
@@ -57,67 +39,25 @@
%D \convertMPtoPDF{mp-pra-1.eps}{.5}{.5}
%D \stoptyping
-%D \macros
-%D {makeMPintoPDFobject,lastPDFMPobject}
-%D
-%D For experts there are a few more options. When attributes
-%D are to be added, the code must be embedded in an object
-%D accompanied with the appropriate directives. One can
-%D influence this process with \type {\makeMPintoPDFobject}.
-%D
-%D This option defaults to~0, because \CONTEXT\ takes care
-%D of objects at another level, which saves some bytes.
-%D
-%D \starttabulate[|l|l|p|]
-%D \NC 0 \NC never \NC don't use an object \NC\NR
-%D \NC 1 \NC always \NC always use an object \NC\NR
-%D \NC 2 \NC optional \NC use object when needed \NC\NR
-%D \stoptabulate
-%D
-%D The last object number used is avaliable in the macro
-%D \type {\lastPDFMPobject}.
-
-\ifx\makeMPintoPDFobject \undefined \chardef\makeMPintoPDFobject \zerocount \fi
-\ifx\blackoutMPgraphic \undefined \chardef\blackoutMPgraphic \plusone \fi
-\ifx\everyMPtoPDFconversion\undefined \newtoks\everyMPtoPDFconversion \fi
-
-\let\lastPDFMPobject \!!zerocount
-\let\currentPDFresources\empty
-\let\setMPextensions \relax
-
\def\PDFMPformoffset
- {\ifx\objectoffset\undefined\zeropoint\else\objectoffset\fi}
-
-\def\resetMPvariables#1#2#3%
- {\global\let\MPwidth \!!zeropoint
- \global\let\MPheight\!!zeropoint
- \global\let\MPllx \!!zerocount
- \global\let\MPlly \!!zerocount
- \global\let\MPurx \!!zerocount
- \global\let\MPury \!!zerocount
- \xdef\MPxscale {#2}\ifx\MPxscale\empty\let\MPxscale\!!plusone\fi
- \xdef\MPyscale {#3}\ifx\MPyscale\empty\let\MPyscale\!!plusone\fi
- \xdef\MPfilename {#1}}
+ {\ifdefined\objectoffset\objectoffset\else\zeropoint\fi}
%D The main macro:
-\def\convertMPtoPDF#1#2#3% watch the transparency reset
- {\resetMPvariables{#1}{#2}{#3}%
- \vbox\bgroup
+\def\convertMPtoPDF#1#2#3% scaling no longer supported at this level (so #2 & #3 ignored)
+ {\vbox\bgroup
+ \message{[MP to PDF]}%
+ \xdef\MPfilename{#1}%
+ \glet\MPwidth \!!zeropoint
+ \glet\MPheight\!!zeropoint
+ \glet\MPllx \!!zerocount
+ \glet\MPlly \!!zerocount
+ \glet\MPurx \!!zerocount
+ \glet\MPury \!!zerocount
\forgetall
\offinterlineskip
- %\ifcase\blackoutMPgraphic\or\PDFcode{0 g 0 G}\fi % fixed in mp
\setbox\scratchbox\vbox\bgroup
- \setnormalcatcodes % we can be in verbatim or so
- \message{[MP to PDF]}%
- \startMPresources
- \PDFcomment{mps begin}%
- \PDFcode{q 1 0 0 1 0 0 cm}%
- \ctxlua{mptopdf.convertmpstopdf("\MPfilename")}\removeunwantedspaces
- \dohandleMPresettransparency % a bit messy here, should be a toks
- \PDFcode{Q}%
- \PDFcomment{mps end}%
- \stopMPresources
+ \ctxlua{mptopdf.convertmpstopdf("\MPfilename")}\removeunwantedspaces
\egroup
\setbox\scratchbox\hbox\bgroup
\hskip-\MPllx\onebasepoint
@@ -135,53 +75,33 @@
\dopackageMPgraphic\scratchbox
\egroup}
-\let\processMPtoPDFfile\convertMPtoPDF
-
-%D A common hook.
-
-\let\MPfshowcommand\empty
-
-%D Objects.
-
-\def\dopackageMPgraphic#1% #1 = boxregister
- {\ifcase\makeMPintoPDFobject\or\or\ifx\currentPDFresources\empty\else
- % an existing value of 2 signals object support (set elsewhere)
- \chardef\makeMPintoPDFobject\plusone
- \fi\fi
- \ifcase\makeMPintoPDFobject
- \box#1%
- \or
- \scratchdimen\PDFMPformoffset\relax
- \ifdim\scratchdimen>\zeropoint % compensate for error
- \setbox#1\vbox spread 2\scratchdimen
- {\forgetall\vss\hbox spread 2\scratchdimen{\hss\box#1\hss}\vss}%
- \fi
- \setMPPDFobject{\currentPDFresources}{#1}%
- \ifdim\scratchdimen>\zeropoint % compensate for error
- \vbox to \MPheight
- {\forgetall\vss\hbox to \MPwidth{\hss\getMPPDFobject\hss}\vss}%
- \else
- \getMPPDFobject
- \fi
- \global\let\currentPDFresources\empty
- \else
- \box#1%
- \fi}
+%D Objects (move all to backend)
+
+% \def\dopackageMPgraphic#1% #1 = boxregister
+% {\scratchdimen\PDFMPformoffset\relax
+% \ifdim\scratchdimen>\zeropoint % compensate for error
+% \setbox#1\vbox spread 2\scratchdimen
+% {\forgetall\vss\hbox spread 2\scratchdimen{\hss\box#1\hss}\vss}%
+% \fi
+% \setMPPDFobject{#1}%
+% \ifdim\scratchdimen>\zeropoint % compensate for error
+% \vbox to \MPheight
+% {\forgetall\vss\hbox to \MPwidth{\hss\getMPPDFobject\hss}\vss}%
+% \else
+% \getMPPDFobject
+% \fi}
+%
+% \def\setMPPDFobject#1% boxnumber
+% {\the\pdfbackendeveryxform
+% \finalizeobjectbox{#1}%
+% \immediate\pdfxform resources{\pdfcurrentresources}#1%
+% \edef\getMPPDFobject{\noexpand\pdfrefxform\the\pdflastxform}}
+%
+% \let\getMPPDFobject\relax
-\def\setMPPDFobject#1#2% resources boxnumber
- {\ifx\pdfxform\undefined
- \def\getMPPDFobject{\box#2}%
- \else\ifx\pdftexversion\undefined
- \def\getMPPDFobject{\box#2}%
- \else\ifnum\pdftexversion<14
- \def\getMPPDFobject{\box#2}%
- \else
- \ifx\everyPDFxform\undefined\else\the\everyPDFxform\fi
- \immediate\pdfxform resources{#1}#2%
- \edef\getMPPDFobject{\noexpand\pdfrefxform\the\pdflastxform}%
- \fi\fi\fi}
+% we don't need to package as each page has all resources anyway
-\let\getMPPDFobject\relax
+\let\dopackageMPgraphic\box
%D \macros
%D {deleteMPgraphic,
@@ -243,32 +163,6 @@
\newconditional\manyMPspecials \settrue\manyMPspecials
-%D In case of \PDF, we need to prepare resourcs.
-
-\newtoks\MPstartresources
-\newtoks\MPstopresources
-
-\def\startMPresources
- {\the\MPstartresources}
-
-\def\stopMPresources
- {\the\MPstopresources}
-
-%D Some day we may consider collecting local resources.
-
-\appendtoks
- \global\let\currentPDFresources\empty % kind of redundant
-\to \MPstartresources
-
-% \appendtoks
-% \collectPDFresources
-% \global\let\currentPDFresources\collectedPDFresources
-% \to \MPstopresources
-
-\appendtoksonce
- \the\everyPDFxform
-\to \MPstopresources
-
%D Since colors are not subjected to transformations, we can
%D only use colors as signal. In our case, we use a dummy colored
%D path with a red color component of \type {0.n}, so \type
@@ -278,25 +172,11 @@
\newif\ifMPcmykcolors
\newif\ifMPspotcolors
-\def\dohandleMPrgb #1#2#3{\revokeMPtransparencyspecial\execcolorR #1:#2:#3:0:0\od}
-\def\dohandleMPcmyk#1#2#3#4{\revokeMPtransparencyspecial\execcolorC#1:#2:#3:#4:0:0\od}
-\def\dohandleMPgray #1{\revokeMPtransparencyspecial\execcolorS #1:0:0\od}
-\def\dohandleMPspot#1#2#3#4{\revokeMPtransparencyspecial\execcolorP#1:#2:#3:#4:0:0\od}
-
-%D Specials:
-
-\settrue \manyMPspecials \newcount\nofMParguments \let\extraMPpathcode\empty
-
-\def\@@MP {@@MP}
-\def\@@MPSK{@MPSK@}
-
-\def\MPspecial{\@@MPSK\@@MPSK\gMPs\nofMParguments}
-
-\def\defineMPspecial#1#2%
- {\setvalue{\@@MPSK\@@MPSK#1}{#2}}
-
-%D Special number~1 is dedicated to \CMYK\ support. If you
-%D want to know why: look at this:
+%D We support specials but assume that the files are somewhat simple
+%D ones wo we have dropped a few. The reason is that runtime \METAPOST\
+%D processing now uses \MPLIB\ so we only need to deal with the
+%D conversion here. See meta-pdh.mkiv (and older files) for more
+%D details. Here we just give a few examples.
%D
%D \startbuffer[mp]
%D fill fullcircle xyscaled (3cm,1cm) withcolor \MPcolor{test} ;
@@ -326,38 +206,11 @@
%D no conversion to \RGB,
%D support in \METAPOST}
%D {\setupcolors[cmyk=ja,state=start]\getbuffer[cmyk]}
-
-\defineMPspecial{1}
- {\ifMPcmykcolors
- \setxvalue{\@@MPSK\gMPs6}{\noexpand\dohandleMPcmykcolor{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}}%
- \fi}
-
-\defineMPspecial{2}
- {\ifMPspotcolors
- \setxvalue{\@@MPSK\gMPs6}{\noexpand\dohandleMPspotcolor{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}}%
-% \checkMPspot{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}%
- \fi}
-
-% \def\checkMPspot#1#2#3#4%
-% {\normalexpanded{\noexpand\resolveMPspotcolor#1 #2 #3 #4}\end
-% \ifx\MPspotspace\MPresolvedspace
-% \edef\MPspotspacespec{/\MPspotspace\space}%
-% \doifinstringelse\MPspotspacespec\currentMPcolorspaces
-% \donothing\registerMPcolorspace
-% \fi}
-
-\let\revokeMPtransparencyspecial\relax
-
-\def\dohandleMPrgbcolor #1#2#3{\revokeMPtransparencyspecial\execcolorR #1:#2:#3:0:0\od}
-\def\dohandleMPcmykcolor#1#2#3#4{\revokeMPtransparencyspecial\execcolorC#1:#2:#3:#4:0:0\od}
-\def\dohandleMPgraycolor #1{\revokeMPtransparencyspecial\execcolorS #1:0:0\od}
-\def\dohandleMPspotcolor#1#2#3#4{\revokeMPtransparencyspecial\execcolorP#1:#2:#3:#4:0:0\od}
-
+%D
%D Transparency support used specials 60 (rgb) and 61
%D (cmyk).
%D
-%D \startbufferFshade
-
+%D \startbuffer
%D u := 2cm ; path p ; p := fullcircle scaled u shifted (u/4,0);
%D
%D fill p rotated 90 withcolor transparent(1,.5,yellow) ;
@@ -390,28 +243,6 @@
%D
%D \startlinecorrection \processMPbuffer \stoplinecorrection
%D
-%D We save all the three components needed in one macro,
-%D just to save hash space.
-
-\def\dohandleMPrgbtransparency #1#2#3#4#5{\execcolorR #1:#2:#3:#4:#5\od\let\revokeMPtransparencyspecial\dorevokeMPtransparencyspecial}
-\def\dohandleMPcmyktransparency#1#2#3#4#5#6{\execcolorC#1:#2:#3:#4:#5:#6\od\let\revokeMPtransparencyspecial\dorevokeMPtransparencyspecial}
-\def\dohandleMPgraytransparency #1#2#3{\execcolorS #1:#2:#3\od\let\revokeMPtransparencyspecial\dorevokeMPtransparencyspecial}
-\def\dohandleMPspottransparency#1#2#3#4#5#6{\execcolorP#1:#2:#3:#4:#5:#6\od\let\revokeMPtransparencyspecial\dorevokeMPtransparencyspecial}
-
-\def\dorevokeMPtransparencyspecial
- {\PDFcode{\PDFtransparencyresetidentifier\space gs}%
- \let\revokeMPtransparencyspecial\relax}
-
-\defineMPspecial{3} % rgb
- {\setxvalue{\@@MPSK\gMPs6}{\noexpand\dohandleMPrgbtransparency{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs1}{\gMPs2}}}
-
-\defineMPspecial{4} % cmyk
- {\setxvalue{\@@MPSK\gMPs7}{\noexpand\dohandleMPcmyktransparency{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs1}{\gMPs2}}}
-
-\defineMPspecial{5} % spot
- {\setxvalue{\@@MPSK\gMPs7}{\noexpand\dohandleMPspottransparency{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs1}{\gMPs2}}%
- }%\checkMPspot{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}}
-
%D Shading is an example of a more advanced graphic feature,
%D but users will seldom encounter those complications. Here
%D we only show a few simple examples, but many other
@@ -448,9 +279,7 @@
%D \stopuniqueMPgraphic
%D \stopbuffer
%D
-%D \typebuffer
-%D
-%D \getbuffer
+%D \typebuffer \getbuffer
%D
%D These graphics can be hooked into the overlay mechanism,
%D which is available in many commands.
@@ -461,9 +290,7 @@
%D \defineoverlay[demo 3][\uniqueMPgraphic {DuotoneShade}]
%D \stopbuffer
%D
-%D \typebuffer
-%D
-%D \getbuffer
+%D \typebuffer \getbuffer
%D
%D These backgrounds can for instance be applied to \type
%D {\framed}:
@@ -506,8 +333,6 @@
%D \stopcombination
%D \stoplinecorrection
%D
-%D \blank
-%D
%D \startlinecorrection
%D \startcombination[5*1]
%D {\SomeShade{20}{circular}{0}{.9green}{.3green}} {circular 0}
@@ -518,8 +343,6 @@
%D \stopcombination
%D \stoplinecorrection
%D
-%D \blank
-%D
%D \startlinecorrection
%D \startcombination[4*1]
%D {\SomeShade{30}{linear}{0}{.3red}{.9red}} {linear 0}
@@ -545,96 +368,7 @@
%D \NC /C1 \NC outer shade \NC \NR
%D \NC /N \NC smaller values, bigger inner circles \NC \NR
%D \stoptabulate
-
-\newcount\currentPDFshade % 0 % global (document wide) counter
-
-\def\dosetMPsomePDFshade#1#2%
- {\immediate\pdfobj
- {<>}%
- \immediate\pdfobj
- {<>}%
- \global\advance\currentPDFshade \plusone
- \appendtoPDFdocumentshades{/Sh\the\currentPDFshade\space\the\pdflastobj\space0 R }%
- \setxvalue{\@@MPSK#2}{\noexpand\dohandleMPshade{\the\currentPDFshade}}}
-
-\def\dosetMPlinearshade {\dosetMPsomePDFshade2}% #1
-\def\dosetMPcircularshade{\dosetMPsomePDFshade3}% #1
-
-\defineMPspecial{30}
- {\normalexpanded{\noexpand\resolveMPrgbcolor{\gMPs4}{\gMPs5}{\gMPs6}}\to\MPshadeA
- \normalexpanded{\noexpand\resolveMPrgbcolor{\gMPs{9}}{\gMPs{10}}{\gMPs{11}}}\to\MPshadeB
- \edef\MPshadeC{\gMPs7 \gMPs8 \gMPs{12} \gMPs{13}}%
- \dosetMPlinearshade{\gMPs{14}}}
-
-\defineMPspecial{31}
- {\normalexpanded{\noexpand\resolveMPrgbcolor{\gMPs4}{\gMPs5}{\gMPs6}}\to\MPshadeA
- \normalexpanded{\noexpand\resolveMPrgbcolor{\gMPs{10}}{\gMPs{11}}{\gMPs{12}}}\to\MPshadeB
- \edef\MPshadeC{\gMPs7 \gMPs8 \gMPs9 \gMPs{13} \gMPs{14} \gMPs{15}}%
- \dosetMPcircularshade{\gMPs{16}}}
-
-\defineMPspecial{32}
- {\normalexpanded{\noexpand\resolveMPcmykcolor{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}}\to\MPshadeA
- \normalexpanded{\noexpand\resolveMPcmykcolor{\gMPs{10}}{\gMPs{11}}{\gMPs{12}}{\gMPs{13}}}\to\MPshadeB
- \edef\MPshadeC{\gMPs8 \gMPs9 \gMPs{14} \gMPs{15}}%
- \dosetMPlinearshade{\gMPs{16}}}
-
-\defineMPspecial{33}
- {\normalexpanded{\noexpand\resolveMPcmykcolor{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}}\to\MPshadeA
- \normalexpanded{\noexpand\resolveMPcmykcolor{\gMPs{11}}{\gMPs{12}}{\gMPs{13}}{\gMPs{14}}}\to\MPshadeB
- \edef\MPshadeC{\gMPs8 \gMPs9 \gMPs{10} \gMPs{15} \gMPs{16} \gMPs{17}}%
- \dosetMPcircularshade{\gMPs{18}}}
-
-\defineMPspecial{34}
- {\normalexpanded{\noexpand\resolveMPspotcolor{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}}\to\MPshadeA
- \normalexpanded{\noexpand\resolveMPspotcolor{\gMPs{10}}{\gMPs{11}}{\gMPs{12}}{\gMPs{13}}}\to\MPshadeB
- \edef\MPshadeC{\gMPs8 \gMPs9 \gMPs{14} \gMPs{15}}%
- \dosetMPlinearshade{\gMPs{16}}}
-
-\defineMPspecial{35}
- {\normalexpanded{\noexpand\resolveMPcmykcolor{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}}\to\MPshadeA
- \normalexpanded{\noexpand\resolveMPcmykcolor{\gMPs{11}}{\gMPs{12}}{\gMPs{13}}{\gMPs{14}}}\to\MPshadeB
- \edef\MPshadeC{\gMPs8 \gMPs9 \gMPs{10} \gMPs{15} \gMPs{16} \gMPs{17}}%
- \dosetMPcircularshade{\gMPs{18}}}
-
-\newconditional\ignoreMPpath
-
-\def\dohandleMPshade#1%
- {\revokeMPtransparencyspecial
- \settrue\ignoreMPpath
- \def\extraMPpathcode{/Sh#1 sh Q}%
- \chardef\finiMPpath\zerocount
- \PDFcode{q /Pattern cs}}
-
-\defineMPspecial{10}
- {\setxvalue{\@@MPSK\gMPs8}%
- {\noexpand\handleMPfigurespecial{\gMPs1}{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}{\gMPs8}}}
-
-\def\handleMPfigurespecial#1#2#3#4#5#6#7#8% todo : combine with ext fig
- {\global\letvalue{\@@MPSK#8}\empty
- \vbox to \zeropoint
- {\vss
- \hbox to \zeropoint
- {\ifcase\pdfoutput\or % will be hooked into the special driver
- \doiffileelse{#7}
- {\doifundefinedelse{mps:x:#7}
- {\immediate\pdfximage\!!width\onebasepoint\!!height\onebasepoint{#7}%
- \setxvalue{mps:x:#7}{\pdfrefximage\the\pdflastximage}}%
- {\message{[reusing figure #7]}}%
- \PDFcode{q #1 #2 #3 #4 #5 #6 cm}%
- \rlap{\getvalue{mps:x:#7}}%
- \PDFcode{Q}}
- {\message{[unknown figure #7]}}%
- \fi
- \hss}}}
-
+%D
%D An example of using both special features is the
%D following.
%D
@@ -653,294 +387,88 @@
%D \stopMPpage
%D \stoptyping
-\defineMPspecial{20}
- {\setxvalue{\@@MPSK\gMPs6}%
- {\noexpand\handleMPhyperlink{\gMPs1}{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}}}
-
-\def\handleMPhyperlink#1#2#3#4#5#6%
- {\global\letvalue{\@@MPSK#6}\empty
- \setbox\scratchbox\hbox
- {\setbox\scratchbox\null
- \wd\scratchbox\dimexpr-#1\onebasepoint+#3\onebasepoint\relax
- \ht\scratchbox\dimexpr-#2\onebasepoint+#4\onebasepoint\relax
- \incolorfalse
- \gotobox{\box\scratchbox}[#5]}%
- \setbox\scratchbox\hbox
- {\hskip\dimexpr\MPxoffset\onebasepoint+#1\onebasepoint\relax
- \raise\dimexpr\MPyoffset\onebasepoint+#2\onebasepoint\relax
- \box\scratchbox}%
- \smashbox\scratchbox
- \box\scratchbox}
-
-%D This special (number 50) passes positions to a tex file.
-%D This method uses a two||pass approach an (mis|)|used the
-%D context positioning macros. In \type {core-pos} we will
-%D implement the low level submacro needed.
-%D
-%D \startbuffer
-%D \definelayer[test]
-%D
-%D \setlayer
-%D [test]
-%D [x=\MPx{somepos-1},y=\MPy{somepos-1}]
-%D {Whatever we want here!}
-%D
-%D \setlayer
-%D [test]
-%D [x=\MPx{somepos-2},y=\MPy{somepos-2}]
-%D {Whatever we need there!}
-%D
-%D \startuseMPgraphic{oeps}
-%D draw fullcircle scaled 6cm withcolor red ;
-%D register ("somepos-1",1cm,2cm,center currentpicture) ;
-%D register ("somepos-2",4cm,3cm,(-1cm,-2cm)) ;
-%D \stopuseMPgraphic
-%D
-%D \framed[background=test,offset=overlay]{\useMPgraphic{oeps}}
-%D \stopbuffer
-%D
-%D \typebuffer
-%D
-%D Here the width and height are not realy used, but one can
-%D imagine situations where tex has to work with values
-%D calculated by \METAPOST.
-%D
-%D \startlinecorrection
-%D \getbuffer
-%D \stoplinecorrection
-%D
-%D Later we will implement a more convenient macro:
-%D
-%D \starttyping
-%D \setMPlayer [test] [somepos-1] {Whatever we want here!}
-%D \setMPlayer [test] [somepos-2] {Whatever we need there!}
-%D \stoptyping
-
-\defineMPspecial{50} % x y width height label
- {\dosavepositionwhd
- {\gMPs5}%
- {0}%
- {\the\dimexpr-\MPllx\onebasepoint+\gMPs1\onebasepoint\relax}
- {\the\dimexpr\gMPs2\onebasepoint-\scratchdimen+\MPury\onebasepoint\relax}% scratchdimen ?
- {\the\dimexpr\gMPs3\onebasepoint\relax}%
- {\the\dimexpr\gMPs4\onebasepoint\relax}%
- {0pt}}
-
-%D A few auxiliary macros. This will move to colo-ini.
-
-\def\MPgrayspace{DeviceGray}
-\def\MPrgbspace {DeviceRGB}
-\def\MPcmykspace{DeviceCMYK}
-\let\MPspotspace\MPgrayspace
-
-\def\MPcmykBlack{0 0 0 0}
-\def\MPcmykWhite{0 0 0 1}
-
-\def\startMPcolorresolve
- {\bgroup
- \def\dostartgraycolormode##1%
- {\global\let\MPresolvedspace\MPgrayspace
- \xdef\MPresolvedcolor{##1}}%
- \def\dostartrgbcolormode ##1##2##3%
- {\global\let\MPresolvedspace\MPrgbspace
- \xdef\MPresolvedcolor{##1 ##2 ##3}}%
- \def\dostartcmykcolormode##1##2##3##4%
- {\global\let\MPresolvedspace\MPcmykspace
- \xdef\MPresolvedcolor{##1 ##2 ##3 ##4}}%
- \def\dostartspotcolormode##1##2%
- {\global\let\MPspotspace\empty % left over ?
- \xdef\MPresolvedspace{##1}%
- \xdef\MPresolvedcolor{##2}%
- \global\let\MPspotspace\MPresolvedspace}% signal
- \dostartgraycolormode\!!zerocount} % kind of hackery initialization
-
-\let\stopMPcolorresolve\egroup
-
-\def\resolveMPrgbcolor#1#2#3\to#4%
- {\startMPcolorresolve
- \execcolorR#1:#2:#3:0:0\od
- \stopMPcolorresolve
- \let#4\MPresolvedcolor}
-
-\def\resolveMPcmykcolor#1#2#3#4\to#5%
- {\startMPcolorresolve
- \execcolorC#1:#2:#3:#4:0:0\od
- \stopMPcolorresolve
- \let#5\MPresolvedcolor}
-
-\def\resolveMPgraycolor#1\end\to#2%
- {\startMPcolorresolve
- \execcolorS#1:0:0\od
- \stopMPcolorresolve
- \let#2\MPresolvedcolor}
-
-\def\resolveMPspotcolor#1#2#3#4\end\to#5%
- {\startMPcolorresolve
- \ifnum#2>\plusone
- \checkmultitonecolor{#1}%
- \fi
- \execcolorP#1:#2:#3:#4:0:0\od
- \stopMPcolorresolve
- \let#5\MPresolvedcolor}
-
\startMPinitializations
mp_shade_version := 2 ;
\stopMPinitializations
-% will be done better
-
-\def\MPStextext#1#2#3#4#5% if we clean up this plugin model, we can
- {\def\MPtextdata{#3}% % delegate the splitter to lua + redesign
- \def\MPtextsize{#2}%
- \def\lastMPmoveX{#4}%
- \def\lastMPmoveY{#5}%
- \defconvertedcommand\MPtextdata\MPtextdata % no edef
- \splitstring\MPtextdata\at::::\to\MPtexttag\and\MPtextnumber
- \executeifdefined{handleMPtext\MPtexttag}
- {\setbox\scratchbox\hbox
- {\font\temp=#1\space at #2\onebasepoint
- \let\c\char
- \temp
- \MPfshowcommand{#3}}%
- \setbox\scratchbox\hbox
- {\hskip#4\onebasepoint
- \raise#5\onebasepoint
- \box\scratchbox}%
- \smashbox\scratchbox
- \box\scratchbox}}
-
-%D We save the special variables on a stack. It's not that
-%D fast, but it make implementing the special more convenient.
-
-\def\MPSbegin
- {\nofMParguments\zerocount}
-
-\def\MPSend
- {\csname\MPspecial\endcsname}
-
-\def\MPSset
- {\advance\nofMParguments\plusone
- \expandafter\def\csname\@@MP\number\nofMParguments\endcsname}
+%D This is done much cleaner in \MPLIB.
-\def\gMPs#1{\csname\@@MP\number#1\endcsname}
+% %D A common hook.
+%
+% \let\MPfshowcommand\empty
+%
+% \def\MPStextext#1#2#3#4#5% if we clean up this plugin model, we can
+% {\def\MPtextdata{#3}% % delegate the splitter to lua + redesign
+% \def\MPtextsize{#2}%
+% \def\lastMPmoveX{#4}%
+% \def\lastMPmoveY{#5}%
+% \defconvertedcommand\MPtextdata\MPtextdata % no edef
+% \splitstring\MPtextdata\at::::\to\MPtexttag\and\MPtextnumber
+% \executeifdefined{handleMPtext\MPtexttag}
+% {\setbox\scratchbox\hbox
+% {\font\temp=#1\space at #2\onebasepoint
+% \let\c\char
+% \temp
+% \MPfshowcommand{#3}}%
+% \setbox\scratchbox\hbox
+% {\hskip#4\onebasepoint
+% \raise#5\onebasepoint
+% \box\scratchbox}%
+% \smashbox\scratchbox
+% \box\scratchbox}}
+
+\unexpanded\def\MPStextext#1#2#3#4#5% if we clean up this plugin model, we can
+ {\setbox\scratchbox\hbox
+ {\font\temp=#1\space at #2\onebasepoint \let\c\char \temp #3}%
+ \setbox\scratchbox\hbox
+ {\hskip#4\onebasepoint \raise#5\onebasepoint \box\scratchbox}%
+ \smashbox\scratchbox
+ \box\scratchbox}
%D The boundingbox.
\def\MPSboundingbox#1#2#3#4%
- {\xdef\MPllx{#1}%
- \xdef\MPlly{#2}%
- \xdef\MPurx{#3}%
- \xdef\MPury{#4}%
+ {\xdef\MPllx{#1}\xdef\MPlly{#2}\xdef\MPurx{#3}\xdef\MPury{#4}%
\xdef\MPwidth {\the\dimexpr#3\onebasepoint-#1\onebasepoint\relax}%
\xdef\MPheight{\the\dimexpr#4\onebasepoint-#2\onebasepoint\relax}}
\MPSboundingbox0000
-\def\MPSspecial#1#2%
- {\csname\@@MPSK#2\endcsname}
-
-%D A path is (in most cases) just a sequence of \PDF\ commands.
-
-% \newcontitional\ignoreMPpath
-
-\def\MPSpath
- {\PDFcode}
-
-\def\MPScode % hack, will be improved
- {\ifconditional\ignoreMPpath
- \PDFcode{h W n}%
- \ifx\extraMPpathcode\empty\else
- \PDFcode{\extraMPpathcode}%
- \let\extraMPpathcode\empty
- \fi
- \setfalse\ignoreMPpath
- \expandafter\gobbleoneargument
- \else
- \expandafter\PDFcode
- \fi}
-
-\let\MPSrgb \dohandleMPrgb
-\let\MPScmyk\dohandleMPcmyk
-\let\MPSgray\dohandleMPgray
-\let\MPSspot\dohandleMPspot
-
%D Test code:
-
-% \startMPcode
-% fill fullcircle scaled 3cm withcolor red ;
-% fill fullcircle scaled 2cm withcolor green ;
-% fill fullcircle scaled 1cm withcolor blue ;
-% currentpicture := currentpicture shifted (-4cm,0) ;
-% fill fullcircle scaled 3cm withcolor cmyk(0,0,1,0) ;
-% fill fullcircle scaled 2cm withcolor cmyk(0,1,0,0) ;
-% fill fullcircle scaled 1cm withcolor cmyk(0,0,1,0) ;
-% currentpicture := currentpicture shifted (-4cm,0) ;
-% draw fullcircle scaled 3cm dashed evenly ;
-% draw fullcircle scaled 2cm dashed withdots ;
-% draw origin withpen pencircle scaled 3mm;
-% currentpicture := currentpicture shifted (-4cm,0) ;
-% fill fullcircle scaled 2cm shifted (-.5cm,+.5cm) withcolor transparent(1,.5,red);
-% fill fullcircle scaled 2cm shifted (-.5cm,-.5cm) withcolor transparent(1,.5,red);
-% fill fullcircle scaled 2cm shifted (+.5cm,+.5cm) withcolor transparent(1,.5,green);
-% fill fullcircle scaled 2cm shifted (+.5cm,-.5cm) withcolor transparent(1,.5,cmyk(1,0,1,.5));
-% currentpicture := currentpicture shifted (12cm,-4cm) ;
-% draw "o e p s" infont defaultfont scaled 2 shifted (-1cm,0) ;
-% currentpicture := currentpicture shifted (-4cm,0) ;
-% % bug: shift
-% draw fullcircle scaled 3cm withpen pencircle yscaled 3mm xscaled 2mm rotated 30 ;
-% draw fullcircle scaled 2cm withpen pencircle yscaled 3mm xscaled 2mm rotated 20 withcolor red ;
-% filldraw fullcircle scaled 1cm withpen pencircle yscaled 3mm xscaled 2mm rotated 10 withcolor green ;
-% currentpicture := currentpicture shifted (-4cm,0) ;
-% % shade cannot handle shift
-% circular_shade(fullcircle scaled 3cm,0,.2red,.9green) ;
-% circular_shade(fullcircle scaled 3cm shifted(+4cm,0),0,cmyk(1,0,0,0),cmyk(0,1,0,0)) ;
-% filldraw boundingbox currentpicture enlarged -3cm withpen pencircle scaled 1pt withcolor .5white ;
-% \stopMPcode
-
-% We cannot use attributes for switching colors in mp literals because
-% grouping (qQ) interferes.
-
-\ifx\colorversion\undefined \else \ifnum\colorversion>\plusone
-
- \def\dohandleMPgraycolor #1{\ctxlua{ctx.pdffinishtransparency()
- ctx.pdfgrayliteral(\the\currentcolormodel,#1)}}
- \def\dohandleMPrgbcolor #1#2#3{\ctxlua{ctx.pdffinishtransparency()
- ctx.pdfrgbliteral (\the\currentcolormodel,#1,#2,#3)}}
- \def\dohandleMPcmykcolor#1#2#3#4{\ctxlua{ctx.pdffinishtransparency()
- ctx.pdfcmykliteral(\the\currentcolormodel,#1,#2,#3,#4)}}
- \def\dohandleMPspotcolor#1#2#3#4{\ctxlua{ctx.pdffinishtransparency()
- ctx.pdfspotliteral(\the\currentcolormodel,"#1",#2,"#3","#4")}}
-
- % we can combine the next calls
-
- \def\dohandleMPgraytransparency #1#2#3{\ctxlua{ctx.pdfgrayliteral(\the\currentcolormodel,#1)
- ctx.pdftransparencyliteral(#2,#3)}}
- \def\dohandleMPrgbtransparency #1#2#3#4#5{\ctxlua{ctx.pdfrgbliteral (\the\currentcolormodel,#1,#2,#3)
- ctx.pdftransparencyliteral(#4,#5)}}
- \def\dohandleMPcmyktransparency#1#2#3#4#5#6{\ctxlua{ctx.pdfcmykliteral(\the\currentcolormodel,#1,#2,#3,#4)
- ctx.pdftransparencyliteral(#5,#6)}}
- \def\dohandleMPspottransparency#1#2#3#4#5#6{\ctxlua{ctx.pdfspotliteral(\the\currentcolormodel,"#1",#2,"#3","#4")
- ctx.pdftransparencyliteral(#5,#6)}}
-
- \def\dohandleMPresettransparency {\ctxlua{ctx.pdffinishtransparency()}}
-
- \def\resolveMPgraycolor #1\to#2{\ctxlua{ctx.resolvempgraycolor("\strippedcsname#2","MPresolvedspace",\number\currentcolormodel,#1)}}
- \def\resolveMPrgbcolor #1#2#3\to#4{\ctxlua{ctx.resolvemprgbcolor ("\strippedcsname#4","MPresolvedspace",\number\currentcolormodel,#1,#2,#3)}}
- \def\resolveMPcmykcolor#1#2#3#4\to#5{\ctxlua{ctx.resolvempcmykcolor("\strippedcsname#5","MPresolvedspace",\number\currentcolormodel,#1,#2,#3,#4)}}
-
- \def\resolveMPspotcolor#1#2#3#4\to#5% unchecked
- {\ctxlua{ctx.resolvempspotcolor("\strippedcsname#5","MPresolvedspace",\number\currentcolormodel,"#1",#2,"#3","#4")}%
- \xdef\MPresolvedspace{#1}%
- \xdef\MPresolvedcolor{#4}%
- \global\let\MPspotspace\MPresolvedspace}
-
- % used as callers
-
- \let\MPSgray\dohandleMPgraycolor
- \let\MPSrgb \dohandleMPrgbcolor
- \let\MPScmyk\dohandleMPcmykcolor
- \let\MPspot \dohandleMPspotcolor
-
-\fi \fi
+%D
+%D \startbuffer
+%D \startMPcode
+%D fill fullcircle scaled 3cm withcolor red ;
+%D fill fullcircle scaled 2cm withcolor green ;
+%D fill fullcircle scaled 1cm withcolor blue ;
+%D currentpicture := currentpicture shifted (-4cm,0) ;
+%D fill fullcircle scaled 3cm withcolor cmyk(0,0,1,0) ;
+%D fill fullcircle scaled 2cm withcolor cmyk(0,1,0,0) ;
+%D fill fullcircle scaled 1cm withcolor cmyk(0,0,1,0) ;
+%D currentpicture := currentpicture shifted (-4cm,0) ;
+%D draw fullcircle scaled 3cm dashed evenly ;
+%D draw fullcircle scaled 2cm dashed withdots ;
+%D draw origin withpen pencircle scaled 3mm;
+%D currentpicture := currentpicture shifted (-4cm,0) ;
+%D fill fullcircle scaled 2cm shifted (-.5cm,+.5cm) withcolor transparent(1,.5,red);
+%D fill fullcircle scaled 2cm shifted (-.5cm,-.5cm) withcolor transparent(1,.5,red);
+%D fill fullcircle scaled 2cm shifted (+.5cm,+.5cm) withcolor transparent(1,.5,green);
+%D fill fullcircle scaled 2cm shifted (+.5cm,-.5cm) withcolor transparent(1,.5,cmyk(1,0,1,.5));
+%D currentpicture := currentpicture shifted (12cm,-4cm) ;
+%D draw "o e p s" infont defaultfont scaled 2 shifted (-1cm,0) ;
+%D currentpicture := currentpicture shifted (-4cm,0) ;
+%D % bug: shift
+%D draw fullcircle scaled 3cm withpen pencircle yscaled 3mm xscaled 2mm rotated 30 ;
+%D draw fullcircle scaled 2cm withpen pencircle yscaled 3mm xscaled 2mm rotated 20 withcolor red ;
+%D filldraw fullcircle scaled 1cm withpen pencircle yscaled 3mm xscaled 2mm rotated 10 withcolor green ;
+%D currentpicture := currentpicture shifted (-4cm,0) ;
+%D % shade cannot handle shift
+%D circular_shade(fullcircle scaled 3cm,0,.2red,.9green) ;
+%D circular_shade(fullcircle scaled 3cm shifted(+4cm,0),0,cmyk(1,0,0,0),cmyk(0,1,0,0)) ;
+%D filldraw boundingbox currentpicture enlarged -3cm withpen pencircle scaled 1pt withcolor .5white ;
+%D \stopMPcode
+%D \stopbuffer
+%D
+%D \typebuffer \startlinecorrection \getbuffer \stoplinecorrection
\protect \endinput
diff --git a/tex/context/base/meta-pdh.lua b/tex/context/base/meta-pdh.lua
index e05529cc8..ef15c6a11 100644
--- a/tex/context/base/meta-pdh.lua
+++ b/tex/context/base/meta-pdh.lua
@@ -24,6 +24,7 @@ if not modules then modules = { } end modules ['meta-pdf'] = {
local concat, format = table.concat, string.format
+local texsprint = tex.sprint
local ctxcatcodes = tex.ctxcatcodes
mptopdf = { }
@@ -148,11 +149,11 @@ end
-- from lua to tex
function mptopdf.pdfcode(str)
- tex.sprint(ctxcatcodes,"\\PDFcode{" .. str .. "}") -- \\MPScode
+ texsprint(ctxcatcodes,"\\pdfliteral{" .. str .. "}") -- \\MPScode
end
function mptopdf.texcode(str)
- tex.sprint(ctxcatcodes,str)
+ texsprint(ctxcatcodes,str)
end
-- auxiliary functions
@@ -350,52 +351,23 @@ end
--~ end
--~ end
-if false and ctx and ctx.aux and ctx.aux.definecolor then
-
- logs.report("mptopdf", "using attribute based mps colors")
-
- -- does not work due to Q-q mess-up
-
- function mps.setrgbcolor(r,g,b) -- extra check
- r, g, b = tonumber(r), tonumber(g), tonumber(b) -- needed when we use lpeg
- if r == 0.0123 and g < 0.1 then -- g is extra check
- mptopdf.texcode("\\doresetattribute{transparency}\\MPSspecial{" .. g*10000 .. "}{" .. b*10000 .. "}")
- elseif r == 0.123 and g < 0.1 then -- g is extra check
- mptopdf.texcode("\\doresetattribute{transparency}\\MPSspecial{" .. g* 1000 .. "}{" .. b* 1000 .. "}")
- else
- mptopdf.texcode("\\doresetattribute{transparency}\\dosetattribute{color}{" .. colors.register('color',nil,'rgb',r,g,b) .. "}")
- end
- end
-
- function mps.setcmykcolor(c,m,y,k)
- mptopdf.texcode("\\doresetattribute{transparency}\\dosetattribute{color}{" .. colors.register('color',nil,'cmyk',tonumber(c),tonumber(m),tonumber(y),tonumber(k)) .. "}")
- end
-
- function mps.setgray(s)
- mptopdf.texcode("\\doresetattribute{transparency}\\dosetattribute{color}{" .. colors.register('color',nil,'gray',tonumber(s)) .. "}")
- end
-
-else
-
- function mps.setrgbcolor(r,g,b) -- extra check
- r, g = tonumber(r), tonumber(g) -- needed when we use lpeg
- if r == 0.0123 and g < 0.1 then
- mptopdf.texcode("\\MPSspecial{" .. g*10000 .. "}{" .. b*10000 .. "}")
- elseif r == 0.123 and g < 0.1 then
- mptopdf.texcode("\\MPSspecial{" .. g* 1000 .. "}{" .. b* 1000 .. "}")
- else
- mptopdf.texcode("\\MPSrgb{" .. r .. "}{" .. g .. "}{" .. b .. "}")
- end
- end
-
- function mps.setcmykcolor(c,m,y,k)
- mptopdf.texcode("\\MPScmyk{" .. c .. "}{" .. m .. "}{" .. y .. "}{" .. k .. "}")
+function mps.setrgbcolor(r,g,b) -- extra check
+ r, g = tonumber(r), tonumber(g) -- needed when we use lpeg
+ if r == 0.0123 and g < 0.1 then
+ mptopdf.texcode("\\MPSspecial{" .. g*10000 .. "}{" .. b*10000 .. "}")
+ elseif r == 0.123 and g < 0.1 then
+ mptopdf.texcode("\\MPSspecial{" .. g* 1000 .. "}{" .. b* 1000 .. "}")
+ else
+ mptopdf.texcode("\\MPSrgb{" .. r .. "}{" .. g .. "}{" .. b .. "}")
end
+end
- function mps.setgray(s)
- mptopdf.texcode("\\MPSgray{" .. s .. "}")
- end
+function mps.setcmykcolor(c,m,y,k)
+ mptopdf.texcode("\\MPScmyk{" .. c .. "}{" .. m .. "}{" .. y .. "}{" .. k .. "}")
+end
+function mps.setgray(s)
+ mptopdf.texcode("\\MPSgray{" .. s .. "}")
end
function mps.specials(version,signal,factor) -- 2.0 123 1000
diff --git a/tex/context/base/meta-pdh.mkiv b/tex/context/base/meta-pdh.mkiv
new file mode 100644
index 000000000..0736598cf
--- /dev/null
+++ b/tex/context/base/meta-pdh.mkiv
@@ -0,0 +1,780 @@
+%D \module
+%D [ file=meta-pdf,
+%D version=2006.06.07,
+%D title=\METAPOST\ Graphics,
+%D subtitle=Conversion to \PDF,
+%D author=Hans Hagen \& others (see text),
+%D date=\currentdate,
+%D copyright=\PRAGMA]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D Formerly known as supp-pdf.tex and supp-mpe.tex and meta-pdf.mkiv.
+%D
+%D Beware: this file is not used but kept for historic purposed!
+
+% \useMPgraphic{1}
+% \testfeatureonce{250}{\setbox0\hbox{\convertMPtoPDF{test-mps-mpgraph.1}{1}{1}}}
+%
+% 8.4 : mkii, direct parsing by tex
+% 11.8 : mkiv, dirty conversion (10.8 with dirty tricks)
+% 14.5 : mkiv, clean conversion
+% 7.4 : mkiv, simulated clean direct lua from mp
+% 0.3 : time taken by tex to handle converted code
+%
+% timings may differ now that we revamped the backend
+
+\registerctxluafile{meta-pdf}{1.003}
+
+%D We will clean up the color mess later.
+
+\writestatus{loading}{MetaPost Graphics / MPS to PDF}
+
+\unprotect
+
+%D First we define a handy constant:
+
+\bgroup \catcode`\%=\@@other \xdef\letterpercent{\string%} \egroup
+
+%D \macros
+%D {convertMPtoPDF}
+%D
+%D The next set of macros implements \METAPOST\ to \PDF\
+%D conversion. The traditional method is in the MkII file.
+%D
+%D The main conversion command is:
+%D
+%D \starttyping
+%D \convertMPtoPDF {filename} {x scale} {y scale}
+%D \stoptyping
+%D
+%D The dimensions are derived from the bounding box. So we
+%D only have to say:
+%D
+%D \starttyping
+%D \convertMPtoPDF{mp-pra-1.eps}{1}{1}
+%D \convertMPtoPDF{mp-pra-1.eps}{.5}{.5}
+%D \stoptyping
+
+%D \macros
+%D {makeMPintoPDFobject,lastPDFMPobject}
+%D
+%D For experts there are a few more options. When attributes
+%D are to be added, the code must be embedded in an object
+%D accompanied with the appropriate directives. One can
+%D influence this process with \type {\makeMPintoPDFobject}.
+%D
+%D This option defaults to~0, because \CONTEXT\ takes care
+%D of objects at another level, which saves some bytes.
+%D
+%D \starttabulate[|l|l|p|]
+%D \NC 0 \NC never \NC don't use an object \NC\NR
+%D \NC 1 \NC always \NC always use an object \NC\NR
+%D \NC 2 \NC optional \NC use object when needed \NC\NR
+%D \stoptabulate
+%D
+%D The last object number used is avaliable in the macro
+%D \type {\lastPDFMPobject}.
+
+\ifx\makeMPintoPDFobject \undefined \chardef\makeMPintoPDFobject \zerocount \fi
+\ifx\everyMPtoPDFconversion\undefined \newtoks\everyMPtoPDFconversion \fi
+
+\let\lastPDFMPobject \!!zerocount
+\let\currentPDFresources\empty
+\let\setMPextensions \relax
+
+\def\PDFMPformoffset
+ {\ifx\objectoffset\undefined\zeropoint\else\objectoffset\fi}
+
+\def\resetMPvariables#1#2#3%
+ {\global\let\MPwidth \!!zeropoint
+ \global\let\MPheight\!!zeropoint
+ \global\let\MPllx \!!zerocount
+ \global\let\MPlly \!!zerocount
+ \global\let\MPurx \!!zerocount
+ \global\let\MPury \!!zerocount
+ \xdef\MPxscale {#2}\ifx\MPxscale\empty\let\MPxscale\!!plusone\fi
+ \xdef\MPyscale {#3}\ifx\MPyscale\empty\let\MPyscale\!!plusone\fi
+ \xdef\MPfilename {#1}}
+
+%D The main macro:
+
+\def\convertMPtoPDF#1#2#3% watch the transparency reset
+ {\resetMPvariables{#1}{#2}{#3}%
+ \vbox\bgroup
+ \forgetall
+ \offinterlineskip
+ \setbox\scratchbox\vbox\bgroup
+ \setnormalcatcodes % we can be in verbatim or so
+ \message{[MP to PDF]}%
+ \startMPresources
+ \pdfliteral{\letterpercent\space mps begin}%
+ \pdfliteral{q 1 0 0 1 0 0 cm}%
+ \ctxlua{mptopdf.convertmpstopdf("\MPfilename")}\removeunwantedspaces
+ \pdfliteral{Q}%
+ \pdfliteral{\letterpercent\space mps end}%
+ \stopMPresources
+ \egroup
+ \setbox\scratchbox\hbox\bgroup
+ \hskip-\MPllx\onebasepoint
+ \raise-\MPlly\onebasepoint
+ \box\scratchbox
+ \egroup
+ \setbox\scratchbox\vbox to \MPheight\bgroup
+ \vfill
+ \hsize\MPwidth
+ \smashbox\scratchbox
+ \box\scratchbox
+ \egroup
+ \wd\scratchbox\MPwidth
+ \ht\scratchbox\MPheight
+ \dopackageMPgraphic\scratchbox
+ \egroup}
+
+\let\processMPtoPDFfile\convertMPtoPDF
+
+%D A common hook.
+
+\let\MPfshowcommand\empty
+
+%D Objects.
+
+\def\dopackageMPgraphic#1% #1 = boxregister
+ {\ifcase\makeMPintoPDFobject\or\or\ifx\currentPDFresources\empty\else
+ % an existing value of 2 signals object support (set elsewhere)
+ \chardef\makeMPintoPDFobject\plusone
+ \fi\fi
+ \ifcase\makeMPintoPDFobject
+ \box#1%
+ \or
+ \scratchdimen\PDFMPformoffset\relax
+ \ifdim\scratchdimen>\zeropoint % compensate for error
+ \setbox#1\vbox spread 2\scratchdimen
+ {\forgetall\vss\hbox spread 2\scratchdimen{\hss\box#1\hss}\vss}%
+ \fi
+ \setMPPDFobject{\currentPDFresources}{#1}%
+ \ifdim\scratchdimen>\zeropoint % compensate for error
+ \vbox to \MPheight
+ {\forgetall\vss\hbox to \MPwidth{\hss\getMPPDFobject\hss}\vss}%
+ \else
+ \getMPPDFobject
+ \fi
+ \global\let\currentPDFresources\empty
+ \else
+ \box#1%
+ \fi}
+
+\def\setMPPDFobject#1#2% resources boxnumber
+ {\ifx\everyPDFxform\undefined\else\the\everyPDFxform\fi
+ \immediate\pdfxform resources{#1}#2%
+ \edef\getMPPDFobject{\noexpand\pdfrefxform\the\pdflastxform}}
+
+\let\getMPPDFobject\relax
+
+%D \macros
+%D {deleteMPgraphic,
+%D startMPresources,
+%D stopMPresources}
+
+\ifx\deleteMPgraphic\undefined
+ \def\deleteMPgraphic#1{}
+\fi
+
+\ifx\startMPresources\undefined
+ \let\startMPresources\relax
+ \let\stopMPresources\relax
+\fi
+
+%D We implement extensions by using the \METAPOST\ special
+%D mechanism. Opposite to \TEX's specials, the \METAPOST\ ones
+%D are flushed before or after the graphic data, but thereby
+%D are no longer connected to a position.
+%D
+%D We implement specials by overloading the \type {fill}
+%D operator. By counting the fills, we can let the converter
+%D treat the appropriate fill in a special way. The
+%D specification of the speciality can have two forms,
+%D determined by the setting of a boolean variable:
+%D
+%D \starttyping
+%D _inline_specials_ := false ; % comment like code (default)
+%D _inline_specials_ := true ; % command like code
+%D \stoptyping
+%D
+%D When the specification is embedded as comment, it looks
+%D like:
+%D
+%D \starttyping
+%D %%MetaPostSpecial
+%D \stoptyping
+%D
+%D The in||line alternative is more tuned for \POSTSCRIPT,
+%D since it permits us to define a macro \type {special}.
+%D
+%D \starttyping
+%D inline : special
+%D \stoptyping
+%D
+%D The \type {identifier} determines what to do, and the data
+%D can be used to accomplish this. A type~2 shading function
+%D has identifier~2. Alltogether, the number of parameters is
+%D specified in \type {size}. The \type {number} is the number
+%D of the fill that needs the special treatment. For a type~2
+%D and~3 shaded fill, the datablock contains the following
+
+%D data:
+%D
+%D \starttyping
+%D from to n inner_r g b x y outer_r g b x y
+%D from to n inner_r g b x y radius outer_r g b x y radius
+%D \stoptyping
+
+\newconditional\manyMPspecials \settrue\manyMPspecials
+
+%D In case of \PDF, we need to prepare resourcs.
+
+\newtoks\MPstartresources
+\newtoks\MPstopresources
+
+\def\startMPresources
+ {\the\MPstartresources}
+
+\def\stopMPresources
+ {\the\MPstopresources}
+
+%D Some day we may consider collecting local resources.
+
+\appendtoks
+ \global\let\currentPDFresources\empty % kind of redundant
+\to \MPstartresources
+
+% \appendtoks
+% \collectPDFresources
+% \global\let\currentPDFresources\collectedPDFresources
+% \to \MPstopresources
+
+\appendtoksonce
+ \the\everyPDFxform
+\to \MPstopresources
+
+%D Since colors are not subjected to transformations, we can
+%D only use colors as signal. In our case, we use a dummy colored
+%D path with a red color component of \type {0.n}, so \type
+%D {0.001} is the first path and \type {0.010} the tenth. Since
+%D \METAPOST strips trailing zeros, we have to padd the string.
+
+\newif\ifMPcmykcolors
+\newif\ifMPspotcolors
+
+%D Specials:
+
+% \settrue \manyMPspecials \newcount\nofMParguments \let\extraMPpathcode\empty
+%
+% \def\@@MP {@@MP}
+% \def\@@MPSK{@MPSK@}
+%
+% \def\MPspecial{\@@MPSK\@@MPSK\gMPs\nofMParguments}
+%
+% \def\defineMPspecial#1#2%
+% {\setvalue{\@@MPSK\@@MPSK#1}{#2}}
+
+%D Special number~1 is dedicated to \CMYK\ support. If you
+%D want to know why: look at this:
+%D
+%D \startbuffer[mp]
+%D fill fullcircle xyscaled (3cm,1cm) withcolor \MPcolor{test} ;
+%D \stopbuffer
+%D
+%D \startbuffer[cmyk]
+%D \startcombination[4*1]
+%D {\definecolor[test][c=1,y=.3,k=.3] \processMPbuffer[mp]} {c=1 y=.3 k=.3}
+%D {\definecolor[test][c=.9,y=.15] \processMPbuffer[mp]} {c=.9 y=.15}
+%D {\definecolor[test][c=.25,y=.8] \processMPbuffer[mp]} {c=.25 y=.8}
+%D {\definecolor[test][c=.45,y=.1] \processMPbuffer[mp]} {c=.45 y=.1}
+%D \stopcombination
+%D \stopbuffer
+%D
+%D \placefigure
+%D {\CMYK\ support disabled,
+%D conversion to \RGB.}
+%D {\setupcolors[cmyk=nee,state=start]\getbuffer[cmyk]}
+%D
+%D \placefigure
+%D {\CMYK\ support enabled,
+%D no support in \METAPOST.}
+%D {\setupcolors[cmyk=ja,mpcmyk=nee,state=start]\getbuffer[cmyk]}
+%D
+%D \placefigure
+%D {\CMYK\ support enabled,
+%D no conversion to \RGB,
+%D support in \METAPOST}
+%D {\setupcolors[cmyk=ja,state=start]\getbuffer[cmyk]}
+
+% \let\revokeMPtransparencyspecial\relax
+
+%D Transparency support used specials 60 (rgb) and 61
+%D (cmyk).
+%D
+%D \startbuffer
+%D u := 2cm ; path p ; p := fullcircle scaled u shifted (u/4,0);
+%D
+%D fill p rotated 90 withcolor transparent(1,.5,yellow) ;
+%D fill p rotated 210 withcolor transparent(1,.5,green) ;
+%D fill p rotated 330 withcolor transparent(1,.5,blue) ;
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D \startlinecorrection \processMPbuffer \stoplinecorrection
+%D
+%D One can also communicate colors between \CONTEXT\ and
+%D \METAPOST:
+%D
+%D \startbuffer
+%D \definecolor[tcyan] [c=1,k=.2,t=.5]
+%D \definecolor[tmagenta][m=1,k=.2,t=.5]
+%D \definecolor[tyellow] [y=1,k=.2,t=.5]
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+%D
+%D \startbuffer
+%D u := 2cm ; path p ; p := fullcircle scaled u shifted (u/4,0);
+%D
+%D fill p rotated 90 withcolor \MPcolor{tcyan} ;
+%D fill p rotated 210 withcolor \MPcolor{tmagenta} ;
+%D fill p rotated 330 withcolor \MPcolor{tyellow} ;
+%D \stopbuffer
+%D
+%D \startlinecorrection \processMPbuffer \stoplinecorrection
+
+%D Shading is an example of a more advanced graphic feature,
+%D but users will seldom encounter those complications. Here
+%D we only show a few simple examples, but many other
+%D alternatives are possible by setting up the functions built
+%D in \PDF\ in the appropriate way.
+%D
+%D Shading has to do with interpolation between two or more
+%D points or user supplied ranges. In \PDF, the specifications
+%D of a shade has to be encapsulated in objects and passed on
+%D as resources. This is a \PDF\ level 1.3. feature. One can
+%D simulate three dimensional shades as well and define simple
+%D functions using a limited set of \POSTSCRIPT\ primitives.
+%D Given the power of \METAPOST\ and these \PDF\ features, we
+%D can achieve superb graphic effects.
+%D
+%D Since everything is hidden in \TEX\ and \METAPOST\ graphics,
+%D we can stick to high level \CONTEXT\ command, as shown in
+%D the following exmples.
+%D
+%D \startbuffer
+%D \startuniqueMPgraphic{CircularShade}
+%D path p ; p := unitsquare xscaled \overlaywidth yscaled \overlayheight ;
+%D circular_shade(p,0,.2red,.9red) ;
+%D \stopuniqueMPgraphic
+%D
+%D \startuniqueMPgraphic{LinearShade}
+%D path p ; p := unitsquare xscaled \overlaywidth yscaled \overlayheight ;
+%D linear_shade(p,0,.2blue,.9blue) ;
+%D \stopuniqueMPgraphic
+%D
+%D \startuniqueMPgraphic{DuotoneShade}
+%D path p ; p := unitsquare xscaled \overlaywidth yscaled \overlayheight ;
+%D linear_shade(p,2,.5green,.5red) ;
+%D \stopuniqueMPgraphic
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D \getbuffer
+%D
+%D These graphics can be hooked into the overlay mechanism,
+%D which is available in many commands.
+%D
+%D \startbuffer
+%D \defineoverlay[demo 1][\uniqueMPgraphic{CircularShade}]
+%D \defineoverlay[demo 2][\uniqueMPgraphic {LinearShade}]
+%D \defineoverlay[demo 3][\uniqueMPgraphic {DuotoneShade}]
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D \getbuffer
+%D
+%D These backgrounds can for instance be applied to \type
+%D {\framed}:
+%D
+%D \startbuffer
+%D \setupframed[width=3cm,height=2cm,frame=off]
+%D \startcombination[3*1]
+%D {\framed[backgroundachtergrond=demo 1]{\bfd \white Demo 1}} {}
+%D {\framed[backgroundachtergrond=demo 2]{\bfd \white Demo 2}} {}
+%D {\framed[backgroundachtergrond=demo 3]{\bfd \white Demo 3}} {}
+%D \stopcombination
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D \startlinecorrection
+%D \getbuffer
+%D \stoplinecorrection
+%D
+%D There are a few more alternatives, determined by the second
+%D parameter passed to \type {circular_shade} and alike.
+%D
+%D \def\SomeShade#1#2#3#4#5%
+%D {\startuniqueMPgraphic{Shade-#1}
+%D width := \overlaywidth ;
+%D height := \overlayheight ;
+%D path p ; p := unitsquare xscaled width yscaled height ;
+%D #2_shade(p,#3,#4,#5) ;
+%D \stopuniqueMPgraphic
+%D \defineoverlay[Shade-#1][\uniqueMPgraphic{Shade-#1}]%
+%D \framed[backgroundachtergrond=Shade-#1,width=2cm,height=2cm,frame=off]{}}
+%D
+%D \startlinecorrection
+%D \startcombination[5*1]
+%D {\SomeShade{10}{circular}{0}{.3blue}{.9blue}} {circular 0}
+%D {\SomeShade{11}{circular}{1}{.3blue}{.9blue}} {circular 1}
+%D {\SomeShade{12}{circular}{2}{.3blue}{.9blue}} {circular 2}
+%D {\SomeShade{13}{circular}{3}{.3blue}{.9blue}} {circular 3}
+%D {\SomeShade{14}{circular}{4}{.3blue}{.9blue}} {circular 4}
+%D \stopcombination
+%D \stoplinecorrection
+%D
+%D \blank
+%D
+%D \startlinecorrection
+%D \startcombination[5*1]
+%D {\SomeShade{20}{circular}{0}{.9green}{.3green}} {circular 0}
+%D {\SomeShade{21}{circular}{1}{.9green}{.3green}} {circular 1}
+%D {\SomeShade{22}{circular}{2}{.9green}{.3green}} {circular 2}
+%D {\SomeShade{23}{circular}{3}{.9green}{.3green}} {circular 3}
+%D {\SomeShade{24}{circular}{4}{.9green}{.3green}} {circular 4}
+%D \stopcombination
+%D \stoplinecorrection
+%D
+%D \blank
+%D
+%D \startlinecorrection
+%D \startcombination[4*1]
+%D {\SomeShade{30}{linear}{0}{.3red}{.9red}} {linear 0}
+%D {\SomeShade{31}{linear}{1}{.3red}{.9red}} {linear 1}
+%D {\SomeShade{32}{linear}{2}{.3red}{.9red}} {linear 2}
+%D {\SomeShade{33}{linear}{3}{.3red}{.9red}} {linear 3}
+%D \stopcombination
+%D \stoplinecorrection
+%D
+%D These macros closely cooperate with the \METAPOST\ module
+%D \type {mp-spec.mp}, which is part of the \CONTEXT\
+%D distribution.
+%D
+%D The low level (\PDF) implementation is based on the \TEX\
+%D based \METAPOST\ to \PDF\ converter. Shading is supported
+%D by overloading the \type {fill} operator as implemented
+%D earlier. In \PDF\ type~2 and~3 shading functions are
+%D specified in terms of:
+%D
+%D \starttabulate[|Tl|l|]
+%D \NC /Domain \NC sort of meeting range \NC \NR
+%D \NC /C0 \NC inner shade \NC \NR
+%D \NC /C1 \NC outer shade \NC \NR
+%D \NC /N \NC smaller values, bigger inner circles \NC \NR
+%D \stoptabulate
+
+% \newcount\currentPDFshade % 0 % global (document wide) counter
+%
+% \def\dosetMPsomePDFshade#1#2%
+% {\immediate\pdfobj
+% {<>}%
+% \immediate\pdfobj
+% {<>}%
+% \global\advance\currentPDFshade \plusone
+% \ctxlua{lpdf.adddocumentshade("Sh\the\currentPDFshade",lpdf.reference(\the\pdflastobj))}%
+% \setxvalue{\@@MPSK#2}{\noexpand\dohandleMPshade{\the\currentPDFshade}}}
+%
+% \def\dosetMPlinearshade {\dosetMPsomePDFshade2}% #1
+% \def\dosetMPcircularshade{\dosetMPsomePDFshade3}% #1
+%
+% \defineMPspecial{30}
+% {\normalexpanded{\noexpand\resolveMPrgbcolor{\gMPs4}{\gMPs5}{\gMPs6}}\to\MPshadeA
+% \normalexpanded{\noexpand\resolveMPrgbcolor{\gMPs{9}}{\gMPs{10}}{\gMPs{11}}}\to\MPshadeB
+% \edef\MPshadeC{\gMPs7 \gMPs8 \gMPs{12} \gMPs{13}}%
+% \dosetMPlinearshade{\gMPs{14}}}
+%
+% \defineMPspecial{31}
+% {\normalexpanded{\noexpand\resolveMPrgbcolor{\gMPs4}{\gMPs5}{\gMPs6}}\to\MPshadeA
+% \normalexpanded{\noexpand\resolveMPrgbcolor{\gMPs{10}}{\gMPs{11}}{\gMPs{12}}}\to\MPshadeB
+% \edef\MPshadeC{\gMPs7 \gMPs8 \gMPs9 \gMPs{13} \gMPs{14} \gMPs{15}}%
+% \dosetMPcircularshade{\gMPs{16}}}
+%
+% \defineMPspecial{32}
+% {\normalexpanded{\noexpand\resolveMPcmykcolor{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}}\to\MPshadeA
+% \normalexpanded{\noexpand\resolveMPcmykcolor{\gMPs{10}}{\gMPs{11}}{\gMPs{12}}{\gMPs{13}}}\to\MPshadeB
+% \edef\MPshadeC{\gMPs8 \gMPs9 \gMPs{14} \gMPs{15}}%
+% \dosetMPlinearshade{\gMPs{16}}}
+%
+% \defineMPspecial{33}
+% {\normalexpanded{\noexpand\resolveMPcmykcolor{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}}\to\MPshadeA
+% \normalexpanded{\noexpand\resolveMPcmykcolor{\gMPs{11}}{\gMPs{12}}{\gMPs{13}}{\gMPs{14}}}\to\MPshadeB
+% \edef\MPshadeC{\gMPs8 \gMPs9 \gMPs{10} \gMPs{15} \gMPs{16} \gMPs{17}}%
+% \dosetMPcircularshade{\gMPs{18}}}
+%
+% \defineMPspecial{34}
+% {\normalexpanded{\noexpand\resolveMPspotcolor{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}}\to\MPshadeA
+% \normalexpanded{\noexpand\resolveMPspotcolor{\gMPs{10}}{\gMPs{11}}{\gMPs{12}}{\gMPs{13}}}\to\MPshadeB
+% \edef\MPshadeC{\gMPs8 \gMPs9 \gMPs{14} \gMPs{15}}%
+% \dosetMPlinearshade{\gMPs{16}}}
+%
+% \defineMPspecial{35}
+% {\normalexpanded{\noexpand\resolveMPcmykcolor{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}}\to\MPshadeA
+% \normalexpanded{\noexpand\resolveMPcmykcolor{\gMPs{11}}{\gMPs{12}}{\gMPs{13}}{\gMPs{14}}}\to\MPshadeB
+% \edef\MPshadeC{\gMPs8 \gMPs9 \gMPs{10} \gMPs{15} \gMPs{16} \gMPs{17}}%
+% \dosetMPcircularshade{\gMPs{18}}}
+%
+% \newconditional\ignoreMPpath
+%
+% \def\dohandleMPshade#1%
+% {\revokeMPtransparencyspecial
+% \settrue\ignoreMPpath
+% \def\extraMPpathcode{/Sh#1 sh Q}%
+% \pdfliteral{q /Pattern cs}}
+%
+% \defineMPspecial{10}
+% {\setxvalue{\@@MPSK\gMPs8}%
+% {\noexpand\handleMPfigurespecial{\gMPs1}{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}{\gMPs8}}}
+%
+% \def\handleMPfigurespecial#1#2#3#4#5#6#7#8% todo : combine with ext fig
+% {\global\letvalue{\@@MPSK#8}\empty
+% \vbox to \zeropoint
+% {\vss
+% \hbox to \zeropoint
+% {\ifcase\pdfoutput\or % will be hooked into the special driver
+% \doiffileelse{#7}
+% {\doifundefinedelse{mps:x:#7}
+% {\immediate\pdfximage\!!width\onebasepoint\!!height\onebasepoint{#7}%
+% \setxvalue{mps:x:#7}{\pdfrefximage\the\pdflastximage}}%
+% {\message{[reusing figure #7]}}%
+% \pdfliteral{q #1 #2 #3 #4 #5 #6 cm}%
+% \rlap{\getvalue{mps:x:#7}}%
+% \pdfliteral{Q}}
+% {\message{[unknown figure #7]}}%
+% \fi
+% \hss}}}
+
+%D An example of using both special features is the
+%D following.
+%D
+%D \starttyping
+%D \startMPpage
+%D externalfigure "hakker1b.png" scaled 22cm rotated 10 shifted (-2cm,0cm);
+%D externalfigure "hakker1b.png" scaled 10cm rotated -10 ;
+%D externalfigure "hakker1b.png" scaled 7cm rotated 45 shifted (8cm,12cm) ;
+%D path p ; p := unitcircle xscaled 15cm yscaled 20cm;
+%D path q ; q := p rotatedaround(center p,90) ;
+%D path r ; r := buildcycle(p,q) ; clip currentpicture to r ;
+%D path s ; s := boundingbox currentpicture enlarged 5mm ;
+%D picture c ; c := currentpicture ; currentpicture := nullpicture ;
+%D circular_shade(s,0,.2red,.9red) ;
+%D addto currentpicture also c ;
+%D \stopMPpage
+%D \stoptyping
+
+% \defineMPspecial{20}
+% {\setxvalue{\@@MPSK\gMPs6}%
+% {\noexpand\handleMPhyperlink{\gMPs1}{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}}}
+%
+% \def\handleMPhyperlink#1#2#3#4#5#6%
+% {\global\letvalue{\@@MPSK#6}\empty
+% \setbox\scratchbox\hbox
+% {\setbox\scratchbox\null
+% \wd\scratchbox\dimexpr-#1\onebasepoint+#3\onebasepoint\relax
+% \ht\scratchbox\dimexpr-#2\onebasepoint+#4\onebasepoint\relax
+% \gotobox{\box\scratchbox}[#5]}%
+% \setbox\scratchbox\hbox
+% {\hskip\dimexpr\MPxoffset\onebasepoint+#1\onebasepoint\relax
+% \raise\dimexpr\MPyoffset\onebasepoint+#2\onebasepoint\relax
+% \box\scratchbox}%
+% \smashbox\scratchbox
+% \box\scratchbox}
+
+%D This special (number 50) passes positions to a tex file.
+%D This method uses a two||pass approach an (mis|)|used the
+%D context positioning macros. In \type {core-pos} we will
+%D implement the low level submacro needed.
+%D
+%D \startbuffer
+%D \definelayer[test]
+%D
+%D \setlayer
+%D [test]
+%D [x=\MPx{somepos-1},y=\MPy{somepos-1}]
+%D {Whatever we want here!}
+%D
+%D \setlayer
+%D [test]
+%D [x=\MPx{somepos-2},y=\MPy{somepos-2}]
+%D {Whatever we need there!}
+%D
+%D \startuseMPgraphic{oeps}
+%D draw fullcircle scaled 6cm withcolor red ;
+%D register ("somepos-1",1cm,2cm,center currentpicture) ;
+%D register ("somepos-2",4cm,3cm,(-1cm,-2cm)) ;
+%D \stopuseMPgraphic
+%D
+%D \framed[background=test,offset=overlay]{\useMPgraphic{oeps}}
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D Here the width and height are not realy used, but one can
+%D imagine situations where tex has to work with values
+%D calculated by \METAPOST.
+%D
+%D \startlinecorrection
+%D \getbuffer
+%D \stoplinecorrection
+%D
+%D Later we will implement a more convenient macro:
+%D
+%D \starttyping
+%D \setMPlayer [test] [somepos-1] {Whatever we want here!}
+%D \setMPlayer [test] [somepos-2] {Whatever we need there!}
+%D \stoptyping
+
+% \defineMPspecial{50} % x y width height label
+% {\dosavepositionwhd
+% {\gMPs5}%
+% {0}%
+% {\the\dimexpr-\MPllx\onebasepoint+\gMPs1\onebasepoint\relax}
+% {\the\dimexpr\gMPs2\onebasepoint-\scratchdimen+\MPury\onebasepoint\relax}% scratchdimen ?
+% {\the\dimexpr\gMPs3\onebasepoint\relax}%
+% {\the\dimexpr\gMPs4\onebasepoint\relax}%
+% {0pt}}
+
+\startMPinitializations
+ mp_shade_version := 2 ;
+\stopMPinitializations
+
+%D This is done much cleaner in \MPLIB.
+
+\def\MPStextext#1#2#3#4#5% if we clean up this plugin model, we can
+ {\def\MPtextdata{#3}% % delegate the splitter to lua + redesign
+ \def\MPtextsize{#2}%
+ \def\lastMPmoveX{#4}%
+ \def\lastMPmoveY{#5}%
+ \defconvertedcommand\MPtextdata\MPtextdata % no edef
+ \splitstring\MPtextdata\at::::\to\MPtexttag\and\MPtextnumber
+ \executeifdefined{handleMPtext\MPtexttag}
+ {\setbox\scratchbox\hbox
+ {\font\temp=#1\space at #2\onebasepoint
+ \let\c\char
+ \temp
+ \MPfshowcommand{#3}}%
+ \setbox\scratchbox\hbox
+ {\hskip#4\onebasepoint
+ \raise#5\onebasepoint
+ \box\scratchbox}%
+ \smashbox\scratchbox
+ \box\scratchbox}}
+
+%D We save the special variables on a stack. It's not that
+%D fast, but it make implementing the special more convenient.
+
+% \def\MPSbegin
+% {\nofMParguments\zerocount}
+%
+% \def\MPSend
+% {\csname\MPspecial\endcsname}
+%
+% \def\MPSset
+% {\advance\nofMParguments\plusone
+% \expandafter\def\csname\@@MP\number\nofMParguments\endcsname}
+%
+% \def\gMPs#1{\csname\@@MP\number#1\endcsname}
+
+%D The boundingbox.
+
+\def\MPSboundingbox#1#2#3#4%
+ {\xdef\MPllx{#1}\xdef\MPlly{#2}\xdef\MPurx{#3}\xdef\MPury{#4}%
+ \xdef\MPwidth {\the\dimexpr#3\onebasepoint-#1\onebasepoint\relax}%
+ \xdef\MPheight{\the\dimexpr#4\onebasepoint-#2\onebasepoint\relax}}
+
+\MPSboundingbox0000
+
+% \def\MPSspecial#1#2%
+% {\csname\@@MPSK#2\endcsname}
+
+%D A path is (in most cases) just a sequence of \PDF\ commands.
+
+% \newconditional\ignoreMPpath
+
+% \def\MPSpath
+% {\pdfliteral}
+
+% \def\MPScode % hack, will be improved
+% {\ifconditional\ignoreMPpath
+% \pdfliteral{h W n}%
+% \ifx\extraMPpathcode\empty\else
+% \pdfliteral{\extraMPpathcode}%
+% \let\extraMPpathcode\empty
+% \fi
+% \setfalse\ignoreMPpath
+% \expandafter\gobbleoneargument
+% \else
+% \expandafter\pdfliteral
+% \fi}
+
+%D Test code:
+
+% \startMPcode
+% fill fullcircle scaled 3cm withcolor red ;
+% fill fullcircle scaled 2cm withcolor green ;
+% fill fullcircle scaled 1cm withcolor blue ;
+% currentpicture := currentpicture shifted (-4cm,0) ;
+% fill fullcircle scaled 3cm withcolor cmyk(0,0,1,0) ;
+% fill fullcircle scaled 2cm withcolor cmyk(0,1,0,0) ;
+% fill fullcircle scaled 1cm withcolor cmyk(0,0,1,0) ;
+% currentpicture := currentpicture shifted (-4cm,0) ;
+% draw fullcircle scaled 3cm dashed evenly ;
+% draw fullcircle scaled 2cm dashed withdots ;
+% draw origin withpen pencircle scaled 3mm;
+% currentpicture := currentpicture shifted (-4cm,0) ;
+% fill fullcircle scaled 2cm shifted (-.5cm,+.5cm) withcolor transparent(1,.5,red);
+% fill fullcircle scaled 2cm shifted (-.5cm,-.5cm) withcolor transparent(1,.5,red);
+% fill fullcircle scaled 2cm shifted (+.5cm,+.5cm) withcolor transparent(1,.5,green);
+% fill fullcircle scaled 2cm shifted (+.5cm,-.5cm) withcolor transparent(1,.5,cmyk(1,0,1,.5));
+% currentpicture := currentpicture shifted (12cm,-4cm) ;
+% draw "o e p s" infont defaultfont scaled 2 shifted (-1cm,0) ;
+% currentpicture := currentpicture shifted (-4cm,0) ;
+% % bug: shift
+% draw fullcircle scaled 3cm withpen pencircle yscaled 3mm xscaled 2mm rotated 30 ;
+% draw fullcircle scaled 2cm withpen pencircle yscaled 3mm xscaled 2mm rotated 20 withcolor red ;
+% filldraw fullcircle scaled 1cm withpen pencircle yscaled 3mm xscaled 2mm rotated 10 withcolor green ;
+% currentpicture := currentpicture shifted (-4cm,0) ;
+% % shade cannot handle shift
+% circular_shade(fullcircle scaled 3cm,0,.2red,.9green) ;
+% circular_shade(fullcircle scaled 3cm shifted(+4cm,0),0,cmyk(1,0,0,0),cmyk(0,1,0,0)) ;
+% filldraw boundingbox currentpicture enlarged -3cm withpen pencircle scaled 1pt withcolor .5white ;
+% \stopMPcode
+
+% We cannot use attributes for switching colors in mp literals because
+% grouping (qQ) interferes.
+
+% \def\dohandleMPshade#1%
+% {\revokeMPtransparencyspecial
+% \settrue\ignoreMPpath
+% \def\extraMPpathcode{/#1 sh Q}%
+% \pdfliteral{q /Pattern cs}}
+
+\protect \endinput
diff --git a/tex/context/base/metatex.tex b/tex/context/base/metatex.tex
index c7ceb005d..df674c11a 100644
--- a/tex/context/base/metatex.tex
+++ b/tex/context/base/metatex.tex
@@ -37,12 +37,12 @@
\def\loadcorefile#1{\normalinput#1\relax}
-\loadcorefile{syst-ini.tex} % some basic commands and allocations that are expected down the line
-\loadcorefile{syst-pln.tex} % plain tex initializations of internal registers (no further code)
+\loadcorefile{syst-ini} % some basic commands and allocations that are expected down the line
+\loadcorefile{syst-pln} % plain tex initializations of internal registers (no further code)
-\loadcorefile{luat-cod.tex} %
-\loadcorefile{luat-bas.tex} %
-\loadcorefile{luat-lib.tex} %
+\loadmarkfile{luat-cod} %
+\loadmarkfile{luat-bas} %
+\loadmarkfile{luat-lib} %
% needs stripping:
@@ -54,12 +54,12 @@
% helpers, maybe less
-\loadcorefile{syst-aux.tex} % a whole lot of auxiliary macros
-%loadcorefile{syst-lua.tex} % some helpers using lua instead
-%loadcorefile{syst-con.mkiv} % some rather basic conversions
-%loadcorefile{syst-fnt.mkiv}
-%loadcorefile{syst-str.mkiv}
-%loadcorefile{syst-rtp.mkiv}
+\loadmarkfile{syst-aux} % a whole lot of auxiliary macros
+%loadmarkfile{syst-lua} % some helpers using lua instead
+%loadmarkfile{syst-con} % some rather basic conversions
+%loadmarkfile{syst-fnt}
+%loadmarkfile{syst-str}
+%loadmarkfile{syst-rtp}
% not needed
@@ -68,24 +68,24 @@
% characters
-\loadcorefile{char-utf.tex}
-\loadcorefile{char-ini.tex}
-\loadcorefile{char-enc.tex} % \registerctxluafile{char-enc}{1.001}
+\loadmarkfile{char-utf}
+\loadmarkfile{char-ini}
+\loadmarkfile{char-enc} % \registerctxluafile{char-enc}{1.001}
% nodes
-\loadcorefile{node-ini.tex}
-%loadcorefile{node-fin.tex}
-%loadcorefile{node-par.tex}
+\loadmarkfile{node-ini}
+%loadmarkfile{node-fin}
+%loadmarkfile{node-par}
% attributes, not needed:
-%loadcorefile{attr-ini.tex}
+%loadmarkfile{attr-ini}
% regimes
-% \loadcorefile{regi-ini.mkiv}
-% \loadcorefile{regi-syn.tex}
+% \loadmarkfile{regi-ini}
+% \loadcorefile{regi-syn}
% languages
@@ -132,10 +132,6 @@
%registerctxluafile{l-xml}{1.001} % needed for font database
-% plain
-
-%loadcorefile{syst-stp.tex} % stripped plain
-
% why not ...
\pdfoutput\plusone
diff --git a/tex/context/base/mlib-ctx.lua b/tex/context/base/mlib-ctx.lua
index 4d4e25a3d..2b16af28e 100644
--- a/tex/context/base/mlib-ctx.lua
+++ b/tex/context/base/mlib-ctx.lua
@@ -41,8 +41,15 @@ end
statistics.register("metapost processing time", function()
local n = metapost.n
if n > 0 then
- return format("%s seconds, loading: %s seconds, execution: %s seconds, n: %s",
- statistics.elapsedtime(metapost), statistics.elapsedtime(mplib), statistics.elapsedtime(metapost.exectime),n)
+ local e = metapost.externals.n
+ local str = format("%s seconds, loading: %s seconds, execution: %s seconds, n: %s",
+ statistics.elapsedtime(metapost), statistics.elapsedtime(mplib),
+ statistics.elapsedtime(metapost.exectime), n)
+ if e > 0 then
+ return format("%s, external: %s seconds (%s calls)", str, statistics.elapsedtime(metapost.externals), e)
+ else
+ return str
+ end
else
return nil
end
diff --git a/tex/context/base/mlib-pdf.lua b/tex/context/base/mlib-pdf.lua
index 8dfa5e552..b0b4bfe4f 100644
--- a/tex/context/base/mlib-pdf.lua
+++ b/tex/context/base/mlib-pdf.lua
@@ -293,7 +293,6 @@ function metapost.flush(result,flusher,askedfig) -- pdf flusher, table en dan co
prescript = object.prescript,
postscript = object.postscript,
}
- --~ print(table.serialize(currentobject))
--
local before, inbetween, after = nil, nil, nil
--
@@ -457,34 +456,32 @@ function metapost.parse(result,askedfig)
end
end
-do
+-- tracing:
- -- just tracing
+local t = { }
- local t = { }
-
- local flusher = {
- startfigure = function()
- t = { }
- texsprint(ctxcatcodes,"\\startnointerference")
- end,
- flushfigure = function(literals)
- for i=1, #literals do
- t[#t+1] = literals[i]
- end
- end,
- stopfigure = function()
- texsprint(ctxcatcodes,"\\stopnointerference")
+local flusher = {
+ startfigure = function()
+ t = { }
+ texsprint(ctxcatcodes,"\\startnointerference")
+ end,
+ flushfigure = function(literals)
+ for i=1, #literals do
+ t[#t+1] = literals[i]
end
- }
-
- function metapost.pdfliterals(result)
- metapost.flush(result,flusher)
- return t
+ end,
+ stopfigure = function()
+ texsprint(ctxcatcodes,"\\stopnointerference")
end
+}
+function metapost.pdfliterals(result)
+ metapost.flush(result,flusher)
+ return t
end
+-- so far
+
function metapost.totable(result)
local figure = result and result.fig and result.fig[1]
if figure then
@@ -510,6 +507,8 @@ function metapost.totable(result)
end
end
+-- will be overloaded later
+
function metapost.colorconverter()
return function(cr)
local n = #cr
diff --git a/tex/context/base/mlib-pdf.mkiv b/tex/context/base/mlib-pdf.mkiv
index 92fcb28ae..2681b0810 100644
--- a/tex/context/base/mlib-pdf.mkiv
+++ b/tex/context/base/mlib-pdf.mkiv
@@ -15,8 +15,6 @@
\registerctxluafile{mlib-pdf}{1.001}
-% \let\MPLIBtoPDF\pdfliteral
-
\def\MPLIBtoPDF#1{\ctxlua{metapost.flush_literal(#1)}}
\def\MPLIBboundingbox#1#2#3#4%
@@ -31,7 +29,7 @@
{\naturalhbox\bgroup
\doactivatecolor\s!black\forcecolorhack
\MPLIBboundingbox{#1}{#2}{#3}{#4}%
- \forgetall
+ %\forgetall % done already elsewhere
\setbox\scratchbox\vbox\bgroup
\noindent % this is really needed in order to force tex into proper cm's
\startMPresources}
@@ -81,7 +79,7 @@
{\font\temp=#1\space at #2\onebasepoint
\let\c\char
\temp
- \MPfshowcommand{#3}}%
+ #3}%
\setbox\scratchbox\hbox
{\hskip#4\onebasepoint
\raise#5\onebasepoint
diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua
index 04a9ba230..d5ce9e869 100644
--- a/tex/context/base/mlib-pps.lua
+++ b/tex/context/base/mlib-pps.lua
@@ -27,6 +27,7 @@ local cmyktogray = colors.cmyktogray or function() return 0 end
metapost = metapost or { }
metapost.specials = metapost.specials or { }
metapost.specials.data = metapost.specials.data or { }
+metapost.externals = metapost.externals or { n = 0 }
local data = metapost.specials.data
@@ -40,21 +41,25 @@ local colordata = { {}, {}, {}, {}, {} }
--~ => rest : r=123 g=n>10 b=whatever
local nooutercolor = "0 g 0 G"
-local nooutertransparency = "/Tr0 gs"
+local nooutertransparency = "/Tr0 gs" -- only when set
local outercolormode = 0
local outercolor = nooutercolor
local outertransparency = nooutertransparency
local innercolor = nooutercolor
local innertransparency = nooutertransparency
-function metapost.set_outer_color(mode,color,transparency)
+local pdfcolor, pdftransparency = lpdf.color, lpdf.transparency
+local registercolor, registerspotcolor = colors.register, colors.registerspotcolor
+local registertransparencies = transparencies.register
+
+function metapost.set_outer_color(mode,colormodel,colorattribute,transparencyattribute)
-- has always to be called before conversion
-- todo: transparency (not in the mood now)
outercolormode = mode
if mode == 1 or mode == 3 then
- -- inherit from outer
- outercolor = color or nooutercolor
- outertransparency = transparency or nooutertransparency
+ -- inherit from outer (registered color)
+ outercolor = pdfcolor(colormodel,colorattribute) or nooutercolor
+ outertransparency = pdftransparency(transparencyattribute) or nooutertransparency
elseif mode == 2 then
-- stand alone
outercolor = ""
@@ -63,8 +68,8 @@ function metapost.set_outer_color(mode,color,transparency)
outercolor = nooutercolor
outertransparency = nooutertransparency
end
- innercolor = outercolor
- innertransparency = outertransparency
+ innercolor = outercolor
+ innertransparency = outertransparency -- not yet used
end
local function checked_color_pair(color)
@@ -117,7 +122,12 @@ function metapost.specials.register(str) -- only colors
--~ end
end
-function metapost.colorhandler(cs, object, result, colorconverter)
+local function spotcolorconverter(parent, n, d, p)
+ registerspotcolor(parent)
+ return pdfcolor(colors.model,registercolor('color',nil,'spot',parent,n,d,p))
+end
+
+function metapost.colorhandler(cs, object, result, colorconverter) -- handles specials
local cr = outercolor
local what = round(cs[2]*10000)
local data = colordata[what]
@@ -129,16 +139,14 @@ function metapost.colorhandler(cs, object, result, colorconverter)
elseif what == 1 then
result[#result+1], cr = colorconverter({ data[2], data[3], data[4], data[5] })
elseif what == 2 then
- ctx.registerspotcolor(data[2])
- result[#result+1] = ctx.pdfcolor(colors.model,colors.register('color',nil,'spot',data[2],data[3],data[4],data[5]))
+ result[#result+1] = spotcolorconverter(data[2],data[3],data[4],data[5])
else
if what == 3 then
result[#result+1], cr = colorconverter({ data[3], data[4], data[5]})
elseif what == 4 then
result[#result+1], cr = colorconverter({ data[3], data[4], data[5], data[6]})
elseif what == 5 then
- ctx.registerspotcolor(data[3])
- result[#result+1] = ctx.pdfcolor(colors.model,colors.register('color',nil,'spot',data[3],data[4],data[5],data[6]))
+ result[#result+1] = spotcolorconverter(data[3],data[4],data[5],data[6])
end
object.prescript = "tr"
object.postscript = data[1] .. "," .. data[2]
@@ -147,30 +155,28 @@ function metapost.colorhandler(cs, object, result, colorconverter)
return object, cr
end
-function metapost.colorspec(cs)
+function metapost.colorspec(cs) -- used for shades ... returns table (for checking) or string (spot)
local what = round(cs[2]*10000)
local data = colordata[what][round(cs[3]*10000)]
if not data then
return { 0 }
elseif what == 1 then
- return { data[2], data[3], data[4], data[5] }
+ return { tonumber(data[2]), tonumber(data[3]), tonumber(data[4]), tonumber(data[5]) }
elseif what == 2 then
- ctx.registerspotcolor(data[2])
- return ctx.pdfcolor(colors.model,colors.register('color',nil,'spot',data[2],data[3],data[4],data[5]))
+ return spotcolorconverter(data[2],data[3],data[4],data[5])
elseif what == 3 then
- return { data[3], data[4], data[5] }
+ return { tonumber(data[3]), tonumber(data[4]), tonumber(data[5]) }
elseif what == 4 then
- return { data[3], data[4], data[5], data[6] }
+ return { tonumber(data[3]), tonumber(data[4]), tonumber(data[5]), tonumber(data[6]) }
elseif what == 5 then
- ctx.registerspotcolor(data[3])
- return ctx.pdfcolor(colors.model,colors.register('color',nil,'spot',data[3],data[4],data[5],data[6]))
+ return spotcolorconverter(data[3],data[4],data[5],data[6])
end
end
function metapost.specials.tr(specification,object,result)
local a, t = match(specification,"^(.+),(.+)$")
local before = a and t and function()
- result[#result+1] = format("/Tr%s gs",transparencies.register('mp',a,t))
+ result[#result+1] = format("/Tr%s gs",registertransparencies('mp',a,t))
return object, result
end
local after = before and function()
@@ -182,6 +188,7 @@ end
local specificationsplitter = lpeg.Ct(lpeg.splitat(" "))
local colorsplitter = lpeg.Ct(lpeg.splitat(":"))
+local colorsplitter = lpeg.Ct(lpeg.splitter(":",tonumber))
-- Unfortunately we cannot use cmyk colors natively because there is no
-- generic color allocation primitive ... it's just an rgbcolor color.. This
@@ -273,20 +280,12 @@ function metapost.specials.cs(specification,object,result,flusher) -- spot color
local cb = colorsplitter:match(t[8])
if round(ca[1]*10000) == 123 then ca = metapost.colorspec(ca) end
if round(cb[1]*10000) == 123 then cb = metapost.colorspec(cb) end
+ local name = format("MplSh%s",nofshades)
+ local domain = { tonumber(t[1]), tonumber(t[2]) }
+ local coordinates = { tonumber(t[5]), tonumber(t[6]), tonumber(t[7]), tonumber(t[9]), tonumber(t[10]), tonumber(t[11]) }
if type(ca) == "string" then
- -- spot color, not supported, maybe at some point use the fallbacks
- sprint(ctxcatcodes,format("\\MPLIBcircularshade{%s}{%s %s}{%.3f}{%.3f}{%s}{%s}{%s %s %s %s %s %s}",
- nofshades,
- t[1], t[2], 0, 1, 1, "DeviceGray",
- t[5], t[6], t[7], t[9], t[10], t[11]))
--- terrible hack, somehow does not work
---~ local a = ca:match("^([^ ]+)")
---~ local b = cb:match("^([^ ]+)")
---~ sprint(ctxcatcodes,format("\\xMPLIBcircularshade{%s}{%s %s}{%s}{%s}{%s}{%s}{%s %s %s %s %s %s}",
---~ nofshades,
---~ --~ t[1], t[2], a, b, 1, "DeviceN",
---~ 0, 1, a, b, 1, "DeviceN",
---~ t[5], t[6], t[7], t[9], t[10], t[11]))
+ -- backend specific (will be renamed)
+ lpdf.circularshade(name,domain,{ 0 },{ 1 },1,"DeviceGray",coordinates)
else
if #ca > #cb then
normalize(ca,cb)
@@ -307,10 +306,8 @@ function metapost.specials.cs(specification,object,result,flusher) -- spot color
ca[1], ca[2], ca[3] = a, a, a
cb[1], cb[2], cb[3] = b, b, b
end
- sprint(ctxcatcodes,format("\\MPLIBcircularshade{%s}{%s %s}{%.3f %.3f %.3f}{%.3f %.3f %.3f}{%s}{%s}{%s %s %s %s %s %s}",
- nofshades,
- t[1], t[2], ca[1], ca[2], ca[3], cb[1], cb[2], cb[3], 1, "DeviceRGB",
- t[5], t[6], t[7], t[9], t[10], t[11]))
+ -- backend specific (will be renamed)
+ lpdf.circularshade(name,domain,ca,cb,1,"DeviceRGB",coordinates)
elseif model == "cmyk" then
if #ca == 3 then
ca[1], ca[2], ca[3], ca[4] = rgbtocmyk(ca[1],ca[2],ca[3])
@@ -319,10 +316,8 @@ function metapost.specials.cs(specification,object,result,flusher) -- spot color
ca[1], ca[2], ca[3], ca[4] = 0, 0, 0, ca[1]
cb[1], cb[2], cb[3], ca[4] = 0, 0, 0, ca[1]
end
- sprint(ctxcatcodes,format("\\MPLIBcircularshade{%s}{%s %s}{%.3f %.3f %.3f %.3f}{%.3f %.3f %.3f %.3f}{%s}{%s}{%s %s %s %s %s %s}",
- nofshades,
- t[1], t[2], ca[1], ca[2], ca[3], ca[4], cb[1], cb[2], cb[3], cb[4], 1, "DeviceCMYK",
- t[5], t[6], t[7], t[9], t[10], t[11]))
+ -- backend specific (will be renamed)
+ lpdf.circularshade(name,domain,ca,cb,1,"DeviceCMYK",coordinates)
else
if #ca == 4 then
ca[1] = cmyktogray(ca[1],ca[2],ca[3],ca[4])
@@ -331,10 +326,8 @@ function metapost.specials.cs(specification,object,result,flusher) -- spot color
ca[1] = rgbtogray(ca[1],ca[2],ca[3])
cb[1] = rgbtogray(cb[1],cb[2],cb[3])
end
- sprint(ctxcatcodes,format("\\MPLIBcircularshade{%s}{%s %s}{%.3f}{%.3f}{%s}{%s}{%s %s %s %s %s %s}",
- nofshades,
- t[1], t[2], ca[1], cb[1], 1, "DeviceGray",
- t[5], t[6], t[7], t[9], t[10], t[11]))
+ -- backend specific (will be renamed)
+ lpdf.circularshade(name,domain,ca,cb,1,"DeviceGRAY",coordinates)
end
end
local before = function()
@@ -342,7 +335,7 @@ function metapost.specials.cs(specification,object,result,flusher) -- spot color
return object, result
end
local after = function()
- result[#result+1] = format("W n /MpSh%s sh Q", nofshades)
+ result[#result+1] = format("W n /%s sh Q", name)
return object, result
end
object.color, object.type = nil, nil
@@ -359,12 +352,12 @@ function metapost.specials.ls(specification,object,result,flusher)
local cb = colorsplitter:match(t[7])
if round(ca[1]*10000) == 123 then ca = metapost.colorspec(ca) end
if round(cb[1]*10000) == 123 then cb = metapost.colorspec(cb) end
+ local name = format("MpSh%s",nofshades)
+ local domain = { tonumber(t[1]), tonumber(t[2]) }
+ local coordinates = { tonumber(t[5]), tonumber(t[6]), tonumber(t[7]), tonumber(t[9]) }
if type(ca) == "string" then
- -- spot color, not supported, maybe at some point use the fallbacks
- sprint(ctxcatcodes,format("\\MPLIBlinearshade{%s}{%s %s}{%.3f}{%.3f}{%s}{%s}{%s %s %s %s}",
- nofshades,
- t[1], t[2], 0, 1, 1, "DeviceGray",
- t[5], t[6], t[8], t[9]))
+ -- backend specific (will be renamed)
+ lpdf.linearshade(name,domain,{ 0 },{ 1 },1,"DeviceGray",coordinates)
else
if #ca > #cb then
normalize(ca,cb)
@@ -384,10 +377,8 @@ function metapost.specials.ls(specification,object,result,flusher)
ca[1], ca[2], ca[3] = a, a, a
cb[1], cb[2], cb[3] = b, b, b
end
- sprint(ctxcatcodes,format("\\MPLIBlinearshade{%s}{%s %s}{%.3f %.3f %.3f}{%.3f %.3f %.3f}{%s}{%s}{%s %s %s %s}",
- nofshades,
- t[1], t[2], ca[1], ca[2], ca[3], cb[1], cb[2], cb[3], 1, "DeviceRGB",
- t[5], t[6], t[8], t[9]))
+ -- backend specific (will be renamed)
+ lpdf.linearshade(name,domain,ca,cb,1,"DeviceRGB",coordinates)
elseif model == "cmyk" then
if #ca == 3 then
ca[1], ca[2], ca[3], ca[4] = rgbtocmyk(ca[1],ca[2],ca[3])
@@ -396,10 +387,8 @@ function metapost.specials.ls(specification,object,result,flusher)
ca[1], ca[2], ca[3], ca[4] = 0, 0, 0, ca[1]
cb[1], cb[2], cb[3], ca[4] = 0, 0, 0, ca[1]
end
- sprint(ctxcatcodes,format("\\MPLIBlinearshade{%s}{%s %s}{%.3f %.3f %.3f %.3f}{%.3f %.3f %.3f %.3f}{%s}{%s}{%s %s %s %s}",
- nofshades,
- t[1], t[2], ca[1], ca[2], ca[3], ca[4], cb[1], cb[2], cb[3], cb[4], 1, "DeviceCMYK",
- t[5], t[6], t[8], t[9]))
+ -- backend specific (will be renamed)
+ lpdf.linearshade(name,domain,ca,cb,1,"DeviceCMYK",coordinates)
else
if #ca == 4 then
ca[1] = cmyktogray(ca[1],ca[2],ca[3],ca[4])
@@ -408,10 +397,8 @@ function metapost.specials.ls(specification,object,result,flusher)
ca[1] = rgbtogray(ca[1],ca[2],ca[3])
cb[1] = rgbtogray(cb[1],cb[2],cb[3])
end
- sprint(ctxcatcodes,format("\\MPLIBlinearshade{%s}{%s %s}{%.3f}{%.3f}{%s}{%s}{%s %s %s %s}",
- nofshades,
- t[1], t[2], ca[1], cb[1], 1, "DeviceGray",
- t[5], t[6], t[8], t[9]))
+ -- backend specific (will be renamed)
+ lpdf.linearshade(name,domain,ca,cb,1,"DeviceGRAY",coordinates)
end
end
local before = function()
@@ -419,7 +406,7 @@ function metapost.specials.ls(specification,object,result,flusher)
return object, result
end
local after = function()
- result[#result+1] = format("W n /MpSh%s sh Q", nofshades)
+ result[#result+1] = format("W n /%s sh Q", name)
return object, result
end
object.color, object.type = nil, nil
@@ -500,145 +487,146 @@ function metapost.specials.ts(specification,object,result,flusher)
end
end
+-- rather generic pdf, so use this elsewhere too it no longer pays
+-- off to distinguish between outline and fill (we now have both
+-- too, e.g. in arrows)
+
metapost.reducetogray = true
+local models = { }
-function metapost.colorconverter() -- rather generic pdf, so use this elsewhere too
- -- it no longer pays off to distinguish between outline and fill
- -- (we now have both too, e.g. in arrows)
- local model = colors.model
- local reduce = metapost.reducetogray
- if model == "all" then
- return function(cr)
- local n = #cr
- if n == 0 then
- return checked_color_pair()
- elseif reduce then
- if n == 1 then
- local s = cr[1]
- return checked_color_pair(format("%.3f g %.3f G",s,s))
- elseif n == 3 then
- local r, g, b = cr[1], cr[2], cr[3]
- if r == g and g == b then
- return checked_color_pair(format("%.3f g %.3f G",r,r))
- else
- return checked_color_pair(format("%.3f %.3f %.3f rg %.3f %.3f %.3f RG",r,g,b,r,g,b))
- end
- else
- local c, m, y, k = cr[1], cr[2], cr[3], cr[4]
- if c == m and m == y and y == 0 then
- k = 1 - k
- return checked_color_pair(format("%.3f g %.3f G",k,k))
- else
- return checked_color_pair(format("%.3f %.3f %.3f %.3f k %.3f %.3f %.3f %.3f K",c,m,y,k,c,m,y,k))
- end
- end
- elseif n == 1 then
- local s = cr[1]
- return checked_color_pair(format("%.3f g %.3f G",s,s))
- elseif n == 3 then
- local r, g, b = cr[1], cr[2], cr[3]
+function models.all(cr)
+ local n = #cr
+ if n == 0 then
+ return checked_color_pair()
+ elseif metapost.reducetogray then
+ if n == 1 then
+ local s = cr[1]
+ return checked_color_pair(format("%.3f g %.3f G",s,s))
+ elseif n == 3 then
+ local r, g, b = cr[1], cr[2], cr[3]
+ if r == g and g == b then
+ return checked_color_pair(format("%.3f g %.3f G",r,r))
+ else
return checked_color_pair(format("%.3f %.3f %.3f rg %.3f %.3f %.3f RG",r,g,b,r,g,b))
+ end
+ else
+ local c, m, y, k = cr[1], cr[2], cr[3], cr[4]
+ if c == m and m == y and y == 0 then
+ k = 1 - k
+ return checked_color_pair(format("%.3f g %.3f G",k,k))
else
- local c, m, y, k = cr[1], cr[2], cr[3], cr[4]
return checked_color_pair(format("%.3f %.3f %.3f %.3f k %.3f %.3f %.3f %.3f K",c,m,y,k,c,m,y,k))
end
end
- elseif model == "rgb" then
- return function(cr)
- local n = #cr
- if n == 0 then
- return checked_color_pair()
- elseif reduce then
- if n == 1 then
- local s = cr[1]
- checked_color_pair(format("%.3f g %.3f G",s,s))
- elseif n == 3 then
- local r, g, b = cr[1], cr[2], cr[3]
- if r == g and g == b then
- return checked_color_pair(format("%.3f g %.3f G",r,r))
- else
- return checked_color_pair(format("%.3f %.3f %.3f rg %.3f %.3f %.3f RG",r,g,b,r,g,b))
- end
- else
- local c, m, y, k = cr[1], cr[2], cr[3], cr[4]
- if c == m and m == y and y == 0 then
- k = 1 - k
- return checked_color_pair(format("%.3f g %.3f G",k,k))
- else
- local r, g, b = cmyktorgb(c,m,y,k)
- return checked_color_pair(format("%.3f %.3f %.3f rg %.3f %.3f %.3f RG",r,g,b,r,g,b))
- end
- end
- elseif n == 1 then
- local s = cr[1]
- return checked_color_pair(format("%.3f g %.3f G",s,s))
+ elseif n == 1 then
+ local s = cr[1]
+ return checked_color_pair(format("%.3f g %.3f G",s,s))
+ elseif n == 3 then
+ local r, g, b = cr[1], cr[2], cr[3]
+ return checked_color_pair(format("%.3f %.3f %.3f rg %.3f %.3f %.3f RG",r,g,b,r,g,b))
+ else
+ local c, m, y, k = cr[1], cr[2], cr[3], cr[4]
+ return checked_color_pair(format("%.3f %.3f %.3f %.3f k %.3f %.3f %.3f %.3f K",c,m,y,k,c,m,y,k))
+ end
+end
+
+function models.rgb(cr)
+ local n = #cr
+ if n == 0 then
+ return checked_color_pair()
+ elseif metapost.reducetogray then
+ if n == 1 then
+ local s = cr[1]
+ checked_color_pair(format("%.3f g %.3f G",s,s))
+ elseif n == 3 then
+ local r, g, b = cr[1], cr[2], cr[3]
+ if r == g and g == b then
+ return checked_color_pair(format("%.3f g %.3f G",r,r))
else
- local r, g, b
- if n == 3 then
- r, g, b = cmyktorgb(cr[1],cr[2],cr[3],cr[4])
- else
- r, g, b = cr[1], cr[2], cr[3]
- end
return checked_color_pair(format("%.3f %.3f %.3f rg %.3f %.3f %.3f RG",r,g,b,r,g,b))
end
- end
- elseif model == "cmyk" then
- return function(cr)
- local n = #cr
- if n == 0 then
- return checked_color_pair()
- elseif reduce then
- if n == 1 then
- local s = cr[1]
- return checked_color_pair(format("%.3f g %.3f G",s,s))
- elseif n == 3 then
- local r, g, b = cr[1], cr[2], cr[3]
- if r == g and g == b then
- return checked_color_pair(format("%.3f g %.3f G",r,r))
- else
- local c, m, y, k = rgbtocmyk(r,g,b)
- return checked_color_pair(format("%.3f %.3f %.3f %.3f k %.3f %.3f %.3f %.3f K",c,m,y,k,c,m,y,k))
- end
- else
- local c, m, y, k = cr[1], cr[2], cr[3], cr[4]
- if c == m and m == y and y == 0 then
- k = 1 - k
- return checked_color_pair(format("%.3f g %.3f G",k,k))
- else
- return checked_color_pair(format("%.3f %.3f %.3f %.3f k %.3f %.3f %.3f %.3f K",c,m,y,k,c,m,y,k))
- end
- end
- elseif n == 1 then
- local s = cr[1]
- return checked_color_pair(format("%.3f g %.3f G",s,s))
+ else
+ local c, m, y, k = cr[1], cr[2], cr[3], cr[4]
+ if c == m and m == y and y == 0 then
+ k = 1 - k
+ return checked_color_pair(format("%.3f g %.3f G",k,k))
else
- local c, m, y, k
- if n == 3 then
- c, m, y, k = rgbtocmyk(cr[1],cr[2],cr[3])
- else
- c, m, y, k = cr[1], cr[2], cr[3], cr[4]
- end
- return checked_color_pair(format("%.3f %.3f %.3f %.3f k %.3f %.3f %.3f %.3f K",c,m,y,k,c,m,y,k))
+ local r, g, b = cmyktorgb(c,m,y,k)
+ return checked_color_pair(format("%.3f %.3f %.3f rg %.3f %.3f %.3f RG",r,g,b,r,g,b))
end
end
+ elseif n == 1 then
+ local s = cr[1]
+ return checked_color_pair(format("%.3f g %.3f G",s,s))
else
- return function(cr)
- local n, s = #cr, 0
- if n == 0 then
- return checked_color_pair()
- elseif n == 4 then
- s = cmyktogray(cr[1],cr[2],cr[3],cr[4])
- elseif n == 3 then
- s = rgbtogray(cr[1],cr[2],cr[3])
+ local r, g, b
+ if n == 3 then
+ r, g, b = cmyktorgb(cr[1],cr[2],cr[3],cr[4])
+ else
+ r, g, b = cr[1], cr[2], cr[3]
+ end
+ return checked_color_pair(format("%.3f %.3f %.3f rg %.3f %.3f %.3f RG",r,g,b,r,g,b))
+ end
+end
+
+function models.cmyk(cr)
+ local n = #cr
+ if n == 0 then
+ return checked_color_pair()
+ elseif metapost.reducetogray then
+ if n == 1 then
+ local s = cr[1]
+ return checked_color_pair(format("%.3f g %.3f G",s,s))
+ elseif n == 3 then
+ local r, g, b = cr[1], cr[2], cr[3]
+ if r == g and g == b then
+ return checked_color_pair(format("%.3f g %.3f G",r,r))
else
- s = cr[1]
+ local c, m, y, k = rgbtocmyk(r,g,b)
+ return checked_color_pair(format("%.3f %.3f %.3f %.3f k %.3f %.3f %.3f %.3f K",c,m,y,k,c,m,y,k))
end
- return checked_color_pair(format("%.3f g %.3f G",s,s))
+ else
+ local c, m, y, k = cr[1], cr[2], cr[3], cr[4]
+ if c == m and m == y and y == 0 then
+ k = 1 - k
+ return checked_color_pair(format("%.3f g %.3f G",k,k))
+ else
+ return checked_color_pair(format("%.3f %.3f %.3f %.3f k %.3f %.3f %.3f %.3f K",c,m,y,k,c,m,y,k))
+ end
+ end
+ elseif n == 1 then
+ local s = cr[1]
+ return checked_color_pair(format("%.3f g %.3f G",s,s))
+ else
+ local c, m, y, k
+ if n == 3 then
+ c, m, y, k = rgbtocmyk(cr[1],cr[2],cr[3])
+ else
+ c, m, y, k = cr[1], cr[2], cr[3], cr[4]
end
+ return checked_color_pair(format("%.3f %.3f %.3f %.3f k %.3f %.3f %.3f %.3f K",c,m,y,k,c,m,y,k))
end
end
+function models.gray(cr)
+ local n, s = #cr, 0
+ if n == 0 then
+ return checked_color_pair()
+ elseif n == 4 then
+ s = cmyktogray(cr[1],cr[2],cr[3],cr[4])
+ elseif n == 3 then
+ s = rgbtogray(cr[1],cr[2],cr[3])
+ else
+ s = cr[1]
+ end
+ return checked_color_pair(format("%.3f g %.3f G",s,s))
+end
+
+function metapost.colorconverter()
+ return models[colors.model] or gray
+end
+
do
local P, S, V, Cs = lpeg.P, lpeg.S, lpeg.V, lpeg.Cs
@@ -829,6 +817,9 @@ end
function metapost.intermediate.actions.makempy()
if #graphics > 0 then
+ local externals = metapost.externals
+ externals.n = externals.n + 1
+ statistics.starttiming(externals)
local mpofile = tex.jobname .. "-mpgraph"
local mpyfile = file.replacesuffix(mpofile,"mpy")
local pdffile = file.replacesuffix(mpofile,"pdf")
@@ -846,6 +837,7 @@ function metapost.intermediate.actions.makempy()
io.savedata(mpyfile,concat(result,""))
end
end
- graphics = { }
+ statistics.stoptiming(externals)
+ graphics = { } -- ?
end
end
diff --git a/tex/context/base/mlib-pps.mkiv b/tex/context/base/mlib-pps.mkiv
index beaef044e..83880994b 100644
--- a/tex/context/base/mlib-pps.mkiv
+++ b/tex/context/base/mlib-pps.mkiv
@@ -15,15 +15,7 @@
\registerctxluafile{mlib-pps}{1.001}
-\def\MPLIBcircularshade#1#2#3#4#5#6#7% nr domain color-a color-b ? colorspace oordinates
- {\immediate\pdfobj{<>}%
- \immediate\pdfobj{<>}%
- \appendtoPDFdocumentshades{/MpSh#1 \the\pdflastobj\space0 R }}
-
-\def\MPLIBlinearshade#1#2#3#4#5#6#7% nr domain color-a color-b ? colorspace oordinates
- {\immediate\pdfobj{<>}%
- \immediate\pdfobj{<>}%
- \appendtoPDFdocumentshades{/MpSh#1 \the\pdflastobj\space0 R }}
+% this will move !
\def\MPLIBfigure#1#2#3#4#5#6#7% todo: move Q q to lua
{\setbox\scratchbox\hbox{\externalfigure[#7]}%
@@ -38,13 +30,7 @@
\def\MPLIBfreetext#1%
{\global\setbox#1\emptybox}
-% \def\MPLIBgettext#1#2#3#4#5#6#7% we can also use this for the figure and pass sx/sy
-% {\ctxlua{metapost.edefsxsy(\number\wd#7,\number\ht#7,\number\dp#7)}%
-% \pdfliteral{q #1 #2 #3 #4 #5 #6 cm}%
-% \vbox to \zeropoint{\vss\hbox to \zeropoint{\scale[sx=\sx,sy=\sy]{\raise\dp#7\box#7}\hss}}%
-% \pdfliteral{Q}}
-
-\def\MPLIBgettextscaled#1#2#3%
+\def\MPLIBgettextscaled#1#2#3% why a copy
{\vbox to \zeropoint{\vss\hbox to \zeropoint{\black\scale[sx=#2,sy=#3]{\raise\dp#1\copy#1}\hss}}}
\def\MPLIBallocate#1%
diff --git a/tex/context/base/mlib-run.lua b/tex/context/base/mlib-run.lua
index d22e0d742..b155dd344 100644
--- a/tex/context/base/mlib-run.lua
+++ b/tex/context/base/mlib-run.lua
@@ -116,7 +116,7 @@ function metapost.load(name)
ini_version = false,
mem_name = file.replacesuffix(name,"mem"),
find_file = finder,
---~ job_name = "mplib",
+ -- job_name = "mplib",
}
) )
local result
diff --git a/tex/context/base/mult-chk.lua b/tex/context/base/mult-chk.lua
index 1c74d2e38..2c1ab3c78 100644
--- a/tex/context/base/mult-chk.lua
+++ b/tex/context/base/mult-chk.lua
@@ -53,7 +53,7 @@ local function set(key,value)
end
end
-local pattern = aux.make_settings_to_hash_pattern(set,true)
+local pattern = aux.make_settings_to_hash_pattern(set,"tolerant")
function commands.getcheckedparameters(k,p,s)
if s and s ~= "" then
diff --git a/tex/context/base/mult-chk.mkii b/tex/context/base/mult-chk.mkii
index 6299d0cda..60f568a1e 100644
--- a/tex/context/base/mult-chk.mkii
+++ b/tex/context/base/mult-chk.mkii
@@ -15,6 +15,9 @@
%D No checking in \MKII.
+\def\gobbleparameters{\doquadrupleempty\dogobbleparameters} % todo: 1,2,3,4 case
+\def\dogobbleparameters[#1][#2][#3][#4]{}
+
\def\setvalidparameterkeys{\gobbleparameters} % forward reference, so no \let
\def\addvalidparameterkeys{\gobbleparameters} % forward reference, so no \let
diff --git a/tex/context/base/mult-cld.lua b/tex/context/base/mult-cld.lua
new file mode 100644
index 000000000..c9e922afe
--- /dev/null
+++ b/tex/context/base/mult-cld.lua
@@ -0,0 +1,174 @@
+if not modules then modules = { } end modules ['mult-cld'] = {
+ version = 1.001,
+ comment = "companion to mult-cld.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- This is an experiment: generating context code at the lua end. After all
+-- it is surprisingly simple to implement due to metatables. I was wondering
+-- if there was a more natural way to deal with commands at the lua end.
+-- Of course it's a bit slower but often more readable when mixed with lua
+-- code. It can also be handy when generating documents from databases or
+-- when constructing large tables or so.
+--
+-- Todo: optional checking against interface!
+
+context = context or { }
+
+local format, concat = string.format, table.concat
+local next, type = next, type
+local texsprint, texiowrite = tex.sprint, texio.write
+
+local flush = texsprint
+local cache
+
+local function cached_flush(c,...)
+ local tt = { ... }
+ for i=1,#tt do
+ cache[#cache+1] = tt[i]
+ end
+end
+
+local function writer(k,...)
+ flush(ctxcatcodes,k)
+ local t = { ... }
+ if next(t) then
+ for i=1,#t do
+ local ti = t[i]
+ local typ, force = type(ti), nil
+ while typ == "function" do
+ local saved_flush = flush
+ cache = { }
+ flush = cached_flush
+ ti, force = ti()
+ if force then
+ typ = false -- force special cases
+ elseif typ == "nil" then
+ typ = "string"
+ ti = concat(cache)
+ elseif typ == "string" then
+ ti = concat(cache)
+ end
+ flush = saved_flush
+ end
+ if ti == nil then
+ -- next
+ elseif typ == "string" or typ == "number" then
+ flush(ctxcatcodes,"{",ti,"}")
+ elseif typ == "table" then
+ flush(ctxcatcodes,"[")
+ local c = concat(ti,",")
+ if c ~= "" then
+ flush(ctxcatcodes,c)
+ else
+ local done = false
+ for k, v in next, ti do
+ if done then
+ flush(ctxcatcodes,",",k,'=',v)
+ else
+ flush(ctxcatcodes,k,'=',v)
+ done = true
+ end
+ end
+ end
+ flush(ctxcatcodes,"]")
+ -- elseif typ == "boolean" then
+ -- flush(ctxcatcodes,"\n")
+ elseif ti == true then
+ flush(ctxcatcodes,"\n")
+ elseif typ == false then
+ if force == "direct" then
+ flush(ctxcatcodes,tostring(ti))
+ end
+ else
+ logs.report("interfaces","error: %s gets a weird argument %s",k,tostring(ti))
+ end
+ end
+ end
+end
+
+local function indexer(t,k)
+ local f = function(...) return writer("\\"..k.." ",...) end -- building the cs here saves time
+ t[k] = f
+ return f
+end
+
+local function caller(t,f,...)
+ if f then
+ flush(ctxcatcodes,format(f,...))
+ else
+ flush(ctxcatcodes,"\n")
+ end
+end
+
+setmetatable(context, { __index = indexer, __call = caller } )
+
+-- the only non macro:
+
+local trace_cld = false
+
+function context.runfile(filename)
+ filename = resolvers.findtexfile(filename) or ""
+ if filename ~= "" then
+ local ok = dofile(filename)
+ if ok then
+ if trace_cld then
+ commands.writestatus("cld","begin of file '%s'",filename)
+ end
+ ok()
+ if trace_cld then
+ commands.writestatus("cld","end of file '%s'",filename)
+ end
+ else
+ commands.writestatus("cld","invalid file '%s'",filename)
+ end
+ else
+ commands.writestatus("cld","unknown file '%s'",filename)
+ end
+end
+
+-- tracking is using the regular mechanism; we need to define
+-- these 'macro' functions explictly as otherwise they are are
+-- delayed (as all commands print back to tex, so that tracing
+-- would be enabled afterwards)
+
+trackers.register("cld.print", function(v)
+ trace_cld = v
+ if v then
+ flush = function(c,...)
+ texiowrite(...)
+ texsprint(c,...)
+ end
+ else
+ flush = texsprint
+ end
+end)
+
+function context.enabletrackers (str) trackers.enable (str) end
+function context.disabletrackers(str) trackers.disable(str) end
+
+-- see demo-lud.lud for an example
+
+-- context.starttext(true)
+-- context.chapter({ "label" }, "title", true)
+-- context.chapter(function() return { "label" } end, "title", true)
+--
+-- context.startchapter({ title = "test" }, { more = "oeps" }, true)
+--
+-- context.bTABLE(true)
+-- for i=1,10 do
+-- context.bTR()
+-- for i=1,10 do
+-- context.bTD()
+-- context("%#2i",math.random(99))
+-- context.eTD()
+-- end
+-- context.eTR(true)
+-- end
+-- context.eTABLE(true)
+--
+-- context.stopchapter(true)
+--
+-- context.stoptext(true)
diff --git a/tex/context/base/mult-cld.mkiv b/tex/context/base/mult-cld.mkiv
new file mode 100644
index 000000000..050928658
--- /dev/null
+++ b/tex/context/base/mult-cld.mkiv
@@ -0,0 +1,20 @@
+%D \module
+%D [ file=mult-ini,
+%D version=2008.10.22, % 1996.06.01,
+%D title=\CONTEXT\ Multilingual Macros,
+%D subtitle=Initialization,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This is just an idea, maybe a bad one.
+
+\writestatus{loading}{ConTeXt Multilingual Macros / Lua}
+
+\registerctxluafile{mult-cld}{1.001}
+
+\endinput
diff --git a/tex/context/base/mult-de.tex b/tex/context/base/mult-de.tex
index c73223658..3213fa7de 100644
--- a/tex/context/base/mult-de.tex
+++ b/tex/context/base/mult-de.tex
@@ -233,6 +233,7 @@
\setinterfacevariable{lastpage}{letzteseite}
\setinterfacevariable{lastpagenumber}{lastpagenumber}
\setinterfacevariable{lastsubpage}{letzteunterseite}
+\setinterfacevariable{layer}{layer}
\setinterfacevariable{left}{links}
\setinterfacevariable{leftedge}{linkekante}
\setinterfacevariable{lefthanging}{lefthanging}
@@ -843,6 +844,7 @@
\setinterfaceconstant{sectionconversion}{sectionconversion}
\setinterfaceconstant{sectionconversionset}{sectionconversionset}
\setinterfaceconstant{sectionnumber}{abschnittsnummer}
+\setinterfaceconstant{sectionresetset}{sectionresetset}
\setinterfaceconstant{sectionsegments}{sectionsegments}
\setinterfaceconstant{sectionseparatorset}{sectionseparatorset}
\setinterfaceconstant{sectionset}{sectionset}
diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua
index dff747db1..2fea7dfe7 100644
--- a/tex/context/base/mult-def.lua
+++ b/tex/context/base/mult-def.lua
@@ -9766,6 +9766,9 @@ return {
["pe"]="شمارهبخش",
["ro"]="numarsectiune",
},
+ ["sectionresetset"]={
+ ["en"]="sectionresetset",
+ },
["sectionsegments"]={
["en"]="sectionsegments",
},
@@ -13352,6 +13355,16 @@ return {
["pe"]="زیرصفحهآخر",
["ro"]="ultimasubpagina",
},
+ ["layer"]={
+ ["cs"]="layer",
+ ["de"]="layer",
+ ["en"]="layer",
+ ["fr"]="layer",
+ ["it"]="layer",
+ ["nl"]="layer",
+ ["pe"]="layer",
+ ["ro"]="layer",
+ },
["left"]={
["cs"]="vlevo",
["de"]="links",
diff --git a/tex/context/base/mult-en.tex b/tex/context/base/mult-en.tex
index d9ece5dfd..50997b1d8 100644
--- a/tex/context/base/mult-en.tex
+++ b/tex/context/base/mult-en.tex
@@ -233,6 +233,7 @@
\setinterfacevariable{lastpage}{lastpage}
\setinterfacevariable{lastpagenumber}{lastpagenumber}
\setinterfacevariable{lastsubpage}{lastsubpage}
+\setinterfacevariable{layer}{layer}
\setinterfacevariable{left}{left}
\setinterfacevariable{leftedge}{leftedge}
\setinterfacevariable{lefthanging}{lefthanging}
@@ -843,6 +844,7 @@
\setinterfaceconstant{sectionconversion}{sectionconversion}
\setinterfaceconstant{sectionconversionset}{sectionconversionset}
\setinterfaceconstant{sectionnumber}{sectionnumber}
+\setinterfaceconstant{sectionresetset}{sectionresetset}
\setinterfaceconstant{sectionsegments}{sectionsegments}
\setinterfaceconstant{sectionseparatorset}{sectionseparatorset}
\setinterfaceconstant{sectionset}{sectionset}
diff --git a/tex/context/base/mult-fr.tex b/tex/context/base/mult-fr.tex
index cfc56cb5c..16f22ec7f 100644
--- a/tex/context/base/mult-fr.tex
+++ b/tex/context/base/mult-fr.tex
@@ -233,6 +233,7 @@
\setinterfacevariable{lastpage}{dernierepage}
\setinterfacevariable{lastpagenumber}{derniernumeropage}
\setinterfacevariable{lastsubpage}{dernieresouspage}
+\setinterfacevariable{layer}{layer}
\setinterfacevariable{left}{gauche}
\setinterfacevariable{leftedge}{bordgauche}
\setinterfacevariable{lefthanging}{lefthanging}
@@ -843,6 +844,7 @@
\setinterfaceconstant{sectionconversion}{sectionconversion}
\setinterfaceconstant{sectionconversionset}{sectionconversionset}
\setinterfaceconstant{sectionnumber}{numerosection}
+\setinterfaceconstant{sectionresetset}{sectionresetset}
\setinterfaceconstant{sectionsegments}{sectionsegments}
\setinterfaceconstant{sectionseparatorset}{sectionseparatorset}
\setinterfaceconstant{sectionset}{sectionset}
diff --git a/tex/context/base/mult-his.tex b/tex/context/base/mult-his.tex
deleted file mode 100644
index fe87d4bcf..000000000
--- a/tex/context/base/mult-his.tex
+++ /dev/null
@@ -1,1155 +0,0 @@
-%D \module
-%D [ file=mult-ini,
-%D version=1996.06.01,
-%D title=\CONTEXT\ Multilingual Macros,
-%D subtitle=Initialization,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D This module implements the multi||lingual interface to
-%D \CONTEXT. These capabilities concern messages, commands and
-%D parameters. Currently the following interfaces are
-%D supported:
-%D
-%D \starttabulate[|l|l|c|c|]
-%D \NC\bf language\NC\bf translator \NC\bf messages\NC \bf interface\NC\NR
-%D \NC dutch \NC Hans Hagen \NC yes \NC yes \NC\NR
-%D \NC english \NC Hans Hagen \& SPQR \NC yes \NC yes \NC\NR
-%D \NC german \NC Tobias Burnus \NC yes \NC yes \NC\NR
-%D \NC czech \NC Tom Hudec \NC yes \NC yes \NC\NR
-%D \NC italian \NC Giuseppe Bilotta \NC yes \NC yes \NC\NR
-%D \NC french \NC Renaud Aubin \NC yes \NC yes \NC\NR
-%D \NC romanian \NC .... \NC yes \NC yes \NC\NR
-%D \NC norwegian \NC Hans Fredrik Nordhaug \NC yes \NC no \NC\NR
-%D \stoptabulate
-
-%D to be translated:
-%D
-%D message : floatblocks/13
-%D variables : sorttype compress autohang
-
-\writestatus{loading}{ConTeXt Multilingual Macros / Initialization}
-
-\unprotect
-
-%D \macros
-%D [constanten,variabelen,commands]
-%D {v!,c!,k!,s!,e!,m!,l!,r!,f!,p!,x!,y!}
-%D
-%D In the system modules we introduced some prefixed constants,
-%D variables (both macros) and registers. Apart from a
-%D tremendous saving in terms of memory and a gain in speed we
-%D use from now on prefixes when possible for just another
-%D reason: consistency and multi||linguality. Systematically
-%D using prefixed macros enables us to implement a
-%D multi||lingual user interface. Redefining these next set of
-%D prefixes therefore can have desastrous results.
-%D
-%D \startlinecorrection
-%D \starttable[|c|c|c|]
-%D \HL
-%D \NC \bf prefix \NC \bf meaning \NC \bf application \NC\SR
-%D \HL
-%D \NC \type{\c!prefix!} \NC c! \NC constant (direct) \NC\FR
-%D \NC \type{\e!prefix!} \NC e! \NC element \NC\MR
-%D \NC \type{\f!prefix!} \NC f! \NC file \NC\MR
-%D \NC \type{\k!prefix!} \NC k! \NC constant (indirect) \NC\MR
-%D \NC \type{\l!prefix!} \NC l! \NC language \NC\MR
-%D \NC \type{\m!prefix!} \NC m! \NC message \NC\MR
-%D \NC \type{\p!prefix!} \NC p! \NC procedure \NC\MR
-%D \NC \type{\r!prefix!} \NC r! \NC reference \NC\MR
-%D \NC \type{\s!prefix!} \NC s! \NC system \NC\MR
-%D \NC \type{\v!prefix!} \NC v! \NC variable \NC\MR
-%D \NC \type{\x!prefix!} \NC x! \NC setup constant \NC\MR
-%D \NC \type{\y!prefix!} \NC y! \NC setup variable \NC\LR
-%D \HL
-%D \stoptable
-%D \stoplinecorrection
-%D
-%D In the single||lingual version we used \type{!}, \type{!!},
-%D \type{!!!} and \type{!!!!}.
-
-\def\c!prefix!{c!} \def\e!prefix!{e!} \def\f!prefix!{f!}
-\def\k!prefix!{k!} \def\l!prefix!{l!} \def\m!prefix!{m!}
-\def\p!prefix!{p!} \def\r!prefix!{r!} \def\s!prefix!{s!}
-\def\v!prefix!{v!} \def\t!prefix!{t!}
-
-% \def\x!prefix!{x!} % obsolete
-% \def\y!prefix!{y!} % obsolete
-
-%D \macros
-%D [constants,variables,commands]
-%D {@@,??}
-%D
-%D Variables generated by the system can be recognized on their
-%D prefix \type{@@}. They are composed of a command (class)
-%D specific tag, which can be recognized on \type{??}, and a
-%D system constant, which has the prefix \type{c!}. We'll se
-%D some more of this.
-
-\def\??prefix {??}
-\def\@@prefix {@@}
-
-%D Just to be complete we repeat some of the already defined
-%D system constants here. Maybe their prefix \type{\s!} now
-%D falls into place.
-
-\def\s!next {next} \def\s!default {default}
-\def\s!dummy {dummy} \def\s!unknown {unknown}
-
-\def\s!do {do} \def\s!dodo {dodo}
-
-\def\s!complex {complex} \def\s!start {start}
-\def\s!simple {simple} \def\s!stop {stop}
-
-%D The word \type{height} takes 6~token memory cells. The
-%D control sequence \type{\height} on the other hand uses only
-%D one. Knowing this, we can improve the performance of \TEX,
-%D both is terms of speed and memory usage, by using control
-%D sequences instead of the words written in full.
-%D
-%D Where in the \ASCII\ file the second lines takes nine extra
-%D characters, \TEX\ saves us 13~tokens.
-%D
-%D \starttyping
-%D \hrule width 10pt height 2pt depth 1pt
-%D \hrule \!!width 10pt \!!height 2pt \!!depth 1pt
-%D \stoptyping
-%D
-%D One condition is that we have defined \type{\!!height},
-%D \type{\!!width} and \type{\!!depth} as respectively
-%D \type{height}, \type{width} and \type{depth}. Using this
-%D scheme therefore only makes sense when a token sequence is
-%D used more than once. Savings like this should of course be
-%D implemented in english, just because \TEX\ is english.
-
-\def\!!width {width}
-\def\!!height {height}
-\def\!!depth {depth}
-\def\!!plus {plus}
-\def\!!minus {minus}
-\def\!!fill {fill}
-\def\!!to {to}
-
-%D \macros
-%D {defineinterfaceconstant,
-%D defineinterfacevariable,
-%D defineinterfaceelement,
-%D definesystemvariable,
-%D definesystemconstant,
-%D definemessageconstant,
-%D definereferenceconstant,
-%D definefileconstant}
-%D
-%D The first part of this module is dedicated to dealing with
-%D multi||lingual constants and variables. When \CONTEXT\ grew
-%D bigger and bigger in terms of bytes and used string space,
-%D we switched to predefined constants. At the cost of more
-%D hash table entries, the macros not only becase more compact,
-%D they became much faster too. Maybe an even bigger advantage
-%D was that mispelling could no longer lead to problems. Even a
-%D multi||lingual interface became possible.
-%D
-%D Constants --- we'll introduce the concept of variables later
-%D on --- are preceded by a type specific prefix, followed by a
-%D \type{!}. To force consistency, we provide a few commands
-%D for defining such constants.
-%D
-%D \starttyping
-%D \defineinterfaceconstant {name} {meaning}
-%D \defineinterfacevariable {name} {meaning}
-%D \defineinterfaceelement {name} {meaning}
-%D \stoptyping
-%D
-%D Which is the same as:
-%D
-%D \starttyping
-%D \def\c!name{meaning}
-%D \def\v!name{meaning}
-%D \def\e!name{meaning}
-%D \stoptyping
-
-\def\defineinterfaceconstant #1#2{\setvalue{\c!prefix!#1}{#2}}
-\def\defineinterfacevariable #1#2{\setvalue{\v!prefix!#1}{#2}}
-\def\defineinterfaceelement #1#2{\setvalue{\e!prefix!#1}{#2}}
-
-%D Next come some interface independant constants:
-%D
-%D \starttyping
-%D \definereferenceconstant {name} {meaning}
-%D \definefileconstant {name} {meaning}
-%D \stoptyping
-
-\def\definereferenceconstant #1#2{\setvalue{\r!prefix!#1}{#2}}
-\def\definefileconstant #1#2{\setvalue{\f!prefix!#1}{#2}}
-
-%D A new one:
-
-\def\definetypescriptconstant#1#2{\setvalue{\t!prefix!#1}{#2}}
-
-%D And finaly we have the one argument, space saving constants
-%D
-%D \starttyping
-%D \definesystemconstant {name}
-%D \definemessageconstant {name}
-%D \stoptyping
-
-\def\definesystemconstant #1{\setvalue{\s!prefix!#1}{#1}}
-\def\definemessageconstant #1{\setvalue{\m!prefix!#1}{#1}}
-
-%D In a parameter driven system, some parameters are shared
-%D by more system components. In \CONTEXT\ we can distinguish
-%D parameters by a unique prefix. Such a prefix is defined
-%D with:
-%D
-%D \starttyping
-%D \definesystemvariable {name}
-%D \stoptyping
-
-\def\definesystemvariable#1{\setevalue{\??prefix#1}{\@@prefix#1}}
-
-\definesystemvariable{ms}
-
-%D \macros
-%D {selectinterface,
-%D defaultinterface, currentinterface, currentresponses}
-%D
-%D With \type{\selectinterface} we specify the language we are
-%D going to use. The system asks for the language wanted, and
-%D defaults to \type{\currentinterface} when we just give
-%D \type{enter}. By default the message system uses the
-%D current interface language, but \type{\currentresponses}
-%D can specify another language too.
-%D
-%D Because we want to generate formats directly too, we do
-%D not ask for interface specifications when these are already
-%D defined (like in cont-nl.tex and alike).
-
-\ifx\undefined\scratchwrite \newwrite\scratchwrite \fi
-\ifx\undefined\scratchread \newwrite\scratchread \fi
-
-\immediate\openin\scratchread=mult-def.tex % may overload the defaults
-
-\ifeof\scratchread % no high level commands yet
- \immediate\closein\scratchread
-\else
- \immediate\closein\scratchread \input mult-def.tex
-\fi
-
-\ifx\defaultinterface\undefined
-
- \def\defaultinterface{english}
-
- \def\selectinterface
- {\def\docommand##1##2%
- {\bgroup
- \endlinechar\minusone
- \global\read16 to ##1
- \egroup
- \doifnothing\currentinterface{\let##1=##2}%
- \doifundefined{\s!prefix!##1}{\let##1=##2}}%
- \docommand\currentinterface\defaultinterface
- \writestatus{interface}{defining \currentinterface\space interface}%
- \writeline
- \docommand\currentresponses\currentinterface
- \writestatus{interface}{using \currentresponses\space messages}%
- \writeline
- \let\selectinterface\relax}
-
-\else
-
- \def\selectinterface
- {\writestatus{interface}{defining \currentinterface\space interface}%
- \writeline
- \writestatus{interface}{using \currentresponses\space messages}%
- \writeline
- \let\selectinterface\relax}
-
-\fi
-
-\ifx\currentinterface\undefined \let\currentinterface=\defaultinterface \fi
-\ifx\currentresponses\undefined \let\currentresponses=\defaultinterface \fi
-
-%D \macros
-%D {startinterface}
-%D
-%D Sometimes we want to define things only for specific
-%D interface languages. This can be done by means of the
-%D selector:
-%D
-%D \starttyping
-%D \startinterface language
-%D
-%D language specific definitions & commands
-%D
-%D \stopinterface
-%D \stoptyping
-
-\def\startinterface #1
- {\doifnotinset\currentinterface{#1}{\gobbleuntil\stopinterface}}
-
-\let\stopinterface\relax
-
-%D \macros
-%D {startmessages,
-%D getmessage,
-%D showmessage,
-%D makemessage}
-%D
-%D A package as large as \CONTEXT\ can hardly function without
-%D a decent message mechanism. Due to its multi||lingual
-%D interface, the message subsystem has to be multi||lingual
-%D too. A major drawback of this feature is that we have to
-%D code messages. As a result, the source becomes less self
-%D documented. On the other hand, consistency will improve.
-%D
-%D Because the overhead in terms of entries in the (already
-%D exhausted) hash table has to be minimal, messages are packed
-%D in libraries. We can extract a message from such a library
-%D in three ways:
-%D
-%D \starttyping
-%D \getmessage {library} {tag}
-%D \showmessage {library} {tag} {data}
-%D \makemessage {library} {tag} {data}
-%D \stoptyping
-%D
-%D The first command gets the message \type{tag} from the
-%D \type{library} specified. The other commands take an extra
-%D argument: a list of items to be inserted in the message
-%D text. While \type{\showmessage} shows the message at the
-%D terminal, the other commands generate the message as text.
-%D Before we explain the \type{data} argument, we give an
-%D example of a library.
-%D
-%D \starttyping
-%D % messages moved
-%D \stoptyping
-%D
-%D The first message is a simple one and can be shown with:
-%D
-%D \starttyping
-%D \showmessage {alfa} {1} {}
-%D \stoptyping
-%D
-%D The second message on the other hand needs some extra data:
-%D
-%D \starttyping
-%D \showmessage {alfa} {2} {and last,to you}
-%D \stoptyping
-%D
-%D This message is shown as:
-%D
-%D \starttyping
-%D something : second (and last) message to you
-%D \stoptyping
-%D
-%D As we can see, the title entry is shown with the message.
-%D The data fields are comma separated and are specified in the
-%D message text by \type{--}.
-%D
-%D It is not required to define all messages in a library at
-%D once. We can add messages to a library in the following way:
-%D
-%D \starttyping
-%D % messages moved
-%D \stoptyping
-%D
-%D Because such definitions can take place in different
-%D modules, the system gives a warning when a tag occurs more
-%D than once. The first occurrence takes preference over later
-%D ones, so we had better use a save offset, as shown in the
-%D example. As we can see, the title field is specified only
-%D the first time!
-%D
-%D Because we want to check for duplicate tags, the macros
-%D are a bit more complicated than neccessary. The \NEWLINE\
-%D token is used as message separator.
-%D
-%D For internal purposes one can use \type {\setmessagetext},
-%D which puts the message text asked for in \type
-%D {\currentmessagetext}.
-
-\loadmarkfile{mult-ini}
-
-%D \macros
-%D {ifshowwarnings, ifshowmessages}
-%D
-%D Sometimes displaying message can slow down processing
-%D considerably. We therefore introduce warnings. Users can
-%D turn of warnings and messages by saying:
-%D
-%D \starttyping
-%D \showwarningstrue
-%D \showmessagestrue
-%D \stoptyping
-%D
-%D Turning off messages also turns off warnings, which is
-%D quote logical because they are less important.
-
-% not yet mkiv
-
-\newif\ifshowwarnings \showwarningstrue
-\newif\ifshowmessages \showmessagestrue
-
-\let\normalshowmessage\showmessage
-
-\def\showwarning
- {\ifshowwarnings
- \expandafter\showmessage
- \else
- \expandafter\gobblethreearguments
- \fi}
-
-\def\showmessage
- {\ifshowmessages
- \expandafter\normalshowmessage
- \else
- \expandafter\gobblethreearguments
- \fi}
-
-%D \macros
-%D {dosetvalue,dosetevalue,dosetgvalue,dosetxvalue,docopyvalue,doresetvalue} % dogetvalue
-%D
-%D We already defined these auxiliary macros in the system
-%D modules. Starting with this module however, we have to take
-%D multi||linguality a bit more serious.
-%D
-%D First we show a well||defined (simplified) alternative:
-%D
-%D \starttyping
-%D \def\dosetvalue#1#2#3%
-%D {\doifdefinedelse{\c!prefix!#2}
-%D {\setvalue{#1\getvalue{\c!prefix!#2}}{#3}}
-%D {\setvalue{#1#2}{#3}}}
-%D
-%D \def\docopyvalue#1#2#3%
-%D {\doifdefinedelse{\c!prefix!#3}
-%D {\setvalue{#1\getvalue{\c!prefix!#3}}%
-%D {\getvalue{#2\getvalue{\c!prefix!#3}}}}
-%D {\setvalue{#1#3}%
-%D {\getvalue{#2#3}}}}
-%D \stoptyping
-%D
-%D These macros are called upon quite often and so we optimized
-%D them a bit.
-%D
-%D \starttyping
-%D \def\dosetvalue#1#2#3%
-%D {\let\c!internal!\c!internal!n
-%D \p!doifundefined{\k!prefix!#2}%
-%D \let\c!internal!\c!internal!y
-%D \let\donottest\doprocesstest
-%D \@EA\def\csname#1#2\endcsname{#3}%
-%D \else
-%D \let\c!internal!\c!internal!y
-%D \let\donottest\doprocesstest
-%D \@EA\def\csname#1\csname\k!prefix!#2\endcsname\endcsname{#3}%
-%D \fi}
-%D
-%D \def\dosetevalue#1#2#3%
-%D {\let\c!internal!\c!internal!n
-%D \p!doifundefined{\k!prefix!#2}%
-%D \let\c!internal!\c!internal!y
-%D \let\donottest\doprocesstest
-%D \@EA\edef\csname#1#2\endcsname{#3}%
-%D \else
-%D \let\c!internal!\c!internal!y
-%D \let\donottest\doprocesstest
-%D \@EA\edef\csname#1\csname\k!prefix!#2\endcsname\endcsname{#3}%
-%D \fi}
-%D
-%D \def\dosetgvalue#1#2#3%
-%D {\let\c!internal!\c!internal!n
-%D \p!doifundefined{\k!prefix!#2}%
-%D \let\c!internal!\c!internal!y
-%D \let\donottest\doprocesstest
-%D \@EA\gdef\csname#1#2\endcsname{#3}%
-%D \else
-%D \let\c!internal!\c!internal!y
-%D \let\donottest\doprocesstest
-%D \@EA\gdef\csname#1\csname\k!prefix!#2\endcsname\endcsname{#3}%
-%D \fi}
-%D
-%D \def\docopyvalue#1#2#3%
-%D {\let\c!internal!\c!internal!n
-%D \p!doifundefined{\k!prefix!#3}%
-%D \let\c!internal!\c!internal!y
-%D \let\donottest\doprocesstest % still needed ?
-%D \@EA\def\csname#1#3\endcsname%
-%D {\csname#2#3\endcsname}%
-%D \else
-%D \let\c!internal!\c!internal!y
-%D \let\donottest\doprocesstest % still needed ?
-%D \@EA\def\csname#1\csname\k!prefix!#3\endcsname\endcsname%
-%D {\csname#2\csname\k!prefix!#3\endcsname\endcsname}%
-%D \fi}
-%D \stoptyping
-
-\def\doresetvalue#1#2%
- {\dosetvalue{#1}{#2}{}}
-
-\def\doignorevalue#1#2#3%
- {\dosetvalue{#1}{#2}{}}
-
-% \def\dogetvalue#1#2%
-% {\csname#1\csname\k!prefix!#2\endcsname\endcsname}
-
-%D Although maybe not clearly visible, there is a
-%D considerable profit in further optimization. By expanding
-%D the embedded \type {\csname} we can reduce the format file
-%D by about 5\% (60~KB out of 1.9~MB).
-%D
-%D \starttyping
-%D \def\docopyvalue#1#2#3% c -> k
-%D {\p!doifundefined{\k!prefix!#3}%
-%D \let\donottest\doprocesstest
-%D \@EAEAEA\def\@EA
-%D \csname\@EA#1\@EA#3\@EA
-%D \endcsname\@EA{\csname#2#3\endcsname}%
-%D \else
-%D \let\donottest\doprocesstest
-%D \@EAEAEA\def\@EA
-%D \csname\@EA#1\@EA\csname\@EA\k!prefix!\@EA#3\@EA\endcsname\@EA
-%D \endcsname\@EA{\csname#2\csname\k!prefix!#3\endcsname\endcsname}%
-%D \fi}
-%D \stoptyping
-%D
-%D The next alternatives are slightly faster.
-
-\def\dosetvalue#1#2%
- {\let\c!internal!\c!internal!n
- \ifcsname\k!prefix!#2\endcsname
- \let\c!internal!\c!internal!y
- \@EA\def\csname#1\csname\k!prefix!#2\endcsname%\endcsname
- \else
- \let\c!internal!\c!internal!y
- \@EA\def\csname#1#2%\endcsname
- \fi\endcsname}
-
-\def\dosetevalue#1#2%
- {\let\c!internal!\c!internal!n
- \ifcsname\k!prefix!#2\endcsname
- \let\c!internal!\c!internal!y
- \@EA\edef\csname#1\csname\k!prefix!#2\endcsname%\endcsname
- \else
- \let\c!internal!\c!internal!y
- \@EA\edef\csname#1#2%\endcsname
- \fi\endcsname}
-
-\def\dosetgvalue#1#2%
- {\let\c!internal!\c!internal!n
- \ifcsname\k!prefix!#2\endcsname
- \let\c!internal!\c!internal!y
- \@EA\gdef\csname#1\csname\k!prefix!#2\endcsname%\endcsname
- \else
- \let\c!internal!\c!internal!y
- \@EA\gdef\csname#1#2%\endcsname
- \fi\endcsname}
-
-\def\dosetxvalue#1#2%
- {\let\c!internal!\c!internal!n
- \ifcsname\k!prefix!#2\endcsname
- \let\c!internal!\c!internal!y
- \@EA\xdef\csname#1\csname\k!prefix!#2\endcsname%\endcsname
- \else
- \let\c!internal!\c!internal!y
- \@EA\xdef\csname#1#2%\endcsname
- \fi\endcsname}
-
-\def\docopyvalue#1#2#3% real tricky expansion, quite unreadable
- {\let\c!internal!\c!internal!n
- \ifcsname\k!prefix!#3\endcsname
- \let\c!internal!\c!internal!y
- \@EA\def\csname#1\csname\k!prefix!#3\endcsname
- \@EA\endcsname\@EA{\csname#2\csname\k!prefix!#3\endcsname\endcsname}%
- \else
- \let\c!internal!\c!internal!y
- \@EA\def\csname#1#3\@EA\endcsname\@EA{\csname#2#3\endcsname}%
- \fi}
-
-%D We can now redefine some messages that will be
-%D introduced in the multi||lingual system module.
-
-\def\showassignerror #1#2{\showmessage\m!check1{#1,#2}\waitonfatalerror}
-\def\showargumenterror#1#2{\showmessage\m!check2{#1,#2}\waitonfatalerror}
-\def\showdefinederror #1#2{\showmessage\m!check3{#1,#2}\waitonfatalerror}
-
-%D \CONTEXT\ is a parameter driven package. This means that
-%D users instruct the system by means of variables, values and
-%D keywords. These instructions take the form:
-%D
-%D \starttyping
-%D \setupsomething[some variable=some value, another one=a keyword]
-%D \stoptyping
-%D
-%D or by keyword only:
-%D
-%D \starttyping
-%D \dosomething[this way,that way,no way]
-%D \stoptyping
-%D
-%D Because the same variables can occur in more than one setup
-%D command, we have to be able to distinguish them. This is
-%D achieved by assigning them a unique prefix.
-%D
-%D Imagine a setup command for boxed text, that enables us to
-%D specify the height and width of the box. Behide the scenes
-%D the command
-%D
-%D \starttyping
-%D \setupbox [width=12cm, height=3cm]
-%D \stoptyping
-%D
-%D results in something like
-%D
-%D \starttyping
-%D \ {12cm}
-%D \ {3cm}
-%D \stoptyping
-%D
-%D while a similar command for specifying the page dimensions
-%D of an \cap{A4} page results in:
-%D
-%D \starttyping
-%D \ {21.0cm}
-%D \ {27.9cm}
-%D \stoptyping
-%D
-%D The prefixes \type{} and \type{} are hidden from
-%D users and can therefore be language independant. Variables
-%D on the other hand, differ for each language:
-%D
-%D \starttyping
-%D \ {}
-%D \ {}
-%D \ {}
-%D \stoptyping
-%D
-%D In this example we can see that the assigned values or
-%D keywords are language dependant too. This will be a
-%D complication when defining multi||lingual setup files.
-%D
-%D A third phenomena is that variables and values can have a
-%D similar meaning.
-%D
-%D \starttyping
-%D \ {}
-%D \ {12cm}
-%D \stoptyping
-%D
-%D A (minor) complication is that where in english we use
-%D \type{}, in dutch we find both \type{} and
-%D \type{}. This means that when we use some sort of
-%D translation table, we have to distinguish between the
-%D variables at the left side and the fixed values at the
-%D right.
-%D
-%D The same goes for commands that are composed of different
-%D user supplied and/or language specific elements. In english
-%D we can use:
-%D
-%D \starttyping
-%D \