diff options
author | Hans Hagen <pragma@wxs.nl> | 2023-05-07 16:54:07 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2023-05-07 16:54:07 +0200 |
commit | 51156ffe8b1434d9c1896f12a59554cbe877ee3d (patch) | |
tree | 9b7f63933469eb41dadca4825da317d1c2839990 | |
parent | cc6d486ffa3fad4ffb698ad5ccbd5c5f4ebc6a00 (diff) | |
download | context-51156ffe8b1434d9c1896f12a59554cbe877ee3d.tar.gz |
2023-05-07 16:28:00
42 files changed, 1457 insertions, 643 deletions
diff --git a/doc/context/scripts/mkiv/mtx-install-modules.html b/doc/context/scripts/mkiv/mtx-install-modules.html new file mode 100644 index 000000000..b75ed4b42 --- /dev/null +++ b/doc/context/scripts/mkiv/mtx-install-modules.html @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<!-- compare with lmx framework variant --> + +<!-- + filename : context-base.xml + comment : companion to mtx-server-ctx-startup.tex + author : Hans Hagen, PRAGMA-ADE, Hasselt NL + copyright: PRAGMA ADE / ConTeXt Development Team + license : see context related readme files +--> + +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> + <head> + <title>ConTeXt Module Installer 1.00</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <style type="text/css"> + body { color: #FFFFFF; background-color: #808080; font-family: optima, verdana, futura, "lucida sans", arial, geneva, helvetica, sans; font-size: 12px; line-height: 18px; } a:link, a:active, a:visited { color: #FFFFFF; } a.dir-view:link, a.dir-view:active, a.dir-view:visited { color: #FFFFFF; text-decoration: underline; } .valid { color: #00FF00; } .invalid { color: #FF0000; } .invisible { visibility: hidden; } button, .commonlink, .smallbutton { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; border-color: #7F7F7F; border-style: solid; border-width: .125ex; background-color: #FFFFFF; padding: .5ex; } .smallbutton { width: 1em; } a.commonlink:link, a.commonlink:active, a.commonlink:visited, a.smalllink:link, a.smalllink:active, a.smalllink:visited { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; } h1, .title { font-style: normal; font-weight: normal; font-size: 18px; line-height: 18px; margin-bottom: 20px; } h2, .subtitle { font-style: normal; font-weight: normal; font-size: 12px; margin-top: 18px; margin-bottom: 18px; } table { line-height: 18px; font-size: 12px; margin: 0; } th { font-weight: bold; text-align: left; padding-bottom: 6px; } .tc { font-weight: bold; text-align: left; } p, li { max-width: 60em; } .empty-line { margin-top: 4px; } .more-room { margin-right: 1.5em; } .much-more-room { margin-right: 3em; } #main { position: absolute; left: 10%; top: 10%; right: 10%; bottom: 10%; z-index: 2; width: 80%; height: 80%; padding: 0%; margin: 0%; overflow: auto; border-style: none; border-width: 0; background-color: #3F3F3F; } #main-settings { margin: 12px; x_max-width: 60em; line-height: 18px; font-size: 12px; } #left { position: absolute; top : 10%; left: 0%; bottom: 0%; right: 90%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; } #right { position: absolute; top : 0%; left: 90%; bottom: 10%; right: 0%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; _margin-left: -15px; } #bottom { position: absolute; left: 10%; right: 0%; top: 90%; bottom: 0%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top { position: absolute; left: 0%; right: 10%; top: 0%; bottom: 90%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #top-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: right; vertical-align: middle; } #bottom-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #bottom-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: left; vertical-align: middle; } #left-one { position: absolute; width: 100%; buggedheight: 100%; } #left-two { position: relative; margin-top: 12px; line-height: 18px; text-align: center; vertical-align: top; } #right-one { display: table; height: 100%; width: 100%; } #right-two { display: table-row; height: 100%; width: 100%; } #right-three { display: table-cell; width: 100%; vertical-align: bottom; _position: absolute; _top: 100%; } #right-four { text-align: center; margin-bottom: 2ex; _position: relative; _top: -100%; } #more-top { position: absolute; top: 0%; left: 90%; bottom: 90%; right: 0%; z-index: 3; width: 10%; height: 10%; padding: 0%; margin: 0%; border-style: none; border-width: 0; } #more-top-settings { text-align: center; } #more-right-settings { margin-right: 12px; margin-left: 12px; line-height: 18px; font-size: 10px; text-align: center; } #right-safari { _display: table; width: 100%; height: 100%; } + </style> + <style type="text/css"> + </style> + </head> + <body> + <div id="top"> <div id="top-one"> + <div id="top-two">ConTeXt Module Installer 1.00 </div> + </div> + </div> + <div id="bottom"> <div id="bottom-one"> + <div id="bottom-two">wiki: http://contextgarden.net | mail: ntg-context@ntg.nl | website: http://www.pragma-ade.nl</div> + </div> + </div> + <div id="left"></div> + <div id="right"></div> + <div id="main"> + <div id='main-settings'> + <h1>Command line options</h1> +<table> + <tr><th style="width: 10em">flag</th><th style="width: 8em">value</th><th>description</th></tr> + <tr><th/><td/><td/></tr> + <tr><th>--list</th><td></td><td>list modules</td></tr> + <tr><th>--install</th><td></td><td>install modules</td></tr> + <tr><th>--module</th><td></td><td>install (zip) file(s)</td></tr> + </table> +<br/> +<h1>Examples</h1> +<tt>mtxrun --script install-modules --list</tt> +<br/><br/><tt>mtxrun --script install-modules --install filter letter</tt> +<br/><tt>mtxrun --script install-modules --install tikz</tt> +<br/><tt>mtxrun --script install-modules --install --all</tt> +<br/><br/><tt>mtxrun --script install-modules --install --module t-letter.zip</tt> +<br/><br/> </div> + </div> + </body> +</html> diff --git a/doc/context/scripts/mkiv/mtx-install-modules.man b/doc/context/scripts/mkiv/mtx-install-modules.man new file mode 100644 index 000000000..cd83aea54 --- /dev/null +++ b/doc/context/scripts/mkiv/mtx-install-modules.man @@ -0,0 +1,33 @@ +.TH "mtx-install" "1" "01-01-2023" "version 2.01" "ConTeXt Installer" +.SH NAME + mtx-install - ConTeXt Installer +.SH SYNOPSIS +.B mtxrun --script install [ +.I OPTIONS ... +.B ] [ +.I FILENAMES +.B ] +.SH DESCRIPTION +.B ConTeXt Installer +.SH OPTIONS +.TP +.B --list +list modules +.TP +.B --install +install modules +.TP +.B --module +install (zip) file(s) +.SH AUTHOR +More information about ConTeXt and the tools that come with it can be found at: + + +.B "maillist:" +ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context + +.B "webpage:" +http://www.pragma-ade.nl / http://tex.aanhet.net + +.B "wiki:" +http://contextgarden.net diff --git a/doc/context/scripts/mkiv/mtx-install-modules.xml b/doc/context/scripts/mkiv/mtx-install-modules.xml new file mode 100644 index 000000000..872c1d64e --- /dev/null +++ b/doc/context/scripts/mkiv/mtx-install-modules.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-install</entry> + <entry name="detail">ConTeXt Installer</entry> + <entry name="version">2.01</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="list"><short>list modules</short></flag> + <flag name="install"><short>install modules</short></flag> + <flag name="module"><short>install (zip) file(s)</short></flag> + </subcategory> + </category> + </flags> + <examples> + <category> + <title>Examples</title> + <subcategory> + <example><command>mtxrun --script install-modules --list</command></example> + </subcategory> + <subcategory> + <example><command>mtxrun --script install-modules --install filter letter</command></example> + <example><command>mtxrun --script install-modules --install tikz</command></example> + <example><command>mtxrun --script install-modules --install --all</command></example> + </subcategory> + <subcategory> + <example><command>mtxrun --script install-modules --install --module t-letter.zip</command></example> + </subcategory> + </category> + </examples> +</application> diff --git a/doc/context/scripts/mkiv/mtx-install.html b/doc/context/scripts/mkiv/mtx-install.html new file mode 100644 index 000000000..dc08c4837 --- /dev/null +++ b/doc/context/scripts/mkiv/mtx-install.html @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<!-- compare with lmx framework variant --> + +<!-- + filename : context-base.xml + comment : companion to mtx-server-ctx-startup.tex + author : Hans Hagen, PRAGMA-ADE, Hasselt NL + copyright: PRAGMA ADE / ConTeXt Development Team + license : see context related readme files +--> + +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> + <head> + <title>ConTeXt Installer 2.01</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <style type="text/css"> + body { color: #FFFFFF; background-color: #808080; font-family: optima, verdana, futura, "lucida sans", arial, geneva, helvetica, sans; font-size: 12px; line-height: 18px; } a:link, a:active, a:visited { color: #FFFFFF; } a.dir-view:link, a.dir-view:active, a.dir-view:visited { color: #FFFFFF; text-decoration: underline; } .valid { color: #00FF00; } .invalid { color: #FF0000; } .invisible { visibility: hidden; } button, .commonlink, .smallbutton { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; border-color: #7F7F7F; border-style: solid; border-width: .125ex; background-color: #FFFFFF; padding: .5ex; } .smallbutton { width: 1em; } a.commonlink:link, a.commonlink:active, a.commonlink:visited, a.smalllink:link, a.smalllink:active, a.smalllink:visited { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; } h1, .title { font-style: normal; font-weight: normal; font-size: 18px; line-height: 18px; margin-bottom: 20px; } h2, .subtitle { font-style: normal; font-weight: normal; font-size: 12px; margin-top: 18px; margin-bottom: 18px; } table { line-height: 18px; font-size: 12px; margin: 0; } th { font-weight: bold; text-align: left; padding-bottom: 6px; } .tc { font-weight: bold; text-align: left; } p, li { max-width: 60em; } .empty-line { margin-top: 4px; } .more-room { margin-right: 1.5em; } .much-more-room { margin-right: 3em; } #main { position: absolute; left: 10%; top: 10%; right: 10%; bottom: 10%; z-index: 2; width: 80%; height: 80%; padding: 0%; margin: 0%; overflow: auto; border-style: none; border-width: 0; background-color: #3F3F3F; } #main-settings { margin: 12px; x_max-width: 60em; line-height: 18px; font-size: 12px; } #left { position: absolute; top : 10%; left: 0%; bottom: 0%; right: 90%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; } #right { position: absolute; top : 0%; left: 90%; bottom: 10%; right: 0%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; _margin-left: -15px; } #bottom { position: absolute; left: 10%; right: 0%; top: 90%; bottom: 0%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top { position: absolute; left: 0%; right: 10%; top: 0%; bottom: 90%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #top-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: right; vertical-align: middle; } #bottom-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #bottom-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: left; vertical-align: middle; } #left-one { position: absolute; width: 100%; buggedheight: 100%; } #left-two { position: relative; margin-top: 12px; line-height: 18px; text-align: center; vertical-align: top; } #right-one { display: table; height: 100%; width: 100%; } #right-two { display: table-row; height: 100%; width: 100%; } #right-three { display: table-cell; width: 100%; vertical-align: bottom; _position: absolute; _top: 100%; } #right-four { text-align: center; margin-bottom: 2ex; _position: relative; _top: -100%; } #more-top { position: absolute; top: 0%; left: 90%; bottom: 90%; right: 0%; z-index: 3; width: 10%; height: 10%; padding: 0%; margin: 0%; border-style: none; border-width: 0; } #more-top-settings { text-align: center; } #more-right-settings { margin-right: 12px; margin-left: 12px; line-height: 18px; font-size: 10px; text-align: center; } #right-safari { _display: table; width: 100%; height: 100%; } + </style> + <style type="text/css"> + </style> + </head> + <body> + <div id="top"> <div id="top-one"> + <div id="top-two">ConTeXt Installer 2.01 </div> + </div> + </div> + <div id="bottom"> <div id="bottom-one"> + <div id="bottom-two">wiki: http://contextgarden.net | mail: ntg-context@ntg.nl | website: http://www.pragma-ade.nl</div> + </div> + </div> + <div id="left"></div> + <div id="right"></div> + <div id="main"> + <div id='main-settings'> + <h1>Command line options</h1> +<table> + <tr><th style="width: 10em">flag</th><th style="width: 8em">value</th><th>description</th></tr> + <tr><th/><td/><td/></tr> + <tr><th>--platform</th><td>string</td><td>platform</td></tr> + <tr><th>--server</th><td>string</td><td>repository url (rsync://contextgarden.net)</td></tr> + <tr><th>--modules</th><td>string</td><td>extra modules (can be list or 'all')</td></tr> + <tr><th>--fonts</th><td>string</td><td>additional fonts (can be list or 'all')</td></tr> + <tr><th>--goodies</th><td>string</td><td>extra binaries (like scite and texworks)</td></tr> + <tr><th>--install</th><td></td><td>install context</td></tr> + <tr><th>--update</th><td></td><td>update context</td></tr> + <tr><th>--erase</th><td></td><td>wipe the cache</td></tr> + <tr><th>--identify</th><td></td><td>create list of files</td></tr> + <tr><th>--secure</th><td></td><td>use curl for https</td></tr> + </table> +<br/> + </div> + </div> + </body> +</html> diff --git a/doc/context/scripts/mkiv/mtx-install.man b/doc/context/scripts/mkiv/mtx-install.man new file mode 100644 index 000000000..77ea98600 --- /dev/null +++ b/doc/context/scripts/mkiv/mtx-install.man @@ -0,0 +1,54 @@ +.TH "mtx-install" "1" "01-01-2023" "version 2.01" "ConTeXt Installer" +.SH NAME + mtx-install - ConTeXt Installer +.SH SYNOPSIS +.B mtxrun --script install [ +.I OPTIONS ... +.B ] [ +.I FILENAMES +.B ] +.SH DESCRIPTION +.B ConTeXt Installer +.SH OPTIONS +.TP +.B --platform=string +platform +.TP +.B --server=string +repository url (rsync://contextgarden.net) +.TP +.B --modules=string +extra modules (can be list or 'all') +.TP +.B --fonts=string +additional fonts (can be list or 'all') +.TP +.B --goodies=string +extra binaries (like scite and texworks) +.TP +.B --install +install context +.TP +.B --update +update context +.TP +.B --erase +wipe the cache +.TP +.B --identify +create list of files +.TP +.B --secure +use curl for https +.SH AUTHOR +More information about ConTeXt and the tools that come with it can be found at: + + +.B "maillist:" +ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context + +.B "webpage:" +http://www.pragma-ade.nl / http://tex.aanhet.net + +.B "wiki:" +http://contextgarden.net diff --git a/doc/context/scripts/mkiv/mtx-install.xml b/doc/context/scripts/mkiv/mtx-install.xml new file mode 100644 index 000000000..a7dd8631c --- /dev/null +++ b/doc/context/scripts/mkiv/mtx-install.xml @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-install</entry> + <entry name="detail">ConTeXt Installer</entry> + <entry name="version">2.01</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="platform" value="string"><short>platform</short></flag> + <flag name="server" value="string"><short>repository url (rsync://contextgarden.net)</short></flag> + <flag name="modules" value="string"><short>extra modules (can be list or 'all')</short></flag> + <flag name="fonts" value="string"><short>additional fonts (can be list or 'all')</short></flag> + <flag name="goodies" value="string"><short>extra binaries (like scite and texworks)</short></flag> + <flag name="install"><short>install context</short></flag> + <flag name="update"><short>update context</short></flag> + <flag name="erase"><short>wipe the cache</short></flag> + <flag name="identify"><short>create list of files</short></flag> + <flag name="secure"><short>use curl for https</short></flag> + </subcategory> + </category> + </flags> +</application> diff --git a/doc/context/sources/general/manuals/workflows/workflows-graphics.tex b/doc/context/sources/general/manuals/workflows/workflows-graphics.tex index 2246c1c88..9c6fb232d 100644 --- a/doc/context/sources/general/manuals/workflows/workflows-graphics.tex +++ b/doc/context/sources/general/manuals/workflows/workflows-graphics.tex @@ -198,6 +198,42 @@ images it might make sense to have a final run with a higher compress level. The \stopsection +\startsection[title=Remote] + +You can include images from a remote location using a \URL\ specification. + +\starttyping +\externalfigure[https://www.pragma-ade.com/logo-ade.png] % via curl +\externalfigure[http://www.pragma-ade.com/logo-ade.png] % via socket +\stoptyping + +Normally the socket library will be used for \type {http} and Curl for \type +{https}. Images are cached and there is some threshold that makes sure that we +don't keep fetching. You can set the threshold to zero seconds to avoid that: + +\starttyping +\enabledirectives[schemes.threshold=0] +\stoptyping + +In \LMTX\ there are some more options: + +\starttyping +\enabledirectives[schemes.inmemory] +\enabledirectives[schemes.uselibrary] +\stoptyping + +The first option avoid storing an image in a file and therefore consumes a bit +more memory and the second one tries to use the Curl library instead of calling +the program. If you want ot see what is going on you can use: + +\starttyping +\enabletrackers[resolvers.schemes] +\enabletrackers[graphics.locating] +\enabletrackers[resolvers.virtual] +\stoptyping + +\stopsection + \stopchapter \stopcomponent diff --git a/scripts/context/lua/mtx-ctan.lua b/scripts/context/lua/mtx-ctan.lua index 6de51caa3..7603e363b 100644 --- a/scripts/context/lua/mtx-ctan.lua +++ b/scripts/context/lua/mtx-ctan.lua @@ -141,6 +141,7 @@ end local function checkedpattern(pattern) if pattern then + pattern = string.topattern(pattern,true) return lower(shaped(pattern)) end end @@ -291,7 +292,7 @@ scripts.ctan.topics = json and found[#found+1] = { key or name, details } end else - if strfound(pattern,name) or strfound(pattern,details) then + if strfound(pattern,key or name) or strfound(pattern,details) then found[#found+1] = { key or name, details } end end diff --git a/scripts/context/lua/mtx-install-modules.lua b/scripts/context/lua/mtx-install-modules.lua new file mode 100644 index 000000000..590e321fe --- /dev/null +++ b/scripts/context/lua/mtx-install-modules.lua @@ -0,0 +1,323 @@ +if not modules then modules = { } end modules ['mtx-install-modules'] = { + version = 1.234, + comment = "companion to mtxrun.lua", + author = "Hans Hagen", + copyright = "ConTeXt Development Team", + license = "see context related readme files" +} + +-- Installing tikz is a bit tricky because there are many packages involved and it's +-- sort of impossible to derive from the names what to include in the installation. +-- I tried to use the ctan scrips we ship but there is no way to reliably derive a +-- set from the topics or packages using the web api (there are also some +-- inconsistencies between the json and xml interfaces that will not be fixed). A +-- wildcard pull of everything tikz/pgf is likely to fail or at least gives files we +-- don't want and/or need, the solution is to be specific. +-- +-- After that was implemented the script changed name and now also installs the +-- third party modules. +-- +-- We use curl and not the built in socket library because all kind of ssl and +-- redirection can kick in and who know how it evolves. +-- +-- We use the context unzipper because we cannot be sure if unzip is present on the +-- system. In many cases windows, linux and osx installations lack it by default. +-- +-- This script should be run in the tex root where there is also a texmf-context sub +-- directory; it will quit otherwise. The modules path will be created when absent. +-- +-- Maybe some day we can get the modules from ctan but then we need a consistent +-- names and such. + +local helpinfo = [[ +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-install</entry> + <entry name="detail">ConTeXt Installer</entry> + <entry name="version">2.01</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="list"><short>list modules</short></flag> + <flag name="install"><short>install modules</short></flag> + <flag name="module"><short>install (zip) file(s)</short></flag> + </subcategory> + </category> + </flags> + <examples> + <category> + <title>Examples</title> + <subcategory> + <example><command>mtxrun --script install-modules --list</command></example> + </subcategory> + <subcategory> + <example><command>mtxrun --script install-modules --install filter letter</command></example> + <example><command>mtxrun --script install-modules --install tikz</command></example> + <example><command>mtxrun --script install-modules --install --all</command></example> + </subcategory> + <subcategory> + <example><command>mtxrun --script install-modules --install --module t-letter.zip</command></example> + </subcategory> + </category> + </examples> +</application> +]] + + +local application = logs.application { + name = "mtx-install-modules", + banner = "ConTeXt Module Installer 1.00", + helpinfo = helpinfo, +} + +local report = application.report + +scripts = scripts or { } +scripts.modules = scripts.modules or { } + +local okay, curl = pcall(require,"libs-imp-curl") + +local fetched = curl and curl.fetch and function(str) + local data, message = curl.fetch { + url = str, + followlocation = true, + sslverifyhost = false, + sslverifypeer = false, + } + if not data then + report("some error: %s",message) + end + return data +end or function(str) + -- So, no redirect to http, which means that we cannot use the built in socket + -- library. What if the client is happy with http? + local data = os.resultof("curl -sSL " .. str) + return data +end + +local urls = { + ctan = "https://mirrors.ctan.org/install", + modules = "https://modules.contextgarden.net/dl" +} + +local tmpzipfile = "temp.zip" +local checkdir = "texmf-context" +local targetdir = "texmf-modules" + +local function install(list) + if type(list) ~= "table"then + report("unknown specification") + end + local zips = list.zips + local wipes = list.wipes + if type(zips) ~= "table" then + report("incomplete specification") + else + report("installing into %a",targetdir) + for i=1,#zips do + local where = urls[list.url] .. "/" .. zips[i] + local data = fetched(where) + if string.find(data,"^PK") then + io.savedata(tmpzipfile,data) + report("from %a",where) + report("into %a",targetdir) + utilities.zipfiles.unzipdir { + zipname = tmpzipfile, + path = ".", + verbose = "steps", + } + os.remove(tmpzipfile) + else + report("unknown %a",where) + end + end + + local function wiper(wipes) + for i=1,#wipes do + local s = wipes[i] + if type(s) == "table" then + wiper(s) + elseif type(s) == "string" then + local t = dir.glob(s) + report("wiping %i files in %a",#t,s) + for i=1,#t do + os.remove(t[i]) + end + end + end + end + + if type(wipes) == "table" then + wiper(wipes) + end + end +end + +local function wipers(s) + return { + "tex/context/third/" ..s.. "/**", + "doc/context/third/" ..s.. "/**", + "source/context/third/" ..s.. "/**", + + "tex/context/" ..s.. "/**", + "doc/context/" ..s.. "/**", + "source/context/" ..s.. "/**", + + "scripts/" ..s.. "/**", + } +end + +local defaults = { + "tex/latex/**", + "tex/plain/**", + + "doc/latex/**", + "doc/plain/**", + "doc/generic/**", + + "source/latex/**", + "source/plain/**", + "source/generic/**", +} + +local lists = { + ["tikz"] = { + url = "ctan", + zips = { + "graphics/pgf/base/pgf.tds.zip", + "graphics/pgf/contrib/pgfplots.tds.zip", + "graphics/pgf/contrib/circuitikz.tds.zip", + }, + wipes = { + wipers("pgf"), + wipers("pgfplots"), + wipers("circuitikz"), + defaults, + } + }, + -- from the context garden + ["pocketdiary"] = { url = "modules", zips = { "Collection-of-calendars-based-on-PocketDiary-module.zip" } }, + ["collating"] = { url = "modules", zips = { "Environment-for-collating-marks.zip" } }, + ["account"] = { url = "modules", zips = { "t-account.zip" } }, + ["algorithmic"] = { url = "modules", zips = { "t-algorithmic.zip" } }, + ["animation"] = { url = "modules", zips = { "t-animation.zip" } }, + ["annotation"] = { url = "modules", zips = { "t-annotation.zip" } }, + ["aquamints"] = { url = "modules", zips = { "aquamints.zip" } }, + ["bibmod-doc"] = { url = "modules", zips = { "bibmod-doc.zip" } }, + -- ["bnf-0.3"] = { url = "modules", zips = { "t-bnf-0.3.zip" } }, + ["bnf"] = { url = "modules", zips = { "t-bnf.zip" } }, + ["chromato"] = { url = "modules", zips = { "t-chromato.zip" } }, + ["cmscbf"] = { url = "modules", zips = { "t-cmscbf.zip" } }, + ["cmttbf"] = { url = "modules", zips = { "t-cmttbf.zip" } }, + ["crossref"] = { url = "modules", zips = { "t-crossref.zip" } }, + ["cyrillicnumbers"] = { url = "modules", zips = { "t-cyrillicnumbers.zip" } }, + ["degrade"] = { url = "modules", zips = { "t-degrade.zip" } }, + ["enigma"] = { url = "modules", zips = { "enigma.zip" } }, + ["fancybreak"] = { url = "modules", zips = { "t-fancybreak.zip" } }, + ["filter"] = { url = "modules", zips = { "t-filter.zip" } }, + ["french"] = { url = "modules", zips = { "t-french.zip" } }, + ["fullpage"] = { url = "modules", zips = { "t-fullpage.zip" } }, + ["gantt"] = { url = "modules", zips = { "t-gantt.zip" } }, + ["gfsdidot"] = { url = "modules", zips = { "gfsdidot.zip" } }, + ["gm"] = { url = "modules", zips = { "t-gm.zip" } }, + ["gnuplot"] = { url = "modules", zips = { "t-gnuplot.zip" } }, + ["greek"] = { url = "modules", zips = { "t-greek.zip" } }, + ["grph-downsample"] = { url = "modules", zips = { "grph-downsample.lua.zip" } }, + ["gs"] = { url = "modules", zips = { "t-gs.zip" } }, + ["high"] = { url = "modules", zips = { "high.zip" } }, + ["inifile"] = { url = "modules", zips = { "t-inifile.zip" } }, + ["karnaugh"] = { url = "modules", zips = { "karnaugh.zip" } }, + ["layout"] = { url = "modules", zips = { "t-layout.zip" } }, + ["letter"] = { url = "modules", zips = { "t-letter.zip" } }, + ["letterspace"] = { url = "modules", zips = { "t-letterspace.mkiv.zip" } }, + ["lettrine"] = { url = "modules", zips = { "t-lettrine.zip" } }, + ["lua-widow-control"] = { url = "modules", zips = { "lua-widow-control.zip" } }, + ["mathsets"] = { url = "modules", zips = { "t-mathsets.zip" } }, + ["metaducks"] = { url = "modules", zips = { "metaducks.zip" } }, + ["pret-c.lua"] = { url = "modules", zips = { "pret-c.lua.zip" } }, + ["rst"] = { url = "modules", zips = { "t-rst.zip" } }, + ["rsteps"] = { url = "modules", zips = { "t-rsteps.zip" } }, + ["simplebib"] = { url = "modules", zips = { "t-simplebib.zip" } }, + ["simplefonts"] = { url = "modules", zips = { "t-simplefonts.zip" } }, + ["simpleslides"] = { url = "modules", zips = { "t-simpleslides.zip" } }, + ["stormfontsupport"] = { url = "modules", zips = { "stormfontsupport.zip" } }, + ["sudoku"] = { url = "modules", zips = { "sudoku.zip" } }, + ["taspresent"] = { url = "modules", zips = { "t-taspresent.zip" } }, + ["texshow"] = { url = "modules", zips = { "u-texshow.zip" } }, + ["title"] = { url = "modules", zips = { "t-title.zip" } }, + ["transliterator"] = { url = "modules", zips = { "t-transliterator.zip" } }, + ["typearea"] = { url = "modules", zips = { "t-typearea.zip" } }, + ["typescripts"] = { url = "modules", zips = { "t-typescripts.zip" } }, + ["urwgaramond"] = { url = "modules", zips = { "f-urwgaramond.zip" } }, + ["urwgothic"] = { url = "modules", zips = { "f-urwgothic.zip" } }, + ["vim"] = { url = "modules", zips = { "t-vim.zip" } }, + ["visualcounter"] = { url = "modules", zips = { "t-visualcounter.zip" } }, +} + + +function scripts.modules.list() + for k, v in table.sortedhash(lists) do + report("%-20s: %-36s : % t",k,urls[v.url],v.zips) + end +end + +function scripts.modules.install() + local curdir = dir.current() + local done = false + if not lfs.isdir(checkdir) then + report("unknown subdirectory %a",checkdir) + elseif not dir.mkdirs(targetdir) then + report("unable to create %a",targetdir) + elseif not lfs.chdir(targetdir) then + report("unable to go into %a",targetdir) + elseif environment.argument("module") or environment.argument("modules") then + local files = environment.files + if #files == 0 then + report("no archive names provided") + else + for i=1,#files do + local name = files[i] + install { url = "modules", zips = { file.addsuffix(name,"zip") } } + end + done = files + end + else + local files = environment.argument("all") and table.sortedkeys(lists) or environment.files + if #files == 0 then + report("no module names provided") + else + for i=1,#files do + local list = lists[files[i]] + if list then + install(list) + end + end + done = files + end + end + if done then + report() + report("renewing file database") + report() + resolvers.renewcache() + resolvers.load() + report() + report("installed: % t",done) + report() + end + lfs.chdir(curdir) +end + +if environment.argument("list") then + scripts.modules.list() +elseif environment.argument("install") then + scripts.modules.install() +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) +else + application.help() + report("") +end + diff --git a/scripts/context/lua/mtx-install-tikz.lua b/scripts/context/lua/mtx-install-tikz.lua deleted file mode 100644 index 74a292241..000000000 --- a/scripts/context/lua/mtx-install-tikz.lua +++ /dev/null @@ -1,162 +0,0 @@ -if not modules then modules = { } end modules ['mtx-install-tikz'] = { - version = 1.234, - comment = "companion to mtxrun.lua", - author = "Hans Hagen", - copyright = "ConTeXt Development Team", - license = "see context related readme files" -} - --- Installing tikz is a bit tricky because there are many packages involved and it's --- sort of impossible to derive from the names what to include in the installation. --- I tried to use the ctan scrips we ship but there is no way to reliably derive a --- set from the topics or packages using the web api (there are also some --- inconsistencies between the jkson and xml interfaces that will not be fixed). A --- wildcard pull of everything tikz/pgf is likely to fail or at least gives files we --- don't want and/or need, the solution is to be specific. --- --- We use curl and not the built in socket library because all kind of ssl and --- redirection can kick in and who know how it evolves. --- --- We use the context unzipper because we cannot be sure if unzip is present on the --- system. In many cases windows, linux and osx installations lack it by default. --- --- This script has no help info etc as it's a rather dumb downloader. One can always --- do a better job than this suboptimal quick hack. Let me know if I forget to wipe --- something. --- --- mtxrun --script install-tikz --- --- It should be run in the tex root and will quit when there is no texmf-context --- path found. The modules path will be created when absent. - -local okay, curl = pcall(require,"libs-imp-curl") - -local fetched = curl and curl.fetch and function(str) - local data, message = curl.fetch { - url = str, - followlocation = true, - sslverifyhost = false, - sslverifypeer = false, - } - if not data then - report("some error: %s",message) - end - return data -end or function(str) - -- So, no redirect to http, which means that we cannot use the built in socket - -- library. What if the client is happy with http? - local data = os.resultof("curl -sSL " .. str) - return data -end - -local ctanurl = "https://mirrors.ctan.org/install" -local tmpzipfile = "temp.zip" -local checkdir = "texmf-context" -local targetdir = "texmf-modules" - -local report = logs.reporter("install") - -scripts = scripts or { } -scripts.ctan = scripts.ctan or { } - -function scripts.ctan.install(list) - if type(list) ~= "table"then - report("unknown specification") - end - local zips = list.zips - local wipes = list.wipes - if type(zips) ~= "table" or type(wipes) ~= "table" then - report("incomplete specification") - elseif not lfs.isdir(checkdir) then - report("unknown subdirectory %a",checkdir) - elseif not dir.mkdirs(targetdir) then - report("unable to create %a",targetdir) - elseif not lfs.chdir(targetdir) then - report("unable to go into %a",targetdir) - else - report("installing into %a",targetdir) - for i=1,#zips do - local where = ctanurl .. "/" .. zips[i] - local data = fetched(where) - if string.find(data,"^PK") then - io.savedata(tmpzipfile,data) - report("from %a",where) - report("into %a",targetdir) - utilities.zipfiles.unzipdir { - zipname = tmpzipfile, - path = ".", - verbose = "steps", - } - os.remove(tmpzipfile) - else - report("unknown %a",where) - end - end - - local function wiper(wipes) - for i=1,#wipes do - local s = wipes[i] - if type(s) == "table" then - wiper(s) - elseif type(s) == "string" then - local t = dir.glob(s) - report("wiping %i files in %a",#t,s) - for i=1,#t do - os.remove(t[i]) - end - end - end - end - - wiper(wipes) - - report("renewing file database") - resolvers.renewcache() - resolvers.load() - end -end - -local function wipers(s) - return { - "tex/context/third/" ..s.. "/**", - "doc/context/third/" ..s.. "/**", - "source/context/third/" ..s.. "/**", - - "tex/context/" ..s.. "/**", - "doc/context/" ..s.. "/**", - "source/context/" ..s.. "/**", - - "scripts/" ..s.. "/**", - } -end - -local defaults = { - "tex/latex/**", - "tex/plain/**", - - "doc/latex/**", - "doc/plain/**", - "doc/generic/**", - - "source/latex/**", - "source/plain/**", - "source/generic/**", -} - -local lists = { - tikz = { - zips = { - "graphics/pgf/base/pgf.tds.zip", - "graphics/pgf/contrib/pgfplots.tds.zip", - "graphics/pgf/contrib/circuitikz.tds.zip", - }, - wipes = { - wipers("pgf"), - wipers("pgfplots"), - wipers("circuitikz"), - defaults, - } - }, -} - -scripts.ctan.install(lists.tikz) diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index f8ef74110..27c2e6cb0 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -15876,7 +15876,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-zip"] = package.loaded["util-zip"] or true --- original size: 23730, stripped down to: 14293 +-- original size: 32353, stripped down to: 16001 if not modules then modules={} end modules ['util-zip']={ version=1.001, @@ -15902,11 +15902,13 @@ end local files=utilities.files local openfile=files.open local closefile=files.close +local getsize=files.size local readstring=files.readstring local readcardinal2=files.readcardinal2le local readcardinal4=files.readcardinal4le local setposition=files.setposition local getposition=files.getposition +local skipbytes=files.skip local band=bit32.band local rshift=bit32.rshift local lshift=bit32.lshift @@ -15929,6 +15931,55 @@ local openzipfile,closezipfile,unzipfile,foundzipfile,getziphash,getziplist do handle=openfile(name,0), } end + local function update(handle,data) + position=data.offset + setposition(handle,position) + local signature=readstring(handle,4) + if signature=="PK\3\4" then + local version=readcardinal2(handle) + local flag=readcardinal2(handle) + local method=readcardinal2(handle) + skipbytes(handle,4) + local crc32=readcardinal4(handle) + local compressed=readcardinal4(handle) + local uncompressed=readcardinal4(handle) + local namelength=readcardinal2(handle) + local extralength=readcardinal2(handle) + local filename=readstring(handle,namelength) + local descriptor=band(flag,8)~=0 + local encrypted=band(flag,1)~=0 + local acceptable=method==0 or method==8 + local skipped=0 + local size=0 + if encrypted then + size=readcardinal2(handle) + skipbytes(handle,size) + skipped=skipped+size+2 + skipbytes(8) + skipped=skipped+8 + size=readcardinal2(handle) + skipbytes(handle,size) + skipped=skipped+size+2 + size=readcardinal4(handle) + skipbytes(handle,size) + skipped=skipped+size+4 + size=readcardinal2(handle) + skipbytes(handle,size) + skipped=skipped+size+2 + end + if acceptable then + if filename~=data.filename then + else + position=position+30+namelength+extralength+skipped + data.position=position + return position + end + else + end + end + data.position=false + return false + end local function collect(z) if not z.list then local list={} @@ -15936,72 +15987,68 @@ local openzipfile,closezipfile,unzipfile,foundzipfile,getziphash,getziplist do local position=0 local index=0 local handle=z.handle - while true do - setposition(handle,position) - local signature=readstring(handle,4) - if signature=="PK\3\4" then - local version=readcardinal2(handle) - local flag=readcardinal2(handle) - local method=readcardinal2(handle) - local filetime=readcardinal2(handle) - local filedate=readcardinal2(handle) - local crc32=readcardinal4(handle) - local compressed=readcardinal4(handle) - local uncompressed=readcardinal4(handle) - local namelength=readcardinal2(handle) - local extralength=readcardinal2(handle) - local filename=readstring(handle,namelength) - local descriptor=band(flag,8)~=0 - local encrypted=band(flag,1)~=0 - local acceptable=method==0 or method==8 - local skipped=0 - local size=0 - if encrypted then - size=readcardinal2(handle) - skipbytes(size) - skipped=skipped+size+2 - skipbytes(8) - skipped=skipped+8 - size=readcardinal2(handle) - skipbytes(size) - skipped=skipped+size+2 - size=readcardinal4(handle) - skipbytes(size) - skipped=skipped+size+4 - size=readcardinal2(handle) - skipbytes(size) - skipped=skipped+size+2 - end - position=position+30+namelength+extralength+skipped - if descriptor then - setposition(handle,position+compressed) - crc32=readcardinal4(handle) - compressed=readcardinal4(handle) - uncompressed=readcardinal4(handle) - end - if acceptable then - index=index+1 - local data={ - filename=filename, - index=index, - position=position, - method=method, - compressed=compressed, - uncompressed=uncompressed, - crc32=crc32, - encrypted=encrypted, - } - hash[filename]=data - list[index]=data - else + local size=getsize(handle) + for i=size-4,size-64*1024,-1 do + setposition(handle,i) + local enddirsignature=readcardinal4(handle) + if enddirsignature==0x06054B50 then + local thisdisknumber=readcardinal2(handle) + local centraldisknumber=readcardinal2(handle) + local thisnofentries=readcardinal2(handle) + local totalnofentries=readcardinal2(handle) + local centralsize=readcardinal4(handle) + local centraloffset=readcardinal4(handle) + local commentlength=readcardinal2(handle) + local comment=readstring(handle,length) + if size-i>=22 then + if thisdisknumber==centraldisknumber then + setposition(handle,centraloffset) + while true do + if readcardinal4(handle)==0x02014B50 then + skipbytes(handle,4) + local flag=readcardinal2(handle) + local method=readcardinal2(handle) + skipbytes(handle,4) + local crc32=readcardinal4(handle) + local compressed=readcardinal4(handle) + local uncompressed=readcardinal4(handle) + local namelength=readcardinal2(handle) + local extralength=readcardinal2(handle) + local commentlength=readcardinal2(handle) + skipbytes(handle,8) + local headeroffset=readcardinal4(handle) + local filename=readstring(handle,namelength) + skipbytes(handle,extralength+commentlength) + local descriptor=band(flag,8)~=0 + local encrypted=band(flag,1)~=0 + local acceptable=method==0 or method==8 + if acceptable then + index=index+1 + local data={ + filename=filename, + index=index, + position=nil, + method=method, + compressed=compressed, + uncompressed=uncompressed, + crc32=crc32, + encrypted=encrypted, + offset=headeroffset, + } + hash[filename]=data + list[index]=data + end + else + break + end + end + end + break end - position=position+compressed - else - break end - z.list=list - z.hash=hash end + z.list=list + z.hash=hash end end function getziplist(z) @@ -16040,7 +16087,10 @@ local openzipfile,closezipfile,unzipfile,foundzipfile,getziphash,getziplist do local handle=z.handle local position=data.position local compressed=data.compressed - if compressed>0 then + if position==nil then + position=update(handle,data) + end + if position and compressed>0 then setposition(handle,position) local result=readstring(handle,compressed) if data.method==8 then @@ -26138,8 +26188,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1037585 --- stripped bytes : 408686 +-- original bytes : 1046208 +-- stripped bytes : 415601 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index f8ef74110..27c2e6cb0 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -15876,7 +15876,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-zip"] = package.loaded["util-zip"] or true --- original size: 23730, stripped down to: 14293 +-- original size: 32353, stripped down to: 16001 if not modules then modules={} end modules ['util-zip']={ version=1.001, @@ -15902,11 +15902,13 @@ end local files=utilities.files local openfile=files.open local closefile=files.close +local getsize=files.size local readstring=files.readstring local readcardinal2=files.readcardinal2le local readcardinal4=files.readcardinal4le local setposition=files.setposition local getposition=files.getposition +local skipbytes=files.skip local band=bit32.band local rshift=bit32.rshift local lshift=bit32.lshift @@ -15929,6 +15931,55 @@ local openzipfile,closezipfile,unzipfile,foundzipfile,getziphash,getziplist do handle=openfile(name,0), } end + local function update(handle,data) + position=data.offset + setposition(handle,position) + local signature=readstring(handle,4) + if signature=="PK\3\4" then + local version=readcardinal2(handle) + local flag=readcardinal2(handle) + local method=readcardinal2(handle) + skipbytes(handle,4) + local crc32=readcardinal4(handle) + local compressed=readcardinal4(handle) + local uncompressed=readcardinal4(handle) + local namelength=readcardinal2(handle) + local extralength=readcardinal2(handle) + local filename=readstring(handle,namelength) + local descriptor=band(flag,8)~=0 + local encrypted=band(flag,1)~=0 + local acceptable=method==0 or method==8 + local skipped=0 + local size=0 + if encrypted then + size=readcardinal2(handle) + skipbytes(handle,size) + skipped=skipped+size+2 + skipbytes(8) + skipped=skipped+8 + size=readcardinal2(handle) + skipbytes(handle,size) + skipped=skipped+size+2 + size=readcardinal4(handle) + skipbytes(handle,size) + skipped=skipped+size+4 + size=readcardinal2(handle) + skipbytes(handle,size) + skipped=skipped+size+2 + end + if acceptable then + if filename~=data.filename then + else + position=position+30+namelength+extralength+skipped + data.position=position + return position + end + else + end + end + data.position=false + return false + end local function collect(z) if not z.list then local list={} @@ -15936,72 +15987,68 @@ local openzipfile,closezipfile,unzipfile,foundzipfile,getziphash,getziplist do local position=0 local index=0 local handle=z.handle - while true do - setposition(handle,position) - local signature=readstring(handle,4) - if signature=="PK\3\4" then - local version=readcardinal2(handle) - local flag=readcardinal2(handle) - local method=readcardinal2(handle) - local filetime=readcardinal2(handle) - local filedate=readcardinal2(handle) - local crc32=readcardinal4(handle) - local compressed=readcardinal4(handle) - local uncompressed=readcardinal4(handle) - local namelength=readcardinal2(handle) - local extralength=readcardinal2(handle) - local filename=readstring(handle,namelength) - local descriptor=band(flag,8)~=0 - local encrypted=band(flag,1)~=0 - local acceptable=method==0 or method==8 - local skipped=0 - local size=0 - if encrypted then - size=readcardinal2(handle) - skipbytes(size) - skipped=skipped+size+2 - skipbytes(8) - skipped=skipped+8 - size=readcardinal2(handle) - skipbytes(size) - skipped=skipped+size+2 - size=readcardinal4(handle) - skipbytes(size) - skipped=skipped+size+4 - size=readcardinal2(handle) - skipbytes(size) - skipped=skipped+size+2 - end - position=position+30+namelength+extralength+skipped - if descriptor then - setposition(handle,position+compressed) - crc32=readcardinal4(handle) - compressed=readcardinal4(handle) - uncompressed=readcardinal4(handle) - end - if acceptable then - index=index+1 - local data={ - filename=filename, - index=index, - position=position, - method=method, - compressed=compressed, - uncompressed=uncompressed, - crc32=crc32, - encrypted=encrypted, - } - hash[filename]=data - list[index]=data - else + local size=getsize(handle) + for i=size-4,size-64*1024,-1 do + setposition(handle,i) + local enddirsignature=readcardinal4(handle) + if enddirsignature==0x06054B50 then + local thisdisknumber=readcardinal2(handle) + local centraldisknumber=readcardinal2(handle) + local thisnofentries=readcardinal2(handle) + local totalnofentries=readcardinal2(handle) + local centralsize=readcardinal4(handle) + local centraloffset=readcardinal4(handle) + local commentlength=readcardinal2(handle) + local comment=readstring(handle,length) + if size-i>=22 then + if thisdisknumber==centraldisknumber then + setposition(handle,centraloffset) + while true do + if readcardinal4(handle)==0x02014B50 then + skipbytes(handle,4) + local flag=readcardinal2(handle) + local method=readcardinal2(handle) + skipbytes(handle,4) + local crc32=readcardinal4(handle) + local compressed=readcardinal4(handle) + local uncompressed=readcardinal4(handle) + local namelength=readcardinal2(handle) + local extralength=readcardinal2(handle) + local commentlength=readcardinal2(handle) + skipbytes(handle,8) + local headeroffset=readcardinal4(handle) + local filename=readstring(handle,namelength) + skipbytes(handle,extralength+commentlength) + local descriptor=band(flag,8)~=0 + local encrypted=band(flag,1)~=0 + local acceptable=method==0 or method==8 + if acceptable then + index=index+1 + local data={ + filename=filename, + index=index, + position=nil, + method=method, + compressed=compressed, + uncompressed=uncompressed, + crc32=crc32, + encrypted=encrypted, + offset=headeroffset, + } + hash[filename]=data + list[index]=data + end + else + break + end + end + end + break end - position=position+compressed - else - break end - z.list=list - z.hash=hash end + z.list=list + z.hash=hash end end function getziplist(z) @@ -16040,7 +16087,10 @@ local openzipfile,closezipfile,unzipfile,foundzipfile,getziphash,getziplist do local handle=z.handle local position=data.position local compressed=data.compressed - if compressed>0 then + if position==nil then + position=update(handle,data) + end + if position and compressed>0 then setposition(handle,position) local result=readstring(handle,compressed) if data.method==8 then @@ -26138,8 +26188,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1037585 --- stripped bytes : 408686 +-- original bytes : 1046208 +-- stripped bytes : 415601 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index f8ef74110..27c2e6cb0 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -15876,7 +15876,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-zip"] = package.loaded["util-zip"] or true --- original size: 23730, stripped down to: 14293 +-- original size: 32353, stripped down to: 16001 if not modules then modules={} end modules ['util-zip']={ version=1.001, @@ -15902,11 +15902,13 @@ end local files=utilities.files local openfile=files.open local closefile=files.close +local getsize=files.size local readstring=files.readstring local readcardinal2=files.readcardinal2le local readcardinal4=files.readcardinal4le local setposition=files.setposition local getposition=files.getposition +local skipbytes=files.skip local band=bit32.band local rshift=bit32.rshift local lshift=bit32.lshift @@ -15929,6 +15931,55 @@ local openzipfile,closezipfile,unzipfile,foundzipfile,getziphash,getziplist do handle=openfile(name,0), } end + local function update(handle,data) + position=data.offset + setposition(handle,position) + local signature=readstring(handle,4) + if signature=="PK\3\4" then + local version=readcardinal2(handle) + local flag=readcardinal2(handle) + local method=readcardinal2(handle) + skipbytes(handle,4) + local crc32=readcardinal4(handle) + local compressed=readcardinal4(handle) + local uncompressed=readcardinal4(handle) + local namelength=readcardinal2(handle) + local extralength=readcardinal2(handle) + local filename=readstring(handle,namelength) + local descriptor=band(flag,8)~=0 + local encrypted=band(flag,1)~=0 + local acceptable=method==0 or method==8 + local skipped=0 + local size=0 + if encrypted then + size=readcardinal2(handle) + skipbytes(handle,size) + skipped=skipped+size+2 + skipbytes(8) + skipped=skipped+8 + size=readcardinal2(handle) + skipbytes(handle,size) + skipped=skipped+size+2 + size=readcardinal4(handle) + skipbytes(handle,size) + skipped=skipped+size+4 + size=readcardinal2(handle) + skipbytes(handle,size) + skipped=skipped+size+2 + end + if acceptable then + if filename~=data.filename then + else + position=position+30+namelength+extralength+skipped + data.position=position + return position + end + else + end + end + data.position=false + return false + end local function collect(z) if not z.list then local list={} @@ -15936,72 +15987,68 @@ local openzipfile,closezipfile,unzipfile,foundzipfile,getziphash,getziplist do local position=0 local index=0 local handle=z.handle - while true do - setposition(handle,position) - local signature=readstring(handle,4) - if signature=="PK\3\4" then - local version=readcardinal2(handle) - local flag=readcardinal2(handle) - local method=readcardinal2(handle) - local filetime=readcardinal2(handle) - local filedate=readcardinal2(handle) - local crc32=readcardinal4(handle) - local compressed=readcardinal4(handle) - local uncompressed=readcardinal4(handle) - local namelength=readcardinal2(handle) - local extralength=readcardinal2(handle) - local filename=readstring(handle,namelength) - local descriptor=band(flag,8)~=0 - local encrypted=band(flag,1)~=0 - local acceptable=method==0 or method==8 - local skipped=0 - local size=0 - if encrypted then - size=readcardinal2(handle) - skipbytes(size) - skipped=skipped+size+2 - skipbytes(8) - skipped=skipped+8 - size=readcardinal2(handle) - skipbytes(size) - skipped=skipped+size+2 - size=readcardinal4(handle) - skipbytes(size) - skipped=skipped+size+4 - size=readcardinal2(handle) - skipbytes(size) - skipped=skipped+size+2 - end - position=position+30+namelength+extralength+skipped - if descriptor then - setposition(handle,position+compressed) - crc32=readcardinal4(handle) - compressed=readcardinal4(handle) - uncompressed=readcardinal4(handle) - end - if acceptable then - index=index+1 - local data={ - filename=filename, - index=index, - position=position, - method=method, - compressed=compressed, - uncompressed=uncompressed, - crc32=crc32, - encrypted=encrypted, - } - hash[filename]=data - list[index]=data - else + local size=getsize(handle) + for i=size-4,size-64*1024,-1 do + setposition(handle,i) + local enddirsignature=readcardinal4(handle) + if enddirsignature==0x06054B50 then + local thisdisknumber=readcardinal2(handle) + local centraldisknumber=readcardinal2(handle) + local thisnofentries=readcardinal2(handle) + local totalnofentries=readcardinal2(handle) + local centralsize=readcardinal4(handle) + local centraloffset=readcardinal4(handle) + local commentlength=readcardinal2(handle) + local comment=readstring(handle,length) + if size-i>=22 then + if thisdisknumber==centraldisknumber then + setposition(handle,centraloffset) + while true do + if readcardinal4(handle)==0x02014B50 then + skipbytes(handle,4) + local flag=readcardinal2(handle) + local method=readcardinal2(handle) + skipbytes(handle,4) + local crc32=readcardinal4(handle) + local compressed=readcardinal4(handle) + local uncompressed=readcardinal4(handle) + local namelength=readcardinal2(handle) + local extralength=readcardinal2(handle) + local commentlength=readcardinal2(handle) + skipbytes(handle,8) + local headeroffset=readcardinal4(handle) + local filename=readstring(handle,namelength) + skipbytes(handle,extralength+commentlength) + local descriptor=band(flag,8)~=0 + local encrypted=band(flag,1)~=0 + local acceptable=method==0 or method==8 + if acceptable then + index=index+1 + local data={ + filename=filename, + index=index, + position=nil, + method=method, + compressed=compressed, + uncompressed=uncompressed, + crc32=crc32, + encrypted=encrypted, + offset=headeroffset, + } + hash[filename]=data + list[index]=data + end + else + break + end + end + end + break end - position=position+compressed - else - break end - z.list=list - z.hash=hash end + z.list=list + z.hash=hash end end function getziplist(z) @@ -16040,7 +16087,10 @@ local openzipfile,closezipfile,unzipfile,foundzipfile,getziphash,getziplist do local handle=z.handle local position=data.position local compressed=data.compressed - if compressed>0 then + if position==nil then + position=update(handle,data) + end + if position and compressed>0 then setposition(handle,position) local result=readstring(handle,compressed) if data.method==8 then @@ -26138,8 +26188,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1037585 --- stripped bytes : 408686 +-- original bytes : 1046208 +-- stripped bytes : 415601 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index f8ef74110..27c2e6cb0 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -15876,7 +15876,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-zip"] = package.loaded["util-zip"] or true --- original size: 23730, stripped down to: 14293 +-- original size: 32353, stripped down to: 16001 if not modules then modules={} end modules ['util-zip']={ version=1.001, @@ -15902,11 +15902,13 @@ end local files=utilities.files local openfile=files.open local closefile=files.close +local getsize=files.size local readstring=files.readstring local readcardinal2=files.readcardinal2le local readcardinal4=files.readcardinal4le local setposition=files.setposition local getposition=files.getposition +local skipbytes=files.skip local band=bit32.band local rshift=bit32.rshift local lshift=bit32.lshift @@ -15929,6 +15931,55 @@ local openzipfile,closezipfile,unzipfile,foundzipfile,getziphash,getziplist do handle=openfile(name,0), } end + local function update(handle,data) + position=data.offset + setposition(handle,position) + local signature=readstring(handle,4) + if signature=="PK\3\4" then + local version=readcardinal2(handle) + local flag=readcardinal2(handle) + local method=readcardinal2(handle) + skipbytes(handle,4) + local crc32=readcardinal4(handle) + local compressed=readcardinal4(handle) + local uncompressed=readcardinal4(handle) + local namelength=readcardinal2(handle) + local extralength=readcardinal2(handle) + local filename=readstring(handle,namelength) + local descriptor=band(flag,8)~=0 + local encrypted=band(flag,1)~=0 + local acceptable=method==0 or method==8 + local skipped=0 + local size=0 + if encrypted then + size=readcardinal2(handle) + skipbytes(handle,size) + skipped=skipped+size+2 + skipbytes(8) + skipped=skipped+8 + size=readcardinal2(handle) + skipbytes(handle,size) + skipped=skipped+size+2 + size=readcardinal4(handle) + skipbytes(handle,size) + skipped=skipped+size+4 + size=readcardinal2(handle) + skipbytes(handle,size) + skipped=skipped+size+2 + end + if acceptable then + if filename~=data.filename then + else + position=position+30+namelength+extralength+skipped + data.position=position + return position + end + else + end + end + data.position=false + return false + end local function collect(z) if not z.list then local list={} @@ -15936,72 +15987,68 @@ local openzipfile,closezipfile,unzipfile,foundzipfile,getziphash,getziplist do local position=0 local index=0 local handle=z.handle - while true do - setposition(handle,position) - local signature=readstring(handle,4) - if signature=="PK\3\4" then - local version=readcardinal2(handle) - local flag=readcardinal2(handle) - local method=readcardinal2(handle) - local filetime=readcardinal2(handle) - local filedate=readcardinal2(handle) - local crc32=readcardinal4(handle) - local compressed=readcardinal4(handle) - local uncompressed=readcardinal4(handle) - local namelength=readcardinal2(handle) - local extralength=readcardinal2(handle) - local filename=readstring(handle,namelength) - local descriptor=band(flag,8)~=0 - local encrypted=band(flag,1)~=0 - local acceptable=method==0 or method==8 - local skipped=0 - local size=0 - if encrypted then - size=readcardinal2(handle) - skipbytes(size) - skipped=skipped+size+2 - skipbytes(8) - skipped=skipped+8 - size=readcardinal2(handle) - skipbytes(size) - skipped=skipped+size+2 - size=readcardinal4(handle) - skipbytes(size) - skipped=skipped+size+4 - size=readcardinal2(handle) - skipbytes(size) - skipped=skipped+size+2 - end - position=position+30+namelength+extralength+skipped - if descriptor then - setposition(handle,position+compressed) - crc32=readcardinal4(handle) - compressed=readcardinal4(handle) - uncompressed=readcardinal4(handle) - end - if acceptable then - index=index+1 - local data={ - filename=filename, - index=index, - position=position, - method=method, - compressed=compressed, - uncompressed=uncompressed, - crc32=crc32, - encrypted=encrypted, - } - hash[filename]=data - list[index]=data - else + local size=getsize(handle) + for i=size-4,size-64*1024,-1 do + setposition(handle,i) + local enddirsignature=readcardinal4(handle) + if enddirsignature==0x06054B50 then + local thisdisknumber=readcardinal2(handle) + local centraldisknumber=readcardinal2(handle) + local thisnofentries=readcardinal2(handle) + local totalnofentries=readcardinal2(handle) + local centralsize=readcardinal4(handle) + local centraloffset=readcardinal4(handle) + local commentlength=readcardinal2(handle) + local comment=readstring(handle,length) + if size-i>=22 then + if thisdisknumber==centraldisknumber then + setposition(handle,centraloffset) + while true do + if readcardinal4(handle)==0x02014B50 then + skipbytes(handle,4) + local flag=readcardinal2(handle) + local method=readcardinal2(handle) + skipbytes(handle,4) + local crc32=readcardinal4(handle) + local compressed=readcardinal4(handle) + local uncompressed=readcardinal4(handle) + local namelength=readcardinal2(handle) + local extralength=readcardinal2(handle) + local commentlength=readcardinal2(handle) + skipbytes(handle,8) + local headeroffset=readcardinal4(handle) + local filename=readstring(handle,namelength) + skipbytes(handle,extralength+commentlength) + local descriptor=band(flag,8)~=0 + local encrypted=band(flag,1)~=0 + local acceptable=method==0 or method==8 + if acceptable then + index=index+1 + local data={ + filename=filename, + index=index, + position=nil, + method=method, + compressed=compressed, + uncompressed=uncompressed, + crc32=crc32, + encrypted=encrypted, + offset=headeroffset, + } + hash[filename]=data + list[index]=data + end + else + break + end + end + end + break end - position=position+compressed - else - break end - z.list=list - z.hash=hash end + z.list=list + z.hash=hash end end function getziplist(z) @@ -16040,7 +16087,10 @@ local openzipfile,closezipfile,unzipfile,foundzipfile,getziphash,getziplist do local handle=z.handle local position=data.position local compressed=data.compressed - if compressed>0 then + if position==nil then + position=update(handle,data) + end + if position and compressed>0 then setposition(handle,position) local result=readstring(handle,compressed) if data.method==8 then @@ -26138,8 +26188,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1037585 --- stripped bytes : 408686 +-- original bytes : 1046208 +-- stripped bytes : 415601 -- end library merge diff --git a/source/luametatex/source/luametatex.h b/source/luametatex/source/luametatex.h index 8d5aa4e9a..fe9893e98 100644 --- a/source/luametatex/source/luametatex.h +++ b/source/luametatex/source/luametatex.h @@ -92,7 +92,7 @@ # define luametatex_version 210 # define luametatex_revision 9 # define luametatex_version_string "2.10.09" -# define luametatex_development_id 20230427 +# define luametatex_development_id 20230507 # define luametatex_name_camelcase "LuaMetaTeX" # define luametatex_name_lowercase "luametatex" diff --git a/source/luametatex/source/tex/texscanning.c b/source/luametatex/source/tex/texscanning.c index c4f9b0c56..2b9d6a110 100644 --- a/source/luametatex/source/tex/texscanning.c +++ b/source/luametatex/source/tex/texscanning.c @@ -2433,12 +2433,20 @@ static void tex_aux_scan_dimen_unknown_unit_error(void) { ); } +/*tex + The Edith and Tove were introduced at BachoTeX 2023 and because the error message + was still in feet we decided to adapt it accordingly so now in addition it reports + different values, including Theodores little feet measured by Arthur as being roughly + five Ediths. +*/ + static void tex_aux_scan_dimen_out_of_range_error(void) { tex_handle_error( normal_error_type, "Dimension too large", - "I can't work with sizes bigger than about 575 cm (230 es). Continue and I'll\n" - "use the largest value I can (16383 pt)." + "I can't work with sizes bigger than about 19 feet (45 Theodores as of 2023),\n" + "575 centimeters, 2300 Toves, 230 Ediths or 16383 points. Continue and I'll use\n" + "the largest value I can." ); } diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index b19283ff1..121b11c87 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2023.05.05 18:36} +\newcontextversion{2023.05.07 16:25} %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 f5ef6f059..de8d469ab 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2023.05.05 18:36} +\edef\contextversion{2023.05.07 16:25} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index a3bc4164e..866adbbe3 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2023.05.05 18:36} +\newcontextversion{2023.05.07 16:25} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 1ef4503ab..7c688a91c 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -49,7 +49,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2023.05.05 18:36} +\edef\contextversion{2023.05.07 16:25} %D Kind of special: diff --git a/tex/context/base/mkiv/publ-imp-apa.mkvi b/tex/context/base/mkiv/publ-imp-apa.mkvi index b8038bd96..65f33fa9f 100644 --- a/tex/context/base/mkiv/publ-imp-apa.mkvi +++ b/tex/context/base/mkiv/publ-imp-apa.mkvi @@ -909,7 +909,7 @@ \setmode{btx:apa:title-placed} % we make the title active, opening "file" \btxdoifelse {file} { - \texdefinition{btx:format:inject} + \texdefinition{btx:format:goto} {url(file:\btxflush{file})} { \texdefinition{btx:apa:composed-title}{title} @@ -1071,8 +1071,7 @@ \starttexdefinition mutable protected btx:apa:authoryear % we make the authoryear active, pointing to the citation - \texdefinition{btx:format:inject} - {internal(\currentbtxinternal)} + \texdefinition{btx:format:gotointernal} { \doifelsesetups{apa:list:sameauthor} { \btxdoifelsesameasprevious {author} { @@ -1287,15 +1286,11 @@ \starttexdefinition mutable protected btx:apa:url \begingroup \setbreakpoints[doi] - \ifconditional\btxinteractive - \goto { - \hyphenatedurl{\btxflush{url}} - } [ - url(\btxflush{url}) - ] - \else + \texdefinition {btx:format:goto} { + url(\btxflush{url}) + } { \hyphenatedurl{\btxflush{url}} - \fi + } \endgroup \stoptexdefinition @@ -1304,15 +1299,11 @@ \starttexdefinition mutable protected btx:apa:doi \begingroup \setbreakpoints[doi] - \ifconditional\btxinteractive - \goto { - \hyphenatedurl{doi:\btxflush{doi}} - } [ - url(http://dx.doi.org/\btxflush{doi}) - ] - \else + \texdefinition {btx:format:goto} { + url(http://dx.doi.org/\btxflush{doi}) + } { \hyphenatedurl{doi:\btxflush{doi}} - \fi + } \endgroup \stoptexdefinition diff --git a/tex/context/base/mkiv/publ-imp-aps.mkvi b/tex/context/base/mkiv/publ-imp-aps.mkvi index f6f118ada..da84c312e 100644 --- a/tex/context/base/mkiv/publ-imp-aps.mkvi +++ b/tex/context/base/mkiv/publ-imp-aps.mkvi @@ -615,7 +615,7 @@ \btxdoif {title} { % we make the title active, opening file \btxdoifelse {file} { - \texdefinition{btx:format:inject} + \texdefinition{btx:format:goto} {url(file:\btxflush{file})} { \texdefinition{btx:aps:composed-title}{title} diff --git a/tex/context/base/mkiv/publ-imp-list.mkvi b/tex/context/base/mkiv/publ-imp-list.mkvi index 5b4331eed..15ed8df82 100644 --- a/tex/context/base/mkiv/publ-imp-list.mkvi +++ b/tex/context/base/mkiv/publ-imp-list.mkvi @@ -48,7 +48,7 @@ \starttexdefinition mutable protected btx:list:numbering #variant \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:#variant] - \btxusecommand[\currentbtxspecification:\s!list:\s!numbering:#variant] { + \btxusecommand [\currentbtxspecification:\s!list:\s!numbering:#variant] { \fastsetup{\s!btx:\s!list:\s!numbering} } \btxstopstyleandcolor diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv index fafefa781..d75006b18 100644 --- a/tex/context/base/mkiv/publ-ini.mkiv +++ b/tex/context/base/mkiv/publ-ini.mkiv @@ -1143,7 +1143,7 @@ {\the\t_btx_reference_inject \strc_lists_inject_direct % todo: make like \btx_list_reference_inject_now with { } [\s!btx]% - [\c!type=\s!btx,\c!location=\v!here]% + [\c!type=\s!btx]% \c!location=\v!none [\ifx\currentbtxdataset\v!default\else\s!btxset=\currentbtxdataset,\fi% \s!btxref=\currentbtxtag,% %\ifx\currentbtxcombis \empty\else\s!btxcom={\currentbtxcombis},\fi% @@ -1997,6 +1997,7 @@ \c!separator:juniors={\btxspace}, \c!separator:vons={\btxspace}, \c!separator:initials={\btxspace}, + \c!connector:initials={-}, \c!stopper:initials={.}, %\c!surnamesep={\btxcomma}, % is this used anywhere? \c!separator:invertedinitials={\btxcomma}, diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex d4b423224..7d6a106d1 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex ee377dae7..f0e2e8ef0 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/util-zip.lua b/tex/context/base/mkiv/util-zip.lua index 4ceec7afd..84539492c 100644 --- a/tex/context/base/mkiv/util-zip.lua +++ b/tex/context/base/mkiv/util-zip.lua @@ -34,11 +34,13 @@ end local files = utilities.files local openfile = files.open local closefile = files.close +local getsize = files.size local readstring = files.readstring local readcardinal2 = files.readcardinal2le local readcardinal4 = files.readcardinal4le local setposition = files.setposition local getposition = files.getposition +local skipbytes = files.skip local band = bit32.band local rshift = bit32.rshift @@ -69,6 +71,158 @@ local openzipfile, closezipfile, unzipfile, foundzipfile, getziphash, getziplist } end + -- https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT + +-- local function collect(z) +-- if not z.list then +-- local list = { } +-- local hash = { } +-- local position = 0 +-- local index = 0 +-- local handle = z.handle +-- while true do +-- setposition(handle,position) +-- local signature = readstring(handle,4) +-- if signature == "PK\3\4" then +-- -- [local file header 1] +-- -- [encryption header 1] +-- -- [file data 1] +-- -- [data descriptor 1] +-- local version = readcardinal2(handle) +-- local flag = readcardinal2(handle) +-- local method = readcardinal2(handle) +-- local filetime = readcardinal2(handle) +-- local filedate = readcardinal2(handle) +-- local crc32 = readcardinal4(handle) +-- local compressed = readcardinal4(handle) +-- local uncompressed = readcardinal4(handle) +-- local namelength = readcardinal2(handle) +-- local extralength = readcardinal2(handle) +-- local filename = readstring(handle,namelength) +-- local descriptor = band(flag,8) ~= 0 +-- local encrypted = band(flag,1) ~= 0 +-- local acceptable = method == 0 or method == 8 +-- -- 30 bytes of header including the signature +-- local skipped = 0 +-- local size = 0 +-- if encrypted then +-- size = readcardinal2(handle) +-- skipbytes(handle,size) +-- skipped = skipped + size + 2 +-- skipbytes(8) +-- skipped = skipped + 8 +-- size = readcardinal2(handle) +-- skipbytes(handle,size) +-- skipped = skipped + size + 2 +-- size = readcardinal4(handle) +-- skipbytes(handle,size) +-- skipped = skipped + size + 4 +-- size = readcardinal2(handle) +-- skipbytes(handle,size) +-- skipped = skipped + size + 2 +-- end +-- position = position + 30 + namelength + extralength + skipped +-- -- if descriptor then +-- -- -- where is this one located +-- -- setposition(handle,position + compressed) +-- -- crc32 = readcardinal4(handle) +-- -- compressed = readcardinal4(handle) +-- -- uncompressed = readcardinal4(handle) +-- -- end +-- if acceptable then +-- index = index + 1 +-- local data = { +-- filename = filename, +-- index = index, +-- position = position, +-- method = method, +-- compressed = compressed, +-- uncompressed = uncompressed, +-- crc32 = crc32, +-- encrypted = encrypted, +-- } +-- hash[filename] = data +-- list[index] = data +-- else +-- -- maybe a warning when encrypted +-- end +-- position = position + compressed +-- else +-- break +-- end +-- z.list = list +-- z.hash = hash +-- end +-- end +-- end +-- end + +-- end +-- end + + local function update(handle,data) + position = data.offset + setposition(handle,position) + local signature = readstring(handle,4) + if signature == "PK\3\4" then -- 0x04034B50 + -- [local file header 1] + -- [encryption header 1] + -- [file data 1] + -- [data descriptor 1] + local version = readcardinal2(handle) + local flag = readcardinal2(handle) + local method = readcardinal2(handle) + skipbytes(handle,4) + ----- filetime = readcardinal2(handle) + ----- filedate = readcardinal2(handle) + local crc32 = readcardinal4(handle) + local compressed = readcardinal4(handle) + local uncompressed = readcardinal4(handle) + local namelength = readcardinal2(handle) + local extralength = readcardinal2(handle) + local filename = readstring(handle,namelength) + local descriptor = band(flag,8) ~= 0 + local encrypted = band(flag,1) ~= 0 + local acceptable = method == 0 or method == 8 + -- 30 bytes of header including the signature + local skipped = 0 + local size = 0 + if encrypted then + size = readcardinal2(handle) + skipbytes(handle,size) + skipped = skipped + size + 2 + skipbytes(8) + skipped = skipped + 8 + size = readcardinal2(handle) + skipbytes(handle,size) + skipped = skipped + size + 2 + size = readcardinal4(handle) + skipbytes(handle,size) + skipped = skipped + size + 4 + size = readcardinal2(handle) + skipbytes(handle,size) + skipped = skipped + size + 2 + end + if acceptable then + if filename ~= data.filename then + -- elseif method ~= data.method then + -- elseif encrypted ~= data.encrypted then + -- elseif crc32 ~= 0 and crc32 ~= data.crc32 then + -- elseif uncompressed ~= 0 and uncompressed ~= data.uncompressed then + -- elseif compressed ~= 0 and compressed ~= data.compressed then + else + position = position + 30 + namelength + extralength + skipped + data.position = position + return position + end + else + -- maybe a warning when encrypted + end + end + data.position = false + return false + end + local function collect(z) if not z.list then local list = { } @@ -76,78 +230,88 @@ local openzipfile, closezipfile, unzipfile, foundzipfile, getziphash, getziplist local position = 0 local index = 0 local handle = z.handle - while true do - setposition(handle,position) - local signature = readstring(handle,4) - if signature == "PK\3\4" then - -- [local file header 1] - -- [encryption header 1] - -- [file data 1] - -- [data descriptor 1] - local version = readcardinal2(handle) - local flag = readcardinal2(handle) - local method = readcardinal2(handle) - local filetime = readcardinal2(handle) - local filedate = readcardinal2(handle) - local crc32 = readcardinal4(handle) - local compressed = readcardinal4(handle) - local uncompressed = readcardinal4(handle) - local namelength = readcardinal2(handle) - local extralength = readcardinal2(handle) - local filename = readstring(handle,namelength) - local descriptor = band(flag,8) ~= 0 - local encrypted = band(flag,1) ~= 0 - local acceptable = method == 0 or method == 8 - -- 30 bytes of header including the signature - local skipped = 0 - local size = 0 - if encrypted then - size = readcardinal2(handle) - skipbytes(size) - skipped = skipped + size + 2 - skipbytes(8) - skipped = skipped + 8 - size = readcardinal2(handle) - skipbytes(size) - skipped = skipped + size + 2 - size = readcardinal4(handle) - skipbytes(size) - skipped = skipped + size + 4 - size = readcardinal2(handle) - skipbytes(size) - skipped = skipped + size + 2 - end - position = position + 30 + namelength + extralength + skipped - if descriptor then - setposition(handle,position + compressed) - crc32 = readcardinal4(handle) - compressed = readcardinal4(handle) - uncompressed = readcardinal4(handle) - end - if acceptable then - index = index + 1 - local data = { - filename = filename, - index = index, - position = position, - method = method, - compressed = compressed, - uncompressed = uncompressed, - crc32 = crc32, - encrypted = encrypted, - } - hash[filename] = data - list[index] = data - else - -- maybe a warning when encrypted + local size = getsize(handle) + -- + -- Not all files have the compressed into set so we need to get the directory + -- first. We only handle single disk zip files. + -- + for i=size-4,size-64*1024,-1 do + setposition(handle,i) + local enddirsignature = readcardinal4(handle) + if enddirsignature == 0x06054B50 then + local thisdisknumber = readcardinal2(handle) + local centraldisknumber = readcardinal2(handle) + local thisnofentries = readcardinal2(handle) + local totalnofentries = readcardinal2(handle) + local centralsize = readcardinal4(handle) + local centraloffset = readcardinal4(handle) + local commentlength = readcardinal2(handle) + local comment = readstring(handle,length) + if size - i >= 22 then + if thisdisknumber == centraldisknumber then + setposition(handle,centraloffset) + while true do + if readcardinal4(handle) == 0x02014B50 then + skipbytes(handle,4) + ----- versionmadeby = readcardinal2(handle) + ----- versionneeded = readcardinal2(handle) + local flag = readcardinal2(handle) + local method = readcardinal2(handle) + skipbytes(handle,4) + ----- filetime = readcardinal2(handle) + ----- filedate = readcardinal2(handle) + local crc32 = readcardinal4(handle) + local compressed = readcardinal4(handle) + local uncompressed = readcardinal4(handle) + local namelength = readcardinal2(handle) + local extralength = readcardinal2(handle) + local commentlength = readcardinal2(handle) + skipbytes(handle,8) + ----- disknumber = readcardinal2(handle) + ----- intattributes = readcardinal2(handle) + ----- extattributes = readcardinal4(handle) + local headeroffset = readcardinal4(handle) + local filename = readstring(handle,namelength) + skipbytes(handle,extralength+commentlength) + ----- extradata = readstring(handle,extralength) + ----- comment = readstring(handle,commentlength) + -- + local descriptor = band(flag,8) ~= 0 + local encrypted = band(flag,1) ~= 0 + local acceptable = method == 0 or method == 8 + if acceptable then + index = index + 1 + local data = { + filename = filename, + index = index, + position = nil, + method = method, + compressed = compressed, + uncompressed = uncompressed, + crc32 = crc32, + encrypted = encrypted, + offset = headeroffset, + } + hash[filename] = data + list[index] = data + end + else + break + end + end + end + break end - position = position + compressed - else - break end - z.list = list - z.hash = hash end + -- for i=1,index do -- delayed + -- local data = list[i] + -- if not data.position then + -- update(handle,list[i]) + -- end + -- end + z.list = list + z.hash = hash end end @@ -156,6 +320,7 @@ local openzipfile, closezipfile, unzipfile, foundzipfile, getziphash, getziplist if not list then collect(z) end + -- inspect(z.list) return z.list end @@ -193,7 +358,10 @@ local openzipfile, closezipfile, unzipfile, foundzipfile, getziphash, getziplist local handle = z.handle local position = data.position local compressed = data.compressed - if compressed > 0 then + if position == nil then + position = update(handle,data) + end + if position and compressed > 0 then setposition(handle,position) local result = readstring(handle,compressed) if data.method == 8 then diff --git a/tex/context/base/mkxl/back-exp.lmt b/tex/context/base/mkxl/back-exp.lmt index e5e2e9dab..ada1fe98c 100644 --- a/tex/context/base/mkxl/back-exp.lmt +++ b/tex/context/base/mkxl/back-exp.lmt @@ -1576,9 +1576,9 @@ local collectresults do -- too many locals otherwise if s then c = s end - if c == 0 then + if c == 0 or c == 0xFFFD then if trace_export then - report_export("%w<!-- skipping last glyph -->",currentdepth) + report_export("%w<!-- skipping glyph %U -->",currentdepth,c) end elseif c == 0x20 then local a = getattr(n,a_characters) diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 030a373aa..1e3f06e43 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2023.05.05 18:36} +\newcontextversion{2023.05.07 16:25} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 4cfa73091..292118662 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2023.05.05 18:36} +\immutable\edef\contextversion{2023.05.07 16:25} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt index 0048f4bb8..be156affb 100644 --- a/tex/context/base/mkxl/driv-shp.lmt +++ b/tex/context/base/mkxl/driv-shp.lmt @@ -289,6 +289,8 @@ local flush_character do end end + -- virtual t3 fonts have negative font index + for i=1,#vfcommands do local packet = vfcommands[i] if packet then @@ -297,16 +299,14 @@ local flush_character do local chr = packet[2] local csx = packet[3] local csy = packet[4] or csx - pos_h = pos_h + flushchar(fnt,chr,csx,csy) -* sx + pos_h = pos_h + flushchar(fnt,chr,csx,csy) * sx elseif command == "slot" then local index = packet[2] local chr = packet[3] local csx = packet[4] local csy = packet[5] or csx if index == 0 then - pos_h = pos_h + flushchar(font,chr,csx,csy) -* sx + pos_h = pos_h + flushchar(font,chr,csx,csy) * sx else local okay = fonts and fonts[index] if okay then @@ -315,13 +315,11 @@ local flush_character do if fnt == 0 then fnt = font end - pos_h = pos_h + flushchar(fnt,chr,csx,csy) -* sx + pos_h = pos_h + flushchar(fnt,chr,csx,csy) * sx end else -- safeguard, we assume the font itself (often index 1) - pos_h = pos_h + flushchar(font,chr,csx,csy) -* sx + pos_h = pos_h + flushchar(font,chr,csx,csy) * sx end end elseif command == "use" then @@ -394,6 +392,7 @@ local flush_character do if v and v ~= 0 then pos_v = pos_v + v * sy end +print("6>",fnt) flushchar(fnt,c,csx,csy) pos_h = ph pos_v = pv @@ -525,6 +524,7 @@ local flush_character do local okay = fonts and fonts[index] if okay then fnt = okay.id or fnt -- or maybe just return +print("7>",fnt) end elseif command == "lua" then local code = packet[2] diff --git a/tex/context/base/mkxl/lpdf-emb.lmt b/tex/context/base/mkxl/lpdf-emb.lmt index f63dcf6ef..303704aa7 100644 --- a/tex/context/base/mkxl/lpdf-emb.lmt +++ b/tex/context/base/mkxl/lpdf-emb.lmt @@ -2173,8 +2173,6 @@ local noffonts = 0 local getstreamhash = fonts.handlers.otf.getstreamhash local loadstreamdata = fonts.handlers.otf.loadstreamdata --- we can actually now number upwards (so not use fontid in /F) - local objects = setmetatableindex(lpdf.usedfontobjects,function(t,k) -- defined in lpdf-lmt.lmt local v if type(k) == "number" then @@ -2227,13 +2225,13 @@ function lpdf.flushfonts() -- don't have the id. -- we can combine the two for loops .. todo + -- inspect(lpdf.usedcharacters) for fontid, used in sortedhash(lpdf.usedcharacters) do -- for a bitmap we need a different hash unless we stick to a fixed high -- resolution which makes much sense - local hash = getstreamhash(fontid) if hash then local parent = mainfonts[hash] @@ -2263,7 +2261,7 @@ function lpdf.flushfonts() end end end - if rawdata then +-- if rawdata then -- we don't have these when we nest vf's (as in antykwa) parent = { hash = hash, fontdata = fontdata, @@ -2281,7 +2279,7 @@ function lpdf.flushfonts() } mainfonts[hash] = parent noffonts = noffonts + 1 - end +-- end end -- print("after ",fontid,hash,parent) if parent then @@ -2297,6 +2295,7 @@ function lpdf.flushfonts() -- this is no not yet ok for tfm / type 1 .. we need to move the nested blobs ourside the loop for hash, details in sortedhash(mainfonts) do + -- the filename can be somewhat weird if we have a virtual font that starts out with some local filename = details.filename if next(details.indices) then local properties = details.properties diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt index 7f3e53f28..5f900fc35 100644 --- a/tex/context/base/mkxl/lpdf-lmt.lmt +++ b/tex/context/base/mkxl/lpdf-lmt.lmt @@ -243,6 +243,7 @@ local threshold = 655360 local tjfactor = 100 / 65536 function flushers.updatefontstate(font) + -- virtual t3 fonts have negative font index fontcharacters = characters[font] -- fontdescriptions = descriptions[font] fontparameters = parameters[font] @@ -2227,25 +2228,25 @@ local finalize do -- resources can be indirect -if state == "ignore" or state == false then + if state == "ignore" or state == false then -else + else - registerpage(pageattributes) + registerpage(pageattributes) - lpdf.finalizepage(true) + lpdf.finalizepage(true) - local TrimBox = pageattributes.TrimBox - local CropBox = pageattributes.CropBox - local BleedBox = pageattributes.BleedBox + local TrimBox = pageattributes.TrimBox + local CropBox = pageattributes.CropBox + local BleedBox = pageattributes.BleedBox - -- Indirect objects don't work in all viewers. + -- Indirect objects don't work in all viewers. - if TrimBox then pageattributes.TrimBox = pdfsharedobject(checkedbox(bbox,TrimBox,"TrimBox")) end - if CropBox then pageattributes.CropBox = pdfsharedobject(checkedbox(bbox,CropBox,"CropBox")) end - if BleedBox then pageattributes.BleedBox = pdfsharedobject(checkedbox(bbox,BleedBox,"BleedBox")) end + if TrimBox then pageattributes.TrimBox = pdfsharedobject(checkedbox(bbox,TrimBox,"TrimBox")) end + if CropBox then pageattributes.CropBox = pdfsharedobject(checkedbox(bbox,CropBox,"CropBox")) end + if BleedBox then pageattributes.BleedBox = pdfsharedobject(checkedbox(bbox,BleedBox,"BleedBox")) end -end + end else diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt index ee9e56f8f..a5ad102ec 100644 --- a/tex/context/base/mkxl/math-act.lmt +++ b/tex/context/base/mkxl/math-act.lmt @@ -922,16 +922,14 @@ end do - local nps = fonts.helpers.newprivateslot - local list = { - { 0x2032, nps("delimited ghost 0x2032"), 1 }, - { 0x2033, nps("delimited ghost 0x2033"), 2, 0x2032 }, - { 0x2034, nps("delimited ghost 0x2034"), 3, 0x2032 }, - { 0x2057, nps("delimited ghost 0x2057"), 4, 0x2032 }, - { 0x2035, nps("delimited ghost 0x2035"), 1 }, - { 0x2036, nps("delimited ghost 0x2036"), 2, 0x2035 }, - { 0x2037, nps("delimited ghost 0x2037"), 3, 0x2035 }, + { 0x2032, 1 }, + { 0x2033, 2, 0x2032 }, + { 0x2034, 3, 0x2032 }, + { 0x2057, 4, 0x2032 }, + { 0x2035, 1 }, + { 0x2036, 2, 0x2035 }, + { 0x2037, 3, 0x2035 }, } datasets.fixprimes = list @@ -943,7 +941,7 @@ do for i=1,#list do local entry = list[i] local unicode = entry[1] - local count = entry[3] + local count = entry[2] local used = fonts.handlers.otf.getsubstitution(target,unicode,"ssty",true,"math","dflt") or unicode local data = targetcharacters[used] if data then @@ -960,10 +958,10 @@ do if fake then for i=1,#list do local entry = list[i] - local count = entry[3] + local count = entry[2] if count > 1 then local unicode = entry[1] - local original = entry[4] + local original = entry[3] local data = targetcharacters[original] if data then local oldwidth = data.width @@ -986,51 +984,6 @@ do end end - function mathtweaks.addprimed(target,original,parameters) - local characters = target.characters - for i=1,#list do - local entry = list[i] - local basecode = entry[1] - local movecode = entry[2] - local basedata = characters[basecode] - if basedata then - local baseheight = basedata.height or 0 - local basewidth = basedata.width or 0 - local used = baseheight - local total = baseheight - characters[movecode] = { -- todo:share - width = basewidth, - height = used, - unicode = basecode, -- 0xFFFD or space or so - -- callback = "devirtualize", - commands = { - downcommand[used], - { "rule", used, 0 }, - }, - } - basedata.partsorientation = "vertical" - basedata.parts = { - { - advance = used, - ["end"] = used, - extender = 1, - glyph = movecode, - start = used, - }, - { - advance = total, - ["end"] = 0, - glyph = basecode, - start = total, - }, - } - if trace_tweaking then - report_tweak("primed %U added",target,original,basecode) - end - end - end - end - end do @@ -3246,6 +3199,14 @@ do { 0x0303, nps("delimited right tilde"), nps("delimited ghost tilde") }, { 0x20DB, nps("delimited right dddot"), nps("delimited ghost dddot") }, + { 0x2032, nps("delimited right prime"), nps("delimited ghost prime"), false, 1 }, + { 0x2033, nps("delimited right dprime"), nps("delimited ghost dprime"), false, 1 }, + { 0x2034, nps("delimited right tprime"), nps("delimited ghost tprime"), false, 1 }, + { 0x2057, nps("delimited right qprime"), nps("delimited ghost qprime"), false, 1 }, + { 0x2035, nps("delimited right rprime"), nps("delimited ghost rprime"), false, 1 }, + { 0x2036, nps("delimited right drprime"), nps("delimited ghost rdprime"), false, 1 }, + { 0x2037, nps("delimited right dtprime"), nps("delimited ghost rtprime"), false, 1 }, + { 0x231C, nps("delimited left upper corner"), nps("delimited ghost upper corner") }, { 0x231D, nps("delimited right upper corner"), nps("delimited ghost upper corner") }, { 0x231E, nps("delimited left lower corner"), nps("delimited ghost lower corner"), true }, @@ -3307,8 +3268,7 @@ do characters[movecode] = { width = basewidth, height = used, - unicode = basecode, - -- callback = "devirtualize", + unicode = 0xFFFD, commands = { downcommand[used], { "rule", used, 0 }, @@ -3319,13 +3279,13 @@ do advance = used, ["end"] = used, extender = 1, - glyph = movecode, + glyph = movecode, -- bottom start = used, }, { advance = total, ["end"] = 0, - glyph = fouriercode, + glyph = fouriercode, -- top start = total, }, } @@ -3334,15 +3294,16 @@ do end characters[fouriercode] = { width = basewidth, - height = baseheight, + height = baseheight, -- somehow no \primed antykwa (unless we double the height) depth = basedepth, unicode = basecode, - -- callback = "devirtualize", commands = { scale == 1 and charcommand[basecode] or { "slot", 0, basecode, scale, scale }, }, partsorientation = "vertical", - parts = parts, + parts = parts, +-- keepvirtual = basechar.commands and true or false, + -- callback = "devirtualize", } if trace_tweaking then report_tweak("fourier %U added using %U",target,original,basecode,fouriercode) diff --git a/tex/context/base/mkxl/math-dld.mklx b/tex/context/base/mkxl/math-dld.mklx index 281ccedb2..4f8cf8fb4 100644 --- a/tex/context/base/mkxl/math-dld.mklx +++ b/tex/context/base/mkxl/math-dld.mklx @@ -250,13 +250,29 @@ % $ \autofences \fourier{(z+\frac12)} + \courier{(z+\frac12)} + \xourier{(z+\frac12)} $ -\definemathdelimited [primed] [\c!right="2032,\c!size=1,\c!topoffset=.2\exheight] -\definemathdelimited [doubleprimed] [primed] [\c!right="2033] -\definemathdelimited [tripleprimed] [primed] [\c!right="2034] -\definemathdelimited [quadrupleprimed] [primed] [\c!right="2057] -\definemathdelimited [reverseprimed] [primed] [\c!right="2035] -\definemathdelimited [doublereverseprimed] [primed] [\c!right="2036] -\definemathdelimited [triplereverseprimed] [primed] [\c!right="2037] +\integerdef\delimitedrightprimeuc \privatecharactercode{delimited right prime} +\integerdef\delimitedrightdprimeuc \privatecharactercode{delimited right dprime} +\integerdef\delimitedrighttprimeuc \privatecharactercode{delimited right tprime} +\integerdef\delimitedrightqprimeuc \privatecharactercode{delimited right qprime} +\integerdef\delimitedrightrprimeuc \privatecharactercode{delimited right rprime} +\integerdef\delimitedrightrdprimeuc \privatecharactercode{delimited right rdprime} +\integerdef\delimitedrightrtprimeuc \privatecharactercode{delimited right rtprime} + +%definemathdelimited [primed] [\c!right="2032,\c!size=1,\c!topoffset=.2\exheight] +%definemathdelimited [doubleprimed] [primed] [\c!right="2033] +%definemathdelimited [tripleprimed] [primed] [\c!right="2034] +%definemathdelimited [quadrupleprimed] [primed] [\c!right="2057] +%definemathdelimited [reverseprimed] [primed] [\c!right="2035] +%definemathdelimited [doublereverseprimed] [primed] [\c!right="2036] +%definemathdelimited [triplereverseprimed] [primed] [\c!right="2037] + +\definemathdelimited [primed] [\c!right=\delimitedrightprimeuc,\c!topoffset=.2\exheight,\c!size=1] +\definemathdelimited [doubleprimed] [primed] [\c!right=\delimitedrightdprimeuc] +\definemathdelimited [tripleprimed] [primed] [\c!right=\delimitedrighttprimeuc] +\definemathdelimited [quadrupleprimed] [primed] [\c!right=\delimitedrightqprimeuc] +\definemathdelimited [reverseprimed] [primed] [\c!right=\delimitedrightrprimeuc] +\definemathdelimited [doublereverseprimed] [primed] [\c!right=\delimitedrightrdprimeuc] +\definemathdelimited [triplereverseprimed] [primed] [\c!right=\delimitedrightrtprimeuc] % diff --git a/tex/context/base/mkxl/math-fnt.lmt b/tex/context/base/mkxl/math-fnt.lmt index 87dfe16e5..d829c342e 100644 --- a/tex/context/base/mkxl/math-fnt.lmt +++ b/tex/context/base/mkxl/math-fnt.lmt @@ -6,6 +6,9 @@ if not modules then modules = { } end modules ['math-fnt'] = { license = "see context related readme files" } +-- It is a pitty that we don't have a unicode character that can be used but that never +-- gets copied when we cut and paste. Not all pdf viewers ignore 0xFFFD for instance. + local round = math.round local setmetatableindex = table.setmetatableindex @@ -62,11 +65,11 @@ local function register_extensible(font,char,style,box) local fontdata = chardata[font] local oldchar = fontdata[char] if oldchar and not oldchar.keepvirtual then -if enabled == true or enabled == "both" or oldchar.partsorientation == enabled then - -- we're okay -else - return -end + if enabled == true or enabled == "both" or oldchar.partsorientation == enabled then + -- we're okay + else + return + end local bx = tonut(box) -- actually we don't want colors and such so if we do finalize we -- should be more selctive: @@ -76,8 +79,8 @@ end local id = getid(bx) local al = getattrlst(bx) local wd, ht, dp = getwhd(bx) - local unicode = oldchar.unicode or char - -- we cannot have self referencing t3 fonts + local unicode = oldchar.unicode or char + -- we cannot have self referencing t3 fonts .. see devirtualize code local oldcommands = oldchar.oldcommands local newcommands = oldchar.commands if oldcommands then @@ -123,7 +126,7 @@ end -- height = ht, -- depth = dp, -- } - -- local p = oldchar.vparts + -- local p = oldchar.parts -- if p then -- local first = fontdata[p[#p].glyph] -- local last = fontdata[p[ 1].glyph] diff --git a/tex/context/base/mkxl/publ-ini.mkxl b/tex/context/base/mkxl/publ-ini.mkxl index f120c55fb..3ed15ad98 100644 --- a/tex/context/base/mkxl/publ-ini.mkxl +++ b/tex/context/base/mkxl/publ-ini.mkxl @@ -438,6 +438,7 @@ \permanent\protected\def\btxrightbracket {\removeunwantedspaces]\space} \permanent\protected\def\btxrightbracketperiod {\removeunwantedspaces].\space} \permanent\protected\def\btxrightbracketcomma {\removeunwantedspaces],\space} +\permanent\protected\def\btxhyphen {\removeunwantedspaces-} %D Variables: @@ -1995,6 +1996,7 @@ \c!separator:juniors={\btxspace}, \c!separator:vons={\btxspace}, \c!separator:initials={\btxspace}, + \c!connector:initials={\btxhyphen}, \c!stopper:initials={.}, %\c!surnamesep={\btxcomma}, % is this used anywhere? \c!separator:invertedinitials={\btxcomma}, diff --git a/tex/context/fonts/mkiv/antykwa-math.lfg b/tex/context/fonts/mkiv/antykwa-math.lfg index 975ada70e..90ec9bbc8 100644 --- a/tex/context/fonts/mkiv/antykwa-math.lfg +++ b/tex/context/fonts/mkiv/antykwa-math.lfg @@ -164,11 +164,14 @@ if common then force = true, }, { + tweak = "addfourier", + }, + { tweak = "keepbases", -- list = { 0x302 } list = "default" }, -} + } common.mathematics.helpers.copyrecipes(recipes) diff --git a/tex/context/fonts/mkiv/iwona-math.lfg b/tex/context/fonts/mkiv/iwona-math.lfg index 2754e1577..76131ad8e 100644 --- a/tex/context/fonts/mkiv/iwona-math.lfg +++ b/tex/context/fonts/mkiv/iwona-math.lfg @@ -96,6 +96,9 @@ if common then fake = 0.9, -- replace multiples with this width proportion }, { + tweak = "addfourier", + }, + { tweak = "addequals", force = true, }, diff --git a/tex/context/fonts/mkiv/kurier-math.lfg b/tex/context/fonts/mkiv/kurier-math.lfg index a7290d0ca..96154194a 100644 --- a/tex/context/fonts/mkiv/kurier-math.lfg +++ b/tex/context/fonts/mkiv/kurier-math.lfg @@ -96,6 +96,9 @@ if common then fake = 0.9, -- replace multiples with this width proportion }, { + tweak = "addfourier", + }, + { tweak = "addequals", force = true, }, diff --git a/tex/context/fonts/mkiv/pagella-math.lfg b/tex/context/fonts/mkiv/pagella-math.lfg index 05e6fad81..ea8fdb8fe 100644 --- a/tex/context/fonts/mkiv/pagella-math.lfg +++ b/tex/context/fonts/mkiv/pagella-math.lfg @@ -231,9 +231,9 @@ return { tweak = "addfourier", variant = 1, }, - { - tweak = "addprimed", - }, +-- { +-- tweak = "addprimed", +-- }, { tweak = "kernpairs", list = { diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 5441fa004..86f683ce2 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2023-05-05 18:36 +-- merge date : 2023-05-07 16:25 do -- begin closure to overcome local limits and interference |