From 5a7dd5d18ced4a73b05467f208d4c4b0d1afebc0 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 5 Feb 2021 18:08:41 +0100 Subject: 2021-02-05 17:44:00 --- .../manuals/followingup/followingup-fonts.tex | 370 +++++++++++---------- metapost/context/base/mpxl/mp-lmtx.mpxl | 10 +- metapost/context/base/mpxl/mp-miss.mpxl | 68 ++++ tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkii/mult-de.mkii | 4 + tex/context/base/mkiv/buff-imp-nested.mkiv | 4 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/core-uti.lua | 2 +- tex/context/base/mkiv/good-ctx.lua | 24 +- tex/context/base/mkiv/meta-ini.mkiv | 7 +- tex/context/base/mkiv/mult-def.lua | 3 + tex/context/base/mkiv/page-lay.mkiv | 4 +- tex/context/base/mkiv/spac-hor.mkiv | 17 +- tex/context/base/mkiv/status-files.pdf | Bin 26124 -> 26132 bytes tex/context/base/mkiv/status-lua.pdf | Bin 255649 -> 255713 bytes tex/context/base/mkiv/strc-reg.lua | 25 +- tex/context/base/mkiv/symb-imp-nav.mkiv | 17 +- tex/context/base/mkxl/buff-par.mklx | 2 +- tex/context/base/mkxl/buff-ver.mkxl | 48 +-- tex/context/base/mkxl/catc-def.mkxl | 4 +- tex/context/base/mkxl/catc-ini.mkxl | 18 +- tex/context/base/mkxl/colo-ini.mkxl | 6 +- tex/context/base/mkxl/cont-cs.mkxl | 4 +- tex/context/base/mkxl/cont-de.mkxl | 4 +- tex/context/base/mkxl/cont-en.mkxl | 4 +- tex/context/base/mkxl/cont-fr.mkxl | 4 +- tex/context/base/mkxl/cont-gb.mkxl | 4 +- tex/context/base/mkxl/cont-it.mkxl | 4 +- tex/context/base/mkxl/cont-log.mkxl | 4 +- tex/context/base/mkxl/cont-new.mkxl | 2 +- tex/context/base/mkxl/cont-nl.mkxl | 4 +- tex/context/base/mkxl/cont-pe.mkxl | 6 +- tex/context/base/mkxl/cont-ro.mkxl | 4 +- tex/context/base/mkxl/context.mkxl | 10 +- tex/context/base/mkxl/core-con.mkxl | 19 +- tex/context/base/mkxl/core-def.mkxl | 4 +- tex/context/base/mkxl/core-env.mkxl | 49 ++- tex/context/base/mkxl/core-ini.mkxl | 14 +- tex/context/base/mkxl/core-sys.mkxl | 2 +- tex/context/base/mkxl/core-two.mkxl | 1 + tex/context/base/mkxl/core-uti.lua | 2 +- tex/context/base/mkxl/enco-ini.mkxl | 20 +- tex/context/base/mkxl/file-job.mklx | 4 +- tex/context/base/mkxl/font-chk.lmt | 238 +++++++------ tex/context/base/mkxl/font-chk.mkxl | 26 ++ tex/context/base/mkxl/font-col.lmt | 27 +- tex/context/base/mkxl/font-emp.mklx | 4 +- tex/context/base/mkxl/font-fea.mklx | 3 +- tex/context/base/mkxl/font-fil.mklx | 3 +- tex/context/base/mkxl/font-ini.mklx | 18 +- tex/context/base/mkxl/font-mat.mklx | 2 + tex/context/base/mkxl/font-mpf.lmt | 12 +- tex/context/base/mkxl/font-ogr.lmt | 43 +-- tex/context/base/mkxl/font-pre.mkxl | 6 +- tex/context/base/mkxl/font-sty.mklx | 6 +- tex/context/base/mkxl/font-sym.mklx | 2 + tex/context/base/mkxl/grph-epd.mkxl | 6 +- tex/context/base/mkxl/grph-inc.mkxl | 6 +- tex/context/base/mkxl/lang-ini.mkxl | 7 +- tex/context/base/mkxl/lang-lab.mkxl | 61 ++-- tex/context/base/mkxl/lang-mis.mkxl | 34 +- tex/context/base/mkxl/lang-url.mkxl | 4 +- tex/context/base/mkxl/lpdf-emb.lmt | 2 +- tex/context/base/mkxl/lpdf-epa.lmt | 4 +- tex/context/base/mkxl/luat-ini.mkxl | 12 +- tex/context/base/mkxl/luat-lib.mkxl | 14 +- tex/context/base/mkxl/math-ali.mkxl | 6 +- tex/context/base/mkxl/math-def.mkxl | 2 +- tex/context/base/mkxl/math-ini.mkxl | 56 ++-- tex/context/base/mkxl/math-pln.mkxl | 22 +- tex/context/base/mkxl/math-stc.mklx | 8 +- tex/context/base/mkxl/meta-imp-clock.mkxl | 2 + tex/context/base/mkxl/meta-ini.lmt | 161 +++++++++ tex/context/base/mkxl/meta-ini.mkxl | 30 +- tex/context/base/mkxl/meta-nod.mkxl | 2 + tex/context/base/mkxl/meta-tex.mkxl | 56 ++-- tex/context/base/mkxl/mult-aux.mkxl | 10 +- tex/context/base/mkxl/mult-ini.mkxl | 6 +- tex/context/base/mkxl/node-nut.lmt | 2 + tex/context/base/mkxl/node-rul.mkxl | 42 +-- tex/context/base/mkxl/pack-box.mkxl | 21 +- tex/context/base/mkxl/pack-com.mkxl | 38 ++- tex/context/base/mkxl/pack-lyr.mkxl | 2 +- tex/context/base/mkxl/pack-mrl.mkxl | 2 +- tex/context/base/mkxl/pack-rul.mkxl | 22 +- tex/context/base/mkxl/page-bck.mkxl | 5 +- tex/context/base/mkxl/page-cst.mkxl | 6 +- tex/context/base/mkxl/page-ini.mkxl | 2 +- tex/context/base/mkxl/page-lay.mkxl | 4 +- tex/context/base/mkxl/page-txt.mklx | 13 +- tex/context/base/mkxl/publ-ini.mkxl | 20 +- tex/context/base/mkxl/publ-old.mkxl | 6 +- tex/context/base/mkxl/spac-grd.mkxl | 2 +- tex/context/base/mkxl/spac-hor.mkxl | 26 +- tex/context/base/mkxl/spac-ver.mkxl | 6 +- tex/context/base/mkxl/strc-flt.mklx | 2 +- tex/context/base/mkxl/strc-itm.mklx | 29 +- tex/context/base/mkxl/strc-lst.mklx | 3 + tex/context/base/mkxl/strc-mat.mkxl | 24 +- tex/context/base/mkxl/strc-not.mklx | 4 +- tex/context/base/mkxl/strc-num.mkxl | 2 + tex/context/base/mkxl/strc-ref.mklx | 17 +- tex/context/base/mkxl/strc-reg.mkxl | 32 +- tex/context/base/mkxl/strc-syn.mkxl | 8 +- tex/context/base/mkxl/supp-box.lmt | 99 +++++- tex/context/base/mkxl/supp-box.mkxl | 50 +-- tex/context/base/mkxl/supp-mat.mkxl | 18 +- tex/context/base/mkxl/symb-ini.mkxl | 4 +- tex/context/base/mkxl/syst-aux.lmt | 18 + tex/context/base/mkxl/syst-aux.mkxl | 188 ++++++----- tex/context/base/mkxl/syst-ini.mkxl | 6 +- tex/context/base/mkxl/syst-mes.mkxl | 20 -- tex/context/base/mkxl/tabl-ltb.mkxl | 28 +- tex/context/base/mkxl/tabl-tab.mkxl | 11 +- tex/context/base/mkxl/tabl-tbl.mkxl | 4 - tex/context/base/mkxl/trac-vis.lmt | 25 +- tex/context/base/mkxl/typo-del.mkxl | 14 +- tex/context/base/mkxl/typo-itc.mklx | 6 +- tex/context/interface/mkii/keys-de.xml | 4 + tex/context/modules/mkiv/s-references-show.mkiv | 2 +- tex/context/modules/mkxl/s-fonts-show.mkxl | 15 +- tex/context/modules/mkxl/s-symbols-show.mkxl | 16 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 125 files changed, 1574 insertions(+), 1007 deletions(-) create mode 100644 metapost/context/base/mpxl/mp-miss.mpxl create mode 100644 tex/context/base/mkxl/meta-ini.lmt delete mode 100644 tex/context/base/mkxl/syst-mes.mkxl diff --git a/doc/context/sources/general/manuals/followingup/followingup-fonts.tex b/doc/context/sources/general/manuals/followingup/followingup-fonts.tex index 6bc10e929..502370d7d 100644 --- a/doc/context/sources/general/manuals/followingup/followingup-fonts.tex +++ b/doc/context/sources/general/manuals/followingup/followingup-fonts.tex @@ -8,24 +8,24 @@ \startsection[title={History}] -The infrastructure for fonts makes for a large part of the code of any \TEX\ -macro package. We have to go back in time to understand why. When \TEX\ showed -up, fonts were collections of bitmaps and measures. There were at most 256 glyphs -in a font and in order to do its job, \TEX\ needed to know (and still needs to -know) the width, height and depth of glyphs. If you want ligatures it also needs -to know how to construct them from the input and when you want kerning there has -to be additional information about what neighboring glyphs need a kern in -between. Math is yet another subtask that demands extra information, like chains -of glyphs that grow in size and if needed even recipes of how to construct large -shapes from smaller ones. - -Fonts come in sizes, and for instance Latin Modern has quite a few variants where -the shapes are adapted to the size. This means that when you need a 9pt regular -shape alongside a 12pt one, two fonts have to be loaded. This is quite visible in -math where we have three related sizes: text, script and scriptscript, grouped in -so called families. When we scale the digit~2 to the same height you will notice -that the text, script and scriptscript sizes look different (the last three are -unscaled): +The infrastructure for fonts makes up a large part of the code of any \TEX\ macro +package. We have to go back in time to understand why. When \TEX\ showed up, +fonts were collections of bitmaps and measures. There were at most 256 glyphs in +a font and in order to do its job, \TEX\ needed to know (and still needs to know) +the width, height and depth of glyphs. If you want ligatures it also needs to +know how to construct them from the input and when you want kerning there has to +be additional information about what neighboring glyphs need a kern in between. +Math is yet another subtask that demands extra information, like chains of glyphs +that grow in size and if needed even recipes of how to construct large shapes +from smaller ones. + +Fonts come in sizes. Latin Modern and the original Computer Modern, for instance, +have quite a few variants where the shapes are adapted to the size. This means +that when you need a 9pt regular shape alongside a 12pt one, two fonts have to be +loaded. This is quite visible in math where we have three related sizes: text, +script and scriptscript, grouped in so called families. When we scale the digit~2 +to the same height you will notice that the text, script and scriptscript sizes +look different (the last three are unscaled): \startlinecorrection \dontleavehmode\scale[frame=on,height=5ex]{$\textstyle 2$}\quad @@ -49,18 +49,18 @@ just give a short summary of what a font system has to deal with. \startitemize \startitem In a bodyfont setup different sizes (9pt, 10pt, 12pt) can have their own - specific set of fonts. This can result in quite some definitions that relate - to the style, like regular, bold, italic, bolditalic, slanted and - boldslanted, etc. When possible loading the fonts is delayed. But in - \CONTEXT\ often the number of actually loaded fonts is not that large. + specific set of fonts. This can result in quite a number of definitions that + relate to the style, like regular, bold, italic, bold italic, slanted, bold + slanted, etc. When possible loading the fonts is delayed. In \CONTEXT\ often + the number of fonts that are actually loaded is not that large. \stopitem \startitem Some font designs have different shapes per bodyfont size. A minor complication is that when one is missing some heuristic best|-|match choice - might be needed. Okay, in practice only Latin Modern falls into this - category. Maybe \OPENTYPE\ variable fonts can be seen this way, but, although - we supported that right from the start, I haven't noticed much interest in - the \TEX\ community. + might be needed. Okay, in practice only Latin Modern falls into this category + for \CONTEXT. Maybe \OPENTYPE\ variable fonts can be seen this way, but, + although we supported that right from the start, I haven't noticed much + interest in the \TEX\ community. \stopitem \startitem Within a bodyfont size we distinguish size variants. We can go smaller (x and @@ -75,45 +75,45 @@ just give a short summary of what a font system has to deal with. others (keep in mind that we started in the age of bitmaps). \stopitem \startitem - Special features, like smallcaps or oldstyle numerals, can demand their own + Special features, such as smallcaps or oldstyle numerals, can demand their own definitions. More loading and automatic definitions can be triggered by sizes - needed in for instance scripts and titles. + needed in, e.g., scripts and titles. \stopitem \startitem - A document can have a mixed setup, that is: use different font designs in one + A document can have a mixed setup, that is: using different font + designs within one document, so some kind of namespace subsystem is needed. \stopitem \startitem - In an eight bit font world, we not only have text fonts but also collections + In an eight|-|bit font world, we not only have text fonts but also collections of symbols, and even in math there are additional symbol collections. In - \OPENTYPE\ symbols end up in text fonts, but there we have tons of emoji's + \OPENTYPE\ symbols end up in text fonts, but there we have tons of emojis and color fonts. All has to be dealt with in an integrated way. And we're not even talking of virtual fonts, (runtime) \METAPOST\ generated fonts, and so on. \stopitem \startitem - In traditional eight bit engines the dependency of hyphenation on the - encoding of a font can result in the necessity to load a font multiple times - in different encodings, something that depends on the language mix used. - Interesting is that coming up with an European encoding (covering most Latin - languages) was not that hard, especially when one keeps in mind that many - eight bit encodings waste slots on seldom used symbols, but by that time - \OPENTYPE\ and and \UNICODE\ input started to dominate. + In traditional eight|-|bit engines, hyphenation depends on a font's encoding, + which can require loading a font multiple times in different encodings. This + depends on the language mix used. A side point is that defining a European + encoding covering most Latin languages was not that hard, especially when one + keeps in mind that many eight|-|bit encodings waste slots on seldom used + symbols, but by that time \OPENTYPE\ and \UNICODE\ input started to dominate. \stopitem \startitem In the more modern \OPENTYPE\ fonts combinations of features can demand - additional instances (one can think of language|/|script combinations, - substitutions in base mode, special effects like boldening, color fonts, - etc.). + additional instances: one can think of language|/|script combinations, + substitutions in base mode, special effects like emboldening, color fonts, + etc. \stopitem \startitem - Math is complicated by the fact that in traditional \TEX\ alphabets come from - different fonts which is why we have many so called families; sometimes a - font has several alphabets which means that some mapping can be needed. - Operating on the size, shape, encoding and style axes puts some demands on - the font system. Add to this (often) partial (due to lack of fonts) bold - support and it gets even more complicated. In \OPENTYPE\ all the alphabets - come from one font. + Math is complicated by the fact that in traditional \TEX, alphabets come from + different fonts, which is why we have many so|-|called families; a font can + have several alphabets which means that some mapping can be needed. Operating + on the size, shape, encoding and style axes puts some demands on the font + system. Add to this the (often) partial (due to lack of fonts) bold support + and it gets even more complicated. In \OPENTYPE\ all the alphabets come from + one font. \stopitem \startitem There is additional math auto|-|definition and loading code for the sizes @@ -123,12 +123,12 @@ just give a short summary of what a font system has to deal with. All this has resulted in a pretty complex subsystem. Although going \OPENTYPE\ (and emulated \OPENTYPE\ with \TYPEONE\ fonts as we do in \MKIV) removes some -complications, like encodings, it does also add complexity because of the many -possible font features, either or not dependent on script and language. Text as -well as math got simpler at the \TEX\ end (but that is compensated by quite a bit -\LUA\ code that deals with new features). +complications, like encodings, it also adds complexity because of the many +possible font features, either dependent or not on script and language. Text as +well as math got simpler in the \TEX\ code, though that was traded for quite a +bit of \LUA\ code to deal with new features. -Also, in order to let a font subsystem not impact performance to much, let alone +So, in order to let the font subsystem not impact performance too much, let alone extensive memory usage, the \CONTEXT\ font subsystem is rather optimized. The biggest burden comes from fonts that have a dynamic (adaptive) definition because then we need to do quite a bit of testing per font switch, but even that has @@ -138,67 +138,68 @@ always been rather fast. \startsection[title={Reality}] -In \MKIV\ and therefore also in \LMTX\ more font magic happens. The initial node -lists that make up a box or paragraph can get manipulated in several ways and -often fonts are involved. The font features (smallcaps, oldstyle, alternates, -etc.) can be defined static (as part of the definition) or dynamic (resolved on -the spot at the cost of some overhead). Characters can be remapped, fonts can be -replaced. The math subsystem in \MKIV\ was different right from the start: we use -a limited number of families (regular, bold, l2r and r2l), and stay abstract till -the moment we need to deal with the specific alphabets. But still, in \MKIV, we -have the families with three fonts. - -In the \LUAMETATEX\ manual we show some math magic and we do so for different -fonts. As a side effect, we set up half a dozen bodyfont collections: Lucida, -Pagella, Latin Modern, Dejavu, the math standard Cambria, etc. Even with delayed -and shared font loading, we end up with 158 instances but quite a bit of them are -math fonts, at least six per bodyfont size: regular and bold (boldened) text, -script and scriptscript. Of course most are just copies with different scaling -that reuse already loaded resources. In the final\PDF\ we have 21 subset fonts. +In \MKIV\ and therefore also in \LUAMETATEX\ (\LMTX) more font magic happens. The +initial node lists that make up a box or paragraph can get manipulated in several +ways and often fonts are involved. The font features (smallcaps, oldstyle, +alternates, etc.)\ can be defined as static (part of the definition) or as +dynamic (resolved on the spot at the cost of some overhead). Characters can be +remapped, fonts can be replaced. The math subsystem in \MKIV\ was different right +from the start: we use a limited number of families (regular, bold, l2r and r2l), +and stay abstract till the moment we need to deal with the specific alphabets. +But still, in \MKIV, we have the families with three fonts. + +In the \LUAMETATEX\ manual we show some math magic for different fonts. As a side +effect, we set up half a dozen bodyfont collections: Lucida, Pagella, Latin +Modern, Dejavu, the math standard Cambria, etc. Even with delayed and shared font +loading, we end up with 158 instances but quite a few of them are math fonts, at +least six per bodyfont size: regular and bold (emboldened) text, script and +scriptscript. Of course most are just copies with different scaling that reuse +already loaded resources. In the final \PDF\ we have 21 subsetted fonts. If we look at the math fonts that we use today, there is however quite some -overlap. It starts with a text font. From that script and scriptscript variants +overlap. It starts with a text font. From that, script and scriptscript variants are derived, but often these variants use many text size related shapes too. Some shapes get alternatives (from the \type {ssty} feature), and the whole clone gets -scaled. But, much of the logic of for instance extensibles is the same. - -A similar situation happens with for instance large \CJK\ fonts: there are hardly -any advanced features involved there, so any size is basically a copy with scaled -dimensions, and these fonts can be real huge! - -Actually, when we talk about features, in many cases in \CONTEXT\ you don't -define them as part of the font. For instance small caps can best be triggered by -using a dynamic feature: applied to a specific stretch of text. In fact, often -features like superiors of fractions only work well on characters that fit the -bill and produce weird side effects otherwise (a matter of design completeness). -When the font handler does its work there are actually four cases: no features -get applied, something that for instance happens with most mono spaced fonts, -base mode is used, which means that the \TEX\ machinery takes care of -constructing ligatures and injecting kerns, and node mode, where \LUA\ handles -the features. The fourth case is a special case of node mode where a different -feature set is applied. \footnote {We also have so called plug mode where an -external renderer can do the work but that one is only around for some -experiments during Idris Hamid's font development.} At the cost of some extra -overhead (for each node mode run) dynamic features are quite powerful and save -quite some memory and definitions. \footnote {The generic font handler that is -derived from the \CONTEXT\ one doesn't implement this so it runs a little -faster.} The overhead comes from much more testing regarding the font we deal -with because suddenly the same font can demand different treatments, depending on -what dynamic features are active. \footnote {Originally this model was introduced -for a dynamic paragraph optimization subsystem for Arabic but no one really uses -it because there there are no suitable fonts.} - -Although the font handling is responsible for much of the time spent in \LUA, it is -still reasonable given what has to be done. Actually, because we have an extensible -system, it's often the extensions that takes additional runtime. Flexibility comes -at a price. +scaled. But, much of the logic of, for instance, extensibles is the same. + +A similar situation happens with large \CJK\ fonts: there are hardly any advanced +features involved there, so any size is basically a copy with scaled dimensions, +and these fonts can be truly huge! + +When we talk about features, in many cases in \CONTEXT\ you don't define them as +part of the font. For instance small caps can best be triggered by using a +dynamic feature: applied to a specific stretch of text. In fact, often features +like superiors of fractions only work well on characters that fit the bill and +produce weird side effects otherwise (a matter of design completeness). When the +font handler does its work there are actually four cases: no features get applied +(something that happens with, for instance, most monospaced fonts); base mode is +used (which means that the \TEX\ machinery takes care of constructing ligatures +and injecting kerns); and node mode (where \LUA\ handles the features). The +fourth case is a special case of node mode where a different feature set is +applied. \footnote {We also have so|-|called plug mode where an external renderer +can do the work but that one is only around due to some experiments during Idris +Hamid's font development.} At the cost of some extra overhead (for each node mode +run) dynamic features are quite powerful and save quite a lot of memory and +definitions. \footnote {The generic font handler that is derived from the +\CONTEXT\ one doesn't implement this, so it runs a little faster.} The overhead +comes from much more testing regarding the font we deal with because suddenly the +same font can demand different treatments, depending on what dynamic features are +active. \footnote {Originally this model was introduced for a dynamic paragraph +optimization subsystem for Arabic but in practice no one uses it because there +are no suitable fonts.} + +Although the font handling is responsible for much of the time spent in \LUA, it +is still reasonable given what has to be done. Because we have an extensible +system, it's often the extensions that takes additional runtime. Flexibility +comes at a price. \stopsection \startsection[title={Progress}] -At some point I started playing with realtime glyph scaling. Here realtime means that -it doesn't depend on the font definition. To get an idea, here is an example: +At some point I started playing with realtime glyph scaling. Here realtime means +that it doesn't depend on the font definition. To get an idea, here is an example +(all examples are additionally scaled for \TUGBOAT): \startbuffer test {\glyphxscale 2500 test} test @@ -208,13 +209,13 @@ test {\glyphxscale 2500 test} test \getbuffer -The glyphs in the current font get scaled horizontally without the need for an extra -font instance. Now, this kind of trickery puts some constraints on the font handling, -as is demonstrated in the next example. We use Latin Modern because that font has -all these ligatures: +The glyphs in the current font get scaled horizontally without the need for an +extra font instance. Now, this kind of trickery puts some constraints on the font +handling, as is demonstrated in the next example. We use Latin Modern because +that font has all these ligatures: \startbuffer -\definedfont[lmroman-regular*default]% +\definedfont[lmroman10-regular*default]% e{\glyphxscale 2500 ff}icient ef{\glyphxscale 2500 f}icient ef{\glyphxscale 2500 fi}cient @@ -225,25 +226,25 @@ e{\glyphxscale 2500 ffi}cient {\getbuffer} -So, in order to deal with this kind of scaling, we now operate not only on the -font (id) and dynamic feature axes, but also on the scales of which we have three -variants: glyph scale, glyph xscale and glyph yscale). There is actually also a -state dimension but we leave that for now; think of flagging glyphs as initial or -final. This brings the number of axis to six. It is important to stress that in +In order to deal with this kind of scaling, we now operate not only on the font +(id) and dynamic feature axes, but also on the scales, of which we have three +variants: glyph scale, glyph xscale and glyph yscale. There is actually also a +state dimension but we omit that for now (think of flagging glyphs as initial or +final). This brings the number of axis to six. It is important to stress that in these examples the same font instance is used! -Just for the record: there are several approaches to switching fonts possible but -for now we stick to a simple font id switch plus glyph scale settings at the -\TEX\ end. A variant would be to introduce a new mechanism where id's and scales -go together but for now I see no real gain in that. +Just for the record: several approaches to switching fonts are possible but for +now we stick to a simple font id switch plus glyph scale settings at the \TEX\ +end. A variant would be to introduce a new mechanism where id's and scales go +together but for now I see no real gain in that. \stopsection \startsection[title={Math}] -Given what is written in the previous sections, a logical question would be -\quotation {Can we apply scaling to math?} and the answer is \quotation {Yes, we -can!}. But we actually go a bit further and that is partly due to some other +Given what has been discussed in the previous sections, a logical question would +be \quotation {Can we apply scaling to math?} and the answer is \quotation {Yes, +we can!}. We can even go a bit further and that is partly due to some other properties of the engine. From \PDFTEX\ the \LUATEX\ engines inherited character protrusion and glyph @@ -252,11 +253,11 @@ carry the expanded dimensions, in \LUATEX\ at some point this was replaced by an expansion field in the glyph and kern nodes. So, instead of changing the font id of expanded glyphs, the same id is used but with the applied expansion factor set in the glyph. A side effect was that in places where dimensions are needed, we -call functions that calculate the expanded widths on request (as these can -change during linebreak calculations) in combination with accessing font -dimensions directly. This level of abstraction is even more present in -\LUAMETATEX. This means that we have an uniform interface to fonts and as a side -effect scaling is to be dealt with in only a few places in the code. +call functions that calculate the expanded widths on request (as these can change +during linebreak calculations) in combination with accessing font dimensions +directly. This level of abstraction is even more present in \LUAMETATEX. This +means that we have an uniform interface to fonts and as a side effect scaling +need be dealt with in only a few places in the code. Now, in math we have a few more complications. First of all, we have three sizes to consider and we also have lots of parameters that depend on the size. But, as @@ -267,52 +268,53 @@ one bodyfont size of math (note that each math family has three sizes, where the script and script sizes can have different, fine tuned, shapes) and just scale that on demand. -Once all that was in place it was a logical next step to see if we could actually -stick to one instance. Because in \LUAMETATEX\ we try to load fonts efficiently +Once all that was in place it was a logical next step to see if we could stick to +just a single instance. Because in \LUAMETATEX\ we try to load fonts efficiently we store only the minimally needed information at the \TEX\ end. A font with no math therefore has less data per glyph. Again, this brings some abstraction that -actually helped to implement the one instance mechanism. A math glyph has -optional lists of increasing sizes and vertical or horizontal extensibles. So -what got added was an optional chain of smaller sizes. If a character has 3 -different glyphs for the three sizes, the text glyph has a pointer to the script -glyph which in turn has a pointer to the scriptscript glyph. This means that when -the math engine needs a specific character at a given size (text, script, -scriptscript) we just follow that chain. +helped to implement the one instance mechanism. A math glyph has optional lists +of increasing sizes and vertical or horizontal extensibles. So what got added was +an optional chain of smaller sizes. If a character has three different glyphs for +the three sizes, the text glyph has a pointer to the script glyph which in turn +has a pointer to the scriptscript glyph. This means that when the math engine +needs a specific character at a given size (text, script, scriptscript) we just +follow that chain. In an \OPENTYPE\ math font the script and scriptscript sizes are specified as percentages of the text size. When the dimensions of a glyph are needed, we just scale on the fly. Again this adds some overhead but I'm pretty sure that no user -will notice this. +will notice. So, to summarize: if we need a character at scriptscript size, we access the text size glyph, check for a pointer to a script size, go there, and again check for a -smaller size. We just use what fits the bill. And, when we need dimensions we +smaller size. We use only what fits the bill. And, when we need dimensions we just scale. In order to scale we need the relative size, so we need to set that up when we load the font. Because in \CONTEXT\ we also can assemble a virtual \OPENTYPE\ font from \TYPEONE\ fonts, it was actually that (old) compatibility -feature, the one that implements \TYPEONE\ bases \OPENTYPE\ math, that took most -time to adapt, not so much because it is complicates but because in \LMTX\ we -have to bypass some advanced loading mechanisms. Because we can scale in two -dimensions the many (font related) math parameters also need to be dealt with -accordingly. +feature, the one that implements \TYPEONE\ based on \OPENTYPE\ math, that took +the most time to adapt, not so much because it is complicated but because in +\LMTX\ we have to bypass some advanced loading mechanisms. Because we can scale +in two dimensions the many (font|-|related) math parameters also need to be dealt +with accordingly. The end result is that for math we now only need to define two fonts per bodyfont setup: regular and bold at the natural scale (normally 10pt) and we share these -for all sizes. It is because of this and what we describe in the next section -that the 158 instances for the \LUAMETATEX\ manual can now be brought down to 30. +for all sizes. As a result of this and what we describe in the next section, the +158 instances for the \LUAMETATEX\ manual can be reduced to~30. + \stopsection \startsection[title={Text}] Sharing instances in text mode is relatively simple, although we do have to keep -in mind that these are extra axis when dealing with font features: two +in mind that scaling is an extra axis when dealing with font features: two neighboring glyphs with the same font id and dynamics but with different scales are effectively from different fonts. -Another complication is that when we use font fallbacks (read: take missing +Another complication is that when we use font fallbacks (read:\ take missing glyphs from another font) we no longer have a dedicated instance but use a shared -one. This in itself if not a problem but we do need to handle specified relative +one. This in itself is not a problem but we do need to handle specified relative scales. This was not that hard to patch in \CONTEXT\ \LMTX. We can enforce aggressive font sharing with: @@ -321,7 +323,7 @@ We can enforce aggressive font sharing with: \enableexperiments[fonts.compact] \stoptyping -After that we often use less instances. Just to give an idea, on the \LUAMETATEX\ +After that we often use fewer instances. Just to give an idea, on the \LUAMETATEX\ manual we get these stats: \starttyping @@ -329,14 +331,14 @@ manual we get these stats: 290 pages, 9.5 sec, 149M lua, 35M tex, 30 instances \stoptyping -So, we win on all fronts when we use this glyph scale mechanism. The magic -primitive that deals with this is \type {\glyphscale} primitive that accepts a +So, we win on all fronts when we use this glyph scaling mechanism. The magic +primitive that deals with this is named \type {\glyphscale}; it accepts a number, where \type {1200} and \type {1.2} both mean scaling to 20\percent\ more -than normal. But one can best not use this primitive directly. +than normal. But it's best not to use this primitive directly. -A specific font can be defined using the \type {\definefont} command. In \LMTX\ a -regular scaler can be followed by two scale factors. The next example -demonstrates this: +A specific scaled font can be defined using the \type {\definefont} command. In +\LMTX\ a regular scaler can be followed by two scale factors. The next example +demonstrates this (as can be seen, the \type {yoffset} affects the baseline): \startbuffer \definefont[FooA][Serif*default @ 12pt 1800 500] @@ -414,14 +416,14 @@ This gives: \getbuffer -Just for the record: the Latin Modern fonts, when set up to use design sizes, will -still use the specific size related files. +Just for the record: the Latin Modern fonts, when set up to use design sizes, +will still use the specific size|-|related files. \stopsection \startsection[title={Hackery}] -You can actually use negative scale values, as is demonstrated in the following +You can use negative scale values, as is demonstrated in the following code: \startbuffer @@ -450,8 +452,8 @@ gives: \stoplinecorrection Glyphs can have offsets and these are used for implementing \OPENTYPE\ features. -However, they are also available at the \TEX\ end. Take this example where we use -the new \type {\glyph} primitive (a variant of \type {\char} that takes +However, they are also available on the \TEX\ side. Take this example where we +use the new \type {\glyph} primitive (a variant of \type {\char} that takes keywords): \startbuffer @@ -465,13 +467,13 @@ keywords): \typebuffer \getbuffer -This example demonstrates that the \type {\glyph} primitive takes quite some +This example demonstrates that the \type {\glyph} primitive takes quite a few keywords: \type {xoffset}, \type {yoffset}, \type {xscale}, \type {yscale}, \type -{left}, \type {right}, \type {raise}, \type {options}, \type {font} and \type {id} -where the last two take a font identifier or font id (an positive number). For -this article it's enough to know that the option indicates that glyph dimension -should include the offset. In a moment we will see an alternative that doesn't -need that. +{left}, \type {right}, \type {raise}, \type {options}, \type {font} and \type +{id} where the last two take a font identifier or font id (a positive number). +For this article it's enough to know that the option indicates that glyph +dimension should include the offset. In a moment we will see an alternative that +doesn't need that. \startbuffer \samplefile{jojomayer} @@ -497,7 +499,7 @@ To quote Jojo Mayer: Keep in mind that this can interfere badly with font feature processing which also used offsets. It might often work out okay vertically, but less well horizontally. -The scales, as mentioned, works with pseudo scales but that is sometimes a bit +The scales, as mentioned, works with pseudo|-|scales but that is sometimes a bit cumbersome. This is why a special \type {\numericscale} primitive has been introduced. @@ -555,8 +557,8 @@ The result is the same: \darkgreen \getbuffer[definition,example] \stopnarrower -But anyway: don't over|-|do it. We have dealt with such cases for decades without -these fancy new features. The next example show margins in action: +But anyway: don't overdo it. We have dealt with such cases for decades without +these fancy new features. The next example shows margins in action: \startlinecorrection \bTABLE[align=middle,width=.33\textwidth] @@ -618,14 +620,14 @@ dimensions of a glyph. \startsection[title={Implementation}] Discussing the implementation in the engine makes no sense here, also because -details might change. However, it is good to know that quite some properties -travel with the glyph nodes, for instance the scales, margins, offsets, language, -script and state properties, control over kerning, ligaturing, expansion and -protrusion, etc. The dimensions (width, height and depth) are not stored in the -glyph node but calculated from the font, scales and optionally the offsets and -expansion factor. One problem is that the more clever (and nice) solutions we -cook up, the more it might impact performance. So, I will delay some experiments -till I have a more powerful machine. +details might change. However, it is good to know that many properties travel +with the glyph nodes, for instance the scales, margins, offsets, language, script +and state properties, control over kerning, ligaturing, expansion and protrusion, +etc. The dimensions (width, height and depth) are not stored in the glyph node +but calculated from the font, scales and optionally the offsets and expansion +factor. One problem is that the more clever (and nice) solutions we cook up, the +more it might impact performance. So, I will delay some experiments till I have a +more powerful machine. One reason for {\em not} storing the dimensions in a glyph node is that we often copy those nodes or change character fields in the font handler and we definitely @@ -633,17 +635,17 @@ don't want the wrong dimensions there. At that moment, offsets and margin fields don't reflect features yet, so copying them is no big deal because at that moment these are still zero. However, dimensions are rather character bound so every time a character is set, we also would have to set the dimensions. Even worse, -when we can set them, the question arises if they actually were already set -explicitly. So, this is a can of worms we're not going to open: the basic width, -height and depth of the glyph as specified in the font is used and combined with -actual dimensions (likely already scaled according the glyph scales) in offset -and margin fields. +when we can set them, the question arises if they were already set explicitly. +So, this is a can of worms we're not going to open: the basic width, height and +depth of the glyph as specified in the font is used and combined with actual +dimensions (likely already scaled according the glyph scales) in offset and +margin fields. Now, I have to admit that especially playing with using margins to glyphs instead of font kerns is more of an experiment to see what the consequences are than a -necessity, but what would be the joy of \TEX\ without such experiments. And as +necessity, but what would be the joy of \TEX\ without such experiments? And as usual, in \CONTEXT\ these will become options in the font handler that one can -either or not enable. +enable, or not. \stopsection diff --git a/metapost/context/base/mpxl/mp-lmtx.mpxl b/metapost/context/base/mpxl/mp-lmtx.mpxl index 57794e544..56a0ec066 100644 --- a/metapost/context/base/mpxl/mp-lmtx.mpxl +++ b/metapost/context/base/mpxl/mp-lmtx.mpxl @@ -2224,6 +2224,7 @@ newscriptindex mfid_registerglyph ; mfid_registerglyph := scriptindex "registe % An experimental macro: vardef registercomposedglyph (expr u) (suffix snippets) = + save s ; s := getparameterdefault "mpsfont" "scale" 1 ; save llx, lly, urx, ury ; llx := xpart llcorner snippets[u] ; if llx <> 0 : @@ -2231,9 +2232,9 @@ vardef registercomposedglyph (expr u) (suffix snippets) = snippets[u] := snippets[u] shifted (-llx, 0) ; llx := 0; fi ; - lly := ypart llcorner snippets[u] ; - urx := xpart urcorner snippets[u] ; - ury := ypart urcorner snippets[u] ; + lly := ypart llcorner snippets[u] / s ; + urx := xpart urcorner snippets[u] / s ; + ury := ypart urcorner snippets[u] / s ; lmt_registerglyph [ category = getparameter "mpsfont" "category", unicode = u, @@ -2247,6 +2248,7 @@ enddef ; vardef composeglyph (suffix snippets) = save u ; u := getparameter "mpsfont" "unicode" ; + save s ; s := getparameterdefault "mpsfont" "scale" 1 ; snippets[u] := image ( for i=1 upto getparametercount "mpsfont" "shapes" : draw scantokens ( getparameter "mpsfont" "shapes" i "shape" ) @@ -2254,7 +2256,7 @@ vardef composeglyph (suffix snippets) = withcolor getparameter "mpsfont" "shapes" i "color" fi ; endfor ; - ) ; + ) scaled s ; registercomposedglyph(u, snippets) ; enddef ; diff --git a/metapost/context/base/mpxl/mp-miss.mpxl b/metapost/context/base/mpxl/mp-miss.mpxl new file mode 100644 index 000000000..0788fece4 --- /dev/null +++ b/metapost/context/base/mpxl/mp-miss.mpxl @@ -0,0 +1,68 @@ +%D \module +%D [ file=mp-miss.mpiv, +%D version=2021.02.01, +%D title=\CONTEXT\ \METAPOST\ graphics, +%D subtitle=missing glyphs, +%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. + +if known metafun_loaded_miss : endinput ; fi ; + +newinternal boolean metafun_loaded_miss ; metafun_loaded_miss := true ; immutable metafun_loaded_miss ; + +picture MissingSnippets[][]; + +vardef MissingGlyphSymbol(expr w, h, d) = + image ( + draw (0,-d)--(w,-d)--(w,h)--(0,h)--cycle ; + if d <> 0 : draw (0,0)--(w,0) ; + ) +enddef ; + +vardef MissingLowercase = image ( draw MissingGlyphSymbol(.45, .55, .20) scaled 1000 ; ) enddef ; +vardef MissingUppercase = image ( draw MissingGlyphSymbol(.65, .70, .25) scaled 1000 ; ) enddef ; +vardef MissingMark = image ( draw MissingGlyphSymbol(.15, .70, -.50) scaled 1000 ; ) enddef ; +vardef MissingPunctuation = image ( draw MissingGlyphSymbol(.15, .55, .20) scaled 1000 ; ) enddef ; +vardef MissingUnknown = image ( draw MissingGlyphSymbol(.45, .20, 0) scaled 1000 ; ) enddef ; + +% vardef MissingGlyph = +% pickup pencircle scaled 0.05 ; +% composeglyph(MissingSnippets[getparameterdefault "mpsfont" "namespace" 1]) ; +% enddef ; + +vardef MissingGlyph = + save u ; u := getparameterdefault "mpsfont" "unicode" 1; + save s ; s := getparameterdefault "mpsfont" "scale" 1 ; + save n ; n := getparameterdefault "mpsfont" "namespace" 1 ; + save i ; i := getparameterdefault "mpsfont" "slant" 0 ; + save w ; w := getparameterdefault "mpsfont" "weight" 1 ; + pickup pencircle scaled (0.05 * w) ; + MissingSnippets[n][u] := image ( + draw scantokens ( getparameter "mpsfont" "shapes" (1) "shape" ) + withcolor getparameter "mpsfont" "shapes" (1) "color" + ) scaled s slanted i ; + registercomposedglyph(u, MissingSnippets[n]) ; +enddef ; + +lmt_registerglyphs [ + name = "missing", + units = 1000, + width = 100, + height = 100, + depth = 0, +] ; + +% we need to set up some basics (signals to the backend and such) at definition +% time so we just force a bogus shape (zero) + +lmt_registerglyph [ + category = "missing", +] ; + +permanent MissingSnippets, MissingGlyphSymbol, MissingLowercase, MissingUppercase, + MissingMark, MissingPunctuation, MissingUnknown, MissingGlyph ; diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 83b16916a..e2adc3d91 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2021.02.01 13:17} +\newcontextversion{2021.02.05 17:41} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 8dc76805c..1c2b39e53 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2021.02.01 13:17} +\edef\contextversion{2021.02.05 17:41} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-de.mkii b/tex/context/base/mkii/mult-de.mkii index 3e2caec87..06a4fb162 100644 --- a/tex/context/base/mkii/mult-de.mkii +++ b/tex/context/base/mkii/mult-de.mkii @@ -774,6 +774,8 @@ \setinterfaceconstant{deepnumbercommand}{deepnumbercommand} \setinterfaceconstant{deeptextcommand}{deeptextcommand} \setinterfaceconstant{default}{default} +\setinterfaceconstant{defaultheight}{defaultheight} +\setinterfaceconstant{defaultwidth}{defaultwidth} \setinterfaceconstant{define}{define} \setinterfaceconstant{delay}{wartezeit} \setinterfaceconstant{depth}{tiefe} @@ -1118,6 +1120,7 @@ \setinterfaceconstant{print}{print} \setinterfaceconstant{printable}{druckbar} \setinterfaceconstant{process}{process} +\setinterfaceconstant{processors}{processors} \setinterfaceconstant{profile}{profile} \setinterfaceconstant{properties}{properties} \setinterfaceconstant{pubsep}{pubsep} @@ -1131,6 +1134,7 @@ \setinterfaceconstant{reference}{referenz} \setinterfaceconstant{referencemethod}{referencemethod} \setinterfaceconstant{referenceprefix}{referenceprefix} +\setinterfaceconstant{referencetext}{referencetext} \setinterfaceconstant{referencing}{referieren} \setinterfaceconstant{region}{region} \setinterfaceconstant{regionin}{regionin} diff --git a/tex/context/base/mkiv/buff-imp-nested.mkiv b/tex/context/base/mkiv/buff-imp-nested.mkiv index f6a25b5f8..9a6a884f0 100644 --- a/tex/context/base/mkiv/buff-imp-nested.mkiv +++ b/tex/context/base/mkiv/buff-imp-nested.mkiv @@ -15,7 +15,7 @@ \unprotect -\unexpanded\def\donestedtypingstart{\bgroup\swaptypeface{}} -\unexpanded\def\donestedtypingstop {\egroup{}} +\permanent\protected\def\donestedtypingstart{\bgroup\swaptypeface{}} +\permanent\protected\def\donestedtypingstop {\egroup{}} \protect \endinput diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 83ccdfaef..dfe225db7 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.02.01 13:17} +\newcontextversion{2021.02.05 17:41} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 66788f837..7ce8e0ca0 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.02.01 13:17} +\edef\contextversion{2021.02.05 17:41} %D Kind of special: diff --git a/tex/context/base/mkiv/core-uti.lua b/tex/context/base/mkiv/core-uti.lua index 60cf3d6a9..887ef9a75 100644 --- a/tex/context/base/mkiv/core-uti.lua +++ b/tex/context/base/mkiv/core-uti.lua @@ -43,7 +43,7 @@ local report_passes = logs.reporter("job","passes") job = job or { } local job = job -job.version = 1.31 +job.version = 1.32 job.packversion = 1.02 -- some day we will implement loading of other jobs and then we need diff --git a/tex/context/base/mkiv/good-ctx.lua b/tex/context/base/mkiv/good-ctx.lua index 7a25baf93..80672676c 100644 --- a/tex/context/base/mkiv/good-ctx.lua +++ b/tex/context/base/mkiv/good-ctx.lua @@ -32,6 +32,7 @@ local fontgoodies = fonts.goodies or { } local nuts = nodes.nuts local tonut = nuts.tonut local getattr = nuts.getattr +local getprop = nuts.getprop local nextglyph = nuts.traversers.glyph -- colorschemes @@ -61,8 +62,10 @@ local function setcolorscheme(tfmdata,scheme) local characters = tfmdata.characters for i=1,#what do local w = what[i] - for j=1,#w do - local name = w[j] + local force = w.force + local list = w.list or w + for j=1,#list do + local name = list[j] local kind = type(name) if name == "*" then -- inefficient but only used for tracing anyway @@ -81,10 +84,16 @@ local function setcolorscheme(tfmdata,scheme) -- limited usage: we only deal with non reassigned -- maybe some day I'll also support the ones with a -- tounicode in this range - for unicode=start,stop do - if characters[unicode] then + if force then + for unicode=start,stop do reverse[unicode] = i end + else + for unicode=start,stop do + if characters[unicode] then + reverse[unicode] = i + end + end end end else @@ -150,6 +159,13 @@ function colorschemes.coloring(head) if f ~= lastfont then lastfont = f lastscheme = fontproperties[f].colorscheme + if not lastscheme then + local p = getprop(n, "original") + if p then + lastfont = p.font + lastscheme = fontproperties[lastfont].colorscheme + end + end end if a ~= lastattr then lastattr = a diff --git a/tex/context/base/mkiv/meta-ini.mkiv b/tex/context/base/mkiv/meta-ini.mkiv index 52aafac62..9305a0495 100644 --- a/tex/context/base/mkiv/meta-ini.mkiv +++ b/tex/context/base/mkiv/meta-ini.mkiv @@ -883,11 +883,8 @@ {\meta_prepare_instance_variable{#1}% \edef\overlaystamp{\overlaystamp:\MPvariable{#1}}} -\unexpanded\def\getMPdata {\clf_getMPdata} - \let\rawMPdata \clf_getMPdata - -\unexpanded\def\getMPstored{\clf_getMPstored} - \let\rawMPstored \clf_getMPstored +\unexpanded\def\getMPdata{\clf_getMPdata} + \let\rawMPdata \clf_getMPdata %D We need this trick because we need to make sure that the tex scanner sees %D newlines and does not quit. Also, we do need to flush the buffer under a normal diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index 450238c16..0f2ef419c 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -8564,6 +8564,9 @@ return { ["fr"]="entrees", ["nl"]="ingangen", }, + ["processors"]={ + ["en"]="processors", + }, ["equalheight"]={ ["cs"]="equalheight", ["de"]="equalheight", diff --git a/tex/context/base/mkiv/page-lay.mkiv b/tex/context/base/mkiv/page-lay.mkiv index bec9dc7ce..6f41f3bd8 100644 --- a/tex/context/base/mkiv/page-lay.mkiv +++ b/tex/context/base/mkiv/page-lay.mkiv @@ -551,8 +551,8 @@ \doglobal\swapdimens\paperwidth\paperheight \fi \ifinpagebody % local freeze - \normalexpanded{\setlayouttargetparemeter\c!height{\the\paperheight}}% - \normalexpanded{\setlayouttargetparemeter\c!width {\the\paperwidth }}% + \normalexpanded{\setlayouttargetparameter\c!height{\the\paperheight}}% + \normalexpanded{\setlayouttargetparameter\c!width {\the\paperwidth }}% \fi % \page_paper_set_offsets diff --git a/tex/context/base/mkiv/spac-hor.mkiv b/tex/context/base/mkiv/spac-hor.mkiv index 5c7163822..16a1a0d4e 100644 --- a/tex/context/base/mkiv/spac-hor.mkiv +++ b/tex/context/base/mkiv/spac-hor.mkiv @@ -478,11 +478,20 @@ %D from now on we treat it as a normal space and not as a space with \type %D {sfcode} 1000. +% \unexpanded\def\specialspaceprimitive +% {\begingroup +% % so, no fancy extra spacing after: foo i.e.\ bar +% \nonfrenchspacing\normalspaceprimitive +% \endgroup} + \unexpanded\def\specialspaceprimitive - {\begingroup - % so, no fancy extra spacing after: foo i.e.\ bar - \nonfrenchspacing\normalspaceprimitive - \endgroup} + {% is a current state, set explicitly or when a character is appended + \ifhmode + \spacefactor\plusthousand + \else + \dontleavehmode + \fi + \normalspaceprimitive} \unexpanded\def\normalnotobeyedspace {\mathortext\normalspaceprimitive\specialspaceprimitive} % no \dontleavehmode\space (else no frenchspacing) diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 4fa124525..35efbfdcb 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index 022a29167..b5fcc04ae 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkiv/strc-reg.lua b/tex/context/base/mkiv/strc-reg.lua index 6873f89eb..6e26f6f37 100644 --- a/tex/context/base/mkiv/strc-reg.lua +++ b/tex/context/base/mkiv/strc-reg.lua @@ -460,6 +460,7 @@ local function preprocessentries(rawdata) local processors = rawdata.processors local et = entries.entries local kt = entries.keys + local pt = entries.processors local entryproc = processors and processors.entry local pageproc = processors and processors.page local coding = rawdata.metadata.coding @@ -483,16 +484,20 @@ local function preprocessentries(rawdata) end kt = lpegmatch(coding == "xml" and entrysplitter_xml or entrysplitter_tex,k) end + if not pt then + pt = { } + end -- entries = { } local ok = false for k=#et,1,-1 do local etk = et[k] local ktk = kt[k] + local ptk = pt[k] if not ok and etk == "" then entries[k] = nil else - entries[k] = { etk or "", ktk ~= "" and ktk or nil } + entries[k] = { etk or "", ktk ~= "" and ktk or false, ptk ~= "" and ptk or false } ok = true end end @@ -677,31 +682,33 @@ implement { { "catcodes", "integer" }, { "own" }, { "xmlroot" }, - { "xmlsetup" } + { "xmlsetup" }, } }, { "entries", { { "entries", "list" }, { "keys", "list" }, + { "processors", "list" }, { "entry" }, - { "key" } + { "key" }, + { "processor" }, } }, { "references", { { "internal", "integer" }, { "section", "integer" }, { "view" }, - { "label" } + { "label" }, } }, { "seeword", { - { "text" } + { "text" }, } }, { "processors", { { "entry" }, { "key" }, - { "page" } + { "page" }, } }, { "userdata" }, @@ -1258,6 +1265,7 @@ function registers.flush(data,options,prefixspec,pagespec) while d < #data do d = d + 1 local entry = data[d] +-- inspect(entry) local metadata = entry.metadata local kind = metadata.kind local list = entry.list @@ -1266,8 +1274,9 @@ function registers.flush(data,options,prefixspec,pagespec) e[i] = false end for i=1,maxlevel do + local li = list[i] if list[i] then - e[i] = list[i][1] + e[i] = li[1] end if e[i] == done[i] then -- skip @@ -1309,7 +1318,7 @@ function registers.flush(data,options,prefixspec,pagespec) local processors = entry.processors local internal = references.internal or 0 local seeparent = references.seeparent or "" - local processor = processors and processors[1] or "" + local processor = (li and li[3]) or (processors and processors[1]) or "" -- so, we need to keep e as is (local), or we need local title = e[i] ... which might be -- more of a problem ctx_startregisterentry(0) -- will become a counter diff --git a/tex/context/base/mkiv/symb-imp-nav.mkiv b/tex/context/base/mkiv/symb-imp-nav.mkiv index 6e2f2c1f0..ce5b1d76a 100644 --- a/tex/context/base/mkiv/symb-imp-nav.mkiv +++ b/tex/context/base/mkiv/symb-imp-nav.mkiv @@ -24,7 +24,7 @@ \definefontsynonym [ContextNavigation] [contnav] -\def\ContextNavigationGlyph{\getnamedglyphdirect{ContextNavigation}} % #1 +\permanent\protected\def\ContextNavigationGlyph{\getnamedglyphdirect{ContextNavigation}} % #1 \startsymbolset [navigation 1] @@ -122,8 +122,15 @@ \stopsymbolset -%D \showsymbolset[navigation 1] -%D \showsymbolset[navigation 2] -%D \showsymbolset[navigation 3] +\protect -\protect \endinput +\continueifinputfile{symb-imp-nav.mkiv} + +\starttext + \showsymbolset[navigation 1]\page + \showsymbolset[navigation 2]\page + \showsymbolset[navigation 3]\page + \ContextNavigationGlyph{char03}\quad + \ContextNavigationGlyph{char67}\quad + \ContextNavigationGlyph{charcb} +\stoptext diff --git a/tex/context/base/mkxl/buff-par.mklx b/tex/context/base/mkxl/buff-par.mklx index ddafd7e14..b6ffa3f53 100644 --- a/tex/context/base/mkxl/buff-par.mklx +++ b/tex/context/base/mkxl/buff-par.mklx @@ -137,7 +137,7 @@ \mutable\let\currentparallellabel \empty \mutable\let\currentparallelcontent \empty -\def\doflushparallel#instance#status#line#label#content% called at lua end +\permanent\protected\def\doflushparallel#instance#status#line#label#content% called at lua end {\begingroup \def\currentparallelinstance{#instance}% \def\currentparallelnumber {#status}% diff --git a/tex/context/base/mkxl/buff-ver.mkxl b/tex/context/base/mkxl/buff-ver.mkxl index 11ad92784..7a34729fb 100644 --- a/tex/context/base/mkxl/buff-ver.mkxl +++ b/tex/context/base/mkxl/buff-ver.mkxl @@ -424,10 +424,10 @@ \aftergroup\egroup \let\nexttoken} -\protected\def\tex{\buff_verbatim_special_type\texescape \relax} -\protected\def\arg{\buff_verbatim_special_type\leftargument \rightargument} -\protected\def\mat{\buff_verbatim_special_type\inlinemathmarker \inlinemathmarker} -\protected\def\dis{\buff_verbatim_special_type\displaymathmarker\displaymathmarker} +\mutable\protected\def\tex{\buff_verbatim_special_type\texescape \relax} +\mutable\protected\def\arg{\buff_verbatim_special_type\leftargument \rightargument} +\mutable\protected\def\mat{\buff_verbatim_special_type\inlinemathmarker \inlinemathmarker} +\mutable\protected\def\dis{\buff_verbatim_special_type\displaymathmarker\displaymathmarker} \aliased\let\normaltexttex\tex \aliased\let\normaltextarg\arg @@ -930,25 +930,25 @@ \newcount \c_buff_verbatim_current \newconditional\c_buff_optimize_linebreaks - \def\doverbatimspace {\obeyedspace} - -\protected\def\doinlineverbatimstart {} -\protected\def\doinlineverbatimstop {} -\protected\def\doinlineverbatimbeginline {} -\protected\def\doinlineverbatimnewline {\obeyedspace} -\protected\def\doinlineverbatimemptyline {\obeyedspace} - -\protected\def\dodisplayverbatimstart {\advance\c_buff_verbatim_current\plusone - \buff_verbatim_begin_of_line} -\protected\def\dodisplayverbatimstop {\buff_verbatim_end_of_line} -\protected\def\dodisplayverbatimbeginline{\advance\c_buff_verbatim_current\plusone - \buff_verbatim_begin_of_line} -\protected\def\dodisplayverbatimnewline {\buff_verbatim_end_of_line - \par - \ifconditional\c_buff_optimize_linebreaks - \buff_verbatim_inject_breaks - \fi} -\protected\def\dodisplayverbatimemptyline{\buff_verbatim_empty_line} +\permanent\protected\def\doverbatimspace {\obeyedspace} + +\permanent\protected\def\doinlineverbatimstart {} +\permanent\protected\def\doinlineverbatimstop {} +\permanent\protected\def\doinlineverbatimbeginline {} +\permanent\protected\def\doinlineverbatimnewline {\obeyedspace} +\permanent\protected\def\doinlineverbatimemptyline {\obeyedspace} + +\permanent\protected\def\dodisplayverbatimstart {\advance\c_buff_verbatim_current\plusone + \buff_verbatim_begin_of_line} +\permanent\protected\def\dodisplayverbatimstop {\buff_verbatim_end_of_line} +\permanent\protected\def\dodisplayverbatimbeginline{\advance\c_buff_verbatim_current\plusone + \buff_verbatim_begin_of_line} +\permanent\protected\def\dodisplayverbatimnewline {\buff_verbatim_end_of_line + \par + \ifconditional\c_buff_optimize_linebreaks + \buff_verbatim_inject_breaks + \fi} +\permanent\protected\def\dodisplayverbatimemptyline{\buff_verbatim_empty_line} \protected\def\buff_verbatim_inject_breaks {\ifnum\c_buff_verbatim_current=\plusone @@ -993,6 +993,6 @@ %D This is \type {\asciimode} without the double comment hackery: -\protected\def\literalmode{\setcatcodetable\txtcatcodes} +\permanent\protected\def\literalmode{\setcatcodetable\txtcatcodes} \protect \endinput diff --git a/tex/context/base/mkxl/catc-def.mkxl b/tex/context/base/mkxl/catc-def.mkxl index a67d94e44..b7332a41d 100644 --- a/tex/context/base/mkxl/catc-def.mkxl +++ b/tex/context/base/mkxl/catc-def.mkxl @@ -266,8 +266,8 @@ \chardef \| = \barasciicode \pushoverloadmode - \catcodetable \ctxcatcodes - \let \defaultcatcodetable \ctxcatcodes + \catcodetable \ctxcatcodes + \aliased\let\defaultcatcodetable\ctxcatcodes \popoverloadmode \endinput diff --git a/tex/context/base/mkxl/catc-ini.mkxl b/tex/context/base/mkxl/catc-ini.mkxl index c7427a40c..7f1a89f6c 100644 --- a/tex/context/base/mkxl/catc-ini.mkxl +++ b/tex/context/base/mkxl/catc-ini.mkxl @@ -20,21 +20,21 @@ %D file. There is some overlap in code with \MKII\ but we take that for granted. %D Also, in \MKIV\ less active characters are used. -\begingroup - \letcharcode\newlineasciicode\relax \xdef\outputnewlinechar{\Uchar\newlineasciicode} -\endgroup +% \begingroup +% \letcharcode\newlineasciicode\relax \xdef\outputnewlinechar{\Uchar\newlineasciicode} +% \endgroup % \endlinechar = \endoflineasciicode % appended to input lines % \newlinechar = \newlineasciicode % can be used in write % rather special and used in writing to file: \let\par\outputnewlinechar -\permanent\protected\def\initializenewlinechar % operating system dependent - {\begingroup - \letcharcode\newlineasciicode\relax - \newlinechar\newlineasciicode - \xdef\outputnewlinechar{\Uchar\newlineasciicode}% - \endgroup} +% \permanent\protected\def\initializenewlinechar % operating system dependent +% {\begingroup +% \enforced\letcharcode\newlineasciicode\relax +% \newlinechar\newlineasciicode +% \xdef\outputnewlinechar{\Uchar\newlineasciicode}% +% \endgroup} %D We predefine some prefixes ahead of syst-aux and mult-sys. We reserve 8 slots for %D catcodes. (This active mess probably needs an update some day.) diff --git a/tex/context/base/mkxl/colo-ini.mkxl b/tex/context/base/mkxl/colo-ini.mkxl index 7dfa541db..0e3ea9c6f 100644 --- a/tex/context/base/mkxl/colo-ini.mkxl +++ b/tex/context/base/mkxl/colo-ini.mkxl @@ -806,8 +806,6 @@ \begincsname\??transparencysetter\currentcolorparameter\endcsname \fi} -\let\dosetcolorattribute\dousecolorhashparameter % for a while - \permanent\protected\def\deactivatecolor % sort of public but a bad name {\let\currentcolorname\s!black \c_attr_color \attributeunsetvalue @@ -1071,8 +1069,8 @@ %D \stopregistercolor %D \stoptyping -\let\maintextcolor \empty -\def\defaulttextcolor{black} +\mutable\let\maintextcolor \empty +\mutable\def\defaulttextcolor{black} \permanent\protected\def\inheritmaintextcolor {\ifempty\maintextcolor\else\colo_helpers_activate\maintextcolor\fi} diff --git a/tex/context/base/mkxl/cont-cs.mkxl b/tex/context/base/mkxl/cont-cs.mkxl index 8e5ae567c..2167b568f 100644 --- a/tex/context/base/mkxl/cont-cs.mkxl +++ b/tex/context/base/mkxl/cont-cs.mkxl @@ -13,8 +13,8 @@ \catcode`\{=1 \catcode`\}=2 -\def\defaultinterface {czech} -\def\defaultlanguagetag{cs} +\immutable\def\defaultinterface {czech} +\immutable\def\defaultlanguagetag{cs} \input context.mkxl diff --git a/tex/context/base/mkxl/cont-de.mkxl b/tex/context/base/mkxl/cont-de.mkxl index 579cc88c3..1f54bbb30 100644 --- a/tex/context/base/mkxl/cont-de.mkxl +++ b/tex/context/base/mkxl/cont-de.mkxl @@ -13,8 +13,8 @@ \catcode`\{=1 \catcode`\}=2 -\def\defaultinterface {german} -\def\defaultlanguagetag{de} +\immutable\def\defaultinterface {german} +\immutable\def\defaultlanguagetag{de} \input context.mkxl diff --git a/tex/context/base/mkxl/cont-en.mkxl b/tex/context/base/mkxl/cont-en.mkxl index bfb17ffb3..5dd02f7d4 100644 --- a/tex/context/base/mkxl/cont-en.mkxl +++ b/tex/context/base/mkxl/cont-en.mkxl @@ -13,8 +13,8 @@ \catcode`\{=1 \catcode`\}=2 -\def\defaultinterface {english} -\def\defaultlanguagetag{en} +\immutable\def\defaultinterface {english} +\immutable\def\defaultlanguagetag{en} \input context.mkxl diff --git a/tex/context/base/mkxl/cont-fr.mkxl b/tex/context/base/mkxl/cont-fr.mkxl index bedae536b..baee1ec71 100644 --- a/tex/context/base/mkxl/cont-fr.mkxl +++ b/tex/context/base/mkxl/cont-fr.mkxl @@ -13,8 +13,8 @@ \catcode`\{=1 \catcode`\}=2 -\def\defaultinterface {french} -\def\defaultlanguagetag{fr} +\immutable\def\defaultinterface {french} +\immutable\def\defaultlanguagetag{fr} \input context.mkxl diff --git a/tex/context/base/mkxl/cont-gb.mkxl b/tex/context/base/mkxl/cont-gb.mkxl index 464b237da..0c3197a3e 100644 --- a/tex/context/base/mkxl/cont-gb.mkxl +++ b/tex/context/base/mkxl/cont-gb.mkxl @@ -13,8 +13,8 @@ \catcode`\{=1 \catcode`\}=2 -\def\defaultinterface {english} -\def\defaultlanguagetag{gb} +\immutable\def\defaultinterface {english} +\immutable\def\defaultlanguagetag{gb} \input context.mkxl diff --git a/tex/context/base/mkxl/cont-it.mkxl b/tex/context/base/mkxl/cont-it.mkxl index 1702a872f..0491c2efd 100644 --- a/tex/context/base/mkxl/cont-it.mkxl +++ b/tex/context/base/mkxl/cont-it.mkxl @@ -13,8 +13,8 @@ \catcode`\{=1 \catcode`\}=2 -\def\defaultinterface {italian} -\def\defaultlanguagetag{it} +\immutable\def\defaultinterface {italian} +\immutable\def\defaultlanguagetag{it} \input context.mkxl diff --git a/tex/context/base/mkxl/cont-log.mkxl b/tex/context/base/mkxl/cont-log.mkxl index d2d8e0e4f..f35c6f169 100644 --- a/tex/context/base/mkxl/cont-log.mkxl +++ b/tex/context/base/mkxl/cont-log.mkxl @@ -122,11 +122,11 @@ %D The \METAFONT\ and \METAPOST\ logos adapt themselves to the current fontsize, an %D ugly but usefull hack. -\let\logofont\nullfont +\mutable\let\logofont\nullfont % \loadmapfile[original-base.map] % stil needed? not if we assume afm -\protected\def\setMFPfont% more sensitive for low level changes +\permanent\protected\def\setMFPfont% more sensitive for low level changes {\font\logofont=logo% \ifx\fontalternative\s!bf\s!bf\orelse \ifx\fontalternative\s!it\s!sl\orelse diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 92dddab22..c130a9440 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.02.01 13:17} +\newcontextversion{2021.02.05 17:41} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/cont-nl.mkxl b/tex/context/base/mkxl/cont-nl.mkxl index 1f00e7e89..5e74114e5 100644 --- a/tex/context/base/mkxl/cont-nl.mkxl +++ b/tex/context/base/mkxl/cont-nl.mkxl @@ -13,8 +13,8 @@ \catcode`\{=1 \catcode`\}=2 -\def\defaultinterface {dutch} -\def\defaultlanguagetag{nl} +\immutable\def\defaultinterface {dutch} +\immutable\def\defaultlanguagetag{nl} \input context.mkxl diff --git a/tex/context/base/mkxl/cont-pe.mkxl b/tex/context/base/mkxl/cont-pe.mkxl index 82bf73721..2242c3e0d 100644 --- a/tex/context/base/mkxl/cont-pe.mkxl +++ b/tex/context/base/mkxl/cont-pe.mkxl @@ -13,9 +13,9 @@ \catcode`\{=1 \catcode`\}=2 -\def\defaultinterface {persian} -\def\messageinterface {english} -\def\defaultlanguagetag{pe} +\immutable\def\defaultinterface {persian} +\immutable\def\messageinterface {english} +\immutable\def\defaultlanguagetag{pe} \input context.mkxl diff --git a/tex/context/base/mkxl/cont-ro.mkxl b/tex/context/base/mkxl/cont-ro.mkxl index 6d636c7dc..ced28ba3d 100644 --- a/tex/context/base/mkxl/cont-ro.mkxl +++ b/tex/context/base/mkxl/cont-ro.mkxl @@ -13,8 +13,8 @@ \catcode`\{=1 \catcode`\}=2 -\def\defaultinterface {romanian} -\def\defaultlanguagetag{ro} +\immutable\def\defaultinterface {romanian} +\immutable\def\defaultlanguagetag{ro} \input context.mkxl diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 78aa7bf93..abd86d3cd 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2021.02.01 13:17} +\immutable\edef\contextversion{2021.02.05 17:41} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error @@ -65,9 +65,9 @@ %D Some checking (more primitives are now defined): -\ifdefined\defaultinterface \else \def\defaultinterface {english} \fi -%ifdefined\messageinterface \else \let\messageinterface \defaultinterface \fi -\ifdefined\defaultlanguagetag \else \def\defaultlanguagetag{en} \fi +\ifdefined\defaultinterface \else \immutable\def\defaultinterface {english} \fi +%ifdefined\messageinterface \else \immutable\let\messageinterface \defaultinterface \fi +\ifdefined\defaultlanguagetag \else \immutable\def\defaultlanguagetag{en} \fi %D There is only this way to pass the version info to \LUA\ (currently). Hm, we could %D now put it into the environment. @@ -80,7 +80,7 @@ \loadmkxlfile{norm-ctx} \loadmkxlfile{syst-pln} -\loadmkxlfile{syst-mes} +%loadmkxlfile{syst-mes} \loadmkxlfile{luat-cod} \loadmkxlfile{luat-bas} diff --git a/tex/context/base/mkxl/core-con.mkxl b/tex/context/base/mkxl/core-con.mkxl index bfa8079e6..e2e23298c 100644 --- a/tex/context/base/mkxl/core-con.mkxl +++ b/tex/context/base/mkxl/core-con.mkxl @@ -177,15 +177,6 @@ \box\scratchbox \egroup} -%D \macros -%D {protectconversion} -%D -%D The previous two commands are not robust enough to be passed to \type -%D {\write} en \type{\message}. That's why we introduce: - -\permanent\protected\def\protectconversion - {\let\doconvertcharacters\firstofoneargument} - %D \macros %D {normaltime,normalyear,normalmonth,normalday} %D @@ -526,11 +517,9 @@ #3}% \endgroup} -\def\lastmonth{12} % can be set to e.g. 1 when testing - \permanent\protected\def\processyear#1#2#3#4% year command before after {\begingroup - \dorecurse\lastmonth + \dorecurse\plustwelve {\normalyear #1\relax \normalmonth\recurselevel\relax #3\processmonth\normalyear\normalmonth{#2}#4}% @@ -977,9 +966,9 @@ %D Taken from x-asciimath (see digits-001.tex for an example): -\let\spaceddigitsmethod \empty % alternative methods : 1 default, 2 and 3 only when > 4 -\let\spaceddigitssymbol \empty % extra splitter symbol : {,} -\let\spaceddigitsseparator\empty % separator symbol : {\Uchar{"2008}} +\mutable\let\spaceddigitsmethod \empty % alternative methods : 1 default, 2 and 3 only when > 4 +\mutable\let\spaceddigitssymbol \empty % extra splitter symbol : {,} +\mutable\let\spaceddigitsseparator\empty % separator symbol : {\Uchar{"2008}} \permanent\protected\def\spaceddigits#1% {\clf_spaceddigits diff --git a/tex/context/base/mkxl/core-def.mkxl b/tex/context/base/mkxl/core-def.mkxl index c7baf9ab1..e82026d21 100644 --- a/tex/context/base/mkxl/core-def.mkxl +++ b/tex/context/base/mkxl/core-def.mkxl @@ -107,7 +107,7 @@ \appendtoks \showcontextbanner - \initializenewlinechar + %\initializenewlinechar \calculatecurrenttime \syst_files_load % for the moment here (before doc env) @@ -149,7 +149,7 @@ % temporary here: \pushoverloadmode - \frozen\protected\def\arg{\mathortext\normalmatharg\normaltextarg} + \frozen\protected\def\arg{\mathortext\normalmatharg\normaltextarg} % might be overloaded \popoverloadmode % might move to \everydump or even disappear: diff --git a/tex/context/base/mkxl/core-env.mkxl b/tex/context/base/mkxl/core-env.mkxl index c90b92f22..4e040d632 100644 --- a/tex/context/base/mkxl/core-env.mkxl +++ b/tex/context/base/mkxl/core-env.mkxl @@ -306,16 +306,49 @@ \installmacrostack\c_syst_modes_set_done +% \permanent\protected\def\startmodeset +% {\push_macro_c_syst_modes_set_done +% \setfalse\c_syst_modes_set_done +% \doifelsenextoptionalcs\syst_modes_set_start\syst_modes_set_quit} +% +% \aliased\let\stopmodeset\relax +% +% \def\syst_modes_set_start[#1]% +% {\edef\m_mode_case{#1}% +% \unless\ifx\m_mode_case\s!default +% \expandafter\syst_modes_set_check +% \orelse\ifconditional\c_syst_modes_set_done +% \expandafter\syst_modes_set_quit +% \else +% \expandafter\syst_modes_set_yes +% \fi} +% +% \def\syst_modes_set_check +% {\syst_modes_check_lr\syst_modes_set_yes\syst_modes_set_nop\m_mode_case} +% +% \def\syst_modes_set_yes#1% +% {\settrue\c_syst_modes_set_done +% #1% +% \doifelsenextoptionalcs\syst_modes_set_start\syst_modes_set_quit} +% +% \def\syst_modes_set_nop#1% +% {\doifelsenextoptionalcs\syst_modes_set_start\syst_modes_set_quit} +% +% \def\syst_modes_set_quit#-\stopmodeset +% {\pop_macro_c_syst_modes_set_done} + \permanent\protected\def\startmodeset {\push_macro_c_syst_modes_set_done \setfalse\c_syst_modes_set_done - \doifelsenextoptionalcs\syst_modes_set_start\syst_modes_set_quit} + \syst_modes_set_start} \aliased\let\stopmodeset\relax -\def\syst_modes_set_start[#1]% +\tolerant\def\syst_modes_set_start#.[#1]% skip spaces and pars {\edef\m_mode_case{#1}% - \unless\ifx\m_mode_case\s!default + \ifempty\m_mode_case + \expandafter\syst_modes_set_quit + \orunless\ifx\m_mode_case\s!default \expandafter\syst_modes_set_check \orelse\ifconditional\c_syst_modes_set_done \expandafter\syst_modes_set_quit @@ -326,13 +359,13 @@ \def\syst_modes_set_check {\syst_modes_check_lr\syst_modes_set_yes\syst_modes_set_nop\m_mode_case} -\def\syst_modes_set_yes#1% +\tolerant\def\syst_modes_set_yes#1% {\settrue\c_syst_modes_set_done #1% - \doifelsenextoptionalcs\syst_modes_set_start\syst_modes_set_quit} + \syst_modes_set_start} -\def\syst_modes_set_nop#1% - {\doifelsenextoptionalcs\syst_modes_set_start\syst_modes_set_quit} +\tolerant\def\syst_modes_set_nop#1% + {\syst_modes_set_start} \def\syst_modes_set_quit#-\stopmodeset {\pop_macro_c_syst_modes_set_done} @@ -610,6 +643,8 @@ \permanent\protected\def\setgvariables{\syst_variables_set[\getrawgparameters]} \permanent\protected\def\setxvariables{\syst_variables_set[\getrawxparameters]} +\mutable\let\currentvariableclass\empty + \tolerant\def\syst_variables_set[#1]#*[#2]#*[#3]% tricky, test on s-pre-60 {\doifelse{#2}\currentvariableclass {#1[\??variables#2:][#3]}% diff --git a/tex/context/base/mkxl/core-ini.mkxl b/tex/context/base/mkxl/core-ini.mkxl index 94a0faeb9..ce6121061 100644 --- a/tex/context/base/mkxl/core-ini.mkxl +++ b/tex/context/base/mkxl/core-ini.mkxl @@ -207,13 +207,13 @@ \aliased\let\stopboxedcontent\egroup -%D We store some original meanings, maybe in \type {math-ini}. - -\let\normalat \at -\let\normalin \in -\let\normalfrom \from -%let\normalover \over -\let\normalabout\about +% %D We store some original meanings, maybe in \type {math-ini}. +% +% \let\normalat \at +% \let\normalin \in +% \let\normalfrom \from +% \let\normalover \over +% \let\normalabout\about %D This will be implemented way later: diff --git a/tex/context/base/mkxl/core-sys.mkxl b/tex/context/base/mkxl/core-sys.mkxl index e27e0734d..946e5630f 100644 --- a/tex/context/base/mkxl/core-sys.mkxl +++ b/tex/context/base/mkxl/core-sys.mkxl @@ -23,7 +23,7 @@ \permanent\protected\def\newcontextversion#1% {\doifelse{#1}\contextversion - {\let\newcontextversion\gobbleoneargument} + {\aliased\let\newcontextversion\gobbleoneargument} {\writeline \writestatus{Fatal Error}{Your format does not match the base files!}% \writeline diff --git a/tex/context/base/mkxl/core-two.mkxl b/tex/context/base/mkxl/core-two.mkxl index 322765a39..cadd9d059 100644 --- a/tex/context/base/mkxl/core-two.mkxl +++ b/tex/context/base/mkxl/core-two.mkxl @@ -84,6 +84,7 @@ \mutable\let\twopassdata \empty \mutable\let\twopassdatalist\empty +\mutable\let\noftwopassitems\!!zeropoint \def\syst_twopass_check % can be delegated to lua once obsolete is gone {\ifempty\twopassdata diff --git a/tex/context/base/mkxl/core-uti.lua b/tex/context/base/mkxl/core-uti.lua index 60cf3d6a9..887ef9a75 100644 --- a/tex/context/base/mkxl/core-uti.lua +++ b/tex/context/base/mkxl/core-uti.lua @@ -43,7 +43,7 @@ local report_passes = logs.reporter("job","passes") job = job or { } local job = job -job.version = 1.31 +job.version = 1.32 job.packversion = 1.02 -- some day we will implement loading of other jobs and then we need diff --git a/tex/context/base/mkxl/enco-ini.mkxl b/tex/context/base/mkxl/enco-ini.mkxl index f8487d697..24ebc92a1 100644 --- a/tex/context/base/mkxl/enco-ini.mkxl +++ b/tex/context/base/mkxl/enco-ini.mkxl @@ -173,16 +173,16 @@ %D Math (will move): -\definemathaccent acute \mathacute -\definemathaccent grave \mathgrave -\definemathaccent ddot \mathddot -\definemathaccent tilde \mathtilde -\definemathaccent bar \mathbar -\definemathaccent breve \mathbreve -\definemathaccent check \mathcheck -\definemathaccent hat \mathhat -\definemathaccent vec \mathvec -\definemathaccent dot \mathdot +%definemathaccent acute \mathacute +%definemathaccent grave \mathgrave +%definemathaccent ddot \mathddot +%definemathaccent tilde \mathtilde +%definemathaccent bar \mathbar +%definemathaccent breve \mathbreve +%definemathaccent check \mathcheck +%definemathaccent hat \mathhat +%definemathaccent vec \mathvec +%definemathaccent dot \mathdot %definemathaccent widetilde \mathwidetilde %definemathaccent widehat \mathwidehat diff --git a/tex/context/base/mkxl/file-job.mklx b/tex/context/base/mkxl/file-job.mklx index cb6ea13cc..d898a3c07 100644 --- a/tex/context/base/mkxl/file-job.mklx +++ b/tex/context/base/mkxl/file-job.mklx @@ -80,12 +80,12 @@ \ifdefined\textlevel \else \newcount\textlevel \fi % might go away \ifdefined\strc_pagenumbers_flush_final_page \else \let\strc_pagenumbers_flush_final_page\relax \fi % ugly -\protected\def\dostarttext +\permanent\protected\def\dostarttext {\enforced\glet\dostarttext\relax \the\everystarttext \global\everystarttext\emptytoks} -\protected\def\dostoptext +\permanent\protected\def\dostoptext {\enforced\glet\dostoptext\relax \strc_pagenumbers_flush_final_page \page % hm, bonus diff --git a/tex/context/base/mkxl/font-chk.lmt b/tex/context/base/mkxl/font-chk.lmt index 8e73d1b3c..9f5aa2aab 100644 --- a/tex/context/base/mkxl/font-chk.lmt +++ b/tex/context/base/mkxl/font-chk.lmt @@ -113,125 +113,153 @@ end fonts.loggers.onetimemessage = onetimemessage local fakes = { - lowercase = { width = .45, height = .55, depth = .20 }, - uppercase = { width = .65, height = .70, depth = .25 }, - mark = { width = .15, height = .70, depth = -.50 }, - punctuation = { width = .15, height = .55, depth = .20 }, - unknown = { width = .45, height = .20, depth = 0 }, + MissingLowercase = { width = .45, height = .55, depth = .20 }, + MissingUppercase = { width = .65, height = .70, depth = .25 }, + MissingMark = { width = .15, height = .70, depth = -.50 }, + MissingPunctuation = { width = .15, height = .55, depth = .20 }, + MissingUnknown = { width = .45, height = .20, depth = 0 }, } local mapping = allocate { - lu = { "uppercase", "darkred" }, - ll = { "lowercase", "darkred" }, - lt = { "uppercase", "darkred" }, - lm = { "lowercase", "darkred" }, - lo = { "lowercase", "darkred" }, - mn = { "mark", "darkgreen" }, - mc = { "mark", "darkgreen" }, - me = { "mark", "darkgreen" }, - nd = { "lowercase", "darkblue" }, - nl = { "lowercase", "darkblue" }, - no = { "lowercase", "darkblue" }, - pc = { "punctuation", "darkcyan" }, - pd = { "punctuation", "darkcyan" }, - ps = { "punctuation", "darkcyan" }, - pe = { "punctuation", "darkcyan" }, - pi = { "punctuation", "darkcyan" }, - pf = { "punctuation", "darkcyan" }, - po = { "punctuation", "darkcyan" }, - sm = { "lowercase", "darkmagenta" }, - sc = { "lowercase", "darkyellow" }, - sk = { "lowercase", "darkyellow" }, - so = { "lowercase", "darkyellow" }, + lu = { "MissingUppercase", "darkred" }, + ll = { "MissingLowercase", "darkred" }, + lt = { "MissingUppercase", "darkred" }, + lm = { "MissingLowercase", "darkred" }, + lo = { "MissingLowercase", "darkred" }, + mn = { "MissingMark", "darkgreen" }, + mc = { "MissingMark", "darkgreen" }, + me = { "MissingMark", "darkgreen" }, + nd = { "MissingLowercase", "darkblue" }, + nl = { "MissingLowercase", "darkblue" }, + no = { "MissingLowercase", "darkblue" }, + pc = { "MissingPunctuation", "darkcyan" }, + pd = { "MissingPunctuation", "darkcyan" }, + ps = { "MissingPunctuation", "darkcyan" }, + pe = { "MissingPunctuation", "darkcyan" }, + pi = { "MissingPunctuation", "darkcyan" }, + pf = { "MissingPunctuation", "darkcyan" }, + po = { "MissingPunctuation", "darkcyan" }, + sm = { "MissingLowercase", "darkmagenta" }, + sc = { "MissingLowercase", "darkyellow" }, + sk = { "MissingLowercase", "darkyellow" }, + so = { "MissingLowercase", "darkyellow" }, } -table.setmetatableindex(mapping, { "unknown", "darkgray" }) +table.setmetatableindex(mapping, { "MissingUnknown", "darkgray" }) + +checkers.mapping = mapping -- We provide access by (private) name for tracing purposes. We also need -- to make sure the dimensions are known at the lua and tex end. -local cache = { } - -local function add(tfmdata,name,color,size,collected) - local hash = formatters["%s_%s_%i"](name,color,floor(size)) - local chardata = cache[hash] - if not chardata then - local fake = fakes[name] - local width = size * fake.width - local height = size * fake.height - local depth = size * fake.depth - chardata = { - width = width, - height = height, - depth = depth, - commands = { - { "frame", width, height, depth, 65536/5, false, true, true, color }, - } - } - cache[hash] = chardata - end - if not hasprivate(tfmdata,privatename) then - local privatename = formatters["placeholder %s %s"](name,color) - local privatecode = addprivate(tfmdata, privatename, chardata) - collected[privatecode] = chardata - end - return chardata -end - -local function addplaceholder(font,char) - local tfmdata = fontdata[font or true] - local characters = tfmdata.characters - local size = tfmdata.parameters.size - local scale = size * bpfactor - local collected = { } - local category = chardata[char].category or "unknown" - local fakedata = mapping[category] - local chardata = add(tfmdata,fakedata[1],fakedata[2],size,collected) - collected [char] = chardata - characters[char] = chardata - addcharacters(font, { characters = collected }) - return "char", char -- needed for math-noa -end +-- local cache = { } +-- +-- local function add(tfmdata,name,color,size,collected) +-- local hash = formatters["%s_%s_%i"](name,color,floor(size)) +-- local chardata = cache[hash] +-- if not chardata then +-- local fake = fakes[name] +-- local width = size * fake.width +-- local height = size * fake.height +-- local depth = size * fake.depth +-- chardata = { +-- width = width, +-- height = height, +-- depth = depth, +-- commands = { +-- { "frame", width, height, depth, 65536/5, false, true, true, color }, +-- } +-- } +-- cache[hash] = chardata +-- end +-- if not hasprivate(tfmdata,privatename) then +-- local privatename = formatters["placeholder %s %s"](name,color) +-- local privatecode = addprivate(tfmdata, privatename, chardata) +-- collected[privatecode] = chardata +-- end +-- return chardata +-- end +-- +-- function checkers.placeholder(font,char) +-- local tfmdata = fontdata[font or true] +-- local characters = tfmdata.characters +-- local size = tfmdata.parameters.size +-- local scale = size * bpfactor +-- local collected = { } +-- local category = chardata[char].category or "unknown" +-- local fakedata = mapping[category] +-- local chardata = add(tfmdata,fakedata[1],fakedata[2],size,collected) +-- collected [char] = chardata +-- characters[char] = chardata +-- addcharacters(font, { characters = collected }) +-- return "char", char -- needed for math-noa +-- end -- For old times sake we keep this: a whole bunch of fake symbols -local function addplaceholders(tfmdata) - local properties = tfmdata.properties - local size = tfmdata.parameters.size - local scale = size * bpfactor - local collected = { } - local colors = { "darkred", "darkgreen", "darkblue", "darkcyan", "darkmagenta", "darkyellow", "darkgray" } - for name, v in sortedhash(fakes) do - for i=1,#colors do - add(tfmdata,name,colors[i],size,collected) - end - end - if next(collected) then - local id = properties.id - if id then - addcharacters(id, { characters = collected }) - end - end +-- local function addplaceholders(tfmdata,feature,value) +-- if value then +-- local properties = tfmdata.properties +-- local size = tfmdata.parameters.size +-- local scale = size * bpfactor +-- local collected = { } +-- local colors = { "darkred", "darkgreen", "darkblue", "darkcyan", "darkmagenta", "darkyellow", "darkgray" } +-- for name, v in sortedhash(fakes) do +-- for i=1,#colors do +-- add(tfmdata,name,colors[i],size,collected) +-- end +-- end +-- if next(collected) then +-- local id = properties.id +-- if id then +-- addcharacters(id, { characters = collected }) +-- end +-- end +-- end +-- end + +-- local chardata = characters.data +-- local fontdata = fonts.hashes.identifiers +-- local mapping = fonts.checkers.mapping + +function checkers.placeholder(font,char) + local category = chardata[char].category or "lu" -- todo: unknown + local fakedata = mapping[category] + local tfmdata = fontdata[font] + local units = tfmdata.parameters.units or 1000 + local slant = (tfmdata.parameters.slant or 0)/65536 + local scale = units/1000 + local rawdata = tfmdata.shared and tfmdata.shared.rawdata + local weight = (rawdata and rawdata.metadata and rawdata.metadata.pfmweight or 400)/400 + local specification = { + code = "MissingGlyph", + scale = scale, + slant = slant, + weight = weight, + namespace = font, + shapes = { { shape = fakedata[1], color = fakedata[2] } }, + } + fonts.helpers.setmetaglyphs("missing", font, char, specification) end -registerotffeature { - name = "missing", - description = "missing symbols", - manipulators = { - base = addplaceholders, - node = addplaceholders, - } -} +-- registerotffeature { +-- name = "missing", +-- description = "missing symbols", +-- default = false, +-- manipulators = { +-- base = addplaceholders, +-- node = addplaceholders, +-- } +-- } -- fonts.loggers.add_placeholders = function(id) addplaceholders(fontdata[id or true]) end -- fonts.loggers.category_to_placeholder = mapping -checkers.placeholder = addplaceholder - function checkers.missing(head) local lastfont = nil local characters = nil if action == "replace" then + local addplaceholder = checkers.placeholder -- so we can overload for n, char, font in nextglyph, head do if font ~= lastfont then lastfont = font @@ -239,7 +267,10 @@ function checkers.missing(head) end if font > 0 and not characters[char] and is_character[chardata[char].category or "unknown"] then onetimemessage(font,char,"missing (will be flagged)") - addplaceholder(font,char) + local f, c = addplaceholder(font,char) + if f and c then + setchar(head, c, f) + end end end elseif action == "remove" then @@ -327,7 +358,6 @@ end checkers.getmissing = getmissing - do local reported = true @@ -345,14 +375,20 @@ do end end) + local loaded = false + trackers.register("fonts.missing", function(v) if v then enableaction("processors","fonts.checkers.missing") else disableaction("processors","fonts.checkers.missing") end - if v == "replace" then - otffeatures.defaults.missing = true + -- if v == "replace" then + -- otffeatures.defaults.missing = true + -- end + if not loaded and v == "replace" then + metapost.simple("simplefun",'loadfile("mp-miss.mpxl");') + loaded = true end action = v end) diff --git a/tex/context/base/mkxl/font-chk.mkxl b/tex/context/base/mkxl/font-chk.mkxl index 29b159fc2..f64756983 100644 --- a/tex/context/base/mkxl/font-chk.mkxl +++ b/tex/context/base/mkxl/font-chk.mkxl @@ -26,4 +26,30 @@ \permanent\protected\def\removemissingcharacters {\enabletrackers[fonts.missing=remove]} \permanent\protected\def\replacemissingcharacters{\enabletrackers[fonts.missing=replace]} +% \enableexperiments[fonts.compact] + +%D \starttyping +%D \replacemissingcharacters +%D +%D \startbuffer +%D \startlines[before=,after=] +%D \strut {\tf test \char 12345\ test \char 12346\ test} +%D \strut {\bf test \char 12345\ test \char 12346\ test} +%D \strut {\it test \char 12345\ test \char 12346\ test} +%D \strut {\bi test \char 12345\ test \char 12346\ test} +%D \strut {test ὀ ρ φ α ν ῖ ο ς test} +%D \stoplines +%D \stopbuffer +%D +%D \starttext +%D \startTEXpage[offset=2pt,strut=no] +%D \getbuffer +%D \switchtobodyfont[pagella] +%D \getbuffer +%D \switchtobodyfont[dejavu] +%D \getbuffer +%D \stopTEXpage +%D \stoptext +%D \stoptyping + \endinput diff --git a/tex/context/base/mkxl/font-col.lmt b/tex/context/base/mkxl/font-col.lmt index 05de35903..41d327400 100644 --- a/tex/context/base/mkxl/font-col.lmt +++ b/tex/context/base/mkxl/font-col.lmt @@ -26,6 +26,7 @@ local setfont = nuts.setfont local nextchar = nuts.traversers.char local getscales = nuts.getscales local setscales = nuts.setscales +local setprop = nuts.setprop local settings_to_hash = utilities.parsers.settings_to_hash @@ -238,11 +239,9 @@ function collections.clonevector(name) if factor then vector.factor = factor end -if texconditionals["c_font_compact"] then - if rscale then + if texconditionals["c_font_compact"] and rscale then vector.rscale = rscale end -end if trace_collecting then if target then report_fonts("remapping font %a to %a for range %U - %U, offset %X, target %U",current,cloneid,start,stop,offset,target) @@ -344,9 +343,9 @@ function collections.prepare(name) -- we can do this in lua now .. todo local f = d[i] local name = f.font local scale = f.rscale or 1 -if texconditionals["c_font_compact"] then - scale = 1 -end + if texconditionals["c_font_compact"] then + scale = 1 + end if fontpatternhassize(name) then context.font_fallbacks_clone_unique(name,scale) else @@ -419,17 +418,17 @@ function collections.process(head) -- this way we keep feature processing local vect = vector[char] if vect then local kind = type(vect) + local newfont, newchar if kind == "table" then - local newfont = vect[1] - local newchar = vect[2] + newfont = vect[1] + newchar = vect[2] if trace_collecting then report_fonts("remapping character %C in font %a to character %C in font %a%s", char,font,newchar,newfont,not chardata[newfont][newchar] and " (missing)" or "" ) end - setfont(n,newfont,newchar) elseif kind == "function" then - local newfont, newchar = vect(font,char,vector) + newfont, newchar = vect(font,char,vector) if not newfont then newfont = font end @@ -441,7 +440,6 @@ function collections.process(head) -- this way we keep feature processing char,font,newchar,newfont,not chardata[newfont][newchar] and " (missing)" or "" ) end - setfont(n,newfont,newchar) vector[char] = { newfont, newchar } else local fakemono = vector.factor @@ -450,10 +448,11 @@ function collections.process(head) -- this way we keep feature processing font,vect,char,not chardata[vect][char] and " (missing)" or "" ) end + newfont = vect if fakemono then - setfont(n,vect,monoslot(vect,char,font,fakemono)) + newchar = monoslot(vect,char,font,fakemono) else - setfont(n,vect) + newchar = char end end local rscale = vector.rscale @@ -461,6 +460,8 @@ function collections.process(head) -- this way we keep feature processing local s, x, y = getscales(n) setscales(n,s*rscale,x*rscale,y*rscale) end + setfont(n,newfont,newchar) + setprop(n, "original", { font = font, char = char }) end end end diff --git a/tex/context/base/mkxl/font-emp.mklx b/tex/context/base/mkxl/font-emp.mklx index a6c4136f6..1e30e7012 100644 --- a/tex/context/base/mkxl/font-emp.mklx +++ b/tex/context/base/mkxl/font-emp.mklx @@ -152,7 +152,9 @@ %D italic correction. As a bonus we also look for something that looks like a dash, %D in which case we don't correct. -\let\italiccorrection=\/ % tex primitive +\aliased\let\normalitaliccorrection\/ % the tex primitive + +\let\italiccorrection\normalitaliccorrection % will be overloaded \permanent\protected\def\emphasiscorrection % public, not in raw alignment groups, else omit problem {\ifhmode\ifnum\currentgrouptype=\aligngroupcode\else diff --git a/tex/context/base/mkxl/font-fea.mklx b/tex/context/base/mkxl/font-fea.mklx index 5f83c87d3..5d5cea23f 100644 --- a/tex/context/base/mkxl/font-fea.mklx +++ b/tex/context/base/mkxl/font-fea.mklx @@ -136,7 +136,8 @@ % beware: these are global features on top of existing font features -\let\currentfeature \s!current +\mutable\let\currentfeature\s!current + \let\m_font_feature_list \s!current \let\m_font_feature_asked\empty diff --git a/tex/context/base/mkxl/font-fil.mklx b/tex/context/base/mkxl/font-fil.mklx index dcbe568b1..3733644cd 100644 --- a/tex/context/base/mkxl/font-fil.mklx +++ b/tex/context/base/mkxl/font-fil.mklx @@ -68,8 +68,7 @@ \let\m_font_name\empty \let\m_font_file\empty -\def \defaultfontfile{\truefontname{Normal}} % was cmtt10, but that one is gone -%edef\nullfontname {\fontname\nullfont} +\mutable\def\defaultfontfile{\truefontname{Normal}} % was cmtt10, but that one is gone \permanent\protected\def\definefontsynonym[#name]#spacer[#file]% {\edef\m_font_name{#name}% diff --git a/tex/context/base/mkxl/font-ini.mklx b/tex/context/base/mkxl/font-ini.mklx index 2960cd9fb..65a60c837 100644 --- a/tex/context/base/mkxl/font-ini.mklx +++ b/tex/context/base/mkxl/font-ini.mklx @@ -351,6 +351,8 @@ {\pop_macro_savedfont \savedfont} +\aliased\let\popcurrentfont\relax + \permanent\protected\def\pushcurrentfont {\enforced\permanent\protected\edef\popcurrentfont {\def\noexpand\fontbody {\fontbody}% @@ -423,9 +425,9 @@ \permanent\def\thenormalizedbodyfontsize#body% {\clf_nbfs\dimexpr#body\relax} -\edef\normalizedglobalbodyfontsize{\thenormalizedbodyfontsize\bodyfontsize} -\edef\normalizedlocalbodyfontsize {\thenormalizedbodyfontsize\bodyfontsize} -\edef\normalizedbodyfontsize {\thenormalizedbodyfontsize\bodyfontsize} +\mutable\edef\normalizedglobalbodyfontsize{\thenormalizedbodyfontsize\bodyfontsize} +\mutable\edef\normalizedlocalbodyfontsize {\thenormalizedbodyfontsize\bodyfontsize} +\mutable\edef\normalizedbodyfontsize {\thenormalizedbodyfontsize\bodyfontsize} %D \macros %D {mapfontsize} @@ -659,6 +661,7 @@ \mutable\let\somefontname \s!unknown \mutable\let\somefontspec \s!unknown +\mutable\let\somefontfile \s!unknown \mutable\let\somefontsize \zerocount \mutable\let\somefontsizey\empty \mutable\let\somefontsizey\empty @@ -2393,11 +2396,10 @@ \permanent\protected\def\fastswitchtobodyfont#name% {\ifcsname\??fontenvironments\normalizedbodyfontsize#name\endcsname - %\edef\futurebodyfontsize{\csname\??fontenvironments\normalizedbodyfontsize#name\endcsname}% - \edef\futurebodyfontsize{\lastnamedcs}% - \ifcsname\??fontbodyknown\futurebodyfontsize\endcsname - \font_basics_complete_switch\futurebodyfontsize - \localbodyfontsize\futurebodyfontsize\relax + \edef\p_bodyfont{\lastnamedcs}% + \ifcsname\??fontbodyknown\p_bodyfont\endcsname + \font_basics_complete_switch\p_bodyfont + \localbodyfontsize\p_bodyfont\relax \fi \fi \csname\??fontstyle\fontstyle\endcsname diff --git a/tex/context/base/mkxl/font-mat.mklx b/tex/context/base/mkxl/font-mat.mklx index 561effd58..3fc6275a6 100644 --- a/tex/context/base/mkxl/font-mat.mklx +++ b/tex/context/base/mkxl/font-mat.mklx @@ -104,6 +104,8 @@ %def\mathsizesuffix{\ifcase\fontface\or\mathtextsuffix\or\mathscriptsuffix\or\mathscriptscriptsuffix\fi} \mutable\let\mathsizesuffix\empty +\mutable\let\fontfamily\relax % for now public but it is a helper + \def\font_helpers_set_math_family_indeed_normal#mrtag#family% \fontface etc are also used later on {\let\savedfontbody\fontbody \let\fontfamily#family% diff --git a/tex/context/base/mkxl/font-mpf.lmt b/tex/context/base/mkxl/font-mpf.lmt index b8a21788a..b1e6a00dd 100644 --- a/tex/context/base/mkxl/font-mpf.lmt +++ b/tex/context/base/mkxl/font-mpf.lmt @@ -34,8 +34,8 @@ local newprivateslot = fonts.helpers.newprivateslot local currentfont = font.current local function setmetaglyphs(category,fontid,unicode,specification) - local tfmdata = fontdata[fontid] if unicode then + local tfmdata = fontdata[fontid] local characters = tfmdata.characters specification.unicode = unicode specification.category = category @@ -68,10 +68,10 @@ local function setmetaglyphs(category,fontid,unicode,specification) fonts.dropins.swapone("mps",tfmdata,shape,unicode) -- local olddata = characters[unicode] - newdata.width = urx - llx - newdata.height = ury - newdata.depth = -lly - newdata.unicode = unicode + newdata.width = urx - llx + newdata.height = ury + newdata.depth = -lly + newdata.unicode = unicode -- commands = { { "offset", -llx, 0, newdata.commands[1][1], newdata.commands[1][2] } } if llx ~= 0 then newdata.commands = { { "offset", -llx, 0 }, newdata.commands[1] } @@ -89,7 +89,7 @@ local function setmetaglyph(specification) local category = specification.category local name = specification.name if category and name then - local fontid = currentfont() + local fontid = specification.fontid or currentfont() local private = newprivateslot(name) register(fontid,private,function(font,char) return setmetaglyphs(category,font,char,specification) end diff --git a/tex/context/base/mkxl/font-ogr.lmt b/tex/context/base/mkxl/font-ogr.lmt index 9c90bce49..698593ac7 100644 --- a/tex/context/base/mkxl/font-ogr.lmt +++ b/tex/context/base/mkxl/font-ogr.lmt @@ -53,27 +53,28 @@ do -- todo: pass specification table instead function dropins.provide(method,t_tfmdata,indexdata,...) - local droppedin = dropins.nextid() - local t_characters = t_tfmdata.characters - local t_descriptions = t_tfmdata.descriptions - local t_properties = t_tfmdata.properties - local d_tfmdata = setmetatableindex({ },t_tfmdata) - local d_properties = setmetatableindex({ },t_properties) - d_tfmdata.properties = d_properties - local d_characters = { } -- setmetatableindex({ },t_characters) -- hm, index vs unicode - local d_descriptions = { } -- setmetatableindex({ },t_descriptions) -- hm, index vs unicode - d_tfmdata.characters = d_characters - d_tfmdata.descriptions = d_descriptions - d_tfmdata.parentdata = t_tfmdata -- so we can access it if needed - d_properties.instance = - droppedin -- will become an extra element in the hash - identifiers[droppedin] = d_tfmdata - local fonts = t_tfmdata.fonts or { } - t_tfmdata.fonts = fonts - d_properties.format = "type3" - d_properties.method = method - d_properties.indexdata = { indexdata, ... } -- can take quite some memory - local slot = #fonts + 1 - fonts[slot] = { id = droppedin } + local droppedin = dropins.nextid() + local t_characters = t_tfmdata.characters + local t_descriptions = t_tfmdata.descriptions + local t_properties = t_tfmdata.properties + local d_tfmdata = setmetatableindex({ },t_tfmdata) + local d_properties = setmetatableindex({ },t_properties) + d_properties.basefontname = "ContextRuntimeFont" .. droppedin + d_tfmdata.properties = d_properties + local d_characters = { } -- setmetatableindex({ },t_characters) -- hm, index vs unicode + local d_descriptions = { } -- setmetatableindex({ },t_descriptions) -- hm, index vs unicode + d_tfmdata.characters = d_characters + d_tfmdata.descriptions = d_descriptions + d_tfmdata.parentdata = t_tfmdata -- so we can access it if needed + d_properties.instance = - droppedin -- will become an extra element in the hash + identifiers[droppedin] = d_tfmdata + local fonts = t_tfmdata.fonts or { } + t_tfmdata.fonts = fonts + d_properties.format = "type3" + d_properties.method = method + d_properties.indexdata = { indexdata, ... } -- can take quite some memory + local slot = #fonts + 1 + fonts[slot] = { id = droppedin } return slot, droppedin, d_tfmdata, d_properties end diff --git a/tex/context/base/mkxl/font-pre.mkxl b/tex/context/base/mkxl/font-pre.mkxl index 311512bce..e6e6930e1 100644 --- a/tex/context/base/mkxl/font-pre.mkxl +++ b/tex/context/base/mkxl/font-pre.mkxl @@ -463,9 +463,9 @@ % \definefontfeature[mathscript] [math-script] % \definefontfeature[mathscriptscript] [math-scriptscript] -\definefontfeature - [missing] - [missing=yes] +% \definefontfeature +% [missing] +% [missing=yes] %D Nice to have too: diff --git a/tex/context/base/mkxl/font-sty.mklx b/tex/context/base/mkxl/font-sty.mklx index 11abdde99..48964b04c 100644 --- a/tex/context/base/mkxl/font-sty.mklx +++ b/tex/context/base/mkxl/font-sty.mklx @@ -205,8 +205,6 @@ \currentstyleparameter \fi} -\let\dosetfontattribute\dousestylehashparameter % for a while - %D New commands (not yet interfaced): %D %D \startbuffer @@ -271,7 +269,7 @@ \installcorenamespace{styleargument} -\protected\def\style[#name]% as this is can be a switch we use groupedcommand % frozen? +\permanent\protected\def\style[#name]% as this is can be a switch we use groupedcommand % frozen? {\csname\??styleargument \ifcsname\??stylecheck#name\endcsname 2% defined as style @@ -415,7 +413,7 @@ \dousestylehashparameter{#1}{#2}% \dousecolorhashparameter{#1}{#3}} -\let\dostopattributes\endgroup +\aliased\let\dostopattributes\endgroup %D New but it needs to be supported explicitly (as in natural tables). diff --git a/tex/context/base/mkxl/font-sym.mklx b/tex/context/base/mkxl/font-sym.mklx index 7f68d267e..c521582a2 100644 --- a/tex/context/base/mkxl/font-sym.mklx +++ b/tex/context/base/mkxl/font-sym.mklx @@ -216,6 +216,8 @@ %D Every now and then we want to define a font directly, for instance when we %D typeset title pages. The next macro saves some typing: +\mutable\let\nextfont\relax % this one could be more private but this is okay + \permanent\protected\def\setfont% geen \font_helpers_set_font mogelijk {\afterassignment\font_basics_set_font\font\nextfont=} diff --git a/tex/context/base/mkxl/grph-epd.mkxl b/tex/context/base/mkxl/grph-epd.mkxl index a0fcc51da..6d5f6ff2a 100644 --- a/tex/context/base/mkxl/grph-epd.mkxl +++ b/tex/context/base/mkxl/grph-epd.mkxl @@ -17,13 +17,17 @@ \registerctxluafile{grph-epd}{} +% hm, this one is globally overloaded + \def\figurereference{\clf_figurestatus{reference}{}} % might become private +\mutable\let\mergedfigurereference\empty + \defineoverlay[system:graphics:epdf][\directsetup{system:graphics:epdf}] \startsetups system:graphics:epdf \clf_figure_mergegoodies{\externalfigureparameter\c!interaction}% - \reference[\figurereference]{}% todo: dest area + \reference[\mergedfigurereference]{}% todo: dest area \stopsetups \defineframed diff --git a/tex/context/base/mkxl/grph-inc.mkxl b/tex/context/base/mkxl/grph-inc.mkxl index fe8971d35..c56155888 100644 --- a/tex/context/base/mkxl/grph-inc.mkxl +++ b/tex/context/base/mkxl/grph-inc.mkxl @@ -423,12 +423,12 @@ {\naturalhpack{\strc_references_flush_destination_nodes\directgotodumbbox{#2}[cross:b:#1]}}% \endgroup} -\let\doexternalfigurerepeat\gobblefourarguments % called from lua end +\aliased\let\doexternalfigurerepeat\gobblefourarguments % called from lua end \permanent\tolerant\protected\def\placeregisteredexternalfigures[#1]% {\page \begingroup - \protected\def\doexternalfigurerepeat{\grph_include_place_registered_indeed{#1}}% + \enforced\protected\def\doexternalfigurerepeat{\grph_include_place_registered_indeed{#1}}% \dorecurse\clf_figure_nof_registered_pages {\page \clf_figure_flush_registered_pages\recurselevel @@ -448,7 +448,7 @@ %D Scaling: -\let\dowithfigure\relax % name might change (into a proper hook) +\mutable\let\dowithfigure\relax % name might change (into a proper hook) \permanent\protected\def\doscalefigure % used at lua end {\global\setbox\foundexternalfigure\vpack{\scale[\v!figure]{\dowithfigure{\box\foundexternalfigure}}}} diff --git a/tex/context/base/mkxl/lang-ini.mkxl b/tex/context/base/mkxl/lang-ini.mkxl index fa689a18b..151b5be02 100644 --- a/tex/context/base/mkxl/lang-ini.mkxl +++ b/tex/context/base/mkxl/lang-ini.mkxl @@ -39,7 +39,7 @@ %D zero has no patterns, first of all because I like to start numbering at one. It %D may come in handy for special purposes as well. -\normallanguage\zerocount \def\loadedlanguage{1} +\normallanguage\zerocount %D \macros %D {currentlanguage, setupcurrentlanguage} @@ -413,7 +413,8 @@ % \uchyph\plusone : -\chardef \completehyphenationmodecode \numexpr +% \chardef \completehyphenationmodecode \numexpr +\permanent \integerdef \completehyphenationmodecode \numexpr \normalhyphenationmodecode % \discretionary + \automatichyphenationmodecode % - + \explicithyphenationmodecode % \- @@ -474,6 +475,8 @@ %D You can setup the default language to reset settings. +\mutable\let\currentlanguagesetups\empty + \appendtoks \edef\currentlanguagesetups{\languageparameter\c!setups}% \ifempty\currentlanguagesetups \else diff --git a/tex/context/base/mkxl/lang-lab.mkxl b/tex/context/base/mkxl/lang-lab.mkxl index 8968631a0..369049ed1 100644 --- a/tex/context/base/mkxl/lang-lab.mkxl +++ b/tex/context/base/mkxl/lang-lab.mkxl @@ -60,7 +60,7 @@ \installcorenamespace{label} -\let\currentlabelcategory\empty +% \let\currentlabelcategory\empty \permanent\tolerant\protected\def\definelabelclass[#1]#*[#2]% {\normalexpanded @@ -77,30 +77,46 @@ % hm, not interfaced -\let\thetextprefix\empty +\mutable\let\thetextprefix\empty + +\mutable\let\currenttextprefixclass\s!unknown +\mutable\let\currenttextprefixname \empty +\mutable\let\currenttextprefixtag \s!unknown \protected\def\lang_labels_define_class_indeed#1#2#3#4#5#6#7#8#9% - {\permanent\instance\setuvalue {setup#1text}{\protecttextprefixes#2\def\currenttextprefixclass{#1}\lang_labels_text_prefix_setup}% - \permanent\instance\setuvalue{preset#1text}{\protecttextprefixes 1\def\currenttextprefixclass{#1}\lang_labels_text_prefix_setup}% - \permanent\instance\setuvalue {copy#1text}{\protecttextprefixes 1\def\currenttextprefixclass{#1}\lang_labels_text_prefix_copy }% - \permanent\instance\setuvalue {start#1text}{\protecttextprefixes 1\def\currenttextprefixclass{#1}\lang_labels_text_prefix_start[#1]}% - \permanent\instance\letvalue {stop#1text}\relax + {\permanent\instance\protected\defcsname setup#1text\endcsname{\protecttextprefixes#2\def\currenttextprefixclass{#1}\lang_labels_text_prefix_setup}% + \permanent\instance\protected\defcsname preset#1text\endcsname{\protecttextprefixes 1\def\currenttextprefixclass{#1}\lang_labels_text_prefix_setup}% + \permanent\instance\protected\defcsname copy#1text\endcsname{\protecttextprefixes 1\def\currenttextprefixclass{#1}\lang_labels_text_prefix_copy }% + \permanent\instance\protected\defcsname start#1text\endcsname{\protecttextprefixes 1\def\currenttextprefixclass{#1}\lang_labels_text_prefix_start[#1]}% + \permanent\instance \letcsname stop#1text\endcsname \relax \permanent\instance\def#4{\reallanguagetag{\defaultlanguage\currentmainlanguage}}% \ifnum#2=\plustwo % used for math and tags \instance\def#3{#5#4}% +% \instance\def#5##1##2% ##1=language +% {\ifcsname\??label\currentlabelcategory#1:##1:##2\endcsname +% \lastnamedcs +% \orelse\ifcsname\??label#1:##1:##2\endcsname +% \lastnamedcs +% \orelse\ifcsname\??language##1\s!default\endcsname +% \expandafter#5\lastnamedcs{##2}% +% \orelse\ifcsname\??label\currentlabelcategory#1:##2\endcsname +% \lastnamedcs +% \orelse\ifcsname\??label#1:##2\endcsname +% \lastnamedcs +% \orelse\ifcsname\??label\currentlabelcategory#1:\s!en:##2\endcsname +% \lastnamedcs +% \orelse\ifcsname\??label#1:\s!en:##2\endcsname +% \lastnamedcs +% \else +% ##2% +% \fi}% \instance\def#5##1##2% ##1=language - {\ifcsname\??label\currentlabelcategory#1:##1:##2\endcsname - \lastnamedcs - \orelse\ifcsname\??label#1:##1:##2\endcsname + {\ifcsname\??label#1:##1:##2\endcsname \lastnamedcs \orelse\ifcsname\??language##1\s!default\endcsname \expandafter#5\lastnamedcs{##2}% - \orelse\ifcsname\??label\currentlabelcategory#1:##2\endcsname - \lastnamedcs \orelse\ifcsname\??label#1:##2\endcsname \lastnamedcs - \orelse\ifcsname\??label\currentlabelcategory#1:\s!en:##2\endcsname - \lastnamedcs \orelse\ifcsname\??label#1:\s!en:##2\endcsname \lastnamedcs \else @@ -124,10 +140,10 @@ \else \enforced\let\thetextprefix\dummytextprefix \fi}% - \permanent\instance\protected\def#6##1{#3{##1}\expandafter\flushleftlabelclass \thetextprefix}% - \permanent\instance\protected\def#7##1{#3{##1}\expandafter\flushrightlabelclass\thetextprefix}% - \permanent\instance\protected\def#8##1{#3{##1}\expandafter\flushbothlabelclass \thetextprefix}% #2 - \permanent\instance\protected\def#9##1{#3{##1}\expandafter\flushleftlabelclass \thetextprefix}% + \permanent \instance\protected\def#6##1{#3{##1}\expandafter\firstoftwoarguments \thetextprefix}% \flushleftlabelclass + \permanent\instance\protected\def#7##1{#3{##1}\expandafter\secondoftwoarguments \thetextprefix}% \flushrightlabelclass + \permanent\instance\protected\def#8##1{#3{##1}\expandafter\lang_labels_flush_both\thetextprefix}% \flushbothlabelclass #2 + \permanent\instance\protected\def#9##1{#3{##1}\expandafter\firstoftwoarguments \thetextprefix}% \flushleftlabelclass \fi \appendtoks \enforced\permanent\instance\let#6\firstofoneargument % to be checked @@ -138,10 +154,10 @@ % why not lang_* ? -\let\flushleftlabelclass \firstoftwoarguments -\let\flushrightlabelclass\secondoftwoarguments +% \let\flushleftlabelclass \firstoftwoarguments +% \let\flushrightlabelclass\secondoftwoarguments -\permanent\def\flushbothlabelclass#1#2#3{#1#3#2} +\permanent\def\lang_labels_flush_both#1#2#3{#1#3#2} \permanent\def\dummytextprefix{\empty\empty} @@ -163,9 +179,6 @@ \newconstant\protecttextprefixes -\let\currenttextprefixtag \s!unknown -\let\currenttextprefixclass\s!unknown - \tolerant\def\lang_labels_text_prefix_start[#1]#*[#2]#*[#3]% class language name {\ifarguments\or\or \edef\currenttextprefixtag{\reallanguagetag\currentmainlanguage}% diff --git a/tex/context/base/mkxl/lang-mis.mkxl b/tex/context/base/mkxl/lang-mis.mkxl index 46cbddf97..f1ed3cb18 100644 --- a/tex/context/base/mkxl/lang-mis.mkxl +++ b/tex/context/base/mkxl/lang-mis.mkxl @@ -232,7 +232,7 @@ \newconditional\punctafterdiscretionary \newconditional\spaceafterdiscretionary -\def\lang_discretionaries_check_before %i sused grouped +\def\lang_discretionaries_check_before %is used grouped {\ifvmode \dontleavehmode \fi @@ -269,14 +269,14 @@ \futurelet\nexttoken\next}% \next} -\let\discretionarytoken \relax -\let\textmodediscretionary\relax +\let\lang_discretionaries_token \relax +\let\lang_discretionaries_action\relax \permanent\protected\def\activedododotextmodediscretionary#1#2% - {\edef\discretionarytoken{\detokenize{#2}}% - \def\textmodediscretionary{\handletextmodediscretionary{#1}}% + {\edef\lang_discretionaries_token{\detokenize{#2}}% + \def\lang_discretionaries_action{\handletextmodediscretionary{#1}}% \lang_discretionaries_check_after - \ifempty\discretionarytoken + \ifempty\lang_discretionaries_token \ifx#1\nexttoken % takes care of ||| and +++ and ...... \ifcsname\??discretionaryaction\string#1\endcsname \lastnamedcs @@ -294,22 +294,22 @@ \else \lang_discretionaries_check_before % the next line has been changed (20050203) - % \prewordbreak\hbox{\textmodediscretionary\nexttoken}\postwordbreak + % \prewordbreak\hbox{\lang_discretionaries_action\nexttoken}\postwordbreak % but an hbox blocks a possible \discretionary \ifcsname\??discretionaryaction\endcsname \lastnamedcs \orelse\ifconditional\spaceafterdiscretionary - %\prewordbreak\textmodediscretionary\relax - \wordboundary\textmodediscretionary\relax + %\prewordbreak\lang_discretionaries_action\relax + \wordboundary\lang_discretionaries_action\relax \orelse\ifconditional\punctafterdiscretionary - %\prewordbreak\textmodediscretionary\relax - \wordboundary\textmodediscretionary\relax + %\prewordbreak\lang_discretionaries_action\relax + \wordboundary\lang_discretionaries_action\relax \else - %\prewordbreak\textmodediscretionary\prewordbreak - \wordboundary\textmodediscretionary\wordboundary + %\prewordbreak\lang_discretionaries_action\prewordbreak + \wordboundary\lang_discretionaries_action\wordboundary \fi \fi - \orelse\ifcsname\??discretionaryaction\discretionarytoken\endcsname + \orelse\ifcsname\??discretionaryaction\lang_discretionaries_token\endcsname \lastnamedcs \else \lang_discretionaries_check_before @@ -352,9 +352,9 @@ \endcsname} \setuvalue{\??discretionarymode d}#1% - {\edef\discretionarytoken{\detokenize{#1}}% - \let\textmodediscretionary\compoundhyphen - \ifcsname\??discretionaryaction\discretionarytoken\endcsname + {\edef\lang_discretionaries_token{\detokenize{#1}}% + \let\lang_discretionaries_action\compoundhyphen + \ifcsname\??discretionaryaction\lang_discretionaries_token\endcsname \expandafter\lastnamedcs \else \expandafter\indirectdiscretionary diff --git a/tex/context/base/mkxl/lang-url.mkxl b/tex/context/base/mkxl/lang-url.mkxl index 5e046fcf6..04a55fcf9 100644 --- a/tex/context/base/mkxl/lang-url.mkxl +++ b/tex/context/base/mkxl/lang-url.mkxl @@ -62,8 +62,8 @@ \enforced\let\Ux\eUx \to \everyhyphenatedurl -\let\hyphenatedurlseparator \empty % \periodcentered -\let\hyphenatedurldiscretionary\empty +\mutable\let\hyphenatedurlseparator \empty % \periodcentered +\mutable\let\hyphenatedurldiscretionary\empty \setnewconstant\hyphenatedurllefthyphenmin \plusthree \setnewconstant\hyphenatedurlrighthyphenmin\plusthree diff --git a/tex/context/base/mkxl/lpdf-emb.lmt b/tex/context/base/mkxl/lpdf-emb.lmt index 5517d8051..3412a5a78 100644 --- a/tex/context/base/mkxl/lpdf-emb.lmt +++ b/tex/context/base/mkxl/lpdf-emb.lmt @@ -1828,7 +1828,7 @@ do mainwriters["type3"] = function(details) local properties = details.properties - local basefontname = details.basefontname or properties.name + local basefontname = properties.basefontname or details.basefontname or properties.name -- messy local askedmethod = properties.method or "pk" local method = methods[askedmethod] or methods.pk if not method then diff --git a/tex/context/base/mkxl/lpdf-epa.lmt b/tex/context/base/mkxl/lpdf-epa.lmt index 00d9f3c4b..b37e9c043 100644 --- a/tex/context/base/mkxl/lpdf-epa.lmt +++ b/tex/context/base/mkxl/lpdf-epa.lmt @@ -36,6 +36,8 @@ local context = context local nodeinjections = backends.pdf.nodeinjections +local setmacro = tokens.setters.macro + local pdfarray = lpdf.array local pdfdictionary = lpdf.dictionary local pdfconstant = lpdf.constant @@ -337,7 +339,7 @@ function codeinjections.mergereferences(specification) end end -- moved outside previous test - context.setgvalue("figurereference",reference) -- global, todo: setmacro + setmacro("mergedfigurereference",reference,"global") if trace_links then report_link("setting figure reference to %a",reference) end diff --git a/tex/context/base/mkxl/luat-ini.mkxl b/tex/context/base/mkxl/luat-ini.mkxl index 48876a05f..5c29afc53 100644 --- a/tex/context/base/mkxl/luat-ini.mkxl +++ b/tex/context/base/mkxl/luat-ini.mkxl @@ -21,7 +21,7 @@ %D will keep code outside \TEX\ files as much as possible. The solutions evolved %D with the engine but one can find some history in the \MKIV\ files and articles. -\ifdefined\setnaturalcatcodes \else \let\setnaturalcatcodes\relax \fi +%ifdefined\setnaturalcatcodes \else \let\setnaturalcatcodes\relax \fi \ifdefined\obeylualines \else \let\obeylualines \relax \fi \ifdefined\obeyluatokens \else \let\obeyluatokens \relax \fi @@ -77,11 +77,11 @@ \ifdefined\? \else \def\?{?} \fi \ifdefined\! \else \def\!{!} \fi % bonus -\ifdefined\1 \else \def\1{1} \fi \ifdefined\2 \else \def\2{2} \fi -\ifdefined\3 \else \def\3{3} \fi \ifdefined\4 \else \def\4{4} \fi -\ifdefined\5 \else \def\5{5} \fi \ifdefined\6 \else \def\6{6} \fi -\ifdefined\7 \else \def\7{7} \fi \ifdefined\8 \else \def\8{8} \fi -\ifdefined\9 \else \def\9{9} \fi \ifdefined\0 \else \def\0{0} \fi +\ifdefined\1 \else \mutable\def\1{1} \fi \ifdefined\2 \else \mutable\def\2{2} \fi +\ifdefined\3 \else \mutable\def\3{3} \fi \ifdefined\4 \else \mutable\def\4{4} \fi +\ifdefined\5 \else \mutable\def\5{5} \fi \ifdefined\6 \else \mutable\def\6{6} \fi +\ifdefined\7 \else \mutable\def\7{7} \fi \ifdefined\8 \else \mutable\def\8{8} \fi +\ifdefined\9 \else \mutable\def\9{9} \fi \ifdefined\0 \else \mutable\def\0{0} \fi \immutable\edef\lua_letter_backslash{\string\\} \immutable\edef\lua_letter_bar {\string\|} \immutable\edef\lua_letter_dash {\string\-} diff --git a/tex/context/base/mkxl/luat-lib.mkxl b/tex/context/base/mkxl/luat-lib.mkxl index d4d3e860f..f0b25c070 100644 --- a/tex/context/base/mkxl/luat-lib.mkxl +++ b/tex/context/base/mkxl/luat-lib.mkxl @@ -93,12 +93,12 @@ \registerctxluafile{lxml-aux}{} \registerctxluafile{lxml-mis}{} -\pushoverloadmode - -\permanent\protected\def\writestatus#1#2{\ctxlua{logs.status([==[#1]==],[==[#2]==])}} -\permanent\protected\def\writestring #1{\ctxlua{logs.writer([==[#1]==],"\string\n")}} -\permanent\protected\def\writeline {\ctxlua{logs.newline()}} - -\popoverloadmode +% \pushoverloadmode +% +% \ifdefined\writestatus \else \protected\def\writestatus#1#2{\ctxlua{logs.status([==[#1]==],[==[#2]==])}} \fi +% \ifdefined\writestring \else \protected\def\writestring #1{\ctxlua{logs.writer([==[#1]==],"\string\n")}} \fi +% \ifdefined\writeline \else \protected\def\writeline {\ctxlua{logs.newline()}} \fi +% +% \popoverloadmode \endinput diff --git a/tex/context/base/mkxl/math-ali.mkxl b/tex/context/base/mkxl/math-ali.mkxl index 72f857720..008313f09 100644 --- a/tex/context/base/mkxl/math-ali.mkxl +++ b/tex/context/base/mkxl/math-ali.mkxl @@ -1046,8 +1046,8 @@ \installcorenamespace{mathmatrixalignlocation} -\let\mathmatrixleft \empty % experimental hook -\let\mathmatrixright\empty % experimental hook +\mutable\let\mathmatrixleft \empty % experimental hook +\mutable\let\mathmatrixright\empty % experimental hook \setvalue{\??mathmatrixalignlocation\v!top }{\raise\dimexpr(\nextboxdp-\nextboxht)/2 +\mathaxisheight\mathstyle\relax} \setvalue{\??mathmatrixalignlocation\v!high }{\raise\dimexpr(\nextboxdp-\nextboxht)/2\relax} @@ -1202,7 +1202,7 @@ \setupcurrentmathmatrix[#2]% \math_matrix_start[\currentmathmatrix]} -\permanent\protected\def\stopnamedmatrix +\noaligned\permanent\protected\def\stopnamedmatrix {\math_matrix_stop \endgroup} diff --git a/tex/context/base/mkxl/math-def.mkxl b/tex/context/base/mkxl/math-def.mkxl index 040005293..1f3da649d 100644 --- a/tex/context/base/mkxl/math-def.mkxl +++ b/tex/context/base/mkxl/math-def.mkxl @@ -81,7 +81,7 @@ \permanent\protected\def\setoperatorlimits#1#2% operator limits {\savenormalmeaning{#1}% %frozen\protected\expandafter\def\expandafter#1\expandafter{\csname normal\csstring#1\endcsname#2}} - \frozen\protected\edef#1{\expandafter\noexpand\csname normal\csstring#1\endcsname\noexpand#2}} + \frozen\protected\edef#1{\expandafter\noexpand\csname\s!normal\csstring#1\endcsname\noexpand#2}} \pushoverloadmode diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index 39eb3f31d..6b77db469 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -179,13 +179,13 @@ \permanent\protected\def\startpickupmath % for the moment private {\ifconditional\indisplaymath \startforceddisplaymath - \let\stoppickupmath\stopforceddisplaymath + \enforced\let\stoppickupmath\stopforceddisplaymath \else \startimath - \let\stoppickupmath\stopimath + \enforced\let\stoppickupmath\stopimath \fi} -\let\stoppickupmath\relax +\aliased\let\stoppickupmath\relax % \protected\def\rawmathcharacter#1% slow but only for tracing % {\begingroup @@ -221,24 +221,29 @@ \installswitchcommandhandler \??mathematics {mathematics} \??mathematics -\permanent\protected\def\startmathematics % no grouping, if ever then also an optional second - {\doifelsenextoptionalcs\math_mathematics_start_yes\math_mathematics_start_nop} - \installmacrostack\currentmathematics -\protected\def\math_mathematics_start_yes[#1]% - {\push_macro_currentmathematics - \edef\currentmathematics{#1}% check for valid - \the\everyswitchmathematics} +% \permanent\protected\def\startmathematics % no grouping, if ever then also an optional second +% {\doifelsenextoptionalcs\math_mathematics_start_yes\math_mathematics_start_nop} +% +% \protected\def\math_mathematics_start_yes[#1]% +% {\push_macro_currentmathematics +% \edef\currentmathematics{#1}% check for valid +% \the\everyswitchmathematics} +% +% \protected\def\math_mathematics_start_nop +% {\push_macro_currentmathematics +% \let\currentmathematics\empty +% \the\everyswitchmathematics} -\protected\def\math_mathematics_start_nop +\permanent\protected\tolerant\def\startmathematics[#1]% no grouping, if ever then also an optional second {\push_macro_currentmathematics - \let\currentmathematics\empty + \edef\currentmathematics{#1}% check for valid \the\everyswitchmathematics} \permanent\protected\def\stopmathematics {\pop_macro_currentmathematics - \the\everyswitchmathematics} + \the\everyswitchmathematics} % only needed at level zero \definemathematics[\v!default] % not needed, but nicer when nesting back to normal @@ -597,7 +602,7 @@ %D %D To be done. -\let\mathboldsymbol\relax % yet unsupported, will be +\mutable\let\mathboldsymbol\relax % yet unsupported, will be \permanent\protected\def\boldsymbol {\mathortext\mathboldsymbol\bold} @@ -812,7 +817,7 @@ \let\math_tags_mi\firstofoneunexpanded \protected\def\math_tags_mn#1{\begingroup\mathupright\math_set_o_both#1\endgroup} -\protected\def\math_tags_ms#1{\begingroup\mathupright\math_set_p_both#1\endgroup} +\protected\def\math_tags_ms#1{\begingroup\mathupright\math_set_p_both#1\endgroup} % why not just \text % Once this is stable we can store the number at the tex end which is % faster. Functions getnumbers >= 1000. @@ -832,9 +837,9 @@ \ifempty\p_functionstyle \expandafter\math_mfunction_styled_none \orelse\ifcsname\??alternativestyle\p_functionstyle\endcsname - \doubleexpandafter\math_mfunction_styled_text + \expandafter\math_mfunction_styled_text \else - \doubleexpandafter\math_mfunction_styled_math + \expandafter\math_mfunction_styled_math \fi} \protected\def\math_mfunction_styled_text#1% @@ -886,6 +891,11 @@ \ifdefined\apply \else \aliased\let\apply\relax \fi +\mutable\let\mo\relax +\mutable\let\mi\relax +\mutable\let\mn\relax +\mutable\let\ms\relax + \appendtoks \enforced\let\math_tags_mfunctiontxt\clf_tagmfunctiontxt \enforced\let\math_tags_mfunctionlab\clf_tagmfunctionlab @@ -1109,8 +1119,8 @@ % most math fonts have messed up primes, just test this: $\prime^{\prime^{\prime}}$ -{ \catcode\circumflexasciicode\othercatcode \glet\othercircumflextoken ^ } -{ \catcode\circumflexasciicode\superscriptcatcode \glet\superscriptcircumflextoken^ } +{ \catcode\circumflexasciicode\othercatcode \immutable\glet\othercircumflextoken ^ } +{ \catcode\circumflexasciicode\superscriptcatcode \immutable\glet\superscriptcircumflextoken^ } \ifdefined \prime \else \Umathchardef\prime "0 "0 "2032 @@ -1451,8 +1461,8 @@ \permanent\protected\def\mathgreekitalic {\c_attr_mathgreek"333\relax} \permanent\protected\def\mathgreekdefault{\c_attr_mathgreek"000\relax} -\let\mathgreeknormal\mathgreekupright -\let\mathgreeknone \mathgreekdefault +\aliased\let\mathgreeknormal\mathgreekupright +\aliased\let\mathgreeknone \mathgreekdefault \appendtoks \c_attr_mathgreek\c_math_greek_attribute @@ -1963,8 +1973,8 @@ %D Some dimension fun: -\let\mathexheight \exheight % also in math-ini.mkiv -\def\mathemwidth {\Umathquad\normalmathstyle} % also in math-ini.mkiv +\aliased \let\mathexheight \exheight % also in math-ini.mkiv +\permanent\def\mathemwidth {\Umathquad\normalmathstyle} % also in math-ini.mkiv %D A plain inheritance: diff --git a/tex/context/base/mkxl/math-pln.mkxl b/tex/context/base/mkxl/math-pln.mkxl index e386eb72d..2fcf6e4cb 100644 --- a/tex/context/base/mkxl/math-pln.mkxl +++ b/tex/context/base/mkxl/math-pln.mkxl @@ -28,29 +28,29 @@ % will move -\def\oalign#1% +\permanent\def\oalign#1% {\leavevmode % plain tex uses this \vtop {\baselineskip\zeroskip \lineskip.25\exheight \ialign{\alignmark\alignmark\crcr#1\crcr}}} -\def\ooalign % chars over each other +\permanent\def\ooalign % chars over each other {\lineskiplimit-\maxdimen \oalign} % needs checking -\def\choose{\atopwithdelims()} -\def\brack {\atopwithdelims[]} -\def\brace {\atopwithdelims\{\}} +\permanent\protected\def\choose{\atopwithdelims()} +\permanent\protected\def\brack {\atopwithdelims[]} +\permanent\protected\def\brace {\atopwithdelims\{\}} % needs checking -\protected\def\buildrel#1\over#2% +\permanent\protected\def\buildrel#1\over#2% {\mathrel{\mathop{\kern\zeropoint#2}\limits^{#1}}} -\protected\def\bmod +\permanent\protected\def\bmod {\nonscript \mskip-\medmuskip \mkern5mu @@ -60,12 +60,12 @@ \nonscript \mskip-\medmuskip} -\protected\def\pmod#1% +\permanent\protected\def\pmod#1% {\allowbreak \mkern18mu (\mfunction{mod}\mskip\medmuskip#1)} -\protected\def\cases#1% +\permanent\protected\def\cases#1% {\left\{% \mskip\thinmuskip \vcenter @@ -80,7 +80,7 @@ \crcr}}% \right.} -\protected\def\matrix#1% +\permanent\protected\def\matrix#1% {\emptyhbox \mskip\thinmuskip \vcenter @@ -101,7 +101,7 @@ \noalign{\kern-\baselineskip}}}% \mskip\thinmuskip} -\protected\def\pmatrix#1% +\permanent\protected\def\pmatrix#1% {\left(\matrix{#1}\right)} % \protected\def\openup diff --git a/tex/context/base/mkxl/math-stc.mklx b/tex/context/base/mkxl/math-stc.mklx index e7541f61c..76aeda030 100644 --- a/tex/context/base/mkxl/math-stc.mklx +++ b/tex/context/base/mkxl/math-stc.mklx @@ -1273,15 +1273,15 @@ \defineextensiblefiller [twoheadleftarrowfill] ["219E] \defineextensiblefiller [twoheadrightarrowfill] ["21A0] \defineextensiblefiller [mapstofill] ["21A6] -\defineextensiblefiller [hookleftarrowfill] ["21A9] -\defineextensiblefiller [hookrightarrowfill] ["21AA] +%defineextensiblefiller [hookleftarrowfill] ["21A9] +%defineextensiblefiller [hookrightarrowfill] ["21AA] \defineextensiblefiller [leftharpoondownfill] ["21BD] \defineextensiblefiller [leftharpoonupfill] ["21BC] \defineextensiblefiller [rightharpoondownfill] ["21C1] \defineextensiblefiller [rightharpoonupfill] ["21C0] \defineextensiblefiller [rightoverleftarrowfill] ["21C4] -\defineextensiblefiller [leftrightharpoonsfill] ["21CB] -\defineextensiblefiller [rightleftharpoonsfill] ["21CC] +%defineextensiblefiller [leftrightharpoonsfill] ["21CB] % yet undefined +%defineextensiblefiller [rightleftharpoonsfill] ["21CC] % yet undefined \defineextensiblefiller [triplerelfill] ["2261] \defineextensiblefiller [leftrightarrowfill] ["27F7] \defineextensiblefiller [Leftarrowfill] ["27F8] diff --git a/tex/context/base/mkxl/meta-imp-clock.mkxl b/tex/context/base/mkxl/meta-imp-clock.mkxl index b48abf5ee..0612113ea 100644 --- a/tex/context/base/mkxl/meta-imp-clock.mkxl +++ b/tex/context/base/mkxl/meta-imp-clock.mkxl @@ -89,6 +89,8 @@ % \enableexperiments[fonts.compact] +\nopdfcompression + \setuplayout[tight] \setupbodyfont[dejavu] diff --git a/tex/context/base/mkxl/meta-ini.lmt b/tex/context/base/mkxl/meta-ini.lmt new file mode 100644 index 000000000..ed7b2264f --- /dev/null +++ b/tex/context/base/mkxl/meta-ini.lmt @@ -0,0 +1,161 @@ +if not modules then modules = { } end modules ['meta-ini'] = { + version = 1.001, + comment = "companion to meta-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local tonumber = tonumber +local format = string.format +local concat = table.concat +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local P, Cs, R, S, C, Cc = lpeg.P, lpeg.Cs, lpeg.R, lpeg.S, lpeg.C, lpeg.Cc + +metapost = metapost or { } +local metapost = metapost +local context = context + +local colorhash = attributes.list[attributes.private('color')] +local textype = tex.type +local MPcolor = context.MPcolor + +do + + local dimenorname = + lpegpatterns.validdimen / function(s) + context("\\the\\dimexpr %s",s) + end + + (C(lpegpatterns.float) + Cc(1)) * lpegpatterns.space^0 * P("\\") * C(lpegpatterns.letter^1) / function(f,s) + local t = textype(s) + if t == "dimen" then + context("\\the\\dimexpr %s\\%s\\relax",f,s) + elseif t == "count" then + context("\\the\\numexpr \\%s * %s\\relax",s,f) -- \scratchcounter is not permitted + end + end + + local splitter = lpeg.splitat("::",true) + + interfaces.implement { + name = "prepareMPvariable", + arguments = "string", + actions = function(v) + if v == "" then + -- MPcolor("black") + context("black") + else + local typ, var = lpegmatch(splitter,v) + if not var then + -- parse + if colorhash[v] then + -- MPcolor(v) + context("%q",var) + elseif tonumber(v) then + context(v) + elseif not lpegmatch(dimenorname,v) then + context("\\number %s",v) -- 0.4 ... + end + elseif typ == "d" then -- to be documented + -- dimension + context("\\the\\dimexpr %s\\relax",var) + elseif typ == "n" then -- to be documented + -- number + context("\\the\\numexpr %s\\relax",var) + elseif typ == "s" then -- to be documented + -- string + -- context(var) + context("%q",var) + elseif typ == "c" then -- to be documented + -- color + -- MPcolor(var) + context("%q",var) + else + context(var) + end + end + end + } + +end + +do + + local ctx_mathematics = context.mathematics + + -- function metapost.formatnumber(f,n) -- just lua format + -- f = gsub(f,"@(%d)","%%.%1") + -- f = gsub(f,"@","%%") + -- f = format(f,tonumber(n) or 0) + -- f = gsub(f,"e([%+%-%d]+)",function(s) + -- return format("\\times10^{%s}",tonumber(s) or s) -- strips leading zeros + -- end) + -- context.mathematics(f) + -- end + + -- formatters["\\times10^{%N}"](s) -- strips leading zeros too + + local one = Cs((P("@")/"%%." * (R("09")^1) + P("@")/"%%" + 1)^0) + local two = Cs((P("e")/"" * ((S("+-")^0 * R("09")^1) / function(s) + -- return format("\\times10^{%s}",tonumber(s) or s) + return "\\times10^{" .. (tonumber(s) or s) .."}" + end) + 1)^1) + + -- local two = Cs((P("e")/"" * ((S("+-")^0 * R("09")^1) / formatters["\\times10^{%N}"]) + 1)^1) + + function metapost.formatnumber(fmt,n) -- just lua format + ctx_mathematics(lpegmatch(two,format(lpegmatch(one,fmt),n))) + end + +end + +do + + -- this is an old pass-data-to-tex mechanism + + local ctx_printtable = context.printtable + + local data = false + + function mp.mf_start_saving_data(n) + data = { } + end + + function mp.mf_stop_saving_data() + if data then + -- nothing + end + end + + function mp.mf_finish_saving_data() + if data then + -- nothing + end + end + + function mp.mf_save_data(str) + if data then + data[#data+1] = str + end + end + + local function getdata() + if data then + ctx_printtable(data,"\r") + end + end + + interfaces.implement { + name = "getMPdata", + public = true, + protected = true, + actions = getdata, + } + + interfaces.implement { + name = "rawMPdata", + public = true, + actions = getdata, + } + +end diff --git a/tex/context/base/mkxl/meta-ini.mkxl b/tex/context/base/mkxl/meta-ini.mkxl index ce3e59c96..227e3499a 100644 --- a/tex/context/base/mkxl/meta-ini.mkxl +++ b/tex/context/base/mkxl/meta-ini.mkxl @@ -12,6 +12,8 @@ %C details. %D Some lmtx upgrading work needs to be done here. +%D +%D For real \METAFUN\ magic see \type {https://art-aleatoire.com/}. % initializations: % @@ -60,7 +62,7 @@ \writestatus{loading}{MetaPost Graphics / Initializations} -\registerctxluafile{meta-ini}{} +\registerctxluafile{meta-ini}{autosuffix} \unprotect @@ -197,9 +199,9 @@ \edef\currentMPformat{\MPinstanceparameter\s!format}% \meta_show_properties} -\def\currentMPgraphicname{\s!unknown} -\def\currentMPinstance {\defaultMPinstance} -\def\currentMPformat {\currentMPinstance} +\mutable\def\currentMPgraphicname{\s!unknown} +\mutable\def\currentMPinstance {\defaultMPinstance} +\mutable\def\currentMPformat {\currentMPinstance} \defineMPinstance[metafun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes] \defineMPinstance[minifun] [\s!format=minifun,\s!extensions=\v!yes,\s!initializations=\v!yes] @@ -407,6 +409,8 @@ \mutable\def\width {0 } % left-over \mutable\def\height{0 } % left-over +\mutable\let\currentMPclip\empty + \protected\def\meta_grab_clip_path#1#2#3% {\begingroup \d_overlay_width #2\relax @@ -488,7 +492,8 @@ \newbox\b_meta_variable_box -\let \currentmpvariableclass \empty +\mutable\let \currentmpvariableclass \empty % public + \let \m_meta_current_variable \empty \let \m_meta_current_variable_template\empty @@ -598,7 +603,7 @@ % todo: frozen or not? -\def\overlaystamp % watch the \MPcolor, since colors can be redefined +\permanent\def\overlaystamp % watch the \MPcolor, since colors can be redefined {\the\d_overlay_width :% \the\d_overlay_height :% \the\d_overlay_depth :% @@ -784,7 +789,7 @@ \def\m_meta_page_prefix{\doifelseoddpage oe} -\def\overlaypagestamp +\permanent\def\overlaypagestamp {\m_meta_page_prefix :% \the\d_overlay_width :% \the\d_overlay_height :% @@ -808,7 +813,7 @@ \permanent\tolerant\protected\def\uniqueMPpagegraphic#=#=% {\meta_begin_graphic_group{#1}% - \let\overlaystamp\overlaypagestamp + \enforced\let\overlaystamp\overlaypagestamp \setupMPvariables[\m_meta_page_prefix:#1][#2]% prefix is new here \csname\??mpgraphic\m_meta_page_prefix:#1\endcsname\empty \meta_end_graphic_group} @@ -830,13 +835,10 @@ \def\meta_extend_overlay_stamp#1% {\meta_prepare_instance_variable{#1}% - \edef\overlaystamp{\overlaystamp:\MPvariable{#1}}} - -\permanent\protected\def\getMPdata {\clf_getMPdata} - \aliased\let\rawMPdata \clf_getMPdata % we need frozen at the lua end + \enforced\permanent\edef\overlaystamp{\overlaystamp:\MPvariable{#1}}} -\permanent\protected\def\getMPstored{\clf_getMPstored} - \aliased\let\rawMPstored \clf_getMPstored % we need frozen at the lua end +% \getMPdata % define at the lua end +% \rawMPdata % define at the lua end %D We need this trick because we need to make sure that the tex scanner sees %D newlines and does not quit. Also, we do need to flush the buffer under a normal diff --git a/tex/context/base/mkxl/meta-nod.mkxl b/tex/context/base/mkxl/meta-nod.mkxl index 021e84561..3f7a5a79f 100644 --- a/tex/context/base/mkxl/meta-nod.mkxl +++ b/tex/context/base/mkxl/meta-nod.mkxl @@ -226,6 +226,8 @@ \setvalue{\??metanodesoption dashed}{dashed evenly} \setvalue{\??metanodesoption dotted}{dashed withdots scaled .5} +\aliased\let\connectnodes\relax + \appendtoks \enforced\let\connectnodes\grph_nodes_fromto \to \t_every_meta_nodes diff --git a/tex/context/base/mkxl/meta-tex.mkxl b/tex/context/base/mkxl/meta-tex.mkxl index a2377c321..5937ce408 100644 --- a/tex/context/base/mkxl/meta-tex.mkxl +++ b/tex/context/base/mkxl/meta-tex.mkxl @@ -50,6 +50,28 @@ \letvalue{\??graphictexdepth n}\donothing \letvalue{\??graphictexdepth\s!nodepth}\donothing +% old hackery, slightly modernized + +\permanent\protected\def\definetextext[#1]% + {\tolerant\defcsname\??graphictexarguments#1\endcsname} + +\permanent\tolerant\def\sometxt[#1]#*[#2]% + {\ifarguments + \expandafter\meta_some_txt_a + \or + \expandafter\meta_some_txt_b + \or + \expandafter\meta_some_txt_c + \or + \fi{#1}{#2}} + +\def\meta_some_txt_a#1#2#3{textext.drt("\clf_metapostescaped{#3}")} +\def\meta_some_txt_b#1#2#3{textext.drt("\mpsometxt{#1}{\clf_metapostescaped{#3}}")} +\def\meta_some_txt_c#1#2#3{textext.drt("\mpsometxt{#1}[#2]{\clf_metapostescaped{#3}}")} + +\permanent\protected\def\mpsometxt#1% + {\begincsname\??graphictexarguments#1\endcsname} + % \definetextext[framed]{\framed} % % \startMPcode @@ -65,39 +87,7 @@ % draw \sometxt[framed][foregroundstyle=bold]{Mojca's}; % draw \sometxt[framed]{eyes only!} rotated -45 ; % \stopMPcode - -\permanent\protected\def\definetextext[#1]% - {\def\currenttextext{#1}% - \doifelsenextoptionalcs\meta_textext_define_one\meta_textext_define_zero} - -\def\meta_textext_define_one {\setvalue{\??graphictexarguments1:\currenttextext}} -\def\meta_textext_define_zero{\setvalue{\??graphictexarguments0:\currenttextext}} - -\permanent\def\sometxt#1#{\meta_some_txt{#1}} - -\def\meta_some_txt#1#2% we need to capture embedded quotes (a bit messy as later on textext is filtered - {textext.drt("\mpsometxt#1{\clf_metapostescaped{#2}}")} - -\permanent\protected\def\mpsometxt % no _ catcode - {\doifelsenextoptionalcs\meta_some_txt_indeed_yes\meta_some_txt_indeed_nop} - -\def\meta_some_txt_indeed_yes[#1]% - {\def\currenttextext{#1}% - \csname\??graphictexarguments - \ifcsname\??graphictexarguments0:#1\endcsname0\else - \ifcsname\??graphictexarguments1:#1\endcsname1\else - ?\fi\fi - \endcsname} - -\def\meta_some_txt_indeed_nop - {} - -\setvalue{\??graphictexarguments ?}{} -\setvalue{\??graphictexarguments 0}{\csname\??graphictexarguments\currenttextext\endcsname} -\setvalue{\??graphictexarguments 1}{\dosingleempty\meta_gx_one} - -\def\meta_gx_one{\csname\??graphictexarguments1:\currenttextext\endcsname} - +% % \definetextext[framed][#1]#2{\framed[width=4cm]{\switchtobodyfont[#1]#2}} % \definetextext[simple]{\framed[width=8cm]} % diff --git a/tex/context/base/mkxl/mult-aux.mkxl b/tex/context/base/mkxl/mult-aux.mkxl index 20199667c..31b8ae878 100644 --- a/tex/context/base/mkxl/mult-aux.mkxl +++ b/tex/context/base/mkxl/mult-aux.mkxl @@ -379,8 +379,6 @@ \expandafter\noexpand\csname use#2styleparameter\endcsname \expandafter\noexpand\csname use#2colorparameter\endcsname}} -\let\definehandlerparent\empty - \def\mult_check_for_parent#1#2#3#4% {\ifcsname#1#4:\s!parent\endcsname\orelse\ifx#4\empty\else \writestatus\m!system{error: invalid parent #4 for #3, #4 defined too (best check it)}% @@ -492,10 +490,10 @@ \expandafter\noexpand\csname everysetup#2root\endcsname \expandafter\noexpand\csname nested_setup_current#2\endcsname}} -\let\doingrootsetupnamed\plusone % \setuplayout[name][key=value] -\let\doingrootsetuproot \plustwo % \setuplayout [key=value] -\let\doingrootsetnamed \plusthree % \setuplayout[name] -\let\doingrootsetroot \plusfour % \setuplayout +\aliased\let\doingrootsetupnamed\plusone % \setuplayout[name][key=value] +\aliased\let\doingrootsetuproot \plustwo % \setuplayout [key=value] +\aliased\let\doingrootsetnamed \plusthree % \setuplayout[name] +\aliased\let\doingrootsetroot \plusfour % \setuplayout \protected\def\mult_interfaces_install_switch_setup_handler_a#1#2#3% {\frozen\protected\def#3{\mult_interfaces_get_parameters{#1#2:}}} diff --git a/tex/context/base/mkxl/mult-ini.mkxl b/tex/context/base/mkxl/mult-ini.mkxl index 1b13b1dbc..f2dad6fac 100644 --- a/tex/context/base/mkxl/mult-ini.mkxl +++ b/tex/context/base/mkxl/mult-ini.mkxl @@ -232,7 +232,7 @@ \else - \def\defaultinterface{english} + \immutable\def\defaultinterface{english} \permanent\overloaded\protected\def\selectinterface {\enforced\permanent\protected\def\selectinterface##1##2% @@ -252,8 +252,8 @@ \fi -\ifdefined\currentinterface \else \let\currentinterface\defaultinterface \fi -\ifdefined\currentresponses \else \let\currentresponses\defaultinterface \fi +\ifdefined\currentinterface \else \aliased\let\currentinterface\defaultinterface \fi +\ifdefined\currentresponses \else \aliased\let\currentresponses\defaultinterface \fi %D \macros %D {startinterface} diff --git a/tex/context/base/mkxl/node-nut.lmt b/tex/context/base/mkxl/node-nut.lmt index 296f6f446..ab44e4d92 100644 --- a/tex/context/base/mkxl/node-nut.lmt +++ b/tex/context/base/mkxl/node-nut.lmt @@ -98,6 +98,7 @@ local nuts = { getnucleus = direct.getnucleus, getoffsets = direct.getoffsets, -- getxyoffsets = direct.getxyoffsets, + getscale = direct.getscale, getscales = direct.getscales, getxscale = direct.getxscale, getyscale = direct.getyscale, @@ -191,6 +192,7 @@ local nuts = { setlist = direct.setlist, setnext = direct.setnext, setnucleus = direct.setnucleus, + setscale = direct.setscale or direct.setscales, setscales = direct.setscales, setoffsets = direct.setoffsets, addxoffset = direct.addxoffset, diff --git a/tex/context/base/mkxl/node-rul.mkxl b/tex/context/base/mkxl/node-rul.mkxl index 3adf3b5b8..2b55561d8 100644 --- a/tex/context/base/mkxl/node-rul.mkxl +++ b/tex/context/base/mkxl/node-rul.mkxl @@ -226,8 +226,8 @@ \aliased\let\normalmathoverbar \overbar \aliased\let\normalmathunderbar \underbar -\aliased\let\normalmathoverstrike \overstrike -\aliased\let\normalmathunderstrike\understrike +%aliased\let\normalmathoverstrike \overstrike +%aliased\let\normalmathunderstrike\understrike \definebar[\v!overbar] [\c!method=1,\c!dy=0.4,\c!offset=1.8,\c!continue=\v!yes] \definebar[\v!underbar] [\c!method=1,\c!dy=-0.4,\c!offset=-0.3,\c!continue=\v!yes] @@ -273,19 +273,19 @@ \enforced\permanent\expandafter\let\expandafter\overbar\csname\v!overbar\endcsname \fi -\ifdefined\normalmathunderstrike - \enforced\permanent\expandafter\let\expandafter\normaltextunderstrike\csname\v!understrike\endcsname - \enforced\permanent\protected\def\understrike{\mathortext\normalmathunderstrike\normaltextunderstrike} -\else - \enforced\permanent\expandafter\let\expandafter\understrike\csname\v!understrike\endcsname -\fi - -\ifdefined\normalmathoverstrike - \enforced\permanent\expandafter\let\expandafter\normaltextoverstrike\csname\v!overstrike\endcsname - \enforced\permanent\protected\def\overstrike{\mathortext\normalmathoverstrike \normaltextoverstrike} -\else - \enforced\permanent\expandafter\let\expandafter\overstrike\csname\v!overstrike\endcsname -\fi +% \ifdefined\normalmathunderstrike +% \enforced\permanent\expandafter\let\expandafter\normaltextunderstrike\csname\v!understrike\endcsname +% \enforced\permanent\protected\def\understrike{\mathortext\normalmathunderstrike\normaltextunderstrike} +% \else +% \enforced\permanent\expandafter\let\expandafter\understrike\csname\v!understrike\endcsname +% \fi +% +% \ifdefined\normalmathoverstrike +% \enforced\permanent\expandafter\let\expandafter\normaltextoverstrike\csname\v!overstrike\endcsname +% \enforced\permanent\protected\def\overstrike{\mathortext\normalmathoverstrike \normaltextoverstrike} +% \else +% \enforced\permanent\expandafter\let\expandafter\overstrike\csname\v!overstrike\endcsname +% \fi \enforced\permanent\expandafter\let\expandafter\overstrikes\csname\v!overstrikes\endcsname \enforced\permanent\expandafter\let\expandafter\underbars \csname\v!underbars \endcsname @@ -441,17 +441,17 @@ \expandafter\let\expandafter\shiftup \csname\v!shiftup \endcsname \expandafter\let\expandafter\shiftdown \csname\v!shiftdown \endcsname -% This is a weird helper: +% This is a weird helper.. these might go away: -\protected\def\dostartisolation{\signalcharacter} -\protected\def\dostopisolation {\signalcharacter} -\protected\def\doisolator {\signalcharacter} +\permanent\protected\def\dostartisolation{\signalcharacter} +\permanent\protected\def\dostopisolation {\signalcharacter} +\permanent\protected\def\doisolator {\signalcharacter} -\protected\def\dosetupisolatedalign#1% +\permanent\protected\def\dosetupisolatedalign#1% {\doisolator \setupalign[#1]\relax} -\protected\def\doisolatedgroupedalign#1#2% +\permanent\protected\def\doisolatedgroupedalign#1#2% {\groupedcommand {\begingroup\dostartisolation\begingroup#1} {#2\endgroup\dostopisolation\endgroup}} diff --git a/tex/context/base/mkxl/pack-box.mkxl b/tex/context/base/mkxl/pack-box.mkxl index 3cb50d6f0..71a2dd326 100644 --- a/tex/context/base/mkxl/pack-box.mkxl +++ b/tex/context/base/mkxl/pack-box.mkxl @@ -51,6 +51,8 @@ % % \anchor[text-1][preset=lefttop][framed settings]{HELLO WORLD} +\mutable\let\currentanchor\empty + \permanent\tolerant\protected\def\defineanchor[#1]#*[#2]#*[#3]#*[#4]% name targetlayer layersetting framedsetting {\setvalue{\??anchor#1}{\pack_anchors_process_defined{#2}{#3}{#4}}} @@ -324,8 +326,8 @@ {\begingroup \pack_boxes_collector_check_box{#1}% \ifconditional\c_pack_boxes_collector_valid_box + \letcollectorparameter\c!hoffset\zeropoint \letcollectorparameter\c!voffset\zeropoint - \letcollectorparameter\h!voffset\zeropoint \setupcurrentcollector[#2]% \global\wd\b_pack_boxes_collector\dimexpr\wd\b_pack_boxes_collector+\collectorparameter\c!hoffset\relax \global\ht\b_pack_boxes_collector\dimexpr\ht\b_pack_boxes_collector+\collectorparameter\c!voffset\relax @@ -544,6 +546,9 @@ \setvalue{\??bleedinglocation tr}{\settrue\c_pack_boxes_r\settrue\c_pack_boxes_t} \setvalue{\??bleedinglocation rt}{\settrue\c_pack_boxes_r\settrue\c_pack_boxes_t} +\mutable\let\currentbleedposition\empty +\mutable\let\currentpageposition \empty + \permanent\tolerant\protected\def\bleed[#1]% {\hbox\bgroup \global\advance\c_pack_boxes_bleeds\plusone @@ -551,8 +556,8 @@ \enforced\permanent\xdef\bleedwidth {\the\hsize}% \enforced\permanent\xdef\bleedheight{\the\vsize}% % - \edef\currentbgposition {bleed:\number\c_pack_boxes_bleeds}% - \edef\currentpageposition{page:0}% todo: per page + \edef\currentbleedposition{bleed:\number\c_pack_boxes_bleeds}% + \edef\currentpageposition {page:0}% todo: per page % \setupcurrentbleeding[#1]% % @@ -574,9 +579,9 @@ \enforced\permanent\xdef\bleedwidth{\the\dimexpr \ifdone \ifconditional\c_pack_boxes_l - \scratchwidth+\MPx\currentbgposition-\MPx\currentpageposition + \scratchwidth+\MPx\currentbleedposition-\MPx\currentpageposition \orelse\ifconditional\c_pack_boxes_r - \paperwidth -\MPx\currentbgposition+\MPx\currentpageposition % not checked + \paperwidth -\MPx\currentbleedposition+\MPx\currentpageposition % not checked \else \scratchwidth \fi @@ -587,9 +592,9 @@ \enforced\permanent\xdef\bleedheight{\the\dimexpr \ifdone \ifconditional\c_pack_boxes_t - \paperheight -\MPy\currentbgposition+\MPy\currentpageposition % not checked + \paperheight -\MPy\currentbleedposition+\MPy\currentpageposition % not checked \orelse\ifconditional\c_pack_boxes_b - \scratchheight+\MPy\currentbgposition-\MPy\currentpageposition + \MPh\currentbgposition % not checked (\MPh added) + \scratchheight+\MPy\currentbleedposition-\MPy\currentpageposition + \MPh\currentbleedposition % not checked (\MPh added) \else \scratchheight \fi @@ -618,7 +623,7 @@ \ht\nextbox\scratchheight \dp\nextbox\zeropoint \ifdone - \hpos\currentbgposition{\box\nextbox}% + \hpos\currentbleedposition{\box\nextbox}% \else \box\nextbox \fi diff --git a/tex/context/base/mkxl/pack-com.mkxl b/tex/context/base/mkxl/pack-com.mkxl index b70e30892..d2a9af914 100644 --- a/tex/context/base/mkxl/pack-com.mkxl +++ b/tex/context/base/mkxl/pack-com.mkxl @@ -228,6 +228,10 @@ \newtoks\everycombination +\aliased\let\combination\empty + +\let\p_nx_ny\empty + \permanent\protected\def\stopcombination {\bgroup\normalexpanded{\egroup{}\ntimes{{}{}}\c_pack_combinations_y}% brr \dostoptagged @@ -239,52 +243,52 @@ {\bgroup % so we can grab a group \pack_combinations_push \edef\currentcombination{#1}% - \edef\currentcombinationspec{#2}% + \edef\p_nx_ny{#2}% % - \ifempty\currentcombinationspec + \ifempty\p_nx_ny \ifcondition\validassignment{#1}% \let\currentcombination\empty \setupcurrentcombination[#1]% - \edef\currentcombinationspec{\combinationparameter\c!nx*\combinationparameter\c!ny*}% + \edef\p_nx_ny{\combinationparameter\c!nx*\combinationparameter\c!ny*}% \else \doifelseinstring{*}\currentcombination - {\edef\currentcombinationspec{\currentcombination*\plusone*}% + {\edef\p_nx_ny{\currentcombination*\plusone*}% \let\currentcombination\empty} {\doifelsenumber\currentcombination - {\edef\currentcombinationspec{\currentcombination*\plusone*}% + {\edef\p_nx_ny{\currentcombination*\plusone*}% \let\currentcombination\empty} - {\edef\currentcombinationspec{\combinationparameter\c!nx*\combinationparameter\c!ny*}}}% + {\edef\p_nx_ny{\combinationparameter\c!nx*\combinationparameter\c!ny*}}}% \fi \else \ifcondition\validassignment{#2}% \setupcurrentcombination[#2]% - \edef\currentcombinationspec{\combinationparameter\c!nx*\combinationparameter\c!ny*}% + \edef\p_nx_ny{\combinationparameter\c!nx*\combinationparameter\c!ny*}% \else - \edef\currentcombinationspec{\currentcombinationspec*\plusone*}% + \edef\p_nx_ny{\p_nx_ny*\plusone*}% \fi \fi % % test first: % -% \ifempty\currentcombinationspec +% \ifempty\p_nx_ny % \ifhastok={#1}% % \let\currentcombination\empty % \setupcurrentcombination[#1]% -% \edef\currentcombinationspec{\combinationparameter\c!nx*\combinationparameter\c!ny*}% +% \edef\p_nx_ny{\combinationparameter\c!nx*\combinationparameter\c!ny*}% % \orelse\ifhastok*{\currentcombination}% -% \edef\currentcombinationspec{\currentcombination*\plusone*}% +% \edef\p_nx_ny{\currentcombination*\plusone*}% % \let\currentcombination\empty % \orelse\ifchknum\currentcombination\or -% \edef\currentcombinationspec{\currentcombination*\plusone*}% +% \edef\p_nx_ny{\currentcombination*\plusone*}% % \let\currentcombination\empty % \else -% \edef\currentcombinationspec{\combinationparameter\c!nx*\combinationparameter\c!ny*}% +% \edef\p_nx_ny{\combinationparameter\c!nx*\combinationparameter\c!ny*}% % \fi % \orelse\ifhastok={#2}% % \setupcurrentcombination[#2]% -% \edef\currentcombinationspec{\combinationparameter\c!nx*\combinationparameter\c!ny*}% +% \edef\p_nx_ny{\combinationparameter\c!nx*\combinationparameter\c!ny*}% % \else -% \edef\currentcombinationspec{\currentcombinationspec*\plusone*}% +% \edef\p_nx_ny{\p_nx_ny*\plusone*}% % \fi % \forgetall @@ -306,8 +310,8 @@ % \dostarttaggedchained\t!combination\currentcombination\??combination \vbox \ifx\p_height\v!fit\else to \p_height \fi \bgroup - \let\combination\empty % permits \combination{}{} handy for cld - \normalexpanded{\pack_combinations_start_indeed[\currentcombinationspec]}} + \enforced\let\combination\empty % permits \combination{}{} handy for cld + \normalexpanded{\pack_combinations_start_indeed[\p_nx_ny]}} \let\pack_combinations_check_x_y\relax diff --git a/tex/context/base/mkxl/pack-lyr.mkxl b/tex/context/base/mkxl/pack-lyr.mkxl index 6f84b0628..bb4926db5 100644 --- a/tex/context/base/mkxl/pack-lyr.mkxl +++ b/tex/context/base/mkxl/pack-lyr.mkxl @@ -95,7 +95,7 @@ \c!sy=1, \c!region=\layeranchor] -\def\layeranchor{\currentlayer:\the\realpageno} +\permanent\def\layeranchor{\currentlayer:\the\realpageno} \let\p_pack_layers_doublesided\empty \let\p_pack_layers_state \empty diff --git a/tex/context/base/mkxl/pack-mrl.mkxl b/tex/context/base/mkxl/pack-mrl.mkxl index e0ab0708c..7bdbc6b60 100644 --- a/tex/context/base/mkxl/pack-mrl.mkxl +++ b/tex/context/base/mkxl/pack-mrl.mkxl @@ -189,7 +189,7 @@ \s!height\linewidth \s!depth \zeropoint}} -\let\dovlwdhtdp\pack_rule_vl_indeed % used elsewhere +% \let\dovlwdhtdp\pack_rule_vl_indeed % used elsewhere .. not any more %D \macros %D {hairline, thinrule, thinrules, setupthinrules} diff --git a/tex/context/base/mkxl/pack-rul.mkxl b/tex/context/base/mkxl/pack-rul.mkxl index 2471f3ca2..e793b1e53 100644 --- a/tex/context/base/mkxl/pack-rul.mkxl +++ b/tex/context/base/mkxl/pack-rul.mkxl @@ -200,7 +200,7 @@ \newdimen\d_framed_target_wd \newdimen\d_framed_target_ht \newdimen\d_framed_target_dp -\newdimen\d_framed_linewidth \let\ruledlinewidth\d_framed_linewidth % needed at lua end +\newdimen\d_framed_linewidth \aliased\let\ruledlinewidth\d_framed_linewidth % needed at lua end \let\p_framed_frame \empty % \framedparameter\c!frame \let\p_framed_backgroundoffset\empty @@ -539,6 +539,8 @@ \newdimen\framedbackgrounddepth \newdimen\framedbackgroundoffset +\aliased\let\foregroundbox\relax + \def\pack_framed_background_box_content% fuzzy but needed hack, this \vss, otherwise {\vpack to \framedbackgroundheight{\vss\box\b_framed_normal\vss}} % vertical shift \backgroundheight @@ -567,7 +569,7 @@ \else \setlayoutcomponentattribute{\v!background:\p_framed_component}% \fi - \let\foregroundbox\pack_framed_background_box_content + \enforced\let\foregroundbox\pack_framed_background_box_content \hpack \layoutcomponentboxattribute to \framedbackgroundwidth\bgroup % width in case 'foreground' is used as overlay \the\everybackgroundbox % moved \expandafter\pack_framed_process_backgrounds\p_framed_background,\s!unknown,\relax % hm, messy .. look into it @@ -759,7 +761,7 @@ %D for passing this identifier between brackets lays in the mere fact that this way %D we can use the optional argument grabbers. -\def\defaultframeoffset{.25\exheight} +\mutable\def\defaultframeoffset{.25\exheight} \installcorenamespace{regularframedlevel} @@ -985,9 +987,9 @@ \defineinterfaceconstant {fr!analyze} {fr:analyze} % private option -\let\delayedbegstrut\relax -\let\delayedendstrut\relax -\let\delayedstrut \relax +\aliased\let\delayedbegstrut\relax +\aliased\let\delayedendstrut\relax +\aliased\let\delayedstrut \relax \mutable\let\localoffset\empty \mutable\let\localwidth \empty @@ -995,6 +997,14 @@ \mutable\let\localformat\empty \mutable\let\localstrut \empty +\mutable\let\framedwidth \empty +\mutable\let\framedheight\empty +\mutable\let\framedoffset\empty + +\aliased\let\localbegstrut\relax +\aliased\let\localendstrut\relax +\aliased\let\localstrut \relax + \protected\def\pack_framed_process_indeed {\d_framed_frameoffset\framedparameter\c!frameoffset \edef\p_framed_backgroundoffset{\framedparameter\c!backgroundoffset}% diff --git a/tex/context/base/mkxl/page-bck.mkxl b/tex/context/base/mkxl/page-bck.mkxl index dc4cc602a..334a797b8 100644 --- a/tex/context/base/mkxl/page-bck.mkxl +++ b/tex/context/base/mkxl/page-bck.mkxl @@ -600,9 +600,12 @@ \permanent\protected\def\disablehiddenbackground {\global\setfalse\c_page_backgrounds_hidden_enabled} -\def\hiddenbackgroundlist +\immutable\def\hiddenbackgroundlist {\v!text-2,\v!text-1,\v!foreground,\v!text+1,\v!text+2} +\permanent\protected\def\prependhiddenbackground#1{\enforced\edef\hiddenbackgroundlist{#1,\hiddenbackgroundlist}} +\permanent\protected\def\appendhiddenbackground #1{\enforced\edef\hiddenbackgroundlist{\hiddenbackgroundlist,#1}} + \defineoverlay[\v!text-2][\positionregionoverlay\textanchor{\v!text-2}] % no new anchor, we share text \defineoverlay[\v!text-1][\positionregionoverlay\textanchor{\v!text-1}] \defineoverlay[\v!text+1][\positionregionoverlay\textanchor{\v!text+1}] diff --git a/tex/context/base/mkxl/page-cst.mkxl b/tex/context/base/mkxl/page-cst.mkxl index 31cf158f5..d0d6f2abd 100644 --- a/tex/context/base/mkxl/page-cst.mkxl +++ b/tex/context/base/mkxl/page-cst.mkxl @@ -720,7 +720,9 @@ % maybe move the left/right correction to the tex end or the offset to lua -\protected\def\page_grd_set_area#1#2#3#4#5#6#7#8% can be optimized +% used nowhere: + +\permanent\protected\def\setpagegridarea#1#2#3#4#5#6#7#8% can be optimized {\begingroup \edef\currentpagegridarea{#2}% \setpagegridareaparameter\c!width {#5\scaledpoint}% @@ -763,8 +765,6 @@ \fi \endgroup} -\aliased\let\setpagegridarea\page_grd_set_area - % state start | repeat %D The old one, for now: diff --git a/tex/context/base/mkxl/page-ini.mkxl b/tex/context/base/mkxl/page-ini.mkxl index e78f759a8..0a0993d44 100644 --- a/tex/context/base/mkxl/page-ini.mkxl +++ b/tex/context/base/mkxl/page-ini.mkxl @@ -186,7 +186,7 @@ \box\b_page_otr_special \fi} -\def\page_otr_add_special_content +\permanent\protected\def\page_otr_add_special_content {\dowithnextboxcs\page_otr_add_special_content_indeed\hbox} \permanent\protected\def\page_otr_add_special_content_indeed diff --git a/tex/context/base/mkxl/page-lay.mkxl b/tex/context/base/mkxl/page-lay.mkxl index 29698cb67..6a5b5c09e 100644 --- a/tex/context/base/mkxl/page-lay.mkxl +++ b/tex/context/base/mkxl/page-lay.mkxl @@ -537,8 +537,8 @@ \enforced\global\swapcsvalues\paperwidth\paperheight \fi \ifinpagebody % local freeze - \normalexpanded{\setlayouttargetparemeter\c!height{\the\paperheight}}% - \normalexpanded{\setlayouttargetparemeter\c!width {\the\paperwidth }}% + \normalexpanded{\setlayouttargetparameter\c!height{\the\paperheight}}% + \normalexpanded{\setlayouttargetparameter\c!width {\the\paperwidth }}% \fi % \page_paper_set_offsets diff --git a/tex/context/base/mkxl/page-txt.mklx b/tex/context/base/mkxl/page-txt.mklx index a5a5a97ab..981a15089 100644 --- a/tex/context/base/mkxl/page-txt.mklx +++ b/tex/context/base/mkxl/page-txt.mklx @@ -90,6 +90,9 @@ \fi \to \everysetuplayoutelement +\mutable\let\currenttextstate \empty +\mutable\let\previoustextstate\empty + \def\page_layouts_reset_element_status#vertical% {\gdefcsname\??layouttextsreset#vertical\endcsname{\page_layouts_set_element_status_normal#vertical}} @@ -172,6 +175,8 @@ \permanent\protected\def\setupfootertexts{\setuptexts[\v!footer]} \permanent\protected\def\setupbottomtexts{\setuptexts[\v!bottom]} +\mutable\let\currentlayoutelementstate\empty + \permanent\tolerant\protected\def\setuptexts[#vertical]#spacer[#horizontal]#spacer[#a]#spacer[#b]#spacer[#c]#spacer[#d]% {\ifarguments % there is always one @@ -238,15 +243,15 @@ \uselayoutelementstyleandcolor#style#color% \begincsname\??layouttextstrut\layoutelementparameter\c!strut\endcsname \ignorecrlf - \edef\currentlayoutelementwidth{\layoutelementparameter#width}% - \ifempty\currentlayoutelementwidth\else + \edef\p_width{\layoutelementparameter#width}% + \ifempty\p_width\else \expandafter\page_layouts_process_element_limited \fi\p_text \endgroup} \def\page_layouts_process_element_limited#content% are the {}{}{} still needed? {\limitated - left \currentlayoutelementwidth + left \p_width text {#content} sentinel {\unknown} \relax} @@ -267,6 +272,8 @@ \newcount\c_page_layouts_element_state_n +\mutable\let\textlinestatus\empty + \def\page_layouts_set_element_status#vertical% {\c_page_layouts_element_state_n=0\namedlayoutelementparameter#vertical\c!n\relax \ifcase\c_page_layouts_element_state_n diff --git a/tex/context/base/mkxl/publ-ini.mkxl b/tex/context/base/mkxl/publ-ini.mkxl index e3eee279d..b1af17413 100644 --- a/tex/context/base/mkxl/publ-ini.mkxl +++ b/tex/context/base/mkxl/publ-ini.mkxl @@ -771,9 +771,9 @@ \fi \to \everybtxlistrendering -\def\nofbtxlistentries {0} -\def\currentbtxlistentry{0} -\def\currentbtxlistindex{0} % only for internal use (points back to big list) +\mutable\let\nofbtxlistentries \!!zerocount +\mutable\let\currentbtxlistentry\!!zerocount +\mutable\let\currentbtxlistindex\!!zerocount % only for internal use (points back to big list) \newconditional\c_publ_prefixed @@ -1888,28 +1888,28 @@ % \btxusecommand[btx:apa:list:article:title]{foo} % \btxstopstyle -\let\savedcurrentbtx\empty +\mutable\let\m_btx_saved_current\empty \permanent\protected\def\btxstartstyle[#1]% {\begingroup - \let\savedcurrentbtx\currentbtx + \let\m_btx_saved_current\currentbtx \def\currentbtx{#1}% \usebtxstyleparameter\c!style - \let\currentbtx\savedcurrentbtx} + \let\currentbtx\m_btx_saved_current} \permanent\protected\def\btxstartcolor[#1]% {\begingroup - \let\savedcurrentbtx\currentbtx + \let\m_btx_saved_current\currentbtx \def\currentbtx{#1}% \usebtxcolorparameter\c!color - \let\currentbtx\savedcurrentbtx} + \let\currentbtx\m_btx_saved_current} \permanent\protected\def\btxstartstyleandcolor[#1]% {\begingroup - \let\savedcurrentbtx\currentbtx + \let\m_btx_saved_current\currentbtx \def\currentbtx{#1}% \usebtxstyleandcolor\c!style\c!color - \let\currentbtx\savedcurrentbtx} + \let\currentbtx\m_btx_saved_current} \aliased\let\btxstopstyle \endgroup \aliased\let\btxstopcolor \endgroup diff --git a/tex/context/base/mkxl/publ-old.mkxl b/tex/context/base/mkxl/publ-old.mkxl index cf7e0c46b..e5cc98a74 100644 --- a/tex/context/base/mkxl/publ-old.mkxl +++ b/tex/context/base/mkxl/publ-old.mkxl @@ -15,8 +15,8 @@ % No protection because we have a module that overloads them! -\protected\def\setupbibtex {\usemodule[oldbibtex]\setupbibtex} -\protected\def\setuppublications {\usemodule[oldbibtex]\setuppublications} -\protected\def\setuppublicationlist{\usemodule[oldbibtex]\setuppublicationlist} +\mutable\protected\def\setupbibtex {\usemodule[oldbibtex]\setupbibtex} +\mutable\protected\def\setuppublications {\usemodule[oldbibtex]\setuppublications} +\mutable\protected\def\setuppublicationlist{\usemodule[oldbibtex]\setuppublicationlist} \protect diff --git a/tex/context/base/mkxl/spac-grd.mkxl b/tex/context/base/mkxl/spac-grd.mkxl index fbb02f50c..cc293532b 100644 --- a/tex/context/base/mkxl/spac-grd.mkxl +++ b/tex/context/base/mkxl/spac-grd.mkxl @@ -326,7 +326,7 @@ \fi \fi} -\let\normalstartbaselinecorrection\startbaselinecorrection +\aliased\let\normalstartbaselinecorrection\startbaselinecorrection \pushoverloadmode diff --git a/tex/context/base/mkxl/spac-hor.mkxl b/tex/context/base/mkxl/spac-hor.mkxl index 1e7781026..cf67e8093 100644 --- a/tex/context/base/mkxl/spac-hor.mkxl +++ b/tex/context/base/mkxl/spac-hor.mkxl @@ -418,7 +418,7 @@ % When we don't add the % here, we effectively get \ and % since we have by default \def\^^M{\ } we get into a loop. -\let\normalspaceprimitive=\ % space-comment is really needed +\aliased\let\normalspaceprimitive=\ % space-comment is really needed %D As the \type{\ } is convenient in: %D @@ -431,14 +431,26 @@ %D from now on we treat it as a normal space and not as a space with \type %D {sfcode} 1000. +% \permanent\protected\def\specialspaceprimitive +% {\begingroup +% % so, no fancy extra spacing after: foo i.e.\ bar +% \nonfrenchspacing\normalspaceprimitive +% \endgroup} + \permanent\protected\def\specialspaceprimitive - {\begingroup - % so, no fancy extra spacing after: foo i.e.\ bar - \nonfrenchspacing\normalspaceprimitive - \endgroup} + {% is a current state, set explicitly or when a character is appended + \ifhmode + \spacefactor\plusthousand + \else + \dontleavehmode + \fi + \normalspaceprimitive} + +% \permanent\protected\def\normalnotobeyedspace +% {\mathortext\normalspaceprimitive\specialspaceprimitive} % no \dontleavehmode\space (else no frenchspacing) \permanent\protected\def\normalnotobeyedspace - {\mathortext\normalspaceprimitive\specialspaceprimitive} % no \dontleavehmode\space (else no frenchspacing) + {\ifmmode\normalspaceprimitive\else\specialspaceprimitive\fi} % no \dontleavehmode\space (else no frenchspacing) \pushoverloadmode @@ -1070,7 +1082,7 @@ \s!plus#2\interwordstretch \s!minus#3\interwordshrink} -\def\fixedspaceamount#1% +\permanent\def\fixedspaceamount#1% {#1\interwordspace} % moved from page-lin diff --git a/tex/context/base/mkxl/spac-ver.mkxl b/tex/context/base/mkxl/spac-ver.mkxl index 3d0963df5..5c150f225 100644 --- a/tex/context/base/mkxl/spac-ver.mkxl +++ b/tex/context/base/mkxl/spac-ver.mkxl @@ -1502,12 +1502,12 @@ \permanent\protected\def\installsnapvalues#1#2% {\let\m_spac_snapper\empty \rawprocesscommacommand[#2]\spac_grids_expand_snapper - \edef\currentsnapper{#1:\m_spac_snapper}% - \ifcsname\??gridsnapperattributes\currentsnapper\endcsname + \edef\p_spac_snapper{#1:\m_spac_snapper}% + \ifcsname\??gridsnapperattributes\p_spac_snapper\endcsname \scratchcounter\lastnamedcs % already defined \else \scratchcounter\clf_definesnapmethod{#1}{\m_spac_snapper}% - \edefcsname\??gridsnapperattributes\currentsnapper\endcsname{\the\scratchcounter}% + \edefcsname\??gridsnapperattributes\p_spac_snapper\endcsname{\the\scratchcounter}% \fi \edefcsname\??gridsnappers#1\endcsname{\c_attr_snapmethod\the\scratchcounter\relax}% \letcsname\??gridsnappersets#1\endcsname\m_spac_snapper} diff --git a/tex/context/base/mkxl/strc-flt.mklx b/tex/context/base/mkxl/strc-flt.mklx index f5d2b3c97..6086f09b6 100644 --- a/tex/context/base/mkxl/strc-flt.mklx +++ b/tex/context/base/mkxl/strc-flt.mklx @@ -2548,7 +2548,7 @@ \initializeboxstack\??localfloatstack -\newcount\c_strc_localfloats_n \let\noflocalfloats\c_strc_localfloats_n +\newcount\c_strc_localfloats_n \aliased\let\noflocalfloats\c_strc_localfloats_n \permanent\protected\def\resetlocalfloats {\global\c_strc_localfloats_n\zerocount diff --git a/tex/context/base/mkxl/strc-itm.mklx b/tex/context/base/mkxl/strc-itm.mklx index c6206edd5..16bed0d6c 100644 --- a/tex/context/base/mkxl/strc-itm.mklx +++ b/tex/context/base/mkxl/strc-itm.mklx @@ -796,6 +796,9 @@ \advance\d_strc_itemgroups_list_width\itemgroupparameter\c!distance\relax \let\currentitemgroup\savedcurrentitemgroup} +\let\p_itemgroups_options \empty +\let\p_itemgroups_extra_options\empty + \permanent\tolerant\protected\def\startitemgroup[#category]#spacer[#options]#spacer[#settings]% {\begingroup % (1) \nofarguments\lastarguments @@ -806,8 +809,8 @@ \normalexpanded{\chaintocurrentitemgroup{\currentparentitemgroup:\currentitemlevel}}% \edef\currentitemgroup{\currentparentitemgroup:\currentitemlevel}% % - \edef\itemgroupoptions{\itemgroupparameter\c!option}% - \let\itemgroupextraoptions\empty + \edef\p_itemgroups_options{\itemgroupparameter\c!option}% + \let\p_itemgroups_extra_options\empty \ifcase\nofarguments \strc_itemgroups_start_indeed{}% \or @@ -816,27 +819,27 @@ \ifhastok={#options}% \strc_itemgroups_start_indeed{#options}% \else - \edef\itemgroupextraoptions{#options}% + \edef\p_itemgroups_extra_options{#options}% \strc_itemgroups_start_indeed{}% \fi \or - \edef\itemgroupextraoptions{#options}% + \edef\p_itemgroups_extra_options{#options}% \strc_itemgroups_start_indeed{#settings}% \fi} \def\strc_itemgroups_start_indeed#settings% - {\ifempty\itemgroupoptions - \let\itemgroupoptions\itemgroupextraoptions - \orelse\ifempty\itemgroupextraoptions + {\ifempty\p_itemgroups_options + \let\p_itemgroups_options\p_itemgroups_extra_options + \orelse\ifempty\p_itemgroups_extra_options % ok \else - \edef\itemgroupoptions{\itemgroupoptions,\itemgroupextraoptions}% + \edef\p_itemgroups_options{\p_itemgroups_options,\p_itemgroups_extra_options}% \fi \begingroup % (2) \the\itemgroupcommands \setconditional\c_strc_itemgroups_text_saved\c_strc_itemgroups_text \strc_itemgroups_initialize_local - \strc_itemgroups_preset_stage_one\itemgroupoptions + \strc_itemgroups_preset_stage_one\p_itemgroups_options % % \ifhmode % \ifconditional\c_strc_itemgroups_auto_concat @@ -856,19 +859,19 @@ \fi \c_strc_itemgroups_n_of_items\zerocount \strc_itemgroups_check_n_of_items - \ifempty\itemgroupoptions + \ifempty\p_itemgroups_options \strc_itemgroups_setup_symbol_default \strc_itemgroups_reset_continue_state \setupcurrentitemgroup[#settings]% \else - \strc_itemgroups_process_options\itemgroupoptions + \strc_itemgroups_process_options\p_itemgroups_options \setupcurrentitemgroup[#settings]% \ifconditional\c_strc_itemgroups_continue \strc_itemgroups_setup_symbol_continue \strc_itemgroups_fetch_continue_state \else \strc_itemgroups_setup_symbol_asked - \strc_itemgroups_store_continue_state\itemgroupoptions{#settings}% + \strc_itemgroups_store_continue_state\p_itemgroups_options{#settings}% \fi \fi % @@ -1136,6 +1139,8 @@ % \stopitemize % \stopitemize +\mutable\let\currentitemreference\empty + \tolerant\permanent\protected\def\startitemgroupitem[#reference]% we can reuse more {\def\currentitemreference{#reference}% \ifconditional\c_strc_itemgroups_text diff --git a/tex/context/base/mkxl/strc-lst.mklx b/tex/context/base/mkxl/strc-lst.mklx index d54192e25..c39b3d488 100644 --- a/tex/context/base/mkxl/strc-lst.mklx +++ b/tex/context/base/mkxl/strc-lst.mklx @@ -616,6 +616,9 @@ \listparameter\c!stopper \rightlabeltext\currentlistlabel} +\mutable\let\currentlistnumber\!!zerocount +\mutable\let\currentlistlabel \empty + \protected\def\strc_lists_symbol_default {\dontleavehmode \strut diff --git a/tex/context/base/mkxl/strc-mat.mkxl b/tex/context/base/mkxl/strc-mat.mkxl index f69422edc..3e425b9b1 100644 --- a/tex/context/base/mkxl/strc-mat.mkxl +++ b/tex/context/base/mkxl/strc-mat.mkxl @@ -138,21 +138,21 @@ \appendtoks \normalexpanded{\definelist[\currentformula]}% is expansion needed? - \frozen\instance\setuevalue{\e!start\currentformula\v!formula}{\strc_formulas_start_formula{\currentformula}}% - \frozen\instance\setuevalue{\e!stop \currentformula\v!formula}{\strc_formulas_stop_formula}% + \frozen\instance\protected\edefcsname\e!start\currentformula\v!formula\endcsname{\strc_formulas_start_formula{\currentformula}}% + \frozen\instance\protected\edefcsname\e!stop \currentformula\v!formula\endcsname{\strc_formulas_stop_formula}% \to \everydefineformula \definelist[\v!formula] -\permanent\setuvalue{\e!start\v!formula}{\strc_formulas_start_formula{}} -\permanent\setuvalue{\e!stop \v!formula}{\strc_formulas_stop_formula} +\permanent\defcsname\e!start\v!formula\endcsname{\strc_formulas_start_formula{}} +\permanent\defcsname\e!stop \v!formula\endcsname{\strc_formulas_stop_formula} \let\strc_formulas_start_formula\relax % defined later \let\strc_formulas_stop_formula \relax % defined later \permanent\tolerant\protected\def\defineformulaalternative[#1]#*[#2]#*[#3]% - {\frozen\instance\setvalue{\e!start#1\v!formula}{#2}% - \frozen\instance\setvalue{\e!stop #1\v!formula}{#3}} + {\frozen\instance\defcsname\e!start#1\v!formula\endcsname{#2}% + \frozen\instance\defcsname\e!stop #1\v!formula\endcsname{#3}} % sp = single line paragraph sd = single line display % mp = multi line paragraph md = multy line display @@ -971,18 +971,16 @@ % \protected\def\switchtoformulabodyfont % {\switchtobodyfont} -\setuvalue{\v!formula}{\dosingleempty\strc_formulas_formula} - -\def\strc_formulas_formula[#1]#2% todo: tagged +\tolerant\permanent\protected\def\formula[#1];#2% todo: tagged {\begingroup - \edef\p_direct{#1}% - \ifempty\p_direct \else - \rawprocesscommalist[\p_direct]\strc_formulas_option + \ifparameters#1\else + \rawprocesscommacommand[#1]\strc_formulas_option \fi - % not : \def\strc_formulas_formula[##1]##2{\mathematics{##2}}% \mathematics{#2}% \endgroup} +\aliased\letcsname\v!formula\endcsname\formula + %D \starttyping %D % test \par % no preceding hlist %D % $$x$$ % preceding hlist diff --git a/tex/context/base/mkxl/strc-not.mklx b/tex/context/base/mkxl/strc-not.mklx index 47d2eba89..9de9181d0 100644 --- a/tex/context/base/mkxl/strc-not.mklx +++ b/tex/context/base/mkxl/strc-not.mklx @@ -627,8 +627,8 @@ \letvalue{\??noteinteractiondisplay\v!text }\strc_references_prepare_display_references_yes_text \letvalue{\??noteinteractiondisplay\v!yes }\strc_references_prepare_display_references_yes_number -\let\strc_notes_set_style_color_inline_nop \usenotestyleandcolor -\let\strc_notes_set_style_color_display_nop\usenotationstyleandcolor +\mutable\let\strc_notes_set_style_color_inline_nop \usenotestyleandcolor +\mutable\let\strc_notes_set_style_color_display_nop\usenotationstyleandcolor \protected\def\strc_notes_set_style_color_inline_yes#style#color% {\usenotestyleandcolor#style#color% diff --git a/tex/context/base/mkxl/strc-num.mkxl b/tex/context/base/mkxl/strc-num.mkxl index 1eb4f605d..02674bce2 100644 --- a/tex/context/base/mkxl/strc-num.mkxl +++ b/tex/context/base/mkxl/strc-num.mkxl @@ -83,6 +83,8 @@ \permanent\def\strc_counters_way #1{\clf_way{\namedcounterparameter{#1}\c!way}} \permanent\def\thenamedcounterlevel#1{\xthenamedheadlevel{\clf_way{\namedcounterparameter{#1}\c!way}}} +\mutable\let\currentcounterlevel\!!zerocount % yes or no public ? + \protected\def\strc_counters_check_setup {\edef\p_name{\directcounterparameter\s!name}% \ifx\currentcounter\p_name diff --git a/tex/context/base/mkxl/strc-ref.mklx b/tex/context/base/mkxl/strc-ref.mklx index 680cf2e29..09378e6b6 100644 --- a/tex/context/base/mkxl/strc-ref.mklx +++ b/tex/context/base/mkxl/strc-ref.mklx @@ -731,15 +731,15 @@ %D An unknown reference is reported on the screen, in the log file and, when %D enabled, in the left margin of the text. -\let\unknownreference\gobbleoneargument +\mutable\let\unknownreference\gobbleoneargument %D When a reference is not found, we typeset a placeholder (two glyphs are often %D enough to represent the reference text). % \askedreference defined in lua -\def\dummyreference{{\tttf ??}} -\def\emptyreference{{\tttf !!}} +\mutable\def\dummyreference{{\tttf ??}} +\mutable\def\emptyreference{{\tttf !!}} \installtextracker {structures.referencing.show} @@ -978,9 +978,12 @@ \ifdefined\in \aliased\let\normalmathin \in \permanent\protected\def\in {\mathortext\normalmathin \strc_references_in } \else \aliased\let\in \strc_references_in \fi \ifdefined\over \aliased\let\normalmathover \over \permanent\protected\def\over {\mathortext\normalmathover \strc_references_about} \else \aliased\let\over \strc_references_about \fi % - \ifdefined\at \aliased\let\normalmathat \at \permanent\protected\def\at {\mathortext\normalmathat \strc_references_at } \else \aliased\let\at \strc_references_at \fi - \ifdefined\about \aliased\let\normalmathabout\about \permanent\protected\def\about{\mathortext\normalmathabout\strc_references_about} \else \aliased\let\about\strc_references_about \fi - \ifdefined\from \aliased\let\normalmathfrom \from \permanent\protected\def\from {\mathortext\normalmathfrom \strc_references_from } \else \aliased\let\from \strc_references_from \fi + % \ifdefined\at \aliased\let\normalmathat \at \permanent\protected\def\at {\mathortext\normalmathat \strc_references_at } \else \aliased\let\at \strc_references_at \fi + % \ifdefined\about \aliased\let\normalmathabout\about \permanent\protected\def\about{\mathortext\normalmathabout\strc_references_about} \else \aliased\let\about\strc_references_about \fi + % \ifdefined\from \aliased\let\normalmathfrom \from \permanent\protected\def\from {\mathortext\normalmathfrom \strc_references_from } \else \aliased\let\from \strc_references_from \fi + \aliased\let\at \strc_references_at + \aliased\let\about\strc_references_about + \aliased\let\from \strc_references_from \to \everydump \permanent \def\filterreference #key{\clf_filterreference{#key}} % no checking, expandable @@ -2130,7 +2133,7 @@ \getparameters[\??referencingprefix#kind:#category][#settings]% \fi} -\def\referencestructureprefixparameter#kind#name#category#parameter% +\permanent\def\referencestructureprefixparameter#kind#name#category#parameter% {\ifcsname\??referencingprefix#name:#category#parameter\endcsname \lastnamedcs \orelse\ifcsname\??referencingprefix#kind:#category#parameter\endcsname diff --git a/tex/context/base/mkxl/strc-reg.mkxl b/tex/context/base/mkxl/strc-reg.mkxl index f2466a8c4..dacd3e5e8 100644 --- a/tex/context/base/mkxl/strc-reg.mkxl +++ b/tex/context/base/mkxl/strc-reg.mkxl @@ -159,6 +159,10 @@ \mutable\let\currentregisterseeword \empty \mutable\let\currentregistersynchronize \empty \mutable\let\currentregisterxmlsetup \empty +\mutable\let\currentregisterprocessors \empty +\mutable\let\currentregisterprocessorsa \empty +\mutable\let\currentregisterprocessorsb \empty +\mutable\let\currentregisterprocessorsc \empty \newconditional\c_strc_registers_defining \setnewconstant\c_strc_registers_maxlevel \plusfive @@ -251,17 +255,23 @@ \xdef\currentregisterkeysb{\registerparameter{\c!keys:2}}% \xdef\currentregisterkeysc{\registerparameter{\c!keys:3}}} +\def\strc_registers_register_page_expand_processors + {\xdef\currentregisterprocessorsa{\registerparameter{\c!processors:1}}% + \xdef\currentregisterprocessorsb{\registerparameter{\c!processors:2}}% + \xdef\currentregisterprocessorsc{\registerparameter{\c!processors:3}}} + \def\strc_registers_register_page_entry_indeed#1#2#3% register data userdata {\begingroup \edef\currentregister{#1}% %\setupcurrentregister[\c!entries=,\c!label=,\c!keys=,\c!alternative=,#2]% \setupcurrentregister[#2]% - \edef\currentregisterlabel {\registerparameter\c!label}% - \edef\currentregisterexpansion{\registerparameter\c!expansion}% - \edef\currentregisterownnumber{\registerparameter\c!ownnumber}% - \xdef\currentregisterkeys {\registerparameter\c!keys}% - \xdef\currentregisterentries {\registerparameter\c!entries}% - \xdef\currentregisterxmlsetup {\registerparameter\c!xmlsetup}% + \edef\currentregisterlabel {\registerparameter\c!label}% + \edef\currentregisterexpansion {\registerparameter\c!expansion}% + \edef\currentregisterownnumber {\registerparameter\c!ownnumber}% + \xdef\currentregisterkeys {\registerparameter\c!keys}% + \xdef\currentregisterentries {\registerparameter\c!entries}% + \xdef\currentregisterprocessors{\registerparameter\c!processors}% + \xdef\currentregisterxmlsetup {\registerparameter\c!xmlsetup}% \ifempty\currentregisterentries \ifx\currentregisterexpansion\s!xml \strc_registers_register_page_expand_xml_entries @@ -286,6 +296,7 @@ \strc_registers_register_page_expand_yes_keys \fi \fi + \strc_registers_register_page_expand_processors \setnextinternalreference % we could consider storing register entries in a list which we % could then sort @@ -330,6 +341,15 @@ \else key {\currentregisterkeys}% \fi + \ifempty\currentregisterprocessors + processors { + {\currentregisterprocessorsa}% + {\currentregisterprocessorsb}% + {\currentregisterprocessorsc}% + } + \else + processor {\currentregisterprocessors}% + \fi }% userdata {\detokenize\expandafter{\normalexpanded{#3}}} }% diff --git a/tex/context/base/mkxl/strc-syn.mkxl b/tex/context/base/mkxl/strc-syn.mkxl index 09769bd2f..d6d1fab9b 100644 --- a/tex/context/base/mkxl/strc-syn.mkxl +++ b/tex/context/base/mkxl/strc-syn.mkxl @@ -418,13 +418,15 @@ } \stopsetups +\aliased\let\synonymentry\relax + \permanent\tolerant\protected\def\placelistofsynonyms[#1]#*[#2]% {\begingroup \edef\currentsimplelist{#1}% \doifelsecommandhandler\??simplelist\currentsimplelist {\strc_constructions_initialize{#1}% \setupcurrentsimplelist[#2]% - \let\synonymentry\strc_synonym_normal + \enforced\let\synonymentry\strc_synonym_normal % so we can hook tabulate into before and after \normalexpanded{\simplelistparameter\c!before \noexpand\clf_processsynonyms @@ -611,9 +613,9 @@ \setupcurrentsimplelist[#2]% \edef\p_simplelist_command{\simplelistparameter\c!command}% \ifempty\p_simplelist_command - \let\synonymentry\strc_sorting_normal + \enforced\let\synonymentry\strc_sorting_normal \else - \let\synonymentry\strc_sorting_command + \enforced\let\synonymentry\strc_sorting_command \fi % so we can hook tabulate into before and after \normalexpanded{\simplelistparameter\c!before diff --git a/tex/context/base/mkxl/supp-box.lmt b/tex/context/base/mkxl/supp-box.lmt index b4b0d44cc..9dd85e093 100644 --- a/tex/context/base/mkxl/supp-box.lmt +++ b/tex/context/base/mkxl/supp-box.lmt @@ -485,18 +485,22 @@ end do - local takebox = nuts.takebox - local flush_list = nuts.flush_list - local copy_list = nuts.copy_list - local getwhd = nuts.getwhd - local setbox = nuts.setbox - local new_hlist = nuts.pool.hlist - - local boxes = { } - nodes.boxes = boxes - local cache = table.setmetatableindex("table") - local report = logs.reporter("boxes","cache") - local trace = false + local tonut = nodes.tonut + local takebox = nuts.takebox + local flush_list = nuts.flush_list + local copy_list = nuts.copy_list + local getwhd = nuts.getwhd + local setbox = nuts.setbox + local new_hlist = nuts.pool.hlist + + local values = tokens.values + local dimension_value = values.dimension + + local boxes = { } + nodes.boxes = boxes + local cache = table.setmetatableindex("table") + local report = logs.reporter("boxes","cache") + local trace = false trackers.register("nodes.boxes",function(v) trace = v end) @@ -562,7 +566,7 @@ do setbox(box,b or nil) end - function boxes.dimensions(category,name) + local function dimensions(category,name) name = tonumber(name) or name local b = cache[category][name] if b then @@ -572,6 +576,8 @@ do end end + boxes.dimensions = dimensions + function boxes.reset(category,name) name = tonumber(name) or name local c = cache[category] @@ -599,18 +605,24 @@ do implement { name = "putboxincache", + public = true, + protected = true, arguments = { "string", "string", "integer" }, actions = boxes.save, } implement { name = "getboxfromcache", + public = true, + protected = true, arguments = { "string", "string", "integer" }, actions = boxes.restore, } implement { name = "directboxfromcache", + public = true, + protected = true, arguments = "2 strings", actions = { boxes.direct, context }, -- actions = function(category,name) local b = boxes.direct(category,name) if b then context(b) end end, @@ -618,6 +630,8 @@ do implement { name = "directcopyboxfromcache", + public = true, + protected = true, arguments = { "string", "string", true }, actions = { boxes.direct, context }, -- actions = function(category,name) local b = boxes.direct(category,name,true) if b then context(b) end end, @@ -625,22 +639,81 @@ do implement { name = "copyboxfromcache", + public = true, + protected = true, arguments = { "string", "string", "integer", true }, actions = boxes.restore, } implement { name = "doifelseboxincache", + public = true, + protected = true, arguments = "2 strings", actions = { boxes.found, doifelse }, } implement { name = "resetboxesincache", + public = true, + protected = true, arguments = "string", actions = boxes.reset, } + -- we can share this ... + + implement { + name = "getboxwdfromcache", + public = true, + protected = true, + usage = "value", + arguments = "2 strings", + actions = function(category,name) + local w, h, d = dimensions(category,name) + return dimension_value, w + end, + } + + implement { + name = "getboxhtfromcache", + arguments = "2 strings", + public = true, + protected = true, + usage = "value", + actions = function(category,name) + local w, h, d = dimensions(category,name) + return dimension_value, h + end, + } + + implement { + name = "getboxdpfromcache", + arguments = "2 strings", + public = true, + protected = true, + usage = "value", + actions = function(category,name) + local w, h, d = dimensions(category,name) + return dimension_value, d + end, + } + + implement { + name = "putnextboxincache", + public = true, + protected = true, + arguments = { "string", "string", "box" }, + actions = function(category,name,b) + name = tonumber(name) or name + b = tonut(b) + if trace then + report("category %a, name %a, %s (%s)",category,name,"save",b and "content" or "empty") + end + cache[category][name] = b or false + end + } + end implement { diff --git a/tex/context/base/mkxl/supp-box.mkxl b/tex/context/base/mkxl/supp-box.mkxl index ac39b396a..8bfb6a451 100644 --- a/tex/context/base/mkxl/supp-box.mkxl +++ b/tex/context/base/mkxl/supp-box.mkxl @@ -892,8 +892,8 @@ {\endgraf \egroup} -\let\beginshapebox\beginofshapebox -\let\endshapebox \endofshapebox +\aliased\let\beginshapebox\beginofshapebox +\aliased\let\endshapebox \endofshapebox \permanent\protected\def\flushshapebox {\bgroup @@ -1040,16 +1040,23 @@ %D This can be done in a more modern way but for nostalgic reasons we keep it. +\mutable\let\nextprocessedtoken\empty + +\mutable\let\before \relax % for now mutable +%mutable\let\between\relax % is a math character +\mutable\let\after \relax % for now mutable +\mutable\let\white \relax % for now mutable + \permanent\protected\def\processtokens#1#2#3#4#5% {\begingroup \def\lastcharacter{\lastcharacter}% hm, recursive ? \enforced\permanent\def\space{ }% \enforced\let\\\space - \def\before {#1}% - \def\between{#2}% - \def\after {#3}% - \def\white {#4}% - \let\savedbefore\before + \enforced\def\before {#1}% + \enforced\def\between{#2}% + \enforced\def\after {#3}% + \enforced\def\white {#4}% + \enforced\let\savedbefore\before \syst_boxes_processtokens#5\lastcharacter \endgroup} @@ -1059,7 +1066,7 @@ \def\syst_boxes_redo_processedtoken {\dowithnextbox {\before{\copy\nextbox}% \before can use nextbox several times - \let\before\between + \enforced\let\before\between \syst_boxes_processtokens} \hbox\bgroup} @@ -1071,10 +1078,10 @@ \else \expandafter\if\space\nextprocessedtoken \after\white - \let\before\savedbefore + \enforced\let\before\savedbefore \else \before\nextprocessedtoken - \let\before\between + \enforced\let\before\between \fi \expandafter\syst_boxes_processtokens \fi} @@ -2415,16 +2422,17 @@ %D \resetboxesincache{foo} %D \stoptyping -\permanent\protected\def\putboxincache #1#2#3{\clf_putboxincache {#1}{#2}#3\relax} -\permanent\protected\def\getboxfromcache #1#2#3{\clf_getboxfromcache {#1}{#2}#3\relax} -\permanent\protected\def\doifelseboxincache #1#2{\clf_doifelseboxincache {#1}{#2}} -\permanent\protected\def\copyboxfromcache #1#2#3{\clf_copyboxfromcache {#1}{#2}#3\relax} -\permanent\protected\def\directboxfromcache #1#2{\clf_directboxfromcache {#1}{#2}} -\permanent\protected\def\directcopyboxfromcache#1#2{\clf_directcopyboxfromcache{#1}{#2}} -\permanent\protected\def\resetboxesincache #1{\clf_resetboxesincache {#1}} - -\permanent\protected\def\putnextboxincache#1#2% - {\dowithnextbox{\putboxincache{#1}{#2}\nextbox}} +% \putboxincache % {category} {name} number +% \getboxfromcache % {category} {name} number +% \doifelseboxincache % {category} {name} +% \copyboxfromcache % {category} {name} number +% \directboxfromcache % {category} {name} +% \directcopyboxfromcache % {category} {name} +% \resetboxesincache % {category} +% \putnextboxincache % {category} {name} box +% \getboxwdfromcache % {category} {name} +% \getboxhtfromcache % {category} {name} +% \getboxdpfromcache % {category} {name} %D \macros %D {removedepth, obeydepth} @@ -2662,6 +2670,8 @@ \newdimen\lastnaturalboxht \newdimen\lastnaturalboxdp +%D We can define these public in lua: + \aliased\let\getnaturaldimensions\clf_getnaturaldimensions % sets three dimensions \aliased\let\naturalwd \clf_naturalwd % calculates and returns wd diff --git a/tex/context/base/mkxl/supp-mat.mkxl b/tex/context/base/mkxl/supp-mat.mkxl index 7e0086fc8..99f184f76 100644 --- a/tex/context/base/mkxl/supp-mat.mkxl +++ b/tex/context/base/mkxl/supp-mat.mkxl @@ -113,9 +113,9 @@ \ifhmode \expandafter\inlinemathematics \orelse\ifintable - \doubleexpandafter\inlinemathematics + \expandafter\inlinemathematics \else - \doubleexpandafter\displaymathematics + \expandafter\displaymathematics \fi} %D \macros @@ -129,12 +129,14 @@ \newsignal\dimensionsignal -\def\dimensiontypeface {\tf} -\def\dimensionhalfspace {\,} +\mutable\def\dimensiontypeface {\tf} +\mutable\def\dimensionhalfspace {\,} + +\aliased\let\dodimensionsignal\relax -\protected\def\dimension#1% +\permanent\protected\def\dimension#1% {\pushmacro\dodimensionsignal - \gdef\dodimensionsignal{\kern\dimensionsignal}% + \enforced\gdef\dodimensionsignal{\kern\dimensionsignal}% \ifzeropt\lastskip \ifzeropt\lastkern \ifmmode @@ -153,8 +155,8 @@ \dodimensionsignal \popmacro\dodimensionsignal} -\protected\def\nodimension#1% - {\unskip#1\glet\dodimensionsignal\relax} +\permanent\protected\def\nodimension#1% + {\unskip#1\enforced\glet\dodimensionsignal\relax} % experiment, not yet to be used diff --git a/tex/context/base/mkxl/symb-ini.mkxl b/tex/context/base/mkxl/symb-ini.mkxl index 74d4a2232..c29b07360 100644 --- a/tex/context/base/mkxl/symb-ini.mkxl +++ b/tex/context/base/mkxl/symb-ini.mkxl @@ -316,8 +316,8 @@ \permanent\protected\def\resetsymbolset {\t_symb_setups\emptytoks} -\permanent\protected\def\forcesymbolset[#1]% - {\t_symb_setups{\symb_fetch{#1}}} +\permanent\protected\def\forcesymbolset[#1]% still needed? why not just usesymbolset + {\normalexpanded{\t_symb_setups{\symb_fetch{#1}}}} %D \macros %D {showsymbolset} diff --git a/tex/context/base/mkxl/syst-aux.lmt b/tex/context/base/mkxl/syst-aux.lmt index 4ef7b19d6..726fd4d32 100644 --- a/tex/context/base/mkxl/syst-aux.lmt +++ b/tex/context/base/mkxl/syst-aux.lmt @@ -299,10 +299,28 @@ implement { implement { name = "immediatemessage", + public = true, arguments = { "'message'", "string" }, actions = logs.status } +implement { + name = "writestring", + public = true, + protected = true, + arguments = "string", + actions = function (s) + logs.writer(s,"\n") + end, +} + +implement { + name = "writeline", + public = true, + protected = true, + actions = logs.newline, +} + implement { name = "resettimer", actions = function() diff --git a/tex/context/base/mkxl/syst-aux.mkxl b/tex/context/base/mkxl/syst-aux.mkxl index 4ee3f530c..c70ff0170 100644 --- a/tex/context/base/mkxl/syst-aux.mkxl +++ b/tex/context/base/mkxl/syst-aux.mkxl @@ -35,6 +35,11 @@ \unprotect +%D These are for local helpers, the names are historic: + +\mutable\let\docommand \relax +\mutable\let\dodocommand\relax + %D \macros %D {unexpanded} %D @@ -95,7 +100,7 @@ %D %D There is already \type{\space} but just to be sure we also provide this one: -\def\normalspace{ } +\permanent\def\normalspace{ } \newif\if!!donea \newif\if!!doneb \newif\if!!donec % soon obsolete in lmtx \newif\if!!doned \newif\if!!donee \newif\if!!donef % soon obsolete in lmtx @@ -1375,43 +1380,45 @@ %D Some more raw material: -\def\syst_helpers_raw_process_action#1=>#2,% - {\ifarguments - %\expandafter\syst_helpers_raw_process_action_gobble - \or - \expandafter\syst_helpers_raw_process_action_gobble - \or - \edef\m_syst_string_two{#1}% - \ifx\m_syst_string_one\m_syst_string_two - \def\m_syst_helpers_process_action{#2}% - \expandafter\expandafter\expandafter\syst_helpers_raw_process_action_gobble - \else - \ifx\s!unknown\m_syst_string_two - \def\m_syst_helpers_process_action_unknown{#2}% - \fi - \expandafter\expandafter\expandafter\syst_helpers_raw_process_action_next - \fi - \fi} - -\def\syst_helpers_raw_process_action_gobble#-\ignorearguments - {} - -\def\syst_helpers_raw_process_action_next - {\expandafterspaces\syst_helpers_raw_process_action} - -\protected\def\xrawprocessaction[#1]#2[#3]% - {\edef\m_syst_string_one{#1}% - \ifempty\m_syst_string_one - \let\m_syst_string_one\s!default - \fi - \let\m_syst_helpers_process_action\relax - \let\m_syst_helpers_process_action_unknown\relax - \syst_helpers_raw_process_action#3\ignorearguments\ignorearguments\ignorearguments - \ifrelax\m_syst_helpers_process_action - \m_syst_helpers_process_action_unknown - \else - \m_syst_helpers_process_action - \fi} +% probably never used +% +% \def\syst_helpers_raw_process_action#1=>#2,% +% {\ifarguments +% %\expandafter\syst_helpers_raw_process_action_gobble +% \or +% \expandafter\syst_helpers_raw_process_action_gobble +% \or +% \edef\m_syst_string_two{#1}% +% \ifx\m_syst_string_one\m_syst_string_two +% \def\m_syst_helpers_process_action{#2}% +% \expandafter\expandafter\expandafter\syst_helpers_raw_process_action_gobble +% \else +% \ifx\s!unknown\m_syst_string_two +% \def\m_syst_helpers_process_action_unknown{#2}% +% \fi +% \expandafter\expandafter\expandafter\syst_helpers_raw_process_action_next +% \fi +% \fi} +% +% \def\syst_helpers_raw_process_action_gobble#-\ignorearguments +% {} +% +% \def\syst_helpers_raw_process_action_next +% {\expandafterspaces\syst_helpers_raw_process_action} +% +% \permanent\protected\def\xrawprocessaction[#1]#*[#2]% +% {\edef\m_syst_string_one{#1}% +% \ifempty\m_syst_string_one +% \let\m_syst_string_one\s!default +% \fi +% \let\m_syst_helpers_process_action\relax +% \let\m_syst_helpers_process_action_unknown\relax +% \syst_helpers_raw_process_action#2\ignorearguments\ignorearguments\ignorearguments +% \ifrelax\m_syst_helpers_process_action +% \m_syst_helpers_process_action_unknown +% \else +% \m_syst_helpers_process_action +% \fi} %D When we process the list \type {a,b,c,d,e}, the raw routine takes over 30\% less %D time, when we feed $20+$ character strings we gain about 20\%. Alternatives which @@ -1546,7 +1553,7 @@ %D funny to see that this alternative saw the light so lately --- can be used to do %D expanded assigments. -\let\currentvalue\empty +% \mutable\let\currentvalue\empty % only mkii \permanent\protected\def\getparameters {\dogetparameters\dosetvalue} \permanent\protected\def\geteparameters {\dogetparameters\dosetevalue} @@ -2785,53 +2792,52 @@ \read16 to \wait \endgroup} -%D \macros -%D {writestring,writeline, -%D writestatus,statuswidth,normalwritestatus} -%D -%D Maybe one didn't notice, but we've already introduced a macro for showing -%D messages. In the multi||lingual modules, we will also introduce a mechanism for -%D message passing. For the moment we stick to the core macros: -%D -%D \starttyping -%D \writestring {string} -%D \writeline -%D \writestatus {category} {message} -%D \stoptyping -%D -%D Messages are formatted. One can provide the maximum with of the identification -%D string with the macro \type {\statuswidth}. - -\setnewconstant\statuswidth 15 -%setnewconstant\statuswrite 128 % \pluscxxviii - -\ifdefined\writestring \else - - \protected\def\writestring{\immediate\write\statuswrite} - \protected\def\writeline {\writestring{}} - -\fi - -\protected\def\normalwritestatus#1#2% - {\writestring{\expandafter\syst_helpers_split_status_yes\expandafter\statuswidth#1% - \space\space\space\space\space\space\space - \space\space\space\space\space\space\space - \space\space\space\space\space\space\end - \space:\space#2}} - -\def\syst_helpers_split_status_yes#1#2% - {\ifcase#1 \expandafter\syst_helpers_split_status_nop\fi#2% - \expandafter\syst_helpers_split_status_yes\expandafter{\the\numexpr#1+\minusone\relax}} - -\def\syst_helpers_split_status_nop#1\end - {} +% %D \macros +% %D {writestring,writeline,writestatus} +% %D +% %D Maybe one didn't notice, but we've already introduced a macro for showing +% %D messages. In the multi||lingual modules, we will also introduce a mechanism for +% %D message passing. For the moment we stick to the core macros: +% %D +% %D \starttyping +% %D \writestring {string} +% %D \writeline +% %D \writestatus {category} {message} +% %D \stoptyping +% %D +% %D Messages are formatted. One can provide the maximum with of the identification +% %D string with the macro \type {\statuswidth}. +% +% \setnewconstant\statuswidth 15 +% \setnewconstant\statuswrite 128 % \pluscxxviii +% +% \ifdefined\writestring \else +% +% \protected\def\writestring{\immediate\write\statuswrite} +% \protected\def\writeline {\writestring{}} +% +% \fi +% +% \protected\def\normalwritestatus#1#2% +% {\writestring{\expandafter\syst_helpers_split_status_yes\expandafter\statuswidth#1% +% \space\space\space\space\space\space\space +% \space\space\space\space\space\space\space +% \space\space\space\space\space\space\end +% \space:\space#2}} +% +% \def\syst_helpers_split_status_yes#1#2% +% {\ifcase#1 \expandafter\syst_helpers_split_status_nop\fi#2% +% \expandafter\syst_helpers_split_status_yes\expandafter{\the\numexpr#1+\minusone\relax}} +% +% \def\syst_helpers_split_status_nop#1\end +% {} %D \macros %D {immediatemessage} %D %D A fully expandable message: -\aliased\let\immediatemessage\clf_immediatemessage % {} mandate / todo permanent at lua end +% \immediatemessage % {} mandate / defined at the lua end %D \macros %D {rawgetparameters} @@ -3078,7 +3084,7 @@ \permanent\protected\def\savenormalmeaning#1% {\ifcsname normal\csstring#1\endcsname \else - \letcsname normal\csstring#1\endcsname#1% + \aliased\letcsname normal\csstring#1\endcsname#1% \fi} %D \macros @@ -5665,7 +5671,9 @@ %D assignment, this time by using \type {\futurelet}, and grabbing an argument as %D well. That way we can handle the sentinal, a blank space and grouped tokens. -\protected\def\syst_helpers_handle_tokens % \nexthandledtoken is part of interface +\mutable\let\nexthandledtoken\empty % part of public interface + +\protected\def\syst_helpers_handle_tokens {\futurelet\nexthandledtoken\syst_helpers_handle_tokens_indeed} \permanent\protected\def\handletokens#1\with#2% @@ -6177,12 +6185,12 @@ \aliased\let\doifnonzeropositiveelse\doifelsenonzeropositive -% here ? +%D Some old|-|time favourites: -\protected\def\dosetrawvalue #1#2#3{\defcsname #1#2\endcsname{#3}} -\protected\def\dosetrawevalue#1#2#3{\edefcsname #1#2\endcsname{#3}} -\protected\def\dosetrawgvalue#1#2#3{\global\defcsname #1#2\endcsname{#3}} -\protected\def\dosetrawxvalue#1#2#3{\global\edefcsname#1#2\endcsname{#3}} +\permanent\protected\def\dosetrawvalue #1#2#3{\defcsname #1#2\endcsname{#3}} +\permanent\protected\def\dosetrawevalue#1#2#3{\edefcsname #1#2\endcsname{#3}} +\permanent\protected\def\dosetrawgvalue#1#2#3{\global\defcsname #1#2\endcsname{#3}} +\permanent\protected\def\dosetrawxvalue#1#2#3{\global\edefcsname#1#2\endcsname{#3}} \permanent\protected\def\getrawparameters {\dogetparameters\dosetrawvalue } \permanent\protected\def\getraweparameters {\dogetparameters\dosetrawevalue} @@ -6216,7 +6224,7 @@ \aliased\let\elapsedtime \clf_elapsedtime % todo: at lua end \aliased\let\elapsedseconds\elapsedtime -\let\elapsedsteps\!!zerocount +\aliased\let\elapsedsteps\!!zerocount \permanent\protected\def\elapsedsteptime % unexpanded ! a bit useless but who knows ... {\clf_elapsedsteptime\elapsedsteps\relax} @@ -6224,11 +6232,11 @@ \newcount\c_syst_helpers_test_feature_n \newcount\c_syst_helpers_test_feature_m -\def\currentfeaturetest{\number\c_syst_helpers_test_feature_n} +\permanent\def\currentfeaturetest{\number\c_syst_helpers_test_feature_n} \permanent\protected\def\testfeature#1#2% {\c_syst_helpers_test_feature_m#1\relax - \xdef\elapsedsteps{\number\c_syst_helpers_test_feature_m}% + \enforced\xdef\elapsedsteps{\number\c_syst_helpers_test_feature_m}% \def\syst_helpers_test_feature_yes {\advance\c_syst_helpers_test_feature_n\plusone \ifnum\c_syst_helpers_test_feature_n>\c_syst_helpers_test_feature_m\else diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl index 018658544..b630cfeda 100644 --- a/tex/context/base/mkxl/syst-ini.mkxl +++ b/tex/context/base/mkxl/syst-ini.mkxl @@ -304,7 +304,7 @@ % %D The next definitions are really needed (in \CONTEXT): -\newlinechar\newlineasciicode \edef\outputnewlinechar{\Uchar\newlineasciicode} % {^^J} +\newlinechar\newlineasciicode \permanent\edef\outputnewlinechar{\Uchar\newlineasciicode} % {^^J} %D One reason to start high with allocation is that it permits us to allocate %D consecutive ranges more easily, for instance if for \MPLIB\ we want to allocate a @@ -733,11 +733,11 @@ \pushoverloadmode -\protected\def\dump +\permanent\protected\def\dump {\the\everydump \global\everydump\emptytoks \pushoverloadmode - \glet\dump\relax + \enforced\glet\dump\relax \popoverloadmode %let\pushoverloadmode\relax %let\popoverloadmode\relax diff --git a/tex/context/base/mkxl/syst-mes.mkxl b/tex/context/base/mkxl/syst-mes.mkxl deleted file mode 100644 index 166be16e3..000000000 --- a/tex/context/base/mkxl/syst-mes.mkxl +++ /dev/null @@ -1,20 +0,0 @@ -%D \module -%D [ file=syst-mes, -%D version=2010.06.03, -%D title=\CONTEXT\ System Macros, -%D subtitle=Messages, -%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. - -% These will be overloaded later on: - -\protected\def\writestring{\immediate\write\statuswrite} -\protected\def\writeline {\writestring{}} -% \let\message \normalmessage - -\endinput diff --git a/tex/context/base/mkxl/tabl-ltb.mkxl b/tex/context/base/mkxl/tabl-ltb.mkxl index ab9675927..ec4a37360 100644 --- a/tex/context/base/mkxl/tabl-ltb.mkxl +++ b/tex/context/base/mkxl/tabl-ltb.mkxl @@ -61,6 +61,12 @@ \installcorenamespace{linetableheight} \installcorenamespace{linetabledepth} +% (For now) we share these three: + +\aliased\let\tabl_lines_initialize_box \tabl_tabulate_initialize_box +\aliased\let\tabl_lines_initialize_boxes\tabl_tabulate_initialize_boxes +\aliased\let\b_tabl_lines_current \b_tabl_tabulate_current + \newconditional \c_tabl_lines_preroll \newconditional \c_tabl_lines_in_table @@ -93,7 +99,7 @@ \newconditional \linetableautoheight \settrue\linetableautoheight -\initializetablebox\zerocount % holds repeater +\tabl_lines_initialize_box\zerocount % holds repeater \pushoverloadmode @@ -313,12 +319,12 @@ {\backgroundline[\linetablecparameter\c!backgroundcolor]{\box\scratchbox}} \def\tabl_lines_save_part - {\global\setbox\tablebox\c_tabl_lines_part + {\global\setbox\b_tabl_lines_current\c_tabl_lines_part \ifcase\c_tabl_lines_part\relax \box\scratchbox % just storing \else \vbox - {\ifvoid\tablebox\c_tabl_lines_part\else\unvbox\tablebox\c_tabl_lines_part\fi + {\ifvoid\b_tabl_lines_current\c_tabl_lines_part\else\unvbox\b_tabl_lines_current\c_tabl_lines_part\fi \edef\p_background{\linetablerparameter\c!background}% \ifx\p_background\v!color \backgroundline[\linetablerparameter\c!backgroundcolor]{\box\scratchbox}% @@ -344,7 +350,7 @@ \else \dorecurse\c_tabl_lines_n_of_parts {\c_tabl_lines_part\recurselevel - \dp\tablebox\c_tabl_lines_part\strutdepth + \dp\b_tabl_lines_current\c_tabl_lines_part\strutdepth % noindent en endgraf needed else whitespace mess-up! \whitespace % here not after verticalstrut \ifdim\topskipgap=\zeropoint\else @@ -356,7 +362,7 @@ \nointerlineskip % fix topskip \fi \noindent\strut - \hpack to \hsize{\box\tablebox\c_tabl_lines_part\hss}% + \hpack to \hsize{\box\b_tabl_lines_current\c_tabl_lines_part\hss}% \endgraf \ifnum\c_tabl_lines_part<\c_tabl_lines_n_of_parts\relax \linetableparameter\c!inbetween @@ -367,7 +373,7 @@ % after, later \fi \c_tabl_lines_head_state\plusthree - \global\setbox\tablebox\zerocount\emptybox % here + \global\setbox\b_tabl_lines_current\zerocount\emptybox % here \fi % reset \c_tabl_lines_row will be an option, currently % starts at zero after split @@ -440,7 +446,7 @@ \global\c_tabl_lines_page \plusone \fi \global\advance\c_tabl_lines_part\plusone - \global\d_tabl_lines_width\wd\tablebox\zerocount + \global\d_tabl_lines_width\wd\b_tabl_lines_current\zerocount \tabl_lines_start_part \fi \else @@ -474,7 +480,7 @@ \global\advance\c_tabl_lines_part\plusone \ifnum\c_tabl_lines_part>\c_tabl_lines_n_of_parts \global\c_tabl_lines_n_of_parts\c_tabl_lines_part - \initializetablebox\c_tabl_lines_part + \tabl_lines_initialize_box\c_tabl_lines_part \fi \global\d_tabl_lines_width\wd\b_tabl_lines_cell \tabl_lines_start_part @@ -482,8 +488,8 @@ % check for left/right page \ifcase\c_tabl_lines_page\donetrue\or\donetrue\or\donefalse\fi\ifdone % insert repeater - \global\advance\d_tabl_lines_width\wd\tablebox\zerocount - \ifconditional\c_tabl_lines_preroll\kern\wd\else\unhcopy\fi\tablebox\zerocount + \global\advance\d_tabl_lines_width\wd\b_tabl_lines_current\zerocount + \ifconditional\c_tabl_lines_preroll\kern\wd\else\unhcopy\fi\b_tabl_lines_current\zerocount \fi \fi \fi @@ -527,7 +533,7 @@ \advance\scratchcounter##1% \xdefcsname\??linetablepart\number\c_tabl_lines_n_of_parts\endcsname{\the\scratchcounter}}% \processcommacommand[\linetableparameter\c!n]\docommand - \initializetableboxes\c_tabl_lines_n_of_parts + \tabl_lines_initialize_boxes\c_tabl_lines_n_of_parts \global\c_tabl_lines_part\ifcase\c_tabl_lines_repeat\plusone\else\zerocount\fi % repeater \global\c_tabl_lines_step\plusone \global\c_tabl_lines_line\zerocount diff --git a/tex/context/base/mkxl/tabl-tab.mkxl b/tex/context/base/mkxl/tabl-tab.mkxl index 7f16360a0..8aeb1644b 100644 --- a/tex/context/base/mkxl/tabl-tab.mkxl +++ b/tex/context/base/mkxl/tabl-tab.mkxl @@ -565,6 +565,8 @@ % Key "\doendtableformat": Equivalent to "." +\aliased\let\doendtableformat\relax + \newtableformatkey \doendtableformat {\!tkTestForBeginFormat\doendtableformat{\!tfFinishFormat}} @@ -2158,15 +2160,6 @@ {\tablerowfactor\plustwo }% \to \localtabledefinitions -\def\dohandlebar % here ? - {\ifmmode - \expandafter\domathmodebar - \orelse\ifintable - \expandafter\domathmodebar - \else - \expandafter\dotextmodebar - \fi} - \appendtoks \expandnamespaceparameter\??tablealign\directtablesparameter\c!align\s!unknown \assignalfadimension{\directtablesparameter\c!VL}\m_tabl_table_VLwidth 246% diff --git a/tex/context/base/mkxl/tabl-tbl.mkxl b/tex/context/base/mkxl/tabl-tbl.mkxl index cabe3babf..1195c3473 100644 --- a/tex/context/base/mkxl/tabl-tbl.mkxl +++ b/tex/context/base/mkxl/tabl-tbl.mkxl @@ -291,10 +291,6 @@ \tabl_tabulate_initialize_boxes{16} % not really needed -\let\initializetablebox \tabl_tabulate_initialize_box % used elsewhere, will change -\let\initializetableboxes\tabl_tabulate_initialize_boxes % used elsewhere, will change -\let\tablebox \b_tabl_tabulate_current - % 0 = NC column next EQ equal column % 1 = RC column raw RQ equal column raw % 2 = HC column hook HQ equal column hook diff --git a/tex/context/base/mkxl/trac-vis.lmt b/tex/context/base/mkxl/trac-vis.lmt index 6e9bd8e8c..44723e38f 100644 --- a/tex/context/base/mkxl/trac-vis.lmt +++ b/tex/context/base/mkxl/trac-vis.lmt @@ -187,6 +187,7 @@ end local userrule -- bah, not yet defined: todo, delayed(nuts.rules,"userrule") local outlinerule -- bah, not yet defined: todo, delayed(nuts.rules,"userrule") +local emptyrule -- bah, not yet defined: todo, delayed(nuts.rules,"userrule") local function initialize() -- @@ -237,6 +238,10 @@ local function initialize() if not outlinerule then outlinerule = nuts.pool.outlinerule end + -- + if not emptyrule then + emptyrule = nuts.pool.emptyrule + end initialize = false end @@ -783,7 +788,7 @@ local ruledbox do ruledbox = function(head,current,vertical,layer,what,simple,previous,trace_origin,parent) local wd, ht, dp = getwhd(current) - if wd ~= 0 then + local force_origin = wd == 0 or (dp + ht) == 0 local shift = getshift(current) local next = getnext(current) local prev = previous @@ -804,7 +809,9 @@ local ruledbox do -- we need to trigger the right mode (else sometimes no whatits) local info = setlink( this and copy_list(this) or nil, - (dp == 0 and outlinerule and outlinerule(wd,ht,dp,linewidth)) or userrule { + (force_origin and emptyrule(wd,ht,dp)) -- we accept some overhead + or (dp == 0 and outlinerule and outlinerule(wd,ht,dp,linewidth)) + or userrule { width = wd, height = ht, depth = dp, @@ -819,9 +826,9 @@ local ruledbox do -- setattr(info,a_layer,layer) if vertical then - if shift == 0 then + if not force_origin and shift == 0 then info = setlink(current,dp ~= 0 and new_kern(-dp) or nil,info) - elseif trace_origin then + elseif trace_origin or force_origin then local size = 2*size local origin = o_cache[size] origin = copy_list(origin) @@ -839,9 +846,9 @@ local ruledbox do end info = new_vlist(info,wd,ht,dp,shift) else - if shift == 0 then + if not force_origin and shift == 0 then info = setlink(current,new_kern(-wd),info) - elseif trace_origin then + elseif trace_origin or force_origin then local size = 2*size local origin = o_cache[size] origin = copy_list(origin) @@ -869,9 +876,9 @@ local ruledbox do else return head, info end - else - return head, current - end + -- else + -- return head, current + -- end end end diff --git a/tex/context/base/mkxl/typo-del.mkxl b/tex/context/base/mkxl/typo-del.mkxl index 2a7dc27da..7df5ac0de 100644 --- a/tex/context/base/mkxl/typo-del.mkxl +++ b/tex/context/base/mkxl/typo-del.mkxl @@ -29,12 +29,12 @@ \expandnamespaceparameter\??hyphenmarksign\dummyparameter\c!sign\v!normal} \setvalue{\??hyphenmarksign\v!normal}% - {\let\textmodehyphen\normalhyphen - \let\textmodehyphendiscretionary\normalhyphendiscretionary} + {\enforced\let\textmodehyphen\normalhyphen + \enforced\let\textmodehyphendiscretionary\normalhyphendiscretionary} \setvalue{\??hyphenmarksign\v!wide}% - {\let\textmodehyphen\composedhyphen - \let\textmodehyphendiscretionary\composedhyphendiscretionary} + {\enforced\let\textmodehyphen\composedhyphen + \enforced\let\textmodehyphendiscretionary\composedhyphendiscretionary} \setuphyphenmark[\c!sign=\v!wide] @@ -60,8 +60,8 @@ {\hbox{\directsymbol\empty\c!leftcompoundhyphen}} {\hbox{\directsymbol\empty\c!compoundhyphen}}} -\let\textmodehyphen \composedhyphen -\let\textmodehyphendiscretionary\composedhyphendiscretionary +\aliased\let\textmodehyphen \composedhyphen +\aliased\let\textmodehyphendiscretionary\composedhyphendiscretionary \definesymbol[\c!leftcompoundhyphen] [\languageparameter\c!leftcompoundhyphen] \definesymbol[\c!rightcompoundhyphen] [\languageparameter\c!rightcompoundhyphen] @@ -314,7 +314,7 @@ %D \NC [fr:en] \NC {\tttf fr} \quotation[fr:en]{{\tttf } something french} \NC \NR %D \stoptabulate -\let\currentdelimitedlanguage\empty +\mutable\let\currentdelimitedlanguage\empty \installglobalmacrostack\currentdelimitedlanguage diff --git a/tex/context/base/mkxl/typo-itc.mklx b/tex/context/base/mkxl/typo-itc.mklx index 141ee9968..67753efd5 100644 --- a/tex/context/base/mkxl/typo-itc.mklx +++ b/tex/context/base/mkxl/typo-itc.mklx @@ -30,15 +30,11 @@ % \let\/=/ % \let\emphasiscorrection\donothing -\ifdefined \normalitaliccorrection \else - \aliased\let\normalitaliccorrection\italiccorrection -\fi - \permanent\protected\def\italiccorrection {\ifnum\c_attr_italics<\plusone\normalitaliccorrection\fi} \pushoverloadmode - \aliased\let\/\italiccorrection + \aliased\let\/\italiccorrection % replaces the primitive \popoverloadmode % 1 = end of word diff --git a/tex/context/interface/mkii/keys-de.xml b/tex/context/interface/mkii/keys-de.xml index fb3969277..2f7d32e9f 100644 --- a/tex/context/interface/mkii/keys-de.xml +++ b/tex/context/interface/mkii/keys-de.xml @@ -780,6 +780,8 @@ + + @@ -1124,6 +1126,7 @@ + @@ -1137,6 +1140,7 @@ + diff --git a/tex/context/modules/mkiv/s-references-show.mkiv b/tex/context/modules/mkiv/s-references-show.mkiv index 72cccce54..a693fbc44 100644 --- a/tex/context/modules/mkiv/s-references-show.mkiv +++ b/tex/context/modules/mkiv/s-references-show.mkiv @@ -21,7 +21,7 @@ \enablehiddenbackground % trick -\edef\hiddenbackgroundlist{\hiddenbackgroundlist,trace-references} +\appendhiddenbackground{trace-references} \defineoverlay [trace-references] diff --git a/tex/context/modules/mkxl/s-fonts-show.mkxl b/tex/context/modules/mkxl/s-fonts-show.mkxl index 4b6fbf998..42b5af125 100644 --- a/tex/context/modules/mkxl/s-fonts-show.mkxl +++ b/tex/context/modules/mkxl/s-fonts-show.mkxl @@ -92,11 +92,8 @@ {\bgroup \iftok{#1}\emptytoks\else \definedfont[#1]% - \ifdim2.5\emwidth>.05\hsize - \tx - \ifdim2.5\emwidth>.05\hsize - \txx - \fi + \ifdim40\emwidth>\hsize + \glyphscale750\relax \fi \fi \integerdef\c_module_fonts_font_id\fontid\font @@ -126,7 +123,7 @@ \scratchdimenone 2.5\emwidth \scratchdimentwo 2.4\emwidth \scratchdimenthree2.3\emwidth - \edef\charplane{\number#2}% + \scratchcounterfour#2\relax \forgetall \startoverlay % easier in cld {\vbox @@ -177,8 +174,8 @@ \hpack {\dostepwiserecurse\zerocount{15}\plusone {\scratchcountertwo \recurselevel - \scratchcounter \numexpr\scratchcounterone*16+\scratchcountertwo\relax - \scratchcounterthree\numexpr\charplane*256+\scratchcounter\relax + \scratchcounterthree\numexpr\scratchcounterone*16+\scratchcountertwo\relax + \scratchcounterthree\numexpr\scratchcounterfour*256+\scratchcounterthree\relax \iffontchar\font\scratchcounterthree \setbox\scratchbox\ruledhpack{\char\scratchcounterthree}% \bgroup @@ -197,7 +194,7 @@ \nointerlineskip \vskip2\points % the \noexpand before \blank is needed for non etex - \edef\theshowfontspecs{name: {\noexpand\black\fontname\font}\quad plane: \charplane\enspace"\hexnumber\charplane}% + \edef\theshowfontspecs{name: {\noexpand\black\fontname\font}\quad plane: \the\scratchcounterfour\enspace"\hexnumber\scratchcounterfour}% \tf % also sets em \hbox to 40\emwidth{\blue\hfill\tinyfont\setstrut\strut\theshowfontspecs} \egroup diff --git a/tex/context/modules/mkxl/s-symbols-show.mkxl b/tex/context/modules/mkxl/s-symbols-show.mkxl index a2cda24d1..37d42fe00 100644 --- a/tex/context/modules/mkxl/s-symbols-show.mkxl +++ b/tex/context/modules/mkxl/s-symbols-show.mkxl @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% todo: implementor + \startluacode function commands.showsymbolset(collection,symbols,fontid) if type(symbols) == "string" then @@ -43,24 +45,26 @@ end local detail = defined and byname context.start() - context.forcesymbolset { collection } + context.setupsymbolset { collection } context.starttabulate { detail and "|lT|l|l|lT|" or "|lT|l|l|"} for symbol, how in table.sortedhash(list) do - context.NC() if detail and how then - context.bold(symbol) + context.BC() else - context(symbol) + context.NC() end + context(symbol) context.NC() context.symbol(symbol) context.NC() context.framed(options,context.nested.symbol(symbol)) - context.NC() if detail and how then - context.bold("defined") + context.BC() + context("defined") + else context.NC() end + context.NC() context.NR() end context.stoptabulate() diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 2bc5323cb..72ae3ab9c 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2021-02-01 13:17 +-- merge date : 2021-02-05 17:41 do -- begin closure to overcome local limits and interference -- cgit v1.2.3