From 32f8047624c2fa49c3031a66edb5a039a813f276 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sun, 4 Jun 2017 17:42:38 +0200 Subject: 2017-06-04 17:01:00 --- .../documents/general/manuals/rules-mkiv.pdf | Bin 155730 -> 155746 bytes doc/context/documents/general/qrcs/setup-cs.pdf | Bin 843684 -> 845018 bytes doc/context/documents/general/qrcs/setup-de.pdf | Bin 841934 -> 842943 bytes doc/context/documents/general/qrcs/setup-en.pdf | Bin 846823 -> 847214 bytes doc/context/documents/general/qrcs/setup-fr.pdf | Bin 840815 -> 841488 bytes doc/context/documents/general/qrcs/setup-it.pdf | Bin 842897 -> 843081 bytes doc/context/documents/general/qrcs/setup-nl.pdf | Bin 839028 -> 840035 bytes doc/context/documents/general/qrcs/setup-ro.pdf | Bin 839482 -> 840119 bytes .../presentations/examples/present-weird-001.pdf | Bin 0 -> 334905 bytes .../presentations/examples/present-weird-001.tex | 113 ++++++ .../general/manuals/luatex/luatex-fonts.tex | 64 +++- .../sources/general/manuals/rules/rules-mkiv.tex | 2 +- scripts/context/lua/mtxrun.lua | 26 +- scripts/context/stubs/mswin/mtxrun.lua | 26 +- scripts/context/stubs/unix/mtxrun | 26 +- scripts/context/stubs/win64/mtxrun.lua | 26 +- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/cont-fil.mkiv | 3 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/font-ctx.lua | 113 ++++-- tex/context/base/mkiv/font-emp.mkvi | 18 +- tex/context/base/mkiv/font-hsh.lua | 2 +- tex/context/base/mkiv/font-ini.lua | 4 +- tex/context/base/mkiv/font-ots.lua | 18 +- tex/context/base/mkiv/font-pre.mkiv | 8 +- tex/context/base/mkiv/font-sol.lua | 2 +- tex/context/base/mkiv/font-sty.mkvi | 115 +++--- tex/context/base/mkiv/grph-inc.lua | 4 - tex/context/base/mkiv/l-table.lua | 22 +- tex/context/base/mkiv/lang-hyp.lua | 2 +- tex/context/base/mkiv/math-act.lua | 29 +- tex/context/base/mkiv/math-dim.lua | 5 +- tex/context/base/mkiv/math-noa.lua | 2 +- tex/context/base/mkiv/math-vfu.lua | 40 +- tex/context/base/mkiv/node-met.lua | 36 -- tex/context/base/mkiv/node-nut.lua | 5 - tex/context/base/mkiv/node-res.lua | 17 + tex/context/base/mkiv/node-rul.lua | 51 ++- tex/context/base/mkiv/node-rul.mkiv | 11 + tex/context/base/mkiv/page-one.mkiv | 2 +- tex/context/base/mkiv/spac-ver.lua | 31 +- tex/context/base/mkiv/status-files.pdf | Bin 25794 -> 25706 bytes tex/context/base/mkiv/status-lua.pdf | Bin 424658 -> 424698 bytes tex/context/base/mkiv/strc-ref.mkvi | 2 +- tex/context/fonts/mkiv/cambria-math.lfg | 15 + tex/context/interface/mkiv/context-en.xml | 4 + tex/context/interface/mkiv/i-context.pdf | Bin 846823 -> 847214 bytes tex/context/interface/mkiv/i-fonts.xml | 10 +- tex/context/interface/mkiv/i-readme.pdf | Bin 60771 -> 60769 bytes tex/context/modules/mkii/m-streams.mkii | 2 + tex/context/modules/mkiv/m-matrix.mkiv | 359 ++++++++++++------ tex/context/modules/mkiv/s-pre-17.mkiv | 404 --------------------- tex/context/modules/mkiv/s-pre-30.mkiv | 257 ------------- tex/context/modules/mkiv/s-present-weird.mkiv | 302 +++++++++++++++ tex/generic/context/luatex/luatex-basics-nod.lua | 2 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 36 +- tex/generic/context/luatex/luatex-pdf.tex | 11 +- 59 files changed, 1183 insertions(+), 1052 deletions(-) create mode 100644 doc/context/presentations/examples/present-weird-001.pdf create mode 100644 doc/context/presentations/examples/present-weird-001.tex delete mode 100644 tex/context/modules/mkiv/s-pre-17.mkiv delete mode 100644 tex/context/modules/mkiv/s-pre-30.mkiv create mode 100644 tex/context/modules/mkiv/s-present-weird.mkiv diff --git a/doc/context/documents/general/manuals/rules-mkiv.pdf b/doc/context/documents/general/manuals/rules-mkiv.pdf index 97ac2fe4d..6e4da3ec8 100644 Binary files a/doc/context/documents/general/manuals/rules-mkiv.pdf and b/doc/context/documents/general/manuals/rules-mkiv.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf index 3fc137d65..b60b34a12 100644 Binary files a/doc/context/documents/general/qrcs/setup-cs.pdf and b/doc/context/documents/general/qrcs/setup-cs.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf index 9c2207d89..8555bebb8 100644 Binary files a/doc/context/documents/general/qrcs/setup-de.pdf and b/doc/context/documents/general/qrcs/setup-de.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf index ba034bb5c..068bac6cb 100644 Binary files a/doc/context/documents/general/qrcs/setup-en.pdf and b/doc/context/documents/general/qrcs/setup-en.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf index 4c1affb39..576e2e9f5 100644 Binary files a/doc/context/documents/general/qrcs/setup-fr.pdf and b/doc/context/documents/general/qrcs/setup-fr.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf index 1b39b9ed8..64554d876 100644 Binary files a/doc/context/documents/general/qrcs/setup-it.pdf and b/doc/context/documents/general/qrcs/setup-it.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf index ccb328a6b..4aa4dc2f6 100644 Binary files a/doc/context/documents/general/qrcs/setup-nl.pdf and b/doc/context/documents/general/qrcs/setup-nl.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf index d31367ab2..a21665aff 100644 Binary files a/doc/context/documents/general/qrcs/setup-ro.pdf and b/doc/context/documents/general/qrcs/setup-ro.pdf differ diff --git a/doc/context/presentations/examples/present-weird-001.pdf b/doc/context/presentations/examples/present-weird-001.pdf new file mode 100644 index 000000000..e3533a31e Binary files /dev/null and b/doc/context/presentations/examples/present-weird-001.pdf differ diff --git a/doc/context/presentations/examples/present-weird-001.tex b/doc/context/presentations/examples/present-weird-001.tex new file mode 100644 index 000000000..7049bac59 --- /dev/null +++ b/doc/context/presentations/examples/present-weird-001.tex @@ -0,0 +1,113 @@ +\usemodule[present-weird] + +\starttext + +\TitlePage{About Text\\Today's Talk\\Hans Hagen} + +\StartPage{The First Page} + + \StartTopic{Some Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input knuth \StopText + \StopTopic + + \StartTopic{Another Text} + \StartText \input tufte \StopText + \StartText \input zapf \StopText + \StartText \input knuth \StopText + \StopTopic + + \StartTopic{Some More Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input tufte \StopText + \StopTopic + + \StartTopic{Some Text Again} + \StartText \input tufte \StopText + \StartText \input zapf \StopText + \StartText \input knuth \StopText + \StartText \input tufte \StopText + \StopTopic + +\StopPage + +\StartPage{The Second Page} + + \StartTopic{Some Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StopTopic + + \StartTopic{Another Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StopTopic + + \StartTopic{Some Nice Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input tufte \StopText + \StartText \input tufte \StopText + \StopTopic + + \StartTopic{Some Funny Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StopTopic + + \StartTopic{Quite Some Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StopTopic + + \StartTopic{Even More Text} + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StopTopic + +\StopPage + +\StartPage{The Third Page} + + \StartTopic{Some Short Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StopTopic + + \StartTopic{Some Minimal Text} + \StartText \input tufte \StopText + \StartText \input zapf \StopText + \StopTopic + + \StartTopic{Some More Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input tufte \StopText + \StartText \input tufte \StopText + \StopTopic + +\StopPage + +\stoptext diff --git a/doc/context/sources/general/manuals/luatex/luatex-fonts.tex b/doc/context/sources/general/manuals/luatex/luatex-fonts.tex index 221c0ce85..793189d1c 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-fonts.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-fonts.tex @@ -460,7 +460,7 @@ parameters to that command. The allowed commands and their arguments are: and move right by the character's width\NC\NR \NC node \NC 1 \NC node \NC output this node (list), and move right by the width of this list\NC\NR -\NC slot \NC 2 \NC number \NC a shortcut for the combination of a font and char command\NC\NR +\NC slot \NC 2 \NC 2 numbers \NC a shortcut for the combination of a font and char command\NC\NR \NC push \NC 0 \NC \NC save current position\NC\NR \NC nop \NC 0 \NC \NC do nothing \NC\NR \NC pop \NC 0 \NC \NC pop position \NC\NR @@ -468,6 +468,8 @@ parameters to that command. The allowed commands and their arguments are: \NC down \NC 1 \NC number \NC move down on the page\NC\NR \NC right \NC 1 \NC number \NC move right on the page\NC\NR \NC special \NC 1 \NC string \NC output a \type {\special} command\NC\NR +\NC pdf \NC 2 \NC 2 strings \NC output a \PDF\ literal, the first string is one of \type {origin}, + \type {page}, \type {direct} or \type {raw}\NC\NR \NC lua \NC 1 \NC string \NC execute a \LUA\ script (at \type {\latelua} time)\NC\NR \NC image \NC 1 \NC image \NC output an image (the argument can be either an \type {} variable or an \type {image_spec} table)\NC\NR @@ -484,15 +486,17 @@ Here is a rather elaborate glyph commands example: \starttyping ... commands = { - { 'push' }, -- remember where we are - { 'right', 5000 }, -- move right about 0.08pt - { 'font', 3 }, -- select the fonts[3] entry - { 'char', 97 }, -- place character 97 (ASCII 'a') - { 'pop' }, -- go all the way back - { 'down', -200000 }, -- move upwards by about 3pt - { 'special', 'pdf: 1 0 0 rg' } -- switch to red color - { 'rule', 500000, 20000 } -- draw a bar - { 'special','pdf: 0 g' } -- back to black + { "push" }, -- remember where we are + { "right", 5000 }, -- move right about 0.08pt + { "font", 3 }, -- select the fonts[3] entry + { "char", 97 }, -- place character 97 (ASCII 'a') + { "pop" }, -- go all the way back + { "down", -200000 }, -- move upwards by about 3pt + { "special", "pdf: 1 0 0 rg" } -- switch to red color + -- { "pdf", "origin", "1 0 0 rg" } -- switch to red color (alternative) + { "rule", 500000, 20000 } -- draw a bar + { "special", "pdf: 0 g" } -- back to black + -- { "pdf", "origin", "0 g" } -- back to black (alternative) } ... \stoptyping @@ -511,6 +515,10 @@ output pointer will always move by exactly the width that was given in the \type {width} key of the character hash. Any movements that take place inside the \type {commands} array are ignored on the upper level. +The special can have a \type {pdf:}, \type {pdf:origin:}, \type {pdf:page:}, +\type {pdf:direct:} or \type {pdf:raw:} prefix. When you have to concatenate +strings using the \type {pdf} command might be more efficient. + \subsection{Artificial fonts} Even in a \quote {real} font, there can be virtual characters. When \LUATEX\ @@ -662,7 +670,32 @@ You can define your own font into \type {font.fonts} by calling this function: The return value is the internal id number of the defined font (the index into \type {font.fonts}). If the font creation fails, an error is raised. The table -is a font structure, as explained in \in {chapter} [fonts]. +is a font structure, as explained in \in {chapter} [fonts]. An alternative call +is: + +\startfunctioncall + i = + font.define( n, f) +\stopfunctioncall + +Where the first argument is a reserved font id (see below). + +\subsection{Extending a font} + +Within reasonable bounds you can extend a font after it has been defined. Because +some properties are best left unchanged this is limited to adding characters. + +\startfunctioncall +font.addcharacters(,
f) +\stopfunctioncall + +The table passed can have the fields \type {characters} which is a (sub)table +like the one used in define, and for virtual fonts a \type {fonts} table can be +added. The characters defined in the \type {characters} table are added (when not +yet present) or replace an existing entry. Keep in mind that replacing can have +side effects because a character already can have been used. Instead of posing +restrictions we expect the user to be careful. (The \type {setfont} helper is +a more drastic replacer.) \subsection{Projected next font id} @@ -673,7 +706,14 @@ is a font structure, as explained in \in {chapter} [fonts]. This returns the font id number that would be returned by a \type {font.define} call if it was executed at this spot in the code flow. This is useful for virtual -fonts that need to reference themselves. +fonts that need to reference themselves. If you pass \type {true} as argument, +the id gets reserved and you can pass to \type {font.define} as first argument. +This can be handy when you create complex virtual fonts. + +\startfunctioncall + i = + font.nextid(true) +\stopfunctioncall \subsection{Font id} diff --git a/doc/context/sources/general/manuals/rules/rules-mkiv.tex b/doc/context/sources/general/manuals/rules/rules-mkiv.tex index 536a37aea..00ab49c25 100644 --- a/doc/context/sources/general/manuals/rules/rules-mkiv.tex +++ b/doc/context/sources/general/manuals/rules/rules-mkiv.tex @@ -627,7 +627,7 @@ primitive here, so we follow the \TEX\ conventions of keywords. \hskip-100mm \darkred \frule width 100mm height 10mm depth 8mm radius 2mm line 2pt\relax \hskip-100mm - \hbox to 100mm{\white \bold \hfill some handy word with frames\hfill} + \hbox to 100mm{\white \bold \hfill some handy word with frames\hfill}% \egroup \stopbuffer diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 5e0aff589..7589a5c95 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -1670,7 +1670,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-table"] = package.loaded["l-table"] or true --- original size: 39608, stripped down to: 23165 +-- original size: 39726, stripped down to: 23243 if not modules then modules={} end modules ['l-table']={ version=1.001, @@ -2464,7 +2464,9 @@ function table.unnest(t) return unnest(t) end local function are_equal(a,b,n,m) - if a and b and #a==#b then + if a==b then + return true + elseif a and b and #a==#b then n=n or 1 m=m or #a for i=n,m do @@ -2484,15 +2486,17 @@ local function are_equal(a,b,n,m) end end local function identical(a,b) - for ka,va in next,a do - local vb=b[ka] - if va==vb then - elseif type(va)=="table" and type(vb)=="table" then - if not identical(va,vb) then + if a~=b then + for ka,va in next,a do + local vb=b[ka] + if va==vb then + elseif type(va)=="table" and type(vb)=="table" then + if not identical(va,vb) then + return false + end + else return false end - else - return false end end return true @@ -20536,8 +20540,8 @@ end -- of closure -- used libraries : l-lua.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 845187 --- stripped bytes : 306192 +-- original bytes : 845305 +-- stripped bytes : 306232 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 5e0aff589..7589a5c95 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -1670,7 +1670,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-table"] = package.loaded["l-table"] or true --- original size: 39608, stripped down to: 23165 +-- original size: 39726, stripped down to: 23243 if not modules then modules={} end modules ['l-table']={ version=1.001, @@ -2464,7 +2464,9 @@ function table.unnest(t) return unnest(t) end local function are_equal(a,b,n,m) - if a and b and #a==#b then + if a==b then + return true + elseif a and b and #a==#b then n=n or 1 m=m or #a for i=n,m do @@ -2484,15 +2486,17 @@ local function are_equal(a,b,n,m) end end local function identical(a,b) - for ka,va in next,a do - local vb=b[ka] - if va==vb then - elseif type(va)=="table" and type(vb)=="table" then - if not identical(va,vb) then + if a~=b then + for ka,va in next,a do + local vb=b[ka] + if va==vb then + elseif type(va)=="table" and type(vb)=="table" then + if not identical(va,vb) then + return false + end + else return false end - else - return false end end return true @@ -20536,8 +20540,8 @@ end -- of closure -- used libraries : l-lua.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 845187 --- stripped bytes : 306192 +-- original bytes : 845305 +-- stripped bytes : 306232 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 5e0aff589..7589a5c95 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -1670,7 +1670,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-table"] = package.loaded["l-table"] or true --- original size: 39608, stripped down to: 23165 +-- original size: 39726, stripped down to: 23243 if not modules then modules={} end modules ['l-table']={ version=1.001, @@ -2464,7 +2464,9 @@ function table.unnest(t) return unnest(t) end local function are_equal(a,b,n,m) - if a and b and #a==#b then + if a==b then + return true + elseif a and b and #a==#b then n=n or 1 m=m or #a for i=n,m do @@ -2484,15 +2486,17 @@ local function are_equal(a,b,n,m) end end local function identical(a,b) - for ka,va in next,a do - local vb=b[ka] - if va==vb then - elseif type(va)=="table" and type(vb)=="table" then - if not identical(va,vb) then + if a~=b then + for ka,va in next,a do + local vb=b[ka] + if va==vb then + elseif type(va)=="table" and type(vb)=="table" then + if not identical(va,vb) then + return false + end + else return false end - else - return false end end return true @@ -20536,8 +20540,8 @@ end -- of closure -- used libraries : l-lua.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 845187 --- stripped bytes : 306192 +-- original bytes : 845305 +-- stripped bytes : 306232 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 5e0aff589..7589a5c95 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -1670,7 +1670,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-table"] = package.loaded["l-table"] or true --- original size: 39608, stripped down to: 23165 +-- original size: 39726, stripped down to: 23243 if not modules then modules={} end modules ['l-table']={ version=1.001, @@ -2464,7 +2464,9 @@ function table.unnest(t) return unnest(t) end local function are_equal(a,b,n,m) - if a and b and #a==#b then + if a==b then + return true + elseif a and b and #a==#b then n=n or 1 m=m or #a for i=n,m do @@ -2484,15 +2486,17 @@ local function are_equal(a,b,n,m) end end local function identical(a,b) - for ka,va in next,a do - local vb=b[ka] - if va==vb then - elseif type(va)=="table" and type(vb)=="table" then - if not identical(va,vb) then + if a~=b then + for ka,va in next,a do + local vb=b[ka] + if va==vb then + elseif type(va)=="table" and type(vb)=="table" then + if not identical(va,vb) then + return false + end + else return false end - else - return false end end return true @@ -20536,8 +20540,8 @@ end -- of closure -- used libraries : l-lua.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 845187 --- stripped bytes : 306192 +-- original bytes : 845305 +-- stripped bytes : 306232 -- end library merge diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index da22a37a1..f1f1b7b54 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.05.28 19:30} +\newcontextversion{2017.06.04 16:55} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index b47be4275..ed6e5657a 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2017.05.28 19:30} +\edef\contextversion{2017.06.04 16:55} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-fil.mkiv b/tex/context/base/mkiv/cont-fil.mkiv index e2c7f401e..69c45c0e5 100644 --- a/tex/context/base/mkiv/cont-fil.mkiv +++ b/tex/context/base/mkiv/cont-fil.mkiv @@ -74,7 +74,8 @@ \definefilesynonym [pre-balls] [present-balls] \definefilesynonym [pre-15] [present-balls] \definefilesynonym [pre-knot] [pre-16] -\definefilesynonym [pre-weird] [pre-17] +\definefilesynonym [pre-17] [present-weird] +\definefilesynonym [pre-weird] [present-weird] \definefilesynonym [pre-shade] [pre-18] \definefilesynonym [pre-organic] [pre-19] \definefilesynonym [pre-speckle] [pre-20] diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index c98444273..cd928701d 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.05.28 19:30} +\newcontextversion{2017.06.04 16:55} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index ac0e03320..f586f8706 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.05.28 19:30} +\edef\contextversion{2017.06.04 16:55} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua index d375d4679..e13da7f8a 100644 --- a/tex/context/base/mkiv/font-ctx.lua +++ b/tex/context/base/mkiv/font-ctx.lua @@ -1262,7 +1262,7 @@ do -- else too many locals -- -- characters[0x2007] = { width = characters[0x0030] and characters[0x0030].width or parameters.space } -- figure -- -- characters[0x2008] = { width = characters[0x002E] and characters[0x002E].width or parameters.space } -- period -- -- --- constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference +-- -- constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference -- local id = definefont(tfmdata) -- csnames[id] = specification.cs -- tfmdata.properties.id = id @@ -1429,7 +1429,7 @@ do -- else too many locals -- characters[0x2007] = { width = characters[0x0030] and characters[0x0030].width or parameters.space } -- figure -- characters[0x2008] = { width = characters[0x002E] and characters[0x002E].width or parameters.space } -- period -- - constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference + -- constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference local fallbacks = specification.fallbacks local mathsize = (mathsize == 1 or mathsize == 2 or mathsize == 3) and mathsize or nil -- can be unset so we test 1 2 3 if fallbacks and fallbacks ~= "" and mathsize and not busy then @@ -2383,26 +2383,24 @@ dimenfactors.pct = nil to scale virtual characters.

--ldx]]-- --- in versions > 0.82 0 is supported as equivalent of self - -function constructors.checkvirtualids(tfmdata) - -- begin of experiment: we can use { "slot", 0, number } in virtual fonts - local fonts = tfmdata.fonts - local selfid = font.nextid() - if fonts and #fonts > 0 then - for i=1,#fonts do - local fi = fonts[i] - if fi[2] == 0 then - fi[2] = selfid - elseif fi.id == 0 then - fi.id = selfid - end - end - else - -- tfmdata.fonts = { "id", selfid } -- conflicts with other next id's (vf math), too late anyway - end - -- end of experiment -end +-- function constructors.checkvirtualids(tfmdata) +-- -- begin of experiment: we can use { "slot", 0, number } in virtual fonts +-- local fonts = tfmdata.fonts +-- local selfid = font.nextid() +-- if fonts and #fonts > 0 then +-- for i=1,#fonts do +-- local fi = fonts[i] +-- if fi[2] == 0 then +-- fi[2] = selfid +-- elseif fi.id == 0 then +-- fi.id = selfid +-- end +-- end +-- else +-- -- tfmdata.fonts = { "id", selfid } -- conflicts with other next id's (vf math), too late anyway +-- end +-- -- end of experiment +-- end -- function constructors.getvirtualid(tfmdata) -- -- since we don't know the id yet, we use 0 as signal @@ -3091,3 +3089,74 @@ do } end + +-- for the moment here (and not in font-con.lua): + +local identical = table.identical +local copy = table.copy +local fontdata = fonts.hashes.identifiers +local addcharacters = font.addcharacters + +-- This helper is mostly meant to add last-resort (virtual) characters +-- or runtime generated fonts (so we forget about features and such). It +-- will probably take a while before it get used. + +local trace_adding = false +local report_adding = logs.reporter("fonts","add characters") + +trackers.register("fonts.addcharacters",function(v) trace_adding = v end) + +if addcharacters then + + function fonts.constructors.addcharacters(id,list) + local newchar = list.characters + if newchar then + local data = fontdata[id] + local newfont = list.fonts + local oldchar = data.characters + local oldfont = data.fonts + addcharacters(id, { + characters = newchar, + fonts = newfont, + nomath = not data.properties.hasmath, + }) + -- this is just for tracing, as the assignment only uses the fonts list + -- and doesn't store it otherwise + if newfont then + if oldfont then + local oldn = #oldfont + local newn = #newfont + for n=1,newn do + local ok = false + local nf = newfont[n] + for o=1,oldn do + if identical(nf,oldfont[o]) then + ok = true + break + end + end + if not ok then + oldn = oldn + 1 + oldfont[oldn] = newfont[i] + end + end + else + data.fonts = newfont + end + end + -- this is because we need to know what goes on and also might + -- want to access character data + for u, c in next, newchar do + if trace_adding then + report_adding("adding character %U to font %!font:name!",u,id) + end + oldchar[u] = c + end + end + end + +else + function fonts.constructors.addcharacters(id,list) + report_adding("adding characters to %!font:name! is not yet supported",id) + end +end diff --git a/tex/context/base/mkiv/font-emp.mkvi b/tex/context/base/mkiv/font-emp.mkvi index 8f87ff7a1..1b6d46798 100644 --- a/tex/context/base/mkiv/font-emp.mkvi +++ b/tex/context/base/mkiv/font-emp.mkvi @@ -62,6 +62,16 @@ \else \ifx\fontalternative\s!sl\bs \else \bf\fi\fi} +\unexpanded\def\normalitalicface % public + {\relax\ifx\fontalternative\s!tf\it + \else \ifx\fontalternative\s!bf\bi + \else \tf\fi\fi} + +\unexpanded\def\normalslantedface % public + {\relax\ifx\fontalternative\s!tf\sl + \else \ifx\fontalternative\s!bf\bs + \else \tf\fi\fi} + \unexpanded\def\normaltypeface % public {\relax \ifx\fontalternative\s!bi \it \else @@ -77,9 +87,11 @@ \ifx\fontalternative\s!bi \bf \else \emphasistypeface \fi\fi\fi\fi\fi} -\let\typeface\normaltypeface % public -\let\boldface\normalboldface % public -\let\swapface\swaptypeface % public +\let\typeface \normaltypeface % public +\let\boldface \normalboldface % public +\let\slantedface\normalslantedface % public +\let\italicface \normalitalicface % public +\let\swapface \swaptypeface % public %D To be set with the default body font environment: \type %D {em} being \type {slanted} or \type {italic}. diff --git a/tex/context/base/mkiv/font-hsh.lua b/tex/context/base/mkiv/font-hsh.lua index 12f7bdfc2..95914b50c 100644 --- a/tex/context/base/mkiv/font-hsh.lua +++ b/tex/context/base/mkiv/font-hsh.lua @@ -359,4 +359,4 @@ function font.getfont(id) return identifiers[id] end -font.setfont = currentfont -- bah, no native 'setfont' as name +-- font.setfont = currentfont -- bah, no native 'setfont' as name diff --git a/tex/context/base/mkiv/font-ini.lua b/tex/context/base/mkiv/font-ini.lua index 708961b97..7ac8f218b 100644 --- a/tex/context/base/mkiv/font-ini.lua +++ b/tex/context/base/mkiv/font-ini.lua @@ -27,4 +27,6 @@ fonts.readers = { } fonts.definers = { methods = { } } fonts.loggers = { register = function() end } -fontloader = nil +if context then + fontloader = nil +end diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 1230475b3..bd54b61c9 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -224,7 +224,7 @@ local math_code = nodecodes.math local dir_code = nodecodes.dir local localpar_code = nodecodes.localpar -local discretionary_code = disccodes.discretionary +----- discretionary_code = disccodes.discretionary local ligature_code = glyphcodes.ligature local a_state = attributes.private('state') @@ -3833,11 +3833,13 @@ otf.helpers.pardirstate = pardirstate do - -- experimental speedup (only with hyphenated text and multiple fonts per processing) - -- - -- at some point this might become true by default + -- This is a measurable experimental speedup (only with hyphenated text and multiple + -- fonts per processor call), especially for fonts with lots of contextual lookups. + + -- local fastdisc = true + local fastdisc = context and LUATEXVERSION >= 1.005 - local fastdisc = false directives.register("otf.fastdisc",function(v) fastdisc = v end) + directives.register("otf.fastdisc",function(v) fastdisc = v end) function otf.featuresprocessor(head,font,attr,direction,n) @@ -4023,9 +4025,9 @@ do if ok then done = true end - else - start = getnext(start) - end + else + start = getnext(start) + end elseif id == math_code then start = getnext(end_of_math(start)) elseif id == dir_code then diff --git a/tex/context/base/mkiv/font-pre.mkiv b/tex/context/base/mkiv/font-pre.mkiv index 9336fa352..45f933dd5 100644 --- a/tex/context/base/mkiv/font-pre.mkiv +++ b/tex/context/base/mkiv/font-pre.mkiv @@ -607,7 +607,7 @@ \definealternativestyle [\v!bigger] [\setbigbodyfont \tf] [] \definealternativestyle [\v!smaller] [\setsmallbodyfont\tf] [] -\definealternativestyle [\v!sans,\v!sansserif] [\ss] [] +\definealternativestyle [\v!sans,\v!sansserif] [\ss] \definealternativestyle [\v!roman,\v!serif,\v!regular] [\rm] \definealternativestyle [\v!handwritten] [\hw] \definealternativestyle [\v!calligraphic] [\cg] @@ -619,6 +619,12 @@ \definealternativestyle [\v!mononormal] [\tt\tf] [] \definealternativestyle [\v!monobold] [\tt\bf] [] +\definealternativestyle [typeface] [\typeface] [] % no translation here (quite basic) +\definealternativestyle [boldface] [\boldface] [] +\definealternativestyle [slantedface] [\slantedface] [] +\definealternativestyle [italicface] [\italicface] [] +\definealternativestyle [swapface] [\swapface] [] + % For Alan: \definealternativestyle diff --git a/tex/context/base/mkiv/font-sol.lua b/tex/context/base/mkiv/font-sol.lua index 82fc3dc40..d89f41441 100644 --- a/tex/context/base/mkiv/font-sol.lua +++ b/tex/context/base/mkiv/font-sol.lua @@ -395,7 +395,7 @@ function splitters.split(head) if m > max_more then max_more = m end start, stop, done = nil, nil, true end - while current do -- also nextid + while current do -- also ischar local next = getnext(current) local id = getid(current) if id == glyph_code then diff --git a/tex/context/base/mkiv/font-sty.mkvi b/tex/context/base/mkiv/font-sty.mkvi index cf49cd5eb..2d00c5ec8 100644 --- a/tex/context/base/mkiv/font-sty.mkvi +++ b/tex/context/base/mkiv/font-sty.mkvi @@ -18,34 +18,33 @@ %D \macros %D {definealternativestyle} %D -%D In the main modules we are going to implement lots of -%D parameterized commands and one of these parameters will -%D concern the font to use. To suit consistent use of fonts we -%D here implement a mechanism for defining the keywords that -%D present a particular style or alternative. +%D In the main modules we are going to implement lots of parameterized commands and +%D one of these parameters will concern the font to use. To suit consistent use of +%D fonts we here implement a mechanism for defining the keywords that present a +%D particular style or alternative. %D %D \starttyping %D \definealternativestyle [keywords] [\style] [\nostyle] %D \stoptyping %D -%D The first command is used in the normal textflow, while the -%D second command takes care of headings and alike. Consider -%D the next two definitions: +%D The first command is used in the normal textflow, while the second command takes +%D care of headings and alike. Consider the next two definitions: %D %D \starttyping %D \definealternativestyle [bold] [\bf] [] %D \definealternativestyle [cap] [\cap] [\cap] %D \stoptyping %D -%D A change \type{\bf} in a heading which is to be set in -%D \type{\tfd} does not look that well, so therefore we leave -%D the second argument of \type{\definealternativestyle} empty. -%D When we capatalize characters using the pseudo small cap -%D command \type{\cap}, we want this to take effect in both -%D text and headings, which is accomplished by assigning both -%D arguments. +%D A change \type {\bf} in a heading which is to be set in \type {\tfd} does not look +%D that well, so therefore we leave the second argument of \type +%D {\definealternativestyle} empty. When we capatalize characters using the pseudo +%D small cap command \type {\cap}, we want this to take effect in both text and +%D headings, which is accomplished by assigning both arguments. -\installcorenamespace{alternativestyles} +\installcorenamespace{alternativestyles} % settings +\installcorenamespace{alternativestyle} % instances + +\installsetuponlycommandhandler \??alternativestyles {alternativestyles} \setnewconstant \c_font_current_alternative_style_index \plusone @@ -57,13 +56,21 @@ \let\definestyle\definealternativestyle % later redefined +\newconstant\c_fonts_basics_alternative_style_method + \def\font_basics_define_alternative_style_indeed#variantone#varianttwo#command% - {\ifcsname#command\endcsname + {\setvalue{\??alternativestyle#command}{\font_helpers_apply_alternative_style{#variantone}{#varianttwo}}% + \ifcsname#command\endcsname % no redefinition + \else\ifnum\c_fonts_basics_alternative_style_method=\plusone + \ifthirdargument + \setuevalue{#command}{\groupedcommand{\expandafter\noexpand\begincsname\??alternativestyle#command\endcsname}{}}% + \else + \setuvalue{#command}{\groupedcommand{#variantone}{}}% + \fi \else \setuvalue{#command}{\groupedcommand{#variantone}{}}% - \fi - \setvalue{\??alternativestyles#command}{\font_helpers_apply_alternative_style{#variantone}{#varianttwo}}}% + \fi\fi} \def\font_helpers_apply_alternative_style {\ifcase\c_font_current_alternative_style_index @@ -77,18 +84,24 @@ \fi} \def\applyalternativestyle#name% public - {\begincsname\??alternativestyles#name\endcsname} + {\begincsname\??alternativestyle#name\endcsname} + +\appendtoks + \doifelse{\alternativestylesparameter\c!method}\v!auto + {\c_fonts_basics_alternative_style_method\plusone}% + {\c_fonts_basics_alternative_style_method\zerocount}% +\to \everysetupalternativestyles -%D Maybe too geneneric, but probably ok is the following. (Maybe one -%D day we will use a dedicated grouped command for styles.) +%D Maybe too generic, but probably ok is the following. (Maybe one day we will use a +%D dedicated grouped command for styles.) % \appendtoks % \let\groupedcommand\thirdofthreearguments % \to \everysimplifycommands -%D This command also defines the keyword as command. This means -%D that the example definition of \type{bold} we gave before, -%D results in a command \type{\bold} which can be used as: +%D This command also defines the keyword as command. This means that the example +%D definition of \type {bold} we gave before, results in a command \type {\bold} +%D which can be used as: %D %D \startbuffer %D He's a \bold{bold} man with a {\bold head}. @@ -102,39 +115,33 @@ %D \definealternativestyle[bold][\bf][]\getbuffer %D \stopexample %D -%D Such definitions are of course unwanted for \type{\cap} -%D because this would result in an endless recursive call. -%D Therefore we check on the existance of both the command and -%D the substitution. The latter is needed because for instance -%D \type{\type} is an entirely diferent command. That command -%D handles verbatim, while the style command would just switch -%D to teletype font. This is just an example of a tricky -%D naming coincidence. - +%D Such definitions are of course unwanted for \type {\cap} because this would +%D result in an endless recursive call. Therefore we check on the existance of both +%D the command and the substitution. The latter is needed because for instance \type +%D {\type} is an entirely diferent command. That command handles verbatim, while the +%D style command would just switch to teletype font. This is just an example of a +%D tricky naming coincidence. +%D %D \macros %D {doconvertfont,noconvertfont, %D dontconvertfont,redoconvertfont} %D -%D After having defined such keywords, we can call for them by -%D using +%D After having defined such keywords, we can call for them by using %D %D \starttyping %D \doconvertfont{keyword}{text} %D \stoptyping %D -%D We deliberately pass an argument. This enables us to -%D assign converters that handle one argument, like -%D \type{\cap}. +%D We deliberately pass an argument. This enables us to assign converters that +%D handle one argument, like \type {\cap}. %D -%D By default the first specification is used to set the style, -%D exept when we say \type{\dontconvertfont}, after which the -%D second specification is used. We can also directly call for -%D \type{\noconvertfont}. In nested calls, we can restore the -%D conversion by saying \type{\redoconvertfont}. - -%D These commands are not grouped! Grouping is most probably -%D done by the calling macro's and would lead to unnecessary -%D overhead. +%D By default the first specification is used to set the style, exept when we say +%D \type {\dontconvertfont}, after which the second specification is used. We can +%D also directly call for \type {\noconvertfont}. In nested calls, we can restore +%D the conversion by saying \type {\redoconvertfont}. +%D +%D These commands are not grouped! Grouping is most probably done by the calling +%D macro's and would lead to unnecessary overhead. \let\m_current_convert_font \empty \let\m_current_convert_font_dt\empty @@ -149,7 +156,7 @@ \def\font_helpers_do_convert_font {\edef\m_current_convert_font_dt{\detokenize\expandafter{\m_current_convert_font}}% - \ifcsname\??alternativestyles\m_current_convert_font_dt\endcsname + \ifcsname\??alternativestyle\m_current_convert_font_dt\endcsname \expandafter\lastnamedcs \else\ifcsname\m_current_convert_font_dt\endcsname \doubleexpandafter\lastnamedcs @@ -157,8 +164,8 @@ \doubleexpandafter\m_current_convert_font \fi\fi} -%D Low level switches (downward compatible, but we keep them as one can use -%D them in styles): +%D Low level switches (downward compatible, but we keep them as one can use them in +%D styles): %D %D \starttyping %D \usemodule[abr-02] @@ -188,7 +195,7 @@ \unexpanded\def\dousecurrentstyleparameter % empty check outside here {\edef\detokenizedstyleparameter{\detokenize\expandafter{\currentstyleparameter}}% \settrue\fontattributeisset % reset is done elsewhere - \ifcsname\??alternativestyles\detokenizedstyleparameter\endcsname + \ifcsname\??alternativestyle\detokenizedstyleparameter\endcsname \lastnamedcs \else\ifcsname\detokenizedstyleparameter\endcsname \lastnamedcs @@ -392,8 +399,8 @@ \unexpanded\edef\vsone#character{#character\normalUchar"FE00 } % used \unexpanded\edef\vstwo#character{#character\normalUchar"FE01 } % not used but handy for testing -%D For historic reasons we keep the following around but they are no longer -%D that relevant for \MKIV. +%D For historic reasons we keep the following around but they are no longer that +%D relevant for \MKIV. \unexpanded\def\doattributes#1#2#3#4% {\begingroup % geen \bgroup, anders in mathmode lege \hbox diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua index b5e74b4c1..5f2fb88c9 100644 --- a/tex/context/base/mkiv/grph-inc.lua +++ b/tex/context/base/mkiv/grph-inc.lua @@ -89,10 +89,6 @@ local trace_usage = false trackers.register ("graphics.usage", func local extra_check = false directives.register("graphics.extracheck", function(v) extra_check = v end) local auto_transform = true directives.register("graphics.autotransform", function(v) auto_transform = v end) -if LUATEXVERSION <= 1 then - auto_transform = false -end - local report_inclusion = logs.reporter("graphics","inclusion") local report_figures = logs.reporter("system","graphics") local report_figure = logs.reporter("used graphic") diff --git a/tex/context/base/mkiv/l-table.lua b/tex/context/base/mkiv/l-table.lua index 3c1ce6daf..5bfc4bc47 100644 --- a/tex/context/base/mkiv/l-table.lua +++ b/tex/context/base/mkiv/l-table.lua @@ -1092,7 +1092,9 @@ function table.unnest(t) -- bad name end local function are_equal(a,b,n,m) -- indexed - if a and b and #a == #b then + if a == b then + return true + elseif a and b and #a == #b then n = n or 1 m = m or #a for i=n,m do @@ -1114,16 +1116,18 @@ local function are_equal(a,b,n,m) -- indexed end local function identical(a,b) -- assumes same structure - for ka, va in next, a do - local vb = b[ka] - if va == vb then - -- same - elseif type(va) == "table" and type(vb) == "table" then - if not identical(va,vb) then + if a ~= b then + for ka, va in next, a do + local vb = b[ka] + if va == vb then + -- same + elseif type(va) == "table" and type(vb) == "table" then + if not identical(va,vb) then + return false + end + else return false end - else - return false end end return true diff --git a/tex/context/base/mkiv/lang-hyp.lua b/tex/context/base/mkiv/lang-hyp.lua index b85295f19..b1b9e605a 100644 --- a/tex/context/base/mkiv/lang-hyp.lua +++ b/tex/context/base/mkiv/lang-hyp.lua @@ -1647,7 +1647,7 @@ featureset.hyphenonly = hyphenonly == v_yes return head, done end - if LUATEXVERSION< 1.005 then + if LUATEXVERSION < 1.005 then expanded = function(head) local done = hyphenate(head) diff --git a/tex/context/base/mkiv/math-act.lua b/tex/context/base/mkiv/math-act.lua index ddc7510b1..69d85d01f 100644 --- a/tex/context/base/mkiv/math-act.lua +++ b/tex/context/base/mkiv/math-act.lua @@ -238,6 +238,8 @@ function mathematics.overloaddimensions(target,original,set) local hfactor = parameters.hfactor local vfactor = parameters.vfactor local addprivate = fonts.helpers.addprivate +target.type = "virtual" +target.properties.virtualized = true local function overload(dimensions) for unicode, data in next, dimensions do local character = characters[unicode] @@ -249,9 +251,9 @@ function mathematics.overloaddimensions(target,original,set) if trace_defining and (width or height or depth) then report_math("overloading dimensions of %C, width %a, height %a, depth %a",unicode,width,height,depth) end - if width then character.width = width * hfactor end - if height then character.height = height * vfactor end - if depth then character.depth = depth * vfactor end + if width then character.width = width * hfactor end + if height then character.height = height * vfactor end + if depth then character.depth = depth * vfactor end -- local xoffset = data.xoffset local yoffset = data.yoffset @@ -262,13 +264,22 @@ function mathematics.overloaddimensions(target,original,set) yoffset = { "down", -yoffset * vfactor } end if xoffset or yoffset then - local slot = { "slot", 1, addprivate(target,nil,fastcopy(character)) } - if xoffset and yoffset then - character.commands = { xoffset, yoffset, slot } - elseif xoffset then - character.commands = { xoffset, slot } + if character.commands then + if yoffset then + insert(character.commands,1,yoffset) + end + if xoffset then + insert(character.commands,1,xoffset) + end else - character.commands = { yoffset, slot } + local slot = { "slot", 0, addprivate(target,nil,fastcopy(character)) } + if xoffset and yoffset then + character.commands = { xoffset, yoffset, slot } + elseif xoffset then + character.commands = { xoffset, slot } + else + character.commands = { yoffset, slot } + end end character.index = nil end diff --git a/tex/context/base/mkiv/math-dim.lua b/tex/context/base/mkiv/math-dim.lua index ba0235a5b..72b9d7e50 100644 --- a/tex/context/base/mkiv/math-dim.lua +++ b/tex/context/base/mkiv/math-dim.lua @@ -6,9 +6,6 @@ if not modules then modules = { } end modules ['math-dim'] = { license = "see context related readme files" } --- Beware: only Taco and Ulrik really understands in depth what these dimensions --- do so if you run into problems ask on the context list. - -- The radical_rule value is also used as a trigger. In luatex the accent -- placement happens either the opentype way (using top_accent cum suis) or the -- traditional way. In order to determine what method to use the \Umathradicalrule @@ -18,6 +15,8 @@ if not modules then modules = { } end modules ['math-dim'] = { -- which case the engine takes the rulethickness. In c-speak: -- -- int compat_mode = (radical_rule(cur_style) == undefined_math_parameter) ; +-- +-- In the meantime things have been updated and we now have two code paths. local abs, next = math.abs, next diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua index 2e94f0d71..8b1fa87fd 100644 --- a/tex/context/base/mkiv/math-noa.lua +++ b/tex/context/base/mkiv/math-noa.lua @@ -1461,7 +1461,7 @@ do local hash = setmetatableindex(function(t,font) local g = fontdata[font].goodies - local m = g and g[1].mathematics + local m = g and g[1] and g[1].mathematics local k = m and m.kernpairs t[font] = k return k diff --git a/tex/context/base/mkiv/math-vfu.lua b/tex/context/base/mkiv/math-vfu.lua index a8a789d28..1e40d5ac4 100644 --- a/tex/context/base/mkiv/math-vfu.lua +++ b/tex/context/base/mkiv/math-vfu.lua @@ -603,22 +603,24 @@ local function copy_glyph(main,target,original,unicode,slot) local olddata = original[unicode] if olddata then local newdata = { - width = olddata.width, - height = olddata.height, - depth = olddata.depth, - italic = olddata.italic, - kerns = olddata.kerns, - commands = { { "slot", slot, unicode } }, + width = olddata.width, + height = olddata.height, + depth = olddata.depth, + italic = olddata.italic, + kerns = olddata.kerns, + tounicode = olddata.tounicode, + commands = { { "slot", slot, unicode } }, } local glyphdata = newdata local nextglyph = olddata.next while nextglyph do local oldnextdata = original[nextglyph] local newnextdata = { - commands = { { "slot", slot, nextglyph } }, - width = oldnextdata.width, - height = oldnextdata.height, - depth = oldnextdata.depth, + width = oldnextdata.width, + height = oldnextdata.height, + depth = oldnextdata.depth, + tounicode = olddata.tounicode, + commands = { { "slot", slot, nextglyph } }, } local newnextglyph = addprivate(main,formatters["M-N-%H"](nextglyph),newnextdata) newdata.next = newnextglyph @@ -641,10 +643,11 @@ local function copy_glyph(main,target,original,unicode,slot) local oldglyph = hvi.glyph local olddata = original[oldglyph] local newdata = { - commands = { { "slot", slot, oldglyph } }, - width = olddata.width, - height = olddata.height, - depth = olddata.depth, + width = olddata.width, + height = olddata.height, + depth = olddata.depth, + tounicode = olddata.tounicode, + commands = { { "slot", slot, oldglyph } }, } hvi.glyph = addprivate(main,formatters["M-H-%H"](oldglyph),newdata) -- report_virtual("copied h variant: %X at index %i",hvi.glyph,i) @@ -659,10 +662,11 @@ local function copy_glyph(main,target,original,unicode,slot) local oldglyph = vvi.glyph local olddata = original[oldglyph] local newdata = { - commands = { { "slot", slot, oldglyph } }, - width = olddata.width, - height = olddata.height, - depth = olddata.depth, + width = olddata.width, + height = olddata.height, + depth = olddata.depth, + tounicode = olddata.tounicode, + commands = { { "slot", slot, oldglyph } }, } vvi.glyph = addprivate(main,formatters["M-V-%H"](oldglyph),newdata) -- report_virtual("copied v variant: %X at index %i",vvi.glyph,i) diff --git a/tex/context/base/mkiv/node-met.lua b/tex/context/base/mkiv/node-met.lua index 9ebc8e411..e6d0f4689 100644 --- a/tex/context/base/mkiv/node-met.lua +++ b/tex/context/base/mkiv/node-met.lua @@ -669,39 +669,3 @@ end nodes.keys = keys -- [id][subtype] nodes.fields = nodefields -- (n) - --- temporary hack - -if LUATEXVERSION <= 1.002 then - - local get = tex.get - local flush = node.free - - function tex.get(name,split) - local s = get(name) - if split == true then - if s then - local width = s.width - local stretch = s.stretch - local shrink = s.shrink - local stretch_order = s.stretch_order - local shrink_order = s.shrink_order - flush(s) - return width, stretch, shrink, stretch_order, shrink_order - else - return 0, 0, 0, 0, 0 - end - elseif split == false then - if s then - local width = s.width - flush(s) - return width - else - return 0 - end - else - return s - end - end - -end diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua index b42727e06..787afd888 100644 --- a/tex/context/base/mkiv/node-nut.lua +++ b/tex/context/base/mkiv/node-nut.lua @@ -210,11 +210,6 @@ if LUATEXVERSION < 1.005 then function direct.getsup (n) return getfield(n,"sup") end end --- if LUATEXVERSION < 1.004 then --- local gc = direct.getcomponents --- getcomponents = function(n) local c = gc(n) return c ~= 0 and c or nil end --- end - -- local hash = table.setmetatableindex("number") -- local ga = direct.get_attribute -- function direct.get_attribute(n,a) diff --git a/tex/context/base/mkiv/node-res.lua b/tex/context/base/mkiv/node-res.lua index 8b7ec1a62..858408bd9 100644 --- a/tex/context/base/mkiv/node-res.lua +++ b/tex/context/base/mkiv/node-res.lua @@ -26,6 +26,7 @@ local skipcodes = nodes.skipcodes local kerncodes = nodes.kerncodes local rulecodes = nodes.rulecodes local nodecodes = nodes.nodecodes +local gluecodes = nodes.gluecodes local boundarycodes = nodes.boundarycodes local usercodes = nodes.usercodes @@ -86,6 +87,8 @@ local setpenalty = nuts.setpenalty local setdir = nuts.setdir local setshift = nuts.setshift local setwidth = nuts.setwidth +local setsubtype = nuts.setsubtype +local setleader = nuts.setleader local copy_nut = nuts.copy local new_nut = nuts.new @@ -183,6 +186,8 @@ local noad = register_nut(new_nut("noad")) local boundary = register_nut(new_nut("boundary",boundarycodes.user)) local wordboundary = register_nut(new_nut("boundary",boundarycodes.word)) +local cleader = register_nut(copy_nut(glue)) setsubtype(cleader,gluecodes.cleaders) setglue(cleader,0,65536,0,2,0) + -- the dir field needs to be set otherwise crash: local rule = register_nut(new_nut("rule")) setdir(rule, "TLT") @@ -362,6 +367,18 @@ function nutpool.userrule(width,height,depth,dir) -- w/h/d == nil will let them return n end +function nutpool.leader(width,list) + local n = copy_nut(cleader) + if width then + setwidth(n,width) + end + if list then + setleader(n,list) + end + return n +end + + function nutpool.latelua(code) local n = copy_nut(latelua) setfield(n,"string",code) diff --git a/tex/context/base/mkiv/node-rul.lua b/tex/context/base/mkiv/node-rul.lua index 4ec651d3b..b6cb9c167 100644 --- a/tex/context/base/mkiv/node-rul.lua +++ b/tex/context/base/mkiv/node-rul.lua @@ -35,6 +35,7 @@ local setlink = nuts.setlink local getnext = nuts.getnext local getprev = nuts.getprev local getid = nuts.getid +local getdir = nuts.getdir local getattr = nuts.getattr local setattr = nuts.setattr local getfont = nuts.getfont @@ -57,6 +58,7 @@ local traverse_id = nuts.traverse_id local list_dimensions = nuts.rangedimensions local hpack_nodes = nuts.hpack local current_attr = nuts.current_attr +local copy_list = nuts.copy_list local nodecodes = nodes.nodecodes local rulecodes = nodes.rulecodes @@ -82,6 +84,7 @@ local nodepool = nuts.pool local new_rule = nodepool.rule local new_userrule = nodepool.userrule local new_kern = nodepool.kern +local new_leader = nodepool.leader local n_tostring = nodes.idstostring local n_tosequence = nodes.tosequence @@ -208,8 +211,19 @@ local trace_ruled = false trackers.register("nodes.rules", function(v) trace_ local report_ruled = logs.reporter("nodes","rules") function rules.define(settings) - data[#data+1] = settings - context(#data) + local nofdata = #data+1 + data[nofdata] = settings + local text = settings.text + if text then + local b = nuts.takebox(text) + if b then + nodepool.register(b) + settings.text = getlist(b) + else + settings.text = nil + end + end + context(nofdata) end local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but acceptable for this purpose @@ -242,7 +256,6 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a local method = d.method local empty = d.empty == v_yes local offset = d.offset - local continue = d.continue local dy = d.dy local order = d.order local max = d.max @@ -322,18 +335,28 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a } inject(tonut(r),w,ht,dp) else - for i=1,level do - local ht = (offset+(i-1)*dy)*e + rulethickness - m - local dp = -(offset+(i-1)*dy)*e + rulethickness + m - local r = new_rule(w,ht,dp) - if color then - setattr(r,a_colormodel,colorspace) - setattr(r,a_color,color) - end - if transparency then - setattr(r,a_transparency,transparency) + local tx = d.text + if tx then + tx = copy_list(tx) + if d["repeat"] == v_yes then + tx = new_leader(w,tx) end + local r = hpack_nodes(tx,w,"exactly") inject(r,w,ht,dp) + else + for i=1,level do + local ht = (offset+(i-1)*dy)*e + rulethickness - m + local dp = -(offset+(i-1)*dy)*e + rulethickness + m + local r = new_rule(w,ht,dp) + if color then + setattr(r,a_colormodel,colorspace) + setattr(r,a_color,color) + end + if transparency then + setattr(r,a_transparency,transparency) + end + inject(r,w,ht,dp) + end end end return head @@ -617,6 +640,8 @@ implement { { "ta", "integer" }, { "mp" }, { "empty" }, + { "text", "integer" }, + { "repeat" }, } } } diff --git a/tex/context/base/mkiv/node-rul.mkiv b/tex/context/base/mkiv/node-rul.mkiv index bfdd17d30..661c8d7ef 100644 --- a/tex/context/base/mkiv/node-rul.mkiv +++ b/tex/context/base/mkiv/node-rul.mkiv @@ -108,8 +108,14 @@ \setuevalue\currentbar{\node_rules_direct{\currentbar}}% \to \everydefinebar +\newbox\b_node_rules + \unexpanded\def\node_rules_define {\edef\p_node_rules_color{\barparameter\c!color}% + \edef\p_node_text{\barparameter\c!text}% + \ifx\p_node_text\empty\else + \setbox\b_node_rules\hbox{\p_node_text}% + \fi \setevalue{\??barattribute\currentbar}{\number \clf_definerule continue {\barparameter\c!continue}% @@ -125,6 +131,11 @@ offset \barparameter\c!offset\space % number dy \barparameter\c!dy\space % number empty {\barparameter\c!empty}% + \ifx\p_node_text\empty\else + % not that useful and efficient, more for testing something + text \b_node_rules + repeat {\barparameter\c!repeat}% + \fi \relax}} \unexpanded\def\node_rules_redefine#1% diff --git a/tex/context/base/mkiv/page-one.mkiv b/tex/context/base/mkiv/page-one.mkiv index 59efbd204..180c63834 100644 --- a/tex/context/base/mkiv/page-one.mkiv +++ b/tex/context/base/mkiv/page-one.mkiv @@ -1,4 +1,4 @@ - %D \module +%D \module %D [ file=page-one, %D version=2000.10.20, %D title=\CONTEXT\ Page Macros, diff --git a/tex/context/base/mkiv/spac-ver.lua b/tex/context/base/mkiv/spac-ver.lua index 2f0191e6a..d7c1a2cbb 100644 --- a/tex/context/base/mkiv/spac-ver.lua +++ b/tex/context/base/mkiv/spac-ver.lua @@ -1117,7 +1117,7 @@ end -- we could inject a vadjust to force a recalculation .. a mess -- -- So, the next is far from robust and okay but for the moment this overlaying --- has to do. Always test this with the examples in spec-ver.mkvi! +-- has to do. Always test this with the examples in spac-ver.mkvi! local function check_experimental_overlay(head,current) local p = nil @@ -1131,7 +1131,12 @@ local function check_experimental_overlay(head,current) -- We deal with this at the tex end .. we don't see spacing .. enabling this code -- is probably harmless but then we need to test it. -- + -- we could calculate this before we call + -- + -- problem: prev list and next list can be unconnected + -- local c = getnext(p) + local l = c while c and c ~= n do local id = getid(c) if id == glue_code then @@ -1139,19 +1144,28 @@ local function check_experimental_overlay(head,current) elseif id == kern_code then skips = skips + getkern(c) end + l = c c = getnext(c) end + local c = getprev(n) + while c and c ~= n and c ~= l do + local id = getid(c) + if id == glue_code then + skips = skips + getwidth(c) + elseif id == kern_code then + skips = skips + getkern(c) + end + c = getprev(c) + end -- local delta = n_ht + skips + p_dp texsetdimen("global","d_spac_overlay",-delta) -- for tracing + -- we should adapt pagetotal ! (need a hook for that) .. now we have the wrong pagebreak local k = new_kern(-delta) + head = insert_node_before(head,n,k) if n_ht > p_ht then - -- we should adapt pagetotal ! (need a hook for that) .. now we have the wrong pagebreak - setheight(p,n_ht) - end - insert_node_before(head,n,k) - if p == head then - head = k + local k = new_kern(n_ht-p_ht) + head = insert_node_before(head,p,k) end if trace_vspacing then report_vspacing("overlaying, prev height: %p, prev depth: %p, next height: %p, skips: %p, move up: %p",p_ht,p_dp,n_ht,skips,delta) @@ -1177,7 +1191,7 @@ local function check_experimental_overlay(head,current) c = current while c do local id = getid(c) - if id == glue_code or id == penalty_code then + if id == glue_code or id == penalty_code then -- kern ? c = getprev(c) elseif id == hlist_code then p = c @@ -1190,6 +1204,7 @@ local function check_experimental_overlay(head,current) if a_snapmethod == a_snapvbox then -- quit, we're not on the mvl else + -- inefficient when we're at the end of a page local c = tonut(texlists.page_head) while c and c ~= n do local id = getid(c) diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 35991ae80..eb8c1fec7 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index d55d283f5..011c188be 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkiv/strc-ref.mkvi b/tex/context/base/mkiv/strc-ref.mkvi index 9f2a7b91c..69a9e2219 100644 --- a/tex/context/base/mkiv/strc-ref.mkvi +++ b/tex/context/base/mkiv/strc-ref.mkvi @@ -372,7 +372,7 @@ {\begingroup \dowithnextbox {\strc_references_set_page_only_destination_attribute{#1}% - \hbox + \hpack % \hbox \ifnum\lastdestinationattribute=\attributeunsetvalue\else attr \destinationattribute \lastdestinationattribute \fi {\box\b_strc_destination_nodes\box\nextbox}% \endgroup}} diff --git a/tex/context/fonts/mkiv/cambria-math.lfg b/tex/context/fonts/mkiv/cambria-math.lfg index ae875e64d..c18854d18 100644 --- a/tex/context/fonts/mkiv/cambria-math.lfg +++ b/tex/context/fonts/mkiv/cambria-math.lfg @@ -50,5 +50,20 @@ return { -- [0x1D44F] = 1000, -- 𝑎𝑏 demo -- } -- }, + -- kerns = { + -- [0x1D453] = { + -- force = true, + -- topright = { + -- { + -- kern = 1000, + -- }, + -- }, + -- bottomright = { + -- { + -- kern = 1000, + -- }, + -- }, + -- }, + -- }, }, } diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml index 07181d34f..7a861c30e 100644 --- a/tex/context/interface/mkiv/context-en.xml +++ b/tex/context/interface/mkiv/context-en.xml @@ -10483,11 +10483,15 @@ + + + + diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf index ba034bb5c..068bac6cb 100644 Binary files a/tex/context/interface/mkiv/i-context.pdf and b/tex/context/interface/mkiv/i-context.pdf differ diff --git a/tex/context/interface/mkiv/i-fonts.xml b/tex/context/interface/mkiv/i-fonts.xml index c774ef273..02da28a93 100644 --- a/tex/context/interface/mkiv/i-fonts.xml +++ b/tex/context/interface/mkiv/i-fonts.xml @@ -49,6 +49,10 @@ + + + + @@ -59,6 +63,10 @@ + + + +