diff options
author | Karl Berry <karl@freefriends.org> | 2023-05-06 22:03:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-05-06 22:03:57 +0000 |
commit | 996ab582db894fb0949df386489a5101ed07062e (patch) | |
tree | a124f1b8886ff8c004c9960709f056b3d898aa99 /Master/texmf-dist/tex | |
parent | 6a69999bbc827b94cfa79dae2264da0d4b2f0e02 (diff) |
luametatex 2.10.08, context 2023.05.05 18:36
git-svn-id: svn://tug.org/texlive/trunk@67034 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
359 files changed, 13010 insertions, 5538 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/anch-pos.lua b/Master/texmf-dist/tex/context/base/mkiv/anch-pos.lua index 77f55964f8f..cf3ed87fcb9 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/anch-pos.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/anch-pos.lua @@ -6,12 +6,9 @@ if not modules then modules = { } end modules ['anch-pos'] = { license = "see context related readme files" } ---[[ldx-- -<p>We save positional information in the main utility table. Not only -can we store much more information in <l n='lua'/> but it's also -more efficient.</p> ---ldx]]-- - +-- We save positional information in the main utility table. Not only can we store +-- much more information in Lua but it's also more efficient. +-- -- plus (extra) is obsolete but we will keep it for a while -- -- maybe replace texsp by our own converter (stay at the lua end) diff --git a/Master/texmf-dist/tex/context/base/mkiv/attr-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/attr-ini.lua index b05c343e598..cd1a0c54916 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/attr-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/attr-ini.lua @@ -9,10 +9,8 @@ if not modules then modules = { } end modules ['attr-ini'] = { local next, type = next, type local osexit = os.exit ---[[ldx-- -<p>We start with a registration system for atributes so that we can use the -symbolic names later on.</p> ---ldx]]-- +-- We start with a registration system for atributes so that we can use the symbolic +-- names later on. local nodes = nodes local context = context @@ -54,17 +52,13 @@ storage.register("attributes/list", list, "attributes.list") -- end -- end ---[[ldx-- -<p>We reserve this one as we really want it to be always set (faster).</p> ---ldx]]-- +-- We reserve this one as we really want it to be always set (faster). names[0], numbers["fontdynamic"] = "fontdynamic", 0 ---[[ldx-- -<p>private attributes are used by the system and public ones are for users. We use dedicated -ranges of numbers for them. Of course a the <l n='context'/> end a private attribute can be -accessible too, so a private attribute can have a public appearance.</p> ---ldx]]-- +-- Private attributes are used by the system and public ones are for users. We use +-- dedicated ranges of numbers for them. Of course a the TeX end a private attribute +-- can be accessible too, so a private attribute can have a public appearance. sharedstorage.attributes_last_private = sharedstorage.attributes_last_private or 15 -- very private sharedstorage.attributes_last_public = sharedstorage.attributes_last_public or 1024 -- less private diff --git a/Master/texmf-dist/tex/context/base/mkiv/attr-mkr.mkiv b/Master/texmf-dist/tex/context/base/mkiv/attr-mkr.mkiv index 544558dcf3f..a784dd9d8c4 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/attr-mkr.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/attr-mkr.mkiv @@ -20,6 +20,7 @@ \unexpanded\def\definemarker [#1]{\defineattribute[\s!marker:#1]} \unexpanded\def\setmarker [#1]#2[#3]{\dosetattribute{\s!marker:#1}{#3}} \unexpanded\def\resetmarker [#1]{\dogetattribute{\s!marker:#1}} - \def\boxmarker #1#2{attr \numexpr\dogetattributeid{\s!marker:#1}\numexpr \numexpr#2\relax} + \def\boxmarker #1#2{attr \numexpr\dogetattributeid{\s!marker:#1}\relax \numexpr\numexpr#2\relax} +\unexpanded\def\marker #1{\numexpr\dogetattributeid{\s!marker:#1}\relax} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mkiv/bibl-bib.lua b/Master/texmf-dist/tex/context/base/mkiv/bibl-bib.lua index baeb3d2f9af..b7e478004a7 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/bibl-bib.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/bibl-bib.lua @@ -6,11 +6,9 @@ if not modules then modules = { } end modules ['bibl-bib'] = { license = "see context related readme files" } ---[[ldx-- -<p>This is a prelude to integrated bibliography support. This file just loads -bibtex files and converts them to xml so that the we access the content -in a convenient way. Actually handling the data takes place elsewhere.</p> ---ldx]]-- +-- This is a prelude to integrated bibliography support. This file just loads bibtex +-- files and converts them to xml so that the we access the content in a convenient +-- way. Actually handling the data takes place elsewhere. local lower, format, gsub, concat = string.lower, string.format, string.gsub, table.concat local next = next diff --git a/Master/texmf-dist/tex/context/base/mkiv/char-def.lua b/Master/texmf-dist/tex/context/base/mkiv/char-def.lua index 5e9d7d05a8b..1d4c130e918 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/char-def.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/char-def.lua @@ -67155,6 +67155,7 @@ characters.data={ description="MINUS SIGN", direction="es", linebreak="pr", + mathextensible="h", mathgroup="binary arithmetic", mathspec={ { diff --git a/Master/texmf-dist/tex/context/base/mkiv/char-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/char-ini.lua index db1b85cc5d1..627ba072c70 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/char-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/char-ini.lua @@ -36,20 +36,16 @@ local trace_defining = false trackers.register("characters.defining", fu local report_defining = logs.reporter("characters") ---[[ldx-- -<p>This module implements some methods and creates additional datastructured -from the big character table that we use for all kind of purposes: -<type>char-def.lua</type>.</p> - -<p>We assume that at this point <type>characters.data</type> is already -loaded!</p> ---ldx]]-- - +-- This module implements some methods and creates additional datastructured from +-- the big character table that we use for all kind of purposes: 'char-def.lua'. +-- +-- We assume that at this point 'characters.data' is already populated! +-- -- todo: in 'char-def.lua' assume defaults: -- --- directions = l --- cjkwd = a --- linebreak = al +-- directions = l +-- cjkwd = a +-- linebreak = al characters = characters or { } local characters = characters @@ -62,9 +58,7 @@ else os.exit() end ---[[ldx-- -Extending the table. ---ldx]]-- +-- Extending the table. if context and CONTEXTLMTXMODE == 0 then @@ -84,9 +78,7 @@ if context and CONTEXTLMTXMODE == 0 then end ---[[ldx-- -<p>This converts a string (if given) into a number.</p> ---ldx]]-- +-- This converts a string (if given) into a number. local pattern = (P("0x") + P("U+")) * ((R("09","AF")^1 * P(-1)) / function(s) return tonumber(s,16) end) @@ -957,10 +949,8 @@ characters.bidi = allocate { on = "Other Neutrals", } ---[[ldx-- -<p>At this point we assume that the big data table is loaded. From this -table we derive a few more.</p> ---ldx]]-- +-- At this point we assume that the big data table is loaded. From this table we +-- derive a few more. if not characters.fallbacks then @@ -1037,10 +1027,8 @@ setmetatableindex(characters.textclasses,function(t,k) return false end) ---[[ldx-- -<p>Next comes a whole series of helper methods. These are (will be) part -of the official <l n='api'/>.</p> ---ldx]]-- +-- Next comes a whole series of helper methods. These are (will be) part of the +-- official API. -- we could make them virtual: characters.contextnames[n] @@ -1433,9 +1421,7 @@ function characters.lettered(str,spacing) return concat(new) end ---[[ldx-- -<p>Requesting lower and uppercase codes:</p> ---ldx]]-- +-- Requesting lower and uppercase codes: function characters.uccode(n) return uccodes[n] end -- obsolete function characters.lccode(n) return lccodes[n] end -- obsolete diff --git a/Master/texmf-dist/tex/context/base/mkiv/char-tex.lua b/Master/texmf-dist/tex/context/base/mkiv/char-tex.lua index 7f544b14784..09547d00540 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/char-tex.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/char-tex.lua @@ -42,17 +42,14 @@ local trace_defining = false trackers.register("characters.defining", fu local report_defining = logs.reporter("characters") ---[[ldx-- -<p>In order to deal with 8-bit output, we need to find a way to go from <l n='utf'/> to -8-bit. This is handled in the <l n='luatex'/> engine itself.</p> - -<p>This leaves us problems with characters that are specific to <l n='tex'/> like -<type>{}</type>, <type>$</type> and alike. We can remap some chars that tex input files -are sensitive for to a private area (while writing to a utility file) and revert then -to their original slot when we read in such a file. Instead of reverting, we can (when -we resolve characters to glyphs) map them to their right glyph there. For this purpose -we can use the private planes 0x0F0000 and 0x100000.</p> ---ldx]]-- +-- In order to deal with 8-bit output, we need to find a way to go from UTF to +-- 8-bit. This is handled in the 32 bit engine itself. This leaves us problems with +-- characters that are specific to TeX, like curly braces and dollars. We can remap +-- some chars that tex input files are sensitive for to a private area (while +-- writing to a utility file) and revert then to their original slot when we read in +-- such a file. Instead of reverting, we can (when we resolve characters to glyphs) +-- map them to their right glyph there. For this purpose we can use the private +-- planes 0x0F0000 and 0x100000. local low = allocate() local high = allocate() @@ -102,21 +99,6 @@ private.escape = utf.remapper(escapes) -- maybe: ,"dynamic" private.replace = utf.remapper(low) -- maybe: ,"dynamic" private.revert = utf.remapper(high) -- maybe: ,"dynamic" ---[[ldx-- -<p>We get a more efficient variant of this when we integrate -replacements in collapser. This more or less renders the previous -private code redundant. The following code is equivalent but the -first snippet uses the relocated dollars.</p> - -<typing> -[x] [$x$] -</typing> ---ldx]]-- - --- using the tree-lpeg-mapper would be nice but we also need to deal with end-of-string --- cases: "\"\i" and don't want "\relax" to be seen as \r e lax" (for which we need to mess --- with spaces - local accentmapping = allocate { ['"'] = { [""] = "¨", A = "Ä", a = "ä", @@ -452,10 +434,8 @@ implement { -- a waste of scanner but consistent actions = texcharacters.defineaccents } ---[[ldx-- -<p>Instead of using a <l n='tex'/> file to define the named glyphs, we -use the table. After all, we have this information available anyway.</p> ---ldx]]-- +-- Instead of using a TeX file to define the named glyphs, we use the table. After +-- all, we have this information available anyway. function commands.makeactive(n,name) -- not used contextsprint(ctxcatcodes,format("\\catcode%s=13\\unexpanded\\def %s{\\%s}",n,utfchar(n),name)) @@ -747,9 +727,7 @@ function characters.setactivecatcodes(cct) tex.catcodetable = saved end ---[[ldx-- -<p>Setting the lccodes is also done in a loop over the data table.</p> ---ldx]]-- +-- -- Setting the lccodes is also done in a loop over the data table. -- function characters.setcodes() -- we could loop over csletters -- if trace_defining then diff --git a/Master/texmf-dist/tex/context/base/mkiv/char-utf.lua b/Master/texmf-dist/tex/context/base/mkiv/char-utf.lua index e230370b5d9..f9cba36ca5c 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/char-utf.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/char-utf.lua @@ -6,21 +6,19 @@ if not modules then modules = { } end modules ['char-utf'] = { license = "see context related readme files" } ---[[ldx-- -<p>When a sequence of <l n='utf'/> characters enters the application, it may be -neccessary to collapse subsequences into their composed variant.</p> - -<p>This module implements methods for collapsing and expanding <l n='utf'/> -sequences. We also provide means to deal with characters that are special to -<l n='tex'/> as well as 8-bit characters that need to end up in special kinds -of output (for instance <l n='pdf'/>).</p> - -<p>We implement these manipulations as filters. One can run multiple filters -over a string.</p> - -<p>The old code has now been moved to char-obs.lua which we keep around for -educational purposes.</p> ---ldx]]-- +-- When a sequence of UTF characters enters the application, it may be +-- neccessary to collapse subsequences into their composed variant. +-- +-- This module implements methods for collapsing and expanding UTF sequences. We +-- also provide means to deal with characters that are special to TeX as well as +-- 8-bit characters that need to end up in special kinds of output (for instance +-- PDF). +-- +-- We implement these manipulations as filters. One can run multiple filters over a +-- string. +-- +-- The old code has now been moved to char-obs.lua which we keep around for +-- educational purposes. local next, type = next, type local gsub, find = string.gsub, string.find @@ -55,10 +53,8 @@ characters.filters.utf = utffilters local data = characters.data ---[[ldx-- -<p>It only makes sense to collapse at runtime, since we don't expect source code -to depend on collapsing.</p> ---ldx]]-- +-- It only makes sense to collapse at runtime, since we don't expect source code to +-- depend on collapsing. -- for the moment, will be entries in char-def.lua .. this is just a subset that for -- typographic (font) reasons we want to have split ... if we decompose all, we get diff --git a/Master/texmf-dist/tex/context/base/mkiv/chem-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/chem-ini.lua index f7d10ffa272..06049807a69 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/chem-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/chem-ini.lua @@ -19,11 +19,9 @@ local cpatterns = patterns.context chemistry = chemistry or { } local chemistry = chemistry ---[[ -<p>The next code started out as adaptation of code from Wolfgang Schuster as -posted on the mailing list. The current version supports nested braces and -unbraced integers as scripts.</p> -]]-- +-- The next code started out as adaptation of code from Wolfgang Schuster as posted +-- on the mailing list. The current version supports nested braces and unbraced +-- integers as scripts. local moleculeparser = cpatterns.scripted chemistry.moleculeparser = moleculeparser diff --git a/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua index 9b5e705ca78..b7f1628622f 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua @@ -455,11 +455,11 @@ end if CONTEXTLMTXMODE > 0 then - callback.register("show_lua_call", function(what, slot) + callbacks.register("show_lua_call", function(what, slot) local name = namesofscanners[slot] -- return name and formatters["%s: \\%s, slot: %i"](what,name,slot) or "" return name and formatters["%s \\%s"](what,name) or "" - end) + end, "provide lua call details") end diff --git a/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv b/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv index 22e4d4baeac..a3bc4164e7c 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2023.03.10 12:15} +\newcontextversion{2023.05.05 18:36} %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/Master/texmf-dist/tex/context/base/mkiv/context.mkiv b/Master/texmf-dist/tex/context/base/mkiv/context.mkiv index 80d04bf9d5f..1ef4503ab17 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/context.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/context.mkiv @@ -13,7 +13,7 @@ %D There is some residual code in \MKIV\ that results from the transition to \LMTX\ %D but removeing it can have side effects due to oversights. There is no impact on -%D performance to I leave at that. +%D performance to I leave at that. % Here is some timing (2015-04-01) luajittex format generation: % @@ -49,7 +49,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2023.03.10 12:15} +\edef\contextversion{2023.05.05 18:36} %D Kind of special: diff --git a/Master/texmf-dist/tex/context/base/mkiv/core-con.lua b/Master/texmf-dist/tex/context/base/mkiv/core-con.lua index f57eb6ef890..d3e108a7a3d 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/core-con.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/core-con.lua @@ -8,13 +8,9 @@ if not modules then modules = { } end modules ['core-con'] = { -- todo: split into lang-con.lua and core-con.lua ---[[ldx-- -<p>This module implements a bunch of conversions. Some are more -efficient than their <l n='tex'/> counterpart, some are even -slower but look nicer this way.</p> - -<p>Some code may move to a module in the language namespace.</p> ---ldx]]-- +-- This module implements a bunch of conversions. Some are more efficient than their +-- TeX counterpart, some are even slower but look nicer this way. Some code may move +-- to a module in the language namespace. local floor = math.floor local osdate, ostime, ostimezone = os.date, os.time, os.timezone diff --git a/Master/texmf-dist/tex/context/base/mkiv/core-dat.lua b/Master/texmf-dist/tex/context/base/mkiv/core-dat.lua index b58a801d964..89521b1851f 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/core-dat.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/core-dat.lua @@ -6,10 +6,8 @@ if not modules then modules = { } end modules ['core-dat'] = { license = "see context related readme files" } ---[[ldx-- -<p>This module provides a (multipass) container for arbitrary data. It -replaces the twopass data mechanism.</p> ---ldx]]-- +-- This module provides a (multipass) container for arbitrary data. It replaces the +-- twopass data mechanism. local tonumber, tostring, type = tonumber, tostring, type @@ -231,9 +229,7 @@ implement { actions = datasetvariablefromjob } ---[[ldx-- -<p>We also provide an efficient variant for page states.</p> ---ldx]]-- +-- We also provide an efficient variant for page states. local collected = allocate() local tobesaved = allocate() @@ -250,13 +246,9 @@ local function initializer() tobesaved = pagestates.tobesaved end -job.register('job.pagestates.collected', tobesaved, initializer, nil) +job.register("job.pagestates.collected", tobesaved, initializer, nil) -table.setmetatableindex(tobesaved, function(t,k) - local v = { } - t[k] = v - return v -end) +table.setmetatableindex(tobesaved, "table") local function setstate(settings) local name = settings.name diff --git a/Master/texmf-dist/tex/context/base/mkiv/core-two.lua b/Master/texmf-dist/tex/context/base/mkiv/core-two.lua index 3ab2112b9aa..da37a617067 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/core-two.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/core-two.lua @@ -6,15 +6,14 @@ if not modules then modules = { } end modules ['core-two'] = { license = "see context related readme files" } +-- This is actually one of the oldest MkIV files and basically a port of MkII but +-- the old usage has long be phased out. Also, the public part is now handled by +-- datasets which makes this a more private store. + local next = next local remove, concat = table.remove, table.concat local allocate = utilities.storage.allocate ---[[ldx-- -<p>We save multi-pass information in the main utility table. This is a -bit of a mess because we support old and new methods.</p> ---ldx]]-- - local collected = allocate() local tobesaved = allocate() diff --git a/Master/texmf-dist/tex/context/base/mkiv/core-uti.lua b/Master/texmf-dist/tex/context/base/mkiv/core-uti.lua index 887ef9a7536..e8a28c187ce 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/core-uti.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/core-uti.lua @@ -6,16 +6,13 @@ if not modules then modules = { } end modules ['core-uti'] = { license = "see context related readme files" } --- todo: keep track of changes here (hm, track access, and only true when --- accessed and changed) - ---[[ldx-- -<p>A utility file has always been part of <l n='context'/> and with -the move to <l n='luatex'/> we also moved a lot of multi-pass info -to a <l n='lua'/> table. Instead of loading a <l n='tex'/> based -utility file under different setups, we now load a table once. This -saves much runtime but at the cost of more memory usage.</p> ---ldx]]-- +-- A utility file has always been part of ConTeXt and with the move to LuaTeX we +-- also moved a lot of multi-pass info to a Lua table. Instead of loading a TeX +-- based utility file under different setups, we now load a table once. This saves +-- much runtime but at the cost of more memory usage. +-- +-- In the meantime the overhead is a bit more due to the amount of data being saved +-- and more agressive compacting. local math = math local format, match = string.format, string.match @@ -46,14 +43,9 @@ local job = job job.version = 1.32 job.packversion = 1.02 --- some day we will implement loading of other jobs and then we need --- job.jobs - ---[[ldx-- -<p>Variables are saved using in the previously defined table and passed -onto <l n='tex'/> using the following method. Of course one can also -directly access the variable using a <l n='lua'/> call.</p> ---ldx]]-- +-- Variables are saved using in the previously defined table and passed onto TeX +-- using the following method. Of course one can also directly access the variable +-- using a Lua call. local savelist, comment = { }, { } diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-con.lua b/Master/texmf-dist/tex/context/base/mkiv/data-con.lua index 51e0ce85614..d7d3c7d4610 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/data-con.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/data-con.lua @@ -13,19 +13,17 @@ local trace_cache = false trackers.register("resolvers.cache", functi local trace_containers = false trackers.register("resolvers.containers", function(v) trace_containers = v end) local trace_storage = false trackers.register("resolvers.storage", function(v) trace_storage = v end) ---[[ldx-- -<p>Once we found ourselves defining similar cache constructs several times, -containers were introduced. Containers are used to collect tables in memory and -reuse them when possible based on (unique) hashes (to be provided by the calling -function).</p> - -<p>Caching to disk is disabled by default. Version numbers are stored in the -saved table which makes it possible to change the table structures without -bothering about the disk cache.</p> - -<p>Examples of usage can be found in the font related code. This code is not -ideal but we need it in generic too so we compromise.</p> ---ldx]]-- +-- Once we found ourselves defining similar cache constructs several times, +-- containers were introduced. Containers are used to collect tables in memory and +-- reuse them when possible based on (unique) hashes (to be provided by the calling +-- function). +-- +-- Caching to disk is disabled by default. Version numbers are stored in the saved +-- table which makes it possible to change the table structures without bothering +-- about the disk cache. +-- +-- Examples of usage can be found in the font related code. This code is not ideal +-- but we need it in generic too so we compromise. containers = containers or { } local containers = containers diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-res.lua b/Master/texmf-dist/tex/context/base/mkiv/data-res.lua index 8afc09b9792..11e67f78545 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/data-res.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/data-res.lua @@ -135,16 +135,35 @@ local criticalvars = { -- we also report weird ones, with weird being: (1) duplicate /texmf or (2) no /web2c in -- the names. +-- if environment.default_texmfcnf then +-- resolvers.luacnfspec = "home:texmf/web2c;" .. environment.default_texmfcnf -- texlive + home: for taco etc +-- else +-- resolvers.luacnfspec = concat ( { +-- "home:texmf/web2c", +-- "selfautoparent:/texmf-local/web2c", +-- "selfautoparent:/texmf-context/web2c", +-- "selfautoparent:/texmf-dist/web2c", +-- "selfautoparent:/texmf/web2c", +-- }, ";") +-- end + if environment.default_texmfcnf then + -- this will go away (but then also no more checking in mtxrun.lua itself) resolvers.luacnfspec = "home:texmf/web2c;" .. environment.default_texmfcnf -- texlive + home: for taco etc else - resolvers.luacnfspec = concat ( { - "home:texmf/web2c", - "selfautoparent:/texmf-local/web2c", - "selfautoparent:/texmf-context/web2c", - "selfautoparent:/texmf-dist/web2c", - "selfautoparent:/texmf/web2c", - }, ";") + local texroot = environment.texroot + resolvers.luacnfspec = "home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-context/web2c;selfautoparent:/texmf/web2c" + if texroot and isdir(texroot .. "/texmf-context") then + -- we're okay and run the lean and mean installation + elseif texroot and isdir(texroot .. "/texmf-dist") then + -- we're in texlive where texmf-dist is leading + resolvers.luacnfspec = "home:texmf/web2c;selfautoparent:/texmf-local/web2c;selfautoparent:/texmf-dist/web2c;selfautoparent:/texmf/web2c" + elseif ostype ~= "windows" and isdir("/etc/texmf/web2c") then + -- we have some linux distribution that does it its own way + resolvers.luacnfspec = "home:texmf/web2c;/etc/texmf/web2c;selfautodir:/share/texmf/web2c" + else + -- we stick to the reference specification + end end local unset_variable = "unset" diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-tar.lua b/Master/texmf-dist/tex/context/base/mkiv/data-tar.lua index 45de749b663..b2416330ff2 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/data-tar.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/data-tar.lua @@ -12,14 +12,10 @@ local trace_locating = false trackers.register("resolvers.locating", function(v local report_tar = logs.reporter("resolvers","tar") ---[[ldx-- -<p>We use a url syntax for accessing the tar file itself and file in it:</p> - -<typing> -tar:///oeps.tar?name=bla/bla.tex -tar:///oeps.tar?tree=tex/texmf-local -</typing> ---ldx]]-- +-- We use a url syntax for accessing the tar file itself and file in it: +-- +-- tar:///oeps.tar?name=bla/bla.tex +-- tar:///oeps.tar?tree=tex/texmf-local local resolvers = resolvers local findfile = resolvers.findfile diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua b/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua index 1948f1ea596..21e0d1f4f18 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua @@ -6,20 +6,15 @@ if not modules then modules = { } end modules ['data-tmp'] = { license = "see context related readme files" } ---[[ldx-- -<p>This module deals with caching data. It sets up the paths and implements -loaders and savers for tables. Best is to set the following variable. When not -set, the usual paths will be checked. Personally I prefer the (users) temporary -path.</p> - -</code> -TEXMFCACHE=$TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;. -</code> - -<p>Currently we do no locking when we write files. This is no real problem -because most caching involves fonts and the chance of them being written at the -same time is small. We also need to extend luatools with a recache feature.</p> ---ldx]]-- +-- This module deals with caching data. It sets up the paths and implements loaders +-- and savers for tables. Best is to set the following variable. When not set, the +-- usual paths will be checked. Personally I prefer the (users) temporary path. +-- +-- TEXMFCACHE=$TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;. +-- +-- Currently we do no locking when we write files. This is no real problem because +-- most caching involves fonts and the chance of them being written at the same time +-- is small. We also need to extend luatools with a recache feature. local next, type = next, type local pcall, loadfile, collectgarbage = pcall, loadfile, collectgarbage diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-zip.lua b/Master/texmf-dist/tex/context/base/mkiv/data-zip.lua index 1a9310f17fe..40f38c8555b 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/data-zip.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/data-zip.lua @@ -14,17 +14,13 @@ local trace_locating = false trackers.register("resolvers.locating", function(v local report_zip = logs.reporter("resolvers","zip") ---[[ldx-- -<p>We use a url syntax for accessing the zip file itself and file in it:</p> - -<typing> -zip:///oeps.zip?name=bla/bla.tex -zip:///oeps.zip?tree=tex/texmf-local -zip:///texmf.zip?tree=/tex/texmf -zip:///texmf.zip?tree=/tex/texmf-local -zip:///texmf-mine.zip?tree=/tex/texmf-projects -</typing> ---ldx]]-- +-- We use a url syntax for accessing the zip file itself and file in it: +-- +-- zip:///oeps.zip?name=bla/bla.tex +-- zip:///oeps.zip?tree=tex/texmf-local +-- zip:///texmf.zip?tree=/tex/texmf +-- zip:///texmf.zip?tree=/tex/texmf-local +-- zip:///texmf-mine.zip?tree=/tex/texmf-projects local resolvers = resolvers local findfile = resolvers.findfile diff --git a/Master/texmf-dist/tex/context/base/mkiv/file-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/file-ini.lua index 2a0271a9d80..01bedeeebe4 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/file-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/file-ini.lua @@ -6,11 +6,8 @@ if not modules then modules = { } end modules ['file-ini'] = { license = "see context related readme files" } ---[[ldx-- -<p>It's more convenient to manipulate filenames (paths) in <l n='lua'/> than in -<l n='tex'/>. These methods have counterparts at the <l n='tex'/> end.</p> ---ldx]]-- - +-- It's more convenient to manipulate filenames (paths) in Lua than in TeX. These +-- methods have counterparts at the TeX end. local implement = interfaces.implement local setmacro = interfaces.setmacro diff --git a/Master/texmf-dist/tex/context/base/mkiv/file-mod.lua b/Master/texmf-dist/tex/context/base/mkiv/file-mod.lua index d392887ec18..ac9ad938a53 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/file-mod.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/file-mod.lua @@ -6,17 +6,11 @@ if not modules then modules = { } end modules ['file-mod'] = { license = "see context related readme files" } --- This module will be redone! For instance, the prefixes will move to data-* --- as they arr sort of generic along with home:// etc/. - --- context is not defined yet! todo! (we need to load tupp-fil after cld) --- todo: move startreadingfile to lua and push regime there - ---[[ldx-- -<p>It's more convenient to manipulate filenames (paths) in -<l n='lua'/> than in <l n='tex'/>. These methods have counterparts -at the <l n='tex'/> side.</p> ---ldx]]-- +-- This module will be redone! For instance, the prefixes will move to data-* as +-- they are sort of generic along with home:// etc/. +-- +-- It is more convenient to manipulate filenames (paths) in Lua than in TeX. The +-- methods below have counterparts at the TeX end. local format, find, concat, tonumber = string.format, string.find, table.concat, tonumber local sortedhash = table.sortedhash diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-afk.lua b/Master/texmf-dist/tex/context/base/mkiv/font-afk.lua index 761016d3485..250c17e776e 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-afk.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-afk.lua @@ -7,11 +7,9 @@ if not modules then modules = { } end modules ['font-afk'] = { dataonly = true, } ---[[ldx-- -<p>For ligatures, only characters with a code smaller than 128 make sense, -anything larger is encoding dependent. An interesting complication is that a -character can be in an encoding twice but is hashed once.</p> ---ldx]]-- +-- For ligatures, only characters with a code smaller than 128 make sense, anything +-- larger is encoding dependent. An interesting complication is that a character can +-- be in an encoding twice but is hashed once. local allocate = utilities.storage.allocate diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-con.lua b/Master/texmf-dist/tex/context/base/mkiv/font-con.lua index 066ea33ed2b..10f98ca1201 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-con.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-con.lua @@ -6,6 +6,9 @@ if not modules then modules = { } end modules ['font-con'] = { license = "see context related readme files" } +-- Todo: Enable fixes from the lmt to here. Also in font-oto.lua wrt the changed +-- assignments. (Around texlive 2024 in order not to disturb generic.) + -- some names of table entries will be changed (no _) local next, tostring, tonumber, rawget = next, tostring, tonumber, rawget @@ -22,11 +25,9 @@ local trace_scaling = false trackers.register("fonts.scaling", function(v) local report_defining = logs.reporter("fonts","defining") --- watch out: no negative depths and negative eights permitted in regular fonts - ---[[ldx-- -<p>Here we only implement a few helper functions.</p> ---ldx]]-- +-- Watch out: no negative depths and negative heights are permitted in regular +-- fonts. Also, the code in LMTX is a bit different. Here we only implement a +-- few helper functions. local fonts = fonts local constructors = fonts.constructors or { } @@ -59,11 +60,9 @@ constructors.designsizes = designsizes local loadedfonts = allocate() constructors.loadedfonts = loadedfonts ---[[ldx-- -<p>We need to normalize the scale factor (in scaled points). This has to -do with the fact that <l n='tex'/> uses a negative multiple of 1000 as -a signal for a font scaled based on the design size.</p> ---ldx]]-- +-- We need to normalize the scale factor (in scaled points). This has to do with the +-- fact that TeX uses a negative multiple of 1000 as a signal for a font scaled +-- based on the design size. local factors = { pt = 65536.0, @@ -118,22 +117,18 @@ function constructors.getmathparameter(tfmdata,name) end end ---[[ldx-- -<p>Beware, the boundingbox is passed as reference so we may not overwrite it -in the process; numbers are of course copies. Here 65536 equals 1pt. (Due to -excessive memory usage in CJK fonts, we no longer pass the boundingbox.)</p> ---ldx]]-- - --- The scaler is only used for otf and afm and virtual fonts. If a virtual font has italic --- correction make sure to set the hasitalics flag. Some more flags will be added in the --- future. - ---[[ldx-- -<p>The reason why the scaler was originally split, is that for a while we experimented -with a helper function. However, in practice the <l n='api'/> calls are too slow to -make this profitable and the <l n='lua'/> based variant was just faster. A days -wasted day but an experience richer.</p> ---ldx]]-- +-- Beware, the boundingbox is passed as reference so we may not overwrite it in the +-- process; numbers are of course copies. Here 65536 equals 1pt. (Due to excessive +-- memory usage in CJK fonts, we no longer pass the boundingbox.) +-- +-- The scaler is only used for OTF and AFM and virtual fonts. If a virtual font has +-- italic correction make sure to set the hasitalics flag. Some more flags will be +-- added in the future. +-- +-- The reason why the scaler was originally split, is that for a while we +-- experimented with a helper function. However, in practice the API calls are too +-- slow to make this profitable and the Lua based variant was just faster. A days +-- wasted day but an experience richer. function constructors.cleanuptable(tfmdata) -- This no longer makes sense because the addition of font.getcopy and its @@ -656,6 +651,14 @@ function constructors.scale(tfmdata,specification) if changed then local c = changed[unicode] if c and c ~= unicode then + -- local cc = changed[c] + -- if cc then + -- while cc do + -- c = cc + -- cc = changed[c] + -- end + -- end + -- check not needed: if c then description = descriptions[c] or descriptions[unicode] or character character = characters[c] or character @@ -1093,9 +1096,7 @@ function constructors.finalize(tfmdata) return tfmdata end ---[[ldx-- -<p>A unique hash value is generated by:</p> ---ldx]]-- +-- A unique hash value is generated by: local hashmethods = { } constructors.hashmethods = hashmethods @@ -1154,13 +1155,11 @@ hashmethods.normal = function(list) end end ---[[ldx-- -<p>In principle we can share tfm tables when we are in need for a font, but then -we need to define a font switch as an id/attr switch which is no fun, so in that -case users can best use dynamic features ... so, we will not use that speedup. Okay, -when we get rid of base mode we can optimize even further by sharing, but then we -loose our testcases for <l n='luatex'/>.</p> ---ldx]]-- +-- In principle we can share tfm tables when we are in need for a font, but then we +-- need to define a font switch as an id/attr switch which is no fun, so in that +-- case users can best use dynamic features ... so, we will not use that speedup. +-- Okay, when we get rid of base mode we can optimize even further by sharing, but +-- then we loose our testcases for LuaTeX. function constructors.hashinstance(specification,force) local hash = specification.hash @@ -1516,10 +1515,7 @@ do end ---[[ldx-- -<p>We need to check for default features. For this we provide -a helper function.</p> ---ldx]]-- +-- We need to check for default features. For this we provide a helper function. function constructors.checkedfeatures(what,features) local defaults = handlers[what].features.defaults diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-ctx.lua b/Master/texmf-dist/tex/context/base/mkiv/font-ctx.lua index 2c56b5613fc..f9ad475ac6f 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-ctx.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-ctx.lua @@ -528,26 +528,19 @@ do end ---[[ldx-- -<p>So far we haven't really dealt with features (or whatever we want -to pass along with the font definition. We distinguish the following -situations:</p> -situations:</p> - -<code> -name:xetex like specs -name@virtual font spec -name*context specification -</code> ---ldx]]-- - --- currently fonts are scaled while constructing the font, so we --- have to do scaling of commands in the vf at that point using e.g. --- "local scale = g.parameters.factor or 1" after all, we need to --- work with copies anyway and scaling needs to be done at some point; --- however, when virtual tricks are used as feature (makes more --- sense) we scale the commands in fonts.constructors.scale (and set the --- factor there) +-- So far we haven't really dealt with features (or whatever we want to pass along +-- with the font definition. We distinguish the following situations: +-- +-- name:xetex like specs +-- name@virtual font spec +-- name*context specification +-- +-- Currently fonts are scaled while constructing the font, so we have to do scaling +-- of commands in the vf at that point using e.g. "local scale = g.parameters.factor +-- or 1" after all, we need to work with copies anyway and scaling needs to be done +-- at some point; however, when virtual tricks are used as feature (makes more +-- sense) we scale the commands in fonts.constructors.scale (and set the factor +-- there). local loadfont = definers.loadfont @@ -2385,10 +2378,8 @@ dimenfactors.em = nil dimenfactors["%"] = nil dimenfactors.pct = nil ---[[ldx-- -<p>Before a font is passed to <l n='tex'/> we scale it. Here we also need -to scale virtual characters.</p> ---ldx]]-- +-- Before a font is passed to TeX we scale it. Here we also need to scale virtual +-- characters. do diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-def.lua b/Master/texmf-dist/tex/context/base/mkiv/font-def.lua index b752b3258c4..01bced6d161 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-def.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-def.lua @@ -24,10 +24,9 @@ trackers.register("fonts.loading", "fonts.defining", "otf.loading", "afm.loading local report_defining = logs.reporter("fonts","defining") ---[[ldx-- -<p>Here we deal with defining fonts. We do so by intercepting the -default loader that only handles <l n='tfm'/>.</p> ---ldx]]-- +-- Here we deal with defining fonts. We do so by intercepting the default loader +-- that only handles TFM files. Although, we started out that way but in the +-- meantime we can hardly speak of TFM any more. local fonts = fonts local fontdata = fonts.hashes.identifiers @@ -53,25 +52,18 @@ local designsizes = constructors.designsizes local resolvefile = fontgoodies and fontgoodies.filenames and fontgoodies.filenames.resolve or function(s) return s end ---[[ldx-- -<p>We hardly gain anything when we cache the final (pre scaled) -<l n='tfm'/> table. But it can be handy for debugging, so we no -longer carry this code along. Also, we now have quite some reference -to other tables so we would end up with lots of catches.</p> ---ldx]]-- - ---[[ldx-- -<p>We can prefix a font specification by <type>name:</type> or -<type>file:</type>. The first case will result in a lookup in the -synonym table.</p> - -<typing> -[ name: | file: ] identifier [ separator [ specification ] ] -</typing> - -<p>The following function split the font specification into components -and prepares a table that will move along as we proceed.</p> ---ldx]]-- +-- We hardly gain anything when we cache the final (pre scaled) TFM table. But it +-- can be handy for debugging, so we no longer carry this code along. Also, we now +-- have quite some reference to other tables so we would end up with lots of +-- catches. +-- +-- We can prefix a font specification by "name:" or "file:". The first case will +-- result in a lookup in the synonym table. +-- +-- [ name: | file: ] identifier [ separator [ specification ] ] +-- +-- The following function split the font specification into components and prepares +-- a table that will move along as we proceed. -- beware, we discard additional specs -- @@ -164,9 +156,7 @@ if context then end ---[[ldx-- -<p>We can resolve the filename using the next function:</p> ---ldx]]-- +-- We can resolve the filename using the next function: definers.resolvers = definers.resolvers or { } local resolvers = definers.resolvers @@ -258,23 +248,17 @@ function definers.resolve(specification) return specification end ---[[ldx-- -<p>The main read function either uses a forced reader (as determined by -a lookup) or tries to resolve the name using the list of readers.</p> - -<p>We need to cache when possible. We do cache raw tfm data (from <l -n='tfm'/>, <l n='afm'/> or <l n='otf'/>). After that we can cache based -on specificstion (name) and size, that is, <l n='tex'/> only needs a number -for an already loaded fonts. However, it may make sense to cache fonts -before they're scaled as well (store <l n='tfm'/>'s with applied methods -and features). However, there may be a relation between the size and -features (esp in virtual fonts) so let's not do that now.</p> - -<p>Watch out, here we do load a font, but we don't prepare the -specification yet.</p> ---ldx]]-- - --- very experimental: +-- The main read function either uses a forced reader (as determined by a lookup) or +-- tries to resolve the name using the list of readers. +-- +-- We need to cache when possible. We do cache raw tfm data (from TFM, AFM or OTF). +-- After that we can cache based on specificstion (name) and size, that is, TeX only +-- needs a number for an already loaded fonts. However, it may make sense to cache +-- fonts before they're scaled as well (store TFM's with applied methods and +-- features). However, there may be a relation between the size and features (esp in +-- virtual fonts) so let's not do that now. +-- +-- Watch out, here we do load a font, but we don't prepare the specification yet. function definers.applypostprocessors(tfmdata) local postprocessors = tfmdata.postprocessors @@ -439,17 +423,13 @@ function constructors.readanddefine(name,size) -- no id -- maybe a dummy first return fontdata[id], id end ---[[ldx-- -<p>So far the specifiers. Now comes the real definer. Here we cache -based on id's. Here we also intercept the virtual font handler. Since -it evolved stepwise I may rewrite this bit (combine code).</p> - -In the previously defined reader (the one resulting in a <l n='tfm'/> -table) we cached the (scaled) instances. Here we cache them again, but -this time based on id. We could combine this in one cache but this does -not gain much. By the way, passing id's back to in the callback was -introduced later in the development.</p> ---ldx]]-- +-- So far the specifiers. Now comes the real definer. Here we cache based on id's. +-- Here we also intercept the virtual font handler. +-- +-- In the previously defined reader (the one resulting in a TFM table) we cached the +-- (scaled) instances. Here we cache them again, but this time based on id. We could +-- combine this in one cache but this does not gain much. By the way, passing id's +-- back to in the callback was introduced later in the development. function definers.registered(hash) local id = internalized[hash] @@ -522,9 +502,7 @@ function font.getfont(id) return fontdata[id] -- otherwise issues end ---[[ldx-- -<p>We overload the <l n='tfm'/> reader.</p> ---ldx]]-- +-- We overload the <l n='tfm'/> reader. if not context then callbacks.register('define_font', definers.read, "definition of fonts (tfmdata preparation)") diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-enc.lua b/Master/texmf-dist/tex/context/base/mkiv/font-enc.lua index f2f0595ddfa..732bc890728 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-enc.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-enc.lua @@ -16,10 +16,8 @@ local setmetatableindex = table.setmetatableindex local allocate = utilities.storage.allocate local mark = utilities.storage.mark ---[[ldx-- -<p>Because encodings are going to disappear, we don't bother defining -them in tables. But we may do so some day, for consistency.</p> ---ldx]]-- +-- Because encodings are going to disappear, we don't bother defining them in +-- tables. But we may do so some day, for consistency. local report_encoding = logs.reporter("fonts","encoding") @@ -43,24 +41,19 @@ function encodings.is_known(encoding) return containers.is_valid(encodings.cache,encoding) end ---[[ldx-- -<p>An encoding file looks like this:</p> - -<typing> -/TeXnANSIEncoding [ -/.notdef -/Euro -... -/ydieresis -] def -</typing> - -<p>Beware! The generic encoding files don't always apply to the ones that -ship with fonts. This has to do with the fact that names follow (slightly) -different standards. However, the fonts where this applies to (for instance -Latin Modern or <l n='tex'> Gyre) come in OpenType variants too, so these -will be used.</p> ---ldx]]-- +-- An encoding file looks like this: +-- +-- /TeXnANSIEncoding [ +-- /.notdef +-- /Euro +-- ... +-- /ydieresis +-- ] def +-- +-- Beware! The generic encoding files don't always apply to the ones that ship with +-- fonts. This has to do with the fact that names follow (slightly) different +-- standards. However, the fonts where this applies to (for instance Latin Modern or +-- TeXGyre come in OpenType variants too, so these will be used. local enccodes = characters.enccodes or { } @@ -120,10 +113,7 @@ function encodings.load(filename) return containers.write(encodings.cache, name, data) end ---[[ldx-- -<p>There is no unicode encoding but for practical purposes we define -one.</p> ---ldx]]-- +-- There is no unicode encoding but for practical purposes we define one. -- maybe make this a function: diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-fbk.lua b/Master/texmf-dist/tex/context/base/mkiv/font-fbk.lua index b6c9a430ddf..da04b50a864 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-fbk.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-fbk.lua @@ -10,10 +10,6 @@ local cos, tan, rad, format = math.cos, math.tan, math.rad, string.format local utfbyte, utfchar = utf.byte, utf.char local next = next ---[[ldx-- -<p>This is very experimental code!</p> ---ldx]]-- - local trace_visualize = false trackers.register("fonts.composing.visualize", function(v) trace_visualize = v end) local trace_define = false trackers.register("fonts.composing.define", function(v) trace_define = v end) diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-imp-tex.lua b/Master/texmf-dist/tex/context/base/mkiv/font-imp-tex.lua index b4b9a7b6943..87a1ae3aa2f 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-imp-tex.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-imp-tex.lua @@ -13,36 +13,31 @@ local otf = fonts.handlers.otf local registerotffeature = otf.features.register local addotffeature = otf.addfeature --- tlig (we need numbers for some fonts so ...) +-- We provide a few old and obsolete compatibility input features. We need numbers +-- for some fonts so no names here. Do we also need them for afm fonts? -local specification = { +local tlig = { type = "ligature", order = { "tlig" }, prepend = true, data = { - -- endash = "hyphen hyphen", - -- emdash = "hyphen hyphen hyphen", - [0x2013] = { 0x002D, 0x002D }, - [0x2014] = { 0x002D, 0x002D, 0x002D }, - -- quotedblleft = "quoteleft quoteleft", - -- quotedblright = "quoteright quoteright", - -- quotedblleft = "grave grave", - -- quotedblright = "quotesingle quotesingle", - -- quotedblbase = "comma comma", + [0x2013] = { 0x002D, 0x002D }, + [0x2014] = { 0x002D, 0x002D, 0x002D }, }, } -addotffeature("tlig",specification) - -registerotffeature { - -- this makes it a known feature (in tables) - name = "tlig", - description = "tex ligatures", +local tquo = { + type = "ligature", + order = { "tquo" }, + prepend = true, + data = { + [0x201C] = { 0x0060, 0x0060 }, + [0x201D] = { 0x0027, 0x0027 }, + [0x201E] = { 0x002C, 0x002C }, + }, } --- trep - -local specification = { +local trep = { type = "substitution", order = { "trep" }, prepend = true, @@ -53,13 +48,13 @@ local specification = { }, } -addotffeature("trep",specification) +addotffeature("trep",trep) -- last +addotffeature("tlig",tlig) +addotffeature("tquo",tquo) -- first -registerotffeature { - -- this makes it a known feature (in tables) - name = "trep", - description = "tex replacements", -} +registerotffeature { name = "tlig", description = "tex ligatures" } +registerotffeature { name = "tquo", description = "tex quotes" } +registerotffeature { name = "trep", description = "tex replacements" } -- some day this will be moved to font-imp-scripts.lua diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/font-ini.lua index 8bab6d90295..201cc69f48c 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-ini.lua @@ -6,9 +6,7 @@ if not modules then modules = { } end modules ['font-ini'] = { license = "see context related readme files" } ---[[ldx-- -<p>Not much is happening here.</p> ---ldx]]-- +-- Not much is happening here. local allocate = utilities.storage.allocate local sortedhash = table.sortedhash diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-log.lua b/Master/texmf-dist/tex/context/base/mkiv/font-log.lua index 092b5a62ea9..96b5864fd52 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-log.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-log.lua @@ -19,12 +19,9 @@ fonts.loggers = loggers local usedfonts = utilities.storage.allocate() ----- loadedfonts = utilities.storage.allocate() ---[[ldx-- -<p>The following functions are used for reporting about the fonts -used. The message itself is not that useful in regular runs but since -we now have several readers it may be handy to know what reader is -used for which font.</p> ---ldx]]-- +-- The following functions are used for reporting about the fonts used. The message +-- itself is not that useful in regular runs but since we now have several readers +-- it may be handy to know what reader is used for which font. function loggers.onetimemessage(font,char,message,reporter) local tfmdata = fonts.hashes.identifiers[font] diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-nod.lua b/Master/texmf-dist/tex/context/base/mkiv/font-nod.lua index a7dcfd9b09b..1e39784d971 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-nod.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-nod.lua @@ -7,11 +7,6 @@ if not modules then modules = { } end modules ['font-nod'] = { license = "see context related readme files" } ---[[ldx-- -<p>This is rather experimental. We need more control and some of this -might become a runtime module instead. This module will be cleaned up!</p> ---ldx]]-- - local utfchar = utf.char local concat, fastcopy = table.concat, table.fastcopy local match, rep = string.match, string.rep diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-one.lua b/Master/texmf-dist/tex/context/base/mkiv/font-one.lua index 829f52ea043..25efc2a0467 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-one.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-one.lua @@ -7,18 +7,16 @@ if not modules then modules = { } end modules ['font-one'] = { license = "see context related readme files" } ---[[ldx-- -<p>Some code may look a bit obscure but this has to do with the fact that we also use -this code for testing and much code evolved in the transition from <l n='tfm'/> to -<l n='afm'/> to <l n='otf'/>.</p> - -<p>The following code still has traces of intermediate font support where we handles -font encodings. Eventually font encoding went away but we kept some code around in -other modules.</p> - -<p>This version implements a node mode approach so that users can also more easily -add features.</p> ---ldx]]-- +-- Some code may look a bit obscure but this has to do with the fact that we also +-- use this code for testing and much code evolved in the transition from TFM to AFM +-- to OTF. +-- +-- The following code still has traces of intermediate font support where we handles +-- font encodings. Eventually font encoding went away but we kept some code around +-- in other modules. +-- +-- This version implements a node mode approach so that users can also more easily +-- add features. local fonts, logs, trackers, containers, resolvers = fonts, logs, trackers, containers, resolvers @@ -71,15 +69,13 @@ local overloads = fonts.mappings.overloads local applyruntimefixes = fonts.treatments and fonts.treatments.applyfixes ---[[ldx-- -<p>We cache files. Caching is taken care of in the loader. We cheat a bit by adding -ligatures and kern information to the afm derived data. That way we can set them faster -when defining a font.</p> - -<p>We still keep the loading two phased: first we load the data in a traditional -fashion and later we transform it to sequences. Then we apply some methods also -used in opentype fonts (like <t>tlig</t>).</p> ---ldx]]-- +-- We cache files. Caching is taken care of in the loader. We cheat a bit by adding +-- ligatures and kern information to the afm derived data. That way we can set them +-- faster when defining a font. +-- +-- We still keep the loading two phased: first we load the data in a traditional +-- fashion and later we transform it to sequences. Then we apply some methods also +-- used in opentype fonts (like tlig). function afm.load(filename) filename = resolvers.findfile(filename,'afm') or "" @@ -312,10 +308,8 @@ local function enhance_fix_names(data) end end ---[[ldx-- -<p>These helpers extend the basic table with extra ligatures, texligatures -and extra kerns. This saves quite some lookups later.</p> ---ldx]]-- +-- These helpers extend the basic table with extra ligatures, texligatures and extra +-- kerns. This saves quite some lookups later. local addthem = function(rawdata,ligatures) if ligatures then @@ -349,17 +343,14 @@ local function enhance_add_ligatures(rawdata) addthem(rawdata,afm.helpdata.ligatures) end ---[[ldx-- -<p>We keep the extra kerns in separate kerning tables so that we can use -them selectively.</p> ---ldx]]-- - --- This is rather old code (from the beginning when we had only tfm). If --- we unify the afm data (now we have names all over the place) then --- we can use shcodes but there will be many more looping then. But we --- could get rid of the tables in char-cmp then. Als, in the generic version --- we don't use the character database. (Ok, we can have a context specific --- variant). +-- We keep the extra kerns in separate kerning tables so that we can use them +-- selectively. +-- +-- This is rather old code (from the beginning when we had only tfm). If we unify +-- the afm data (now we have names all over the place) then we can use shcodes but +-- there will be many more looping then. But we could get rid of the tables in +-- char-cmp then. Als, in the generic version we don't use the character database. +-- (Ok, we can have a context specific variant). local function enhance_add_extra_kerns(rawdata) -- using shcodes is not robust here local descriptions = rawdata.descriptions @@ -440,9 +431,7 @@ local function enhance_add_extra_kerns(rawdata) -- using shcodes is not robust h do_it_copy(afm.helpdata.rightkerned) end ---[[ldx-- -<p>The copying routine looks messy (and is indeed a bit messy).</p> ---ldx]]-- +-- The copying routine looks messy (and is indeed a bit messy). local function adddimensions(data) -- we need to normalize afm to otf i.e. indexed table instead of name if data then @@ -619,11 +608,9 @@ end return nil end ---[[ldx-- -<p>Originally we had features kind of hard coded for <l n='afm'/> files but since I -expect to support more font formats, I decided to treat this fontformat like any -other and handle features in a more configurable way.</p> ---ldx]]-- +-- Originally we had features kind of hard coded for AFM files but since I expect to +-- support more font formats, I decided to treat this fontformat like any other and +-- handle features in a more configurable way. function afm.setfeatures(tfmdata,features) local okay = constructors.initializefeatures("afm",tfmdata,features,trace_features,report_afm) @@ -715,13 +702,10 @@ local function afmtotfm(specification) end end ---[[ldx-- -<p>As soon as we could intercept the <l n='tfm'/> reader, I implemented an -<l n='afm'/> reader. Since traditional <l n='pdftex'/> could use <l n='opentype'/> -fonts with <l n='afm'/> companions, the following method also could handle -those cases, but now that we can handle <l n='opentype'/> directly we no longer -need this features.</p> ---ldx]]-- +-- As soon as we could intercept the TFM reader, I implemented an AFM reader. Since +-- traditional pdfTeX could use OpenType fonts with AFM companions, the following +-- method also could handle those cases, but now that we can handle OpenType +-- directly we no longer need this features. local function read_from_afm(specification) local tfmdata = afmtotfm(specification) @@ -736,9 +720,7 @@ local function read_from_afm(specification) return tfmdata end ---[[ldx-- -<p>We have the usual two modes and related features initializers and processors.</p> ---ldx]]-- +-- We have the usual two modes and related features initializers and processors. registerafmfeature { name = "mode", diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-onr.lua b/Master/texmf-dist/tex/context/base/mkiv/font-onr.lua index 9e5a012bd5f..6234742a3d4 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-onr.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-onr.lua @@ -7,18 +7,16 @@ if not modules then modules = { } end modules ['font-onr'] = { license = "see context related readme files" } ---[[ldx-- -<p>Some code may look a bit obscure but this has to do with the fact that we also use -this code for testing and much code evolved in the transition from <l n='tfm'/> to -<l n='afm'/> to <l n='otf'/>.</p> - -<p>The following code still has traces of intermediate font support where we handles -font encodings. Eventually font encoding went away but we kept some code around in -other modules.</p> - -<p>This version implements a node mode approach so that users can also more easily -add features.</p> ---ldx]]-- +-- Some code may look a bit obscure but this has to do with the fact that we also +-- use this code for testing and much code evolved in the transition from TFM to AFM +-- to OTF. +-- +-- The following code still has traces of intermediate font support where we handles +-- font encodings. Eventually font encoding went away but we kept some code around +-- in other modules. +-- +-- This version implements a node mode approach so that users can also more easily +-- add features. local fonts, logs, trackers, resolvers = fonts, logs, trackers, resolvers @@ -44,12 +42,9 @@ afm.readers = readers afm.version = 1.513 -- incrementing this number one up will force a re-cache ---[[ldx-- -<p>We start with the basic reader which we give a name similar to the built in <l n='tfm'/> -and <l n='otf'/> reader.</p> -<p>We use a new (unfinished) pfb loader but I see no differences between the old -and new vectors (we actually had one bad vector with the old loader).</p> ---ldx]]-- +-- We start with the basic reader which we give a name similar to the built in TFM +-- and OTF reader. We use a PFB loader but I see no differences between the old and +-- new vectors (we actually had one bad vector with the old loader). local get_indexes, get_shapes @@ -305,11 +300,10 @@ do end ---[[ldx-- -<p>We start with the basic reader which we give a name similar to the built in <l n='tfm'/> -and <l n='otf'/> reader. We only need data that is relevant for our use. We don't support -more complex arrangements like multiple master (obsolete), direction specific kerning, etc.</p> ---ldx]]-- +-- We start with the basic reader which we give a name similar to the built in TFM +-- and OTF reader. We only need data that is relevant for our use. We don't support +-- more complex arrangements like multiple master (obsolete), direction specific +-- kerning, etc. local spacer = patterns.spacer local whitespace = patterns.whitespace diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-ota.lua b/Master/texmf-dist/tex/context/base/mkiv/font-ota.lua index a8f9f0047c2..160d0d0edb6 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-ota.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-ota.lua @@ -54,10 +54,8 @@ local chardata = characters and characters.data local otffeatures = fonts.constructors.features.otf local registerotffeature = otffeatures.register ---[[ldx-- -<p>Analyzers run per script and/or language and are needed in order to -process features right.</p> ---ldx]]-- +-- Analyzers run per script and/or language and are needed in order to process +-- features right. local setstate = nuts.setstate local getstate = nuts.getstate diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-otc.lua b/Master/texmf-dist/tex/context/base/mkiv/font-otc.lua index f83c3e8ec76..0787a203598 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-otc.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-otc.lua @@ -786,7 +786,12 @@ local function addfeature(data,feature,specifications,prepareonly) local list = askedsteps[i] local coverage = nil local format = nil - if featuretype == "substitution" then +if type(list) == "function" then + list = list(data,specification,list,i) +end + if not list then + -- see ebgaramond hack + elseif featuretype == "substitution" then -- see font-imp-tweaks: we directly pass a mapping so no checks done category = "gsub" coverage = (mapping and list) or prepare_substitution(list,featuretype,nocheck) diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-otl.lua b/Master/texmf-dist/tex/context/base/mkiv/font-otl.lua index 354ca59a78d..0825077b3f2 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-otl.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-otl.lua @@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading") local fonts = fonts local otf = fonts.handlers.otf -otf.version = 3.132 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 3.133 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otl", otf.version, true) otf.svgcache = containers.define("fonts", "svg", otf.version, true) otf.pngcache = containers.define("fonts", "png", otf.version, true) diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-oto.lua b/Master/texmf-dist/tex/context/base/mkiv/font-oto.lua index e8b92c07755..0689f4dfb5b 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-oto.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-oto.lua @@ -6,6 +6,9 @@ if not modules then modules = { } end modules ['font-oto'] = { -- original tex license = "see context related readme files" } +-- Todo: Enable fixes from the lmt to here. Also in font-con.lua wrt the changed +-- assignments. (Around texlive 2024 in order not to disturb generic.) + local concat, unpack = table.concat, table.unpack local insert, remove = table.insert, table.remove local format, gmatch, gsub, find, match, lower, strip = string.format, string.gmatch, string.gsub, string.find, string.match, string.lower, string.strip @@ -260,7 +263,9 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis for i=1,#steps do for unicode, data in next, steps[i].coverage do if unicode ~= data then +-- if not changed[unicode] then changed[unicode] = data +-- end end if trace_singles then report_substitution(feature,sequence,descriptions,unicode,data) @@ -273,7 +278,9 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis local replacement = data[alternate] if replacement then if unicode ~= replacement then +-- if not changed[unicode] then changed[unicode] = replacement +-- end end if trace_alternatives then report_alternate(feature,sequence,descriptions,unicode,replacement,value,"normal") @@ -281,7 +288,9 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis elseif defaultalt == "first" then replacement = data[1] if unicode ~= replacement then +-- if not changed[unicode] then changed[unicode] = replacement +-- end end if trace_alternatives then report_alternate(feature,sequence,descriptions,unicode,replacement,value,defaultalt) @@ -289,7 +298,9 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis elseif defaultalt == "last" then replacement = data[#data] if unicode ~= replacement then +-- if not changed[unicode] then changed[unicode] = replacement +-- end end if trace_alternatives then report_alternate(feature,sequence,descriptions,unicode,replacement,value,defaultalt) diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-ots.lua b/Master/texmf-dist/tex/context/base/mkiv/font-ots.lua index 6d7c5fb2568..48f85c3658d 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-ots.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-ots.lua @@ -7,92 +7,90 @@ if not modules then modules = { } end modules ['font-ots'] = { -- sequences license = "see context related readme files", } ---[[ldx-- -<p>I need to check the description at the microsoft site ... it has been improved -so maybe there are some interesting details there. Most below is based on old and -incomplete documentation and involved quite a bit of guesswork (checking with the -abstract uniscribe of those days. But changing things is tricky!</p> - -<p>This module is a bit more split up that I'd like but since we also want to test -with plain <l n='tex'/> it has to be so. This module is part of <l n='context'/> -and discussion about improvements and functionality mostly happens on the -<l n='context'/> mailing list.</p> - -<p>The specification of OpenType is (or at least decades ago was) kind of vague. -Apart from a lack of a proper free specifications there's also the problem that -Microsoft and Adobe may have their own interpretation of how and in what order to -apply features. In general the Microsoft website has more detailed specifications -and is a better reference. There is also some information in the FontForge help -files. In the end we rely most on the Microsoft specification.</p> - -<p>Because there is so much possible, fonts might contain bugs and/or be made to -work with certain rederers. These may evolve over time which may have the side -effect that suddenly fonts behave differently. We don't want to catch all font -issues.</p> - -<p>After a lot of experiments (mostly by Taco, me and Idris) the first implementation -was already quite useful. When it did most of what we wanted, a more optimized version -evolved. Of course all errors are mine and of course the code can be improved. There -are quite some optimizations going on here and processing speed is currently quite -acceptable and has been improved over time. Many complex scripts are not yet supported -yet, but I will look into them as soon as <l n='context'/> users ask for it.</p> - -<p>The specification leaves room for interpretation. In case of doubt the Microsoft -implementation is the reference as it is the most complete one. As they deal with -lots of scripts and fonts, Kai and Ivo did a lot of testing of the generic code and -their suggestions help improve the code. I'm aware that not all border cases can be -taken care of, unless we accept excessive runtime, and even then the interference -with other mechanisms (like hyphenation) are not trivial.</p> - -<p>Especially discretionary handling has been improved much by Kai Eigner who uses complex -(latin) fonts. The current implementation is a compromis between his patches and my code -and in the meantime performance is quite ok. We cannot check all border cases without -compromising speed but so far we're okay. Given good test cases we can probably improve -it here and there. Especially chain lookups are non trivial with discretionaries but -things got much better over time thanks to Kai.</p> - -<p>Glyphs are indexed not by unicode but in their own way. This is because there is no -relationship with unicode at all, apart from the fact that a font might cover certain -ranges of characters. One character can have multiple shapes. However, at the -<l n='tex'/> end we use unicode so and all extra glyphs are mapped into a private -space. This is needed because we need to access them and <l n='tex'/> has to include -then in the output eventually.</p> - -<p>The initial data table is rather close to the open type specification and also not -that different from the one produced by <l n='fontforge'/> but we uses hashes instead. -In <l n='context'/> that table is packed (similar tables are shared) and cached on disk -so that successive runs can use the optimized table (after loading the table is -unpacked).</p> - -<p>This module is sparsely documented because it is has been a moving target. The -table format of the reader changed a bit over time and we experiment a lot with -different methods for supporting features. By now the structures are quite stable</p> - -<p>Incrementing the version number will force a re-cache. We jump the number by one -when there's a fix in the reader or processing code that can result in different -results.</p> - -<p>This code is also used outside context but in context it has to work with other -mechanisms. Both put some constraints on the code here.</p> - ---ldx]]-- - --- Remark: We assume that cursives don't cross discretionaries which is okay because it --- is only used in semitic scripts. +-- I need to check the description at the microsoft site ... it has been improved so +-- maybe there are some interesting details there. Most below is based on old and +-- incomplete documentation and involved quite a bit of guesswork (checking with the +-- abstract uniscribe of those days. But changing things is tricky! +-- +-- This module is a bit more split up that I'd like but since we also want to test +-- with plain TeX it has to be so. This module is part of ConTeXt and discussion +-- about improvements and functionality mostly happens on the ConTeXt mailing list. +-- +-- The specification of OpenType is (or at least decades ago was) kind of vague. +-- Apart from a lack of a proper free specifications there's also the problem that +-- Microsoft and Adobe may have their own interpretation of how and in what order to +-- apply features. In general the Microsoft website has more detailed specifications +-- and is a better reference. There is also some information in the FontForge help +-- files. In the end we rely most on the Microsoft specification. +-- +-- Because there is so much possible, fonts might contain bugs and/or be made to +-- work with certain rederers. These may evolve over time which may have the side +-- effect that suddenly fonts behave differently. We don't want to catch all font +-- issues. +-- +-- After a lot of experiments (mostly by Taco, me and Idris) the first +-- implementation was already quite useful. When it did most of what we wanted, a +-- more optimized version evolved. Of course all errors are mine and of course the +-- code can be improved. There are quite some optimizations going on here and +-- processing speed is currently quite acceptable and has been improved over time. +-- Many complex scripts are not yet supported yet, but I will look into them as soon +-- as ConTeXt users ask for it. +-- +-- The specification leaves room for interpretation. In case of doubt the Microsoft +-- implementation is the reference as it is the most complete one. As they deal with +-- lots of scripts and fonts, Kai and Ivo did a lot of testing of the generic code +-- and their suggestions help improve the code. I'm aware that not all border cases +-- can be taken care of, unless we accept excessive runtime, and even then the +-- interference with other mechanisms (like hyphenation) are not trivial. +-- +-- Especially discretionary handling has been improved much by Kai Eigner who uses +-- complex (latin) fonts. The current implementation is a compromis between his +-- patches and my code and in the meantime performance is quite ok. We cannot check +-- all border cases without compromising speed but so far we're okay. Given good +-- test cases we can probably improve it here and there. Especially chain lookups +-- are non trivial with discretionaries but things got much better over time thanks +-- to Kai. +-- +-- Glyphs are indexed not by unicode but in their own way. This is because there is +-- no relationship with unicode at all, apart from the fact that a font might cover +-- certain ranges of characters. One character can have multiple shapes. However, at +-- the TeX end we use unicode so and all extra glyphs are mapped into a private +-- space. This is needed because we need to access them and TeX has to include then +-- in the output eventually. +-- +-- The initial data table is rather close to the open type specification and also +-- not that different from the one produced by Fontforge but we uses hashes instead. +-- In ConTeXt that table is packed (similar tables are shared) and cached on disk so +-- that successive runs can use the optimized table (after loading the table is +-- unpacked). +-- +-- This module is sparsely documented because it is has been a moving target. The +-- table format of the reader changed a bit over time and we experiment a lot with +-- different methods for supporting features. By now the structures are quite stable +-- +-- Incrementing the version number will force a re-cache. We jump the number by one +-- when there's a fix in the reader or processing code that can result in different +-- results. +-- +-- This code is also used outside ConTeXt but in ConTeXt it has to work with other +-- mechanisms. Both put some constraints on the code here. +-- +-- Remark: We assume that cursives don't cross discretionaries which is okay because +-- it is only used in semitic scripts. -- -- Remark: We assume that marks precede base characters. -- --- Remark: When complex ligatures extend into discs nodes we can get side effects. Normally --- this doesn't happen; ff\d{l}{l}{l} in lm works but ff\d{f}{f}{f}. +-- Remark: When complex ligatures extend into discs nodes we can get side effects. +-- Normally this doesn't happen; ff\d{l}{l}{l} in lm works but ff\d{f}{f}{f}. -- -- Todo: check if we copy attributes to disc nodes if needed. -- --- Todo: it would be nice if we could get rid of components. In other places we can use --- the unicode properties. We can just keep a lua table. +-- Todo: it would be nice if we could get rid of components. In other places we can +-- use the unicode properties. We can just keep a lua table. -- --- Remark: We do some disc juggling where we need to keep in mind that the pre, post and --- replace fields can have prev pointers to a nesting node ... I wonder if that is still --- needed. +-- Remark: We do some disc juggling where we need to keep in mind that the pre, post +-- and replace fields can have prev pointers to a nesting node ... I wonder if that +-- is still needed. -- -- Remark: This is not possible: -- @@ -1038,10 +1036,8 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,skiphash,st end end ---[[ldx-- -<p>We get hits on a mark, but we're not sure if the it has to be applied so -we need to explicitly test for basechar, baselig and basemark entries.</p> ---ldx]]-- +-- We get hits on a mark, but we're not sure if the it has to be applied so we need +-- to explicitly test for basechar, baselig and basemark entries. function handlers.gpos_mark2base(head,start,dataset,sequence,markanchors,rlmode,skiphash) local markchar = getchar(start) @@ -1236,10 +1232,8 @@ function handlers.gpos_cursive(head,start,dataset,sequence,exitanchors,rlmode,sk return head, start, false end ---[[ldx-- -<p>I will implement multiple chain replacements once I run into a font that uses -it. It's not that complex to handle.</p> ---ldx]]-- +-- I will implement multiple chain replacements once I run into a font that uses it. +-- It's not that complex to handle. local chainprocs = { } @@ -1292,29 +1286,22 @@ end chainprocs.reversesub = reversesub ---[[ldx-- -<p>This chain stuff is somewhat tricky since we can have a sequence of actions to be -applied: single, alternate, multiple or ligature where ligature can be an invalid -one in the sense that it will replace multiple by one but not neccessary one that -looks like the combination (i.e. it is the counterpart of multiple then). For -example, the following is valid:</p> - -<typing> -<line>xxxabcdexxx [single a->A][multiple b->BCD][ligature cde->E] xxxABCDExxx</line> -</typing> - -<p>Therefore we we don't really do the replacement here already unless we have the -single lookup case. The efficiency of the replacements can be improved by deleting -as less as needed but that would also make the code even more messy.</p> ---ldx]]-- - ---[[ldx-- -<p>Here we replace start by a single variant.</p> ---ldx]]-- - --- To be done (example needed): what if > 1 steps - --- this is messy: do we need this disc checking also in alternates? +-- This chain stuff is somewhat tricky since we can have a sequence of actions to be +-- applied: single, alternate, multiple or ligature where ligature can be an invalid +-- one in the sense that it will replace multiple by one but not neccessary one that +-- looks like the combination (i.e. it is the counterpart of multiple then). For +-- example, the following is valid: +-- +-- xxxabcdexxx [single a->A][multiple b->BCD][ligature cde->E] xxxABCDExxx +-- +-- Therefore we we don't really do the replacement here already unless we have the +-- single lookup case. The efficiency of the replacements can be improved by +-- deleting as less as needed but that would also make the code even more messy. +-- +-- Here we replace start by a single variant. +-- +-- To be done : what if > 1 steps (example needed) +-- This is messy: do we need this disc checking also in alternates? local function reportzerosteps(dataset,sequence) logwarning("%s: no steps",cref(dataset,sequence)) @@ -1390,9 +1377,7 @@ function chainprocs.gsub_single(head,start,stop,dataset,sequence,currentlookup,r return head, start, false end ---[[ldx-- -<p>Here we replace start by new glyph. First we delete the rest of the match.</p> ---ldx]]-- +-- Here we replace start by new glyph. First we delete the rest of the match. -- char_1 mark_1 -> char_x mark_1 (ignore marks) -- char_1 mark_1 -> char_x @@ -1444,9 +1429,7 @@ function chainprocs.gsub_alternate(head,start,stop,dataset,sequence,currentlooku return head, start, false end ---[[ldx-- -<p>Here we replace start by a sequence of new glyphs.</p> ---ldx]]-- +-- Here we replace start by a sequence of new glyphs. function chainprocs.gsub_multiple(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex) local mapping = currentlookup.mapping @@ -1470,11 +1453,9 @@ function chainprocs.gsub_multiple(head,start,stop,dataset,sequence,currentlookup return head, start, false end ---[[ldx-- -<p>When we replace ligatures we use a helper that handles the marks. I might change -this function (move code inline and handle the marks by a separate function). We -assume rather stupid ligatures (no complex disc nodes).</p> ---ldx]]-- +-- When we replace ligatures we use a helper that handles the marks. I might change +-- this function (move code inline and handle the marks by a separate function). We +-- assume rather stupid ligatures (no complex disc nodes). -- compare to handlers.gsub_ligature which is more complex ... why @@ -2532,7 +2513,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s -- fonts can have many steps (each doing one check) or many contexts -- todo: make a per-char cache so that we have small contexts (when we have a context - -- n == 1 and otherwise it can be more so we can even distingish n == 1 or more) + -- n == 1 and otherwise it can be more so we can even distinguish n == 1 or more) local nofcontexts = contexts.n -- #contexts diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-sol.lua b/Master/texmf-dist/tex/context/base/mkiv/font-sol.lua index b3b514a16b7..b194a6ca936 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-sol.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-sol.lua @@ -111,7 +111,7 @@ local whatsit_code = nodecodes.whatsit local fontkern_code = kerncodes.fontkern -local righttoleft_code = nodes.dirvalues.righttoleft +local righttoleft_code = (tex.directioncodes and tex.directioncodes.righttoleft) or nodes.dirvalues.righttoleft -- LMTX local userdefinedwhatsit_code = whatsitcodes.userdefined diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua b/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua index e80d57f4146..9fba3d8d4a0 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua @@ -56,10 +56,8 @@ local trace_rejections = false trackers.register("fonts.rejections", fu local report_names = logs.reporter("fonts","names") ---[[ldx-- -<p>This module implements a name to filename resolver. Names are resolved -using a table that has keys filtered from the font related files.</p> ---ldx]]-- +-- This module implements a name to filename resolver. Names are resolved using a +-- table that has keys filtered from the font related files. fonts = fonts or { } -- also used elsewhere @@ -88,10 +86,6 @@ local autoreload = true directives.register("fonts.autoreload", function(v) autoreload = toboolean(v) end) directives.register("fonts.usesystemfonts", function(v) usesystemfonts = toboolean(v) end) ---[[ldx-- -<p>A few helpers.</p> ---ldx]]-- - -- -- what to do with these -- -- -- -- thin -> thin @@ -305,10 +299,8 @@ local function analyzespec(somename) end end ---[[ldx-- -<p>It would make sense to implement the filters in the related modules, -but to keep the overview, we define them here.</p> ---ldx]]-- +-- It would make sense to implement the filters in the related modules, but to keep +-- the overview, we define them here. filters.afm = fonts.handlers.afm.readers.getinfo filters.otf = fonts.handlers.otf.readers.getinfo @@ -412,11 +404,9 @@ filters.ttc = filters.otf -- end -- end ---[[ldx-- -<p>The scanner loops over the filters using the information stored in -the file databases. Watch how we check not only for the names, but also -for combination with the weight of a font.</p> ---ldx]]-- +-- The scanner loops over the filters using the information stored in the file +-- databases. Watch how we check not only for the names, but also for combination +-- with the weight of a font. filters.list = { "otf", "ttf", "ttc", "afm", -- no longer dfont support (for now) @@ -1402,11 +1392,8 @@ local function is_reloaded() end end ---[[ldx-- -<p>The resolver also checks if the cached names are loaded. Being clever -here is for testing purposes only (it deals with names prefixed by an -encoding name).</p> ---ldx]]-- +-- The resolver also checks if the cached names are loaded. Being clever here is for +-- testing purposes only (it deals with names prefixed by an encoding name). local function fuzzy(mapping,sorted,name,sub) -- no need for reverse sorted here local condensed = gsub(name,"[^%a%d]","") diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-tfm.lua b/Master/texmf-dist/tex/context/base/mkiv/font-tfm.lua index 945421a4219..81f94532b3b 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-tfm.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-tfm.lua @@ -50,21 +50,18 @@ constructors.resolvevirtualtoo = false -- wil be set in font-ctx.lua fonts.formats.tfm = "type1" -- we need to have at least a value here fonts.formats.ofm = "type1" -- we need to have at least a value here ---[[ldx-- -<p>The next function encapsulates the standard <l n='tfm'/> loader as -supplied by <l n='luatex'/>.</p> ---ldx]]-- - --- this might change: not scaling and then apply features and do scaling in the --- usual way with dummy descriptions but on the other hand .. we no longer use --- tfm so why bother - --- ofm directive blocks local path search unless set; btw, in context we --- don't support ofm files anyway as this format is obsolete - --- we need to deal with nested virtual fonts, but because we load in the --- frontend we also need to make sure we don't nest too deep (esp when sizes --- get large) +-- The next function encapsulates the standard TFM loader as supplied by LuaTeX. +-- +-- This might change: not scaling and then apply features and do scaling in the +-- usual way with dummy descriptions but on the other hand. However, we no longer +-- use TFM (except for the JMN math fonts) so why bother. +-- +-- The ofm directive blocks a local path search unless set. Actually, in ConTeXt we +-- never had to deal with OFM files anyway as this format is obsolete (there are +-- hardly any fonts in that format that are of use). +-- +-- We need to deal with nested virtual fonts, but because we load in the frontend we +-- also need to make sure we don't nest too deep (esp when sizes get large) -- -- (VTITLE Example of a recursion) -- (MAPFONT D 0 (FONTNAME recurse)(FONTAT D 2)) @@ -72,7 +69,7 @@ supplied by <l n='luatex'/>.</p> -- (CHARACTER C B (CHARWD D 2)(CHARHT D 2)(MAP (SETCHAR C A))) -- (CHARACTER C C (CHARWD D 4)(CHARHT D 4)(MAP (SETCHAR C B))) -- --- we added the same checks as below to the luatex engine +-- We added the same checks as below to the LuaTeX engine. function tfm.setfeatures(tfmdata,features) local okay = constructors.initializefeatures("tfm",tfmdata,features,trace_features,report_tfm) diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-trt.lua b/Master/texmf-dist/tex/context/base/mkiv/font-trt.lua index abc92ba5265..8935340787c 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-trt.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-trt.lua @@ -12,11 +12,9 @@ local cleanfilename = fonts.names.cleanfilename local splitbase = file.splitbase local lower = string.lower ---[[ldx-- -<p>We provide a simple treatment mechanism (mostly because I want to demonstrate -something in a manual). It's one of the few places where an lfg file gets loaded -outside the goodies manager.</p> ---ldx]]-- +-- We provide a simple treatment mechanism (mostly because I want to demonstrate +-- something in a manual). It's one of the few places where an lfg file gets loaded +-- outside the goodies manager. local treatments = fonts.treatments or { } fonts.treatments = treatments diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-vir.lua b/Master/texmf-dist/tex/context/base/mkiv/font-vir.lua index c3071cac0b6..6142ddafd09 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-vir.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-vir.lua @@ -6,9 +6,8 @@ if not modules then modules = { } end modules ['font-vir'] = { license = "see context related readme files" } ---[[ldx-- -<p>This is very experimental code! Not yet adapted to recent changes. This will change.</p> ---ldx]]-- +-- This is very experimental code! Not yet adapted to recent changes. This will +-- change. Actually we moved on. -- present in the backend but unspecified: -- @@ -25,10 +24,8 @@ local constructors = fonts.constructors local vf = constructors.handlers.vf vf.version = 1.000 -- same as tfm ---[[ldx-- -<p>We overload the <l n='vf'/> reader.</p> ---ldx]]-- - +-- -- We overload the VF reader.: +-- -- general code / already frozen -- -- function vf.find(name) diff --git a/Master/texmf-dist/tex/context/base/mkiv/good-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/good-ini.lua index df79adb61c3..33e79a5d48f 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/good-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/good-ini.lua @@ -9,12 +9,14 @@ if not modules then modules = { } end modules ['good-ini'] = { -- depends on ctx local type, next = type, next -local gmatch = string.gmatch -local sortedhash, insert = table.sortedhash, table.insert +local gmatch, find, topattern = string.gmatch, string.find, string.topattern +local sortedhash, insert, contains = table.sortedhash, table.insert, table.contains local fonts = fonts -local trace_goodies = false trackers.register("fonts.goodies", function(v) trace_goodies = v end) +local trace_goodies = false trackers.register("fonts.goodies", function(v) trace_goodies = v end) +local trace_extensions = false trackers.register("fonts.goodies.extensions", function(v) trace_extensions = v end) + local report_goodies = logs.reporter("fonts","goodies") local allocate = utilities.storage.allocate @@ -324,15 +326,43 @@ end local function setextensions(tfmdata) local goodies = tfmdata.goodies if goodies then + local shared = tfmdata.shared + local metadata = shared and shared.rawdata and shared.rawdata.metadata for i=1,#goodies do local g = goodies[i] local e = g.extensions if e then - local goodie = g.name or "unknown" + local goodie = g.name or "unknown" + local fontname = metadata and metadata.fontname + if trace_extensions then + report_goodies("checking extensions for font %a",fontname or "unknown") + end for i=1,#e do - local name = "extension-" .. i - -- report_goodies("adding extension %s from %s",name,goodie) - otf.enhancers.addfeature(tfmdata.shared.rawdata,name,e[i]) + local entry = e[i] + local fnames = entry.fonts + local tnames = type(fnames) + local valid = false + if not fontname then + valid = true + elseif tnames == "table" then + if fnames[fontname] then + valid = true + elseif #fnames > 0 and contains(fnames,fontname) then + valid = true + end + elseif tnames == "string" then + fnames = topattern(fnames) + valid = find(fontname,fnames) and true + else + valid = true + end + if valid then + local name = "extension-" .. i + if trace_extensions then + report_goodies("adding extension %a from %a for font %a",name,goodie,fontname or "unknown") + end + otf.enhancers.addfeature(tfmdata.shared.rawdata,name,entry) + end end end end diff --git a/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua b/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua index 3e24e4e2a12..3164068505d 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua @@ -21,7 +21,8 @@ local dir = dir local lfs = lfs local attributes = lfs.attributes -local walkdir = lfs.dir +----- walkdir = lfs.dir +local scandir = lfs.dir local isdir = lfs.isdir -- not robust, will be overloaded anyway local isfile = lfs.isfile -- not robust, will be overloaded anyway local currentdir = lfs.currentdir @@ -69,6 +70,20 @@ else end +-- safeguard + +local isreadable = file.isreadable + +local walkdir = function(p,...) + if isreadable(p.."/.") then + return scandir(p,...) + else + return function() end + end +end + +lfs.walkdir = walkdir + -- handy function dir.current() diff --git a/Master/texmf-dist/tex/context/base/mkiv/lang-def.mkiv b/Master/texmf-dist/tex/context/base/mkiv/lang-def.mkiv index 19f431ebf56..7ec4b722eb2 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lang-def.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/lang-def.mkiv @@ -273,7 +273,7 @@ [\s!hy] [\c!spacing=\v!packed, \c!leftsentence=\endash, % *sentences not confirmed - \c!rightsentence=\endash, + \c!rightsentence=\endash, \c!leftsubsentence=\endash, \c!rightsubsentence=\endash, \c!leftquote=\guilsingleleft, @@ -781,7 +781,8 @@ \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!year,\space,\v!month,\space,\v!day}] + \c!date={\v!day,\space,\v!month,\space,\v!year}] + \installlanguage[\s!pt-br][\c!default=\s!pt] % Brazil \installlanguage[\s!es-es][\c!default=\s!es] % Spain diff --git a/Master/texmf-dist/tex/context/base/mkiv/lang-txt.lua b/Master/texmf-dist/tex/context/base/mkiv/lang-txt.lua index cb8053fb69c..c41936dacb8 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lang-txt.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/lang-txt.lua @@ -49,14 +49,14 @@ if not modules then modules = { } end modules ['lang-txt'] = { -- nn Norwegian Hans Fredrik Nordhaug, ... -- nl Dutch Hans Hagen -- pl Polish Grzegorz Sapijaszko (2011) --- pt Portuguese Pedro F. M. Mendonça +-- pt Portuguese Pedro F. M. Mendonça; additions Joana Sophia Bogas Carneiro (2023) -- ro Romanian Dan Seracu, ... -- ru Russian Olga Briginets, Alexander Bokovoy, Victor Figurnov, ... -- sk Slovak Tomáš Hála (2012, 2022) -- sl Slovenian Mojca Miklavec -- sr Serbian Ivan Pešić (2020) -- sr-latn Serbian Ivan Pešić (2020) --- sv Swedish ... +-- sv Swedish ...; additions Edith and Mikael Sundqvist (2023) -- tk Turkish Tobias Burnus -- tr Turkmen Nazar Annagurban -- ua Ukrainian Olga Briginets, Alexander Bokovoy, Victor Figurnov, ... @@ -69,6 +69,11 @@ if not modules then modules = { } end modules ['lang-txt'] = { -- thinspace == sixperemspace = 0x2006 -- print("!"..utf.char(0x2006).."!") +-- Will be done when needed: +-- (TH) editor|editors:mnem missing +-- (HH) save memory at functions +-- (MS) btx settings for sv + languages = languages or { } local languages = languages @@ -84,7 +89,7 @@ data.labels={ ["be"]="У", ["bg"]="в", ["ca"]="En", - ["cs"]={ "In", "V" }, + ["cs"]="In", ["de"]="In", ["en"]="In", ["eo"]="En", @@ -93,7 +98,7 @@ data.labels={ ["fr"]="Dans", ["hy"]="Մեջ", ["mk"]="во", - ["sk"]={ "In", "V" }, + ["sk"]="In", ["sr"]="У", ["sr-latn"]="U", }, @@ -113,6 +118,7 @@ data.labels={ ["hy"]="Համար", ["mk"]="Број", ["nl"]="Nummer", + ["pt"]="Numero", ["sk"]="Číslo", ["sr"]="Број", ["sr-latn"]="Broj", @@ -134,6 +140,7 @@ data.labels={ ["hy"]="Ծավալ", ["mk"]="Том", ["nl"]="Deel", + ["pt"]="Volume", ["sk"]="Zväzok", ["sr"]="Том", ["sr-latn"]="Tom", @@ -156,6 +163,7 @@ data.labels={ ["it"]="e", ["mk"]="и", ["nl"]="en", + ["pt"]="e", ["sk"]="a", ["sr"]="и", ["sr-latn"]="i", @@ -166,7 +174,7 @@ data.labels={ ["be"]="Выданне", ["bg"]="издание", ["ca"]="Edició", - ["cs"]="Vydání", + ["cs"]="vydání", ["de"]="Auflage", ["en"]="edition", ["eo"]="eldono", @@ -179,17 +187,18 @@ data.labels={ ["it"]="edizione", ["mk"]="издание", ["nl"]="editie", - ["sk"]="Vydanie", + ["pt"]="edicao", + ["sk"]="vydanie", ["sr"]="издање", ["sr-latn"]="izdanje", }, }, ["editor"]={ ["labels"]={ - ["be"]="Рэдактар", + ["be"]="реэдактар", ["bg"]="редактор", - ["ca"]="Editor", - ["cs"]={ "Editor", "Editorka" }, + ["ca"]="editor", + ["cs"]="editor", ["de"]="Herausgeber", ["en"]="editor", ["eo"]="eldonisto", @@ -200,17 +209,24 @@ data.labels={ ["hy"]="խմբագիր", ["it"]="a cura di", ["mk"]="уредник", - ["sk"]={ "Editor", "Editorka" }, + ["pt"]="editor", + ["sk"]="editor", ["sr"]="уредник", ["sr-latn"]="urednik", }, }, + ["editor:f"]={ + ["labels"]={ + ["cs"]="editorka", + ["sk"]="editorka", + }, + }, ["editors"]={ ["labels"]={ - ["be"]="Рэдактары", + ["be"]="рэдактары", ["bg"]="редактори", - ["ca"]="Editors", - ["cs"]="Editoři", + ["ca"]="editors", + ["cs"]="editoři", ["de"]="Herausgeber", ["en"]="editors", ["eo"]="eldonistoj", @@ -220,21 +236,16 @@ data.labels={ ["hy"]="խմբագիրներ", ["it"]="a cura di", ["mk"]="уредници", - ["sk"]="Editori", + ["pt"]="editores", + ["sk"]="editori", ["sr"]="уредници", ["sr-latn"]="urednici", }, }, ["editors:f"]={ ["labels"]={ - ["cs"]="Editorky", - ["sk"]="Editorky", - }, - }, - ["editors:m"]={ - ["labels"]={ - ["cs"]="Editoři", - ["sk"]="Editori", + ["cs"]="editorky", + ["sk"]="editorky", }, }, ["in"]={ @@ -251,6 +262,7 @@ data.labels={ ["fr"]="dans", ["hy"]="մեջ", ["mk"]="во", + ["pt"]="em", ["sk"]="v", ["sr"]="у", ["sr-latn"]="u", @@ -274,6 +286,7 @@ data.labels={ ["it"]="Tesi di laurea", ["mk"]="Магистерска дисертација", ["nl"]="Masterproef", + ["pt"]="Tese de mestrado", ["sk"]="Diplomová práca", ["sr"]="Мастер дисертација", ["sr-latn"]="Master disertacija", @@ -295,6 +308,7 @@ data.labels={ ["hy"]="համար", ["mk"]="број", ["nl"]="nummer", + ["pt"]="numero", ["sk"]="číslo", ["sr"]="број", ["sr-latn"]="broj", @@ -314,6 +328,7 @@ data.labels={ ["hy"]="-ից", ["mk"]="од", ["nl"]="van", + ["pt"]="de", ["sk"]="z", ["sr"]="од", ["sr-latn"]="od", @@ -322,7 +337,7 @@ data.labels={ ["others"]={ ["labels"]={ ["ca"]="et al.", - ["cs"]={ "a~kol.", "et al."}, + ["cs"]="a~kol.", ["de"]="et al.", ["en"]="et al.", ["eo"]="aliaj", @@ -331,7 +346,8 @@ data.labels={ ["fr"]="et al.", ["hy"]="եւ այլն", ["mk"]="и др.", - ["sk"]={ "a~kol.", "et al."}, + ["pt"]="etc", + ["sk"]="a~kol.", ["sr"]="и др.", ["sr-latn"]="i dr.", }, @@ -350,6 +366,7 @@ data.labels={ ["fr"]="p.", ["hy"]="էջ", ["mk"]="стр.", + ["pt"]="p", ["sk"]="s.", ["sr"]="стр.", ["sr-latn"]="str.", @@ -372,6 +389,7 @@ data.labels={ ["hy"]="էջեր", ["mk"]="страници", ["nl"]="paginas", + ["pt"]="paginas", ["sk"]="strany", ["sr"]="страницa", ["sr-latn"]="stranica", @@ -394,6 +412,7 @@ data.labels={ ["it"]="Brevetto", ["mk"]="Патент", ["nl"]="Octrooi", + ["pt"]="Patente", ["sk"]="Patent", ["sr"]="Патент", ["sr-latn"]="Patent", @@ -416,6 +435,7 @@ data.labels={ ["it"]="Tesi di dottorato", ["mk"]="Докторска дисертација", ["nl"]="Proefschrift", + ["pt"]="Tese de douturamento", ["sk"]="Dizertačná práca", ["sr"]="Докторска дисертација", ["sr-latn"]="Doktorska disertacija", @@ -433,6 +453,7 @@ data.labels={ ["fa"]="صص", ["hy"]="էջ", ["mk"]="стр.", + ["pt"]="pp", ["sk"]="s.", ["sr"]="стр.", ["sr-latn"]="str.", @@ -456,6 +477,7 @@ data.labels={ ["it"]="Relazione tecnica", ["mk"]="Технички извештај", ["nl"]="Technisch rapport", + ["pt"]="Reporte tecnico", ["sk"]="Technická zpráva", ["sr"]="Технички извештај", ["sr-latn"]="Tehnički izveštaj", @@ -477,6 +499,7 @@ data.labels={ ["hy"]="ծավալ", ["mk"]="том", ["nl"]="deel", + ["pt"]="volume", ["sk"]="zväzok", ["sr"]="том", ["sr-latn"]="tom", @@ -499,6 +522,7 @@ data.labels={ ["it"]="con", ["mk"]="со", ["nl"]="met", + ["pt"]="com", ["sk"]="s", ["sr"]="са", ["sr-latn"]="sa", @@ -515,9 +539,11 @@ data.labels={ ["es"]="Pr", ["hy"]="P", ["mk"]="P", + ["pt"]="Pr", ["sk"]="P", ["sr"]="P", ["sr-latn"]="P", + ["sv"]="Pr", }, }, ["arccos"]={ @@ -531,9 +557,11 @@ data.labels={ ["hy"]="arccos", ["mk"]="arccos", ["pl"]="arc\\sixperemspace cos", + ["pt"]="arccos", ["sk"]="arccos", ["sr"]="arccos", ["sr-latn"]="arccos", + ["sv"]="arccos", }, }, ["arccosh"]={ @@ -547,9 +575,11 @@ data.labels={ ["hy"]="arccosh", ["mk"]="arccosh", ["pl"]="arc\\sixperemspace cosh", + ["pt"]="arccosh", ["sk"]="arccosh", ["sr"]="arccosh", ["sr-latn"]="arccosh", + ["sv"]="arcosh", }, }, ["arccot"]={ @@ -563,9 +593,11 @@ data.labels={ ["hy"]="arcctg", ["mk"]="arccotg", ["pl"]="arc\\sixperemspace ctg", + ["pt"]="arccot", ["sk"]="arccotg", ["sr"]="arcctg", ["sr-latn"]="arcctg", + ["sv"]="arccot", }, }, ["arcsin"]={ @@ -579,9 +611,11 @@ data.labels={ ["hy"]="arcsin", ["mk"]="arcsin", ["pl"]="arc\\sixperemspace sin", + ["pt"]="arcsin", ["sk"]="arcsin", ["sr"]="arcsin", ["sr-latn"]="arcsin", + ["sv"]="arcsin", }, }, ["arcsinh"]={ @@ -595,9 +629,11 @@ data.labels={ ["hy"]="arcsinh", ["mk"]="arcsinh", ["pl"]="arc\\sixperemspace sinh", + ["pt"]="arcsinh", ["sk"]="arcsinh", ["sr"]="arcsinh", ["sr-latn"]="arcsinh", + ["sv"]="arsinh", }, }, ["arctan"]={ @@ -611,9 +647,11 @@ data.labels={ ["hy"]="arctan", ["mk"]="arctg", ["pl"]="arc\\sixperemspace tg", + ["pt"]="arctan", ["sk"]="arctg", ["sr"]="arctg", ["sr-latn"]="arctg", + ["sv"]="arctan", }, }, ["arctanh"]={ @@ -627,9 +665,11 @@ data.labels={ ["hy"]="arctanh", ["mk"]="arctgh", ["pl"]="arc\\sixperemspace tgh", + ["pt"]="arctanh", ["sk"]="arctgh", ["sr"]="arctgh", ["sr-latn"]="arctgh", + ["sv"]="artanh", }, }, ["arg"]={ @@ -641,9 +681,11 @@ data.labels={ ["es"]="arg", ["hy"]="arg", ["mk"]="arg", + ["pt"]="arg", ["sk"]="arg", ["sr"]="arg", ["sr-latn"]="arg", + ["sv"]="arg", }, }, ["cos"]={ @@ -655,9 +697,11 @@ data.labels={ ["es"]="cos", ["hy"]="cos", ["mk"]="cos", + ["pt"]="cos", ["sk"]="cos", ["sr"]="cos", ["sr-latn"]="cos", + ["sv"]="cos", }, }, ["cosh"]={ @@ -669,9 +713,11 @@ data.labels={ ["es"]="cosh", ["hy"]="cosh", ["mk"]="cosh", + ["pt"]="cosh", ["sk"]="cosh", ["sr"]="cosh", ["sr-latn"]="cosh", + ["sv"]="cosh", }, }, ["cot"]={ @@ -685,9 +731,11 @@ data.labels={ ["hy"]="cot", ["mk"]="ctg", ["pl"]="ctg", + ["pt"]="cot", ["sk"]="cotg", ["sr"]="ctg", ["sr-latn"]="ctg", + ["sv"]="cot", }, }, ["coth"]={ @@ -699,9 +747,11 @@ data.labels={ ["es"]="coth", ["hy"]="coth", ["mk"]="ctgh", + ["pt"]="coth", ["sk"]="cotgh", ["sr"]="ctgh", ["sr-latn"]="ctgh", + ["sv"]="coth", }, }, ["csc"]={ @@ -713,28 +763,13 @@ data.labels={ ["es"]="csc", ["hy"]="csc", ["mk"]="cosec", + ["pt"]="csc", ["sk"]="cosec", ["sr"]="cosec", ["sr-latn"]="cosec", + ["sv"]="csc", }, }, ---[[ ["ctg"]={ - ["labels"]={ - ["ca"]="cot", - ["cs"]="cotg", - ["en"]="cot", - ["eo"]="cotan", - ["es"]="cot", - ["hr"]="ctg", - ["hy"]="cot", - ["mk"]="ctg", - ["pl"]="ctg", - ["sk"]="cotg", - ["sr"]="ctg", - ["sr-latn"]="ctg", - }, - }, ---]] ["deg"]={ ["labels"]={ ["ca"]="gr", @@ -744,9 +779,11 @@ data.labels={ ["es"]="gr", ["hy"]="deg", ["mk"]="deg", + ["pt"]="deg", ["sk"]="deg", ["sr"]="deg", ["sr-latn"]="deg", + ["sv"]="deg", }, }, ["det"]={ @@ -757,9 +794,11 @@ data.labels={ ["eo"]="det", ["es"]="det", ["hy"]="det", + ["pt"]="det", ["sk"]="det", ["sr"]="det", ["sr-latn"]="det", + ["sv"]="det", }, }, ["diff"]={ @@ -769,7 +808,9 @@ data.labels={ ["en"]="d", ["eo"]="dif", ["hy"]="d", + ["pt"]="d", ["sk"]="d", + ["sv"]="d", }, }, ["dim"]={ @@ -781,9 +822,11 @@ data.labels={ ["es"]="dim", ["hy"]="dim", ["mk"]="dim", + ["pt"]="dim", ["sk"]="dim", ["sr"]="dim", ["sr-latn"]="dim", + ["sv"]="dim", }, }, ["exp"]={ @@ -794,9 +837,11 @@ data.labels={ ["eo"]="eksp", ["es"]="exp", ["hy"]="exp", + ["pt"]="exp", ["sk"]="exp", ["sr"]="exp", ["sr-latn"]="exp", + ["sv"]="exp", }, }, ["gcd"]={ @@ -811,9 +856,11 @@ data.labels={ ["hy"]="ԱԸԲ", ["mk"]="НЗД", ["nl"]="ggd", + ["pt"]="gcd", ["sk"]="NSD", ["sr"]="НЗД", ["sr-latn"]="NZD", + ["sv"]="sgd", }, }, ["hom"]={ @@ -824,7 +871,9 @@ data.labels={ ["eo"]="hom", ["es"]="hom", ["hy"]="հոմ", + ["pt"]="hom", ["sk"]="Hom", + ["sv"]="hom", }, }, ["inf"]={ @@ -836,9 +885,11 @@ data.labels={ ["es"]="inf", ["hy"]="inf", ["mk"]="inf", + ["pt"]="inf", ["sk"]="inf", ["sr"]="inf", ["sr-latn"]="inf", + ["sv"]="inf", }, }, ["injlim"]={ @@ -849,9 +900,11 @@ data.labels={ ["eo"]="", ["es"]="lím\\sixperemspace iny", ["hy"]="inj\\sixperemspace lim", + ["pt"]="inj\\sixperemspace lim", ["sk"]="inj\\sixperemspace lim", ["sr"]="inj\\sixperemspace lim", ["sr-latn"]="inj\\sixperemspace lim", + ["sv"]="inj\\sixperemspace lim", }, }, ["inv"]={ @@ -863,9 +916,11 @@ data.labels={ ["es"]="inv", ["hy"]="inv", ["mk"]="inv", + ["pt"]="inv", ["sk"]="inv", ["sr"]="inv", ["sr-latn"]="inv", + ["sv"]="inv", }, }, ["ker"]={ @@ -876,9 +931,11 @@ data.labels={ ["eo"]="", ["es"]="Ker", ["hy"]="ker", + ["pt"]="ker", ["sk"]="ker", ["sr"]="ker", ["sr-latn"]="ker", + ["sv"]="ker", }, }, ["lcm"]={ @@ -893,9 +950,11 @@ data.labels={ ["hy"]="աըբ", ["mk"]="НЗС", ["nl"]="kgv", + ["pt"]="lcm", ["sk"]="NSN", ["sr"]="НЗС", ["sr-latn"]="NZS", + ["sv"]="lcm", }, }, ["lg"]={ @@ -909,9 +968,11 @@ data.labels={ ["fr"]="log", ["hy"]="lg", ["mk"]="lg", + ["pt"]="lg", ["sk"]="log", ["sr"]="lg", ["sr-latn"]="lg", + ["sv"]="lg", }, }, ["lim"]={ @@ -923,9 +984,11 @@ data.labels={ ["es"]="lím", ["hy"]="lim", ["mk"]="lim", + ["pt"]="lim", ["sk"]="lim", ["sr"]="lim", ["sr-latn"]="lim", + ["sv"]="lim", }, }, ["liminf"]={ @@ -937,9 +1000,11 @@ data.labels={ ["es"]="lím\\sixperemspace inf", ["hy"]="lim\\sixperemspace infs", ["mk"]="lim\\sixperemspace inf", + ["pt"]="lim\\sixperemspace inf", ["sk"]="lim\\sixperemspace inf", ["sr"]="lim\\sixperemspace inf", ["sr-latn"]="lim\\sixperemspace inf", + ["sv"]="lim\\sixperemspace inf", }, }, ["limsup"]={ @@ -951,9 +1016,11 @@ data.labels={ ["es"]="lím\\sixperemspace sup", ["hy"]="lim\\sixperemspace sup", ["mk"]="lim\\sixperemspace sup", + ["pt"]="lim\\sixperemspace sup", ["sk"]="lim\\sixperemspace sup", ["sr"]="lim\\sixperemspace sup", ["sr-latn"]="lim\\sixperemspace sup", + ["sv"]="lim\\sixperemspace sup", }, }, ["ln"]={ @@ -965,9 +1032,11 @@ data.labels={ ["es"]="ln", ["hy"]="ln", ["mk"]="ln", + ["pt"]="ln", ["sk"]="ln", ["sr"]="ln", ["sr-latn"]="ln", + ["sv"]="ln", }, }, ["log"]={ @@ -979,9 +1048,11 @@ data.labels={ ["es"]="log", ["hy"]="log", ["mk"]="log", + ["pt"]="log", ["sk"]="log", ["sr"]="log", ["sr-latn"]="log", + ["sv"]="log", }, }, ["max"]={ @@ -994,15 +1065,17 @@ data.labels={ ["fi"]="max", ["hy"]="max", ["mk"]="max", + ["pt"]="max", ["sk"]="max", ["sr"]="max", ["sr-latn"]="max", + ["sv"]="max", }, }, ["median"]={ ["labels"]={ + ["comment"]=[[ cs+sk: \tilde won't work]], ["ca"]="mitjana", - -- ["cs"]="\\tilde", -- won't work ["cs"]="Me", ["en"]="median", ["eo"]="mediano", @@ -1010,10 +1083,11 @@ data.labels={ ["fi"]="mediaani", ["fr"]="médiane", ["hy"]="միջին", - -- ["sk"]="\\tilde", -- won't work + ["pt"]="median", ["sk"]="Med", ["sr"]="median", ["sr-latn"]="median", + ["sv"]="median", }, }, ["min"]={ @@ -1026,9 +1100,11 @@ data.labels={ ["fi"]="min", ["hy"]="min", ["mk"]="min", + ["pt"]="min", ["sk"]="min", ["sr"]="min", ["sr-latn"]="min", + ["sv"]="min", }, }, ["mod"]={ @@ -1041,9 +1117,11 @@ data.labels={ ["fi"]="mod", ["hy"]="mod", ["mk"]="mod", + ["pt"]="mod", ["sk"]="mod", ["sr"]="mod", ["sr-latn"]="mod", + ["sv"]="mod", }, }, ["projlim"]={ @@ -1054,9 +1132,11 @@ data.labels={ ["eo"]="", ["es"]="lím\\sixperemspace proy", ["hy"]="proj\\sixperemspace lim", + ["pt"]="proj\\sixperemspace lim", ["sk"]="proj\\sixperemspace lim", ["sr"]="proj\\sixperemspace lim", ["sr-latn"]="proj\\sixperemspace lim", + ["sv"]="proj\\sixperemspace lim", }, }, ["sec"]={ @@ -1069,9 +1149,11 @@ data.labels={ ["fi"]="sek", ["hy"]="sec", ["mk"]="sec", + ["pt"]="sec", ["sk"]="sec", ["sr"]="sec", ["sr-latn"]="sec", + ["sv"]="sec", }, }, ["sin"]={ @@ -1084,9 +1166,11 @@ data.labels={ ["fi"]="sin", ["hy"]="sin", ["mk"]="sin", + ["pt"]="sen", ["sk"]="sin", ["sr"]="sin", ["sr-latn"]="sin", + ["sv"]="sin", }, }, ["sinh"]={ @@ -1098,9 +1182,11 @@ data.labels={ ["es"]="senh", ["hy"]="sinh", ["mk"]="sinh", + ["pt"]="sinh", ["sk"]="sinh", ["sr"]="sinh", ["sr-latn"]="sinh", + ["sv"]="sinh", }, }, ["sup"]={ @@ -1111,9 +1197,11 @@ data.labels={ ["es"]="sup", ["hy"]="sup", ["mk"]="sup", + ["pt"]="sup", ["sk"]="sup", ["sr"]="sup", ["sr-latn"]="sup", + ["sv"]="sup", }, }, ["tan"]={ @@ -1126,9 +1214,11 @@ data.labels={ ["hy"]="tan", ["mk"]="tg", ["pl"]="tg", + ["pt"]="tan", ["sk"]="tg", ["sr"]="tg", ["sr-latn"]="tg", + ["sv"]="tan", }, }, ["tanh"]={ @@ -1139,9 +1229,11 @@ data.labels={ ["es"]="tanh", ["hy"]="tanh", ["mk"]="tgh", + ["pt"]="tanh", ["sk"]="tgh", ["sr"]="tgh", ["sr-latn"]="tgh", + ["sv"]="tanh", }, }, }, @@ -1172,13 +1264,13 @@ data.labels={ ["nl"]=" en ", ["nn"]="", ["pl"]=" i ", - ["pt"]="", + ["pt"]=" e ", ["ro"]="", ["ru"]="", ["sk"]=" a ", ["sl"]="", ["sr"]=" и ", - ["sv"]="", + ["sv"]=" och ", ["tk"]="", ["tr"]="", ["ua"]="", @@ -1190,18 +1282,18 @@ data.labels={ ["labels"]={ ["af"]="Bylae ", ["ar"]="ملحق ", - ["be"]="Апендыцыт", + ["be"]="Апендыцыт ", ["ca"]="Apèndix ", - ["cn"]="附录", + ["cn"]="附录 ", ["cs"]="Příloha ", ["da"]="Bilag ", ["de"]="Anhang ", ["en"]="Appendix ", - ["eo"]="Anekso", + ["eo"]="Anekso ", ["es"]="Apéndice ", ["et"]="Lisa ", ["fa"]="پیوست ", - ["fi"]="liite", + ["fi"]="Liite ", ["fr"]="Annexe ", ["gr"]="Παράρτημα ", ["hr"]="Dodatak ", @@ -1217,14 +1309,14 @@ data.labels={ ["nl"]="", ["nn"]="Tillegg ", ["pl"]="Dodatek ", - ["pt"]="", + ["pt"]="Apendice ", ["ro"]="", ["ru"]="", ["sk"]="Príloha ", ["sl"]="Dodatek ", ["sr"]="Додатак ", ["sr-latn"]="Dodatak ", - ["sv"]="", + ["sv"]="Bilaga ", ["tk"]="Goşmaça ", ["tr"]="", ["ua"]="", @@ -1331,16 +1423,16 @@ data.labels={ ["labels"]={ ["af"]="", ["ar"]="في صفحة ", - ["ca"]="a la pagina", + ["ca"]="a la pagina ", ["cs"]="na straně ", ["da"]="på side ", ["de"]="auf Seite ", ["en"]="at page ", - ["eo"]="je paĝo", + ["eo"]="je paĝo ", ["es"]="en la página ", ["et"]="leheküljel ", ["fa"]="در صفحه ", - ["fi"]="sivulla", + ["fi"]="sivulla ", ["fr"]="à la page ", ["gr"]="", ["hr"]="na stranici ", @@ -1354,7 +1446,7 @@ data.labels={ ["nl"]="op pagina ", ["nn"]="på side ", ["pl"]="na stronie ", - ["pt"]="", + ["pt"]="na pagina", ["ro"]="", ["ru"]="на странице ", ["sk"]="na strane ", @@ -1473,18 +1565,18 @@ data.labels={ ["be"]="Глава ", ["bg"]="Eпизод ", ["ca"]="Capítol ", - ["cn"]={ "第", "章" }, + ["cn"]={ "第 ", " 章" }, ["cs"]="Kapitola ", ["da"]="", ["de"]="Kapitel ", ["en"]="Chapter ", - ["eo"]="Ĉapitro", + ["eo"]="Ĉapitro ", ["es"]="Capítulo ", ["et"]="Peatükk ", ["fa"]="فصل ", ["fi"]="luku", ["fr"]="Chapitre ", - ["gr"]="Κεφάλαιο", + ["gr"]="Κεφάλαιο ", ["hr"]="Poglavlje ", ["hu"]={ "", " fejezet" }, ["hy"]="Գլուխ ", @@ -1498,15 +1590,15 @@ data.labels={ ["nl"]="", ["nn"]="", ["pl"]="Rozdział ", - ["pt"]="", + ["pt"]="Capitulo ", ["ro"]="", ["ru"]="", ["sk"]="Kapitola ", ["sl"]="Poglavje ", ["sr"]="Глава ", ["sr-latn"]="Glava ", - ["sv"]="", - ["tk"]="Bap", + ["sv"]="Kapitel ", + ["tk"]="Bap ", ["tr"]="", ["ua"]="", ["vi"]="Chương ", @@ -1540,25 +1632,31 @@ data.labels={ ["nl"]=" (vervolgd)", ["nn"]="", ["pl"]="", - ["pt"]="", + ["pt"]=" (continua)", ["ro"]="", ["ru"]="", ["sk"]=" (pokračovanie)", ["sl"]="", ["sr"]=" (наставак)", ["sr-latn"]=" (nastavak)", - ["sv"]="", + ["sv"]=" (forts.)", ["tk"]="", ["tr"]="", ["ua"]="", ["vi"]="", }, }, + ["day:genetiv"]={ + ["labels"]={ + ["cs"]="dne", + ["sk"]="dňa", + }, + }, ["day"]={ ["labels"]={ ["bg"]="ден", ["ca"]="dia", - ["cs"]="den", -- {"den", "dne" } + ["cs"]="den", ["de"]="Tag", ["en"]="day", ["eo"]="tago", @@ -1570,9 +1668,11 @@ data.labels={ ["kr"]="일", ["mk"]="ден", ["nl"]="dag", - ["sk"]="deň", -- {"deň", "dňa" } + ["pt"]="dia", + ["sk"]="deň", ["sr"]="дан", ["sr-latn"]="dan", + ["sv"]="dag", }, }, ["december"]={ @@ -1771,10 +1871,10 @@ data.labels={ ["labels"]={ ["af"]="Figuur ", ["ar"]="شكل ", - ["be"]="Малюнак", - ["bg"]="Фигура", + ["be"]="Малюнак ", + ["bg"]="Фигура ", ["ca"]="Figura ", - ["cn"]="图", + ["cn"]="图 ", ["cs"]="Obrázek ", ["da"]="Figur ", ["de"]="Abbildung ", @@ -1785,7 +1885,7 @@ data.labels={ ["fa"]="شکل ", ["fi"]="Kuva ", ["fr"]="Figure ", - ["gr"]="Σχήμα", + ["gr"]="Σχήμα ", ["hr"]="Slika ", ["hu"]={ "", " ábra" }, ["hy"]="Նկար ", @@ -1807,7 +1907,7 @@ data.labels={ ["sr"]="Слика ", ["sr-latn"]="Slika ", ["sv"]="Figur ", - ["tk"]="Surat", + ["tk"]="Surat ", ["tr"]="Şekil ", ["ua"]="Малюнок ", ["vi"]="Hình ", @@ -1821,7 +1921,9 @@ data.labels={ ["eo"]="sekvv", ["fr"]=hairspace .. "sqq", ["hy"]="ff.", + ["pt"]="seg", ["sk"]="násl.", + ["sv"]="ff.", }, }, ["following:singular"]={ @@ -1832,7 +1934,9 @@ data.labels={ ["eo"]="sekv", ["fr"]=hairspace .. "sq", ["hy"]="f.", + ["pt"]="seg", ["sk"]="násl.", + ["sv"]="f.", }, }, ["followingpage"]={ @@ -1850,9 +1954,11 @@ data.labels={ ["hy"]="Հաջորդ էջում", ["mk"]="на следната страница", ["nl"]="op een volgende bladzijde", + ["pt"]="pagina seguinte", ["sk"]="na nasledujúcej strane", ["sr"]="на следећој страници", ["sr-latn"]="na sledećoj stranici", + ["sv"]="på nästa sida", }, }, ["friday"]={ @@ -1925,21 +2031,21 @@ data.labels={ ["be"]="Графіка ", ["bg"]="Графичен ", ["ca"]="Gràfica ", - ["cn"]="插图", + ["cn"]="插图 ", ["cs"]="Graf ", ["da"]="Grafik ", ["de"]="Grafik ", ["en"]="Graphic ", - ["eo"]="Grafiko", + ["eo"]="Grafiko ", ["es"]="Gráfico ", ["et"]="Pilt ", ["fa"]="طرح ", ["fi"]="Grafiikka ", ["fr"]="Illustration ", - ["gr"]="Γραφικό", + ["gr"]="Γραφικό ", ["hr"]="Slika ", ["hu"]={ "", " kép" }, - ["hy"]="Գրաֆ", + ["hy"]="Գրաֆ ", ["it"]="Grafico ", ["ja"]="イラスト", ["la"]="Typus ", @@ -1957,10 +2063,10 @@ data.labels={ ["sr"]="График ", ["sr-latn"]="Grafik ", ["sv"]="Grafik ", - ["tk"]="Grafik", - ["tr"]="Grafik", + ["tk"]="Grafik ", + ["tr"]="Grafik ", ["ua"]="График ", - ["vi"]="Đồ thị", + ["vi"]="Đồ thị ", }, }, ["hencefore"]={ @@ -1969,10 +2075,10 @@ data.labels={ ["ar"]="كما وضحنا سابقا", ["be"]="гл. вышэй", ["bg"]="виж по-горе", - ["ca"]="com es mostra dalt ", + ["ca"]="com es mostra dalt", ["cs"]="viz výše", ["da"]="se foroven", - ["de"]="siehe oben", -- better "oben"? + ["de"]="siehe oben", ["en"]="as we show above", ["eo"]="laŭsupre", ["es"]="como se muestra arriba", @@ -1993,7 +2099,7 @@ data.labels={ ["nl"]="hierboven", ["nn"]="som vist over", ["pl"]="jak pokazano wyżej", - ["pt"]="", + ["pt"]="como mostrado em cima", ["ro"]="", ["ru"]="см. выше", ["sk"]="pozri hore", @@ -2016,7 +2122,7 @@ data.labels={ ["ca"]="com es mostra baix", ["cs"]="viz níže", ["da"]="se forneden", - ["de"]="siehe unten", -- better "nachstehend"? + ["de"]="siehe unten", ["en"]="as we show below", ["eo"]="laŭsube", ["es"]="como se muestra abajo", @@ -2037,7 +2143,7 @@ data.labels={ ["nl"]="hieronder", ["nn"]="som vist under", ["pl"]="jak pokazano niżej", - ["pt"]="", + ["pt"]="como mostrado em baixo", ["ro"]="", ["ru"]="см. ниже", ["sk"]="pozri ďalej", @@ -2058,20 +2164,20 @@ data.labels={ ["be"]="Інтэрмецца ", ["bg"]="Интермецо ", ["ca"]="Intermedi ", - ["cn"]="퉣", + ["cn"]="퉣 ", ["cs"]="Intermezzo ", ["da"]="Intermezzo ", ["de"]="Intermezzo ", ["en"]="Intermezzo ", - ["eo"]="Intermezo", + ["eo"]="Intermezo ", ["es"]="Intermedio ", ["et"]="Vahemäng ", ["fi"]="Intermezzo ", ["fr"]="Intermède ", - ["gr"]="Παύση", + ["gr"]="Παύση ", ["hr"]="Intermeco ", ["hu"]={ "", " intermezzo" }, - ["hy"]="Ինտերմեցո", + ["hy"]="Ինտերմեցո ", ["it"]="Intermezzo ", ["ja"]="間奏曲", ["kr"]="간주곡", @@ -2090,10 +2196,10 @@ data.labels={ ["sr"]="Дигресија ", ["sr-latn"]="Digresija ", ["sv"]="Intermezzo ", - ["tk"]="Arakesme", + ["tk"]="Arakesme ", ["tr"]="", ["ua"]="Вставка ", - ["vi"]="intermezzo", + ["vi"]="Intermezzo ", }, }, ["january"]={ @@ -2395,7 +2501,7 @@ data.labels={ ["be"]="радок ", ["bg"]="ред ", ["ca"]="línia ", - ["cn"]="行", + ["cn"]="行 ", ["cs"]="řádek ", ["da"]="linie ", ["de"]="Zeile ", @@ -2406,7 +2512,7 @@ data.labels={ ["fa"]="سطر ", ["fi"]="rivi ", ["fr"]="ligne ", - ["gr"]="Γραμμή", + ["gr"]="Γραμμή ", ["hr"]="redak ", ["hu"]={ "", " sor" }, ["hy"]="Տող ", @@ -2428,7 +2534,7 @@ data.labels={ ["sr"]="линија ", ["sr-latn"]="linija ", ["sv"]="rad ", - ["tk"]="setir", + ["tk"]="setir ", ["tr"]="satır ", ["ua"]="рядок ", ["vi"]="dòng ", @@ -2441,7 +2547,7 @@ data.labels={ ["be"]="радкi ", ["bg"]="редове ", ["ca"]="línies ", - ["cn"]="行", + ["cn"]="行 ", ["cs"]="řádky ", ["da"]="linier ", ["de"]="Zeilen ", @@ -2452,7 +2558,7 @@ data.labels={ ["fa"]="سطرهای ", ["fi"]="rivie ", ["fr"]="lignes ", - ["gr"]="Γραμμές", + ["gr"]="Γραμμές ", ["hr"]="retci ", ["hu"]="sorok ", ["hy"]="Տողեր ", @@ -2474,7 +2580,7 @@ data.labels={ ["sr"]="линије ", ["sr-latn"]="linije ", ["sv"]="rader ", - ["tk"]="setirler", + ["tk"]="setirler ", ["tr"]="satırlar ", ["ua"]="рядки ", ["vi"]="dòng ", @@ -2742,6 +2848,7 @@ data.labels={ ["be"]="месяц", ["bg"]="месец", ["ca"]="mes", + ["cs"]="měsíc", ["de"]="Monat", ["en"]="month", ["eo"]="monato", @@ -2754,8 +2861,11 @@ data.labels={ ["kr"]="월", ["mk"]="месец", ["nl"]="maand", + ["pt"]="mes", + ["sk"]="mesiac", ["sr"]="месец", ["sr-latn"]="mesec", + ["sv"]="månad", }, }, ["november"]={ @@ -2956,7 +3066,7 @@ data.labels={ ["af"]="", ["ar"]="صفحة ", ["be"]="старонка ", - ["bg"]="страна", + ["bg"]="страна ", ["ca"]="pagina ", ["cs"]="strana ", ["da"]="Side ", @@ -2966,7 +3076,7 @@ data.labels={ ["es"]="página ", ["et"]="lehekülg ", ["fa"]="صفحه ", - ["fi"]="Sivu", + ["fi"]="Sivu ", ["fr"]="page ", ["gr"]="", ["hr"]="stranica ", @@ -2981,7 +3091,7 @@ data.labels={ ["nl"]="pagina ", ["nn"]="side ", ["pl"]="strona ", - ["pt"]="", + ["pt"]="pagina ", ["ro"]="", ["ru"]="страница ", ["sk"]="strana ", @@ -3002,7 +3112,7 @@ data.labels={ ["be"]="Частка ", ["bg"]="Частка ", ["ca"]="Part ", - ["cn"]={ "第", "部分" }, + ["cn"]={ "第 ", " 部分" }, ["cs"]="Část ", ["da"]="Del ", ["de"]="Teil ", @@ -3013,7 +3123,7 @@ data.labels={ ["fa"]="قسمت ", ["fi"]="Osa ", ["fr"]="Partie ", - ["gr"]="Μέρος", + ["gr"]="Μέρος ", ["hr"]="Dio ", ["hu"]={ "", " rész" }, ["hy"]="Մաս ", @@ -3022,10 +3132,9 @@ data.labels={ ["kr"]={ "제", "부" }, ["la"]="Pars ", ["lt"]={ "", " dalis" }, - ["mk"]="Дел ", ["nb"]="Del ", ["nl"]="Deel ", - ["nn"]="Del", + ["nn"]="Del ", ["pl"]="Część ", ["pt"]="Parte ", ["ro"]="Partea ", @@ -3035,7 +3144,7 @@ data.labels={ ["sr"]="Део ", ["sr-latn"]="Deo ", ["sv"]="Del ", - ["tk"]="Bölüm", + ["tk"]="Bölüm ", ["tr"]="Cilt ", ["ua"]="Частина ", ["vi"]="Phần ", @@ -3043,9 +3152,10 @@ data.labels={ }, ["precedingpage"]={ ["labels"]={ + ["comment"]=[[ "auf der vorigen Seite" ok, but not "auf einer vorigen Seite" ]], ["ca"]="en una pagina anterior", ["cs"]="na předchozí straně", - ["de"]="oben", -- "auf der vorigen Seite" ok, but not "auf einer vorigen Seite" + ["de"]="oben", ["en"]="on a preceding page", ["eo"]="sur antaŭa paĝo", ["es"]="en la pagina anterior", @@ -3056,9 +3166,11 @@ data.labels={ ["hy"]="նախորդ էջ", ["mk"]="на претходната страница", ["nl"]="op een voorgaande bladzijde", + ["pt"]="na seguinte pagina", ["sk"]="na predchádzajúcej strane", ["sr"]="на претходној страници", ["sr-latn"]="na prethodnoj stranici", + ["sv"]="på föregående sida", }, }, ["saturday"]={ @@ -3130,18 +3242,18 @@ data.labels={ ["ar"]="فصل ", ["bg"]="Cекция ", ["ca"]="Secció ", - ["cn"]={ "第", "节" }, + ["cn"]={ "第 ", " 节" }, ["cs"]="Sekce ", ["da"]="", ["de"]="Abschnitt ", - ["en"]="Section", + ["en"]="Section ", ["eo"]="Sekcio ", ["es"]="Sección ", ["et"]="jaos ", ["fa"]="بخش ", - ["fi"]="Osio", + ["fi"]="Osio ", ["fr"]="Section ", - ["gr"]="Ενότητα", + ["gr"]="Ενότητα ", ["hr"]="Odjeljak ", ["hu"]="Fejezet ", ["hy"]="Բաժին ", @@ -3162,7 +3274,7 @@ data.labels={ ["sl"]="", ["sr"]="Одељак ", ["sr-latn"]="Odeljak ", - ["sv"]="", + ["sv"]="Avsnitt", ["tk"]="", ["tr"]="", ["ua"]="", @@ -3174,7 +3286,7 @@ data.labels={ ["af"]="", ["ar"]="انظر ", ["be"]="гл. ", - ["bg"]="погледни", + ["bg"]="погледни ", ["ca"]="vore ", ["cs"]="viz ", ["da"]="se ", @@ -3184,7 +3296,7 @@ data.labels={ ["es"]="ver: ", ["et"]="vaadake ", ["fa"]="نگاه کنید به ", - ["fi"]="Katso", + ["fi"]="katso ", ["fr"]="cf. ", ["gr"]="", ["hr"]="vidi ", @@ -3199,7 +3311,7 @@ data.labels={ ["nl"]="zie ", ["nn"]="sjå ", ["pl"]="patrz ", - ["pt"]="", + ["pt"]="ver ", ["ro"]="", ["ru"]="см. ", ["sk"]="pozri ", @@ -3320,14 +3432,14 @@ data.labels={ ["cs"]="Podsekce ", ["da"]="", ["de"]="Unterabschnitt ", - ["en"]="Subsection", + ["en"]="Subsection ", ["eo"]="Subsekcio ", ["es"]="Subsección ", ["et"]="alajaotis ", ["fa"]="زیربخش ", ["fi"]="Alajakso", ["fr"]="Soussection ", - ["gr"]="Υπόενότητα", + ["gr"]="Υπόενότητα ", ["hr"]="Pododjeljak ", ["hu"]="Alfejezet ", ["hy"]=" Ենթաբաժին ", @@ -3340,14 +3452,14 @@ data.labels={ ["nl"]="", ["nn"]="", ["pl"]="Podpodrozdział ", - ["pt"]="", + ["pt"]="Subsecçao ", ["ro"]="", ["ru"]="", ["sk"]="Podsekcia ", ["sl"]="", ["sr"]="Пододељак ", ["sr-latn"]="Pododeljak ", - ["sv"]="", + ["sv"]="Underavsnitt", ["tk"]="", ["tr"]="", ["ua"]="", @@ -3365,12 +3477,12 @@ data.labels={ ["cs"]="Podpodsekce ", ["da"]="", ["de"]="Unterunterabschnitt ", - ["en"]="Subsubsection", + ["en"]="Subsubsection ", ["eo"]="Subsubsekcio ", ["es"]="Subsubsección ", ["et"]="alamjaotis ", ["fa"]="زیرزیربخش ", - ["fi"]="Alakohta", + ["fi"]="Alakohta ", ["fr"]="Soussoussection ", ["gr"]="", ["hr"]="Podpododjeljak ", @@ -3385,14 +3497,14 @@ data.labels={ ["nl"]="", ["nn"]="", ["pl"]="", - ["pt"]="", + ["pt"]="Subsubsecçao ", ["ro"]="", ["ru"]="", ["sk"]="Podpodsekcia ", ["sl"]="", ["sr"]="Подпододељак ", ["sr-latn"]="Podpododeljak ", - ["sv"]="", + ["sv"]="Underunderavsnitt", ["tk"]="", ["tr"]="", ["ua"]="", @@ -3409,13 +3521,13 @@ data.labels={ ["cn"]="", ["cs"]="Podpodpodsekce ", ["da"]="", - ["de"]="Unterunterunterabschnitt", - ["en"]="Subsubsubsection", + ["de"]="Unterunterunterabschnitt ", + ["en"]="Subsubsubsection ", ["eo"]="Subsubsubsekcio ", ["es"]="Subsubsubsección ", ["et"]="", ["fa"]="زیرزیرزیربخش ", - ["fi"]="Ala-alakohta", + ["fi"]="Ala-alakohta ", ["fr"]="Soussoussoussection ", ["gr"]="", ["hr"]="Podpodpododjeljak ", @@ -3430,7 +3542,7 @@ data.labels={ ["nl"]="", ["nn"]="", ["pl"]="", - ["pt"]="", + ["pt"]="Subsubsubsecçao ", ["ro"]="", ["ru"]="", ["sk"]="Podpodpodsekcia ", @@ -3513,7 +3625,7 @@ data.labels={ ["be"]="Табліца ", ["bg"]="Таблица ", ["ca"]="Taula ", - ["cn"]="表", + ["cn"]="表 ", ["cs"]="Tabulka ", ["da"]="Tabel ", ["de"]="Tabelle ", @@ -3524,7 +3636,7 @@ data.labels={ ["fa"]="جدول ", ["fi"]="Taulukko ", ["fr"]="Tableau ", - ["gr"]="Πίνακας", + ["gr"]="Πίνακας ", ["hr"]="Tablica ", ["hu"]={ "", " táblázat" }, ["hy"]="Աղյուսակ ", @@ -3546,7 +3658,7 @@ data.labels={ ["sr"]="Табела ", ["sr-latn"]="Tabela ", ["sv"]="Tabell ", - ["tk"]="Tablisa", + ["tk"]="Tablisa ", ["tr"]="Tablo ", ["ua"]="Таблиця ", ["vi"]="Bảng ", @@ -3758,9 +3870,11 @@ data.labels={ ["kr"]="년", ["mk"]="година", ["nl"]="jaar", + ["pt"]="ano", ["sk"]="rok", ["sr"]="година", ["sr-latn"]="godina", + ["sv"]="år", }, }, }, @@ -3773,7 +3887,7 @@ data.labels={ ["bg"]="Съкращения", ["ca"]="Abreviacions", ["cn"]="缩略语", - ["cs"]="Seznam zkratek", --"Zkratky" + ["cs"]="Seznam zkratek", ["da"]="Forkortelser", ["de"]="Abkürzungen", ["en"]="Abbreviations", @@ -3800,7 +3914,7 @@ data.labels={ ["pt"]="Abreviaturas", ["ro"]="Abrevieri", ["ru"]="Список сокращений", - ["sk"]="Zoznam skratiek", -- "Skratky" + ["sk"]="Zoznam skratiek", ["sl"]="Kratice", ["sr"]="Скраћенице", ["sr-latn"]="Skraćenice", @@ -3863,7 +3977,7 @@ data.labels={ ["ar"]="الأشكال", ["be"]="Спіс ілюстрацый", ["ca"]="Figures", - ["cn"]="图形", + ["cn"]="图", ["cs"]="Seznam obrázků", ["da"]="Figurer", ["de"]="Abbildungen", @@ -4046,7 +4160,7 @@ data.labels={ ["be"]="Лагатыпы", ["bg"]="Логотипи", ["ca"]="Logotips", - ["cn"]="徽贬", + ["cn"]="徽标", ["cs"]="Loga", ["da"]="Logoer", ["de"]="Logos", @@ -4112,14 +4226,14 @@ data.labels={ ["nl"]="Literatuur", ["nn"]="", ["pl"]="Bibliografia", - ["pt"]="", + ["pt"]="Referencias", ["ro"]="", ["ru"]="", ["sk"]="Literatúra", ["sl"]="Literatura", ["sr"]="Литература", ["sr-latn"]="Literatura", - ["sv"]="", + ["sv"]="Litteraturförteckning", ["tk"]="", ["tr"]="", ["ua"]="", diff --git a/Master/texmf-dist/tex/context/base/mkiv/lang-url.lua b/Master/texmf-dist/tex/context/base/mkiv/lang-url.lua index 7a8b7ca86c3..7cd666df567 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lang-url.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/lang-url.lua @@ -21,12 +21,10 @@ local v_after = variables.after local is_letter = characters.is_letter ---[[ -<p>Hyphenating <l n='url'/>'s is somewhat tricky and a matter of taste. I did -consider using a dedicated hyphenation pattern or dealing with it by node -parsing, but the following solution suits as well. After all, we're mostly -dealing with <l n='ascii'/> characters.</p> -]]-- +-- Hyphenating URL's is somewhat tricky and a matter of taste. I did consider using +-- a dedicated hyphenation pattern or dealing with it by node parsing, but the +-- following solution suits as well. After all, we're mostly dealing with ASCII +-- characters. local urls = { } languages.urls = urls diff --git a/Master/texmf-dist/tex/context/base/mkiv/lpdf-mis.lua b/Master/texmf-dist/tex/context/base/mkiv/lpdf-mis.lua index 94e9fc2714f..803a8860eb4 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lpdf-mis.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/lpdf-mis.lua @@ -246,7 +246,8 @@ local function setupidentity() addtoinfo("ConTeXt.Version",version) addtoinfo("ConTeXt.Time",os.date("%Y-%m-%d %H:%M")) addtoinfo("ConTeXt.Jobname",jobname) - addtoinfo("ConTeXt.Url","www.pragma-ade.com") + -- addtoinfo("ConTeXt.Url","www.pragma-ade.com") + addtoinfo("ConTeXt.Url","github.com/contextgarden/context") addtoinfo("ConTeXt.Support","contextgarden.net") addtoinfo("TeX.Support","tug.org") -- diff --git a/Master/texmf-dist/tex/context/base/mkiv/luat-cbk.lua b/Master/texmf-dist/tex/context/base/mkiv/luat-cbk.lua index 9fd55f3ecc0..9e35283c164 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/luat-cbk.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/luat-cbk.lua @@ -12,20 +12,16 @@ local collectgarbage, type, next = collectgarbage, type, next local round = math.round local sortedhash, sortedkeys, tohash = table.sortedhash, table.sortedkeys, table.tohash ---[[ldx-- -<p>Callbacks are the real asset of <l n='luatex'/>. They permit you to hook -your own code into the <l n='tex'/> engine. Here we implement a few handy -auxiliary functions.</p> ---ldx]]-- +-- Callbacks are the real asset of LuaTeX. They permit you to hook your own code +-- into the TeX engine. Here we implement a few handy auxiliary functions. Watch +-- out, there are diferences between LuateX and LuaMetaTeX. callbacks = callbacks or { } local callbacks = callbacks ---[[ldx-- -<p>When you (temporarily) want to install a callback function, and after a -while wants to revert to the original one, you can use the following two -functions. This only works for non-frozen ones.</p> ---ldx]]-- +-- When you (temporarily) want to install a callback function, and after a while +-- wants to revert to the original one, you can use the following two functions. +-- This only works for non-frozen ones. local trace_callbacks = false trackers.register("system.callbacks", function(v) trace_callbacks = v end) local trace_calls = false -- only used when analyzing performance and initializations @@ -47,13 +43,12 @@ local list = callbacks.list local permit_overloads = false local block_overloads = false ---[[ldx-- -<p>By now most callbacks are frozen and most provide a way to plug in your own code. For instance -all node list handlers provide before/after namespaces and the file handling code can be extended -by adding schemes and if needed I can add more hooks. So there is no real need to overload a core -callback function. It might be ok for quick and dirty testing but anyway you're on your own if -you permanently overload callback functions.</p> ---ldx]]-- +-- By now most callbacks are frozen and most provide a way to plug in your own code. +-- For instance all node list handlers provide before/after namespaces and the file +-- handling code can be extended by adding schemes and if needed I can add more +-- hooks. So there is no real need to overload a core callback function. It might be +-- ok for quick and dirty testing but anyway you're on your own if you permanently +-- overload callback functions. -- This might become a configuration file only option when it gets abused too much. @@ -279,65 +274,50 @@ end) -- callbacks.freeze("read_.*_file","reading file") -- callbacks.freeze("open_.*_file","opening file") ---[[ldx-- -<p>The simple case is to remove the callback:</p> - -<code> -callbacks.push('linebreak_filter') -... some actions ... -callbacks.pop('linebreak_filter') -</code> - -<p>Often, in such case, another callback or a macro call will pop -the original.</p> - -<p>In practice one will install a new handler, like in:</p> - -<code> -callbacks.push('linebreak_filter', function(...) - return something_done(...) -end) -</code> - -<p>Even more interesting is:</p> - -<code> -callbacks.push('linebreak_filter', function(...) - callbacks.pop('linebreak_filter') - return something_done(...) -end) -</code> - -<p>This does a one-shot.</p> ---ldx]]-- - ---[[ldx-- -<p>Callbacks may result in <l n='lua'/> doing some hard work -which takes time and above all resourses. Sometimes it makes -sense to disable or tune the garbage collector in order to -keep the use of resources acceptable.</p> - -<p>At some point in the development we did some tests with counting -nodes (in this case 121049).</p> - -<table> -<tr><td>setstepmul</td><td>seconds</td><td>megabytes</td></tr> -<tr><td>200</td><td>24.0</td><td>80.5</td></tr> -<tr><td>175</td><td>21.0</td><td>78.2</td></tr> -<tr><td>150</td><td>22.0</td><td>74.6</td></tr> -<tr><td>160</td><td>22.0</td><td>74.6</td></tr> -<tr><td>165</td><td>21.0</td><td>77.6</td></tr> -<tr><td>125</td><td>21.5</td><td>89.2</td></tr> -<tr><td>100</td><td>21.5</td><td>88.4</td></tr> -</table> - -<p>The following code is kind of experimental. In the documents -that describe the development of <l n='luatex'/> we report -on speed tests. One observation is that it sometimes helps to -restart the collector. Okay, experimental code has been removed, -because messing aroudn with the gc is too unpredictable.</p> ---ldx]]-- - +-- The simple case is to remove the callback: +-- +-- callbacks.push('linebreak_filter') +-- ... some actions ... +-- callbacks.pop('linebreak_filter') +-- +-- Often, in such case, another callback or a macro call will pop the original. +-- +-- In practice one will install a new handler, like in: +-- +-- callbacks.push('linebreak_filter', function(...) +-- return something_done(...) +-- end) +-- +-- Even more interesting is: +-- +-- callbacks.push('linebreak_filter', function(...) +-- callbacks.pop('linebreak_filter') +-- return something_done(...) +-- end) +-- +-- This does a one-shot. +-- +-- Callbacks may result in Lua doing some hard work which takes time and above all +-- resourses. Sometimes it makes sense to disable or tune the garbage collector in +-- order to keep the use of resources acceptable. +-- +-- At some point in the development we did some tests with counting nodes (in this +-- case 121049). +-- +-- setstepmul seconds megabytes +-- 200 24.0 80.5 +-- 175 21.0 78.2 +-- 150 22.0 74.6 +-- 160 22.0 74.6 +-- 165 21.0 77.6 +-- 125 21.5 89.2 +-- 100 21.5 88.4 +-- +-- The following code is kind of experimental. In the documents that describe the +-- development of LuaTeX we report on speed tests. One observation is that it +-- sometimes helps to restart the collector. Okay, experimental code has been +-- removed, because messing around with the gc is too unpredictable. +-- -- For the moment we keep this here and not in util-gbc.lua or so. utilities = utilities or { } diff --git a/Master/texmf-dist/tex/context/base/mkiv/luat-fmt.lua b/Master/texmf-dist/tex/context/base/mkiv/luat-fmt.lua index fe97cf604b9..19172133227 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/luat-fmt.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/luat-fmt.lua @@ -15,6 +15,11 @@ if not modules then modules = { } end modules ['luat-fmt'] = { -- I'll strip the code here because something generic will never take of and we -- moved on to luametatex anyway. +-- Per 2023-04-25 we need to explicitly pass --socket and --shell-escape because +-- other macro packages need these libraries to be disabled due to lack of control. +-- So a quite drastic break of downward compatibility (context could not generate a +-- format otherwise). Yet another reason to move on to luametatex. + local format = string.format local concat = table.concat local quoted = string.quoted @@ -64,7 +69,7 @@ end -- The silent option is for Taco. It's a bit of a hack because we cannot yet mess -- with directives. In fact, I could probably clean up the maker a bit by now. -local template = [[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %redirect%]] +local template = [[--ini %primaryflags% --socket --shell-escape --lua=%luafile% %texfile% %secondaryflags% %redirect%]] local checkers = { primaryflags = "verbose", -- "flags" @@ -225,7 +230,7 @@ function environment.make_format(formatname) lfs.chdir(startupdir) end -local template = [[%primaryflags% --fmt=%fmtfile% --lua=%luafile% %texfile% %secondaryflags%]] +local template = [[%primaryflags% --socket --shell-escape --fmt=%fmtfile% --lua=%luafile% %texfile% %secondaryflags%]] local checkers = { primaryflags = "verbose", diff --git a/Master/texmf-dist/tex/context/base/mkiv/luat-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/luat-ini.lua index dcca8cec7a8..83fe0713d66 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/luat-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/luat-ini.lua @@ -6,11 +6,9 @@ if not modules then modules = { } end modules ['luat-ini'] = { license = "see context related readme files" } ---[[ldx-- -<p>We cannot load anything yet. However what we will do us reserve a few tables. -These can be used for runtime user data or third party modules and will not be -cluttered by macro package code.</p> ---ldx]]-- +-- We cannot load anything yet. However what we will do us reserve a few tables. +-- These can be used for runtime user data or third party modules and will not be +-- cluttered by macro package code. userdata = userdata or { } -- for users (e.g. functions etc) thirddata = thirddata or { } -- only for third party modules diff --git a/Master/texmf-dist/tex/context/base/mkiv/lxml-aux.lua b/Master/texmf-dist/tex/context/base/mkiv/lxml-aux.lua index fc17371e58f..217f81c13f9 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lxml-aux.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/lxml-aux.lua @@ -110,11 +110,7 @@ function xml.processattributes(root,pattern,handle) return collected end ---[[ldx-- -<p>The following functions collect elements and texts.</p> ---ldx]]-- - --- are these still needed -> lxml-cmp.lua +-- The following functions collect elements and texts. function xml.collect(root, pattern) return xmlapplylpath(root,pattern) @@ -153,9 +149,7 @@ function xml.collect_tags(root, pattern, nonamespace) end end ---[[ldx-- -<p>We've now arrived at the functions that manipulate the tree.</p> ---ldx]]-- +-- We've now arrived at the functions that manipulate the tree. local no_root = { no_root = true } @@ -780,9 +774,7 @@ function xml.remapname(root, pattern, newtg, newns, newrn) end end ---[[ldx-- -<p>Helper (for q2p).</p> ---ldx]]-- +-- Helper (for q2p). function xml.cdatatotext(e) local dt = e.dt @@ -879,9 +871,7 @@ end -- xml.addentitiesdoctype(x,"hexadecimal") -- print(x) ---[[ldx-- -<p>Here are a few synonyms.</p> ---ldx]]-- +-- Here are a few synonyms: xml.all = xml.each xml.insert = xml.insertafter diff --git a/Master/texmf-dist/tex/context/base/mkiv/lxml-ent.lua b/Master/texmf-dist/tex/context/base/mkiv/lxml-ent.lua index df80a798533..1d6d058b64f 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lxml-ent.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/lxml-ent.lua @@ -10,14 +10,10 @@ local next = next local byte, format = string.byte, string.format local setmetatableindex = table.setmetatableindex ---[[ldx-- -<p>We provide (at least here) two entity handlers. The more extensive -resolver consults a hash first, tries to convert to <l n='utf'/> next, -and finaly calls a handler when defines. When this all fails, the -original entity is returned.</p> - -<p>We do things different now but it's still somewhat experimental</p> ---ldx]]-- +-- We provide (at least here) two entity handlers. The more extensive resolver +-- consults a hash first, tries to convert to UTF next, and finaly calls a handler +-- when defines. When this all fails, the original entity is returned. We do things +-- different now but it's still somewhat experimental. local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end) diff --git a/Master/texmf-dist/tex/context/base/mkiv/lxml-lpt.lua b/Master/texmf-dist/tex/context/base/mkiv/lxml-lpt.lua index 78a9fca2e0a..d242b07de92 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lxml-lpt.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/lxml-lpt.lua @@ -20,28 +20,21 @@ local formatters = string.formatters -- no need (yet) as paths are cached anyway -- beware, this is not xpath ... e.g. position is different (currently) and -- we have reverse-sibling as reversed preceding sibling ---[[ldx-- -<p>This module can be used stand alone but also inside <l n='mkiv'/> in -which case it hooks into the tracker code. Therefore we provide a few -functions that set the tracers. Here we overload a previously defined -function.</p> -<p>If I can get in the mood I will make a variant that is XSLT compliant -but I wonder if it makes sense.</P> ---ldx]]-- - ---[[ldx-- -<p>Expecially the lpath code is experimental, we will support some of xpath, but -only things that make sense for us; as compensation it is possible to hook in your -own functions. Apart from preprocessing content for <l n='context'/> we also need -this module for process management, like handling <l n='ctx'/> and <l n='rlx'/> -files.</p> - -<typing> -a/b/c /*/c -a/b/c/first() a/b/c/last() a/b/c/index(n) a/b/c/index(-n) -a/b/c/text() a/b/c/text(1) a/b/c/text(-1) a/b/c/text(n) -</typing> ---ldx]]-- +-- This module can be used stand alone but also inside ConTeXt in which case it +-- hooks into the tracker code. Therefore we provide a few functions that set the +-- tracers. Here we overload a previously defined function. +-- +-- If I can get in the mood I will make a variant that is XSLT compliant but I +-- wonder if it makes sense. +-- +-- Expecially the lpath code is experimental, we will support some of xpath, but +-- only things that make sense for us; as compensation it is possible to hook in +-- your own functions. Apart from preprocessing content for ConTeXt we also need +-- this module for process management, like handling CTX and RLX files. +-- +-- a/b/c /*/c +-- a/b/c/first() a/b/c/last() a/b/c/index(n) a/b/c/index(-n) +-- a/b/c/text() a/b/c/text(1) a/b/c/text(-1) a/b/c/text(n) local trace_lpath = false local trace_lparse = false @@ -62,11 +55,9 @@ if trackers then end) end ---[[ldx-- -<p>We've now arrived at an interesting part: accessing the tree using a subset -of <l n='xpath'/> and since we're not compatible we call it <l n='lpath'/>. We -will explain more about its usage in other documents.</p> ---ldx]]-- +-- We've now arrived at an interesting part: accessing the tree using a subset of +-- XPATH and since we're not compatible we call it LPATH. We will explain more about +-- its usage in other documents. local xml = xml @@ -1273,9 +1264,8 @@ do end local applylpath = xml.applylpath ---[[ldx-- -<p>This is the main filter function. It returns whatever is asked for.</p> ---ldx]]-- + +-- This is the main filter function. It returns whatever is asked for. function xml.filter(root,pattern) -- no longer funny attribute handling here return applylpath(root,pattern) @@ -1525,21 +1515,16 @@ expressions.tag = function(e,n) -- only tg end end ---[[ldx-- -<p>Often using an iterators looks nicer in the code than passing handler -functions. The <l n='lua'/> book describes how to use coroutines for that -purpose (<url href='http://www.lua.org/pil/9.3.html'/>). This permits -code like:</p> - -<typing> -for r, d, k in xml.elements(xml.load('text.xml'),"title") do - print(d[k]) -- old method -end -for e in xml.collected(xml.load('text.xml'),"title") do - print(e) -- new one -end -</typing> ---ldx]]-- +-- Often using an iterators looks nicer in the code than passing handler functions. +-- The LUA book describes how to use coroutines for that purpose +-- 'href="http://www.lua.org/pil/9.3.html"'. This permits code like: +-- +-- for r, d, k in xml.elements(xml.load('text.xml'),"title") do +-- print(d[k]) -- old method +-- end +-- for e in xml.collected(xml.load('text.xml'),"title") do +-- print(e) -- new one +-- end -- local wrap, yield = coroutine.wrap, coroutine.yield -- local dummy = function() end diff --git a/Master/texmf-dist/tex/context/base/mkiv/lxml-mis.lua b/Master/texmf-dist/tex/context/base/mkiv/lxml-mis.lua index 04ba7b35c6a..ea62550bbeb 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lxml-mis.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/lxml-mis.lua @@ -17,13 +17,10 @@ local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, l lpegpatterns.xml = lpegpatterns.xml or { } local xmlpatterns = lpegpatterns.xml ---[[ldx-- -<p>The following helper functions best belong to the <t>lxml-ini</t> -module. Some are here because we need then in the <t>mk</t> -document and other manuals, others came up when playing with -this module. Since this module is also used in <l n='mtxrun'/> we've -put them here instead of loading mode modules there then needed.</p> ---ldx]]-- +-- The following helper functions best belong to the 'lxml-ini' module. Some are +-- here because we need then in the 'mk' document and other manuals, others came up +-- when playing with this module. Since this module is also used in 'mtxrun' we've +-- put them here instead of loading mode modules there then needed. local function xmlgsub(t,old,new) -- will be replaced local dt = t.dt diff --git a/Master/texmf-dist/tex/context/base/mkiv/lxml-tab.lua b/Master/texmf-dist/tex/context/base/mkiv/lxml-tab.lua index e18362bd8cd..a06b5906540 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lxml-tab.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/lxml-tab.lua @@ -18,13 +18,12 @@ local trace_entities = false trackers.register("xml.entities", function(v) trac local report_xml = logs and logs.reporter("xml","core") or function(...) print(string.format(...)) end ---[[ldx-- -<p>The parser used here is inspired by the variant discussed in the lua book, but -handles comment and processing instructions, has a different structure, provides -parent access; a first version used different trickery but was less optimized to we -went this route. First we had a find based parser, now we have an <l n='lpeg'/> based one. -The find based parser can be found in l-xml-edu.lua along with other older code.</p> ---ldx]]-- +-- The parser used here is inspired by the variant discussed in the lua book, but +-- handles comment and processing instructions, has a different structure, provides +-- parent access; a first version used different trickery but was less optimized to +-- we went this route. First we had a find based parser, now we have an LPEG based +-- one. The find based parser can be found in l-xml-edu.lua along with other older +-- code. if lpeg.setmaxstack then lpeg.setmaxstack(1000) end -- deeply nested xml files @@ -42,26 +41,19 @@ local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns local P, S, R, C, V, C, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.C, lpeg.Cs local formatters = string.formatters ---[[ldx-- -<p>First a hack to enable namespace resolving. A namespace is characterized by -a <l n='url'/>. The following function associates a namespace prefix with a -pattern. We use <l n='lpeg'/>, which in this case is more than twice as fast as a -find based solution where we loop over an array of patterns. Less code and -much cleaner.</p> ---ldx]]-- +-- First a hack to enable namespace resolving. A namespace is characterized by a +-- URL. The following function associates a namespace prefix with a pattern. We use +-- LPEG, which in this case is more than twice as fast as a find based solution +-- where we loop over an array of patterns. Less code and much cleaner. do -- begin of namespace closure (we ran out of locals) xml.xmlns = xml.xmlns or { } ---[[ldx-- -<p>The next function associates a namespace prefix with an <l n='url'/>. This -normally happens independent of parsing.</p> - -<typing> -xml.registerns("mml","mathml") -</typing> ---ldx]]-- +-- The next function associates a namespace prefix with an URL. This normally +-- happens independent of parsing. +-- +-- xml.registerns("mml","mathml") local check = P(false) local parse = check @@ -71,15 +63,11 @@ function xml.registerns(namespace, pattern) -- pattern can be an lpeg parse = P { P(check) + 1 * V(1) } end ---[[ldx-- -<p>The next function also registers a namespace, but this time we map a -given namespace prefix onto a registered one, using the given -<l n='url'/>. This used for attributes like <t>xmlns:m</t>.</p> - -<typing> -xml.checkns("m","http://www.w3.org/mathml") -</typing> ---ldx]]-- +-- The next function also registers a namespace, but this time we map a given +-- namespace prefix onto a registered one, using the given URL. This used for +-- attributes like 'xmlns:m'. +-- +-- xml.checkns("m","http://www.w3.org/mathml") function xml.checkns(namespace,url) local ns = lpegmatch(parse,lower(url)) @@ -88,68 +76,54 @@ function xml.checkns(namespace,url) end end ---[[ldx-- -<p>Next we provide a way to turn an <l n='url'/> into a registered -namespace. This used for the <t>xmlns</t> attribute.</p> - -<typing> -resolvedns = xml.resolvens("http://www.w3.org/mathml") -</typing> - -This returns <t>mml</t>. ---ldx]]-- +-- Next we provide a way to turn an URL into a registered namespace. This used for +-- the 'xmlns' attribute. +-- +-- resolvedns = xml.resolvens("http://www.w3.org/mathml") +-- +-- This returns MATHML. function xml.resolvens(url) return lpegmatch(parse,lower(url)) or "" end ---[[ldx-- -<p>A namespace in an element can be remapped onto the registered -one efficiently by using the <t>xml.xmlns</t> table.</p> ---ldx]]-- +-- A namespace in an element can be remapped onto the registered one efficiently by +-- using the 'xml.xmlns' table. end -- end of namespace closure ---[[ldx-- -<p>This version uses <l n='lpeg'/>. We follow the same approach as before, stack and top and -such. This version is about twice as fast which is mostly due to the fact that -we don't have to prepare the stream for cdata, doctype etc etc. This variant is -is dedicated to Luigi Scarso, who challenged me with 40 megabyte <l n='xml'/> files that -took 12.5 seconds to load (1.5 for file io and the rest for tree building). With -the <l n='lpeg'/> implementation we got that down to less 7.3 seconds. Loading the 14 -<l n='context'/> interface definition files (2.6 meg) went down from 1.05 seconds to 0.55.</p> - -<p>Next comes the parser. The rather messy doctype definition comes in many -disguises so it is no surprice that later on have to dedicate quite some -<l n='lpeg'/> code to it.</p> - -<typing> -<!DOCTYPE Something PUBLIC "... ..." "..." [ ... ] > -<!DOCTYPE Something PUBLIC "... ..." "..." > -<!DOCTYPE Something SYSTEM "... ..." [ ... ] > -<!DOCTYPE Something SYSTEM "... ..." > -<!DOCTYPE Something [ ... ] > -<!DOCTYPE Something > -</typing> - -<p>The code may look a bit complex but this is mostly due to the fact that we -resolve namespaces and attach metatables. There is only one public function:</p> - -<typing> -local x = xml.convert(somestring) -</typing> - -<p>An optional second boolean argument tells this function not to create a root -element.</p> - -<p>Valid entities are:</p> - -<typing> -<!ENTITY xxxx SYSTEM "yyyy" NDATA zzzz> -<!ENTITY xxxx PUBLIC "yyyy" > -<!ENTITY xxxx "yyyy" > -</typing> ---ldx]]-- +-- This version uses LPEG. We follow the same approach as before, stack and top and +-- such. This version is about twice as fast which is mostly due to the fact that we +-- don't have to prepare the stream for cdata, doctype etc etc. This variant is is +-- dedicated to Luigi Scarso, who challenged me with 40 megabyte XML files that took +-- 12.5 seconds to load (1.5 for file io and the rest for tree building). With the +-- LPEG implementation we got that down to less 7.3 seconds. Loading the 14 ConTeXt +-- interface definition files (2.6 meg) went down from 1.05 seconds to 0.55. +-- +-- Next comes the parser. The rather messy doctype definition comes in many +-- disguises so it is no surprice that later on have to dedicate quite some LPEG +-- code to it. +-- +-- <!DOCTYPE Something PUBLIC "... ..." "..." [ ... ] > +-- <!DOCTYPE Something PUBLIC "... ..." "..." > +-- <!DOCTYPE Something SYSTEM "... ..." [ ... ] > +-- <!DOCTYPE Something SYSTEM "... ..." > +-- <!DOCTYPE Something [ ... ] > +-- <!DOCTYPE Something > +-- +-- The code may look a bit complex but this is mostly due to the fact that we +-- resolve namespaces and attach metatables. There is only one public function: +-- +-- local x = xml.convert(somestring) +-- +-- An optional second boolean argument tells this function not to create a root +-- element. +-- +-- Valid entities are: +-- +-- <!ENTITY xxxx SYSTEM "yyyy" NDATA zzzz> +-- <!ENTITY xxxx PUBLIC "yyyy" > +-- <!ENTITY xxxx "yyyy" > -- not just one big nested table capture (lpeg overflow) @@ -1332,10 +1306,8 @@ function xml.inheritedconvert(data,xmldata,cleanup) -- xmldata is parent return xc end ---[[ldx-- -<p>Packaging data in an xml like table is done with the following -function. Maybe it will go away (when not used).</p> ---ldx]]-- +-- Packaging data in an xml like table is done with the following function. Maybe it +-- will go away (when not used). function xml.is_valid(root) return root and root.dt and root.dt[1] and type(root.dt[1]) == "table" and not root.dt[1].er @@ -1354,11 +1326,8 @@ end xml.errorhandler = report_xml ---[[ldx-- -<p>We cannot load an <l n='lpeg'/> from a filehandle so we need to load -the whole file first. The function accepts a string representing -a filename or a file handle.</p> ---ldx]]-- +-- We cannot load an LPEG from a filehandle so we need to load the whole file first. +-- The function accepts a string representing a filename or a file handle. function xml.load(filename,settings) local data = "" @@ -1382,10 +1351,8 @@ function xml.load(filename,settings) end end ---[[ldx-- -<p>When we inject new elements, we need to convert strings to -valid trees, which is what the next function does.</p> ---ldx]]-- +-- When we inject new elements, we need to convert strings to valid trees, which is +-- what the next function does. local no_root = { no_root = true } @@ -1398,11 +1365,9 @@ function xml.toxml(data) end end ---[[ldx-- -<p>For copying a tree we use a dedicated function instead of the -generic table copier. Since we know what we're dealing with we -can speed up things a bit. The second argument is not to be used!</p> ---ldx]]-- +-- For copying a tree we use a dedicated function instead of the generic table +-- copier. Since we know what we're dealing with we can speed up things a bit. The +-- second argument is not to be used! -- local function copy(old) -- if old then @@ -1466,13 +1431,10 @@ end xml.copy = copy ---[[ldx-- -<p>In <l n='context'/> serializing the tree or parts of the tree is a major -actitivity which is why the following function is pretty optimized resulting -in a few more lines of code than needed. The variant that uses the formatting -function for all components is about 15% slower than the concatinating -alternative.</p> ---ldx]]-- +-- In ConTeXt serializing the tree or parts of the tree is a major actitivity which +-- is why the following function is pretty optimized resulting in a few more lines +-- of code than needed. The variant that uses the formatting function for all +-- components is about 15% slower than the concatinating alternative. -- todo: add <?xml version='1.0' standalone='yes'?> when not present @@ -1490,10 +1452,8 @@ function xml.checkbom(root) -- can be made faster end end ---[[ldx-- -<p>At the cost of some 25% runtime overhead you can first convert the tree to a string -and then handle the lot.</p> ---ldx]]-- +-- At the cost of some 25% runtime overhead you can first convert the tree to a +-- string and then handle the lot. -- new experimental reorganized serialize @@ -1711,21 +1671,18 @@ newhandlers { } } ---[[ldx-- -<p>How you deal with saving data depends on your preferences. For a 40 MB database -file the timing on a 2.3 Core Duo are as follows (time in seconds):</p> - -<lines> -1.3 : load data from file to string -6.1 : convert string into tree -5.3 : saving in file using xmlsave -6.8 : converting to string using xml.tostring -3.6 : saving converted string in file -</lines> -<p>Beware, these were timing with the old routine but measurements will not be that -much different I guess.</p> ---ldx]]-- +-- How you deal with saving data depends on your preferences. For a 40 MB database +-- file the timing on a 2.3 Core Duo are as follows (time in seconds): +-- +-- 1.3 : load data from file to string +-- 6.1 : convert string into tree +-- 5.3 : saving in file using xmlsave +-- 6.8 : converting to string using xml.tostring +-- 3.6 : saving converted string in file +-- +-- Beware, these were timing with the old routine but measurements will not be that +-- much different I guess. -- maybe this will move to lxml-xml @@ -1827,10 +1784,8 @@ xml.newhandlers = newhandlers xml.serialize = serialize xml.tostring = xmltostring ---[[ldx-- -<p>The next function operated on the content only and needs a handle function -that accepts a string.</p> ---ldx]]-- +-- The next function operated on the content only and needs a handle function that +-- accepts a string. local function xmlstring(e,handle) if not handle or (e.special and e.tg ~= "@rt@") then @@ -1849,9 +1804,7 @@ end xml.string = xmlstring ---[[ldx-- -<p>A few helpers:</p> ---ldx]]-- +-- A few helpers: --~ xmlsetproperty(root,"settings",settings) @@ -1899,11 +1852,9 @@ function xml.name(root) end end ---[[ldx-- -<p>The next helper erases an element but keeps the table as it is, -and since empty strings are not serialized (effectively) it does -not harm. Copying the table would take more time. Usage:</p> ---ldx]]-- +-- The next helper erases an element but keeps the table as it is, and since empty +-- strings are not serialized (effectively) it does not harm. Copying the table +-- would take more time. function xml.erase(dt,k) if dt then @@ -1915,13 +1866,9 @@ function xml.erase(dt,k) end end ---[[ldx-- -<p>The next helper assigns a tree (or string). Usage:</p> - -<typing> -dt[k] = xml.assign(root) or xml.assign(dt,k,root) -</typing> ---ldx]]-- +-- The next helper assigns a tree (or string). Usage: +-- +-- dt[k] = xml.assign(root) or xml.assign(dt,k,root) function xml.assign(dt,k,root) if dt and k then @@ -1932,15 +1879,10 @@ function xml.assign(dt,k,root) end end --- the following helpers may move - ---[[ldx-- -<p>The next helper assigns a tree (or string). Usage:</p> -<typing> -xml.tocdata(e) -xml.tocdata(e,"error") -</typing> ---ldx]]-- +-- The next helper assigns a tree (or string). Usage: +-- +-- xml.tocdata(e) +-- xml.tocdata(e,"error") function xml.tocdata(e,wrapper) -- a few more in the aux module local whatever = type(e) == "table" and xmltostring(e.dt) or e or "" diff --git a/Master/texmf-dist/tex/context/base/mkiv/math-def.mkiv b/Master/texmf-dist/tex/context/base/mkiv/math-def.mkiv index 901f075d348..14da40a4a7c 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/math-def.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/math-def.mkiv @@ -47,6 +47,9 @@ \definemathcommand [deg] [nolop] {\mfunctionlabeltext{deg}} \definemathcommand [det] [limop] {\mfunctionlabeltext{det}} \definemathcommand [dim] [nolop] {\mfunctionlabeltext{dim}} +%definemathcommand [erf] [nolop] {\mfunctionlabeltext{erf}} +%definemathcommand [erfc] [nolop] {\mfunctionlabeltext{erfc}} +%definemathcommand [erfi] [nolop] {\mfunctionlabeltext{erfi}} \definemathcommand [exp] [nolop] {\mfunctionlabeltext{exp}} \definemathcommand [gcd] [limop] {\mfunctionlabeltext{gcd}} \definemathcommand [hom] [nolop] {\mfunctionlabeltext{hom}} diff --git a/Master/texmf-dist/tex/context/base/mkiv/math-map.lua b/Master/texmf-dist/tex/context/base/mkiv/math-map.lua index 5f93b43fc6c..153dde85291 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/math-map.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/math-map.lua @@ -7,31 +7,13 @@ if not modules then modules = { } end modules ['math-map'] = { license = "see context related readme files" } --- todo: make sparse .. if self - ---[[ldx-- -<p>Remapping mathematics alphabets.</p> ---ldx]]-- - --- oldstyle: not really mathematics but happened to be part of --- the mathematics fonts in cmr --- --- persian: we will also provide mappers for other --- scripts - --- todo: alphabets namespace --- maybe: script/scriptscript dynamic, - --- superscripped primes get unscripted ! - --- to be looked into once the fonts are ready (will become font --- goodie): --- --- (U+2202,U+1D715) : upright --- (U+2202,U+1D715) : italic --- (U+2202,U+1D715) : upright --- --- plus add them to the regular vectors below so that they honor \it etc +-- persian: we will also provide mappers for other scripts +-- todo : alphabets namespace +-- maybe : script/scriptscript dynamic, +-- check : (U+2202,U+1D715) : upright +-- (U+2202,U+1D715) : italic +-- (U+2202,U+1D715) : upright +-- add them to the regular vectors below so that they honor \it etc local type, next = type, next local merged, sortedhash = table.merged, table.sortedhash diff --git a/Master/texmf-dist/tex/context/base/mkiv/math-vfu.lua b/Master/texmf-dist/tex/context/base/mkiv/math-vfu.lua index 5fe9738a218..be1402cdf6f 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/math-vfu.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/math-vfu.lua @@ -620,8 +620,10 @@ setmetatableindex(reverse, function(t,name) end local m = mathencodings[name] local r = { } - for u, i in next, m do - r[i] = u + if type(m) == "table" then + for u, i in next, m do + r[i] = u + end end reverse[name] = r return r @@ -714,8 +716,9 @@ function vfmath.define(specification,set,goodies) local start = (trace_virtual or trace_timings) and os.clock() local okset = { } local n = 0 - for s=1,#set do - local ss = set[s] + local setlist = set.recipe or set + for s=1,#setlist do + local ss = setlist[s] local ssname = ss.name if add_optional and ss.optional then if trace_virtual then diff --git a/Master/texmf-dist/tex/context/base/mkiv/meta-fun.lua b/Master/texmf-dist/tex/context/base/mkiv/meta-fun.lua index ddbbd9a523c..aa388b0ca3b 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/meta-fun.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/meta-fun.lua @@ -13,15 +13,18 @@ local format, load, type = string.format, load, type local context = context local metapost = metapost -metapost.metafun = metapost.metafun or { } -local metafun = metapost.metafun +local metafun = metapost.metafun or { } +metapost.metafun = metafun function metafun.topath(t,connector) context("(") if #t > 0 then + if not connector then + connector = ".." + end for i=1,#t do if i > 1 then - context(connector or "..") + context(connector) end local ti = t[i] if type(ti) == "string" then @@ -39,12 +42,15 @@ end function metafun.interpolate(f,b,e,s,c) local done = false context("(") - for i=b,e,(e-b)/s do - local d = load(format("return function(x) return %s end",f)) - if d then - d = d() + local d = load(format("return function(x) return %s end",f)) + if d then + d = d() + if not c then + c = "..." + end + for i=b,e,(e-b)/s do if done then - context(c or "...") + context(c) else done = true end diff --git a/Master/texmf-dist/tex/context/base/mkiv/mlib-fio.lua b/Master/texmf-dist/tex/context/base/mkiv/mlib-fio.lua index 51c88eb2237..39a7095053c 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/mlib-fio.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/mlib-fio.lua @@ -54,8 +54,18 @@ local function validftype(ftype) end end +local remapped = { + -- We don't yet have an interface for adding more here but when needed + -- there will be one. + ["hatching.mp"] = "mp-remapped-hatching.mp", + ["boxes.mp"] = "mp-remapped-boxes.mp", + ["hatching"] = "mp-remapped-hatching.mp", + ["boxes"] = "mp-remapped-boxes.mp", +} + finders.file = function(specification,name,mode,ftype) - return resolvers.findfile(name,validftype(ftype)) + local usedname = remapped[name] or name + return resolvers.findfile(usedname,validftype(ftype)) end local function i_finder(name,mode,ftype) -- fake message for mpost.map and metafun.mpvi diff --git a/Master/texmf-dist/tex/context/base/mkiv/mlib-run.lua b/Master/texmf-dist/tex/context/base/mkiv/mlib-run.lua index 602d6f36c0d..82426668fab 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/mlib-run.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/mlib-run.lua @@ -6,28 +6,12 @@ if not modules then modules = { } end modules ['mlib-run'] = { license = "see context related readme files", } --- cmyk -> done, native --- spot -> done, but needs reworking (simpler) --- multitone -> --- shade -> partly done, todo: cm --- figure -> done --- hyperlink -> low priority, easy - --- new * run --- or --- new * execute^1 * finish - --- a*[b,c] == b + a * (c-b) - ---[[ldx-- -<p>The directional helpers and pen analysis are more or less translated from the -<l n='c'/> code. It really helps that Taco know that source so well. Taco and I spent -quite some time on speeding up the <l n='lua'/> and <l n='c'/> code. There is not -much to gain, especially if one keeps in mind that when integrated in <l n='tex'/> -only a part of the time is spent in <l n='metapost'/>. Of course an integrated -approach is way faster than an external <l n='metapost'/> and processing time -nears zero.</p> ---ldx]]-- +-- The directional helpers and pen analysis are more or less translated from the C +-- code. It really helps that Taco know that source so well. Taco and I spent quite +-- some time on speeding up the Lua and C code. There is not much to gain, +-- especially if one keeps in mind that when integrated in TeX only a part of the +-- time is spent in MetaPost. Of course an integrated approach is way faster than an +-- external MetaPost and processing time nears zero. local type, tostring, tonumber, next = type, tostring, tonumber, next local find, striplines = string.find, utilities.strings.striplines diff --git a/Master/texmf-dist/tex/context/base/mkiv/mult-low.lua b/Master/texmf-dist/tex/context/base/mkiv/mult-low.lua index 686fbfb7aba..69655ee3884 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/mult-low.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/mult-low.lua @@ -146,7 +146,7 @@ return { "startallmodes", "stopallmodes", "startnotallmodes", "stopnotallmodes", "doifallmodes", "doifelseallmodes", "doifallmodeselse", "doifnotallmodes", "startenvironment", "stopenvironment", "environment", - "startcomponent", "stopcomponent", "component", + "startcomponent", "stopcomponent", "component", "startlocalcomponent", "stoplocalcomponent", "startproduct", "stopproduct", "product", "startproject", "stopproject", "project", "starttext", "stoptext", "startnotext", "stopnotext", @@ -259,11 +259,11 @@ return { "globalsetmode", "globalresetmode", "globalsetsystemmode", "globalresetsystemmode", "booleanmodevalue", -- - "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", + "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newfloat", "newlanguage", "newfamily", "newfam", "newhelp", -- not used -- - "newinteger", "newdimension", "newgluespec", "newmugluespec", - "aliasinteger", "aliasdimension", + "newinteger", "newdimension", "newgluespec", "newmugluespec", "newposit", + "aliasinteger", "aliasdimension", "aliasposit", -- "then", "begcsname", diff --git a/Master/texmf-dist/tex/context/base/mkiv/mult-mps.lua b/Master/texmf-dist/tex/context/base/mkiv/mult-mps.lua index 008bcbb9fbf..cfa8215170f 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/mult-mps.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/mult-mps.lua @@ -127,7 +127,7 @@ return { -- "red", "green", "blue", "cyan", "magenta", "yellow", "black", "white", "background", -- - "mm", "pt", "dd", "bp", "cm", "pc", "cc", "in", "dk", + "mm", "pt", "dd", "bp", "cm", "pc", "cc", "in", "dk", "es", "ts", -- "triplet", "quadruplet", "totransform", "bymatrix", "closedcurve", "closedlines", -- diff --git a/Master/texmf-dist/tex/context/base/mkiv/mult-prm.lua b/Master/texmf-dist/tex/context/base/mkiv/mult-prm.lua index 72da8971821..37779ec57cd 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/mult-prm.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/mult-prm.lua @@ -99,6 +99,7 @@ return { "Umathcode", "Umathconnectoroverlapmin", "Umathdegreevariant", + "Umathdelimiterextendmargin", "Umathdelimiterovervariant", "Umathdelimiterpercent", "Umathdelimitershortfall", @@ -318,6 +319,7 @@ return { "currentmarks", "dbox", "defcsname", + "deferred", "detokenized", "dimensiondef", "dimexpression", @@ -333,6 +335,7 @@ return { "etoks", "etoksapp", "etokspre", + "eufactor", "everybeforepar", "everymathatom", "everytab", @@ -349,7 +352,11 @@ return { "explicitdiscretionary", "explicithyphenpenalty", "firstvalidlanguage", + "float", + "floatdef", + "floatexpr", "flushmarks", + "fontcharba", "fontcharta", "fontid", "fontmathcontrol", @@ -399,6 +406,7 @@ return { "hyphenationmin", "hyphenationmode", "ifabsdim", + "ifabsfloat", "ifabsnum", "ifarguments", "ifboolean", @@ -414,6 +422,7 @@ return { "ifdimval", "ifempty", "ifflags", + "iffloat", "ifhaschar", "ifhastok", "ifhastoks", @@ -429,6 +438,7 @@ return { "ifrelax", "iftok", "ifzerodim", + "ifzerofloat", "ifzeronum", "ignorearguments", "ignoredepthcriterium", @@ -556,7 +566,9 @@ return { "maththreshold", "mathunderline", "meaningasis", + "meaningful", "meaningfull", + "meaningles", "meaningless", "mugluespecdef", "mutable", @@ -588,6 +600,7 @@ return { "pardirection", "permanent", "pettymuskip", + "positdef", "postexhyphenchar", "posthyphenchar", "postinlinepenalty", diff --git a/Master/texmf-dist/tex/context/base/mkiv/node-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/node-ini.lua index ef7d4afed2d..ea726ff3d26 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/node-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/node-ini.lua @@ -6,50 +6,38 @@ if not modules then modules = { } end modules ['node-ini'] = { license = "see context related readme files" } ---[[ldx-- -<p>Most of the code that had accumulated here is now separated in modules.</p> ---ldx]]-- - --- I need to clean up this module as it's a bit of a mess now. The latest luatex --- has most tables but we have a few more in luametatex. Also, some are different --- between these engines. We started out with hardcoded tables, that then ended --- up as comments and are now gone (as they differ per engine anyway). +-- Most of the code that had accumulated here is now separated in modules. local next, type, tostring = next, type, tostring local gsub = string.gsub local concat, remove = table.concat, table.remove local sortedhash, sortedkeys, swapped = table.sortedhash, table.sortedkeys, table.swapped ---[[ldx-- -<p>Access to nodes is what gives <l n='luatex'/> its power. Here we implement a -few helper functions. These functions are rather optimized.</p> ---ldx]]-- - ---[[ldx-- -<p>When manipulating node lists in <l n='context'/>, we will remove nodes and -insert new ones. While node access was implemented, we did quite some experiments -in order to find out if manipulating nodes in <l n='lua'/> was feasible from the -perspective of performance.</p> - -<p>First of all, we noticed that the bottleneck is more with excessive callbacks -(some gets called very often) and the conversion from and to <l n='tex'/>'s -datastructures. However, at the <l n='lua'/> end, we found that inserting and -deleting nodes in a table could become a bottleneck.</p> - -<p>This resulted in two special situations in passing nodes back to <l n='tex'/>: -a table entry with value <type>false</type> is ignored, and when instead of a -table <type>true</type> is returned, the original table is used.</p> - -<p>Insertion is handled (at least in <l n='context'/> as follows. When we need to -insert a node at a certain position, we change the node at that position by a -dummy node, tagged <type>inline</type> which itself has_attribute the original -node and one or more new nodes. Before we pass back the list we collapse the -list. Of course collapsing could be built into the <l n='tex'/> engine, but this -is a not so natural extension.</p> - -<p>When we collapse (something that we only do when really needed), we also -ignore the empty nodes. [This is obsolete!]</p> ---ldx]]-- +-- Access to nodes is what gives LuaTeX its power. Here we implement a few helper +-- functions. These functions are rather optimized. +-- +-- When manipulating node lists in ConTeXt, we will remove nodes and insert new +-- ones. While node access was implemented, we did quite some experiments in order +-- to find out if manipulating nodes in Lua was feasible from the perspective of +-- performance. +-- +-- First of all, we noticed that the bottleneck is more with excessive callbacks +-- (some gets called very often) and the conversion from and to TeX's +-- datastructures. However, at the Lua end, we found that inserting and deleting +-- nodes in a table could become a bottleneck. +-- +-- This resulted in two special situations in passing nodes back to TeX: a table +-- entry with value 'false' is ignored, and when instead of a table 'true' is +-- returned, the original table is used. +-- +-- Insertion is handled (at least in ConTeXt as follows. When we need to insert a +-- node at a certain position, we change the node at that position by a dummy node, +-- tagged 'inline' which itself has_attribute the original node and one or more new +-- nodes. Before we pass back the list we collapse the list. Of course collapsing +-- could be built into the TeX engine, but this is a not so natural extension. + +-- When we collapse (something that we only do when really needed), we also ignore +-- the empty nodes. [This is obsolete!] -- local gf = node.direct.getfield -- local n = table.setmetatableindex("number") diff --git a/Master/texmf-dist/tex/context/base/mkiv/node-res.lua b/Master/texmf-dist/tex/context/base/mkiv/node-res.lua index 5c669f9da0e..f2c6e97e989 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/node-res.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/node-res.lua @@ -9,11 +9,6 @@ if not modules then modules = { } end modules ['node-res'] = { local type, next = type, next local gmatch, format = string.gmatch, string.format ---[[ldx-- -<p>The next function is not that much needed but in <l n='context'/> we use -for debugging <l n='luatex'/> node management.</p> ---ldx]]-- - local nodes, node = nodes, node local report_nodes = logs.reporter("nodes","housekeeping") diff --git a/Master/texmf-dist/tex/context/base/mkiv/node-tra.lua b/Master/texmf-dist/tex/context/base/mkiv/node-tra.lua index 67435f1c78f..20e354392f8 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/node-tra.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/node-tra.lua @@ -6,10 +6,8 @@ if not modules then modules = { } end modules ['node-tra'] = { license = "see context related readme files" } ---[[ldx-- -<p>This is rather experimental. We need more control and some of this -might become a runtime module instead. This module will be cleaned up!</p> ---ldx]]-- +-- Some of the code here might become a runtime module instead. This old module will +-- be cleaned up anyway! local next = next local utfchar = utf.char diff --git a/Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua b/Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua index 445085776f3..dda82874912 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua @@ -6,10 +6,8 @@ if not modules then modules = { } end modules ['pack-obj'] = { license = "see context related readme files" } ---[[ldx-- -<p>We save object references in the main utility table. jobobjects are -reusable components.</p> ---ldx]]-- +-- We save object references in the main utility table; job objects are reusable +-- components. local context = context local codeinjections = backends.codeinjections diff --git a/Master/texmf-dist/tex/context/base/mkiv/pack-rul.lua b/Master/texmf-dist/tex/context/base/mkiv/pack-rul.lua index 98117867c91..20db028ec50 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/pack-rul.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/pack-rul.lua @@ -7,10 +7,6 @@ if not modules then modules = { } end modules ['pack-rul'] = { license = "see context related readme files" } ---[[ldx-- -<p>An explanation is given in the history document <t>mk</t>.</p> ---ldx]]-- - -- we need to be careful with display math as it uses shifts -- \framed[align={lohi,middle}]{$x$} diff --git a/Master/texmf-dist/tex/context/base/mkiv/phys-dim.lua b/Master/texmf-dist/tex/context/base/mkiv/phys-dim.lua index 91803e4fdcd..fa9f3f308a0 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/phys-dim.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/phys-dim.lua @@ -452,7 +452,7 @@ local short_units = { -- I'm not sure about casing s = "second", g = "gram", n = "newton", - v = "volt", + V = "volt", t = "tonne", l = "liter", -- w = "watt", @@ -460,6 +460,12 @@ local short_units = { -- I'm not sure about casing -- a = "ampere", A = "ampere", + Ω = "ohm", + +-- C = "coulomb", -- needs checking with (c)enti +-- K = "kelvin", -- needs checking with (k)ilo +-- N = "newton", -- needs checking with (n)ewton + min = "minute", [utfchar(0x2103)] = "celsius", diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-dat.lua b/Master/texmf-dist/tex/context/base/mkiv/publ-dat.lua index 64aaaf4603e..2e5f07f05a5 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/publ-dat.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/publ-dat.lua @@ -11,12 +11,6 @@ if not modules then modules = { } end modules ['publ-dat'] = { -- todo: dataset = datasets[dataset] => current = datasets[dataset] -- todo: maybe split this file ---[[ldx-- -<p>This is a prelude to integrated bibliography support. This file just loads -bibtex files and converts them to xml so that the we access the content -in a convenient way. Actually handling the data takes place elsewhere.</p> ---ldx]]-- - if not characters then dofile(resolvers.findfile("char-utf.lua")) dofile(resolvers.findfile("char-tex.lua")) diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.lua b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.lua index 65dee0717f1..6e0520e10f4 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.lua @@ -95,14 +95,11 @@ categories.article = { "year", "subtitle", "type", "file", "journal", "volume", "number", "pages", - "doi", "note", + "doi", "issn", "note", -- APA ignores this: -- -- "month", -- - -- fields defined in jabref but presently ignored: - -- - -- "issn", }, } @@ -120,7 +117,7 @@ categories.magazine = { "subtitle", "type", "file", "number", "month", "day", - "doi", "note", + "doi", "issn", "note", }, } @@ -142,7 +139,7 @@ categories.periodical = { "subtitle", "file", "series", "volume", "number", "month", "organization", - "doi", "note", + "doi", "issn", "note", }, } @@ -157,7 +154,7 @@ categories.standard = { "author", "year", "title", "subtitle", - "doi", "note", + "doi", "isbn", "note", }, optional = { "withauthor", "translator", @@ -181,7 +178,7 @@ categories.book = { "subtitle", "type", "file", "editionset", "series", "address", - "doi", "note", + "doi", "isbn", "note", "abstract", }, } @@ -208,7 +205,7 @@ categories.inbook = { "editionset", "series", "month", "address", - "doi", "note", + "doi", "isbn", "note", }, } @@ -236,7 +233,7 @@ categories.incollection = { -- APA ignores this: "chapter", "month", "address", - "doi", "note", + "doi", "isbn", "note", }, } @@ -257,7 +254,7 @@ categories.booklet = { "year", "month", "subtitle", "type", "file", "address", - "doi", "note", + "doi", "isbn", "note", }, } @@ -281,7 +278,7 @@ categories.proceedings = { "editionset", "series", "month", "address", - "doi", "note", + "doi", "isbn", "note", }, } @@ -296,7 +293,7 @@ categories.inproceedings = { "month", "edition", "series", "address", "organization", - "doi", "note", + "doi", "isbn", "note", }, } @@ -320,7 +317,7 @@ categories.thesis = { "subtitle", "file", "month", "address", - "doi", "note", + "doi", "isbn", "note", }, } @@ -338,7 +335,7 @@ categories.mastersthesis = { "subtitle", "file", "month", "address", - "doi", "note", + "doi", "isbn", "note", }, } categories.phdthesis = categories.mastersthesis @@ -365,7 +362,7 @@ categories.techreport = { "subtitle", "file", "editionset", "month", - "doi", "note", + "doi", "isbn", "note", }, } @@ -387,7 +384,7 @@ categories.manual = { "address", "subtitle", "file", "editionset", "month", "year", - "doi", "note", + "doi", "isbn", "note", -- "abstract", }, } @@ -515,7 +512,7 @@ categories.misc = { "title", "subtitle", "file", "year", "month", "howpublished", - "doi", "note", + "doi", "isbn", "note", }, } @@ -533,7 +530,7 @@ categories.other = { optional = { "withauthor", "translator", "subtitle", "file", - "doi", "note", + "doi", "isbn", "note", }, } diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.mkvi index b4ac74258bb..b8038bd960b 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.mkvi @@ -113,6 +113,14 @@ [apa:\s!list] \definebtx + [apa:\s!list:isbn] + [apa:\s!list] + +\definebtx + [apa:\s!list:issn] + [apa:\s!list] + +\definebtx [apa:\s!list:\s!page] [apa:\s!list] [\c!separator:2={\btxcomma}, @@ -521,6 +529,14 @@ [apa:\s!cite:url] \definebtx + [apa:\s!cite:isbn] + [apa:\s!cite] + +\definebtx + [apa:\s!cite:issn] + [apa:\s!cite] + +\definebtx [apa:\s!cite:num] [apa:\s!cite] [\c!left={[}, @@ -879,6 +895,11 @@ \endgroup % which namespace? %\doif{\btxparameter{translate}}\v!yes { + % + % An option is unnecessary because the translated title + % only gets placed if the user includes a title:xx field + % for the entry - not standard for bibtex... + % \texdefinition{btx:apa:translated-title}{#title} %} \btxstopstyleandcolor @@ -1140,7 +1161,12 @@ } \btxdoif {edition} { \texdefinition{btx:apa:leftparenthesis-or-comma} - \btxflush{edition} + % the edition= field is often language-dependent + % (i.e. second, 2nd, revised, etc.) + % so we handle an optional edition:xx= field: + \btxdoifelse {edition:\mainbtxlanguage} + {\btxflush{edition:\mainbtxlanguage}} + {\btxflush{edition}} \btxspace \btxlabeltext{apa:edition} } @@ -1309,6 +1335,14 @@ \btxspace \texdefinition{btx:apa:doi} } + \btxdoif {issn} { + \btxspace + issn\colon\btxflush{issn} + } + \btxdoif {isbn} { + \btxspace + isbn\colon\btxflush{isbn} + } \texdefinition{btx:apa:note} \removeunwantedspaces \stoptexdefinition diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-aps.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-aps.mkvi index e16279222a6..f6f118ada79 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-aps.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-aps.mkvi @@ -807,6 +807,7 @@ \stoptexdefinition \starttexdefinition mutable protected btx:aps:doi-url #text + % no: \texdefinition {btx:format:goto} because different test \ifconditional\btxinteractive \btxdoifelse {doi} { \goto {#text} [url(http://dx.doi.org/\btxflush{doi})] diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-chicago.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-chicago.mkvi index 315d686129d..152891d88a0 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-chicago.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-chicago.mkvi @@ -887,11 +887,11 @@ \setmode{btx:chicago:title-placed} % we make the title active, opening "file" \btxdoifelse {file} { - \texdefinition{btx:format:inject} - {url(file:\btxflush{file})} - { - \texdefinition{btx:chicago:composed-title}{title} - } + \texdefinition{btx:format:goto} { + url(file:\btxflush{file}) + } { + \texdefinition{btx:chicago:composed-title}{title} + } } { \texdefinition{btx:chicago:composed-title}{title} } @@ -1049,8 +1049,7 @@ \starttexdefinition mutable protected btx:chicago:authoryear % we make the authoryear active, pointing to the citation - \texdefinition{btx:format:inject} - {internal(\currentbtxinternal)} + \texdefinition{btx:format:gotointernal} { \doifelsesetups{chicago:list:sameauthor} { \btxdoifelsesameasprevious {author} { @@ -1256,15 +1255,11 @@ \starttexdefinition mutable protected btx:chicago: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 @@ -1273,15 +1268,11 @@ \starttexdefinition mutable protected btx:chicago: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/Master/texmf-dist/tex/context/base/mkiv/publ-imp-cite.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-cite.mkvi index c9afdbf42dc..5336c146ef9 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-cite.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-cite.mkvi @@ -14,19 +14,9 @@ \unprotect \starttexdefinition mutable protected btx:cite:inject #content - \ifconditional\btxinteractive - \ifx\currentbtxinternal\empty - #content - \else - \goto { - #content - } [ - \s!internal(\currentbtxinternal) - ] - \fi - \else + \texdefinition{btx:format:gotointernal} { #content - \fi + } \stoptexdefinition \starttexdefinition mutable protected btx:cite:checkconcat @@ -252,33 +242,27 @@ \startsetups btx:cite:url \ifx\currentbtxfirst\empty \fastsetup{\s!btx:\s!cite:\s!empty} - \else\ifconditional\btxinteractive - \goto { + \else + \texdefinition {btx:format:goto} { + url(\currentbtxfirst) + } { \btxcitereference \hyphenatedurl{\currentbtxfirst} - } [ - url(\currentbtxfirst) - ] - \else - \btxcitereference - \hyphenatedurl{\currentbtxfirst} - \fi\fi + } + \fi \stopsetups \startsetups btx:cite:doi \ifx\currentbtxfirst\empty \fastsetup{\s!btx:\s!cite:\s!empty} - \else\ifconditional\btxinteractive - \goto { + \else + \texdefinition {btx:format:goto} { + url(http://dx.doi.org/\currentbtxfirst) + } { \btxcitereference \hyphenatedurl{doi:\currentbtxfirst} - } [ - url(http://dx.doi.org/\currentbtxfirst) - ] - \else - \btxcitereference - \hyphenatedurl{doi:\currentbtxfirst} - \fi\fi + } + \fi \stopsetups \protect diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-definitions.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-definitions.mkvi index 1e9f8ea9bb1..4b6e8d6ae46 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-definitions.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-definitions.mkvi @@ -27,36 +27,50 @@ \btxfield{short} \stopxmlsetups -\starttexdefinition mutable protected btx:format:inject #link #content +\starttexdefinition mutable protected btx:format:gotointernal #content \ifx\currentbtxinternal\empty #content + \else\ifnum\currentbtxinternal=\zerocount + #content \else\ifconditional\btxinteractive + \goto {#content} [\s!internal(\currentbtxinternal)] + \else + #content + \fi\fi\fi +\stoptexdefinition + +\starttexdefinition mutable protected btx:format:goto #link #content + \ifconditional\btxinteractive \goto {#content} [#link] \else #content - \fi\fi + \fi \stoptexdefinition \startxmlsetups btx:format:doi \edef\currentbtxfielddoi{\btxfield{doi}} \ifx\currentbtxfielddoi\empty {\tttf no-doi} - \else\ifconditional\btxinteractive - \goto{\hyphenatedurl{\currentbtxfielddoi}}[url(http://dx.doi.org/\currentbtxfielddoi)] \else - \hyphenatedurl{\currentbtxfielddoi} - \fi\fi + \texdefinition {btx:format:goto} { + url(http://dx.doi.org/\currentbtxfielddoi) + } { + \hyphenatedurl{\currentbtxfielddoi} + } + \fi \stopxmlsetups \startxmlsetups btx:format:url \edef\currentbtxfieldurl{\btxfield{url}} \ifx\currentbtxfieldurl\empty {\tttf no-url} - \else\ifconditional\btxinteractive - \goto{\hyphenatedurl{\currentbtxfieldurl}}[url(\currentbtxfieldurl)] \else - \hyphenatedurl{\currentbtxfieldurl} - \fi\fi + \texdefinition {btx:format:goto} { + url(\currentbtxfieldurl) + } { + \hyphenatedurl{\currentbtxfieldurl} + } + \fi \stopxmlsetups \startxmlsetups btx:format:year diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-list.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-list.mkvi index eec63e515c6..5b4331eed46 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-list.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-list.mkvi @@ -14,19 +14,9 @@ \unprotect \starttexdefinition mutable protected btx:list:inject:text #content - \ifconditional\btxinteractivetext - \ifx\currentbtxinternal\empty - #content - \else - \goto { - #content - } [ - \s!internal(\currentbtxinternal) - ] - \fi - \else + \texdefinition{btx:format:gotointernal} { #content - \fi + } \stoptexdefinition \startsetups \s!btx:\s!list:text @@ -40,19 +30,9 @@ \stopsetups \starttexdefinition mutable protected btx:list:inject:number #content - \ifconditional\btxinteractivenumber - \ifx\currentbtxinternal\empty - #content - \else - \goto { - #content - } [ - \s!internal(\currentbtxinternal) - ] - \fi - \else + \texdefinition{btx:format:gotointernal} { #content - \fi + } \stoptexdefinition \starttexdefinition mutable protected btx:list:helpers:concat diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-page.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-page.mkvi index 5bcfe6ea355..feec4f107a9 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-page.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-page.mkvi @@ -25,6 +25,17 @@ \fastsetup{\s!btx:\s!list:\s!page:concat} \fastsetup{\s!btx:\currentbtxspecification:\s!list:page-or-pages} \ifconditional\btxinteractivepage + \ifx\currentbtxfirstinternal\empty + \donefalse + \else\ifnum\currentbtxfirstinternal=\zerocount + \donefalse + \else + \donetrue + \fi\fi + \else + \donefalse + \fi + \ifdone \goto { \currentbtxfirstpage } [ diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/publ-ini.lua index dac0ab441d0..a7d1a6bb5a6 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/publ-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/publ-ini.lua @@ -296,7 +296,8 @@ do local checksum = nil local username = file.addsuffix(file.robustname(formatters["%s-btx-%s"](prefix,name)),"lua") if userdata and next(userdata) then - if job.passes.first then + if environment.currentrun == 1 then + -- if job.passes.first then local newdata = serialize(userdata) checksum = md5.HEX(newdata) io.savedata(username,newdata) @@ -1803,10 +1804,14 @@ do -- todo: names = { "btx" } + local function collectresult(rendering) + return structures.lists.filter(rendering.specifications) or { } + end + methods[v_force] = function (dataset,rendering,keyword) -- only for checking, can have duplicates, todo: collapse page numbers, although -- we then also needs deferred writes - local result = structures.lists.filter(rendering.specifications) or { } + local result = collectresult(rendering) local list = rendering.list local current = datasets[dataset] local luadata = current.luadata @@ -1831,7 +1836,7 @@ do -- global : if tag and not alldone[tag] and done[tag] ~= section then ... methods[v_local] = function(dataset,rendering,keyword) - local result = structures.lists.filter(rendering.specifications) or { } + local result = collectresult(rendering) local section = sections.currentid() local list = rendering.list local repeated = rendering.repeated == v_yes @@ -1903,7 +1908,7 @@ do if not dataset then return end - local rendering = renderings[dataset] + local rendering = renderings[dataset] if not rendering then return end @@ -1919,6 +1924,7 @@ do rendering.repeated = specification.repeated or v_no rendering.group = specification.group or "" rendering.specifications = specification + rendering.collected = false local filtermethod = methods[method] if not filtermethod then report_list("invalid method %a",method or "") @@ -1932,6 +1938,16 @@ do else keyword = nil end + local filename = specification.filename + if filename and filename ~= "" then + local utilitydata = job.loadother(filename) + local lists = utilitydata and utilitydata.structures.lists + if lists then + rendering.collected = lists.collected + else + return + end + end filtermethod(dataset,rendering,keyword) local list = rendering.list if list and filter ~= "" then @@ -2094,15 +2110,20 @@ do flush() end local nofranges = #ranges +local interactive = not rendering.collected for i=1,nofranges do local r = ranges[i] ctx_btxsetconcat(concatstate(i,nofranges)) local first = r[1] local last = r[2] +if interactive then ctx_btxsetfirstinternal(first[2].internal) +end ctx_btxsetfirstpage(first[1]) if last then +if interactive then ctx_btxsetlastinternal(last[2].internal) +end ctx_btxsetlastpage(last[1]) end if trace_details then @@ -2261,14 +2282,16 @@ do local list = rendering.list local li = list[i] if li then - local data = datasets[dataset] - local luadata = data.luadata - local details = data.details - local tag = li[1] - local listindex = li[2] - local n = li[3] - local entry = luadata[tag] - local detail = details[tag] + local data = datasets[dataset] + local luadata = data.luadata + local details = data.details + local tag = li[1] + local listindex = li[2] + local n = li[3] + local entry = luadata[tag] + local detail = details[tag] + -- + local interactive = not rendering.collected -- ctx_btxstartlistentry() ctx_btxsetcurrentlistentry(i) -- redundant @@ -2282,6 +2305,7 @@ do ctx_btxsettag(tag) ctx_btxsetnumber(n) -- +if interactive then local citation = citetolist[n] if citation then local references = citation.references @@ -2291,6 +2315,7 @@ do ctx_btxsetinternal(internal) end end +end end -- if language then @@ -2384,6 +2409,7 @@ do { "ignored" }, { "group" }, { "filter" }, + { "filename" }, } } } @@ -2805,6 +2831,7 @@ do -- we refer to a previous list entry bl = entry.internal end + -- no check for external (yet) ctx_btxsetinternal(bl and bl > 0 and bl or "") end local language = entry.language @@ -3255,7 +3282,7 @@ do ctx_btxsettag(tag) ctx_btxsetbacklink(currentcitation) local bl = listtocite[currentcitation] - ctx_btxsetinternal(bl and bl.references.internal or "") +-- ctx_btxsetinternal(bl and bl.references.internal or "") if first then ctx_btxsetfirst(first[key] or "") -- f_missing(first.tag)) local suffix = entry.suffix diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-ini.mkiv b/Master/texmf-dist/tex/context/base/mkiv/publ-ini.mkiv index 6e34d3ab5e5..fafefa78188 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/publ-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/publ-ini.mkiv @@ -342,7 +342,7 @@ \newtoks\t_btx_cmd \newbox \b_btx_cmd -\t_btx_cmd{\global\setbox\b_btx_cmd\hpack{\clf_btxcmdstring}} +\t_btx_cmd{\global\setbox\b_btx_cmd\hbox{\clf_btxcmdstring}} % no \hpack, otherwise prerolling --- doesn't work \let\btxcmd\btxcommand @@ -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!none + [\c!type=\s!btx,\c!location=\v!here]% [\ifx\currentbtxdataset\v!default\else\s!btxset=\currentbtxdataset,\fi% \s!btxref=\currentbtxtag,% %\ifx\currentbtxcombis \empty\else\s!btxcom={\currentbtxcombis},\fi% diff --git a/Master/texmf-dist/tex/context/base/mkiv/regi-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/regi-ini.lua index 2a3b2caafa5..460d97d5e60 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/regi-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/regi-ini.lua @@ -6,11 +6,8 @@ if not modules then modules = { } end modules ['regi-ini'] = { license = "see context related readme files" } ---[[ldx-- -<p>Regimes take care of converting the input characters into -<l n='utf'/> sequences. The conversion tables are loaded at -runtime.</p> ---ldx]]-- +-- Regimes take care of converting the input characters into UTF sequences. The +-- conversion tables are loaded at runtime. -- Todo: use regi-imp*.lua instead @@ -30,9 +27,7 @@ local sequencers = utilities.sequencers local textlineactions = resolvers.openers.helpers.textlineactions local setmetatableindex = table.setmetatableindex ---[[ldx-- -<p>We will hook regime handling code into the input methods.</p> ---ldx]]-- +-- We will hook regime handling code into the input methods. local trace_translating = false trackers.register("regimes.translating", function(v) trace_translating = v end) diff --git a/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.lua b/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.lua index 046b7864f8b..85645787109 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.lua @@ -183,7 +183,7 @@ implement { } implement { - name = "doiffieldsetelse", + name = "doifelsefieldset", arguments = "string", actions = function(name) ctx_doifelse(codeinjections.validfieldset(name)) diff --git a/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.mkvi b/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.mkvi index 6c0e97a9af0..ac5d28e9e35 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/scrn-fld.mkvi @@ -275,7 +275,7 @@ %D A few testing macros: -\def\doifelsefieldbody #tag{\clf_doifelsefield{#tag}} +\def\doifelsefieldbody #tag{\clf_doifelsefieldset{#tag}} \def\doifelsefieldcategory#tag{\clf_doifelsefieldcategory{#tag}} \let\doiffieldbodyelse \doifelsefieldbody diff --git a/Master/texmf-dist/tex/context/base/mkiv/sort-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/sort-ini.lua index 98f516c22a8..a375d705751 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/sort-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/sort-ini.lua @@ -6,49 +6,45 @@ if not modules then modules = { } end modules ['sort-ini'] = { license = "see context related readme files" } --- It took a while to get there, but with Fleetwood Mac's "Don't Stop" --- playing in the background we sort of got it done. - ---[[<p>The code here evolved from the rather old mkii approach. There -we concatinate the key and (raw) entry into a new string. Numbers and -special characters get some treatment so that they sort ok. In -addition some normalization (lowercasing, accent stripping) takes -place and again data is appended ror prepended. Eventually these -strings are sorted using a regular string sorter. The relative order -of character is dealt with by weighting them. It took a while to -figure this all out but eventually it worked ok for most languages, -given that the right datatables were provided.</p> - -<p>Here we do follow a similar approach but this time we don't append -the manipulated keys and entries but create tables for each of them -with entries being tables themselves having different properties. In -these tables characters are represented by numbers and sorting takes -place using these numbers. Strings are simplified using lowercasing -as well as shape codes. Numbers are filtered and after getting an offset -they end up at the right end of the spectrum (more clever parser will -be added some day). There are definitely more solutions to the problem -and it is a nice puzzle to solve.</p> - -<p>In the future more methods can be added, as there is practically no -limit to what goes into the tables. For that we will provide hooks.</p> - -<p>Todo: decomposition with specific order of accents, this is -relatively easy to do.</p> - -<p>Todo: investigate what standards and conventions there are and see -how they map onto this mechanism. I've learned that users can come up -with any demand so nothing here is frozen.</p> - -<p>Todo: I ran into the Unicode Collation document and noticed that -there are some similarities (like the weights) but using that method -would still demand extra code for language specifics. One option is -to use the allkeys.txt file for the uc vectors but then we would also -use the collapsed key (sq, code is now commented). In fact, we could -just hook those into the replacer code that we reun beforehand.</p> - -<p>In the future index entries will become more clever, i.e. they will -have language etc properties that then can be used.</p> -]]-- +-- It took a while to get there, but with Fleetwood Mac's "Don't Stop" playing in +-- the background we sort of got it done. +-- +-- The code here evolved from the rather old mkii approach. There we concatinate the +-- key and (raw) entry into a new string. Numbers and special characters get some +-- treatment so that they sort ok. In addition some normalization (lowercasing, +-- accent stripping) takes place and again data is appended ror prepended. +-- Eventually these strings are sorted using a regular string sorter. The relative +-- order of character is dealt with by weighting them. It took a while to figure +-- this all out but eventually it worked ok for most languages, given that the right +-- datatables were provided. +-- +-- Here we do follow a similar approach but this time we don't append the +-- manipulated keys and entries but create tables for each of them with entries +-- being tables themselves having different properties. In these tables characters +-- are represented by numbers and sorting takes place using these numbers. Strings +-- are simplified using lowercasing as well as shape codes. Numbers are filtered and +-- after getting an offset they end up at the right end of the spectrum (more clever +-- parser will be added some day). There are definitely more solutions to the +-- problem and it is a nice puzzle to solve. +-- +-- In the future more methods can be added, as there is practically no limit to what +-- goes into the tables. For that we will provide hooks. +-- +-- Todo: decomposition with specific order of accents, this is relatively easy to +-- do. +-- +-- Todo: investigate what standards and conventions there are and see how they map +-- onto this mechanism. I've learned that users can come up with any demand so +-- nothing here is frozen. +-- +-- Todo: I ran into the Unicode Collation document and noticed that there are some +-- similarities (like the weights) but using that method would still demand extra +-- code for language specifics. One option is to use the allkeys.txt file for the uc +-- vectors but then we would also use the collapsed key (sq, code is now commented). +-- In fact, we could just hook those into the replacer code that we reun beforehand. +-- +-- In the future index entries will become more clever, i.e. they will have language +-- etc properties that then can be used. local gsub, find, rep, sub, sort, concat, tohash, format = string.gsub, string.find, string.rep, string.sub, table.sort, table.concat, table.tohash, string.format local utfbyte, utfchar, utfcharacters = utf.byte, utf.char, utf.characters diff --git a/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf b/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf Binary files differindex c073662c578..d4b423224f5 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf +++ b/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf diff --git a/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf b/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf Binary files differindex 5bced88ec0d..ee377dae779 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf +++ b/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf diff --git a/Master/texmf-dist/tex/context/base/mkiv/syst-con.lua b/Master/texmf-dist/tex/context/base/mkiv/syst-con.lua index 6a11fa8d3c6..f0ea8546a2e 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/syst-con.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/syst-con.lua @@ -20,10 +20,9 @@ local implement = interfaces.implement local formatters = string.formatters ---[[ldx-- -<p>For raw 8 bit characters, the offset is 0x110000 (bottom of plane 18) at -the top of <l n='luatex'/>'s char range but outside the unicode range.</p> ---ldx]]-- +-- For raw 8 bit characters, the offset is 0x110000 (bottom of plane 18) at the top +-- of LuaTeX's char range but outside the unicode range. This is no longer the case +-- in LuaMetaTeX. function converters.hexstringtonumber(n) tonumber(n,16) end function converters.octstringtonumber(n) tonumber(n, 8) end diff --git a/Master/texmf-dist/tex/context/base/mkiv/syst-ini.mkiv b/Master/texmf-dist/tex/context/base/mkiv/syst-ini.mkiv index ae1978eb6d7..5f226958bcf 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/syst-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/syst-ini.mkiv @@ -253,6 +253,9 @@ \let\newfam\newfamily +\let\newinteger \newcount % just in case +\let\newdimension\newdimen % just in case + \firstvalidlanguage\plusone % Watch out, for the moment we disable the check for already being defined diff --git a/Master/texmf-dist/tex/context/base/mkiv/tabl-tbl.mkiv b/Master/texmf-dist/tex/context/base/mkiv/tabl-tbl.mkiv index 2ed104adf38..8b6afb9563e 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/tabl-tbl.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/tabl-tbl.mkiv @@ -1551,7 +1551,8 @@ \fi} \def\tabl_tabulate_vrule_reset_indeed - {\dofastloopcs\c_tabl_tabulate_max_vrulecolumn\tabl_tabulate_vrule_reset_step + {\gletcsname\??tabulatevrule0\endcsname\undefined + \dofastloopcs\c_tabl_tabulate_max_vrulecolumn\tabl_tabulate_vrule_reset_step \global\c_tabl_tabulate_max_vrulecolumn\zerocount} \def\tabl_tabulate_vrule_reset_step % undefined or relax diff --git a/Master/texmf-dist/tex/context/base/mkiv/toks-scn.mkiv b/Master/texmf-dist/tex/context/base/mkiv/toks-scn.mkiv index 12abf0cb85f..0fdb9cca650 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/toks-scn.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/toks-scn.mkiv @@ -18,9 +18,6 @@ \registerctxluafile{toks-scn}{} \registerctxluafile{cldf-scn}{} \registerctxluafile{cldf-stp}{} - -\ifcase \contextlmtxmode \else - \registerctxluafile{cldf-lmt}{} -\fi +%registerctxluafile{cldf-lmt}{} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mkiv/trac-lmx.lua b/Master/texmf-dist/tex/context/base/mkiv/trac-lmx.lua index a531a76d671..56522e1e782 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/trac-lmx.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/trac-lmx.lua @@ -6,7 +6,8 @@ if not modules then modules = { } end modules ['trac-lmx'] = { license = "see context related readme files" } --- this one will be adpated to the latest helpers +-- This one will be adpated to the latest helpers. It might even become a +-- module instead. local type, tostring, rawget, loadstring, pcall = type, tostring, rawget, loadstring, pcall local format, sub, gsub = string.format, string.sub, string.gsub diff --git a/Master/texmf-dist/tex/context/base/mkiv/typo-duc.lua b/Master/texmf-dist/tex/context/base/mkiv/typo-duc.lua index 614defeb687..2f00fa038ec 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/typo-duc.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/typo-duc.lua @@ -599,23 +599,23 @@ local function resolve_weak(list,size,start,limit,orderbefore,orderafter) else -- only more efficient when we have es/cs local runner = start + 2 if runner <= limit then - local before = list[start] - local entry = list[start + 1] - local after = list[runner] + local before = list[start] + local current = list[start + 1] + local after = list[runner] while after do - local direction = entry.direction + local direction = current.direction if direction == "es" then if before.direction == "en" and after.direction == "en" then - entry.direction = "en" + current.direction = "en" end elseif direction == "cs" then local prevdirection = before.direction if prevdirection == "en" then if after.direction == "en" then - entry.direction = "en" + current.direction = "en" end elseif prevdirection == "an" and after.direction == "an" then - entry.direction = "an" + current.direction = "an" end end before = current diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-dim.lua b/Master/texmf-dist/tex/context/base/mkiv/util-dim.lua index bb9eca96688..6462f3e4920 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/util-dim.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/util-dim.lua @@ -6,14 +6,10 @@ if not modules then modules = { } end modules ['util-dim'] = { license = "see context related readme files" } ---[[ldx-- -<p>Internally <l n='luatex'/> work with scaled point, which are -represented by integers. However, in practice, at east at the -<l n='tex'/> end we work with more generic units like points (pt). Going -from scaled points (numbers) to one of those units can be -done by using the conversion factors collected in the following -table.</p> ---ldx]]-- +-- Internally LuaTeX work with scaled point, which are represented by integers. +-- However, in practice, at east at the TeX end we work with more generic units like +-- points (pt). Going from scaled points (numbers) to one of those units can be done +-- by using the conversion factors collected in the following table. local format, match, gsub, type, setmetatable = string.format, string.match, string.gsub, type, setmetatable local P, S, R, Cc, C, lpegmatch = lpeg.P, lpeg.S, lpeg.R, lpeg.Cc, lpeg.C, lpeg.match @@ -45,7 +41,9 @@ local dimenfactors = allocate { ["dd"] = ( 1157/ 1238)/65536, ["cc"] = ( 1157/14856)/65536, -- ["nd"] = (20320/21681)/65536, - -- ["nc"] = ( 5080/65043)/65536 + -- ["nc"] = ( 5080/65043)/65536, + ["es"] = ( 9176/ 129)/65536, + ["ts"] = ( 4588/ 645)/65536, } -- print(table.serialize(dimenfactors)) @@ -86,10 +84,8 @@ local dimenfactors = allocate { -- ["sp"]=1, -- } ---[[ldx-- -<p>A conversion function that takes a number, unit (string) and optional -format (string) is implemented using this table.</p> ---ldx]]-- +-- A conversion function that takes a number, unit (string) and optional format +-- (string) is implemented using this table. local f_none = formatters["%s%s"] local f_true = formatters["%0.5F%s"] @@ -110,9 +106,7 @@ local function numbertodimen(n,unit,fmt) -- will be redefined later ! end end ---[[ldx-- -<p>We collect a bunch of converters in the <type>number</type> namespace.</p> ---ldx]]-- +-- We collect a bunch of converters in the 'number' namespace. number.maxdimen = 1073741823 number.todimen = numbertodimen @@ -122,7 +116,7 @@ function number.topoints (n,fmt) return numbertodimen(n,"pt",fmt) end function number.toinches (n,fmt) return numbertodimen(n,"in",fmt) end function number.tocentimeters (n,fmt) return numbertodimen(n,"cm",fmt) end function number.tomillimeters (n,fmt) return numbertodimen(n,"mm",fmt) end -function number.toscaledpoints(n,fmt) return numbertodimen(n,"sp",fmt) end +-------- number.toscaledpoints(n,fmt) return numbertodimen(n,"sp",fmt) end function number.toscaledpoints(n) return n .. "sp" end function number.tobasepoints (n,fmt) return numbertodimen(n,"bp",fmt) end function number.topicas (n,fmt) return numbertodimen(n "pc",fmt) end @@ -130,14 +124,13 @@ function number.todidots (n,fmt) return numbertodimen(n,"dd",fmt) end function number.tociceros (n,fmt) return numbertodimen(n,"cc",fmt) end -------- number.tonewdidots (n,fmt) return numbertodimen(n,"nd",fmt) end -------- number.tonewciceros (n,fmt) return numbertodimen(n,"nc",fmt) end +function number.toediths (n,fmt) return numbertodimen(n,"es",fmt) end +function number.totoves (n,fmt) return numbertodimen(n,"ts",fmt) end ---[[ldx-- -<p>More interesting it to implement a (sort of) dimen datatype, one -that permits calculations too. First we define a function that -converts a string to scaledpoints. We use <l n='lpeg'/>. We capture -a number and optionally a unit. When no unit is given a constant -capture takes place.</p> ---ldx]]-- +-- More interesting it to implement a (sort of) dimen datatype, one that permits +-- calculations too. First we define a function that converts a string to +-- scaledpoints. We use LPEG. We capture a number and optionally a unit. When no +-- unit is given a constant capture takes place. local amount = (S("+-")^0 * R("09")^0 * P(".")^0 * R("09")^0) + Cc("0") local unit = R("az")^1 + P("%") @@ -152,21 +145,16 @@ function number.splitdimen(str) return lpegmatch(splitter,str) end ---[[ldx-- -<p>We use a metatable to intercept errors. When no key is found in -the table with factors, the metatable will be consulted for an -alternative index function.</p> ---ldx]]-- +-- We use a metatable to intercept errors. When no key is found in the table with +-- factors, the metatable will be consulted for an alternative index function. setmetatableindex(dimenfactors, function(t,s) -- error("wrong dimension: " .. (s or "?")) -- better a message return false end) ---[[ldx-- -<p>We redefine the following function later on, so we comment it -here (which saves us bytecodes.</p> ---ldx]]-- +-- We redefine the following function later on, so we comment it here (which saves +-- us bytecodes. -- function string.todimen(str) -- if type(str) == "number" then @@ -182,44 +170,38 @@ here (which saves us bytecodes.</p> local stringtodimen -- assigned later (commenting saves bytecode) local amount = S("+-")^0 * R("09")^0 * S(".,")^0 * R("09")^0 -local unit = P("pt") + P("cm") + P("mm") + P("sp") + P("bp") + P("in") + - P("pc") + P("dd") + P("cc") + P("nd") + P("nc") +local unit = P("pt") + P("cm") + P("mm") + P("sp") + P("bp") + + P("es") + P("ts") + P("pc") + P("dd") + P("cc") + + P("in") + -- + P("nd") + P("nc") local validdimen = amount * unit lpeg.patterns.validdimen = validdimen ---[[ldx-- -<p>This converter accepts calls like:</p> - -<typing> -string.todimen("10") -string.todimen(".10") -string.todimen("10.0") -string.todimen("10.0pt") -string.todimen("10pt") -string.todimen("10.0pt") -</typing> - -<p>With this in place, we can now implement a proper datatype for dimensions, one -that permits us to do this:</p> - -<typing> -s = dimen "10pt" + dimen "20pt" + dimen "200pt" - - dimen "100sp" / 10 + "20pt" + "0pt" -</typing> - -<p>We create a local metatable for this new type:</p> ---ldx]]-- +-- This converter accepts calls like: +-- +-- string.todimen("10") +-- string.todimen(".10") +-- string.todimen("10.0") +-- string.todimen("10.0pt") +-- string.todimen("10pt") +-- string.todimen("10.0pt") +-- +-- With this in place, we can now implement a proper datatype for dimensions, one +-- that permits us to do this: +-- +-- s = dimen "10pt" + dimen "20pt" + dimen "200pt" +-- - dimen "100sp" / 10 + "20pt" + "0pt" +-- +-- We create a local metatable for this new type: local dimensions = { } ---[[ldx-- -<p>The main (and globally) visible representation of a dimen is defined next: it is -a one-element table. The unit that is returned from the match is normally a number -(one of the previously defined factors) but we also accept functions. Later we will -see why. This function is redefined later.</p> ---ldx]]-- +-- The main (and globally) visible representation of a dimen is defined next: it is +-- a one-element table. The unit that is returned from the match is normally a +-- number (one of the previously defined factors) but we also accept functions. +-- Later we will see why. This function is redefined later. -- function dimen(a) -- if a then @@ -241,11 +223,9 @@ see why. This function is redefined later.</p> -- end -- end ---[[ldx-- -<p>This function return a small hash with a metatable attached. It is -through this metatable that we can do the calculations. We could have -shared some of the code but for reasons of speed we don't.</p> ---ldx]]-- +-- This function return a small hash with a metatable attached. It is through this +-- metatable that we can do the calculations. We could have shared some of the code +-- but for reasons of speed we don't. function dimensions.__add(a, b) local ta, tb = type(a), type(b) @@ -281,20 +261,16 @@ function dimensions.__unm(a) return setmetatable({ - a }, dimensions) end ---[[ldx-- -<p>It makes no sense to implement the power and modulo function but -the next two do make sense because they permits is code like:</p> - -<typing> -local a, b = dimen "10pt", dimen "11pt" -... -if a > b then - ... -end -</typing> ---ldx]]-- - --- makes no sense: dimensions.__pow and dimensions.__mod +-- It makes no sense to implement the power and modulo function but +-- the next two do make sense because they permits is code like: +-- +-- local a, b = dimen "10pt", dimen "11pt" +-- ... +-- if a > b then +-- ... +-- end +-- +-- This also makes no sense: dimensions.__pow and dimensions.__mod. function dimensions.__lt(a, b) return a[1] < b[1] @@ -304,24 +280,17 @@ function dimensions.__eq(a, b) return a[1] == b[1] end ---[[ldx-- -<p>We also need to provide a function for conversion to string (so that -we can print dimensions). We print them as points, just like <l n='tex'/>.</p> ---ldx]]-- +-- We also need to provide a function for conversion to string (so that we can print +-- dimensions). We print them as points, just like TeX. function dimensions.__tostring(a) return a[1]/65536 .. "pt" -- instead of todimen(a[1]) end ---[[ldx-- -<p>Since it does not take much code, we also provide a way to access -a few accessors</p> - -<typing> -print(dimen().pt) -print(dimen().sp) -</typing> ---ldx]]-- +-- Since it does not take much code, we also provide a way to access a few accessors +-- +-- print(dimen().pt) +-- print(dimen().sp) function dimensions.__index(tab,key) local d = dimenfactors[key] @@ -332,41 +301,34 @@ function dimensions.__index(tab,key) return 1/d end ---[[ldx-- -<p>In the converter from string to dimension we support functions as -factors. This is because in <l n='tex'/> we have a few more units: -<type>ex</type> and <type>em</type>. These are not constant factors but -depend on the current font. They are not defined by default, but need -an explicit function call. This is because at the moment that this code -is loaded, the relevant tables that hold the functions needed may not -yet be available.</p> ---ldx]]-- - - dimenfactors["ex"] = 4 * 1/65536 -- 4pt - dimenfactors["em"] = 10 * 1/65536 -- 10pt --- dimenfactors["%"] = 4 * 1/65536 -- 400pt/100 - ---[[ldx-- -<p>The previous code is rather efficient (also thanks to <l n='lpeg'/>) but we -can speed it up by caching converted dimensions. On my machine (2008) the following -loop takes about 25.5 seconds.</p> - -<typing> -for i=1,1000000 do - local s = dimen "10pt" + dimen "20pt" + dimen "200pt" - - dimen "100sp" / 10 + "20pt" + "0pt" -end -</typing> - -<p>When we cache converted strings this becomes 16.3 seconds. In order not -to waste too much memory on it, we tag the values of the cache as being -week which mean that the garbage collector will collect them in a next -sweep. This means that in most cases the speed up is mostly affecting the -current couple of calculations and as such the speed penalty is small.</p> - -<p>We redefine two previous defined functions that can benefit from -this:</p> ---ldx]]-- +-- In the converter from string to dimension we support functions as factors. This +-- is because in TeX we have a few more units: 'ex' and 'em'. These are not constant +-- factors but depend on the current font. They are not defined by default, but need +-- an explicit function call. This is because at the moment that this code is +-- loaded, the relevant tables that hold the functions needed may not yet be +-- available. + + dimenfactors["ex"] = 4 /65536 -- 4pt + dimenfactors["em"] = 10 /65536 -- 10pt +-- dimenfactors["%"] = 4 /65536 -- 400pt/100 + dimenfactors["eu"] = (9176/129)/65536 -- 1es + +-- The previous code is rather efficient (also thanks to LPEG) but we can speed it +-- up by caching converted dimensions. On my machine (2008) the following loop takes +-- about 25.5 seconds. +-- +-- for i=1,1000000 do +-- local s = dimen "10pt" + dimen "20pt" + dimen "200pt" +-- - dimen "100sp" / 10 + "20pt" + "0pt" +-- end +-- +-- When we cache converted strings this becomes 16.3 seconds. In order not to waste +-- too much memory on it, we tag the values of the cache as being week which mean +-- that the garbage collector will collect them in a next sweep. This means that in +-- most cases the speed up is mostly affecting the current couple of calculations +-- and as such the speed penalty is small. +-- +-- We redefine two previous defined functions that can benefit from this: local known = { } setmetatable(known, { __mode = "v" }) @@ -436,14 +398,10 @@ function number.toscaled(d) return format("%0.5f",d/0x10000) -- 2^16 end ---[[ldx-- -<p>In a similar fashion we can define a glue datatype. In that case we -probably use a hash instead of a one-element table.</p> ---ldx]]-- - ---[[ldx-- -<p>Goodie:s</p> ---ldx]]-- +-- In a similar fashion we can define a glue datatype. In that case we probably use +-- a hash instead of a one-element table. +-- +-- A goodie: function number.percent(n,d) -- will be cleaned up once luatex 0.30 is out d = d or texget("hsize") diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-fmt.lua b/Master/texmf-dist/tex/context/base/mkiv/util-fmt.lua index fe80c64201e..4da4ef985cc 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/util-fmt.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/util-fmt.lua @@ -11,7 +11,7 @@ utilities.formatters = utilities.formatters or { } local formatters = utilities.formatters local concat, format = table.concat, string.format -local tostring, type = tostring, type +local tostring, type, unpack = tostring, type, unpack local strip = string.strip local lpegmatch = lpeg.match @@ -21,12 +21,15 @@ function formatters.stripzeros(str) return lpegmatch(stripper,str) end -function formatters.formatcolumns(result,between) +function formatters.formatcolumns(result,between,header) if result and #result > 0 then - between = between or " " - local widths, numbers = { }, { } - local first = result[1] - local n = #first + local widths = { } + local numbers = { } + local templates = { } + local first = result[1] + local n = #first + between = between or " " + -- for i=1,n do widths[i] = 0 end @@ -35,13 +38,6 @@ function formatters.formatcolumns(result,between) for j=1,n do local rj = r[j] local tj = type(rj) --- if tj == "number" then --- numbers[j] = true --- end --- if tj ~= "string" then --- rj = tostring(rj) --- r[j] = rj --- end if tj == "number" then numbers[j] = true rj = tostring(rj) @@ -55,29 +51,59 @@ function formatters.formatcolumns(result,between) end end end + if header then + for i=1,#header do + local h = header[i] + for j=1,n do + local hj = tostring(h[j]) + h[j] = hj + local w = #hj + if w > widths[j] then + widths[j] = w + end + end + end + end for i=1,n do local w = widths[i] if numbers[i] then if w > 80 then - widths[i] = "%s" .. between - else - widths[i] = "%0" .. w .. "i" .. between + templates[i] = "%s" .. between + else + templates[i] = "% " .. w .. "i" .. between end else if w > 80 then - widths[i] = "%s" .. between - elseif w > 0 then - widths[i] = "%-" .. w .. "s" .. between + templates[i] = "%s" .. between + elseif w > 0 then + templates[i] = "%-" .. w .. "s" .. between else - widths[i] = "%s" + templates[i] = "%s" end end end - local template = strip(concat(widths)) + local template = strip(concat(templates)) for i=1,#result do local str = format(template,unpack(result[i])) result[i] = strip(str) end + if header then + for i=1,n do + local w = widths[i] + if w > 80 then + templates[i] = "%s" .. between + elseif w > 0 then + templates[i] = "%-" .. w .. "s" .. between + else + templates[i] = "%s" + end + end + local template = strip(concat(templates)) + for i=1,#header do + local str = format(template,unpack(header[i])) + header[i] = strip(str) + end + end end - return result + return result, header end diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-prs.lua b/Master/texmf-dist/tex/context/base/mkiv/util-prs.lua index 635b610e072..d7b7087a5ec 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/util-prs.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/util-prs.lua @@ -264,8 +264,13 @@ function parsers.groupedsplitat(symbol,withaction) if not pattern then local symbols = S(symbol) local separator = space^0 * symbols * space^0 - local value = lbrace * C((nobrace + nestedbraces)^0) * rbrace - + C((nestedbraces + (1-(space^0*(symbols+P(-1)))))^0) + local value = + lbrace + * C((nobrace + nestedbraces)^0) + -- * rbrace + * (rbrace * (#symbols + P(-1))) -- new per 2023-03-11 + + + C((nestedbraces + (1-(space^0*(symbols+P(-1)))))^0) if withaction then local withvalue = Carg(1) * value / function(f,s) return f(s) end pattern = spaces * withvalue * (separator*withvalue)^0 diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-sac.lua b/Master/texmf-dist/tex/context/base/mkiv/util-sac.lua index 36daef81673..9d2e8356da3 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/util-sac.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/util-sac.lua @@ -551,14 +551,14 @@ if bit32 and not streams.tocardinal1 then local char = string.char streams.tocardinal1 = char - function streams.tocardinal2(n) return char(extract( 8,8),extract( 0,8)) end - function streams.tocardinal3(n) return char(extract(16,8),extract( 8,8),extract(0,8)) end - function streams.tocardinal4(n) return char(extract(24,8),extract(16,8),extract(8,8),extract(0,8)) end + function streams.tocardinal2(n) return char(extract(n, 8,8),extract(n, 0,8)) end + function streams.tocardinal3(n) return char(extract(n,16,8),extract(n, 8,8),extract(n,0,8)) end + function streams.tocardinal4(n) return char(extract(n,24,8),extract(n,16,8),extract(n,8,8),extract(n,0,8)) end streams.tocardinal1le = char - function streams.tocardinal2le(n) return char(extract(0,8),extract(8,8)) end - function streams.tocardinal3le(n) return char(extract(0,8),extract(8,8),extract(16,8)) end - function streams.tocardinal4le(n) return char(extract(0,8),extract(8,8),extract(16,8),extract(24,8)) end + function streams.tocardinal2le(n) return char(extract(n,0,8),extract(n,8,8)) end + function streams.tocardinal3le(n) return char(extract(n,0,8),extract(n,8,8),extract(n,16,8)) end + function streams.tocardinal4le(n) return char(extract(n,0,8),extract(n,8,8),extract(n,16,8),extract(n,24,8)) end end diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua b/Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua index 066ca30237e..65f6703ae36 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua @@ -394,7 +394,7 @@ local runners = { if trace then report("resultof: %s",command) end - local handle = iopopen(command,"r") -- already has flush + local handle = iopopen(command,"rb") -- already has flush if handle then local result = handle:read("*all") or "" handle:close() diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-seq.lua b/Master/texmf-dist/tex/context/base/mkiv/util-seq.lua index 35839f2302c..49952dd98d5 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/util-seq.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/util-seq.lua @@ -6,15 +6,13 @@ if not modules then modules = { } end modules ['util-seq'] = { license = "see context related readme files" } ---[[ldx-- -<p>Here we implement a mechanism for chaining the special functions -that we use in <l n="context"> to deal with mode list processing. We -assume that namespaces for the functions are used, but for speed we -use locals to refer to them when compiling the chain.</p> ---ldx]]-- - +-- Here we implement a mechanism for chaining the special functions that we use in +-- ConteXt to deal with mode list processing. We assume that namespaces for the +-- functions are used, but for speed we use locals to refer to them when compiling +-- the chain. +-- -- todo: delayed: i.e. we register them in the right order already but delay usage - +-- -- todo: protect groups (as in tasks) local gsub, gmatch = string.gsub, string.gmatch diff --git a/Master/texmf-dist/tex/context/base/mkxl/anch-box.mkxl b/Master/texmf-dist/tex/context/base/mkxl/anch-box.mkxl index d480b221483..e1ab5662c90 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/anch-box.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/anch-box.mkxl @@ -32,6 +32,11 @@ linecolor=\namedboxanchorcontentparameter{#1}{\c!rulecolor}, #2} +\mutable\lettonothing\boxanchorone +\mutable\lettonothing\boxanchortwo +\mutable\lettonothing\boxanchorposone +\mutable\lettonothing\boxanchorpostwo + \tolerant\permanent\protected\def\connectboxanchors[#1]#*[#2]#*[#3]#*[#4]#*#:#5#6% {\begingroup % diff --git a/Master/texmf-dist/tex/context/base/mkxl/attr-eff.lmt b/Master/texmf-dist/tex/context/base/mkxl/attr-eff.lmt new file mode 100644 index 00000000000..d04408fb970 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/attr-eff.lmt @@ -0,0 +1,134 @@ +if not modules then modules = { } end modules ['attr-eff'] = { + version = 1.001, + comment = "companion to attr-eff.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local attributes, nodes, backends, utilities = attributes, nodes, backends, utilities +local tex = tex + +local states = attributes.states +local enableaction = nodes.tasks.enableaction +local nodeinjections = backends.nodeinjections +local texsetattribute = tex.setattribute +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex +local formatters = string.formatters + +local interfaces = interfaces +local implement = interfaces.implement + +local variables = interfaces.variables +local v_normal = variables.normal + +attributes.effects = attributes.effects or { } +local effects = attributes.effects + +local a_effect = attributes.private('effect') + +effects.data = allocate() +effects.values = effects.values or { } +effects.registered = effects.registered or { } +effects.attribute = a_effect + +local data = effects.data +local registered = effects.registered +local values = effects.values + +local f_stamp = formatters["%s:%s:%s"] + +storage.register("attributes/effects/registered", registered, "attributes.effects.registered") +storage.register("attributes/effects/values", values, "attributes.effects.values") + +-- valid effects: normal inner outer both hidden (stretch,rulethickness,effect) + +local function effect(...) effect = nodeinjections.effect return effect(...) end + +local function extender(effects,key) + if key == "none" then + local d = effect(0,0,0) + effects.none = d + return d + end +end + +local function reviver(data,n) + local e = values[n] -- we could nil values[n] now but hardly needed + local d = effect(e[1],e[2],e[3]) + data[n] = d + return d +end + +setmetatableindex(effects, extender) +setmetatableindex(effects.data, reviver) + +effects.handler = nodes.installattributehandler { + name = "effect", + namespace = effects, + initializer = states.initialize, + finalizer = states.finalize, + processor = states.process, +} + +local function register(specification) + local alternative, stretch, rulethickness + if specification then + alternative = specification.alternative or v_normal + stretch = specification.stretch or 0 + rulethickness = specification.rulethickness or 0 + else + alternative = v_normal + stretch = 0 + rulethickness = 0 + end + local stamp = f_stamp(alternative,stretch,rulethickness) + local n = registered[stamp] + if not n then + n = #values + 1 + values[n] = { alternative, stretch, rulethickness } + registered[stamp] = n + end + return n +end + +local enabled = false + +local function enable() + if not enabled then + enableaction("shipouts","attributes.effects.handler") + enabled = true + end +end + +effects.register = register +effects.enable = enable + +-- interface + +implement { + name = "seteffect", + actions = function(specification) + if not enabled then + enable() + end + texsetattribute(a_effect,register(specification)) + end, + arguments = { + { + { "alternative", "string" }, + { "stretch", "integer" }, + { "rulethickness", "dimen" } + } + } +} + +implement { + name = "reseteffect", + actions = function() + if enabled then + texsetattribute(a_effect,register()) + end + end +} diff --git a/Master/texmf-dist/tex/context/base/mkxl/attr-eff.mkxl b/Master/texmf-dist/tex/context/base/mkxl/attr-eff.mkxl index 42aadf9a278..5a50ab60cdc 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/attr-eff.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/attr-eff.mkxl @@ -13,7 +13,7 @@ \writestatus{loading}{ConTeXt Attribute Macros / Effects} -\registerctxluafile{attr-eff}{} +\registerctxluafile{attr-eff}{autosuffix} \unprotect @@ -22,7 +22,7 @@ \installcommandhandler \??effect {effect} \??effect \setupeffect - [\c!method=\v!none, + [\c!method=\v!none, % should become command or define or so \c!stretch=\zerocount, \c!rulethickness=\zeropoint, \c!alternative=\v!normal] diff --git a/Master/texmf-dist/tex/context/base/mkxl/attr-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/attr-ini.lmt index 8b2ec89119b..32fc36cdd87 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/attr-ini.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/attr-ini.lmt @@ -10,10 +10,8 @@ local next, type = next, type local osexit = os.exit local sortedhash = table.sortedhash ---[[ldx-- -<p>We start with a registration system for atributes so that we can use the -symbolic names later on.</p> ---ldx]]-- +-- We start with a registration system for atributes so that we can use the symbolic +-- names later on. local nodes = nodes local context = context @@ -71,17 +69,13 @@ trackers.register("attributes.values", function(v) trace_values = v end) -- end -- end ---[[ldx-- -<p>We reserve this one as we really want it to be always set (faster).</p> ---ldx]]-- +-- We reserve this one as we really want it to be always set (faster). names[0], numbers["fontdynamic"] = "fontdynamic", 0 ---[[ldx-- -<p>private attributes are used by the system and public ones are for users. We use dedicated -ranges of numbers for them. Of course a the <l n='context'/> end a private attribute can be -accessible too, so a private attribute can have a public appearance.</p> ---ldx]]-- +-- Private attributes are used by the system and public ones are for users. We use +-- dedicated ranges of numbers for them. Of course a the TeX end a private attribute +-- can be accessible too, so a private attribute can have a public appearance. sharedstorage.attributes_last_private = sharedstorage.attributes_last_private or 15 -- very private sharedstorage.attributes_last_public = sharedstorage.attributes_last_public or 1024 -- less private diff --git a/Master/texmf-dist/tex/context/base/mkxl/attr-mkr.lmt b/Master/texmf-dist/tex/context/base/mkxl/attr-mkr.lmt new file mode 100644 index 00000000000..10550d93504 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/attr-mkr.lmt @@ -0,0 +1,40 @@ +if not modules then modules = { } end modules ['attr-mkr'] = { + version = 1.001, + comment = "companion to attr-mkr.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local markers = nodes.markers or { } +nodes.markers = markers + +local cache = { } +local numbers = attributes.numbers +local a_unknown = attributes.private("marker:unknown") + +local nuts = nodes.nuts +local tonut = nodes.tonut +local setattr = nuts.setattr +local getattr = nuts.getattr + +table.setmetatableindex(cache,function(t,k) + local k = "marker:" .. k + local v = numbers[k] or a_unknown + t[k] = v + return v +end) + +function markers.get(n,name) + local a = cache[name] + if a then + getattr(tonut(n),a) + end +end + +function markers.set(n,name,v) + local a = cache[name] + if a then + setattr(tonut(n),a,v) + end +end diff --git a/Master/texmf-dist/tex/context/base/mkxl/attr-mkr.mkxl b/Master/texmf-dist/tex/context/base/mkxl/attr-mkr.mkxl index 2209af24157..24e0a23193c 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/attr-mkr.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/attr-mkr.mkxl @@ -15,11 +15,12 @@ \unprotect -\registerctxluafile{attr-mkr}{} +\registerctxluafile{attr-mkr}{autosuffix} \permanent \protected\def\definemarker [#1]{\defineattribute[\s!marker:#1]} \permanent\tolerant\protected\def\setmarker [#1]#*[#2]{\dosetattribute{\s!marker:#1}{#2}} \permanent \protected\def\resetmarker [#1]{\dogetattribute{\s!marker:#1}} -\permanent \def\boxmarker #1#2{attr \numexpr\dogetattributeid{\s!marker:#1}\numexpr \numexpr#2\relax} +\permanent \def\boxmarker #1#2{attr \numexpr\dogetattributeid{\s!marker:#1}\relax \numexpr#2\relax} +\permanent \protected\def\marker #1{\numexpr\dogetattributeid{\s!marker:#1}\relax} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mkxl/attr-neg.lmt b/Master/texmf-dist/tex/context/base/mkxl/attr-neg.lmt new file mode 100644 index 00000000000..4739b736d82 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/attr-neg.lmt @@ -0,0 +1,104 @@ +if not modules then modules = { } end modules ['attr-neg'] = { + version = 1.001, + comment = "companion to attr-neg.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- this module is being reconstructed and code will move to other places +-- we can also do the nsnone via a metatable and then also se index 0 + +local format = string.format + +local attributes, nodes, utilities, logs, backends = attributes, nodes, utilities, logs, backends +local commands, context, interfaces = commands, context, interfaces +local tex = tex + +local states = attributes.states +local enableaction = nodes.tasks.enableaction +local nodeinjections = backends.nodeinjections +local texsetattribute = tex.setattribute +local variables = interfaces.variables +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex + +--- negative / positive + +attributes.negatives = attributes.negatives or { } +local negatives = attributes.negatives + +local a_negative = attributes.private("negative") + +local v_none = interfaces.variables.none + +negatives.data = allocate() +negatives.attribute = a_negative + +negatives.registered = allocate { + [variables.positive] = 1, + [variables.negative] = 2, +} + +local data = negatives.data +local registered = negatives.registered + +local function extender(negatives,key) + if key == "none" then -- v_none then + local d = data[1] + negatives.none = d + return d + end +end + +local function reviver(data,n) + if n == 1 then + local d = nodeinjections.positive() -- called once + data[1] = d + return d + elseif n == 2 then + local d = nodeinjections.negative() -- called once + data[2] = d + return d + end +end + +setmetatableindex(negatives, extender) +setmetatableindex(negatives.data, reviver) + +negatives.handler = nodes.installattributehandler { + name = "negative", + namespace = negatives, + initializer = states.initialize, + finalizer = states.finalize, + processor = states.process, +} + +local function register(stamp) + return registered[stamp] or registered.positive +end + +local function enable() + enableaction("shipouts","attributes.negatives.handler") +end + +negatives.register = register +negatives.enable = enable + +-- interface + +local enabled = false + +function negatives.set(stamp) + if not enabled then + enable() + enabled = true + end + texsetattribute(a_negative,register(stamp)) +end + +interfaces.implement { + name = "setnegative", + actions = negatives.set, + arguments = "argument", +} diff --git a/Master/texmf-dist/tex/context/base/mkxl/attr-neg.mkxl b/Master/texmf-dist/tex/context/base/mkxl/attr-neg.mkxl index c849e6bf6db..869ac0b2e55 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/attr-neg.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/attr-neg.mkxl @@ -13,16 +13,19 @@ \writestatus{loading}{ConTeXt Attribute Macros / Negation} -\registerctxluafile{attr-neg}{} +\registerctxluafile{attr-neg}{autosuffix} \unprotect +%D This feature is kind of useless because only \ACROBAT\ seems to support it and +%D even rather complete mupdf based viewers seem to ignore it. + % positive and negative are preregistered -\permanent\protected\def\startnegative{\clf_setnegative{\v!negative}} -\permanent\protected\def\stopnegative {\clf_setnegative{\v!positive}} +\permanent\protected\def\startnegative{\clf_setnegative\v!negative} +\permanent\protected\def\stopnegative {\clf_setnegative\v!positive} -\permanent\protected\def\startpositive{\clf_setnegative{\v!positive}} -\permanent\protected\def\stoppositive {\clf_setnegative{\v!negative}} +\permanent\protected\def\startpositive{\clf_setnegative\v!positive} +\permanent\protected\def\stoppositive {\clf_setnegative\v!negative} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mkxl/catc-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/catc-ini.mkxl index d8c4da04060..4a473b47691 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/catc-ini.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/catc-ini.mkxl @@ -236,8 +236,10 @@ %\letcsname\Uchar"FFFF\Uchar\expandafter`\string#1\endcsname\m_active \letcsname\csactive#1\endcsname\m_active} +\mutable\integerdef\c_active_char_code\zerocount + \permanent\protected\def\pushactivecharcode{\afterassignment\syst_active_push\integerdef\c_active_char_code} -\permanent\protected\def\popactivecharcode {\afterassignment\syst_active_pop\integerdef \c_active_char_code} +\permanent\protected\def\popactivecharcode {\afterassignment\syst_active_pop \integerdef\c_active_char_code} \permanent\protected\def\syst_active_push {\expandafter\let\expandafter\m_active\csname\csactive\Uchar\c_active_char_code\endcsname diff --git a/Master/texmf-dist/tex/context/base/mkxl/char-tex.lmt b/Master/texmf-dist/tex/context/base/mkxl/char-tex.lmt index 0e0297381bf..0ac297d599b 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/char-tex.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/char-tex.lmt @@ -23,6 +23,8 @@ local mark = utilities.storage.mark local context = context local commands = commands +if not characters then require("char-ini") require("char-utf") end + local characters = characters local texcharacters = { } characters.tex = texcharacters @@ -44,17 +46,14 @@ local trace_defining = false trackers.register("characters.defining", fu local report_defining = logs.reporter("characters") ---[[ldx-- -<p>In order to deal with 8-bit output, we need to find a way to go from <l n='utf'/> to -8-bit. This is handled in the <l n='luatex'/> engine itself.</p> - -<p>This leaves us problems with characters that are specific to <l n='tex'/> like -<type>{}</type>, <type>$</type> and alike. We can remap some chars that tex input files -are sensitive for to a private area (while writing to a utility file) and revert then -to their original slot when we read in such a file. Instead of reverting, we can (when -we resolve characters to glyphs) map them to their right glyph there. For this purpose -we can use the private planes 0x0F0000 and 0x100000.</p> ---ldx]]-- +-- In order to deal with 8-bit output, we need to find a way to go from UTF to +-- 8-bit. This is handled in the 32 bit engine itself. This leaves us problems with +-- characters that are specific to TeX, like curly braces and dollars. We can remap +-- some chars that tex input files are sensitive for to a private area (while +-- writing to a utility file) and revert then to their original slot when we read in +-- such a file. Instead of reverting, we can (when we resolve characters to glyphs) +-- map them to their right glyph there. For this purpose we can use the private +-- planes 0x0F0000 and 0x100000. local low = allocate() local high = allocate() @@ -104,21 +103,6 @@ private.escape = utf.remapper(escapes) -- maybe: ,"dynamic" private.replace = utf.remapper(low) -- maybe: ,"dynamic" private.revert = utf.remapper(high) -- maybe: ,"dynamic" ---[[ldx-- -<p>We get a more efficient variant of this when we integrate -replacements in collapser. This more or less renders the previous -private code redundant. The following code is equivalent but the -first snippet uses the relocated dollars.</p> - -<typing> -[x] [$x$] -</typing> ---ldx]]-- - --- using the tree-lpeg-mapper would be nice but we also need to deal with end-of-string --- cases: "\"\i" and don't want "\relax" to be seen as \r e lax" (for which we need to mess --- with spaces - local accentmapping = allocate { ['"'] = { [""] = "¨", A = "Ä", a = "ä", @@ -286,12 +270,12 @@ local commandmapping = allocate { texcharacters.commandmapping = commandmapping -local ligaturemapping = allocate { - ["''"] = "”", - ["``"] = "“", - ["--"] = "–", - ["---"] = "—", -} +-- local ligaturemapping = allocate { +-- ["''"] = "”", +-- ["``"] = "“", +-- ["--"] = "–", +-- ["---"] = "—", +-- } -- Older accent handling code can be found in char-def.lua but in the meantime -- we moved on. First the one with commands: @@ -319,9 +303,9 @@ local function toutfpattern() hash["{\\"..k.."}"] = v hash["{\\"..k.." }"] = v end - for k, v in next, ligaturemapping do - hash[k] = v - end + -- for k, v in next, ligaturemapping do + -- hash[k] = v + -- end untex = utfchartabletopattern(hash) / hash end return untex @@ -374,9 +358,9 @@ local function toutfpattern() for k, v in next, commandmapping do hash[k] = v end - for k, v in next, ligaturemapping do - hash[k] = v - end + -- for k, v in next, ligaturemapping do + -- hash[k] = v + -- end untex = utfchartabletopattern(hash) / hash end return untex @@ -401,7 +385,7 @@ if not interfaces then return end local implement = interfaces.implement -local pattern +local pattern1, pattern2 local verbosemarks = characters.verbosemarks @@ -418,6 +402,7 @@ else ["grave"] = utfchar(0x300), ["acute"] = utfchar(0x301), ["circumflex"] = utfchar(0x302), + ["circumflex"] = utfchar(0x302), ["tilde"] = utfchar(0x303), ["macron"] = utfchar(0x304), ["line"] = utfchar(0x304), ["overline"] = utfchar(0x305), @@ -442,6 +427,7 @@ else ["macron below"] = utfchar(0x331), ["line below"] = utfchar(0x331), ["hook below"] = utfchar(0x1FA9D), + } characters.verbosemarks = verbosemarks @@ -452,48 +438,68 @@ else end -local function prepare() - pattern = Cs((utfchartabletopattern(verbosemarks) / verbosemarks + lpegpatterns.space/"" + lpegpatterns.utf8character)^0) - return pattern +local function prepare1() + pattern1 = Cs( + ( +P("\\")/"" * (utfchartabletopattern(commandmapping) / commandmapping) * (P(" ")/"") ++ utfchartabletopattern(verbosemarks) / verbosemarks + + lpegpatterns.space/"" + + lpegpatterns.utf8character + )^0 + ) + return pattern1 +end + +local function prepare2() + local back = { + ["ı"] = "i", + ["ȷ"] = "j", + } + pattern2 = Cs( + ( + utfchartabletopattern(back) / back + + lpegpatterns.utf8character + )^0 + ) + return pattern2 end local hash = table.setmetatableindex(function(t,k) - local f = "" - k = lpegmatch(pattern or prepare(),k) or k + local f = k + k = lpegmatch(pattern1 or prepare1(),k) or k + k = lpegmatch(pattern2 or prepare2(),k) or k local v = collapse(k) or k -- char specials --- print("collapse",k,v) if k ~= v then goto DONE end v = combine(k) or k -- with specials --- print("combine",k,v) if k ~= v then goto DONE end v = commandmapping[k] or k --- print("command",k,v) if k ~= v then - f = "\\" + f = "\\" .. f goto DONE end v = textoutf(k) or k --- print("utf",k,v) if k ~= v then - f = "\\" + f = "\\" .. f goto DONE end ::DONE:: - report_defining("instead of old school '%s%s' you can input the utf sequence %s",f,k,v) + report_defining("instead of old school '%s' you can input the utf sequence %s",f,v) t[k] = v return v end) implement { name = "chr", - arguments = "argument", + -- arguments = "argument", -- not here + arguments = "string", public = true, actions = function(str) - context(hash[str]) -- expandable + local hsh = hash[str] + context(hsh) -- expandable end } @@ -556,10 +562,8 @@ implement { -- a waste of scanner but consistent actions = texcharacters.defineaccents } ---[[ldx-- -<p>Instead of using a <l n='tex'/> file to define the named glyphs, we -use the table. After all, we have this information available anyway.</p> ---ldx]]-- +-- Instead of using a TeX file to define the named glyphs, we use the table. After +-- all, we have this information available anyway. local function to_number(s) local n = tonumber(s) @@ -854,10 +858,6 @@ function characters.setactivecatcodes(cct) tex.catcodetable = saved end ---[[ldx-- -<p>Setting the lccodes is also done in a loop over the data table.</p> ---ldx]]-- - implement { name = "chardescription", arguments = "integer", diff --git a/Master/texmf-dist/tex/context/base/mkxl/cldf-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/cldf-ini.mkxl index 0c5788bb291..b9620ff1c0a 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/cldf-ini.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/cldf-ini.mkxl @@ -1,5 +1,5 @@ %D \module -%D [ file=cldf-int, +%D [ file=cldf-ini, %D version=2019.01.01, %D title=\CONTEXT\ Data Macros, %D subtitle=Integer, diff --git a/Master/texmf-dist/tex/context/base/mkxl/cldf-lmt.lmt b/Master/texmf-dist/tex/context/base/mkxl/cldf-lmt.lmt index aba3dacdaa5..1eb80ac602b 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/cldf-lmt.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/cldf-lmt.lmt @@ -1008,6 +1008,7 @@ do return integer_code, code[n] else local v = scaninteger(true) + -- local v = scancardinal(true) -- if isglobal(what) then if what and (tonumber(what) & global_code) then setsparse(code,"global",n,v) diff --git a/Master/texmf-dist/tex/context/base/mkxl/cldf-pos.lmt b/Master/texmf-dist/tex/context/base/mkxl/cldf-pos.lmt new file mode 100644 index 00000000000..9378b01be8c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/cldf-pos.lmt @@ -0,0 +1,187 @@ +if not modules then modules = { } end modules ['cldf-pos'] = { + version = 1.001, + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- https://cse512-19s.github.io/FP-Well-Rounded/ + +local tostring, load, type, tonumber = tostring, load, type, tonumber +local lpegmatch = lpeg.match +local context = context + +local setmetatableindex = table.setmetatableindex + +local implement = interfaces.implement + +local fromposit = posit.fromposit +local toposit = posit.toposit +local posittonumber = posit.tonumber + +local values = tokens.values +local boolean_code = values.boolean +local float_code = values.float + +local scanners = tokens.scanners +local scanposit = scanners.posit +local scanfloat = scanners.float +local scaninteger = scanners.integer +local scancsname = scanners.csname + +do -- these are only for testing and might go to a module eventually + + local codes = tex.codes + + local global_code = tex.flagcodes.global + + local savelua = token.savelua + ----- isdefined = token.isdefined + + local newsparse = sparse.new + local setsparse = sparse.set + ----- wipesparse = sparse.wipe + local restoresparse = sparse.restore + + local registerfunction = context.functions.register + + implement { + name = "positunumdef", + public = true, + untraced = true, + protected = true, + actions = function(what) + local name = scancsname(true) + local code = newsparse() + local restore = registerfunction(function() restoresparse(code) end) + implement { + name = name, + public = true, + protected = true, + usage = "value", + actions = function(what) + local n = scaninteger() + if what == "value" then + local v = fromposit(code[n]) + -- return float_code, v + context("%.99g",v) + else + local v = toposit(scanfloat()) + if what and (tonumber(what) & global_code) then + setsparse(code,"global",n,v) + else + savelua(restore,true) -- only once + setsparse(code,n,v) + end + end + end, + } + codes[name] = code + end, + } + + do + + local p_number = lpeg.patterns.number + local p = lpeg.Cs( + lpeg.Cc("local new = new ; return ") + * ( + lpeg.C(p_number) / function(s) + return "new(" .. s .. ")" + end + + lpeg.P(1) + )^0 + ) + + local t = setmetatableindex({ new = posit.new }, posit) + + local function calculate(s) + local new = lpegmatch(p,s) + new = load(new,nil,nil,t) + if new then + new = new() + if new then + return new + end + end + return old + end + + implement { + name = "positunum", + public = true, + arguments = "string", + actions = function(s) + local r = calculate(s) + local t = type(r) + if t == "boolean" then + context(tostring(r)) + elseif t == "string" then + context(r) + else + context("%N",posittonumber(r)) + end + end + } + + implement { + name = "ifpositunum", + public = true, + usage = "condition", + arguments = "string", + actions = function(s) + return boolean_code, calculate(s) and true or false + end, + } + + end + +end + +do + + local xsin = xmath.sin local xasin = xmath.asin local xsinh = xmath.sinh local xasinh = xmath.asinh + local xcos = xmath.cos local xacos = xmath.acos local xcosh = xmath.cosh local xacosh = xmath.acosh + local xtan = xmath.tan local xatan = xmath.atan local xtanh = xmath.tanh local xatanh = xmath.atanh + + local xsqrt = xmath.sqrt + local xlog = xmath.log + local xexp = xmath.exp + local xpow = xmath.pow + local xceil = xmath.ceil + local xfloor = xmath.floor + local xround = xmath.round + local xabs = xmath.fabs + local xmod = xmath.fmod + local xrem = xmath.remainder + local xrad = xmath.rad + local xdeg = xmath.deg + local xatan2 = xmath.atan2 + + implement { name = "pfsin", public = true, usage = "value", actions = function() return float_code, xsin (scanposit(true)) end } + implement { name = "pfcos", public = true, usage = "value", actions = function() return float_code, xcos (scanposit(true)) end } + implement { name = "pftan", public = true, usage = "value", actions = function() return float_code, xtan (scanposit(true)) end } + implement { name = "pfasin", public = true, usage = "value", actions = function() return float_code, xasin (scanposit(true)) end } + implement { name = "pfacos", public = true, usage = "value", actions = function() return float_code, xacos (scanposit(true)) end } + implement { name = "pfatan", public = true, usage = "value", actions = function() return float_code, xatan (scanposit(true)) end } + implement { name = "pfsinh", public = true, usage = "value", actions = function() return float_code, xsinh (scanposit(true)) end } + implement { name = "pfcosh", public = true, usage = "value", actions = function() return float_code, xcosh (scanposit(true)) end } + implement { name = "pftanh", public = true, usage = "value", actions = function() return float_code, xtanh (scanposit(true)) end } + implement { name = "pfasinh", public = true, usage = "value", actions = function() return float_code, xasinh(scanposit(true)) end } + implement { name = "pfacosh", public = true, usage = "value", actions = function() return float_code, xacosh(scanposit(true)) end } + implement { name = "pfatanh", public = true, usage = "value", actions = function() return float_code, xatanh(scanposit(true)) end } + implement { name = "pfsqrt", public = true, usage = "value", actions = function() return float_code, xsqrt (scanposit(true)) end } + implement { name = "pflog", public = true, usage = "value", actions = function() return float_code, xlog (scanposit(true)) end } + implement { name = "pfexp", public = true, usage = "value", actions = function() return float_code, xexp (scanposit(true)) end } + implement { name = "pfceil", public = true, usage = "value", actions = function() return float_code, xceil (scanposit(true)) end } + implement { name = "pffloor", public = true, usage = "value", actions = function() return float_code, xfloor(scanposit(true)) end } + implement { name = "pfround", public = true, usage = "value", actions = function() return float_code, xround(scanposit(true)) end } + implement { name = "pfabs", public = true, usage = "value", actions = function() return float_code, xabs (scanposit(true)) end } + implement { name = "pfrad", public = true, usage = "value", actions = function() return float_code, xrad (scanposit(true)) end } + implement { name = "pfdeg", public = true, usage = "value", actions = function() return float_code, xdeg (scanposit(true)) end } + implement { name = "pfatantwo", public = true, usage = "value", actions = function() return float_code, xatan2(scanposit(true),scanposit(true)) end } + implement { name = "pfpow", public = true, usage = "value", actions = function() return float_code, xpow (scanposit(true),scanposit(true)) end } + implement { name = "pfmod", public = true, usage = "value", actions = function() return float_code, xmod (scanposit(true),scanposit(true)) end } + implement { name = "pfrem", public = true, usage = "value", actions = function() return float_code, xrem (scanposit(true),scanposit(true)) end } + +end diff --git a/Master/texmf-dist/tex/context/base/mkxl/cldf-pos.mkxl b/Master/texmf-dist/tex/context/base/mkxl/cldf-pos.mkxl new file mode 100644 index 00000000000..fb419d07061 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/cldf-pos.mkxl @@ -0,0 +1,36 @@ +%D \module +%D [ file=cldf-pos, +%D version=2023.04.21, +%D title=\CONTEXT\ Data Macros, +%D subtitle=Posit, +%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. + +\writestatus{loading}{ConTeXt Posit Numbers / Initialization} + +\registerctxluafile{cldf-pos}{autosuffix} + +\newposit\pfpi \pfpi 3.1415926535897932384626433832795028841971 +\newposit\pftwopi \pftwopi \floatexpr \pfpi * 2 \relax + +% \newfloat\fooA +% +% \scratchdimen=123.456pt\relax [\type{dim:} \the\scratchdimen==123.456pt]\par +% \fooA =123.456\relax [\type{pos:} \the\fooA ==123.456] \par +% \fooA =\scratchdimen\relax [\type{pos:} \the\fooA ==123.456] \par +% \scratchdimen=\fooA\relax [\type{dim:} \the\scratchdimen==123.456pt]\par +% \scratchdimen\dimexpr\fooA+10pt\relax[\type{dim:} \the\scratchdimen==133.456pt]\par +% +% \fooA\pfsin \pfpi [\the\fooA]\par +% \fooA\pfcos \pfpi [\the\fooA]\par +% \fooA\pfsqrt\pfpi [\the\fooA]\par +% \fooA\pfexp \pfpi [\the\fooA]\par +% \fooA\pflog \pfpi [\the\fooA]\par +% \fooA\pfpow \pfpi 2 [\the\fooA]\par + +\endinput diff --git a/Master/texmf-dist/tex/context/base/mkxl/cont-new.mkxl b/Master/texmf-dist/tex/context/base/mkxl/cont-new.mkxl index ef7c4071708..030a373aa14 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/cont-new.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2023.03.10 12:15} +\newcontextversion{2023.05.05 18:36} %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/Master/texmf-dist/tex/context/base/mkxl/context.mkxl b/Master/texmf-dist/tex/context/base/mkxl/context.mkxl index cfea2b9ba29..4cfa730914c 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/context.mkxl +++ b/Master/texmf-dist/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.03.10 12:15} +\immutable\edef\contextversion{2023.05.05 18:36} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error @@ -104,6 +104,7 @@ \loadmkxlfile{luat-ini} \loadmkxlfile{toks-scn} +\loadmkxlfile{cldf-pos} \loadmkxlfile{syst-aux} \loadmkxlfile{syst-lua} @@ -162,7 +163,7 @@ \loadmkxlfile{node-fin} \loadmkxlfile{node-mig} -%loadmkxlfile{node-pag} +\loadmkxlfile{node-pag} \loadmkxlfile{driv-ini} % after node-ini (ext) @@ -215,8 +216,9 @@ \loadmkxlfile{unic-ini} -\loadmkxlfile{core-two} +%loadmkxlfile{core-two} % retired, not in testsuite, not on garden, not in styles \loadmkxlfile{core-dat} +\loadmkxlfile{core-pag} \loadmkxlfile{colo-ini} \loadmkxlfile{colo-nod} @@ -647,30 +649,26 @@ % we will definitely freeze mkiv and then use lmt files for futher development % of lmtx. We also no longer use the macro feature to replace 5.3 compatible % function calls by native 5.4 features as lmt files assume 5.4 anyway. This -% makes format generation a little faster (not that it's that slow). It might \ +% makes format generation a little faster (not that it's that slow). It might % take a while before we dealt with all of them because I'll also clean them -% up a bit when doing. +% up a bit when doing. Some will probably always be shared, like char-def.lua. % -% % luat-bas.mkxl l-macro-imp-optimize % this will go away - -% c:/data/develop/context/sources/attr-eff.lua -% c:/data/develop/context/sources/attr-mkr.lua -% c:/data/develop/context/sources/attr-neg.lua - -% c:/data/develop/context/sources/buff-imp-default.lua -% c:/data/develop/context/sources/buff-imp-escaped.lua -% c:/data/develop/context/sources/buff-imp-lua.lua -% c:/data/develop/context/sources/buff-imp-mp.lua -% c:/data/develop/context/sources/buff-imp-nested.lua -% c:/data/develop/context/sources/buff-imp-parsed-xml.lua -% c:/data/develop/context/sources/buff-imp-tex.lua -% c:/data/develop/context/sources/buff-imp-xml.lua +% % luat-bas.mkxl l-macro-imp-optimize % this is no longer used % c:/data/develop/context/sources/buff-par.lua % c:/data/develop/context/sources/buff-ver.lua +% +% c:/data/develop/context/sources/buff-imp-default.lua % shared +% c:/data/develop/context/sources/buff-imp-escaped.lua % shared +% c:/data/develop/context/sources/buff-imp-lua.lua % shared +% c:/data/develop/context/sources/buff-imp-mp.lua % shared +% c:/data/develop/context/sources/buff-imp-nested.lua % shared +% c:/data/develop/context/sources/buff-imp-parsed-xml.lua % shared +% c:/data/develop/context/sources/buff-imp-tex.lua % shared +% c:/data/develop/context/sources/buff-imp-xml.lua % shared % c:/data/develop/context/sources/char-cjk.lua -% c:/data/develop/context/sources/char-def.lua +% c:/data/develop/context/sources/char-def.lua % shared data file, a real big one % c:/data/develop/context/sources/char-enc.lua % c:/data/develop/context/sources/char-ent.lua % c:/data/develop/context/sources/char-fio.lua @@ -684,7 +682,7 @@ % c:/data/develop/context/sources/cldf-com.lua % c:/data/develop/context/sources/cldf-ini.lua -% c:/data/develop/context/sources/cldf-prs.lua % use in chemistry +% c:/data/develop/context/sources/cldf-prs.lua % used in chemistry % c:/data/develop/context/sources/cldf-scn.lua % c:/data/develop/context/sources/cldf-stp.lua % c:/data/develop/context/sources/cldf-ver.lua @@ -694,8 +692,6 @@ % c:/data/develop/context/sources/core-con.lua % c:/data/develop/context/sources/core-ctx.lua -% c:/data/develop/context/sources/core-dat.lua -% c:/data/develop/context/sources/core-two.lua % data... @@ -704,7 +700,7 @@ % c:/data/develop/context/sources/file-res.lua % c:/data/develop/context/sources/font-afk.lua -% c:/data/develop/context/sources/font-agl.lua +% c:/data/develop/context/sources/font-agl.lua % shared data file % c:/data/develop/context/sources/font-aux.lua % c:/data/develop/context/sources/font-cid.lua % c:/data/develop/context/sources/font-enc.lua @@ -728,16 +724,16 @@ % c:/data/develop/context/sources/font-trt.lua % c:/data/develop/context/sources/font-web.lua % proof of concept, never used -% c:/data/develop/context/sources/font-imp-combining.lua % shared, like typescript -% c:/data/develop/context/sources/font-imp-dimensions.lua % idem -% c:/data/develop/context/sources/font-imp-italics.lua % idem -% c:/data/develop/context/sources/font-imp-notused.lua % idem -% c:/data/develop/context/sources/font-imp-properties.lua % idem -% c:/data/develop/context/sources/font-imp-reorder.lua % idem -% c:/data/develop/context/sources/font-imp-spacekerns.lua % idem -% c:/data/develop/context/sources/font-imp-tex.lua % idem -% c:/data/develop/context/sources/font-imp-tweaks.lua % idem -% c:/data/develop/context/sources/font-imp-unicode.lua % idem +% c:/data/develop/context/sources/font-imp-combining.lua % shared +% c:/data/develop/context/sources/font-imp-dimensions.lua % shared +% c:/data/develop/context/sources/font-imp-italics.lua % shared +% c:/data/develop/context/sources/font-imp-notused.lua % shared +% c:/data/develop/context/sources/font-imp-properties.lua % shared +% c:/data/develop/context/sources/font-imp-reorder.lua % shared +% c:/data/develop/context/sources/font-imp-spacekerns.lua % shared +% c:/data/develop/context/sources/font-imp-tex.lua % shared +% c:/data/develop/context/sources/font-imp-tweaks.lua % shared +% c:/data/develop/context/sources/font-imp-unicode.lua % shared % c:/data/develop/context/sources/good-ctx.lua % c:/data/develop/context/sources/good-ini.lua @@ -753,26 +749,26 @@ % c:/data/develop/context/sources/java-ini.lua -% c:/data/develop/context/sources/lang-cnt.lua -% c:/data/develop/context/sources/lang-def.lua % these are data files -% c:/data/develop/context/sources/lang-txt.lua % these are data files +% c:/data/develop/context/sources/lang-cnt.lua % shared data file +% c:/data/develop/context/sources/lang-def.lua % shared data file +% c:/data/develop/context/sources/lang-txt.lua % shared data file % c:/data/develop/context/sources/lang-wrd.lua % c:/data/develop/context/sources/luat-exe.lua % c:/data/develop/context/sources/luat-iop.lua % c:/data/develop/context/sources/luat-mac.lua % will become lmt -% c:/data/develop/context/sources/lxml-aux.lua -% c:/data/develop/context/sources/lxml-css.lua -% c:/data/develop/context/sources/lxml-dir.lua -% c:/data/develop/context/sources/lxml-ent.lua -% c:/data/develop/context/sources/lxml-ini.lua -% c:/data/develop/context/sources/lxml-lpt.lua -% c:/data/develop/context/sources/lxml-mis.lua -% c:/data/develop/context/sources/lxml-sor.lua -% c:/data/develop/context/sources/lxml-tab.lua -% c:/data/develop/context/sources/lxml-tex.lua -% c:/data/develop/context/sources/lxml-xml.lua +% c:/data/develop/context/sources/lxml-aux.lua % the xml interfcace is rather stable +% c:/data/develop/context/sources/lxml-css.lua % and is also provided/used in lua so +% c:/data/develop/context/sources/lxml-dir.lua % might as well share these because they +% c:/data/develop/context/sources/lxml-ent.lua % are unlikely to change +% c:/data/develop/context/sources/lxml-ini.lua % +% c:/data/develop/context/sources/lxml-lpt.lua % +% c:/data/develop/context/sources/lxml-mis.lua % +% c:/data/develop/context/sources/lxml-sor.lua % +% c:/data/develop/context/sources/lxml-tab.lua % +% c:/data/develop/context/sources/lxml-tex.lua % +% c:/data/develop/context/sources/lxml-xml.lua % % c:/data/develop/context/sources/meta-blb.lua % c:/data/develop/context/sources/meta-fun.lua @@ -791,19 +787,17 @@ % c:/data/develop/context/sources/page-mix.lua % c:/data/develop/context/sources/page-pst.lua -% c:/data/develop/context/sources/phys-dim.lua - % c:/data/develop/context/sources/publ-aut.lua % shared -% c:/data/develop/context/sources/publ-dat.lua -% c:/data/develop/context/sources/publ-fnd.lua -% c:/data/develop/context/sources/publ-inc.lua -% c:/data/develop/context/sources/publ-ini.lua -% c:/data/develop/context/sources/publ-jrn.lua -% c:/data/develop/context/sources/publ-oth.lua -% c:/data/develop/context/sources/publ-reg.lua -% c:/data/develop/context/sources/publ-sor.lua -% c:/data/develop/context/sources/publ-tra.lua -% c:/data/develop/context/sources/publ-usr.lua +% c:/data/develop/context/sources/publ-dat.lua % shared +% c:/data/develop/context/sources/publ-fnd.lua % shared +% c:/data/develop/context/sources/publ-inc.lua % shared +% c:/data/develop/context/sources/publ-ini.lua % shared +% c:/data/develop/context/sources/publ-jrn.lua % shared +% c:/data/develop/context/sources/publ-oth.lua % shared +% c:/data/develop/context/sources/publ-reg.lua % shared +% c:/data/develop/context/sources/publ-sor.lua % shared +% c:/data/develop/context/sources/publ-tra.lua % shared +% c:/data/develop/context/sources/publ-usr.lua % shared % c:/data/develop/context/sources/scrn-but.lua % c:/data/develop/context/sources/scrn-fld.lua @@ -834,8 +828,3 @@ % c:/data/develop/context/sources/trac-lmx.lua % c:/data/develop/context/sources/trac-par.lua % c:/data/develop/context/sources/trac-tex.lua - -% c:/data/develop/context/sources/typo-cln.lua -- wrong name for what it does -% c:/data/develop/context/sources/typo-dha.lua - -% c:/data/develop/context/sources/unic-ini.lua diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-dat.lmt b/Master/texmf-dist/tex/context/base/mkxl/core-dat.lmt new file mode 100644 index 00000000000..fd8aa0fb64a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/core-dat.lmt @@ -0,0 +1,225 @@ +if not modules then modules = { } end modules ['core-dat'] = { + version = 1.001, + comment = "companion to core-dat.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- This module provides a (multipass) container for arbitrary data. It replaces the +-- twopass data mechanism. + +local tonumber, tostring, type = tonumber, tostring, type + +local context = context + +local trace_datasets = false trackers.register("job.datasets" , function(v) trace_datasets = v end) + +local report_dataset = logs.reporter("dataset") + +local allocate = utilities.storage.allocate +local settings_to_hash = utilities.parsers.settings_to_hash + +local texgetcount = tex.getcount +local texsetcount = tex.setcount + +local v_yes = interfaces.variables.yes + +local new_latelua = nodes.pool.latelua + +local implement = interfaces.implement + +local c_realpageno = tex.iscount("realpageno") + +local collected = allocate() +local tobesaved = allocate() + +local datasets = { + collected = collected, + tobesaved = tobesaved, +} + +job.datasets = datasets + +local function initializer() + collected = datasets.collected + tobesaved = datasets.tobesaved +end + +job.register('job.datasets.collected', tobesaved, initializer, nil) + +local sets = { } + +table.setmetatableindex(tobesaved, function(t,k) + local v = { } + t[k] = v + return v +end) + +table.setmetatableindex(sets, function(t,k) + local v = { + index = 0, + order = 0, + } + t[k] = v + return v +end) + +local function setdata(settings) + local name = settings.name + local tag = settings.tag + local data = settings.data + local list = tobesaved[name] + if settings.convert and type(data) == "string" then + data = settings_to_hash(data) + end + if type(data) ~= "table" then + data = { data = data } + end + if not tag then + tag = #list + 1 + else + tag = tonumber(tag) or tag -- autonumber saves keys + end + list[tag] = data + if settings.delay == v_yes then + local set = sets[name] + local index = set.index + 1 + set.index = index + data.index = index + data.order = index + data.realpage = texgetcount(c_realpageno) + if trace_datasets then + report_dataset("action %a, name %a, tag %a, index %a","assign delayed",name,tag,index) + end + elseif trace_datasets then + report_dataset("action %a, name %a, tag %a","assign immediate",name,tag) + end + return name, tag, data +end + +datasets.setdata = setdata + +function datasets.extend(name,tag) + if type(name) == "table" then + name, tag = name.name, name.tag + end + local set = sets[name] + local order = set.order + 1 + local realpage = texgetcount(c_realpageno) + set.order = order + local t = tobesaved[name][tag] + t.realpage = realpage + t.order = order + if trace_datasets then + report_dataset("action %a, name %a, tag %a, page %a, index %a","flush by order",name,tag,t.index or 0,order,realpage) + end +end + +function datasets.getdata(name,tag,key,default) + local t = collected[name] + if t == nil then + if trace_datasets then + report_dataset("error: unknown dataset, name %a",name) + end + elseif type(t) ~= "table" then + return t + else + t = t[tag] or t[tonumber(tag)] + if not t then + if trace_datasets then + report_dataset("error: unknown dataset, name %a, tag %a",name,tag) + end + elseif key then + return t[key] or default + else + return t + end + end + return default +end + +local function setdataset(settings) + settings.convert = true + local name, tag = setdata(settings) + if settings.delay ~= v_yes then + -- + else + context(new_latelua { action = job.datasets.extend, name = name, tag = tag }) + end +end + +local cache = table.setmetatableindex(function(t,k) + local v = table.load(k..".tuc") + if v then + v = v.job + if v then + v = v.datasets + if v then + v = v.collected + end + end + end + if not v then + v = { } + if trace_datasets then + report_dataset("error: unknown dataset job %a",k) + end + end + t[k] = v + return v +end) + +local function datasetvariable(name,tag,key,cache) + local t = (cache or collected)[name] + if t == nil then + if trace_datasets then + report_dataset("error: unknown dataset, name %a, tag %a, not passed to tex",name) -- no tag + end + elseif type(t) ~= "table" then + context(tostring(t)) + else + t = t and (t[tag] or t[tonumber(tag)]) + if not t then + if trace_datasets then + report_dataset("error: unknown dataset, name %a, tag %a, not passed to tex",name,tag) + end + elseif type(t) == "table" then + local s = t[key] + if type(s) ~= "table" then + context(tostring(s)) + elseif trace_datasets then + report_dataset("error: unknown dataset, name %a, tag %a, not passed to tex",name,tag) + end + end + end +end + +local function datasetvariablefromjob(jobnname,name,tag,key) + datasetvariable(name,tag,key,cache[jobnname]) +end + +implement { + name = "setdataset", + actions = setdataset, + arguments = { + { + { "name" }, + { "tag" }, + { "delay" }, + { "data" }, + } + } +} + +implement { + name = "datasetvariable", + actions = datasetvariable, + arguments = "3 strings", +} + +implement { + name = "datasetvariablefromjob", + arguments = { "string", "string", "string", "string" }, + actions = datasetvariablefromjob +} diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-dat.mkxl b/Master/texmf-dist/tex/context/base/mkxl/core-dat.mkxl index ab40d874c1a..6d7d1bd14ae 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/core-dat.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/core-dat.mkxl @@ -1,6 +1,6 @@ %D \module %D [ file=core-dat, -%D version=20122.04.17, % replaces core-two from 1997.03.31, +%D version=2021.04.17, % replaces core-two from 1997.03.31, %D title=\CONTEXT\ Core Macros, %D subtitle=Multipass Datasets, %D author=Hans Hagen, @@ -42,7 +42,7 @@ \unprotect -\registerctxluafile{core-dat}{} +\registerctxluafile{core-dat}{autosuffix} \installcorenamespace{dataset} @@ -78,50 +78,4 @@ \expandafter\clf_datasetvariable \fi} -\installcorenamespace{pagestate} -\installcorenamespace{pagestatecounter} - -\installcommandhandler \??pagestate {pagestate} \??pagestate - -\def\syst_pagestates_allocate - {\expandafter\newinteger\csname\??pagestatecounter\currentpagestate\endcsname} - -\appendtoks - \syst_pagestates_allocate -\to \everydefinepagestate - -\setuppagestate - [\c!delay=\v!yes] - -\permanent\tolerant\protected\def\setpagestate[#1]#*[#2]% - {\begingroup - \edef\currentpagestate{#1}% - \ifcsname\??pagestatecounter\currentpagestate\endcsname - \scratchcounter\lastnamedcs - \advanceby\scratchcounter\plusone - \else - \scratchcounter\plusone - \syst_pagestates_allocate - \fi - \global\csname\??pagestatecounter\currentpagestate\endcsname\scratchcounter - \clf_setpagestate - name {\currentpagestate}% - tag {\ifparameter#2\or#2\else\number\scratchcounter\fi}% - delay {\pagestateparameter\c!delay}% - \relax - \endgroup} - -\permanent\protected\def\autosetpagestate#1% - {\setpagestate[#1]\relax} - -\permanent\def\autopagestatenumber#1{\begincsname\??pagestatecounter#1\endcsname} - -\permanent\def\pagestaterealpage #1#2{\clf_pagestaterealpage {#1}{#2}} -\permanent\def\setpagestaterealpageno#1#2{\clf_setpagestaterealpageno{#1}{#2}} -\permanent\def\pagestaterealpageorder#1#2{\clf_pagestaterealpageorder{#1}#2\relax} - -\permanent\def\autopagestaterealpage #1{\clf_pagestaterealpage {#1}{\number\autopagestatenumber{#1}}} -\permanent\def\setautopagestaterealpageno#1{\clf_setpagestaterealpageno{#1}{\number\autopagestatenumber{#1}}} -\permanent\def\autopagestaterealpageorder#1{\clf_pagestaterealpageorder{#1}\numexpr\autopagestatenumber{#1}\relax} - \protect diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-pag.lmt b/Master/texmf-dist/tex/context/base/mkxl/core-pag.lmt new file mode 100644 index 00000000000..219171d424e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/core-pag.lmt @@ -0,0 +1,160 @@ +if not modules then modules = { } end modules ['core-dat'] = { + version = 1.001, + comment = "companion to core-dat.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- This module provides a (multipass) container for arbitrary data. It replaces the +-- twopass data mechanism. + +local tonumber = tonumber + +local context = context +local ctx_latelua = context.latelua + +local trace_pagestates = false trackers.register("job.pagestates", function(v) trace_pagestates = v end) + +local report_pagestate = logs.reporter("pagestate") + +local allocate = utilities.storage.allocate + +local texgetcount = tex.getcount +local texsetcount = tex.setcount + +local new_latelua = nodes.pool.latelua + +local implement = interfaces.implement +local getnamespace = interfaces.getnamespace + +local c_realpageno = tex.iscount("realpageno") +local c_realpagestateno = tex.iscount("realpagestateno") + +local collected = allocate() +local tobesaved = allocate() + +local pagestates = { + collected = collected, + tobesaved = tobesaved, +} + +job.pagestates = pagestates + +local function initializer() + collected = pagestates.collected + tobesaved = pagestates.tobesaved +end + +job.register("job.pagestates.collected", tobesaved, initializer, nil) + +table.setmetatableindex(tobesaved, "table") + +local function setstate(settings) + local name = settings.name + local tag = settings.tag + local list = tobesaved[name] + if not tag then + tag = #list + 1 + else + tag = tonumber(tag) or tag -- autonumber saves keys + end + local realpage = texgetcount(c_realpageno) + local data = realpage + list[tag] = data + if trace_pagestates then + report_pagestate("action %a, name %a, tag %a, preset %a","set",name,tag,realpage) + end + return name, tag, data +end + +local function extend(name,tag) + local realpage = texgetcount(c_realpageno) + if trace_pagestates then + report_pagestate("action %a, name %a, tag %a, preset %a","synchronize",name,tag,realpage) + end + tobesaved[name][tag] = realpage +end + +local function realpage(name,tag,default) + local t = collected[name] + if t then + t = t[tag] or t[tonumber(tag)] + if t then + return tonumber(t or default) + elseif trace_pagestates then + report_pagestate("error: unknown dataset, name %a, tag %a",name,tag) + end + elseif trace_pagestates then + report_pagestate("error: unknown dataset, name %a, tag %a",name) -- nil + end + return default +end + +local function realpageorder(name,tag) + local t = collected[name] + if t then + local p = t[tag] + if p then + local n = 1 + for i=tag-1,1,-1 do + if t[i] == p then + n = n +1 + end + end + return n + end + end + return 0 +end + +pagestates.setstate = setstate +pagestates.extend = extend +pagestates.realpage = realpage +pagestates.realpageorder = realpageorder + +function pagestates.countervalue(name) + return name and texgetcount(getnamespace("pagestatecounter") .. name) or 0 +end + +local function setpagestate(settings) + local name, tag = setstate(settings) + -- context(new_latelua(function() extend(name,tag) end)) + ctx_latelua(function() extend(name,tag) end) +end + +local function setpagestaterealpageno(name,tag) + local t = collected[name] + t = t and (t[tag] or t[tonumber(tag)]) + texsetcount("realpagestateno",t or texgetcount(c_realpageno)) +end + +implement { + name = "setpagestate", + actions = setpagestate, + arguments = { + { + { "name" }, + { "tag" }, + { "delay" }, + } + } +} + +implement { + name = "pagestaterealpage", + actions = { realpage, context }, + arguments = "2 strings", +} + +implement { + name = "setpagestaterealpageno", + actions = setpagestaterealpageno, + arguments = "2 strings", +} + +implement { + name = "pagestaterealpageorder", + actions = { realpageorder, context }, + arguments = { "string", "integer" } +} diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-pag.mkxl b/Master/texmf-dist/tex/context/base/mkxl/core-pag.mkxl new file mode 100644 index 00000000000..43b398b16cb --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/core-pag.mkxl @@ -0,0 +1,68 @@ +%D \module +%D [ file=core-pag, +%D version=2023.03.23, % moved from core-dat +%D title=\CONTEXT\ Core Macros, +%D subtitle=Multipass Pagestate, +%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. + +\writestatus{loading}{ConTeXt Core Macros / Multipass Pagestate} + +\unprotect + +\newinteger\realpagestateno + +\registerctxluafile{core-pag}{autosuffix} + +\installcorenamespace{pagestate} +\installcorenamespace{pagestatecounter} + +\installcommandhandler \??pagestate {pagestate} \??pagestate + +\def\syst_pagestates_allocate + {\expandafter\newinteger\csname\??pagestatecounter\currentpagestate\endcsname} + +\appendtoks + \syst_pagestates_allocate +\to \everydefinepagestate + +\setuppagestate + [\c!delay=\v!yes] + +\permanent\tolerant\protected\def\setpagestate[#1]#*[#2]% + {\begingroup + \edef\currentpagestate{#1}% + \ifcsname\??pagestatecounter\currentpagestate\endcsname + \scratchcounter\lastnamedcs + \advanceby\scratchcounter\plusone + \else + \scratchcounter\plusone + \syst_pagestates_allocate + \fi + \global\csname\??pagestatecounter\currentpagestate\endcsname\scratchcounter + \clf_setpagestate + name {\currentpagestate}% + tag {\ifparameter#2\or#2\else\number\scratchcounter\fi}% + delay {\pagestateparameter\c!delay}% + \relax + \endgroup} + +\permanent\protected\def\autosetpagestate#1% + {\setpagestate[#1]\relax} + +\permanent\def\autopagestatenumber#1{\begincsname\??pagestatecounter#1\endcsname} + +\permanent\def\pagestaterealpage #1#2{\clf_pagestaterealpage {#1}{#2}} +\permanent\def\setpagestaterealpageno#1#2{\clf_setpagestaterealpageno{#1}{#2}} +\permanent\def\pagestaterealpageorder#1#2{\clf_pagestaterealpageorder{#1}#2\relax} + +\permanent\def\autopagestaterealpage #1{\clf_pagestaterealpage {#1}{\number\autopagestatenumber{#1}}} +\permanent\def\setautopagestaterealpageno#1{\clf_setpagestaterealpageno{#1}{\number\autopagestatenumber{#1}}} +\permanent\def\autopagestaterealpageorder#1{\clf_pagestaterealpageorder{#1}\numexpr\autopagestatenumber{#1}\relax} + +\protect diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-two.lmt b/Master/texmf-dist/tex/context/base/mkxl/core-two.lmt new file mode 100644 index 00000000000..7ea42374ee9 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/core-two.lmt @@ -0,0 +1,210 @@ +if not modules then modules = { } end modules ['core-two'] = { + version = 1.001, + comment = "companion to core-two.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- This is actually one of the oldest MkIV files and basically a port of MkII but +-- the old usage has long be phased out. Also, the public part is now handled by +-- datasets which makes this a more private store. + +-- local next = next +-- local remove, concat = table.remove, table.concat + +local allocate = utilities.storage.allocate + +local collected = allocate() +local tobesaved = allocate() + +local jobpasses = { + collected = collected, + tobesaved = tobesaved, +} + +job.passes = jobpasses + +local function initializer() + collected = jobpasses.collected + tobesaved = jobpasses.tobesaved +end + +job.register('job.passes.collected', tobesaved, initializer, nil) + +function jobpasses.getcollected(id) + return collected[id] or { } +end + +function jobpasses.gettobesaved(id) + local t = tobesaved[id] + if not t then + t = { } + tobesaved[id] = t + end + return t +end + +-- local function define(id) +-- local p = tobesaved[id] +-- if not p then +-- p = { } +-- tobesaved[id] = p +-- end +-- return p +-- end +-- +-- local function save(id,str,index) +-- local jti = define(id) +-- if index then +-- jti[index] = str +-- else +-- jti[#jti+1] = str +-- end +-- end +-- +-- local function savetagged(id,tag,str) +-- local jti = define(id) +-- jti[tag] = str +-- end +-- +-- local function getdata(id,index,default) +-- local jti = collected[id] +-- local value = jti and jti[index] +-- return value ~= "" and value or default or "" +-- end +-- +-- local function getfield(id,index,tag,default) +-- local jti = collected[id] +-- jti = jti and jti[index] +-- local value = jti and jti[tag] +-- return value ~= "" and value or default or "" +-- end +-- +-- local function getcollected(id) +-- return collected[id] or { } +-- end +-- +-- local function gettobesaved(id) +-- return define(id) +-- end +-- +-- local function get(id) +-- local jti = collected[id] +-- if jti and #jti > 0 then +-- return remove(jti,1) +-- end +-- end +-- +-- local function first(id) +-- local jti = collected[id] +-- return jti and jti[1] +-- end +-- +-- local function last(id) +-- local jti = collected[id] +-- return jti and jti[#jti] +-- end +-- +-- local function find(id,n) +-- local jti = collected[id] +-- return jti and jti[n] or nil +-- end +-- +-- local function count(id) +-- local jti = collected[id] +-- return jti and #jti or 0 +-- end +-- +-- local function list(id) +-- local jti = collected[id] +-- if jti then +-- return concat(jti,',') +-- end +-- end +-- +-- local function inlist(id,str) +-- local jti = collected[id] +-- if jti then +-- for _, v in next, jti do +-- if v == str then +-- return true +-- end +-- end +-- end +-- return false +-- end +-- +-- local check = first +-- +-- jobpasses.define = define +-- jobpasses.save = save +-- jobpasses.savetagged = savetagged +-- jobpasses.getdata = getdata +-- jobpasses.getfield = getfield +-- jobpasses.getcollected = getcollected +-- jobpasses.gettobesaved = gettobesaved +-- jobpasses.get = get +-- jobpasses.first = first +-- jobpasses.last = last +-- jobpasses.find = find +-- jobpasses.list = list +-- jobpasses.count = count +-- jobpasses.check = check +-- jobpasses.inlist = inlist +-- +-- -- interface +-- +-- local implement = interfaces.implement +-- +-- implement { name = "gettwopassdata", actions = { get, context }, arguments = "string" } +-- implement { name = "getfirsttwopassdata",actions = { first, context }, arguments = "string" } +-- implement { name = "getlasttwopassdata", actions = { last, context }, arguments = "string" } +-- implement { name = "findtwopassdata", actions = { find, context }, arguments = "2 strings" } +-- implement { name = "gettwopassdatalist", actions = { list, context }, arguments = "string" } +-- implement { name = "counttwopassdata", actions = { count, context }, arguments = "string" } +-- implement { name = "checktwopassdata", actions = { check, context }, arguments = "string" } +-- +-- implement { +-- name = "definetwopasslist", +-- actions = define, +-- arguments = "string" +-- } +-- +-- implement { +-- name = "savetwopassdata", +-- actions = save, +-- arguments = "2 strings", +-- } +-- +-- implement { +-- name = "savetaggedtwopassdata", +-- actions = savetagged, +-- arguments = "3 strings", +-- } +-- +-- implement { +-- name = "doifelseintwopassdata", +-- actions = { inlist, commands.doifelse }, +-- arguments = "2 strings", +-- } +-- +-- -- local ctx_latelua = context.latelua +-- +-- -- implement { +-- -- name = "lazysavetwopassdata", +-- -- arguments = "3 strings", +-- -- public = true, +-- -- actions = function(a,b,c) +-- -- ctx_latelua(function() save(a,c) end) +-- -- end, +-- -- } +-- +-- -- implement { +-- -- name = "lazysavetaggedtwopassdata", +-- -- arguments = "3 strings", +-- -- public = true, +-- -- actions = function(a,b,c) +-- -- ctx_latelua(function() savetagged(a,b,c) end) +-- -- end, +-- -- } diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-two.mkxl b/Master/texmf-dist/tex/context/base/mkxl/core-two.mkxl index 38f03c7c45b..10a7eec9ead 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/core-two.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/core-two.mkxl @@ -1,6 +1,6 @@ %D \module %D [ file=core-two, % moved from core-uti -%D version=1997.03.31, +%D version=1997.03.31, % stripped down 2023-03-21 %D title=\CONTEXT\ Core Macros, %D subtitle=Two Pass Data, %D author=Hans Hagen, @@ -11,102 +11,110 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\writestatus{loading}{ConTeXt Core Macros / Two Pass Data} +%D The public interface is replaced by datasets and two pass data is now private +%D to the engine. For the moment we keep some commands commented. The unused +%D (second) argument is an inheritance from \MKII. If needed we can bring back +%D a compatible interface. -%D This is a rather old mechanism which has not changed much over time, apart from -%D adding a few more selectors. This code used to be part of \type {core-uti}. The -%D following examples demonstrate the interface. -%D -%D \startbuffer -%D \definetwopasslist{test-1} -%D -%D \gettwopassdatalist{test-1} [\twopassdatalist=] -%D \checktwopassdata {test-1} [\twopassdata=] -%D \checktwopassdata {test-1} [\twopassdata=] -%D \gettwopassdata {test-1} [\twopassdata=] -%D \gettwopassdata {test-1} [\twopassdata=] -%D -%D \definetwopasslist{test-2} -%D -%D \lazysavetwopassdata{test-2}{1}{x} -%D \lazysavetwopassdata{test-2}{2}{y} -%D \lazysavetwopassdata{test-2}{3}{z} -%D -%D \gettwopassdatalist{test-2} [\twopassdatalist=x,y,z] -%D \checktwopassdata {test-2} [\twopassdata=x] -%D \checktwopassdata {test-2} [\twopassdata=x] -%D \gettwopassdata {test-2} [\twopassdata=x] -%D \gettwopassdata {test-2} [\twopassdata=y] -%D \gettwopassdata {test-2} [\twopassdata=z] -%D \gettwopassdata {test-2} [\twopassdata=] -%D -%D \definetwopasslist{test-3} -%D -%D \lazysavetaggedtwopassdata{test-3}{1}{x}{a} -%D \lazysavetaggedtwopassdata{test-3}{2}{y}{b} -%D \lazysavetaggedtwopassdata{test-3}{3}{z}{c} -%D -%D \findtwopassdata{test-3}{x} [\twopassdata=a] -%D \findtwopassdata{test-3}{y} [\twopassdata=b] -%D \findtwopassdata{test-3}{z} [\twopassdata=c] -%D \findtwopassdata{test-3}{w} [\twopassdata=] -%D -%D \definetwopasslist{test-4} -%D -%D \lazysavetwopassdata{test-4}{1}{A} -%D \lazysavetwopassdata{test-4}{2}{B} -%D \lazysavetwopassdata{test-4}{3}{C} -%D -%D \getfirsttwopassdata{test-4} [\twopassdata=A] -%D \getlasttwopassdata {test-4} [\twopassdata=C] -%D \getfirsttwopassdata{test-4} [\twopassdata=A] -%D \getlasttwopassdata {test-4} [\twopassdata=C] -%D \getfromtwopassdata {test-4}{1} [\twopassdata=A] -%D \getfromtwopassdata {test-4}{3} [\twopassdata=C] -%D \getfromtwopassdata {test-4}{2} [\twopassdata=B] -%D \stopbuffer -%D -%D \getbuffer \typebuffer +\writestatus{loading}{ConTeXt Core Macros / Two Pass Data} \unprotect -\registerctxluafile{core-two}{} - -\permanent\def\immediatesavetwopassdata #1#2#3{\normalexpanded{\noexpand\clf_savetwopassdata{#1}{#3}}} -\permanent\def \lazysavetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlatecommand{savetwopassdata("#1","#3")}}} -\permanent\let \savetwopassdata \lazysavetwopassdata -\permanent\def \savetaggedtwopassdata#1#2#3#4{\normalexpanded{\noexpand\clf_savetaggedtwopassdata{#1}{#3}{#4}}} -\permanent\def\lazysavetaggedtwopassdata#1#2#3#4{\normalexpanded{\noexpand\ctxlatecommand{savetaggedtwopassdata("#1",'#3',"#4")}}} - -% temp hack: needs a proper \starteverytimeluacode - -\setfalse\twopassdatafound - -\mutable\lettonothing\twopassdata -\mutable\lettonothing\twopassdatalist - -\mutable\let\noftwopassitems\!!zeropoint - -\def\syst_twopass_check % can be delegated to lua once obsolete is gone - {\ifempty\twopassdata - \setfalse\twopassdatafound - \else - \settrue\twopassdatafound - \fi} - -\permanent\protected\def\definetwopasslist #1{\clf_definetwopasslist{#1}} -\permanent\protected\def\gettwopassdata #1{\edef\twopassdata {\clf_gettwopassdata {#1}}\syst_twopass_check} -\permanent\protected\def\checktwopassdata #1{\edef\twopassdata {\clf_checktwopassdata {#1}}\syst_twopass_check} -\permanent\protected\def\findtwopassdata #1#2{\edef\twopassdata {\clf_findtwopassdata {#1}{#2}}\syst_twopass_check} -\permanent\protected\def\getfirsttwopassdata #1{\edef\twopassdata {\clf_getfirsttwopassdata {#1}}\syst_twopass_check} -\permanent\protected\def\getlasttwopassdata #1{\edef\twopassdata {\clf_getlasttwopassdata {#1}}% - \edef\noftwopassitems{\clf_counttwopassdata {#1}}\syst_twopass_check} -\permanent\protected\def\getnamedtwopassdatalist#1#2{\edef #1{\clf_gettwopassdatalist {#2}}} -\permanent\protected\def\gettwopassdatalist #1{\edef\twopassdatalist{\clf_gettwopassdatalist {#1}}} - -\permanent\protected\def\doifelseintwopassdata #1#2{\clf_doifelseintwopassdata{#1}{#2}} +\registerctxluafile{core-two}{autosuffix} -\aliased\let\doifintwopassdataelse\doifelseintwopassdata -\aliased\let\getfromtwopassdata \findtwopassdata +% %D This is a rather old mechanism which has not changed much over time, apart from +% %D adding a few more selectors. This code used to be part of \type {core-uti}. The +% %D following examples demonstrate the interface. +% %D +% %D \startbuffer +% %D \definetwopasslist{test-1} +% %D +% %D \gettwopassdatalist{test-1} [\twopassdatalist=] +% %D \checktwopassdata {test-1} [\twopassdata=] +% %D \checktwopassdata {test-1} [\twopassdata=] +% %D \gettwopassdata {test-1} [\twopassdata=] +% %D \gettwopassdata {test-1} [\twopassdata=] +% %D +% %D \definetwopasslist{test-2} +% %D +% %D \lazysavetwopassdata{test-2}{1}{x} +% %D \lazysavetwopassdata{test-2}{2}{y} +% %D \lazysavetwopassdata{test-2}{3}{z} +% %D +% %D \gettwopassdatalist{test-2} [\twopassdatalist=x,y,z] +% %D \checktwopassdata {test-2} [\twopassdata=x] +% %D \checktwopassdata {test-2} [\twopassdata=x] +% %D \gettwopassdata {test-2} [\twopassdata=x] +% %D \gettwopassdata {test-2} [\twopassdata=y] +% %D \gettwopassdata {test-2} [\twopassdata=z] +% %D \gettwopassdata {test-2} [\twopassdata=] +% %D +% %D \definetwopasslist{test-3} +% %D +% %D \lazysavetaggedtwopassdata{test-3}{1}{x}{a} +% %D \lazysavetaggedtwopassdata{test-3}{2}{y}{b} +% %D \lazysavetaggedtwopassdata{test-3}{3}{z}{c} +% %D +% %D \findtwopassdata{test-3}{x} [\twopassdata=a] +% %D \findtwopassdata{test-3}{y} [\twopassdata=b] +% %D \findtwopassdata{test-3}{z} [\twopassdata=c] +% %D \findtwopassdata{test-3}{w} [\twopassdata=] +% %D +% %D \definetwopasslist{test-4} +% %D +% %D \lazysavetwopassdata{test-4}{1}{A} +% %D \lazysavetwopassdata{test-4}{2}{B} +% %D \lazysavetwopassdata{test-4}{3}{C} +% %D +% %D \getfirsttwopassdata{test-4} [\twopassdata=A] +% %D \getlasttwopassdata {test-4} [\twopassdata=C] +% %D \getfirsttwopassdata{test-4} [\twopassdata=A] +% %D \getlasttwopassdata {test-4} [\twopassdata=C] +% %D \getfromtwopassdata {test-4}{1} [\twopassdata=A] +% %D \getfromtwopassdata {test-4}{3} [\twopassdata=C] +% %D \getfromtwopassdata {test-4}{2} [\twopassdata=B] +% %D \stopbuffer +% %D +% %D \getbuffer \typebuffer +% +% %D The next code can be simplified (read: defined at the \LUA\ end) but we never use this +% %D mechanism which has been replaced by datasets so it's not worth the effort. +% +% \permanent\def\immediatesavetwopassdata #1#2#3{\normalexpanded{\noexpand\clf_savetwopassdata{#1}{#3}}} +% \permanent\def \lazysavetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlatecommand{savetwopassdata("#1","#3")}}} +% \permanent\let \savetwopassdata \lazysavetwopassdata +% \permanent\def \savetaggedtwopassdata#1#2#3#4{\normalexpanded{\noexpand\clf_savetaggedtwopassdata{#1}{#3}{#4}}} +% \permanent\def\lazysavetaggedtwopassdata#1#2#3#4{\normalexpanded{\noexpand\ctxlatecommand{savetaggedtwopassdata("#1","#3","#4")}}} +% +% % temp hack: needs a proper \starteverytimeluacode +% +% \setfalse\twopassdatafound +% +% \mutable\lettonothing\twopassdata +% \mutable\lettonothing\twopassdatalist +% +% \mutable\let\noftwopassitems\!!zeropoint +% +% \def\syst_twopass_check % can be delegated to lua once obsolete is gone +% {\ifempty\twopassdata +% \setfalse\twopassdatafound +% \else +% \settrue\twopassdatafound +% \fi} +% +% \permanent\protected\def\definetwopasslist #1{\clf_definetwopasslist{#1}} +% \permanent\protected\def\gettwopassdata #1{\edef\twopassdata {\clf_gettwopassdata {#1}}\syst_twopass_check} +% \permanent\protected\def\checktwopassdata #1{\edef\twopassdata {\clf_checktwopassdata {#1}}\syst_twopass_check} +% \permanent\protected\def\findtwopassdata #1#2{\edef\twopassdata {\clf_findtwopassdata {#1}{#2}}\syst_twopass_check} +% \permanent\protected\def\getfirsttwopassdata #1{\edef\twopassdata {\clf_getfirsttwopassdata {#1}}\syst_twopass_check} +% \permanent\protected\def\getlasttwopassdata #1{\edef\twopassdata {\clf_getlasttwopassdata {#1}}% +% \edef\noftwopassitems{\clf_counttwopassdata {#1}}\syst_twopass_check} +% \permanent\protected\def\getnamedtwopassdatalist#1#2{\edef #1{\clf_gettwopassdatalist {#2}}} +% \permanent\protected\def\gettwopassdatalist #1{\edef\twopassdatalist{\clf_gettwopassdatalist {#1}}} +% +% \permanent\protected\def\doifelseintwopassdata #1#2{\clf_doifelseintwopassdata{#1}{#2}} +% +% \aliased\let\doifintwopassdataelse\doifelseintwopassdata +% \aliased\let\getfromtwopassdata \findtwopassdata \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-uti.lmt b/Master/texmf-dist/tex/context/base/mkxl/core-uti.lmt index 966428b36b1..dbfa82ed7d1 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/core-uti.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/core-uti.lmt @@ -6,16 +6,13 @@ if not modules then modules = { } end modules ['core-uti'] = { license = "see context related readme files" } --- todo: keep track of changes here (hm, track access, and only true when --- accessed and changed) - ---[[ldx-- -<p>A utility file has always been part of <l n='context'/> and with -the move to <l n='luatex'/> we also moved a lot of multi-pass info -to a <l n='lua'/> table. Instead of loading a <l n='tex'/> based -utility file under different setups, we now load a table once. This -saves much runtime but at the cost of more memory usage.</p> ---ldx]]-- +-- A utility file has always been part of ConTeXt and with the move to LuaTeX we +-- also moved a lot of multi-pass info to a Lua table. Instead of loading a TeX +-- based utility file under different setups, we now load a table once. This saves +-- much runtime but at the cost of more memory usage. +-- +-- In the meantime the overhead is a bit more due to the amount of data being saved +-- and more agressive compacting. local math = math local next, type, tostring, tonumber, setmetatable, load = next, type, tostring, tonumber, setmetatable, load @@ -46,14 +43,9 @@ local job = job job.version = 1.33 job.packversion = 1.02 --- some day we will implement loading of other jobs and then we need --- job.jobs - ---[[ldx-- -<p>Variables are saved using in the previously defined table and passed -onto <l n='tex'/> using the following method. Of course one can also -directly access the variable using a <l n='lua'/> call.</p> ---ldx]]-- +-- Variables are saved using in the previously defined table and passed onto TeX +-- using the following method. Of course one can also directly access the variable +-- using a Lua call. local savelist, comment = { }, { } @@ -382,13 +374,18 @@ function job.load(filename) end function job.loadother(filename) - statistics.starttiming(loadedfiles) + local jobname = environment.jobname + if filename == jobname then + return + end filename = file.addsuffix(filename,"tuc") local unpacked = othercache[filename] if not unpacked then - -- so we can register the same name twice(in loading order) + -- so we can register the same name twice (in loading order) ... needs checking if we want this + statistics.starttiming(loadedfiles) local utilitydata = load(filename) if utilitydata then + report_passes("integrating list %a into %a",filename,jobname) local jobpacker = utilitydata.job.packed unpacknumberdata(jobpacker.index) unpacked = { } @@ -403,14 +400,15 @@ function job.loadother(filename) end unpacked.job.packed = nil -- nicer in inspecting othercache[filename] = unpacked - -- + -- + utilitydata.components, utilitydata.namestack = collectstructure(utilitydata.job.structure.collected) + -- structures.lists .integrate(utilitydata) structures.registers .integrate(utilitydata) structures.references.integrate(utilitydata) - -- end + statistics.stoptiming(loadedfiles) end - statistics.stoptiming(loadedfiles) return unpacked end diff --git a/Master/texmf-dist/tex/context/base/mkxl/data-sch.lmt b/Master/texmf-dist/tex/context/base/mkxl/data-sch.lmt new file mode 100644 index 00000000000..36f89040c99 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/data-sch.lmt @@ -0,0 +1,312 @@ +if not modules then modules = { } end modules ['data-sch'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local load, tonumber, require = load, tonumber, require +local gsub, format = string.gsub, string.format +local savedata = io.savedata +local sortedhash, concat = table.sortedhash, table.concat +local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders +local addsuffix, suffix, splitbase = file.addsuffix, file.suffix, file.splitbase +local md5hex = md5.hex +local removefile, renamefile, fileexists = os.remove, os.rename, io.exists + +-- todo: more locals + +local trace_schemes = false trackers.register("resolvers.schemes",function(v) trace_schemes = v end) +local report_schemes = logs.reporter("resolvers","schemes") + +local http = require("socket.http") +local ltn12 = require("ltn12") + +if mbox then mbox = nil end -- useless and even bugged (helper overwrites lib) + +local resolvers = resolvers +local schemes = resolvers.schemes or { } +resolvers.schemes = schemes + +local cleaners = { } +schemes.cleaners = cleaners + +local threshold = 24 * 60 * 60 +local inmemory = false +local uselibrary = false + +directives.register("schemes.threshold", function(v) threshold = tonumber(v) or threshold end) +directives.register("schemes.inmemory", function(v) inmemory = v end) +directives.register("schemes.uselibrary", function(v) uselibrary = v end) + +function cleaners.none(specification) + return specification.original +end + +-- function cleaners.strip(specification) +-- -- todo: only keep suffix periods, so after the last +-- return (gsub(specification.original,"[^%a%d%.]+","-")) -- so we keep periods +-- end + +function cleaners.strip(specification) -- keep suffixes + local path, name = splitbase(specification.original) + if path == "" then + return (gsub(name,"[^%a%d%.]+","-")) + else + return (gsub((gsub(path,"%.","-") .. "-" .. name),"[^%a%d%.]+","-")) + end +end + +function cleaners.md5(specification) + return addsuffix(md5hex(specification.original),suffix(specification.path)) +end + +local cleaner = cleaners.strip + +directives.register("schemes.cleanmethod", function(v) cleaner = cleaners[v] or cleaners.strip end) + +function resolvers.schemes.cleanname(specification) + local hash = cleaner(specification) + if trace_schemes then + report_schemes("hashing %a to %a",specification.original,hash) + end + return hash +end + +local cached = { } +local loaded = { } +local reused = { } +local thresholds = { } +local handlers = { } + +local function fetcher(report) + if uselibrary then + local curl = require("curl") or require("libs-imp-curl") -- we have curl preloaded + local fetch = curl and curl.fetch + if fetch then + return function(str) + local data, message = fetch { + url = str, + followlocation = true, + sslverifyhost = false, + sslverifypeer = false, + } + if not data then + report("some error: %s",message) + end + return data + end + end + end +end + +local runner = sandbox.registerrunner { + name = "to file curl resolver", + method = "execute", + program = "curl", + template = '--silent --insecure --create-dirs --output "%cachename%" "%original%"', + internal = function(specification) + local fetch = fetcher(specification.reporter) + return fetch and function(name,program,template,checkers,defaults,variables,reporter,finalized) + local data = fetch(variables.original) + savedata(variables.cachename,data or "") + end + end, + checkers = { + cachename = "cache", + original = "url", + } +} + +local memrunner = sandbox.registerrunner { + name = "in memory curl resolver", + method = "resultof", + program = "curl", + template = '--silent --insecure "%original%"', + internal = function(specification) + local fetch = fetcher(specification.reporter) + return fetch and function(name,program,template,checkers,defaults,variables,reporter,finalized) + return fetch(variables.original) or "" + end + end, + checkers = { + original = "url", + } +} + +local function fetch(specification) + local original = specification.original + local scheme = specification.scheme + local cleanname = schemes.cleanname(specification) + if inmemory then + statistics.starttiming(schemes) + local cachename = resolvers.savers.virtualname(cleanname) + local handler = handlers[scheme] + -- if handler and not uselibrary then + if handler then -- internal sockets are twice as fast as library + if trace_schemes then + report_schemes("fetching %a, protocol %a, method %a",original,scheme,"built-in") + end + logs.flush() + handler(specification,cachename) + else + if trace_schemes then + report_schemes("fetching %a, protocol %a, method %a",original,scheme,"curl") + end + logs.flush() + local result = memrunner { + original = original, + } + resolvers.savers.directvirtual(cachename,result,true) -- persistent + end + loaded[scheme] = loaded[scheme] + 1 + statistics.stoptiming(schemes) + return cachename + else + local cachename = caches.setfirstwritablefile(cleanname,"schemes") + if not cached[original] or threshold == 0 then + statistics.starttiming(schemes) + if threshold == 0 or not fileexists(cachename) or (os.difftime(os.time(),lfs.attributes(cachename).modification) > (thresholds[protocol] or threshold)) then + -- removefile(cachename) + cached[original] = cachename + local handler = handlers[scheme] + if handler then + if trace_schemes then + report_schemes("fetching %a, protocol %a, method %a",original,scheme,"built-in") + end + logs.flush() + handler(specification,cachename) + else + if trace_schemes then + report_schemes("fetching %a, protocol %a, method %a",original,scheme,"curl") + end + logs.flush() + runner { + original = original, + cachename = cachename, + } + end + end + if fileexists(cachename) then + cached[original] = cachename + if trace_schemes then + report_schemes("using cached %a, protocol %a, cachename %a",original,scheme,cachename) + end + else + cached[original] = "" + if trace_schemes then + report_schemes("using missing %a, protocol %a",original,scheme) + end + end + loaded[scheme] = loaded[scheme] + 1 + statistics.stoptiming(schemes) + else + if trace_schemes then + report_schemes("reusing %a, protocol %a",original,scheme) + end + reused[scheme] = reused[scheme] + 1 + end + return cached[original] + end +end + +local function finder(specification,filetype) + return resolvers.methodhandler("finders",fetch(specification),filetype) +end + +local opener = openers.file +local loader = loaders.file + +local function install(scheme,handler,newthreshold) + handlers [scheme] = handler + loaded [scheme] = 0 + reused [scheme] = 0 + finders [scheme] = finder + openers [scheme] = opener + loaders [scheme] = loader + thresholds[scheme] = newthreshold or threshold +end + +schemes.install = install + +local function http_handler(specification,cachename) + if inmemory then + local result = { } + local status, message = http.request { + url = specification.original, + sink = ltn12.sink.table(result) + } + resolvers.savers.directvirtual(cachename,concat(result),true) -- persistent + else + local tempname = cachename .. ".tmp" + local handle = io.open(tempname,"wb") + local status, message = http.request { + url = specification.original, + sink = ltn12.sink.file(handle) + } + if not status then + removefile(tempname) + else + removefile(cachename) + renamefile(tempname,cachename) + end + end + return cachename +end + +install('http',http_handler) +install('https') -- see pod +install('ftp') + +statistics.register("scheme handling time", function() + local l, r, nl, nr = { }, { }, 0, 0 + for k, v in sortedhash(loaded) do + if v > 0 then + nl = nl + 1 + l[nl] = k .. ":" .. v + end + end + for k, v in sortedhash(reused) do + if v > 0 then + nr = nr + 1 + r[nr] = k .. ":" .. v + end + end + local n = nl + nr + if n > 0 then + if nl == 0 then l = { "none" } end + if nr == 0 then r = { "none" } end + return format("%s seconds, %s processed, threshold %s seconds, loaded: %s, reused: %s", + statistics.elapsedtime(schemes), n, threshold, concat(l," "), concat(l," ")) + else + return nil + end +end) + +-- We provide a few more helpers: + +----- http = require("socket.http") +local httprequest = http.request +local toquery = url.toquery + +local function fetchstring(url,data) + local q = data and toquery(data) + if q then + url = url .. "?" .. q + end + local reply = httprequest(url) + return reply -- just one argument +end + +schemes.fetchstring = fetchstring + +function schemes.fetchtable(url,data) + local reply = fetchstring(url,data) + if reply then + local s = load("return " .. reply) + if s then + return s() + end + end +end diff --git a/Master/texmf-dist/tex/context/base/mkxl/data-vir.lmt b/Master/texmf-dist/tex/context/base/mkxl/data-vir.lmt index b78211fc9a7..75a8c68c02e 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/data-vir.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/data-vir.lmt @@ -20,26 +20,42 @@ local savers = resolvers.savers local cleaners = resolvers.cleaners local data = { } +local keep = { } local n = 0 -- hm, number can be query local f_virtual_n = formatters["virtual://%s.%s"] local f_virtual_y = formatters["virtual://%s-%s.%s"] -function savers.virtual(specification,content,suffix) +local function virtualname(specification,suffix) n = n + 1 -- one number for all namespaces local path = type(specification) == "table" and specification.path or specification if type(path) ~= "string" or path == "" then path = "virtualfile" end - local filename = suffix and f_virtual_y(path,n,suffix) or f_virtual_n(path,n) + return suffix and f_virtual_y(path,n,suffix) or f_virtual_n(path,n) +end + +local function directvirtual(filename,content,persistent) + if not content then + content = "" + end if trace_virtual then - report_virtual("saver: file %a saved",filename) + report_virtual("saver: file %a saved, size %i",filename,#content) end - data[filename] = content + data[filename] = content or "" + keep[filename] = persistent return filename end +function savers.virtual(specification,content,suffix) + return directvirtual(virtualname(specification,suffix),content) +end + +savers.virtualname = virtualname +savers.directvirtual = directvirtual + function cleaners.virtual(filename) data[filename] = nil + keep[filename] = nil end local finders = resolvers.finders @@ -94,7 +110,10 @@ function loaders.virtual(specification) if trace_virtual then report_virtual("loader: file %a loaded",original) end - data[original] = nil + if not keep[original] then + data[original] = nil + keep[original] = nil + end return true, d, #d end if trace_virtual then diff --git a/Master/texmf-dist/tex/context/base/mkxl/driv-shp.lmt b/Master/texmf-dist/tex/context/base/mkxl/driv-shp.lmt index 09928f303eb..0048f4bb868 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/driv-shp.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/driv-shp.lmt @@ -69,11 +69,11 @@ local parameters = fonthashes.parameters local nodecodes = nodes.nodecodes local whatsitcodes = nodes.whatsitcodes local gluecodes = nodes.gluecodes -local dirvalues = nodes.dirvalues local subtypes = nodes.subtypes -local lefttoright_code = dirvalues.lefttoright -local righttoleft_code = dirvalues.righttoleft +local directioncodes = tex.directioncodes +local lefttoright_code = directioncodes.lefttoright +local righttoleft_code = directioncodes.righttoleft local glyph_code = nodecodes.glyph local kern_code = nodecodes.kern @@ -1804,7 +1804,7 @@ do literal = showdetails, } - callback.register("show_whatsit",function(n,what,l,tlp,l1,l2) + callbacks.register("show_whatsit",function(n,what,l,tlp,l1,l2) local s = nodes.whatsitcodes[n.subtype] if what == 1 then return s or "unknown" @@ -1815,12 +1815,10 @@ do w(n,l,tlp,l1,l2) end end - end) + end,"provide whatsit details") - local names = attributes.names + local names = attributes.names -- we show the name and number - callback.register("get_attribute",function(k,v) - return attributes.names[k], nil -- we show the name and number - end) + callbacks.register("get_attribute",function(k,v) return attributes.names[k], nil end,"provide verbose attrbute name") end diff --git a/Master/texmf-dist/tex/context/base/mkxl/driv-usr.lmt b/Master/texmf-dist/tex/context/base/mkxl/driv-usr.lmt index 0542228aace..df381f35f4f 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/driv-usr.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/driv-usr.lmt @@ -40,10 +40,10 @@ local dirdimensions = nuts.dirdimensions local nodecodes = nodes.nodecodes local whatsitcodes = nodes.whatsitcodes -local dirvalues = nodes.dirvalues -local lefttoright_code = dirvalues.lefttoright -local righttoleft_code = dirvalues.righttoleft +local directioncodes = tex.directioncodes +local lefttoright_code = directioncodes.lefttoright +local righttoleft_code = directioncodes.righttoleft local glyph_code = nodecodes.glyph local kern_code = nodecodes.kern diff --git a/Master/texmf-dist/tex/context/base/mkxl/enco-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/enco-ini.mkxl index 3d87ee7765c..dfe534f32b8 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/enco-ini.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/enco-ini.mkxl @@ -74,6 +74,17 @@ \immutable\letcsname\??accents\endcsname\empty %D Because now have this (\type {\chr} issues a one|-|time warning): +%D +%D \stopbuffer +%D \chr {e acute} +%D \chr {i circumflex} +%D \^{i} \^i \^{\i} +%D \^{a} \"{a} +%D \withcircumflex{a} +%D \withdiaeresis{a} +%D \stopbuffer +%D +%D \typebuffer \getbuffer \permanent\protected\def\dodefinecombine#1#2% {\ifcsname\string#1\endcsname\else diff --git a/Master/texmf-dist/tex/context/base/mkxl/file-job.lmt b/Master/texmf-dist/tex/context/base/mkxl/file-job.lmt index e117b914e0b..c3906468b24 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/file-job.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/file-job.lmt @@ -13,7 +13,7 @@ local next, rawget, tostring, tonumber = next, rawget, tostring, tonumber local gsub, match, gmatch, ind = string.gsub, string.match, string.gmatch, string.find local insert, remove, concat, unique, imerged = table.insert, table.remove, table.concat, table.unique, table.imerged local validstring, formatters = string.valid, string.formatters -local sortedhash = table.sortedhash +local sortedhash, copytable = table.sortedhash, table.copy local setmetatableindex, setmetatablenewindex = table.setmetatableindex, table.setmetatablenewindex local commands = commands @@ -24,10 +24,12 @@ local ctx_doifelse = commands.doifelse local implement = interfaces.implement -local trace_jobfiles = false trackers.register("system.jobfiles", function(v) trace_jobfiles = v end) +local trace_jobfiles = false trackers.register("system.jobfiles", function(v) trace_jobfiles = v end) +local trace_structure = false trackers.register("system.structure", function(v) trace_structure = v end) local report = logs.reporter("system") local report_jobfiles = logs.reporter("system", "jobfiles") +local report_structure = logs.reporter("system", "structure") local report_functions = logs.reporter("system", "functions") local texsetcount = tex.setcount @@ -69,6 +71,12 @@ local v_product = variables.product local v_component = variables.component local v_yes = variables.yes +local v_local = variables["local"] +local v_global = variables["global"] + +local e_start = elements.start +local e_stop = elements.stop + -- main code .. there is some overlap .. here we have loc:// local function findctxfile(name) -- loc ? any ? @@ -402,7 +410,7 @@ local c_textlevel = tex.iscount("textlevel") local function dummyfunction() end local function startstoperror() - report("invalid \\%s%s ... \\%s%s structure",elements.start,v_text,elements.stop,v_text) + report("invalid \\%s%s ... \\%s%s structure",e_start,v_text,e_stop,v_text) startstoperror = dummyfunction end @@ -528,6 +536,10 @@ local tree = { type = "text", name = "", branches = { } } local treestack = { } local top = tree.branches local root = tree +local namestack = { } +local namelist = { } +local namehash = { } +local nametop = false local project_stack = { } local product_stack = { } @@ -550,6 +562,15 @@ local function pushtree(what,name) top = t end +local function pushcurrent(what,name) + if what == v_product or what == v_component or what == v_text then + insert(namestack,name) + nametop = copytable(namestack) + namelist[#namelist+1] = nametop + insert(namehash,#namelist) + end +end + local function poptree() top = remove(treestack) if #top[#top].branches == 0 then @@ -557,6 +578,13 @@ local function poptree() end end +local function popcurrent(what) + if what == v_product or what == v_component then + remove(namestack) + remove(namehash) + end +end + do local function log_tree(report,top,depth) @@ -600,22 +628,75 @@ job.structure = jobstructure jobstructure.collected = jobstructure.collected or { } jobstructure.tobesaved = root jobstructure.components = { } +jobstructure.namestack = { } -local function initialize() - local function collect(root,result) +function collectstructure(collected) + local namestack = { } + local n = 0 + local function collect(root,result,stack) local branches = root.branches if branches then + local s = copytable(stack) + local m = #s + 1 for i=1,#branches do local branch = branches[i] - if branch.type == "component" then + local what = branch.type + if what == v_component then result[#result+1] = branch.name end - collect(branch,result) + s[m] = branch.name + if what == v_product or what == v_component then + n = n + 1 + namestack[n] = copytable(s) + end + collect(branch,result,s) end end return result end - jobstructure.components = collect(jobstructure.collected,{}) + local components = collect(collected,{},{}) +-- inspect(namestack) + return components, namestack +end + +local function initialize() + jobstructure.components, jobstructure.namestack = collectstructure(jobstructure.collected) +end + +function jobresolvers.collectstructure(collected) + return collectstructure(collected or jobstructure.collected) +end + +do + local reported = { } + + function jobresolvers.currentstructure() +-- inspect(namehash) + local n = namehash[#namehash] + if trace_structure and not reported[n] then + local namestack = jobstructure.namestack + local new = namelist [n] + local old = namestack[n] + new = new and concat(new," ") or "" + old = old and concat(old," ") or "" + if old == new then + report_structure("%02i : %a",n,old) + else + report_structure("%02i : %a <> %a",n,old,new) + end + reported[n] = true + end + return n, namelist[n] + end + +end + +function jobresolvers.namelist(n,utilitydata) + if utilitydata then + return utilitydata.namestack[n] + else + return namelist[n] or jobstructure.namestack[n] + end end job.register('job.structure.collected',root,initialize) @@ -836,36 +917,32 @@ implement { name = "usecomponent", public = true, protected = true, actions = -- [v_environment] = context.stopenvironmentindeed, -- } -local start = { - [v_project] = "startprojectindeed", - [v_product] = "startproductindeed", - [v_component] = "startcomponentindeed", - [v_environment] = "startenvironmentindeed", -} +-- local start = { +-- [v_project] = "startprojectindeed", +-- [v_product] = "startproductindeed", +-- [v_component] = "startcomponentindeed", +-- [v_environment] = "startenvironmentindeed", +-- } -local stop = { - [v_project] = "stopprojectindeed", - [v_product] = "stopproductindeed", - [v_component] = "stopcomponentindeed", - [v_environment] = "stopenvironmentindeed", -} +-- local stop = { +-- [v_project] = "stopprojectindeed", +-- [v_product] = "stopproductindeed", +-- [v_component] = "stopcomponentindeed", +-- [v_environment] = "stopenvironmentindeed", +-- } -local function gotonextlevel(what,name) -- todo: something with suffix name +local function gotonextlevel(what,how,name) -- todo: something with suffix name insert(stacks[what],name) insert(typestack,currenttype) currenttype = what pushtree(what,name) - if start[what] then - -- start[what]() - token.expandmacro(start[what]) - end + pushcurrent(what,name) + token.expandmacro(e_start..":"..what..":"..how) end -local function gotopreviouslevel(what) - if stop[what] then - token.expandmacro(stop[what]) - -- stop[what]() -- not immediate - end +local function gotopreviouslevel(what,how) + token.expandmacro(e_stop..":"..what..":"..how) + popcurrent(what) poptree() currenttype = remove(typestack) or v_text remove(stacks[what]) -- not currenttype ... weak recovery @@ -881,20 +958,22 @@ local function autoname() return name end -implement { name = "startproject", public = true, protected = true, actions = function() gotonextlevel(v_project, autoname()) end } -implement { name = "startproduct", public = true, protected = true, actions = function() gotonextlevel(v_product, autoname()) end } -implement { name = "startcomponent", public = true, protected = true, actions = function() gotonextlevel(v_component, autoname()) end } -implement { name = "startenvironment", public = true, protected = true, actions = function() gotonextlevel(v_environment,autoname()) end } - -implement { name = "stopproject", public = true, protected = true, actions = function() gotopreviouslevel(v_project ) end } -implement { name = "stopproduct", public = true, protected = true, actions = function() gotopreviouslevel(v_product ) end } -implement { name = "stopcomponent", public = true, protected = true, actions = function() gotopreviouslevel(v_component ) end } -implement { name = "stopenvironment", public = true, protected = true, actions = function() gotopreviouslevel(v_environment) end } - -implement { name = "currentproject", public = true, actions = function() context(topofstack(v_project )) end } -implement { name = "currentproduct", public = true, actions = function() context(topofstack(v_product )) end } -implement { name = "currentcomponent", public = true, actions = function() context(topofstack(v_component )) end } -implement { name = "currentenvironment", public = true, actions = function() context(topofstack(v_environment)) end } +implement { name = "startproject", public = true, protected = true, actions = function() gotonextlevel(v_project, v_global, autoname()) end } +implement { name = "startproduct", public = true, protected = true, actions = function() gotonextlevel(v_product, v_global, autoname()) end } +implement { name = "startcomponent", public = true, protected = true, actions = function() gotonextlevel(v_component, v_global, autoname()) end } +implement { name = "startlocalcomponent", public = true, protected = true, actions = function() gotonextlevel(v_component, v_local, autoname()) end } +implement { name = "startenvironment", public = true, protected = true, actions = function() gotonextlevel(v_environment, v_global, autoname()) end } + +implement { name = "stopproject", public = true, protected = true, actions = function() gotopreviouslevel(v_project, v_global) end } +implement { name = "stopproduct", public = true, protected = true, actions = function() gotopreviouslevel(v_product, v_global) end } +implement { name = "stopcomponent", public = true, protected = true, actions = function() gotopreviouslevel(v_component, v_global) end } +implement { name = "stoplocalcomponent", public = true, protected = true, actions = function() gotopreviouslevel(v_component, v_local ) end } +implement { name = "stopenvironment", public = true, protected = true, actions = function() gotopreviouslevel(v_environment, v_global) end } + +implement { name = "currentproject", public = true, actions = function() context(topofstack(v_project )) end } +implement { name = "currentproduct", public = true, actions = function() context(topofstack(v_product )) end } +implement { name = "currentcomponent", public = true, actions = function() context(topofstack(v_component )) end } +implement { name = "currentenvironment", public = true, actions = function() context(topofstack(v_environment)) end } -- -- -- this will move -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/Master/texmf-dist/tex/context/base/mkxl/file-job.mklx b/Master/texmf-dist/tex/context/base/mkxl/file-job.mklx index 76b679bd683..1c57a832dfb 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/file-job.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/file-job.mklx @@ -184,43 +184,54 @@ \newsystemmode\v!component \newsystemmode\v!environment -\permanent\protected\def\startprojectindeed +\permanent\protected\defcsname\e!start:\v!project:\v!global\endcsname {%starttext \pushsystemmode\v!project \setsystemmode\v!project} -\permanent\protected\def\stopprojectindeed +\permanent\protected\defcsname\e!stop:\v!project:\v!global\endcsname {\popsystemmode\v!project %stoptext \endinput} -\permanent\protected\def\startproductindeed +\permanent\protected\defcsname\e!start:\v!product:\v!global\endcsname {\starttext \pushsystemmode\v!product \setsystemmode\v!product} -\permanent\protected\def\stopproductindeed +\permanent\protected\defcsname\e!stop:\v!product:\v!global\endcsname {\popsystemmode\v!product \stoptext \endinput} -\permanent\protected\def\startcomponentindeed +\permanent\protected\defcsname\e!start:\v!component:\v!global\endcsname {\starttext \pushreferenceprefix\currentcomponent \pushsystemmode\v!component \setsystemmode\v!component} -\permanent\protected\def\stopcomponentindeed +\permanent\protected\defcsname\e!stop:\v!component:\v!global\endcsname {\popsystemmode\v!component \popreferenceprefix \stoptext \endinput} -\permanent\protected\def\startenvironmentindeed +\permanent\protected\defcsname\e!start:\v!component:\v!local\endcsname + {\starttext + \pushreferenceprefix\currentcomponent + \pushsystemmode\v!component + \setsystemmode\v!component} + +\permanent\protected\defcsname\e!stop:\v!component:\v!local\endcsname + {\popsystemmode\v!component + \popreferenceprefix + \stoptext} + +\permanent\protected\defcsname\e!start:\v!environment:\v!global\endcsname {\pushsystemmode\v!environment \setsystemmode\v!environment} -\permanent\protected\def\stopenvironmentindeed +\permanent\protected\defcsname\e!stop:\v!environment:\v!global\endcsname {\popsystemmode\v!environment \endinput} diff --git a/Master/texmf-dist/tex/context/base/mkxl/file-mod.lmt b/Master/texmf-dist/tex/context/base/mkxl/file-mod.lmt index d10abf53385..567387a3ac2 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/file-mod.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/file-mod.lmt @@ -6,17 +6,11 @@ if not modules then modules = { } end modules ['file-mod'] = { license = "see context related readme files" } --- This module will be redone! For instance, the prefixes will move to data-* --- as they arr sort of generic along with home:// etc/. - --- context is not defined yet! todo! (we need to load tupp-fil after cld) --- todo: move startreadingfile to lua and push regime there - ---[[ldx-- -<p>It's more convenient to manipulate filenames (paths) in -<l n='lua'/> than in <l n='tex'/>. These methods have counterparts -at the <l n='tex'/> side.</p> ---ldx]]-- +-- This module will be redone! For instance, the prefixes will move to data-* as +-- they are sort of generic along with home:// etc/. +-- +-- It is more convenient to manipulate filenames (paths) in Lua than in TeX. The +-- methods below have counterparts at the TeX end. local format, find, concat, tonumber = string.format, string.find, table.concat, tonumber local sortedhash = table.sortedhash diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-chk.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-chk.lmt index 05a3611ccd2..e70e9083d1d 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-chk.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/font-chk.lmt @@ -487,7 +487,7 @@ do local cache = table.setmetatableindex("table") - callback.register("missing_character", function(n,f,c) + callbacks.register("missing_character", function(n,f,c) local cached = cache[f] local found = cached[c] if found == nil then @@ -530,7 +530,7 @@ do n.font = found[1] n.scale = found[2] end - end) + end,"report details about a missing character") function definers.registerfallbackfont(style,list) local l = fallbacks[style] diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-con.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-con.lmt index 073af7d2ec8..599641e2c01 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-con.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/font-con.lmt @@ -22,11 +22,9 @@ local trace_scaling = false trackers.register("fonts.scaling", function(v) local report_defining = logs.reporter("fonts","defining") --- watch out: no negative depths and negative eights permitted in regular fonts - ---[[ldx-- -<p>Here we only implement a few helper functions.</p> ---ldx]]-- +-- Watch out: no negative depths and negative heights are permitted in regular +-- fonts. Also, the code in LMTX is a bit different. Here we only implement a +-- few helper functions. local fonts = fonts local constructors = fonts.constructors or { } @@ -53,11 +51,9 @@ constructors.loadedfonts = loadedfonts ----- scalecommands = fonts.helpers.scalecommands ---[[ldx-- -<p>We need to normalize the scale factor (in scaled points). This has to -do with the fact that <l n='tex'/> uses a negative multiple of 1000 as -a signal for a font scaled based on the design size.</p> ---ldx]]-- +-- We need to normalize the scale factor (in scaled points). This has to do with the +-- fact that TeX uses a negative multiple of 1000 as a signal for a font scaled +-- based on the design size. local factors = { pt = 65536.0, @@ -112,33 +108,29 @@ function constructors.getmathparameter(tfmdata,name) end end ---[[ldx-- -<p>Beware, the boundingbox is passed as reference so we may not overwrite it -in the process; numbers are of course copies. Here 65536 equals 1pt. (Due to -excessive memory usage in CJK fonts, we no longer pass the boundingbox.)</p> ---ldx]]-- - --- The scaler is only used for otf and afm and virtual fonts. If a virtual font has italic --- correction make sure to set the hasitalics flag. Some more flags will be added in the --- future. - ---[[ldx-- -<p>The reason why the scaler was originally split, is that for a while we experimented -with a helper function. However, in practice the <l n='api'/> calls are too slow to -make this profitable and the <l n='lua'/> based variant was just faster. A days -wasted day but an experience richer.</p> ---ldx]]-- +-- Beware, the boundingbox is passed as reference so we may not overwrite it in the +-- process; numbers are of course copies. Here 65536 equals 1pt. (Due to excessive +-- memory usage in CJK fonts, we no longer pass the boundingbox.) +-- +-- The scaler is only used for OTF and AFM and virtual fonts. If a virtual font has +-- italic correction make sure to set the hasitalics flag. Some more flags will be +-- added in the future. +-- +-- The reason why the scaler was originally split, is that for a while we +-- experimented with a helper function. However, in practice the API calls are too +-- slow to make this profitable and the Lua based variant was just faster. A days +-- wasted day but an experience richer. -- experimental, sharing kerns (unscaled and scaled) saves memory -- local sharedkerns, basekerns = constructors.check_base_kerns(tfmdata) -- loop over descriptions (afm and otf have descriptions, tfm not) -- there is no need (yet) to assign a value to chr.tonunicode - +-- -- constructors.prepare_base_kerns(tfmdata) -- optimalization - --- we have target.name=metricfile and target.fullname=RealName and target.filename=diskfilename --- when collapsing fonts, luatex looks as both target.name and target.fullname as ttc files --- can have multiple subfonts +-- +-- We have target.name = metricfile and target.fullname = RealName and +-- target.filename = diskfilename when collapsing fonts. LuaTeX looks at both +-- target.name and target.fullname because TTC files can have multiple subfonts. function constructors.calculatescale(tfmdata,scaledpoints) -- implemented in font-ctx.lmt @@ -597,6 +589,14 @@ function constructors.scale(tfmdata,specification) if changed then local c = changed[unicode] if c and c ~= unicode then + local cc = changed[c] + if cc then + while cc do + c = cc + cc = changed[c] + end + end + -- check not needed: if c then description = descriptions[c] or descriptions[unicode] or character character = characters[c] or character @@ -1008,9 +1008,7 @@ function constructors.finalize(tfmdata) return tfmdata end ---[[ldx-- -<p>A unique hash value is generated by:</p> ---ldx]]-- +-- A unique hash value is generated by: local hashmethods = { } constructors.hashmethods = hashmethods @@ -1069,13 +1067,11 @@ hashmethods.normal = function(list) end end ---[[ldx-- -<p>In principle we can share tfm tables when we are in need for a font, but then -we need to define a font switch as an id/attr switch which is no fun, so in that -case users can best use dynamic features ... so, we will not use that speedup. Okay, -when we get rid of base mode we can optimize even further by sharing, but then we -loose our testcases for <l n='luatex'/>.</p> ---ldx]]-- +-- In principle we can share tfm tables when we are in need for a font, but then we +-- need to define a font switch as an id/attr switch which is no fun, so in that +-- case users can best use dynamic features ... so, we will not use that speedup. +-- Okay, when we get rid of base mode we can optimize even further by sharing, but +-- then we loose our testcases for LuaTeX. function constructors.hashinstance(specification,force) -- implemented in font-ctx.lmt @@ -1407,10 +1403,7 @@ do end ---[[ldx-- -<p>We need to check for default features. For this we provide -a helper function.</p> ---ldx]]-- +-- We need to check for default features. For this we provide a helper function. function constructors.checkedfeatures(what,features) local defaults = handlers[what].features.defaults diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-ctx.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-ctx.lmt index 23c676e4ee5..113cade52d4 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-ctx.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/font-ctx.lmt @@ -529,19 +529,13 @@ do end ---[[ldx-- -<p>So far we haven't really dealt with features (or whatever we want -to pass along with the font definition. We distinguish the following -situations:</p> -situations:</p> - -<code> -name:xetex like specs -name@virtual font spec -name*context specification -</code> ---ldx]]-- - +-- So far we haven't really dealt with features (or whatever we want to pass along +-- with the font definition. We distinguish the following situations: +-- +-- name:xetex like specs +-- name@virtual font spec +-- name*context specification +-- -- Currently fonts are scaled while constructing the font, so we have to do scaling -- of commands in the vf at that point using e.g. "local scale = g.parameters.factor -- or 1" after all, we need to work with copies anyway and scaling needs to be done @@ -1383,25 +1377,35 @@ do -- else too many locals local characters = tfmdata.characters local parameters = tfmdata.parameters local properties = tfmdata.properties - -- we use char0 as signal; cf the spec pdf can handle this (no char in slot) - characters[0] = nil - tfmdata.original = specification.specification - local id = definefont(tfmdata,properties.id) - csnames[id] = specification.cs - properties.id = id -- already set - definers.register(tfmdata,id) -- to be sure, normally already done - texdefinefont(global,cs,id) - -- texdefinefont(cs,id,global and "global") - constructors.finalize(tfmdata) - if trace_defining then - report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a, step %a", - name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,"-") + if characters then + -- we use char0 as signal; cf the spec pdf can handle this (no char in slot) + characters[0] = nil + tfmdata.original = specification.specification + local id = definefont(tfmdata,properties.id) + csnames[id] = specification.cs + properties.id = id -- already set + definers.register(tfmdata,id) -- to be sure, normally already done + texdefinefont(global,cs,id) + -- texdefinefont(cs,id,global and "global") + constructors.finalize(tfmdata) + if trace_defining then + report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a, step %a", + name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,"-") + end + -- resolved (when designsize is used): + local size = round(tfmdata.parameters.size or 655360) + setmacro("somefontsize",size.."sp") + texsetcount(c_scaledfontsize,size) + lastfontid = id + else + -- case 1: same as ** + local nice = nice_cs(cs) + if not reported[name][nice] then + report_defining("unable to define %a as %a",name,nice) + end + lastfontid = -1 + texsetcount(c_scaledfontsize,0) end - -- resolved (when designsize is used): - local size = round(tfmdata.parameters.size or 655360) - setmacro("somefontsize",size.."sp") - texsetcount(c_scaledfontsize,size) - lastfontid = id elseif tfmtype == "number" then if trace_defining then report_defining("reusing %s, id %a, target %a, features %a / %a, fallbacks %a / %a, goodies %a / %a, designsize %a / %a", @@ -1417,6 +1421,7 @@ do -- else too many locals texsetcount(c_scaledfontsize,size) lastfontid = tfmdata else + -- case 2: same as ** local nice = nice_cs(cs) if not reported[name][nice] then report_defining("unable to define %a as %a",name,nice) @@ -1592,7 +1597,7 @@ do -- else too many locals return (define { name = name, size = size } or 0) end - callbacks.register('define_font', read, "definition of fonts (tfmdata preparation)") + callbacks.register("define_font",read,"define and/or load a font") -- here @@ -2258,10 +2263,8 @@ dimenfactors.em = nil dimenfactors["%"] = nil dimenfactors.pct = nil ---[[ldx-- -<p>Before a font is passed to <l n='tex'/> we scale it. Here we also need -to scale virtual characters.</p> ---ldx]]-- +-- Before a font is passed to TeX we scale it. Here we also need to scale virtual +-- characters. do diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-def.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-def.lmt index 6afeeb47405..ea6b2d0c039 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-def.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/font-def.lmt @@ -24,10 +24,9 @@ trackers.register("fonts.loading", "fonts.defining", "otf.loading", "afm.loading local report_defining = logs.reporter("fonts","defining") ---[[ldx-- -<p>Here we deal with defining fonts. We do so by intercepting the -default loader that only handles <l n='tfm'/>.</p> ---ldx]]-- +-- Here we deal with defining fonts. We do so by intercepting the default loader +-- that only handles TFM files. Although, we started out that way but in the +-- meantime we can hardly speak of TFM any more. local nextfont = font.nextid @@ -55,25 +54,18 @@ local designsizes = constructors.designsizes local resolvefile = fontgoodies and fontgoodies.filenames and fontgoodies.filenames.resolve or function(s) return s end ---[[ldx-- -<p>We hardly gain anything when we cache the final (pre scaled) -<l n='tfm'/> table. But it can be handy for debugging, so we no -longer carry this code along. Also, we now have quite some reference -to other tables so we would end up with lots of catches.</p> ---ldx]]-- - ---[[ldx-- -<p>We can prefix a font specification by <type>name:</type> or -<type>file:</type>. The first case will result in a lookup in the -synonym table.</p> - -<typing> -[ name: | file: ] identifier [ separator [ specification ] ] -</typing> - -<p>The following function split the font specification into components -and prepares a table that will move along as we proceed.</p> ---ldx]]-- +-- We hardly gain anything when we cache the final (pre scaled) TFM table. But it +-- can be handy for debugging, so we no longer carry this code along. Also, we now +-- have quite some reference to other tables so we would end up with lots of +-- catches. +-- +-- We can prefix a font specification by "name:" or "file:". The first case will +-- result in a lookup in the synonym table. +-- +-- [ name: | file: ] identifier [ separator [ specification ] ] +-- +-- The following function split the font specification into components and prepares +-- a table that will move along as we proceed. -- beware, we discard additional specs -- @@ -166,9 +158,7 @@ do end ---[[ldx-- -<p>We can resolve the filename using the next function:</p> ---ldx]]-- +-- We can resolve the filename using the next function: definers.resolvers = definers.resolvers or { } local resolvers = definers.resolvers @@ -261,23 +251,17 @@ function definers.resolve(specification) return specification end ---[[ldx-- -<p>The main read function either uses a forced reader (as determined by -a lookup) or tries to resolve the name using the list of readers.</p> - -<p>We need to cache when possible. We do cache raw tfm data (from <l -n='tfm'/>, <l n='afm'/> or <l n='otf'/>). After that we can cache based -on specificstion (name) and size, that is, <l n='tex'/> only needs a number -for an already loaded fonts. However, it may make sense to cache fonts -before they're scaled as well (store <l n='tfm'/>'s with applied methods -and features). However, there may be a relation between the size and -features (esp in virtual fonts) so let's not do that now.</p> - -<p>Watch out, here we do load a font, but we don't prepare the -specification yet.</p> ---ldx]]-- - --- very experimental: +-- The main read function either uses a forced reader (as determined by a lookup) or +-- tries to resolve the name using the list of readers. +-- +-- We need to cache when possible. We do cache raw tfm data (from TFM, AFM or OTF). +-- After that we can cache based on specificstion (name) and size, that is, TeX only +-- needs a number for an already loaded fonts. However, it may make sense to cache +-- fonts before they're scaled as well (store TFM's with applied methods and +-- features). However, there may be a relation between the size and features (esp in +-- virtual fonts) so let's not do that now. +-- +-- Watch out, here we do load a font, but we don't prepare the specification yet. function definers.applypostprocessors(tfmdata) local postprocessors = tfmdata.postprocessors @@ -431,17 +415,13 @@ function constructors.readanddefine(name,size) -- no id -- maybe a dummy first return fontdata[id], id end ---[[ldx-- -<p>So far the specifiers. Now comes the real definer. Here we cache -based on id's. Here we also intercept the virtual font handler. Since -it evolved stepwise I may rewrite this bit (combine code).</p> - -In the previously defined reader (the one resulting in a <l n='tfm'/> -table) we cached the (scaled) instances. Here we cache them again, but -this time based on id. We could combine this in one cache but this does -not gain much. By the way, passing id's back to in the callback was -introduced later in the development.</p> ---ldx]]-- +-- So far the specifiers. Now comes the real definer. Here we cache based on id's. +-- Here we also intercept the virtual font handler. +-- +-- In the previously defined reader (the one resulting in a TFM table) we cached the +-- (scaled) instances. Here we cache them again, but this time based on id. We could +-- combine this in one cache but this does not gain much. By the way, passing id's +-- back to in the callback was introduced later in the development. function definers.registered(hash) local id = internalized[hash] diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-fbk.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-fbk.lmt index bdc5265aeaa..09f20b42cb3 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-fbk.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/font-fbk.lmt @@ -10,10 +10,6 @@ local cos, tan, rad, format = math.cos, math.tan, math.rad, string.format local utfbyte, utfchar = utf.byte, utf.char local next = next ---[[ldx-- -<p>This is very experimental code!</p> ---ldx]]-- - local trace_visualize = false trackers.register("fonts.composing.visualize", function(v) trace_visualize = v end) local trace_define = false trackers.register("fonts.composing.define", function(v) trace_define = v end) diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-fil.mklx b/Master/texmf-dist/tex/context/base/mkxl/font-fil.mklx index 79535ea112d..89ec2f5c433 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-fil.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/font-fil.mklx @@ -104,6 +104,11 @@ {\letcsname\??fontfile\fontclass\m_font_name\endcsname\m_font_file \normalexpanded{\font_basics_define_font_synonym_yes_opt[#spec]}} +\let\p_features \undefined +\let\p_fallbacks \undefined +\let\p_goodies \undefined +\let\p_designsize\undefined + \protected\def\font_basics_define_font_synonym_nop_opt[#specification]% {\let\p_features \undefined \let\p_fallbacks \undefined @@ -294,7 +299,7 @@ % pre-expansion. \def\font_helpers_update_font_class_parameters - {\edef\m_font_class_direction {\begincsname\??fontclass\fontclass\fontstyle\s!direction \endcsname}% + {%edef\m_font_class_direction {\begincsname\??fontclass\fontclass\fontstyle\s!direction \endcsname}% \edef\m_font_class_features {\begincsname\??fontclass\fontclass\fontstyle\s!features \endcsname}% \edef\m_font_class_fallbacks {\begincsname\??fontclass\fontclass\fontstyle\s!fallbacks \endcsname}% \edef\m_font_class_goodies {\begincsname\??fontclass\fontclass\fontstyle\s!goodies \endcsname}% diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-ini.lmt index bc68fa83d4c..dcec8594eab 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-ini.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/font-ini.lmt @@ -6,10 +6,6 @@ if not modules then modules = { } end modules ['font-ini'] = { license = "see context related readme files" } ---[[ldx-- -<p>Not much is happening here.</p> ---ldx]]-- - local sortedhash, setmetatableindex = table.sortedhash, table.setmetatableindex local allocate = utilities.storage.allocate diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-ini.mklx b/Master/texmf-dist/tex/context/base/mkxl/font-ini.mklx index 6efae2ae10b..ea727bde4dc 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-ini.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/font-ini.mklx @@ -755,6 +755,16 @@ \immutable\dimensiondef\d_font_default_size 10pt +%lettonothing\m_font_class_direction % no longer used +\lettonothing\m_font_class_features +\lettonothing\m_font_class_fallbacks +\lettonothing\m_font_class_goodies + +\lettonothing\m_font_direction +\lettonothing\m_font_features +\lettonothing\m_font_fallbacks +\lettonothing\m_font_goodies + \protected\def\font_helpers_low_level_define {\ifconditional\c_font_compact \expandafter\font_helpers_low_level_define_compact diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-lib.mklx b/Master/texmf-dist/tex/context/base/mkxl/font-lib.mklx index 6caf1daf8df..9214a8b5232 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-lib.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/font-lib.mklx @@ -52,7 +52,7 @@ \registerctxluafile{font-oti}{} % otf initialization \registerctxluafile{font-ott}{} % otf tables (first) \registerctxluafile{font-otl}{autosuffix} -\registerctxluafile{font-oto}{} +\registerctxluafile{font-oto}{autosuffix} \registerctxluafile{font-otj}{autosuffix} \registerctxluafile{font-oup}{} \registerctxluafile{font-ota}{autosuffix} diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-mat.mklx b/Master/texmf-dist/tex/context/base/mkxl/font-mat.mklx index 76f6f87b973..a93174e3799 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-mat.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/font-mat.mklx @@ -337,15 +337,17 @@ %D 0 while in rl mode 0 is a copy of 1. There is no real overhead involved in this. %D This also permits different font definitions for normal and mixed. -\lettonothing\m_font_class_direction -\lettonothing\m_font_class_features -\lettonothing\m_font_class_fallbacks -\lettonothing\m_font_class_goodies - -\lettonothing\m_font_direction -\lettonothing\m_font_features -\lettonothing\m_font_fallbacks -\lettonothing\m_font_goodies +% moved to ini +% +% \lettonothing\m_font_class_direction +% \lettonothing\m_font_class_features +% \lettonothing\m_font_class_fallbacks +% \lettonothing\m_font_class_goodies +% +% \lettonothing\m_font_direction +% \lettonothing\m_font_features +% \lettonothing\m_font_fallbacks +% \lettonothing\m_font_goodies \appendtoks \font_helpers_set_math_family\c_font_fam_mr\s!mr @@ -531,7 +533,12 @@ \else \c_math_m_scaled\numericscale#1\relax \fi - \scaledmathstyle\c_math_m_scaled + \scaledmathstyle + \ifnum\glyphscale=\plusthousand + \c_math_m_scaled + \else + \numexpr(\c_math_m_scaled*\glyphscale)/\plusthousand\relax + \fi \fi} %D This is nasty, as the engine only stores the last set family parameters (per style) which diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-one.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-one.lmt index 453f611927a..71694dcca84 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-one.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/font-one.lmt @@ -7,18 +7,16 @@ if not modules then modules = { } end modules ['font-one'] = { license = "see context related readme files" } ---[[ldx-- -<p>Some code may look a bit obscure but this has to do with the fact that we also use -this code for testing and much code evolved in the transition from <l n='tfm'/> to -<l n='afm'/> to <l n='otf'/>.</p> - -<p>The following code still has traces of intermediate font support where we handles -font encodings. Eventually font encoding went away but we kept some code around in -other modules.</p> - -<p>This version implements a node mode approach so that users can also more easily -add features.</p> ---ldx]]-- +-- Some code may look a bit obscure but this has to do with the fact that we also +-- use this code for testing and much code evolved in the transition from TFM to AFM +-- to OTF. +-- +-- The following code still has traces of intermediate font support where we handles +-- font encodings. Eventually font encoding went away but we kept some code around +-- in other modules. +-- +-- This version implements a node mode approach so that users can also more easily +-- add features. local fonts, logs, trackers, containers, resolvers = fonts, logs, trackers, containers, resolvers @@ -71,15 +69,13 @@ local overloads = fonts.mappings.overloads local applyruntimefixes = fonts.treatments and fonts.treatments.applyfixes ---[[ldx-- -<p>We cache files. Caching is taken care of in the loader. We cheat a bit by adding -ligatures and kern information to the afm derived data. That way we can set them faster -when defining a font.</p> - -<p>We still keep the loading two phased: first we load the data in a traditional -fashion and later we transform it to sequences. Then we apply some methods also -used in opentype fonts (like <t>tlig</t>).</p> ---ldx]]-- +-- We cache files. Caching is taken care of in the loader. We cheat a bit by adding +-- ligatures and kern information to the afm derived data. That way we can set them +-- faster when defining a font. +-- +-- We still keep the loading two phased: first we load the data in a traditional +-- fashion and later we transform it to sequences. Then we apply some methods also +-- used in opentype fonts (like tlig). function afm.load(filename) filename = resolvers.findfile(filename,'afm') or "" @@ -312,10 +308,8 @@ local function enhance_fix_names(data) end end ---[[ldx-- -<p>These helpers extend the basic table with extra ligatures, texligatures -and extra kerns. This saves quite some lookups later.</p> ---ldx]]-- +-- These helpers extend the basic table with extra ligatures, texligatures and extra +-- kerns. This saves quite some lookups later. local addthem = function(rawdata,ligatures) if ligatures then @@ -349,17 +343,14 @@ local function enhance_add_ligatures(rawdata) addthem(rawdata,afm.helpdata.ligatures) end ---[[ldx-- -<p>We keep the extra kerns in separate kerning tables so that we can use -them selectively.</p> ---ldx]]-- - --- This is rather old code (from the beginning when we had only tfm). If --- we unify the afm data (now we have names all over the place) then --- we can use shcodes but there will be many more looping then. But we --- could get rid of the tables in char-cmp then. Als, in the generic version --- we don't use the character database. (Ok, we can have a context specific --- variant). +-- We keep the extra kerns in separate kerning tables so that we can use them +-- selectively. +-- +-- This is rather old code (from the beginning when we had only tfm). If we unify +-- the afm data (now we have names all over the place) then we can use shcodes but +-- there will be many more looping then. But we could get rid of the tables in +-- char-cmp then. Als, in the generic version we don't use the character database. +-- (Ok, we can have a context specific variant). local function enhance_add_extra_kerns(rawdata) -- using shcodes is not robust here local descriptions = rawdata.descriptions @@ -440,9 +431,7 @@ local function enhance_add_extra_kerns(rawdata) -- using shcodes is not robust h do_it_copy(afm.helpdata.rightkerned) end ---[[ldx-- -<p>The copying routine looks messy (and is indeed a bit messy).</p> ---ldx]]-- +-- The copying routine looks messy (and is indeed a bit messy). local function adddimensions(data) -- we need to normalize afm to otf i.e. indexed table instead of name if data then @@ -619,11 +608,9 @@ end return nil end ---[[ldx-- -<p>Originally we had features kind of hard coded for <l n='afm'/> files but since I -expect to support more font formats, I decided to treat this fontformat like any -other and handle features in a more configurable way.</p> ---ldx]]-- +-- Originally we had features kind of hard coded for AFM files but since I expect to +-- support more font formats, I decided to treat this fontformat like any other and +-- handle features in a more configurable way. function afm.setfeatures(tfmdata,features) local okay = constructors.initializefeatures("afm",tfmdata,features,trace_features,report_afm) @@ -715,13 +702,10 @@ local function afmtotfm(specification) end end ---[[ldx-- -<p>As soon as we could intercept the <l n='tfm'/> reader, I implemented an -<l n='afm'/> reader. Since traditional <l n='pdftex'/> could use <l n='opentype'/> -fonts with <l n='afm'/> companions, the following method also could handle -those cases, but now that we can handle <l n='opentype'/> directly we no longer -need this features.</p> ---ldx]]-- +-- As soon as we could intercept the TFM reader, I implemented an AFM reader. Since +-- traditional pdfTeX could use OpenType fonts with AFM companions, the following +-- method also could handle those cases, but now that we can handle OpenType +-- directly we no longer need this features. local function read_from_afm(specification) local tfmdata = afmtotfm(specification) @@ -736,9 +720,7 @@ local function read_from_afm(specification) return tfmdata end ---[[ldx-- -<p>We have the usual two modes and related features initializers and processors.</p> ---ldx]]-- +-- We have the usual two modes and related features initializers and processors. registerafmfeature { name = "mode", diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-onr.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-onr.lmt index d28c247df63..04f9d3bb2c8 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-onr.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/font-onr.lmt @@ -7,18 +7,16 @@ if not modules then modules = { } end modules ['font-onr'] = { license = "see context related readme files" } ---[[ldx-- -<p>Some code may look a bit obscure but this has to do with the fact that we also use -this code for testing and much code evolved in the transition from <l n='tfm'/> to -<l n='afm'/> to <l n='otf'/>.</p> - -<p>The following code still has traces of intermediate font support where we handles -font encodings. Eventually font encoding went away but we kept some code around in -other modules.</p> - -<p>This version implements a node mode approach so that users can also more easily -add features.</p> ---ldx]]-- +-- Some code may look a bit obscure but this has to do with the fact that we also +-- use this code for testing and much code evolved in the transition from TFM to AFM +-- to OTF. +-- +-- The following code still has traces of intermediate font support where we handles +-- font encodings. Eventually font encoding went away but we kept some code around +-- in other modules. +-- +-- This version implements a node mode approach so that users can also more easily +-- add features. local fonts, logs, trackers, resolvers = fonts, logs, trackers, resolvers @@ -49,12 +47,9 @@ pfb.version = 1.002 local readers = afm.readers or { } afm.readers = readers ---[[ldx-- -<p>We start with the basic reader which we give a name similar to the built in <l n='tfm'/> -and <l n='otf'/> reader.</p> -<p>We use a new (unfinished) pfb loader but I see no differences between the old -and new vectors (we actually had one bad vector with the old loader).</p> ---ldx]]-- +-- We start with the basic reader which we give a name similar to the built in TFM +-- and OTF reader. We use a PFB loader but I see no differences between the old and +-- new vectors (we actually had one bad vector with the old loader). local get_indexes, get_shapes @@ -71,7 +66,7 @@ do -- local plain = bxor(cipher,rshift(r,8)) local plain = (cipher ~ ((r >> 8) & 0xFFFFFFFF)) -- r = ((cipher + r) * c1 + c2) % 65536 - r = ((cipher + r) * c1 + c2) % 0x10000 + r = ((cipher + r) * c1 + c2) % 0x10000 return char(plain) end @@ -366,11 +361,10 @@ do end ---[[ldx-- -<p>We start with the basic reader which we give a name similar to the built in <l n='tfm'/> -and <l n='otf'/> reader. We only need data that is relevant for our use. We don't support -more complex arrangements like multiple master (obsolete), direction specific kerning, etc.</p> ---ldx]]-- +-- We start with the basic reader which we give a name similar to the built in TFM +-- and OTF reader. We only need data that is relevant for our use. We don't support +-- more complex arrangements like multiple master (obsolete), direction specific +-- kerning, etc. local spacer = patterns.spacer local whitespace = patterns.whitespace diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-ota.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-ota.lmt index 157270ef18d..6e81307418b 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-ota.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/font-ota.lmt @@ -56,10 +56,8 @@ local chardata = characters and characters.data local otffeatures = fonts.constructors.features.otf local registerotffeature = otffeatures.register ---[[ldx-- -<p>Analyzers run per script and/or language and are needed in order to -process features right.</p> ---ldx]]-- +-- Analyzers run per script and/or language and are needed in order to process +-- features right. local setstate = nuts.setstate local getstate = nuts.getstate diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-oto.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-oto.lmt new file mode 100644 index 00000000000..f2269627311 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/font-oto.lmt @@ -0,0 +1,556 @@ +if not modules then modules = { } end modules ['font-oto'] = { -- original tex + version = 1.001, + comment = "companion to font-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local concat, unpack = table.concat, table.unpack +local insert, remove = table.insert, table.remove +local format, gmatch, gsub, find, match, lower, strip = string.format, string.gmatch, string.gsub, string.find, string.match, string.lower, string.strip +local type, next, tonumber, tostring = type, next, tonumber, tostring + +local trace_baseinit = false trackers.register("otf.baseinit", function(v) trace_baseinit = v end) +local trace_singles = false trackers.register("otf.singles", function(v) trace_singles = v end) +local trace_multiples = false trackers.register("otf.multiples", function(v) trace_multiples = v end) +local trace_alternatives = false trackers.register("otf.alternatives", function(v) trace_alternatives = v end) +local trace_ligatures = false trackers.register("otf.ligatures", function(v) trace_ligatures = v end) +local trace_kerns = false trackers.register("otf.kerns", function(v) trace_kerns = v end) +local trace_preparing = false trackers.register("otf.preparing", function(v) trace_preparing = v end) + +local report_prepare = logs.reporter("fonts","otf prepare") + +local fonts = fonts +local otf = fonts.handlers.otf + +local otffeatures = otf.features +local registerotffeature = otffeatures.register + +otf.defaultbasealternate = "none" -- first last + +local getprivate = fonts.constructors.getprivate + +local wildcard = "*" +local default = "dflt" + +local formatters = string.formatters +local f_unicode = formatters["%U"] +local f_uniname = formatters["%U (%s)"] +local f_unilist = formatters["% t (% t)"] + +local function gref(descriptions,n) + if type(n) == "number" then + local name = descriptions[n].name + if name then + return f_uniname(n,name) + else + return f_unicode(n) + end + elseif n then + local num = { } + local nam = { } + local j = 0 + for i=1,#n do + local ni = n[i] + if tonumber(ni) then -- first is likely a key + j = j + 1 + local di = descriptions[ni] + num[j] = f_unicode(ni) + nam[j] = di and di.name or "-" + end + end + return f_unilist(num,nam) + else + return "<error in base mode tracing>" + end +end + +local function cref(feature,sequence) + return formatters["feature %a, type %a, (chain) lookup %a"](feature,sequence.type,sequence.name) +end + +local function report_substitution(feature,sequence,descriptions,unicode,substitution) + if unicode == substitution then + report_prepare("%s: base substitution %s maps onto itself", + cref(feature,sequence), + gref(descriptions,unicode)) + else + report_prepare("%s: base substitution %s => %S", + cref(feature,sequence), + gref(descriptions,unicode), + gref(descriptions,substitution)) + end +end + +local function report_alternate(feature,sequence,descriptions,unicode,replacement,value,comment) + if unicode == replacement then + report_prepare("%s: base alternate %s maps onto itself", + cref(feature,sequence), + gref(descriptions,unicode)) + else + report_prepare("%s: base alternate %s => %s (%S => %S)", + cref(feature,sequence), + gref(descriptions,unicode), + replacement and gref(descriptions,replacement), + value, + comment) + end +end + +local function report_ligature(feature,sequence,descriptions,unicode,ligature) + report_prepare("%s: base ligature %s => %S", + cref(feature,sequence), + gref(descriptions,ligature), + gref(descriptions,unicode)) +end + +local function report_kern(feature,sequence,descriptions,unicode,otherunicode,value) + report_prepare("%s: base kern %s + %s => %S", + cref(feature,sequence), + gref(descriptions,unicode), + gref(descriptions,otherunicode), + value) +end + +-- We need to make sure that luatex sees the difference between base fonts that have +-- different glyphs in the same slots in fonts that have the same fullname (or filename). +-- LuaTeX will merge fonts eventually (and subset later on). If needed we can use a more +-- verbose name as long as we don't use <()<>[]{}/%> and the length is < 128. + +local basehash, basehashes, applied = { }, 1, { } + +local function registerbasehash(tfmdata) + local properties = tfmdata.properties + local hash = concat(applied," ") + local base = basehash[hash] + if not base then + basehashes = basehashes + 1 + base = basehashes + basehash[hash] = base + end + properties.basehash = base + properties.fullname = (properties.fullname or properties.name) .. "-" .. base + -- report_prepare("fullname base hash '%a, featureset %a",tfmdata.properties.fullname,hash) + applied = { } +end + +local function registerbasefeature(feature,value) + applied[#applied+1] = feature .. "=" .. tostring(value) +end + +-- The original basemode ligature builder used the names of components and did some expression +-- juggling to get the chain right. The current variant starts with unicodes but still uses +-- names to make the chain. This is needed because we have to create intermediates when needed +-- but use predefined snippets when available. To some extend the current builder is more stupid +-- but I don't worry that much about it as ligatures are rather predicatable. +-- +-- Personally I think that an ff + i == ffi rule as used in for instance latin modern is pretty +-- weird as no sane person will key that in and expect a glyph for that ligature plus the following +-- character. Anyhow, as we need to deal with this, we do, but no guarantes are given. +-- +-- latin modern dejavu +-- +-- f+f 102 102 102 102 +-- f+i 102 105 102 105 +-- f+l 102 108 102 108 +-- f+f+i 102 102 105 +-- f+f+l 102 102 108 102 102 108 +-- ff+i 64256 105 64256 105 +-- ff+l 64256 108 +-- +-- As you can see here, latin modern is less complete than dejavu but +-- in practice one will not notice it. +-- +-- The while loop is needed because we need to resolve for instance pseudo names like +-- hyphen_hyphen to endash so in practice we end up with a bit too many definitions but the +-- overhead is neglectable. We can have changed[first] or changed[second] but it quickly becomes +-- messy if we need to take that into account. + +local function makefake(tfmdata,name,present) + local private = getprivate(tfmdata) + local character = { intermediate = true, ligatures = { } } + tfmdata.resources.unicodes[name] = private + tfmdata.characters[private] = character + tfmdata.descriptions[private] = { name = name } + present[name] = private + return character +end + +local function make_1(present,tree,name) + if tonumber(tree) then + present[name] = v + else + for k, v in next, tree do + if k == "ligature" then + present[name] = v + else + make_1(present,v,name .. "_" .. k) + end + end + end +end + +local function make_3(present,tfmdata,characters,tree,name,preceding,unicode,done,v) + local character = characters[preceding] + if not character then + if trace_baseinit then + report_prepare("weird ligature in lookup %a, current %C, preceding %C",sequence.name,v,preceding) + end + character = makefake(tfmdata,name,present) + end + local ligatures = character.ligatures + if ligatures then + ligatures[unicode] = { char = v } + else + character.ligatures = { [unicode] = { char = v } } + end + if done then + local d = done[name] + if not d then + done[name] = { "dummy", v } + else + d[#d+1] = v + end + end +end + +local function make_2(present,tfmdata,characters,tree,name,preceding,unicode,done) + if tonumber(tree) then + make_3(present,tfmdata,characters,tree,name,preceding,unicode,done,tree) + else + for k, v in next, tree do + if k == "ligature" then + make_3(present,tfmdata,characters,tree,name,preceding,unicode,done,v) + else + local code = present[name] or unicode + local name = name .. "_" .. k + make_2(present,tfmdata,characters,v,name,code,k,done) + end + end + end +end + +local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplist) + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local resources = tfmdata.resources + local changed = tfmdata.changed + + local ligatures = { } + local alternate = tonumber(value) or true and 1 + local defaultalt = otf.defaultbasealternate + local trace_singles = trace_baseinit and trace_singles + local trace_alternatives = trace_baseinit and trace_alternatives + local trace_ligatures = trace_baseinit and trace_ligatures + + -- A chain of changes is handled in font-con which is cleaner because + -- we can have shared changes and such. + + if not changed then + changed = { } + tfmdata.changed = changed + end + + for i=1,#lookuplist do + local sequence = lookuplist[i] + local steps = sequence.steps + local kind = sequence.type + if kind == "gsub_single" then + for i=1,#steps do + for unicode, data in next, steps[i].coverage do + if unicode ~= data and not changed[unicode] then + changed[unicode] = data + end + if trace_singles then + report_substitution(feature,sequence,descriptions,unicode,data) + end + end + end + elseif kind == "gsub_alternate" then + for i=1,#steps do + for unicode, data in next, steps[i].coverage do + local replacement = data[alternate] + if replacement then + if unicode ~= replacement and not changed[unicode] then + changed[unicode] = replacement + end + if trace_alternatives then + report_alternate(feature,sequence,descriptions,unicode,replacement,value,"normal") + end + elseif defaultalt == "first" then + replacement = data[1] + if unicode ~= replacement and not changed[unicode] then + changed[unicode] = replacement + end + if trace_alternatives then + report_alternate(feature,sequence,descriptions,unicode,replacement,value,defaultalt) + end + elseif defaultalt == "last" then + replacement = data[#data] + if unicode ~= replacement and not changed[unicode] then + changed[unicode] = replacement + end + if trace_alternatives then + report_alternate(feature,sequence,descriptions,unicode,replacement,value,defaultalt) + end + else + if trace_alternatives then + report_alternate(feature,sequence,descriptions,unicode,replacement,value,"unknown") + end + end + end + end + elseif kind == "gsub_ligature" then + for i=1,#steps do + for unicode, data in next, steps[i].coverage do + ligatures[#ligatures+1] = { unicode, data, "" } -- lookupname } + if trace_ligatures then + report_ligature(feature,sequence,descriptions,unicode,data) + end + end + end + end + end + + local nofligatures = #ligatures + + if nofligatures > 0 then + local characters = tfmdata.characters + local present = { } + local done = trace_baseinit and trace_ligatures and { } + + for i=1,nofligatures do + local ligature = ligatures[i] + local unicode = ligature[1] + local tree = ligature[2] + make_1(present,tree,"ctx_"..unicode) + end + + for i=1,nofligatures do + local ligature = ligatures[i] + local unicode = ligature[1] + local tree = ligature[2] + local lookupname = ligature[3] + make_2(present,tfmdata,characters,tree,"ctx_"..unicode,unicode,unicode,done,sequence) + end + + end + +end + +local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist) + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local resources = tfmdata.resources + local properties = tfmdata.properties + local traceindeed = trace_baseinit and trace_kerns + -- check out this sharedkerns trickery + for i=1,#lookuplist do + local sequence = lookuplist[i] + local steps = sequence.steps + local kind = sequence.type + local format = sequence.format + if kind == "gpos_pair" then + for i=1,#steps do + local step = steps[i] + local format = step.format + if format == "kern" or format == "move" then + for unicode, data in next, steps[i].coverage do + local character = characters[unicode] + local kerns = character.kerns + if not kerns then + kerns = { } + character.kerns = kerns + end + if traceindeed then + for otherunicode, kern in next, data do + if not kerns[otherunicode] and kern ~= 0 then + kerns[otherunicode] = kern + report_kern(feature,sequence,descriptions,unicode,otherunicode,kern) + end + end + else + for otherunicode, kern in next, data do + if not kerns[otherunicode] and kern ~= 0 then + kerns[otherunicode] = kern + end + end + end + end + else + for unicode, data in next, steps[i].coverage do + local character = characters[unicode] + local kerns = character.kerns + for otherunicode, kern in next, data do + -- kern[2] is true (all zero) or a table + local other = kern[2] + if other == true or (not other and not (kerns and kerns[otherunicode])) then + local kern = kern[1] + if kern == true then + -- all zero + elseif kern[1] ~= 0 or kern[2] ~= 0 or kern[4] ~= 0 then + -- a complex pair not suitable for basemode + else + kern = kern[3] + if kern ~= 0 then + if kerns then + kerns[otherunicode] = kern + else + kerns = { [otherunicode] = kern } + character.kerns = kerns + end + if traceindeed then + report_kern(feature,sequence,descriptions,unicode,otherunicode,kern) + end + end + end + end + end + end + end + end + end + end + +end + +local function initializehashes(tfmdata) + -- already done +end + +local function checkmathreplacements(tfmdata,fullname,fixitalics) + if tfmdata.mathparameters then + local characters = tfmdata.characters + local changed = tfmdata.changed + if next(changed) then + if trace_preparing or trace_baseinit then + report_prepare("checking math replacements for %a",fullname) + end + for unicode, replacement in next, changed do + local u = characters[unicode] + local r = characters[replacement] + if u and r then + local n = u.next + local v = u.vert_variants + local h = u.horiz_variants + if fixitalics then + -- quite some warnings on stix ... + local ui = u.italic + if ui and not r.italic then + if trace_preparing then + report_prepare("using %i units of italic correction from %C for %U",ui,unicode,replacement) + end + r.italic = ui -- print(ui,ri) + end + end + if n and not r.next then + if trace_preparing then + report_prepare("forcing %s for %C substituted by %U","incremental step",unicode,replacement) + end + r.next = n + end + if v and not r.vert_variants then + if trace_preparing then + report_prepare("forcing %s for %C substituted by %U","vertical variants",unicode,replacement) + end + r.vert_variants = v + end + if h and not r.horiz_variants then + if trace_preparing then + report_prepare("forcing %s for %C substituted by %U","horizontal variants",unicode,replacement) + end + r.horiz_variants = h + end + else + if trace_preparing then + report_prepare("error replacing %C by %U",unicode,replacement) + end + end + end + end + end +end + +local function featuresinitializer(tfmdata,value) + if true then -- value then + local starttime = trace_preparing and os.clock() + local features = tfmdata.shared.features + local fullname = tfmdata.properties.fullname or "?" + if features then + initializehashes(tfmdata) + local collectlookups = otf.collectlookups + local rawdata = tfmdata.shared.rawdata + local properties = tfmdata.properties + local script = properties.script + local language = properties.language + local rawresources = rawdata.resources + local rawfeatures = rawresources and rawresources.features + local basesubstitutions = rawfeatures and rawfeatures.gsub + local basepositionings = rawfeatures and rawfeatures.gpos + local substitutionsdone = false + local positioningsdone = false + -- + if basesubstitutions or basepositionings then + local sequences = tfmdata.resources.sequences + for s=1,#sequences do + local sequence = sequences[s] + local sfeatures = sequence.features + if sfeatures then + local order = sequence.order + if order then + for i=1,#order do -- + local feature = order[i] + local value = features[feature] + if value then + local validlookups, lookuplist = collectlookups(rawdata,feature,script,language) +-- if not validlookups and not lookuplist and script == "math" then +-- validlookups, lookuplist = collectlookups(rawdata,feature,"dflt","dflt") +-- end + if not validlookups then + -- skip + elseif basesubstitutions and basesubstitutions[feature] then + if trace_preparing then + report_prepare("filtering base %s feature %a for %a with value %a","sub",feature,fullname,value) + end + preparesubstitutions(tfmdata,feature,value,validlookups,lookuplist) + registerbasefeature(feature,value) + substitutionsdone = true + elseif basepositionings and basepositionings[feature] then + if trace_preparing then + report_prepare("filtering base %a feature %a for %a with value %a","pos",feature,fullname,value) + end + preparepositionings(tfmdata,feature,value,validlookups,lookuplist) + registerbasefeature(feature,value) + positioningsdone = true + end + end + end + end + end + end + end + -- + if substitutionsdone then + checkmathreplacements(tfmdata,fullname,features.fixitalics) + end + -- + registerbasehash(tfmdata) + end + if trace_preparing then + report_prepare("preparation time is %0.3f seconds for %a",os.clock()-starttime,fullname) + end + end +end + +registerotffeature { + name = "features", + description = "features", + default = true, + initializers = { + -- position = 1, -- after setscript (temp hack ... we need to force script / language to 1 + base = featuresinitializer, + } +} + +otf.basemodeinitializer = featuresinitializer diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-ots.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-ots.lmt index e7fcfc57675..9e7fdb1ab1e 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-ots.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/font-ots.lmt @@ -7,92 +7,90 @@ if not modules then modules = { } end modules ['font-ots'] = { -- sequences license = "see context related readme files", } ---[[ldx-- -<p>I need to check the description at the microsoft site ... it has been improved -so maybe there are some interesting details there. Most below is based on old and -incomplete documentation and involved quite a bit of guesswork (checking with the -abstract uniscribe of those days. But changing things is tricky!</p> - -<p>This module is a bit more split up that I'd like but since we also want to test -with plain <l n='tex'/> it has to be so. This module is part of <l n='context'/> -and discussion about improvements and functionality mostly happens on the -<l n='context'/> mailing list.</p> - -<p>The specification of OpenType is (or at least decades ago was) kind of vague. -Apart from a lack of a proper free specifications there's also the problem that -Microsoft and Adobe may have their own interpretation of how and in what order to -apply features. In general the Microsoft website has more detailed specifications -and is a better reference. There is also some information in the FontForge help -files. In the end we rely most on the Microsoft specification.</p> - -<p>Because there is so much possible, fonts might contain bugs and/or be made to -work with certain rederers. These may evolve over time which may have the side -effect that suddenly fonts behave differently. We don't want to catch all font -issues.</p> - -<p>After a lot of experiments (mostly by Taco, me and Idris) the first implementation -was already quite useful. When it did most of what we wanted, a more optimized version -evolved. Of course all errors are mine and of course the code can be improved. There -are quite some optimizations going on here and processing speed is currently quite -acceptable and has been improved over time. Many complex scripts are not yet supported -yet, but I will look into them as soon as <l n='context'/> users ask for it.</p> - -<p>The specification leaves room for interpretation. In case of doubt the Microsoft -implementation is the reference as it is the most complete one. As they deal with -lots of scripts and fonts, Kai and Ivo did a lot of testing of the generic code and -their suggestions help improve the code. I'm aware that not all border cases can be -taken care of, unless we accept excessive runtime, and even then the interference -with other mechanisms (like hyphenation) are not trivial.</p> - -<p>Especially discretionary handling has been improved much by Kai Eigner who uses complex -(latin) fonts. The current implementation is a compromis between his patches and my code -and in the meantime performance is quite ok. We cannot check all border cases without -compromising speed but so far we're okay. Given good test cases we can probably improve -it here and there. Especially chain lookups are non trivial with discretionaries but -things got much better over time thanks to Kai.</p> - -<p>Glyphs are indexed not by unicode but in their own way. This is because there is no -relationship with unicode at all, apart from the fact that a font might cover certain -ranges of characters. One character can have multiple shapes. However, at the -<l n='tex'/> end we use unicode so and all extra glyphs are mapped into a private -space. This is needed because we need to access them and <l n='tex'/> has to include -then in the output eventually.</p> - -<p>The initial data table is rather close to the open type specification and also not -that different from the one produced by <l n='fontforge'/> but we uses hashes instead. -In <l n='context'/> that table is packed (similar tables are shared) and cached on disk -so that successive runs can use the optimized table (after loading the table is -unpacked).</p> - -<p>This module is sparsely documented because it is has been a moving target. The -table format of the reader changed a bit over time and we experiment a lot with -different methods for supporting features. By now the structures are quite stable</p> - -<p>Incrementing the version number will force a re-cache. We jump the number by one -when there's a fix in the reader or processing code that can result in different -results.</p> - -<p>This code is also used outside context but in context it has to work with other -mechanisms. Both put some constraints on the code here.</p> - ---ldx]]-- - --- Remark: We assume that cursives don't cross discretionaries which is okay because it --- is only used in semitic scripts. +-- I need to check the description at the microsoft site ... it has been improved so +-- maybe there are some interesting details there. Most below is based on old and +-- incomplete documentation and involved quite a bit of guesswork (checking with the +-- abstract uniscribe of those days. But changing things is tricky! +-- +-- This module is a bit more split up that I'd like but since we also want to test +-- with plain TeX it has to be so. This module is part of ConTeXt and discussion +-- about improvements and functionality mostly happens on the ConTeXt mailing list. +-- +-- The specification of OpenType is (or at least decades ago was) kind of vague. +-- Apart from a lack of a proper free specifications there's also the problem that +-- Microsoft and Adobe may have their own interpretation of how and in what order to +-- apply features. In general the Microsoft website has more detailed specifications +-- and is a better reference. There is also some information in the FontForge help +-- files. In the end we rely most on the Microsoft specification. +-- +-- Because there is so much possible, fonts might contain bugs and/or be made to +-- work with certain rederers. These may evolve over time which may have the side +-- effect that suddenly fonts behave differently. We don't want to catch all font +-- issues. +-- +-- After a lot of experiments (mostly by Taco, me and Idris) the first +-- implementation was already quite useful. When it did most of what we wanted, a +-- more optimized version evolved. Of course all errors are mine and of course the +-- code can be improved. There are quite some optimizations going on here and +-- processing speed is currently quite acceptable and has been improved over time. +-- Many complex scripts are not yet supported yet, but I will look into them as soon +-- as ConTeXt users ask for it. +-- +-- The specification leaves room for interpretation. In case of doubt the Microsoft +-- implementation is the reference as it is the most complete one. As they deal with +-- lots of scripts and fonts, Kai and Ivo did a lot of testing of the generic code +-- and their suggestions help improve the code. I'm aware that not all border cases +-- can be taken care of, unless we accept excessive runtime, and even then the +-- interference with other mechanisms (like hyphenation) are not trivial. +-- +-- Especially discretionary handling has been improved much by Kai Eigner who uses +-- complex (latin) fonts. The current implementation is a compromis between his +-- patches and my code and in the meantime performance is quite ok. We cannot check +-- all border cases without compromising speed but so far we're okay. Given good +-- test cases we can probably improve it here and there. Especially chain lookups +-- are non trivial with discretionaries but things got much better over time thanks +-- to Kai. +-- +-- Glyphs are indexed not by unicode but in their own way. This is because there is +-- no relationship with unicode at all, apart from the fact that a font might cover +-- certain ranges of characters. One character can have multiple shapes. However, at +-- the TeX end we use unicode so and all extra glyphs are mapped into a private +-- space. This is needed because we need to access them and TeX has to include then +-- in the output eventually. +-- +-- The initial data table is rather close to the open type specification and also +-- not that different from the one produced by Fontforge but we uses hashes instead. +-- In ConTeXt that table is packed (similar tables are shared) and cached on disk so +-- that successive runs can use the optimized table (after loading the table is +-- unpacked). +-- +-- This module is sparsely documented because it is has been a moving target. The +-- table format of the reader changed a bit over time and we experiment a lot with +-- different methods for supporting features. By now the structures are quite stable +-- +-- Incrementing the version number will force a re-cache. We jump the number by one +-- when there's a fix in the reader or processing code that can result in different +-- results. +-- +-- This code is also used outside ConTeXt but in ConTeXt it has to work with other +-- mechanisms. Both put some constraints on the code here. +-- +-- Remark: We assume that cursives don't cross discretionaries which is okay because +-- it is only used in semitic scripts. -- -- Remark: We assume that marks precede base characters. -- --- Remark: When complex ligatures extend into discs nodes we can get side effects. Normally --- this doesn't happen; ff\d{l}{l}{l} in lm works but ff\d{f}{f}{f}. +-- Remark: When complex ligatures extend into discs nodes we can get side effects. +-- Normally this doesn't happen; ff\d{l}{l}{l} in lm works but ff\d{f}{f}{f}. -- -- Todo: check if we copy attributes to disc nodes if needed. -- --- Todo: it would be nice if we could get rid of components. In other places we can use --- the unicode properties. We can just keep a lua table. +-- Todo: it would be nice if we could get rid of components. In other places we can +-- use the unicode properties. We can just keep a lua table. -- --- Remark: We do some disc juggling where we need to keep in mind that the pre, post and --- replace fields can have prev pointers to a nesting node ... I wonder if that is still --- needed. +-- Remark: We do some disc juggling where we need to keep in mind that the pre, post +-- and replace fields can have prev pointers to a nesting node ... I wonder if that +-- is still needed. -- -- Remark: This is not possible: -- @@ -254,8 +252,8 @@ local math_code = nodecodes.math local dir_code = nodecodes.dir local par_code = nodecodes.par -local lefttoright_code = nodes.dirvalues.lefttoright -local righttoleft_code = nodes.dirvalues.righttoleft +local lefttoright_code = tex.directioncodes.lefttoright +local righttoleft_code = tex.directioncodes.righttoleft local discretionarydisc_code = nodes.disccodes.discretionary @@ -1092,10 +1090,8 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,skiphash,st end end ---[[ldx-- -<p>We get hits on a mark, but we're not sure if the it has to be applied so -we need to explicitly test for basechar, baselig and basemark entries.</p> ---ldx]]-- +-- We get hits on a mark, but we're not sure if the it has to be applied so we need +-- to explicitly test for basechar, baselig and basemark entries. function handlers.gpos_mark2base(head,start,dataset,sequence,markanchors,rlmode,skiphash) local markchar = getchar(start) @@ -1292,10 +1288,8 @@ function handlers.gpos_cursive(head,start,dataset,sequence,exitanchors,rlmode,sk return head, start, false end ---[[ldx-- -<p>I will implement multiple chain replacements once I run into a font that uses -it. It's not that complex to handle.</p> ---ldx]]-- +-- I will implement multiple chain replacements once I run into a font that uses it. +-- It's not that complex to handle. local chainprocs = { } @@ -1348,29 +1342,22 @@ end chainprocs.reversesub = reversesub ---[[ldx-- -<p>This chain stuff is somewhat tricky since we can have a sequence of actions to be -applied: single, alternate, multiple or ligature where ligature can be an invalid -one in the sense that it will replace multiple by one but not neccessary one that -looks like the combination (i.e. it is the counterpart of multiple then). For -example, the following is valid:</p> - -<typing> -<line>xxxabcdexxx [single a->A][multiple b->BCD][ligature cde->E] xxxABCDExxx</line> -</typing> - -<p>Therefore we we don't really do the replacement here already unless we have the -single lookup case. The efficiency of the replacements can be improved by deleting -as less as needed but that would also make the code even more messy.</p> ---ldx]]-- - ---[[ldx-- -<p>Here we replace start by a single variant.</p> ---ldx]]-- - --- To be done (example needed): what if > 1 steps - --- this is messy: do we need this disc checking also in alternates? +-- This chain stuff is somewhat tricky since we can have a sequence of actions to be +-- applied: single, alternate, multiple or ligature where ligature can be an invalid +-- one in the sense that it will replace multiple by one but not neccessary one that +-- looks like the combination (i.e. it is the counterpart of multiple then). For +-- example, the following is valid: +-- +-- xxxabcdexxx [single a->A][multiple b->BCD][ligature cde->E] xxxABCDExxx +-- +-- Therefore we we don't really do the replacement here already unless we have the +-- single lookup case. The efficiency of the replacements can be improved by +-- deleting as less as needed but that would also make the code even more messy. +-- +-- Here we replace start by a single variant. +-- +-- To be done : what if > 1 steps (example needed) +-- This is messy: do we need this disc checking also in alternates? local function reportzerosteps(dataset,sequence) logwarning("%s: no steps",cref(dataset,sequence)) @@ -1446,9 +1433,7 @@ function chainprocs.gsub_single(head,start,stop,dataset,sequence,currentlookup,r return head, start, false end ---[[ldx-- -<p>Here we replace start by new glyph. First we delete the rest of the match.</p> ---ldx]]-- +-- Here we replace start by new glyph. First we delete the rest of the match. -- char_1 mark_1 -> char_x mark_1 (ignore marks) -- char_1 mark_1 -> char_x @@ -1500,9 +1485,7 @@ function chainprocs.gsub_alternate(head,start,stop,dataset,sequence,currentlooku return head, start, false end ---[[ldx-- -<p>Here we replace start by a sequence of new glyphs.</p> ---ldx]]-- +-- Here we replace start by a sequence of new glyphs. function chainprocs.gsub_multiple(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex) local mapping = currentlookup.mapping @@ -1526,11 +1509,9 @@ function chainprocs.gsub_multiple(head,start,stop,dataset,sequence,currentlookup return head, start, false end ---[[ldx-- -<p>When we replace ligatures we use a helper that handles the marks. I might change -this function (move code inline and handle the marks by a separate function). We -assume rather stupid ligatures (no complex disc nodes).</p> ---ldx]]-- +-- When we replace ligatures we use a helper that handles the marks. I might change +-- this function (move code inline and handle the marks by a separate function). We +-- assume rather stupid ligatures (no complex disc nodes). -- compare to handlers.gsub_ligature which is more complex ... why diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-tex.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-tex.lmt index 2d21687df7e..c8727de72b3 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-tex.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/font-tex.lmt @@ -186,10 +186,10 @@ fonts.handlers.otf.features.register { -- fonts.helpers.registerboxglyph { category = "demo", unicode = 105 } -- fonts.helpers.registerboxglyph { category = "demo", unicode = 106 } -local callbacks = fonts.callbacks or { } -fonts.callbacks = callbacks +local fontcallbacks = fonts.callbacks or { } +fonts.callbacks = fontcallbacks -function callbacks.devirtualize(chardata,f,c) +function fontcallbacks.devirtualize(chardata,f,c) if chardata.commands then local h = node.hpack(nodes.pool.glyph(f,c)) local p = setboxdirectly(f,c,h) @@ -205,7 +205,7 @@ local function processcallback(f,c) if chardata then local callback = chardata.callback if callback then - local action = type(callback) == "function" and callback or callbacks[callback] + local action = type(callback) == "function" and callback or fontcallbacks[callback] if action then action(chardata,f,c) end @@ -213,6 +213,6 @@ local function processcallback(f,c) end end -callback.register("process_character",processcallback) +callbacks.register("process_character",processcallback,"apply an action to a character in a font") -callbacks.callback = processcallback +fontcallbacks.callback = processcallback diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-tfm.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-tfm.lmt index 9fce8fc5fae..d6857b39ed1 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-tfm.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/font-tfm.lmt @@ -50,21 +50,18 @@ constructors.resolvevirtualtoo = false -- wil be set in font-ctx.lua fonts.formats.tfm = "type1" -- we need to have at least a value here fonts.formats.ofm = "type1" -- we need to have at least a value here ---[[ldx-- -<p>The next function encapsulates the standard <l n='tfm'/> loader as -supplied by <l n='luatex'/>.</p> ---ldx]]-- - --- this might change: not scaling and then apply features and do scaling in the --- usual way with dummy descriptions but on the other hand .. we no longer use --- tfm so why bother - --- ofm directive blocks local path search unless set; btw, in context we --- don't support ofm files anyway as this format is obsolete - --- we need to deal with nested virtual fonts, but because we load in the --- frontend we also need to make sure we don't nest too deep (esp when sizes --- get large) +-- The next function encapsulates the standard TFM loader as supplied by LuaTeX. +-- +-- This might change: not scaling and then apply features and do scaling in the +-- usual way with dummy descriptions but on the other hand. However, we no longer +-- use TFM (except for the JMN math fonts) so why bother. +-- +-- The ofm directive blocks a local path search unless set. Actually, in ConTeXt we +-- never had to deal with OFM files anyway as this format is obsolete (there are +-- hardly any fonts in that format that are of use). +-- +-- We need to deal with nested virtual fonts, but because we load in the frontend we +-- also need to make sure we don't nest too deep (esp when sizes get large) -- -- (VTITLE Example of a recursion) -- (MAPFONT D 0 (FONTNAME recurse)(FONTAT D 2)) @@ -72,7 +69,8 @@ supplied by <l n='luatex'/>.</p> -- (CHARACTER C B (CHARWD D 2)(CHARHT D 2)(MAP (SETCHAR C A))) -- (CHARACTER C C (CHARWD D 4)(CHARHT D 4)(MAP (SETCHAR C B))) -- --- we added the same checks as below to the luatex engine +-- The virtual fonts are handled in the backend and therefore LMTX provides more +-- features than in the original specification. LuaTeX already had a few more. function tfm.setfeatures(tfmdata,features) local okay = constructors.initializefeatures("tfm",tfmdata,features,trace_features,report_tfm) diff --git a/Master/texmf-dist/tex/context/base/mkxl/font-txt.lmt b/Master/texmf-dist/tex/context/base/mkxl/font-txt.lmt index aae69ddd383..c42a3a655e3 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/font-txt.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/font-txt.lmt @@ -122,7 +122,7 @@ local math_code = nodecodes.math local dir_code = nodecodes.dir local par_code = nodecodes.par -local righttoleft_code = nodes.dirvalues.righttoleft +local righttoleft_code = tex.directioncodes.righttoleft local txtdirstate = otf.helpers.txtdirstate local pardirstate = otf.helpers.pardirstate diff --git a/Master/texmf-dist/tex/context/base/mkxl/lang-def.mkxl b/Master/texmf-dist/tex/context/base/mkxl/lang-def.mkxl index cd5fd4ba34e..192c9c6f9d7 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/lang-def.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/lang-def.mkxl @@ -257,7 +257,7 @@ \installlanguage [\s!sl] - [\c!command=\v!no, + [\c!define=\v!no, \c!spacing=\v!packed, \c!leftsentence=\hbox{\endash\space}, \c!rightsentence=\hbox{\space\endash}, @@ -271,7 +271,7 @@ \installlanguage % for now we copy from slovenian [\s!sq] - [\c!command=\v!no, + [\c!define=\v!no, \s!lefthyphenmin=2, \s!righthyphenmin=2, \c!spacing=\v!packed, @@ -284,12 +284,12 @@ \c!leftquotation=\rightguillemot, \c!rightquotation=\leftguillemot, \c!date={\v!day,{.},\space,\v!month,\space,\v!year}] - + \installlanguage [\s!hy] [\c!spacing=\v!packed, \c!leftsentence=\endash, % *sentences not confirmed - \c!rightsentence=\endash, + \c!rightsentence=\endash, \c!leftsubsentence=\endash, \c!rightsubsentence=\endash, \c!leftquote=\guilsingleleft, @@ -613,7 +613,7 @@ \installlanguage [\s!lt] - [\c!command=\v!no, + [\c!define=\v!no, \c!spacing=\v!packed, \c!leftsentence=\emdash, \c!rightsentence=\emdash, @@ -755,7 +755,7 @@ \installlanguage [\s!it] - [\c!command=\v!no, + [\c!define=\v!no, \c!spacing=\v!packed, \c!leftsentence=\emdash, \c!rightsentence=\emdash, @@ -798,7 +798,7 @@ \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!year,\space,\v!month,\space,\v!day}] + \c!date={\v!day,\space,\v!month,\space,\v!year}] \installlanguage[\s!pt-br][\c!default=\s!pt] % Brazil \installlanguage[\s!es-es][\c!default=\s!es] % Spain diff --git a/Master/texmf-dist/tex/context/base/mkxl/lang-lab.mkxl b/Master/texmf-dist/tex/context/base/mkxl/lang-lab.mkxl index 6152d287412..c8dc33cccf7 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/lang-lab.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/lang-lab.mkxl @@ -375,4 +375,27 @@ \permanent\protected\def\LABELTEXT#1{\WORD{\labeltext{#1}}} % only for simple cases! +%D For publications we have gender specific ones (one could use the main one for a +%D gender neutral one). +%D +%D \startbuffer +%D \startlines +%D (\labeltext {demo-texts}) +%D (\labeltexts {demo-texts}{ TEST }) +%D (\leftlabeltext {demo-texts}) +%D (\rightlabeltext{demo-texts}) +%D \stoplines +%D +%D \startlines \mainlanguage[cs] +%D test \btxlabeltext{editor} \par +%D test \btxlabeltext{editor:f} \par +%D test \btxlabeltext{editor:m} \par +%D test \btxlabeltext{editors} \par +%D test \btxlabeltext{editors:f} \par +%D test \btxlabeltext{editors:m} \par +%D \stoplines +%D \stopbuffer +%D +%D \typebuffer \getbuffer + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mkxl/lang-url.lmt b/Master/texmf-dist/tex/context/base/mkxl/lang-url.lmt index b918464d032..7607d7d8472 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/lang-url.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/lang-url.lmt @@ -23,12 +23,10 @@ local v_after = variables.after local is_letter = characters.is_letter ---[[ -<p>Hyphenating <l n='url'/>'s is somewhat tricky and a matter of taste. I did -consider using a dedicated hyphenation pattern or dealing with it by node -parsing, but the following solution suits as well. After all, we're mostly -dealing with <l n='ascii'/> characters.</p> -]]-- +-- Hyphenating URL's is somewhat tricky and a matter of taste. I did consider using +-- a dedicated hyphenation pattern or dealing with it by node parsing, but the +-- following solution suits as well. After all, we're mostly dealing with ASCII +-- characters. local urls = { } languages.urls = urls diff --git a/Master/texmf-dist/tex/context/base/mkxl/lpdf-ano.lmt b/Master/texmf-dist/tex/context/base/mkxl/lpdf-ano.lmt index 55b145730b8..4d9af002c79 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/lpdf-ano.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/lpdf-ano.lmt @@ -26,11 +26,12 @@ local rep, format, find = string.rep, string.format, string.find local min = math.min local lpegmatch = lpeg.match local formatters = string.formatters -local sortedkeys, concat = table.sortedkeys, table.concat +local sortedkeys, concat, swapped = table.sortedkeys, table.concat, table.swapped local trace_references = false trackers.register("references.references", function(v) trace_references = v end) local trace_destinations = false trackers.register("references.destinations", function(v) trace_destinations = v end) local trace_bookmarks = false trackers.register("references.bookmarks", function(v) trace_bookmarks = v end) +local trace_externals = false trackers.register("references.externals", function(v) trace_externals = v end) local log_destinations = false directives.register("destinations.log", function(v) log_destinations = v end) local untex_urls = true directives.register("references.untexurls", function(v) untex_urls = v end) @@ -510,59 +511,65 @@ function nodeinjections.destination(width,height,depth,names,view) if method == v_page then for n=1,#names do local name = names[n] - local used = usedviews[name] - if used and used ~= true then - -- already done, maybe a warning - elseif type(name) == "number" then - -- if noview then - -- usedviews[name] = view - -- names[n] = false - -- else + if name then + local used = usedviews[name] + if used and used ~= true then + -- already done, maybe a warning + elseif type(name) == "number" then + -- if noview then + -- usedviews[name] = view + -- names[n] = false + -- else + usedviews[name] = view + names[n] = false + -- end + else usedviews[name] = view - names[n] = false - -- end - else - usedviews[name] = view + end end end elseif method == v_name then for n=1,#names do local name = names[n] - local used = usedviews[name] - if used and used ~= true then - -- already done, maybe a warning - elseif type(name) == "number" then - local used = usedinternals[name] - usedviews[name] = view - names[n] = registerautoprefix(name) - doview = true - else - usedviews[name] = view - doview = true + if name then + local used = usedviews[name] + if used and used ~= true then + -- already done, maybe a warning + elseif type(name) == "number" then + local used = usedinternals[name] + usedviews[name] = view + names[n] = registerautoprefix(name) + doview = true + else + usedviews[name] = view + doview = true + end end end else for n=1,#names do local name = names[n] - if usedviews[name] then - -- already done, maybe a warning - elseif type(name) == "number" then - if noview then - usedviews[name] = view - names[n] = false - else - local used = usedinternals[name] - if used and used ~= defaultview then + if name then + if usedviews[name] then + -- already done, maybe a warning + elseif type(name) == "number" then + if noview then usedviews[name] = view - names[n] = registerautoprefix(name) - doview = true - else names[n] = false + else + local used = usedinternals[name] + if used and used ~= defaultview then + usedviews[name] = view + names[n] = registerautoprefix(name) + doview = true + else + names[n] = false + end end + else + usedviews[name] = view + doview = true end - else - usedviews[name] = view - doview = true end end end @@ -634,20 +641,95 @@ end -- annotations -local function pdffilelink(filename,destination,page,actions) - if not filename or filename == "" or file.basename(filename) == tex.jobname then - return false - end - filename = file.addsuffix(filename,"pdf") - if (not destination or destination == "") or (references.outermethod == v_page) then - destination = pdfarray { (page or 1) - 1, pdf_fit } +local pdffilelink do + + local valid = table.setmetatableindex(function(t,filename) + local found = false + if lfs.isfile(filename) then + report_destinations("loading destinations from file %a",filename) + local pdffile = lpdf.epdf.load(filename) + if pdffile then + local pages = pdffile.pages + local nofpages = pdffile.nofpages + local destinations = pdffile.destinations + if pages and nofpages > 0 and destinations then + local reverse = swapped(pages) + local total = 0 + found = { } + for k, v in next, destinations do + local D = v.D + if D then + found[k] = reverse[D[1]] + total = total + 1 + end + end + t[filename] = found + report_destinations("%i destinations on %i pages found",total,nofpages) + end + end + end + return found + end) + + local pagefromhash = structures.references.pagefromhash + + pdffilelink = function(filename,destination,page,actions) + if not filename or filename == "" or file.basename(filename) == tex.jobname then + return false + end + filename = file.addsuffix(filename,"pdf") + -- page auto name + local forcepage = false + if not destination or destination == "" then + forcepage = true + elseif references.outermethod == v_page then + if not page then + local hash = valid[filename] + page = hash and hash[destination] + if not page or trace_externals then + report_destinations("no %s destination %a in file %a","page",destination,filename) + end + end + forcepage = true + else -- name or auto, maybe only check with auto + local hash = valid[filename] + if hash then + local p = nil + p, destination = pagefromhash(hash,destination,page,actions) + if p then + if references.outermethod == v_name then + -- keep destination string + elseif page then + if p ~= page then + report_destinations("page %i for destination %a in %a conflicts, %i expected",page,destination,filename,p) + page = p + end + forcepage = true + elseif p then + page = p + forcepage = true + end + else + if not page or trace_externals then + report_destinations("no %s destination %a in file %a","name",destination,filename) + end + forcepage = true + end + -- else + -- keep destination string + end + end + if forcepage then + destination = pdfarray { (page or 1) - 1, pdf_fit } + end + return pdfdictionary { + S = pdf_gotor, -- can also be pdf_launch + F = filename, + D = destination or defaultdestination, + NewWindow = actions.newwindow and true or nil, + } end - return pdfdictionary { - S = pdf_gotor, -- can also be pdf_launch - F = filename, - D = destination or defaultdestination, - NewWindow = actions.newwindow and true or nil, - } + end local untex = references.urls.untex @@ -725,6 +807,7 @@ lpdf.action = pdfaction function codeinjections.prerollreference(actions) -- share can become option if actions then +-- inspect(actions) local main, n = pdfaction(actions) if main then local bs, bc = pdfborder() @@ -980,6 +1063,9 @@ runners["outer"] = function(var,actions) end runners["outer with inner"] = function(var,actions) + if var.r then + actions.realpage = var.r + end return pdffilelink(references.checkedfile(var.outer),var.inner,var.r,actions) end diff --git a/Master/texmf-dist/tex/context/base/mkxl/lpdf-img.lmt b/Master/texmf-dist/tex/context/base/mkxl/lpdf-img.lmt index c241ccdb72a..e7dc663d6f0 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/lpdf-img.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/lpdf-img.lmt @@ -67,6 +67,7 @@ local zlibcompress = xzip.compress local zlibdecompress = xzip.decompress local trace = false +local cleanvirtual = resolvers.cleaners.virtual -- false -- for now local report_jpg = logs.reporter("graphics","jpg") local report_jp2 = logs.reporter("graphics","jp2") @@ -74,6 +75,8 @@ local report_png = logs.reporter("graphics","png") trackers.register("graphics.backend", function(v) trace = v end) +directives.register("graphics.cleanvirtuals", function(v) cleanvirtual = v and resolvers.cleaners.virtual or false end) + local injectors = { } lpdf.injectors = injectors @@ -158,6 +161,9 @@ do if trace then report_jpg("%s: width %i, height %i, colordepth %i, size %i",filename,xsize,ysize,colordepth,#content) end + if cleanvirtual then + cleanvirtual(filename) + end return createimage { bbox = { 0, 0, specification.width/xsize, specification.height/ysize }, -- mandate transform = specification.transform, @@ -197,6 +203,9 @@ do if trace then report_jp2("%s: width %i, height %i, size %i",filename,xsize,ysize,#content) end + if cleanvirtual then + cleanvirtual(filename) + end return createimage { bbox = { 0, 0, specification.width/xsize, specification.height/ysize }, -- mandate transform = specification.transform, @@ -1211,6 +1220,9 @@ do end local width = specification.width or xsize * 65536 local height = specification.height or ysize * 65536 + if cleanvirtual then + cleanvirtual(filename) + end return createimage { bbox = { 0, 0, width/xsize, height/ysize }, -- mandate transform = specification.transform, diff --git a/Master/texmf-dist/tex/context/base/mkxl/lpdf-lmt.lmt b/Master/texmf-dist/tex/context/base/mkxl/lpdf-lmt.lmt index f443632b82b..7f3e53f285a 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/lpdf-lmt.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/lpdf-lmt.lmt @@ -38,6 +38,7 @@ local formatters, splitupstring = string.formatters, string.splitup local concat, sortedhash = table.concat, table.sortedhash local setmetatableindex = table.setmetatableindex local loaddata = io.loaddata +local ceil = math.ceil local bpfactor <const> = number.dimenfactors.bp @@ -2272,11 +2273,16 @@ end } end if xformtype == 0 or xformtype == 1 or xformtype == 3 then +-- wrapper.BBox = pdfarray { +-- -margin * bpfactor, +-- -margin * bpfactor, +-- (boundingbox[3] + margin) * bpfactor, +-- (boundingbox[4] + margin) * bpfactor, wrapper.BBox = pdfarray { - -margin * bpfactor, - -margin * bpfactor, - (boundingbox[3] + margin) * bpfactor, - (boundingbox[4] + margin) * bpfactor, + -ceil( margin * bpfactor), + -ceil( margin * bpfactor), + ceil((boundingbox[3] + margin) * bpfactor), + ceil((boundingbox[4] + margin) * bpfactor), } end if xformtype == 0 or xformtype == 2 or xformtype == 3 then diff --git a/Master/texmf-dist/tex/context/base/mkxl/lpdf-pde.lmt b/Master/texmf-dist/tex/context/base/mkxl/lpdf-pde.lmt index 68712d58d9d..4e5d73e0467 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/lpdf-pde.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/lpdf-pde.lmt @@ -67,7 +67,6 @@ local lpdf = lpdf local lpdf_epdf = { } lpdf.epdf = lpdf_epdf -local pdfopen = pdfe.open local pdfopenfile = pdfe.openfile local pdfnew = pdfe.new local pdfclose = pdfe.close @@ -540,10 +539,9 @@ function lpdf_epdf.load(filename,userpassword,ownerpassword,fromstring) local __file__ if fromstring then __data__ = pdfnew(filename,#filename) - elseif pdfopenfile then - __data__ = pdfopenfile(ioopen(filename,"rb")) else - __data__ = pdfopen(filename) + local f = ioopen(filename,"rb") + __data__ = f and pdfopenfile(f) end if __data__ then if userpassword and getstatus(__data__) < 0 then diff --git a/Master/texmf-dist/tex/context/base/mkxl/lpdf-rul.lmt b/Master/texmf-dist/tex/context/base/mkxl/lpdf-rul.lmt index 4efa17bb0bc..ce90488bd44 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/lpdf-rul.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/lpdf-rul.lmt @@ -21,7 +21,7 @@ local ruleactions = nuts.rules.ruleactions local getwhd = nuts.getwhd -local lefttoright_code = nodes.dirvalues.lefttoright +local lefttoright_code = tex.directioncodes.lefttoright local mpcolor = attributes.colors.mpcolor diff --git a/Master/texmf-dist/tex/context/base/mkxl/lpdf-xmp.lmt b/Master/texmf-dist/tex/context/base/mkxl/lpdf-xmp.lmt index e147c796fe0..aec12b22f85 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/lpdf-xmp.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/lpdf-xmp.lmt @@ -346,7 +346,8 @@ local function setupidentity() pdfaddtoinfo("ConTeXt.Jobname",jobname) end -- - pdfaddtoinfo("ConTeXt.Url","www.pragma-ade.com") + -- pdfaddtoinfo("ConTeXt.Url","www.pragma-ade.com") + pdfaddtoinfo("ConTeXt.Url","github.com/contextgarden/context") pdfaddtoinfo("ConTeXt.Support","contextgarden.net") pdfaddtoinfo("TeX.Support","tug.org") -- diff --git a/Master/texmf-dist/tex/context/base/mkxl/luat-cbk.lmt b/Master/texmf-dist/tex/context/base/mkxl/luat-cbk.lmt index 744d12e279a..1726f1e5a63 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/luat-cbk.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/luat-cbk.lmt @@ -12,20 +12,16 @@ local collectgarbage, type, next = collectgarbage, type, next local round = math.round local sortedhash, sortedkeys, tohash = table.sortedhash, table.sortedkeys, table.tohash ---[[ldx-- -<p>Callbacks are the real asset of <l n='luatex'/>. They permit you to hook -your own code into the <l n='tex'/> engine. Here we implement a few handy -auxiliary functions.</p> ---ldx]]-- +-- Callbacks are the real asset of LuaTeX. They permit you to hook your own code +-- into the TeX engine. Here we implement a few handy auxiliary functions. Watch +-- out, there are diferences between LuateX and LuaMetaTeX. callbacks = callbacks or { } local callbacks = callbacks ---[[ldx-- -<p>When you (temporarily) want to install a callback function, and after a -while wants to revert to the original one, you can use the following two -functions. This only works for non-frozen ones.</p> ---ldx]]-- +-- When you (temporarily) want to install a callback function, and after a while +-- wants to revert to the original one, you can use the following two functions. +-- This only works for non-frozen ones. local trace_callbacks = false trackers.register("system.callbacks", function(v) trace_callbacks = v end) local trace_calls = false -- only used when analyzing performance and initializations @@ -47,13 +43,12 @@ local list = callbacks.list local permit_overloads = false local block_overloads = false ---[[ldx-- -<p>By now most callbacks are frozen and most provide a way to plug in your own code. For instance -all node list handlers provide before/after namespaces and the file handling code can be extended -by adding schemes and if needed I can add more hooks. So there is no real need to overload a core -callback function. It might be ok for quick and dirty testing but anyway you're on your own if -you permanently overload callback functions.</p> ---ldx]]-- +-- By now most callbacks are frozen and most provide a way to plug in your own code. +-- For instance all node list handlers provide before/after namespaces and the file +-- handling code can be extended by adding schemes and if needed I can add more +-- hooks. So there is no real need to overload a core callback function. It might be +-- ok for quick and dirty testing but anyway you're on your own if you permanently +-- overload callback functions. -- This might become a configuration file only option when it gets abused too much. @@ -171,12 +166,15 @@ function callbacks.known(name) end function callbacks.report() + local usage = list_callbacks() for name, _ in sortedhash(list) do local str = frozen[name] + local sta = state(name) + local use = usage[name] and "+" or "-" if str then - report_callbacks("%s: %s -> %s",state(name),name,str) + report_callbacks("%-9s : %s : %-22s -> %s",sta,use,name,str) else - report_callbacks("%s: %s",state(name),name) + report_callbacks("%-9s : %s : %-22s", sta,use,name) end end end diff --git a/Master/texmf-dist/tex/context/base/mkxl/luat-cnf.lmt b/Master/texmf-dist/tex/context/base/mkxl/luat-cnf.lmt index ea9eb0d8937..5859411731a 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/luat-cnf.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/luat-cnf.lmt @@ -60,7 +60,7 @@ function texconfig.init() -- not in luametatex "unicode", "utf", "gzip", "zip", "zlib", -- in luametatex - "xzip", "xmath", "xcomplex", "xdecimal", "basexx", + "xzip", "xmath", "xcomplex", "xdecimal", "basexx", "posit", -- maybe some day in luametatex "lz4", "lzo", -- always (mime can go) diff --git a/Master/texmf-dist/tex/context/base/mkxl/luat-cod.mkxl b/Master/texmf-dist/tex/context/base/mkxl/luat-cod.mkxl index ed4a1398119..322076aa140 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/luat-cod.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/luat-cod.mkxl @@ -42,7 +42,7 @@ \toksapp \everydump {% \permanent\let\ctxlatelua \latelua \permanent\def\ctxlatecommand#1{\latelua{commands.#1}}% - \aliased\let\lateluacode \ctxlatelua + \aliased\let\lateluacode \ctxlatelua } % no \appendtoks yet \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mkxl/luat-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/luat-ini.lmt index 3202ea42b1a..56e3bd1c18d 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/luat-ini.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/luat-ini.lmt @@ -6,11 +6,9 @@ if not modules then modules = { } end modules ['luat-ini'] = { license = "see context related readme files" } ---[[ldx-- -<p>We cannot load anything yet. However what we will do us reserve a few tables. -These can be used for runtime user data or third party modules and will not be -cluttered by macro package code.</p> ---ldx]]-- +-- We cannot load anything yet. However what we will do us reserve a few tables. +-- These can be used for runtime user data or third party modules and will not be +-- cluttered by macro package code. userdata = userdata or { } -- for users (e.g. functions etc) thirddata = thirddata or { } -- only for third party modules diff --git a/Master/texmf-dist/tex/context/base/mkxl/luat-lib.mkxl b/Master/texmf-dist/tex/context/base/mkxl/luat-lib.mkxl index cb161cafa7c..d701fd2937e 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/luat-lib.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/luat-lib.mkxl @@ -34,7 +34,7 @@ \registerctxluafile{util-sta}{} -\registerctxluafile{util-sbx}{} % needs tracker and templates +\registerctxluafile{util-sbx}{autosuffix} % needs tracker and templates \registerctxluafile{util-soc-imp-reset} {} \registerctxluafile{util-soc-imp-socket} {} @@ -66,7 +66,7 @@ \registerctxluafile{data-dec}{} \registerctxluafile{data-tar}{} %registerctxluafile{data-crl}{} -\registerctxluafile{data-sch}{} +\registerctxluafile{data-sch}{autosuffix} \registerctxluafile{data-tre}{} \registerctxluafile{data-lua}{} \registerctxluafile{data-ctx}{} diff --git a/Master/texmf-dist/tex/context/base/mkxl/luat-run.lmt b/Master/texmf-dist/tex/context/base/mkxl/luat-run.lmt index f6b2ea06368..7796bb4b924 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/luat-run.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/luat-run.lmt @@ -156,10 +156,10 @@ appendaction(wrapupactions,"system",synctex.wrapup) -- this can be done later -callbacks.register('start_run', start_run, "actions performed at the beginning of a run") -callbacks.register('stop_run', stop_run, "actions performed at the end of a run") +callbacks.register("start_run", start_run, "actions performed at the beginning of a run") +callbacks.register("stop_run", stop_run, "actions performed at the end of a run") callbacks.register("pre_dump", pre_dump_actions, "lua related finalizers called before we dump the format") -- comes after \everydump -callbacks.register('wrapup_run', wrapup_run, "actions performed after closing files") +callbacks.register("wrapup_run", wrapup_run, "actions performed after closing files") -- an example: @@ -201,8 +201,6 @@ local report_open = logs.reporter("open source") local report_close = logs.reporter("close source") local report_load = logs.reporter("load resource") -local register = callbacks.register - local level = 0 local total = 0 local stack = { } @@ -211,56 +209,57 @@ function luatex.currentfile() return stack[#stack] or tex.jobname end +function luatex.currentlevel() + return level +end + +function luatex.currenttotal() + return total +end + +local enabled = true directives.register("system.reportfiles", function(v) enabled = v end) + local function report_start(name,rest) - if rest then - -- luatex - if name ~= 1 then + if enabled then + if rest then + -- luatex + if name ~= 1 then + insert(stack,false) + return + end + name = rest + end + if find(name,"virtual://",1,true) then insert(stack,false) - return + else + insert(stack,name) + total = total + 1 + level = level + 1 + -- report_open("%i > %i > %s",level,total,name or "?") + report_open("level %i, order %i, name %a",level,total,name or "?") + synctex.setfilename(name) end - name = rest - end - if find(name,"virtual://",1,true) then - insert(stack,false) - else - insert(stack,name) - total = total + 1 - level = level + 1 - -- report_open("%i > %i > %s",level,total,name or "?") - report_open("level %i, order %i, name %a",level,total,name or "?") - synctex.setfilename(name) end end local function report_stop() - local name = remove(stack) - if name then - -- report_close("%i > %i > %s",level,total,name or "?") - report_close("level %i, order %i, name %a",level,total,name or "?") - level = level - 1 - name = stack[#stack] --- synctex.setfilename(stack[#stack] or tex.jobname) + if enabled then + local name = remove(stack) if name then - synctex.setfilename(name) + -- report_close("%i > %i > %s",level,total,name or "?") + report_close("level %i, order %i, name %a",level,total,name or "?") + level = level - 1 + name = stack[#stack] + -- synctex.setfilename(stack[#stack] or tex.jobname) + if name then + synctex.setfilename(name) + end end end end -local function report_none() -end - -register("start_file",report_start) -register("stop_file", report_stop) - -directives.register("system.reportfiles", function(v) - if v then - register("start_file",report_start) - register("stop_file", report_stop) - else - register("start_file",report_none) - register("stop_file", report_none) - end -end) +callbacks.register("start_file",report_start,"report opening of a file") +callbacks.register("stop_file", report_stop, "report closing of a file") -- start_run doesn't work @@ -273,7 +272,7 @@ end) local report = logs.reporter("csname overload") local reported = { } -callback.register("handle_overload", function(fatal,overload,csname,flags) +callbacks.register("handle_overload", function(fatal,overload,csname,flags) if not reported[csname] then logs.newline() local readstate = status.readstate @@ -295,7 +294,7 @@ callback.register("handle_overload", function(fatal,overload,csname,flags) osexit(1) end end -end) +end,"handle primitive and macro overload protection") -- bonus diff --git a/Master/texmf-dist/tex/context/base/mkxl/lxml-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/lxml-ini.mkxl index be249c1f3bd..a185efd124d 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/lxml-ini.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/lxml-ini.mkxl @@ -83,7 +83,7 @@ \immutable\def\xmltempbuffername{xml-temp} \permanent\protected\def\prettyprintbuffer#1#2% only used here - {\ifdefined\scitebuffer + {\ifdefined\scitebuffer % we could predefine to relax \scitebuffer[#2][#1]% \else \typebuffer[#1][\c!option=#2]% diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-acc.mklx b/Master/texmf-dist/tex/context/base/mkxl/math-acc.mklx index 49f97ae9c1c..2201ed88635 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-acc.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/math-acc.mklx @@ -32,6 +32,49 @@ %D Older implementations are kept in the \MKII\ and \MKIV\ modules for educational %D purposes. +%D Only very few fonts provide flat accents but we emulate them for those that don't +%D have them. We also need to fix the related font parameter for a few fonts like +%D Lucida and Garamond. + +% \startbuffer +% \im{ +% \dostepwiserecurse{`A}{`Z}{1}{ +% \blackrule[height=\the\Umathflattenedaccentbaseheight\textstyle,depth=0pt,width=0.05ts] +% \hat{\char#1} +% } +% } +% \stopbuffer +% +% \start % TEXpage[offset=1ts] +% \showglyphs +% \switchtobodyfont[modern] \getbuffer\par +% \switchtobodyfont[erewhon] \getbuffer\par +% \switchtobodyfont[concrete] \getbuffer\par +% \switchtobodyfont[libertinus] \getbuffer\par +% \switchtobodyfont[stixtwo] \getbuffer\par +% \switchtobodyfont[kpfonts] \getbuffer\par +% \switchtobodyfont[minion] \getbuffer\par +% \switchtobodyfont[schola] \getbuffer\par +% \switchtobodyfont[lucida] \getbuffer\par +% \switchtobodyfont[xcharter] \getbuffer\par +% \switchtobodyfont[libertinus] \getbuffer\par +% \switchtobodyfont[termes] \getbuffer\par +% \stop %TEXpage + +% scale: +% +% no : only use base +% yes : use base, variants and extensible, stretch and shrink when set +% keep : use base, variants and extensible, stretch and shrink when set, but keep base +% +% alignsymbol: +% +% center when accent is wider than base +% +% stretch|shrink: +% +% scale accent to fit (base and variants depending on 'scale' value) + \installcorenamespace{mathaccents} \installcommandhandler \??mathaccents {mathaccent} \??mathaccents @@ -43,7 +86,10 @@ \c!bottom=, \c!mathstyle=, \c!color=, - \c!stretch=\v!no, + \c!scale=\v!no, + \c!alignsymbol=\v!yes, + %\c!stretch=\v!no, + %\c!shrink=\v!no, \c!define=\v!yes] % not used \definemathaccent @@ -92,23 +138,51 @@ \installlocalcurrenthandler \??mathaccents {mathaccent} +%D \starttyping +%D \im { \showboxes \showglyphs +%D \hat{\tilde{\dot{x}}} +%D } +%D \im { \showboxes \showglyphs +%D \hat[align=middle]{\tilde[align=middle]{\dot{x}}} +%D } +%D \stoptyping + \tolerant\protected\def\math_accent_make_double#class#kind#top#bottom#*[#settings]#:#content% {\beginmathgroup \setlocalmathaccentcurrent{#class}% \edef\currentmathaccent{#class}% \startusemathstyleparameter\mathaccentparameter\c!mathstyle \setupcurrentmathaccent[#settings]% - \edef\m_fixed{\ifcstok{\mathaccentparameter\c!stretch}\v!yes\else\s!fixed\fi}% + \edef\p_scale{\mathaccentparameter\c!scale}% + \ifx\p_scale\v!keep + \lettonothing\m_fixed + \orelse\ifx\p_scale\v!yes + \lettonothing\m_fixed + \else + \let\m_fixed\s!fixed + \fi \Umathaccent \usedcolorparameterattributes{\mathaccentparameter\c!color}% - % nooverflow % there is never na overflow anyway but we do accept thekey + % nooverflow % there is never na overflow anyway but we do accept the key + \ifcstok{\mathaccentparameter\c!align }\v!middle\s!center \space\fi + \ifcstok{\mathaccentparameter\c!stretch}\v!yes \s!stretch\space\fi + \ifcstok{\mathaccentparameter\c!shrink }\v!yes \s!shrink \space\fi + \ifx\p_scale\v!keep + \s!keepbase\space + \fi + \ifcstok{\mathaccentparameter\c!alignsymbol}\v!yes + \s!nooverflow\space + \fi \ifcase#kind\or - top \m_fixed + \s!top\space + \m_fixed \fam\zerocount#top \or - bottom \m_fixed + \s!bottom\space + \m_fixed \fam\zerocount#bottom \or - both \m_fixed + \s!both\space + \m_fixed \fam\zerocount#bottom \fam\zerocount#top \fi @@ -135,7 +209,7 @@ \pushoverloadmode % These retain the given unicode values ... but can stretch when configured -% to do so: \setupmathaccent[\v!top][\c!stretch=\v!yes] +% to do so: \setupmathaccent[\v!top][\c!scale=\v!yes] % Extended/modified below % @@ -155,7 +229,7 @@ \definemathtopaccent[\v!top][acute] ["0301] \definemathtopaccent[\v!top][hat] ["0302] \definemathtopaccent[\v!top][tilde] ["0303] -\definemathtopaccent[\v!top][bar] ["0304] +\definemathtopaccent[\v!top][bar] ["0305] %definemathtopaccent[\v!top][overbar] ["0305]% We expect overbar to stretch, so later \definemathtopaccent[\v!top][breve] ["0306] \definemathtopaccent[\v!top][dot] ["0307] @@ -170,8 +244,8 @@ %definemathtopaccent[\v!top][overturnedcomma] ["0312] %definemathtopaccent[\v!top][overcommatopright] ["0315] %definemathtopaccent[\v!top][leftangleabove] ["031A] -\definemathtopaccent[\v!top][leftharpoonaccent] ["20D0] -\definemathtopaccent[\v!top][rightharpoonaccent] ["20D1] +\definemathtopaccent[\v!top][overleftharpoon] ["20D0] +\definemathtopaccent[\v!top][overrightharpoon] ["20D1] %definemathtopaccent[\v!top][verticaloverlayaccent]["20D2] %definemathtopaccent[\v!top][vec] ["20D7]% We expect vec to stretch, so later \definemathtopaccent[\v!top][dddot] ["20DB] @@ -189,17 +263,17 @@ \definemathaccent [\v!top:\v!stretch] [\v!top] - [\c!stretch=\v!yes] + [\c!scale=\v!keep,\c!stretch=\v!yes,\c!shrink=\v!yes] \definemathaccent [\v!bottom:\v!stretch] [\v!bottom] - [\c!stretch=\v!yes] + [\c!scale=\v!keep,\c!stretch=\v!yes,\c!shrink=\v!yes] \definemathaccent [\v!both:\v!stretch] [\v!both] - [\c!stretch=\v!yes] + [\c!scale=\v!keep,\c!stretch=\v!yes,\c!shrink=\v!yes] %D We have a problem. We can use stackers but then we need to adapt the dimensions %D which is font dependent. So, for now we keep them as accents. @@ -208,7 +282,7 @@ \definemathtopaccent[\v!top:\v!stretch][wideacute]["0301] \definemathtopaccent[\v!top:\v!stretch][widehat] ["0302] \definemathtopaccent[\v!top:\v!stretch][widetilde]["0303] -\definemathtopaccent[\v!top:\v!stretch][widebar] ["0305]%or 305 +\definemathtopaccent[\v!top:\v!stretch][widebar] ["0305]% (not 304, the caret) \definemathtopaccent[\v!top:\v!stretch][widebreve]["0306] \definemathtopaccent[\v!top:\v!stretch][widedot] ["0307] \definemathtopaccent[\v!top:\v!stretch][wideddot] ["0308] @@ -220,17 +294,17 @@ \definemathtopaccent[\v!top:\v!stretch][wideoverleftharpoon] ["20D0] \definemathtopaccent[\v!top:\v!stretch][wideoverrightharpoon] ["20D1] -\definemathtopaccent[\v!top:\v!stretch][wideoverleftarrow] ["20D6] -\definemathtopaccent[\v!top:\v!stretch][wideoverrightarrow] ["20D7] +\definemathtopaccent[\v!top:\v!stretch][wideoverleftarrow] ["20D6] +\definemathtopaccent[\v!top:\v!stretch][wideoverrightarrow] ["20D7] \definemathtopaccent[\v!top:\v!stretch][wideoverleftrightarrow]["20E1] -\definemathbottomaccent[\v!bottom:\v!stretch][wideundertilde]["0330] -\definemathbottomaccent[\v!bottom:\v!stretch][wideunderbar]["0332] -\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftrightarrow]["034D] -\definemathbottomaccent[\v!bottom:\v!stretch][wideunderrightharpoon]["20EC] -\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftharpoon]["20ED] -\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftarrow]["20EE] -\definemathbottomaccent[\v!bottom:\v!stretch][wideunderrightarrow]["20EF] +\definemathbottomaccent[\v!bottom:\v!stretch][wideundertilde] ["0330] +\definemathbottomaccent[\v!bottom:\v!stretch][wideunderbar] ["0332] +\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftrightarrow]["034D] % weird code +\definemathbottomaccent[\v!bottom:\v!stretch][wideunderrightharpoon] ["20EC] +\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftharpoon] ["20ED] +\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftarrow] ["20EE] +\definemathbottomaccent[\v!bottom:\v!stretch][wideunderrightarrow] ["20EF] \aliased\let\mathring\ring % for a while diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-act.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-act.lmt index a6614aaa508..ee9e56f8fab 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-act.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/math-act.lmt @@ -18,6 +18,7 @@ local type, next, tonumber = type, next, tonumber local fastcopy, copytable, insert, remove, concat = table.fastcopy, table.copy, table.insert, table.remove, table.concat local formatters = string.formatters local byte = string.byte +local max = math.max local setmetatableindex, sortedkeys, sortedhash = table.setmetatableindex, table.sortedkeys, table.sortedhash local lpegmatch = lpeg.match @@ -45,13 +46,18 @@ local blocks = characters.blocks local stepper = utilities.parsers.stepper local helpers = fonts.helpers -local upcommand = helpers.commands.up -local downcommand = helpers.commands.down -local rightcommand = helpers.commands.right -local leftcommand = helpers.commands.left -local charcommand = helpers.commands.char local prependcommands = helpers.prependcommands +local vfcommands = helpers.commands +local upcommand = vfcommands.up +local downcommand = vfcommands.down +local rightcommand = vfcommands.right +local leftcommand = vfcommands.left +local slotcommand = vfcommands.slot +local charcommand = vfcommands.char +local push = vfcommands.push +local pop = vfcommands.pop + local sequencers = utilities.sequencers local appendgroup = sequencers.appendgroup local appendaction = sequencers.appendaction @@ -290,7 +296,7 @@ local function report_tweak(fmt,target,original,...) metadata and metadata.fontname or "unknown", parameters.size or 655360, parameters.mathsize or 1, - string.formatters[fmt](...) + formatters[fmt](...) ) else print("something is wrong") @@ -427,6 +433,8 @@ local detail do return nxt end end + elseif list == "flataccent" then + return c.flataccent end end end @@ -527,7 +535,7 @@ do k = mathgaps[k] or k local character = targetcharacters[k] if character then --- if not character.tweaked then -- todo: add a force + -- if not character.tweaked then -- todo: add a force local t = type(v) if t == "number" then v = list[v] @@ -660,7 +668,7 @@ do else report_mathtweak("invalid dimension entry %U",k) end --- character.tweaked = true + -- character.tweaked = true if v.all then local nxt = character.next if nxt then @@ -674,7 +682,7 @@ do end end end --- end + -- end else report_tweak("no character %U",target,original,k) end @@ -1303,6 +1311,7 @@ do else c.width = width end +c.bottomanchor = width/2 -- maybe optional end if italic then c.italic = nil @@ -1343,8 +1352,9 @@ do end end end - return - elseif not list or list == "all" or list == true or parameters.all then + goto done + end + if not list or list == "all" or list == true or parameters.all then list = sortedkeys(targetcharacters) elseif type(list) == "string" then list = { list } @@ -1371,6 +1381,7 @@ do end end end + ::done:: feedback_tweak(whatever,target,original,done) end @@ -1695,7 +1706,8 @@ do accent = { [0x0300] = over, -- widegrave [0x0308] = over, -- wideddot - [0x0304] = over, -- widebar + [0x0304] = over, -- macron (bar) + [0x0305] = over, -- widebar [0x0301] = over, -- wideacute [0x0302] = over, -- widehat [0x030C] = over, -- widecheck @@ -1710,7 +1722,7 @@ do datasets.accentdimensions = candidates local function adapt(c,factor,baseheight,basedepth) --- if not c.tweaked then + if not c.tweaked then local height = c.height or 0 local depth = c.depth or 0 local yoffset = 0 @@ -1736,8 +1748,8 @@ do c.yoffset = yoffset ~= 0 and yoffset or nil c.height = height > 0 and height or nil c.depth = depth > 0 and depth or nil --- c.tweaked = true --- end + c.tweaked = true + end end local function process(target,original,characters,list,baseheight,basedepth) @@ -1806,46 +1818,18 @@ end do - local addprivate = fonts.helpers.addprivate - local privateslot = fonts.helpers.privateslot - - -- function mathtweaks.addrules(target,original,parameters) - -- local characters = target.characters - -- local height = target.mathparameters.OverbarRuleThickness - -- local depth = target.mathparameters.UnderbarRuleThickness - -- local width = target.parameters.emwidth/2 - -- local step = 0.8 * width - -- characters[0x203E] = { -- over - -- width = width, - -- height = height, - -- depth = 0, - -- unicode = 0x203E, - -- commands = { { "rule", height, width } }, - -- parts = { - -- { advance = width, ["end"] = step, glyph = 0x203E, start = 0 }, - -- { advance = width, ["end"] = 0, glyph = 0x203E, start = step, extender = 1 }, - -- } - -- } - -- characters[0x0332] = { -- under - -- width = width, - -- height = 0, - -- depth = depth, - -- yoffset = -depth, - -- unicode = 0x0332, - -- commands = { { "rule", height, width } }, - -- parts = { - -- { advance = width, ["end"] = step, glyph = 0x0332, start = 0 }, - -- { advance = width, ["end"] = 0, glyph = 0x0332, start = step, extender = 1 }, - -- } - -- } - -- end + local addprivate = fonts.helpers.addprivate + local privateslot = fonts.helpers.privateslot + local newprivateslot = fonts.helpers.newprivateslot function mathtweaks.addrules(target,original,parameters) local characters = target.characters local thickness = target.mathparameters.OverbarRuleThickness local width = target.parameters.emwidth / 2 - local step = 0.8 * width - characters[0x203E] = { -- over + local width = target.parameters.emwidth / 3 +-- local step = 0.8 * width + local step = 0.5 * width + characters[0x203E] = { -- middle used for all kind width = width, height = thickness / 2, depth = thickness / 2, @@ -1858,8 +1842,43 @@ do }, partsorientation = "horizontal", } - -- - characters[0x0332] = characters[0x203E] + local function build(target,leftarrow,rightarrow) + if leftarrow and rightarrow then + -- actually the same sort of code as we have for antykwa + local left = leftarrow.parts + local right = rightarrow.parts + if left and right then + local leftline = right[1].glyph + local rightline = left [#left].glyph + local leftdata = characters[leftline] + local rightdata = characters[rightline] + local leftwidth = leftdata.width + local rightwidth = rightdata.width + local result = characters[target] -- copytable(leftdata) + if not result or result.width == 0 then + result = { + height = leftdata.height, + depth = leftdata.depth, + width = 0.9*leftwidth + rightwidth, + unicode = target, + commands = { + slotcommand[0][leftline], + leftcommand[0.1*leftwidth], + slotcommand[0][rightline], + }, + } + characters[target] = result + end + result.parts = { + { advance = leftwidth, glyph = leftline, ["end"] = .9*leftwidth, start = 0 }, + { advance = rightwidth, glyph = rightline, ["end"] = .1*leftwidth, start = .9*rightwidth, extender = 1 }, + } + result.partsorientation = "horizontal" + end + end + end + build(0x305,characters[0x20D6],characters[0x20D7]) -- overbar accent + build(0x332,characters[0x20EE],characters[0x20EF]) -- underbar accent -- -- lucida lacks them ... -- @@ -1875,11 +1894,16 @@ do commands = { { "rule", thickness * 2.5, thickness } }, }) characters[0x23B4] = { -- over - width = width, +-- width = width, + width = 2*thickness+width, height = half, depth = double, unicode = 0x23B4, - commands = { { "rule", thickness, width } }, + commands = { + slotcommand[0][tpiece], + slotcommand[0][0x203E], + slotcommand[0][tpiece], + }, parts = { { advance = thickness, glyph = tpiece, ["end"] = 0, start = half }, { advance = width, glyph = 0x203E, ["end"] = step, start = step, extender = 1 }, @@ -1896,12 +1920,16 @@ do yoffset = - half, commands = { { "rule", thickness * 2.5, thickness } }, }) - characters[0x23B5] = { -- over - width = width, + characters[0x23B5] = { -- under + width = 2*thickness+width, height = double, depth = half, unicode = 0x23B5, - commands = { { "rule", thickness, width } }, + commands = { + slotcommand[0][bpiece], + slotcommand[0][0x203E], + slotcommand[0][bpiece], + }, parts = { { advance = thickness, glyph = bpiece, ["end"] = 0, start = half }, { advance = width, glyph = 0x203E, ["end"] = step, start = step, extender = 1 }, @@ -1913,10 +1941,216 @@ do -- end + -- vfmath.builders.extension(target) + + local rbe = newprivateslot("radical bar extender") + local fbe = newprivateslot("fraction bar extender") + + local frp = { + newprivateslot("flat rule left piece"), + newprivateslot("flat rule middle piece"), + newprivateslot("flat rule right piece"), + } + + local rrp = { + newprivateslot("radical rule left piece"), + newprivateslot("radical rule middle piece"), + newprivateslot("radical rule right piece"), + } + + local mrp = { + newprivateslot("minus rule left piece"), + newprivateslot("minus rule middle piece"), + newprivateslot("minus rule right piece"), + } + + local function useminus(target,unicode,characters,parameters,skipfirst,what,tounicode) + local minus = characters[0x2212] + local parts = minus.parts + if parameters == true then + parameters = { } + end + if parts then + what = copytable(what) + parts = copytable(parts) + local xscale = parameters.xscale or 1 -- why not applied to width ? + local yscale = parameters.yscale or 1 + local mwidth = minus.width + local mheight = minus.height + local height = (parameters.height or 1) * mheight + local yshift = (parameters.yoffset or 0) * mheight + local loverlap = parameters.leftoverlap or 0 + local roverlap = parameters.rightoverlap or 0 + local loffset = parameters.leftoffset or 0 + local roffset = parameters.rightoffset or 0 + if skipfirst then + remove(parts,1) + remove(what,1) + end + height = height / 2 + yshift = yshift + height + for i=1,#parts do + local part = parts[i] + local glyph = part.glyph + local gdata = characters[glyph] + local width = gdata.width + local xshift = 0 + if i == 1 and loverlap ~= 0 then + xshift = loverlap * width + width = width - xshift + elseif i == #parts and roverlap ~= 0 then + width = width + roverlap * width + end + characters[what[i]] = { + height = height, + depth = height, + width = width, + advance = gdata.width, + commands = { + leftcommand[xshift], + downcommand[yshift], + { "slot", 0, glyph, xscale, yscale }, + }, + } +if part["start"] >= width then + part["start"] = width +end +if part["end"] >= width then + part["end"] = width +end +part.advance = width + part.glyph = what[i] + end + xshift = loffset * mwidth + loverlap * mwidth + width = mwidth - xshift - roffset * mwidth - roverlap * mwidth + characters[unicode] = { + -- base character + height = height, + depth = height, + width = width, + commands = { + leftcommand[xshift], + downcommand[yshift], + { "slot", 0, 0x2212, xscale, yscale }, + }, + unicode = tounicode or unicode, + -- extensibles + parts = parts, + partsorientation = "horizontal", + } + end + end + + -- add minus parts of not there and create clipped clone + + local function checkminus(target,unicode,characters,parameters,skipfirst,what,tounicode) + local minus = characters[unicode] + local parts = minus.parts + if parameters == true then + parameters = { } + end + local p_normal = 0 + local p_flat = 0 + local mwidth = minus.width + local height = minus.height + local depth = minus.depth + local loffset = parameters.leftoffset or 0 + local roffset = parameters.rightoffset or 0 + local lshift = mwidth * loffset + local rshift = mwidth * roffset + local width = mwidth - lshift - rshift + if parts then + -- print("minus has parts") + if lshift ~= 0 or width ~= mwidth then + parts = copytable(parts) + for i=1,#parts do + local part = parts[i] + local glyph = part.glyph + local gdata = characters[glyph] + local width = gdata.width + local advance = part.advance + local lshift = 0 + if i == 1 and left ~= 0 then + lshift = loffset * width + width = width - lshift + advance = advance - lshift + elseif i == #parts and roffset ~= 0 then + width = width - rshift + advance = advance - rshift + end + characters[what[i]] = { + height = height, + depth = depth, + width = width, + commands = { + leftcommand[lshift], + slotcommand[0][glyph], +-- { "offset", lshift, 0, glyph }, + }, + } + part.glyph = what[i] + part.advance = advance + end + minus.parts = parts + minus.partsorientation = "horizontal" + + end + else + local f_normal = formatters["M-NORMAL-%H"](unicode) + -- local p_normal = hasprivate(main,f_normal) + p_normal = addprivate(target,f_normal,{ + height = height, + width = width, + commands = { + push, + leftcommand[lshift], + slotcommand[0][unicode], + pop, +-- { "offset", lshift, 0, unicode }, + }, + }) +-- local step = width/2 + local step = .8*width + minus.parts = { + { extender = 0, glyph = p_normal, ["end"] = step, start = 0, advance = width }, + { extender = 1, glyph = p_normal, ["end"] = step, start = step, advance = width }, + { extender = 0, glyph = p_normal, ["end"] = 0, start = step, advance = width }, + } + minus.partsorientation = "horizontal" + end + minus.unicode = tounicode or unicode + end + + function mathtweaks.replacerules(target,original,parameters) + local characters = target.characters + local minus = parameters.minus + local fraction = parameters.fraction + local radical = parameters.radical + local stacker = parameters.stacker + if minus then + checkminus(target,0x2212,characters,minus,false,mrp) + end + if fraction then + useminus(target,fbe,characters,fraction,false,frp,0x2044) -- division slash + end + if radical then +if not characters[rbe] then + local skipfirst = true + if radical.skipfirst == false then -- explicit + skipfirst = false + end + useminus(target,rbe,characters,radical,skipfirst,rrp,0x2061) -- apply function +end + end + if stacker then + useminus(target,0x203E,characters,stacker,false,frp) + end + end + local force = false experiments.register("math.arrows", function(v) force = v end) local function tighten(target,unicode,left,right,squeeze,yoffset) - local name = string.formatters["math tightened %U %.3N %.3N %.3N %.3N"](unicode,left,right,squeeze,yoffset) + local name = formatters["math tightened %U %.3N %.3N %.3N %.3N"](unicode,left,right,squeeze,yoffset) local slot = privateslot(target,name) if not slot then local characters = target.characters @@ -1947,7 +2181,7 @@ do if chardata and (force or overloads[unicode] == false or not chardata.parts) then if not list then -- chardata.parts = nil -- when we test - chardata.parts = { { glyph = unicode } } +-- chardata.parts = { { glyph = unicode } } else local overload = overloads[unicode] local parts = { } @@ -1982,7 +2216,8 @@ do end end if #parts == #list then - chardata.parts = parts + chardata.parts = parts + chardata.partsorientation = "horizontal" end end end @@ -2024,6 +2259,7 @@ do return { -- [0x002D] = { { left = slack, right = slack, glyph = 0x2212 }, single }, -- rel +-- [0x2212] = { { left = slack, right = slack, glyph = 0x2212 }, single }, -- rel -- [0x2190] = leftsingle, -- leftarrow [0x219E] = leftsingle, -- twoheadleftarrow @@ -2259,7 +2495,8 @@ do local function fix(target,original,characters,u,l) local data = characters[u] if data then - data.innerlocation = l.location == "right" and 2 or 1 + -- data.innerlocation = l.location == "right" and 2 or 1 + data.innerlocation = l.location == "right" and "right" or "left" data.innerxoffset = (l.hfactor or 1) * (data.width or 0) data.inneryoffset = (l.vfactor or 1) * ((data.height or 0) + (data.depth or 0)) end @@ -2451,17 +2688,18 @@ do -- see pagella for an extensive example local nps = fonts.helpers.newprivateslot local mapping = { - [0x0300] = { 0x0060, false, nps("flat 0x0060 1") }, - [0x0308] = { 0x00A8, false, nps("flat 0x00A8 1") }, - [0x0304] = { 0x00AF, false, nps("flat 0x00AF 1") }, - [0x0301] = { 0x00B4, false, nps("flat 0x00B4 1") }, - [0x0302] = { 0x02C6, true, nps("flat 0x02C6 1") }, - [0x030C] = { 0x02C7, true, nps("flat 0x02C7 1") }, - [0x0306] = { 0x02D8, false, nps("flat 0x02D8 1") }, - [0x0307] = { 0x02D9, false, nps("flat 0x02D9 1") }, - [0x030A] = { 0x02DA, false, nps("flat 0x02DA 1") }, - [0x0303] = { 0x02DC, true, nps("flat 0x02DC 1") }, - [0x20DB] = { 0x20DB, false, nps("flat 0x20DB 1") }, + [0x0300] = { 0x0060, false }, + [0x0308] = { 0x00A8, false }, + [0x0304] = { 0x00AF, false }, -- 305 + [0x0301] = { 0x00B4, false }, + [0x0302] = { 0x02C6, true }, + [0x030C] = { 0x02C7, true }, + [0x0306] = { 0x02D8, false }, + [0x0307] = { 0x02D9, false }, + [0x030A] = { 0x02DA, false }, + [0x0303] = { 0x02DC, true }, + [0x20DB] = { 0x20DB, false }, +-- [0x20EF] = { 0x20EF, false }, } datasets.fixaccents = mapping @@ -2469,6 +2707,18 @@ do -- see pagella for an extensive example datasets.flattenaccents = mapping datasets.copyaccents = mapping + -- local flat = stretchingdata.flataccent + -- if flat then + -- -- Nasty! xoffset needed. Check this when we patch vf. + -- local flatdata = characters[flat] + -- flatdata.width = width + -- flatdata.advance = 0 + -- flatdata.topanchor = topanchor + -- flatdata.xoffset = width + topanchor + -- end + +local cdata = characters.data + function mathtweaks.fixaccents(target,original,parameters) local characters = target.characters local done = false @@ -2476,13 +2726,27 @@ do -- see pagella for an extensive example local alias = entry[1] local stretchingdata = characters[stretching] if stretchingdata and stretchingdata.width == 0 then +if false then + local b = target.descriptions[stretching].boundingbox + if b then + local llx = b[1] * target.parameters.hfactor + local urx = b[3] * target.parameters.hfactor + width = urx - llx + stretchingdata.width = width + stretchingdata.xoffset = - llx + stretchingdata.advance = urx + stretchingdata.topanchor = width/2 + stretchingdata.bottomanchor = width/2 + end +else local topanchor = stretchingdata.topanchor or 0 local width = -topanchor - topanchor = width/2 + topanchor = width/2 stretchingdata.width = width stretchingdata.advance = 0 stretchingdata.topanchor = topanchor stretchingdata.commands = { rightcommand[width + topanchor], charcommand[stretching] } +end if not trace_tweaking then done = true elseif done then @@ -2495,6 +2759,56 @@ do -- see pagella for an extensive example feedback_tweak("fixaccents",target,original,done) end + function mathtweaks.checkaccents(target,original,parameters) + local characters = target.characters + local done = false + local factor = target.parameters.hfactor + for unicode, data in sortedhash(characters) do + local width = data.width + if width == 0 then + local d = chardata[data.unicode or unicode] + local c = d and d.category + if c == "mn" or c == "sk" or c == "lm" then -- we can probably can go + local b = target.descriptions[unicode].boundingbox + if b then + local topanchor = data.topanchor or 0 + local llx = b[1] * factor + local urx = b[3] * factor +-- if topanchor < 0 then +if true then + -- width = - topanchor + width = 2 * (topanchor - llx) +-- data.commands = { +-- -- rightcommand[width+width/2], +-- rightcommand[-llx], +-- slotcommand[0][unicode] +-- } +data.xoffset = -llx +else + width = urx - llx + -- data.advance = urx + data.commands = { + leftcommand[llx], + slotcommand[0][unicode] + } +end + data.width = width + data.topanchor = width/2 + data.bottomanchor = width/2 + end + if not trace_tweaking then + done = true + elseif done then + done[unicode] = true + else + done = { [unicode] = true } + end + end + end + end + feedback_tweak("checkaccents",target,original,done) + end + -- all true|number false function mathtweaks.extendaccents(target,original,parameters) @@ -2550,24 +2864,40 @@ do -- see pagella for an extensive example -- offset factor 0.9|calculated -- squeeze factor 0.1|calculated + local f_flat = formatters["flat accent %05X"] + function mathtweaks.flattenaccents(target,original,parameters) local characters = target.characters local force = parameters.force - local squeeze = parameters.squeeze or 0.8 - local ofactor = parameters.offset or (squeeze/2) - local hfactor = parameters.height or (1 - ofactor) + local squeeze = parameters.squeeze or 0.85 + local ofactor = parameters.offset or (squeeze/8.5) + local hfactor = parameters.height or 0.95 -- (1 - ofactor) local done = false for stretching, entry in sortedhash(mapping) do - local last = characters[stretching] + local code = stretching + local last = characters[stretching] while last do if force or not last.flataccent then - local slot = entry[3] - local data = copytable(last) - local height = data.height or 0 - data.effect = { squeeze = squeeze } - data.height = hfactor * height - data.yoffset = ofactor * height - characters[slot] = data + local slot = nps(f_flat(code)) + local height = last.height or 0 +-- print(last.width/65536,code,slot) +-- data.effect = { squeeze = squeeze } +characters[slot] = { + width = last.width, + depth = last.depth, + height = last.height * hfactor, + topanchor = last.topanchor, + bottomanchor = last.bottomanchor, + commands = { { "offset", 0, ofactor * height, code, 1, squeeze } }, +-- commands = { slotcommand[0][code] }, +-- effect = { squeeze = squeeze }, +-- next = last.next, + unicode = last.unicode, +} +-- if code == 770 then +-- inspect(last) +-- end + last.flataccent = slot if not trace_tweaking then done = true @@ -2577,9 +2907,9 @@ do -- see pagella for an extensive example done = { [stretching] = true } end end - local n = last.next - if n then - last = characters[n] + code = last.next + if code then + last = characters[code] else break end @@ -2602,7 +2932,8 @@ do -- see pagella for an extensive example height = stretchingdata.height, depth = stretchingdata.depth, next = stretchingdata.next, - commands = { charcommand[stretching] }, +-- commands = { charcommand[stretching] }, + commands = stretchingdata.commands or { charcommand[stretching] }, topanchor = stretchingdata.topanchor, -- unicode = stretching, -- when we alias to combiners unicode = alias, -- when we keep the original @@ -2620,6 +2951,34 @@ do -- see pagella for an extensive example feedback_tweak("copyaccents",target,original,done) end + function mathtweaks.keepbases(target,original,parameters) + local characters = target.characters + local done = false + local list = parameters.list + if list == "default" then + list = sortedkeys(mapping) + end + if list and #list > 0 then + for i=1,#list do -- assumes sorting + local unicode = list[i] + local chardata = characters[unicode] + if chardata then + chardata.keepbase = true + if not trace_tweaking then + done = true + elseif done then + done[unicode] = true + else + done = { [unicode] = true } + end + end + end + else + -- maybe also hash + end + feedback_tweak("keepbases",target,original,done) + end + end do @@ -2636,40 +2995,119 @@ do end +-- do +-- +-- local single <const> = 0x003D +-- local double <const> = 0x2A75 +-- local triple <const> = 0x2A76 +-- +-- function mathtweaks.addequals(target,original,parameters) +-- local characters = target.characters +-- local basechar = characters[single] +-- local width = basechar.width +-- local height = basechar.height +-- local depth = basechar.depth +-- local advance = (parameters.advance or 1/20) * width +-- local char = charcommand[single] +-- local left = leftcommand[advance] +-- characters[double] = { +-- unicode = double, +-- width = 2*width - 1*advance, +-- height = height, +-- depth = depth, +-- commands = { char, left, char }, +-- } +-- characters[triple] = { +-- unicode = triple, +-- width = 3*width - 2*advance, +-- height = height, +-- depth = depth, +-- commands = { char, left, char, left, char }, +-- } +-- if trace_tweaking then +-- report_tweak("double %U and triple %U equals added",target,original,double,triple) +-- end +-- end +-- +-- end + do - local single <const> = 0x003D - local double <const> = 0x2A75 - local triple <const> = 0x2A76 + local function jointwo(characters,force,unicode,ds,u1,d12,u2) + if force or not characters[unicode] then + local c1 = characters[u1] + local c2 = characters[u2] + if c1 and c2 then + local w1 = c1.width + local w2 = c2.width + local width + if d12 == false then + d12 = 0 + width = w2 + elseif d12 < 0 then + d12 = d12 * w2 + width = w2 + else + d12 = d12 * ds + width = w1 + w2 - d12 + end + characters[unicode] = { + unicode = unicode, + width = width, + height = max(c1.height or 0, c2.height or 0), + depth = max(c1.depth or 0, c2.depth or 0), +keepvirtual = true, + commands = { + -- { "inspect" }, + -- { "trace" }, + slotcommand[0][u1], + -- { "trace" }, + d12 ~= 0 and leftcommand[d12] or false, + slotcommand[0][u2], + -- { "trace" }, + }, + } + end + end + end + + local function jointhree(characters,force,unicode,ds,u1,d12,u2,d23,u3) + if force or not characters[unicode] then + local c1 = characters[u1] + local c2 = characters[u2] + local c3 = characters[u3] + if c1 and c2 and c3 then + local w1 = c1.width + local w2 = c2.width + local w3 = c3.width + d12 = d12 * ds + d23 = d23 * ds + characters[unicode] = { + unicode = unicode, + width = w1 + w2 + w3 - d12 - d23, + height = max(c1.height or 0, c2.height or 0, c3.height or 0), + depth = max(c1.depth or 0, c2.depth or 0, c3.depth or 0), + commands = { + slotcommand[0][u1], + d12 ~= 0 and leftcommand[d12] or false, + slotcommand[0][u2], + d23 ~= 0 and leftcommand[d23] or false, + slotcommand[0][u3], + } + } + end + end + end function mathtweaks.addequals(target,original,parameters) local characters = target.characters - local basechar = characters[single] - local width = basechar.width - local height = basechar.height - local depth = basechar.depth - local advance = (parameters.advance or 1/20) * width - local char = charcommand[single] - local left = leftcommand[advance] - characters[double] = { - unicode = double, - width = 2*width - 1*advance, - height = height, - depth = depth, --- callback = "devirtualize", - commands = { char, left, char }, - } - characters[triple] = { - unicode = triple, - width = 3*width - 2*advance, - height = height, - depth = depth, --- callback = "devirtualize", - commands = { char, left, char, left, char }, - } - if trace_tweaking then - report_tweak("double %U and triple %U equals added",target,original,double,triple) - end + local step = target.parameters.size/18 + local force = parameters.force +force = true + jointwo (characters,force,0x2254,step,0x03A,0,0x03D) -- := + jointhree(characters,force,0x2A74,step,0x03A,0,0x03A,0,0x03D) -- ::= + jointwo (characters,force,0x2A75,step,0x03D,0,0x03D) -- == + jointhree(characters,force,0x2A76,step,0x03D,0,0x03D,0,0x03D) -- === end end @@ -2807,28 +3245,45 @@ do { 0x030A, nps("delimited right ring"), nps("delimited ghost ring") }, { 0x0303, nps("delimited right tilde"), nps("delimited ghost tilde") }, { 0x20DB, nps("delimited right dddot"), nps("delimited ghost dddot") }, + + { 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 }, + { 0x231F, nps("delimited right lower corner"), nps("delimited ghost lower corner"), true }, + + -- If needed we can have an installer: + { 0x2020, nps("delimited right dagger"), nps("delimited ghost dagger") }, { 0x2021, nps("delimited right ddagger"), nps("delimited ghost ddagger") }, { 0x2217, nps("delimited right ast"), nps("delimited ghost ast") }, { 0x22C6, nps("delimited right star"), nps("delimited ghost star") }, - { 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 }, - { 0x231F, nps("delimited right lower corner"), nps("delimited ghost lower corner"), true }, + { 0x2020, nps("delimited right dagger 1"), nps("delimited ghost dagger 1"), false, 1 }, + { 0x2021, nps("delimited right ddagger 1"), nps("delimited ghost ddagger 1"), false, 1 }, + { 0x2217, nps("delimited right ast 1"), nps("delimited ghost ast 1"), false, 1 }, + { 0x22C6, nps("delimited right star 1"), nps("delimited ghost star 1"), false, 1 }, } function mathtweaks.addfourier(target,original,parameters) local characters = target.characters for i=1,#list do - local entry = list[i] - local basecode = entry[1] - local fouriercode = entry[2] - local movecode = entry[3] - local reverse = entry[4] - local basechar = characters[basecode] + local entry = list[i] + local basecode = entry[1] + local fouriercode = entry[2] + local movecode = entry[3] + local reverse = entry[4] + local size = entry[5] or 0 + local basechar = characters[basecode] + local compactscale = 1 + if basechar and target.properties.compactmath and size > 0 then + compactscale = target.parameters[size > 1 and "scriptscriptscale" or "scriptscale"] / 1000 + for i=1,size do + basecode = basechar.smaller or basecode + basechar = characters[basecode] + end + end if basechar then - local scale = parameters.scale or 1 + local scale = (parameters.scale or 1) * compactscale local variant = parameters.variant if variant then for i=1,variant do @@ -2846,9 +3301,9 @@ do local basewidth = scale * (basechar.width or 0) local used = baseheight/2 local total = baseheight + basedepth -if reverse then - used = total / 2 -- basedepth / 2 -end + if reverse then + used = total / 2 -- basedepth / 2 + end characters[movecode] = { width = basewidth, height = used, @@ -2908,59 +3363,6 @@ do local double <const> = 0x2016 local triple <const> = 0x2980 - -- local nps = fonts.helpers.newprivateslot - -- - -- local function variantlist(characters,unicode,chardata,what,total,used) - -- local parenthesis = characters[0x28].next - -- local width = chardata.width - -- local height = chardata.height - -- local depth = chardata.depth - -- local total = height + depth - -- local count = 1 - -- while parenthesis do - -- local private = nps(what .. " size " .. count) - -- local pardata = characters[parenthesis] - -- local parheight = pardata.height - -- local pardepth = pardata.depth - -- local scale = (parheight+pardepth)/total - -- local offset = - pardepth + scale * depth - -- chardata.next = private - -- chardata = { - -- unicode = unicode, - -- width = width, - -- height = parheight, - -- depth = pardepth, - -- commands = { - -- { "offset", 0, offset, unicode, 1, scale } - -- }, - -- } - -- characters[private] = chardata - -- parenthesis = pardata.next - -- if paranthesis then - -- pardata = characters[parenthesis] - -- end - -- count = count + 1 - -- end - -- chardata.parts = { - -- { - -- advance = total, - -- ["end"] = used, - -- glyph = unicode, - -- start = 0, - -- -- start = used/5, - -- }, - -- { - -- advance = total, - -- -- ["end"] = 0, - -- ["end"] = used/5, -- prevents small gap with inward curved endpoints - -- extender = 1, - -- glyph = unicode, - -- start = used, - -- }, - -- } - -- chardata.partsorientation = "vertical" - -- end - local function variantlist(unicode,chardata,total,used) chardata.varianttemplate = 0x0028 chardata.parts = { @@ -3126,6 +3528,45 @@ end do + function mathtweaks.sortvariants(target,original,parameters) + local list = parameters.list + if list then + local characters = target.characters + local horizontal = parameters.orientation == "horizontal" + for i=1,#list do + local u = list[i] + local c = characters[u] + if c then + local t = { } + while true do + local n = c.next + if n then + c = characters[n] + end + if c and not c.parts then + if horizontal then + t[c.width or 0] = n + else + t[(c.height or 0) + (c.depth or 0)] = n + end + else + break + end + end + local c = characters[u] + for k, v in sortedhash(t) do + c.next = v + c = characters[v] + end + end + end + end + end + +end + +do + -- We started with the list that xits has in rtlm but most of them can be derived from -- the database, and others need to be added. @@ -3251,7 +3692,11 @@ do end local next = data.next if next then - add(target,original,characters,next,"next") + if next == unicode then + report_tweak("skipping cyclic %U (%s)",target,original,unicode,"next") + else + add(target,original,characters,next,"next") + end end end end @@ -3424,7 +3869,7 @@ do end end - -- there is no real need for thios but let's play nice with memory anyway + -- there is no real need for this but let's play nice with memory anyway local efindex = 0 local effects = setmetatableindex (function (t,k) @@ -3462,6 +3907,7 @@ do local feature = entry.feature local thesource = entry.source local thetarget = entry.target or thesource + local keep = (entry.keep == true) or (parameters.keep == true) if thesource and thetarget then local sourcerange = type(thesource) == "table" and thesource or blocks[thesource] -- .gaps local targetrange = type(thetarget) == "table" and thetarget or blocks[thetarget] -- .gaps @@ -3504,13 +3950,17 @@ do local sourceunicode = mathgaps[s] or s if chars[sourceunicode] then local targetunicode = mathgaps[t] or t - if feature then - sourceunicode = getsubstitution(dropin,sourceunicode,feature,true,"math","dflt") or sourceunicode + if keep and characters[targetunicode] then + -- okay + else + if feature then + sourceunicode = getsubstitution(dropin,sourceunicode,feature,true,"math","dflt") or sourceunicode + end +-- if trace_tweaking then +-- report_tweak("copying %s %U from file %a to %s %U",target,original,thesource,sourceunicode,filename,thetarget,targetunicode) +-- end + characters[targetunicode] = copiedglyph(target,characters,chars,sourceunicode,index) end --- if trace_tweaking then --- report_tweak("copying %s %U from file %a to %s %U",target,original,thesource,sourceunicode,filename,thetarget,targetunicode) --- end - characters[targetunicode] = copiedglyph(target,characters,chars,sourceunicode,index) end end -- diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-ali.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-ali.mkxl index b37887332d2..7b61fd234df 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-ali.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/math-ali.mkxl @@ -938,13 +938,18 @@ \def\math_cases_NC_two {\ifmmode\stopimath\fi} -\def\math_cases_TC_zero +\def\math_cases_TC_zero % needs checking + %{\ifmmode\else\startimath\fi} {} \def\math_cases_TC_one {\ifmmode\stopimath\fi \aligntab} +\def\math_cases_TC_two + %{\ifmmode\stopimath\fi} % needs checking + {} + \permanent\protected\def\math_cases_NC {\ifcase\c_math_cases_nc \expandafter\math_cases_NC_zero @@ -1268,6 +1273,7 @@ \newconditional\c_math_matrix_first \newconstant \c_math_matrix_anchor_mode +\newconditional\c_math_matrix_sl_seen % enabled : 1 % left/both : 2 @@ -1403,9 +1409,41 @@ \c!toffset=.25\exheight, \c!boffset=\mathmatrixparameter\c!toffset] -\noaligned\permanent\tolerant\protected\def\math_matrix_HL[#1]#*% +% \noaligned\permanent\tolerant\protected\def\math_matrix_HL[#1]#*% +% {\noalign\bgroup +% \math_matrix_check_rule[#1]% +% \divideby\scratchdimen\plustwo +% \ifdim\scratchdimen>\zeropoint +% % \autorule\s!height\scratchdimen\s!depth\scratchdimen\relax +% \scratchdistance\mathmatrixparameter\c!toffset\relax +% \ifdim\scratchdistance>\zeropoint +% \nohrule +% \s!attr \mathalignmentvruleattribute\plustwo +% \s!height\scratchdistance +% \s!depth \zeropoint +% \relax +% \fi +% \hrule +% \s!attr \mathalignmentvruleattribute\plusthree +% \s!height\scratchdimen +% \s!depth \scratchdimen +% \relax +% \scratchdistance\mathmatrixparameter\c!boffset\relax +% \ifdim\scratchdistance>\zeropoint +% \nohrule +% \s!attr \mathalignmentvruleattribute\plusfour +% \s!height\zeropoint +% \s!depth \scratchdistance +% \relax +% \fi +% \else +% % zero dimensions disable the rule +% \fi +% \egroup} + +\def\math_matrix_HL_indeed#1#2% {\noalign\bgroup - \math_matrix_check_rule[#1]% + \math_matrix_check_rule[#2]% \divideby\scratchdimen\plustwo \ifdim\scratchdimen>\zeropoint % \autorule\s!height\scratchdimen\s!depth\scratchdimen\relax @@ -1422,6 +1460,17 @@ \s!height\scratchdimen \s!depth \scratchdimen \relax + \ifnum#1>\plusone + \localcontrolledloop\plustwo#1\plusone + {\kern.125\d_math_eqalign_distance % hskip + \hrule + \s!attr \mathalignmentvruleattribute\plusthree + \s!height\scratchdimen + \s!depth \scratchdimen + \relax}% + \kern-2\scratchdimen + \kern-.125\d_math_eqalign_distance % hskip + \fi \scratchdistance\mathmatrixparameter\c!boffset\relax \ifdim\scratchdistance>\zeropoint \nohrule @@ -1435,6 +1484,9 @@ \fi \egroup} +\permanent\tolerant\noaligned\protected\def\math_matrix_HL [#1]#*{\math_matrix_HL_indeed\plusone{#1}} +\permanent\tolerant\noaligned\protected\def\math_matrix_HLHL[#1]#*{\math_matrix_HL_indeed\plustwo{#1}} + \protected\def\math_matrix_vertical_rule_indeed#1#2% {\math_matrix_check_rule[#2]% \enablematrixrules @@ -1456,7 +1508,7 @@ \protected\def\math_matrix_horizontal_rule_indeed#1#2% {\math_matrix_check_rule[#2]% \global\setfalse\c_math_matrix_first - \global\settrue\c_math_matrix_sl_seen + \global\settrue \c_math_matrix_sl_seen \enablematrixrules \leaders#1% \s!attr \mathalignmenthruleattribute\plusone @@ -1514,19 +1566,38 @@ %boundary\c_math_matrix_sl_boundary \enforced\let\NR\math_matrix_NL_NR} -\permanent\tolerant\protected\def\math_matrix_VL[#1]#*% +% \permanent\tolerant\protected\def\math_matrix_VL[#1]#*% +% {\span\omit +% \ifconditional\c_math_matrix_first\else +% \kern.5\d_math_eqalign_distance % hskip +% \fi +% \math_matrix_vertical_rule_yes{#1}% +% \kern.5\d_math_eqalign_distance % hskip +% \global\setfalse\c_math_matrix_first +% \aligntab +% \boundary\c_math_matrix_vl_boundary +% \enforced\let\NR\math_matrix_NL_NR +% } + +\def\math_matrix_VL_indeed#1#2%% {\span\omit \ifconditional\c_math_matrix_first\else \kern.5\d_math_eqalign_distance % hskip \fi - \math_matrix_vertical_rule_yes{#1}% - \kern.5\d_math_eqalign_distance % hskip + \math_matrix_vertical_rule_yes{#2}% + \localcontrolledloop\plustwo#1\plusone + {\kern.125\d_math_eqalign_distance % hskip + \math_matrix_vertical_rule_yes{#2}}% + \kern.5\d_math_eqalign_distance \global\setfalse\c_math_matrix_first \aligntab \boundary\c_math_matrix_vl_boundary \enforced\let\NR\math_matrix_NL_NR } +\permanent\tolerant\protected\def\math_matrix_VL [#1]#*{\math_matrix_VL_indeed\plusone{#1}} +\permanent\tolerant\protected\def\math_matrix_VLVL[#1]#*{\math_matrix_VL_indeed\plustwo{#1}} + \permanent\tolerant\protected\def\math_matrix_NL[#1]#*% {\span\omit \ifconditional\c_math_matrix_first\else @@ -1585,6 +1656,9 @@ \enforced\let\VC\math_matrix_VC % bonus, extra column \enforced\let\VT\math_matrix_VT % bonus, idem but tight \enforced\let\TB\math_common_TB + % just because it's easy: + \enforced\let\VLVL\math_matrix_VLVL + \enforced\let\HLHL\math_matrix_HLHL \to \everymathmatrix \definesystemattribute[mathmatrixornament][public] @@ -2818,6 +2892,8 @@ {\unskip \strc_formulas_place_number_nested{#1}{#2}\crcr} +\aliased\let\math_align_strut\relax + \permanent\tolerant\protected\def\math_simplealign_start[#1]#*[#2]% {\begingroup \edef\currentmathsimplealign{#1}% diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-def.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-def.mkxl index a423a6a7934..3e4d724aeae 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-def.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/math-def.mkxl @@ -46,6 +46,9 @@ \definemathfunction [deg] \definemathfunction [det] [\c!mathlimits=\v!yes] \definemathfunction [dim] +\definemathfunction [erf] +\definemathfunction [erfc] +\definemathfunction [erfi] \definemathfunction [exp] \definemathfunction [gcd] [\c!mathlimits=\v!yes] \definemathfunction [hom] @@ -139,36 +142,57 @@ %D \formula {A \simcoloncolon B} %D \stoplines %D -%D The next macros take care of the space between the colon and the -%D relation symbol. +%D The next macros take care of the space between the colon and the relation symbol, +%D but they are kind of weird and not in \UNICODE. Either we define them virtual or +%D we just keep these as bonus. \pushoverloadmode -\definemathcommand [colonsep] {\mkern-1.2mu} -\definemathcommand [doublecolonsep] {\mkern-0.9mu} - -\definemathcommand [centercolon] [\s!relation] {\mathstylevcenteredhbox\colon} -\definemathcommand [colonminus] [\s!relation] {\centercolon\colonsep\mathrel{-}} -%definemathcommand [minuscolon] [\s!relation] {\mathrel{-}\colonsep\centercolon} % native char -%definemathcommand [colonequals] [\s!relation] {\centercolon\colonsep=} % native char -%definemathcommand [equalscolon] [\s!relation] {=\centercolon\colonsep} % native char -\definemathcommand [colonapprox] [\s!relation] {\centercolon\colonsep\approx} -\definemathcommand [approxcolon] [\s!relation] {\approx\centercolon\colonsep} -\definemathcommand [colonsim] [\s!relation] {\centercolon\colonsep\sim} -\definemathcommand [simcolon] [\s!relation] {\sim\centercolon\colonsep} - -\definemathcommand [coloncolon] [\s!relation] {\centercolon\doublecolonsep\centercolon} -\definemathcommand [coloncolonminus] [\s!relation] {\coloncolon\colonsep\mathrel{-}} -\definemathcommand [minuscoloncolon] [\s!relation] {\mathrel{-}\colonsep\coloncolon} -\definemathcommand [coloncolonequals] [\s!relation] {\coloncolon\colonsep=} % native char -\definemathcommand [equalscoloncolon] [\s!relation] {=\coloncolon\colonsep} -\definemathcommand [coloncolonapprox] [\s!relation] {\coloncolon\colonsep\approx} -\definemathcommand [approxcoloncolon] [\s!relation] {\approx\coloncolon\colonsep} -\definemathcommand [coloncolonsim] [\s!relation] {\coloncolon\colonsep\sim} -\definemathcommand [simcoloncolon] [\s!relation] {\sim\coloncolon\colonsep} +\protected\def\math_relation_atom_ordinary{\mathatom \s!class \mathrelationcode \s!all \mathordcode} + +\definemathcommand [centercolon] {\math_relation_atom_ordinary{\colon}} +\definemathcommand [colonminus] {\math_relation_atom_ordinary{\colon\minus}} +\definemathcommand [colonapprox] {\math_relation_atom_ordinary{\colon\approx}} +\definemathcommand [approxcolon] {\math_relation_atom_ordinary{\approx\colon}} +\definemathcommand [colonsim] {\math_relation_atom_ordinary{\colon\sim}} +\definemathcommand [simcolon] {\math_relation_atom_ordinary{\sim\colon}} + +\definemathcommand [coloncolon] {\math_relation_atom_ordinary{\colon\colon}} +\definemathcommand [coloncolonminus] {\math_relation_atom_ordinary{\colon\colon\minus}} +\definemathcommand [minuscoloncolon] {\math_relation_atom_ordinary{\minus\colon\colon}} +\definemathcommand [coloncolonequals] {\math_relation_atom_ordinary{\colon\colon\eq}} % native char +\definemathcommand [equalscoloncolon] {\math_relation_atom_ordinary{\eq\colon\colon}} +\definemathcommand [coloncolonapprox] {\math_relation_atom_ordinary{\colon\colon\approx}} +\definemathcommand [approxcoloncolon] {\math_relation_atom_ordinary{\approx\colon\colon}} +\definemathcommand [coloncolonsim] {\math_relation_atom_ordinary{\colon\colon\sim}} +\definemathcommand [simcoloncolon] {\math_relation_atom_ordinary{\sim\colon\colon}} + +% \definemathcommand [manycolons] [relation] [ordinary] {\colon\colon\colon\colon\colon\colon\colon} \popoverloadmode +%D \macros +%D {amedian} +%D +%D Something language specific, the arithmic median: +%D +%D \starttyping +%D \im {x + \amedian {x - a} + x} +%D \mainlanguage[cs] \im {x + \amedian {x - a} + x} +%D \stoptyping + +\defcsname \s!en:amedian\endcsname#1{\widebar {#1}} +\defcsname \s!cs:amedian\endcsname#1{\widetilde{#1}} +\defcsname \s!sk:amedian\endcsname#1{\widetilde{#1}} + +\permanent\protected\def\amedian + {\csname + \ifcsname\currentmainlanguage:amedian\endcsname + \currentmainlanguage\else\s!en + \fi + :amedian% + \endcsname} + % \appendtoks % \def\over{\primitive\over}% % \to \everymathematics diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-dif.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-dif.mkxl index ad53ee25a27..4c11177260a 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-dif.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/math-dif.mkxl @@ -19,8 +19,8 @@ % For new times sake: - \let\normal_math_dd\dd - \let\normal_math_DD\DD + \ifdefined\dd \aliased\let\normal_math_dd\dd \else \lettonothing\normal_math_dd \fi + \ifdefined\DD \aliased\let\normal_math_DD\DD \else \lettonothing\normal_math_DD \fi \def\c!differentiald{differentiald} % for now diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-dld.mklx b/Master/texmf-dist/tex/context/base/mkxl/math-dld.mklx index dcbb17c5eca..281ccedb2c0 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-dld.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/math-dld.mklx @@ -28,7 +28,8 @@ \installcommandhandler \??mathdelimited {mathdelimited} \??mathdelimited \setupmathdelimited - [\c!alternative=\v!normal, + [\c!define=\v!yes, + \c!alternative=\v!normal, \c!mpoffset=.25\exheight, \c!topoffset=\zeropoint, \c!bottomoffset=\zeropoint, @@ -43,7 +44,7 @@ \c!rightmargin=\zeropoint] \appendtoks - \ifcstok{\mathdelimitedparameter\c!rightmargin}\v!no\else + \ifcstok{\mathdelimitedparameter\c!define}\v!yes \frozen\protected\instance\edefcsname\currentmathdelimited\endcsname{\math_delimited_handle{\currentmathdelimited}} \fi \to \everydefinemathdelimited @@ -70,7 +71,7 @@ \s!depth \dimexpr\mathdelimitedparameter\c!depth+\mathdelimitedparameter\c!bottomoffset\relax \s!source\numexpr\namedboxanchor{\mathdelimitedparameter\c!source}\relax \s!style \normalmathstyle - \s!size \numexpr\namedboxanchor{\mathdelimitedparameter\c!size}\relax + \s!size \numexpr\mathdelimitedparameter\c!size\relax \zerocount \mathdelimitedparameter\c!left \zerocount \mathdelimitedparameter\c!right \relax} @@ -88,7 +89,6 @@ {\popcolor#body}% \fi} - %integerdef\delimitedrightgraveuc \privatecharactercode{delimited right grave} \integerdef\delimitedrightddotuc \privatecharactercode{delimited right ddot} \integerdef\delimitedrightbaruc \privatecharactercode{delimited right bar} @@ -100,10 +100,6 @@ \integerdef\delimitedrightringuc \privatecharactercode{delimited right ring} \integerdef\delimitedrighttildeuc \privatecharactercode{delimited right tilde} \integerdef\delimitedrightdddotuc \privatecharactercode{delimited right dddot} -\integerdef\delimitedrightdaggeruc \privatecharactercode{delimited right dagger} -\integerdef\delimitedrightddaggeruc \privatecharactercode{delimited right ddagger} -\integerdef\delimitedrightastuc \privatecharactercode{delimited right ast} -\integerdef\delimitedrightstaruc \privatecharactercode{delimited right star} % \integerdef\delimitedrighthatuc \privatecharactercode{delimited right hat} % \integerdef\delimitedrighttildeuc \privatecharactercode{delimited right tilde} @@ -114,33 +110,38 @@ \definemathdelimited [marked] - [\c!command=\v!no, + [\c!define=\v!no, \c!topoffset=.2\exheight] \definemathdelimited [ddotmarked] [marked] - [\c!right=\delimitedrightddotuc] + [\c!define=\v!yes, + \c!right=\delimitedrightddotuc] \definemathdelimited [barmarked] [marked] - [\c!right=\delimitedrightbaruc] + [\c!define=\v!yes, + \c!right=\delimitedrightbaruc] \definemathdelimited [hatmarked] [marked] - [\c!right=\delimitedrighthatuc] + [\c!define=\v!yes, + \c!right=\delimitedrighthatuc] \definemathdelimited [checkmarked] [marked] - [\c!right=\delimitedrightcheckuc] + [\c!define=\v!yes, + \c!right=\delimitedrightcheckuc] \definemathdelimited [brevemarked] [marked] - [\c!right=\delimitedrightbreveuc] + [\c!define=\v!yes, + \c!right=\delimitedrightbreveuc] \definemathdelimited [dotmarked] @@ -150,44 +151,78 @@ \definemathdelimited [ringmarked] [marked] - [\c!right=\delimitedrightringuc] + [\c!define=\v!yes, + \c!right=\delimitedrightringuc] \definemathdelimited [tildemarked] [marked] - [\c!right=\delimitedrighttildeuc] + [\c!define=\v!yes, + \c!right=\delimitedrighttildeuc] \definemathdelimited [dddotmarked] [marked] - [\c!right=\delimitedrightdddotuc] + [\c!define=\v!yes, + \c!right=\delimitedrightdddotuc] % The following ones are % not really belonging here, % but convenient +% If there are more needed we can have: +% +% \c!ight=\privatecharactercode{delimited right dagger \mathdelimitedparameter\c!size} +% +% or even: +% +% \def\privatedelimitedcode#1{\privatecharactercode{delimited #1 \mathdelimitedparameter\c!size}} +% +% \c!right=\privatedelimitedcode{right dagger} +% +% with some glyph installer btu let's for now save some bytes in the format. + +\integerdef\delimitedrightdaggeruc \privatecharactercode{delimited right dagger} +\integerdef\delimitedrightddaggeruc \privatecharactercode{delimited right ddagger} +\integerdef\delimitedrightastuc \privatecharactercode{delimited right ast} +\integerdef\delimitedrightstaruc \privatecharactercode{delimited right star} + +\integerdef\delimitedscriptrightdaggeruc \privatecharactercode{delimited right dagger 1} +\integerdef\delimitedscriptrightddaggeruc \privatecharactercode{delimited right ddagger 1} +\integerdef\delimitedscriptrightastuc \privatecharactercode{delimited right ast 1} +\integerdef\delimitedscriptrightstaruc \privatecharactercode{delimited right star 1} + \definemathdelimited [daggermarked] [marked] - [\c!size=1, - \c!right=\delimitedrightdaggeruc] + [\c!define=\v!yes, + \c!size=1, + \c!right=\delimitedscriptrightdaggeruc] + %\c!right=\privatedelimitedcode{right dagger}] \definemathdelimited [ddaggermarked] [marked] - [\c!size=1, - \c!right=\delimitedrightddaggeruc] + [\c!define=\v!yes, + \c!size=1, + \c!right=\delimitedscriptrightddaggeruc] + %\c!right=\privatedelimitedcode{right ddagger}] \definemathdelimited [astmarked] - [\c!size=1, - \c!right=\delimitedrightastuc] + [marked] + [\c!define=\v!yes, + \c!size=1, + \c!right=\delimitedscriptrightastuc] + %\c!right=\privatedelimitedcode{right ast}] \definemathdelimited [starmarked] [marked] - [\c!size=1, - \c!right=\delimitedrightstaruc] + [\c!define=\v!yes, + \c!size=1, + \c!right=\delimitedscriptrightstaruc] + %\c!right=\privatedelimitedcode{right star}] % More contextual diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-fen.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-fen.mkxl index 1656f4b4a1c..53c34c56716 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-fen.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/math-fen.mkxl @@ -15,7 +15,7 @@ \unprotect -% \definemathfence [fancybracket] [bracket] [command=yes,color=blue] +% \definemathfence [fancybracket] [bracket] [define=yes,color=blue] % % test $|x|$ test \par % test $||x||$ test (okay) \par @@ -42,7 +42,7 @@ \c!middle=, \c!mathstyle=, \c!color=, - \c!command=, + \c!define=, % was \c!command \c!mathclass=, \c!leftclass=\mathopencode, \c!rightclass=\mathclosecode, @@ -59,9 +59,7 @@ \c!factor=\v!auto] \appendtoks - \edef\p_command{\mathfenceparameter\c!command}% - \ifx\p_command\v!yes - % \instance + \ifcstok{\mathfenceparameter\c!define}\v!yes \protected\edefcsname\currentmathfence\endcsname{\math_fenced_fenced{\currentmathfence}}% \fi \to \everydefinemathfence @@ -307,6 +305,9 @@ \directsetup{math:fence:set:bar} \stopsetups +\mutable\lettonothing\suchthat +% \fastsetup{math:fence:set} + \protected\def\math_fenced_middle_common {\math_fenced_middle} % redefined inside atom @@ -338,6 +339,19 @@ % \definemathfence [tupdownarrows] [text] [\c!left="2191,\c!right="2193] +\def\math_fenced_check#1% + {\iftok{\mathfenceparameter#1}\emptytoks\letmathfenceparameter#1\v!none\fi} + +\appendtoks + \math_fenced_check\c!left + \math_fenced_check\c!right +\to \everysetupmathfence + +\appendtoks + \math_fenced_check\c!left + \math_fenced_check\c!right +\to \everydefinemathfence + \protected\def\math_fenced_horizontal_common#1#2#3#4% \Uwhatever class symbol source {\c_math_fenced_class\math_class_by_parameter\mathfenceparameter#2\relax \edef\p_fence{#3}% @@ -387,7 +401,7 @@ \setupmathfence [\v!text] [\c!text=\v!yes, - \c!command=\v!yes, + \c!define=\v!yes, \c!distance=.125\emwidth] \tolerant\protected\def\math_fenced_vertical#1#*[#2]% @@ -653,10 +667,23 @@ \immutable\protected\def\Lopenbracketmirrored {\math_fenced_fenced_stop {mirroredopenbracket}} \immutable\protected\def\Ropenbracketmirrored {\math_fenced_fenced_start{mirroredopenbracket}} \immutable\protected\def\Lnothingmirrored {\math_fenced_fenced_stop {mirrorednothing}} \immutable\protected\def\Rnothingmirrored {\math_fenced_fenced_start{mirrorednothing}} -\definemathfence [interval] [\c!left="2997,\c!right="2998] -\definemathfence [openinterval] [interval] [\c!left="2998,\c!right="2998] -\definemathfence [leftopeninterval] [interval] [\c!left="2997,\c!right="2997] -\definemathfence [rightopeninterval] [interval] [\c!left="2998,\c!right="2998] +% These tortoise chars almost only exist in stix (and ar not commonly used) + +% \definemathfence [interval] [\c!left="2997,\c!right="2998] +% \definemathfence [openinterval] [interval] [\c!left="2998,\c!right="2998] +% \definemathfence [leftopeninterval] [interval] [\c!left="2997,\c!right="2997] +% \definemathfence [rightopeninterval] [interval] [\c!left="2998,\c!right="2998] + +% Different intervals. The variants are the ones suggested by Bourbaki. + +\definemathfence [interval] [\c!left="005B,\c!right="005D] +\definemathfence [openinterval] [interval] [\c!left="0028,\c!right="0029] +\definemathfence [closedinterval] [interval] [\c!left="005B,\c!right="005D] +\definemathfence [leftopeninterval] [interval] [\c!left="0028,\c!right="005D] +\definemathfence [rightopeninterval] [interval] [\c!left="005B,\c!right="0029] +\definemathfence [varopeninterval] [interval] [\c!left="005D,\c!right="005B] +\definemathfence [varleftopeninterval] [interval] [\c!left="005D,\c!right="005D] +\definemathfence [varrightopeninterval] [interval] [\c!left="005B,\c!right="005B] \immutable\protected\def\Linterval {\math_fenced_fenced_start{interval}} \immutable\protected\def\Lointerval {\math_fenced_fenced_start{openinterval}} @@ -693,6 +720,10 @@ % \im { \left\{ \frac{1}{2} \right\} } % \im { \left\lbrace \frac{1}{2} \right\rbrace } +\lettonothing\math_fenced_x_p_left +\lettonothing\math_fenced_x_p_right +\lettonothing\math_fenced_x_p_middle + \def\math_fenced_x_left {\advanceby\c_math_fence_nesting\plusone \ifx\math_fenced_x_p_left\bgroup\let\math_fenced_x_p_left\letterleftbrace\fi @@ -957,7 +988,11 @@ \protected\def\math_choosemathbig_math#1#2% so we accept \big{||} as well {\math_fenced_force_size\bigmathdelimitervariant{#1}\relax - \Uvextensible#2\relax + \Uvextensible + \s!axis + \s!exact + #2% + \relax \c_attr_mathsize\attributeunsetvalue} \protected\def\math_choosemathbig_text#1#2% so we accept \big{||} as well @@ -972,7 +1007,11 @@ \permanent\protected\def\mathdelimiterstep#1#2% not used, only in example {\begingroup \math_fenced_force_size\plusone{#1}% - \Uvextensible#2\relax + \Uvextensible + \s!axis + \s!exact + #2% + \relax \endgroup} \definemathcommand [big] {\choosemathbig1} @@ -1004,7 +1043,7 @@ % \vrule height 3cm depth 3cm % \right\rintegral -%definemathfence [fancybracket] [bracket] [command=yes,color=red] +%definemathfence [fancybracket] [bracket] [define=yes,color=red] %D The nested fences recovery code is needed for mathml and the original %D code can still be found in the mkiv file. @@ -1014,7 +1053,7 @@ \let\math_fences_normal_left \left \let\math_fences_normal_right \right \let\math_fences_normal_middle\middle -\let\math_fences_normal_both \leftorright +\let\math_fences_normal_both \relax % undefined \protected\def\math_fences_auto_left #1{\c_attr_mathautofence\plusone #1\c_attr_mathautofence\attributeunsetvalue} \protected\def\math_fences_auto_right #1{\c_attr_mathautofence\plustwo #1\c_attr_mathautofence\attributeunsetvalue} @@ -1187,6 +1226,8 @@ {\let\math_fenced_trace\math_fenced_trace_indeed} {\let\math_fenced_trace\donothing} +\mutable\integerdef\c_math_fence_level\minusone + \appendtoks \integerdef\c_math_fence_level\minusone \c_math_fence_nesting\zerocount @@ -1211,10 +1252,10 @@ % $x + \tdownuparrows{left}{right} + x$ % $x + \tupanddownarrows[color=red,leftcolor=green,rightcolor=blue]{left}{right} + x$ -\definemathfence [tupanddownarrows] [\v!text] [\c!left="2191,\c!right="2193] -\definemathfence [tupdownarrows] [\v!text] [\c!left="21C5,\c!right=0] -\definemathfence [tdownuparrows] [\v!text] [\c!middle="21F5] -\definemathfence [tuparrow] [\v!text] [\c!middle="2191] -\definemathfence [tdownarrow] [\v!text] [\c!middle="2193] +\definemathfence [tupanddownarrows][\v!text][\c!left="2191,\c!right="2193] +\definemathfence [tupdownarrows] [\v!text][\c!left="21C5,\c!right=0] +\definemathfence [tdownuparrows] [\v!text][\c!middle="21F5] +\definemathfence [tuparrow] [\v!text][\c!middle="2191] +\definemathfence [tdownarrow] [\v!text][\c!middle="2193] \protect diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-fnt.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-fnt.lmt index 911e0adb520..87dfe16e52a 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-fnt.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/math-fnt.lmt @@ -54,98 +54,100 @@ local cache = setmetatableindex(function(t,width) return v end) +local enabled = "vertical" directives.register("math.extensibles", function(v) enabled = v end) -- default per 2022-08-25 + local function register_extensible(font,char,style,box) - -- We don't share (yet)! - local fontdata = chardata[font] - local oldchar = fontdata[char] - if oldchar and oldchar.keepvirtual then - -- for now, needed for iwona etc - return nil - else - local bx = tonut(box) - updaters.apply("tagging.state.disable") -- fast enough - nodes.handlers.finalizelist(bx) - updaters.apply("tagging.state.enable") - local id = getid(bx) - local al = getattrlst(bx) - local wd, ht, dp = getwhd(bx) - local unicode = oldchar.unicode or char - -- we cannot have self referencing t3 fonts - local oldcommands = oldchar.oldcommands - local newcommands = oldchar.commands - if oldcommands then - oldchar.commands = oldcommands - end - -- - local p = fonts.hashes.parameters[font] - local sx = round(1000/p.extendfactor) - local sy = round(1000/p.squeezefactor) - -- we saved a scaled glyph stream so we now use an unscaled one ... horrible hack: - if sx ~= 1000 then - wd = wd * 7200/7227 - end - if sy ~= 1000 then - ht = ht * 7200/7227 - dp = dp * 7200/7227 - end - -- - -- local private = fonts.helpers.setboxdirectly(font,unicode,box) - local private = cache[wd][ht][dp][font][unicode] - if not private then - private = fonts.helpers.setboxdirectly(font,unicode,box) - cache[wd][ht][dp][font][unicode] = private - end - local glyph = new_glyph(font,private,al) - nuts.setscales(glyph,1000,sx,sy) - -- - -- if fonts.hashes.properties[font].compactmath then - -- nuts.setscales(g,1000,1000,1000) - -- end - -- - -- nasty, testcase: bold math sqrt extensible - -- - local n = new_hlist(glyph) - -- - if newcommands then - oldchar.commands = newcommands - end - -- - -- local newchar = { - -- unicode = unicode, - -- width = wd, - -- height = ht, - -- depth = dp, - -- } - -- local p = oldchar.vparts - -- if p then - -- local first = fontdata[p[#p].glyph] - -- local last = fontdata[p[ 1].glyph] - -- if first then - -- newchar.topleft = first.topleft - -- newchar.topright = first.topright - -- end - -- if last then - -- newchar.bottomleft = last.bottomleft - -- newchar.bottomright = last.bottomright - -- end - -- end - -- addcharacters(font, { [private] = newchar }) - -- so the dimensions of the box don't match the glyph scale! - setwhd(n,wd,ht,dp) - setattrlst(n,al) - if id == vlist_code then - n = new_vlist(n) + if enabled then + -- We don't share (yet)! + 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 + local bx = tonut(box) + -- actually we don't want colors and such so if we do finalize we + -- should be more selctive: + -- updaters.apply("tagging.state.disable") + -- nodes.handlers.finalizelist(bx) + -- updaters.apply("tagging.state.enable") + local id = getid(bx) + local al = getattrlst(bx) + local wd, ht, dp = getwhd(bx) + local unicode = oldchar.unicode or char + -- we cannot have self referencing t3 fonts + local oldcommands = oldchar.oldcommands + local newcommands = oldchar.commands + if oldcommands then + oldchar.commands = oldcommands + end + -- + local p = fonts.hashes.parameters[font] + local sx = round(1000/p.extendfactor) + local sy = round(1000/p.squeezefactor) + -- we saved a scaled glyph stream so we now use an unscaled one ... horrible hack: + if sx ~= 1000 then + wd = wd * 7200/7227 + end + if sy ~= 1000 then + ht = ht * 7200/7227 + dp = dp * 7200/7227 + end + -- + -- local private = fonts.helpers.setboxdirectly(font,unicode,box) + local private = cache[wd][ht][dp][font][unicode] + if not private then + private = fonts.helpers.setboxdirectly(font,unicode,box) + cache[wd][ht][dp][font][unicode] = private + end + local glyph = new_glyph(font,private,al) + nuts.setscales(glyph,1000,sx,sy) + -- + -- if fonts.hashes.properties[font].compactmath then + -- nuts.setscales(g,1000,1000,1000) + -- end + -- + -- nasty, testcase: bold math sqrt extensible + -- + local n = new_hlist(glyph) + -- + if newcommands then + oldchar.commands = newcommands + end + -- + -- local newchar = { + -- unicode = unicode, + -- width = wd, + -- height = ht, + -- depth = dp, + -- } + -- local p = oldchar.vparts + -- if p then + -- local first = fontdata[p[#p].glyph] + -- local last = fontdata[p[ 1].glyph] + -- if first then + -- newchar.topleft = first.topleft + -- newchar.topright = first.topright + -- end + -- if last then + -- newchar.bottomleft = last.bottomleft + -- newchar.bottomright = last.bottomright + -- end + -- end + -- addcharacters(font, { [private] = newchar }) + -- so the dimensions of the box don't match the glyph scale! setwhd(n,wd,ht,dp) setattrlst(n,al) + if id == vlist_code then + n = new_vlist(n) + setwhd(n,wd,ht,dp) + setattrlst(n,al) + end + return tonode(n) end - return tonode(n) end end -directives.register("math.extensibles", function(v) - callback.register("register_extensible", v and register_extensible or nil) -end) - --- Default per 2022-08-25 - -callback.register("register_extensible", register_extensible) +callbacks.register("register_extensible",register_extensible,"register math extensible construct") diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-frc.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-frc.mkxl index 47edc52c411..7e6f7c5ce4d 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-frc.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/math-frc.mkxl @@ -104,6 +104,14 @@ \c!vfactor=\plusthousand, \c!rule=\v!auto] +%D We now default to nice bars: + +\integerdef\fractionbarextenderuc \privatecharactercode{fraction bar extender} + +\setupmathfractions + [\c!rule=\v!symbol, + \c!symbol=\fractionbarextenderuc] + \appendtoks \instance\frozen\protected\edefcsname\currentmathfraction\endcsname{\math_frac{\currentmathfraction}}% \to \everydefinemathfraction @@ -303,15 +311,23 @@ {\edef\p_method {\mathfractionparameter\c!method}% \edef\p_rule {\mathfractionparameter\c!rule}% \edef\p_thickness{\mathfractionparameter\c!rulethickness}% - \scratchcounterone \mathfractionparameter\c!left \relax - \scratchcountertwo \mathfractionparameter\c!right \relax - \scratchcounterthree \mathfractionparameter\c!middle \relax + \scratchcounterone \mathfractionparameter\c!left \relax + \scratchcountertwo \mathfractionparameter\c!right \relax + \scratchcounterthree + \ifx\p_method\v!horizontal + \mathfractionparameter\c!middle + \orelse\ifx\p_method\v!line + \mathfractionparameter\c!middle + \else + \mathfractionparameter\c!symbol + \fi + \relax \ifcsname \??fractionmethods \p_method \ifx\p_method\v!horizontal \orelse\ifx\p_method\v!line - \orelse\ifcsname\??fractionmethods\p_method\p_rule\endcsname + \orelse\ifcsname\??fractionmethods\p_method\p_rule\endcsname % \v!vertical \p_rule \else \v!auto diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-ini.lmt index f26f24c93b1..904b98d790b 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-ini.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/math-ini.lmt @@ -169,12 +169,11 @@ do local fontchardata = fonts.hashes.characters local f_dictionary = false - local register = callback.register local whatdetail = "all" local function trace(n,properties,group,index,font,char) -- local properties, group, index, font, char = nodes.nuts.getchardict(nodes.nuts.tonut(n)) - if properties ~= 0 or group ~= 0 or index ~= 0 then + if whatdetail and (properties ~= 0 or group ~= 0 or index ~= 0) then local char = fontchardata[font][char] if char or whatdetail == "all" then local unicode = char and char.unicode @@ -199,16 +198,9 @@ do end end - trackers.register("math.dictionaries",function(v) - whatdetail = v - if whatdetail then - register("get_math_dictionary",trace) - else - register("get_math_dictionary") - end - end) + trackers.register("math.dictionaries",function(v) whatdetail = v end) - register("get_math_dictionary",trace) + callbacks.register("get_math_dictionary",trace,"provide math dictionary details") -- This is experimental and a prelude to the long pending "relate math rendering to -- some field" wish. In TeX characters and symbols are grouped by class but that is @@ -410,7 +402,7 @@ classes["all"] = specialclasses["all"] classnames[specialclasses["all"] ] classes["begin"] = specialclasses["begin"] classnames[specialclasses["begin"]] = "beg" classes["end"] = specialclasses["end"] classnames[specialclasses["end"] ] = "end" -callback.register("get_noad_class", function(n) return classnames[n] end) +callbacks.register("get_noad_class", function(n) return classnames[n] end,"provide math class name") local function registerprivateclass(name,parent) local class = parent and classes[parent] or classes[name] diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-ini.mkxl index 7d0c8ef81fc..f9b733d9cb2 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-ini.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/math-ini.mkxl @@ -1399,6 +1399,10 @@ % \im{1\unit{hour} 20 \unit{minute} 56 \unit{second}} % \inherited\setmathspacing \mathdimensioncode \mathdigitcode \allmathstyles \thickmuskip + \inherited\setmathspacing \mathdimensioncode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathdimensioncode \mathbinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathdimensioncode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathdimensioncode \mathrelationcode \allunsplitstyles \pettymuskip % \inherited\setmathspacing \mathfakecode \mathallcode \allmathstyles \tinymuskip \inherited\setmathspacing \mathallcode \mathfakecode \allmathstyles \tinymuskip @@ -1418,20 +1422,20 @@ \inherited\setmathspacing \mathtextpunctuationcode \mathdifferentialcode \allmathstyles \mathinterwordmuskip \inherited\setmathspacing \mathtextpunctuationcode \mathpunctuationcode \allmathstyles \mathinterwordmuskip % - \inherited\setmathspacing \mathordinarycode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathoperatorcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathbinarycode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathrelationcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathopencode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathmiddlecode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathclosecode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathconstructcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathellipsiscode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathfractioncode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathradicalcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathdifferentialcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathordinarycode \mathtextpunctuationcode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathoperatorcode \mathtextpunctuationcode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathbinarycode \mathtextpunctuationcode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathrelationcode \mathtextpunctuationcode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathopencode \mathtextpunctuationcode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathtextpunctuationcode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathclosecode \mathtextpunctuationcode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathtextpunctuationcode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathtextpunctuationcode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathtextpunctuationcode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathradicalcode \mathtextpunctuationcode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathdifferentialcode \mathtextpunctuationcode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \pettymuskip \stopsetups \directsetup{math:spacing:default} @@ -1732,6 +1736,9 @@ \permanent\protected\def\mathcodecommand#1% {\mathatom \s!class \mathcodechecked{#1}} +\permanent\protected\def\mathcodeallcommand#1#2% + {\mathatom \s!class \mathcodechecked{#1} \s!all \mathcodechecked{#2}} + \def\math_class_by_parameter #1#2{\normalexpanded{\noexpand\mathcodechecked{#1#2}}} \def\math_atom_by_parameter #1{\normalexpanded{\noexpand\math_atom_by_parameter_indeed{#1\c!mathclass}}} \def\math_atom_by_parameter_indeed#1{\mathatom \s!class \mathcodechecked{#1}} @@ -1750,15 +1757,14 @@ \installcorenamespace{mathcommand} -% todo: define these commands as frozen! - \permanent\tolerant\protected\def\definemathcommand[#1]#*[#2]#*[#3]#:#*#4% command class args meaning {\ifparameter#3\or - \edef\scratchstringone{#3}% make this one m_arguments - \ifx\scratchstringone\v!one + \ifcstok{#3}\v!one \frozen\protected\defcsname\??mathcommand#1\endcsname##1{\mathcodecommand{#2}{#4{##1}}}% - \orelse\ifx\scratchstringone\v!two + \orelse\ifcstok{#3}\v!two \frozen\protected\defcsname\??mathcommand#1\endcsname##1##2{\mathcodecommand{#2}{#4{##1}{##2}}}% + \orelse\ifchknum\mathcodechecked{#3}\or + \frozen\protected\defcsname\??mathcommand#1\endcsname{\mathcodeallcommand{#2}{#3}{#4}}% \else \frozen\protected\defcsname\??mathcommand#1\endcsname{\mathcodecommand{#2}{#4}}% \fi @@ -2812,50 +2818,83 @@ \installcorenamespace {mathautopunctuation} -\bgroup - - % This can and will be replaced by classes: - - \catcode\commaasciicode \activecatcode - \catcode\periodasciicode \activecatcode - \catcode\semicolonasciicode\activecatcode - - \gdefcsname\??mathautopunctuation\v!no\endcsname - {\let,\math_punctuation_nop_comma - \let.\math_punctuation_nop_period - \let;\math_punctuation_nop_semicolon} - - \gdefcsname\??mathautopunctuation\v!yes\endcsname - {\let,\math_punctuation_yes_comma - \let.\math_punctuation_yes_period - \let;\math_punctuation_nop_semicolon} - - \gdefcsname\??mathautopunctuation\v!all\endcsname - {\let,\math_punctuation_all_comma - \let.\math_punctuation_all_period - \let;\math_punctuation_nop_semicolon} - - \gdefcsname\??mathautopunctuation comma\endcsname - {\let,\math_punctuation_yes_comma - \let.\math_punctuation_yes_period - \let;\math_punctuation_nop_semicolon} - - \gdefcsname\??mathautopunctuation\v!yes\string,semicolon\endcsname - {\let,\math_punctuation_yes_comma - \let.\math_punctuation_yes_period - \let;\math_punctuation_yes_semicolon} - - \gdefcsname\??mathautopunctuation comma\string,semicolon\endcsname - {\let,\math_punctuation_yes_comma - \let.\math_punctuation_yes_period - \let;\math_punctuation_yes_semicolon} - - \gdefcsname\??mathautopunctuation\v!all\string,semicolon\endcsname - {\let,\math_punctuation_all_comma - \let.\math_punctuation_all_period - \let;\math_punctuation_all_semicolon} +% \bgroup +% +% \catcode\commaasciicode \activecatcode +% \catcode\periodasciicode \activecatcode +% \catcode\semicolonasciicode\activecatcode +% +% \gdefcsname\??mathautopunctuation\v!no\endcsname +% {\let,\math_punctuation_nop_comma +% \let.\math_punctuation_nop_period +% \let;\math_punctuation_nop_semicolon} +% +% \gdefcsname\??mathautopunctuation\v!yes\endcsname +% {\let,\math_punctuation_yes_comma +% \let.\math_punctuation_yes_period +% \let;\math_punctuation_nop_semicolon} +% +% \gdefcsname\??mathautopunctuation\v!all\endcsname +% {\let,\math_punctuation_all_comma +% \let.\math_punctuation_all_period +% \let;\math_punctuation_nop_semicolon} +% +% \gdefcsname\??mathautopunctuation comma\endcsname +% {\let,\math_punctuation_yes_comma +% \let.\math_punctuation_yes_period +% \let;\math_punctuation_nop_semicolon} +% +% \gdefcsname\??mathautopunctuation\v!yes\string,semicolon\endcsname +% {\let,\math_punctuation_yes_comma +% \let.\math_punctuation_yes_period +% \let;\math_punctuation_yes_semicolon} +% +% \gdefcsname\??mathautopunctuation comma\string,semicolon\endcsname +% {\let,\math_punctuation_yes_comma +% \let.\math_punctuation_yes_period +% \let;\math_punctuation_yes_semicolon} +% +% \gdefcsname\??mathautopunctuation\v!all\string,semicolon\endcsname +% {\let,\math_punctuation_all_comma +% \let.\math_punctuation_all_period +% \let;\math_punctuation_all_semicolon} +% +% \egroup -\egroup +\defcsname\??mathautopunctuation\v!no\endcsname + {\letcharcode\commaasciicode \math_punctuation_nop_comma + \letcharcode\periodasciicode \math_punctuation_nop_period + \letcharcode\semicolonasciicode\math_punctuation_nop_semicolon} + +\defcsname\??mathautopunctuation\v!yes\endcsname + {\letcharcode\commaasciicode \math_punctuation_yes_comma + \letcharcode\periodasciicode \math_punctuation_yes_period + \letcharcode\semicolonasciicode\math_punctuation_nop_semicolon} + +\defcsname\??mathautopunctuation\v!all\endcsname + {\letcharcode\commaasciicode \math_punctuation_all_comma + \letcharcode\periodasciicode \math_punctuation_all_period + \letcharcode\semicolonasciicode\math_punctuation_nop_semicolon} + +\defcsname\??mathautopunctuation comma\endcsname + {\letcharcode\commaasciicode \math_punctuation_yes_comma + \letcharcode\periodasciicode \math_punctuation_yes_period + \letcharcode\semicolonasciicode\math_punctuation_nop_semicolon} + +\defcsname\??mathautopunctuation\v!yes\string,semicolon\endcsname + {\letcharcode\commaasciicode \math_punctuation_yes_comma + \letcharcode\periodasciicode \math_punctuation_yes_period + \letcharcode\semicolonasciicode\math_punctuation_yes_semicolon} + +\defcsname\??mathautopunctuation comma\string,semicolon\endcsname + {\letcharcode\commaasciicode \math_punctuation_yes_comma + \letcharcode\periodasciicode \math_punctuation_yes_period + \letcharcode\semicolonasciicode\math_punctuation_yes_semicolon} + +\defcsname\??mathautopunctuation\v!all\string,semicolon\endcsname + {\letcharcode\commaasciicode \math_punctuation_all_comma + \letcharcode\periodasciicode \math_punctuation_all_period + \letcharcode\semicolonasciicode\math_punctuation_all_semicolon} % \appendtoks % \global\mathcode\commaasciicode \c_math_special @@ -4548,8 +4587,8 @@ \def\math_axis_inject_indeed#1% {\srule - \s!height \dimexpr\scratchdimentwo+\scratchdimenone\relax - \s!depth -\dimexpr\scratchdimentwo-\scratchdimenone\relax + \s!height \dimexpr(\scratchdimentwo+\scratchdimenone)*\c_math_m_scaled/\plusthousand\relax + \s!depth -\dimexpr(\scratchdimentwo-\scratchdimenone)*\c_math_m_scaled/\plusthousand\relax \s!attr \mathaxisattribute#1% \relax} diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-map.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-map.lmt index 98cc59c8942..0bd75d74894 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-map.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/math-map.lmt @@ -7,31 +7,13 @@ if not modules then modules = { } end modules ['math-map'] = { license = "see context related readme files" } --- todo: make sparse .. if self - ---[[ldx-- -<p>Remapping mathematics alphabets.</p> ---ldx]]-- - --- oldstyle: not really mathematics but happened to be part of --- the mathematics fonts in cmr --- --- persian: we will also provide mappers for other --- scripts - --- todo: alphabets namespace --- maybe: script/scriptscript dynamic, - --- superscripped primes get unscripted ! - --- to be looked into once the fonts are ready (will become font --- goodie): --- --- (U+2202,U+1D715) : upright --- (U+2202,U+1D715) : italic --- (U+2202,U+1D715) : upright --- --- plus add them to the regular vectors below so that they honor \it etc +-- persian: we will also provide mappers for other scripts +-- todo : alphabets namespace +-- maybe : script/scriptscript dynamic, +-- check : (U+2202,U+1D715) : upright +-- (U+2202,U+1D715) : italic +-- (U+2202,U+1D715) : upright +-- add them to the regular vectors below so that they honor \it etc local type, next = type, next local merged, sortedhash = table.merged, table.sortedhash diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-noa.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-noa.lmt index 4a0cb57449e..cbcf6164d1f 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-noa.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/math-noa.lmt @@ -881,47 +881,48 @@ do local method = div(a,100) local size = a % 100 setattr(pointer,a_mathsize,0) - local delimiter = getdelimiter(pointer) - if delimiter then - local oldchar, font, fam = getcharspec(delimiter) - if oldchar > 0 and font > 0 then - local ht = getheight(pointer) - local dp = getdepth(pointer) - local data = fontdata[font] - local characters = data.characters - local olddata = characters[oldchar] --- local oldheight = olddata.height or 0 --- local olddepth = olddata.depth or 0 - local template = olddata.varianttemplate - local newchar = mathematics.big(data,template or oldchar,size,method) - local newdata = characters[newchar] - local newheight = newdata.height or 0 - local newdepth = newdata.depth or 0 - if template then --- local ratio = (newheight + newdepth) / (oldheight + olddepth) --- setheight(pointer,ratio * oldheight) --- setdepth(pointer,ratio * olddepth) - setheight(pointer,newheight) - setdepth(pointer,newdepth) - if not olddata.extensible then - -- check this on bonum and antykwa - setoptions(pointer,0) - end - if trace_fences then --- report_fences("replacing %C using method %a, size %a, template %C and ratio %.3f",newchar,method,size,template,ratio) - report_fences("replacing %C using method %a, size %a and template %C",newchar,method,size,template) - end - else - -- 1 scaled point is a signal, for now - if ht == 1 then - setheight(pointer,newheight) - end - if dp == 1 then - setdepth(pointer,newdepth) - end - setchar(delimiter,newchar) - if trace_fences then - report_fences("replacing %C by %C using method %a and size %a",oldchar,char,method,size) + if size ~= 0 then + local delimiter = getdelimiter(pointer) + if delimiter then + local oldchar, font, fam = getcharspec(delimiter) + if oldchar > 0 and font > 0 then + local ht = getheight(pointer) + local dp = getdepth(pointer) + local data = fontdata[font] + local characters = data.characters + local olddata = characters[oldchar] + if olddata then + local template = olddata.varianttemplate + local newchar = mathematics.big(data,template or oldchar,size,method) + local newdata = characters[newchar] + local newheight = newdata.height or 0 + local newdepth = newdata.depth or 0 + if template then + setheight(pointer,newheight) + setdepth(pointer,newdepth) + if not olddata.extensible then + -- check this on bonum and antykwa + setoptions(pointer,0) + end + setoptions(pointer,getoptions(pointer)| tex.noadoptioncodes.scale ) + if trace_fences then + report_fences("replacing %C using method %a, size %a and template %C",newchar,method,size,template) + end + else + -- 1 scaled point is a signal, for now + if ht == 1 then + setheight(pointer,newheight) + end + if dp == 1 then + setdepth(pointer,newdepth) + end + setchar(delimiter,newchar) + if trace_fences then + report_fences("replacing %C by %C using method %a and size %a",oldchar,char,method,size) + end + end + elseif trace_fences then + report_fences("not replacing %C using method %a and size %a",oldchar,method,size) end end end @@ -1552,18 +1553,22 @@ do local attributes = mathalternates.attributes local registered = mathalternates.registered local hashes = mathalternates.hashes + local newchar = nil for i=1,#registered do local r = registered[i] if (a & r) ~= 0 then - local char = getchar(pointer) + local char = newchar or getchar(pointer) local alt = hashes[i][char] if alt == nil then local what = attributes[r] +local list = what.list +if not list or list[char] then alt = otf.getalternate(fontdata[fontid],char,what.feature,what.value) or false if alt == char then alt = false end hashes[i][char] = alt +end end if alt then if trace_alternates then @@ -1571,11 +1576,15 @@ do report_alternates("alternate %a, value %a, replacing glyph %U by glyph %U", tostring(what.feature),tostring(what.value),char,alt) end - setchar(pointer,alt) - break + -- setchar(pointer,alt) + -- break + newchar = alt end end end + if newchar then + setchar(pointer,newchar) + end end end end @@ -2974,7 +2983,7 @@ function processors.mlisttohlist(head,style,penalties,beginclass,endclass,level) return head end -callbacks.register('mlist_to_hlist',processors.mlisttohlist,"preprocessing math list") +callbacks.register("mlist_to_hlist",processors.mlisttohlist,"convert a noad list into a node list") -- tracing diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-rad.mklx b/Master/texmf-dist/tex/context/base/mkxl/math-rad.mklx index 703481c0820..ee91243e0ae 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-rad.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/math-rad.mklx @@ -195,8 +195,8 @@ \zerocount \fi \Urooted - \s!height\dimexpr\mathradicalparameter\c!height\relax - \s!depth \dimexpr\mathradicalparameter\c!depth\relax + \s!height\dimexpr\ifcstok{\mathradicalparameter\c!height}\v!none\scaledpoint\else\mathradicalparameter\c!height\fi\relax + \s!depth \dimexpr\ifcstok{\mathradicalparameter\c!depth }\v!none\scaledpoint\else\mathradicalparameter\c!depth \fi\relax \s!source\numexpr\namedboxanchor{\mathradicalparameter\c!source}\relax \s!style \normalmathstyle \ifzeronum\scratchcounter\else @@ -378,6 +378,12 @@ \integerdef\delimitedrightanutityuc \privatecharactercode{delimited right annuity} \integerdef\radicalbarextenderuc \privatecharactercode{radical bar extender} +%D We now default to nice bars: + +\setupmathradical + [\c!rule=\v!symbol, + \c!top=\radicalbarextenderuc] + \definemathradical [rannuity] [\c!left=\zerocount, diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-spa.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-spa.lmt index 9875f8b2d93..a575b17142e 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-spa.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/math-spa.lmt @@ -41,12 +41,18 @@ local getnormalizedline = node.direct.getnormalizedline local getbox = nuts.getbox local setoffsets = nuts.setoffsets local addxoffset = nuts.addxoffset +local setattrlist = nuts.setattrlist local nextglue = nuts.traversers.glue local nextlist = nuts.traversers.list local nextboundary = nuts.traversers.boundary local nextnode = nuts.traversers.node +local insertafter = nuts.insertafter +local insertbefore = nuts.insertbefore +local newkern = nuts.pool.kern +local newstrutrule = nuts.pool.strutrule + local texsetdimen = tex.setdimen local texgetdimen = tex.getdimen local texsetcount = tex.setcount @@ -65,6 +71,10 @@ local d_strc_math_first_height = texisdimen("d_strc_math_first_height") local d_strc_math_last_depth = texisdimen("d_strc_math_last_depth") local d_strc_math_indent = texisdimen("d_strc_math_indent") +local report = logs.reporter("mathalign") + +local trace = false trackers.register("mathalign",function(v) trace = v end ) + local function moveon(s) for n, id, subtype in nextnode, getnext(s) do s = n @@ -83,42 +93,6 @@ local function moveon(s) return s end --- stages[1] = function(specification,stage) --- local box = getbox(specification.box) --- local head = getlist(box) --- local align = specification.alignstate --- local distance = specification.distance --- for s in nextboundary, head do --- local data = getdata(s) --- if data == boundary then --- -- todo: skip over ghost, maybe penalty, maybe glues all in one loop --- s = moveon(s) --- for n, id, subtype in nextnode, getnext(s) do --- s = n --- if id == kern_code then --- -- move on (s_2 case) --- elseif id == glue_code then --- -- move on --- elseif id == penalty_code then --- -- move on (untested) --- elseif id == hlist_code and subtype == ghost_code then --- -- move on --- else --- break --- end --- end --- distance = distance + getdimensions(head,s) --- break --- end --- end --- texsetdimen("global",d_strc_math_indent,distance) --- if align == 2 then --- for n in nextglue, head do --- setglue(n,getwidth(n),0,0,0,0) --- end --- end --- end - -- -- todo: skip over ghost, maybe penalty, maybe glues all in one loop -- -- local n = getnext(s) @@ -171,16 +145,20 @@ stages[1] = function(specification,stage) p = getprev(p) end end - -- we use a hangindent so we need to treat the first one - local f = found[1] - local delta = f[2] - max - if delta ~= 0 then - nuts.insertafter(head,moveon(head),nuts.pool.kern(-delta)) - end - for i=2,#found do + for i=1,#found do local f = found[i] - local delta = f[2] - max - nuts.insertafter(head,moveon(f[3]),nuts.pool.kern(-f[2])) -- check head + local w = f[2] + local d = i == 1 and (max-w) or -w + local k = newkern(d) + local r = newstrutrule(0,2*65536,2*65536) + local s = moveon(f[3]) + if trace then + report("row %i, width %p, delta %p",i,w,d) + end + setattrlist(r,head) + setattrlist(k,head) + insertbefore(head,s,r) + insertafter(head,r,k) end end texsetdimen("global",d_strc_math_indent,max) diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-stc.mklx b/Master/texmf-dist/tex/context/base/mkxl/math-stc.mklx index 5922fb1166c..1e488af2cbd 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-stc.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/math-stc.mklx @@ -78,47 +78,35 @@ % At some point we can consider to use the more natural \LUAMETATEX\ features but the % problem is that we lack proper support in fonts and we also have less control. -\installcorenamespace {mathextensiblefallbacks} +%installcorenamespace {mathextensiblefallbacks} -% currently no italic correction ... problem is that we don't know yet if we have an italic -% below so we we need to postpone - -% \def\math_stackers_fallback -% {\hbox to \scratchwidth{\csname\??mathextensiblefallbacks\ifcsname\??mathextensiblefallbacks\number\scratchunicode\endcsname\number\scratchunicode\fi\endcsname}} -% %{\csname\??mathextensiblefallbacks\ifcsname\??mathextensiblefallbacks\number\scratchunicode\endcsname\number\scratchunicode\fi\endcsname } +% In math mode we no longer fallback, simply because only a few fonts implement +% extensible using minus and equal signs. So either we provide a tweaked one or we +% simply ignore the lack. Better choose a font that matches expectations that some +% fragile imperfect hackery. \def\math_stackers_fallback {\mathstylehbox to \scratchwidth{\usemathstackerscolorparameter\c!color \hss \hskip\mathstackersparameter\c!topoffset\relax % for manual italic correction - \ifcsname\??mathextensiblefallbacks\number\scratchunicode\endcsname - \lastnamedcs - \else + % \ifcsname\??mathextensiblefallbacks\number\scratchunicode\endcsname + % \lastnamedcs + % \else \Umathchar\zerocount\zerocount\scratchunicode - \fi + % \fi \hss}} -% \def\math_stackers_regular -% {\mathstylehbox{\usemathstackerscolorparameter\c!color -% \hskip\d_math_stackers_offset_l -% \Umathaccent\zerocount\zerocount\scratchunicode -% {\hskip\dimexpr\scratchwidth-\d_math_stackers_offset_l-\d_math_stackers_offset_r}% -% \hskip\d_math_stackers_offset_r -% }} - -% \def\math_stackers_stretch % we don't have that one yet -% {\mathstylehbox{\usemathstackerscolorparameter\c!color -% \hskip\d_math_stackers_offset_l -% \Umathaccent\zerocount\zerocount\scratchunicode -% {\hskip\dimexpr\hsize-\d_math_stackers_offset_l-\d_math_stackers_offset_r}% -% \hskip\d_math_stackers_offset_r -% }} - \def\math_stackers_regular {\mathstylehbox{\usemathstackerscolorparameter\c!color \hskip\d_math_stackers_offset_l \Uhextensible middle + \ifcstok{\mathstackersparameter\c!stretch}\v!yes + stretch + \fi + \ifcstok{\mathstackersparameter\c!shrink}\v!yes + shrink + \fi width \dimexpr\scratchwidth-\d_math_stackers_offset_l-\d_math_stackers_offset_r\relax \zerocount\scratchunicode \relax @@ -130,18 +118,8 @@ % $\Umathaccent 0 0 "2190{x}$ \par $\Umathaccent 0 0 "27F8{x}$\par % $\Udelimiterunder 0 "2190{x}$ \par $\Udelimiterunder 0 "27F8{x}$\par -\defcsname\??mathextensiblefallbacks\endcsname - {\hpack{\vrule\s!width\scratchwidth\s!height.1\mathexheight\s!depth\zeropoint}} - -% \def\math_stackers_with_fallback#codepoint% -% {\begingroup -% \scratchunicode#codepoint\relax -% \ifcase\mathextensiblecode\fam\scratchunicode\relax -% \math_stackers_fallback -% \else -% \math_stackers_stretch -% \fi -% \endgroup} +% \defcsname\??mathextensiblefallbacks\endcsname +% {\hpack{\vrule\s!width\scratchwidth\s!height.1\mathexheight\s!depth\zeropoint}} %D We don't really need this because we can assume that fonts have the right %D extensibles. If needed I will make a general virtual extender for \OPENTYPE\ @@ -337,6 +315,28 @@ \scratchbottomoffset\zeropoint \fi} +\def\math_stackers_get_max_width + {\ifdim\wd\scratchboxone>\scratchwidth + \scratchwidth\wd\scratchboxone + \fi + \ifdim\wd\scratchboxtwo>\scratchwidth + \scratchwidth\wd\scratchboxtwo + \fi + \ifdim\wd\scratchboxthree>\scratchwidth + \scratchwidth\wd\scratchboxthree + \fi} + +\def\math_stackers_set_max_width + {\ifdim\wd\scratchboxone<\scratchwidth + \setbox\scratchboxone\hpack to \scratchwidth{\hss\unhbox\scratchboxone\hss}% unhboxing makes leaders work + \fi + \ifdim\wd\scratchboxtwo<\scratchwidth + \setbox\scratchboxtwo\hpack to \scratchwidth{\hss\unhbox\scratchboxtwo\hss}% + \fi + \ifdim\wd\scratchboxthree<\scratchwidth + \setbox\scratchboxthree\hpack to \scratchwidth{\hss\unhbox\scratchboxthree\hss}% + \fi} + \protected\def\math_stackers_triplet#method#category#codepoint#toptext#bottomtext% {\begingroup \edef\currentmathstackers{#category}% @@ -395,19 +395,7 @@ \else \setmathtextbox\scratchboxthree\hbox{\math_stackers_middletext}% \fi - \scratchwidth\wd - \ifdim\wd\scratchboxone>\wd\scratchboxtwo - \ifdim\wd\scratchboxone>\wd\scratchboxthree - \scratchboxone - \else - \scratchboxthree - \fi - \orelse\ifdim\wd\scratchboxtwo>\wd\scratchboxthree - \scratchboxtwo - \else - \scratchboxthree - \fi - \relax + \math_stackers_get_max_width \fi % \scratchdimen\mathstackersparameter\c!minwidth\relax @@ -421,19 +409,11 @@ \setbox\scratchboxthree\csname\??mathstackersalternative\p_alternative\endcsname \dostoptagged \fi - \ifdim\wd\scratchboxthree>\scratchwidth - \scratchwidth\wd\scratchboxthree - \fi +% \ifdim\wd\scratchboxthree>\scratchwidth +% \scratchwidth\wd\scratchboxthree +% \fi % - \ifdim\wd\scratchboxone<\scratchwidth - \setbox\scratchboxone\hpack to \scratchwidth{\hss\unhbox\scratchboxone\hss}% unhboxing makes leaders work - \fi - \ifdim\wd\scratchboxtwo<\scratchwidth - \setbox\scratchboxtwo\hpack to \scratchwidth{\hss\unhbox\scratchboxtwo\hss}% - \fi - \ifdim\wd\scratchboxthree<\scratchwidth - \setbox\scratchboxthree\hpack to \scratchwidth{\hss\unhbox\scratchboxthree\hss}% - \fi + \math_stackers_set_max_width % \ifcsname\??mathstackerslocation\p_location\endcsname \ifcase\csname\??mathstackerslocation\p_location\endcsname\relax @@ -458,7 +438,6 @@ \ifzeropt\scratchdistance\else \setbox\scratchboxthree\hpack{\lower\scratchdistance\box\scratchboxthree}% \fi - % \math_stackers_normalize_three % analysis \ifdim\htdp\scratchboxtwo>\zeropoint @@ -625,6 +604,8 @@ \fi % \math_stackers_normalize_three + \math_stackers_get_max_width + \math_stackers_set_max_width % analysis \ifcase\c_math_stackers_bottom \ifcase\c_math_stackers_top @@ -654,7 +635,7 @@ \math_stackers_bottom\bgroup \lower\dimexpr \scratchdepth - +\ht\scratchboxtwo + +\ht\ifcase\c_math_stackers_top\scratchboxtwo\else\scratchboxone\fi +\mathstackersparameter\c!distance % was \c!voffset \relax \ifcase\c_math_stackers_top @@ -973,6 +954,7 @@ [\v!both] [\v!mathematics] [\c!location=\v!top, % ? + \c!mathclass=\s!accent, % check chemistry \c!strut=\v!no, \c!middlecommand=\mathematics, \c!hoffset=\zeropoint] @@ -989,7 +971,10 @@ [\v!vfenced] [\v!both] [\c!mathclass=\s!ordinary, - \c!mathlimits=\v!yes] + \c!mathlimits=\v!yes, + % only these arrows make sense + \c!stretch=\v!yes, + \c!shrink=\v!yes] % these are needed for mathml: @@ -1037,7 +1022,7 @@ \immutable\protected\def\normaldoublebrace {\Umathaccent \s!both \zerocount \zerocount "23DE \zerocount \zerocount "23DF } \immutable\protected\def\normaldoubleparent{\Umathaccent \s!both \zerocount \zerocount "23DC \zerocount \zerocount "23DD } -% let's keep this +% let's keep this .. some are not defined so there's nothing normal \aliased\let\normaloverbrace \overbrace \aliased\let\normalunderbrace \underbrace @@ -1045,10 +1030,11 @@ \aliased\let\normalunderparent \underparent \aliased\let\normaloverbracket \overbracket \aliased\let\normalunderbracket \underbracket -\aliased\let\normalunderleftarrow \underleftarrow -\aliased\let\normaloverleftarrow \overleftarrow -\aliased\let\normalunderrightarrow\underrightarrow -\aliased\let\normaloverrightarrow \overrightarrow + +%aliased\let\normalunderleftarrow \underleftarrow +%aliased\let\normaloverleftarrow \overleftarrow +%aliased\let\normalunderrightarrow\underrightarrow +%aliased\let\normaloverrightarrow \overrightarrow %D Here come the new ones: @@ -1058,7 +1044,7 @@ \definemathstackers [\v!medium] [\v!mathematics] [\c!hoffset=1.5\mathemwidth] \definemathstackers [\v!big] [\v!mathematics] [\c!hoffset=2\mathemwidth] -\definemathextensible [\v!reverse] [xrel] ["002D] +\definemathextensible [\v!reverse] [xrel] ["2212] % ["002D] \definemathextensible [\v!reverse] [xequal] ["003D] \definemathextensible [\v!reverse] [xleftarrow] ["2190] % ["27F5] \definemathextensible [\v!reverse] [xrightarrow] ["2192] % ["27F6] @@ -1081,14 +1067,14 @@ \definemathextensible [\v!reverse] [xrightleftharpoons] ["21CC] \definemathextensible [\v!reverse] [xtriplerel] ["2261] -\definemathextensible [\v!mathematics] [mrel] ["002D] +\definemathextensible [\v!mathematics] [mrel] ["2212] % ["002D] \definemathextensible [\v!mathematics] [mequal] ["003D] \definemathextensible [\v!mathematics] [mleftarrow] ["2190] % ["27F5] \definemathextensible [\v!mathematics] [mrightarrow] ["2192] % ["27F6] -\definemathextensible [\v!mathematics] [mleftrightarrow] ["27F7] -\definemathextensible [\v!mathematics] [mLeftarrow] ["27F8] -\definemathextensible [\v!mathematics] [mRightarrow] ["27F9] -\definemathextensible [\v!mathematics] [mLeftrightarrow] ["27FA] +\definemathextensible [\v!mathematics] [mleftrightarrow] ["2194] +\definemathextensible [\v!mathematics] [mLeftarrow] ["21D0] +\definemathextensible [\v!mathematics] [mRightarrow] ["21D2] +\definemathextensible [\v!mathematics] [mLeftrightarrow] ["21D4] \definemathextensible [\v!mathematics] [mtwoheadleftarrow] ["219E] \definemathextensible [\v!mathematics] [mtwoheadrightarrow] ["21A0] \definemathextensible [\v!mathematics] [mmapsto] ["21A6] @@ -1104,17 +1090,18 @@ \definemathextensible [\v!mathematics] [mrightleftharpoons] ["21CC] \definemathextensible [\v!mathematics] [mtriplerel] ["2261] -\definemathextensible [\v!text] [trel] ["002D] +\definemathextensible [\v!text] [trel] ["2212] % ["002D] \definemathextensible [\v!text] [tequal] ["003D] \definemathextensible [\v!text] [tmapsto] ["21A6] \definemathextensible [\v!text] [tleftarrow] ["2190] % ["27F5] \definemathextensible [\v!text] [trightarrow] ["2192] % ["27F6] -\definemathextensible [\v!text] [tleftrightarrow] ["27F7] -\definemathextensible [\v!text] [tLeftarrow] ["27F8] -\definemathextensible [\v!text] [tRightarrow] ["27F9] -\definemathextensible [\v!text] [tLeftrightarrow] ["27FA] +\definemathextensible [\v!text] [tleftrightarrow] ["2194] +\definemathextensible [\v!text] [tLeftarrow] ["21D0] +\definemathextensible [\v!text] [tRightarrow] ["21D2] +\definemathextensible [\v!text] [tLeftrightarrow] ["21D4] \definemathextensible [\v!text] [ttwoheadleftarrow] ["219E] \definemathextensible [\v!text] [ttwoheadrightarrow] ["21A0] +\definemathextensible [\v!text] [tmapsto] ["21A6] \definemathextensible [\v!text] [thookleftarrow] ["21A9] \definemathextensible [\v!text] [thookrightarrow] ["21AA] \definemathextensible [\v!text] [tleftharpoondown] ["21BD] @@ -1127,25 +1114,47 @@ \definemathextensible [\v!text] [trightleftharpoons] ["21CC] \definemathextensible [\v!text] [ttriplerel] ["2261] -\definemathoverextensible [\v!top] [overleftarrow] ["2190] % ["27F5] -\definemathoverextensible [\v!top] [overrightarrow] ["2192] % ["27F6] -\definemathoverextensible [\v!top] [overleftrightarrow] ["27F7] -\definemathoverextensible [\v!top] [overtwoheadleftarrow] ["27F8] -\definemathoverextensible [\v!top] [overtwoheadrightarrow] ["27F9] -\definemathoverextensible [\v!top] [overleftharpoondown] ["21BD] -\definemathoverextensible [\v!top] [overleftharpoonup] ["21BC] -\definemathoverextensible [\v!top] [overrightharpoondown] ["21C1] -\definemathoverextensible [\v!top] [overrightharpoonup] ["21C0] +\definemathoverextensible [\v!top] [overleftarrow] ["2190] % ["27F5] +\definemathoverextensible [\v!top] [overrightarrow] ["2192] % ["27F6] +\definemathoverextensible [\v!top] [overleftrightarrow] ["2194] % ["27F7] +\definemathoverextensible [\v!top] [overtwoheadleftarrow] ["219E] % ["27F8] +\definemathoverextensible [\v!top] [overtwoheadrightarrow] ["21A0] % ["27F9] +\definemathoverextensible [\v!top] [overlefttailarrow] ["21A2] +\definemathoverextensible [\v!top] [overrighttailarrow] ["21A3] +\definemathoverextensible [\v!top] [overleftbararrow] ["21A4] +\definemathoverextensible [\v!top] [overrightbararrow] ["21A6] +\definemathoverextensible [\v!top] [overlefthookarrow] ["21A9] +\definemathoverextensible [\v!top] [overrighthookarrow] ["21AA] +\definemathoverextensible [\v!top] [overleftharpoondown] ["21BD] +\definemathoverextensible [\v!top] [overleftharpoonup] ["21BC] +\definemathoverextensible [\v!top] [overrightharpoondown] ["21C1] +\definemathoverextensible [\v!top] [overrightharpoonup] ["21C0] +\definemathoverextensible [\v!top] [overRightarrow] ["21D2] % ["27F9] +\definemathoverextensible [\v!top] [overLeftarrow] ["21D0] % ["27F8] +\definemathoverextensible [\v!top] [overLeftrightarrow] ["21D4] % ["27F8] +\definemathoverextensible [\v!top] [overLeftbararrow] ["2906] +\definemathoverextensible [\v!top] [overRightbararrow] ["2907] \definemathunderextensible [\v!bottom] [underleftarrow] ["2190] % ["27F5] \definemathunderextensible [\v!bottom] [underrightarrow] ["2192] % ["27F6] -\definemathunderextensible [\v!bottom] [underleftrightarrow] ["27F7] -\definemathunderextensible [\v!bottom] [undertwoheadleftarrow] ["27F8] -\definemathunderextensible [\v!bottom] [undertwoheadrightarrow] ["27F9] +\definemathunderextensible [\v!bottom] [underleftrightarrow] ["2194] % ["27F7] +\definemathunderextensible [\v!bottom] [undertwoheadleftarrow] ["219E] % ["27F8] +\definemathunderextensible [\v!bottom] [undertwoheadrightarrow] ["21A0] % ["27F9] +\definemathunderextensible [\v!bottom] [underlefttailarrow] ["21A2] +\definemathunderextensible [\v!bottom] [underrighttailarrow] ["21A3] +\definemathunderextensible [\v!bottom] [underleftbararrow] ["21A4] +\definemathunderextensible [\v!bottom] [underrightbararrow] ["21A6] +\definemathunderextensible [\v!bottom] [underlefthookarrow] ["21A9] +\definemathunderextensible [\v!bottom] [underrighthookarrow] ["21AA] \definemathunderextensible [\v!bottom] [underleftharpoondown] ["21BD] \definemathunderextensible [\v!bottom] [underleftharpoonup] ["21BC] \definemathunderextensible [\v!bottom] [underrightharpoondown] ["21C1] \definemathunderextensible [\v!bottom] [underrightharpoonup] ["21C0] +\definemathunderextensible [\v!bottom] [underRightarrow] ["21D2] % ["27F9] +\definemathunderextensible [\v!bottom] [underLeftarrow] ["21D0] % ["27F8] +\definemathunderextensible [\v!bottom] [underLeftrightarrow] ["21D4] % ["27F8] +\definemathunderextensible [\v!bottom] [underLeftbararrow] ["2906] +\definemathunderextensible [\v!bottom] [underRightbararrow] ["2907] %D We don't use overline and underline. This is one of the overlooked aspects of %D unicode cq. opentype math: why treat rules different than e.g. arrows and @@ -1160,9 +1169,9 @@ %D in the backend (okay, we still need to deal with some cut and paste issues but at %D least we now know what we deal with. -\definemathoverextensible [\v!vfenced] [overbar] ["203E] -\definemathunderextensible [\v!vfenced] [underbar] ["203E] % ["0332] -\definemathdoubleextensible [\v!vfenced] [doublebar] ["203E] ["203E] % ["0332] +\definemathoverextensible [\v!vfenced] [overbar] ["203E] % todo: private +\definemathunderextensible [\v!vfenced] [underbar] ["203E] % todo: private +\definemathdoubleextensible [\v!vfenced] [doublebar] ["203E] ["203E] % todo: private \definemathoverextensible [\v!vfenced] [overbrace] ["23DE] \definemathunderextensible [\v!vfenced] [underbrace] ["23DF] @@ -1178,13 +1187,13 @@ %D For mathml: -\definemathdoubleextensible [\v!both] [overbarunderbar] ["203E] ["203E] +\definemathdoubleextensible [\v!both] [overbarunderbar] ["203E] ["203E] % todo: private \definemathdoubleextensible [\v!both] [overbraceunderbrace] ["23DE] ["23DF] \definemathdoubleextensible [\v!both] [overparentunderparent] ["23DC] ["23DD] \definemathdoubleextensible [\v!both] [overbracketunderbracket] ["23B4] ["23B5] -\definemathovertextextensible [\v!bothtext] [overbartext] ["203E] -\definemathundertextextensible [\v!bothtext] [underbartext] ["203E] +\definemathovertextextensible [\v!bothtext] [overbartext] ["203E] % todo: private +\definemathundertextextensible [\v!bothtext] [underbartext] ["203E] % todo: private \definemathovertextextensible [\v!bothtext] [overbracetext] ["23DE] \definemathundertextextensible [\v!bothtext] [underbracetext] ["23DF] \definemathovertextextensible [\v!bothtext] [overparenttext] ["23DC] @@ -1206,56 +1215,79 @@ \definemathextensible [\v!chemistry] [crightoverleftarrow] ["21C4] \definemathextensible [\v!chemistry] [cleftoverrightarrow] ["21C6] -\def\math_stackers_hacked_fill#1#2#3% - {\mathematics - {\begingroup - \mathsurround\zeropoint - \thickmuskip \zeromuskip - \medmuskip \zeromuskip - \thinmuskip \zeromuskip - \tinymuskip \zeromuskip - \pettymuskip \zeromuskip - \ifrelax#1% - \cleaders\mathstylehbox{#2}\hfill - \else - #1% - \mkern-7\onemuskip - \cleaders\mathstylehbox{\mkern-2\onemuskip#2\mkern-2\onemuskip}\hfill - \mkern-7\onemuskip - #3% - \fi - \endgroup}} - -\immutable\protected\def\rightarrowfill {\math_stackers_hacked_fill \relbar \relbar \rightarrow} -\immutable\protected\def\leftarrowfill {\math_stackers_hacked_fill \leftarrow \relbar \relbar} -\immutable\protected\def\rightoverleftarrowfill{\math_stackers_hacked_fill \relax \crightoverleftarrow \relax} -\immutable\protected\def\leftoverrightarrowfill{\math_stackers_hacked_fill \relax \cleftoverrightarrow \relax} -\immutable\protected\def\equalfill {\math_stackers_hacked_fill \Relbar \Relbar \Relbar} -\immutable\protected\def\Rightarrowfill {\math_stackers_hacked_fill \Relbar \Relbar \Rightarrow} -\immutable\protected\def\Leftarrowfill {\math_stackers_hacked_fill \Leftarrow \Relbar \Relbar} -\immutable\protected\def\Leftrightarrowfill {\math_stackers_hacked_fill \Leftarrow \Relbar \Rightarrow} -\immutable\protected\def\leftrightarrowfill {\math_stackers_hacked_fill \leftarrow \relbar \rightarrow} -\immutable\protected\def\mapstofill {\math_stackers_hacked_fill{\mapstochar\relbar} \relbar \rightarrow} -\immutable\protected\def\twoheadrightarrowfill {\math_stackers_hacked_fill \relbar \relbar \twoheadrightarrow} -\immutable\protected\def\twoheadleftarrowfill {\math_stackers_hacked_fill \twoheadleftarrow \relbar \relbar} -\immutable\protected\def\rightharpoondownfill {\math_stackers_hacked_fill \relbar \relbar \rightharpoondown} -\immutable\protected\def\rightharpoonupfill {\math_stackers_hacked_fill \relbar \relbar \rightharpoonup} -\immutable\protected\def\leftharpoondownfill {\math_stackers_hacked_fill \leftharpoondown \relbar \relbar} -\immutable\protected\def\leftharpoonupfill {\math_stackers_hacked_fill \leftharpoonup \relbar \relbar} -\immutable\protected\def\hookleftfill {\math_stackers_hacked_fill \leftarrow \relbar {\relbar\joinrel\rhook}} -\immutable\protected\def\hookrightfill {\math_stackers_hacked_fill{\lhook\joinrel\relbar}\relbar \rightarrow} -\immutable\protected\def\relfill {\math_stackers_hacked_fill \relbar \relbar \relbar} -\immutable\protected\def\triplerelfill {\math_stackers_hacked_fill \equiv \equiv \equiv} - -%D For the moment (needs checking): +% \def\math_stackers_hacked_fill#1#2#3% +% {\mathematics +% {\begingroup +% \mathsurround\zeropoint +% \thickmuskip \zeromuskip +% \medmuskip \zeromuskip +% \thinmuskip \zeromuskip +% \tinymuskip \zeromuskip +% \pettymuskip \zeromuskip +% \ifrelax#1% +% \cleaders\mathstylehbox{#2}\hfill +% \else +% #1% +% \mkern-7\onemuskip +% \cleaders\mathstylehbox{\mkern-2\onemuskip#2\mkern-2\onemuskip}\hfill +% \mkern-7\onemuskip +% #3% +% \fi +% \endgroup}} +% +% \immutable\protected\def\rightarrowfill {\math_stackers_hacked_fill \relbar \relbar \rightarrow} +% \immutable\protected\def\leftarrowfill {\math_stackers_hacked_fill \leftarrow \relbar \relbar} +% \immutable\protected\def\rightoverleftarrowfill{\math_stackers_hacked_fill \relax \crightoverleftarrow \relax} +% \immutable\protected\def\leftoverrightarrowfill{\math_stackers_hacked_fill \relax \cleftoverrightarrow \relax} +% \immutable\protected\def\equalfill {\math_stackers_hacked_fill \Relbar \Relbar \Relbar} +% \immutable\protected\def\Rightarrowfill {\math_stackers_hacked_fill \Relbar \Relbar \Rightarrow} +% \immutable\protected\def\Leftarrowfill {\math_stackers_hacked_fill \Leftarrow \Relbar \Relbar} +% \immutable\protected\def\Leftrightarrowfill {\math_stackers_hacked_fill \Leftarrow \Relbar \Rightarrow} +% \immutable\protected\def\leftrightarrowfill {\math_stackers_hacked_fill \leftarrow \relbar \rightarrow} +% \immutable\protected\def\mapstofill {\math_stackers_hacked_fill{\mapstochar\relbar} \relbar \rightarrow} +% \immutable\protected\def\twoheadrightarrowfill {\math_stackers_hacked_fill \relbar \relbar \twoheadrightarrow} +% \immutable\protected\def\twoheadleftarrowfill {\math_stackers_hacked_fill \twoheadleftarrow \relbar \relbar} +% \immutable\protected\def\rightharpoondownfill {\math_stackers_hacked_fill \relbar \relbar \rightharpoondown} +% \immutable\protected\def\rightharpoonupfill {\math_stackers_hacked_fill \relbar \relbar \rightharpoonup} +% \immutable\protected\def\leftharpoondownfill {\math_stackers_hacked_fill \leftharpoondown \relbar \relbar} +% \immutable\protected\def\leftharpoonupfill {\math_stackers_hacked_fill \leftharpoonup \relbar \relbar} +% \immutable\protected\def\hookleftfill {\math_stackers_hacked_fill \leftarrow \relbar {\relbar\joinrel\rhook}} +% \immutable\protected\def\hookrightfill {\math_stackers_hacked_fill{\lhook\joinrel\relbar}\relbar \rightarrow} +% \immutable\protected\def\relfill {\math_stackers_hacked_fill \relbar \relbar \relbar} +% \immutable\protected\def\triplerelfill {\math_stackers_hacked_fill \equiv \equiv \equiv} +% +% \permanent\tolerant\protected\def\defineextensiblefiller[#1]#*[#2]% +% {\immutable\letcsname\??mathextensiblefallbacks\number#2\expandafter\endcsname\csname#1\endcsname} + +\installcorenamespace {mathadaptiveextensible} + +\defineadaptive + [mathfiller] + [\c!setups=adaptive:mathfiller, + \c!stretch=1fill] + +\startsetups adaptive:mathfiller + \setbox\usedadaptivebox\hbox to \usedadaptivewidth \bgroup + \startimath + \Uhextensible + \s!width \usedadaptivewidth + \s!middle \zerocount \usedadaptivealternative + \relax + \stopimath + \egroup +\stopsetups + +\def\mathfiller#1% + {\begingroup + \scratchunicode#1\relax + \adaptivebox[mathfiller][\c!alternative=#1]{\hss\strut\hss}% + \endgroup} \permanent\tolerant\protected\def\defineextensiblefiller[#1]#*[#2]% - {\immutable\letcsname\??mathextensiblefallbacks\number#2\expandafter\endcsname\csname#1\endcsname - %\immutable\letcsname#1\expandafter\endcsname\csname#1\endcsname - } % huh? + {\frozen\instance\edefcsname#1\endcsname{\mathfiller{\number#2}}} -%defineextensiblefiller [barfill] ["203E] % yet undefined -\defineextensiblefiller [relfill] ["002D] +%defineextensiblefiller [barfill] ["203E] % % todo: private +\defineextensiblefiller [relfill] ["2212] % ["002D] \defineextensiblefiller [equalfill] ["003D] \defineextensiblefiller [leftarrowfill] ["2190] \defineextensiblefiller [rightarrowfill] ["2192] @@ -1302,14 +1334,18 @@ {\begingroup \edef\currentmathstackers{#category}% \edef\p_moffset{\mathstackersparameter\c!moffset}% - \ifempty\p_moffset \else - \mskip\p_moffset\relax + \ifconditional\indisplaymath + \ifempty\p_moffset \else + \ifmmode\mskip\else\hskip\fi\p_moffset\relax + \fi \fi \ifmmode\math_atom_by_parameter\mathstackersparameter\else\dontleavehmode\fi {\usemathstackerscolorparameter\c!color \Umathchar\zerocount\zerocount#codepoint}% - \ifempty\p_moffset \else - \mskip\p_moffset\relax + \ifconditional\indisplaymath + \ifempty\p_moffset \else + \ifmmode\mskip\else\hskip\fi\p_moffset\relax + \fi \fi \endgroup} @@ -1319,6 +1355,7 @@ \definemathunstacked [\v!wide] [impliedby] ["27F8] % \mathrel{\;\Longleftarrow\;} \definemathunstacked [\v!wide] [implies] ["27F9] % \mathrel{\;\Longrightarrow\;} \definemathunstacked [\v!wide] [iff] ["27FA] % \mathrel{\;\Longleftrightarrow\;} +\definemathunstacked [\v!wide] [impliesby] ["27FA] % \mathrel{\;\Longleftrightarrow\;} % New (an example of using \mathexheight): diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-ttv.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-ttv.lmt index 3393ecc0391..3484d6c80c3 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-ttv.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/math-ttv.lmt @@ -130,6 +130,7 @@ mathencodings["tex-ex"] = { mathencodings["tex-mr"] = { [0x00393] = 0x00, -- Gamma [0x00394] = 0x01, -- Delta + [0x02206] = 0x01, -- Laplace [0x00398] = 0x02, -- Theta [0x0039B] = 0x03, -- Lambda [0x0039E] = 0x04, -- Xi @@ -144,7 +145,8 @@ mathencodings["tex-mr"] = { -- [0x002C7] = 0x14, -- [math]check -- [0x002D8] = 0x15, -- [math]breve -- [0x000AF] = 0x16, -- [math]bar --- [0x00021] = 0x21, -- ! +[0x00021] = 0x21, -- ! -- MS +[0x00026] = 0x26, -- & -- MS [0x00028] = 0x28, -- ( [0x00029] = 0x29, -- ) [0x0002B] = 0x2B, -- + @@ -485,7 +487,8 @@ mathencodings["tex-sy"] = { [0x02240] = 0x6F, -- wr [0x0221A] = 0x70, -- sqrt. AM: Check surd?? [0x02A3F] = 0x71, -- amalg - [0x1D6FB] = 0x72, -- nabla + [0x02207] = 0x72, -- nabla (upright) + [0x1D6FB] = 0x72, -- nabla (italic) -- [0x0222B] = 0x73, -- smallint (TODO: what about intop?) [0x02294] = 0x74, -- sqcup [0x02293] = 0x75, -- sqcap diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-twk.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-twk.mkxl index 6ffb3681840..6e015d3dec3 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-twk.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/math-twk.mkxl @@ -95,5 +95,12 @@ \permanent\protected\def\minute{\iffontchar\font\textminute\textminute\else\mathminute\fi} \permanent\protected\def\second{\iffontchar\font\textsecond\textsecond\else\mathsecond\fi} +% \startsetups[math:rules] +% \letmathfractionparameter\c!rule\v!symbol +% \setmathfractionparameter\c!middle{"203E}% +% \letmathradicalparameter \c!rule\v!symbol +% \setmathradicalparameter \c!top{\radicalbarextenderuc}% +% \setmathfenceparameter \c!alternative{1}% +% \stopsetups \protect diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-vfu.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-vfu.lmt index f3e0ea81425..c29e167663d 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/math-vfu.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/math-vfu.lmt @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['math-vfu'] = { license = "see context related readme files" } +-- somehow an italic gets passed for 'next' + -- All these math vectors .. thanks to Aditya and Mojca they become better and -- better. If you have problems with math fonts or miss characters report it to the -- ConTeXt mailing list. Also thanks to Boguslaw for finding a couple of errors. @@ -62,40 +64,69 @@ local staycommand = vfcommands.stay local nps = fonts.helpers.newprivateslot local ps = fonts.helpers.privateslot +nps("rule middle piece") +nps("rule right piece") +nps("rule left piece") +nps("double rule middle piece") +nps("double rule right piece") +nps("double rule left piece") +nps("arrow left piece") +nps("arrow right piece") +nps("double arrow left piece") +nps("double arrow right piece") + +nps("flat rule left piece") +nps("flat rule middle piece") +nps("flat rule right piece") + +nps("flat double rule left piece") +nps("flat double rule middle piece") +nps("flat double rule right piece") + +nps("minus rule left piece") +nps("minus rule middle piece") +nps("minus rule right piece") + do - local function horibar(main,unicode,rule,left,right,normal) + -- this overlaps with math-act + + local function horibar(main,unicode,rule,left,right,normal,force,m,l,r) local characters = main.characters - if not characters[unicode] then + local data = characters[unicode] + if force or not data then local height = main.mathparameters.defaultrulethickness or 4*65536/10 - local f_rule = rule and formatters["M-HORIBAR-RULE-%H"](rule) - local p_rule = rule and hasprivate(main,f_rule) + local f_rule = rule and formatters["M-HORIBAR-M-%H"](rule) + local p_rule = rule and hasprivate(main,f_rule) + local ndata = normal and characters[normal] if rule and left and right and normal then - local ldata = characters[left] - local mdata = characters[rule] - local rdata = characters[right] - local ndata = characters[normal] + local ldata = characters[l or left] + local mdata = characters[m or rule] + local rdata = characters[r or right] local lwidth = ldata.width or 0 local mwidth = mdata.width or 0 local rwidth = rdata.width or 0 local nwidth = ndata.width or 0 local down = (mdata.height / 2) - height - -- - local f_left = right and formatters["M-HORIBAR-LEFT-%H"](right) - local f_right = right and formatters["M-HORIBAR-RIGHT-%H"](right) +if unicode == normal then + height = ndata.height + down = 0 +end -- + local f_left = left and formatters["M-HORIBAR-L-%H"](left) + local f_right = right and formatters["M-HORIBAR-R-%H"](right) local p_left = left and hasprivate(main,f_left) local p_right = right and hasprivate(main,f_right) -- if not characters[p_rule] then p_rule = addprivate(main,f_rule,{ height = height, - width = mwidth, - width = .95*mwidth, + width = .95*mwidth, +-- keepvirtual = true, commands = { push, - leftcommand[.025*mwidth], + leftcommand[.025*mwidth], downcommand[down], - slotcommand[0][rule], + slotcommand[0][m or rule], pop, }, }) @@ -103,13 +134,13 @@ do if not characters[p_left] then p_left = addprivate(main,f_left,{ height = height, - width = lwidth, - width = .95*lwidth, + width = .95*lwidth, +-- keepvirtual = true, commands = { push, - leftcommand[.025*lwidth], + leftcommand[.025*lwidth], downcommand[down], - slotcommand[0][left], + slotcommand[0][l or left], pop, }, }) @@ -117,50 +148,78 @@ do if not characters[p_right] then p_right = addprivate(main,f_right,{ height = height, - width = rwidth, - width = .95*rwidth, + width = .95*rwidth, +-- keepvirtual = true, commands = { push, - leftcommand[.025*rwidth], + leftcommand[.025*rwidth], downcommand[down], - slotcommand[0][right], + slotcommand[0][r or right], pop, }, }) end - characters[unicode] = { - keepvirtual = true, - partsorientation = "horizontal", - height = height, - width = nwidth, - commands = { +if unicode ~= normal then + data = { + unicode = unicode, + height = height, + width = nwidth, + commands = { downcommand[down], slotcommand[0][normal] }, - parts = { - { glyph = p_left, ["end"] = 0.4*lwidth }, - { glyph = p_rule, extender = 1, ["start"] = mwidth, ["end"] = mwidth }, - { glyph = p_right, ["start"] = 0.6*rwidth }, - } + } + characters[unicode] = data +end + data.parts = { + { glyph = p_left, ["end"] = 0.4*lwidth }, + { glyph = p_rule, extender = 1, ["start"] = mwidth, ["end"] = mwidth }, + { glyph = p_right, ["start"] = 0.6*rwidth }, } else - local width = main.parameters.quad/4 or 4*65536 + local width = main.parameters.quad/2 or 4*65536 -- 3 if not characters[p_rule] then - p_rule = addprivate(main,f_rule,{ - height = height, - width = width, - commands = { push, { "rule", height, width }, pop }, - }) + if unicode == normal then + p_rule = addprivate(main,f_rule,{ + height = ndata.height, + width = width, + commands = { + push, + upcommand[(ndata.height - height)/2], + { "rule", height, width }, + pop + }, + }) + else + p_rule = addprivate(main,f_rule,{ + height = height, + width = width, + commands = { + push, + { "rule", height, width }, + pop + }, + }) + end end - characters[unicode] = { - keepvirtual = true, - partsorientation = "horizontal", - parts = { - { glyph = p_rule }, - { glyph = p_rule, extender = 1, ["start"] = width/2, ["end"] = width/2 }, +if unicode ~= normal then + data = { + unicode = unicode, + height = height, + width = width, + commands = { + slotcommand[0][p_rule] } } + characters[unicode] = data +end + data.parts = { + { glyph = p_rule, ["start"] = width/2, ["end"] = width/2 }, + { glyph = p_rule, extender = 1, ["start"] = width/2, ["end"] = width/2 }, + } end + data.keepvirtual = true -- i need to figure this out + data.partsorientation = "horizontal" end end @@ -180,8 +239,8 @@ do local nwidth = ndata.width or 0 local down = (mdata.height / 2) - height -- - local f_rule = rule and formatters["M-ROOTBAR-RULE-%H"](rule) - local f_right = right and formatters["M-ROOTBAR-RIGHT-%H"](right) + local f_rule = rule and formatters["M-ROOTBAR-M-%H"](rule) + local f_right = right and formatters["M-ROOTBAR-R-%H"](right) local p_rule = rule and hasprivate(main,f_rule) local p_right = right and hasprivate(main,f_right) -- @@ -234,21 +293,29 @@ do if characters[unicode] then local template = characters[first] if template then - if not characters[rule] then - local xheight = main.mathparameters.xheight + local crule = characters[rule] + local xheight = main.mathparameters.xheight + local rheight = 0 + local rdepth = 0 +-- if crule then +-- rheight = crule.height +-- rdepth = crule.depth +-- else local width = template.width / 4 local height = template.height local depth = template.depth - local rheight = where == "top" and height or 3*height - local rdepth = where == "top" and 2*height or 0 + rheight = where == "top" and height or 3*height + rdepth = where == "top" and 2*height or 0 characters[rule] = { height = rheight, depth = rdepth, width = width, commands = { push, { "rule", height, width }, pop }, } - characters[first].depth = rdepth - characters[last] .depth = rdepth +-- end + characters[first].depth = rdepth + characters[last] .depth = rdepth + if where == "top" then while true do chardata.height = chardata.height - xheight chardata.depth = 0 @@ -261,41 +328,49 @@ do break end end + else + while true do + chardata.height = 0 + local next = chardata.next + if next then + unicode = next + chardata = characters[unicode] + else + break + end + end end chardata.keepvirtual = true chardata.partsorientation = "horizontal" chardata.parts = { { glyph = first }, - { glyph = rule, extender = 1 }, + { glyph = rule, extender = 1, start = width/2, ["end"] = width/2 }, { glyph = last }, } end end end - local function brace(main,unicode,first,rule,left,right,rule,last) + local function brace(main,unicode,first,rule,left,right,rule,last,where) local characters = main.characters local chardata = characters[unicode] if chardata then local template = characters[first] if template then - if not characters[rule] then - local xheight = main.mathparameters.xheight - local width = template.width / 4 - local height = template.height - local depth = template.depth - local rheight = 3*height - local rdepth = 2*height - characters[rule] = { - height = rheight, - depth = rdepth, - width = width, - commands = { push, { "rule", height, width }, pop }, - } - characters[first].depth = rdepth - characters[last] .depth = rdepth - characters[left] .height = rheight - characters[right].height = rheight + local xheight = main.mathparameters.xheight + local width = template.width / 4 + local height = template.height + local depth = template.depth + local rheight = 3*height + local rdepth = 2*height + characters[rule] = { + height = rheight, + depth = rdepth, + width = width, + commands = { push, { "rule", height, width }, pop }, + } + -- don't change snippets, they serve dual purposes + if where == "top" then while true do chardata.height = chardata.height - xheight chardata.depth = 0 @@ -308,15 +383,26 @@ do break end end + else + while true do + chardata.height = 0 + local next = chardata.next + if next then + unicode = next + chardata = characters[unicode] + else + break + end + end end chardata.keepvirtual = true chardata.partsorientation = "horizontal" chardata.parts = { { glyph = first }, - { glyph = rule, extender = 1 }, + { glyph = rule, extender = 1, start = width/2, ["end"] = width/2 }, { glyph = left }, { glyph = right }, - { glyph = rule, extender = 1 }, + { glyph = rule, extender = 1, start = width/2, ["end"] = width/2 }, { glyph = last }, } end @@ -436,9 +522,11 @@ do width = w1 + w2 - d12 end characters[unicode] = { + unicode = unicode, width = width, height = max(c1.height or 0, c2.height or 0), depth = max(c1.depth or 0, c2.depth or 0), +keepvirtual = true, commands = { -- { "inspect" }, -- { "trace" }, @@ -482,10 +570,11 @@ do local w1 = c1.width local w2 = c2.width local w3 = c3.width - local mu = main.parameters.size/18 + local ds = main.parameters.size/18 d12 = d12 * ds d23 = d23 * ds characters[unicode] = { + unicode = unicode, width = w1 + w2 + w3 - d12 - d23, height = max(c1.height or 0, c2.height or 0, c3.height or 0), depth = max(c1.depth or 0, c2.depth or 0, c3.depth or 0), @@ -572,6 +661,40 @@ do end end + local function extension(main,unicode,first,middle,last,ffactor,mfactor,lfactor) + local characters = main.characters + local chardata = characters[unicode] + if chardata then + local fw = first and characters[first] + local mw = middle and characters[middle] + local lw = last and characters[last] + if fw and lw then + fw = fw.width ; if fw == 0 then fw = 1 end + lw = lw.width ; if lw == 0 then lw = 1 end + if middle == "left" then + chardata.parts = { + { extender = 0, glyph = first, ["end"] = fw/2, start = 0, advance = fw }, + { extender = 1, glyph = last, ["end"] = lw/2, start = lw/2, advance = lw }, + } + elseif middle == "right" then + chardata.parts = { + { extender = 1, glyph = first, ["end"] = fw/2, start = fw/2, advance = fw }, + { extender = 0, glyph = last, ["end"] = lw/2, start = 0, advance = lw }, + } + elseif mw then + mw = mw.width ; if mw == 0 then mw = 1 end + chardata.parts = { + { extender = 0, glyph = first, ["end"] = fw/2, start = 0, advance = (ffactor or 1)*fw }, + { extender = 1, glyph = middle, ["end"] = mw/2, start = mw/2, advance = (mfactor or 1)*mw }, + { extender = 0, glyph = last, ["end"] = 0, start = lw/2, advance = (lfactor or 1)*lw }, + } + end + chardata.keepvirtual = true -- why this issue with nested virtuals + chardata.partsorientation = "horizontal" + end + end + end + vfmath.builders = { horibar = horibar, rootbar = rootbar, @@ -583,6 +706,7 @@ do jointhree = jointhree, stack = stack, repeated = repeated, + extension = extension, } -- todo: move this to the lfg files @@ -621,6 +745,7 @@ local function copy_glyph(main,target,original,unicode,slot) kerns = olddata.kerns, mathkerns = olddata.mathkerns, tounicode = olddata.tounicode, +-- smaller = olddata.smaller, commands = { slotcommand[slot][unicode] }, } local glyphdata = newdata @@ -755,7 +880,7 @@ local function virtualize(s,uni,fci,skewchar,move,mathparameters,unicode,paramet end end -function vfmath.define(specification,set,goodies) +function vfmath.define(specification,virtual,goodies) local name = specification.name -- symbolic name local size = specification.size -- given size local loaded = { } @@ -766,8 +891,9 @@ function vfmath.define(specification,set,goodies) local okset = { } local n = 0 local f_extra = formatters["virtual.extra.%05X"] - for s=1,#set do - local ss = set[s] + local setlist = virtual.recipe or virtual + for s=1,#setlist do + local ss = setlist[s] local ssname = ss.name if add_optional and ss.optional then if trace_virtual then @@ -781,6 +907,8 @@ function vfmath.define(specification,set,goodies) main = s end local alreadyloaded = names[ssname] -- for px we load one twice (saves .04 sec) +-- local sshash = name .. ":" .. ssname +-- local alreadyloaded = names[sshash] -- for px we load one twice (saves .04 sec) local f, id if alreadyloaded then f, id = alreadyloaded.f, alreadyloaded.id @@ -790,6 +918,7 @@ function vfmath.define(specification,set,goodies) else f, id = fonts.constructors.readanddefine(ssname,size) names[ssname] = { +-- names[sshash] = { f = f, id = id, fontname = ssname, -- diagnostics @@ -934,7 +1063,7 @@ function vfmath.define(specification,set,goodies) mathparameters.axisheight = newparameters[22] or 0 -- axisheight : height of fraction lines above the baseline -- report_virtual("loading and virtualizing font %a at size %p, setting sy parameters",name,size) end - -- We no longer care about kerns and ligatures here. We use backmack because we need to know + -- We no longer care about kerns and ligatures here. We use backmap because we need to know -- the original order and the loader has made a unicode font of it and weird glyph names have -- spoiled that a bit too. if ss.overlay then @@ -1087,9 +1216,32 @@ function vfmath.define(specification,set,goodies) fontname = name, -- diagnostics } -- - local addmissing = goodies.mathematics.addmissing - if type(addmissing) == "function" then - addmissing(main) + local virtualtweaks = virtual.tweaks + if virtualtweaks then + -- + local mathtweaks = mathematics.tweaks + local knowntweaks = { + addmissing = function(main,specification) + local action = specification.action + if action then + action(main,specification) -- source == target + end + end + } + -- + for i=1,#virtualtweaks do + local specification = virtualtweaks[i] + local tweak = specification.tweak + local action = knowntweaks[tweak] + if action then + action(main,specification) + else + action = mathtweaks[tweak] + if action then + action(main,main,specification) + end + end + end end -- mathematics.addfallbacks(main) @@ -1102,22 +1254,6 @@ function vfmath.define(specification,set,goodies) main.MathConstants = main.mathconstants main.nomath = false -- - mathematics.tweaks.setoptions(main,main,{ - tweak = "setoptions", - set = { "ignorekerndimensions" } - }) -- we have dp > ht fences - -- - mathematics.tweaks.fixprimes(main, main, { - tweak = "fixprimes", - factor = 1, -- accent base height - fake = 0.9, -- replace multiples with this width proportion - }) - -- --- mathematics.tweaks.addbars(main,main,{ --- tweak = "addbars", --- advance = 0.52, --- }) - -- if trace_virtual or trace_timings then report_virtual("loading and virtualizing font %a at size %p took %0.3f seconds",name,size,os.clock()-start) end @@ -1148,40 +1284,6 @@ function vfmath.setdigits(font_encoding, name, digits) end end --- local function extension(main,characters,id,size,unicode,first,middle,last) --- local chr = characters[unicode] --- if not chr then --- return -- skip --- end --- local fw = characters[first] --- if not fw then --- return --- end --- local mw = characters[middle] --- if not mw then --- return --- end --- local lw = characters[last] --- if not lw then --- return --- end --- fw = fw.width --- mw = mw.width --- lw = lw.width --- if fw == 0 then --- fw = 1 --- end --- if lw == 0 then --- lw = 1 --- end --- chr.partsorientation = "horizontal" --- chr.parts = { --- { extender = 0, glyph = first, ["end"] = fw/2, start = 0, advance = fw }, --- { extender = 1, glyph = middle, ["end"] = mw/2, start = mw/2, advance = mw }, --- { extender = 0, glyph = last, ["end"] = 0, start = lw/2, advance = lw }, --- } --- end - -- local step = 0.2 -- 0.1 is nicer but gives larger files -- local function clipped(main,characters,id,size,unicode,original) -- push/pop needed? diff --git a/Master/texmf-dist/tex/context/base/mkxl/meta-imp-kaktovik.mkxl b/Master/texmf-dist/tex/context/base/mkxl/meta-imp-kaktovik.mkxl new file mode 100644 index 00000000000..40e9f826c33 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/meta-imp-kaktovik.mkxl @@ -0,0 +1,251 @@ +%D \module +%D [ file=meta-imp-kaktovik, +%D version=2023.04.18, +%D title=\METAPOST\ Graphics, +%D subtitle=Kaktovik Numbers, +%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 Just a quick hack for Hraban (after a post on the mailing list). + +\startMPcalculation{simplefun} + + path kaktovik_glyphs[] ; + + def InitializeKaktovik = + + save p, d, u ; + + pair p[] ; numeric d ; d := .1 ; numeric u ; u := .15 ; + + % d := getparameterdefault "mpsfont" "d" .10 ; + % u := getparameterdefault "mpsfont" "u" .15 ; + + p[0] := (0,1) ; + p[1] := (1,0) ; + p[2] := (2,1 - d) ; + p[3] := (3,0) ; + p[4] := (4,1 - 2d) ; + + p[5] := (4,1 + u) ; + p[6] := (0,1 + 2u) ; + p[7] := (4,1 + 4u) ; + + kaktovik_glyphs[0] := (1,1) { right } .. { left } (2,1/2) { left } .. { right } (3,1); + + for i= 1 upto 4 : + kaktovik_glyphs[i] := p[0] for j=1 upto i : -- p[j] endfor ; + endfor ; + + kaktovik_glyphs[ 5] := p[5] -- p[0] ; for i= 6 upto 9 : kaktovik_glyphs[i] := p[5] -- kaktovik_glyphs[i-5] ; endfor ; + kaktovik_glyphs[10] := p[6] -- kaktovik_glyphs[ 5] ; for i=11 upto 14 : kaktovik_glyphs[i] := p[6] -- kaktovik_glyphs[i-5] ; endfor ; + kaktovik_glyphs[15] := p[7] -- kaktovik_glyphs[10] ; for i=16 upto 19 : kaktovik_glyphs[i] := p[7] -- kaktovik_glyphs[i-5] ; endfor ; + + enddef ; + + vardef Kaktovik(expr i) = + draw image ( + draw kaktovik_glyphs[i] + xscaled (10/20 -1/20) + yscaled (25/20 -2/20) + withpen (pencircle xscaled 1/20 yscaled 5/20) rotated -(2*20) + % withpen (pencircle xscaled 1/40 yscaled 5/40) rotated -(2*20) + % withpen (pencircle xscaled 2.5/40 yscaled 5/40) rotated -(2*20) + ; + ) shifted (2/20,2/20) + enddef ; + + lmt_registerglyphs [ + name = "kaktovik", + units = 2, + usecolor = true, + width = 2, + height = 2, + depth = 0, + preamble = "InitializeKaktovik" + ] ; + + for i=0 upto 19 : + lmt_registerglyph [ + category = "kaktovik", + unicode = 119488 + i, % "0x1D2C0" + code = "Kaktovik(" & decimal i & ")" + ] ; + endfor ; + +\stopMPcalculation + +\startluacode + local kaktovik = moduledata.kaktovik or { } + moduledata.kaktovik = kaktovik + + local tonumber = tonumber + local load = load + local reverse = table.reverse + local utfchar = utf.char + local gsub = string.gsub + local concat = table.concat + local utfvalues = string.utfvalues + local lpegmatch = lpeg.match + + function kaktovik.tointeger(s) + local n = 0 + for b in utfvalues(s) do + local k = b - 0x1D2C0 + n = n * 20 + k + end + return n + end + +-- function kaktovik.tostring(n) +-- local digits = { } +-- local count = 1 +-- while true do +-- digits[count] = utfchar(0x1D2C0 + (n % 20)) +-- n = n // 20 +-- if n == 0 then +-- break; +-- end +-- count = count + 1 +-- end +-- return concat(reverse(digits)) +-- end + + local f = string.formatters["%N"] + + function kaktovik.tostring(n) + if n >= 0 and n <= 19 then + return utfchar(0x1D2C0 + n) + else + -- no need to optimize + local result = gsub(f(n),"(%d+)",function(s) + local digits = { } + local count = 1 + local n = tonumber(s) + while true do + digits[count] = utfchar(0x1D2C0 + (n % 20)) + n = n // 20 + if n == 0 then + break; + end + count = count + 1 + end + return concat(reverse(digits)) + end) + return result + end + end + + do + + local k = { } + local n = 0 + for i=0x1D2C0,0x1D2C0+19 do + k[utf.char(i)] = n + n = n + 1 + end + + local p = lpeg.Cs ( + lpeg.Cc("return ") + * ( + lpeg.utfchartabletopattern(k) / k + + lpeg.P(1) + )^0 + ) + + local t = setmetatable({ },{ __index = math }) + + function kaktovik.calculate(old) + local new = lpegmatch(p,old) + if new then + new = load(new,nil,nil,t) + if type(new) == "function" then + new = new() + if new then + return new + end + end + end + return old + end + + end + + interfaces.implement { + name = "kaktoviknumerals", + arguments = "integer", + actions = { kaktovik.tostring, context } + } + interfaces.implement { + name = "kaktovikcalculate", + public = true, + arguments = "string", + actions = { kaktovik.calculate, kaktovik.tostring, context } + } +\stopluacode + +\unprotect + +\permanent\def\kaktoviknumerals#1{\clf_kaktoviknumerals\numexpr#1\relax} + +\defineconversion [kaktoviknumerals] [\kaktoviknumerals] +\defineconversion [K] [\kaktoviknumerals] + +\definefontfeature + [kaktovik] + [metapost=kaktovik] + +\protect + +\continueifinputfile{meta-imp-kaktovik.mkxl} + +\definefontfeature + [default] + [default] + [metapost=kaktovik] +% [metapost={category=kaktovik,u=.25,d=.20,x=}] + +\setupbodyfont[dejavu] + +% \nopdfcompression + +\startTEXpage[offset=1ts,width=3es] + + \start + \showglyphs + KAKTOVIK + \dostepwiserecurse{0}{19}{1}{\kaktoviknumerals{#1}\space } + \stop + + kaktovik \start + \red\glyphxscale 700 + \dostepwiserecurse{0}{19}{1}{\kaktoviknumerals{#1}\space } + \stop + + \startitemize[packed,K][color=orange,stopper=] + \startitem first \stopitem + \startitem second \stopitem + \startitem third \stopitem + \stopitemize + + KAKTOVIK \start + \red \kaktoviknumerals{2023} -- + \green\kaktoviknumerals{4} -- + \blue \kaktoviknumerals{18} + \stop + + KAKTOVIK + + 𝋂 + 𝋂 = \kaktovikcalculate{𝋂 + 𝋂} = \kaktoviknumerals{4} + + \protected\def\ForWilli#1{#1 = \kaktovikcalculate{#1}} + + \ForWilli{(𝋂 + 𝋂) ^ (𝋂 + 𝋂)} + + \ForWilli{(sin ( 𝋂𝋓 ) )} +\stopTEXpage diff --git a/Master/texmf-dist/tex/context/base/mkxl/meta-imp-newmath.mkxl b/Master/texmf-dist/tex/context/base/mkxl/meta-imp-newmath.mkxl new file mode 100644 index 00000000000..af49f82ac61 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/meta-imp-newmath.mkxl @@ -0,0 +1,76 @@ +%D \module +%D [ file=meta-imp-newmath, +%D version=2023.04.01, +%D title=\METAPOST\ Graphics, +%D subtitle=New Math Symbols, +%D author=Mikael Sundqvist & 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 In this file we will collect solutions for special math symbols. When such symbols +%D are used in publications the CMS will contact the Unicode Consortium to suggest that +%D they get a slot, because then we have proof of usage. We also consider old obsolete +%D symbols because they can be treated like some ancient out|-|of|-|use script and fit +%D into the \type {ancient math script}. + +\startMPextensions + vardef math_ornament_hat(expr w,h,d,o,l) = + image ( path p ; p := + (w/2,h + 10l) -- + (o + w,h + o) -- + (w/2,h + 7l) -- + (-o,h + o) -- + cycle ; + fill p randomized o ; + setbounds currentpicture to (-o,0) -- (w+o,0) -- (w+o,h+2o) -- (-o,h+2o) -- cycle ; + ) + enddef ; +\stopMPextensions + +\startuniqueMPgraphic{math:ornament:hat} + draw + math_ornament_hat( + OverlayWidth, + OverlayHeight, + OverlayDepth, + OverlayOffset, + OverlayLineWidth + ) + withpen + pencircle + xscaled (2OverlayLineWidth) + yscaled (3OverlayLineWidth/4) + rotated 30 + withcolor + OverlayLineColor ; +% draw boundingbox currentpicture; +\stopuniqueMPgraphic + +\definemathornament [widerandomhat] [mp=math:ornament:hat] + +\continueifinputfile{meta-imp-newnmath.mkxl} + +\starttext + +This symbol was designed for one of Mikaels students working on a thesis on +probability. This student needed to typeset the characteristic function of a +random variable \im {X} with density function \im {f_{X}}, and it was insisted to +use another notation than the (wide) hat, that was already used for something +else. For this reason the \tex {widerandomhat} was introduced, + +\startformula + E[\ee^{\ii tX}] = \widerandomhat{f_{X}}(t)\mtp{,} + E[\ee^{\ii t(X_1+X_2)}] = \widerandomhat{f_{X_1} \ast f_{X_2}}(t)\mtp{.} +\stopformula + +Naturally, it is automatically scaled, just like the ordinary wide hat + +\startformula + \widehat{a+b+c+d+e+f} \neq \widerandomhat{a+b+c+d+e+f} +\stopformula + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/mkxl/meta-imp-threesix.mkxl b/Master/texmf-dist/tex/context/base/mkxl/meta-imp-threesix.mkxl index 56a400b45c0..872d0b3e889 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/meta-imp-threesix.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/meta-imp-threesix.mkxl @@ -56,6 +56,15 @@ ["X"] = [[1111001110 1111000110 0001101000 0000110000 0000110000 0001011000 0110001111 0111001111]], ["Y"] = [[111100011 111100011 011000010 001110100 000111000 000011000 001111110 001111110]], ["Z"] = [[11111111 10000111 00001110 00011100 00111000 01110000 11100001 11111111]], + + [","] = [[0000 0000 0000 0000 0000 0011 0111 0111]], + [";"] = [[0011 0011 0011 0000 0000 0011 0111 0111]], + ["."] = [[0000 0000 0000 0000 0000 0111 0111 0111]], + [":"] = [[0111 0111 0111 0000 0000 0111 0111 0111]], + ["!"] = [[0111 0111 0111 0111 0111 0000 0111 0111]], + ["?"] = [[11111 10111 00111 01110 01110 00000 01110 01110]], + + [utf.char(0xAD)] = [[00000 00000 00000 11111 11111 00000 00000 00000]], -- hyphen } local f_code = string.formatters["ThreeSix(%s);"] @@ -206,41 +215,24 @@ [metapost={category=fontthreesix,shape=diamond,color=random,pen=fancy,spread=.1,random=yes}] \definefont[DEKFontA][Serif*fontthreesix-color @ 200pt] -\definefont[DEKFontB][Serif*fontthreesix-color @ 60pt] +\definefont[DEKFontB][Serif*fontthreesix-color @ 12pt] % Or course: -\startTEXpage +\startTEXpage[offset=1dk] \DEKFontA TEX \stopTEXpage -\startTEXpage +\startTEXpage[offset=1dk] \DEKFontA T\kern-0.05em\lower.75\exheight\hbox{E}\kern-.05emX \stopTEXpage -% One of the \CONTEXT\ 2020 posters (inspired by NewYork State AC's press -% conferences as these keywords apply quite well to the audience of the -% meeting): - -% \startTEXpage[align={lohi,middle,nothyphenated},offset=20pt] -% \offinterlineskip \vskip10pt -% \DEKFontA T\kern-0.05em\lower.75\exheight\hbox{E}\kern-.05emX \vskip60pt -% \DEKFontB TOUGH \vskip20pt -% SMART \vskip20pt -% UNITED \vskip20pt -% DISCIPLINED \vskip20pt -% LOVING \vskip10pt -% \stopTEXpage - -\startpagemakeup - \setupalign[middle,nothyphenated] - \offinterlineskip \vfil\vfil - \DEKFontA T\kern-0.05em\lower.75\exheight\hbox{E}\kern-.05emX \vfil\vfil\vfil - \DEKFontB TOUGH \vfil - SMART \vfil - UNITED \vfil - DISCIPLINED \vfil - LOVING \vfil -\stoppagemakeup +% We only have uppercase characters! But I added a few punctuation symbols so that +% we can do the following. Actually we can consider lowercase to be just smaller and +% another shape. + +\startTEXpage[offset=1dk,align=flushleft,foregroundstyle=\DEKFontB] + \WORD{\input{knuth}} +\stopTEXpage \stoptext diff --git a/Master/texmf-dist/tex/context/base/mkxl/meta-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/meta-ini.mkxl index 16b97e8cc40..c5d86e2af21 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/meta-ini.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/meta-ini.mkxl @@ -211,6 +211,7 @@ \defineMPinstance[doublefun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes,\c!method=\s!double] \defineMPinstance[binaryfun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes,\c!method=\s!binary] \defineMPinstance[decimalfun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes,\c!method=\s!decimal] +\defineMPinstance[positfun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes,\c!method=\s!posit] \defineMPinstance[mprun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes] diff --git a/Master/texmf-dist/tex/context/base/mkxl/mlib-run.lmt b/Master/texmf-dist/tex/context/base/mkxl/mlib-run.lmt index 0e955818e19..dc71eefab39 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/mlib-run.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/mlib-run.lmt @@ -6,28 +6,16 @@ if not modules then modules = { } end modules ['mlib-run'] = { license = "see context related readme files", } --- cmyk -> done, native --- spot -> done, but needs reworking (simpler) --- multitone -> --- shade -> partly done, todo: cm --- figure -> done --- hyperlink -> low priority, easy - --- new * run --- or --- new * execute^1 * finish - --- a*[b,c] == b + a * (c-b) - ---[[ldx-- -<p>The directional helpers and pen analysis are more or less translated from the -<l n='c'/> code. It really helps that Taco know that source so well. Taco and I spent -quite some time on speeding up the <l n='lua'/> and <l n='c'/> code. There is not -much to gain, especially if one keeps in mind that when integrated in <l n='tex'/> -only a part of the time is spent in <l n='metapost'/>. Of course an integrated -approach is way faster than an external <l n='metapost'/> and processing time -nears zero.</p> ---ldx]]-- +-- The directional helpers and pen analysis are more or less translated from the C +-- code. In LuaTeX we spent quite some time on speeding up the Lua interface as well +-- as the C code. There is not much to gain, especially if one keeps in mind that +-- when integrated in TeX only a part of the time is spent in MetaPost. Of course an +-- integrated approach is way faster than an external MetaPost and processing time +-- nears zero. +-- +-- In LuaMetaTeX the MetaPost core has been cleaned up a it and as a result +-- processing in double mode is now faster than in scaled mode. There are also extra +-- features and interfaces, so the MkIV and MkXL (LMTX) implementation differ! local type, tostring, tonumber, next = type, tostring, tonumber, next local find, striplines = string.find, utilities.strings.striplines @@ -164,6 +152,7 @@ local methods = { -- binary = "binary", binary = "double", decimal = "decimal", + posit = "posit", default = "scaled", } diff --git a/Master/texmf-dist/tex/context/base/mkxl/mult-sys.mkxl b/Master/texmf-dist/tex/context/base/mkxl/mult-sys.mkxl index 428a8ddcf03..b0df8703b98 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/mult-sys.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/mult-sys.mkxl @@ -114,6 +114,7 @@ %D For proper \UNICODE\ support we need a few font related constants. +\definesystemconstant {accent} \definesystemconstant {action} \definesystemconstant {all} \definesystemconstant {ampersand} @@ -164,6 +165,7 @@ \definesystemconstant {leftclass} \definesystemconstant {rightclass} \definesystemconstant {calligraphic} +\definesystemconstant {center} \definesystemconstant {clone} \definesystemconstant {close} \definesystemconstant {cmyk} @@ -255,6 +257,7 @@ \definesystemconstant {italic} %definesystemconstant {it} \definesystemconstant {itemgroupcolumns} +\definesystemconstant {keepbase} \definesystemconstant {kernpairs} \definesystemconstant {language} \definesystemconstant {lcgreek} @@ -310,6 +313,7 @@ \definesystemconstant {noheight} \definesystemconstant {nomath} \definesystemconstant {none} +\definesystemconstant {nooverflow} \definesystemconstant {noskips} \definesystemconstant {normal} \definesystemconstant {Normal} @@ -331,6 +335,7 @@ \definesystemconstant {pickup} \definesystemconstant {plural} \definesystemconstant {plus} +\definesystemconstant {posit} %definesystemconstant {pt} \definesystemconstant {realpage} \definesystemconstant {register} @@ -373,6 +378,7 @@ \definesystemconstant {setup} \definesystemconstant {set} \definesystemconstant {themaintextcolor} +\definesystemconstant {shrink} \definesystemconstant {simple} \definesystemconstant {Simple} \definesystemconstant {single} @@ -393,6 +399,7 @@ \definesystemconstant {ss} \definesystemconstant {start} \definesystemconstant {stop} +\definesystemconstant {stretch} \definesystemconstant {subpage} \definesystemconstant {subtype} \definesystemconstant {sub} diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-ali.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-ali.lmt index ba2ccdde7d6..5eff779dc24 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/node-ali.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/node-ali.lmt @@ -21,7 +21,6 @@ local setnext = nuts.setnext local getnext = nuts.getnext local getprev = nuts.getprev local getboth = nuts.getboth -local setglue = nuts.setglue local getglue = nuts.getglue local setglue = nuts.setglue local getwhd = nuts.getwhd @@ -372,6 +371,7 @@ do if noflines > 0 then local currentline = 1 for n, subtype in nextglue, head do +-- print(currentline,height/65536,depth/65536) -- one day we can decide what to do with intertext stuff based on the -- subtype but not now ... on our agenda (intertext etc) if subtype == baselineskip_code or subtype == lineskip_code then @@ -383,9 +383,11 @@ do if prevdp < depth then setdepth(lines[currentline][1],depth) delta = delta + (depth - prevdp) +-- lines[currentline][5] = depth end if nextht < height then setheight(lines[nextline][1],height) +-- lines[nextline][4] = height delta = delta + (height - nextht) end -- if subtype == lineskip_code then @@ -394,7 +396,7 @@ do -- else setglue(n,amount+inbetween-delta,stretch,shrink) -- end - curline = nextline + currentline = nextline -- was curline -- if currentline > noflines then -- break -- end diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-dir.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-dir.lmt index 246bf34e40b..5692fddb720 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/node-dir.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/node-dir.lmt @@ -14,7 +14,8 @@ local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist local normaldir_code = nodes.dircodes.normal local line_code = nodes.listcodes.line -local lefttoright_code = nodes.dirvalues.lefttoright + +local lefttoright_code = tex.directioncodes.lefttoright local getnext = nuts.getnext local getlist = nuts.getlist diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-ini.lmt index f1b9bb45299..435f3bf7e17 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/node-ini.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/node-ini.lmt @@ -6,19 +6,13 @@ if not modules then modules = { } end modules ['node-ini'] = { license = "see context related readme files" } ---[[ldx-- -<p>Most of the code that had accumulated here is now separated in modules.</p> ---ldx]]-- - local next, type, tostring = next, type, tostring local gsub = string.gsub local concat, remove = table.concat, table.remove local sortedhash, sortedkeys, swapped = table.sortedhash, table.sortedkeys, table.swapped ---[[ldx-- -<p>Access to nodes is what gives <l n='luatex'/> its power. Here we implement a -few helper functions. These functions are rather optimized.</p> ---ldx]]-- +-- Access to nodes is what gives LuaTeX its power. Here we implement a few helper +-- functions. These functions are rather optimized. nodes = nodes or { } local nodes = nodes @@ -29,7 +23,7 @@ local allocate = utilities.storage.allocate local formatcolumns = utilities.formatters.formatcolumns local getsubtypes = node.subtypes -local getvalues = node.values +----- getvalues = node.values local listcodes = mark(getsubtypes("list")) local rulecodes = mark(getsubtypes("rule")) @@ -51,10 +45,6 @@ local choicecodes = mark(getsubtypes("choice")) local parcodes = mark(getsubtypes("par")) local attributecodes = mark(getsubtypes("attribute")) -local fillvalues = mark(getvalues("fill")) -local dirvalues = mark(getvalues("dir")) -local mathvalues = mark(getvalues("math")) - local function simplified(t) local r = { } for k, v in next, t do @@ -63,17 +53,17 @@ local function simplified(t) return r end -local noadoptions = allocate { - set = 0x08, - unused_1 = 0x00 + 0x08, - unused_2 = 0x01 + 0x08, - axis = 0x02 + 0x08, - no_axis = 0x04 + 0x08, - exact = 0x10 + 0x08, - left = 0x11 + 0x08, - middle = 0x12 + 0x08, - right = 0x14 + 0x08, -} +-- local noadoptions = allocate { +-- set = 0x08, +-- unused_1 = 0x00 + 0x08, +-- unused_2 = 0x01 + 0x08, +-- axis = 0x02 + 0x08, +-- no_axis = 0x04 + 0x08, +-- exact = 0x10 + 0x08, +-- left = 0x11 + 0x08, +-- middle = 0x12 + 0x08, +-- right = 0x14 + 0x08, +-- } local nodecodes = simplified(node.types()) @@ -96,11 +86,6 @@ choicecodes = allocate(swapped(choicecodes,choicecodes)) parcodes = allocate(swapped(parcodes,parcodes)) attributecodes = allocate(swapped(attributecodes,attributecodes)) rulecodes = allocate(swapped(rulecodes,rulecodes)) -noadoptions = allocate(swapped(noadoptions,noadoptions)) - -dirvalues = allocate(swapped(dirvalues,dirvalues)) -fillvalues = allocate(swapped(fillvalues,fillvalues)) -mathvalues = allocate(swapped(mathvalues,mathvalues)) nodes.gluecodes = gluecodes nodes.dircodes = dircodes @@ -121,24 +106,26 @@ nodes.parcodes = parcodes nodes.attributecodes = attributecodes nodes.rulecodes = rulecodes -nodes.noadoptions = noadoptions -nodes.fillvalues = fillvalues -nodes.fillcodes = fillvalues -- for now -nodes.dirvalues = dirvalues -nodes.mathvalues = mathvalues +nodes.nodecodes = nodecodes -nodes.nodecodes = nodecodes +-- these are now in tex namespace but we keep them for old times sake + +nodes.fillvalues = tex.fillcodes +nodes.fillcodes = tex.fillcodes +nodes.dirvalues = tex.directioncodes +nodes.directionvalues = tex.directioncodes +nodes.mathvalues = tex.mathparametercodes -- we will transition to more verbose subtypes (after other math is done) -noadcodes.ord = noadcodes.ord or noadcodes.ordinary -noadcodes.operator = noadcodes.op or noadcodes.operator -noadcodes.bin = noadcodes.bin or noadcodes.binary -noadcodes.rel = noadcodes.rel or noadcodes.relation -noadcodes.punct = noadcodes.punct or noadcodes.punctuation -noadcodes.rad = noadcodes.rad or noadcodes.radical -noadcodes.frac = noadcodes.frac or noadcodes.fraction -noadcodes.acc = noadcodes.acc or noadcodes.accent +noadcodes.ord = noadcodes.ord or noadcodes.ordinary +noadcodes.operator = noadcodes.op or noadcodes.operator +noadcodes.bin = noadcodes.bin or noadcodes.binary +noadcodes.rel = noadcodes.rel or noadcodes.relation +noadcodes.punct = noadcodes.punct or noadcodes.punctuation +noadcodes.rad = noadcodes.rad or noadcodes.radical +noadcodes.frac = noadcodes.frac or noadcodes.fraction +noadcodes.acc = noadcodes.acc or noadcodes.accent -- so for now: @@ -194,8 +181,6 @@ nodes.skipcodes = gluecodes nodes.directioncodes = dircodes nodes.discretionarycodes = disccodes -nodes.directionvalues = dirvalues - glyphcodes.glyph = glyphcodes.character gluecodes.parfillrightskip = gluecodes.parfillrightskip or gluecodes.parfillskip @@ -207,18 +192,6 @@ listcodes.column = listcodes.alignment kerncodes.kerning = kerncodes.fontkern kerncodes.italiccorrection = kerncodes.italiccorrection or 1 -- new -nodes.noadoptions = { - set = 0x08, - unused_1 = 0x00 + 0x08, - unused_2 = 0x01 + 0x08, - axis = 0x02 + 0x08, - no_axis = 0x04 + 0x08, - exact = 0x10 + 0x08, - left = 0x11 + 0x08, - middle = 0x12 + 0x08, - right = 0x14 + 0x08, -} - -- We use the real node code numbers. local texsetintegervalue = tex.setintegervalue diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-pag.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-pag.lmt new file mode 100644 index 00000000000..42b79695c0a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/node-pag.lmt @@ -0,0 +1,32 @@ +if not modules then modules = { } end modules ['node-pag'] = { + version = 1.001, + comment = "companion to node-pag.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- Currently we have no usage for this and it can even be dangerous to mess with +-- the list at this stage, so this is effectively just a placeholder. Users can +-- only mess with before and after hooks. + +pagebuilders = pagebuilders or { } + +local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming + +local actions = nodes.tasks.actions("pagebuilders") + +local function processor(head,groupcode,size,packtype,maxdepth,direction) + if head then + starttiming(pagebuilders) + head = actions(head,groupcode,size,packtype,maxdepth,direction) + stoptiming(pagebuilders) + end + return head +end + +callbacks.register("pre_output_filter",processor,"preparing output box") + +statistics.register("output preparation time", function() + return statistics.elapsedseconds(pagebuilders) +end) diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-pag.mkxl b/Master/texmf-dist/tex/context/base/mkxl/node-pag.mkxl new file mode 100644 index 00000000000..970939dcf76 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/node-pag.mkxl @@ -0,0 +1,20 @@ +%D \module +%D [ file=node-pag, +%D version=2008.09.30, +%D title=\CONTEXT\ Node Macros, +%D subtitle=Page Building, +%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. + +\writestatus{loading}{ConTeXt Node Macros / Page Building} + +\unprotect + +\registerctxluafile{node-pag}{} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-ref.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-ref.lmt index 15c35cba992..18bda16e987 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/node-ref.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/node-ref.lmt @@ -96,9 +96,9 @@ local nodecodes = nodes.nodecodes local gluecodes = nodes.gluecodes local listcodes = nodes.listcodes -local dirvalues = nodes.dirvalues -local lefttoright_code = dirvalues.lefttoright -local righttoleft_code = dirvalues.righttoleft +local directioncodes = tex.directioncodes +local lefttoright_code = directioncodes.lefttoright +local righttoleft_code = directioncodes.righttoleft local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist @@ -689,7 +689,8 @@ do local function setdestination(n,h,d,name,view) -- n = grouplevel, name == table topofstack = topofstack + 1 - stack[topofstack] = { n, h, d, name, view } + -- stack[topofstack] = { n, h, d, name, view } + stack[topofstack] = { n, h or false, d or false, name, view } return topofstack end diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-res.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-res.lmt index 6fed08b6393..b514a3568bf 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/node-res.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/node-res.lmt @@ -10,11 +10,6 @@ local type, next, rawset = type, next, rawset local gmatch, format = string.gmatch, string.format local round = math.round ---[[ldx-- -<p>The next function is not that much needed but in <l n='context'/> we use -for debugging <l n='luatex'/> node management.</p> ---ldx]]-- - local nodes, node = nodes, node local report_nodes = logs.reporter("nodes","housekeeping") @@ -179,7 +174,7 @@ local cleader = register_nut(copy_nut(glue)) setsubtype(cleader,glueco -- the dir field needs to be set otherwise crash: -local lefttoright_code = nodes.dirvalues.lefttoright +local lefttoright_code = tex.directioncodes.lefttoright local rule = register_nut(new_nut(rule_code)) -- setdirection(rule, lefttoright_code) local emptyrule = register_nut(new_nut(rule_code,rulecodes.empty)) -- setdirection(rule, lefttoright_code) diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-tra.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-tra.lmt index 1ef1bb8ad78..4aa476ce540 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/node-tra.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/node-tra.lmt @@ -6,10 +6,8 @@ if not modules then modules = { } end modules ['node-tra'] = { license = "see context related readme files" } ---[[ldx-- -<p>This is rather experimental. We need more control and some of this -might become a runtime module instead. This module will be cleaned up!</p> ---ldx]]-- +-- Some of the code here might become a runtime module instead. This old module will +-- be cleaned up anyway! local next = next local utfchar = utf.char @@ -67,7 +65,7 @@ local new_rule = nutpool.rule local nodecodes = nodes.nodecodes local whatsitcodes = nodes.whatsitcodes -local fillcodes = nodes.fillcodes +local fillcodes = tex.fillcodes local subtypes = nodes.subtypes diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-tsk.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-tsk.lmt index c4871b56808..edc435836ce 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/node-tsk.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/node-tsk.lmt @@ -1016,6 +1016,56 @@ nonut = [[ -- } -- } +tasks.new { + name = "pagebuilders", + processor = nodeprocessor, + sequence = { + "before", -- for users + "normalizers", + "after", -- for users + }, + templates = { + +default = [[ +return function(head) + return head +end +]], + +process = [[ +local tonut = nodes.tonut +local tonode = nodes.nuts.tonode + +%localize% + +return function(head,groupcode,size,packtype,maxdepth,direction) + local nuthead = tonut(head) + +%actions% + return tonode(nuthead) +end +]], + +step = [[ + nuthead = tonut((%action%(tonode(nuthead),groupcode,size,packtype,maxdepth,direction))) +]], + +nut = [[ + nuthead = %action%(nuthead,groupcode,size,packtype,maxdepth,direction) +]], + +nohead = [[ + %action%(tonode(nuthead),groupcode,size,packtype,maxdepth,direction) +]], + +nonut = [[ + %action%(nuthead,groupcode,size,packtype,maxdepth,direction) +]], + + } + +} + -- for now quite useless (too fuzzy) -- -- tasks.new { @@ -1135,3 +1185,106 @@ nonut = [[ } } + +-- -- quality -- -- + +tasks.new { + name = "hquality", + processor = nodeprocessor, + sequence = { + "before", -- for users + "system", + "after", -- for users + }, + templates = { + +default = [[ +return function(how,detail,nod,first,last,filename) + -- nil +end +]], + +process = [[ +local tonut = nodes.tonut +local tonode = nodes.nuts.tonode + +%localize% + +return function(how,detail,nod,first,last,filename) + local nut = tonut(nod) + local rul = nil + +%actions% + + return rul and tonode(rul) +end +]], + +step = [[ + rul = tonut((%action%(how,detail,nod,first,last,filename,rul and tonode(rul)))) +]], + +nut = [[ + rul = %action%(how,detail,nut,first,last,filename,rul) +]], + +nohead = [[ + %action%(how,detail,nod,first,last,filename,rul and tonode(rul)) +]], + +nonut = [[ + %action%(how,detail,nut,first,last,filename,rul) +]], + + } +} + +tasks.new { + name = "vquality", + processor = nodeprocessor, + sequence = { + "before", -- for users + "system", + "after", -- for users + }, + templates = { + +default = [[ +return function(how,detail,nod,first,last,filename) + -- nil +end +]], + +process = [[ +local tonut = nodes.tonut +local tonode = nodes.nuts.tonode + +%localize% + +return function(how,detail,nod,first,last,filename) + local nut = tonut(nod) + local rul = nil + +%actions% + return rul and tonode(rul) +end +]], + +step = [[ + rul = tonut((%action%(how,detail,nod,first,last,filename,tonode(rul)))) +]], + +nut = [[ + rul = %action%(how,detail,nut,first,last,filename,rul) +]], + +nohead = [[ + %action%(how,detail,nod,first,last,filename,rul and tonode(rul)) +]], + +nonut = [[ + %action%(how,detail,nut,first,last,filename,rul) +]], + + } +} diff --git a/Master/texmf-dist/tex/context/base/mkxl/pack-box.mkxl b/Master/texmf-dist/tex/context/base/mkxl/pack-box.mkxl index 5a66d394598..ea270f88b79 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/pack-box.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/pack-box.mkxl @@ -1165,6 +1165,8 @@ \fi \endgroup} +\mutable\lettonothing\currentanchorbox + \permanent\tolerant\protected\def\setanchorbox[#1]#*[#2]% {\begingroup \dowithnextbox diff --git a/Master/texmf-dist/tex/context/base/mkxl/pack-com.mkxl b/Master/texmf-dist/tex/context/base/mkxl/pack-com.mkxl index 0fff4ca1bbf..e07e0ff8ddd 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/pack-com.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/pack-com.mkxl @@ -501,17 +501,24 @@ \def\pack_combinations_caption_second {\ifx\nexttoken\egroup % the caption is empty - \orelse\ifx\nexttoken\stopcaption + \orelse\ifx\nexttoken\stopcaption % language % the caption is empty (new per 2014-05-24) + \orelse\ifx\nexttoken\pack_combinations_float_hack_b + % make sure we honor empty captions (new per 2023-04-20) \else % todo: \p_pack_combinations_alternative\v!none: no style, strut etc \hsize\wd\b_pack_combinations_content \usealignparameter\combinationparameter \usecombinationstyleandcolor\c!style\c!color \bgroup - \aftergroup\endstrut - \aftergroup\egroup - \begstrut + \ifcstok{\combinationparameter\c!strut}\v!no + % make sure we have empty captions (new per 2023-04-20) + \aftergroup\egroup + \else + \aftergroup\endstrut + \aftergroup\egroup + \begstrut + \fi \fi} \def\pack_combinations_pickup_package_pair % we need to store the caption row @@ -624,6 +631,10 @@ %D %D \typebuffer \getbuffer +\definecombination + [\v!float] +% [\c!strut=\v!no] % not needed, we intercept anyway + \protected\def\pack_combinations_float_hack_a#1% {\strc_floats_build_box_separate_split{#1}% \box\b_strc_floats_separate_content} @@ -657,7 +668,8 @@ {\pack_combinations_float_hack_b{\recurselevel}}% \to\scratchtoks}% brrr \let\pack_combinations_check_x_y\pack_combinations_float_check_x_y - \normalexpanded{\startcombination[#1]\the\scratchtoks}\stopcombination + % \normalexpanded{\startcombination[#1]\the\scratchtoks}\stopcombination + \normalexpanded{\startcombination[\v!float][#1]\the\scratchtoks}\stopcombination \resetlocalfloats \egroup} diff --git a/Master/texmf-dist/tex/context/base/mkxl/pack-lyr.mkxl b/Master/texmf-dist/tex/context/base/mkxl/pack-lyr.mkxl index b93d3296079..cc4a7381f23 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/pack-lyr.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/pack-lyr.mkxl @@ -97,35 +97,35 @@ \permanent\def\layeranchor{\currentlayer:\the\realpageno} +\lettonothing\m_pack_layers_anchor +\lettonothing\m_pack_layers_page +\lettonothing\m_pack_layers_region +\lettonothing\m_pack_layers_target +\lettonothing\p_pack_layers_column +\lettonothing\p_pack_layers_corner +\lettonothing\p_pack_layers_direction \lettonothing\p_pack_layers_doublesided -\lettonothing\p_pack_layers_state -\lettonothing\p_pack_layers_option +\lettonothing\p_pack_layers_dx +\lettonothing\p_pack_layers_dy +\lettonothing\p_pack_layers_height +\lettonothing\p_pack_layers_hoffset +\lettonothing\p_pack_layers_line +\lettonothing\p_pack_layers_location \lettonothing\p_pack_layers_method +\lettonothing\p_pack_layers_offset +\lettonothing\p_pack_layers_option +\lettonothing\p_pack_layers_position \lettonothing\p_pack_layers_preset +\lettonothing\p_pack_layers_region +\lettonothing\p_pack_layers_repeat \lettonothing\p_pack_layers_rotation -\lettonothing\p_pack_layers_position -\lettonothing\p_pack_layers_hoffset -\lettonothing\p_pack_layers_voffset -\lettonothing\p_pack_layers_offset -\lettonothing\p_pack_layers_dx -\lettonothing\p_pack_layers_dy +\lettonothing\p_pack_layers_state \lettonothing\p_pack_layers_sx \lettonothing\p_pack_layers_sy +\lettonothing\p_pack_layers_voffset +\lettonothing\p_pack_layers_width \lettonothing\p_pack_layers_x \lettonothing\p_pack_layers_y -\lettonothing\p_pack_layers_corner -\lettonothing\p_pack_layers_location -\lettonothing\p_pack_layers_line -\lettonothing\p_pack_layers_column -\lettonothing\p_pack_layers_width -\lettonothing\p_pack_layers_height -\lettonothing\p_pack_layers_direction -\lettonothing\p_pack_layers_region - -\lettonothing\m_pack_layers_page -\lettonothing\m_pack_layers_target -\lettonothing\m_pack_layers_region -\lettonothing\m_pack_layers_anchor \newconditional\c_pack_layers_repeated \newconditional\c_pack_layers_trace diff --git a/Master/texmf-dist/tex/context/base/mkxl/pack-obj.lmt b/Master/texmf-dist/tex/context/base/mkxl/pack-obj.lmt index 1e22515b95b..a18f5e7e739 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/pack-obj.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/pack-obj.lmt @@ -6,10 +6,8 @@ if not modules then modules = { } end modules ['pack-obj'] = { license = "see context related readme files" } ---[[ldx-- -<p>We save object references in the main utility table. jobobjects are -reusable components.</p> ---ldx]]-- +-- We save object references in the main utility table; job objects are reusable +-- components. local context = context local codeinjections = backends.codeinjections diff --git a/Master/texmf-dist/tex/context/base/mkxl/pack-rul.lmt b/Master/texmf-dist/tex/context/base/mkxl/pack-rul.lmt index 12d131c8873..62a90490137 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/pack-rul.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/pack-rul.lmt @@ -7,10 +7,6 @@ if not modules then modules = { } end modules ['pack-rul'] = { license = "see context related readme files" } ---[[ldx-- -<p>An explanation is given in the history document <t>mk</t>.</p> ---ldx]]-- - -- we need to be careful with display math as it uses shifts -- \framed[align={lohi,middle}]{$x$} diff --git a/Master/texmf-dist/tex/context/base/mkxl/pack-rul.mkxl b/Master/texmf-dist/tex/context/base/mkxl/pack-rul.mkxl index 36b4fc7b0c0..1daa8bcf7e1 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/pack-rul.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/pack-rul.mkxl @@ -237,30 +237,34 @@ %newdimen \d_framed_linewidth \aliased\let \ruledlinewidth\d_framed_linewidth % needed at lua end \newdimension\d_framed_linewidth \aliasdimension\ruledlinewidth\d_framed_linewidth % needed at lua end -\lettonothing\p_framed_frame % \framedparameter\c!frame -\lettonothing\p_framed_backgroundoffset -\lettonothing\p_framed_foregroundstyle -\lettonothing\p_framed_autostrut -\lettonothing\p_framed_location -\lettonothing\p_framed_orientation +\lettonothing\p_frame +\lettonothing\p_framed_adaptive \lettonothing\p_framed_anchoring -\lettonothing\p_framed_synchronize +\lettonothing\p_framed_autostrut \lettonothing\p_framed_autowidth -\lettonothing\p_framed_franalyze +\lettonothing\p_framed_background +\lettonothing\p_framed_backgroundcolor \lettonothing\p_framed_backgroundcorner +\lettonothing\p_framed_backgroundoffset \lettonothing\p_framed_backgroundradius +\lettonothing\p_framed_component +\lettonothing\p_framed_empty +\lettonothing\p_framed_foregroundcolor +\lettonothing\p_framed_foregroundstyle +\lettonothing\p_framed_frame % \framedparameter\c!frame +\lettonothing\p_framed_framecolor \lettonothing\p_framed_framecorner \lettonothing\p_framed_frameradius +\lettonothing\p_framed_franalyze \lettonothing\p_framed_lines -\lettonothing\p_framed_empty -\lettonothing\p_framed_backgroundcolor -\lettonothing\p_framed_framecolor -\lettonothing\p_framed_component -\lettonothing\p_framed_background +\lettonothing\p_framed_location +\lettonothing\p_framed_minheight +\lettonothing\p_framed_orientation \lettonothing\p_framed_rulethickness -\lettonothing\p_framed_foregroundcolor \lettonothing\p_framed_setups \lettonothing\p_framed_synchronize +\lettonothing\p_framed_text_depthcorrection +\lettonothing\p_framed_text_strut %D We don't have to stick to a \TEX\ drawn rule, but also can use rounded %D or even fancier shapes, as we will see later on. diff --git a/Master/texmf-dist/tex/context/base/mkxl/page-brk.mkxl b/Master/texmf-dist/tex/context/base/mkxl/page-brk.mkxl index 23ffc872d38..8c92148fca4 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/page-brk.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/page-brk.mkxl @@ -90,7 +90,7 @@ % disable reset after shipout \global\pageornamentstate\plustwo \fi - % maybe \ifcstok{#1}\emptytoks + % maybe \iftok{#1}\emptytoks \ifparameter#1\or \page_breaks_handle{#1}% \else % so, no pagebreak when \pagebreak[] ! ! ! diff --git a/Master/texmf-dist/tex/context/base/mkxl/page-flt.mkxl b/Master/texmf-dist/tex/context/base/mkxl/page-flt.mkxl index ae2bd4cf8e9..fb699626432 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/page-flt.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/page-flt.mkxl @@ -297,7 +297,31 @@ \newtoks\everybeforeflushedpagefloat -\def\page_floats_flush_page_floats_indeed#1% future releases can do more clever things +\let\m_page_otr_checked_page_float\relax + +\newconditional\c_page_floats_flushed + +% \def\page_floats_flush_page_floats_indeed#1% future releases can do more clever things +% {\page_floats_flush{#1}\plusone +% \edef\floatspecification{\clf_getfloatvariable{specification}}% Is this okay? +% \the\everybeforeflushedpagefloat +% \vpack to \textheight +% {\doifnotinset\v!high\floatspecification\vfill +% \box\floatbox +% \doifnotinset\v!low\floatspecification\vfill}% +% \page_otr_fill_and_eject_page} + +% \protected\def\page_floats_flush_page_floats % used in postpone +% {\edef\m_page_otr_checked_page_float{\clf_checkedpagefloat}% +% \ifempty\m_page_otr_checked_page_float +% % nothing +% \orelse\ifx\m_page_otr_checked_page_float\v!empty +% \emptyhbox \page_otr_fill_and_eject_page % why not dummy_page +% \else +% \page_floats_flush_page_floats_indeed\m_page_otr_checked_page_float +% \fi} + +\def\page_floats_flush_page_floats_inject#1% future releases can do more clever things {\page_floats_flush{#1}\plusone \edef\floatspecification{\clf_getfloatvariable{specification}}% Is this okay? \the\everybeforeflushedpagefloat @@ -305,18 +329,26 @@ {\doifnotinset\v!high\floatspecification\vfill \box\floatbox \doifnotinset\v!low\floatspecification\vfill}% - \page_otr_fill_and_eject_page} - -\let\m_page_otr_checked_page_float\relax + % \page_otr_fill_and_eject_page + \global\settrue\c_page_floats_flushed} \protected\def\page_floats_flush_page_floats % used in postpone + {\global\setfalse\c_page_floats_flushed + \page_floats_flush_page_floats_indeed + \ifconditional\c_page_floats_flushed + \page_otr_fill_and_eject_page + \fi} + +\protected\def\page_floats_flush_page_floats_indeed % used in postpone {\edef\m_page_otr_checked_page_float{\clf_checkedpagefloat}% \ifempty\m_page_otr_checked_page_float % nothing \orelse\ifx\m_page_otr_checked_page_float\v!empty \emptyhbox \page_otr_fill_and_eject_page % why not dummy_page + \expandafter\page_floats_flush_page_floats \else - \page_floats_flush_page_floats_indeed\m_page_otr_checked_page_float + \page_floats_flush_page_floats_inject\m_page_otr_checked_page_float + \expandafter\page_floats_flush_page_floats \fi} % temp hack, needed to prevent floatbox being forgotten during diff --git a/Master/texmf-dist/tex/context/base/mkxl/page-imp.mkxl b/Master/texmf-dist/tex/context/base/mkxl/page-imp.mkxl index 00a0430e6e3..4c192c5549a 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/page-imp.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/page-imp.mkxl @@ -1264,7 +1264,7 @@ % % \starttext \dorecurse{30}{test \recurselevel \page} \stoptext -\permanent\protected\protected\def\pusharrangedpageXY#1% +\permanent\protected\def\pusharrangedpageXY#1% {\advancearrangedpageN \global\advanceby\arrangedpageM\plusone \reportarrangedpage\arrangedpageN @@ -1300,7 +1300,7 @@ \poparrangedpages \fi} -\permanent\protected\protected\def\poparrangedpagesXY +\permanent\protected\def\poparrangedpagesXY {\ifnum\arrangedpageN>\zerocount \paperwidth \arrangedpageX\paperwidth \paperheight\arrangedpageY\paperheight diff --git a/Master/texmf-dist/tex/context/base/mkxl/page-inj.mklx b/Master/texmf-dist/tex/context/base/mkxl/page-inj.mklx index 02f853c5561..2e245fd8bd5 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/page-inj.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/page-inj.mklx @@ -32,6 +32,12 @@ \let\page_boxes_flush_before\clf_flushpageinjectionsbefore \let\page_boxes_flush_after \clf_flushpageinjectionsafter +\lettonothing\p_page_injections_delay +\lettonothing\p_page_injections_n +\lettonothing\p_page_injections_page +\lettonothing\p_page_injections_pagestate +\lettonothing\p_page_injections_state + \def\page_injections_flush_indeed {\begingroup \setbox\scratchbox\normalhpack diff --git a/Master/texmf-dist/tex/context/base/mkxl/page-mbk.mklx b/Master/texmf-dist/tex/context/base/mkxl/page-mbk.mklx index 57c23abc6e3..3dc1c4e7c95 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/page-mbk.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/page-mbk.mklx @@ -75,12 +75,16 @@ \setfalse\c_page_margin_blocks_enabled +\let\page_margin_blocks_stop_block\relax + \permanent\tolerant\protected\def\startmarginblock[#tag]% {\begingroup \edef\currentmarginblock{#tag}% - \doifelse{\marginblockparameter\c!state}\v!start - \page_margin_blocks_start_block_yes - \page_margin_blocks_start_block_nop} + \ifcstok{\marginblockparameter\c!state}\v!start + \expandafter\page_margin_blocks_start_block_yes + \else + \expandafter\page_margin_blocks_start_block_nop + \fi} \permanent\protected\def\stopmarginblock {\page_margin_blocks_stop_block diff --git a/Master/texmf-dist/tex/context/base/mkxl/phys-dim.lmt b/Master/texmf-dist/tex/context/base/mkxl/phys-dim.lmt new file mode 100644 index 00000000000..d3b6f80ba24 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/phys-dim.lmt @@ -0,0 +1,1118 @@ +if not modules then modules = { } end modules ['phys-dim'] = { + version = 1.001, + comment = "companion to phys-dim.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- This is pretty old code that I found back, but let's give it a try +-- in practice. It started out as m-units.lua but as we want to keep that +-- module around we moved the code to the dimensions module. +-- +-- todo: maybe also an sciunit command that converts to si units (1 inch -> 0.0254 m) +-- etc .. typical something to do when listening to a news whow or b-movie +-- +-- todo: collect used units for logging (and list of units, but then we need +-- associations too). + +-- The lists have been checked and completed by Robin Kirkham. + +-- dubious/wrong + +-- Atom = [[u]], -- should be amu (atomic mass unit) +-- Bell = [[B]], -- should be bel +-- Sterant = [[sr]], -- should be steradian +-- Equivalent = [[eql]], -- qualifier? +-- At = [[at]], -- qualifier? +-- Force = [[f]], -- qualifier? +-- eVolt = [[eV]], +-- -- AC or DC voltages should be qualified in the text +-- VoltAC = [[V\unitsbackspace\unitslower{ac}]], +-- VoltDC = [[V\unitsbackspace\unitslower{dc}]], +-- AC = [[V\unitsbackspace\unitslower{ac}]], +-- DC = [[V\unitsbackspace\unitslower{dc}]], +-- -- probably not harmful but there are better alternatives +-- -- e.g., revolution per second (rev/s) +-- RPS = [[RPS]], +-- RPM = [[RPM]], +-- RevPerSec = [[RPS]], +-- RevPerMin = [[RPM]], + +local rawset, next = rawset, next +local V, P, S, R, C, Cc, Cs, matchlpeg = lpeg.V, lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.match +local format, lower, gsub = string.format, string.lower, string.gsub +local appendlpeg = lpeg.append +local utfchartabletopattern = lpeg.utfchartabletopattern +local mergetable, mergedtable, keys, loweredkeys, sortedhash = table.merge, table.merged, table.keys, table.loweredkeys, table.sortedhash +local setmetatablenewindex = table.setmetatablenewindex +local utfchar = utf.char + +physics = physics or { } +physics.units = physics.units or { } + +local allocate = utilities.storage.allocate + +local context = context +local commands = commands +local implement = interfaces.implement + +local trace_units = false +local report_units = logs.reporter("units") + +trackers.register("physics.units", function(v) trace_units = v end) + +-- digits parser (todo : use patterns) + +local math_one = Cs((P("$") /"") * (1-P("$"))^1 * (P("$")/"")) / context.m +local math_two = Cs((P("\\m {")/"") * (1-P("}"))^1 * (P("}")/"")) / context.m -- watch the space after \m + +local digit = R("09") +local plus = P("+") +local minus = P("-") +local plusminus = P("±") +local sign = plus + minus +local power = S("^e") +local digitspace = S("~@_") +local comma = P(",") +local period = P(".") +local semicolon = P(";") +local colon = P(":") +local signspace = P("/") +local positive = P("++") -- was p +local negative = P("--") -- was n +local highspace = P("//") -- was s +local padding = P("=") +local space = P(" ") +local lparent = P("(") +local rparent = P(")") + +local lbrace = P("{") +local rbrace = P("}") + +local digits = digit^1 + +local powerdigits = plus * C(digits) / context.digitspowerplus + + minus * C(digits) / context.digitspowerminus + + C(digits) / context.digitspower + +local ddigitspace = digitspace / "" / context.digitsspace +local ddigit = digits / context.digitsdigit +local dsemicomma = semicolon / "" / context.digitsseparatorspace +local dsemiperiod = colon / "" / context.digitsseparatorspace +local dfinalcomma = comma / "" / context.digitsfinalcomma +local dfinalperiod = period / "" / context.digitsfinalperiod +local dintercomma = comma / "" / context.digitsintermediatecomma +local dinterperiod = period / "" / context.digitsintermediateperiod +local dskipcomma = comma / "" / context.digitsseparatorspace +local dskipperiod = period / "" / context.digitsseparatorspace +local dsignspace = signspace / "" / context.digitssignspace +local dpositive = positive / "" / context.digitspositive +local dnegative = negative / "" / context.digitsnegative +local dhighspace = highspace / "" / context.digitshighspace +local dsomesign = plus / "" / context.digitsplus + + minus / "" / context.digitsminus + + plusminus / "" / context.digitsplusminus +local dpower = power / "" * ( powerdigits + lbrace * powerdigits * rbrace ) + +local dpadding = padding / "" / context.digitszeropadding -- todo + +local dleader = (dpositive + dnegative + dhighspace + dsomesign + dsignspace)^0 +local dtrailer = dpower^0 +local dfinal = P(-1) + #P(1 - comma - period - semicolon - colon) +local dnumber = (ddigitspace + ddigit)^1 + +-- ___,000,000 ___,___,000 ___,___,__0 000,000,000 000.00 000,000,000.00 000,000,000.== + +-- : ; for the moment not used, maybe for invisible fraction . , when no leading number + +-- local c_p = (ddigitspace^1 * dskipcomma)^0 -- ___, +-- * (ddigitspace^0 * ddigit * dintercomma)^0 -- _00, 000, +-- * ddigitspace^0 * ddigit^0 -- _00 000 +-- * ( +-- dfinalperiod * ddigit -- .00 +-- + dskipperiod * dpadding^1 -- .== +-- + dsemiperiod * ddigit -- :00 +-- + dsemiperiod * dpadding^1 -- :== +-- )^0 +-- + ddigit -- 00 +-- +-- local p_c = (ddigitspace^1 * dskipperiod)^0 -- ___. +-- * (ddigitspace^0 * ddigit * dinterperiod)^0 -- _00. 000. +-- * ddigitspace^0 * ddigit^0 -- _00 000 +-- * ( +-- dfinalcomma * ddigit -- ,00 +-- + dskipcomma * dpadding^1 -- ,== +-- + dsemicomma * ddigit -- :00 +-- + dsemicomma * dpadding^1 -- :== +-- )^0 +-- + ddigit -- 00 +-- +-- fix by WS/SB (needs further testing) + +local c_p = (ddigitspace^1 * dskipcomma)^0 -- ___, + * (ddigitspace^0 * ddigit * dintercomma)^0 -- _00, 000, + * ddigitspace^0 * ddigit^0 -- _00 000 + * ( + dfinalperiod * ddigit^1 * dpadding^1 -- .0= + + dfinalperiod * ddigit * (dintercomma * ddigit)^0 -- .00 + + dskipperiod * dpadding^1 -- .== + + dsemiperiod * ddigit * (dintercomma * ddigit)^0 -- :00 + + dsemiperiod * dpadding^1 -- :== + )^0 + + ddigit -- 00 + +local p_c = (ddigitspace^1 * dskipperiod)^0 -- ___. + * (ddigitspace^0 * ddigit * dinterperiod)^0 -- _00. 000. + * ddigitspace^0 * ddigit^0 -- _00 000 + * ( + dfinalcomma * ddigit^1 * dpadding^1 -- ,0= + + dfinalcomma * ddigit * (dinterperiod * ddigit)^0 -- 00 + + dskipcomma * dpadding^1 -- ,== + + dsemicomma * ddigit * (dinterperiod * ddigit)^0 -- :00 + + dsemicomma * dpadding^1 -- :== + )^0 + + ddigit -- 00 + +local p_c_dparser = math_one + math_two + dleader * p_c * dtrailer * dfinal +local c_p_dparser = math_one + math_two + dleader * c_p * dtrailer * dfinal + +local function makedigits(str,reverse) + if reverse then + matchlpeg(p_c_dparser,str) + else + matchlpeg(c_p_dparser,str) + end +end + +-- tables: + +local user_long_prefixes = { } +local user_long_units = { } +local user_long_operators = { } +local user_long_suffixes = { } +local user_symbol_units = { } +local user_packaged_units = { } + +local user_short_prefixes = { } +local user_short_units = { } +local user_short_operators = { } +local user_short_suffixes = { } + +local long_prefixes = { + + -- Le Système international d'unités (SI) 8e édition (Table 5) + + Yocto = "yocto", -- 10^{-24} + Zepto = "zepto", -- 10^{-21} + Atto = "atto", -- 10^{-18} + Femto = "femto", -- 10^{-15} + Pico = "pico", -- 10^{-12} + Nano = "nano", -- 10^{-9} + Micro = "micro", -- 10^{-6} + Milli = "milli", -- 10^{-3} + Centi = "centi", -- 10^{-2} + Deci = "deci", -- 10^{-1} + + Deca = "deca", -- 10^{1} + Hecto = "hecto", -- 10^{2} + Kilo = "kilo", -- 10^{3} + Mega = "mega", -- 10^{6} + Giga = "giga", -- 10^{9} + Tera = "tera", -- 10^{12} + Peta = "peta", -- 10^{15} + Exa = "exa", -- 10^{18} + Zetta = "zetta", -- 10^{21} + Yotta = "yotta", -- 10^{24} + + -- IEC 60027-2: 2005, third edition, Part 2 + + Kibi = "kibi", -- 2^{10} (not ki) + Mebi = "mebi", -- 2^{20} + Gibi = "gibi", -- 2^{30} + Tebi = "tebi", -- 2^{40} + Pebi = "pebi", -- 2^{50} + Exbi = "exbi", -- 2^{60} + + -- not standard + + Zebi = "zebi", -- binary + Yobi = "yobi", -- binary + + Micro = "micro", + Root = "root", +} + +local long_units = { + + -- Le Système international d'unités (SI) 8e édition (except synonyms) + -- SI base units (Table 1) + + Meter = "meter", + Gram = "gram", + Second = "second", + Ampere = "ampere", + Kelvin = "kelvin", + Mole = "mole", + Candela = "candela", + + -- synonyms + + Mol = "mole", + Metre = "meter", + + -- SI derived units with special names (Table 3) + + Radian = "radian", + Steradian = "steradian", + Hertz = "hertz", + Newton = "newton", + Pascal = "pascal", + Joule = "joule", + Watt = "watt", + Coulomb = "coulomb", + Volt = "volt", + Farad = "farad", + Ohm = "ohm", + Siemens = "siemens", + Weber = "weber", + Tesla = "tesla", + Henry = "henry", + Celsius = "celsius", + Lumen = "lumen", + Lux = "lux", + Becquerel = "becquerel", + Gray = "gray", + Sievert = "sievert", + Katal = "katal", + + -- non SI units accepted for use with SI (Table 6) + + Minute = "minute", + Hour = "hour", + Day = "day", + + -- (degree, minute, second of arc are treated specially later) + + Gon = "gon", + Grad = "grad", + Hectare = "hectare", + Liter = "liter", + + Tonne = "tonne", + + -- synonyms + + MetricTon = "tonne", + Litre = "liter", + + ["Metric Ton"] = "tonne", + + -- non-SI units whose values must be obtained experimentally (Table 7) + + AtomicMassUnit = "atomicmassunit", + AstronomicalUnit = "astronomicalunit", + ElectronVolt = "electronvolt", + Dalton = "dalton", + + ["Atomic Mass Unit"] = "atomicmassunit", + ["Astronomical Unit"] = "astronomicalunit", + ["Electron Volt"] = "electronvolt", + + -- special cases (catch doubles, okay, a bit over the top) + + DegreesCelsius = "celsius", + DegreesFahrenheit = "fahrenheit", + DegreeCelsius = "celsius", + DegreeFahrenheit = "fahrenheit", + + ["Degrees Celsius"] = "celsius", + ["Degrees Fahrenheit"] = "fahrenheit", + ["Degree Celsius"] = "celsius", + ["Degree Fahrenheit"] = "fahrenheit", + + -- too late as we already have connected symbols catched: + -- + -- ["° Celsius"] = "celsius", + -- ["° Fahrenheit"] = "fahrenheit", + -- ["°Celsius"] = "celsius", + -- ["°Fahrenheit"] = "fahrenheit", + + -- the "natural units" and "atomic units" are omitted for now + -- synonyms + + eV = "electronvolt", + AMU = "atomicmassunit", + + -- other non-SI units (Table 8) + + Bar = "bar", + Hg = "mercury", + -- ["Millimetre Of Mercury"] = [[mmHg]], + Angstrom = "angstrom", -- strictly Ångström + NauticalMile = "nauticalmile", + Barn = "barn", + Knot = "knot", + Neper = "neper", + Bel = "bel", -- in practice only decibel used + + ["Nautical Mile"] = "nauticalmile", + + -- other non-SI units from CGS system (Table 9) + + Erg = "erg", + Dyne = "dyne", + Poise = "poise", + Stokes = "stokes", + Stilb = "stilb", + Phot = "phot", + Gal = "gal", + Maxwell = "maxwell", + Gauss = "gauss", + Oersted = "oersted", + + -- end of SI + + -- data: for use with the binary prefixes (except Erlang) + + Bit = "bit", + Byte = "byte" , + Baud = "baud", + Erlang = "erlang", + + -- common units, not part of SI + + Atmosphere = "atmosphere", + Revolution = "revolution", + + -- synonyms + + Atm = "atmosphere", + Rev = "revolution", + + -- imperial units (very incomplete) + + Fahrenheit = "fahrenheit", + Foot = "foot", + Inch = "inch", + Calorie = "calorie", + + -- synonyms + + Cal = "calorie", + +} + +local long_operators = { + + Times = "times", + Solidus = "solidus", + Per = "per", + OutOf = "outof", + +} + +local long_suffixes = { + + Linear = "linear", + Square = "square", + Cubic = "cubic", + Quadratic = "quadratic", + Inverse = "inverse", + ILinear = "ilinear", + ISquare = "isquare", + ICubic = "icubic", + IQuadratic = "iquadratic", + +} + +local short_prefixes = { + + y = "yocto", + z = "zetto", + a = "atto", + f = "femto", + p = "pico", + n = "nano", + u = "micro", + m = "milli", + c = "centi", + d = "deci", + da = "deca", + h = "hecto", + k = "kilo", + M = "mega", + G = "giga", + T = "tera", + P = "peta", + E = "exa", + Z = "zetta", + Y = "yotta", + +} + +local short_units = { -- I'm not sure about casing + + m = "meter", + Hz = "hertz", + hz = "hertz", + B = "bel", + b = "bel", + lx = "lux", + -- da = "dalton", + h = "hour", + s = "second", + g = "gram", + n = "newton", + V = "volt", + t = "tonne", + l = "liter", + -- w = "watt", + W = "watt", + -- a = "ampere", + A = "ampere", + + Ω = "ohm", + +-- C = "coulomb", -- needs checking with (c)enti +-- K = "kelvin", -- needs checking with (k)ilo +-- N = "newton", -- needs checking with (n)ewton + + min = "minute", + + [utfchar(0x2103)] = "celsius", + [utfchar(0x2109)] = "fahrenheit", +} + +local short_operators = { + ["."] = "times", + ["*"] = "times", + ["/"] = "solidus", + [":"] = "outof", +} + +local short_suffixes = { -- maybe just raw digit match + ["1"] = "linear", + ["2"] = "square", + ["3"] = "cubic", + ["4"] = "quadratic", + ["+1"] = "linear", + ["+2"] = "square", + ["+3"] = "cubic", + ["+4"] = "quadratic", + ["-1"] = "inverse", + ["-1"] = "ilinear", + ["-2"] = "isquare", + ["-3"] = "icubic", + ["-4"] = "iquadratic", + ["^1"] = "linear", + ["^2"] = "square", + ["^3"] = "cubic", + ["^4"] = "quadratic", + ["^+1"] = "linear", + ["^+2"] = "square", + ["^+3"] = "cubic", + ["^+4"] = "quadratic", + ["^-1"] = "inverse", + ["^-1"] = "ilinear", + ["^-2"] = "isquare", + ["^-3"] = "icubic", + ["^-4"] = "iquadratic", +} + +local symbol_units = { + Degrees = "degree", + Degree = "degree", + -- Deg = "degree", + ["°"] = "degree", + ArcMinute = "arcminute", + ["′"] = "arcminute", -- 0x2032 + ArcSecond = "arcsecond", + ["″"] = "arcsecond", -- 0x2033 + Percent = "percent", + ["%"] = "percent", + Promille = "permille", + Permille = "permille", +} + +local packaged_units = { + Micron = "micron", + mmHg = "millimetermercury", +} + +-- rendering: + +local ctx_unitsPUS = context.unitsPUS +local ctx_unitsPU = context.unitsPU +local ctx_unitsPS = context.unitsPS +local ctx_unitsP = context.unitsP +local ctx_unitsUS = context.unitsUS +local ctx_unitsU = context.unitsU +local ctx_unitsS = context.unitsS +local ctx_unitsO = context.unitsO +local ctx_unitsN = context.unitsN +local ctx_unitsC = context.unitsC +local ctx_unitsQ = context.unitsQ +local ctx_unitsRPM = context.unitsRPM +local ctx_unitsRTO = context.unitsRTO +local ctx_unitsRabout = context.unitsRabout +local ctx_unitsNstart = context.unitsNstart +local ctx_unitsNstop = context.unitsNstop +local ctx_unitsNspace = context.unitsNspace +local ctx_unitsPopen = context.unitsPopen +local ctx_unitsPclose = context.unitsPclose + +local labels = languages.data.labels + +labels.prefixes = allocate { + yocto = { labels = { en = [[y]] } }, -- 10^{-24} + zepto = { labels = { en = [[z]] } }, -- 10^{-21} + atto = { labels = { en = [[a]] } }, -- 10^{-18} + femto = { labels = { en = [[f]] } }, -- 10^{-15} + pico = { labels = { en = [[p]] } }, -- 10^{-12} + nano = { labels = { en = [[n]] } }, -- 10^{-9} + micro = { labels = { en = [[\mu]] } }, -- 10^{-6} + milli = { labels = { en = [[m]] } }, -- 10^{-3} + centi = { labels = { en = [[c]] } }, -- 10^{-2} + deci = { labels = { en = [[d]] } }, -- 10^{-1} + deca = { labels = { en = [[da]] } }, -- 10^{1} + hecto = { labels = { en = [[h]] } }, -- 10^{2} + kilo = { labels = { en = [[k]] } }, -- 10^{3} + mega = { labels = { en = [[M]] } }, -- 10^{6} + giga = { labels = { en = [[G]] } }, -- 10^{9} + tera = { labels = { en = [[T]] } }, -- 10^{12} + peta = { labels = { en = [[P]] } }, -- 10^{15} + exa = { labels = { en = [[E]] } }, -- 10^{18} + zetta = { labels = { en = [[Z]] } }, -- 10^{21} + yotta = { labels = { en = [[Y]] } }, -- 10^{24} + kibi = { labels = { en = [[Ki]] } }, -- 2^{10} (not ki) + mebi = { labels = { en = [[Mi]] } }, -- 2^{20} + gibi = { labels = { en = [[Gi]] } }, -- 2^{30} + tebi = { labels = { en = [[Ti]] } }, -- 2^{40} + pebi = { labels = { en = [[Pi]] } }, -- 2^{50} + exbi = { labels = { en = [[Ei]] } }, -- 2^{60} + zebi = { labels = { en = [[Zi]] } }, -- binary + yobi = { labels = { en = [[Yi]] } }, -- binary + micro = { labels = { en = [[µ]] } }, -- 0x00B5 \textmu + root = { labels = { en = [[√]] } }, -- 0x221A +} + +labels.units = allocate { + meter = { labels = { en = [[m]] } }, + gram = { labels = { en = [[g]] } }, -- strictly kg is the base unit + second = { labels = { en = [[s]] } }, + ampere = { labels = { en = [[A]] } }, + kelvin = { labels = { en = [[K]] } }, + mole = { labels = { en = [[mol]] } }, + candela = { labels = { en = [[cd]] } }, + mol = { labels = { en = [[mol]] } }, + radian = { labels = { en = [[rad]] } }, + steradian = { labels = { en = [[sr]] } }, + hertz = { labels = { en = [[Hz]] } }, + newton = { labels = { en = [[N]] } }, + pascal = { labels = { en = [[Pa]] } }, + joule = { labels = { en = [[J]] } }, + watt = { labels = { en = [[W]] } }, + coulomb = { labels = { en = [[C]] } }, + volt = { labels = { en = [[V]] } }, + farad = { labels = { en = [[F]] } }, + ohm = { labels = { en = [[Ω]] } }, -- 0x2126 \textohm + siemens = { labels = { en = [[S]] } }, + weber = { labels = { en = [[Wb]] } }, + mercury = { labels = { en = [[Hg]] } }, + millimetermercury = { labels = { en = [[mmHg]] } }, -- connected + tesla = { labels = { en = [[T]] } }, + henry = { labels = { en = [[H]] } }, + celsius = { labels = { en = [[\checkedtextcelsius]] } }, -- 0x2103 + lumen = { labels = { en = [[lm]] } }, + lux = { labels = { en = [[lx]] } }, + becquerel = { labels = { en = [[Bq]] } }, + gray = { labels = { en = [[Gy]] } }, + sievert = { labels = { en = [[Sv]] } }, + katal = { labels = { en = [[kat]] } }, + minute = { labels = { en = [[min]] } }, + hour = { labels = { en = [[h]] } }, + day = { labels = { en = [[d]] } }, + gon = { labels = { en = [[gon]] } }, + grad = { labels = { en = [[grad]] } }, + hectare = { labels = { en = [[ha]] } }, + liter = { labels = { en = [[l]] } }, -- symbol l or L + tonne = { labels = { en = [[t]] } }, + electronvolt = { labels = { en = [[eV]] } }, + dalton = { labels = { en = [[Da]] } }, + atomicmassunit = { labels = { en = [[u]] } }, + astronomicalunit = { labels = { en = [[au]] } }, + bar = { labels = { en = [[bar]] } }, + angstrom = { labels = { en = [[Å]] } }, -- strictly Ångström + nauticalmile = { labels = { en = [[M]] } }, + barn = { labels = { en = [[b]] } }, + knot = { labels = { en = [[kn]] } }, + neper = { labels = { en = [[Np]] } }, + bel = { labels = { en = [[B]] } }, -- in practice only decibel used + erg = { labels = { en = [[erg]] } }, + dyne = { labels = { en = [[dyn]] } }, + poise = { labels = { en = [[P]] } }, + stokes = { labels = { en = [[St]] } }, + stilb = { labels = { en = [[sb]] } }, + phot = { labels = { en = [[phot]] } }, + gal = { labels = { en = [[gal]] } }, + maxwell = { labels = { en = [[Mx]] } }, + gauss = { labels = { en = [[G]] } }, + oersted = { labels = { en = [[Oe]] } }, -- strictly Œrsted + bit = { labels = { en = [[bit]] } }, + byte = { labels = { en = [[B]] } }, + baud = { labels = { en = [[Bd]] } }, + erlang = { labels = { en = [[E]] } }, + atmosphere = { labels = { en = [[atm]] } }, + revolution = { labels = { en = [[rev]] } }, + fahrenheit = { labels = { en = [[\checkedtextfahrenheit]] } }, -- 0x2109 + foot = { labels = { en = [[ft]] } }, + inch = { labels = { en = [[inch]] } }, + calorie = { labels = { en = [[cal]] } }, + -- + degree = { labels = { en = [[°]]} }, + arcminute = { labels = { en = [[\checkedtextprime]] } }, -- ′ 0x2032 + arcsecond = { labels = { en = [[\checkedtextdoubleprime]] } }, -- ″ 0x2033 + percent = { labels = { en = [[\percent]] } }, + permille = { labels = { en = [[\promille]] } }, + -- + micron = { labels = { en = [[\textmu m]] } }, +} + +labels.operators = allocate { + times = { labels = { en = [[\unitsTIMES]] } }, + solidus = { labels = { en = [[\unitsSOLIDUS]] } }, + per = { labels = { en = [[\unitsSOLIDUS]] } }, + outof = { labels = { en = [[\unitsOUTOF]] } }, +} + +labels.suffixes = allocate { + linear = { labels = { en = [[1]] } }, + square = { labels = { en = [[2]] } }, + cubic = { labels = { en = [[3]] } }, + quadratic = { labels = { en = [[4]] } }, + inverse = { labels = { en = [[\mathminus1]] } }, + ilinear = { labels = { en = [[\mathminus1]] } }, + isquare = { labels = { en = [[\mathminus2]] } }, + icubic = { labels = { en = [[\mathminus3]] } }, + iquadratic = { labels = { en = [[\mathminus4]] } }, +} + +local function dimpus(p,u,s) + if trace_units then + report_units("prefix %a, unit %a, suffix %a",p,u,s) + end -- + if p ~= "" then + if u ~= "" then + if s ~= "" then + ctx_unitsPUS(p,u,s) + else + ctx_unitsPU(p,u) + end + elseif s ~= "" then + ctx_unitsPS(p,s) + else + ctx_unitsP(p) + end + else + if u ~= "" then + if s ~= "" then + ctx_unitsUS(u,s) + -- elseif c then + -- ctx_unitsC(u) + else + ctx_unitsU(u) + end + elseif s ~= "" then + ctx_unitsS(s) + else + ctx_unitsP(p) + end + end +end + +local function dimspu(s,p,u) + return dimpus(p,u,s) +end + +local function dimop(o) + if trace_units then + report_units("operator %a",o) + end + if o then + ctx_unitsO(o) + end +end + +local function dimsym(s) + if trace_units then + report_units("symbol %a",s) + end + s = symbol_units[s] or s + if s then + ctx_unitsC(s) + end +end + +local function dimpre(p) + if trace_units then + report_units("prefix [%a",p) + end + p = packaged_units[p] or p + if p then + ctx_unitsU(p) + end +end + +-- patterns: +-- +-- space inside Cs else funny captures and args to function +-- +-- square centi meter per square kilo seconds + +-- todo 0x -> rm + +local function update_parsers(keepcase) -- todo: don't remap utf sequences + + local all_long_prefixes = { } + local all_long_units = { } + local all_long_operators = { } + local all_long_suffixes = { } + local all_symbol_units = { } + local all_packaged_units = { } + + local all_short_prefixes = { } + local all_short_units = { } + local all_short_operators = { } + local all_short_suffixes = { } + + for k, v in sortedhash(long_prefixes) do all_long_prefixes [k] = v all_long_prefixes [lower(k)] = v end + for k, v in sortedhash(long_units) do all_long_units [k] = v all_long_units [lower(k)] = v end + for k, v in sortedhash(long_operators) do all_long_operators[k] = v all_long_operators[lower(k)] = v end + for k, v in sortedhash(long_suffixes) do all_long_suffixes [k] = v all_long_suffixes [lower(k)] = v end + for k, v in sortedhash(symbol_units) do all_symbol_units [k] = v all_symbol_units [lower(k)] = v end + for k, v in sortedhash(packaged_units) do all_packaged_units[k] = v all_packaged_units[lower(k)] = v end + + for k, v in sortedhash(user_long_prefixes) do all_long_prefixes [k] = v if not keepcase then all_long_prefixes [lower(k)] = v end end + for k, v in sortedhash(user_long_units) do all_long_units [k] = v if not keepcase then all_long_units [lower(k)] = v end end + for k, v in sortedhash(user_long_operators) do all_long_operators[k] = v if not keepcase then all_long_operators[lower(k)] = v end end + for k, v in sortedhash(user_long_suffixes) do all_long_suffixes [k] = v if not keepcase then all_long_suffixes [lower(k)] = v end end + for k, v in sortedhash(user_symbol_units) do all_symbol_units [k] = v if not keepcase then all_symbol_units [lower(k)] = v end end + for k, v in sortedhash(user_packaged_units) do all_packaged_units[k] = v if not keepcase then all_packaged_units[lower(k)] = v end end + + for k, v in sortedhash(short_prefixes) do all_short_prefixes [k] = v end + for k, v in sortedhash(short_units) do all_short_units [k] = v end + for k, v in sortedhash(short_operators) do all_short_operators[k] = v end + for k, v in sortedhash(short_suffixes) do all_short_suffixes [k] = v end + + for k, v in sortedhash(user_short_prefixes) do all_short_prefixes [k] = v end + for k, v in sortedhash(user_short_units) do all_short_units [k] = v end + for k, v in sortedhash(user_short_operators) do all_short_operators[k] = v end + for k, v in sortedhash(user_short_suffixes) do all_short_suffixes [k] = v end + + local somespace = P(" ")^0/"" + + local p_long_prefix = appendlpeg(all_long_prefixes,nil,true) + local p_long_unit = appendlpeg(all_long_units,nil,true) + local p_long_operator = appendlpeg(all_long_operators,nil,true) + local p_long_suffix = appendlpeg(all_long_suffixes,nil,true) + local p_symbol = appendlpeg(all_symbol_units,nil,true) + local p_packaged = appendlpeg(all_packaged_units,nil,true) + + local p_short_prefix = appendlpeg(all_short_prefixes) + local p_short_unit = appendlpeg(all_short_units) + local p_short_operator = appendlpeg(all_short_operators) + local p_short_suffix = appendlpeg(all_short_suffixes) + + -- more efficient but needs testing + +-- local p_long_prefix = utfchartabletopattern(all_long_prefixes) / all_long_prefixes +-- local p_long_unit = utfchartabletopattern(all_long_units) / all_long_units +-- local p_long_operator = utfchartabletopattern(all_long_operators) / all_long_operators +-- local p_long_suffix = utfchartabletopattern(all_long_suffixes) / all_long_suffixes +-- local p_symbol = utfchartabletopattern(all_symbol_units) / all_symbol_units +-- local p_packaged = utfchartabletopattern(all_packaged_units) / all_packaged_units + +-- local p_short_prefix = utfchartabletopattern(all_short_prefixes) / all_short_prefixes +-- local p_short_unit = utfchartabletopattern(all_short_units) / all_short_units +-- local p_short_operator = utfchartabletopattern(all_short_operators) / all_short_operators +-- local p_short_suffix = utfchartabletopattern(all_short_suffixes) / all_short_suffixes + + -- we can can cleanup some space issues here (todo) + + local unitparser = P { "unit", + -- + longprefix = Cs(V("somespace") * p_long_prefix), + shortprefix = Cs(V("somespace") * p_short_prefix), + longsuffix = Cs(V("somespace") * p_long_suffix), + shortsuffix = Cs(V("somespace") * p_short_suffix), + shortunit = Cs(V("somespace") * p_short_unit), + longunit = Cs(V("somespace") * p_long_unit), + longoperator = Cs(V("somespace") * p_long_operator), + shortoperator = Cs(V("somespace") * p_short_operator), + packaged = Cs(V("somespace") * p_packaged), + -- + nothing = Cc(""), + somespace = somespace, + nospace = (1-somespace)^1, -- was 0 + -- ignore = P(-1), + -- + qualifier = Cs(V("somespace") * (lparent/"") * (1-rparent)^1 * (rparent/"")), + -- + somesymbol = V("somespace") + * (p_symbol/dimsym) + * V("somespace"), + somepackaged = V("somespace") + * (V("packaged") / dimpre) + * V("somespace"), + -- someunknown = V("somespace") + -- * (V("nospace")/ctx_unitsU) + -- * V("somespace"), + -- + combination = V("longprefix") * V("longunit") -- centi meter + + V("nothing") * V("longunit") + + V("shortprefix") * V("shortunit") -- c m + + V("nothing") * V("shortunit") + + V("longprefix") * V("shortunit") -- centi m + + V("shortprefix") * V("longunit"), -- c meter + +-- combination = ( V("longprefix") -- centi meter +-- + V("nothing") +-- ) * V("longunit") +-- + ( V("shortprefix") -- c m +-- + V("nothing") +-- + V("longprefix") +-- ) * V("shortunit") -- centi m +-- + ( V("shortprefix") -- c meter +-- ) * V("longunit"), + + + dimension = V("somespace") + * ( + V("packaged") / dimpre + + (V("longsuffix") * V("combination")) / dimspu + + (V("combination") * (V("shortsuffix") + V("nothing"))) / dimpus + ) + * (V("qualifier") / ctx_unitsQ)^-1 + * V("somespace"), + operator = V("somespace") + * ((V("longoperator") + V("shortoperator")) / dimop) + * V("somespace"), + snippet = V("dimension") + + V("somesymbol"), + unit = ( V("snippet") * (V("operator") * V("snippet"))^0 + + V("somepackaged") + )^1, + } + + -- todo: avoid \ctx_unitsNstart\ctx_unitsNstop (weird that it can happen .. now catched at tex end) + + local letter = R("az","AZ") + local bound = #(1-letter) + -- local number = lpeg.patterns.number + local number = Cs( P("$") * (1-P("$"))^1 * P("$") + + P([[\m{]]) * (1-P("}"))^1 * P("}") + + (1-letter-P(" "))^1 -- todo: catch { } -- not ok + ) / ctx_unitsN + + local start = Cc(nil) / ctx_unitsNstart + local stop = Cc(nil) / ctx_unitsNstop + local space = P(" ") * Cc(nil) / ctx_unitsNspace + local open = P("(") * Cc(nil) / ctx_unitsPopen + local close = P(")") * Cc(nil) / ctx_unitsPclose + + local range = somespace + * ( (P("±") + P("pm") * bound) / "" / ctx_unitsRPM + + (P("–") + P("to") * bound) / "" / ctx_unitsRTO ) + * somespace + + local about = (P("±") + P("pm") * bound) / "" / ctx_unitsRabout + * somespace + + -- todo: start / stop + + local function combine(parser) + return P { "start", + number = start * dleader * (parser + number) * stop, + anumber = space + * open + * V("about")^-1 + * V("number") + * close, + rule = V("number")^-1 + * (V("range") * V("number") + V("anumber"))^-1, + unit = unitparser, + about = about, + range = range, + space = space, + start = V("rule") + * V("unit") + * (V("space") * V("rule") * V("unit"))^0 + + open + * V("number") + * (V("range") * V("number"))^-1 + * close + * dtrailer^-1 + * V("unit") + + V("number") + } + end + + return combine(p_c_dparser), combine(c_p_dparser) +end + +local p_c_parser_lowercase = nil +local c_p_parser_lowercase = nil +local p_c_parser_keepcase = nil +local c_p_parser_keepcase = nil + +local dirty_lowercase = true +local dirty_keepcase = true + +local v_reverse = interfaces.variables.reverse +local v_keep = interfaces.variables.keep + +local function makeunit(order,option,str) + local reverse = order == v_reverse + local keep = option == v_keep + local parser + if keep then + if dirty_keepcase then + if trace_units then + report_units("initializing case %s parser","sensititive") + end + p_c_parser_keepcase, c_p_parser_keepcase = update_parsers(true) + dirty_keepcase = false + end + parser = reverse and p_c_parser_keepcase or c_p_parser_keepcase + else + if dirty_lowercase then + if trace_units then + report_units("initializing case %s parser","insensititive") + end + p_c_parser_lowercase, c_p_parser_lowercase = update_parsers() + dirty_lowercase = false + end + parser = reverse and p_c_parser_lowercase or c_p_parser_lowercase + end + if not matchlpeg(parser,str) then + report_units("unable to parse: %s",str) + context(str) + end +end + +local function trigger(t,k,v) + rawset(t,k,v) + dirty_lowercase = true + dirty_keepcase = true +end + +local t_units = { + prefixes = setmetatablenewindex(long_prefixes,trigger), + units = setmetatablenewindex(long_units,trigger), + operators = setmetatablenewindex(long_operators,trigger), + suffixes = setmetatablenewindex(long_suffixes,trigger), + symbols = setmetatablenewindex(symbol_units,trigger), + packaged = setmetatablenewindex(packaged_units,trigger), +} + +local t_shortcuts = { + prefixes = setmetatablenewindex(short_prefixes,trigger), + units = setmetatablenewindex(short_units,trigger), + operators = setmetatablenewindex(short_operators,trigger), + suffixes = setmetatablenewindex(short_suffixes,trigger), +} + +local t_userunits = { + prefixes = setmetatablenewindex(user_long_prefixes,trigger), + units = setmetatablenewindex(user_long_units,trigger), + operators = setmetatablenewindex(user_long_operators,trigger), + suffixes = setmetatablenewindex(user_long_suffixes,trigger), + symbols = setmetatablenewindex(user_symbol_units,trigger), + packaged = setmetatablenewindex(user_packaged_units,trigger), +} + +local t_usershortcuts = { + prefixes = setmetatablenewindex(user_short_prefixes,trigger), + units = setmetatablenewindex(user_short_units,trigger), + operators = setmetatablenewindex(user_short_operators,trigger), + suffixes = setmetatablenewindex(user_short_suffixes,trigger), +} + +physics.units.tables = allocate { + units = t_units, + shortcuts = t_shortcuts, + userunits = t_userunits, + usershortcuts = t_usershortcuts, +} + +local mapping = { + prefix = "prefixes", + unit = "units", + operator = "operators", + suffix = "suffixes", + symbol = "symbols", + packaged = "packaged", +} + +local function register(category,list,target) + if not list or list == "" then + list = category + category = "unit" + end + local t = target[mapping[category]] + if t then + for k, v in next, utilities.parsers.settings_to_hash(list or "") do + t[k] = v + end + end + -- inspect(tables) +end + +local function registerunit (category,list) register(category,list,t_userunits) end +local function registershortcut(category,list) register(category,list,t_usershortcuts) end + +physics.units.registerunit = registerunit +physics.units.registershortcut = registershortcut + +implement { + name = "digits_normal", + actions = makedigits, + arguments = "string", +} + +implement { + name = "digits_reverse", + actions = makedigits, + arguments = { "string", true }, +} + +implement { + name = "unit", + actions = makeunit, + arguments = "3 strings" +} + +implement { + name = "registerunit", + actions = registerunit, + arguments = "2 strings", +} + +implement { + name = "registerunitshortcut", + actions = registershortcut, + arguments = "2 strings", +} + +implement { + name = "hyphenateddigits", + public = true, + protected = true, + arguments = { "optional", "string" }, + actions = function(filler, digits) + digits = gsub(digits,"(%d)","%1\\digitsbreak ") -- space needed for following letters + digits = gsub(digits,"\\-$",filler) + context(digits) + end +} diff --git a/Master/texmf-dist/tex/context/base/mkxl/phys-dim.mkxl b/Master/texmf-dist/tex/context/base/mkxl/phys-dim.mkxl index 8277ba2317d..e085ba844f8 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/phys-dim.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/phys-dim.mkxl @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\registerctxluafile{phys-dim}{} +\registerctxluafile{phys-dim}{autosuffix} % TAGGING NEEDS CHECKING ... WILL DO WHEN PARSER IS OK @@ -354,7 +354,8 @@ [\c!alternative=, % done: text \c!separator=\v!normal, % done: cdot|big|medium|space \s!language=\currentlanguage, % done: (no interface yet) - \c!order=\v!normal, % ,. (reverse: .,) + \c!order=, % reverse + \c!option=, % keep (case) \c!method=0, %\c!grid=\v!yes, % (maybe) %\c!style=..., % done @@ -431,7 +432,7 @@ \to \everyunits \appendtoks - \frozen\instance\setuevalue\currentunit{\phys_units_direct{\currentunit}} + \frozen\protected\instance\edefcsname\currentunit\endcsname{\phys_units_direct{\currentunit}} \to \everydefineunit \protected\def\phys_units_direct#1% @@ -441,9 +442,10 @@ \settrue\c_phys_units_dospace \removelastskip \fi + \edef\currentunit{#1}% \c_phys_digits_method\unitparameter\c!method\relax \ifmmode\else\dontleavehmode\fi - \edef\currentunit{#1}% +% \edef\currentunit{#1}% \enforced\edef\unitlanguage{\unitparameter\s!language}% \enforced\let\prefixlanguage\unitlanguage \enforced\let\operatorlanguage\unitlanguage @@ -503,9 +505,17 @@ \let\phys_units_direct\phys_units_direct_nested \to \everyunits +% \protected\def\phys_units_indeed#1% +% {\edef\p_order{\unitparameter\c!order}% +% \ifx\p_order\v!reverse +% \expandafter\clf_unit_reverse +% \else +% \expandafter\clf_unit_normal +% \fi +% {\detokenize{#1}}} + \protected\def\phys_units_indeed#1% - {\edef\p_order{\unitparameter\c!order}% - \ifx\p_order\v!reverse\expandafter\clf_unit_reverse\else\expandafter\clf_unit_normal\fi{\detokenize{#1}}} + {\clf_unit{\unitparameter\c!order}{\unitparameter\c!option}{\detokenize{#1}}} \permanent\protected\def\unitsPUS#1#2#3{\phys_units_next\prefixtext{#1}\unittext{#2}\unitsraise{\suffixtext{#3}}\c_phys_units_state\plusone} % suffix \permanent\protected\def\unitsPU #1#2{\phys_units_next\prefixtext{#1}\unittext{#2}\c_phys_units_state\plusthree} % unit @@ -521,10 +531,10 @@ \permanent\protected\def\unitsR #1#2{% todo: tagging \ifmmode #2% - \orelse\ifnum#1=\plusone + \orelse\ifnum#1=\plusone % why this test if we do the same in both cases \digitstextbinop{#2}% before and after \else - \digitstextbinnop{#2}% after + \digitstextbinop{#2}% after \fi \c_phys_units_state\zerocount \setfalse\c_phys_units_dospace @@ -682,7 +692,7 @@ \setfalse\c_phys_units_dospace \phys_units_start} -\permanent\protected\def\unitsTIMES % GP: Does this do anything? HH: yes "times" +\permanent\protected\def\unitsTIMES % GP: Does this do anything? HH: yes "times" {\ifnum\c_phys_units_state=\plusone % suffix \else \unitssmallspace @@ -696,9 +706,16 @@ \fi :} +% \permanent\protected\def\unitsSOLIDUS +% {\ifnum\c_phys_units_state=\plusone % suffix +% \unitsbackspace +% \fi +% {/}% +% }%\unitsbackspace} + \permanent\protected\def\unitsSOLIDUS {\ifnum\c_phys_units_state=\plusone % suffix - \unitsbackspace + \ifmmode\else\unitsbackspace\fi % we have advanced solidus handling in math \fi {/}% }%\unitsbackspace} @@ -737,8 +754,44 @@ %D cicero=cc] %D \stoptyping -\permanent\tolerant\protected\def\registerunit[#1]#*[#2]% todo: public implementer - {\clf_registerunit{#1}{#2}} +\permanent\tolerant\protected\def\registerunit [#1]#*[#2]{\clf_registerunit {#1}{#2}} +\permanent\tolerant\protected\def\registerunitshortcut[#1]#*[#2]{\clf_registerunitshortcut{#1}{#2}} + +%D \starttyping +%D \registerunit +%D [unit] +%D [Point=PT, +%D point=pt, +%D Basepoint=BP, +%D % basepoint=bp, +%D ] +%D +%D \registerunitshortcut +%D [unit] +%D [C=coulomb] +%D +%D \startlines +%D 10 \unit {square meter per second} +%D 10 \unit {square Meter per Second} +%D 10 \unit {point} +%D 10 \unit {Point} +%D 10 \unit {basepoint} +%D 10 \unit {Basepoint} +%D 10 \unit {C} +%D \stoplines +%D +%D \setupunit[unit][option=keep] +%D +%D \startlines +%D 10 \unit {square meter per second} +%D 10 \unit {square Meter per Second} +%D 10 \unit {point} +%D 10 \unit {Point} +%D 10 \unit {basepoint} +%D 10 \unit {Basepoint} +%D 10 \unit {C} +%D \stoplines +%D \stoptyping %D You can generate a list as follows: %D diff --git a/Master/texmf-dist/tex/context/base/mkxl/publ-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/publ-ini.mkxl index b75a933adbf..f120c55fb99 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/publ-ini.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/publ-ini.mkxl @@ -342,7 +342,7 @@ \newtoks\t_btx_cmd \newbox \b_btx_cmd -\t_btx_cmd{\global\setbox\b_btx_cmd\hpack{\clf_btxcmdstring}} +\t_btx_cmd{\global\setbox\b_btx_cmd\hbox{\clf_btxcmdstring}} % no \hpack, otherwise prerolling --- doesn't work \aliased\let\btxcmd\btxcommand @@ -876,6 +876,7 @@ ignored {\btxrenderingparameter\c!ignore}% group {\btxrenderingparameter\c!group}% filter {\btxrenderingparameter\c!filter}% + filename {\btxrenderingparameter\c!file}% for now \relax \ifnum\nofbtxlistentries>\zerocount \clf_btxpreparelistentries{\currentbtxdataset}% could be put in collect @@ -1155,7 +1156,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!none + [\c!type=\s!btx,\c!location=\v!here]% [\ifx\currentbtxdataset\v!default\else\s!btxset=\currentbtxdataset,\fi% \s!btxref=\currentbtxtag,% %\ifempty\currentbtxcombis \else\s!btxcom={\currentbtxcombis},\fi% diff --git a/Master/texmf-dist/tex/context/base/mkxl/regi-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/regi-ini.lmt index c0cd4f1c8ef..efacd512816 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/regi-ini.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/regi-ini.lmt @@ -6,11 +6,8 @@ if not modules then modules = { } end modules ['regi-ini'] = { license = "see context related readme files" } ---[[ldx-- -<p>Regimes take care of converting the input characters into -<l n='utf'/> sequences. The conversion tables are loaded at -runtime.</p> ---ldx]]-- +-- Regimes take care of converting the input characters into UTF sequences. The +-- conversion tables are loaded at runtime. local tostring = tostring local utfchar = utf.char diff --git a/Master/texmf-dist/tex/context/base/mkxl/scrn-fld.mklx b/Master/texmf-dist/tex/context/base/mkxl/scrn-fld.mklx index d5dadcb78bf..e3bde47c678 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/scrn-fld.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/scrn-fld.mklx @@ -274,7 +274,7 @@ %D A few testing macros (expandable for historic reasons): -\permanent\def\doifelsefieldbody #tag{\clf_doifelsefield{#tag}} +\permanent\def\doifelsefieldbody #tag{\clf_doifelsefieldset{#tag}} \permanent\def\doifelsefieldcategory#tag{\clf_doifelsefieldcategory{#tag}} \aliased\let\doiffieldbodyelse \doifelsefieldbody diff --git a/Master/texmf-dist/tex/context/base/mkxl/scrn-ref.lmt b/Master/texmf-dist/tex/context/base/mkxl/scrn-ref.lmt index be298e2d1d2..43c3a0276a6 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/scrn-ref.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/scrn-ref.lmt @@ -51,7 +51,26 @@ function references.setclosepageaction(close) end end -implement { name = "setopendocumentaction", arguments = "string", actions = references.setopendocumentaction } -implement { name = "setclosedocumentaction", arguments = "string", actions = references.setclosedocumentaction } -implement { name = "setopenpageaction", arguments = "string", actions = references.setopenpageaction } -implement { name = "setclosepageaction", arguments = "string", actions = references.setclosepageaction } +implement { + name = "setopendocumentaction", + arguments = "string", + actions = references.setopendocumentaction +} + +implement { + name = "setclosedocumentaction", + arguments = "string", + actions = references.setclosedocumentaction +} + +implement { + name = "setopenpageaction", + arguments = "string", + actions = references.setopenpageaction +} + +implement { + name = "setclosepageaction", + arguments = "string", + actions = references.setclosepageaction +} diff --git a/Master/texmf-dist/tex/context/base/mkxl/scrn-wid.lmt b/Master/texmf-dist/tex/context/base/mkxl/scrn-wid.lmt index caa09adbd93..f2112aa1171 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/scrn-wid.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/scrn-wid.lmt @@ -42,8 +42,6 @@ interactions.linkedlists = linkedlists local texsetbox = tex.setbox -local jobpasses = job.passes - local texgetcount = tex.getcount local codeinjections = backends.codeinjections @@ -277,7 +275,24 @@ implement { } } --- Linkedlists (only a context interface) +-- Linkedlists (only a context interface) .. untested, just adapted from old code. + +local collected = allocate() +local tobesaved = allocate() + +local linkedlists = { + collected = collected, + tobesaved = tobesaved, +} + +job.linkedlists = linkedlists + +local function initializer() + collected = linkedlists.collected + tobesaved = linkedlists.tobesaved +end + +job.register("job.linkedlists.collected", tobesaved, initializer, nil) implement { name = "definelinkedlist", @@ -291,10 +306,12 @@ implement { name = "enhancelinkedlist", arguments = { "string", "integer" }, actions = function(tag,n) - local ll = jobpasses.gettobesaved(tag) - if ll then - ll[n] = texgetcount("realpageno") + local linkedlist = tobesaved[tag] + if not linkedlist then + linkedlist = { } + tobesaved[tag] = linkedlist end + linkedlist[n] = texgetcount("realpageno") end } @@ -302,15 +319,18 @@ implement { name = "addlinklistelement", arguments = "string", actions = function(tag) - local tobesaved = jobpasses.gettobesaved(tag) - local collected = jobpasses.getcollected(tag) or { } + local tobesaved = tobesaved[tag] or { } + local collected = collected[tag] or { } local currentlink = #tobesaved + 1 local noflinks = #collected - tobesaved[currentlink] = 0 + -- + tobesaved[currentlink] = 0 -- needs checking + -- local f = collected[1] or 0 local l = collected[noflinks] or 0 local p = collected[currentlink-1] or f local n = collected[currentlink+1] or l + -- context.setlinkedlistproperties(currentlink,noflinks,f,p,n,l) -- context.ctxlatelua(function() commands.enhancelinkedlist(tag,currentlink) end) end diff --git a/Master/texmf-dist/tex/context/base/mkxl/spac-ali.lmt b/Master/texmf-dist/tex/context/base/mkxl/spac-ali.lmt index 9fa02467292..0eeda643aaf 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/spac-ali.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/spac-ali.lmt @@ -22,7 +22,8 @@ local takeattr = nuts.takeattr local getwidth = nuts.getwidth local findtail = nuts.tail -local righttoleft_code = nodes.dirvalues.righttoleft +local righttoleft_code = tex.directioncodes.righttoleft + local linelist_code = nodes.listcodes.line local hpack_nodes = nuts.hpack diff --git a/Master/texmf-dist/tex/context/base/mkxl/spac-ali.mkxl b/Master/texmf-dist/tex/context/base/mkxl/spac-ali.mkxl index f5b0e2fb846..9d9feab9b17 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/spac-ali.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/spac-ali.mkxl @@ -1325,4 +1325,17 @@ \permanent\protected\def\spaceorpar{\endgraf\ifhmode\space\fi} +%D Kind of documenting: +%D +%D \starttyping +%D \disabletrackers[builders.hpack.quality] % enabled by default +%D \enabletrackers[builders.hpack.collect] +%D \enabletrackers[builders.hpack.overflow] +%D +%D \starttext +%D {\hsize 4cm \input tufte \par} \page +%D {\hsize 8cm \input tufte \par} \page +%D \stoptext +%D \stoptyping + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mkxl/spac-hor.mkxl b/Master/texmf-dist/tex/context/base/mkxl/spac-hor.mkxl index 3c4fd1eb466..ab15e7a6eca 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/spac-hor.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/spac-hor.mkxl @@ -269,9 +269,15 @@ \aliased\let\dorechecknextindentation\relax % public (in macros) -\permanent\protected\protected\def\spac_indentation_check_next_indentation +% \permanent\protected\def\spac_indentation_check_next_indentation +% {\global\enforced\let\dorechecknextindentation\relax +% \doifelsenextchar\par\donothing\spac_indentation_variant_no} % messy check as next is seldom \par + +\permanent\protected\def\spac_indentation_check_next_indentation {\global\enforced\let\dorechecknextindentation\relax - \doifelsenextchar\par\donothing\spac_indentation_variant_no} % messy check as next is seldom \par + \begingroup + \autoparagraphmode\zerocount + \doifelsenextchar\par\endgroup{\endgroup\spac_indentation_variant_no}} % messy check as next is seldom \par \def\spac_indentation_variant_auto {\global\enforced\let\dorechecknextindentation\spac_indentation_check_next_indentation} diff --git a/Master/texmf-dist/tex/context/base/mkxl/spac-pag.mkxl b/Master/texmf-dist/tex/context/base/mkxl/spac-pag.mkxl index d61ddcbe6ae..2e3e1bc0058 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/spac-pag.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/spac-pag.mkxl @@ -16,7 +16,6 @@ \unprotect \newif \ifpagestatemismatch -\newinteger \realpagestateno \newconstant\frozenpagestate \permanent\protected\def\dotrackpagestate#1#2% diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-doc.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-doc.mkxl index 11c96f9c149..e85d222c276 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-doc.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-doc.mkxl @@ -47,6 +47,7 @@ \mutable\lettonothing\currentstructurecomponentbookmark \mutable\lettonothing\currentstructurecomponentcatcodes \mutable\lettonothing\currentstructurecomponentcoding +\mutable\lettonothing\currentstructurecomponentcounter \mutable\lettonothing\currentstructurecomponentexpansion \mutable\lettonothing\currentstructurecomponentlabel \mutable\lettonothing\currentstructurecomponentlevel diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-flt.mklx b/Master/texmf-dist/tex/context/base/mkxl/strc-flt.mklx index 6af22631a80..b3f33734e35 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-flt.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-flt.mklx @@ -531,9 +531,9 @@ \def\strc_floats_apply_caption_command {\setbox\b_strc_floats_caption\hbox\bgroup - %\unless\ifcstok{\floatcaptionparameter\c!command}\emptytoks + %\unless\iftok{\floatcaptionparameter\c!command}\emptytoks \floatcaptionparameter\c!command{\box\b_strc_floats_caption}% - %\orunless\ifcstok{\floatcaptionparameter\c!deeptextcommand}\emptytoks + %\orunless\iftok{\floatcaptionparameter\c!deeptextcommand}\emptytoks % \floatcaptionparameter\c!deeptextcommand{\unvbox\b_strc_floats_caption}% %\else % \box\b_strc_floats_caption @@ -742,7 +742,7 @@ \edef\p_location {\floatcaptionparameter\c!location}% \edef\p_topoffset {\floatcaptionparameter\c!topoffset}% \edef\p_bottomoffset{\floatcaptionparameter\c!bottomoffset}% - \edef\P_freeregion {\floatcaptionparameter\c!freeregion}% + \edef\p_freeregion {\floatcaptionparameter\c!freeregion}% % preset \resetfloatcaptionparameter \c!location \setexpandedfloatcaptionparameter\c!topoffset {\floatparameter\c!topoffset}% @@ -778,7 +778,7 @@ \letfloatcaptionparameter\c!location \p_location \letfloatcaptionparameter\c!topoffset \p_topoffset \letfloatcaptionparameter\c!bottomoffset\p_bottomoffset - \letfloatcaptionparameter\c!freeregion \P_freeregion + \letfloatcaptionparameter\c!freeregion \p_freeregion % \strc_floats_analyze_location \doifelseinset\v!split\floatlocation\strc_floats_place_next_box_split\strc_floats_place_next_box_normal diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-itm.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-itm.lmt index f9153c98e8b..4ee084ca3b7 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-itm.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-itm.lmt @@ -6,20 +6,28 @@ if not modules then modules = { } end modules ['strc-itm'] = { license = "see context related readme files" } -local structures = structures -local itemgroups = structures.itemgroups -local jobpasses = job.passes - +local allocate = utilities.storage.allocate local implement = interfaces.implement -local setvariable = jobpasses.save -local getvariable = jobpasses.getfield - local texsetcount = tex.setcount local texsetdimen = tex.setdimen -local f_stamp = string.formatters["itemgroup:%s:%s"] -local counts = table.setmetatableindex("number") +local itemgroups = structures.itemgroups + +local collected = allocate() +local tobesaved = allocate() + +itemgroups.collected = collected +itemgroups.tobesaved = tobesaved + +local function initializer() + collected = itemgroups.collected + tobesaved = itemgroups.tobesaved +end + +if job then + job.register("structures.itemgroups.collected", tobesaved, initializer) +end local c_strc_itemgroups_max_items = tex.iscount("c_strc_itemgroups_max_items") local d_strc_itemgroups_max_width = tex.isdimen("d_strc_itemgroups_max_width") @@ -28,6 +36,8 @@ local d_strc_itemgroups_max_width = tex.isdimen("d_strc_itemgroups_max_width") -- an itemgroup which in turn makes for less passes when one itemgroup -- entry is added or removed. +local counts = table.setmetatableindex("number") + local trialtypesetting = context.trialtypesetting local function analyzeitemgroup(name,level) @@ -36,16 +46,37 @@ local function analyzeitemgroup(name,level) n = n + 1 counts[name] = n end - local stamp = f_stamp(name,n) - texsetcount(c_strc_itemgroups_max_items,getvariable(stamp,level,1,0)) - texsetdimen(d_strc_itemgroups_max_width,getvariable(stamp,level,2,0)) + local items = 0 + local width = 0 + local itemgroup = collected[name] + if itemgroup then + local entry = itemgroup[n] + if entry then + local l = entry[level] + if l then + items = l[1] or 0 + width = l[2] or 0 + end + end + end + texsetcount(c_strc_itemgroups_max_items,items) + texsetdimen(d_strc_itemgroups_max_width,width) end local function registeritemgroup(name,level,nofitems,maxwidth) local n = counts[name] if not trialtypesetting() then - -- no trialtypsetting - setvariable(f_stamp(name,n), { nofitems, maxwidth }, level) + local itemgroup = tobesaved[name] + if not itemgroup then + itemgroup = { } + tobesaved[name] = itemgroup + end + local entry = itemgroup[n] + if not entry then + entry = { } + itemgroup[n] = entry + end + entry[level] = { nofitems, maxwidth } elseif level == 1 then counts[name] = n - 1 end diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-itm.mklx b/Master/texmf-dist/tex/context/base/mkxl/strc-itm.mklx index 737580a274d..a7dda8fdd45 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-itm.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-itm.mklx @@ -1325,7 +1325,7 @@ \strc_itemgroups_stop_head_indeed \strc_itemgroups_head_body_indeed} -\protected\permanent\def\stopitemgrouphead +\permanent\protected\def\stopitemgrouphead {\dostoptagged \stopitemgroupitem} diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-lst.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-lst.lmt index b60b7520875..312a815cd88 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-lst.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-lst.lmt @@ -37,7 +37,8 @@ local conditionals = tex.conditionals local ctx_latelua = context.latelua -local cheat = true +----- cheat = true -- fragile when we have a multi-component document with cross references +local cheat = false -- so this will become a directive or maybe even just an experiment local structures = structures local lists = structures.lists @@ -259,27 +260,34 @@ function lists.addto(t) -- maybe more more here (saves parsing at the tex end) numberdata.numbers = cached[groupindex].numberdata.numbers end end - local setcomponent = references.setcomponent - if setcomponent then - setcomponent(t) -- can be inlined - end + -- +-- local setcomponent = references.setcomponent +-- if setcomponent then +-- setcomponent(t) -- can be inlined, will be replaced by setstructure below +-- end + -- local r = t.references - if r and not r.section then - r.section = structures.sections.currentid() - end - local b = r and t.block - if r and not b then - local s = r.section - if s then - s = structures.sections.tobesaved[s] - r.block = s and s.block or nil - end - end local i = r and r.internal or 0 -- brrr - if r and kind and name then - local tag = tags.getid(kind,name) - if tag and tag ~= "?" then - r.tag = tag -- todo: use internal ... is unique enough + if r then + if not r.section then + r.section = structures.sections.currentid() + end + if not r.structure then + r.structure = resolvers.jobs.currentstructure() + end + local b = r and t.block + if not b then + local s = r.section + if s then + s = structures.sections.tobesaved[s] + r.block = s and s.block or nil + end + end + if kind and name then + local tag = tags.getid(kind,name) + if tag and tag ~= "?" then + r.tag = tag -- todo: use internal ... is unique enough + end end end local p = pushed[i] @@ -597,7 +605,7 @@ filters[v_intro] = function(specification) return result end -filters[v_reference] = function(specification) +filters[v_reference] = function(specification) -- this will go away local collected = specification.collected local result = { } local nofresult = 0 @@ -954,7 +962,6 @@ filters[v_default] = function(specification) -- is named for i=1,#collected do local v = collected[i] local r = v.references --- inspect(v) if r and (not block or not r.block or pblock == r.block) then local sectionnumber = sections[r.section] if sectionnumber then @@ -1016,10 +1023,9 @@ function lists.process(specification) local references = listentry.references local special = specials and numberdata and specials[zerostrippedconcat(numberdata.numbers,".")] or "" local view = usedviews[i] - -- if cheat and references then - -- -- HH: I still need to test this patch: +-- if cheat and references and cheats[view] then if cheat and references and view and cheats[view] then - -- this permits runs=2 with interactivity + -- this permits runs=2 with interactivity local internal = references.internal usedinternals[internal] = true usedviews [internal] = references.view @@ -1571,7 +1577,7 @@ end function lists.integrate(utilitydata) local filename = utilitydata.comment.file - if filename then + if filename and filename ~= environment.jobname then local structures = utilitydata.structures if structures then local lists = structures.lists.collected or { } @@ -1591,6 +1597,12 @@ function lists.integrate(utilitydata) -- references.internal = nil -- references.realpage = nil -- references.section = nil + if references.view then + references.view = nil + end + if references.used then + references.used = nil + end if references.x then references.x = nil end diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-lst.mklx b/Master/texmf-dist/tex/context/base/mkxl/strc-lst.mklx index 6b8f2504f03..3fd0e979eb4 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-lst.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-lst.mklx @@ -1257,8 +1257,8 @@ \noindent % otherwise annotations are mirrored up \typo_injectors_mark_list \hbox \strc_lists_get_reference_attribute\v!all \strc_lists_get_destination_attribute { - \letlistparameter \c!depth\zeropoint - \resettlistparameter\c!color + \letlistparameter \c!depth\zeropoint + \resetlistparameter\c!color \inheritedlistframed { \letinteractionparameter\c!strut\v!no % still needed? \strc_lists_set_style_color\c!style\c!color\v!all @@ -1498,7 +1498,8 @@ \ifcsname\??listinteractions\p_interaction_forward\endcsname %\expandafter\let\expandafter\p_interaction_forward\csname\??listinteractions\p_interaction_forward\endcsname \expandafter\let\expandafter\p_interaction_forward\lastnamedcs - \ifcstok{\structurelistexternal}\emptytoks % luacall + %\ifcstok{\structurelistexternal}\emptytoks % luacall + \iftok{\structurelistexternal}\emptytoks % luacall \strc_references_get_simple_reference{internal(\currentlistentrylocation)}% \else % \writestatus{FAR OUT LIST}{\structurelistexternal::page(\number\structurelistrealpagenumber)}% diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-mar.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-mar.lmt index e5266daf0dc..61972009c95 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-mar.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-mar.lmt @@ -109,7 +109,7 @@ implement { } implement { - name = "getsynchronizedmarking", + name = "getsynchronizemarking", arguments = { "integer", "string", "string" }, actions = function(class,category,what) local category, n = lpegmatch(pattern,category) @@ -136,7 +136,7 @@ implement { } implement { - name = "resetsynchronizedmarking", + name = "resetsynchronizemarking", arguments = "argument", actions = function(category) local category, n = lpegmatch(pattern,category) diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-mar.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-mar.mkxl index 4c279f6dd6e..6dbb0e20771 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-mar.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-mar.mkxl @@ -169,7 +169,7 @@ \ifcstok{#2}\v!page \markingcommand{#1}{\csname\??markingfilter#3\endcsname{#1}}% \else - \markingcommand{#1}{\clf_getsynchronizedmarking\begincsname\??markingclass#1\endcsname{#2}{#3}}% + \markingcommand{#1}{\clf_getsynchronizemarking\begincsname\??markingclass#1\endcsname{#2}{#3}}% \fi \orelse\ifparameter#2\or \markingcommand{#1}{\csname\??markingfilter#2\endcsname{#1}}% @@ -208,7 +208,7 @@ \ifcstok{#2}\v!page \markingcommand{#1}{\begincsname\??markingfilter#3\endcsname{#1}}% \else - \markingcommand{#1}{\clf_getsynchronizedmarking{#1}{#2}}% + \markingcommand{#1}{\clf_getsynchronizemarking{#1}{#2}}% \fi \fi \fi} @@ -221,9 +221,9 @@ \markingseparator{#1}% \markingcommand{#1}{\begincsname\??markingfilter\v!last\endcsname{#1}}% \else - \markingcommand{#1}{\clf_getsynchronizedmarking{#1}\v!first}% + \markingcommand{#1}{\clf_getsynchronizemarking{#1}\v!first}% \markingseparator{#1}% - \markingcommand{#1}{\clf_getsynchronizedmarking{#1}\v!last}% + \markingcommand{#1}{\clf_getsynchronizemarking{#1}\v!last}% \fi \fi \fi} @@ -240,9 +240,9 @@ \else %\markingcommand{#1}{\begincsname\??markclass:\v!previous\endcsname{#1}}% %\markingseparator{#1}% - \markingcommand{#1}{\clf_getsynchronizedmarking{#1}\v!first}% + \markingcommand{#1}{\clf_getsynchronizemarking{#1}\v!first}% \markingseparator{#1}% - \markingcommand{#1}{\clf_getsynchronizedmarking{#1}\v!last}% + \markingcommand{#1}{\clf_getsynchronizemarking{#1}\v!last}% \fi \fi \fi} diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-mat.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-mat.mkxl index 2e6c21ad27f..6c639bb1f0f 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-mat.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-mat.mkxl @@ -1035,6 +1035,28 @@ \boundary\c_bndr_mathalign \fi} +% \tolerant\protected\def\strc_math_skip_here[#1]% +% {% no strut as it will influence fences +% \ifconditional\c_strc_math_trace_hang +% \strc_math_trace_okay{darkblue}{S #1}% +% \fi +% \scratchdimen\dimexpr\formulaparameter\c!textmargin\relax +% \ifchkdim#1\or +% \d_strc_math_hang_state#1% +% \orelse\ifchknum#1\or +% \d_strc_math_hang_state#1\scratchdimen +% \orelse\iftok{#1}{+}% +% \advanceby\d_strc_math_hang_state\scratchdimen +% \orelse\iftok{#1}{-}% +% \advanceby\d_strc_math_hang_state-\scratchdimen +% \else +% \d_strc_math_hang_state\scratchdimen +% \fi +% \kern\d_strc_math_hang_state +% \strc_math_pickup_again} + +\newboundary\c_bndr_skiphere + \tolerant\protected\def\strc_math_skip_here[#1]% {% no strut as it will influence fences \ifconditional\c_strc_math_trace_hang @@ -1052,6 +1074,7 @@ \else \d_strc_math_hang_state\scratchdimen \fi + \boundary\c_bndr_skiphere \kern\d_strc_math_hang_state \strc_math_pickup_again} diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-not.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-not.lmt index e05228b2b51..2c68cc5993f 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-not.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-not.lmt @@ -520,11 +520,13 @@ notes.check_spacing = check_spacing -- only notes, kind of hardcoded .. bah -callback.register("build_page_insert", function(index,slot) +local function action(index,slot) local state = notes.numbers[index] if state then return tonode(newgluespec(check_spacing(index,slot))) else return tonode(newgluespec()) end -end) +end + +callbacks.register("build_page_insert",action,"check spacing around inserts") diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-ref.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-ref.lmt index 26b1894753c..272e7e99298 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-ref.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-ref.lmt @@ -30,6 +30,7 @@ local trace_referencing = false trackers.register("structures.referencing", local trace_analyzing = false trackers.register("structures.referencing.analyzing", function(v) trace_analyzing = v end) local trace_identifying = false trackers.register("structures.referencing.identifying", function(v) trace_identifying = v end) local trace_importing = false trackers.register("structures.referencing.importing", function(v) trace_importing = v end) +local trace_external = false trackers.register("structures.referencing.external", function(v) trace_external = v end) local trace_empty = false trackers.register("structures.referencing.empty", function(v) trace_empty = v end) local check_duplicates = true @@ -39,6 +40,7 @@ directives.register("structures.referencing.checkduplicates", function(v) check_ local report_references = logs.reporter("references") local report_identifying = logs.reporter("references","identifying") local report_importing = logs.reporter("references","importing") +local report_external = logs.reporter("references","external") local report_empty = logs.reporter("references","empty") local report = report_references @@ -174,6 +176,11 @@ local function initializer() -- can we use a tobesaved as metatable for collecte if i then internals[i] = data usedinternals[i] = r.used + local structure = r.structure + if structure then + structure = resolvers.jobs.namelist(structure,namestack) + r.namestack = structure + end end end end @@ -347,33 +354,44 @@ local function currentorder(kind,name) return orders[kind] and orders[kind][name] or lastorder end -local function setcomponent(data) - -- we might consider doing this at the tex end, just like prefix - local component = productcomponent() - if component then - local references = data and data.references - if references then - references.component = component - if references.prefix == component then - references.prefix = nil - end - end - return component - end - -- but for the moment we do it here (experiment) -end +-- local function setstructure(data) +-- local structure = resolvers.jobs.currentnamehash() +-- if structure then +-- local references = data and data.references +-- if references then +-- references.structure = structure +-- end +-- end +-- end + +-- local function setcomponent(data) +-- -- we might consider doing this at the tex end, just like prefix +-- local component = productcomponent() -- todo: maybe a list +-- -- local component = resolvers.jobs.currentcomponent() +-- if component then +-- local references = data and data.references +-- if references then +-- references.component = component +-- if references.prefix == component then +-- references.prefix = nil +-- end +-- end +-- return component +-- end +-- end references.setnextorder = setnextorder references.setnextinternal = setnextinternal references.currentorder = currentorder -references.setcomponent = setcomponent +references.setstructure = resolvers.jobs.currentstructure -- yes or no here +----------.setcomponent = setcomponent + +implement { + name = "setnextreferenceorder", -- used in strc-enu + actions = setnextorder, + arguments = "2 strings", +} --- implement { --- name = "setnextreferenceorder", --- actions = setnextorder, --- arguments = "2 strings", --- } --- -- implement { -- name = "currentreferenceorder", -- actions = { currentorder, context }, @@ -405,6 +423,9 @@ function references.set(data) -- report_references("invalid reference") -- harmless return 0 end + -- + references.structure = resolvers.jobs.currentstructure() + -- local prefix = references.prefix or "" local pd = tobesaved[prefix] -- nicer is a metatable if not pd then @@ -497,31 +518,82 @@ implement { -- no metatable here .. better be sparse -local function register_from_list(collected,derived,external) +local function register_from_list(collected,derived,external,namestack) local derived_g = derived[""] -- global local derived_p = nil local derived_c = nil local prefix = nil - local component = nil +-- local component = nil local entry = nil if not derived_g then derived_g = { } derived[""] = derived_g end - local function action(s) - if trace_referencing then - report_references("list entry %a provides %a reference %a on realpage %a",i,kind,s,realpage) - end - if derived_p and not derived_p[s] then - derived_p[s] = entry - end - if derived_c and not derived_c[s] then - derived_c[s] = entry + local action = trace_external and + function(s) + if structure then + for i=1,#structure do + local si = structure[i] + -- if si == component then + -- -- skipped + -- elseif si == prefix then + -- -- skipped + -- else + local ds = derived[si] + if not ds then + derived[si] = { [s] = entry } + report_external("reference %a, %s %a",s,"structure",si) + elseif not ds[s] then + ds[s] = entry + report_external("reference %a, %s %a",s,"structure",si) + end + -- end + end + end + if derived_p and not derived_p[s] then + report_external("reference %a, %s %a",s,"prefix",prefix) + derived_p[s] = entry + + end +-- if derived_c and not derived_c[s] then +-- report_external("reference %a, %s %a",s,"component",component) +-- derived_c[s] = entry +-- end + if not derived_g[s] then + report_external("reference %a, %s %a",s,"global","") + derived_g[s] = entry -- first wins + end end - if not derived_g[s] then - derived_g[s] = entry -- first wins + or + function(s) + if derived_p and not derived_p[s] then + derived_p[s] = entry + end +-- if derived_c and not derived_c[s] then +-- derived_c[s] = entry +-- end + if not derived_g[s] then + derived_g[s] = entry -- first wins + end + if structure then + for i=1,#structure do + local si = structure[i] + if si == component then + -- skipped + elseif si == prefix then + -- skipped + else + local ds = derived[si] + if not ds then + derived[si] = { [s] = entry } + elseif not ds[s] then + ds[s] = entry + end + end + end + end end - end + -- for i=1,#collected do entry = collected[i] local metadata = entry.metadata @@ -535,20 +607,32 @@ local function register_from_list(collected,derived,external) local realpage = references.realpage if realpage then prefix = references.prefix - component = references.component +-- component = references.component if prefix and prefix ~= "" then derived_p = derived[prefix] if not derived_p then derived_p = { } derived[prefix] = derived_p end + else + derived_p = nil end - if component and component ~= "" and component ~= prefix then - derived_c = derived[component] - if not derived_c then - derived_c = { } - derived[component] = derived_c - end +-- if component and component ~= "" and component ~= prefix then +-- derived_c = derived[component] +-- if not derived_c then +-- derived_c = { } +-- derived[component] = derived_c +-- end +-- else +-- derived_c = nil +-- end + structure = references.structure + if structure then + structure = resolvers.jobs.namelist(structure,namestack) + references.namestack = structure + end + if trace_referencing or trace_external then + report_references("list entry %a provides %a reference %a on realpage %a",i,kind,reference,realpage) end process_settings(reference,action) end @@ -561,13 +645,13 @@ end function references.integrate(utilitydata) local filename = utilitydata.comment.file - if filename then + if filename and filename ~= environment.jobname then -- lists are already internalized local structures = utilitydata.structures if structures then local lists = structures.lists.collected if lists then - register_from_list(lists,derived,filename) + register_from_list(lists,derived,filename,utilitydata) end end end @@ -575,7 +659,7 @@ end references.registerinitializer(function() -- the main document - register_from_list(lists.collected,derived) + register_from_list(lists.collected,derived) -- false, false end) -- tracing @@ -652,10 +736,10 @@ end) -- urls -local urls = references.urls or { } -references.urls = urls -local urldata = urls.data or { } -urls.data = urldata +local urls = references.urls or { } +references.urls = urls +local urldata = urls.data or { } +urls.data = urldata local p_untexurl = Cs ( ( P("\\")/"" * (P("%")/"%%" + P(1)) @@ -1097,13 +1181,6 @@ local function loadexternalreferences(name,utilitydata) target = { } external[prefix] = target end - -- for s in gmatch(reference,"%s*([^,]+)") do - -- if trace_importing then - -- report_importing("registering %s reference, kind %a, name %a, prefix %a, reference %a", - -- "external",kind,name,prefix,s) - -- end - -- target[s] = target[s] or entry - -- end local function action(s) if trace_importing then report_importing("registering %s reference, kind %a, name %a, prefix %a, reference %a", @@ -1147,7 +1224,7 @@ setmetatableindex(externals, function(t,k) -- either or not automatically return false end) -local productdata = allocate { +local productdata = allocate { -- will go productreferences = { }, componentreferences = { }, components = { }, @@ -1196,6 +1273,13 @@ local function loadproductreferences(productname,componentname,utilitydata) if kind and realpage then local prefix = references.prefix or "" local component = references.component + + -- local structure = references.structure + -- print("!!!!!!!!",structure) + -- if structure then + -- inspect(resolvers.job.namelist(structure)) + -- end + local ctarget, ptarget if not component or component == componentname then -- skip @@ -1327,7 +1411,7 @@ function references.loadpresets(product,component) -- we can consider a special loadproductvariables (product,component,utilitydata) loadproductcomponents(product,component,utilitydata) loadproductreferences(product,component,utilitydata) --- loadproductcomponents(product,component,utilitydata) + -- loadproductcomponents(product,component,utilitydata) end end end @@ -1483,11 +1567,20 @@ end -- foo:bar -> foo == prefix (first we try the global one) -- -:bar -> ignore prefix -local function finish_inner(var,p,i) - var.kind = "inner" +local function finish_inner(set,var,p,i) + local external = i.references.external + local realpage = (i.references and i.references.realpage) or (i.pagedata and i.pagedata.realpage) or 1 + if external then + var.kind = "outer with inner" + var.external = true + var.outer = external + set.external = true -- probably not needed + else + var.kind = "inner" + var.p = p + end + var.r = realpage var.i = i - var.p = p - var.r = (i.references and i.references.realpage) or (i.pagedata and i.pagedata.realpage) or 1 return var end @@ -1506,7 +1599,7 @@ local function identify_inner(set,var,prefix,collected,derived) if i then i = i[splitinner] if i then - return finish_inner(var,"",i) + return finish_inner(set,var,"",i) end end end @@ -1514,7 +1607,7 @@ local function identify_inner(set,var,prefix,collected,derived) if i then i = i[splitinner] if i then - return finish_inner(var,splitprefix,i) + return finish_inner(set,var,splitprefix,i) end end if derived then @@ -1522,11 +1615,13 @@ local function identify_inner(set,var,prefix,collected,derived) -- using the prefix that is active at this moment (so we overload the given -- these are taken from other data structures (like lists) if splitprefix == "-" then +-- loop over the current structure list reversed +-- and end with "" .. needs example local i = derived[""] if i then i = i[splitinner] if i then - return finish_inner(var,"",i) + return finish_inner(set,var,"",i) end end end @@ -1534,7 +1629,7 @@ local function identify_inner(set,var,prefix,collected,derived) if i then i = i[splitinner] if i then - return finish_inner(var,splitprefix,i) + return finish_inner(set,var,splitprefix,i) end end end @@ -1545,7 +1640,7 @@ local function identify_inner(set,var,prefix,collected,derived) if i then i = i[inner] if i then - return finish_inner(var,prefix,i) + return finish_inner(set,var,prefix,i) end end if not i and derived then @@ -1554,7 +1649,22 @@ local function identify_inner(set,var,prefix,collected,derived) if i then i = i[inner] if i then - return finish_inner(var,prefix,i) + return finish_inner(set,var,prefix,i) + end + end + -- + local n, list = resolvers.jobs.currentstructure() + if list then + for i=#list,1,-1 do + local l = list[i] + local i = derived[l] + if i then + i = i[inner] + if i then + -- return finish_inner(set,var,"",i) + return finish_inner(set,var,l,i) + end + end end end end @@ -1571,10 +1681,7 @@ local function unprefixed_inner(set,var,prefix,collected,derived,tobesaved) (derived and derived [""] and derived [""][inner]) or (tobesaved and tobesaved[""] and tobesaved[""][inner]) if i then - var.kind = "inner" - var.p = "" - var.i = i - var.r = (i.references and i.references.realpage) or (i.pagedata and i.pagedata.realpage) or 1 + finish_inner(set,var,"",i) else var.error = "unknown inner or special" end @@ -1611,13 +1718,13 @@ local function identify_auto(set,var,i) end end -- escape from prefix --- local pdata = odata[""] --- if pdata then --- local r = pdata[inner] --- if r then --- return okay(o,"2h") --- end --- end + -- local pdata = odata[""] + -- if pdata then + -- local r = pdata[inner] + -- if r then + -- return okay(o,"2h") + -- end + -- end else for p, pdata in sortedhash(odata) do local r = pdata[inner] @@ -1765,7 +1872,6 @@ end local function identify_inner_or_outer(set,var,i) -- here we fall back on product data local inner = var.inner - if inner and inner ~= "" then -- first we look up in collected and derived using the current prefix @@ -1780,7 +1886,8 @@ local function identify_inner_or_outer(set,var,i) return v end - if var.inner == var.reference and identify_auto(set,var,i) and var.outer and var.outer ~= "" then +-- if var.inner == var.reference and identify_auto(set,var,i) and var.outer and var.outer ~= "" then + if var.inner == var.reference and var.outer and var.outer ~= "" then return identify_outer(set,var,i) end @@ -1804,7 +1911,6 @@ local function identify_inner_or_outer(set,var,i) end -- as a last resort we will consult the global lists - local v = unprefixed_inner(set,var,"",collected,derived,tobesaved) if v then if trace_identifying then @@ -1873,6 +1979,7 @@ local function identify_inner_or_outer(set,var,i) end end end + var.error = "unknown inner" else var.error = "no inner" @@ -1896,40 +2003,51 @@ local function identify_inner_component(set,var,i) return var end +local function identify_outer_component_step(set,var,vi,i,component,where) + if vi then + var.outer = component + var.i = vi + var.kind = "outer with inner" + set.external = true + if trace_identifying then + report_identify_outer(set,var,i,where) + end + return true + end +end + local function identify_outer_component(set,var,i) local component = var.component - local inner = var.inner + local inner = var.inner + -- local data = productdata.componentreferences[component] if data then local d = data[""] - local vi = d and d[inner] - if vi then - var.inner = inner - var.outer = component - var.i = vi - var.kind = "outer with inner" - set.external = true - if trace_identifying then - report_identify_outer(set,var,i,"6a") - end + local d = d and d[inner] + if d and identify_outer_component_step(set,var,d,i,component,"6a") then return var end end + -- local data = productdata.productreferences[component] if data then - local vi = data[inner] - if vi then - var.inner = inner - var.outer = component - var.i = vi - var.kind = "outer with inner" - set.external = true - if trace_identifying then - report_identify_outer(set,var,i,"6b") - end + local d = data[inner] + if d and identify_outer_component_step(set,var,d,i,component,"6b") then + return var + end + end + -- +if texconditionals.autocrossfilereferences then + references.loadpresets(component,component) + local data = productdata.productreferences[component] + if data then + local d = data[inner] + if d and identify_outer_component_step(set,var,d,i,component,"6c") then return var end end +end + -- var.error = "unknown component" if trace_identifying then report_identify_outer(set,var,i,"6c") @@ -1962,6 +2080,8 @@ local function identify(prefix,reference) var = identify_outer(set,var,i) elseif var.arguments then var = identify_arguments(set,var,i) +-- else +-- var = identify_inner_or_outer(set,var,i) elseif not var.component then var = identify_inner_or_outer(set,var,i) elseif productcomponent() then @@ -2364,6 +2484,7 @@ local function filterreference(name,prefixspec,numberspec) -- number page title if data then if name == "realpage" then local cs = references.analyze() -- normally already analyzed but also sets state + -- or just get from references.realpage when present context(tonumber(cs.realpage) or 0) else -- assumes data is table local kind = false @@ -2399,6 +2520,26 @@ local function filterreferencedefault() return filterreference("default",getcurrentprefixspec("default")) end +local function getreferencesectionnumber(reference) + if references.valid("",reference,{},false) then + local data = currentreference and currentreference.i + if type(data) == "table" then + local metadata = data.metadata + if metadata and metadata.kind == "section" then + local numberdata = data.numberdata + if numberdata then + numberdata = numberdata.numbers + context(numberdata[#numberdata] or 0) + return + end + end + elseif trace_referencing then + report_references("name %a, no reference",reference) + end + end + context(0) +end + references.filter = filterreference references.filterdefault = filterreferencedefault @@ -2418,6 +2559,13 @@ implement { } } +implement { + name = "getreferencesectionnumber", + actions = getreferencesectionnumber, + arguments = "string", + public = true, +} + function genericfilters.title(data) if data then local titledata = data.titledata or data.useddata @@ -2691,6 +2839,7 @@ function references.analyze(actions,position,spread) actions.pagestate = checkedpagestate(actions.n,realpage,actions,position,spread) end end +-- inspect(actions) return actions end @@ -2698,6 +2847,8 @@ local function referencepagestate(position,detail,spread) local actions = references.currentset if not actions then return 0 + elseif actions.external then + return 0 else local pagestate = actions.pagestate for i=1,#actions do @@ -3067,3 +3218,32 @@ implement { name = "popreferenceprefix", actions = { popreferenceprefix, context }, -- we can use setmacro } + +-- a bit weird one, used for checkinh in the backend + +function references.pagefromhash(hash,destination,page,actions) + local r = actions[1] + if type(r) == "table" then + r = r.i + if r then + r = r.references + if r then + local structure = r.structure + if structure then + local namestack = r.namestack + if namestack then + for i=#namestack,1,-1 do + local d = namestack[i] .. ":" .. destination + page = hash[d] + if page then + destination = d + break + end + end + end + end + end + end + end + return page, destination +end diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-ref.mklx b/Master/texmf-dist/tex/context/base/mkxl/strc-ref.mklx index a1b6ac22d45..8619d084e74 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-ref.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-ref.mklx @@ -994,6 +994,8 @@ \aliased\let\from \strc_references_from \to \everydump +% can be defined visible at lua end + \permanent \def\filterreference #key{\clf_filterreference{#key}} % no checking, expandable \permanent\protected\def\getreferenceentry#key{\clf_filterreference{#key}} % no checking, not expandable @@ -1005,7 +1007,6 @@ \permanent\def\currentreferencerealpage{\clf_filterreference{realpage}} \aliased \let\currentreferenceorder \getinternalorderreference - %D The most straightforward way of retrieving references is using \type {\ref}. \permanent\tolerant\protected\def\getreference[#key]#spacer[#label]% #key = number page title text default realpage ... @@ -1017,6 +1018,25 @@ \aliased\let\ref\getreference +% setnumber-001.tex +% +% \starttext +% \chapter[one]{One} see setnumber-002 +% \chapter[two]{Two} see setnumber-002 +% \stoptext +% +% setnumber-002.tex +% +% \setupreferencing[autofile=yes] +% \useexternaldocument[foo] [setnumber-001] [{TEST 1}] +% \setupheadnumber[chapter][\getreferencesectionnumber{foo::two}] +% \starttext +% \chapter[three]{Three} from setnumber-001, one: \getreferencesectionnumber{foo::one}\par +% \chapter[four] {Four} from setnumber-001, two: \getreferencesectionnumber{foo::two}\par +% \stoptext +% +% \getreferencesectionnumber{reference} : defined at the lua end + %D Special cases: \permanent\protected\def\strc_references_about[#label]% diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-reg.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-reg.lmt index b66b229212c..6affc02f89c 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-reg.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-reg.lmt @@ -536,7 +536,13 @@ local function preprocessentries(rawdata) end local seeword = rawdata.seeword if seeword then - seeword.processor, seeword.text = splitprocessor(seeword.text or "") + local text = seeword.text or "" + local sp, st = splitprocessor(text) + seeword.text = text + -- seeword.list = lpegmatch(coding == "xml" and entrysplitter_xml or entrysplitter_tex,st) + if sp then + seeword.processor = sp + end end end @@ -585,8 +591,10 @@ local function storeregister(rawdata) -- metadata, references, entries rawdata.userdata = touserdata(userdata) end -- - references.section = currentid() - metadata.level = currentlevel() + references.block = structures.sections.currentblock() + references.structure = resolvers.jobs.currentstructure() + references.section = currentid() + metadata.level = currentlevel() -- local data = notsaved and collected[name] or tobesaved[name] local entries = data.entries @@ -1045,6 +1053,7 @@ function registers.use(tag,filename,class,prefix) filename = filename, data = job.loadother(filename), prefix = prefix or class, + label = prefix or class, } end @@ -1054,13 +1063,43 @@ implement { actions = registers.use, } +-- function registers.use(tag,specification) +-- local class = specification.class +-- local filename = specification.filename +-- local prefix = specification.prefix or class +-- local label = specification.label or prefix +-- if class and filename then +-- used[tag] = { +-- class = class, +-- filename = filename, +-- data = job.loadother(filename), +-- prefix = prefix, +-- label = label, +-- } +-- end +-- end + +-- implement { +-- name = "useregister", +-- actions = registers.use, +-- arguments = { +-- "string", +-- { +-- { "filename" }, +-- { "class" }, +-- { "prefix" }, +-- { "label" }, +-- }, +-- } +-- } + implement { - name = "registerprefix", + name = "registerlabel", arguments = "string", actions = function(tag) local u = used[tag] if u then - context(u.prefix) + context(u.label) end end } @@ -1075,7 +1114,13 @@ local function analyzeregister(class,options) local list = utilities.parsers.settings_to_array(class) local entries = { } local nofentries = 0 - local metadata = false + local multiple = false + for i=1,#list do + if used[list[i]] then + multiple = true + break + end + end for i=1,#list do local l = list[i] local u = used[l] @@ -1089,16 +1134,26 @@ local function analyzeregister(class,options) end if d then local e = d.entries - local u = u and { u.prefix } or nil +-- local u = u and { u.prefix } or nil +local u = multiple and { string.formatters["%03i"](i) } or nil -- maybe prefix but then how about main for i=1,#e do + -- see has no pagedata local ei = e[i] + local external = ei.external +if multiple and ei.metadata.kind == "see" and external then + -- too messy, could be an option but useless +else + nofentries = nofentries + 1 entries[nofentries] = ei if u then local eil = ei.list eil[#eil+1] = u +if external then ei.external = l -- this is the (current) abstract tag, used for prefix +end end +end end if not metadata then metadata = d.metadata @@ -1107,9 +1162,11 @@ local function analyzeregister(class,options) end data = { metadata = metadata or { }, + multiple = multiple, entries = entries, } collected[class] = data + options.multiple = multiple end if data and data.entries then options = options or { } @@ -1322,7 +1379,9 @@ function registers.flush(data,options,prefixspec,pagespec) -- report_registers("invalid see entry in register %a, reference %a",entry.metadata.name,list[1][1]) end end - if entry.external then +-- move up ? +-- if entry.external then + if options.multiple or entry.external then local list = entry.list list[#list] = nil end @@ -1538,6 +1597,10 @@ function registers.flush(data,options,prefixspec,pagespec) local seetext = seeword.text or "" local processor = seeword.processor or (entry.processors and entry.processors[1]) or "" local seeindex = entry.external or entry.references.seeindex or "" + local seelist = lpegmatch(coding == "xml" and entrysplitter_xml or entrysplitter_tex,seetext) + if #seelist > 1 then + seetext = concat(seelist,", ") + end ctx_registerseeword( metadata.name or "", i, @@ -1741,7 +1804,7 @@ interfaces.implement { function registers.integrate(utilitydata) local filename = utilitydata.comment.file - if filename then + if filename and filename ~= environment.jobname then local structures = utilitydata.structures if structures then local registers = structures.registers.collected or { } @@ -1772,6 +1835,7 @@ function registers.integrate(utilitydata) end references.external = filename -- not really needed end + entry.external = true end end end diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-reg.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-reg.mkxl index afe3d27a09c..7dd07b2e261 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-reg.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-reg.mkxl @@ -155,16 +155,17 @@ \mutable\lettonothing\currentregisternumber \mutable\lettonothing\currentregisterownnumber \mutable\lettonothing\currentregisterpageindex +\mutable\lettonothing\currentregisterpageprefix \mutable\lettonothing\currentregisterpagesymbol +\mutable\lettonothing\currentregisterprocessors +\mutable\lettonothing\currentregisterprocessorsa +\mutable\lettonothing\currentregisterprocessorsb +\mutable\lettonothing\currentregisterprocessorsc \mutable\lettonothing\currentregistersectionindex \mutable\lettonothing\currentregisterseeindex \mutable\lettonothing\currentregisterseeword \mutable\lettonothing\currentregistersynchronize \mutable\lettonothing\currentregisterxmlsetup -\mutable\lettonothing\currentregisterprocessors -\mutable\lettonothing\currentregisterprocessorsa -\mutable\lettonothing\currentregisterprocessorsb -\mutable\lettonothing\currentregisterprocessorsc \newconditional\c_strc_registers_defining \setnewconstant\c_strc_registers_maxlevel \plusfive @@ -792,6 +793,25 @@ {\doifelsefiledefined{#1}{}{\usefile[#1][#2]}% \clf_useregister{#1}{#2}{#3}{#4}} +% \permanent\protected\tolerant\def\useregister[#1]#*[#2]#*[#3]#*[#4]% tag file class prefix +% {\begingroup +% \doifelsefiledefined{#1}{}{\usefile[#1][#2]}% +% \ifhastok={#4}% +% \getdummyparameters[\c!prefix=#1,\c!label=#1,#4]% +% \else +% \getdummyparameters[\c!prefix=#4,\c!label=#4]% +% \fi +% \clf_useregister +% {#1} +% { +% filename {#2} +% class {#3} +% prefix {\dummyparameter\c!prefix} +% label {\dummyparameter\c!label} +% } +% \relax +% \endgroup} + %D Character rendering (sections): \installcorenamespace{registerindicator} @@ -975,6 +995,8 @@ \setfalse\settrue\c_strc_registers_vertical \to \everysetupregister +\mutable\lettonothing\currentnestedregister + \permanent\protected\def\usenestedregisterstyleandcolor#1#2% will change {\useregisterstyleandcolor#1#2% % how about style @@ -1123,15 +1145,16 @@ % todo: adapt \strc_references_goto_internal to take an extra argument, the ref \permanent\protected\def\withregisterpagecommand#1#2#3#4% #1:processor #2:internal #3:realpage #4:page - {\ifcase#3\relax - {\tt [entry\space not\space flushed]}% + {\begingroup + \ifcase#3\relax + \tt [entry\space not\space flushed]% \else \def\currentregisterpageindex{#2}% \def\currentregisterrealpage{#3}% \ifchknum\currentregisterpageindex\or \lettonothing\currentregisterpageprefix \else - \def\currentregisterpageprefix{\clf_registerprefix{\currentregisterpageindex}}% + \def\currentregisterpageprefix{\clf_registerlabel{\currentregisterpageindex}}% \fi \iflocation \ifempty\currentregisterpageprefix @@ -1144,7 +1167,8 @@ \setlocationattributes \fi \applyprocessor{#1}{\currentregisterpageprefix\registerparameter\c!pagecommand{#4}}% - \fi} + \fi + \endgroup} \lettonothing\m_current_register @@ -1281,7 +1305,7 @@ \ifchknum\currentregisterseeindex\or \lettonothing\currentregisterpageprefix \else - \def\currentregisterpageprefix{\clf_registerprefix{\currentregisterseeindex}}% + \def\currentregisterpageprefix{\clf_registerlabel{\currentregisterseeindex}}% \fi \iflocation \ifempty\currentregisterpageprefix diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-sec.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-sec.mkxl index 227d24704dc..db100f0dde3 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-sec.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-sec.mkxl @@ -704,7 +704,8 @@ \ifcsname\??headincrement\currentheadincrement\endcsname \lastnamedcs \else - \settrue \c_strc_sectioning_increment\settrue \c_strc_sectioning_to_list + \settrue\c_strc_sectioning_increment + \settrue\c_strc_sectioning_to_list % \filterheadnumber \fi} diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-syn.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-syn.mkxl index 9b4c37ceb53..9b4d410e123 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/strc-syn.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/strc-syn.mkxl @@ -266,6 +266,7 @@ \mutable\lettonothing\currentsynonym \mutable\lettonothing\currentsynonymtag \mutable\lettonothing\currentsynonymtext +\mutable\lettonothing\currentsynonymsortkey \permanent\tolerant\protected\def\definesynonyms[#1]#*[#2]#*[#3]#*[#4]% name plural \meaning \use {\ifnum\lastarguments=\plusfour @@ -626,7 +627,6 @@ \permanent\protected\def\currentsortingname {\clf_synonymname\currentsimplelist\currentsortingtag} \permanent\protected\def\currentsortingpages {\clf_synonympages\currentsimplelist\currentsortingtag} \permanent\protected\def\doifelsecurrentsortingused {\clf_doifelsesynonymused\currentsimplelist\currentsortingtag} -\permanent\protected\def\resetusedsortings [#1]{\clf_resetusedsynonyms{#1}} \permanent\protected\def\sortingname [#1]#*[#2]{\clf_synonymname {#1}{#2}} \permanent\protected\def\sortingpages[#1]#*[#2]{\clf_synonympages{#1}{#2}} diff --git a/Master/texmf-dist/tex/context/base/mkxl/supp-box.lmt b/Master/texmf-dist/tex/context/base/mkxl/supp-box.lmt index a5bfe139452..a26f77ae20e 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/supp-box.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/supp-box.lmt @@ -481,9 +481,9 @@ local doifelse = commands.doifelse do - local dirvalues = nodes.dirvalues - local lefttoright_code = dirvalues.lefttoright - local righttoleft_code = dirvalues.righttoleft + local directioncodes = tex.directioncodes + local lefttoright_code = directioncodes.lefttoright + local righttoleft_code = directioncodes.righttoleft local function firstdirinbox(n) local b = getbox(n) @@ -1395,6 +1395,8 @@ do actions = boxlinecount, } + -- todoL: just inline so that s-system-macros can find them + define_one("boxline", "get") define_one("setboxline", "set") define_one("copyboxline", "copy") diff --git a/Master/texmf-dist/tex/context/base/mkxl/symb-emj.lmt b/Master/texmf-dist/tex/context/base/mkxl/symb-emj.lmt index b043d835df8..1bcb237f635 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/symb-emj.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/symb-emj.lmt @@ -6,8 +6,6 @@ if not modules then modules = { } end modules ['symb-emj'] = { license = "see context related readme files" } --- processors.hpack_filter does it all - local symbols = fonts.symbols local resolvedemoji = characters.emoji.resolve diff --git a/Master/texmf-dist/tex/context/base/mkxl/syst-aux.mkxl b/Master/texmf-dist/tex/context/base/mkxl/syst-aux.mkxl index 2b87f4b3d45..58678f9f3c5 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/syst-aux.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/syst-aux.mkxl @@ -587,7 +587,7 @@ % or (test this): % % \permanent\protected\def\processallactionsinset[#1]% -% {\ifcstok{#1}\emptytoks +% {\iftok{#1}\emptytoks % \expandafter\processaction % \else % \expandafter\syst_helpers_process_all_actions_in_set_indeed @@ -6854,6 +6854,8 @@ %D %D \typebuffer \startpacked \getbuffer \stoppacked +\lettonothing\syst_helpers_wipe_tokens_yes + \def\syst_helpers_wipe_tokens_nop#-^^04{}% \permanent\def\wipetokens#1#2% diff --git a/Master/texmf-dist/tex/context/base/mkxl/syst-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/syst-ini.mkxl index 2b37e30c622..d55a821758d 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/syst-ini.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/syst-ini.mkxl @@ -322,6 +322,7 @@ \permanent\countdef\c_syst_max_allocated_toks = 216 \c_syst_max_allocated_toks = \directlua{tex.write(tex.magicconstants.max_toks_register_index)} % idem \permanent\countdef\c_syst_max_allocated_read = 217 \c_syst_max_allocated_read = \c_syst_max_allocated_iohandle \permanent\countdef\c_syst_max_allocated_write = 218 \c_syst_max_allocated_write = \c_syst_max_allocated_iohandle +\permanent\countdef\c_syst_max_allocated_float = 220 \c_syst_max_allocated_float = \directlua{tex.write(tex.magicconstants.max_float_register_index or 0)} % idem \permanent\countdef\c_syst_last_allocated_count = 221 \c_syst_last_allocated_count = \c_syst_min_allocated_register \permanent\countdef\c_syst_last_allocated_dimen = 222 \c_syst_last_allocated_dimen = \c_syst_min_allocated_register @@ -332,6 +333,7 @@ \permanent\countdef\c_syst_last_allocated_read = 227 \c_syst_last_allocated_read = \c_syst_min_allocated_iohandle \permanent\countdef\c_syst_last_allocated_write = 228 \c_syst_last_allocated_write = \c_syst_min_allocated_iohandle \permanent\countdef\c_syst_last_allocated_marks = 229 \c_syst_last_allocated_marks = \c_syst_min_allocated_mark +\permanent\countdef\c_syst_last_allocated_float = 230 \c_syst_last_allocated_float = \c_syst_min_allocated_register \permanent\countdef\c_syst_min_counter_value = 253 \c_syst_min_counter_value = -"7FFFFFFF \permanent\countdef\c_syst_max_counter_value = 254 \c_syst_max_counter_value = "7FFFFFFF @@ -358,6 +360,7 @@ \permanent\protected\def\newdimension #1{\dimensiondef #1\zeropoint} \permanent\protected\def\newgluespec #1{\gluespecdef #1\zeropoint} \permanent\protected\def\newmugluespec#1{\mugluespecdef#1\zeropoint} +\permanent\protected\def\newposit #1{\positdef #1\zerocount} %D The aliasing here is tricky: we need to make sure the alias is not let to the %D current value but behaves dynamic. Instead we can use just \newcount, unless of @@ -366,6 +369,7 @@ \protected\def\aliasinteger #1#2{\untraced\protected\def#1{#2}}% name parent \protected\def\aliasdimension#1#2{\untraced\protected\def#1{#2}}% name parent +\protected\def\aliasposit #1#2{\untraced\protected\def#1{#2}}% name parent %D So, effectively we start allocating from 256 and upwards. The inserts sit in the %D range 128 upto 254. Page numbers use the counters 0 upto 9 and the pagebox is @@ -386,6 +390,7 @@ \permanent\protected\def\newread {\syst_basics_allocate\c_syst_last_allocated_read \read \integerdef\c_syst_max_allocated_read} \permanent\protected\def\newwrite {\syst_basics_allocate\c_syst_last_allocated_write \write \integerdef\c_syst_max_allocated_write} \permanent\protected\def\newmarks {\syst_basics_allocate\c_syst_last_allocated_marks \marks \integerdef\c_syst_max_allocated_mark} +\permanent\protected\def\newfloat {\syst_basics_allocate\c_syst_last_allocated_float \float \floatdef \c_syst_max_allocated_float} \firstvalidlanguage \plusone % so zero is ignored in hyphenation, this might become the default @@ -1308,7 +1313,7 @@ \endlocalcontrol #2} -\permanent\protected\def\suggestedalias#1#2% +\permanent\protected\def\suggestedalias#1#2% old new {\ifflags#2\permanent\permanent\fi % the rest is taken with the copy \def#1{\syst_suggested_alias#1#2}} diff --git a/Master/texmf-dist/tex/context/base/mkxl/syst-lua.lmt b/Master/texmf-dist/tex/context/base/mkxl/syst-lua.lmt index d8e06d4fd2f..0f80f57d3e7 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/syst-lua.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/syst-lua.lmt @@ -58,6 +58,9 @@ local ctx_secondoftwoarguments = context.secondoftwoarguments local ctx_firstofoneargument = context.firstofoneargument local ctx_gobbleoneargument = context.gobbleoneargument +local values = tokens.values +local boolean_code = values.boolean + implement { -- will be overloaded later name = "writestatus", arguments = "2 arguments", @@ -309,6 +312,21 @@ end do + interfaces.implement { + name = "iflua", + public = true, + usage = "condition", + arguments = "string", + actions = function(s) + local c = load("return(" .. s .. ")") + return boolean_code, (c and c()) and true or false + end, + } + +end + +do + -- This is some 20% slower than native but we only provide this for compatibility -- reasons so we don't care that much about it. Eventually we can drop the built-in -- method. diff --git a/Master/texmf-dist/tex/context/base/mkxl/tabl-com.mkxl b/Master/texmf-dist/tex/context/base/mkxl/tabl-com.mkxl index d8eb7ada7eb..8621d2f6223 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/tabl-com.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/tabl-com.mkxl @@ -49,6 +49,7 @@ \permanent\protected\lettonothing\BH \permanent\protected\lettonothing\BL \permanent\protected\lettonothing\BR +\permanent\protected\lettonothing\BT \permanent\protected\lettonothing\CC \permanent\protected\lettonothing\CL \permanent\protected\lettonothing\CM @@ -68,6 +69,8 @@ \permanent\protected\lettonothing\HL \permanent\protected\lettonothing\HQ \permanent\protected\lettonothing\HR +\permanent\protected\lettonothing\HF +\permanent\protected\lettonothing\HLHL \permanent\protected\lettonothing\LB \permanent\protected\lettonothing\LC \permanent\protected\lettonothing\LT @@ -94,9 +97,13 @@ \permanent\protected\lettonothing\SM \permanent\protected\lettonothing\SR \permanent\protected\lettonothing\TB +\permanent\protected\lettonothing\TC \permanent\protected\lettonothing\TL +\permanent\protected\lettonothing\TM \permanent\protected\lettonothing\TR +\permanent\protected\lettonothing\TT \permanent\protected\lettonothing\VL +\permanent\protected\lettonothing\VLVL \permanent\protected\lettonothing\VC \permanent\protected\lettonothing\VD \permanent\protected\lettonothing\VN diff --git a/Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.mkxl b/Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.mkxl index 414a04f3a1b..b82dcb585e3 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.mkxl @@ -1634,13 +1634,22 @@ % enabled per 2018-02-22 -\def\tabl_ntb_table_get_max_width_step - {\advanceby\scratchdimen\tabl_ntb_get_wid\fastloopindex - \advanceby\scratchdimen\tabl_ntb_get_dis\fastloopindex} +% \def\tabl_ntb_table_get_max_width_step +% {\advanceby\scratchdimen\tabl_ntb_get_wid\fastloopindex +% \advanceby\scratchdimen\tabl_ntb_get_dis\fastloopindex} +% +% \def\tabl_ntb_table_get_max_width +% {\scratchdimen\zeropoint +% \dofastloopcs\c_tabl_ntb_maximum_col\tabl_ntb_table_get_max_width_step +% \ifdim\scratchdimen<\wd\scratchbox\relax +% \scratchdimen\wd\scratchbox\relax +% \fi} \def\tabl_ntb_table_get_max_width {\scratchdimen\zeropoint - \dofastloopcs\c_tabl_ntb_maximum_col\tabl_ntb_table_get_max_width_step + \localcontrolledloop\zerocount\c_tabl_ntb_maximum_col\plusone + {\advanceby\scratchdimen\tabl_ntb_get_wid\currentloopiterator + \advanceby\scratchdimen\tabl_ntb_get_dis\currentloopiterator}% \ifdim\scratchdimen<\wd\scratchbox\relax \scratchdimen\wd\scratchbox\relax \fi} @@ -2377,7 +2386,7 @@ \tabl_ntb_section_disable} \tolerant\permanent\protected\def\bTABLEsection[#1]% - {\ifempty{#1}% + {\iftok{#1}\emptytoks \global\c_tabl_ntb_section_repeat\zerocount \else \letdummyparameter\c!repeat\zerocount diff --git a/Master/texmf-dist/tex/context/base/mkxl/tabl-tab.mkxl b/Master/texmf-dist/tex/context/base/mkxl/tabl-tab.mkxl index 8c872cd477b..ff0d201cfd7 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/tabl-tab.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/tabl-tab.mkxl @@ -58,7 +58,7 @@ \tabl_table_restore_lineskips \normalbaselines % \enforced\let~\fixedspace -` \enforced\letcharcode\tildeasciicode\fixedspace % why + \enforced\letcharcode\tildeasciicode\fixedspace % why \inhibitblank % \blank[\v!disable]% % added \the\everytableparbox} @@ -504,7 +504,7 @@ % Key "M": Displaymath mode. \newtableformatkey M% - {\doreadtableformatkeys \{ b{\normalstartimath\displaystyle} a{\normalstopimath}} + {\doreadtableformatkeys \{ b{\normalstartimath\forcedisplaymath} a{\normalstopimath}} % Key "\m": Template ${}#\hfil$ diff --git a/Master/texmf-dist/tex/context/base/mkxl/tabl-tbl.mkxl b/Master/texmf-dist/tex/context/base/mkxl/tabl-tbl.mkxl index 6c4c3fd47a1..b2e4f50908a 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/tabl-tbl.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/tabl-tbl.mkxl @@ -589,7 +589,7 @@ \installtabulatepreambleoption{m}{\t_tabl_tabulate_bmath{\normalstartimath}% \t_tabl_tabulate_emath{\normalstopimath}% \tabl_tabulate_set_preamble} -\installtabulatepreambleoption{M}{\t_tabl_tabulate_bmath{\normalstartimath\displaystyle}% +\installtabulatepreambleoption{M}{\t_tabl_tabulate_bmath{\normalstartimath\forcedisplaymath}% \t_tabl_tabulate_emath{\normalstopimath}% \tabl_tabulate_set_preamble} \installtabulatepreambleoption{h}{\tabl_tabulate_set_hook} @@ -791,6 +791,7 @@ \defcsname\??tabulatewidth\v!auto\endcsname {\c_tabl_tabulate_modus\plusthree\settrue\c_tabl_tabulate_reshape} +\lettonothing\tabl_tabulate_hook_box \lettonothing\tabl_tabulate_hook_box_begin \lettonothing\tabl_tabulate_hook_box_end @@ -1608,13 +1609,19 @@ \tabl_tabulate_vrule_reset_indeed \fi} +% \def\tabl_tabulate_vrule_reset_indeed +% {\gletcsname\??tabulatevrule0\endcsname\undefined +% \dofastloopcs\c_tabl_tabulate_max_vrulecolumn\tabl_tabulate_vrule_reset_step +% \global\c_tabl_tabulate_max_vrulecolumn\zerocount} +% +% \def\tabl_tabulate_vrule_reset_step % undefined or relax +% {\gletcsname\??tabulatevrule\the\fastloopindex\endcsname\undefined} + \def\tabl_tabulate_vrule_reset_indeed - {\dofastloopcs\c_tabl_tabulate_max_vrulecolumn\tabl_tabulate_vrule_reset_step + {\localcontrolledloop\zerocount\c_tabl_tabulate_max_vrulecolumn\plusone % start at 0 + {\gletcsname\??tabulatevrule\the\currentloopiterator\endcsname\undefined}% \global\c_tabl_tabulate_max_vrulecolumn\zerocount} -\def\tabl_tabulate_vrule_reset_step % undefined or relax - {\gletcsname\??tabulatevrule\the\fastloopindex\endcsname\undefined} - \appendtoks \tabl_tabulate_vrule_reset \to \t_tabl_tabulate_every_after_row @@ -1798,11 +1805,16 @@ \tabl_tabulate_color_reset_indeed \fi} -\def\tabl_tabulate_color_reset_indeed - {\dofastloopcs\c_tabl_tabulate_max_colorcolumn\tabl_tabulate_color_reset_step} +% \def\tabl_tabulate_color_reset_indeed +% {\dofastloopcs\c_tabl_tabulate_max_colorcolumn\tabl_tabulate_color_reset_step} +% +% \def\tabl_tabulate_color_reset_step % undefined or empty? +% {\gletcsname\??tabulatecolor\number\fastloopindex\endcsname\undefined} -\def\tabl_tabulate_color_reset_step % undefined or empty? - {\gletcsname\??tabulatecolor\number\fastloopindex\endcsname\undefined} +\def\tabl_tabulate_color_reset_indeed + {\localcontrolledloop\zerocount\c_tabl_tabulate_max_colorcolumn\plusone % start at 1 + {\gletcsname\??tabulatecolor\the\currentloopiterator\endcsname\undefined}% + \global\c_tabl_tabulate_max_colorcolumn\zerocount} % why not like vrule? \appendtoks \tabl_tabulate_color_reset @@ -2201,34 +2213,40 @@ % {\glettonothing\tabl_tabulate_flush_collected_indeed % \global\c_tabl_tabulate_column\zerocount % \tabl_tabulate_pbreak_check +% \global\setfalse\c_tabl_tabulate_split_done % new 27/12/2022 % \dofastloopcs\c_tabl_tabulate_columns\tabl_tabulate_flush_second_step +% \ifconditional\c_tabl_tabulate_split_done\else +% \glet\tabl_tabulate_tm\s!reset % new 27/12/2022 +% \fi % \global\settrue\c_tabl_tabulate_firstflushed} -% + % \protected\def\tabl_tabulate_flush_second_step -% {\ifvoid\b_tabl_tabulate_current\fastloopindex\else +% {\ifvoid\b_tabl_tabulate_current\fastloopindex +% \else % \gdef\tabl_tabulate_flush_collected_indeed{\the\t_tabl_tabulate_dummy}% +% \ifvoid\b_tabl_tabulate_current\fastloopindex \else +% \global\settrue\c_tabl_tabulate_split_done % new 27/12/2022 +% \fi % \fi} -% -% \def\tabl_tabulate_flush_second -% {\noalign{\tabl_tabulate_flush_second_indeed}% -% \tabl_tabulate_flush_collected_indeed} + +\newconditional\c_tabl_tabulate_split_done \protected\def\tabl_tabulate_flush_second_indeed {\glettonothing\tabl_tabulate_flush_collected_indeed \global\c_tabl_tabulate_column\zerocount \tabl_tabulate_pbreak_check \global\setfalse\c_tabl_tabulate_split_done % new 27/12/2022 - \dofastloopcs\c_tabl_tabulate_columns\tabl_tabulate_flush_second_step + \localcontrolledloop\plusone\c_tabl_tabulate_columns\plusone{\tabl_tabulate_flush_second_step}% \ifconditional\c_tabl_tabulate_split_done\else \glet\tabl_tabulate_tm\s!reset % new 27/12/2022 \fi \global\settrue\c_tabl_tabulate_firstflushed} \protected\def\tabl_tabulate_flush_second_step - {\ifvoid\b_tabl_tabulate_current\fastloopindex + {\ifvoid\b_tabl_tabulate_current\currentloopiterator \else \gdef\tabl_tabulate_flush_collected_indeed{\the\t_tabl_tabulate_dummy}% - \ifvoid\b_tabl_tabulate_current\fastloopindex \else + \ifvoid\b_tabl_tabulate_current\currentloopiterator \else \global\settrue\c_tabl_tabulate_split_done % new 27/12/2022 \fi \fi} @@ -3016,7 +3034,7 @@ \lettonothing\m_table_current_row_background \lettonothing\m_table_current_row_background_default \lettonothing\m_table_current_row_background_filler -\lettonothing\m_table_current_row_background_defaultfiller +\lettonothing\m_table_current_row_background_default_filler \lettonothing\m_table_current_row_background_auto \protected\def\tabl_register_row_background#1% @@ -3262,7 +3280,7 @@ %\letcsname\??tabulatespana r\endcsname\relax \noaligned\tolerant\def\tabl_tabulate_NS[#1]#*[#2]% - {\NC\loopcs{#1}\tabl_tabulate_span + {\NC\loopcs{#1}\tabl_tabulate_span % use localloop and quit \gdef\tabl_tabulate_kooh {\begincsname\??tabulatespana#2\endcsname \glet\tabl_tabulate_kooh\relax}% diff --git a/Master/texmf-dist/tex/context/base/mkxl/tabl-xtb.lmt b/Master/texmf-dist/tex/context/base/mkxl/tabl-xtb.lmt index c475d62330a..50f321c0dc9 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/tabl-xtb.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/tabl-xtb.lmt @@ -87,7 +87,7 @@ local new_glue = nodepool.glue local new_kern = nodepool.kern local new_hlist = nodepool.hlist -local lefttoright_code = nodes.dirvalues.lefttoright +local lefttoright_code = tex.directioncodes.lefttoright local v_stretch = variables.stretch local v_normal = variables.normal diff --git a/Master/texmf-dist/tex/context/base/mkxl/task-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/task-ini.lmt index 57376ae2be8..962a7ef9af7 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/task-ini.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/task-ini.lmt @@ -176,11 +176,20 @@ appendaction("alignments", "normalizers", "nodes.handlers.mathmatrixrules", appendaction("localboxes", "lists", "typesetters.localboxes.handler", nil, "nut", "enabled" ) +appendaction("hquality", "system", "builders.hpack.report", nil, "nonut", "enabled" ) +appendaction("hquality", "system", "builders.hpack.show", nil, "nut", "enabled" ) +appendaction("vquality", "system", "builders.vpack.report", nil, "nonut", "enabled" ) +------------("vquality", "system", "builders.vpack.show", nil, "nut", "enabled" ) + -- some protection -freezecallbacks("find_.*_file", "find file using resolver") -freezecallbacks("read_.*_file", "read file at once") -freezecallbacks("open_.*_file", "open file for reading") +freezecallbacks("find_log_file", "provide the log file name") +freezecallbacks("find_format_file", "locate the format file") +freezecallbacks("open_data_file", "open the given file for reading") +freezecallbacks("process_jobname", "manipulate jobname") +freezecallbacks("trace_memory", "show memory usage details") + +freezecallbacks("hpack_filter", "hlist processing (not used, replaced)") -- no need to add more overhead -- experimental (needs to be updated): @@ -197,6 +206,9 @@ freezegroup("finalizers", "lists") freezegroup("math", "normalizers") freezegroup("math", "builders") +freezegroup("hquality", "system") +freezegroup("vquality", "system") + freezegroup("shipouts", "normalizers") freezegroup("shipouts", "finishers") freezegroup("shipouts", "wrapup") @@ -204,8 +216,8 @@ freezegroup("shipouts", "wrapup") freezegroup("mvlbuilders", "normalizers") freezegroup("vboxbuilders", "normalizers") ------------("parbuilders", "lists") ------------("pagebuilders", "lists") +-----------("parbuilders", "normalizers") +freezegroup("pagebuilders", "normalizers") freezegroup("math", "normalizers") freezegroup("math", "builders") diff --git a/Master/texmf-dist/tex/context/base/mkxl/toks-aux.lmt b/Master/texmf-dist/tex/context/base/mkxl/toks-aux.lmt index 83e714d7738..2027ed78e23 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/toks-aux.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/toks-aux.lmt @@ -197,6 +197,9 @@ tex.listsigncodes = getthem(tex.getlistsignvalues, "listsigncode tex.classoptioncodes = getthem(tex.getmathclassoptionvalues, "classoptioncode") ---.alignmentcontextcodes = getthem(tex.getalignmentcontextvalues ) -- only at lua end tex.specialmathclasscodes = getthem(tex.getspecialmathclassvalues ) -- only at lua end +tex.directioncodes = getthem(tex.getdirectionvalues ) -- only at lua end (todo tex) +tex.fillcodes = getthem(tex.getfillvalues ) -- only at lua end (todo tex) +tex.mathparametercodes = getthem(tex.getmathparametervalues ) -- only at lua end (todo tex) function tex.stringtocodesbitmap(str,codes) local bitmap = 0 diff --git a/Master/texmf-dist/tex/context/base/mkxl/toks-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/toks-ini.lmt index e4bf7626f19..d45e3ae1c35 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/toks-ini.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/toks-ini.lmt @@ -48,6 +48,7 @@ local scanvalue = token.scanvalue local scanchar = token.scanchar local scancsname = token.scancsname local scannextchar = token.scannextchar +local scanposit = token.scanposit local scanreal = token.scanreal local scanfloat = token.scanfloat local scanluanumber = token.scanluanumber @@ -160,6 +161,7 @@ tokens.scanners = { -- these expand gluespec = scanskip, integer = scaninteger, cardinal = scancardinal, + posit = scanposit, real = scanreal, float = scanfloat, luanumber = scanluanumber, diff --git a/Master/texmf-dist/tex/context/base/mkxl/toks-scn.lmt b/Master/texmf-dist/tex/context/base/mkxl/toks-scn.lmt index ab531a46288..855bca6ad23 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/toks-scn.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/toks-scn.lmt @@ -29,6 +29,7 @@ local scantoks = scanners.toks local scaninteger = scanners.integer local scancardinal = scanners.cardinal local scannumber = scanners.number +local scanfloat = scanners.float local scankeyword = scanners.keyword local scankeywordcs = scanners.keywordcs local scanword = scanners.word @@ -226,6 +227,7 @@ local shortcuts = { scaninteger = scaninteger, scancardinal = scancardinal, scannumber = scannumber, + scanfloat = scanfloat, scantable = scantable, -- not directly useable scankeyword = scankeyword, scankeywordcs = scankeywordcs, @@ -262,6 +264,7 @@ local shortcuts = { toboolean = toboolean, inspect = inspect, report = report_scan, + posit = posit, } tokens.shortcuts = shortcuts diff --git a/Master/texmf-dist/tex/context/base/mkxl/trac-deb.lmt b/Master/texmf-dist/tex/context/base/mkxl/trac-deb.lmt index caa5464f8d4..83603ef59e8 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/trac-deb.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/trac-deb.lmt @@ -289,15 +289,15 @@ end directives.register("system.errorcontext", function(v) local register = callback.register if v then - register('show_error_message', nop) - register('show_warning_message', function() processwarning(v) end) - register('intercept_lua_error', function() processerror(v) end) - register('intercept_tex_error', function(mode,eof) processerror(v,eof) return mode end) + register("show_error_message", nop) + register("show_warning_message", function() processwarning(v) end) + register("intercept_lua_error", function() processerror(v) end) + register("intercept_tex_error", function(mode,eof) processerror(v,eof) return mode end) else - register('show_error_message', nil) - register('show_warning_message', nil) - register('intercept_lua_error', nil) - register('intercept_tex_error', nil) + register("show_error_message", nil) + register("show_warning_message", nil) + register("intercept_lua_error", nil) + register("intercept_tex_error", nil) end end) diff --git a/Master/texmf-dist/tex/context/base/mkxl/trac-inf.lmt b/Master/texmf-dist/tex/context/base/mkxl/trac-inf.lmt index feef3714fe7..649fef30bff 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/trac-inf.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/trac-inf.lmt @@ -304,6 +304,9 @@ local registered = false local enabled = false local finished = false +local status = status -- needed for --sandbox +local mplib = mplib -- needed for --sandbox + function statistics.showusage(when) if finished and when == "finish" then return diff --git a/Master/texmf-dist/tex/context/base/mkxl/trac-vis.lmt b/Master/texmf-dist/tex/context/base/mkxl/trac-vis.lmt index dddb4799deb..9b467de29d0 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/trac-vis.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/trac-vis.lmt @@ -760,16 +760,16 @@ end local ruleddir, ruledpar do - local dircodes = nodes.dircodes - local dirvalues = nodes.dirvalues + local dircodes = nodes.dircodes + local directioncodes = tex.directioncodes -- nodes.dirvalues - local cancel_code = dircodes.cancel - local l2r_code = dirvalues.l2r - local r2l_code = dirvalues.r2l + local cancel_code = dircodes.cancel + local l2r_code = directioncodes.l2r + local r2l_code = directioncodes.r2l - local d_cache = caches["dir"] + local d_cache = caches["dir"] - local getdirection = nuts.getdirection + local getdirection = nuts.getdirection local tags = { l2r = "L2R", @@ -1295,7 +1295,7 @@ local ruledglue, ruledmathglue do -- we sometimes pass previous as we can have issues in math (not watertight for all) - local mathvalues = nodes.mathvalues + local mathvalues = tex.mathparametercodes -- nodes.mathvalues mathvalues[-1] = "left" mathvalues[-2] = "right" @@ -1946,7 +1946,7 @@ do head, current = ruledkern(head,current,vertical) end end - goto next; + goto next ::list:: if id == hlist_code then local content = getlist(current) diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-set.mkxl b/Master/texmf-dist/tex/context/base/mkxl/type-set.mkxl index 62dd3c9ab4b..ae1c85ee97d 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/type-set.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/type-set.mkxl @@ -180,6 +180,6 @@ \definefilesynonym [type-imp-antykwa-light.mkiv] [type-imp-antykwa.mkiv] \definefilesynonym [type-imp-antykwa-cond.mkiv] [type-imp-antykwa.mkiv] -\definefilesynonym [type-imp-antykwa-lightcond.mkiv] [type-imp-antykwa.mkiv] +\definefilesynonym [type-imp-antykwa-light-cond.mkiv] [type-imp-antykwa.mkiv] \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-ada.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-ada.lmt index 37393ca77f7..09947938350 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/typo-ada.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/typo-ada.lmt @@ -62,12 +62,13 @@ function adaptive.set(settings) texsetattribute(a_adaptive,registervalue(a_adaptive,settings)) end -local function setadaptive(w,h,d,l,c) +local function setadaptive(w,h,d,l,c,a) setdimen(d_adaptive_width,w) setdimen(d_adaptive_height,h) setdimen(d_adaptive_depth,d) setdimen(d_adaptive_line,l) setmacro("m_adaptive_color",c) + setmacro("m_adaptive_alternative",a) end local methods = { @@ -76,7 +77,7 @@ local methods = { local setups = settings.setups if setups and setups ~= "" then local w, h, d = getwhd(parent) - setadaptive(w,h,d,settings.rulethickness,settings.color) + setadaptive(w,h,d,settings.rulethickness,settings.color,settings.alternative) expandmacro("setup",true,setups) local l = takebox("b_adaptive_box") if l then @@ -150,6 +151,7 @@ interfaces.implement { { "mp", "string" }, { "color", "string" }, { "rulethickness", "dimension" }, + { "alternative", "string" }, } } } diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-ada.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-ada.mkxl index 733b2ca5be0..d6eae424922 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/typo-ada.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/typo-ada.mkxl @@ -39,6 +39,10 @@ \aliased\let\usedadaptivebox\b_adaptive_box \mutable\lettonothing\m_adaptive_color +\mutable\lettonothing\m_adaptive_alternative + +\permanent\def\usedadaptivecolor {\m_adaptive_color} +\permanent\def\usedadaptivealternative{\m_adaptive_alternative} \protected\untraced\def\usedadaptivetotal{\dimexpr\usedadaptiveheight+\usedadaptivedepth\relax} @@ -56,6 +60,7 @@ [\c!foregroundstyle=, \c!foregroundcolor=, \c!color=gray, + \c!alternative=, \c!rulethickness=\linewidth, \c!method=1, \c!stretch=, @@ -95,6 +100,7 @@ method \adaptiveparameter\c!method setups {\p_setups}% color {\adaptiveparameter\c!color}% + alternative {\adaptiveparameter\c!alternative}% rulethickness \adaptiveparameter\c!rulethickness }% \fi diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-adj.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-adj.mkxl index 5c129f07e35..bf754cdbf8c 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/typo-adj.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/typo-adj.mkxl @@ -51,7 +51,7 @@ \tolerant\def\typo_adjusters_blank#1[#2]% no need for speed {\begingroup - % \setbox\scratchbox\vbox{\ifcstok{#2}\emptytoks\blank\else\blank[#2]\fi}% + % \setbox\scratchbox\vbox{\iftok{#2}\emptytoks\blank\else\blank[#2]\fi}% \setbox\scratchbox\vbox{\blank[#2]}% \vadjust #1 index \plustwo {\vskip\htdp\scratchbox}% \endgroup} diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-bld.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-bld.lmt index 00ff9f26796..c0b42001e66 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/typo-bld.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/typo-bld.lmt @@ -19,6 +19,12 @@ local parbuilders = builders.paragraphs parbuilders.constructors = parbuilders.constructors or { } local constructors = parbuilders.constructors +builders.hpack = builders.hpack or { } +builders.vpack = builders.vpack or { } + +local hpackbuilders = builders.hpack +local vpackbuilders = builders.vpack + constructors.names = constructors.names or { } local names = constructors.names @@ -52,6 +58,7 @@ local nuts = nodes.nuts local tonode = nodes.tonode local tonut = nodes.tonut local getattr = nuts.getattr +local flush = nuts.flush local starttiming = statistics.starttiming local stoptiming = statistics.stoptiming @@ -200,13 +207,12 @@ local builders = nodes.builders local vpackactions = nodes.tasks.actions("vboxbuilders") function builders.vpack_filter(head,groupcode,size,packtype,maxdepth,direction) - local done = false if head then starttiming(builders) - head, done = vpackactions(head,groupcode) + head = vpackactions(head,groupcode) stoptiming(builders) end - return head, done + return head end -- This one is special in the sense that it has no head and we operate on the mlv. Also, @@ -244,8 +250,8 @@ function builders.buildpage_filter(pagecontext) end end -registercallback('vpack_filter', builders.vpack_filter, "vertical spacing etc") -registercallback('buildpage_filter', builders.buildpage_filter, "vertical spacing etc (mvl)") +registercallback("vpack_filter", builders.vpack_filter, "vertical spacing etc") +registercallback("buildpage_filter", builders.buildpage_filter, "vertical spacing etc (mvl)") local vboxactions = nodes.tasks.actions("vboxhandlers") @@ -258,7 +264,7 @@ function builders.vbox_filter(head,groupcode) return head end -registercallback('packed_vbox_filter', builders.vbox_filter, "packed vbox treatments") +registercallback("packed_vbox_filter", builders.vbox_filter, "packed vbox treatments") statistics.register("v-node processing time", function() return statistics.elapsedseconds(builders) @@ -297,37 +303,51 @@ local report_quality = logs.reporter("pack quality") -- overflow|badness w h d dir -local function vpack_quality(how,n,detail,first,last,filename) - if last <= 0 then - report_quality("%s vbox",how) - elseif first > 0 and first < last then - report_quality("%s vbox at line %i - %i in file %a",how,first,last,filename or "?") - else - report_quality("%s vbox at line %i in file %a",how,filename or "?",last) +local report = true trackers.register("builders.vpack.quality", function(v) report = v end) +local collect = false trackers.register("builders.vpack.collect", function(v) collect = v end) +---- show = false trackers.register("builders.vpack.overflow",function(v) show = v end) + +function vpackbuilders.report(how,detail,n,first,last,filename) -- no return value + if report then + if last <= 0 then + report_quality("%s vbox",how) + elseif first > 0 and first < last then + report_quality("%s vbox at line %i - %i in file %a",how,first,last,filename or "?") + else + report_quality("%s vbox at line %i in file %a",how,last,filename or "?") + end + end + if collect then + list[#list+1] = { "hbox", how, filename, first, last, how, detail } end - list[#list+1] = { "hbox", how, filename, first, last, how } end -trackers.register("builders.vpack.quality",function(v) - registercallback("vpack_quality",v and vpack_quality or nil,"check vpack quality") -end) +-- function builders.vpack.show(how,detail,n,first,last,filename) -- return value +-- if show then +-- end +-- end -local report = false -local show = false +local report = true trackers.register("builders.hpack.quality", function(v) report = v end) +local collect = false trackers.register("builders.hpack.collect", function(v) collect = v end) +local show = false trackers.register("builders.hpack.overflow",function(v) show = v end) -local function hpack_quality(how,detail,n,first,last,filename) - n = tonut(n) +function hpackbuilders.report(how,detail,n,first,last,filename) -- no return value + local str = (report or collect) and listtoutf(getlist(n),"",true,nil,true) if report then - local str = listtoutf(getlist(n),"",true,nil,true) if last <= 0 then - report_quality("%s hbox: %s",how,str) + report_quality("%s hbox: %s (%p)",how,str,detail) elseif first > 0 and first < last then - report_quality("%s hbox at line %i - %i in file %a: %s",how,first,last,filename or "?",str) + report_quality("%s hbox at line %i - %i in file %a: %s (%p)",how,first,last,filename or "?",str,detail) else - report_quality("%s hbox at line %i in file %a: %s",how,last,filename or "?",str) + report_quality("%s hbox at line %i in file %a: %s (%p)",how,last,filename or "?",str,detail) end - list[#list+1] = { "hbox", how, filename, first, last, str } end + if collect then + list[#list+1] = { "hbox", how, filename, first, last, str, detail } + end +end + +function hpackbuilders.show(how,detail,n,first,last,filename,rule) -- return value if show then local width = 2*65536 local height = getheight(n) @@ -339,7 +359,10 @@ local function hpack_quality(how,detail,n,first,last,filename) if depth < 2*65526 then depth = 2*65526 end - local rule = new_rule(width,height,depth) + if rule then + flush(rule) + end + rule = new_rule(width,height,depth) setdirection(rule,direction) if how == "overfull" then setcolor(rule,"red") @@ -356,19 +379,40 @@ local function hpack_quality(how,detail,n,first,last,filename) rule = hpack(rule) setwidth(rule,0) -- maybe better whd all zero setdirection(rule,direction) - return tonode(rule) -- can be a nut + else + local width = texget("overfullrule") + if width > 0 then + rule = new_rule(width) + end end + return rule end -trackers.register("builders.hpack.quality",function(v) - report = v - registercallback("hpack_quality",(report or show) and hpack_quality or nil,"check hpack quality") -end) +-- -trackers.register("builders.hpack.overflow",function(v) - show = v - registercallback("hpack_quality",(report or show) and hpack_quality or nil,"check hpack quality") -end) +local hqualityactions = nodes.tasks.actions("hquality") +local vqualityactions = nodes.tasks.actions("vquality") + +function hpackbuilders.qualityactions(how,detail,n,first,last,filename) + local rul = nil + -- starttiming(builders) + rul = hqualityactions(how,detail,n,first,last,filename) + -- stoptiming(builders) + return rul +end +function vpackbuilders.qualityactions(how,detail,n,first,last,filename) + local rul = nil + -- starttiming(builders) + rul = vqualityactions(how,detail,n,first,last,filename) + -- stoptiming(builders) + return rul +end + +registercallback("hpack_quality", hpackbuilders.qualityactions, "report horizontal packing quality") +registercallback("vpack_quality", vpackbuilders.qualityactions, "report vertical packing quality") + + +-- statistics.register("quality reports", function() local n = #list @@ -390,7 +434,7 @@ statistics.register("quality reports", function() logs.startfilelogging(report_quality) for i=1,n do local l = list[i] - report_quality("%-" .. fw .. "s [%04i - %04i] : %-" .. hw .. "s %s : %s",file.basename(l[3]),l[4],l[5],l[2],l[1],l[6]) + report_quality("%-" .. fw .. "s [%04i - %04i] : %-" .. hw .. "s %s : %s (%p)",file.basename(l[3]),l[4],l[5],l[2],l[1],l[6],l[7]) end logs.stopfilelogging() report_quality() diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-cln.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-cln.lmt new file mode 100644 index 00000000000..469859162fb --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/typo-cln.lmt @@ -0,0 +1,109 @@ +if not modules then modules = { } end modules ['typo-cln'] = { + version = 1.001, + comment = "companion to typo-cln.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- This quick and dirty hack took less time than listening to a CD (In +-- this case Dream Theaters' Octavium). Of course extensions will take +-- more time. + +-- This feature is probably never used so we can get rid of it. + +local tonumber = tonumber +local utfbyte = utf.byte + +local trace_cleaners = false trackers.register("typesetters.cleaners", function(v) trace_cleaners = v end) +local trace_autocase = false trackers.register("typesetters.cleaners.autocase",function(v) trace_autocase = v end) + +local report_cleaners = logs.reporter("nodes","cleaners") +local report_autocase = logs.reporter("nodes","autocase") + +typesetters.cleaners = typesetters.cleaners or { } +local cleaners = typesetters.cleaners + +local variables = interfaces.variables + +local nodecodes = nodes.nodecodes + +local enableaction = nodes.tasks.enableaction + +local texsetattribute = tex.setattribute + +local nuts = nodes.nuts + +local getattr = nuts.getattr +local setattr = nuts.setattr + +local setchar = nuts.setchar + +local nextglyph = nuts.traversers.glyph + +local unsetvalue = attributes.unsetvalue + +local glyph_code = nodecodes.glyph +local uccodes = characters.uccodes + +local a_cleaner = attributes.private("cleaner") + +local resetter = { -- this will become an entry in char-def + [utfbyte(".")] = true +} + +-- Contrary to the casing code we need to keep track of a state. +-- We could extend the casing code with a status tracker but on +-- the other hand we might want to apply casing afterwards. So, +-- cleaning comes first. + +function cleaners.handler(head) + local inline = false + for n, char, font in nextglyph, head do + if resetter[char] then + inline = false + elseif not inline then + local a = getattr(n,a_cleaner) + if a == 1 then -- currently only one cleaner so no need to be fancy + local upper = uccodes[char] + if type(upper) == "table" then + -- some day, not much change that \SS ends up here + else + setchar(n,upper) + if trace_autocase then + report_autocase("") + end + end + end + inline = true + end + end + return head +end + +-- see typo-cap for a more advanced settings handler .. not needed now + +local enabled = false + +function cleaners.set(n) + if n == variables.reset or not tonumber(n) or n == 0 then + texsetattribute(a_cleaner,unsetvalue) + else + if not enabled then + enableaction("processors","typesetters.cleaners.handler") + if trace_cleaners then + report_cleaners("enabling cleaners") + end + enabled = true + end + texsetattribute(a_cleaner,tonumber(n)) + end +end + +-- interface + +interfaces.implement { + name = "setcharactercleaning", + actions = cleaners.set, + arguments = "string" +} diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-cln.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-cln.mkxl index 84fc1d2353b..fba9d4ab8ae 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/typo-cln.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/typo-cln.mkxl @@ -15,7 +15,7 @@ \unprotect -\registerctxluafile{typo-cln}{} +\registerctxluafile{typo-cln}{autosuffix} \definesystemattribute[cleaner][public] diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-del.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-del.mkxl index 08d0a9b09a1..bd427b954be 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/typo-del.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/typo-del.mkxl @@ -412,10 +412,10 @@ {\begingroup \typo_delimited_push{#1}{#2}% \dostarttaggedchained\t!delimitedblock\currentdelimitedtext\??delimitedtext - \edef\p_delimited_method{\delimitedtextparameter\c!method}% - \ifx\p_delimited_method\v!font + \edef\p_method{\delimitedtextparameter\c!method}% + \ifx\p_method\v!font \expandafter\typo_delimited_start_font - \orelse\ifx\p_delimited_method\v!paragraph + \orelse\ifx\p_method\v!paragraph \expandafter\typo_delimited_start_font \else \expandafter\typo_delimited_start_other @@ -485,12 +485,14 @@ \endgroup \dostoptagged} +\lettonothing\p_delimited_left +\lettonothing\p_delimited_right +\lettonothing\p_delimited_nextleft +\lettonothing\p_delimited_nextright + \tolerant\def\typo_delimited_start_par[#1]% {\let\typo_delimited_stop\typo_delimited_stop_par - \edef\p_delimited_spacebefore{\delimitedtextparameter\c!spacebefore}% - \ifempty\p_delimited_spacebefore \else - \blank[\p_delimited_spacebefore]% - \fi + \checkedblank[\delimitedtextparameter\c!spacebefore]% \delimitedtextparameter\c!before \edef\m_delimited_argument{#1}% \ifempty\m_delimited_argument @@ -538,10 +540,7 @@ \pop_macro_checkindentation \typo_delimited_stop_par_indeed \delimitedtextparameter\c!after - \edef\p_delimited_spaceafter{\delimitedtextparameter\c!spaceafter}% - \ifempty\p_delimited_spaceafter \else - \blank[\p_delimited_spaceafter]% - \fi + \checkedblank[\delimitedtextparameter\c!spaceafter]% \useindentnextparameter\delimitedtextparameter \aftergroup\dorechecknextindentation}% AM: This was missing! @@ -566,10 +565,10 @@ \permanent\tolerant\protected\def\delimitedtext[#1]#*[#2]% {\dontleavehmode % following ones can be omited \typo_delimited_push{#1}{#2}% - \edef\p_delimited_method{\delimitedtextparameter\c!method}% - \ifx\p_delimited_method\v!font + \edef\p_method{\delimitedtextparameter\c!method}% + \ifx\p_method\v!font \expandafter\typo_delimited_fontdriven - \orelse\ifx\p_delimited_method\v!text + \orelse\ifx\p_method\v!text \expandafter\typo_delimited_fontdriven \else \expandafter\typo_delimited_other diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-dha.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-dha.lmt new file mode 100644 index 00000000000..8671970d889 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/typo-dha.lmt @@ -0,0 +1,481 @@ +if not modules then modules = { } end modules ['typo-dha'] = { + version = 1.001, + comment = "companion to typo-dir.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- Some analysis by Idris: +-- +-- 1. Assuming the reading- vs word-order distinction (bidi-char types) is governing; +-- 2. Assuming that 'ARAB' represents an actual arabic string in raw input order, not word-order; +-- 3. Assuming that 'BARA' represent the correct RL word order; +-- +-- Then we have, with input: LATIN ARAB +-- +-- \textdirection 1 LATIN ARAB => LATIN BARA +-- \textdirection 1 LATIN ARAB => LATIN BARA +-- \textdirection 1 LRO LATIN ARAB => LATIN ARAB +-- \textdirection 1 LRO LATIN ARAB => LATIN ARAB +-- \textdirection 1 RLO LATIN ARAB => NITAL ARAB +-- \textdirection 1 RLO LATIN ARAB => NITAL ARAB + +-- elseif d == "es" then -- European Number Separator +-- elseif d == "et" then -- European Number Terminator +-- elseif d == "cs" then -- Common Number Separator +-- elseif d == "nsm" then -- Non-Spacing Mark +-- elseif d == "bn" then -- Boundary Neutral +-- elseif d == "b" then -- Paragraph Separator +-- elseif d == "s" then -- Segment Separator +-- elseif d == "ws" then -- Whitespace +-- elseif d == "on" then -- Other Neutrals + +-- todo : use new dir functions +-- todo : make faster +-- todo : move dir info into nodes +-- todo : swappable tables and floats i.e. start-end overloads (probably loop in builders) + +-- I removed the original tracing code and now use the colorful one. If I ever want to change +-- something I will just inject prints for tracing. + +local nodes, node = nodes, node + +local trace_directions = false trackers.register("typesetters.directions", function(v) trace_directions = v end) + +local report_directions = logs.reporter("typesetting","text directions") + +local nuts = nodes.nuts + +local getnext = nuts.getnext +local getprev = nuts.getprev +local getchar = nuts.getchar +local getid = nuts.getid +local getsubtype = nuts.getsubtype +local getlist = nuts.getlist +local getattr = nuts.getattr +local getprop = nuts.getprop +local getdirection = nuts.getdirection +local isglyph = nuts.isglyph -- or ischar + +local setprop = nuts.setprop +local setstate = nuts.setstate +local setchar = nuts.setchar + +local insertnodebefore = nuts.insertbefore +local insertnodeafter = nuts.insertafter +local remove_node = nuts.remove +local endofmath = nuts.endofmath + +local startofpar = nuts.startofpar + +local nodepool = nuts.pool + +local nodecodes = nodes.nodecodes +local gluecodes = nodes.gluecodes + +local glyph_code = nodecodes.glyph +local math_code = nodecodes.math +local kern_code = nodecodes.kern +local glue_code = nodecodes.glue +local dir_code = nodecodes.dir +local par_code = nodecodes.par + +local parfillskip_code = gluecodes.parfillskip + +local directioncodes = tex.directioncodes +local lefttoright_code = directioncodes.lefttoright +local righttoleft_code = directioncodes.righttoleft + +local new_direction = nodepool.direction + +local insert = table.insert + +local fonthashes = fonts.hashes +local fontchar = fonthashes.characters + +local chardirections = characters.directions +local charmirrors = characters.mirrors +local charclasses = characters.textclasses + +local directions = typesetters.directions +local setcolor = directions.setcolor +local getglobal = directions.getglobal + +local a_directions = attributes.private('directions') + +local strip = false + +local s_isol = fonts.analyzers.states.isol + +local function stopdir(finish) -- we could use finish directly + local n = new_direction(finish == righttoleft_code and righttoleft_code or lefttoright_code,true) + setprop(n,"direction",true) + return n +end + +local function startdir(finish) -- we could use finish directly + local n = new_direction(finish == righttoleft_code and righttoleft_code or lefttoright_code) + setprop(n,"direction",true) + return n +end + +local function nextisright(current) + current = getnext(current) + local character, id = isglyph(current) + if character then + local direction = chardirections[character] + return direction == "r" or direction == "al" or direction == "an" + end +end + +local function previsright(current) + current = getprev(current) + local character, id = isglyph(current) + if character then + local direction = chardirections[character] + return direction == "r" or direction == "al" or direction == "an" + end +end + +local function process(start) + + local head = start + local current = head + local autodir = 0 + local embedded = 0 + local override = 0 + local pardir = 0 + local textdir = 0 + local done = false + local stack = { } + local top = 0 + local obsolete = { } + local rlo = false + local lro = false + local prevattr = false + local fences = { } + + while current do + -- no isglyph here as we test for skips first + local id = getid(current) + local next = getnext(current) + if id == math_code then + current = getnext(endofmath(next)) + elseif getprop(current,"direction") then + -- this handles unhbox etc + current = next + else + local attr = getattr(current,a_directions) + if attr and attr > 0 then + if attr ~= prevattr then + if not getglobal(a) then + lro = false + rlo = false + end + prevattr = attr + end + end + local prop = true + if id == glyph_code then + if attr and attr > 0 then + local character, font = isglyph(current) + if character == 0 then + -- skip signals + -- setprop(current,"direction",true) + else + local direction = chardirections[character] + local reversed = false + if rlo or override > 0 then + if direction == "l" then + direction = "r" + reversed = true + end + elseif lro or override < 0 then + if direction == "r" or direction == "al" then + setstate(current,s_isol) -- hm + direction = "l" + reversed = true + end + end + if direction == "on" then + local mirror = charmirrors[character] + if mirror and fontchar[font][mirror] then + local class = charclasses[character] + if class == "open" then + if nextisright(current) then + setchar(current,mirror) + -- setprop(current,"direction","r") + prop = "r" + elseif autodir < 0 then + setchar(current,mirror) + -- setprop(current,"direction","r") + prop = "r" + else + mirror = false + -- setprop(current,"direction","l") + prop = "l" + end + local fencedir = autodir == 0 and textdir or autodir + fences[#fences+1] = fencedir + elseif class == "close" and #fences > 0 then + local fencedir = fences[#fences] + fences[#fences] = nil + if fencedir < 0 then + setchar(current,mirror) + -- setprop(current,"direction","r") + prop = "r" + else + -- setprop(current,"direction","l") + prop = "l" + mirror = false + end + elseif autodir < 0 then + setchar(current,mirror) + -- setprop(current,"direction","r") + prop = "r" + else + -- setprop(current,"direction","l") + prop = "l" + mirror = false + end + else + -- setprop(current,"direction",true) + end + if trace_directions then + setcolor(current,direction,false,mirror) + end + elseif direction == "l" then + if trace_directions then + setcolor(current,"l",reversed) + end + -- setprop(current,"direction","l") + prop = "l" + elseif direction == "r" then + if trace_directions then + setcolor(current,"r",reversed) + end + -- setprop(current,"direction","r") + prop = "r" + elseif direction == "en" then -- european number + if trace_directions then + setcolor(current,"l") + end + -- setprop(current,"direction","l") + prop = "l" + elseif direction == "al" then -- arabic letter + if trace_directions then + setcolor(current,"r") + end + -- setprop(current,"direction","r") + prop = "r" + elseif direction == "an" then -- arabic number + -- needs a better scanner as it can be a float + if trace_directions then + setcolor(current,"l") -- was r + end + -- setprop(current,"direction","n") -- was r + prop = "n" + elseif direction == "lro" then -- Left-to-Right Override -> right becomes left + top = top + 1 + stack[top] = { override, embedded } + override = -1 + obsolete[#obsolete+1] = current + goto obsolete + elseif direction == "rlo" then -- Right-to-Left Override -> left becomes right + top = top + 1 + stack[top] = { override, embedded } + override = 1 + obsolete[#obsolete+1] = current + goto obsolete + elseif direction == "lre" then -- Left-to-Right Embedding -> lefttoright_code + top = top + 1 + stack[top] = { override, embedded } + embedded = 1 + obsolete[#obsolete+1] = current + goto obsolete + elseif direction == "rle" then -- Right-to-Left Embedding -> righttoleft_code + top = top + 1 + stack[top] = { override, embedded } + embedded = -1 + obsolete[#obsolete+1] = current + goto obsolete + elseif direction == "pdf" then -- Pop Directional Format + if top > 0 then + local s = stack[top] + override = s[1] + embedded = s[2] + top = top - 1 + else + override = 0 + embedded = 0 + end + obsolete[#obsolete+1] = current + goto obsolete + elseif trace_directions then + setcolor(current) + -- setprop(current,"direction",true) + else + -- setprop(current,"direction",true) + end + end + else + -- setprop(current,"direction",true) + end + elseif id == glue_code then + if getsubtype(current) == parfillskip_code then + -- setprop(current,"direction","!") + prop = "!" + else + -- setprop(current,"direction","g") + prop = "g" + end + elseif id == kern_code then + -- setprop(current,"direction","k") + prop = "k" + elseif id == dir_code then + local direction, pop = getdirection(current) + if direction == righttoleft_code then + if not pop then + autodir = -1 + elseif embedded and embedded~= 0 then + autodir = embedded + else + autodir = 0 + end + elseif direction == lefttoright_code then + if not pop then + autodir = 1 + elseif embedded and embedded~= 0 then + autodir = embedded + else + autodir = 0 + end + end + textdir = autodir + -- setprop(current,"direction",true) + elseif id == par_code and startofpar(current) then + local direction = getdirection(current) + if direction == righttoleft_code then + autodir = -1 + elseif direction == lefttoright_code then + autodir = 1 + end + pardir = autodir + textdir = pardir + -- setprop(current,"direction",true) + else + -- setprop(current,"direction",true) + end + setprop(current,"direction",prop) + ::obsolete:: + current = next + end + end + + -- todo: track if really needed + -- todo: maybe we need to set the property (as it can be a copied list) + + if done and strip then + local n = #obsolete + if n > 0 then + for i=1,n do + remove_node(head,obsolete[i],true) + end + if trace_directions then + report_directions("%s character nodes removed",n) + end + end + end + + local state = false + local last = false + local collapse = true + current = head + + -- todo: textdir + -- todo: inject before parfillskip + + while current do + local id = getid(current) + if id == math_code then + -- todo: this might be tricky nesting + current = getnext(endofmath(getnext(current))) + else + local cp = getprop(current,"direction") + if cp == "n" then + local swap = state == "r" + if swap then + head = insertnodebefore(head,current,startdir(lefttoright_code)) + end + setprop(current,"direction",true) + while true do + local n = getnext(current) + if n and getprop(n,"direction") == "n" then + current = n + setprop(current,"direction",true) + else + break + end + end + if swap then + head, current = insertnodeafter(head,current,stopdir(lefttoright_code)) + end + elseif cp == "l" then + if state ~= "l" then + if state == "r" then + head = insertnodebefore(head,last or current,stopdir(righttoleft_code)) + end + head = insertnodebefore(head,current,startdir(lefttoright_code)) + state = "l" + done = true + end + last = false + elseif cp == "r" then + if state ~= "r" then + if state == "l" then + head = insertnodebefore(head,last or current,stopdir(lefttoright_code)) + end + head = insertnodebefore(head,current,startdir(righttoleft_code)) + state = "r" + done = true + end + last = false + elseif collapse then + if cp == "k" or cp == "g" then + last = last or current + else + last = false + end + else + if state == "r" then + head = insertnodebefore(head,current,stopdir(righttoleft_code)) + elseif state == "l" then + head = insertnodebefore(head,current,stopdir(lefttoright_code)) + end + state = false + last = false + end + setprop(current,"direction",true) + end + local next = getnext(current) + if next then + current = next + else + local sd = (state == "r" and stopdir(righttoleft_code)) or (state == "l" and stopdir(lefttoright_code)) + if sd then + if id == glue_code and getsubtype(current) == parfillskip_code then + head = insertnodebefore(head,current,sd) + else + head = insertnodeafter(head,current,sd) + end + end + break + end + end + + return head + +end + +directions.installhandler(interfaces.variables.default,process) diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-dir.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-dir.mkxl index a5a4bc5686d..d9937ce7302 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/typo-dir.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/typo-dir.mkxl @@ -19,9 +19,7 @@ \unprotect \registerctxluafile{typo-dir}{autosuffix} -\registerctxluafile{typo-dha}{} -%registerctxluafile{typo-dua}{} -%registerctxluafile{typo-dub}{} +\registerctxluafile{typo-dha}{autosuffix} \registerctxluafile{typo-duc}{autosuffix} \definesystemattribute[directions][public,pickup] diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-duc.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-duc.lmt index 2e36389466d..ecc1396a17a 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/typo-duc.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/typo-duc.lmt @@ -99,9 +99,9 @@ local penalty_code = nodecodes.penalty local parfillskip_code = gluecodes.parfillskip local parfillleftskip_code = gluecodes.parfillleftskip -local dirvalues = nodes.dirvalues -local lefttoright_code = dirvalues.lefttoright -local righttoleft_code = dirvalues.righttoleft +local directioncodes = tex.directioncodes +local lefttoright_code = directioncodes.lefttoright +local righttoleft_code = directioncodes.righttoleft local maximum_stack = 0xFF @@ -609,23 +609,23 @@ local function resolve_weak(list,size,start,limit,orderbefore,orderafter) else -- only more efficient when we have es/cs local runner = start + 2 if runner <= limit then - local before = list[start] - local entry = list[start + 1] - local after = list[runner] + local before = list[start] + local current = list[start + 1] + local after = list[runner] while after do - local direction = entry.direction + local direction = current.direction if direction == "es" then if before.direction == "en" and after.direction == "en" then - entry.direction = "en" + current.direction = "en" end elseif direction == "cs" then local prevdirection = before.direction if prevdirection == "en" then if after.direction == "en" then - entry.direction = "en" + current.direction = "en" end elseif prevdirection == "an" and after.direction == "an" then - entry.direction = "an" + current.direction = "an" end end before = current diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-lbx.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-lbx.mkxl index 93a2fc86fa8..57186856fed 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/typo-lbx.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/typo-lbx.mkxl @@ -100,6 +100,8 @@ %D existing local box we create nested ones. This is handled in the callback but if %D really needed one can do something like (do we need a primitive?): +\mutable\lettonothing\currentlocalboxeslocation + \def\typo_localboxes_localbox {\ifx\currentlocalboxeslocation\v!right \localrightbox diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-lin.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-lin.lmt index 42ee5a9576f..2a0182e28f5 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/typo-lin.lmt +++ b/Master/texmf-dist/tex/context/base/mkxl/typo-lin.lmt @@ -97,7 +97,7 @@ local new_hlist = nodepool.hlist local new_rule = nodepool.rule local new_glue = nodepool.glue -local righttoleft_code = nodes.dirvalues.righttoleft +local righttoleft_code = tex.directioncodes.righttoleft local setmetatableindex = table.setmetatableindex diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-prc.mklx b/Master/texmf-dist/tex/context/base/mkxl/typo-prc.mklx index f2df329860f..f9a8f8e5efb 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/typo-prc.mklx +++ b/Master/texmf-dist/tex/context/base/mkxl/typo-prc.mklx @@ -54,6 +54,8 @@ \installcommandhandler \??processor {processor} \??processor +\mutable\let\currentprocessor\empty % weird that this is needed + \appendtoks \letcsname\??processorcheck\currentprocessor\endcsname\relax \clf_registerstructureprocessor{\currentprocessor}% global, but it permits using processor that are yet undefined diff --git a/Master/texmf-dist/tex/context/base/mkxl/unic-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/unic-ini.lmt new file mode 100644 index 00000000000..aafaf0ae723 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/unic-ini.lmt @@ -0,0 +1,26 @@ +if not modules then modules = { } end modules ['unic-ini'] = { + version = 1.001, + comment = "companion to unic-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local context = context +local utfchar = utf.char + +-- Beware, initializing unicodechar happens at first usage and takes +-- 0.05 -- 0.1 second (lots of function calls). + +interfaces.implement { + name = "unicodechar", + public = true, + protected = true, + arguments = "argument", + actions = function(asked) + local n = characters.unicodechar(asked) + if n then + context(utfchar(n)) + end + end +} diff --git a/Master/texmf-dist/tex/context/base/mkxl/unic-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/unic-ini.mkxl index aedfe47ed2a..7d2302daeb1 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/unic-ini.mkxl +++ b/Master/texmf-dist/tex/context/base/mkxl/unic-ini.mkxl @@ -13,7 +13,7 @@ \writestatus{loading}{ConTeXt Unicode Support / Initialization} -\registerctxluafile{unic-ini}{} +\registerctxluafile{unic-ini}{autosuffix} \unprotect @@ -26,7 +26,8 @@ %D %D \typebuffer \getbuffer -\permanent\def\unicodechar#1{\clf_unicodechar{#1}} +% \permanent\def\unicodechar#1% defined at the lua end +% {\clf_unicodechar{#1}} \permanent\protected\def\unknownchar {\dontleavehmode\hpack{\vrule\s!width.5\emwidth\s!height\exheight\s!depth\zeropoint}} diff --git a/Master/texmf-dist/tex/context/base/mkxl/util-sbx.lmt b/Master/texmf-dist/tex/context/base/mkxl/util-sbx.lmt new file mode 100644 index 00000000000..b48d4a9f6fb --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/util-sbx.lmt @@ -0,0 +1,658 @@ +if not modules then modules = { } end modules ['util-sbx'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- Note: we use expandname and collapsepath and these use chdir which is overloaded +-- so we need to use originals there. Just something to keep in mind. This is old +-- code that I might need to upgrade to fit lmtx better. I'll stepwise also try to +-- integrate e.g. curl and graphicmagick a bit more natural. Some code below can +-- be simplified because we don't share any longer with luatex. + +if not sandbox then require("l-sandbox") end -- for testing + +local next, type = next, type + +local replace = utilities.templates.replace +local collapsepath = file.collapsepath +local expandname = dir.expandname +local sortedhash = table.sortedhash +local lpegmatch = lpeg.match +local platform = os.type +local P, S, C = lpeg.P, lpeg.S, lpeg.C +local gsub = string.gsub +local lower = string.lower +local find = string.find +local concat = string.concat +local unquoted = string.unquoted +local optionalquoted = string.optionalquoted +local basename = file.basename +local nameonly = file.nameonly + +local sandbox = sandbox +local validroots = { } +local validrunners = { } +local validbinaries = true -- all permitted +local validlibraries = true -- all permitted +local validators = { } +local finalized = nil +local trace = false + +local p_validroot = nil +local p_split = lpeg.firstofsplit(" ") + +local report = logs.reporter("sandbox") + +trackers.register("sandbox",function(v) trace = v end) -- often too late anyway + +sandbox.setreporter(report) + +sandbox.finalizer { + category = "files", + action = function() + finalized = true + end +} + +local function registerroot(root,what) -- what == read|write + if finalized then + report("roots are already finalized") + else + if type(root) == "table" then + root, what = root[1], root[2] + end + if type(root) == "string" and root ~= "" then + root = collapsepath(expandname(root)) + if what == "r" or what == "ro" or what == "readable" then + what = "read" + elseif what == "w" or what == "wo" or what == "writable" then + what = "write" + end + -- true: read & write | false: read + validroots[root] = what == "write" or false + end + end +end + +sandbox.finalizer { + category = "files", + action = function() -- initializers can set the path + if p_validroot then + report("roots are already initialized") + else + sandbox.registerroot(".","write") -- always ok + -- also register texmf as read + for name in sortedhash(validroots) do + if p_validroot then + p_validroot = P(name) + p_validroot + else + p_validroot = P(name) + end + end + p_validroot = p_validroot / validroots + end + end +} + +local function registerbinary(name) + if finalized then + report("binaries are already finalized") + elseif type(name) == "string" and name ~= "" then + if not validbinaries then + return + end + if validbinaries == true then + validbinaries = { [name] = true } + else + validbinaries[name] = true + end + elseif name == true then + validbinaries = { } + end +end + +local function registerlibrary(name) + if finalized then + report("libraries are already finalized") + elseif type(name) == "string" and name ~= "" then + if not validlibraries then + return + end + if validlibraries == true then + validlibraries = { [nameonly(name)] = true } + else + validlibraries[nameonly(name)] = true + end + elseif name == true then + validlibraries = { } + end +end + +-- begin of validators + +local p_write = S("wa") p_write = (1 - p_write)^0 * p_write +local p_path = S("\\/~$%:") p_path = (1 - p_path )^0 * p_path -- be easy on other arguments + +local function normalized(name) -- only used in executers + if platform == "windows" then + name = gsub(name,"/","\\") + end + return name +end + +function sandbox.possiblepath(name) + return lpegmatch(p_path,name) and true or false +end + +local filenamelogger = false + +function sandbox.setfilenamelogger(l) + filenamelogger = type(l) == "function" and l or false +end + +local function validfilename(name,what) + if p_validroot and type(name) == "string" and lpegmatch(p_path,name) then + local asked = collapsepath(expandname(name)) + -- if platform == "windows" then + -- asked = lower(asked) -- we assume ascii names + -- end + local okay = lpegmatch(p_validroot,asked) + if okay == true then + -- read and write access + if filenamelogger then + filenamelogger(name,"w",asked,true) + end + return name + elseif okay == false then + -- read only access + if not what then + -- no further argument to io.open so a readonly case + if filenamelogger then + filenamelogger(name,"r",asked,true) + end + return name + elseif lpegmatch(p_write,what) then + if filenamelogger then + filenamelogger(name,"w",asked,false) + end + return -- we want write access + else + if filenamelogger then + filenamelogger(name,"r",asked,true) + end + return name + end + elseif filenamelogger then + filenamelogger(name,"*",name,false) + end + else + return name + end +end + +local function readable(name,finalized) +-- if platform == "windows" then -- yes or no +-- name = lower(name) -- we assume ascii names +-- end + return validfilename(name,"r") +end + +local function normalizedreadable(name,finalized) +-- if platform == "windows" then -- yes or no +-- name = lower(name) -- we assume ascii names +-- end + local valid = validfilename(name,"r") + if valid then + return normalized(valid) + end +end + +local function writeable(name,finalized) +-- if platform == "windows" then +-- name = lower(name) -- we assume ascii names +-- end + return validfilename(name,"w") +end + +local function normalizedwriteable(name,finalized) +-- if platform == "windows" then +-- name = lower(name) -- we assume ascii names +-- end + local valid = validfilename(name,"w") + if valid then + return normalized(valid) + end +end + +validators.readable = readable +validators.writeable = normalizedwriteable +validators.normalizedreadable = normalizedreadable +validators.normalizedwriteable = writeable +validators.filename = readable + +table.setmetatableindex(validators,function(t,k) + if k then + t[k] = readable + end + return readable +end) + +-- function validators.verbose(s) +-- return s +-- end + +function validators.string(s,finalized) + -- can be used to prevent filename checking (todo: only when registered) + if finalized and suspicious(s) then + return "" + else + return s + end +end + +function validators.cache(s) + if finalized then + return basename(s) + else + return s + end +end + +function validators.url(s) + if finalized and find("^file:") then + return "" + else + return s + end +end + +-- end of validators + +local function filehandlerone(action,one,...) + local checkedone = validfilename(one) + if checkedone then + return action(one,...) + else + -- report("file %a is unreachable",one) + end +end + +local function filehandlertwo(action,one,two,...) + local checkedone = validfilename(one) + if checkedone then + local checkedtwo = validfilename(two) + if checkedtwo then + return action(one,two,...) + else + -- report("file %a is unreachable",two) + end + else + -- report("file %a is unreachable",one) + end +end + +local function iohandler(action,one,...) + if type(one) == "string" then + local checkedone = validfilename(one) + if checkedone then + return action(one,...) + end + elseif one then + return action(one,...) + else + return action() + end +end + +-- runners can be strings or tables +-- +-- os.execute : string +-- os.exec : string or table with program in [0|1] -- no longer there +-- os.spawn : string or table with program in [0|1] -- no longer there +-- +-- our execute: registered program with specification + +local osexecute = sandbox.original(os.execute) +local iopopen = sandbox.original(io.popen) +local reported = { } + +local function validcommand(name,program,template,checkers,defaults,variables,reporter,strict) + if validbinaries ~= false and (validbinaries == true or validbinaries[program]) then + local binpath = nil + if variables then + for variable, value in next, variables do + local chktype = checkers[variable] + if chktype == "verbose" then + -- for now, we will have a "flags" checker + else + local checker = validators[chktype] + if checker and type(value) == "string" then + value = checker(unquoted(value),strict) + if value then + variables[variable] = optionalquoted(value) + else + report("variable %a with value %a fails the check",variable,value) + return + end + else + report("variable %a has no checker",variable) + return + end + end + end + for variable, default in next, defaults do + local value = variables[variable] + if not value or value == "" then + local chktype = checkers[variable] + if chktype == "verbose" then + -- for now, we will have a "flags" checker + elseif type(default) == "string" then + local checker = validators[chktype] + if checker then + default = checker(unquoted(default),strict) + if default then + variables[variable] = optionalquoted(default) + else + report("variable %a with default %a fails the check",variable,default) + return + end + end + end + end + end + binpath = variables.binarypath + end + if type(binpath) == "string" and binpath ~= "" then + -- this works on the console but not from e.g. scite + -- program = '"' .. binpath .. "/" .. program .. '"' + program = binpath .. "/" .. program + end + local command = program .. " " .. replace(template,variables) + if reporter then + reporter("executing runner %a: %s",name,command) + elseif trace then + report("executing runner %a: %s",name,command) + end + return command + elseif not reported[name] then + report("executing program %a of runner %a is not permitted",program,name) + reported[name] = true + end +end + +local runners = { + -- + -- name,program,template,checkers,variables,reporter + -- + resultof = function(...) + local command = validcommand(...) + if command then + if trace then + report("resultof: %s",command) + end + local handle = iopopen(command,"rb") -- already has flush + if handle then + local result = handle:read("*all") or "" + handle:close() + return result + end + end + end, + execute = function(...) + local command = validcommand(...) + if command then + if trace then + report("execute: %s",command) + end + local okay = osexecute(command) + return okay + end + end, + pipeto = function(...) + local command = validcommand(...) + if command then + if trace then + report("pipeto: %s",command) + end + return iopopen(command,"w") -- already has flush + end + end, +} + +function sandbox.registerrunner(specification) + if type(specification) == "string" then + local wrapped = validrunners[specification] + inspect(table.sortedkeys(validrunners)) + if wrapped then + return wrapped + else + report("unknown predefined runner %a",specification) + return + end + end + if type(specification) ~= "table" then + report("specification should be a table (or string)") + return + end + local name = specification.name + if type(name) ~= "string" then + report("invalid name, string expected",name) + return + end + if validrunners[name] then + report("invalid name, runner %a already defined",name) + return + end + local program = specification.program + if type(program) == "string" then + -- common for all platforms + elseif type(program) == "table" then + program = program[platform] or program.default or program.unix + end + if type(program) ~= "string" or program == "" then + report("invalid runner %a specified for platform %a",name,platform) + return + end + local template = specification.template + if not template then + report("missing template for runner %a",name) + return + end + local method = specification.method or "execute" + local checkers = specification.checkers or { } + local defaults = specification.defaults or { } + local internal = specification.internal + local runner = runners[method] + if runner then + local finalized = finalized -- so, the current situation is frozen + local internalized = false + local wrapped = function(variables) + if internal and not internalized then + -- So internal returns a function but can also just return false in which + -- case we fallback in the runner; this permits optional library support. + internal = internal(specification) + if type(internal) ~= "function" then + internal = false + end + internalized = true + end + return (internal or runner)(name,program,template,checkers,defaults,variables,specification.reporter,finalized) + end + validrunners[name] = wrapped + return wrapped + else + validrunners[name] = nil + report("invalid method for runner %a",name) + end +end + +function sandbox.getrunner(name) + return name and validrunners[name] +end + +local function suspicious(str) + return (find(str,"[/\\]") or find(command,"..",1,true)) and true or false +end + +local function binaryrunner(action,command,...) + if validbinaries == false then + -- nothing permitted + report("no binaries permitted, ignoring command: %s",command) + return + end + if type(command) ~= "string" then + -- we only handle strings, maybe some day tables + report("command should be a string") + return + end + local program = lpegmatch(p_split,command) + if not program or program == "" then + report("unable to filter binary from command: %s",command) + return + end + if validbinaries == true then + -- everything permitted + elseif not validbinaries[program] then + report("binary not permitted, ignoring command: %s",command) + return + elseif suspicious(command) then + report("/ \\ or .. found, ignoring command (use sandbox.registerrunner): %s",command) + return + end + return action(command,...) +end + +local function dummyrunner(action,command,...) + if type(command) == "table" then + command = concat(command," ",command[0] and 0 or 1) + end + report("ignoring command: %s",command) +end + +sandbox.filehandlerone = filehandlerone +sandbox.filehandlertwo = filehandlertwo +sandbox.iohandler = iohandler + +do + + local library = optional.library + local foreign = optional.foreign + local reported = { } + local libraryload = library.load + local foreignload = foreign.load + + function library.load(name,...) + if validlibraries == false then + -- all blocked + elseif validlibraries == true then + -- all permitted + return libraryload(name,...) + elseif validlibraries[nameonly(name)] then + -- 'name' permitted + return libraryload(name,...) + else + -- 'name' not permitted + end + if not reported[name] then + report("using library %a is not permitted",name) + reported[name] = true + end + return nil + end + + function foreign.load(name,...) + if validlibraries == false then + -- all blocked + elseif validlibraries == true then + -- all permitted + return foreignload(name,...) + elseif validlibraries[nameonly(name)] then + -- 'name' permitted + return foreignload(name,...) + else + -- 'name' not permitted + end + if not reported[name] then + report("using foreign %a is not permitted",name) + reported[name] = true + end + return nil + end + + -- we can do this in the engine: a one time flag + + function sandbox.disablelibraries() + validlibraries = false + library.load = function() end + foreign.load = function() end + end + + function sandbox.disablerunners() + validbinaries = false + end + +end + +------------------- + +local overload = sandbox.overload +local register = sandbox.register + + overload(loadfile, filehandlerone,"loadfile") -- todo + +if io then + overload(io.open, filehandlerone,"io.open") + overload(io.popen, binaryrunner, "io.popen") + overload(io.input, iohandler, "io.input") + overload(io.output, iohandler, "io.output") + overload(io.lines, filehandlerone,"io.lines") +end + +if os then + overload(os.execute, binaryrunner, "os.execute") + overload(os.spawn, dummyrunner, "os.spawn") -- no longer there + overload(os.exec, dummyrunner, "os.exec") -- no longer there + overload(os.resultof, binaryrunner, "os.resultof") + overload(os.pipeto, binaryrunner, "os.pipeto") + overload(os.rename, filehandlertwo,"os.rename") + overload(os.remove, filehandlerone,"os.remove") +end + +if lfs then + overload(lfs.chdir, filehandlerone,"lfs.chdir") + overload(lfs.mkdir, filehandlerone,"lfs.mkdir") + overload(lfs.rmdir, filehandlerone,"lfs.rmdir") + overload(lfs.isfile, filehandlerone,"lfs.isfile") + overload(lfs.isdir, filehandlerone,"lfs.isdir") + overload(lfs.attributes, filehandlerone,"lfs.attributes") + overload(lfs.dir, filehandlerone,"lfs.dir") + overload(lfs.lock_dir, filehandlerone,"lfs.lock_dir") + overload(lfs.touch, filehandlerone,"lfs.touch") + overload(lfs.link, filehandlertwo,"lfs.link") + overload(lfs.setmode, filehandlerone,"lfs.setmode") + overload(lfs.readlink, filehandlerone,"lfs.readlink") + overload(lfs.shortname, filehandlerone,"lfs.shortname") + overload(lfs.symlinkattributes,filehandlerone,"lfs.symlinkattributes") +end + +-- these are used later on + +if zip then + zip.open = register(zip.open, filehandlerone,"zip.open") +end + +sandbox.registerroot = registerroot +sandbox.registerbinary = registerbinary +sandbox.registerlibrary = registerlibrary +sandbox.validfilename = validfilename + +-- not used in a normal mkiv run : os.spawn = os.execute +-- not used in a normal mkiv run : os.exec = os.exec + +-- print(io.open("test.log")) +-- sandbox.enable() +-- print(io.open("test.log")) +-- print(io.open("t:/test.log")) diff --git a/Master/texmf-dist/tex/context/colors/icc/profiles/default_gray.icc b/Master/texmf-dist/tex/context/colors/icc/profiles/default_gray.icc Binary files differdeleted file mode 100644 index daaa7480ad7..00000000000 --- a/Master/texmf-dist/tex/context/colors/icc/profiles/default_gray.icc +++ /dev/null diff --git a/Master/texmf-dist/tex/context/colors/icc/profiles/ecirgb_v2.icc b/Master/texmf-dist/tex/context/colors/icc/profiles/ecirgb_v2.icc Binary files differdeleted file mode 100644 index 8fd642f8568..00000000000 --- a/Master/texmf-dist/tex/context/colors/icc/profiles/ecirgb_v2.icc +++ /dev/null diff --git a/Master/texmf-dist/tex/context/colors/icc/profiles/ecirgb_v2_iccv4.icc b/Master/texmf-dist/tex/context/colors/icc/profiles/ecirgb_v2_iccv4.icc Binary files differdeleted file mode 100644 index efceaef631b..00000000000 --- a/Master/texmf-dist/tex/context/colors/icc/profiles/ecirgb_v2_iccv4.icc +++ /dev/null diff --git a/Master/texmf-dist/tex/context/colors/icc/profiles/isocoated_v2_300_eci.icc b/Master/texmf-dist/tex/context/colors/icc/profiles/isocoated_v2_300_eci.icc Binary files differdeleted file mode 100644 index 0c46e9eb8bf..00000000000 --- a/Master/texmf-dist/tex/context/colors/icc/profiles/isocoated_v2_300_eci.icc +++ /dev/null diff --git a/Master/texmf-dist/tex/context/colors/icc/profiles/isocoated_v2_eci.icc b/Master/texmf-dist/tex/context/colors/icc/profiles/isocoated_v2_eci.icc Binary files differdeleted file mode 100644 index dceb393f600..00000000000 --- a/Master/texmf-dist/tex/context/colors/icc/profiles/isocoated_v2_eci.icc +++ /dev/null diff --git a/Master/texmf-dist/tex/context/colors/icc/profiles/srgb_v4_icc_preference.icc b/Master/texmf-dist/tex/context/colors/icc/profiles/srgb_v4_icc_preference.icc Binary files differdeleted file mode 100644 index cfbd03e1f78..00000000000 --- a/Master/texmf-dist/tex/context/colors/icc/profiles/srgb_v4_icc_preference.icc +++ /dev/null diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/antykwa-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/antykwa-math.lfg index 5bbd2cf6ce5..975ada70e11 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/antykwa-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/antykwa-math.lfg @@ -1,24 +1,4 @@ -local common = fonts.goodies.load("common-math-jmn.lfg") -local helpers = common.mathematics.helpers - -if not fonts.encodings.math["extensible-jmn-private"] then - - local nps = fonts.helpers.newprivateslot - - fonts.encodings.math["extensible-jmn-private"] = { - [nps("rule middle piece")] = 200, -- minusjmn - [nps("rule right piece")] = 201, -- minusrightjmn - [nps("rule left piece")] = 202, -- minusleftjmn - [nps("double rule middle piece")] = 203, -- equaljmn - [nps("double rule right piece")] = 204, -- equalrightjmn - [nps("double rule left piece")] = 205, -- equalleftjmn - [nps("arrow left piece")] = 206, -- arrowleftjmn - [nps("arrow right piece")] = 207, -- arrowrightjmn - [nps("double arrow left piece")] = 208, -- arrowdblleftjmn - [nps("double arrow right piece")] = 209, -- arrowdblrightjmn - } - -end +-- no longer ok for mkiv: digits are not antykwa local fraction = .25 @@ -105,6 +85,95 @@ local uglyones = { vextenddouble = true, } +local recipes = { + ["antykwa-math"] = { + { name = "file:LatinModern-Math", features = "virtualmath-antykwa", main = true, parameters = false }, + -- + { name = "rm-anttr.tfm", vector = "tex-mr", skewchar=0x7F }, + { name = "mi-anttri.tfm", vector = "tex-mi", skewchar=0x7F }, + { name = "mi-anttri.tfm", vector = "tex-it", skewchar=0x7F }, + { name = "mi-anttbi.tfm", vector = "tex-bi", skewchar=0x7F }, + { name = "rm-anttb.tfm", vector = "tex-bf", skewchar=0x7F }, + { name = "sy-anttrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true + { name = "sy-anttrz.tfm", vector = "extensible-jmn-private", skewchar=0x30 }, + { name = "file:AntykwaTorunska-Regular", vector = "tex-ex-braces", backmap = false }, + { name = "ex-anttr.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, + }, + ["antykwa-light-math"] = { + { name = "file:LatinModern-Math", features = "virtualmath-antykwa-light", main = true, parameters = false }, + -- + { name = "rm-anttl.tfm", vector = "tex-mr", skewchar=0x7F }, + { name = "mi-anttli.tfm", vector = "tex-mi", skewchar=0x7F }, + { name = "mi-anttli.tfm", vector = "tex-it", skewchar=0x7F }, + { name = "mi-anttri.tfm", vector = "tex-bi", skewchar=0x7F }, + { name = "rm-anttr.tfm", vector = "tex-bf", skewchar=0x7F }, + { name = "sy-anttlz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true + { name = "sy-anttlz.tfm", vector = "extensible-jmn-private", skewchar=0x30 }, + { name = "file:AntykwaTorunskaLight-Regular", vector = "tex-ex-braces", backmap = false }, + { name = "ex-anttl.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, + }, + ["antykwa-cond-math"] = { + { name = "file:LatinModern-Math", features = "virtualmath-antykwa-cond", main = true, parameters = false }, + -- + { name = "rm-anttcr.tfm", vector = "tex-mr", skewchar=0x7F }, + { name = "mi-anttcri.tfm", vector = "tex-mi", skewchar=0x7F }, + { name = "mi-anttcri.tfm", vector = "tex-it", skewchar=0x7F }, + { name = "mi-anttcbi.tfm", vector = "tex-bi", skewchar=0x7F }, + { name = "rm-anttcb.tfm", vector = "tex-bf", skewchar=0x7F }, + { name = "sy-anttcrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true + { name = "sy-anttcrz.tfm", vector = "extensible-jmn-private", skewchar=0x30 }, + { name = "file:AntykwaTorunskaCond-Regular", vector = "tex-ex-braces", backmap = false }, + { name = "ex-anttcr.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, + }, + ["antykwa-light-cond-math"] = { + { name = "file:LatinModern-Math", features = "virtualmath-antykwa-lightcond", main = true, parameters = false }, + -- + { name = "rm-anttcl.tfm", vector = "tex-mr", skewchar=0x7F }, + { name = "mi-anttcli.tfm", vector = "tex-mi", skewchar=0x7F }, + { name = "mi-anttcli.tfm", vector = "tex-it", skewchar=0x7F }, + { name = "mi-anttcri.tfm", vector = "tex-bi", skewchar=0x7F }, + { name = "rm-anttcr.tfm", vector = "tex-bf", skewchar=0x7F }, + { name = "sy-anttclz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true + { name = "sy-anttclz.tfm", vector = "extensible-jmn-private", skewchar=0x30 }, + { name = "file:AntykwaTorunskaCondLight-Regular", vector = "tex-ex-braces", backmap = false }, + { name = "ex-anttcl.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, + }, +} + +local tweaks = nil +local common = fonts.goodies.load("common-math-jmn.lfg") + +if common then + + tweaks = { + { + tweak = "addmissing", + action = common.mathematics.helpers.addmissing, + }, + { + tweak = "setoptions", + set = { "ignorekerndimensions" } + }, -- we have dp > ht fences + { + tweak = "fixprimes", + factor = 1.0, -- accent base height + fake = 0.9, -- replace multiples with this width proportion + }, + { + tweak = "addequals", + force = true, + }, + { + tweak = "keepbases", +-- list = { 0x302 } + list = "default" + }, +} + + common.mathematics.helpers.copyrecipes(recipes) + +end + return { name = "antykwa-math", version = "1.00", @@ -123,59 +192,15 @@ return { notshiftfactor = 0.075, }, virtuals = { - ["antykwa-math"] = { - { name = "file:LatinModern-Math", features = "virtualmath-antykwa", main = true, parameters = false }, - -- - { name = "rm-anttr.tfm", vector = "tex-mr", skewchar=0x7F }, - { name = "mi-anttri.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "mi-anttri.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "mi-anttbi.tfm", vector = "tex-bi", skewchar=0x7F }, - { name = "rm-anttb.tfm", vector = "tex-bf", skewchar=0x7F }, - { name = "sy-anttrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true - { name = "sy-anttrz.tfm", vector = "extensible-jmn-private", skewchar=0x30 }, - { name = "file:AntykwaTorunska-Regular", vector = "tex-ex-braces", backmap = false }, - { name = "ex-anttr.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, - }, - ["antykwa-light-math"] = { - { name = "file:LatinModern-Math", features = "virtualmath-antykwa-light", main = true, parameters = false }, - -- - { name = "rm-anttl.tfm", vector = "tex-mr", skewchar=0x7F }, - { name = "mi-anttli.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "mi-anttli.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "mi-anttri.tfm", vector = "tex-bi", skewchar=0x7F }, - { name = "rm-anttr.tfm", vector = "tex-bf", skewchar=0x7F }, - { name = "sy-anttlz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true - { name = "sy-anttlz.tfm", vector = "extensible-jmn-private", skewchar=0x30 }, - { name = "file:AntykwaTorunskaLight-Regular", vector = "tex-ex-braces", backmap = false }, - { name = "ex-anttl.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyone }, - }, - ["antykwa-cond-math"] = { - { name = "file:LatinModern-Math", features = "virtualmath-antykwa-cond", main = true, parameters = false }, - -- - { name = "rm-anttcr.tfm", vector = "tex-mr", skewchar=0x7F }, - { name = "mi-anttcri.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "mi-anttcri.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "mi-anttcbi.tfm", vector = "tex-bi", skewchar=0x7F }, - { name = "rm-anttcb.tfm", vector = "tex-bf", skewchar=0x7F }, - { name = "sy-anttcrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true - { name = "sy-anttcrz.tfm", vector = "extensible-jmn-private", skewchar=0x30 }, - { name = "file:AntykwaTorunskaCond-Regular", vector = "tex-ex-braces", backmap = false }, - { name = "ex-anttcr.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyone }, - }, - ["antykwa-lightcond-math"] = { - { name = "file:LatinModern-Math", features = "virtualmath-antykwa-lightcond", main = true, parameters = false }, - -- - { name = "rm-anttcl.tfm", vector = "tex-mr", skewchar=0x7F }, - { name = "mi-anttcli.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "mi-anttcli.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "mi-anttcri.tfm", vector = "tex-bi", skewchar=0x7F }, - { name = "rm-anttcr.tfm", vector = "tex-bf", skewchar=0x7F }, - { name = "sy-anttclz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true, ignore = uglyones }, -- jmn = true - { name = "sy-anttclz.tfm", vector = "extensible-jmn-private", skewchar=0x30 }, - { name = "file:AntykwaTorunskaCondLight-Regular", vector = "tex-ex-braces", backmap = false }, - { name = "ex-anttcl.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyone }, - } + ["antykwa-math"] = { recipe = recipes["antykwa-math"], tweaks = tweaks }, + ["antykwa-light-math"] = { recipe = recipes["antykwa-light-math"], tweaks = tweaks }, + ["antykwa-cond-math"] = { recipe = recipes["antykwa-cond-math"], tweaks = tweaks }, + ["antykwa-light-cond-math"] = { recipe = recipes["antykwa-light-cond-math"], tweaks = tweaks }, + + ["antykwa-math-nt"] = common and { recipe = recipes["antykwa-math-nt"] } or nil, + ["antykwa-light-math-nt"] = common and { recipe = recipes["antykwa-light-math-nt"] } or nil, + ["antykwa-cond-math-nt"] = common and { recipe = recipes["antykwa-cond-math-nt"] } or nil, + ["antykwa-light-cond-math-nt"] = common and { recipe = recipes["antykwa-light-cond-math-nt"] } or nil, }, - addmissing = helpers.addmissing, } } diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/bonum-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/bonum-math.lfg index 56262eb3264..13be0e69d15 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/bonum-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/bonum-math.lfg @@ -59,6 +59,7 @@ return { }, }, }, + presets.smalldigits { factor = 0.95 }, presets.scripttocalligraphic { }, presets.rsfstoscript { rscale = 0.98 }, presets.rsfsuprighttoscript { rscale = 0.98 }, @@ -71,6 +72,9 @@ return { presets.wipeanchors { }, presets.wipeitalics { }, { + tweak = "checkaccents", + }, + { -- We need to check these, are the tweaks necessary or not? tweak = "dimensions", list = { @@ -90,8 +94,8 @@ return { { tweak = "kerns", list = { - [0x002F] = { topleft = -0.2, bottomright = -0.2 }, - ["0x002F.variants.*"] = { topleft = -0.2, bottomright = -0.2 }, + [0x002F] = { topleft = -0.2, bottomright = -0.2 }, + ["0x002F.variants.*"] = { topleft = -0.2, bottomright = -0.2 }, [0x007D] = { topright = -0.05, bottomright = -0.05 }, -- right brace variants ["0x7D.variants.*"] = { topright = -0.05, bottomright = -0.05 }, -- right brace variants ["0x7D.parts.top"] = { topright = -0.15, }, -- right brace top @@ -109,9 +113,9 @@ return { [0x27EB] = { topright = -0.1, bottomright = -0.1 }, ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, -- - [0x1D465] = { bottomright = -0.05, }, -- italic x (ic is too large) - [0x00393] = { bottomright = -0.30, }, -- upright Gamma - [0x1D43F] = { bottomright = 0.01, }, -- upright L + [0x1D465] = { bottomright = -0.05 }, -- italic x (ic is too large) + [0x00393] = { bottomright = -0.30 }, -- upright Gamma + [0x1D43F] = { bottomright = 0.01 }, -- upright L ["0x222B.parts.bottom"] = { bottomright = -0.20 }, -- int ["0x222C.parts.bottom"] = { bottomright = -0.15 }, -- iint ["0x222D.parts.bottom"] = { bottomright = -0.10 }, -- iiint @@ -125,10 +129,10 @@ return { tweak = "extendaccents", }, { - tweak = "flattenaccents", - squeeze = 0.8, - height = 0.9, - offset = 0.1, + tweak = "flattenaccents", + }, + { + tweak = "fixaccents", -- after flatten (zero width intefrerence) }, { tweak = "radicaldegreeanchors", @@ -142,28 +146,23 @@ return { { tweak = "dimensions", list = { - -- [0x007D] = { topright = -0.05, bottomright = -0.05 }, -- right brace variants - ["0x7C"] = { width = 1.4, xoffset=0.2 }, -- vertical bar - -- ["0x7C.variants.*"] = { width = 1, extend = 2.4 }, -- vertical bar - -- ["0x7C.parts.top"] = { , }, -- vertical bar - -- ["0x7C.parts.bottom"] = { bottomright = -0.15 }, -- vertical bar + -- [0x007D] = { topright = -0.05, bottomright = -0.05 }, -- right brace variants + ["0x7C"] = { width = 1.4, xoffset=0.2 }, -- vertical bar (just looks better tis way) + -- ["0x7C.variants.*"] = { width = 1, extend = 2.4 }, + -- ["0x7C.parts.top"] = { }, + -- ["0x7C.parts.bottom"] = { bottomright = -0.15 }, }, }, - - { - tweak = "fixaccents", - }, -- First we set the dimensions of the initial accent which started out as zero but we want - -- a proper width. - { - tweak = "dimensions", - list = { - [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat - [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve - [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck - }, - }, + -- a proper width. Thjis is no longer needed because we tweak the dimensions automatically, + -- so this is just some documented history. + -- { + -- tweak = "dimensions", + -- list = { + -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + -- ["0x00302.flataccent"] = { width = 1.4, anchor = 1.20 }, -- no offset, because we copy + -- }, + -- }, -- Then we deal with all offsets and heights in one go. So we treat the initial accent -- as well as the variants here. But none for Bonum. -- We now copy these to the not wide slots so that we can set these to stretch as well, @@ -233,6 +232,12 @@ return { tweak = "addrules", }, { + tweak = "replacerules", + fraction = { height = .244, yoffset = .758 }, + radical = { height = .244, yoffset = .758, leftoffset = .1, rightoffset = .1 }, + stacker = { height = .244, yoffset = .758 }, + }, + { -- This tweak is only needed for the funny arrows and these now get properly -- centered. (Could actually be done in the engine). tweak = "addarrows", diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/cambria-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/cambria-math.lfg index a855a2513c3..15fad23c45b 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/cambria-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/cambria-math.lfg @@ -70,6 +70,9 @@ return { tweak = "extendaccents", }, { + tweak = "fixaccents", + }, + { tweak = "radicaldegreeanchors", list = { [0x221A] = { location = "left", hfactor = -0.15, vfactor = .75 }, @@ -82,20 +85,17 @@ return { ["0x221A.parts.bottom"] = { location = "left", hfactor = -0.1, vfactor = 0.95 }, } }, - { - tweak = "fixaccents", - }, -- First we set the dimensions of the initial accent which started out as zero but we want -- a proper width. - { - tweak = "dimensions", - list = { - [0x00302] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widehat - [0x00303] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widetilde - [0x00306] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widebreve - [0x0030C] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widecheck - }, - }, + -- { + -- tweak = "dimensions", + -- list = { + -- [0x00302] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widehat + -- [0x00303] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widetilde + -- [0x00306] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widebreve + -- [0x0030C] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widecheck + -- }, + -- }, -- Then we deal with all offsets and heights in one go. So we treat the initial accent -- as well as the variants here. { @@ -131,6 +131,27 @@ return { tweak = "addrules", }, { + tweak = "replacerules", + minus = { + leftoffset = .0925, + rightoffset = .0925, + }, + fraction = { + height = .204, + yoffset = .796, + }, + radical = { + height = .204, + yoffset = .796, + leftoffset = .0925, + rightoffset = .0925, + }, + stacker = { + height = .204, + yoffset = .796, + }, + }, + { tweak = "wipecues", }, { diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/common-math-jmn.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/common-math-jmn.lfg index 331d65a5d5a..1df814b2fda 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/common-math-jmn.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/common-math-jmn.lfg @@ -1,3 +1,43 @@ +if CONTEXTLMTXMODE == 0 then + + fonts.encodings.math["extensible-jmn-private"] = { } + fonts.encodings.math["tex-ex-braces"] = { } + + return false + +end + +local nps = fonts.helpers.newprivateslot + +local fake20D6 = nps("arrow fake 0x20D6") +local fake20D7 = nps("arrow fake 0x20D7") +local fake20E1 = nps("arrow fake 0x20E1") + +local fake20EE = nps("arrow fake 0x20EE") +local fake20EF = nps("arrow fake 0x20EF") +local fake034D = nps("arrow fake 0x034D") + +local real034D = nps("arrow real 0x034D") + +if not fonts.encodings.math["extensible-jmn-private"] then + + local ps = fonts.helpers.privateslot + + fonts.encodings.math["extensible-jmn-private"] = { + [ps("rule middle piece")] = 200, -- minusjmn + [ps("rule right piece")] = 201, -- minusrightjmn + [ps("rule left piece")] = 202, -- minusleftjmn + [ps("double rule middle piece")] = 203, -- equaljmn + [ps("double rule right piece")] = 204, -- equalrightjmn + [ps("double rule left piece")] = 205, -- equalleftjmn + [ps("arrow left piece")] = 206, -- arrowleftjmn + [ps("arrow right piece")] = 207, -- arrowrightjmn + [ps("double arrow left piece")] = 208, -- arrowdblleftjmn + [ps("double arrow right piece")] = 209, -- arrowdblrightjmn + } + +end + return { name = "common-math-jmn", version = "1.00", @@ -6,8 +46,21 @@ return { copyright = "ConTeXt development team", mathematics = { helpers = { + copyrecipes = function(recipes) + local list = table.keys(recipes) + for i=1,#list do + local n = list[i] + local t = table.copy(recipes[n]) + t[1].features = t[1].features .. "-nt" + recipes[n .. "-nt"] = t + end + end, addmissing = function(main) + local max = math.max + local copytable = table.copy + local slotcommand = fonts.helpers.commands.slot + local builders = fonts.handlers.vf.math.builders local ps = fonts.helpers.privateslot @@ -25,8 +78,8 @@ return { local llbracepiece = ps("ll brace piece") local lrbracepiece = ps("lr brace piece") - builders.brace(main,0x23DE,ulbracepiece,cmbracepiece,lrbracepiece,llbracepiece,cmbracepiece,urbracepiece) - builders.brace(main,0x23DF,llbracepiece,cmbracepiece,urbracepiece,ulbracepiece,cmbracepiece,lrbracepiece) + builders.brace(main,0x23DE,ulbracepiece,cmbracepiece,lrbracepiece,llbracepiece,cmbracepiece,urbracepiece,"top") + builders.brace(main,0x23DF,llbracepiece,cmbracepiece,urbracepiece,ulbracepiece,cmbracepiece,lrbracepiece,"bottom") builders.parent(main,0x23DC,ulbracepiece,umbracepiece,urbracepiece,"top") builders.parent(main,0x23DD,llbracepiece,lmbracepiece,lrbracepiece,"bottom") @@ -39,13 +92,25 @@ return { builders.jointwo(main,0x21A6,ps("maps to piece"),.15,0x02192) -- \mapstochar\rightarrow + local srl = ps("rule left piece") local srm = ps("rule middle piece") local srr = ps("rule right piece") - local srl = ps("rule left piece") + local drl = ps("double rule left piece") local drm = ps("double rule middle piece") local drr = ps("double rule right piece") - local drl = ps("double rule left piece") + + local sfl = ps("flat rule left piece") + local sfm = ps("flat rule middle piece") + local sfr = ps("flat rule right piece") + + local mrl = ps("minus rule left piece") + local mrm = ps("minus rule middle piece") + local mrr = ps("minus rule right piece") + + local dfl = ps("flat double rule left piece") + local dfm = ps("flat double rule middle piece") + local dfr = ps("flat double rule right piece") local sal = ps("arrow left piece") local sar = ps("arrow right piece") @@ -54,34 +119,163 @@ return { local dar = ps("double arrow right piece") local rad = ps("radical bar extender") + local frc = ps("fraction bar extender") - if characters[srm] then + local antykwa = characters[srm] - builders.jointwo(main,0x27F5,sak,joinrelfactor,srr) - builders.jointwo(main,0x27F6,srl,joinrelfactor,sar) - builders.jointwo(main,0x27F7,sak,joinrelfactor,sar) - builders.jointwo(main,0x27F8,dal,joinrelfactor,drr) - builders.jointwo(main,0x27F9,drl,joinrelfactor,dar) - builders.jointwo(main,0x27FA,dal,joinrelfactor,dar) + if not antykwa then - builders.horibar(main,0x203E,srm,srl,srr,0x02212) -- overbar underbar fraction (we take 90/91/92 too!) - -- builders.horibar(main,0x203E,srm,srl,srr,0x0002D) -- overbar underbar fraction (we take 90/91/92 too!) + sal = 0x02190 sar = 0x02192 + dal = 0x021D0 dar = 0x021D2 - builders.rootbar(main,ps("radical bar extender"),srm,srr,0x02212) -- radical + srl = 0x0002D srr = 0x0002D + drl = 0x0003D drr = 0x0003D - else + sfl = 0x0002D srm = 0x0002D + dfl = 0x0003D drm = 0x0003D - builders.jointwo(main,0x27F5,0x02190,joinrelfactor,0x0002D) -- \leftarrow\joinrel\relbar - builders.jointwo(main,0x27F6,0x0002D,joinrelfactor,0x02192) -- \relbar\joinrel\rightarrow - builders.jointwo(main,0x27F7,0x02190,joinrelfactor,0x02192) -- \leftarrow\joinrel\rightarrow - builders.jointwo(main,0x27F8,0x021D0,joinrelfactor,0x0003D) -- \Leftarrow\joinrel\Relbar - builders.jointwo(main,0x27F9,0x0003D,joinrelfactor,0x021D2) -- \Relbar\joinrel\Rightarrow - builders.jointwo(main,0x27FA,0x021D0,joinrelfactor,0x021D2) -- \Leftarrow\joinrel\Rightarrow + end + + if not characters[sfm] then - builders.horibar(main,0x203E,0xFE073) -- overbar underbar + local csal = characters[sal] local sheight = csal.height local sdepth = csal.depth + local cdal = characters[dal] local dheight = cdal.height local ddepth = cdal.depth + local csfl = copytable(characters[srl]) characters[sfl] = csfl csfl.height = sheight csfl.depth = sdepth csfl.italic = nil + local csfm = copytable(characters[srm]) characters[sfm] = csfm csfm.height = sheight csfm.depth = sdepth csfm.italic = nil + local csfr = copytable(characters[srr]) characters[sfr] = csfr csfr.height = sheight csfr.depth = sdepth csfr.italic = nil + local cdfl = copytable(characters[drl]) characters[dfl] = cdfl cdfl.height = dheight cdfl.depth = ddepth cdfl.italic = nil + local cdfm = copytable(characters[drm]) characters[dfm] = cdfm cdfm.height = dheight cdfm.depth = ddepth cdfm.italic = nil + local cdfr = copytable(characters[drr]) characters[dfr] = cdfr cdfr.height = dheight cdfr.depth = ddepth cdfr.italic = nil + + end + + builders.jointwo(main,0x27F5,sal,joinrelfactor,srr) + builders.jointwo(main,0x27F6,srl,joinrelfactor,sar) + builders.jointwo(main,0x27F7,sal,joinrelfactor,sar) + builders.jointwo(main,0x27F8,dal,joinrelfactor,drr) + builders.jointwo(main,0x27F9,drl,joinrelfactor,dar) + builders.jointwo(main,0x27FA,dal,joinrelfactor,dar) + + if antykwa then + builders.horibar(main,0x2212,mrm,mrl,mrr,0x2212,true,srm,srl,srr) -- minus + builders.horibar(main,0x203E,srm,srl,srr,0x2212) -- overbar underbar fraction (we take 90/91/92 too!) + builders.horibar(main,frc,srm,srl,srr,0x2212) -- fraction + builders.rootbar(main,rad,srm,srr,0x2212) -- radical + else + builders.horibar(main,0x2212,false,false,false,0x2212,true) -- minus + builders.horibar(main,0x203E,false,false,false,0x02212) end + local ffactor = antykwa and 1 or 1 -- check MS + local mfactor = antykwa and 1 or .8 + local lfactor = antykwa and 1 or .8 + + builders.extension(main,0x2190,sal,sfm,sfr,ffactor,mfactor,lfactor) -- \leftarrow + builders.extension(main,0x2192,sfl,sfm,sar,ffactor,mfactor,lfactor) -- \rightarrow + builders.extension(main,0x27F5,sal,sfm,sfr,ffactor,mfactor,lfactor) + builders.extension(main,0x27F6,sfl,sfm,sar,ffactor,mfactor,lfactor) + builders.extension(main,0x27F7,sal,sfm,sar,ffactor,mfactor,lfactor) + builders.extension(main,0x27F8,dal,dfm,dfr,ffactor,mfactor,lfactor) + builders.extension(main,0x27F9,dfl,dfm,dar,ffactor,mfactor,lfactor) + builders.extension(main,0x27FA,dal,dfm,dar,ffactor,mfactor,lfactor) + + local tfactor = antykwa and -0.8 or -1.1 -- move up check MS + local bfactor = antykwa and 0.1 or 0.2 + +local tfactor = antykwa and -0.6 or -.6 -- move up check MS +local bfactor = antykwa and 0.1 or 0.2 + + local left = characters[0x27F5] + local right = characters[0x27F6] + local both = characters[0x27F7] + + local height = max(left.height or 0,right.height or 0,both.height or 0) + local depth = max(left.depth or 0,right.depth or 0,both.depth or 0) + + left .height = height ; left .depth = depth + right.height = height ; right.depth = depth + both .height = height ; both .depth = depth + + -- top and bottom arrows : a real mess but now we're drawn into patching it; why are these + -- small ones shifted in the bbox; we could do a better job on top and bottom anchors; we + -- also could use the bbox as in opentype (\wideoverleftarrow etc) + + local rightarrow = characters[0x20D7] + local leftarrow = copytable(rightarrow) + local doublearrow = copytable(rightarrow) + local width = rightarrow.width + local height = rightarrow.height + + -- top + + characters[0x20D6] = leftarrow + characters[0x20E1] = doublearrow + + rightarrow.xoffset = -.2*width + leftarrow.commands = { + { "offset", width, 0, 0x20D7, -1, 1 } + } + doublearrow.commands = { + { "offset", antykwa and .9*width or width, 0, 0x20D7, -1, 1 }, + { "offset", antykwa and .1*width or 0, 0, 0x20D7, 1, 1 } + } + + -- bottom + + local rightarrow = copytable(rightarrow) + local leftarrow = copytable(leftarrow) + local doublearrow = copytable(doublearrow) + + characters[0x20EE] = leftarrow + characters[0x20EF] = rightarrow + characters[0x034D] = doublearrow + + local bheight = .40*height -- can be tuned to match top + local yoffset = -.65*height -- can be tuned to match top + + leftarrow .height = bheight + rightarrow .height = bheight + doublearrow.height = bheight + + rightarrow .yoffset = yoffset + leftarrow .yoffset = yoffset + doublearrow.yoffset = yoffset + + leftarrow.commands = { + { "offset", width, 0, 0x20D7, -1, 1 } + } + doublearrow.commands = { + { "offset", antykwa and .9*width or width, 0, 0x20D7, -1, 1 }, + { "offset", antykwa and .1*width or 0, 0, 0x20D7, 1, 1 } + } + + -- extensibles + + local tl = copytable(left) ; characters[fake20D6] = tl ; characters[0x20D6].next = fake20D6 -- over + local tm = copytable(right) ; characters[fake20D7] = tm ; characters[0x20D7].next = fake20D7 + local tr = copytable(both) ; characters[fake20E1] = tr ; characters[0x20E1].next = fake20E1 + + tl.inneryoffset = tfactor*height ; tl.innerlocation = "top" ; tl.next = nil ; tl.italic = nil + tm.inneryoffset = tfactor*height ; tm.innerlocation = "top" ; tm.next = nil ; tm.italic = nil + tr.inneryoffset = tfactor*height ; tr.innerlocation = "top" ; tr.next = nil ; tr.italic = nil + + local bl = copytable(left) ; characters[fake20EE] = bl ; characters[0x20EE].next = fake20EE -- under + local bm = copytable(right) ; characters[fake20EF] = bm ; characters[0x20EF].next = fake20EF + local br = copytable(both) ; characters[fake034D] = br ; characters[0x034D].next = fake034D + + bl.inneryoffset = bfactor*height bl.innerlocation = "bottom" ; bl.next = nil ; bl.italic = nil + bm.inneryoffset = bfactor*height bm.innerlocation = "bottom" ; bm.next = nil ; bm.italic = nil + br.inneryoffset = bfactor*height br.innerlocation = "bottom" ; br.next = nil ; br.italic = nil + + -- + + local tfactor = antykwa and -15 or -15 + local bfactor = antykwa and 1 or 1 + + local t = copytable(characters[0x203E]) characters[0x0305] = t t.inneryoffset = tfactor*t.height t.innerlocation = "top" t.next = nil t.italic = nil + local t = copytable(characters[0x203E]) characters[0x0332] = t t.inneryoffset = bfactor*t.height t.innerlocation = "bottom" t.next = nil t.italic = nil + builders.jointwo(main,0x2016,0x007C,0.20,0x007C) builders.jointwo(main,0x2980,0x007C,0.20,0x007C,0.20,0x007C) @@ -92,6 +286,8 @@ return { characters[0x2980].extensible = true characters[0x2980].varianttemplate = 0x5B +-- characters[0x0302].keepbase = true -- can also be a tweak + -- 21CB leftrightharpoon -- 21CC rightleftharpoon @@ -105,7 +301,9 @@ return { builders.overlaytwo(main,0x2285,0x00338,notshiftfactor,0x02283) -- \not\supset builders.overlaytwo(main,0x2209,0x00338,notshiftfactor,0x02208) -- \not\in - builders.jointwo(main,0x2254,0x03A,0,0x03D) -- := (≔) + -- builders.jointwo (main,0x2254,0x03A,0,0x03D) -- := + -- builders.jointhree(main,0x2A74,0x03A,0,0x03A,0,0x03D) -- ::= + -- builders.jointwo (main,0x2A75,0x03D,0,0x03D) -- == builders.repeated(main,0x222B,0x222B,1,1/2) builders.repeated(main,0x222C,0x222B,2,1/2) @@ -113,6 +311,11 @@ return { characters[0x02B9] = characters[0x2032] -- we're nice + -- some things are done automatically: + + -- add primes + -- add equals and alike + end } } diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/common-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/common-math.lfg index 45e46d865b6..5c7ade3fbee 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/common-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/common-math.lfg @@ -301,6 +301,17 @@ return { }, } end, + smalldigits = function(parameters) + return { + tweak = "dimensions", + feature = "smalldigits", + list = { + ["digitsnormal"] = { + factor = parameters.factor or 0.9, + }, + }, + } + end, }, }, }, diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/concrete-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/concrete-math.lfg index b69ee0103b4..3c8f363916b 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/concrete-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/concrete-math.lfg @@ -35,6 +35,9 @@ return { presets.moveintegrals { factor = 1.5 }, presets.wipeitalics { }, { + tweak = "checkaccents", + }, + { tweak = "kerns", list = { [0x002F] = { topleft = -0.2, bottomright = -0.2 }, @@ -74,6 +77,12 @@ return { }, }, { + tweak = "extendaccents", + }, + { + tweak = "flattenaccents", + }, + { tweak = "radicaldegreeanchors", list = { ["0x221A.parts.bottom"] = { location = "left", hfactor = .0, vfactor = 1.075 }, @@ -87,6 +96,20 @@ return { advance = 0.6, }, { + tweak = "replacerules", + -- minus = { + -- leftoffset = 0, + -- rightoffset = 0, + -- }, + minus = true, + fraction = { height = .2, yoffset = .8 }, + -- Hans, add option not to cut off first piece + -- Hans, check height. + radical = { height = .2, yoffset = .585, leftoffset = .085, rightoffset = .085, leftoverlap = 0.03, yscale = 0.8 }, + -- radical = { height = .2, yoffset = .75, leftoffset = .085, rightoffset = .085, leftoverlap = 0.039 }, + stacker = { height = .2, yoffset = .8 }, + }, + { tweak = "addactuarian", }, { diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/dejavu-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/dejavu-math.lfg index 03f86928812..bd355c3b56f 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/dejavu-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/dejavu-math.lfg @@ -57,6 +57,9 @@ return { -- because once the advance is set the move is blocked and the ic stil wiped. So, -- we kern. Actually the upright (ascii) f has italic correction. { + tweak = "checkaccents", + }, + { tweak = "kerns", list = { [0x1D453] = { bottomright = -.2 }, @@ -106,19 +109,22 @@ return { } }, { + tweak = "flattenaccents", + }, + { tweak = "fixaccents", }, -- First we set the dimensions of the initial accent which started out as zero but we want -- a proper width. - { - tweak = "dimensions", - list = { - [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat - [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve - [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck - }, - }, + -- { + -- tweak = "dimensions", + -- list = { + -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + -- }, + -- }, -- Then we deal with all offsets and heights in one go. So we treat the initial accent -- as well as the variants here. { @@ -145,6 +151,12 @@ return { tweak = "addrules", }, { + tweak = "replacerules", + fraction = { height = .254, yoffset = .746 }, + radical = { height = .17, leftoffset = .1, rightoffset = .1, yoffset = .485, yscale = .65 }, + stacker = { height = .254, yoffset = .746 }, + }, + { tweak = "wipecues", }, { diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/dejavu-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/dejavu-text.lfg new file mode 100644 index 00000000000..ba6458eafd3 --- /dev/null +++ b/Master/texmf-dist/tex/context/fonts/mkiv/dejavu-text.lfg @@ -0,0 +1,58 @@ +return { + name = "dejavu-text", + version = "1.00", + comment = "Goodies that complement dejavu.", + author = "Mikael Sundqvist & Hans Hagen", + copyright = "ConTeXt development team", + extensions = { + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "DejaVuSerif", + "DejaVuSerif-Bold", + }, + data = { + ["f"] = { + [")"] = 100, + ["}"] = 100, + ["]"] = 100, + ["|"] = 150, + ["\\"] = 175, + ["!"] = 100, + ["?"] = 100, + ["*"] = 100, + }, + } + }, + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "DejaVuSerif-Italic", + "DejaVuSerif-BoldItalic", + }, + data = { + ["f"] = { + [")"] = 140, + ["}"] = 140, + ["]"] = 140, + ["|"] = 100, + ["\\"] = 200, + ["!"] = 100, + ["?"] = 100, + ["*"] = 250, + }, + ["("] = { + ["f"] = 100, + }, + ["{"] = { + ["f"] = 100, + }, + ["["] = { + ["f"] = 100, + }, + } + }, + } +} diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-math.lfg index 812430525d5..20bf48460d0 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-math.lfg @@ -12,8 +12,9 @@ return { FractionRuleThickness = 60, OverbarRuleThickness = 60, UnderbarRuleThickness = 60, - AccentTopShiftUp = -75, - FlattenedAccentTopShiftUp = -75, + AccentTopShiftUp = -25, -- was 075 + FlattenedAccentBaseHeight = 620, -- 420 in font (maybe some misunderstanding in the font regarding accents and heights) + FlattenedAccentTopShiftUp = -25, -- was 075 AccentBaseDepth = 75, DelimiterPercent = 90, DelimiterShortfall = 400, @@ -50,6 +51,9 @@ return { presets.moveintegrals { factor = 1.5 }, presets.wipeitalics { }, { + tweak = "checkaccents", + }, + { tweak = "simplifykerns", }, { @@ -82,9 +86,9 @@ return { [0x27EB] = { topright = -0.1, bottomright = -0.1 }, ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, - [0x51] = { bottomright = 0.25 }, -- Upright Q - [0x211A] = { bottomright = 0.2 }, -- Blackboard bold Q - [0x1D410] = { bottomright = 0.2 }, -- Bold Q + [0x00051] = { bottomright = 0.25 }, -- Upright Q + [0x0211A] = { bottomright = 0.2 }, -- Blackboard bold Q + [0x1D410] = { bottomright = 0.2 }, -- Bold Q [0x1D478] = { bottomright = 0.05 }, -- Bold Q [0x1D5B0] = { bottomright = 0.05 }, -- Sans Q }, @@ -146,8 +150,11 @@ return { tweak = "extendaccents", }, { - tweak = "radicaldegreeanchors", - list = { + tweak = "flattenaccents", + }, + { + tweak = "radicaldegreeanchors", + list = { ["0x221A.parts.bottom"] = { location = "left", hfactor = .0, vfactor = 1.0 }, } }, @@ -173,6 +180,29 @@ return { tweak = "addrules", }, { + tweak = "replacerules", + minus = { + leftoffset = .075, + rightoffset = .075, + }, + fraction = { + height = .2, + yoffset = .8, + }, + radical = { + height = .2, + yoffset = .66, + leftoverlap = .020, + leftoffset = .075, -- todo + rightoffset = .075, -- todo + yscale = .84, + }, + stacker = { + height = .2, + yoffset = .8, + }, + }, + { tweak = "addbars", advance = 0.6, }, diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-text.lfg new file mode 100644 index 00000000000..824728460d5 --- /dev/null +++ b/Master/texmf-dist/tex/context/fonts/mkiv/ebgaramond-text.lfg @@ -0,0 +1,59 @@ +return { + name = "ebgaramond-text", + version = "1.00", + comment = "Goodies that complement ebgaramond.", + author = "Mikael Sundqvist & Hans Hagen", + copyright = "ConTeXt development team", + extensions = { + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "EBGaramond-Regular", + }, + data = { + ["f"] = { + [")"] = 80, + ["}"] = 100, + ["]"] = 100, + ["|"] = 100, + ["\\"] = 120, + ["!"] = 100, + ["?"] = 100, + }, + } + }, + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "EBGaramond-Italic", + "EBGaramond-BoldItalic", + }, + data = { + ["f"] = { + [")"] = 120, + ["}"] = 120, + ["]"] = 120, + ["|"] = 120, + ["\\"] = 120, + ["!"] = 75, + ["?"] = 75, + ["*"] = 120, + }, + ["("] = { + ["f"] = 120, + }, + ["{"] = { + ["f"] = 120, + }, + ["["] = { + ["f"] = 120, + }, + ["|"] = { + ["f"] = 120, + }, + } + }, + } +} diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/erewhon-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/erewhon-math.lfg index 54cc687fab6..91f084e9b64 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/erewhon-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/erewhon-math.lfg @@ -53,6 +53,9 @@ return { presets.moveintegrals { factor = 1.5 }, presets.wipeitalics { }, { + tweak = "checkaccents", + }, + { tweak = "kerns", list = { [0x002F] = { topleft = -0.15, bottomright = -0.15 }, @@ -73,6 +76,9 @@ return { }, }, { + tweak = "flattenaccents", + }, + { tweak = "radicaldegreeanchors", list = { ["0x221A.parts.bottom"] = { location = "left", hfactor = .1, vfactor = 1.025 }, @@ -90,6 +96,29 @@ return { { tweak = "addrules", }, +{ + tweak = "replacerules", + -- minus = { + -- height = 0.188, + -- yoffset = 0.812, + -- leftoffset = 0.2, + -- rightoffset = 0.2, + -- }, + fraction = { + height = .188, + yoffset = .812, + }, + radical = { + height = .188, + yoffset = .812, + leftoffset = 0.12, + rightoffset = 0.12, + }, + stacker = { + height = .188, + yoffset = .812, + }, +}, { tweak = "addactuarian", }, diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/erewhon-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/erewhon-text.lfg new file mode 100644 index 00000000000..46a3aa84228 --- /dev/null +++ b/Master/texmf-dist/tex/context/fonts/mkiv/erewhon-text.lfg @@ -0,0 +1,81 @@ +return { + name = "erewhon-text", + version = "1.00", + comment = "Goodies that complement erewhon.", + author = "Mikael Sundqvist & Hans Hagen", + copyright = "ConTeXt development team", + extensions = { + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "Erewhon-Regular", + -- "Erewhon-Bold", + }, + data = { + ["f"] = { + [")"] = 100, + ["}"] = 100, + ["]"] = 100, + ["|"] = 100, + ["\\"] = 75, + ["!"] = 100, + ["?"] = 100, + ["*"] = 100, + }, + } + }, + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "Erewhon-Bold", + }, + data = { + ["f"] = { + [")"] = 25, + ["}"] = 50, + ["]"] = 25, + ["|"] = 50, + ["\\"] = 75, + ["!"] = 50, + ["?"] = 50, + ["*"] = 50, + }, + } + }, + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "Erewhon-Italic", + "Erewhon-BoldItalic", + }, + data = { + ["f"] = { + [")"] = 50, + ["}"] = 50, + ["]"] = 50, + ["|"] = 125, + ["\\"] = 125, + ["!"] = 100, + ["?"] = 100, + ["*"] = 100, + ["@"] = 100, + }, + ["("] = { + ["f"] = 100, + }, + ["{"] = { + ["f"] = 100, + }, + ["["] = { + ["f"] = 100, + }, + ["|"] = { + ["f"] = 130, + }, + } + }, + } +} diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/euler-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/euler-math.lfg index 1c4659786fa..23d92b0479d 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/euler-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/euler-math.lfg @@ -78,6 +78,9 @@ return { -- add the accent fixes -- fixslashes? { + tweak = "flattenaccents", + }, + { tweak = "checkspacing", }, { diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/iwona-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/iwona-math.lfg index 815b9e1207b..2754e15777a 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/iwona-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/iwona-math.lfg @@ -29,6 +29,82 @@ local uglyones = { vextenddouble = true, } +local recipes = { + ["iwona-math"] = { + { name = "file:LatinModern-Math", features = "virtualmath-iwona", main = true, parameters = false }, + -- + { name = "rm-iwonar.tfm", vector = "tex-mr", skewchar=0x7F }, + { name = "mi-iwonari.tfm", vector = "tex-mi", skewchar=0x7F }, + { name = "mi-iwonari.tfm", vector = "tex-it", skewchar=0x7F }, + { name = "mi-iwonami.tfm", vector = "tex-bi", skewchar=0x7F }, + { name = "rm-iwonam.tfm", vector = "tex-bf", skewchar=0x7F }, + { name = "sy-iwonarz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, + { name = "ex-iwonar.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, + }, + ["iwona-light-math"] = { + { name = "file:LatinModern-Math", features = "virtualmath-iwona-light", main = true, parameters = false }, + -- + { name = "rm-iwonal.tfm", vector = "tex-mr", skewchar=0x7F }, + { name = "mi-iwonali.tfm", vector = "tex-mi", skewchar=0x7F }, + { name = "mi-iwonali.tfm", vector = "tex-it", skewchar=0x7F }, + { name = "mi-iwonari.tfm", vector = "tex-bi", skewchar=0x7F }, + { name = "rm-iwonar.tfm", vector = "tex-bf", skewchar=0x7F }, + { name = "sy-iwonalz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, + { name = "ex-iwonal.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, + }, + ["iwona-medium-math"] = { + { name = "file:LatinModern-Math", features = "virtualmath-iwona-medium", main = true, parameters = false }, + -- + { name = "rm-iwonam.tfm", vector = "tex-mr", skewchar=0x7F }, + { name = "mi-iwonami.tfm", vector = "tex-mi", skewchar=0x7F }, + { name = "mi-iwonami.tfm", vector = "tex-it", skewchar=0x7F }, + { name = "mi-iwonabi.tfm", vector = "tex-bi", skewchar=0x7F }, + { name = "rm-iwonab.tfm", vector = "tex-bf", skewchar=0x7F }, + { name = "sy-iwonamz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, + { name = "ex-iwonam.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, + }, + ["iwona-heavy-math"] = { + { name = "file:LatinModern-Math", features = "virtualmath-iwona-heavy", main = true, parameters = false }, + -- + { name = "rm-iwonah.tfm", vector = "tex-mr", skewchar=0x7F }, + { name = "mi-iwonahi.tfm", vector = "tex-mi", skewchar=0x7F }, + { name = "mi-iwonahi.tfm", vector = "tex-it", skewchar=0x7F }, + { name = "mi-iwonahi.tfm", vector = "tex-bi", skewchar=0x7F }, + { name = "rm-iwonah.tfm", vector = "tex-bf", skewchar=0x7F }, + { name = "sy-iwonahz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, + { name = "ex-iwonah.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, + }, +} + +local tweaks = nil +local common = fonts.goodies.load("common-math-jmn.lfg") + +if common then + + tweaks = { + { + tweak = "addmissing", + action = common.mathematics.helpers.addmissing, + }, + { + tweak = "setoptions", + set = { "ignorekerndimensions" } + }, -- we have dp > ht fences + { + tweak = "fixprimes", + factor = 1.0, -- accent base height + fake = 0.9, -- replace multiples with this width proportion + }, + { + tweak = "addequals", + force = true, + }, + } + + common.mathematics.helpers.copyrecipes(recipes) + +end + return { name = "iwona-math", version = "1.00", @@ -44,51 +120,15 @@ return { -- "mkiv-base.map", }, virtuals = { - ["iwona-math"] = { - { name = "file:LatinModern-Math", features = "virtualmath-iwona", main = true, parameters = false }, - -- - { name = "rm-iwonar.tfm", vector = "tex-mr", skewchar=0x7F }, - { name = "mi-iwonari.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "mi-iwonari.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "mi-iwonami.tfm", vector = "tex-bi", skewchar=0x7F }, - { name = "rm-iwonam.tfm", vector = "tex-bf", skewchar=0x7F }, - { name = "sy-iwonarz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, - { name = "ex-iwonar.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, - }, - ["iwona-light-math"] = { - { name = "file:LatinModern-Math", features = "virtualmath-iwona-light", main = true, parameters = false }, - -- - { name = "rm-iwonal.tfm", vector = "tex-mr", skewchar=0x7F }, - { name = "mi-iwonali.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "mi-iwonali.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "mi-iwonari.tfm", vector = "tex-bi", skewchar=0x7F }, - { name = "rm-iwonar.tfm", vector = "tex-bf", skewchar=0x7F }, - { name = "sy-iwonalz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, - { name = "ex-iwonal.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, - }, - ["iwona-medium-math"] = { - { name = "file:LatinModern-Math", features = "virtualmath-iwona-medium", main = true, parameters = false }, - -- - { name = "rm-iwonam.tfm", vector = "tex-mr", skewchar=0x7F }, - { name = "mi-iwonami.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "mi-iwonami.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "mi-iwonabi.tfm", vector = "tex-bi", skewchar=0x7F }, - { name = "rm-iwonab.tfm", vector = "tex-bf", skewchar=0x7F }, - { name = "sy-iwonamz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, - { name = "ex-iwonam.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, - }, - ["iwona-heavy-math"] = { - { name = "file:LatinModern-Math", features = "virtualmath-iwona-heavy", main = true, parameters = false }, - -- - { name = "rm-iwonah.tfm", vector = "tex-mr", skewchar=0x7F }, - { name = "mi-iwonahi.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "mi-iwonahi.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "mi-iwonahi.tfm", vector = "tex-bi", skewchar=0x7F }, - { name = "rm-iwonah.tfm", vector = "tex-bf", skewchar=0x7F }, - { name = "sy-iwonahz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, - { name = "ex-iwonah.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, - } + ["iwona-math"] = { recipe = recipes["iwona-math"], tweaks = tweaks }, + ["iwona-light-math"] = { recipe = recipes["iwona-light-math"], tweaks = tweaks }, + ["iwona-medium-math"] = { recipe = recipes["iwona-medium-math"], tweaks = tweaks }, + ["iwona-heavy-math"] = { recipe = recipes["iwona-heavy-math"], tweaks = tweaks }, + + ["iwona-math-nt"] = { recipe = common and recipes["iwona-math-nt"] or nil }, + ["iwona-light-math-nt"] = { recipe = common and recipes["iwona-light-math-nt"] or nil }, + ["iwona-medium-math-nt"] = { recipe = common and recipes["iwona-medium-math-nt"] or nil }, + ["iwona-heavy-math-nt"] = { recipe = common and recipes["iwona-heavy-math-nt"] or nil }, }, - addmissing = helpers.addmissing, } } diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/koeielettersot.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/koeielettersot.lfg deleted file mode 100644 index 74bf2dd4966..00000000000 --- a/Master/texmf-dist/tex/context/fonts/mkiv/koeielettersot.lfg +++ /dev/null @@ -1,16 +0,0 @@ -return { - name = "koeielettersot", - version = "1.00", - comment = "Goodies that complement koeielettersot", - author = "Hans Hagen", - copyright = "ConTeXt development team", - mathematics = { - rules = { - ["radical.extender"] = "radical.extender", - ["radical.end"] = "radical.end", - ["hrule.begin"] = "rule.begin", - ["hrule.extender"] = "rule.ex", - ["hrule.end"] = "rule.end", - } - } -} diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-math.lfg index 67ad3841f95..628dd13b657 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-math.lfg @@ -26,6 +26,9 @@ return { expected = "Version 0.40", }, { + tweak = "checkaccents", + }, + { tweak = "dimensions", list = { [0x2A3F] = { factor = 0.84625 } @@ -102,7 +105,9 @@ return { ["0x221A.parts.bottom"] = { location = "left", hfactor = .0, vfactor = 0.65 }, } }, - + { + tweak = "flattenaccents", + }, { tweak = "addscripts", }, @@ -112,6 +117,29 @@ return { { tweak = "addrules", }, +{ + tweak = "replacerules", + -- minus = { + -- height = 0.1818, + -- yoffset = 0.818, + -- leftoffset = 0.2, + -- rightoffset = 0.2, + -- }, + fraction = { + height = .1818, + yoffset = .818, + }, + radical = { + height = .1818, + yoffset = .818, + leftoffset = 0.08, + rightoffset = 0.08, + }, + stacker = { + height = .1818, + yoffset = .818, + }, +}, { -- This will be fixed. Check if new version comes out! tweak = "addbars", diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-text.lfg new file mode 100644 index 00000000000..6a14bec54f6 --- /dev/null +++ b/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-text.lfg @@ -0,0 +1,57 @@ +return { + name = "kpfonts-text", + version = "1.00", + comment = "Goodies that complement kpfonts.", + author = "Mikael Sundqvist & Hans Hagen", + copyright = "ConTeXt development team", + extensions = { + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "KpRoman-Regular", + }, + data = { + ["f"] = { + [")"] = 50, + ["}"] = 50, + ["]"] = 50, + ["*"] = 50, + }, + } + }, + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "KpRoman-Italic", + "KpRoman-SemiboldItalic", + }, + data = { + ["f"] = { + [")"] = 150, + ["}"] = 50, + ["]"] = 50, + ["|"] = 125, + ["\\"] = 125, + ["!"] = 100, + ["?"] = 100, + ["*"] = 100, + ["@"] = 100, + }, + ["("] = { + ["f"] = 100, + }, + ["{"] = { + ["f"] = 100, + }, + ["["] = { + ["f"] = 100, + }, + ["|"] = { + ["f"] = 130, + }, + } + }, + } +} diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/kurier-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/kurier-math.lfg index 22199251855..a7290d0cafb 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/kurier-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/kurier-math.lfg @@ -29,6 +29,82 @@ local uglyones = { vextenddouble = true, } +local recipes = { + ["kurier-math"] = { + { name = "file:LatinModern-Math", features = "virtualmath-kurier", main = true, parameters = false }, + -- + { name = "rm-kurierr.tfm", vector = "tex-mr", skewchar=0x7F }, + { name = "mi-kurierri.tfm", vector = "tex-mi", skewchar=0x7F }, + { name = "mi-kurierri.tfm", vector = "tex-it", skewchar=0x7F }, + { name = "mi-kuriermi.tfm", vector = "tex-bi", skewchar=0x7F }, + { name = "rm-kurierm.tfm", vector = "tex-bf", skewchar=0x7F }, + { name = "sy-kurierrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, + { name = "ex-kurierr.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, + }, + ["kurier-light-math"] = { + { name = "file:LatinModern-Math", features = "virtualmath-kurier-light", main = true, parameters = false }, + -- + { name = "rm-kurierl.tfm", vector = "tex-mr", skewchar=0x7F }, + { name = "mi-kurierli.tfm", vector = "tex-mi", skewchar=0x7F }, + { name = "mi-kurierli.tfm", vector = "tex-it", skewchar=0x7F }, + { name = "mi-kurierri.tfm", vector = "tex-bi", skewchar=0x7F }, + { name = "rm-kurierr.tfm", vector = "tex-bf", skewchar=0x7F }, + { name = "sy-kurierlz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, + { name = "ex-kurierl.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, + }, + ["kurier-medium-math"] = { + { name = "file:LatinModern-Math", features = "virtualmath-kurier-medium", main = true, parameters = false }, + -- + { name = "rm-kurierm.tfm", vector = "tex-mr", skewchar=0x7F }, + { name = "mi-kuriermi.tfm", vector = "tex-mi", skewchar=0x7F }, + { name = "mi-kuriermi.tfm", vector = "tex-it", skewchar=0x7F }, + { name = "mi-kurierhi.tfm", vector = "tex-bi", skewchar=0x7F }, + { name = "rm-kurierh.tfm", vector = "tex-bf", skewchar=0x7F }, + { name = "sy-kuriermz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, + { name = "ex-kurierm.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, + }, + ["kurier-heavy-math"] = { + { name = "file:LatinModern-Math", features = "virtualmath-kurier-heavy", main = true, parameters = false }, + -- + { name = "rm-kurierh.tfm", vector = "tex-mr", skewchar=0x7F }, + { name = "mi-kurierhi.tfm", vector = "tex-mi", skewchar=0x7F }, + { name = "mi-kurierhi.tfm", vector = "tex-it", skewchar=0x7F }, + { name = "mi-kurierhi.tfm", vector = "tex-bi", skewchar=0x7F }, + { name = "rm-kurierh.tfm", vector = "tex-bf", skewchar=0x7F }, + { name = "sy-kurierhz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, + { name = "ex-kurierh.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, + } +} + +local tweaks = nil +local common = fonts.goodies.load("common-math-jmn.lfg") + +if common then + + tweaks = { + { + tweak = "addmissing", + action = common.mathematics.helpers.addmissing, + }, + { + tweak = "setoptions", + set = { "ignorekerndimensions" } + }, -- we have dp > ht fences + { + tweak = "fixprimes", + factor = 1.0, -- accent base height + fake = 0.9, -- replace multiples with this width proportion + }, + { + tweak = "addequals", + force = true, + }, + } + + common.mathematics.helpers.copyrecipes(recipes) + +end + return { name = "kurier-math", version = "1.00", @@ -44,51 +120,15 @@ return { -- "mkiv-base.map", }, virtuals = { - ["kurier-math"] = { - { name = "file:LatinModern-Math", features = "virtualmath-kurier", main = true, parameters = false }, - -- - { name = "rm-kurierr.tfm", vector = "tex-mr", skewchar=0x7F }, - { name = "mi-kurierri.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "mi-kurierri.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "mi-kuriermi.tfm", vector = "tex-bi", skewchar=0x7F }, - { name = "rm-kurierm.tfm", vector = "tex-bf", skewchar=0x7F }, - { name = "sy-kurierrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, - { name = "ex-kurierr.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, - }, - ["kurier-light-math"] = { - { name = "file:LatinModern-Math", features = "virtualmath-kurier-light", main = true, parameters = false }, - -- - { name = "rm-kurierl.tfm", vector = "tex-mr", skewchar=0x7F }, - { name = "mi-kurierli.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "mi-kurierli.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "mi-kurierri.tfm", vector = "tex-bi", skewchar=0x7F }, - { name = "rm-kurierr.tfm", vector = "tex-bf", skewchar=0x7F }, - { name = "sy-kurierlz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, - { name = "ex-kurierl.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, - }, - ["kurier-medium-math"] = { - { name = "file:LatinModern-Math", features = "virtualmath-kurier-medium", main = true, parameters = false }, - -- - { name = "rm-kurierm.tfm", vector = "tex-mr", skewchar=0x7F }, - { name = "mi-kuriermi.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "mi-kuriermi.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "mi-kurierhi.tfm", vector = "tex-bi", skewchar=0x7F }, - { name = "rm-kurierh.tfm", vector = "tex-bf", skewchar=0x7F }, - { name = "sy-kuriermz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, - { name = "ex-kurierm.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, - }, - ["kurier-heavy-math"] = { - { name = "file:LatinModern-Math", features = "virtualmath-kurier-heavy", main = true, parameters = false }, - -- - { name = "rm-kurierh.tfm", vector = "tex-mr", skewchar=0x7F }, - { name = "mi-kurierhi.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "mi-kurierhi.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "mi-kurierhi.tfm", vector = "tex-bi", skewchar=0x7F }, - { name = "rm-kurierh.tfm", vector = "tex-bf", skewchar=0x7F }, - { name = "sy-kurierhz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true }, - { name = "ex-kurierh.tfm", vector = "tex-ex", extension = true, badones = badones, ignore = uglyones }, - } + ["kurier-math"] = { recipe = recipes["kurier-math"], tweaks = tweaks }, + ["kurier-light-math"] = { recipe = recipes["kurier-light-math"], tweaks = tweaks }, + ["kurier-medium-math"] = { recipe = recipes["kurier-medium-math"], tweaks = tweaks }, + ["kurier-heavy-math"] = { recipe = recipes["kurier-heavy-math"], tweaks = tweaks }, + + ["kurier-math-nt"] = { recipe = common and recipes["kurier-math-nt"] or nil }, + ["kurier-light-math-nt"] = { recipe = common and recipes["kurier-light-math-nt"] or nil }, + ["kurier-medium-math-nt"] = { recipe = common and recipes["kurier-medium-math-nt"] or nil }, + ["kurier-heavy-math-nt"] = { recipe = common and recipes["kurier-heavy-math-nt"] or nil }, }, - addmissing = helpers.addmissing, - } + }, } diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/libertinus-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/libertinus-math.lfg index 6f707ed2b8f..02afa0e90b4 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/libertinus-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/libertinus-math.lfg @@ -58,6 +58,9 @@ return { presets.moveintegrals { factor = 1.5 }, presets.wipeitalics { }, { + tweak = "checkaccents", + }, + { tweak = "simplifykerns", }, { @@ -87,19 +90,22 @@ return { tweak = "extendaccents", }, { + tweak = "flattenaccents", + }, + { tweak = "fixaccents", }, -- First we set the dimensions of the initial accent which started out as zero but we want -- a proper width. - { - tweak = "dimensions", - list = { - [0x00302] = { width = 1.8, anchor = 1.40, xoffset = .20 }, -- widehat - [0x00303] = { width = 2.0, anchor = 1.50, xoffset = .30 }, -- widetilde - [0x00306] = { width = 1.6, anchor = 1.30, xoffset = .15 }, -- widebreve - [0x0030C] = { width = 1.3, anchor = 1.15, xoffset = .075 }, -- widecheck - }, - }, + -- { + -- tweak = "dimensions", + -- list = { + -- [0x00302] = { width = 1.8, anchor = 1.40, xoffset = .20 }, -- widehat + -- [0x00303] = { width = 2.0, anchor = 1.50, xoffset = .30 }, -- widetilde + -- [0x00306] = { width = 1.6, anchor = 1.30, xoffset = .15 }, -- widebreve + -- [0x0030C] = { width = 1.3, anchor = 1.15, xoffset = .075 }, -- widecheck + -- }, + -- }, -- Then we deal with all offsets and heights in one go. So we treat the initial accent -- as well as the variants here. None in libertinus. -- We now copy these to the not wide slots so that we can set these to stretch as well, @@ -139,6 +145,30 @@ return { advance = 0.5, }, { + tweak = "replacerules", + minus = { + height = .176, + yoffset = .825, + leftoffset = .065, + rightoffset = .065, + }, + fraction = { + height = .176, + yoffset = .825, + }, + radical = { + height = .140, + yoffset = .6575, + leftoffset = .075, + rightoffset = .075, + yscale = .8, + }, + stacker = { + height = .176, + yoffset = .825, + }, + }, + { tweak = "addactuarian", }, { diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/libertinus-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/libertinus-text.lfg new file mode 100644 index 00000000000..76afb51cd3c --- /dev/null +++ b/Master/texmf-dist/tex/context/fonts/mkiv/libertinus-text.lfg @@ -0,0 +1,59 @@ +return { + name = "libertinus-text", + version = "1.00", + comment = "Goodies that complement libertinus.", + author = "Mikael Sundqvist & Hans Hagen", + copyright = "ConTeXt development team", + extensions = { + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "LibertinusSerif-Regular", + }, + data = { + ["f"] = { + [")"] = 50, + ["}"] = 50, + ["]"] = 50, + ["|"] = 100, + ["\\"] = 50, + ["*"] = 50, + }, + } + }, + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "LibertinusSerif-Italic", + "LibertinusSerif-BoldItalic", + }, + data = { + ["f"] = { + [")"] = 50, + ["}"] = 50, + ["]"] = 50, + ["|"] = 125, + ["\\"] = 125, + ["!"] = 100, + ["?"] = 100, + ["*"] = 100, + ["@"] = 100, + }, + ["("] = { + ["f"] = 100, + }, + ["{"] = { + ["f"] = 100, + }, + ["["] = { + ["f"] = 100, + }, + ["|"] = { + ["f"] = 130, + }, + } + }, + } +} diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/lucida-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/lucida-math.lfg deleted file mode 100644 index 64f53dc33f8..00000000000 --- a/Master/texmf-dist/tex/context/fonts/mkiv/lucida-math.lfg +++ /dev/null @@ -1,225 +0,0 @@ -local common = fonts.goodies.load("common-math.lfg") -local presets = common.mathematics.tweaks.presets - -local integral_variants = { bottomright = -0.20 } ------ integral_top = { topright = 0.05 } -local integral_bottom = { bottomright = -0.45 } - -return { - name = "lucida-opentype-math", - version = "1.00", - comment = "Goodies that complement lucida opentype.", - author = "Hans Hagen & Mikael Sundqvist", - copyright = "ConTeXt development team", - mathematics = { - parameters = { - FractionRuleThickness = 55, - AccentBaseDepth = 250, - DelimiterPercent = 90, - DelimiterShortfall = 400, - SuperscriptBottomMaxWithSubscript = 325, - PrimeShiftUp = "1.4*SuperscriptShiftUp", - PrimeShiftUpCramped = "1.4*SuperscriptShiftUp", - PrimeBaselineDropMax = "0.5*SuperscriptBaselineDropMax", - }, - tweaks = { - aftercopying = { - { - tweak = "version", - expected = "Version 1.901", - }, - { - tweak = "fixoldschool", - version = "Version 1.802", - }, -{ - tweak = "parameters", - feature = "boldmath", - list = { --- RadicalRuleThickness = 55, - RadicalRuleThickness = 60, --- RadicalRuleThickness = "1.09*RadicalRuleThickness", --- FractionRuleThickness = 65, --- OverRuleThickness = 65, --- UnderRuleThickness = 65, - } -}, - { - tweak = "addmirrors", - }, - presets.scripttocalligraphic { }, - presets.rsfstoscript { rscale = 1 }, - presets.rsfsuprighttoscript { rscale = 1 }, - presets.moderntocalligraphic { rscale = 1 }, - presets.eulertocalligraphic { rscale = 1 }, - presets.xitsarabic { rscale = 1.05 }, - presets.fallbacks { }, - presets.moveitalics { correct = true }, - presets.moveitalics { correct = true, letters = true }, - presets.moveintegrals { factor = 1.5 }, - presets.wipeitalics { }, - { - tweak = "replacealphabets", - list = { - { - source = "uppercasescript", - target = "uppercasecalligraphic", - feature = "ss04", - }, - { - source = "lowercasescript", - target = "lowercasecalligraphic", - feature = "ss04", - }, - { - source = "uppercaseboldscript", - target = "uppercaseboldcalligraphic", - feature = "ss04", - }, - -- No lowercase bold calligraphic/script in font - }, - }, - { - tweak = "dimensions", - version = "Version 1.802", - list = { - -- The < and > are slightly too small. We scale them by 867/795 - ["0x003C"] = { scale = 1.09057, width = 1.09057, height = 1.09057 }, - ["0x003E"] = { scale = 1.09057, width = 1.09057, height = 1.09057 }, - }, - }, - { - tweak = "dimensions", - version = "Version 1.802", - list = { - -- these we fix here. Remove when we have new version of Lucida - ["0x23DC.parts.1"] = { xoffset = -0.075, height = .4, yoffset = -0.6 }, - ["0x23DC.parts.2"] = { height = .4, yoffset = -0.6 }, - ["0x23DC.parts.3"] = { xoffset = 0.075, height = .4, yoffset = -0.6 }, - ["0x23DD.parts.1"] = { xoffset = -0.075, depth = .8, yoffset = 0.2 }, - ["0x23DD.parts.2"] = { depth = .8, yoffset = 0.2 }, - ["0x23DD.parts.3"] = { xoffset = 0.075, depth = .8, yoffset = 0.2 }, - ["0x7C.variants.3"] = { squeeze = 0.90, height = 0.90, depth = 0.90 }, - ["0x7C.variants.4"] = { squeeze = 0.80, height = 0.80, depth = 0.80 }, - }, - }, - -- Accents are a mess. We migrate the extensibles from the combiners to the base accent - -- and then need to tweak the width (which is auto set because it was zero with a large - -- accent anchor offset). First we copy and fix. - { - tweak = "extendaccents", - }, - { - tweak = "radicaldegreeanchors", - list = { - ["0x221A.variants.3"] = { location = "left", hfactor = 0, vfactor = .55 }, - ["0x221A.variants.4"] = { location = "left", hfactor = 0, vfactor = .50 }, - ["0x221A.parts.bottom"] = { location = "left", hfactor = 0, vfactor = .85 }, - } - }, - { - tweak = "fixaccents", - }, - -- First we set the dimensions of the initial accent which started out as zero but we want - -- a proper width. Not in lucida - -- Then we deal with all offsets and heights in one go. So we treat the initial accent - -- as well as the variants here. Not in lucida. - -- We now copy these to the not wide slots so that we can set these to stretch as well, - -- if only because it is less confusing and more consistent. - { - tweak = "copyaccents", - }, - -- So far for the accents. - { - tweak = "fixslashes", - }, - { - tweak = "addbreve", - }, - { - tweak = "kerns", - list = { - [0x002F] = { topleft = -0.2, bottomright = -0.2 }, - ["0x7D.parts.top"] = { topright = -0.15 }, -- right brace top - ["0x7D.parts.bottom"] = { bottomright = -0.15 }, -- right brace bottom - ["0x7D.variants.*"] = { topright = -0.15, bottomright = -0.15 }, -- right brace variants - ["0x29.parts.top"] = { topright = -0.25 }, -- right parenthesis top - ["0x29.parts.bottom"] = { bottomright = -0.25 }, -- right parenthesis bottom - ["0x29.variants.*"] = { topright = -0.2, bottomright = -0.2 }, -- right parenthesis variants - ["0x221A.parts.top"] = { topright = 0.2 }, -- right radical top - ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom - ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants - [0x27E9] = { topright = -0.2, bottomright = -0.2 }, -- angle - ["0x27E9.variants.*"] = { topright = -0.3, bottomright = -0.3 }, - [0x27EB] = { topright = -0.2, bottomright = -0.2 }, - ["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 }, - }, - }, - { - tweak = "fixprimes", - factor = 0.7, -- accent base height - fake = 0.65, -- replace multiples with this width proportion - }, - { - tweak = "checkspacing", - }, - { - tweak = "addscripts", - }, - { - tweak = "accentdimensions", - }, - { - tweak = "addrules", - }, - { - tweak = "addactuarian", - }, - { - tweak = "addfourier", - variant = 1, - }, - { - tweak = "addprimed", - }, - { - tweak = "addarrows", - left = 0.1, - right = 0.1, - slack = 0.20, - list = { - [0x21A9] = false, - [0x21AA] = false, - [0x2190] = false, - [0x2192] = false, - [0x219E] = false, - [0x21A0] = false, - } - }, - -- this is the mkiv section - { - tweak = "emulatelmtx", - feature = "emulatelmtx", - comment = "this is for mkiv", - }, - }, - }, - alternates = { - textitalic = { feature = 'ss01', value = 1, comment = "Mathematical Alternative Lowercase Italic" }, - arrow = { feature = 'ss02', value = 1, comment = "Mathematical Alternative Smaller Arrows" }, - operator = { feature = 'ss03', value = 1, comment = "Mathematical Alternative Smaller Operators" }, - calligraphic = { feature = 'ss04', value = 1, comment = "Mathematical Alternative Calligraphic Characters" }, - zero = { feature = 'ss05', value = 1, comment = "Mathematical Alternative Zero" }, - multipledots = { feature = 'ss06', value = 1, comment = "Mathematical Alternative Multiple Dots" }, - ldots = { feature = 'ss07', value = 1, comment = "Mathematical Alternative Ellipsis" }, - }, - bigslots = { - 1, 2, 3, 4 - }, - -- - -- experimental fixes for mkiv: - -- - dimensions = dimensions, - kerns = kerns, - }, -} diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/lucida-typeone-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/lucida-typeone-math.lfg deleted file mode 100644 index 82ba589cd48..00000000000 --- a/Master/texmf-dist/tex/context/fonts/mkiv/lucida-typeone-math.lfg +++ /dev/null @@ -1,348 +0,0 @@ -local mathencodings = fonts.encodings.math - -mathencodings["lbr-ma"] = { - [0x025CB] = 0x00, -- circle - [0x025CF] = 0x01, -- blackcircle - [0x025A1] = 0x02, -- square - [0x025A0] = 0x03, -- blacksquare - [0x025B3] = 0x04, -- triangleup - [0x025B2] = 0x05, -- blacktriangleup - [0x025BD] = 0x06, -- triangledown - [0x025BC] = 0x07, -- blacktriangledown - [0x02B28] = 0x08, -- lozenge - [0x02B27] = 0x09, -- blacklozenge - [0x02B29] = 0x0A, -- blackdiamond - [0x02571] = 0x0B, -- upright - [0x02572] = 0x0C, -- downright - [0x022E4] = 0x0D, -- squareimageofnoteq - [0x022E5] = 0x0E, -- squareoriginalofnoteq - [0x02A4F] = 0x0F, -- dblsquareunion - [0x02A4E] = 0x10, -- dblsquareintersection - [0x02A64] = 0x11, -- zdomainantirestriction - [0x02A65] = 0x12, -- zrangeantirestriction - [0x022EE] = 0x13, -- verticalellipsis - [0x022EF] = 0x14, -- ellipsis - [0x022F0] = 0x15, -- uprightellipsis - [0x022F1] = 0x16, -- downrightellipsis - [0x022D5] = 0x17, -- equalparallel - - [0x0225B] = 0x1A, -- stareq - [0x00127] = 0x1B, -- hbar - [0x022F6] = 0x1C, -- barelementof - [0x02209] = 0x1D, -- notelementof - [0x022FD] = 0x1E, -- barcontains - [0x0220C] = 0x1F, -- notcontain - [0x02204] = 0x20, -- nexists - [0x02194] = 0x21, -- leftrightarrow - [0x02195] = 0x22, -- updownarrow - [0x0219E] = 0x23, -- leftleftarrow - [0x0219F] = 0x24, -- upuparrow - [0x021A0] = 0x25, -- rightrightarrow --- [0x00026] = 0x26, -- amperand - [0x021A1] = 0x27, -- downdownarrow - [0x021A2] = 0x28, -- leftarrowtail - [0x021A3] = 0x29, -- rightarrowtail - [0x021A4] = 0x2A, -- leftarrowbar - [0x021A6] = 0x2B, -- rightarrowbar - [0x021A5] = 0x2C, -- uparrowbar --- [0x02212] = 0x2D, -- minus --- [0x0002D] = 0x2D, -- minus - [0x021A7] = 0x2E, -- downarrowbar - [0x021E4] = 0x2F, -- barleftarrow - [0x021E5] = 0x30, -- barrightarrow - - [0x021E0] = 0x38, -- dashleftarrow - [0x021E1] = 0x39, -- dashuparrow - [0x021E2] = 0x3A, -- dashrightarrow - [0x021E3] = 0x3B, -- dashdownarrow - [0x021A9] = 0x3C, -- hookleftarrow --- [0x0003D] = 0x3D, -- equalto - [0x021AA] = 0x3E, -- hookrightarrow - [0x021AB] = 0x3F, -- looparrowleft - [0x021AC] = 0x40, -- looparrowright - [0x1D538] = 0x41, -- A (blackboard A) - [0x1D539] = 0x42, -- B - [0x02102] = 0x43, -- C - [0x1D53B] = 0x44, -- D - [0x1D53C] = 0x45, -- E - [0x1D53D] = 0x46, -- F - [0x1D53E] = 0x47, -- G - [0x0210D] = 0x48, -- H - [0x1D540] = 0x49, -- I - [0x1D541] = 0x4A, -- J - [0x1D542] = 0x4B, -- K - [0x1D543] = 0x4C, -- L - [0x1D544] = 0x4D, -- M - [0x02115] = 0x4E, -- N - [0x1D546] = 0x4F, -- O - [0x02119] = 0x50, -- P - [0x0211A] = 0x51, -- Q - [0x0211D] = 0x52, -- R - [0x1D54A] = 0x53, -- S - [0x1D54B] = 0x54, -- T - [0x1D54C] = 0x55, -- U - [0x1D54D] = 0x56, -- V - [0x1D54E] = 0x57, -- W - [0x1D54F] = 0x58, -- X - [0x1D550] = 0x59, -- Y - [0x02124] = 0x5A, -- Z (blackboard Z) - [0x0231C] = 0x5B, -- ulcorner - [0x0231D] = 0x5C, -- urcorner - [0x0231E] = 0x5D, -- llcorner - [0x0231F] = 0x5E, -- lrcorner - [0x02225] = 0x5F, -- parallel, Vert, lVert, rVert, arrowvert - [0x021D5] = 0x60, -- Updownarrow - [0x021D4] = 0x61, -- Leftrightarrow - [0x021D6] = 0x62, -- Upleftarrow - [0x021D7] = 0x63, -- Uprightarrow - [0x021D9] = 0x64, -- Downleftarrow - [0x021D8] = 0x65, -- Downrightarrow - [0x021CD] = 0x66, -- nLeftarrow - [0x021CE] = 0x67, -- nLeftrightarrow - [0x021CF] = 0x68, -- nRightarrow --- [0x021CE] = 0x69, -- nLeftrightarrow -- what's the difference between this and 0x0067[0x021CE] - [0x021DA] = 0x6A, -- Lleftarrow - [0x1D55C] = 0x6B, -- k \Bbbk (blackboard k) - [0x021DB] = 0x6C, -- Rrightarrow - [0x021C4] = 0x6D, -- rlarrow - [0x021C6] = 0x6E, -- lrarrow - [0x021C5] = 0x6F, -- udarrow --- [0x021C5] = 0x70, -- duarrow - [0x021C7] = 0x71, -- llarrow - [0x021C8] = 0x72, -- uuarrow - [0x021C9] = 0x73, -- rrarrow - [0x021CA] = 0x74, -- ddarrow - [0x021BE] = 0x75, -- rupharpoon - [0x021BF] = 0x76, -- lupharpoon - [0x021C2] = 0x77, -- rdownharpoon - [0x021C3] = 0x78, -- ldownharpoon - [0x021CB] = 0x79, -- lrharpoon - [0x021CC] = 0x7A, -- rlharpoon - [0x021B0] = 0x7B, -- upthenleftarrow --- [0x00000] = 0x7C, -- part - [0x021B1] = 0x7D, -- upthenrightarrow --- [0x00000] = 0x7E, -- part - [0x02276] = 0x7F, -- ltgt - [0x021B2] = 0x81, -- downthenleftarrow - [0x021B3] = 0x82, -- downthenrightarrow - [0x02B0E] = 0x83, -- rightthendownarrow - [0x02B10] = 0x84, -- leftthendownarrow - [0x02B0F] = 0x85, -- rightthenuparrow - [0x02B11] = 0x86, -- leftthenuparrow - [0x021B6] = 0x87, -- leftarcarrow - [0x021B7] = 0x88, -- rightarcarrow - [0x0293D] = 0x89, -- leftarcarrowplus - [0x0293C] = 0x8A, -- rightarcarrowminus - [0x021BA] = 0x8B, -- anticlockwise - [0x021BB] = 0x8C, -- clockwise - - [0x02260] = 0x94, -- noteq - [0x02262] = 0x95, -- notidentical - [0x02241] = 0x96, -- nottilde - [0x02244] = 0x97, -- notasymptoticallyequal - [0x02249] = 0x98, -- notalmostequal - [0x02247] = 0x99, -- notapproximatelyeq - [0x0226E] = 0x9A, -- nless - [0x0226F] = 0x9B, -- ngtr - [0x02270] = 0x9C, -- nleq - [0x02271] = 0x9D, -- ngeq - [0x022E6] = 0x9E, -- lnsim - [0x022E7] = 0x9F, -- gnsim - [0x02605] = 0xAB, -- black star - [0x02713] = 0xAC, -- check - [0x02277] = 0xC5, -- gtlt - [0x02284] = 0xC6, -- nsubsetof - [0x02285] = 0xC7, -- nsupsetof - [0x02288] = 0xC8, -- nsubseteq - [0x02289] = 0xC9, -- nsupseteq - - [0x0228A] = 0xCC, -- subsetneq - [0x0228B] = 0xCD, -- supsetneq - --- [0x0228A] = 0xD0, -- subsetneq --- [0x0228B] = 0xD1, -- supsetneq - - [0x02270] = 0xD6, -- nleq - [0x02271] = 0xD7, -- ngeq - - [0x02268] = 0xDC, -- lneqq - [0x02269] = 0xDD, -- gneqq - - [0x022E6] = 0xE0, -- lnsim - [0x02219] = 0xE1, -- bullet - [0x022E7] = 0xE2, -- gnsim - - [0x02280] = 0xE5, -- nprec - [0x02281] = 0xE6, -- nsucc - - [0x022E8] = 0xEB, -- precnsim - [0x022E9] = 0xEC, -- succnsim - - [0x022EA] = 0xEF, -- nnormalsub - [0x022EB] = 0xF0, -- ncontainnormalsub - [0x022EC] = 0xF1, -- nnormalsubeq - [0x022ED] = 0xF2, -- ncontainnormalsubeq - - [0x02226] = 0xF7, -- nparallel - [0x022AC] = 0xF8, -- nvdash - [0x022AE] = 0xF9, -- nVdash - [0x022AD] = 0xFA, -- nvDash - [0x022AF] = 0xFB, -- nVDash -} - -mathencodings["lbr-mb"] = { - [0x00393] = 0x00, -- Gamma - [0x00394] = 0x01, -- Delta - [0x00398] = 0x02, -- Theta - [0x0039B] = 0x03, -- Lambda - [0x0039E] = 0x04, -- Xi - [0x003A0] = 0x05, -- Pi - [0x003A3] = 0x06, -- Sigma - [0x003A5] = 0x07, -- Upsilon - [0x003A6] = 0x08, -- Phi - [0x003A8] = 0x09, -- Psi - [0x003A9] = 0x0A, -- Omega - [0x0210F] = 0x9D, -- hslash - [0x02127] = 0x92, -- mho - [0x02132] = 0x90, -- Finv - [0x02136] = 0x95, -- beth - [0x02137] = 0x96, -- gimel - [0x02138] = 0x97, -- daleth - [0x02141] = 0x91, -- Game - [0x02201] = 0x94, -- complement - [0x0226C] = 0xF2, -- between - [0x0227C] = 0xE4, -- preccurlyeq - [0x0227D] = 0xE5, -- succcurlyeq - [0x0229D] = 0xCC, -- circleddash - [0x022A8] = 0xD6, -- vDash - [0x022AA] = 0xD3, -- Vvdash - [0x022B8] = 0xC7, -- multimap - [0x022BB] = 0xD2, -- veebar - [0x022C7] = 0xF7, -- divideontimes - [0x022C9] = 0xCF, -- ltimes - [0x022CA] = 0xCE, -- rtimes - [0x022CB] = 0xD0, -- leftthreetimes - [0x022CC] = 0xD1, -- rightthreetimes - [0x022D6] = 0xDC, -- lessdot - [0x022D7] = 0xDD, -- gtrdot - [0x022D8] = 0xDE, -- lll - [0x022D9] = 0xDF, -- ggg - [0x022DA] = 0xE8, -- lesseqgtr - [0x022DB] = 0xE9, -- gtreqless - [0x022DE] = 0xE6, -- curlyeqprec - [0x022DF] = 0xE7, -- curlyeqsucc - [0x024C7] = 0xC9, -- circledR - [0x024C8] = 0xCA, -- circledS - [0x025B6] = 0xF1, -- blacktriangleright - [0x025B8] = 0xF0, -- blacktriangleleft - [0x02720] = 0xCB, -- maltese - [0x02A7D] = 0xE0, -- leqslant - [0x02A7E] = 0xE1, -- geqslant - [0x02A85] = 0xDA, -- lessapprox - [0x02A86] = 0xDB, -- gtrapprox - [0x02A8B] = 0xEA, -- lesseqqgtr - [0x02A8C] = 0xEB, -- gtreqqless - [0x02A95] = 0xE2, -- eqslantless - [0x02A96] = 0xE3, -- eqslantgtr - [0x02AB7] = 0xEC, -- precapprox - [0x02AB8] = 0xED, -- succapprox - [0x02AC5] = 0xEE, -- subseteqq - [0x02AC6] = 0xEF, -- supseteqq - [0x12035] = 0xC8, -- backprime - [0x1D718] = 0x9B, -- varkappa -} - - -mathencodings["lbr-sy"] = { - - -- [0x022C5] = 0x01, -- cdot, - - [0x0002B] = 0x82, -- plus - [0x0003D] = 0x83, -- equal - - [0x021CB] = 0x8D, -- leftrightharpoons - [0x021CC] = 0x8E, -- rightleftharpoons - [0x02214] = 0x89, -- dotplus - [0x02220] = 0x8B, -- angle - [0x02221] = 0x8C, -- measuredangle - [0x02222] = 0x8D, -- sphericalangle - [0x02234] = 0x90, -- therefore - [0x02235] = 0x91, -- because - [0x0223D] = 0x24, -- backsim - [0x02242] = 0x99, -- eqsim - [0x02245] = 0x9B, -- cong - [0x0224A] = 0x9D, -- approxeq - [0x0224E] = 0xC7, -- Bumpeq - [0x02252] = 0xCB, -- fallingdotseq - [0x02253] = 0xCC, -- risingdotseq - [0x02256] = 0xCF, -- eqcirc - [0x02257] = 0xD0, -- circeq - [0x0225C] = 0xD5, -- triangleq - [0x02266] = 0xDA, -- leqq - [0x02267] = 0xDB, -- geqq - [0x02272] = 0xDC, -- lesssim - [0x02273] = 0xDD, -- gtrsim - [0x02276] = 0xDE, -- lessgtr - [0x02277] = 0xDF, -- gtrless - [0x0227E] = 0xE0, -- precsim - [0x0227F] = 0xE1, -- succsim - [0x0228F] = 0xE4, -- sqsubset - [0x02290] = 0xE5, -- sqsupset - [0x0229A] = 0xE6, -- circledcirc - [0x0229B] = 0xE7, -- circledast - [0x0229E] = 0xEA, -- boxplus - [0x0229F] = 0xEB, -- boxminus - [0x022A0] = 0xEC, -- boxtimes - [0x022A1] = 0xED, -- boxdot - [0x022A7] = 0xEE, -- models - [0x022A9] = 0xF0, -- Vdash - [0x022BC] = 0xF6, -- barwedge - [0x022CE] = 0x85, -- curlyvee - [0x022CF] = 0x84, -- curlywedge - [0x022D0] = 0xF8, -- Subset - [0x022D1] = 0xF9, -- Supset - [0x02300] = 0x53, -- varnothing - [0x025CA] = 0x05, -- lozenge -} - - -mathencodings["lbr-sy"] = table.merged(mathencodings["tex-sy"],mathencodings["lbr-sy"]) - -mathencodings["lbr-fraktur"] = { } - -fonts.handlers.vf.math.setletters(mathencodings, "lbr-fraktur", 0x1D504, 0x1D51E) - -return { - name = "lucida-math", - version = "1.00", - comment = "Goodies that complement lucida math.", - author = "Aditya, Hans, Mojca with help from Zhichu Chen", - copyright = "ConTeXt development team", - mathematics = { - mapfiles = { - "lucida.map", - }, - virtuals = { - ["lucida-math"] = { - { name = "file:lbr.afm", features = "virtualmath", main = true }, - { name = "hlcrim.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "hlcrim.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "hlcry.tfm", vector = "lbr-sy", skewchar=0x30, parameters = true }, - { name = "hlcrv.tfm", vector = "tex-ex", extension = true }, - { name = "hlcra.tfm", vector = "lbr-ma" }, - { name = "hlcrm.tfm", vector = "lbr-mb" }, - -- { name = "hlcrim.tfm", vector = "lbr-mb" }, -- LucidaNewMath-Italic <-> AltItalic - -- { name = "hlcdim.tfm", vector = "lbr-mb" }, -- LucidaNewMath-DemiItalic <-> AltDemiItalic - -- { name = "hlcrima.tfm", vector = "lbr-mb" }, -- LucidaNewMath-AltItalic <-> Italic - { name = "file:lbd.afm", vector = "tex-bf" }, - { name = "file:lbdi.afm", vector = "tex-bi" } , - { name = "file:lsr.afm", vector = "tex-ss" }, - { name = "file:lstr.afm", vector = "tex-tt" }, - { name = "file:lbl.afm", vector = "lbr-fraktur" }, -- more complete - }, - }, - variables = { - joinrelfactor = 4, -- default is 3 - } - } -} diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/modern-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/modern-math.lfg index 4af740789f5..ef99513b960 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/modern-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/modern-math.lfg @@ -56,6 +56,9 @@ return { presets.wipeanchors { }, presets.wipeitalics { }, { + tweak = "checkaccents", + }, + { tweak = "dimensions", list = { [0x1D487] = { anchor = 0.9 }, -- bold italic f @@ -144,25 +147,28 @@ return { tweak = "extendaccents", }, { + tweak = "flattenaccents", + }, + { + tweak = "fixaccents", + }, + { tweak = "radicaldegreeanchors", list = { ["0x221A.parts.bottom"] = { location = "left", hfactor = 0.05, vfactor = 1.05 }, } }, - { - tweak = "fixaccents", - }, -- First we set the dimensions of the initial accent which started out as zero but we want -- a proper width. - { - tweak = "dimensions", - list = { - [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat - [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve - [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck - }, - }, +-- { +-- tweak = "dimensions", +-- list = { +-- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat +-- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde +-- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve +-- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck +-- }, +-- }, -- Then we deal with all offsets and heights in one go. So we treat the initial accent -- as well as the variants here. { @@ -324,6 +330,15 @@ return { tweak = "addrules", }, { + tweak = "replacerules", + -- minus = true, -- we have an extensible + fraction = { height = .15, yoffset = .85 }, + radical = { height = .15, yoffset = .85, leftoffset = .065, rightoffset = .065, leftoverlap = 0.023, +rightoverlap = 0.023 +}, + stacker = { height = .15, yoffset = .85 }, + }, + { tweak = "addbars", advance = 0.52, }, @@ -346,6 +361,8 @@ return { feature = "emulatelmtx", comment = "this is for mkiv", }, +-- { tweak = "inspect", slot = 0x2212 }, +-- { tweak = "inspect", slot = 0x003D }, }, }, bigslots = { diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/modern-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/modern-text.lfg new file mode 100644 index 00000000000..20bdcc60b05 --- /dev/null +++ b/Master/texmf-dist/tex/context/fonts/mkiv/modern-text.lfg @@ -0,0 +1,62 @@ +return { + name = "modern-text", + version = "1.00", + comment = "Goodies that complement latin modern.", + author = "Mikael Sundqvist & Hans Hagen", + copyright = "ConTeXt development team", + extensions = { + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + -- "LMRoman-Regular", + "LMRoman10-Regular", + "LMRoman10-Bold", + }, + data = { + ["f"] = { + [")"] = 50, + ["}"] = 50, + ["]"] = 50, + ["|"] = 100, + ["\\"] = 50, + ["?"] = 50, + ["*"] = 50, + }, + } + }, + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "LMRoman-Italic", + "LMRoman-BoldItalic", + }, + data = { + ["f"] = { + [")"] = 50, + ["}"] = 50, + ["]"] = 50, + ["|"] = 125, + ["\\"] = 125, + ["!"] = 100, + ["?"] = 100, + ["*"] = 100, + ["@"] = 100, + }, + ["("] = { + ["f"] = 100, + }, + ["{"] = { + ["f"] = 100, + }, + ["["] = { + ["f"] = 100, + }, + ["|"] = { + ["f"] = 130, + }, + } + }, + } +} diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-math.lfg index cae69aecc12..12c6e8b23b3 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-math.lfg @@ -1,3 +1,5 @@ +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets -- In order to be able to use beta math fonts, we use our own file name and -- always remap. As this font is experimental we don't spend too much time -- on it now. Even then, we migth stick to design sizes only. @@ -66,10 +68,12 @@ return { end return o * target.parameters.factor end, - NoLimitSupFactor = 0, - NoLimitSubFactor = 1200, - DelimiterPercent = 90, - DelimiterShortfall = 400, + NoLimitSupFactor = 0, + NoLimitSubFactor = 1200, + DelimiterPercent = 90, + DelimiterShortfall = 400, + AccentTopShiftUp = -60, + FlattenedAccentTopShiftUp = -60, SubscriptBaselineDropMin = 50, -- 200 in font (multiplied by 0.59999/2.39868) SubscriptShiftDown = 150, -- 247 in font (multiplied to be consistent with cm) SubscriptShiftDownWithSuperscript = 247, -- relates to the previous one (see math-act) @@ -91,6 +95,21 @@ return { smaller = true, fake = 0.6, }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { }, + presets.rsfsuprighttoscript { }, + presets.moderntocalligraphic { }, + presets.eulertocalligraphic { }, + presets.xitsarabic { rscale = 0.80 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.4, icfactor = 0.8 }, -- the icfactor is due to the very slanted integral. + presets.wipeanchors { }, + presets.wipeitalics { }, + { + tweak = "checkaccents", + }, { tweak = "kerns", list = { @@ -113,7 +132,10 @@ return { ["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 }, }, - }, + }, + { + tweak = "flattenaccents", + }, { tweak = "checkspacing", }, @@ -130,6 +152,13 @@ return { tweak = "addrules", }, { + tweak = "replacerules", + -- minus = true, -- we have an extensible + fraction = { height = .15, yoffset = .85 }, + radical = { height = .15, yoffset = .823, leftoffset = .065, rightoffset = .065, leftoverlap = 0.03 }, + stacker = { height = .15, yoffset = .85 }, + }, + { tweak = "addfourier", variant = 1, }, diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-text.lfg new file mode 100644 index 00000000000..24991642a60 --- /dev/null +++ b/Master/texmf-dist/tex/context/fonts/mkiv/newcomputermodern-text.lfg @@ -0,0 +1,63 @@ +return { + name = "newcomputermodern-text", + version = "1.00", + comment = "Goodies that complement newcomputermodern.", + author = "Mikael Sundqvist & Hans Hagen", + copyright = "ConTeXt development team", + extensions = { + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "NewCM10-Book", + "NewCM10", + "NewCM10-Bold", + }, + data = { + ["f"] = { + [")"] = 50, + ["}"] = 50, + ["]"] = 50, + ["|"] = 100, + ["\\"] = 75, + ["?"] = 50, + ["*"] = 50, + }, + } + }, + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "NewCM10-BookItalic", + "NewCM10-BoldItalic", + "NewCM10-Italic", + }, + data = { + ["f"] = { + [")"] = 50, + ["}"] = 50, + ["]"] = 50, + ["|"] = 125, + ["\\"] = 100, + ["!"] = 100, + ["?"] = 100, + ["*"] = 50, + ["@"] = 100, + }, + ["("] = { + ["f"] = 100, + }, + ["{"] = { + ["f"] = 100, + }, + ["["] = { + ["f"] = 100, + }, + ["|"] = { + ["f"] = 130, + }, + } + }, + } +} diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/pagella-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/pagella-math.lfg index c1d0c7dd5c2..05e6fad814a 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/pagella-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/pagella-math.lfg @@ -40,9 +40,26 @@ return { feature = "euleroverpagella", filename = "euler-math.otf", list = { - { source = { first = 0x02100, last = 0x02BFF } }, - { source = { first = 0x1D400, last = 0x1D7FF } }, - { source = { first = 0x1D538, last = 0x1D550 } }, + { source = "lowercasenormal", target = "lowercaseitalic" }, + { source = "lowercasebold", target = "lowercasebolditalic" }, + { source = "lowercasegreeknormal", target = "lowercasegreekitalic" }, + { source = "lowercasegreekbold", target = "lowercasegreekbolditalic" }, + { source = "uppercasenormal", target = "uppercaseitalic" }, + { source = "uppercasebold", target = "uppercasebolditalic" }, + { source = "uppercasegreeknormal", target = "uppercasegreekitalic" }, + { source = "uppercasegreekbold", target = "uppercasegreekbolditalic" }, + { source = "lowercasenormal", target = "lowercasenormal" }, + { source = "lowercasebold", target = "lowercasebold" }, + { source = "lowercasegreeknormal", target = "lowercasegreeknormal" }, + { source = "lowercasegreekbold", target = "lowercasegreekbold" }, + { source = "uppercasenormal", target = "uppercasenormal" }, + { source = "uppercasebold", target = "uppercasebold" }, + { source = "uppercasegreeknormal", target = "uppercasegreeknormal" }, + { source = "uppercasegreekbold", target = "uppercasegreekbold" }, + { source = "digitsnormal", target = "digitsnormal" }, + -- + { source = { first = 0x02100, last = 0x02BFF } }, -- symbols + { source = { first = 0x1D400, last = 0x1D7FF } }, -- various alphabets }, }, { @@ -66,6 +83,9 @@ return { presets.wipeanchors { }, presets.wipeitalics { }, { + tweak = "checkaccents", + }, + { tweak = "parameters", feature = "euleroverpagella", list = { @@ -94,28 +114,25 @@ return { tweak = "extendaccents", }, { - tweak = "radicaldegreeanchors", - list = { - ["0x221A.parts.bottom"] = { location = "left", hfactor = 0.0, vfactor = 1.1 }, - } + tweak = "flattenaccents", }, { tweak = "fixaccents", }, -- First we set the dimensions of the initial accent which started out as zero but we want -- a proper width. - { - tweak = "dimensions", - list = { - [0x00300] = { width = 0.9 }, -- widegrave - [0x00301] = { width = 0.9 }, -- wideacute - [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat - [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve - [0x0030A] = { width = 0.9, xoffset = -.0 }, -- widering -- weird this one - [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck - }, - }, +-- { +-- tweak = "dimensions", +-- list = { +-- [0x00300] = { width = 0.9 }, -- widegrave +-- [0x00301] = { width = 0.9 }, -- wideacute +-- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat +-- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde +-- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve +-- [0x0030A] = { width = 0.9, xoffset = -.0 }, -- widering -- weird this one +-- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck +-- }, +-- }, -- Then we deal with all offsets and heights in one go. So we treat the initial accent -- as well as the variants here. { @@ -132,6 +149,12 @@ return { }, -- So far for the accents. { + tweak = "radicaldegreeanchors", + list = { + ["0x221A.parts.bottom"] = { location = "left", hfactor = 0.0, vfactor = 1.1 }, + } + }, + { tweak = "fixslashes", }, { @@ -154,7 +177,7 @@ return { [0x27EB] = { topright = -0.2, bottomright = -0.2 }, ["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 }, -- - [0x00393] = { bottomright = -0.20, }, -- upright Gamma + [0x0393] = { bottomright = -0.20, }, -- upright Gamma -- ["0x222B.parts.bottom"] = { bottomright = -0.20 }, -- int ["0x222C.parts.bottom"] = { bottomright = -0.15 }, -- iint @@ -185,6 +208,20 @@ return { advance = 0.2, }, { + tweak = "replacerules", + fraction = { height = .215, yoffset = .785 }, + radical = { height = .215, yoffset = .785, leftoffset = .1, rightoffset = .1 }, + stacker = { height = .215, yoffset = .785 }, + }, + -- on the radical we adapt the offset and give some extra height (prevent clipping) + { + tweak = "replacerules", + feature = "euleroverpagella", + fraction = { height = .15, yoffset = .85 }, + radical = { height = .22, yoffset = .8, leftoffset = .05, rightoffset = .05, leftoverlap = .01 }, + stacker = { height = .15, yoffset = .85 }, + }, + { tweak = "addactuarian", }, { diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/schola-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/schola-math.lfg index e4a3ad39796..42c2bbcc21b 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/schola-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/schola-math.lfg @@ -47,6 +47,9 @@ return { presets.moveintegrals { }, presets.wipeitalics { }, { + tweak = "checkaccents", + }, + { tweak = "kerns", list = { [0x002F] = { topleft = -0.2, bottomright = -0.2 }, @@ -78,25 +81,28 @@ return { tweak = "extendaccents", }, { - tweak = "radicaldegreeanchors", - list = { + tweak = "radicaldegreeanchors", + list = { ["0x221A.parts.bottom"] = { location = "left", hfactor = 0.05, vfactor = 1.1 }, } }, { + tweak = "flattenaccents", + }, + { tweak = "fixaccents", }, -- First we set the dimensions of the initial accent which started out as zero but we want -- a proper width. - { - tweak = "dimensions", - list = { - [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat - [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve - [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck - }, - }, + -- { + -- tweak = "dimensions", + -- list = { + -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + -- }, + -- }, -- Then we deal with all offsets and heights in one go. So we treat the initial accent -- as well as the variants here. Not in schola -- We now copy these to the not wide slots so that we can set these to stretch as well, @@ -117,6 +123,12 @@ return { tweak = "addrules", }, { + tweak = "replacerules", + fraction = { height = .25, yoffset = .7625 }, + radical = { height = .25, leftoffset = .1, rightoffset = .1, yoffset = .7625 }, + stacker = { height = .25, yoffset = .7625 }, + }, + { tweak = "addbars", advance = 0.27, }, diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-math.lfg index b6b1757b6c1..881de752381 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-math.lfg @@ -13,7 +13,11 @@ return { copyright = "ConTeXt development team", mathematics = { alternates = { - calligraphic = { feature = 'ss01', value = 1, comment = "Mathematical Alternative Calligraphic Characters" }, + lambdabar = { feature = 'cv01', value = 1, comment = "Mathematical Alternative Lambda Bar" }, + ramshorn = { feature = 'cv02', value = 1, comment = "Mathematical Alternative Rams Horn" }, + emptyset = { feature = 'cv03', value = 1, comment = "Mathematical Alternative Empty Set" }, + setminus = { feature = 'cv04', value = 1, comment = "Mathematical Alternative Setminus" }, + calligraphic = { feature = 'ss01', value = 1, comment = "Mathematical Alternative Calligraphic Characters" }, -- We do this differently italic = { feature = 'ss02', value = 1, comment = "Mathematical Alternative Lowercase Italic" }, barred = { feature = 'ss03', value = 1, comment = "Mathematical Alternative Barred Characters" }, -- hbar, lambdabar etc primes = { feature = 'ss04', value = 1, comment = "Mathematical Alternative Primes" }, -- larger/lower primes, minute etc @@ -23,9 +27,26 @@ return { upright = { feature = 'ss08', value = 1, comment = "Mathematical Alternative Upright Symbols" }, -- upright integrals etc. negated = { feature = 'ss09', value = 1, comment = "Mathematical Alternative Negated Symbols" }, relation = { feature = 'ss10', value = 1, comment = "Mathematical Alternative Relations" }, - negatedset = { feature = 'ss09', value = 1, comment = "Mathematical Alternative Negated Set Symbols" }, - -- todo = { feature = 'ss14', value = 1, comment = "" }, + negatedset = { feature = 'ss11', value = 1, comment = "Mathematical Alternative Negated Set Symbols" }, + propfrown = { feature = 'ss12', value = 1, comment = "Mathematical Alternative Proportional and Frown" }, + negsine = { feature = 'ss13', value = 1, comment = "Mathematical Alternative Negated Sine Wave" }, + intprod = { feature = 'ss14', value = 1, comment = "Mathematical Alternative Interior Products" }, + capcup = { feature = 'ss15', value = 1, comment = "Mathematical Alternative Intersection and Union with serif" }, circled = { feature = 'ss16', value = 1, comment = "Mathematical Alternative Circled Operators" }, + simvar = { feature = 'ss20', value = 1, comment = "Mathematical Alternative Similar and some more unrelated" }, + -- demo features: + negated8774 = { + feature = 'ss09', + value = 1, + comment = "Mathematical Alternative Negated 8774", + list = { [8774] = true }, + }, + negated8775 = { + feature = 'ss09', + value = 1, + comment = "Mathematical Alternative Negated 8775", + list = { [8775] = true }, + }, }, parameters = { AccentBaseDepth = 30, @@ -78,6 +99,19 @@ return { presets.moveintegrals { }, presets.wipeitalics { }, { + tweak = "checkaccents", + }, + -- Extensibles use .s1 (variant 1), so we cannot wipe all + { + tweak = "wipevariants", + list = { + [0x20D6] = 3, + [0x20D7] = 3, + [0x20EE] = 3, + [0x20EF] = 3, + }, + }, + { tweak = "simplifykerns", }, { @@ -115,21 +149,23 @@ return { ["0x221A.parts.bottom"] = { location = "left", hfactor = 0.05, vfactor = 1.00 }, } }, - + { + tweak = "flattenaccents", + }, { tweak = "fixaccents", }, -- First we set the dimensions of the initial accent which started out as zero but we want -- a proper width. - { - tweak = "dimensions", - list = { - [0x00302] = { width = 1.2, anchor = 1.10, xoffset = .05 }, -- widehat - [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve - [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck - }, - }, + -- { + -- tweak = "dimensions", + -- list = { + -- [0x00302] = { width = 1.2, anchor = 1.10, xoffset = .05 }, -- widehat + -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + -- }, + -- }, -- Then we deal with all offsets and heights in one go. So we treat the initial accent -- as well as the variants here. { @@ -168,6 +204,29 @@ return { advance = 0.4, }, { + tweak = "replacerules", + minus = { + height = .233, + yoffset = .768, + leftoffset = .08, + rightoffset = .08, + }, + fraction = { + height = .233, + yoffset = .768, + }, + radical = { + height = .233, + yoffset = .768, + leftoffset = .08, + rightoffset = .08, + }, + stacker = { + height = .233, + yoffset = .768, + }, + }, + { tweak = "addactuarian", }, { diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-text.lfg new file mode 100644 index 00000000000..2a3b46a78fa --- /dev/null +++ b/Master/texmf-dist/tex/context/fonts/mkiv/stixtwo-text.lfg @@ -0,0 +1,60 @@ +return { + name = "stixtwo-text", + version = "1.00", + comment = "Goodies that complement stix two.", + author = "Mikael Sundqvist & Hans Hagen", + copyright = "ConTeXt development team", + extensions = { + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "STIXTwoText-Regular", + "STIXTwoText-Bold", + }, + data = { + ["f"] = { + [")"] = 50, + ["}"] = 50, + ["]"] = 50, + ["|"] = 100, + ["\\"] = 100, + ["*"] = 50, + }, + } + }, + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "STIXTwoText-Italic", + "STIXTwoText-BoldItalic", + }, + data = { + ["f"] = { + [")"] = 50, + ["}"] = 50, + ["]"] = 50, + ["|"] = 125, + ["\\"] = 125, + ["!"] = 100, + ["?"] = 100, + ["*"] = 100, + ["@"] = 100, + }, + ["("] = { + ["f"] = 100, + }, + ["{"] = { + ["f"] = 100, + }, + ["["] = { + ["f"] = 100, + }, + ["|"] = { + ["f"] = 130, + }, + } + }, + } +} diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/termes-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/termes-math.lfg index d9c53ee2830..7dfc73207ab 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/termes-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/termes-math.lfg @@ -49,6 +49,9 @@ return { presets.moveintegrals { factor = 1.5 }, presets.wipeitalics { }, { + tweak = "checkaccents", + }, + { tweak = "kerns", list = { [0x002F] = { topleft = -0.2, bottomright = -0.2 }, @@ -81,6 +84,12 @@ return { tweak = "extendaccents", }, { + tweak = "flattenaccents", + }, + { + tweak = "fixaccents", + }, + { tweak = "radicaldegreeanchors", list = { [0x221A] = { location = "left", hfactor = 0.0, vfactor = 0.6 }, @@ -88,20 +97,17 @@ return { ["0x221A.parts.bottom"] = { location = "left", hfactor = 0.05, vfactor = 1.1 }, } }, - { - tweak = "fixaccents", - }, -- First we set the dimensions of the initial accent which started out as zero but we want -- a proper width. - { - tweak = "dimensions", - list = { - [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat - [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve - [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck - }, - }, + -- { + -- tweak = "dimensions", + -- list = { + -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + -- }, + -- }, -- Then we deal with all offsets and heights in one go. So we treat the initial accent -- as well as the variants here. Not in termes. -- We now copy these to the not wide slots so that we can set these to stretch as well, @@ -123,6 +129,19 @@ return { tweak = "addrules", }, { + tweak = "replacerules", + fraction = { height = .2, xleftoffset = .115, xrightoffset = .115, yoffset = .81 }, + radical = { height = .2, leftoffset = .115, rightoffset = .115, yoffset = .81 }, + stacker = { height = .2, xleftoffset = .115, xrightoffset = .115, yoffset = .81 }, + }, + -- { + -- tweak = "replacerules", + -- -- minus = true, -- we have an extensible + -- fraction = { height = .2, yoffset = .8 }, + -- radical = { height = .2, yoffset = .8 }, + -- stacker = { height = .2, yoffset = .8 }, + -- }, + { tweak = "addbars", advance = 0.3, }, diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/texgyre-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/texgyre-text.lfg new file mode 100644 index 00000000000..947d730cd5f --- /dev/null +++ b/Master/texmf-dist/tex/context/fonts/mkiv/texgyre-text.lfg @@ -0,0 +1,185 @@ +return { + name = "texgyre-text", + version = "1.00", + comment = "Goodies that complement the texgyre fonts.", + author = "Mikael Sundqvist & Hans Hagen", + copyright = "ConTeXt development team", + extensions = { + { + name = "kern", -- adds to kerns + type = "kern", + -- we have three optional methods for filtering: + fonts = { + "TeXGyreBonum-Regular", + "TeXGyreBonum-Bold", + }, + -- fonts = { + -- ["TeXGyreBonum-Regular"] = true, + -- }, + -- fonts = "TeXGyreBonum-*", + data = { + ["f"] = { + [")"] = 100, + ["}"] = 100, + ["]"] = 100, + ["|"] = 100, + ["\\"] = 120, + ["!"] = 100, + ["?"] = 100, + }, + } + }, + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "TeXGyreBonum-Italic", + "TeXGyreBonum-BoldItalic", + }, + data = { + ["f"] = { + [")"] = 140, + ["}"] = 140, + ["]"] = 140, + ["|"] = 100, + ["\\"] = 150, + ["!"] = 100, + ["?"] = 100, + }, + ["("] = { + ["f"] = 190, + }, + ["{"] = { + ["f"] = 190, + }, + ["["] = { + ["f"] = 190, + }, + } + }, + { + name = "kern", + type = "kern", + fonts = { + "TeXGyreTermes-Regular", + "TeXGyreTermes-Bold", + }, + data = { + ["f"] = { + [")"] = 75, + ["}"] = 75, + ["]"] = 75, + ["|"] = 75, + ["\\"] = 110, + ["!"] = 75, + ["?"] = 75, + }, + } + }, + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "TeXGyreTermes-Italic", + "TeXGyreTermes-BoldItalic", + }, + data = { + ["f"] = { + [")"] = 75, + ["}"] = 75, + ["]"] = 75, + ["|"] = 75, + ["\\"] = 200, + ["!"] = 75, + ["?"] = 75, + }, + ["("] = { + ["f"] = 75, + }, + ["{"] = { + ["f"] = 75, + }, + ["["] = { + ["f"] = 75, + }, + ["|"] = { + ["f"] = 150, + }, + } + }, + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "TeXGyrePagella-Italic", + "TeXGyrePagella-BoldItalic", + }, + data = { + ["f"] = { + [")"] = 120, + ["}"] = 120, + ["]"] = 120, + ["|"] = 120, + ["\\"] = 120, + ["!"] = 75, + ["?"] = 75, + ["*"] = 120, + }, + ["("] = { + ["f"] = 120, + }, + ["{"] = { + ["f"] = 120, + }, + ["["] = { + ["f"] = 120, + }, + ["|"] = { + ["f"] = 120, + }, + } + }, + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "TeXGyreSchola-Regular", + "TeXGyreSchola-Bold", + }, + data = { + ["f"] = { + [")"] = 120, + ["}"] = 120, + ["]"] = 120, + -- ["|"] = 50, + ["\\"] = 100, + ["!"] = 100, + ["?"] = 100, + ["*"] = 75, + ["@"] = 75, + }, + } + }, + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "TeXGyreSchola-Italic", + "TeXGyreSchola-BoldItalic", + }, + data = { + ["f"] = { + [")"] = 120, + ["}"] = 120, + ["]"] = 120, + ["|"] = 120, + ["\\"] = 120, + ["!"] = 75, + ["?"] = 75, + ["*"] = 120, + ["@"] = 75, + }, + } + }, + } +} diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-antykwa.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-antykwa.mkiv index f5e3158f4ee..413223df1b2 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-antykwa.mkiv +++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-antykwa.mkiv @@ -14,14 +14,7 @@ \starttypescriptcollection[antykwa-torunska] \startsetups[antykwa] - % \setupmathfraction[\c!rule=\v!symbol,\c!middle="0203E]% - % \setupmathradical [\c!rule=\v!symbol,\c!top ="FE010]% - % \setupmathfence [\c!alternative=1]% - \letmathfractionparameter\c!rule\v!symbol - \setmathfractionparameter\c!middle{"203E}% - \letmathradicalparameter \c!rule\v!symbol - \setmathradicalparameter \c!top{\radicalbarextenderuc}% - \setmathfenceparameter \c!alternative{1}% + \setmathfenceparameter\c!alternative{1}% \stopsetups % cond => -cont as in iwona @@ -35,20 +28,27 @@ \startsetups[antykwa-torunska-cond] \directsetup{antykwa}\stopsetups \startsetups[antykwa-torunska-light-cond]\directsetup{antykwa}\stopsetups - \definefontfeature[virtualmath-antykwa] [virtualmath][virtualweight=antykwa] - \definefontfeature[virtualmath-antykwa-cond] [virtualmath][virtualweight=antykwa-cond] - \definefontfeature[virtualmath-antykwa-light] [virtualmath][virtualweight=antykwa-light] - \definefontfeature[virtualmath-antykwa-light-cond][virtualmath][virtualweight=antykwa-light-cond] + % these fetaures make the loaded base font unique: - \starttypescript [antykwa,antykwa-torunska,antykwa-light,antykwa-torunska-light,antykwa-cond,antykwa-torunska-cond,antykwa-light-cond,antykwa-torunska-light-cond] - \definetypeface[\typescriptone][\s!rm][\s!serif][\typescriptone] [\s!default] - \definetypeface[\typescriptone][\s!ss][\s!sans] [modern] [\s!default] [\s!rscale=1.05] - \definetypeface[\typescriptone][\s!tt][\s!mono] [modern] [\s!default] [\s!rscale=1.05] - \definetypeface[\typescriptone][\s!mm][\s!math] [\typescriptone] [\s!default] + \definefontfeature[virtualmath-antykwa] [virtualmath][virtualweight=antykwa] + \definefontfeature[virtualmath-antykwa-cond] [virtualmath][virtualweight=antykwa-cond] + \definefontfeature[virtualmath-antykwa-light] [virtualmath][virtualweight=antykwa-light] + \definefontfeature[virtualmath-antykwa-light-cond] [virtualmath][virtualweight=antykwa-light-cond] + + \definefontfeature[virtualmath-antykwa-nt] [virtualmath][virtualweight=antykwa-nt] + \definefontfeature[virtualmath-antykwa-cond-nt] [virtualmath][virtualweight=antykwa-cond-nt] + \definefontfeature[virtualmath-antykwa-light-nt] [virtualmath][virtualweight=antykwa-light-nt] + \definefontfeature[virtualmath-antykwa-light-cond-nt][virtualmath][virtualweight=antykwa-light-cond-nt] + + \starttypescript [antykwa,antykwa-nt,antykwa-torunska,antykwa-light,antykwa-light-nt,antykwa-torunska-light,antykwa-cond,antykwa-cond-nt,antykwa-torunska-cond,antykwa-light-cond,antykwa-light-cond-nt,antykwa-torunska-light-cond] + \definetypeface[\typescriptone][\s!rm][\s!serif][\typescriptone][\s!default] + \definetypeface[\typescriptone][\s!ss][\s!sans] [modern] [\s!default][\s!rscale=1.05] + \definetypeface[\typescriptone][\s!tt][\s!mono] [modern] [\s!default][\s!rscale=1.05] + \definetypeface[\typescriptone][\s!mm][\s!math] [\typescriptone][\s!default] \quittypescriptscanning \stoptypescript - \starttypescript [\s!serif] [antykwa,antykwa-torunska,antykwa-light,antykwa-torunska-light,antykwa-cond,antykwa-torunska-cond,antykwa-light-cond,antykwa-torunska-light-cond] + \starttypescript [\s!serif] [antykwa,antykwa-nt,antykwa-torunska,antykwa-light,antykwa-light-nt,antykwa-torunska-light,antykwa-cond,antykwa-cond-nt,antykwa-torunska-cond,antykwa-light-cond,antykwa-light-cond-nt,antykwa-torunska-light-cond] \definefontsynonym [AntykwaTorunska-Regular] [\s!file:AntykwaTorunska-Regular] [\s!features=\s!default] \definefontsynonym [AntykwaTorunska-Italic] [\s!file:AntykwaTorunska-Italic] [\s!features=\s!default] \definefontsynonym [AntykwaTorunska-Bold] [\s!file:AntykwaTorunska-Bold] [\s!features=\s!default] @@ -71,23 +71,37 @@ \loadfontgoodies[antykwa-math] \definefontsynonym[\s!MathRoman][antykwamath@antykwa-math] \stoptypescript - \starttypescript [\s!math][antykwa-light,antykwa-torunska-light][\s!all] \loadfontgoodies[antykwa-math] \definefontsynonym[\s!MathRoman][antykwalightmath@antykwa-light-math] \stoptypescript - \starttypescript [\s!math][antykwa-cond,antykwa-torunska-cond][\s!all] \loadfontgoodies[antykwa-math] \definefontsynonym[\s!MathRoman][antykwacondmath@antykwa-cond-math] \stoptypescript - \starttypescript [\s!math][antykwa-light-cond,antykwa-torunska-light-cond][\s!all] \loadfontgoodies[antykwa-math] \definefontsynonym[\s!MathRoman][antykwalightcondmath@antykwa-light-cond-math] \stoptypescript - \starttypescript [\s!serif] [antykwa,antykwa-torunska] [\s!name] + \starttypescript [\s!math][antykwa-nt][\s!all] + \loadfontgoodies[antykwa-math] + \definefontsynonym[\s!MathRoman][antykwamathnt@antykwa-math-nt] + \stoptypescript + \starttypescript [\s!math][antykwa-light-nt][\s!all] + \loadfontgoodies[antykwa-math] + \definefontsynonym[\s!MathRoman][antykwalightmathnt@antykwa-light-math-nt] + \stoptypescript + \starttypescript [\s!math][antykwa-cond-nt][\s!all] + \loadfontgoodies[antykwa-math] + \definefontsynonym[\s!MathRoman][antykwacondmathnt@antykwa-cond-math-nt] + \stoptypescript + \starttypescript [\s!math][antykwa-light-cond-nt][\s!all] + \loadfontgoodies[antykwa-math] + \definefontsynonym[\s!MathRoman][antykwacondmathnt@antykwa-light-cond-math-nt] + \stoptypescript + + \starttypescript [\s!serif] [antykwa,antykwa-nt,antykwa-torunska] [\s!name] \setups[\s!font:\s!fallback:\s!serif] \definefontsynonym [\s!Serif] [AntykwaTorunska-Regular] \definefontsynonym [\s!SerifBold] [AntykwaTorunska-Bold] @@ -95,7 +109,7 @@ \definefontsynonym [\s!SerifBoldItalic] [AntykwaTorunska-BoldItalic] \stoptypescript - \starttypescript [\s!serif] [antykwa-light,antykwa-torunska-light] [\s!name] + \starttypescript [\s!serif] [antykwa-light,antykwa-light-nt,antykwa-torunska-light] [\s!name] \setups[\s!font:\s!fallback:\s!serif] \definefontsynonym [\s!Serif] [AntykwaTorunska-Light] \definefontsynonym [\s!SerifBold] [AntykwaTorunska-Medium] @@ -103,7 +117,7 @@ \definefontsynonym [\s!SerifBoldItalic] [AntykwaTorunska-MediumItalic] \stoptypescript - \starttypescript [\s!serif] [antykwa-cond,antykwa-torunska-cond] [\s!name] + \starttypescript [\s!serif] [antykwa-cond,antykwa-cond-nt,antykwa-torunska-cond] [\s!name] \setups[\s!font:\s!fallback:\s!serif] \definefontsynonym [\s!Serif] [AntykwaTorunska-CondRegular] \definefontsynonym [\s!SerifBold] [AntykwaTorunska-CondBold] @@ -111,7 +125,7 @@ \definefontsynonym [\s!SerifBoldItalic] [AntykwaTorunska-CondBoldItalic] \stoptypescript - \starttypescript [\s!serif] [antykwa-light-cond,antykwa-torunska-light-cond] [\s!name] + \starttypescript [\s!serif] [antykwa-light-cond,antykwa-light-cond-nt,antykwa-torunska-light-cond] [\s!name] \setups[\s!font:\s!fallback:\s!serif] \definefontsynonym [\s!Serif] [AntykwaTorunska-CondLight] \definefontsynonym [\s!SerifBold] [AntykwaTorunska-CondMedium] diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-concrete.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-concrete.mkiv index ff4033f8154..c383a27fe6d 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-concrete.mkiv +++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-concrete.mkiv @@ -1,5 +1,5 @@ %D \module -%D [ file=type-imp-erewhon, +%D [ file=type-imp-concrete, %D version=2022.30.09, % a bit older %D title=\CONTEXT\ Typescript Macros, %D subtitle=\TEX Gyre Fonts, @@ -11,9 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%\loadtypescriptfile[texgyre] -%\resetfontfallback [concrete-euler-fix] -%\definefontfallback[concrete-euler-fix][texgyrepagella-math] [0x022EE,0x022F0,0x022F1,0x02661,0x02220][force=yes] +% lm is already preloaded so we can actually move this to lm \starttypescriptcollection[concrete] @@ -21,33 +19,35 @@ %\definefontfeature[none-slanted-concrete] [none] [slant=.2] \doifunknownfontfeature {concrete-math-bold} {\definefontfeature[concrete-math-bold][boldened]} + \doifunknownfontfeature {concrete-text-bold} {\definefontfeature[concrete-text-bold][boldened-10]} \starttypescript [\s!serif] [concrete] - \definefontsynonym [\s!Serif] [\s!file:cmunorm] [\s!features=\s!default] - \definefontsynonym [\s!SerifItalic] [\s!file:cmunoti] [\s!features=\s!default] - \definefontsynonym [\s!SerifSlanted] [\s!file:cmunorm] [\s!features=default-slanted-concrete] - \definefontsynonym [\s!SerifBold] [\s!file:cmunobx] [\s!features=\s!default] - \definefontsynonym [\s!SerifBoldItalic] [\s!file:cmunobi] [\s!features=\s!default] - \definefontsynonym [\s!SerifBoldSlanted] [\s!file:cmunobx] [\s!features=default-slanted-concrete] + \definefontsynonym [\s!Serif] [LMTypewriterVarWd-Regular] [\s!features={\s!default,concrete-text-bold}] + \definefontsynonym [\s!SerifBold] [LMTypewriterVarWd-Dark] [\s!features={\s!default,concrete-text-bold}] + \definefontsynonym [\s!SerifItalic] [LMTypewriterVarWd-Oblique] [\s!features={\s!default,concrete-text-bold}] + \definefontsynonym [\s!SerifSlanted] [LMTypewriterVarWd-Oblique] [\s!features={\s!default,concrete-text-bold}] + \definefontsynonym [\s!SerifBoldItalic] [LMTypewriterVarWd-DarkOblique] [\s!features={\s!default,concrete-text-bold}] + \definefontsynonym [\s!SerifBoldSlanted] [LMTypewriterVarWd-DarkOblique] [\s!features={\s!default,concrete-text-bold}] \stoptypescript \starttypescript [\s!sans] [concrete] - \definefontsynonym [\s!Sans] [\s!file:cmunss] [\s!features=\s!default] - \definefontsynonym [\s!SansItalic] [\s!file:cmunsi] [\s!features=\s!default] - \definefontsynonym [\s!SansSlanted] [\s!file:cmunss] [\s!features=default-slanted-concrete] - \definefontsynonym [\s!SansBold] [\s!file:cmunsx] [\s!features=\s!default] - \definefontsynonym [\s!SansBoldItalic] [\s!file:cmunso] [\s!features=\s!default] - \definefontsynonym [\s!SansBoldSlanted] [\s!file:cmunsx] [\s!features=default-slanted-concrete] + \definefontsynonym [\s!Sans] [LMTypewriterVarWd-Regular] [\s!features={\s!default,concrete-text-bold}] + \definefontsynonym [\s!SansItalic] [LMTypewriterVarWd-Dark] [\s!features={\s!default,concrete-text-bold}] + \definefontsynonym [\s!SansSlanted] [LMTypewriterVarWd-Oblique] [\s!features={\s!default,concrete-text-bold}] + \definefontsynonym [\s!SansBold] [LMTypewriterVarWd-Oblique] [\s!features={\s!default,concrete-text-bold}] + \definefontsynonym [\s!SansBoldItalic] [LMTypewriterVarWd-DarkOblique] [\s!features={\s!default,concrete-text-bold}] + \definefontsynonym [\s!SansBoldSlanted] [LMTypewriterVarWd-DarkOblique] [\s!features={\s!default,concrete-text-bold}] \stoptypescript \starttypescript [\s!mono] [concrete] - \definefontsynonym [\s!Mono] [\s!file:cmuntt] [\s!features=\s!none] - \definefontsynonym [\s!MonoItalic] [\s!file:cmunit] [\s!features=\s!none] - \definefontsynonym [\s!MonoSlanted] [\s!file:cmunst] [\s!features=\s!none] - \definefontsynonym [\s!MonoBold] [\s!file:cmuntb] [\s!features=\s!none] - \definefontsynonym [\s!MonoBoldItalic] [\s!file:cmuntx] [\s!features=\s!none] - \definefontsynonym [\s!MonoBoldSlanted] [\s!file:cmuntb] [\s!features=none-slanted-concrete] - \stoptypescript + \loadfontgoodies[lm] + \definefontsynonym [\s!Mono] [LMTypewriter-Regular] [\s!features={\s!none,concrete-text-bold}] + \definefontsynonym [\s!MonoBold] [LMTypewriter-Dark] [\s!features={\s!none,concrete-text-bold}] + \definefontsynonym [\s!MonoItalic] [LMTypewriter-Italic] [\s!features={\s!none,concrete-text-bold}] + \definefontsynonym [\s!MonoSlanted] [LMTypewriter-Oblique] [\s!features={\s!none,concrete-text-bold}] + \definefontsynonym [\s!MonoBoldItalic] [LMTypewriter-DarkOblique] [\s!features={\s!none,concrete-text-bold}] + \definefontsynonym [\s!MonoBoldSlanted] [LMTypewriter-DarkOblique] [\s!features={\s!none,concrete-text-bold}] + \stoptypescript \starttypescript [\s!math] [concrete] \checkedmapfontsize[\typescripttwo][\s!script] [.76] diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-dejavu.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-dejavu.mkiv index 49b788a734e..70fc8ae8d58 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-dejavu.mkiv +++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-dejavu.mkiv @@ -16,16 +16,16 @@ \definefontfeature[dejavu-condensed-mono][extend=.8] -\starttypescriptcollection[xxdejavu] +\starttypescriptcollection[dejavu] \doifunknownfontfeature {dejavu-math-bold} {\definefontfeature[dejavu-math-bold][boldened]} \starttypescript [\s!serif] [dejavu] [\s!name] \setups[\s!font:\s!fallback:\s!serif] - \definefontsynonym [\s!Serif] [\s!name:dejavuserif] [\s!features=\s!default,\s!fallbacks=\s!Serif] - \definefontsynonym [\s!SerifBold] [\s!name:dejavuserifbold] [\s!features=\s!default,\s!fallbacks=\s!SerifBold] - \definefontsynonym [\s!SerifItalic] [\s!name:dejavuserifitalic] [\s!features=\s!default,\s!fallbacks=\s!SerifItalic] - \definefontsynonym [\s!SerifBoldItalic] [\s!name:dejavuserifbolditalic] [\s!features=\s!default,\s!fallbacks=\s!SerifBoldItalic] + \definefontsynonym [\s!Serif] [\s!name:dejavuserif] [\s!features=\s!default,\s!fallbacks=\s!Serif,\s!goodies=dejavu-text] + \definefontsynonym [\s!SerifBold] [\s!name:dejavuserifbold] [\s!features=\s!default,\s!fallbacks=\s!SerifBold,\s!goodies=dejavu-text] + \definefontsynonym [\s!SerifItalic] [\s!name:dejavuserifitalic] [\s!features=\s!default,\s!fallbacks=\s!SerifItalic,\s!goodies=dejavu-text] + \definefontsynonym [\s!SerifBoldItalic] [\s!name:dejavuserifbolditalic] [\s!features=\s!default,\s!fallbacks=\s!SerifBoldItalic,\s!goodies=dejavu-text] \stoptypescript \starttypescript [\s!sans] [dejavu] [\s!name] diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv index 31026df5b21..46c73956f39 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv +++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv @@ -65,26 +65,28 @@ \starttypescriptcollection[ebgaramond] +% \startsetups[ebgaramond] +% % \setmathfenceparameter \c!alternative{1}% +% \stopsetups + \doifunknownfontfeature {ebgaramond-math-bold} {\definefontfeature[ebgaramond-math-bold][boldened]} \starttypescript [\s!serif] [ebgaramond] \setups[font:fallback:serif] - \definefontsynonym [\s!Serif] [\s!file:ebgaramond-regular] [\s!features=eb-garamond-normal] - \definefontsynonym [\s!SerifItalic] [\s!file:ebgaramond-italic] [\s!features=eb-garamond-normal] - \definefontsynonym [\s!SerifBold] [\s!file:ebgaramond-bold] [\s!features=eb-garamond-normal] - \definefontsynonym [\s!SerifBoldItalic][\s!file:ebgaramond-bolditalic][\s!features=eb-garamond-normal] + \definefontsynonym [\s!Serif] [\s!file:ebgaramond-regular] [\s!features=eb-garamond-normal,\s!goodies=ebgaramond-text] + \definefontsynonym [\s!SerifItalic] [\s!file:ebgaramond-italic] [\s!features=eb-garamond-normal,\s!goodies=ebgaramond-text] + \definefontsynonym [\s!SerifBold] [\s!file:ebgaramond-bold] [\s!features=eb-garamond-normal,\s!goodies=ebgaramond-text] + \definefontsynonym [\s!SerifBoldItalic][\s!file:ebgaramond-bolditalic][\s!features=eb-garamond-normal,\s!goodies=ebgaramond-text] \definefontsynonym [\s!SerifCaps] [\s!Serif] [\s!features=eb-garamond-smallcaps] \stoptypescript - - - \starttypescript [\s!sans] [ysabeau] - % \setups[font:fallback:sans] - \definefontsynonym [\s!Sans] [\s!file:ysabeau-regular] [\s!features=\s!default] - \definefontsynonym [\s!SansItalic] [\s!file:ysabeau-italic] [\s!features=\s!default] - \definefontsynonym [\s!SansBold] [\s!file:ysabeau-bold] [\s!features=\s!default] - \definefontsynonym [\s!SansBoldItalic][\s!file:ysabeau-bolditalic] [\s!features=\s!default] - \definefontsynonym [\s!SansCaps] [\s!Sans] [\s!features=ysabeau-smallcaps] + \starttypescript [\s!sans] [ysabeau] + % \setups[font:fallback:sans] + \definefontsynonym [\s!Sans] [\s!file:ysabeau-regular] [\s!features=\s!default] + \definefontsynonym [\s!SansItalic] [\s!file:ysabeau-italic] [\s!features=\s!default] + \definefontsynonym [\s!SansBold] [\s!file:ysabeau-bold] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldItalic][\s!file:ysabeau-bolditalic] [\s!features=\s!default] + \definefontsynonym [\s!SansCaps] [\s!Sans] [\s!features=ysabeau-smallcaps] \stoptypescript \starttypescript [\s!math] [ebgaramond,ebgaramond-nt] diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-erewhon.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-erewhon.mkiv index c536caa0eb7..660b4c58a06 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-erewhon.mkiv +++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-erewhon.mkiv @@ -23,11 +23,11 @@ \doifunknownfontfeature {erewhon-math-bold} {\definefontfeature[erewhon-math-bold][boldened]} \starttypescript [\s!serif] [erewhon] - \definefontsynonym [\s!Serif] [\s!file:Erewhon-Regular] [\s!features=\s!default] - \definefontsynonym [\s!SerifItalic] [\s!file:Erewhon-Italic] [\s!features=\s!default] + \definefontsynonym [\s!Serif] [\s!file:Erewhon-Regular] [\s!features=\s!default,\s!goodies=erewhon-text] + \definefontsynonym [\s!SerifItalic] [\s!file:Erewhon-Italic] [\s!features=\s!default,\s!goodies=erewhon-text] \definefontsynonym [\s!SerifSlanted] [\s!file:Erewhon-RegularSlanted][\s!features=\s!default] - \definefontsynonym [\s!SerifBold] [\s!file:Erewhon-Bold] [\s!features=\s!default] - \definefontsynonym [\s!SerifBoldItalic] [\s!file:Erewhon-BoldItalic] [\s!features=\s!default] + \definefontsynonym [\s!SerifBold] [\s!file:Erewhon-Bold] [\s!features=\s!default,\s!goodies=erewhon-text] + \definefontsynonym [\s!SerifBoldItalic] [\s!file:Erewhon-BoldItalic] [\s!features=\s!default,\s!goodies=erewhon-text] \definefontsynonym [\s!SerifBoldSlanted][\s!file:Erewhon-BoldSlanted] [\s!features=\s!default] \stoptypescript diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-iwona.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-iwona.mkiv index f4373125083..e682622652d 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-iwona.mkiv +++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-iwona.mkiv @@ -14,13 +14,7 @@ \starttypescriptcollection[iwona] \startsetups[iwona] - % \setupmathfence [\c!alternative=1]% - \setmathfenceparameter \c!alternative{1}% -% \letmathfractionparameter\c!rule\v!symbol -% \setmathfractionparameter\c!middle{"203E}% -% \letmathradicalparameter \c!rule\v!symbol -% \setmathradicalparameter \c!top{\radicalbarextenderuc}% -% \setmathfenceparameter \c!alternative{1}% + \setmathfenceparameter\c!alternative{1}% \stopsetups \startsetups[iwona-light] \directsetup{antykwa}\stopsetups @@ -31,12 +25,17 @@ \startsetups[iwona-medium-cond]\directsetup{antykwa}\stopsetups \startsetups[iwona-heavy-cond] \directsetup{antykwa}\stopsetups - \definefontfeature[virtualmath-iwona] [virtualmath][virtualweight=iwona] - \definefontfeature[virtualmath-iwona-light] [virtualmath][virtualweight=iwona-light] - \definefontfeature[virtualmath-iwona-medium][virtualmath][virtualweight=iwona-medium] - \definefontfeature[virtualmath-iwona-heavy] [virtualmath][virtualweight=iwona-heavy] + \definefontfeature[virtualmath-iwona] [virtualmath][virtualweight=iwona] + \definefontfeature[virtualmath-iwona-light] [virtualmath][virtualweight=iwona-light] + \definefontfeature[virtualmath-iwona-medium] [virtualmath][virtualweight=iwona-medium] + \definefontfeature[virtualmath-iwona-heavy] [virtualmath][virtualweight=iwona-heavy] - \starttypescript [\s!sans] [iwona,iwona-light,iwona-medium,iwona-heavy,iwona-cond,iwona-light-cond,iwona-medium-cond,iwona-heavy-cond] + \definefontfeature[virtualmath-iwona-nt] [virtualmath][virtualweight=iwona-nt] + \definefontfeature[virtualmath-iwona-light-nt] [virtualmath][virtualweight=iwona-light-nt] + \definefontfeature[virtualmath-iwona-medium-nt][virtualmath][virtualweight=iwona-medium-nt] + \definefontfeature[virtualmath-iwona-heavy-nt] [virtualmath][virtualweight=iwona-heavy-nt] + + \starttypescript [\s!sans] [iwona,iwona-light,iwona-medium,iwona-heavy,iwona-cond,iwona-light-cond,iwona-medium-cond,iwona-heavy-cond,iwona,iwona-light-nt,iwona-medium-nt,iwona-heavy-nt,iwona-cond-nt,iwona-light-cond-nt,iwona-medium-cond-nt,iwona-heavy-cond-nt] \definefontsynonym [Iwona-Regular] [\s!file:Iwona-Regular] [\s!features=\s!default] \definefontsynonym [Iwona-Italic] [\s!file:Iwona-Italic] [\s!features=\s!default] @@ -66,22 +65,41 @@ \starttypescript [\s!math][iwona][\s!all] \definefontsynonym[\s!MathRoman] [iwonamath@iwona-math] + \definefontsynonym[\s!MathRomanBold][iwonamediummath@iwona-medium-math] \stoptypescript \starttypescript [\s!math][iwona-light][\s!all] \definefontsynonym[\s!MathRoman] [iwonalightmath@iwona-light-math] + \definefontsynonym[\s!MathRomanBold][iwonamath@kurier-medium-math] \stoptypescript \starttypescript [\s!math][iwona-medium][\s!all] \definefontsynonym[\s!MathRoman] [iwonamediummath@iwona-medium-math] + \definefontsynonym[\s!MathRomanBold][kurierheavymath@kurier-heavy-math] \stoptypescript \starttypescript [\s!math][iwona-heavy][\s!all] \definefontsynonym[\s!MathRoman][iwonaheavymath@iwona-heavy-math] \stoptypescript - \starttypescript [\s!math] [iwona,iwona-light,iwona-medium,iwona-heavy] [\s!all] + \starttypescript [\s!math][iwona-nt][\s!all] + \definefontsynonym[\s!MathRoman] [iwonamathnt@iwona-math-nt] + \definefontsynonym[\s!MathRomanBold][iwonamediummathnt@iwona-medium-math-nt] + \stoptypescript + \starttypescript [\s!math][iwona-light-nt][\s!all] + \definefontsynonym[\s!MathRoman] [iwonalightmathnt@iwona-light-math-nt] + \definefontsynonym[\s!MathRomanBold][iwonamathnt@kurier-medium-math-nt] + \stoptypescript + \starttypescript [\s!math][iwona-medium-nt][\s!all] + \definefontsynonym[\s!MathRoman] [iwonamediummathnt@iwona-medium-math-nt] + \definefontsynonym[\s!MathRomanBold][kurierheavymathnt@kurier-heavy-math-nt] + \stoptypescript + \starttypescript [\s!math][iwona-heavy-nt][\s!all] + \definefontsynonym[\s!MathRoman][iwonaheavymathnt@iwona-heavy-math-nt] + \stoptypescript + + \starttypescript [\s!math] [iwona,iwona-light,iwona-medium,iwona-heavy-nt,iwona-nt,iwona-light-nt,iwona-medium-nt,iwona-heavy-nt] [\s!all] \loadfontgoodies[iwona-math] \stoptypescript - \starttypescript [\s!sans] [iwona-light] [\s!name] + \starttypescript [\s!sans] [iwona-light,iwona-light-nt] [\s!name] \setups[\s!font:\s!fallback:\s!sans] \definefontsynonym [\s!Sans] [Iwona-Light-Regular] \definefontsynonym [\s!SansItalic] [Iwona-Light-Italic] @@ -89,7 +107,7 @@ \definefontsynonym [\s!SansBoldItalic] [Iwona-Medium-Italic] \stoptypescript - \starttypescript [\s!sans] [iwona] [\s!name] + \starttypescript [\s!sans] [iwona,iwona-nt] [\s!name] \setups[\s!font:\s!fallback:\s!sans] \definefontsynonym [\s!Sans] [Iwona-Regular] \definefontsynonym [\s!SansItalic] [Iwona-Italic] @@ -97,7 +115,7 @@ \definefontsynonym [\s!SansBoldItalic] [Iwona-BoldItalic] \stoptypescript - \starttypescript [\s!sans] [iwona-medium] [\s!name] + \starttypescript [\s!sans] [iwona-medium,iwona-medium-nt] [\s!name] \setups[\s!font:\s!fallback:\s!sans] \definefontsynonym [\s!Sans] [Iwona-Medium-Regular] \definefontsynonym [\s!SansItalic] [Iwona-Medium-Italic] @@ -105,7 +123,7 @@ \definefontsynonym [\s!SansBoldItalic] [Iwona-Heavy-Italic] \stoptypescript - \starttypescript [\s!sans] [iwona-heavy] [\s!name] + \starttypescript [\s!sans] [iwona-heavy,iwona-heavy-nt] [\s!name] \setups[\s!font:\s!fallback:\s!sans] \definefontsynonym [\s!Sans] [Iwona-Heavy-Regular] \definefontsynonym [\s!SansItalic] [Iwona-Heavy-Italic] @@ -113,7 +131,7 @@ \definefontsynonym [\s!SansBoldItalic] [Iwona-Heavy-Italic] \stoptypescript - \starttypescript [\s!sans] [iwona-light-cond] [\s!name] + \starttypescript [\s!sans] [iwona-light-cond,iwona-light-cond-nt] [\s!name] \setups[\s!font:\s!fallback:\s!sans] \definefontsynonym [\s!Sans] [Iwona-CondLight-Regular] \definefontsynonym [\s!SansItalic] [Iwona-CondLight-Italic] @@ -122,7 +140,7 @@ \stoptypescript - \starttypescript [\s!sans] [iwona-cond] [\s!name] + \starttypescript [\s!sans] [iwona-cond,iwona-cond-nt] [\s!name] \setups[\s!font:\s!fallback:\s!sans] \definefontsynonym [\s!Sans] [Iwona-CondRegular] \definefontsynonym [\s!SansItalic] [Iwona-CondItalic] @@ -130,7 +148,7 @@ \definefontsynonym [\s!SansBoldItalic] [Iwona-CondBoldItalic] \stoptypescript - \starttypescript [\s!sans] [iwona-medium-cond] [\s!name] + \starttypescript [\s!sans] [iwona-medium-cond,iwona-medium-cond-nt] [\s!name] \setups[\s!font:\s!fallback:\s!sans] \definefontsynonym [\s!Sans] [Iwona-CondMedium-Regular] \definefontsynonym [\s!SansItalic] [Iwona-CondMedium-Italic] @@ -138,7 +156,7 @@ \definefontsynonym [\s!SansBoldItalic] [Iwona-CondHeavy-Italic] \stoptypescript - \starttypescript [iwona,iwona-light,iwona-heavy,iwona-medium] + \starttypescript [iwona,iwona-light,iwona-heavy,iwona-medium,iwona-nt,iwona-light-nt,iwona-heavy-nt,iwona-medium-nt] \definetypeface[\typescriptone][\s!ss][\s!sans] [\typescriptone] [\s!default] \definetypeface[\typescriptone][\s!rm][\s!serif][modern] [\s!default] \definetypeface[\typescriptone][\s!tt][\s!mono] [modern] [\s!default] diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-koeielettersot.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-koeielettersot.mkiv deleted file mode 100644 index da04010166a..00000000000 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-koeielettersot.mkiv +++ /dev/null @@ -1,179 +0,0 @@ -%D \module -%D [ file=type-cowotf, -%D version=2016.09.16, -%D title=\CONTEXT\ Typescript Macros, -%D subtitle=Cow Fonts (otf version), -%D author={Taco Hoekwater \& 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 The cow fonts are a project of Duane Bibby, Hans Hagen and Taco -%D Hoekwater. - -\unprotect - -\definefontfeature - [sheepdigits] - [mode=node, - script=latn, - ss01=yes] - -\definefontfeature - [mathsheepdigits] - [sheepdigits] - [mode=base] - -\definefontfeature - [cowslogos] - [mode=node, - script=latn, - ss02=yes, - dlig=yes] - -\definefontfeature - [cowsligatures] - [mode=node, - script=latn, - dlig=yes] - -\definefontfeature - [cowscolors] - [mode=node, - colr=yes, - ss02=yes, - dlig=yes] - -\definefontfeature - [cowsdefault] - [default] - [mode=node, - compose=yes] - -\definefontfeature - [sheepdefault] - [cowsdefault,sheepdigits] - -\definefontfeature - [cowscolored] - [cowsdefault,cowscolors] - -\definefontfeature - [sheepcolored] - [sheepdefault,cowscolors] - -\starttypescriptcollection[koeielettersot] - - \loadfontgoodies[koeielettersot] - - \starttypescript [\s!all] [cowsotf] - \definefontsynonym [Cows] [koeielettersot][\s!features=cowsdefault] - \definefontsynonym [CowsLogo] [koeielettersot][\s!features=cowslogos] - \definefontsynonym [CowsMathRoman][koeielettersot][\s!features=mathextra,\s!goodies=koeielettersot] - \stoptypescript - - \starttypescript [\s!all] [koeielettersotf,sheepotf] - \definefontsynonym [Sheep] [koeielettersot][\s!features=sheepdefault] - \definefontsynonym [SheepLogo] [koeielettersot][\s!features=cowslogos] - \definefontsynonym [SheepMathRoman][koeielettersot][\s!features={mathsheepdigits,mathextra},\s!goodies=koeielettersot] - \stoptypescript - -% \definefontsynonym[\s!MathRoman][file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=dejavu-math] - - \starttypescript [\s!all] [coloredcowsotf] - \definefontsynonym [Cows] [koeielettersot][\s!features=cowscolored] - \definefontsynonym [CowsLogo] [koeielettersot][\s!features=cowslogos] - \definefontsynonym [CowsMathRoman][koeielettersot][\s!features=mathextra,\s!goodies=koeielettersot] - \stoptypescript - - \starttypescript [\s!all] [coloredsheepotf] - \definefontsynonym [Sheep] [koeielettersot][\s!features=sheepcolored] - \definefontsynonym [SheepLogo] [koeielettersot][\s!features=cowslogos] - \definefontsynonym [SheepMathRoman][koeielettersot][\s!features={mathsheepdigits,mathextra},\s!goodies=koeielettersot] - \stoptypescript - - \starttypescript [\s!serif] [cowsotf,coloredcowsotf] - \setups[\s!font:\s!fallback:\s!serif] - \definefontsynonym [\s!Serif] [Cows] - \definefontsynonym [\s!Serif Logo][CowsLogo] - \stoptypescript - - \starttypescript [\s!serif] [koeielettersotf,sheepotf,coloredsheepotf] - \setups[\s!font:\s!fallback:\s!serif] - \definefontsynonym [\s!Serif] [Sheep] - \definefontsynonym [\s!Serif Logo][SheepLogo] - \stoptypescript - - \starttypescript [\s!math] [cowsotf,coloredcowsotf] - \definefontsynonym [\s!MathRoman][CowsMathRoman] - \enablemathrules % uses \fontclass, for now this way - \stoptypescript - - \starttypescript [\s!math] [koeielettersotf,sheepotf,coloredsheepotf] - \definefontsynonym [\s!MathRoman][SheepMathRoman] - \enablemathrules % uses \fontclass, for now this way - \stoptypescript - - \starttypescript [koeieletters,cows,sheep,coloredcows,coloredsheep] - \definetypeface [\typescriptone][\s!rm][\s!serif][\typescriptone otf][\s!default] - \definetypeface [\typescriptone][\s!ss][\s!serif][\typescriptone otf][\s!default] - \definetypeface [\typescriptone][\s!mm][\s!math] [\typescriptone otf][\s!default] - \definetypeface [\typescriptone][\s!tt][\s!mono] [modern] [\s!default][\s!rscale=0.85] - \stoptypescript - -\stoptypescriptcollection - -\protect - -\continueifinputfile{type-imp-koeielettersot.mkiv} - -\starttext - -\setupbodyfont[cows] - -% \input tufte - -% \stoptext - -% \starttext - -\loadtypescriptfile[cowotf] - -\definecolor[cowred] [r=.50] -\definecolor[cowgreen] [g=.50] -\definecolor[cowblue] [b=.50] -\definecolor[cowyellow][y=.25] - -\definefontcolorpalette[cows][cowgreen,cowyellow,cowblue,cowred] - -\startluacode - fonts.handlers.otf.registerpalette("cows", { - { g = .5 }, - { r = .75, g = .75 }, - { b = .5 }, - { r = .5 }, - }) -\stopluacode - -\adaptfontfeature[cowscolored] [colr=cows] - -\setupbodyfont[coloredcows,12pt] - -\input zapf - -\definefontsynonym - [CowsColored] - [koeielettersot] - -\showotfcomposition - {koeielettersot*default,cowscolors} - {1} - {context} - -\scale[width=\textwidth]{\getnamedglyphdirect{CowsColored*default,cowscolors}{contextlogo}} -\scale[width=\textwidth]{\definedfont[CowsColored*default,cowscolors]context} - -\stoptext diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kpfonts.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kpfonts.mkiv index 472619cd953..bc7de3ae75a 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kpfonts.mkiv +++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kpfonts.mkiv @@ -34,10 +34,10 @@ \stoptypescript \starttypescript [\s!serif] [kpfonts,kpfonts-sans,kpfonts-nt] - \definefontsynonym [\s!Serif] [\s!file:KpRoman-Regular.otf] - \definefontsynonym [\s!SerifBold] [\s!file:KpRoman-SemiBold.otf] - \definefontsynonym [\s!SerifItalic] [\s!file:KpRoman-Italic.otf] - \definefontsynonym [\s!SerifBoldItalic] [\s!file:KpRoman-SemiboldItalic.otf] + \definefontsynonym [\s!Serif] [\s!file:KpRoman-Regular.otf][\s!goodies=kpfonts-text] + \definefontsynonym [\s!SerifBold] [\s!file:KpRoman-SemiBold.otf][\s!goodies=kpfonts-text] + \definefontsynonym [\s!SerifItalic] [\s!file:KpRoman-Italic.otf][\s!goodies=kpfonts-text] + \definefontsynonym [\s!SerifBoldItalic] [\s!file:KpRoman-SemiboldItalic.otf][\s!goodies=kpfonts-text] \definefontsynonym [\s!SerifSlanted] [\s!SerifItalic] \definefontsynonym [\s!SerifBoldSlanted] [\s!SerifBoldItalic] \stoptypescript @@ -68,14 +68,14 @@ \starttypescript [\s!serif] [kpfonts-bold] \setups[\s!font:\s!fallback:\s!serif] - \definefontsynonym [\s!Serif] [\s!file:KpRoman-Regular.otf] + \definefontsynonym [\s!Serif] [\s!file:KpRoman-SemiBold.otf] \definefontsynonym [\s!SerifBold] [\s!file:KpRoman-Bold.otf] - \definefontsynonym [\s!SerifItalic] [\s!file:KpRoman-Italic.otf] + \definefontsynonym [\s!SerifItalic] [\s!file:KpRoman-SemiboldItalic.otf] \definefontsynonym [\s!SerifBoldItalic] [\s!file:KpRoman-BoldItalic.otf] \stoptypescript \starttypescript [\s!math] [kpfonts-bold] - \definefontsynonym [\s!MathRoman] [\s!file:KpMath-Regular.otf] [\s!features={\s!math\mathsizesuffix,kpfonts:mathextra,mathextra},\s!goodies=kpfonts-math] + \definefontsynonym [\s!MathRoman] [\s!file:KpMath-SemiBold.otf] [\s!features={\s!math\mathsizesuffix,kpfonts:mathextra,mathextra},\s!goodies=kpfonts-math] \definefontsynonym [\s!MathRomanBold] [\s!file:KpMath-Bold.otf] [\s!features={\s!math\mathsizesuffix,kpfonts:mathextra,mathextra},\s!goodies=kpfonts-math] \stoptypescript diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kurier.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kurier.mkiv index 0bf1a43cae0..3f68cbfadd3 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kurier.mkiv +++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-kurier.mkiv @@ -13,12 +13,29 @@ \starttypescriptcollection [kurier] - \definefontfeature[virtualmath-kurier] [virtualmath][virtualweight=kurier] - \definefontfeature[virtualmath-kurier-light] [virtualmath][virtualweight=kurier-light] - \definefontfeature[virtualmath-kurier-medium][virtualmath][virtualweight=kurier-medium] - \definefontfeature[virtualmath-kurier-heavy] [virtualmath][virtualweight=kurier-heavy] + \startsetups[kurier] + \setmathfenceparameter\c!alternative{1}% + \stopsetups - \starttypescript [\s!sans] [kurier-light,kurier,kurier-medium] + \startsetups[kurier-light] \directsetup{antykwa}\stopsetups + \startsetups[kurier-medium] \directsetup{antykwa}\stopsetups + \startsetups[kurier-heavy] \directsetup{antykwa}\stopsetups + \startsetups[kurier-cond] \directsetup{antykwa}\stopsetups + \startsetups[kurier-light-cond] \directsetup{antykwa}\stopsetups + \startsetups[kurier-medium-cond]\directsetup{antykwa}\stopsetups + \startsetups[kurier-heavy-cond] \directsetup{antykwa}\stopsetups + + \definefontfeature[virtualmath-kurier] [virtualmath][virtualweight=kurier] + \definefontfeature[virtualmath-kurier-light] [virtualmath][virtualweight=kurier-light] + \definefontfeature[virtualmath-kurier-medium] [virtualmath][virtualweight=kurier-medium] + \definefontfeature[virtualmath-kurier-heavy] [virtualmath][virtualweight=kurier-heavy] + + \definefontfeature[virtualmath-kurier-nt] [virtualmath][virtualweight=kurier-nt] + \definefontfeature[virtualmath-kurier-light-nt] [virtualmath][virtualweight=kurier-light-nt] + \definefontfeature[virtualmath-kurier-medium-nt][virtualmath][virtualweight=kurier-medium-nt] + \definefontfeature[virtualmath-kurier-heavy-nt] [virtualmath][virtualweight=kurier-heavy-nt] + + \starttypescript [\s!sans] [kurier-light,kurier,kurier-medium,kurier-heavy,kurier-light-nt,kurier-nt,kurier-medium-nt,kurier-heavy-nt] \definefontsynonym [Kurier-Light] [\s!file:kurierlightregular] [\s!features=\s!default] \definefontsynonym [Kurier-LightItalic] [\s!file:kurierlightitalic] [\s!features=\s!default] \definefontsynonym [Kurier-Regular] [\s!file:kurierregular] [\s!features=\s!default] @@ -31,7 +48,7 @@ \definefontsynonym [Kurier-HeavyItalic] [\s!file:kurierheavyitalic] [\s!features=\s!default] \stoptypescript - \starttypescript [\s!sans] [kurier-lightcond,kurier-cond,kurier-mediumcond] + \starttypescript [\s!sans] [kurier-lightcond,kurier-cond,kurier-mediumcond,kurier-lightcond-nt,kurier-cond-nt,kurier-mediumcond-nt] \definefontsynonym [Kurier-CondLight] [\s!file:kuriercondlightregular] [\s!features=\s!default] \definefontsynonym [Kurier-CondLightItalic] [\s!file:kuriercondlightitalic] [\s!features=\s!default] \definefontsynonym [Kurier-CondRegular] [\s!file:kuriercondregular] [\s!features=\s!default] @@ -49,7 +66,7 @@ \definefontsynonym[\s!MathRomanBold][kuriermediummath@kurier-medium-math] \stoptypescript \starttypescript [\s!math][kurier-light][\s!all] - \definefontsynonym[\s!MathRoman][kurierlightmath@kurier-light-math] + \definefontsynonym[\s!MathRoman] [kurierlightmath@kurier-light-math] \definefontsynonym[\s!MathRomanBold][kuriermath@kurier-math] \stoptypescript \starttypescript [\s!math][kurier-medium][\s!all] @@ -60,11 +77,27 @@ \definefontsynonym[\s!MathRoman][kurierheavymath@kurier-heavy-math] \stoptypescript - \starttypescript [\s!math] [kurier,kurier-light,kurier-medium,kurier-heavy] [\s!all] + \starttypescript [\s!math][kurier-nt][\s!all] + \definefontsynonym[\s!MathRoman] [kuriermathnt@kurier-math-nt] + \definefontsynonym[\s!MathRomanBold][kuriermediummathnt@kurier-medium-math-nt] + \stoptypescript + \starttypescript [\s!math][kurier-light-nt][\s!all] + \definefontsynonym[\s!MathRoman] [kurierlightmathnt@kurier-light-math-nt] + \definefontsynonym[\s!MathRomanBold][kuriermathnt@kurier-math-nt] + \stoptypescript + \starttypescript [\s!math][kurier-medium-nt][\s!all] + \definefontsynonym[\s!MathRoman] [kuriermediummathnt@kurier-medium-math-nt] + \definefontsynonym[\s!MathRomanBold][kurierheavymathnt@kurier-heavy-math-nt] + \stoptypescript + \starttypescript [\s!math][kurier-heavy-nt][\s!all] + \definefontsynonym[\s!MathRoman][kurierheavymathnt@kurier-heavy-math-nt] + \stoptypescript + + \starttypescript [\s!math] [kurier,kurier-light,kurier-medium,kurier-heavy,kurier-nt,kurier-light-nt,kurier-medium-nt,kurier-heavy-nt] [\s!all] \loadfontgoodies[kurier-math] \stoptypescript - \starttypescript [\s!sans] [kurier-light] + \starttypescript [\s!sans] [kurier-light,kurier-light-nt] \setups[\s!font:\s!fallback:\s!sans] \definefontsynonym [\s!Sans] [Kurier-Light] \definefontsynonym [\s!SansItalic] [Kurier-LightItalic] @@ -72,7 +105,7 @@ \definefontsynonym [\s!SansBoldItalic] [Kurier-MediumItalic] \stoptypescript - \starttypescript [\s!sans] [kurier] + \starttypescript [\s!sans] [kurier,kurier-nt] \setups[\s!font:\s!fallback:\s!sans] \definefontsynonym [\s!Sans] [Kurier-Regular] \definefontsynonym [\s!SansItalic] [Kurier-Italic] @@ -80,7 +113,7 @@ \definefontsynonym [\s!SansBoldItalic] [Kurier-BoldItalic] \stoptypescript - \starttypescript [\s!sans] [kurier-medium] + \starttypescript [\s!sans] [kurier-medium,kurier-medium-nt] \setups[\s!font:\s!fallback:\s!sans] \definefontsynonym [\s!Sans] [Kurier-Medium] \definefontsynonym [\s!SansItalic] [Kurier-MediumItalic] @@ -88,7 +121,15 @@ \definefontsynonym [\s!SansBoldItalic] [Kurier-HeavyItalic] \stoptypescript - \starttypescript [\s!sans] [kurier-lightcond] + \starttypescript [\s!sans] [kurier-heavy,kurier-heavy-nt] + \setups[\s!font:\s!fallback:\s!sans] + \definefontsynonym [\s!Sans] [Kurier-Heavy] + \definefontsynonym [\s!SansItalic] [Kurier-HeavyItalic] + \definefontsynonym [\s!SansBold] [Kurier-Heavy] + \definefontsynonym [\s!SansBoldItalic] [Kurier-Heavy] + \stoptypescript + + \starttypescript [\s!sans] [kurier-lightcond,kurier-lightcond-nt] \setups[\s!font:\s!fallback:\s!sans] \definefontsynonym [\s!Sans] [Kurier-CondLight] \definefontsynonym [\s!SansItalic] [Kurier-CondLightItalic] @@ -96,7 +137,7 @@ \definefontsynonym [\s!SansBoldItalic] [Kurier-CondMediumItalic] \stoptypescript - \starttypescript [\s!sans] [kurier-cond] + \starttypescript [\s!sans] [kurier-cond,kurier-cond-nt] \setups[\s!font:\s!fallback:\s!sans] \definefontsynonym [\s!Sans] [Kurier-CondRegular] \definefontsynonym [\s!SansItalic] [Kurier-CondItalic] @@ -104,7 +145,7 @@ \definefontsynonym [\s!SansBoldItalic] [Kurier-CondBoldItalic] \stoptypescript - \starttypescript [\s!sans] [kurier-mediumcond] + \starttypescript [\s!sans] [kurier-mediumcond,kurier-mediumcond-nt] \setups[\s!font:\s!fallback:\s!sans] \definefontsynonym [\s!Sans] [Kurier-CondMedium] \definefontsynonym [\s!SansItalic] [Kurier-CondMediumItalic] @@ -112,7 +153,7 @@ \definefontsynonym [\s!SansBoldItalic] [Kurier-CondHeavyItalic] \stoptypescript - \starttypescript [kurier-light,kurier,kurier-medium,kurier-lightcond,kurier-cond,kurier-mediumcond] + \starttypescript [kurier-light,kurier,kurier-medium,kurier-heavy,kurier-lightcond,kurier-cond,kurier-mediumcond,kurier-light,kurier-nt,kurier-medium-nt,kurier-heavy-nt,kurier-lightcond-nt,kurier-cond-nt,kurier-mediumcond-nt] \definetypeface [\typescriptone] [\s!ss] [\s!sans] [\typescriptone] [\s!default] \definetypeface [\typescriptone] [\s!rm] [\s!serif] [modern] [\s!default] \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv index f5082f7840a..a995bc42fc2 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv +++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv @@ -121,12 +121,12 @@ \starttypescript [\s!serif] [modern,latin-modern] \loadfontgoodies[lm] - \definefontsynonym [LMRoman-Regular] [\s!file:lmroman10-regular] [\s!features=\s!default] - \definefontsynonym [LMRoman-Bold] [\s!file:lmroman10-bold] [\s!features=\s!default] + \definefontsynonym [LMRoman-Regular] [\s!file:lmroman10-regular] [\s!features=\s!default,\s!goodies=modern-text] + \definefontsynonym [LMRoman-Bold] [\s!file:lmroman10-bold] [\s!features=\s!default,\s!goodies=modern-text] \definefontsynonym [LMRoman-Demi] [\s!file:lmromandemi10-regular] [\s!features=\s!default] - \definefontsynonym [LMRoman-Italic] [\s!file:lmroman10-italic] [\s!features=\s!default] + \definefontsynonym [LMRoman-Italic] [\s!file:lmroman10-italic] [\s!features=\s!default,\s!goodies=modern-text] \definefontsynonym [LMRoman-Oblique] [\s!file:lmromanslant10-regular] [\s!features=\s!default] - \definefontsynonym [LMRoman-BoldItalic] [\s!file:lmroman10-bolditalic] [\s!features=\s!default] + \definefontsynonym [LMRoman-BoldItalic] [\s!file:lmroman10-bolditalic] [\s!features=\s!default,\s!goodies=modern-text] \definefontsynonym [LMRoman-BoldOblique] [\s!file:lmromanslant10-bold] [\s!features=\s!default] \definefontsynonym [LMRoman-DemiOblique] [\s!file:lmromandemi10-oblique] [\s!features=\s!default] \definefontsynonym [LMRoman-CapsRegular] [\s!file:lmroman10-CapsRegular] [\s!features=\s!default] diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-libertinus.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-libertinus.mkiv index 97e3b3493f3..36d2666f724 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-libertinus.mkiv +++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-libertinus.mkiv @@ -24,11 +24,11 @@ \doifunknownfontfeature {libertinus-math-bold} {\definefontfeature[libertinus-math-bold][boldened]} \starttypescript [\s!serif] [libertinus] - \definefontsynonym [LibertinusSerif-Regular] [\s!file:libertinusserif-regular] - \definefontsynonym [LibertinusSerif-Italic] [\s!file:libertinusserif-italic] + \definefontsynonym [LibertinusSerif-Regular] [\s!file:libertinusserif-regular][\s!goodies=libertinus-text] + \definefontsynonym [LibertinusSerif-Italic] [\s!file:libertinusserif-italic][\s!goodies=libertinus-text] \definefontsynonym [LibertinusSerif-Slanted] [\s!file:libertinusserif-italic] - \definefontsynonym [LibertinusSerif-Bold] [\s!file:libertinusserif-bold] - \definefontsynonym [LibertinusSerif-BoldItalic] [\s!file:libertinusserif-bolditalic] + \definefontsynonym [LibertinusSerif-Bold] [\s!file:libertinusserif-bold][\s!goodies=libertinus-text] + \definefontsynonym [LibertinusSerif-BoldItalic] [\s!file:libertinusserif-bolditalic][\s!goodies=libertinus-text] \definefontsynonym [LibertinusSerif-BoldSlanted] [\s!file:libertinusserif-bolditalic] \stoptypescript diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-lucida-typeone.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-lucida-typeone.mkiv deleted file mode 100644 index 59d167a1bbf..00000000000 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-lucida-typeone.mkiv +++ /dev/null @@ -1,136 +0,0 @@ -%D \module -%D [ file=type-imp-lucida-typeone, -%D version=2010.06.21, -%D title=\CONTEXT\ Typescript Macros, -%D subtitle=Lucida, -%D author=Mojca Miklavec \& 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. - -\writestatus{fonts}{Lucida Type 1 support can be broken due to wrong files!} - -\starttypescriptcollection[lucida-typeone] - - \starttypescript [\s!serif] [lucida] - \definefontsynonym [LucidaBright] [\s!name:LucidaBright] - \definefontsynonym [LucidaBright-Demi] [\s!name:LucidaBright-Demi] - \definefontsynonym [LucidaBright-Italic] [\s!name:LucidaBright-Italic] - \definefontsynonym [LucidaBright-DemiItalic] [\s!name:LucidaBright-DemiItalic] - \definefontsynonym [LucidaBright-Oblique] [\s!name:LucidaBright-Oblique] - \definefontsynonym [LucidaBrightSmallcaps] [\s!name:LucidaBrightSmallcaps] - \definefontsynonym [LucidaBrightSmallcaps-Demi] [\s!name:LucidaBrightSmallcaps-Demi] - \stoptypescript - - \starttypescript [\s!sans] [lucida] - \definefontsynonym [LucidaSans] [\s!name:LucidaSans] - \definefontsynonym [LucidaSans-Demi] [\s!name:LucidaSans-Demi] - \definefontsynonym [LucidaSans-Bold] [\s!name:LucidaSans-Bold] - \definefontsynonym [LucidaSans-Italic] [\s!name:LucidaSans-Italic] - \definefontsynonym [LucidaSans-DemiItalic] [\s!name:LucidaSans-DemiItalic] - \definefontsynonym [LucidaSans-BoldItalic] [\s!name:LucidaSans-BoldItalic] - \stoptypescript - - \starttypescript [\s!mono] [lucida] - \definefontsynonym [LucidaTypewriter] [\s!name:LucidaTypewriter] - \definefontsynonym [LucidaTypewriterBold] [\s!name:LucidaTypewriterBold] - \definefontsynonym [LucidaTypewriterOblique] [\s!name:LucidaTypewriterOblique] - \definefontsynonym [LucidaTypewriterBoldOblique] [\s!name:LucidaTypewriterBoldOblique] - \stoptypescript - - \starttypescript [\s!mono] [lucida] - \definefontsynonym [LucidaSans-Typewriter] [\s!name:LucidaSans-Typewriter] - \definefontsynonym [LucidaSans-TypewriterBold] [\s!name:LucidaSans-TypewriterBold] - \definefontsynonym [LucidaSans-TypewriterOblique] [\s!name:LucidaSans-TypewriterOblique] - \definefontsynonym [LucidaSans-TypewriterBoldOblique] [\s!name:LucidaSans-TypewriterBoldOblique] - \stoptypescript - - \starttypescript [calligraphy] [lucida] - \definefontsynonym [LucidaCalligraphy-Italic] [\s!name:LucidaCalligraphy-Italic] - \stoptypescript - - \starttypescript [casual] [lucida] - \definefontsynonym [LucidaCasual] [\s!name:LucidaCasual] - \definefontsynonym [LucidaCasual-Italic] [\s!name:LucidaCasual-Italic] - \stoptypescript - - \starttypescript [handwriting] [lucida] - \definefontsynonym [LucidaHandwriting-Italic] [\s!name:LucidaHandwriting-Italic] - \stoptypescript - - \starttypescript [fax] [lucida] - \definefontsynonym [LucidaFax] [\s!name:LucidaFax] - \definefontsynonym [LucidaFax-Demi] [\s!name:LucidaFax-Demi] - \definefontsynonym [LucidaFax-Italic] [\s!name:LucidaFax-Italic] - \definefontsynonym [LucidaFax-DemiItalic] [\s!name:LucidaFax-DemiItalic] - \stoptypescript - - \starttypescript [blackletter] [lucida] - \definefontsynonym [LucidaBlackletter] [\s!name:LucidaBlackletter] - \stoptypescript - - \starttypescript [\s!math] [lucida] - \loadfontgoodies[lucida-typeone-math] - \definefontsynonym[\s!MathRoman][lucidamath@lucida-math] - \stoptypescript - - \starttypescript [\s!serif] [lucida] [\s!name] - \definefontsynonym [\s!Serif] [LucidaBright] - \definefontsynonym [\s!SerifBold] [LucidaBright-Demi] - \definefontsynonym [\s!SerifItalic] [LucidaBright-Italic] - \definefontsynonym [\s!SerifBoldItalic] [LucidaBright-DemiItalic] - \definefontsynonym [\s!SerifSlanted] [LucidaBright-Oblique] - \definefontsynonym [\s!SerifBoldSlanted] [LucidaBright-DemiItalic] - \definefontsynonym [SerifCaps] [LucidaBrightSmallcaps] - \definefontsynonym [SerifBoldCaps] [LucidaBrightSmallcaps-Demi] - \stoptypescript - - % Lucida Bright Sans - - \starttypescript [\s!sans] [lucida] [\s!name] - \definefontsynonym [\s!Sans] [LucidaSans] - \definefontsynonym [\s!SansBold] [LucidaSans-Demi] - \definefontsynonym [\s!SansItalic] [LucidaSans-Italic] - \definefontsynonym [\s!SansBoldItalic] [LucidaSans-DemiItalic] - \definefontsynonym [\s!SansSlanted] [LucidaSans-Italic] - \definefontsynonym [\s!SansBoldSlanted] [LucidaSans-DemiItalic] - \definefontsynonym [SansCaps] [LucidaSans] - \stoptypescript - - % Lucida Bright Sans Typewriter - - \starttypescript [\s!mono] [lucida] [\s!name] - \definefontsynonym [\s!Mono] [LucidaSans-Typewriter] - \definefontsynonym [\s!MonoBold] [LucidaSans-TypewriterBold] - \definefontsynonym [\s!MonoItalic] [LucidaSans-TypewriterOblique] - \definefontsynonym [\s!MonoBoldItalic] [LucidaSans-TypewriterBoldOblique] - \definefontsynonym [\s!MonoSlanted] [LucidaSans-TypewriterOblique] - \definefontsynonym [\s!MonoBoldSlanted] [LucidaSans-TypewriterBoldOblique] - \definefontsynonym [MonoCaps] [LucidaSans-Typewriter] - \stoptypescript - - % Lucida Calligraphy - - \starttypescript [calligraphy] [lucida] [\s!name] - \definefontsynonym [Calligraphy] [LucidaCalligraphy-Italic] - \stoptypescript - - % Lucida Handwriting - - \starttypescript [handwriting] [lucida] [\s!name] - \definefontsynonym [Handwriting] [LucidaHandwriting-Italic] - \stoptypescript - - \starttypescript [lucida] - \definetypeface [lucida] [\s!rm] [\s!serif] [lucida] [\s!default] [\s!features=\s!default] - \definetypeface [lucida] [\s!ss] [\s!sans] [lucida] [\s!default] [\s!features=\s!default] - \definetypeface [lucida] [\s!tt] [\s!mono] [lucida] [\s!default] [\s!features=\s!none] - \definetypeface [lucida] [\s!hw] [\s!handwriting] [lucida] [\s!default] [\s!features=\s!default] - \definetypeface [lucida] [\s!cg] [\s!calligraphy] [lucida] [\s!default] [\s!features=\s!default] - \definetypeface [lucida] [\s!mm] [\s!math] [lucida] [\s!default] - \stoptypescript - -\stoptypescriptcollection diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-lucida.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-lucida.mkiv deleted file mode 100644 index 186854efcf3..00000000000 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-lucida.mkiv +++ /dev/null @@ -1,100 +0,0 @@ -%D \module -%D [ file=type-lucida-opentype, -%D version=2011.05.18, -%D title=\CONTEXT\ Typescript Macros, -%D subtitle=Lucida Nova Opentype, -%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. - -% NOTA BENE: class features and goodies get expanded! - -\definefontfeature[mathlucida][copymathscripts=yes] % see lfg file - -% \definefontfeature[mathlucida][mathlucida][ss04=yes] % now we swap - -% \definefontfeature[mathlucida][ss03=yes] - -\starttypescriptcollection[lucida-opentype] - - \doifunknownfontfeature {lucida-math-bold} {\definefontfeature[lucida-math-bold][boldened][boldmath=yes]} - - \starttypescript [lucida,lucidaot,lucidadk,lucidaot-nt,lucida-nt] - \loadfontgoodies[lucida-opentype-math] - \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] [\s!features=\s!default] - \definetypeface [\typescriptone] [\s!ss] [\s!sans] [\typescriptone] [\s!default] [\s!features=\s!default] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [\typescriptone] [\s!default] [\s!features=\s!none] - \definetypeface [\typescriptone] [\s!hw] [\s!handwriting] [\typescriptone] [\s!default] [\s!features=\s!default] - \definetypeface [\typescriptone] [\s!cg] [\s!calligraphy] [\typescriptone] [\s!default] [\s!features=\s!default] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [\typescriptone] [\s!default] - \quittypescriptscanning - \stoptypescript - - \starttypescript [\s!serif] [lucida,lucidaot,lucidadk,lucidaot-nt,lucida-nt] - \definefontsynonym [\s!Serif] [\s!file:LucidaBrightOT.otf] - \definefontsynonym [\s!SerifBold] [\s!file:LucidaBrightOT-Demi.otf] - \definefontsynonym [\s!SerifItalic] [\s!file:LucidaBrightOT-Italic.otf] - \definefontsynonym [\s!SerifBoldItalic] [\s!file:LucidaBrightOT-DemiItalic.otf] - \definefontsynonym [\s!SerifSlanted] [\s!SerifItalic] - \definefontsynonym [\s!SerifBoldSlanted] [\s!SerifBoldItalic] - \stoptypescript - - \starttypescript [\s!sans] [lucida,lucidaot,lucidadk,lucidaot-nt,lucida-nt] - \definefontsynonym [\s!Sans] [\s!file:LucidaSansOT.otf] - \definefontsynonym [\s!SansBold] [\s!file:LucidaSansOT-Demi.otf] - \definefontsynonym [\s!SansItalic] [\s!file:LucidaSansOT-Italic.otf] - \definefontsynonym [\s!SansBoldItalic] [\s!file:LucidaSansOT-DemiItalic.otf] - \definefontsynonym [\s!SansSlanted] [\s!SansItalic] - \definefontsynonym [\s!SansBoldSlanted] [\s!SansBoldItalic] - \stoptypescript - - \starttypescript [\s!mono] [lucida,lucidaot,lucidaot-nt,lucida-nt] - \definefontsynonym [\s!Mono] [\s!file:LucidaSansTypewriterOT.otf] - \definefontsynonym [\s!MonoBold] [\s!file:LucidaSansTypewriterOT-Bold.otf] - \definefontsynonym [\s!MonoItalic] [\s!file:LucidaSansTypewriterOT-Oblique.otf] - \definefontsynonym [\s!MonoBoldItalic] [\s!file:LucidaSansTypewriterOT-BoldOblique.otf] - \definefontsynonym [\s!MonoSlanted] [\s!MonoItalic] - \definefontsynonym [\s!MonoBoldSlanted] [\s!MonoBoldItalic] - \stoptypescript - - \starttypescript [\s!mono] [lucidadk,lucidaot-nt,lucida-nt] - \definefontsynonym [\s!Mono] [\s!file:LucidaGrandeMonoDK.otf] - \definefontsynonym [\s!MonoBold] [\s!file:LucidaGrandeMonoDK-Bold.otf] - \definefontsynonym [\s!MonoItalic] [\s!file:LucidaGrandeMonoDK-Oblique.otf] - \definefontsynonym [\s!MonoBoldItalic] [\s!file:LucidaGrandeMonoDK-BoldOblique.otf] - \definefontsynonym [\s!MonoSlanted] [\s!MonoItalic] - \definefontsynonym [\s!MonoBoldSlanted] [\s!MonoBoldItalic] - \stoptypescript - - \starttypescript [\s!math] [lucida,lucida-nt,lucidaot,lucidaot-nt,lucidadk] - \checkedmapfontsize[\typescripttwo][\s!script] [.70] - \checkedmapfontsize[\typescripttwo][\s!scriptscript][.50] - \stoptypescript - - \starttypescript [\s!math] [lucida,lucidaot,lucidadk] - \definefontsynonym [\s!MathRoman] [\s!file:LucidaBrightMathOT.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,lucida:mathextra,mathextra},\s!goodies=lucida-math] - % \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT-Demi.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,mathextra},\s!goodies=lucida-math] - \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT.otf] [\s!features={\s!math\mathsizesuffix,lucida-math-bold,mathlucida,lucida:mathextra,mathextra},\s!goodies=lucida-math] - \stoptypescript - - \starttypescript [\s!math] [lucidaot-nt,lucida-nt] - \definefontsynonym [\s!MathRoman] [\s!file:LucidaBrightMathOT.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,lucida:mathextra,mathextra}] -% \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT-Demi.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,mathextra}] - \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT.otf] [\s!features={\s!math\mathsizesuffix,lucida-math-bold,mathlucida,lucida:mathextra,mathextra}] - \stoptypescript - - \starttypescript [\s!handwriting] [lucida,lucidaot,lucidadk,lucidaot-nt,lucida-nt] - \definefontsynonym [\s!Handwriting] [\s!file:LucidaHandwritingOT.otf] - \stoptypescript - - \starttypescript [\s!calligraphy] [lucida,lucidaot,lucidadk,lucidaot-nt,lucida-nt] - \definefontsynonym [\s!Calligraphy] [\s!file:LucidaCalligraphyOT.otf] - \stoptypescript - -\stoptypescriptcollection - -\endinput diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv index 65a84ec5fe2..b6bb26c7690 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv +++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv @@ -25,10 +25,10 @@ \starttypescript [\s!serif] [newcomputermodern] [\s!name] \setups[\s!font:\s!fallback:\s!serif] - \definefontsynonym [\s!Serif] [\s!file:newcm10-regular.otf] [\s!features=\s!default,\s!fallbacks=\s!Serif] - \definefontsynonym [\s!SerifBold] [\s!file:newcm10-bold.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBold] - \definefontsynonym [\s!SerifItalic] [\s!file:newcm10-italic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifItalic] - \definefontsynonym [\s!SerifBoldItalic] [\s!file:newcm10-bolditalic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBoldItalic] + \definefontsynonym [\s!Serif] [\s!file:newcm10-regular.otf] [\s!features=\s!default,\s!fallbacks=\s!Serif,\s!goodies=newcomputermodern-text] + \definefontsynonym [\s!SerifBold] [\s!file:newcm10-bold.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBold,\s!goodies=newcomputermodern-text] + \definefontsynonym [\s!SerifItalic] [\s!file:newcm10-italic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifItalic,\s!goodies=newcomputermodern-text] + \definefontsynonym [\s!SerifBoldItalic] [\s!file:newcm10-bolditalic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBoldItalic,\s!goodies=newcomputermodern-text] \stoptypescript \starttypescript [\s!sans] [newcomputermodern] [\s!name] @@ -55,10 +55,10 @@ \starttypescript [\s!serif] [newcomputermodern-book] [\s!name] \setups[\s!font:\s!fallback:\s!serif] - \definefontsynonym [\s!Serif] [\s!file:newcm10-book.otf] [\s!features=\s!default,\s!fallbacks=\s!Serif] - \definefontsynonym [\s!SerifBold] [\s!file:newcm10-bold.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBold] - \definefontsynonym [\s!SerifItalic] [\s!file:newcm10-bookitalic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifItalic] - \definefontsynonym [\s!SerifBoldItalic] [\s!file:newcm10-bolditalic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBoldItalic] + \definefontsynonym [\s!Serif] [\s!file:newcm10-book.otf] [\s!features=\s!default,\s!fallbacks=\s!Serif,\s!goodies=newcomputermodern-text] + \definefontsynonym [\s!SerifBold] [\s!file:newcm10-bold.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBold,\s!goodies=newcomputermodern-text] + \definefontsynonym [\s!SerifItalic] [\s!file:newcm10-bookitalic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifItalic,\s!goodies=newcomputermodern-text] + \definefontsynonym [\s!SerifBoldItalic] [\s!file:newcm10-bolditalic.otf] [\s!features=\s!default,\s!fallbacks=\s!SerifBoldItalic,\s!goodies=newcomputermodern-text] \stoptypescript \starttypescript [\s!sans] [newcomputermodern-book] [\s!name] diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-stix.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-stix.mkiv index 3ac0b72572d..d1bad9a2e9a 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-stix.mkiv +++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-stix.mkiv @@ -58,10 +58,10 @@ \starttypescript [\s!serif] [stix,stixtwo,xits] [\s!name] \setups[\s!font:\s!fallback:\s!serif] - \definefontsynonym[\s!Serif] [\s!file:stixtwotext-regular.ttf] [\s!features=\s!default] - \definefontsynonym[\s!SerifBold] [\s!file:stixtwotext-bold.ttf] [\s!features=\s!default] - \definefontsynonym[\s!SerifItalic] [\s!file:stixtwotext-italic.ttf] [\s!features=\s!default] - \definefontsynonym[\s!SerifBoldItalic][\s!file:stixtwotext-bolditalic.ttf][\s!features=\s!default] + \definefontsynonym[\s!Serif] [\s!file:stixtwotext-regular.ttf] [\s!features=\s!default,\s!goodies=stixtwo-text] + \definefontsynonym[\s!SerifBold] [\s!file:stixtwotext-bold.ttf] [\s!features=\s!default,\s!goodies=stixtwo-text] + \definefontsynonym[\s!SerifItalic] [\s!file:stixtwotext-italic.ttf] [\s!features=\s!default,\s!goodies=stixtwo-text] + \definefontsynonym[\s!SerifBoldItalic][\s!file:stixtwotext-bolditalic.ttf][\s!features=\s!default,\s!goodies=stixtwo-text] \stoptypescript \starttypescript[stix,stixtwo,xits,stix-nt,stixtwo-nt] diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-texgyre.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-texgyre.mkiv index a3f3952c787..c4f28fcc4a9 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-texgyre.mkiv +++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-texgyre.mkiv @@ -67,10 +67,10 @@ \definetypescriptprefix [n:chancery] [TeXGyreChorus] \starttypescript [\s!serif,\s!sans] [adventor,bonum,bookman,heros,helvetica,pagella,palatino,schola,schoolbook,termes,times] - \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Regular] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-regular] [\s!features=\s!default] - \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Italic] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-italic] [\s!features=\s!default] - \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Bold] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-bold] [\s!features=\s!default] - \definefontsynonym [\typescriptprefix{n:\typescripttwo}-BoldItalic] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-bolditalic] [\s!features=\s!default] + \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Regular] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-regular] [\s!features=\s!default,\s!goodies=texgyre-text] + \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Italic] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-italic] [\s!features=\s!default,\s!goodies=texgyre-text] + \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Bold] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-bold] [\s!features=\s!default,\s!goodies=texgyre-text] + \definefontsynonym [\typescriptprefix{n:\typescripttwo}-BoldItalic] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-bolditalic] [\s!features=\s!default,\s!goodies=texgyre-text] \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Caps] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-regular] [\s!features=\s!smallcaps] \definefontsynonym [\typescriptprefix{n:\typescripttwo}-ItalicCaps] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-italic] [\s!features=\s!smallcaps] \definefontsynonym [\typescriptprefix{n:\typescripttwo}-BoldCaps] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-bold] [\s!features=\s!smallcaps] diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-xcharter.mkiv b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-xcharter.mkiv index 6b6e5fc4e5f..7d1a88241bd 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-xcharter.mkiv +++ b/Master/texmf-dist/tex/context/fonts/mkiv/type-imp-xcharter.mkiv @@ -19,11 +19,11 @@ \doifunknownfontfeature {xcharter-math-bold} {\definefontfeature[xcharter-math-bold][boldened]} \starttypescript [\s!serif] [xcharter] [\s!name] - \definefontsynonym [\s!Serif] [\s!file:XCharter-Roman] [\s!features=\s!default] - \definefontsynonym [\s!SerifItalic] [\s!file:XCharter-Italic] [\s!features=\s!default] + \definefontsynonym [\s!Serif] [\s!file:XCharter-Roman] [\s!features=\s!default,\s!goodies=xcharter-text] + \definefontsynonym [\s!SerifItalic] [\s!file:XCharter-Italic] [\s!features=\s!default,\s!goodies=xcharter-text] \definefontsynonym [\s!SerifSlanted] [\s!file:XCharter-Slanted] [\s!features=\s!default] - \definefontsynonym [\s!SerifBold] [\s!file:XCharter-Bold] [\s!features=\s!default] - \definefontsynonym [\s!SerifBoldItalic] [\s!file:xcharter-BoldItalic] [\s!features=\s!default] + \definefontsynonym [\s!SerifBold] [\s!file:XCharter-Bold] [\s!features=\s!default,\s!goodies=xcharter-text] + \definefontsynonym [\s!SerifBoldItalic] [\s!file:xcharter-BoldItalic] [\s!features=\s!default,\s!goodies=xcharter-text] \definefontsynonym [\s!SerifBoldSlanted][\s!file:XCharter-BoldSlanted][\s!features=\s!default] \stoptypescript diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/xcharter-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/xcharter-math.lfg index 1ff5d41d8b6..cc4e992d465 100644 --- a/Master/texmf-dist/tex/context/fonts/mkiv/xcharter-math.lfg +++ b/Master/texmf-dist/tex/context/fonts/mkiv/xcharter-math.lfg @@ -39,6 +39,9 @@ return { presets.moveintegrals { factor = 1.5 }, presets.wipeitalics { }, { + tweak = "checkaccents", + }, + { tweak = "kerns", list = { [0x002F] = { topleft = -0.15, bottomright = -0.15 }, @@ -66,6 +69,9 @@ return { } }, { + tweak = "flattenaccents", + }, + { tweak = "checkspacing", }, { @@ -77,6 +83,31 @@ return { { tweak = "addrules", }, +{ + tweak = "replacerules", + -- minus = { + -- height = 0.188, + -- yoffset = 0.812, + -- leftoffset = 0.2, + -- rightoffset = 0.2, + -- }, + fraction = { + height = .188, + yoffset = .812, + }, + radical = { + height = .188, + yoffset = .812, + leftoffset = 0.95, + rightoffset = 0.95, + -- leftoverlap = 0.1, -- Daniel will fix(!) + -- yscale = 0.8, -- no scaling + }, + stacker = { + height = .188, + yoffset = .812, + }, +}, { tweak = "addactuarian", }, @@ -86,6 +117,9 @@ return { { tweak = "addprimed", }, +-- { +-- tweak = "addarrows", +-- }, { tweak = "addfourier", variant = 2, diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/xcharter-text.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/xcharter-text.lfg new file mode 100644 index 00000000000..a836695fd24 --- /dev/null +++ b/Master/texmf-dist/tex/context/fonts/mkiv/xcharter-text.lfg @@ -0,0 +1,62 @@ +return { + name = "xcharter-text", + version = "1.00", + comment = "Goodies that complement Xcharter.", + author = "Mikael Sundqvist & Hans Hagen", + copyright = "ConTeXt development team", + extensions = { + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "XCharter-Roman", + "XCharter-Bold", + }, + data = { + ["f"] = { + [")"] = 125, + ["}"] = 125, + ["]"] = 125, + -- ["|"] = 100, + ["\\"] = 50, + ["*"] = 50, + ["?"] = 50, + ["!"] = 50, + ["\\"] = 125, + }, + } + }, + { + name = "kern", -- adds to kerns + type = "kern", + fonts = { + "XCharter-Italic", + "XCharter-BoldItalic", + }, + data = { + ["f"] = { + [")"] = 150, + ["}"] = 150, + ["]"] = 150, + ["\\"] = 125, + ["!"] = 100, + ["?"] = 100, + ["*"] = 100, + ["@"] = 100, + }, + ["("] = { + ["f"] = 100, + }, + ["{"] = { + ["f"] = 150, + }, + ["["] = { + ["f"] = 100, + }, + ["|"] = { + ["f"] = 130, + }, + } + }, + } +} diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-bengali.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-bengali.mkxl index 84a0b6402f0..84a0b6402f0 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-bengali.mkxl +++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-bengali.mkxl diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-braille.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-braille.mkxl index 17209d50c17..17209d50c17 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-braille.mkxl +++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-braille.mkxl diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-devanagari.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-devanagari.mkxl index 4fb082094eb..4fb082094eb 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-devanagari.mkxl +++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-devanagari.mkxl diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-euler.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-euler.mkxl index a2e066f6b36..a2e066f6b36 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-euler.mkxl +++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-euler.mkxl diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-gujarati.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-gujarati.mkxl index d7f3f707284..d7f3f707284 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-gujarati.mkxl +++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-gujarati.mkxl diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-indic.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-indic.mkxl index aeda0833768..aeda0833768 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-indic.mkxl +++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-indic.mkxl diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-kannada.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-kannada.mkxl index 4838075b2e6..4838075b2e6 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-kannada.mkxl +++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-kannada.mkxl diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-malayalam.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-malayalam.mkxl index 67a35d47258..67a35d47258 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-malayalam.mkxl +++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-malayalam.mkxl diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-tamil.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-tamil.mkxl index 90516365efa..90516365efa 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-tamil.mkxl +++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-tamil.mkxl diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-imp-telugu.mkxl b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-telugu.mkxl index 33d07664c75..33d07664c75 100644 --- a/Master/texmf-dist/tex/context/base/mkxl/type-imp-telugu.mkxl +++ b/Master/texmf-dist/tex/context/fonts/mkxl/type-imp-telugu.mkxl diff --git a/Master/texmf-dist/tex/context/modules/mkiv/m-tikz.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/m-tikz.mkiv index 221c074adca..61df89cfd0a 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/m-tikz.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/m-tikz.mkiv @@ -39,9 +39,10 @@ \permanent\protected\def\starttikzinput {\pushcatcodetable \setcatcodetable\texcatcodes - \catcode`\@=11 - \catcode`\|=12 - \catcode`\!=12 + \catcode`\@=11\relax + \catcode`\|=12\relax + \catcode`\!=12\relax + \catcode`\~=13\relax \relax} \permanent\protected\def\stoptikzinput diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-abbreviations-logos.tex b/Master/texmf-dist/tex/context/modules/mkiv/s-abbreviations-logos.tex index ab2b98a56fe..d04706ca635 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-abbreviations-logos.tex +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-abbreviations-logos.tex @@ -177,10 +177,16 @@ \logo [LMX] {lmx} \logo [LPEG] {lpeg} \logo [LUA] {Lua} -\logo [LUAJIT] {Lua\wordboundary JIT} -\logo [LUAJITTEX] {Lua\wordboundary jit\TeXsuffix} -\logo [LUAMETATEX] {\Lua\wordboundary Meta\wordboundary\TeXsuffix} -\logo [LUATEX] {Lua\wordboundary\TeXsuffix} +% \logo [LUAJIT] {Lua\wordboundary JIT} +% \logo [LUAJITTEX] {Lua\wordboundary jit\TeXsuffix} +% \logo [LUAMETATEX] {\Lua\wordboundary Meta\wordboundary\TeXsuffix} +% \logo [LUATEX] {Lua\wordboundary\TeXsuffix} +% \logo [LUAMETAFUN] {\Lua\wordboundary\MetaFun} +\logo [LUAJIT] {Lua\-JIT} +\logo [LUAJITTEX] {Lua\-jit\-\TeXsuffix} +\logo [LUAMETATEX] {\Lua\-Meta\-\TeXsuffix} +\logo [LUATEX] {Lua\-\TeXsuffix} +\logo [LUAMETAFUN] {\Lua\-\MetaFun} \logo [LUATOOLS] {luatools} \logo [MACOSX] {MacOSX} %logo [MACROTEX] {Macro\TeXsuffix} @@ -189,7 +195,6 @@ \logo [MAPS] {Maps} \logo [MATHML] {MathML} \logo [METAFONT] {\MetaFont} -\logo [LUAMETAFUN] {\Lua\wordboundary\MetaFun} \logo [METAFUN] {\MetaFun} \logo [METAPOST] {\MetaPost} \logo [METATEX] {Meta\TeXsuffix} diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-tables.lua b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-tables.lua index 65725594bcc..ed034b882e6 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-tables.lua +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-tables.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['s-fonts-tables'] = { license = "see context related readme files" } +-- Thsi file needs to be updated to LMTX! + moduledata.fonts = moduledata.fonts or { } moduledata.fonts.tables = moduledata.fonts.tables or { } @@ -29,7 +31,7 @@ local setlink = nodes.setlink local hpack = nodes.hpack local applyvisuals = nodes.applyvisuals -local lefttoright_code = nodes.dirvalues.lefttoright +local lefttoright_code = (tex.directioncodes and tex.directioncodes.lefttoright) or nodes.dirvalues.lefttoright -- LMTX local handle_positions = fonts.handlers.otf.datasetpositionprocessor local handle_injections = nodes.injections.handler diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv index d061179eb90..16ce91748d4 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv @@ -132,8 +132,11 @@ % \showfontvariations[font=file:goldmansanscdvf_wght.ttf] % \stoptext -\showfontvariations - [font=file:nupuram-vf.otf,features=malayalam-two,sample=test നൂപുരം] +% \showfontvariations +% [font=file:nupuram-vf.otf,features=malayalam-two,sample=test നൂപുരം] % [font=file:nupuram-vf.ttf,features=malayalam-two,sample=test നൂപുരം] +\showfontvariations + [font=file:robotoflex.ttf] + \stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkiv/x-asciimath.lua b/Master/texmf-dist/tex/context/modules/mkiv/x-asciimath.lua index fdcab141c37..f158065aaa8 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/x-asciimath.lua +++ b/Master/texmf-dist/tex/context/modules/mkiv/x-asciimath.lua @@ -6,15 +6,14 @@ if not modules then modules = { } end modules ['x-asciimath'] = { license = "see context related readme files" } ---[[ldx-- -<p>Some backgrounds are discussed in <t>x-asciimath.mkiv</t>. This is a third version. I first -tried a to make a proper expression parser but it's not that easy. First we have to avoid left -recursion, which is not that trivial (maybe a future version of lpeg will provide that), and -second there is not really a syntax but a mix of expressions and sequences with some fuzzy logic -applied. Most problematic are fractions and we also need to handle incomplete expressions. So, -instead we (sort of) tokenize the string and then do some passes over the result. Yes, it's real -ugly and unsatisfying code mess down here. Don't take this as an example.</p> ---ldx]]-- +-- Some backgrounds are discussed in 'x-asciimath.mkiv'. This is a third version. I +-- first tried a to make a proper expression parser but it's not that easy. First we +-- have to avoid left recursion, which is not that trivial (maybe a future version +-- of lpeg will provide that), and second there is not really a syntax but a mix of +-- expressions and sequences with some fuzzy logic applied. Most problematic are +-- fractions and we also need to handle incomplete expressions. So, instead we (sort +-- of) tokenize the string and then do some passes over the result. Yes, it's real +-- ugly and unsatisfying code mess down here. Don't take this as an example. -- todo: spaces around all elements in cleanup? -- todo: filter from files listed in tuc file diff --git a/Master/texmf-dist/tex/context/modules/mkxl/m-tikz-pgfplots.tex b/Master/texmf-dist/tex/context/modules/mkxl/m-tikz-pgfplots.tex index 1dd06b8b221..666f6b00b79 100644 --- a/Master/texmf-dist/tex/context/modules/mkxl/m-tikz-pgfplots.tex +++ b/Master/texmf-dist/tex/context/modules/mkxl/m-tikz-pgfplots.tex @@ -4,6 +4,8 @@ \writestatus{loading}{ConTeXt User Module / Pgfplots} +\usemodule[tikz] + \tikzinputfile{pgfplots.revision.tex} \usetikzlibrary[plotmarks] diff --git a/Master/texmf-dist/tex/context/modules/mkxl/m-tikz.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/m-tikz.mkxl index 21544d14e59..29ef764c982 100644 --- a/Master/texmf-dist/tex/context/modules/mkxl/m-tikz.mkxl +++ b/Master/texmf-dist/tex/context/modules/mkxl/m-tikz.mkxl @@ -36,15 +36,36 @@ \protect \fi +\newcatcodetable \tikzcatcodes + +\startcatcodetable \tikzcatcodes + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode \superscriptcatcode + \catcode\underscoreasciicode \subscriptcatcode + \catcode\ampersandasciicode \alignmentcatcode + \catcode\backslashasciicode \escapecatcode + \catcode\leftbraceasciicode \begingroupcatcode + \catcode\rightbraceasciicode \endgroupcatcode + \catcode\dollarasciicode \mathshiftcatcode + \catcode\hashasciicode \parametercatcode + \catcode\commentasciicode \commentcatcode + \catcode\atsignasciicode \lettercatcode + \catcode\exclamationmarkasciicode \othercatcode + \catcode\questionmarkasciicode \lettercatcode + \catcode\tildeasciicode \activecatcode + \catcode\barasciicode \othercatcode +\stopcatcodetable + \permanent\protected\def\starttikzinput {\pushoverloadmode \pushcatcodetable - \setcatcodetable\texcatcodes + \setcatcodetable\tikzcatcodes \pushmacro\meaning \let\meaning\meaningless - \catcode`\@=11 - \catcode`\|=12 - \catcode`\!=12 \autoparagraphmode\zerocount} \permanent\protected\def\stoptikzinput @@ -87,6 +108,7 @@ \permanent\protected\def\starttikzpicture {\dontleavehmode \hcontainer\bgroup + \setcatcodetable\tikzcatcodes \the\everytikzpicture \autoparagraphmode\zerocount \pushmacro\meaning @@ -123,8 +145,9 @@ \let\startpgfinterruptpicture \pgfinterruptpicture \let\stoppgfinterruptpicture \endpgfinterruptpicture \let\startpgfinterruptboundingbox\pgfinterruptboundinbox \let\stoppgfinterruptboudingbox\endpgfinterruptboundingbox -\let\normalusepgfmodule\usepgfmodule -\let\normalusepgflibrary\usepgflibrary +\let\normalusepgfmodule \usepgfmodule +\let\normalusepgflibrary \usepgflibrary +\let\normalusetikzlibrary\usetikzlibrary \tolerant\protected\def\usepgfmodule[#1]#;#2% somehow both variants are used {\starttikzinput @@ -136,6 +159,11 @@ \normalusepgflibrary[#1#2]% \stoptikzinput} +\tolerant\protected\def\usetikzlibrary[#1]#;#2% somehow both variants are used + {\starttikzinput + \normalusetikzlibrary[#1#2]% + \stoptikzinput} + \usepgfmodule[shapes] \usepgfmodule[plot] \usepgfmodule[matrix] diff --git a/Master/texmf-dist/tex/context/modules/mkxl/s-math-atoms.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/s-math-atoms.mkxl index 1b5ebed416e..ab54dd29177 100644 --- a/Master/texmf-dist/tex/context/modules/mkxl/s-math-atoms.mkxl +++ b/Master/texmf-dist/tex/context/modules/mkxl/s-math-atoms.mkxl @@ -1,5 +1,5 @@ %D \module -%D [ file=s-math-atoms.mksl, +%D [ file=s-math-atoms.mkxl, %D version=2022.02.13, %D title=\CONTEXT\ Style File, %D subtitle=Show Math Atom Spacing, diff --git a/Master/texmf-dist/tex/context/modules/mkxl/s-math-tests.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/s-math-tests.mkxl new file mode 100644 index 00000000000..35f2a6248db --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkxl/s-math-tests.mkxl @@ -0,0 +1,112 @@ +%D \module +%D [ file=s-math-tests.mkxl, +%D version=2023.04.03, +%D title=\CONTEXT\ Style File, +%D subtitle=Some Math Tests, +%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. + +\continueifinputfile{s-math-tests.mkxl} + +%D Here we collect some tests that later will become proper macros. + +\starttext + +\startbuffer + \ruledhbox \bgroup \im { + \dostepwiserecurse{`A}{`Z}{1}{ + \blackrule[color=darkgray,height=\the\Umathflattenedaccentbaseheight\textstyle,depth=0pt,width=0.05ts] + \hat{\char#1} + } + }\egroup +\stopbuffer + +\startTEXpage[offset=1ts] + \showglyphs +% \switchtobodyfont[modern] \getbuffer\par +% \blank +% \switchtobodyfont[pagella] \getbuffer\par +% \switchtobodyfont[termes] \getbuffer\par +% \switchtobodyfont[schola] \getbuffer\par +% \blank +% \switchtobodyfont[ebgaramon-nt]\getbuffer\par +% \switchtobodyfont[ebgaramond] \getbuffer\par +% \blank +% \switchtobodyfont[erewhon] \getbuffer\par +% \switchtobodyfont[kpfonts] \getbuffer\par +% \switchtobodyfont[xcharter] \getbuffer\par +% \switchtobodyfont[concrete] \getbuffer\par +% \switchtobodyfont[libertinus] \getbuffer\par +% \switchtobodyfont[stixtwo] \getbuffer\par +% \switchtobodyfont[lucida-nt] \getbuffer\par + \switchtobodyfont[lucida] + % 8.67123pt default + \bgroup + \bitwiseflip\mathfontcontrol\ignoreflataccentsmathcontrolcode + \appendtoks + \Umathflattenedaccentbaseheight\textstyle8.67123pt + \to\everymathematics + \getbuffer\par + \egroup + \bgroup + \appendtoks + \Umathflattenedaccentbaseheight\textstyle8.67123pt + \to\everymathematics + \getbuffer\par + \egroup + % 8.51532pt fixed + \bgroup + \appendtoks + \Umathflattenedaccentbaseheight\textstyle8.51532pt + \to\everymathematics + \getbuffer\par + \egroup +% \switchtobodyfont[libertinus] \getbuffer\par +\stopTEXpage + +\startTEXpage[offset=1ts] + + \definefontfeature[mathextra][] +% \definefontfeature[mathextra][ss10=yes,ss06=yes] + + \setupbodyfont[ebgaramond] + + \bgroup + \setupmathematics[stylealternative=] + \im{\hbar^{\hbar^{\hbar}}} + \egroup + \bgroup + \setupmathematics[stylealternative={hbar}] + \im{\hbar^{\hbar^{\hbar}}} + \egroup + \bgroup + \setupmathematics[stylealternative={hbar,outbendingh}] + \im{\hbar^{\hbar^{\hbar}}} + \egroup + \bgroup + \setupmathematics[stylealternative={outbendingh}] + \im{\hbar^{\hbar^{\hbar}}} + \egroup + + \definefontfeature[mathextra][] +% \definefontfeature[mathextra][cv03=yes] + + \setupbodyfont[stixtwo] + + \bgroup + \setupmathematics[stylealternative=] + \im{\emptyset^{\emptyset^{\emptyset}}} + \egroup + \bgroup + \setupmathematics[stylealternative={emptyset}] + \im{\emptyset^{\emptyset^{\emptyset}}} + \egroup + +\stopTEXpage + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkxl/s-system-macros.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/s-system-macros.mkxl index 6058590004f..597af1a7b20 100644 --- a/Master/texmf-dist/tex/context/modules/mkxl/s-system-macros.mkxl +++ b/Master/texmf-dist/tex/context/modules/mkxl/s-system-macros.mkxl @@ -27,6 +27,8 @@ % todo: and how about metapost ... i need a mp.hashtokens in order to do that and I also % need to think about protection there (tricky as we use an avl hash there) % +% todo: when possible replace \p_whatever_key by \p_key +% % public undefined : SmallCaps scitebuffer sciteinlinebuffer % single todos : \ \- \\ \_ @@ -48,20 +50,24 @@ [A4,landscape] [A4,landscape] +\bitwiseflip \normalizelinemode \discardzerotabskipsnormalizecode + \starttext \startluacode if tex.modes.texmacros then - local context = context - local ctx_NC = context.NC - local ctx_NR = context.NR - local ctx_bold = context.bold - local ctx_verb = context.verbatim + local context = context + local ctx_NC = context.NC + local ctx_NR = context.NR + local ctx_bold = context.bold + local ctx_verb = context.verbatim + local ctx_escaped = context.escaped local find = string.find local gsub = string.gsub + local gmatch = string.gmatch local create = tokens.create local crap = "[$>%|%&%#" .. string.char(0xEF) .. "]" @@ -109,26 +115,82 @@ local data = scripts.interface.editor("data") local files = data and data.common and data.common.filenames or { } local macros = { } + local registers = { } + local implements = { } local flagged = 0 local total = 0 local list = tex.hashtokens() local all = not tex.modes.notmarked local everything = tex.modes.everything + local getmacro = token.getmacro local fmtname = resolvers.locateformat("cont-en.fmt") if fmtname then local logname = file.replacesuffix(fmtname,"log") - for filename in string.gmatch(io.loaddata(logname),"fullname=(%S+)") do + for filename in gmatch(io.loaddata(logname),"fullname=(%S+)") do local s = file.suffix(filename) local b = file.basename(filename) if s ~= "lua" and s ~= "lmt" then local d = io.loaddata(filename) - for m in string.gmatch(d,"\n[\\a-z]*[exg]*def\\([a-zA-Z_]+)") do + -- we could make a nice lpeg + for m in gmatch(d,"\n[\\a-z]*[exg]*def\\([a-zA-Z_]+)") do + macros[m] = b + end + for m in gmatch(d,"\n[\\a-z]*[g]*let\\([a-zA-Z_]+)") do + macros[m] = b + end + for m in gmatch(d,"\n\\lettonothing\\([a-zA-Z_]+)") do + macros[m] = b + end + for m in gmatch(d,"\n\\integerdef\\([a-zA-Z_]+)") do + macros[m] = b + end + for m in gmatch(d,"\n\\dimensiondef\\([a-zA-Z_]+)") do + macros[m] = b + end + for m in gmatch(d,"\n\\gluespecdef\\([a-zA-Z_]+)") do macros[m] = b end - for m in string.gmatch(d,"\n[\\a-z]*[g]*let\\([a-zA-Z_]+)") do + for m in gmatch(d,"\n\\mugluespecdef\\([a-zA-Z_]+)") do macros[m] = b end + for m in gmatch(d,"\n\\newinteger\\([a-zA-Z_]+)") do + registers[m] = b + end + for m in gmatch(d,"\n\\newdimension\\([a-zA-Z_]+)") do + registers[m] = b + end + for m in gmatch(d,"\n\\newgluespec\\([a-zA-Z_]+)") do + registers[m] = b + end + for m in gmatch(d,"\n\\newmugluespec\\([a-zA-Z_]+)") do + registers[m] = b + end + for m in gmatch(d,"\n\\newconditional\\([a-zA-Z_]+)") do + registers[m] = b + end + for m in gmatch(d,"\n\\newtoks\\([a-zA-Z_]+)") do + registers[m] = b + end + for m in gmatch(d,"\n\\newcount\\([a-zA-Z_]+)") do + registers[m] = b + end + for m in gmatch(d,"\n\\newdimen\\([a-zA-Z_]+)") do + registers[m] = b + end + for m in gmatch(d,"\n\\newskip\\([a-zA-Z_]+)") do + registers[m] = b + end + for m in gmatch(d,"\n\\newmuskip\\([a-zA-Z_]+)") do + registers[m] = b + end + elseif b ~= "char-def.lua" then + local d = io.loaddata(filename) + -- maybe inside implement { } + -- maybe get file from debug interface + for m in gmatch(d,'\n +name += +"([a-zA-Z_]+)",') do + implements[m] = b + end end end end @@ -136,8 +198,7 @@ table.sort(list) local function show(visible, check) - -- context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|" } - context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|" } + context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|l|l|l|" } for i=1,#list do local k = list[i] if check(k) then @@ -148,6 +209,8 @@ local permanent = v.permanent and "permanent" local primitive = v.primitive and "primitive" local instance = v.instance and "instance" + local constant = v.constant and "constant" + local untraced = v.untraced and "untraced" local dealtwith = mutable or immutable or mutable or frozen or permanent or primitive -- beware: we can have combinations local whatever = find(k,"^[a-z][a-z][a-z]+_") local cscommand = gsub(v.cmdname or "","_"," ") @@ -156,7 +219,7 @@ if everything or ((all or not marked) and not find(k,"^[pvm]_") and not find(k,"^![tT]")) then local parameters = v.parameters local noaligned = v.noaligned and "noaligned" - local filename = files[k] or macros[k] + local filename = files[k] or macros[k] or implements[k] or registers[k] or implements[gsub(k,"^clf_","")] local csname = context.escape(k) if undefined then marked = "?" @@ -165,7 +228,7 @@ ctx_NC() if primitive then ctx_bold(csname) else ctx_verb(csname) end ctx_NC() if parameters then context(parameters > 0 and parameters or "-") end - ctx_NC() if undefined then context.red(false) end + ctx_NC() if undefined then context.red(false) end context(cscommand) ctx_NC() if primitive then context(primitive) end ctx_NC() if permanent then context(permanent) end @@ -174,7 +237,10 @@ ctx_NC() if mutable then context(mutable) end ctx_NC() if instance then context(instance) end ctx_NC() if noaligned then context(noaligned) end + ctx_NC() if constant then context(constant) end + ctx_NC() if untraced then context(untraced) end ctx_NC() if filename then context(hashnames[filename]) end + ctx_NC() if parameters then if parameters > 0 then ctx_escaped(getmacro(csname,false,true)) end end ctx_NC() ctx_NR() end if visible then diff --git a/Master/texmf-dist/tex/context/modules/mkxl/s-text-tests.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/s-text-tests.mkxl new file mode 100644 index 00000000000..6766a7a0927 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkxl/s-text-tests.mkxl @@ -0,0 +1,72 @@ +%D \module +%D [ file=s-text-tests.mkxl, +%D version=2023.04.11, +%D title=\CONTEXT\ Style File, +%D subtitle=Some Text Tests, +%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. + +\continueifinputfile{s-text-tests.mkxl} + +%D Here we collect some tests that later will become proper macros. + +\usebodyfont[bonum] +\usebodyfont[cambria] +\usebodyfont[concrete] +\usebodyfont[dejavu] +\usebodyfont[ebgaramond] +\usebodyfont[erewhon] +\usebodyfont[kpfonts] +\usebodyfont[libertinus] +\usebodyfont[lucida] +\usebodyfont[minion] +\usebodyfont[modern] +\usebodyfont[newcomputermodern-book] +\usebodyfont[pagella] +\usebodyfont[schola] +\usebodyfont[stixtwo] +\usebodyfont[termes] +\usebodyfont[xcharter] + +\starttext + +\startbuffer +(a) (f) [f] \{f\} f: f; f! f? f\textbar f* f@ f& f/ f\textbackslash +\stopbuffer + +\starttexdefinition ugly #1 + \startsubject[title=#1] + \start + \switchtobodyfont[#1] + {\tf \getbuffer}\blank[small] + {\bf \getbuffer}\blank[small] + {\it \getbuffer}\blank[small] + {\bi \getbuffer}\blank[big] + \stop + \stopsubject +\stoptexdefinition + +\ugly{bonum} +\ugly{cambria} +\ugly{concrete} +\ugly{dejavu} +\ugly{ebgaramond} +\ugly{erewhon} +\ugly{kpfonts} +\ugly{libertinus} +\ugly{lucida} +\ugly{minion} +\ugly{modern} +\ugly{newcomputermodern-book} +\ugly{pagella} +\ugly{schola} +\ugly{stixtwo} +\ugly{termes} +\ugly{xcharter} + +\stoptext diff --git a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua b/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua index 614793314d7..5441fa0043b 100644 --- a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/Master/texmf-dist/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-03-10 12:15 +-- merge date : 2023-05-05 18:36 do -- begin closure to overcome local limits and interference @@ -21334,7 +21334,7 @@ local trace_defining=false registertracker("fonts.defining",function(v) trace_d local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf -otf.version=3.132 +otf.version=3.133 otf.cache=containers.define("fonts","otl",otf.version,true) otf.svgcache=containers.define("fonts","svg",otf.version,true) otf.pngcache=containers.define("fonts","png",otf.version,true) @@ -31740,7 +31740,11 @@ local function addfeature(data,feature,specifications,prepareonly) local list=askedsteps[i] local coverage=nil local format=nil - if featuretype=="substitution" then +if type(list)=="function" then + list=list(data,specification,list,i) +end + if not list then + elseif featuretype=="substitution" then category="gsub" coverage=(mapping and list) or prepare_substitution(list,featuretype,nocheck) elseif featuretype=="ligature" then @@ -37807,7 +37811,7 @@ local fonts=fonts local otf=fonts.handlers.otf local registerotffeature=otf.features.register local addotffeature=otf.addfeature -local specification={ +local tlig={ type="ligature", order={ "tlig" }, prepend=true, @@ -37816,12 +37820,17 @@ local specification={ [0x2014]={ 0x002D,0x002D,0x002D }, }, } -addotffeature("tlig",specification) -registerotffeature { - name="tlig", - description="tex ligatures", +local tquo={ + type="ligature", + order={ "tquo" }, + prepend=true, + data={ + [0x201C]={ 0x0060,0x0060 }, + [0x201D]={ 0x0027,0x0027 }, + [0x201E]={ 0x002C,0x002C }, + }, } -local specification={ +local trep={ type="substitution", order={ "trep" }, prepend=true, @@ -37829,11 +37838,12 @@ local specification={ [0x0027]=0x2019, }, } -addotffeature("trep",specification) -registerotffeature { - name="trep", - description="tex replacements", -} +addotffeature("trep",trep) +addotffeature("tlig",tlig) +addotffeature("tquo",tquo) +registerotffeature { name="tlig",description="tex ligatures" } +registerotffeature { name="tquo",description="tex quotes" } +registerotffeature { name="trep",description="tex replacements" } local anum_arabic={ [0x0030]=0x0660, [0x0031]=0x0661, diff --git a/Master/texmf-dist/tex/generic/context/luatex/luatex-mplib.lua b/Master/texmf-dist/tex/generic/context/luatex/luatex-mplib.lua index 1839c44ee00..99a23b03c54 100644 --- a/Master/texmf-dist/tex/generic/context/luatex/luatex-mplib.lua +++ b/Master/texmf-dist/tex/generic/context/luatex/luatex-mplib.lua @@ -6,19 +6,14 @@ if not modules then modules = { } end modules ['luatex-mplib'] = { license = "public domain", } ---[[ldx-- -<p>This module is a stripped down version of libraries that are used -by <l n='context'/>. It can be used in other macro packages and/or -serve as an example. Embedding in a macro package is upto others and -normally boils down to inputting <t>supp-mpl.tex</t>.</p> ---ldx]]-- +-- This module is a stripped down version of libraries that are used by ConTeXt. It +-- can be used in other macro packages and/or serve as an example. Embedding in a +-- macro package is upto others and normally boils down to inputting 'supp-mpl.tex'. if metapost and metapost.version then - --[[ldx-- - <p>Let's silently quit and make sure that no one loads it - manually in <l n='context'/>.</p> - --ldx]]-- + -- Let's silently quit and make sure that no one loads it manually in + -- ConTeXt. else @@ -29,27 +24,25 @@ else local mplib = require ('mplib') local kpse = require ('kpse') - --[[ldx-- - <p>We create a namespace and some variables to it. If a namespace is - already defined it wil not be initialized. This permits hooking - in code beforehand.</p> + -- We create a namespace and some variables to it. If a namespace is already + -- defined it wil not be initialized. This permits hooking in code beforehand. - <p>We don't make a format automatically. After all, distributions - might have their own preferences and normally a format (mem) file will - have some special place in the <l n='tex'/> tree. Also, there can already - be format files, different memort settings and other nasty pitfalls that - we don't want to interfere with. If you want, you can define a function - <t>metapost.make(name,mem_name) that does the job.</t></p> - --ldx]]-- + -- We don't make a format automatically. After all, distributions might have + -- their own preferences and normally a format (mem) file will have some + -- special place in the TeX tree. Also, there can already be format files, + -- different memort settings and other nasty pitfalls that we don't want to + -- interfere with. If you want, you can define a function + -- + -- metapost.make (name,mem_name) + -- + -- that does the job. metapost = metapost or { } metapost.version = 1.00 metapost.showlog = metapost.showlog or false metapost.lastlog = "" - --[[ldx-- - <p>A few helpers, taken from <t>l-file.lua</t>.</p> - --ldx]]-- + -- A few helpers, taken from 'l-file.lua'. local file = file or { } @@ -61,10 +54,7 @@ else return (string.gsub(filename,"%.[%a%d]+$","")) end - --[[ldx-- - <p>We use the <l n='kpse'/> library unless a finder is already - defined.</p> - --ldx]]-- + -- We use the KPSE library unless a finder is already defined. local mpkpse = kpse.new("luatex","mpost") @@ -76,10 +66,9 @@ else end end - --[[ldx-- - <p>You can use your own reported if needed, as long as it handles multiple - arguments and formatted strings.</p> - --ldx]]-- + -- You can use your own reported if needed, as long as it handles multiple + -- arguments and formatted strings. + metapost.report = metapost.report or function(...) if logs.report then @@ -89,11 +78,9 @@ else end end - --[[ldx-- - <p>The rest of this module is not documented. More info can be found in the - <l n='luatex'/> manual, articles in user group journals and the files that - ship with <l n='context'/>.</p> - --ldx]]-- + -- The rest of this module is not documented. More info can be found in the + -- LuaTeX manual, articles in user group journals and the files that ship + -- with ConTeXt. function metapost.resetlastlog() metapost.lastlog = "" @@ -329,9 +316,8 @@ else return true -- done end - --[[ldx-- - <p>We removed some message and tracing code. We might even remove the flusher</p> - --ldx]]-- + -- We removed some message and tracing code. We might even remove the + -- flusher. local function pdf_startfigure(n,llx,lly,urx,ury) tex.sprint(format("\\startMPLIBtoPDF{%s}{%s}{%s}{%s}",llx,lly,urx,ury)) @@ -443,9 +429,7 @@ else return t end - --[[ldx-- - <p>Support for specials has been removed.</p> - --ldx]]-- + -- Support for specials has been removed. function metapost.flush(result,flusher) if result then diff --git a/Master/texmf-dist/tex/generic/context/luatex/luatex-preprocessor.lua b/Master/texmf-dist/tex/generic/context/luatex/luatex-preprocessor.lua index 8faa0b47e69..b1debcd5c0b 100644 --- a/Master/texmf-dist/tex/generic/context/luatex/luatex-preprocessor.lua +++ b/Master/texmf-dist/tex/generic/context/luatex/luatex-preprocessor.lua @@ -6,11 +6,9 @@ if not modules then modules = { } end modules ['luatex-preprocessor'] = { license = "see context related readme files" } ---[[ldx -<p>This is a stripped down version of the preprocessor. In -<l n='context'/> we have a bit more, use a different logger, and -use a few optimizations. A few examples are shown at the end.</p> ---ldx]] +-- This is a stripped down version of the preprocessor. In ConTeXt we have a bit +-- more, use a different logger, and use a few optimizations. A few examples are +-- shown at the end. local rep, sub, gmatch = string.rep, string.sub, string.gmatch local insert, remove = table.insert, table.remove @@ -99,10 +97,6 @@ local parser = lpeg.Cs { "converter", converter = (lpeg.V("definition") + anything)^1, } ---[[ldx -<p>We provide a few commands.</p> ---ldx]] - -- local texkpse local function find_file(...) diff --git a/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-de.tex b/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-de.tex new file mode 100644 index 00000000000..467cdc67044 --- /dev/null +++ b/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-de.tex @@ -0,0 +1,10 @@ +% name : PPCHTEX / german interface +% version : 1997.03.05 +% author : J. Hagen +% copyright : J. Hagen, A.F. Otten + +\chardef\interfacenumber=2 + +\input ppchtex.noc + +\endinput diff --git a/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-en.tex b/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-en.tex new file mode 100644 index 00000000000..6bd4353199b --- /dev/null +++ b/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-en.tex @@ -0,0 +1,10 @@ +% name : PPCHTEX / english interface +% version : 1997.03.05 +% author : J. Hagen +% copyright : J. Hagen, A.F. Otten + +\chardef\interfacenumber=0 + +\input ppchtex.noc + +\endinput diff --git a/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-nl.tex b/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-nl.tex new file mode 100644 index 00000000000..c9d77733ac5 --- /dev/null +++ b/Master/texmf-dist/tex/generic/context/ppchtex/m-ch-nl.tex @@ -0,0 +1,10 @@ +% name : PPCHTEX / english interface +% version : 1997.03.05 +% author : J. Hagen +% copyright : J. Hagen, A.F. Otten + +\chardef\interfacenumber=1 + +\input ppchtex.noc + +\endinput diff --git a/Master/texmf-dist/tex/generic/context/ppchtex/ppchtex.noc b/Master/texmf-dist/tex/generic/context/ppchtex/ppchtex.noc new file mode 100644 index 00000000000..99d073255cb --- /dev/null +++ b/Master/texmf-dist/tex/generic/context/ppchtex/ppchtex.noc @@ -0,0 +1,212 @@ +%D \module +%D [ file=ppchtex (m-chemie), +%D version=1997.03.19, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=\PPCHTEX\ (Plain Pictex Context cHemie \TEX), +%D author=Hans Hagen, +%D date=\huidigedatum, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}, +%D suggestions={Tobias Burnus, Dirk Kuypers \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See licen-en.pdf for +%C details. + +%D This module facilitates the use of \PPCHTEX\ in macro +%D packages other than \CONTEXT. One of the features of +%D \CONTEXT\ is that the user interface can be in any +%D language. This language is defined at loading time. +%D +%D This module is indeed a surrogate one and is only a poor +%D man's alternative to the more extensive \type{mult-***} +%D modules of \CONTEXT. The extra overhead in terms of macros +%D and functionality that these modules offer is only useful +%D in \CONTEXT. +%D +%D Two interfaces are supported here, but others can easily be +%D defined. This module expects the general system macros to be +%D loaded as wel as a interface switch \type{\ifalternativeinterface} +%D to be set. + +%D First we load some auxiliary macro's: + +\input supp-mis.mkii \let\writestatus\undefined +\input syst-gen.mkii +\input syst-fnt.mkii + +%D after which we can go on with: + +\unprotect + +%D 0 = english +%D 1 = dutch +%D 2 = german + +\ifx\interfacenumber\undefined + \chardef\interfacenumber=0 +\fi + +\def\definesystemvariable #1 % + {\setvalue{??#1}{@@#1}} + +\def\definesystemconstant #1 % + {\setvalue{s!#1}{#1}} + +\def\definevariable #1 #2 #3 % en nl de + {\ifcase\interfacenumber + \setvalue{v!#1}{#1} + \or + \setvalue{v!#1}{#2} + \or + \setvalue{v!#1}{#3} + \fi} + +\def\defineconstant #1 #2 #3 % en nl de + {\ifcase\interfacenumber + \setvalue{c!#1}{#1} + \setvalue{c!#2}{#1} + \or + \setvalue{c!#1}{#1} + \or + \setvalue{c!#1}{#1} + \setvalue{c!#3}{#1} + \fi} + +\def\definecommand #1 #2 #3 % + {\ifcase\interfacenumber + % core commands are english + \or + \doifnot{#1}{#2}{\setvalue{#2}{\getvalue{#1}}} + \or + \doifnot{#1}{#3}{\setvalue{#3}{\getvalue{#1}}} + \fi} + +\long\def\startcommands#1\stopcommands + {} + +\def\dosetvalue#1#2#3% + {\p!doifundefined{\c!prefix!#2}% + \let\donottest=\doprocesstest + \@EA\def\csname#1#2\endcsname{#3}% + \else + \let\donottest=\doprocesstest + \@EA\def\csname#1\csname\c!prefix!#2\endcsname\endcsname{#3}% + \fi} + +\def\dosetevalue#1#2#3% + {\p!doifundefined{\c!prefix!#2}% + \let\donottest=\doprocesstest + \@EA\edef\csname#1#2\endcsname{#3}% + \else + \let\donottest=\doprocesstest + \@EA\edef\csname#1\csname\c!prefix!#2\endcsname\endcsname{#3}% + \fi} + +\def\docopyvalue#1#2#3% + {\p!doifundefined{\c!prefix!#3}% + \let\donottest=\doprocesstest + \@EA\def\csname#1#3\endcsname% + {\csname#2#3\endcsname}% + \else + \let\donottest=\doprocesstest + \@EA\def\csname#1\csname\c!prefix!#3\endcsname\endcsname% + {\csname#2\csname\c!prefix!#3\endcsname\endcsname}% + \fi} + +\def\doresetvalue#1#2% + {\dosetvalue{#1}{#2}{}} + +\def\dogetvalue#1#2% + {\csname#1\csname\c!prefix!#2\endcsname\endcsname} + +\defineconstant axis assenstelsel achsen +\defineconstant top boven oben +\defineconstant width breedte breite +\defineconstant size formaat groesse +\defineconstant number getal nummer +\defineconstant height hoogte hoehe +\defineconstant factor factor faktor +\defineconstant frame kader rahmen +%defineconstant framecolor kaderkleur rahmenfarbe +\defineconstant color kleur farbe +\defineconstant bodyfont korps fliesstext +\defineconstant style letter schriftstil +\defineconstant rulethickness lijndikte liniendicke +\defineconstant rulecolor lijnkleur linienfarbe +\defineconstant left links links +\defineconstant offset offset offset +\defineconstant bottom onder unten +\defineconstant option optie option +\defineconstant location plaats platz +\defineconstant right rechts rechts +\defineconstant resolution resolutie aufloesung +\defineconstant scale schaal format +\defineconstant state status status +\defineconstant text tekst text +\defineconstant textcolor tekstkleur tekstfarbe +\defineconstant textsize tekstformaat textgroesse +\defineconstant alternative variant alternative +\defineconstant x x x +\defineconstant y y y + +\definevariable on aan an +\definevariable big groot gross +\definevariable intext intekst imtext +\definevariable small klein klein +\definevariable medium middel mittel +\definevariable fit passend passend +\definevariable start start start +\definevariable stop stop stop +\definevariable test test test +\definevariable off uit aus + +\definecommand definechemical definieerchemie definierechemie +\definecommand setupchemical stelchemiein stellechemieein +\definecommand chemical chemie chemie +\definecommand tochemical naarchemie zurchemie +\definecommand startchemical startchemie startchemie +\definecommand stopchemical stopchemie stopchemie +\definecommand toptext boventekst textueber +\definecommand bottext ondertekst textunter +\definecommand midtext middentekst textmitte + +\protect + +%D After those definitions we actually load \PPCHTEX: + +\input ppchtex.mkii + +%D We also change some setup values. Let's hope that the next +%D setups forever suits \LATEX. + +\unprotect + +\ifx\bodyfontsize\undefined + \ifx\f@size\undefined + \ifx\@ptsize\undefined + \setupchemical[\c!bodyfont=11pt] + \else + \setupchemical[\c!bodyfont=1\@ptsize pt] + \fi + \else + \setupchemical[\c!bodyfont=\f@size pt] + \fi +\else + \setupchemical[\c!bodyfont=\bodyfontsize] +\fi + +\ifx\mathrm\undefined + \setupchemical[\c!style=\rm] +\else + \setupchemical[\c!style=\mathrm] +\fi + +\ifx\outputresolution\undefined + \setupchemical[\c!resolution=300] +\else + \setupchemical[\c!resolution=\outputresolution] +\fi + +\let\unexpanded\normalunexpanded + +\protect \endinput |