diff options
59 files changed, 976 insertions, 296 deletions
diff --git a/doc/context/documents/general/manuals/luametafun.pdf b/doc/context/documents/general/manuals/luametafun.pdf Binary files differindex d0a19a3b5..188f1f21d 100644 --- a/doc/context/documents/general/manuals/luametafun.pdf +++ b/doc/context/documents/general/manuals/luametafun.pdf diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf Binary files differindex 33234564e..506dfc96a 100644 --- a/doc/context/documents/general/qrcs/setup-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf Binary files differindex 6b3768529..3265015ea 100644 --- a/doc/context/documents/general/qrcs/setup-de.pdf +++ b/doc/context/documents/general/qrcs/setup-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf Binary files differindex 8471d15b4..51102b6e7 100644 --- a/doc/context/documents/general/qrcs/setup-en.pdf +++ b/doc/context/documents/general/qrcs/setup-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf Binary files differindex 20aa6e88e..436f9f41d 100644 --- a/doc/context/documents/general/qrcs/setup-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf Binary files differindex f54ac45f8..09ba7f8cc 100644 --- a/doc/context/documents/general/qrcs/setup-it.pdf +++ b/doc/context/documents/general/qrcs/setup-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf Binary files differindex be096cfa0..c4f84e8e4 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-de.pdf b/doc/context/documents/general/qrcs/setup-mapping-de.pdf Binary files differindex 6af69e8e5..4a8cec63f 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-de.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-en.pdf b/doc/context/documents/general/qrcs/setup-mapping-en.pdf Binary files differindex 0ca8447f9..439349327 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-en.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf Binary files differindex ece38b598..2ba16062a 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-it.pdf b/doc/context/documents/general/qrcs/setup-mapping-it.pdf Binary files differindex 3d1e3f394..ecd479c4b 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-it.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf Binary files differindex a6b35b0df..0ddd7011d 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf Binary files differindex 3a9c33053..15edacd00 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf Binary files differindex 8b47f596c..d389a21cb 100644 --- a/doc/context/documents/general/qrcs/setup-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf Binary files differindex fd120f187..3ec2dc1db 100644 --- a/doc/context/documents/general/qrcs/setup-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-ro.pdf diff --git a/doc/context/scripts/mkiv/mtx-update.html b/doc/context/scripts/mkiv/mtx-update.html deleted file mode 100644 index ed7363ca0..000000000 --- a/doc/context/scripts/mkiv/mtx-update.html +++ /dev/null @@ -1,66 +0,0 @@ -<?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 Minimals Updater 1.03</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 Minimals Updater 1.03 </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 (windows, linux, linux-64, osx-intel, osx-ppc, linux-ppc)</td></tr> - <tr><th>--server</th><td>string</td><td>repository url (rsync://contextgarden.net)</td></tr> - <tr><th>--module</th><td>string</td><td>repository url (minimals)</td></tr> - <tr><th>--repository</th><td>string</td><td>specify version (current, experimental)</td></tr> - <tr><th>--context</th><td>string</td><td>specify version (current, latest, beta, yyyy.mm.dd)</td></tr> - <tr><th>--rsync</th><td>string</td><td>rsync binary (rsync)</td></tr> - <tr><th>--texroot</th><td>string</td><td>installation directory (not guessed for the moment)</td></tr> - <tr><th>--engine</th><td>string</td><td>tex engine (luatex, pdftex, xetex)</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>--force</th><td></td><td>instead of a dryrun, do the real thing</td></tr> - <tr><th>--update</th><td></td><td>update minimal tree</td></tr> - <tr><th>--make</th><td></td><td>also make formats and generate file databases</td></tr> - <tr><th>--keep</th><td></td><td>don't delete unused or obsolete files</td></tr> - <tr><th>--state</th><td></td><td>update tree using saved state</td></tr> - <tr><th>--cygwin</th><td></td><td>adapt drive specs to cygwin</td></tr> - <tr><th>--mingw</th><td></td><td>assume mingw binaries being used</td></tr> - <tr><th>--silent</th><td></td><td>less (or no) logging</td></tr> - </table> -<br/> - </div> - </div> - </body> -</html> diff --git a/doc/context/scripts/mkiv/mtx-update.man b/doc/context/scripts/mkiv/mtx-update.man deleted file mode 100644 index a4ecef639..000000000 --- a/doc/context/scripts/mkiv/mtx-update.man +++ /dev/null @@ -1,81 +0,0 @@ -.TH "mtx-update" "1" "01-01-2019" "version 1.03" "ConTeXt Minimals Updater" -.SH NAME - mtx-update - ConTeXt Minimals Updater -.SH SYNOPSIS -.B mtxrun --script update [ -.I OPTIONS ... -.B ] [ -.I FILENAMES -.B ] -.SH DESCRIPTION -.B ConTeXt Minimals Updater -.SH OPTIONS -.TP -.B --platform=string -platform (windows, linux, linux-64, osx-intel, osx-ppc, linux-ppc) -.TP -.B --server=string -repository url (rsync://contextgarden.net) -.TP -.B --module=string -repository url (minimals) -.TP -.B --repository=string -specify version (current, experimental) -.TP -.B --context=string -specify version (current, latest, beta, yyyy.mm.dd) -.TP -.B --rsync=string -rsync binary (rsync) -.TP -.B --texroot=string -installation directory (not guessed for the moment) -.TP -.B --engine=string -tex engine (luatex, pdftex, xetex) -.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 --force -instead of a dryrun, do the real thing -.TP -.B --update -update minimal tree -.TP -.B --make -also make formats and generate file databases -.TP -.B --keep -don't delete unused or obsolete files -.TP -.B --state -update tree using saved state -.TP -.B --cygwin -adapt drive specs to cygwin -.TP -.B --mingw -assume mingw binaries being used -.TP -.B --silent -less (or no) logging -.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-update.xml b/doc/context/scripts/mkiv/mtx-update.xml deleted file mode 100644 index 818b994fd..000000000 --- a/doc/context/scripts/mkiv/mtx-update.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0"?> -<application> - <metadata> - <entry name="name">mtx-update</entry> - <entry name="detail">ConTeXt Minimals Updater</entry> - <entry name="version">1.03</entry> - </metadata> - <flags> - <category name="basic"> - <subcategory> - <flag name="platform" value="string"><short>platform (windows, linux, linux-64, osx-intel, osx-ppc, linux-ppc)</short></flag> - <flag name="server" value="string"><short>repository url (rsync://contextgarden.net)</short></flag> - <flag name="module" value="string"><short>repository url (minimals)</short></flag> - <flag name="repository" value="string"><short>specify version (current, experimental)</short></flag> - <flag name="context" value="string"><short>specify version (current, latest, beta, yyyy.mm.dd)</short></flag> - <flag name="rsync" value="string"><short>rsync binary (rsync)</short></flag> - <flag name="texroot" value="string"><short>installation directory (not guessed for the moment)</short></flag> - <flag name="engine" value="string"><short>tex engine (luatex, pdftex, xetex)</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="force"><short>instead of a dryrun, do the real thing</short></flag> - <flag name="update"><short>update minimal tree</short></flag> - <flag name="make"><short>also make formats and generate file databases</short></flag> - <flag name="keep"><short>don't delete unused or obsolete files</short></flag> - <flag name="state"><short>update tree using saved state</short></flag> - <flag name="cygwin"><short>adapt drive specs to cygwin</short></flag> - <flag name="mingw"><short>assume mingw binaries being used</short></flag> - <flag name="silent"><short>less (or no) logging</short></flag> - </subcategory> - </category> - </flags> -</application> diff --git a/doc/context/sources/general/manuals/luametafun/luametafun-fonts.tex b/doc/context/sources/general/manuals/luametafun/luametafun-fonts.tex new file mode 100644 index 000000000..27ea2fd00 --- /dev/null +++ b/doc/context/sources/general/manuals/luametafun/luametafun-fonts.tex @@ -0,0 +1,328 @@ +% language=us + +\environment luametafun-style + +\startcomponent luametafun-fonts + +\startchapter[title={Fonts}] + +Fonts are interesting phenomena but can also be quite hairy. Shapes can be +missing or not to your liking. There can be bugs too. Control over fonts has +always been on the agenda of \TEX\ macro packages, and \CONTEXT\ provides a lot +of control, especially in \MKIV. In \LMTX\ we add some more to that: we bring +back \METAFONT's but now in the \METAPOST\ way. A simple example shows how this +is (maybe I should say: will be) done. + +We define three simple shapes and do that (for now) in the \type {simplefun} +instance because that's what is used when generating the glyphs. + +\startbuffer +\startMPcalculation{simplefun} + vardef TestGlyphLB = + image ( + fill (unitsquare xscaled 10 yscaled 16 shifted (0,-3)) + withcolor "darkred" withtransparency (1,.5) + ; + ) + enddef ; + + vardef TestGlyphRB = + image ( + fill (unitcircle xscaled 15 yscaled 12 shifted (0,-2)) + withcolor "darkblue" withtransparency (1,.5) + ; + ) + enddef ; + + vardef TestGlyphFS = + image ( + fill (unittriangle xscaled 15 yscaled 12 shifted (0,-2)) + withcolor "darkgreen" withtransparency (1,.5) + ; + ) + enddef ; +\stopMPcalculation +\stopbuffer + +\typebuffer[option=TEX] \getbuffer + +This is not that spectacular, not is the following: + +\startbuffer +\startMPcalculation{simplefun} + lmt_registerglyphs [ + name = "test", + units = 10, % 1000 + ] ; + + lmt_registerglyph [ + category = "test", + unicode = 123, + code = "draw TestGlyphLB ;", + width = 10, % 1000 + height = 13, % 1300 + depth = 3 % 300 + ] ; + + lmt_registerglyph [ + category = "test", + unicode = 125, + code = "draw TestGlyphRB ;", + width = 15, + height = 10, + depth = 2 + ] ; + + lmt_registerglyph [ + category = "test", + unicode = "/", + code = "draw TestGlyphFS ;", + width = 15, + height = 10, + depth = 2 + ] ; + +\stopMPcalculation +\stopbuffer + +\typebuffer[option=TEX] \getbuffer + +We now define a font. We always use a font as starting point which has the +advantage that we always get something reasonable when we test. Of course you can +use this \type {mps} font feature with other fonts too. + +\startbuffer +\definefontfeature[metapost][metapost=test] % or: mps={category=test} + +\definefont[MyFontA][Serif*metapost @ 10bp] +\definefont[MyFontB][Serif*metapost @ 12bp] +\stopbuffer + +\typebuffer[option=TEX] \getbuffer + +These fonts can now be used: + +\startbuffer +\MyFontA \dorecurse{20}{\{ /#1/ \} }\par +\MyFontB \dorecurse{20}{\{ /#1/ \} }\par +\stopbuffer + +\typebuffer[option=TEX] + +We get some useless text but it demonstrates the idea: + +{\getbuffer} + +If you know a bit more about \CONTEXT\ you could think: so what, wasn't this +already possible? Sure, there are various ways to achieve similar effects, but +the method described here has a few advantages: it's relatively easy and we're +talking about real fonts here. This means that using the shapes for characters is +pretty efficient. + +A more realistic example is given next. It is a subset of what is available in +the \CONTEXT\ core. + +\startbuffer +\startMPcalculation{simplefun} + + pen SymbolPen ; SymbolPen := pencircle scaled 1/4 ; + + vardef SymbolBullet = + fill unitcircle scaled 3 shifted (1.5,1.5) withpen SymbolPen + enddef ; + vardef SymbolSquare = + draw unitsquare scaled (3-1/16) shifted (1.5,1.5) withpen SymbolPen + enddef ; + vardef SymbolBlackDiamond = + fillup unitdiamond scaled (3-1/16) shifted (1.5,1.5) withpen SymbolPen + enddef ; + vardef SymbolNotDef = + draw center unitcircle + scaled 3 + shifted (1.5,1.5) + withpen SymbolPen scaled 4 + enddef ; + + lmt_registerglyphs [ + name = "symbols", + units = 10, + usecolor = true, + width = 6, + height = 6, + depth = 0, + code = "SymbolNotDef ;", + ] ; + + lmt_registerglyph [ category = "symbols", unicode = "0x2022", + code = "SymbolBullet ;" + ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x25A1", + code = "SymbolSquare ;" + ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x25C6", + code = "SymbolBlackDiamond ;" + ] ; +\stopMPcalculation +\stopbuffer + +\typebuffer[option=TEX] \getbuffer + +We could use these symbols in for instance itemize symbols. You might notice the +potential difference in bullets: + +\startbuffer +\definefontfeature[metapost][metapost=symbols] + +\definefont[MyFont] [Serif*metapost sa 1] + +\startitemize[packed] + \startitem {\MyFont • □ ◆}\quad Regular rendering. \stopitem + \startitem {\MyFont\red • □ ◆}\quad Rendering with color. \stopitem + \startitem {\MyFont\blue\showglyphs • □ ◆}\quad Idem but with boundingboxes shown. \stopitem +\stopitemize +\stopbuffer + +\typebuffer[option=TEX] \getbuffer + +When blown up, these symbols look as follows: + +\startlinecorrection +\scale[width=\textwidth]{% + {\MyFont •□◆}% + {\MyFont\red •□◆}% + {\MyFont\blue\showglyphs •□◆}% +} +\stoplinecorrection + +You can use these tricks with basically any font, so also with math fonts. +However, at least for now, you need to define these before the font gets loaded. + +\startbuffer +\startMPcalculation{simplefun} + + pen KindergartenPen ; KindergartenPen := pencircle scaled 1 ; + + % 10 x 10 grid + + vardef KindergartenEqual = + draw image + ( + draw (2,6) -- (9,5) ; + draw (2,4) -- (8,3) ; + ) + shifted (0,-2) + withpen KindergartenPen + withcolor "KindergartenEqual" + enddef ; + vardef KindergartenPlus = + draw image + ( + draw (1,4) -- (9,5) ; + draw (4,1) -- (5,8) ; + ) + shifted (0,-2) + withpen KindergartenPen + withcolor "KindergartenPlus" + enddef ; + vardef KindergartenMinus = + draw image + ( + draw (1,5) -- (9,4) ; + ) + shifted (0,-2) + withpen KindergartenPen + withcolor "KindergartenMinus" + enddef ; + vardef KindergartenTimes = + draw image + ( + draw (2,1) -- (9,8) ; + draw (8,1) -- (2,8) ; + ) + shifted (0,-2) + withpen KindergartenPen + withcolor "KindergartenTimes" + enddef ; + vardef KindergartenDivided = + draw image + ( + draw (2,1) -- (8,9) ; + ) + shifted (0,-2) + withpen KindergartenPen + withcolor "KindergartenDivided" + enddef ; + + lmt_registerglyphs [ + name = "kindergarten", + units = 10, + % usecolor = true, + width = 10, + height = 8, + depth = 2, + ] ; + + lmt_registerglyph [ category = "kindergarten", unicode = "0x003D", + code = "KindergartenEqual" + ] ; + lmt_registerglyph [ category = "kindergarten", unicode = "0x002B", + code = "KindergartenPlus" + ] ; + lmt_registerglyph [ category = "kindergarten", unicode = "0x2212", + code = "KindergartenMinus" + ] ; + lmt_registerglyph [ category = "kindergarten", unicode = "0x00D7", + code = "KindergartenTimes" + ] ; + lmt_registerglyph [ category = "kindergarten", unicode = "0x002F", + code = "KindergartenDivided" + ] ; + +\stopMPcalculation +\stopbuffer + +\typebuffer[option=TEX] \getbuffer + +We also define the colors. If we leave \type {usecolor} to true, the text colors +will be taken. + +\startbuffer[definitions] +\definecolor[KindergartenEqual] [darkgreen] +\definecolor[KindergartenPlus] [darkred] +\definecolor[KindergartenMinus] [darkred] +\definecolor[KindergartenTimes] [darkblue] +\definecolor[KindergartenDivided][darkblue] + +\definefontfeature[mathextra][metapost=kindergarten] +\stopbuffer + +\typebuffer[definitions][option=TEX] \getbuffer[definitions] + +Here is an example: + +\starttyping +\switchtobodyfont[cambria] + +$ y = 2 \times x + a - b / 3 $ +\stoptyping + +Scaled up: + +\startlinecorrection + \switchtobodyfont[cambria] + \scale[width=\textwidth]{$ y = 2 \times x + a - b / 3 $} +\stoplinecorrection + +Of course this won't work out well (yet) with extensible yet, due to related +definitions for which we don't have an interface yet. There is one thing that you +need to keep in mind: the fonts are flushed when the document gets finalized so +you have to make sure that colors are defined at the level that they are still +valid at that time. So best put color definitions like the above in the document +style. + +This is an experimental interface anyway so we don't explain the parameters yet +as there might be more of them. + +\stopchapter + +\stopcomponent diff --git a/doc/context/sources/general/manuals/luametafun/luametafun-style.tex b/doc/context/sources/general/manuals/luametafun/luametafun-style.tex index df469d0c0..63eb7e375 100644 --- a/doc/context/sources/general/manuals/luametafun/luametafun-style.tex +++ b/doc/context/sources/general/manuals/luametafun/luametafun-style.tex @@ -52,4 +52,13 @@ [before=, after=] +% sectionblocks keep things local and we need these colors very late, +% when we flush fonts + +\definecolor[KindergartenEqual] [darkgreen] +\definecolor[KindergartenPlus] [darkred] +\definecolor[KindergartenMinus] [darkred] +\definecolor[KindergartenTimes] [darkblue] +\definecolor[KindergartenDivided][darkblue] + \stopenvironment diff --git a/doc/context/sources/general/manuals/luametafun/luametafun.tex b/doc/context/sources/general/manuals/luametafun/luametafun.tex index 6f5aff173..52b7a6800 100644 --- a/doc/context/sources/general/manuals/luametafun/luametafun.tex +++ b/doc/context/sources/general/manuals/luametafun/luametafun.tex @@ -26,6 +26,7 @@ \component luametafun-function \component luametafun-chart \component luametafun-svg + \component luametafun-fonts \component luametafun-interface \stopbodymatter diff --git a/metapost/context/base/mpiv/mp-lmtx.mpxl b/metapost/context/base/mpiv/mp-lmtx.mpxl index fe84872ea..3d24dfd75 100644 --- a/metapost/context/base/mpiv/mp-lmtx.mpxl +++ b/metapost/context/base/mpiv/mp-lmtx.mpxl @@ -2112,3 +2112,22 @@ vardef lmt_do_surface = popparameters ; ) enddef ; + +% I can make a variant that avoids the lmt_do ... and does an immediate function +% call instead. + +presetparameters "mpsglyphs" [ + name = "dummy", + units = 1000, +] ; + +presetparameters "mpsglyph" [ + category = "dummy", + unicode = 0, +] ; + +def lmt_registerglyphs = applyparameters "mpsglyphs" "lmt_do_registerglyphs" enddef ; +def lmt_registerglyph = applyparameters "mpsglyph" "lmt_do_registerglyph" enddef ; + +vardef lmt_do_registerglyphs = lua.mp.lmt_register_glyphs() ; enddef ; +vardef lmt_do_registerglyph = lua.mp.lmt_register_glyph () ; enddef ; diff --git a/scripts/context/lua/mtx-install.lua b/scripts/context/lua/mtx-install.lua index cf6ba4e98..5395ff6ee 100644 --- a/scripts/context/lua/mtx-install.lua +++ b/scripts/context/lua/mtx-install.lua @@ -402,7 +402,7 @@ function install.update() local osplatform = environment.arguments.platform or nil local platform = platforms[osplatform or os.platform or ""] - if platform == "unknown" and osplatform then + if (platform == "unknown" or platform == "" or not platform) and osplatform then -- catches openbsdN.M kind of specifications platform = osplatform elseif not osplatform then diff --git a/scripts/context/lua/mtx-update.lua b/scripts/context/lua/mtx-update.lua index d9deb1b36..a3297e804 100644 --- a/scripts/context/lua/mtx-update.lua +++ b/scripts/context/lua/mtx-update.lua @@ -164,19 +164,72 @@ update.goodies = { }, } -update.platforms = { +-- update.platforms = { +-- ["mswin"] = "mswin", +-- ["windows"] = "mswin", +-- ["win32"] = "mswin", +-- ["win"] = "mswin", +-- -- ["mswin"] = "win32", +-- -- ["windows"] = "win32", +-- -- ["win32"] = "win32", +-- -- ["win"] = "win32", +-- -- +-- -- ["mswin-64"] = "mswin-64", +-- -- ["windows-64"] = "mswin-64", +-- -- ["win64"] = "mswin-64", +-- ["mswin-64"] = "win64", +-- ["windows-64"] = "win64", +-- ["win64"] = "win64", +-- -- +-- ["linux"] = "linux", +-- ["linux-32"] = "linux", +-- ["linux32"] = "linux", +-- -- +-- ["linux-64"] = "linux-64", +-- ["linux64"] = "linux-64", +-- -- +-- ["linuxmusl-64"] = "linuxmusl-64", +-- -- +-- ["linux-armhf"] = "linux-armhf", +-- -- +-- ["freebsd"] = "freebsd", +-- -- +-- ["freebsd-amd64"] = "freebsd-amd64", +-- -- +-- ["kfreebsd"] = "kfreebsd-i386", +-- ["kfreebsd-i386"] = "kfreebsd-i386", +-- -- +-- ["kfreebsd-amd64"] = "kfreebsd-amd64", +-- -- +-- ["linux-ppc"] = "linux-ppc", +-- ["ppc"] = "linux-ppc", +-- -- +-- ["osx"] = "osx-intel", +-- ["macosx"] = "osx-intel", +-- ["osx-intel"] = "osx-intel", +-- ["osxintel"] = "osx-intel", +-- -- +-- ["osx-ppc"] = "osx-ppc", +-- ["osx-powerpc"] = "osx-ppc", +-- ["osxppc"] = "osx-ppc", +-- ["osxpowerpc"] = "osx-ppc", +-- -- +-- ["osx-64"] = "osx-64", +-- -- +-- ["solaris-intel"] = "solaris-intel", +-- -- +-- ["solaris-sparc"] = "solaris-sparc", +-- ["solaris"] = "solaris-sparc", +-- -- +-- ["unknown"] = "unknown", +-- } + +local platforms = { ["mswin"] = "mswin", ["windows"] = "mswin", ["win32"] = "mswin", ["win"] = "mswin", - -- ["mswin"] = "win32", - -- ["windows"] = "win32", - -- ["win32"] = "win32", - -- ["win"] = "win32", -- - -- ["mswin-64"] = "mswin-64", - -- ["windows-64"] = "mswin-64", - -- ["win64"] = "mswin-64", ["mswin-64"] = "win64", ["windows-64"] = "win64", ["win64"] = "win64", @@ -192,34 +245,39 @@ update.platforms = { -- ["linux-armhf"] = "linux-armhf", -- - ["freebsd"] = "freebsd", + ["openbsd"] = "openbsd6.5", + ["openbsd-i386"] = "openbsd6.5", + ["openbsd-amd64"] = "openbsd6.5-amd64", -- + ["freebsd"] = "freebsd", + ["freebsd-i386"] = "freebsd", ["freebsd-amd64"] = "freebsd-amd64", -- - ["kfreebsd"] = "kfreebsd-i386", - ["kfreebsd-i386"] = "kfreebsd-i386", - -- - ["kfreebsd-amd64"] = "kfreebsd-amd64", + -- ["kfreebsd"] = "kfreebsd-i386", + -- ["kfreebsd-i386"] = "kfreebsd-i386", + -- ["kfreebsd-amd64"] = "kfreebsd-amd64", -- - ["linux-ppc"] = "linux-ppc", - ["ppc"] = "linux-ppc", + -- ["linux-ppc"] = "linux-ppc", + -- ["ppc"] = "linux-ppc", -- - ["osx"] = "osx-intel", - ["macosx"] = "osx-intel", - ["osx-intel"] = "osx-intel", - ["osxintel"] = "osx-intel", + -- ["osx"] = "osx-intel", + -- ["macosx"] = "osx-intel", + -- ["osx-intel"] = "osx-intel", + -- ["osxintel"] = "osx-intel", -- - ["osx-ppc"] = "osx-ppc", - ["osx-powerpc"] = "osx-ppc", - ["osxppc"] = "osx-ppc", - ["osxpowerpc"] = "osx-ppc", + -- ["osx-ppc"] = "osx-ppc", + -- ["osx-powerpc"] = "osx-ppc", + -- ["osxppc"] = "osx-ppc", + -- ["osxpowerpc"] = "osx-ppc", -- + ["macosx"] = "osx-64", + ["osx"] = "osx-64", ["osx-64"] = "osx-64", -- - ["solaris-intel"] = "solaris-intel", + -- ["solaris-intel"] = "solaris-intel", -- - ["solaris-sparc"] = "solaris-sparc", - ["solaris"] = "solaris-sparc", + -- ["solaris-sparc"] = "solaris-sparc", + -- ["solaris"] = "solaris-sparc", -- ["unknown"] = "unknown", } @@ -652,15 +710,33 @@ if scripts.savestate then end end + -- old + local valid = update.platforms for r in gmatch(environment.argument("platform") or os.platform,"([^, ]+)") do if valid[r] then states.set("platforms." .. r, true) end end + -- new + +-- local osplatform = environment.arguments.platform or nil +-- local platform = platforms[osplatform or os.platform or ""] +-- +-- if (platform == "unknown" or platform == "" or not platform) and osplatform then +-- -- catches openbsdN.M kind of specifications +-- platform = osplatform +-- elseif not osplatform then +-- osplatform = platform +-- end +-- states.set("platforms." .. platform, true) end + + -- so far + local valid = table.tohash(update.texformats) for r in gmatch(environment.argument("formats") or "","([^, ]+)") do if valid[r] then states.set("formats." .. r, true) end end + -- local valid = table.tohash(update.mpformats) -- for r in gmatch(environment.argument("formats") or "","([^, ]+)") do -- if valid[r] then states.set("formats." .. r, true) end diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 95df13f9f..0fd5404d7 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -17843,7 +17843,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-lpt"] = package.loaded["lxml-lpt"] or true --- original size: 55145, stripped down to: 30992 +-- original size: 54626, stripped down to: 31255 if not modules then modules={} end modules ['lxml-lpt']={ version=1.001, @@ -18325,6 +18325,8 @@ local builtin={ lastindex="(#ll.__p__.dt or 1)", lastelement="(ll.__p__.en or 1)", last="#list", + list="list", + self="ll", rootposition="order", order="order", element="(ll.ei or 1)", @@ -18433,7 +18435,8 @@ local function register_selector(specification) end local function register_expression(expression) local converted=lpegmatch(converter,expression) - local runner=load(format(template_e,converted)) + local wrapped=format(template_e,converted) + local runner=load(wrapped) runner=(runner and runner()) or function() errorrunner_e(expression,converted) end return { kind="expression",expression=expression,converted=converted,evaluator=runner } end @@ -18805,6 +18808,20 @@ expressions.count=function(e,pattern) local collected=applylpath(e,pattern) return pattern and (collected and #collected) or 0 end +expressions.attribute=function(e,name,value) + if type(e)=="table" and name then + local a=e.at + if a then + local v=a[name] + if value then + return v==value + else + return v + end + end + end + return nil +end expressions.oneof=function(s,...) for i=1,select("#",...) do if s==select(i,...) then @@ -18851,7 +18868,7 @@ function expressions.contains(str,pattern) end return false end -function xml.expressions.idstring(str) +function expressions.idstring(str) return type(str)=="string" and gsub(str,"^#","") or "" end local function traverse(root,pattern,handle) @@ -25840,8 +25857,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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1031236 --- stripped bytes : 408771 +-- original bytes : 1030717 +-- stripped bytes : 407989 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 95df13f9f..0fd5404d7 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -17843,7 +17843,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-lpt"] = package.loaded["lxml-lpt"] or true --- original size: 55145, stripped down to: 30992 +-- original size: 54626, stripped down to: 31255 if not modules then modules={} end modules ['lxml-lpt']={ version=1.001, @@ -18325,6 +18325,8 @@ local builtin={ lastindex="(#ll.__p__.dt or 1)", lastelement="(ll.__p__.en or 1)", last="#list", + list="list", + self="ll", rootposition="order", order="order", element="(ll.ei or 1)", @@ -18433,7 +18435,8 @@ local function register_selector(specification) end local function register_expression(expression) local converted=lpegmatch(converter,expression) - local runner=load(format(template_e,converted)) + local wrapped=format(template_e,converted) + local runner=load(wrapped) runner=(runner and runner()) or function() errorrunner_e(expression,converted) end return { kind="expression",expression=expression,converted=converted,evaluator=runner } end @@ -18805,6 +18808,20 @@ expressions.count=function(e,pattern) local collected=applylpath(e,pattern) return pattern and (collected and #collected) or 0 end +expressions.attribute=function(e,name,value) + if type(e)=="table" and name then + local a=e.at + if a then + local v=a[name] + if value then + return v==value + else + return v + end + end + end + return nil +end expressions.oneof=function(s,...) for i=1,select("#",...) do if s==select(i,...) then @@ -18851,7 +18868,7 @@ function expressions.contains(str,pattern) end return false end -function xml.expressions.idstring(str) +function expressions.idstring(str) return type(str)=="string" and gsub(str,"^#","") or "" end local function traverse(root,pattern,handle) @@ -25840,8 +25857,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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1031236 --- stripped bytes : 408771 +-- original bytes : 1030717 +-- stripped bytes : 407989 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 95df13f9f..0fd5404d7 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -17843,7 +17843,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-lpt"] = package.loaded["lxml-lpt"] or true --- original size: 55145, stripped down to: 30992 +-- original size: 54626, stripped down to: 31255 if not modules then modules={} end modules ['lxml-lpt']={ version=1.001, @@ -18325,6 +18325,8 @@ local builtin={ lastindex="(#ll.__p__.dt or 1)", lastelement="(ll.__p__.en or 1)", last="#list", + list="list", + self="ll", rootposition="order", order="order", element="(ll.ei or 1)", @@ -18433,7 +18435,8 @@ local function register_selector(specification) end local function register_expression(expression) local converted=lpegmatch(converter,expression) - local runner=load(format(template_e,converted)) + local wrapped=format(template_e,converted) + local runner=load(wrapped) runner=(runner and runner()) or function() errorrunner_e(expression,converted) end return { kind="expression",expression=expression,converted=converted,evaluator=runner } end @@ -18805,6 +18808,20 @@ expressions.count=function(e,pattern) local collected=applylpath(e,pattern) return pattern and (collected and #collected) or 0 end +expressions.attribute=function(e,name,value) + if type(e)=="table" and name then + local a=e.at + if a then + local v=a[name] + if value then + return v==value + else + return v + end + end + end + return nil +end expressions.oneof=function(s,...) for i=1,select("#",...) do if s==select(i,...) then @@ -18851,7 +18868,7 @@ function expressions.contains(str,pattern) end return false end -function xml.expressions.idstring(str) +function expressions.idstring(str) return type(str)=="string" and gsub(str,"^#","") or "" end local function traverse(root,pattern,handle) @@ -25840,8 +25857,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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1031236 --- stripped bytes : 408771 +-- original bytes : 1030717 +-- stripped bytes : 407989 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 95df13f9f..0fd5404d7 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -17843,7 +17843,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-lpt"] = package.loaded["lxml-lpt"] or true --- original size: 55145, stripped down to: 30992 +-- original size: 54626, stripped down to: 31255 if not modules then modules={} end modules ['lxml-lpt']={ version=1.001, @@ -18325,6 +18325,8 @@ local builtin={ lastindex="(#ll.__p__.dt or 1)", lastelement="(ll.__p__.en or 1)", last="#list", + list="list", + self="ll", rootposition="order", order="order", element="(ll.ei or 1)", @@ -18433,7 +18435,8 @@ local function register_selector(specification) end local function register_expression(expression) local converted=lpegmatch(converter,expression) - local runner=load(format(template_e,converted)) + local wrapped=format(template_e,converted) + local runner=load(wrapped) runner=(runner and runner()) or function() errorrunner_e(expression,converted) end return { kind="expression",expression=expression,converted=converted,evaluator=runner } end @@ -18805,6 +18808,20 @@ expressions.count=function(e,pattern) local collected=applylpath(e,pattern) return pattern and (collected and #collected) or 0 end +expressions.attribute=function(e,name,value) + if type(e)=="table" and name then + local a=e.at + if a then + local v=a[name] + if value then + return v==value + else + return v + end + end + end + return nil +end expressions.oneof=function(s,...) for i=1,select("#",...) do if s==select(i,...) then @@ -18851,7 +18868,7 @@ function expressions.contains(str,pattern) end return false end -function xml.expressions.idstring(str) +function expressions.idstring(str) return type(str)=="string" and gsub(str,"^#","") or "" end local function traverse(root,pattern,handle) @@ -25840,8 +25857,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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1031236 --- stripped bytes : 408771 +-- original bytes : 1030717 +-- stripped bytes : 407989 -- end library merge diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 296525c5c..bed8b96fc 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{2019.10.02 12:43} +\newcontextversion{2019.10.04 17:44} %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 ed7ade881..b042613af 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{2019.10.02 12:43} +\edef\contextversion{2019.10.04 17:44} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-de.mkii b/tex/context/base/mkii/mult-de.mkii index a957e8f17..9632dc07e 100644 --- a/tex/context/base/mkii/mult-de.mkii +++ b/tex/context/base/mkii/mult-de.mkii @@ -234,6 +234,7 @@ \setinterfacevariable{hanging}{haengend} \setinterfacevariable{head}{kopf} \setinterfacevariable{header}{kopfzeile} +\setinterfacevariable{headintext}{headintext} \setinterfacevariable{height}{hoehe} \setinterfacevariable{helptext}{hilfetext} \setinterfacevariable{hencefore}{vorher} diff --git a/tex/context/base/mkii/mult-nl.mkii b/tex/context/base/mkii/mult-nl.mkii index aebf9a898..ce86f1edd 100644 --- a/tex/context/base/mkii/mult-nl.mkii +++ b/tex/context/base/mkii/mult-nl.mkii @@ -234,6 +234,7 @@ \setinterfacevariable{hanging}{hangend} \setinterfacevariable{head}{kop} \setinterfacevariable{header}{hoofd} +\setinterfacevariable{headintext}{kopintekst} \setinterfacevariable{height}{hoogte} \setinterfacevariable{helptext}{helptekst} \setinterfacevariable{hencefore}{hierboven} diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii index d07d9dbdd..eb5c6d3b8 100644 --- a/tex/context/base/mkii/mult-pe.mkii +++ b/tex/context/base/mkii/mult-pe.mkii @@ -234,6 +234,7 @@ \setinterfacevariable{hanging}{آویزان} \setinterfacevariable{head}{سر} \setinterfacevariable{header}{سربرگ} +\setinterfacevariable{headintext}{headintext} \setinterfacevariable{height}{ارتفاع} \setinterfacevariable{helptext}{متنکمکی} \setinterfacevariable{hencefore}{hencefore} @@ -637,6 +638,7 @@ \setinterfaceconstant{aligntitle}{عنوانتنظیم} \setinterfaceconstant{alternative}{جایگزین} \setinterfaceconstant{anchor}{anchor} +\setinterfaceconstant{anchoring}{anchoring} \setinterfaceconstant{andtext}{andtext} \setinterfaceconstant{apa}{apa} \setinterfaceconstant{arguments}{arguments} @@ -866,6 +868,7 @@ \setinterfaceconstant{hfil}{پرکردنارتفاع} \setinterfaceconstant{hidenumber}{hidenumber} \setinterfaceconstant{hoffset}{آفستا} +\setinterfaceconstant{horizontal}{افقی} \setinterfaceconstant{horoffset}{آفستافق} \setinterfaceconstant{hyphen}{شکستن} \setinterfaceconstant{hyphens}{hyphens} @@ -966,9 +969,12 @@ \setinterfaceconstant{menu}{منو} \setinterfaceconstant{method}{روش} \setinterfaceconstant{middle}{میان} +\setinterfaceconstant{middlecolor}{middlecolor} \setinterfaceconstant{middlecommand}{middlecommand} \setinterfaceconstant{middlespeech}{سخنرانیمیانی} +\setinterfaceconstant{middlestyle}{middlestyle} \setinterfaceconstant{middletext}{متنمیانی} +\setinterfaceconstant{middlewidth}{middlewidth} \setinterfaceconstant{midsentence}{جملهمیانی} \setinterfaceconstant{min}{کمترین} \setinterfaceconstant{mindepth}{کمترینعمق} @@ -1286,6 +1292,7 @@ \setinterfaceconstant{vcompact}{vcompact} \setinterfaceconstant{vector}{vector} \setinterfaceconstant{veroffset}{آفستعم} +\setinterfaceconstant{vertical}{عمودی} \setinterfaceconstant{vfactor}{vfactor} \setinterfaceconstant{vfil}{vfil} \setinterfaceconstant{viewerprefix}{viewerprefix} @@ -1296,6 +1303,7 @@ \setinterfaceconstant{white}{سفید} \setinterfaceconstant{width}{عرض} \setinterfaceconstant{words}{words} +\setinterfaceconstant{xanchor}{xanchor} \setinterfaceconstant{xfactor}{فاکتورایکس} \setinterfaceconstant{xhtml}{xhtml} \setinterfaceconstant{xmax}{xmax} @@ -1303,6 +1311,7 @@ \setinterfaceconstant{xoffset}{آفستایکس} \setinterfaceconstant{xscale}{مقیاسایکس} \setinterfaceconstant{xstep}{گامایکس} +\setinterfaceconstant{yanchor}{yanchor} \setinterfaceconstant{yfactor}{فاکتوروای} \setinterfaceconstant{ymax}{ymax} \setinterfaceconstant{yoffset}{آفستوای} diff --git a/tex/context/base/mkiv/colo-ini.lua b/tex/context/base/mkiv/colo-ini.lua index d865668a5..cd2c19a75 100644 --- a/tex/context/base/mkiv/colo-ini.lua +++ b/tex/context/base/mkiv/colo-ini.lua @@ -571,7 +571,6 @@ colors.isblack = isblack -- if c and c > 1 then -- 1 is black -- local v = attributes.colors.values[c] - local function definespotcolor(name,parent,str,global) if parent == "" or find(parent,"=",1,true) then colors.registerspotcolor(name, parent) -- does that work? no attr @@ -830,7 +829,6 @@ colors.mpoptions = mpoptions -- mpprint(mpnamedcolor(str)) -- end - -- local function formatcolor(ca,separator) -- local cv = colorvalues[ca] -- if cv then diff --git a/tex/context/base/mkiv/colo-ini.mkiv b/tex/context/base/mkiv/colo-ini.mkiv index 7b649c174..fc456e824 100644 --- a/tex/context/base/mkiv/colo-ini.mkiv +++ b/tex/context/base/mkiv/colo-ini.mkiv @@ -859,7 +859,7 @@ % \let\colo_basics_synchronize\gobbleoneargument % used in mp interface % \let\colo_basics_inherit \gobbletwoarguments % used in mp interface -\def\colo_basics_allocate#1% +\def\colo_basics_allocate#1% todo: use a chardef instead {\expandafter\newcount\csname\??colornumber#1\endcsname \clf_synccolorcount{#1}\c_syst_last_allocated_count} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 2236514eb..1b4a8b805 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{2019.10.02 12:43} +\newcontextversion{2019.10.04 17:44} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 87efea55e..cc542ec68 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.10.02 12:43} +\edef\contextversion{2019.10.04 17:44} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl index c3552f09f..6158184ee 100644 --- a/tex/context/base/mkiv/context.mkxl +++ b/tex/context/base/mkiv/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.10.02 12:43} +\edef\contextversion{2019.10.04 17:44} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua index 02cf6093c..0a492b119 100644 --- a/tex/context/base/mkiv/font-ctx.lua +++ b/tex/context/base/mkiv/font-ctx.lua @@ -179,7 +179,7 @@ do local hashes = { } local nofinstances = 0 - local instances = table.setmetatableindex(function(t,k) + local instances = setmetatableindex(function(t,k) nofinstances = nofinstances + 1 t[k] = nofinstances return nofinstances @@ -570,6 +570,21 @@ end -- \definefontfeature[demo][a={b,c}] -- \definefontfeature[demo][a={b=12,c={34,35}}] +local h = setmetatableindex(function(t,k) + local v = "," .. k .. "," + t[k] = v + return v +end) + +-- local function removefromhash(hash,key) +-- local pattern = h[key] +-- for k in next, hash do +-- if k ~= key and find(h[k],pattern) then -- if find(k,",") and ... +-- hash[k] = nil +-- end +-- end +-- end + local function presetcontext(name,parent,features) -- will go to con and shared if features == "" and find(parent,"=",1,true) then features = parent @@ -635,14 +650,23 @@ local function presetcontext(name,parent,features) -- will go to con and shared -- if v then t[k] = v end t[k] = v end - -- needed for dynamic features - -- maybe number should always be renewed as we can redefine features - local number = setups[name] and setups[name].number or 0 -- hm, numbers[name] + -- the number is needed for dynamic features; maybe number should always be + -- renewed as we can redefine features ... i need a test + local number = setups[name] and setups[name].number or 0 if number == 0 then number = #numbers + 1 numbers[number] = name end + -- t.number = number + -- there is the special case of combined features as we have in math but maybe + -- this has to change some day ... otherwise we mess up dynamics (ok, we could + -- impose a limit there: no combined features) + -- + -- done elsewhere (!) + -- + -- removefromhash(setups,name) -- can have changed (like foo,extramath) + -- setups[name] = t return number, t end @@ -913,14 +937,37 @@ end -- return fastcopy(setups[features] or (presetcontext(features,"","") and setups[features])) -- end +-- local function splitcontext(features) -- presetcontext creates dummy here +-- local sf = setups[features] +-- if not sf then +-- local n -- number +-- if find(features,",") then +-- -- let's assume a combination which is not yet defined but just specified (as in math) +-- n, sf = presetcontext(features,features,"") +-- else +-- -- we've run into an unknown feature and or a direct spec so we create a dummy +-- n, sf = presetcontext(features,"","") +-- end +-- end +-- return fastcopy(sf) +-- end + local function splitcontext(features) -- presetcontext creates dummy here - local sf = setups[features] - if not sf then - local n -- number - if find(features,",",a,true) then - -- let's assume a combination which is not yet defined but just specified (as in math) - n, sf = presetcontext(features,features,"") - else + local n, sf + if find(features,",") then + -- + -- from elsewhere (!) + -- + -- this will become: + -- + -- if find(features,"^reset," then + setups[features] = nil + -- end + -- let's assume a combination which is not yet defined but just specified (as in math) + n, sf = presetcontext(features,features,"") + else + sf = setups[features] + if not sf then -- we've run into an unknown feature and or a direct spec so we create a dummy n, sf = presetcontext(features,"","") end diff --git a/tex/context/base/mkiv/font-ogr.lua b/tex/context/base/mkiv/font-ogr.lua index a2e5d2e82..ed5bc709b 100644 --- a/tex/context/base/mkiv/font-ogr.lua +++ b/tex/context/base/mkiv/font-ogr.lua @@ -15,10 +15,12 @@ elseif CONTEXTLMTXMODE == 0 then return end -local tostring, tonumber, next = tostring, tonumber, next -local round, max, mod, div = math.round, math.round, math.mod, math.div -local concat, setmetatableindex = table.concat, table.setmetatableindex +local tostring, tonumber, next, type = tostring, tonumber, next, type +local round, max, mod, div = math.round, math.max, math.mod, math.div +local concat, setmetatableindex, sortedhash = table.concat, table.setmetatableindex, table.sortedhash +local utfbyte = utf.byte local formatters = string.formatters +local settings_to_hash_strict, settings_to_array = utilities.parsers.settings_to_hash_strict, utilities.parsers.settings_to_array local otf = fonts.handlers.otf local otfregister = otf.features.register @@ -51,8 +53,10 @@ do return droppedin end + -- todo: pass specification table instead + function dropins.provide(method,t_tfmdata,indexdata,...) - droppedin = dropins.nextid() + local droppedin = dropins.nextid() local t_characters = t_tfmdata.characters local t_descriptions = t_tfmdata.descriptions local t_properties = t_tfmdata.properties @@ -76,14 +80,13 @@ do return slot, droppedin, d_tfmdata, d_properties end - function dropins.clone(method,tfmdata,shapes,...) + function dropins.clone(method,tfmdata,shapes,...) -- by index if method and shapes then local characters = tfmdata.characters local descriptions = tfmdata.descriptions local droppedin, tfmdrop, dropchars, dropdescs, colrshapes local idx = 255 local slot = 0 - -- for k, v in next, characters do local index = v.index if index then @@ -93,7 +96,13 @@ do if shape then if idx >= 255 then idx = 1 - colrshapes = { filename = shapes.filename, fixdepth = shapes.fixdepth } -- not needed + colrshapes = { -- or use metatable + filename = shapes.filename, + fixdepth = shapes.fixdepth, + units = shapes.units, + usecolor = shapes.usecolor, + -- instance = shapes.instance, + } slot, droppedin, tfmdrop = dropins.provide(method,tfmdata,colrshapes) dropchars = tfmdrop.characters dropdescs = tfmdrop.descriptions @@ -101,10 +110,7 @@ do idx = idx + 1 end colrshapes[idx] = shape -- so not: description - -- --- local helpers = fonts.helpers --- local prependcommands = helpers.prependcommands --- print(v.commands) + -- todo: prepend v.commands = { { "slot", slot, idx } } -- hack to prevent that type 3 also gets 'use' flags .. todo local c = { commands = false, index = idx, dropin = tfmdata } @@ -122,6 +128,170 @@ do end end + function dropins.swap(method,tfmdata,shapes,...) -- by unicode + if method and shapes then + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local droppedin, tfmdrop, dropchars, dropdescs, colrshapes + local idx = 255 + local slot = 0 + -- we can have a variant where shaped are by unicode and not by index + for k, v in next, characters do + local description = descriptions[k] + if description then + local shape = shapes[k] + if shape then + if idx >= 255 then + idx = 1 + colrshapes = { -- or use metatable + filename = shapes.filename, + fixdepth = shapes.fixdepth, + units = shapes.units, + usecolor = shapes.usecolor, + -- instance = shapes.instance, + } + slot, droppedin, tfmdrop = dropins.provide(method,tfmdata,colrshapes) + dropchars = tfmdrop.characters + dropdescs = tfmdrop.descriptions + else + idx = idx + 1 + end + colrshapes[idx] = shape -- so not: description + -- todo: prepend + v.commands = { { "slot", slot, idx } } + -- hack to prevent that type 3 also gets 'use' flags .. todo + local c = { commands = false, index = idx, dropin = tfmdata } + local d = { index = idx, dropin = tfmdata } + setmetatableindex(c,v) + setmetatableindex(d,description) + dropchars[idx] = c + dropdescs[idx] = d + end + end + end + else + -- error + end + end + +end + +do + + local dropins = fonts.dropins + + local shapes = setmetatableindex(function(t,k) + local v = { + glyphs = { }, + parameters = { + units = 1000 + }, + } + t[k] = v + return v + end) + + function dropins.registerglyphs(parameters) + local category = parameters.name + local target = shapes[category].parameters + for k, v in next, parameters do + if k ~= "glyphs" then + target[k] = v + end + end + end + + function dropins.registerglyph(parameters) + local category = parameters.category + local unicode = parameters.unicode + local unitype = type(unicode) + if unitype == "string" then + local uninumber = tonumber(unicode) + if uninumber then + unicode = round(uninumber) + else + unicode = utfbyte(unicode) + end + elseif unitype == "number" then + unicode = round(unicode) + end + parameters.unicode = unicode + -- print(category,unicode) + shapes[category].glyphs[unicode] = parameters + end + + local function initializemps(tfmdata,kind,value) + if value then + local spec = settings_to_hash_strict(value) + if not spec or not next(spec) then + spec = { category = value } + end + -- todo: multiple categories but then mayb also different + -- clones because of the units .. fot now we assume the same + -- units + local category = spec.category + if category and category ~= "" then + local categories = settings_to_array(category) + local usedshapes = nil + local index = 0 + for i=1,#categories do + local category = categories[i] + local mpsshapes = shapes[category] + if mpsshapes then + local properties = tfmdata.properties + local parameters = tfmdata.parameters + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local mpsparameters = mpsshapes.parameters + local units = mpsparameters.units or 1000 + local defaultwidth = mpsparameters.width or 0 + local defaultheight = mpsparameters.height or 0 + local defaultdepth = mpsparameters.depth or 0 + local defaultcode = mpsparameters.code or "" + local scale = parameters.size / units + usedshapes = usedshapes or { + instance = "simplefun", + units = units, + usecolor = mpsparameters.usecolor, + } + -- todo: deal with extensibles and more properties + for unicode, shape in sortedhash(mpsshapes.glyphs) do + -- local oldc = characters[unicode] + -- if oldc then + index = index + 1 + local newc = { + index = index, -- into usedshapes + width = scale * (shape.width or defaultwidth), + height = scale * (shape.height or defaultheight), + depth = scale * (shape.depth or defaultdepth), + } + -- + characters [unicode] = newc + descriptions[unicode] = newc + -- + usedshapes[unicode] = shape.code or defaultcode + -- end + end + end + end + if usedshapes then + -- todo: different font when units and usecolor changes, maybe move into loop + -- above + dropins.swap("mps",tfmdata,usedshapes) + end + end + end + end + + otfregister { + name = "metapost", + description = "metapost glyphs", + manipulators = { + base = initializemps, + node = initializemps, + } + } + end -- This sits here for historcal reasons so for now we keep it here. diff --git a/tex/context/base/mkiv/lpdf-emb.lua b/tex/context/base/mkiv/lpdf-emb.lua index eace34ca1..28ff6ceaf 100644 --- a/tex/context/base/mkiv/lpdf-emb.lua +++ b/tex/context/base/mkiv/lpdf-emb.lua @@ -1532,6 +1532,7 @@ do local f_image = formatters["%.6N 0 d0 /%s Do"] local f_image_d = formatters["%.6N 0 d0 1 0 0 1 0 %.3N cm /%s Do"] local f_stream = formatters["%.6N 0 d0 %s"] + local f_stream_c = formatters["%.6N 0 0 0 0 0 d1 %s"] local f_stream_d = formatters["%.6N 0 d0 1 0 0 1 0 %.3N cm %s"] -- A type 3 font has at most 256 characters and Acrobat also wants a zero slot @@ -1617,17 +1618,21 @@ do local mpshapes = properties.indexdata[1] if mpshapes then local scale = 10 * details.parameters.size/details.parameters.designsize - local units = details.parameters.units + local units = mpshapes.units or details.parameters.units local factor = units * bpfactor / scale local fixdepth = mpshapes.fixdepth + local usecolor = mpshapes.usecolor + -- todo: each mp a table with properties (like using d0 / d1) local function mpstopdf(mp,data) local width = data.width if decompress then mp = decompress(mp) end - local pdf = metapost.simple("metafun",mp,true) -- can be sped up, minifun + local pdf = metapost.simple(mpshapes.instance,mp,true) -- can be sped up, minifun local width = width * factor - if fixdepth then + if usecolor then + return f_stream_c(width,pdf), width + elseif fixdepth then local depth = data.depth or 0 local height = data.height or 0 if depth ~= 0 or height ~= 0 then diff --git a/tex/context/base/mkiv/lxml-lpt.lua b/tex/context/base/mkiv/lxml-lpt.lua index 392c1a401..5bcdfbabc 100644 --- a/tex/context/base/mkiv/lxml-lpt.lua +++ b/tex/context/base/mkiv/lxml-lpt.lua @@ -614,27 +614,6 @@ local lp_doequal = P("=") / "==" local lp_or = P("|") / " or " local lp_and = P("&") / " and " --- local lp_builtin = ( --- P("text") / "(ll.dt[1] or '')" + -- fragile --- P("content") / "ll.dt" + --- P("name") / "((ll.ns~='' and ll.ns..':'..ll.tg) or ll.tg)" + --- P("tag") / "ll.tg" + --- P("position") / "l" + -- is element in finalizer --- P("firstindex") / "1" + --- P("lastindex") / "(#ll.__p__.dt or 1)" + --- P("firstelement") / "1" + --- P("lastelement") / "(ll.__p__.en or 1)" + --- P("first") / "1" + --- P("last") / "#list" + --- P("rootposition") / "order" + --- P("order") / "order" + --- P("element") / "(ll.ei or 1)" + --- P("index") / "(ll.ni or 1)" + --- P("match") / "(ll.mi or 1)" + --- P("namespace") / "ll.ns" + --- P("ns") / "ll.ns" --- ) * ((spaces * P("(") * spaces * P(")"))/"") - local builtin = { text = "(ll.dt[1] or '')", -- fragile content = "ll.dt", @@ -647,6 +626,8 @@ local builtin = { lastindex = "(#ll.__p__.dt or 1)", lastelement = "(ll.__p__.en or 1)", last = "#list", + list = "list", + self = "ll", rootposition = "order", order = "order", element = "(ll.ei or 1)", @@ -654,6 +635,7 @@ local builtin = { match = "(ll.mi or 1)", namespace = "ll.ns", ns = "ll.ns", + } local lp_builtin = lpeg.utfchartabletopattern(builtin)/builtin * ((spaces * P("(") * spaces * P(")"))/"") @@ -806,7 +788,9 @@ end local function register_expression(expression) local converted = lpegmatch(converter,expression) - local runner = load(format(template_e,converted)) + local wrapped = format(template_e,converted) + local runner = load(wrapped) + -- print(wrapped) runner = (runner and runner()) or function() errorrunner_e(expression,converted) end return { kind = "expression", expression = expression, converted = converted, evaluator = runner } end @@ -1306,6 +1290,21 @@ expressions.count = function(e,pattern) -- what if pattern == empty or nil return pattern and (collected and #collected) or 0 end +expressions.attribute = function(e,name,value) + if type(e) == "table" and name then + local a = e.at + if a then + local v = a[name] + if value then + return v == value + else + return v + end + end + end + return nil +end + -- external -- expressions.oneof = function(s,...) @@ -1371,7 +1370,7 @@ function expressions.contains(str,pattern) return false end -function xml.expressions.idstring(str) +function expressions.idstring(str) return type(str) == "string" and gsub(str,"^#","") or "" end diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua index 6a9e3c2cc..9ab8cafc6 100644 --- a/tex/context/base/mkiv/lxml-tex.lua +++ b/tex/context/base/mkiv/lxml-tex.lua @@ -337,7 +337,7 @@ do noferrors = noferrors + 1 errors[filename] = errors[filename] + 1 end - errorhandler(filename) + errorhandler(message) -- (filename) end logs.registerfinalactions(function() diff --git a/tex/context/base/mkiv/meta-imp-symbols.mkxl b/tex/context/base/mkiv/meta-imp-symbols.mkxl new file mode 100644 index 000000000..7d4cb4005 --- /dev/null +++ b/tex/context/base/mkiv/meta-imp-symbols.mkxl @@ -0,0 +1,99 @@ +%D \module +%D [ file=meta-imp-symbols, +%D version=2019.10.01, +%D title=\METAPOST\ Graphics, +%D subtitle=Symbols, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This is an (experimental) prelude to more. + +\startMPcalculation{simplefun} + + pen SymbolPen ; SymbolPen := pencircle scaled 1/4 ; + + vardef SymbolBullet = fill unitcircle scaled 3 shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x2022 • + vardef SymbolDash = draw (origin--right) scaled 3 shifted (1.5,3.0) withpen SymbolPen scaled 2 enddef ; % 0x2013 – + vardef SymbolTriangle = draw unittriangle scaled 3 shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x25B6 ⊳ + vardef SymbolCircle = fill unitcircle scaled 3 shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x2218 ∘ + vardef SymbolSquare = draw unitsquare scaled (3-1/16) shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x25A1 □ + vardef SymbolDiamond = draw unitdiamond scaled 3 shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x22C4 ⋄ + vardef SymbolBlackTriangle = fillup unittriangle scaled (3-1/16) shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x25B6 ▶ + vardef SymbolBlackSquare = fillup unitsquare scaled (3-1/16) shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x25A0 ■ + vardef SymbolBlackDiamond = fillup unitdiamond scaled (3-1/16) shifted (1.5,1.5) withpen SymbolPen enddef ; % 0x25C6 ◆ + + vardef SymbolNotDef = + draw center unitcircle + scaled 3 + shifted (1.5,1.5) + withpen SymbolPen scaled 4 + enddef ; + + vardef SymbolStar = % 0x22C6 % ⋆ + SymbolNotDef + enddef ; + + vardef SymbolCheckmark = % 0x2713 ✓ + SymbolNotDef + enddef ; + + vardef SymbolAsterisk = % 0x2217 ∗ + SymbolNotDef + enddef ; + + % We could set code directly to the meaning of the macro. + + lmt_registerglyphs [ + name = "symbols", + units = 10, + usecolor = true, + width = 6, + height = 6, + depth = 0, + code = "SymbolNotDef ;", + ] ; + + lmt_registerglyph [ category = "symbols", unicode = "0x2022", code = "SymbolBullet ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x2013", code = "SymbolDash ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x22C6" ] ; % , code = "SymbolStar ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x22B3", code = "SymbolTriangle ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x2218", code = "SymbolCircle ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x25A1", code = "SymbolSquare ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x22C4", code = "SymbolDiamond ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x2713" ] ; % , code = "SymbolCheckmark ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x2217" ] ; % , code = "SymbolAsterisk ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x25B6", code = "SymbolBlackTriangle ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x25A0", code = "SymbolBlackSquare ;" ] ; + lmt_registerglyph [ category = "symbols", unicode = "0x25C6", code = "SymbolBlackDiamond ;" ] ; + +\stopMPcalculation + +\continueifinputfile{meta-imp-symbols.mkxl} + +\usemodule[article-basic] \setupbodyfont[pagella] + +\starttext + +\definefontfeature[metasymbols][mps=symbols] + +\definefont[MyFont] [Serif*default,metasymbols sa 1] + +Some metasymbols: + +\startitem {\MyFont • □ ◆}\quad Regular rendering. \stopitem +\startitem {\MyFont\red • □ ◆}\quad Rendering with color. \stopitem +\startitem {\MyFont\blue\showglyphs • □ ◆}\quad Idem but with boundingboxes shown. \stopitem + +And some more: + +\startlines + • – ⋆ ⊳ ∘ □ ⋄ ✓ ∗ ▶ ■ ◆ + {\MyFont • – ⋆ ⊳ ∘ □ ⋄ ✓ ∗ ▶ ■ ◆} +\stoplines + +\stoptext diff --git a/tex/context/base/mkiv/meta-ini.mkxl b/tex/context/base/mkiv/meta-ini.mkxl index 745bd9268..e08aa560a 100644 --- a/tex/context/base/mkiv/meta-ini.mkxl +++ b/tex/context/base/mkiv/meta-ini.mkxl @@ -225,6 +225,8 @@ \defineMPinstance[binarypost] [\s!format=mpost,\c!method=\s!binary] \defineMPinstance[decimalpost][\s!format=mpost,\c!method=\s!decimal] +\defineMPinstance[simplefun] [\s!format=metafun,\c!method=\s!double] % maybe use minifun + %defineMPinstance[megapost] [\s!format=mpost,\c!method=\s!decimal] \newconditional\c_meta_include_initializations diff --git a/tex/context/base/mkiv/mlib-lmp.lua b/tex/context/base/mkiv/mlib-lmp.lua index dc130c2fd..e72ddd03c 100644 --- a/tex/context/base/mkiv/mlib-lmp.lua +++ b/tex/context/base/mkiv/mlib-lmp.lua @@ -154,3 +154,19 @@ function mp.lmt_svg_include() mpdirect(metacode) end end + +if CONTEXTLMTXMODE > 0 then + + local dropins = fonts.dropins + local registerglyphs = dropins.registerglyphs + local registerglyph = dropins.registerglyph + + function mp.lmt_register_glyph() + registerglyph(metapost.getparameterset("mpsglyph")) + end + + function mp.lmt_register_glyphs() + registerglyphs(metapost.getparameterset("mpsglyphs")) + end + +end diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua index 29ef334f1..5af1ccb68 100644 --- a/tex/context/base/mkiv/mlib-lua.lua +++ b/tex/context/base/mkiv/mlib-lua.lua @@ -771,6 +771,7 @@ do metapost.registerscript("namedcolor",function() mpprint(mpnamedcolor(scanstring())) +-- test: return mpnamedcolor(scanstring()) end) end diff --git a/tex/context/base/mkiv/mlib-run.lua b/tex/context/base/mkiv/mlib-run.lua index bf7c8a796..e9d460472 100644 --- a/tex/context/base/mkiv/mlib-run.lua +++ b/tex/context/base/mkiv/mlib-run.lua @@ -518,6 +518,7 @@ function metapost.pushformat(specification,f,m) -- was: instance, name, method local usedinstance = instance .. ":" .. nofformats local mpx = mpxformats [usedinstance] local mpp = mpxpreambles[instance] or "" + -- report_metapost("push instance %a (%S)",usedinstance,mpx) if preamble then preamble = prepareddata(preamble) mpp = mpp .. "\n" .. preamble @@ -851,10 +852,11 @@ do end, } - function metapost.simple(format,code,useextensions) + function metapost.simple(instance,code,useextensions) + -- can we pickup the instance ? local mpx = metapost.pushformat { - instance = "simplefun", - format = "metafun", + instance = instance or "simplefun", + format = "metafun", -- or: minifun method = "double", } metapost.process { diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex e62e508a4..0d100562d 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 b84c61b2e..41c98c12c 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/fonts/mkiv/type-imp-cambria.mkiv b/tex/context/fonts/mkiv/type-imp-cambria.mkiv index 06781a8d0..0ccb4409e 100644 --- a/tex/context/fonts/mkiv/type-imp-cambria.mkiv +++ b/tex/context/fonts/mkiv/type-imp-cambria.mkiv @@ -39,7 +39,7 @@ \stoptypescript % We load a goodies file that will apply a patch to the font. As a demonstration - % we apply the patch when caching as as when scaling which is why we also specify + % we apply the patch when caching and when scaling which is why we also specify % the goodies file with the name. \starttypescript [\s!math] [cambria,cambria-m,cambria-a] [\s!name] diff --git a/tex/context/fonts/mkiv/type-imp-dejavu.mkiv b/tex/context/fonts/mkiv/type-imp-dejavu.mkiv index 3af9d2d17..ee1e9f383 100644 --- a/tex/context/fonts/mkiv/type-imp-dejavu.mkiv +++ b/tex/context/fonts/mkiv/type-imp-dejavu.mkiv @@ -43,8 +43,8 @@ \starttypescript [\s!math][dejavu][\s!name] \loadfontgoodies[dejavu-math] - \definefontsynonym[\s!MathRoman] [file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=dejavu-math] - \definefontsynonym[\s!MathRomanBold][file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,dejavu-math-bold,mathextra},\s!goodies=schola-math] + \definefontsynonym[\s!MathRoman] [\s!file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=dejavu-math] + \definefontsynonym[\s!MathRomanBold][\s!file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,dejavu-math-bold,mathextra},\s!goodies=dejavu-math] \stoptypescript \starttypescript[dejavu] diff --git a/tex/context/fonts/mkiv/type-imp-texgyre.mkiv b/tex/context/fonts/mkiv/type-imp-texgyre.mkiv index 583da77c1..72d3b3588 100644 --- a/tex/context/fonts/mkiv/type-imp-texgyre.mkiv +++ b/tex/context/fonts/mkiv/type-imp-texgyre.mkiv @@ -248,7 +248,7 @@ % \loadfontgoodies[texgyre] % \definefontsynonym[\s!MathRoman][file:texgyre-termes-math-regular.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=texgyre] \definefontsynonym[\s!MathRoman] [file:texgyretermes-math.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=termes-math] - \definefontsynonym[\s!MathRomanBold][file:texgyretermes-math.otf][\s!features={\s!math\mathsizesuffix,termes-math-bold,mathextra},\s!goodies=schola-math] + \definefontsynonym[\s!MathRomanBold][file:texgyretermes-math.otf][\s!features={\s!math\mathsizesuffix,termes-math-bold,mathextra},\s!goodies=termes-math] \stoptypescript \stoptypescriptcollection @@ -277,7 +277,7 @@ % \loadfontgoodies[texgyre] % \definefontsynonym[\s!MathRoman][file:texgyre-pagella-math-regular.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=texgyre] \definefontsynonym[\s!MathRoman] [file:texgyrepagella-math.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=pagella-math] - \definefontsynonym[\s!MathRomanBold][file:texgyrepagella-math.otf][\s!features={\s!math\mathsizesuffix,pagella-math-bold,mathextra},\s!goodies=schola-math] + \definefontsynonym[\s!MathRomanBold][file:texgyrepagella-math.otf][\s!features={\s!math\mathsizesuffix,pagella-math-bold,mathextra},\s!goodies=pagella-math] \stoptypescript \stoptypescriptcollection @@ -290,7 +290,7 @@ % \loadfontgoodies[texgyre] % \definefontsynonym[\s!MathRoman][file:texgyre-bonum-math-regular.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=texgyre] \definefontsynonym[\s!MathRoman] [file:texgyrebonum-math.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=bonum-math] - \definefontsynonym[\s!MathRomanBold][file:texgyrebonum-math.otf][\s!features={\s!math\mathsizesuffix,bonum-math-bold,mathextra},\s!goodies=schola-math] + \definefontsynonym[\s!MathRomanBold][file:texgyrebonum-math.otf][\s!features={\s!math\mathsizesuffix,bonum-math-bold,mathextra},\s!goodies=bonum-math] \stoptypescript \stoptypescriptcollection @@ -305,5 +305,3 @@ \stoptypescript \stoptypescriptcollection - - diff --git a/tex/context/interface/mkii/keys-de.xml b/tex/context/interface/mkii/keys-de.xml index b9cd9cc05..5d1009959 100644 --- a/tex/context/interface/mkii/keys-de.xml +++ b/tex/context/interface/mkii/keys-de.xml @@ -237,6 +237,7 @@ <cd:variable name='hanging' value='haengend'/> <cd:variable name='head' value='kopf'/> <cd:variable name='header' value='kopfzeile'/> + <cd:variable name='headintext' value='headintext'/> <cd:variable name='height' value='hoehe'/> <cd:variable name='helptext' value='hilfetext'/> <cd:variable name='hencefore' value='vorher'/> diff --git a/tex/context/interface/mkii/keys-nl.xml b/tex/context/interface/mkii/keys-nl.xml index 55e0ff335..cb6ebc68d 100644 --- a/tex/context/interface/mkii/keys-nl.xml +++ b/tex/context/interface/mkii/keys-nl.xml @@ -237,6 +237,7 @@ <cd:variable name='hanging' value='hangend'/> <cd:variable name='head' value='kop'/> <cd:variable name='header' value='hoofd'/> + <cd:variable name='headintext' value='kopintekst'/> <cd:variable name='height' value='hoogte'/> <cd:variable name='helptext' value='helptekst'/> <cd:variable name='hencefore' value='hierboven'/> diff --git a/tex/context/interface/mkii/keys-pe.xml b/tex/context/interface/mkii/keys-pe.xml index 86f8f49c9..2fcb76c9f 100644 --- a/tex/context/interface/mkii/keys-pe.xml +++ b/tex/context/interface/mkii/keys-pe.xml @@ -237,6 +237,7 @@ <cd:variable name='hanging' value='آویزان'/> <cd:variable name='head' value='سر'/> <cd:variable name='header' value='سربرگ'/> + <cd:variable name='headintext' value='headintext'/> <cd:variable name='height' value='ارتفاع'/> <cd:variable name='helptext' value='متنکمکی'/> <cd:variable name='hencefore' value='hencefore'/> @@ -643,6 +644,7 @@ <cd:constant name='aligntitle' value='عنوانتنظیم'/> <cd:constant name='alternative' value='جایگزین'/> <cd:constant name='anchor' value='anchor'/> + <cd:constant name='anchoring' value='anchoring'/> <cd:constant name='andtext' value='andtext'/> <cd:constant name='apa' value='apa'/> <cd:constant name='arguments' value='arguments'/> @@ -872,6 +874,7 @@ <cd:constant name='hfil' value='پرکردنارتفاع'/> <cd:constant name='hidenumber' value='hidenumber'/> <cd:constant name='hoffset' value='آفستا'/> + <cd:constant name='horizontal' value='افقی'/> <cd:constant name='horoffset' value='آفستافق'/> <cd:constant name='hyphen' value='شکستن'/> <cd:constant name='hyphens' value='hyphens'/> @@ -972,9 +975,12 @@ <cd:constant name='menu' value='منو'/> <cd:constant name='method' value='روش'/> <cd:constant name='middle' value='میان'/> + <cd:constant name='middlecolor' value='middlecolor'/> <cd:constant name='middlecommand' value='middlecommand'/> <cd:constant name='middlespeech' value='سخنرانیمیانی'/> + <cd:constant name='middlestyle' value='middlestyle'/> <cd:constant name='middletext' value='متنمیانی'/> + <cd:constant name='middlewidth' value='middlewidth'/> <cd:constant name='midsentence' value='جملهمیانی'/> <cd:constant name='min' value='کمترین'/> <cd:constant name='mindepth' value='کمترینعمق'/> @@ -1292,6 +1298,7 @@ <cd:constant name='vcompact' value='vcompact'/> <cd:constant name='vector' value='vector'/> <cd:constant name='veroffset' value='آفستعم'/> + <cd:constant name='vertical' value='عمودی'/> <cd:constant name='vfactor' value='vfactor'/> <cd:constant name='vfil' value='vfil'/> <cd:constant name='viewerprefix' value='viewerprefix'/> @@ -1302,6 +1309,7 @@ <cd:constant name='white' value='سفید'/> <cd:constant name='width' value='عرض'/> <cd:constant name='words' value='words'/> + <cd:constant name='xanchor' value='xanchor'/> <cd:constant name='xfactor' value='فاکتورایکس'/> <cd:constant name='xhtml' value='xhtml'/> <cd:constant name='xmax' value='xmax'/> @@ -1309,6 +1317,7 @@ <cd:constant name='xoffset' value='آفستایکس'/> <cd:constant name='xscale' value='مقیاسایکس'/> <cd:constant name='xstep' value='گامایکس'/> + <cd:constant name='yanchor' value='yanchor'/> <cd:constant name='yfactor' value='فاکتوروای'/> <cd:constant name='ymax' value='ymax'/> <cd:constant name='yoffset' value='آفستوای'/> diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 8471d15b4..51102b6e7 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 87356b5f9..41e4b2392 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 9e38b5e5c..9d036f3ec 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 : 10/02/19 12:43:06 +-- merge date : 10/04/19 17:44:12 do -- begin closure to overcome local limits and interference |