summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/luatex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-04-13 15:51:39 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2018-04-13 15:51:39 +0200
commit25fcad7435f56cdce2658336909f4da6a65589c0 (patch)
treec23d5d04a7e86c7ddc2ebeca06d3de63ebdc806e /doc/context/sources/general/manuals/luatex
parent1e5d7f41ddede5e6400a2a7762032823d3545df4 (diff)
downloadcontext-25fcad7435f56cdce2658336909f4da6a65589c0.tar.gz
2018-04-13 15:02:00
Diffstat (limited to 'doc/context/sources/general/manuals/luatex')
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-enhancements.tex188
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-fonts.tex2
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-introduction.tex81
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-languages.tex455
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-lua.tex310
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-math.tex187
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-modifications.tex141
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-style.tex46
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-titlepage.tex56
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex.tex10
10 files changed, 787 insertions, 689 deletions
diff --git a/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex b/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex
index e0119bf7e..62d10f694 100644
--- a/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex
+++ b/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex
@@ -111,12 +111,14 @@ problem for well|-|behaved input files, but it could create incompatibilities fo
input that would have generated an error when processed by older \TEX|-|based
engines. The affected commands with an altered initial (left of the equals sign)
or secondary (right of the equals sign) value are: \type {\char}, \type
-{\lccode}, \type {\uccode}, \type {\catcode}, \type {\sfcode}, \type {\efcode},
-\type {\lpcode}, \type {\rpcode}, \type {\chardef}.
+{\lccode}, \type {\uccode}, \type {\hjcode}, \type {\catcode}, \type {\sfcode},
+\type {\efcode}, \type {\lpcode}, \type {\rpcode}, \type {\chardef}.
As far as the core engine is concerned, all input and output to text files is
\UTF-8 encoded. Input files can be pre|-|processed using the \type {reader}
-callback. This will be explained in a later chapter.
+callback. This will be explained in \in {section} [iocallback]. Normalization of
+the \UNICODE\ input is on purpose not built|-|in can be handled by a macro
+package during callback processing.
Output in byte|-|sized chunks can be achieved by using characters just outside of
the valid \UNICODE\ range, starting at the value $1{,}114{,}112$ (0x110000). When
@@ -129,8 +131,6 @@ are considered \quote {safe} and therefore printed as|-|is. You can disable
escaping with \type {texio.setescape(false)} in which case you get the normal
characters on the console.
-Normalization of the \UNICODE\ input can be handled by a macro package during
-callback processing (this will be explained in \in {section} [iocallback]).
\subsection{\type {\Uchar}}
@@ -204,6 +204,34 @@ attributes for node list processing from \LUA\ is given in~\in {chapter}[nodes].
Attributes are stored in a sorted (sparse) linked list that are shared when
possible. This permits efficient testing and updating.
+\subsection{Nodes}
+
+When \TEX\ reads input it will interpret the stream according to the properties
+of the characters. Some signal a macro name and trigger expansion, others open
+and close groups, trigger math mode, etc. What's left over becomes the typeset
+text. Internally we get linked list of nodes. Characters become \type {glyph}
+nodes that have for instance a \type {font} and \type {char} property and \typ
+{\kern 10pt} becomes a \type {kern} node with a \type {width} property. Spaces
+are alien to \TEX\ as they are turned into \type {glue} nodes. So, a simple
+paragraph is mostly a mix of sequences of \type {glyph} nodes (words) and \type
+{glue} nodes (spaces).
+
+The sequences of characters at some point are extended with \type {disc} nodes
+that relate to hyphenation. After that font logic can be applied and we get a
+list where some characters can be replaced, for instance multiple characters can
+become one ligature, and font kerns can be injected. This is driven by the
+font properties.
+
+Boxes (like \type {\hbox} and \type {\vbox}) become \type {hlist} or \type
+{vlist} nodes with \type {width}, \type {height}, \type {depth} and \type {shift}
+properties and a pointer \type {list} to its actual content. Boxes can be
+constructed explicitly or can be the result of subprocesses. For instance, when
+lines are broken into paragraphs, the lines are a linked list of \type {hlist}
+nodes.
+
+We will see more of these nodes later on but for now that should be enough to be
+able to follow the rest oof this chapter.
+
\subsection{Box attributes}
Nodes typically receive the list of attributes that is in effect when they are
@@ -229,21 +257,53 @@ incompatibility is mostly due to the fact that separate specials and literals ar
a more unnatural approach to colors than attributes.
It is possible to fine-tune the list of attributes that are applied to a \type
-{hbox}, \type {vbox} or \type {vtop} by the use of the keyword \type {attr}. An
-example:
+{hbox}, \type {vbox} or \type {vtop} by the use of the keyword \type {attr}. The
+\type {attr} keyword(s) should come before a \type {to} or \type {spread}, if
+that is also specified. An example is:
-\starttyping
-\attribute2=5
+\startbuffer[tex]
+\attribute997=123
+\attribute998=456
\setbox0=\hbox {Hello}
-\setbox2=\hbox attr1=12 attr2=-"7FFFFFFF{Hello}
-\stoptyping
+\setbox2=\hbox attr 999 = 789 attr 998 = -"7FFFFFFF{Hello}
+\stopbuffer
+
+\startbuffer[lua]
+ for b=0,2,2 do
+ for a=997, 999 do
+ tex.sprint("box ", b, " : attr ",a," : ",tostring(tex.box[b] [a]))
+ tex.sprint("\\quad\\quad")
+ tex.sprint("list ",b, " : attr ",a," : ",tostring(tex.box[b].list[a]))
+ tex.sprint("\\par")
+ end
+ end
+\stopbuffer
+
+\typebuffer[tex]
+
+Box 0 now has attributes 997 and 998 set while box 2 has attributes 997 and 999
+set while the nodes inside that box will all have attributes 997 and 998 set.
+Assigning the maximum negative value causes an attribute to be ignored.
-This will set the attribute list of box~2 to $1=12$, and the attributes of box~0
-will be $2=5$. As you can see, assigning the maximum negative value causes an
-attribute to be ignored.
+To give you an idea of what this means at the \LUA\ end, take the following
+code:
-The \type {attr} keyword(s) should come before a \type {to} or \type {spread}, if
-that is also specified.
+\typebuffer[lua]
+
+Later we will see that you can access properties of a node. The boxes here are so
+called \type {hlist} nodes that have a field \type {list} that points to the
+content. Because the attributes are a list themselves you can access them by
+indexing the node (here we do that with \type {[a]}. Running this snippet gives:
+
+\start
+ \getbuffer[tex]
+ \startpacked \tt
+ \ctxluabuffer[lua]
+ \stoppacked
+\stop
+
+Because some values are not set we need to apply the \type {tostring} function
+here so that we get the word \type {nil}.
\section{\LUA\ related primitives}
@@ -281,9 +341,10 @@ say:
\stoptyping
Then \LUA\ line comments can be used, since \TEX\ does not replace line endings
-with spaces.
+with spaces. Of course such an approach depends on the macro package that you
+use.
-Likewise, the \syntax {<16-bit number>} designates a name of a \LUA\ chunk and is
+The \syntax {<16-bit number>} designates a name of a \LUA\ chunk and is
taken from the \type {lua.name} array (see the documentation of the \type {lua}
table further in this manual). When a chunk name starts with a \type {@} it will
be displayed as a file name. This is a side effect of the way \LUA\ implements
@@ -337,9 +398,6 @@ can break up \LUATEX\ pretty bad. If you are not careful while working with the
node list interface, you may even end up with assertion errors from within the
\TEX\ portion of the executable.
-The behaviour documented in the above subsection is considered stable in the sense
-that there will not be backward-incompatible changes any more.
-
\subsection{\type {\latelua}}
Contrary to \type {\directlua}, \type {\latelua} stores \LUA\ code in a whatsit
@@ -389,9 +447,9 @@ is easier to keep the code in a separate file and load it using \LUA's
The \type {\directlua} commands involves tokenization of its argument (after
picking up an optional name or number specification). The tokenlist is then
converted into a string and given to \LUA\ to turn into a function that is
-called. The overhead is rather small but when you use this primitive hundreds of
-thousands of times, it can become noticeable. For this reason there is a variant
-call available: \type {\luafunction}. This command is used as follows:
+called. The overhead is rather small but when you have millions of calls it can
+have some impact. For this reason there is a variant call available: \type
+{\luafunction}. This command is used as follows:
\starttyping
\directlua {
@@ -495,31 +553,27 @@ raised.
\subsection{\type {\suppressfontnotfounderror}}
-\startsyntax
-\suppressfontnotfounderror = 1
-\stopsyntax
-
If this integer parameter is non|-|zero, then \LUATEX\ will not complain about
font metrics that are not found. Instead it will silently skip the font
assignment, making the requested csname for the font \type {\ifx} equal to \type
{\nullfont}, so that it can be tested against that without bothering the user.
-\subsection{\type {\suppresslongerror}}
-
\startsyntax
-\suppresslongerror = 1
+\suppressfontnotfounderror = 1
\stopsyntax
+\subsection{\type {\suppresslongerror}}
+
If this integer parameter is non|-|zero, then \LUATEX\ will not complain about
\type {\par} commands encountered in contexts where that is normally prohibited
(most prominently in the arguments of non-long macros).
-\subsection{\type {\suppressifcsnameerror}}
-
\startsyntax
-\suppressifcsnameerror = 1
+\suppresslongerror = 1
\stopsyntax
+\subsection{\type {\suppressifcsnameerror}}
+
If this integer parameter is non|-|zero, then \LUATEX\ will not complain about
non-expandable commands appearing in the middle of a \type {\ifcsname} expansion.
Instead, it will keep getting expanded tokens from the input until it encounters
@@ -527,16 +581,20 @@ an \type {\endcsname} command. If the input expansion is unbalanced with respect
to \type {\csname} \ldots \type {\endcsname} pairs, the \LUATEX\ process may hang
indefinitely.
-\subsection{\type {\suppressoutererror}}
-
\startsyntax
-\suppressoutererror = 1
+\suppressifcsnameerror = 1
\stopsyntax
+\subsection{\type {\suppressoutererror}}
+
If this new integer parameter is non|-|zero, then \LUATEX\ will not complain
about \type {\outer} commands encountered in contexts where that is normally
prohibited.
+\startsyntax
+\suppressoutererror = 1
+\stopsyntax
+
\subsection{\type {\suppressmathparerror}}
The following setting will permit \type {\par} tokens in a math formula:
@@ -557,33 +615,19 @@ a $
When set to a non|-|zero value the following command will not issue an error:
-\starttyping
+\startsyntax
\suppressprimitiveerror = 1
\primitive\notaprimitive
-\stoptyping
+\stopsyntax
\section {Math}
-\subsection{Extensions}
-
-We will cover math in its own chapter because not only the font subsystem and
-spacing model have been enhanced (thereby introducing many new primitives) but
-also because some more control has been added to existing functionality.
-
-\subsection{\type {\matheqnogapstep}}
-
-By default \TEX\ will add one quad between the equation and the number. This is
-hard coded. A new primitive can control this:
-
-\startsyntax
-\matheqnogapstep = 1000
-\stopsyntax
-
-Because a math quad from the math text font is used instead of a dimension, we
-use a step to control the size. A value of zero will suppress the gap. The step
-is divided by 1000 which is the usual way to mimmick floating point factors in
-\TEX.
+We will cover math extensions in its own chapter because not only the font
+subsystem and spacing model have been enhanced (thereby introducing many new
+primitives) but also because some more control has been added to existing
+functionality. Much of this relates to the differences approaches of traditional
+\TEX\ fonts and \OPENTYPE\ math.
\section{Fonts}
@@ -718,10 +762,8 @@ a relaxed equivalent when there is no such name. It is equivalent to
\stoptyping
The advantage is that it saves a lookup (don't expect much speedup) but more
-important is that it avoids using the \type {\if}.
-
-The \type {\lastnamedcs} is one that should be used with care. The above
-example could be written as:
+important is that it avoids using the \type {\if} test. The \type {\lastnamedcs}
+is one that should be used with care. The above example could be written as:
\starttyping
\ifcsname foo\endcsname
@@ -745,8 +787,7 @@ immediate command.
\subsection{\type{\letcharcode}}
-This primitive is still experimental but can be used to assign a meaning to an active
-character, as in:
+This primitive can be used to assign a meaning to an active character, as in:
\starttyping
\def\foo{bar} \letcharcode123=\foo
@@ -759,14 +800,14 @@ This can be a bit nicer that using the uppercase tricks (using the property of
\subsection{\type {\outputbox}}
-\startsyntax
-\outputbox = 65535
-\stopsyntax
-
-This new integer parameter allows you to alter the number of the box that will be
+This integer parameter allows you to alter the number of the box that will be
used to store the page sent to the output routine. Its default value is 255, and
the acceptable range is from 0 to 65535.
+\startsyntax
+\outputbox = 12345
+\stopsyntax
+
\subsection{\type {\vpack}, \type {\hpack} and \type {\tpack}}
These three primitives are like \type {\vbox}, \type {\hbox} and \type {\vtop}
@@ -858,7 +899,8 @@ This has the same effect but the subtype is now~1 and the value~123 is stored.
The traditional ligature builder still sees this as a cancel boundary directive
but at the \LUA\ end you can implement different behaviour. The added benefit of
passing this value is a side effect of the generalization. The subtypes~2 and~3
-are used to control protrusion and word boundaries in hyphenation.
+are used to control protrusion and word boundaries in hyphenation and have
+related primitives.
\section{Control and debugging}
@@ -867,7 +909,7 @@ are used to control protrusion and word boundaries in hyphenation.
If \type {\tracingonline} is larger than~2, the node list display will also print
the node number of the nodes.
-\subsection{\type {\outputmode} and \type {\draftmode}}
+\subsection{\type {\outputmode}}
The \type {\outputmode} variable tells \LUATEX\ what it has to produce:
@@ -876,8 +918,10 @@ The \type {\outputmode} variable tells \LUATEX\ what it has to produce:
\NC \type {1} \NC \PDF\ code \NC \NR
\stoptabulate
+\subsection{\type {\draftmode}}
+
The value of the \type {\draftmode} counter signals the backend if it should
-output less. The \PDF\ backend accepts a value of~$1$, while the \DVI\ backend
+output less. The \PDF\ backend accepts a value of~1, while the \DVI\ backend
ignores the value.
\section {Files}
diff --git a/doc/context/sources/general/manuals/luatex/luatex-fonts.tex b/doc/context/sources/general/manuals/luatex/luatex-fonts.tex
index ddb64d946..7ab77079f 100644
--- a/doc/context/sources/general/manuals/luatex/luatex-fonts.tex
+++ b/doc/context/sources/general/manuals/luatex/luatex-fonts.tex
@@ -22,7 +22,7 @@ The column \quote {\VF} means that this key will be created by the \type
The top|-|level keys in the table are as follows:
-\starttabulate[|l|c|c|c|l|p|]
+\starttabulate[|l|c|c|c|l|pl|]
\BC key \BC vf \BC tfm \BC used \BC value type \BC description \NC \NR
\NC \type{name} \NC yes \NC yes \NC yes \NC string \NC metric (file) name \NC \NR
\NC \type{area} \NC no \NC yes \NC yes \NC string \NC (directory) location, typically empty \NC \NR
diff --git a/doc/context/sources/general/manuals/luatex/luatex-introduction.tex b/doc/context/sources/general/manuals/luatex/luatex-introduction.tex
index d0899147d..4ffc321e0 100644
--- a/doc/context/sources/general/manuals/luatex/luatex-introduction.tex
+++ b/doc/context/sources/general/manuals/luatex/luatex-introduction.tex
@@ -15,7 +15,7 @@ Additional reference material is published in journals of user groups and
It took about a decade to reach stable version 1.0, but for good reason.
Successive versions brought new functionality, more control, some cleanup of
-internals and experimental features evolved into stable ones or were dropped.
+internals. Experimental features evolved into stable ones or were dropped.
Already quite early \LUATEX\ could be used for production and it was used on a
daily basis by the authors. Successive versions sometimes demanded a adaption to
the \LUA\ interfacing, but the concepts were unchanged. The current version can
@@ -26,9 +26,10 @@ properties.
Don't expect \LUATEX\ to behave the same as \PDFTEX ! Although the core
functionality of that 8 bit engine was starting point, it has been combined with
the directional support of \OMEGA\ (\ALEPH). But, \LUATEX\ can behave different
-due to its wide (32 bit) characters, many registers and large memory support.
-There is native \UTF\ input, support for large (more that 8 bit) fonts, and the
-math machinery is tuned for \OPENTYPE\ math. There is support for directional
+due to its wide (32 bit) characters, many registers and large memory support. The
+\PDF\ code produced differs from \PDFTEX\ but users will normally not notice
+that. There is native \UTF\ input, support for large (more than 8 bit) fonts, and
+the math machinery is tuned for \OPENTYPE\ math. There is support for directional
typesetting too. The log output can differ from other engines and will likely
differ more as we move forward. When you run plain \TEX\ for sure \LUATEX\ runs
slower than \PDFTEX\ but when you run for instance \CONTEXT\ \MKIV\ in many cases
@@ -49,25 +50,27 @@ code in \TEX\ engines (especially code that is not needed any longer).
\startitemize[packed]
\startitem
- Most of \PDFTEX\ version 1.40.9, converted to \CCODE. Some experimental
- features have been removed and some utility macros are not inherited as
- their functionality can be done in \LUA. The number of backend interface
- commands has been reduced to a few. The extensions are separated from the
- core (which we keep close to the original \TEX\ core). Some mechanisms
- like expansion and protrusion can behave different from the original due
- to some cleanup and optimization. Some whatsit based functionality (image
- support and reusable content) is now core functionality.
+ We started out with most of \PDFTEX\ version 1.40.9. The code base was
+ converted to \CCODE\ and split in modules. Experimental features were
+ been removed and utility macros are not inherited because their
+ functionality can be programmed in \LUA. The number of backend interface
+ commands has been reduced to a few. The so called extensions are
+ separated from the core (which we try to keep close to the original \TEX\
+ core). Some mechanisms like expansion and protrusion can behave different
+ from the original due to some cleanup and optimization. Some whatsit
+ based functionality (image support and reusable content) is now core
+ functionality. We don't stay in sync with \PDFTEX\ development.
\stopitem
\startitem
- The direction model and some other bits from \ALEPH\ RC4 (derived from
- \OMEGA) is included. The related primitives are part of core \LUATEX\ but
- at the node level directional support is no longer based on so called
- whatsits but on real nodes. In fact, whatsits are now only used for
- backend specific extensions.
+ The direction model from \ALEPH\ RC4 (which is derived from \OMEGA) is
+ included. The related primitives are part of core \LUATEX\ but at the
+ node level directional support is no longer based on so called whatsits
+ but on real nodes with relevant properties. The number of directions is
+ limited to the useful set and the backend has been made direction aware.
\stopitem
\startitem
Neither \ALEPH's I/O translation processes, nor tcx files, nor \ENCTEX\
- can be used, these encoding|-|related functions are superseded by a
+ are available. These encoding|-|related functions are superseded by a
\LUA|-|based solution (reader callbacks). In a similar fashion all file
\IO\ can be intercepted.
\stopitem
@@ -80,14 +83,18 @@ code in \TEX\ engines (especially code that is not needed any longer).
\startitem
There are various \TEX\ extensions but only those that cannot be done
using the \LUA\ interfaces. The math machinery often has two code paths:
- one traditional and the other more suitable for wide \OPENTYPE\ fonts.
+ one traditional and the other more suitable for wide \OPENTYPE\ fonts. Here
+ we follow the \MICROSOFT\ specifications as much as possible. Some math
+ functionality has been opened up a bit so that users have more control.
\stopitem
\startitem
The fontloader uses parts of \FONTFORGE\ 2008.11.17 combined with
additional code specific for usage in a \TEX\ engine. We try to minimize
specific font support to what \TEX\ needs: character references and
dimensions and delegate everything else to \LUA. That way we keep \TEX\
- open for extensions without touching the core.
+ open for extensions without touching the core. In order to minimize
+ dependencies at some point we may decide to make this an optional
+ library.
\stopitem
\startitem
The \METAPOST\ library is integral part of \LUATEX. This gives \TEX\ some
@@ -95,6 +102,13 @@ code in \TEX\ engines (especially code that is not needed any longer).
Again \LUA\ is used as glue between the frontend and backend. Further
development of \METAPOST\ is closely related to \LUATEX.
\stopitem
+ \startitem
+ The virtual font technology that comes with \TEX\ has been integrated
+ into the font machinery in a way that permits creating virtual fonts
+ at runtime. Because \LUATEX\ can also act as a \LUA\ interpreter this
+ means that a complete \TEX\ workflow can be built without the need for
+ additional programs.
+ \stopitem
\stopitemize
We try to keep upcoming versions compatible but intermediate releases can contain
@@ -106,22 +120,29 @@ solutions. After all, with \LUA\ you can extend the core functionality. The less
dependencies, the better.
The \TEXLIVE\ version is to be considered the current stable version. Any version
-between the yearly \TEXLIVE\ releases are to be considered beta. The beta
-releases are normally available via the \CONTEXT\ distribution channels (the
-garden and so called minimals).
+between the yearly \TEXLIVE\ releases are to be considered beta and in the
+repository end up as trunk releases. We have an experimental branch that we use
+for development but there is no support for any of its experimental features.
+Intermediate releases (from trunk) are normally available via the \CONTEXT\
+distribution channels (the garden and so called minimals).
-\blank[1*big]
+\blank[big]
-Hans Hagen, Harmut Henkel, \crlf
-Taco Hoekwater \& Luigi Scarso
+\startlines
+Hans Hagen
+Harmut Henkel
+Taco Hoekwater
+Luigi Scarso
+\stoplines
\blank[3*big]
-\starttabulate
+\starttabulate[|||]
\NC Version \EQ \currentdate \NC \NR
-\NC \LUATEX \EQ version \cldcontext{status.luatex_version/100},
- revision \cldcontext{status.luatex_revision},
- number \cldcontext{environment.luatexversion} \NC \NR
+\NC \LUATEX \EQ \cldcontext{LUATEXENGINE} %
+ \cldcontext{LUATEXVERSION} / %
+ \cldcontext{LUATEXFUNCTIONALITY}
+ \NC \NR
\NC \CONTEXT \EQ MkIV \contextversion \NC \NR
\stoptabulate
diff --git a/doc/context/sources/general/manuals/luatex/luatex-languages.tex b/doc/context/sources/general/manuals/luatex/luatex-languages.tex
index 365e87f26..f0fc98813 100644
--- a/doc/context/sources/general/manuals/luatex/luatex-languages.tex
+++ b/doc/context/sources/general/manuals/luatex/luatex-languages.tex
@@ -13,7 +13,7 @@ easiest way to explain the difference is to focus on unrestricted horizontal mod
(i.e.\ paragraphs) and hyphenation first. Later on, it will be easy to deal
with the differences that occur in horizontal and math modes.
-In \TEX82, the characters you type are converted into \type {char_node} records
+In \TEX82, the characters you type are converted into \type {char} node records
when they are encountered by the main control loop. \TEX\ attaches and processes
the font information while creating those records, so that the resulting \quote
{horizontal list} contains the final forms of ligatures and implicit kerning.
@@ -21,7 +21,7 @@ This packaging is needed because we may want to get the effective width of for
instance a horizontal box.
When it becomes necessary to hyphenate words in a paragraph, \TEX\ converts (one
-word at time) the \type {char_node} records into a string by replacing ligatures
+word at time) the \type {char} node records into a string by replacing ligatures
with their components and ignoring the kerning. Then it runs the hyphenation
algorithm on this string, and converts the hyphenated result back into a \quote
{horizontal list} that is consecutively spliced back into the paragraph stream.
@@ -29,14 +29,14 @@ Keep in mind that the paragraph may contain unboxed horizontal material, which
then already contains ligatures and kerns and the words therein are part of the
hyphenation process.
-Those \type {char_node} records are somewhat misnamed, as they are glyph
+Those \type {char} node records are somewhat misnamed, as they are glyph
positions in specific fonts, and therefore not really \quote {characters} in the
-linguistic sense. There is no language information inside the \type {char_node}
+linguistic sense. There is no language information inside the \type {char} node
records at all. Instead, language information is passed along using \type
-{language whatsit} records inside the horizontal list.
+{language whatsit} nodes inside the horizontal list.
In \LUATEX, the situation is quite different. The characters you type are always
-converted into \type {glyph_node} records with a special subtype to identify them
+converted into \type {glyph} node records with a special subtype to identify them
as being intended as linguistic characters. \LUATEX\ stores the needed language
information in those records, but does not do any font|-|related processing at
the time of node creation. It only stores the index of the current font and a
@@ -50,66 +50,50 @@ and finally it adjusts all the subtype identifiers so that the records are \quot
\section[charsandglyphs]{Characters and glyphs}
-\TEX82 (including \PDFTEX) differentiates between \type {char_node}s and \type
-{lig_node}s. The former are simple items that contained nothing but a \quote
+\TEX82 (including \PDFTEX) differentiates between \type {char} nodes and \type
+{lig} nodes. The former are simple items that contained nothing but a \quote
{character} and a \quote {font} field, and they lived in the same memory as
tokens did. The latter also contained a list of components, and a subtype
indicating whether this ligature was the result of a word boundary, and it was
stored in the same place as other nodes like boxes and kerns and glues.
In \LUATEX, these two types are merged into one, somewhat larger structure called
-a \type {glyph_node}. Besides having the old character, font, and component
-fields, and the new special fields like \quote {attr} (see~\in {section}
-[glyphnodes]), these nodes also contain:
+a \type {glyph} nodes. Besides having the old character, font, and component
+fields there are a few more, like \quote {attr} that we will see in \in {section}
+[glyphnodes], these nodes also contain a subtype, that codes four main types and
+two additional ghost types. For ligatures, multiple bits can be set at the same
+time (in case of a single|-|glyph word).
\startitemize
-
-\startitem A subtype, split into four main types:
-
- \startitemize
- \startitem
- \type {character}, for characters to be hyphenated: the lowest bit
- (bit 0) is set to 1.
- \stopitem
- \startitem
- \type {glyph}, for specific font glyphs: the lowest bit (bit 0) is
- not set.
- \stopitem
- \startitem
- \type {ligature}, for ligatures (bit 1 is set)
- \stopitem
- \startitem
- \type {ghost}, for \quote {ghost objects} (bit 2 is set)
- \stopitem
- \stopitemize
-
- The latter two make further use of two extra fields (bits 3 and 4):
-
- \startitemize
- \startitem
- \type {left}, for ligatures created from a left word boundary and for
- ghosts created from \type {\leftghost}
- \stopitem
- \startitem
- \type {right}, for ligatures created from a right word boundary and
- for ghosts created from \type {\rightghost}
- \stopitem
- \stopitemize
-
- For ligatures, both bits can be set at the same time (in case of a
- single|-|glyph word).
-
-\stopitem
-
-\startitem
- \type {glyph_node}s of type \quote {character} also contain language data,
- split into four items that were current when the node was created: the
- \type {\setlanguage} (15 bits), \type {\lefthyphenmin} (8 bits), \type
- {\righthyphenmin} (8 bits), and \type {\uchyph} (1 bit).
-\stopitem
-
+ \startitem
+ \type {character}, for characters to be hyphenated: the lowest bit
+ (bit 0) is set to 1.
+ \stopitem
+ \startitem
+ \type {glyph}, for specific font glyphs: the lowest bit (bit 0) is
+ not set.
+ \stopitem
+ \startitem
+ \type {ligature}, for constructed ligatures bit 1 is set
+ \stopitem
+ \startitem
+ \type {ghost}, for so called \quote {ghost objects} bit 2 is set
+ \stopitem
+ \startitem
+ \type {left}, for ligatures created from a left word boundary and for
+ ghosts created from \type {\leftghost} bit 3 gets set
+ \stopitem
+ \startitem
+ \type {right}, for ligatures created from a right word boundary and
+ for ghosts created from \type {\rightghost} bit 4 is set
+ \stopitem
\stopitemize
+The \type {glyph} nodes also contain language data, split into four items that
+were current when the node was created: the \type {\setlanguage} (15 bits), \type
+{\lefthyphenmin} (8 bits), \type {\righthyphenmin} (8 bits), and \type {\uchyph}
+(1 bit).
+
Incidentally, \LUATEX\ allows 16383 separate languages, and words can be 256
characters long. The language is stored with each character. You can set
\type {\firstvalidlanguage} to for instance~1 and make thereby language~0
@@ -134,7 +118,7 @@ In traditional \TEX\ the process of hyphenation is driven by \type {lccode}s. In
possible. When you do nothing, the currently used \type {lccode}s are used, when
loading patterns, setting exceptions or hyphenating a list.
-When you set \type {\savinghyphcodes} to a value larger than zero the current set
+When you set \type {\savinghyphcodes} to a value greater than zero the current set
of \type {lccode}s will be saved with the language. In that case changing a \type
{lccode} afterwards has no effect. However, you can adapt the set with:
@@ -147,37 +131,23 @@ hyphenation happens is (normally) when the paragraph or a horizontal box is
constructed. When \type {\savinghyphcodes} was zero when the language got
initialized you start out with nothing, otherwise you already have a set.
-When a \type {\hjcode} is larger than $0$ but smaller than $32$ is indicates the
+When a \type {\hjcode} is greater than 0 but less than 32 is indicates the
to be used length. In the following example we map a character (\type {x}) onto
another one in the patterns and tell the engine that \type {œ} counts as one
character. Because traditionally zero itself is reserved for inhibiting
-hyphenation, a value of $32$ counts as zero.
-
-\starttyping
-% assuming french patterns:
-foobar % foo-bar
-
-\hjcode`x=`o
-
-fxxbar % fxx-bar
-
-\lefthyphenmin3
-
-œdipus % œdi-pus
-
-\lefthyphenmin4
-
-œdipus % œdipus
-
-\hjcode`œ=2
-
-œdipus % œdi-pus
-
-\hjcode`i=32
-\hjcode`d=32
-
-œdipus % œdipus
-\stoptyping
+hyphenation, a value of 32 counts as zero.
+
+Here are some examples (we assume that French patterns are used):
+
+\starttabulate[||||]
+\NC \NC \type{foobar} \NC \type{foo-bar} \NC \NR
+\NC \type{\hjcode`x=`o} \NC \type{fxxbar} \NC \type{fxx-bar} \NC \NR
+\NC \type{\lefthyphenmin3} \NC \type{œdipus} \NC \type{œdi-pus} \NC \NR
+\NC \type{\lefthyphenmin4} \NC \type{œdipus} \NC \type{œdipus} \NC \NR
+\NC \type{\hjcode`œ=2} \NC \type{œdipus} \NC \type{œdi-pus} \NC \NR
+\NC \type{\hjcode`i=32 \hjcode`d=32} \NC \type{œdipus} \NC \type{œdipus} \NC \NR
+\NC
+\stoptabulate
Carrying all this information with each glyph would give too much overhead and
also make the process of setting up thee codes more complex. A solution with
@@ -194,23 +164,23 @@ as trigger. Here are a few examples of usage:
\startbuffer
discrete---discrete
\stopbuffer
-\typebuffer \start \dontcomplain \hsize 1pt \getbuffer \par \stop
+\typebuffer \startnarrower \dontcomplain \hsize 1pt \getbuffer \par \stopnarrower
\startbuffer
discrete\discretionary{}{}{---}discrete
\stopbuffer
-\typebuffer \start \dontcomplain \hsize 1pt \getbuffer \par \stop
+\typebuffer \startnarrower \dontcomplain \hsize 1pt \getbuffer \par \stopnarrower
\startbuffer
discrete\wordboundary\discretionary{}{}{---}discrete
\stopbuffer
-\typebuffer \start \dontcomplain \hsize 1pt \getbuffer \par \stop
+\typebuffer \startnarrower \dontcomplain \hsize 1pt \getbuffer \par \stopnarrower
\startbuffer
discrete\wordboundary\discretionary{}{}{---}\wordboundary discrete
\stopbuffer
-\typebuffer \start \dontcomplain \hsize 1pt \getbuffer \par \stop
+\typebuffer \startnarrower \dontcomplain \hsize 1pt \getbuffer \par \stopnarrower
\startbuffer
discrete\wordboundary\discretionary{---}{}{}\wordboundary discrete
\stopbuffer
-\typebuffer \start \dontcomplain \hsize 1pt \getbuffer \par \stop
+\typebuffer \startnarrower \dontcomplain \hsize 1pt \getbuffer \par \stopnarrower
We only accept an explicit hyphen when there is a preceding glyph and we skip a
sequence of explicit hyphens as that normally indicates a \type {--} or \type
@@ -359,12 +329,18 @@ before--after \par
before---after \par
\stopbuffer
-We show three samples:
+In \in {figure} [automatichyphenmode:1] \in {and} [automatichyphenmode:2] we show
+what happens with three samples:
Input A: \typebuffer[a]
Input B: \typebuffer[b]
Input C: \typebuffer[c]
+As with primitive companions of other single character commands, the \type {\-}
+command has a more verbose primitive version in \type {\explicitdiscretionary}
+and the normally intercepted in the hyphenator character \type {-} (or whatever
+is configured) is available as \type {\automaticdiscretionary}.
+
\startbuffer[demo]
\startcombination[nx=4,ny=3,location=top]
{\framed[align=normal,strut=no,top=\vskip.5ex,bottom=\vskip.5ex]{\automatichyphenmode\zerocount \hsize6em \getbuffer[a]}} {A~0~6em}
@@ -382,104 +358,123 @@ Input C: \typebuffer[c]
\stopcombination
\stopbuffer
-\startplacefigure[reference=automatic:1,title={The automatic modes \type {0} (default), \type {1} and \type {2}, with a \type {\hsize}
+\startplacefigure[reference=automatichyphenmode:1,title={The automatic modes \type {0} (default), \type {1} and \type {2}, with a \type {\hsize}
of 6em and 2pt (which triggers a linebreak).}]
\dontcomplain \tt \getbuffer[demo]
\stopplacefigure
-\startplacefigure[reference=automatic:2,title={The automatic modes \type {0} (default), \type {1} and \type {2}, with \type
+\startplacefigure[reference=automatichyphenmode:2,title={The automatic modes \type {0} (default), \type {1} and \type {2}, with \type
{\preexhyphenchar} and \type {\postexhyphenchar} set to characters \type {A} and \type {B}.}]
\postexhyphenchar`A\relax
\preexhyphenchar `B\relax
\dontcomplain \tt \getbuffer[demo]
\stopplacefigure
-As with primitive companions of other single character commands, the \type {\-}
-command has a more verbose primitive version in \type {\explicitdiscretionary}
-and the normally intercepted in the hyphenator character \type {-} (or whatever
-is configured) is available as \type {\automaticdiscretionary}.
-
\section{The main control loop}
In \LUATEX's main loop, almost all input characters that are to be typeset are
converted into \type {glyph} node records with subtype \quote {character}, but
there are a few exceptions.
-First, the \type {\accent} primitives creates nodes with subtype \quote {glyph}
-instead of \quote {character}: one for the actual accent and one for the
-accentee. The primary reason for this is that \type {\accent} in \TEX82 is
-explicitly dependent on the current font encoding, so it would not make much
-sense to attach a new meaning to the primitive's name, as that would invalidate
-many old documents and macro packages. \footnote {Of course, modern packages will
-not use the \type {\accent} primitive at all but try to map directly on composed
-characters.} A secondary reason is that in \TEX82, \type {\accent} prohibits
-hyphenation of the current word. Since in \LUATEX\ hyphenation only takes place
-on \quote {character} nodes, it is possible to achieve the same effect.
-
-This change of meaning did happen with \type {\char}, that now generates \quote
-{glyph} nodes with a character subtype. In traditional \TEX\ there was a strong
-relationship between the 8|-|bit input encoding, hyphenation and glyphs taken
-from a font. In \LUATEX\ we have \UTF\ input, and in most cases this maps
-directly to a character in a font, apart from glyph replacement in the font
-engine. If you want to access arbitrary glyphs in a font directly you can always
-use \LUA\ to do so, because fonts are available as \LUA\ table.
-
-Second, all the results of processing in math mode eventually become nodes with
-\quote {glyph} subtypes.
-
-Third, the \ALEPH|-|derived commands \type {\leftghost} and \type {\rightghost}
-create nodes of a third subtype: \quote {ghost}. These nodes are ignored
-completely by all further processing until the stage where inter|-|glyph kerning
-is added.
-
-Fourth, automatic discretionaries are handled differently. \TEX82 inserts an
-empty discretionary after sensing an input character that matches the \type
-{\hyphenchar} in the current font. This test is wrong in our opinion: whether or
-not hyphenation takes place should not depend on the current font, it is a
-language property. \footnote {When \TEX\ showed up we didn't have \UNICODE\ yet
-and being limited to eight bits meant that one sometimes had to compromise
-between supporting character input, glyph rendering, hyphenation.}
-
-In \LUATEX, it works like this: if \LUATEX\ senses a string of input characters
-that matches the value of the new integer parameter \type {\exhyphenchar}, it will
-insert an explicit discretionary after that series of nodes. Initex sets the \type
-{\exhyphenchar=`\-}. Incidentally, this is a global parameter instead of a
-language-specific one because it may be useful to change the value depending on
-the document structure instead of the text language.
-
-The insertion of discretionaries after a sequence of explicit hyphens happens at
-the same time as the other hyphenation processing, {\it not\/} inside the main
-control loop.
-
-The only use \LUATEX\ has for \type {\hyphenchar} is at the check whether a word
-should be considered for hyphenation at all. If the \type {\hyphenchar} of the
-font attached to the first character node in a word is negative, then hyphenation
-of that word is abandoned immediately. This behaviour is added for backward
-compatibility only, and the use of \type {\hyphenchar=-1} as a means of
-preventing hyphenation should not be used in new \LUATEX\ documents.
-
-Fifth, \type {\setlanguage} no longer creates whatsits. The meaning of \type
-{\setlanguage} is changed so that it is now an integer parameter like all others.
-That integer parameter is used in \type {\glyph_node} creation to add language
-information to the glyph nodes. In conjunction, the \type {\language} primitive is
-extended so that it always also updates the value of \type {\setlanguage}.
-
-Sixth, the \type {\noboundary} command (that prohibits word boundary processing
-where that would normally take place) now does create nodes. These nodes are
-needed because the exact place of the \type {\noboundary} command in the input
-stream has to be retained until after the ligature and font processing stages.
-
-Finally, there is no longer a \type {main_loop} label in the code. Remember that
-\TEX82 did quite a lot of processing while adding \type {char_nodes} to the
-horizontal list? For speed reasons, it handled that processing code outside of
-the \quote {main control} loop, and only the first character of any \quote {word}
-was handled by that \quote {main control} loop. In \LUATEX, there is no longer a
-need for that (all hard work is done later), and the (now very small) bits of
-character|-|handling code have been moved back inline. When \type
-{\tracingcommands} is on, this is visible because the full word is reported,
-instead of just the initial character.
-
-Because we tend to make hard codes behaviour configurable a few new primitives
+\startitemize[n]
+
+\startitem
+ The \type {\accent} primitives creates nodes with subtype \quote {glyph}
+ instead of \quote {character}: one for the actual accent and one for the
+ accentee. The primary reason for this is that \type {\accent} in \TEX82 is
+ explicitly dependent on the current font encoding, so it would not make much
+ sense to attach a new meaning to the primitive's name, as that would
+ invalidate many old documents and macro packages. A secondary reason is that
+ in \TEX82, \type {\accent} prohibits hyphenation of the current word. Since
+ in \LUATEX\ hyphenation only takes place on \quote {character} nodes, it is
+ possible to achieve the same effect. Of course, modern \UNICODE\ aware macro
+ packages will not use the \type {\accent} primitive at all but try to map
+ directly on composed characters.
+
+ This change of meaning did happen with \type {\char}, that now generates
+ \quote {glyph} nodes with a character subtype. In traditional \TEX\ there was
+ a strong relationship between the 8|-|bit input encoding, hyphenation and
+ glyphs taken from a font. In \LUATEX\ we have \UTF\ input, and in most cases
+ this maps directly to a character in a font, apart from glyph replacement in
+ the font engine. If you want to access arbitrary glyphs in a font directly
+ you can always use \LUA\ to do so, because fonts are available as \LUA\
+ table.
+\stopitem
+
+\startitem
+ All the results of processing in math mode eventually become nodes with
+ \quote {glyph} subtypes. In fact, the result of processing math is just
+ a regular list of glyphs, kerns, glue, penalties, boxes etc.
+\stopitem
+
+\startitem
+ The \ALEPH|-|derived commands \type {\leftghost} and \type {\rightghost}
+ create nodes of a third subtype: \quote {ghost}. These nodes are ignored
+ completely by all further processing until the stage where inter|-|glyph
+ kerning is added.
+\stopitem
+
+\startitem
+ Automatic discretionaries are handled differently. \TEX82 inserts an empty
+ discretionary after sensing an input character that matches the \type
+ {\hyphenchar} in the current font. This test is wrong in our opinion: whether
+ or not hyphenation takes place should not depend on the current font, it is a
+ language property. \footnote {When \TEX\ showed up we didn't have \UNICODE\
+ yet and being limited to eight bits meant that one sometimes had to
+ compromise between supporting character input, glyph rendering, hyphenation.}
+
+ In \LUATEX, it works like this: if \LUATEX\ senses a string of input
+ characters that matches the value of the new integer parameter \type
+ {\exhyphenchar}, it will insert an explicit discretionary after that series
+ of nodes. Initex sets the \type {\exhyphenchar=`\-}. Incidentally, this is a
+ global parameter instead of a language-specific one because it may be useful
+ to change the value depending on the document structure instead of the text
+ language.
+
+ The insertion of discretionaries after a sequence of explicit hyphens happens
+ at the same time as the other hyphenation processing, {\it not\/} inside the
+ main control loop.
+
+ The only use \LUATEX\ has for \type {\hyphenchar} is at the check whether a
+ word should be considered for hyphenation at all. If the \type {\hyphenchar}
+ of the font attached to the first character node in a word is negative, then
+ hyphenation of that word is abandoned immediately. This behaviour is added
+ for backward compatibility only, and the use of \type {\hyphenchar=-1} as a
+ means of preventing hyphenation should not be used in new \LUATEX\ documents.
+\stopitem
+
+\startitem
+ The \type {\setlanguage} command no longer creates whatsits. The meaning of
+ \type {\setlanguage} is changed so that it is now an integer parameter like
+ all others. That integer parameter is used in \type {\glyph_node} creation to
+ add language information to the glyph nodes. In conjunction, the \type
+ {\language} primitive is extended so that it always also updates the value of
+ \type {\setlanguage}.
+\stopitem
+
+\startitem
+ The \type {\noboundary} command (that prohibits word boundary processing
+ where that would normally take place) now does create nodes. These nodes are
+ needed because the exact place of the \type {\noboundary} command in the
+ input stream has to be retained until after the ligature and font processing
+ stages.
+\stopitem
+
+\startitem
+ There is no longer a \type {main_loop} label in the code. Remember that
+ \TEX82 did quite a lot of processing while adding \type {char_nodes} to the
+ horizontal list? For speed reasons, it handled that processing code outside
+ of the \quote {main control} loop, and only the first character of any \quote
+ {word} was handled by that \quote {main control} loop. In \LUATEX, there is
+ no longer a need for that (all hard work is done later), and the (now very
+ small) bits of character|-|handling code have been moved back inline. When
+ \type {\tracingcommands} is on, this is visible because the full word is
+ reported, instead of just the initial character.
+\stopitem
+
+\stopitemize
+
+Because we tend to make hard coded behaviour configurable a few new primitives
have been added:
\starttyping
@@ -509,16 +504,16 @@ other values do what we always did in \LUATEX: insert \type {\exhyphenpenalty}.
\section[patternsexceptions]{Loading patterns and exceptions}
-The hyphenation algorithm in \LUATEX\ is quite different from the one in \TEX82,
-although it uses essentially the same user input.
+Although we keep the traditional approach towards hyphenation (which is still
+superior) the implementation of the hyphenation algorithm in \LUATEX\ is quite
+different from the one in \TEX82.
After expansion, the argument for \type {\patterns} has to be proper \UTF8 with
individual patterns separated by spaces, no \type {\char} or \type {\chardef}d
commands are allowed. The current implementation quite strict and will reject all
-non|-|\UNICODE\ characters.
-
-Likewise, the expanded argument for \type {\hyphenation} also has to be proper
-\UTF8, but here a bit of extra syntax is provided:
+non|-|\UNICODE\ characters. Likewise, the expanded argument for \type
+{\hyphenation} also has to be proper \UTF8, but here a bit of extra syntax is
+provided:
\startitemize[n]
\startitem
@@ -632,6 +627,10 @@ of the implementation:
are used this is compatible with traditional \TEX. When you apply the \LUA\
\type {lang.hyphenate} function the current values are used.
\stopitem
+\startitem
+ The hyphenation exception dictionary is maintained as key|-|value hash, and
+ that is also dynamic, so the \type {hyph_size} setting is not used either.
+\stopitem
\stopitemize
Because we store penalties in the disc node the \type {\discretionary} command has
@@ -667,8 +666,8 @@ for the current \type {\language}, this behaviour is compatible with \type {\pat
and \type {\hyphenation}.
\LUATEX\ also hyphenates the first word in a paragraph. Words can be up to 256
-characters long (up from 64 in \TEX82). Longer words generate an error right now,
-but eventually either the limitation will be removed or perhaps it will become
+characters long (up from 64 in \TEX82). Longer words are ignored right now, but
+eventually either the limitation will be removed or perhaps it will become
possible to silently ignore the excess characters (this is what happens in
\TEX82, but there the behaviour cannot be controlled).
@@ -677,9 +676,6 @@ that this function expects to receive a list of \quote {character} nodes. It wil
not operate properly in the presence of \quote {glyph}, \quote {ligature}, or
\quote {ghost} nodes, nor does it know how to deal with kerning.
-The hyphenation exception dictionary is maintained as key|-|value hash, and that
-is also dynamic, so the \type {hyph_size} setting is not used either.
-
\section{Applying ligatures and kerning}
After all possible hyphenation points have been inserted in the list, \LUATEX\
@@ -694,19 +690,23 @@ boundary items after it is done with them, and it does the same for \quote
{ghost} nodes. Finally, at the end of the kerning stage, all remaining \quote
{character} nodes are converted to \quote {glyph} nodes.
-This work separation is worth mentioning because, if you overrule from \LUA\ only
+This word separation is worth mentioning because, if you overrule from \LUA\ only
one of the two callbacks related to font handling, then you have to make sure you
perform the tasks normally done by \LUATEX\ itself in order to make sure that the
other, non|-|overruled, routine continues to function properly.
-Work in this area is not yet complete, but most of the possible cases are handled
-by our rewritten ligaturing engine. At some point all of the possible inputs will
-become supported. \footnote {Not all of this makes sense because we nowadays have
-\OPENTYPE\ fonts and ligature building can happen in ,any different ways there.}
+Although we could improve the situation the reality is that in modern \OPENTYPE\
+fonts ligatures can be constructed in many ways: by replacing a sequence of
+characters by one glyph, or by selectively replacing individual glyphs, or by
+kerning, or any combination of this. Add to that contextual analysis and it will
+be clear that we have to let \LUA\ do that job instead. The generic font handler
+that we provide (which is part of \CONTEXT) distinguishes between base mode
+(which essentially is what we describe here and which delegates the task to \TEX)
+and node mode (which deals with more complex fonts.
-For example, take the word \type {office}, hyphenated \type {of-fice}, using a
-\quote {normal} font with all the \type {f}-\type {f} and \type {f}-\type {i}
-type ligatures:
+Let's look at an example. Take the word \type {office}, hyphenated \type
+{of-fice}, using a \quote {normal} font with all the \type {f}-\type {f} and
+\type {f}-\type {i} type ligatures:
\starttabulate[|l|l|]
\NC initial \NC \type {{o}{f}{f}{i}{c}{e}} \NC\NR
@@ -808,11 +808,13 @@ approach.
\section{Breaking paragraphs into lines}
-This code is still almost unchanged, but because of the above|-|mentioned changes
+This code is almost unchanged, but because of the above|-|mentioned changes
with respect to discretionaries and ligatures, line breaking will potentially be
different from traditional \TEX. The actual line breaking code is still based on
the \TEX82 algorithms, and it does not expect there to be discretionaries inside
-of discretionaries.
+of discretionaries. But, as patterns evolve and fonts handling can influence
+discretionaries, you need to be aware of the fact that long term consistency is not
+an engine matter only.
But that situation is now fairly common in \LUATEX, due to the changes to the
ligaturing mechanism. And also, the \LUATEX\ discretionary nodes are implemented
@@ -837,104 +839,95 @@ representing a language, and the associated functions.
\stopfunctioncall
This function creates a new userdata object. An object of type \type {<language>}
-is the first argument to most of the other functions in the \type {lang}
-library. These functions can also be used as if they were object methods, using
-the colon syntax.
-
-Without an argument, the next available internal id number will be assigned to
-this object. With argument, an object will be created that links to the internal
-language with that id number.
+is the first argument to most of the other functions in the \type {lang} library.
+These functions can also be used as if they were object methods, using the colon
+syntax. Without an argument, the next available internal id number will be
+assigned to this object. With argument, an object will be created that links to
+the internal language with that id number.
\startfunctioncall
<number> n = lang.id(<language> l)
\stopfunctioncall
-returns the internal \type {\language} id number this object refers to.
+The number returned is the internal \type {\language} id number this object refers to.
\startfunctioncall
<string> n = lang.hyphenation(<language> l)
lang.hyphenation(<language> l, <string> n)
\stopfunctioncall
-Either returns the current hyphenation exceptions for this language, or adds new
-ones. The syntax of the string is explained in~\in {section}
+This either returns the current hyphenation exceptions for this language, or adds
+new ones. The syntax of the string is explained in~\in {section}
[patternsexceptions].
\startfunctioncall
lang.clear_hyphenation(<language> l)
\stopfunctioncall
-Clears the exception dictionary (string) for this language.
+This call clears the exception dictionary (string) for this language.
\startfunctioncall
<string> n = lang.clean(<language> l, <string> o)
<string> n = lang.clean(<string> o)
\stopfunctioncall
-Creates a hyphenation key from the supplied hyphenation value. The syntax of the
-argument string is explained in~\in {section} [patternsexceptions]. This function
-is useful if you want to do something else based on the words in a dictionary
-file, like spell|-|checking.
+This function creates a hyphenation key from the supplied hyphenation value. The
+syntax of the argument string is explained in \in {section} [patternsexceptions].
+This function is useful if you want to do something else based on the words in a
+dictionary file, like spell|-|checking.
\startfunctioncall
<string> n = lang.patterns(<language> l)
lang.patterns(<language> l, <string> n)
\stopfunctioncall
-Adds additional patterns for this language object, or returns the current set.
-The syntax of this string is explained in~\in {section} [patternsexceptions].
+This adds additional patterns for this language object, or returns the current
+set. The syntax of this string is explained in \in {section}
+[patternsexceptions].
\startfunctioncall
lang.clear_patterns(<language> l)
\stopfunctioncall
-Clears the pattern dictionary for this language.
+This can be used to clear the pattern dictionary for a language.
\startfunctioncall
<number> n = lang.prehyphenchar(<language> l)
lang.prehyphenchar(<language> l, <number> n)
-\stopfunctioncall
-
-Gets or sets the \quote {pre|-|break} hyphen character for implicit hyphenation
-in this language (initially the hyphen, decimal 45).
-\startfunctioncall
<number> n = lang.posthyphenchar(<language> l)
lang.posthyphenchar(<language> l, <number> n)
\stopfunctioncall
-Gets or sets the \quote {post|-|break} hyphen character for implicit hyphenation
-in this language (initially null, decimal~0, indicating emptiness).
+These two are used to get or set the \quote {pre|-|break} and \quote
+{post|-|break} hyphen characters for implicit hyphenation in this language. The
+intial values are decimal 45 (hyphen) and decimal~0 (indicating emptiness).
\startfunctioncall
<number> n = lang.preexhyphenchar(<language> l)
lang.preexhyphenchar(<language> l, <number> n)
-\stopfunctioncall
-Gets or sets the \quote {pre|-|break} hyphen character for explicit hyphenation
-in this language (initially null, decimal~0, indicating emptiness).
-
-\startfunctioncall
<number> n = lang.postexhyphenchar(<language> l)
lang.postexhyphenchar(<language> l, <number> n)
\stopfunctioncall
-Gets or sets the \quote {post|-|break} hyphen character for explicit hyphenation
-in this language (initially null, decimal~0, indicating emptiness).
+These gets or set the \quote {pre|-|break} and \quote {post|-|break} hyphen
+characters for explicit hyphenation in this language. Both are initially
+decimal~0 (indicating emptiness).
\startfunctioncall
<boolean> success = lang.hyphenate(<node> head)
<boolean> success = lang.hyphenate(<node> head, <node> tail)
\stopfunctioncall
-Inserts hyphenation points (discretionary nodes) in a node list. If \type {tail}
-is given as argument, processing stops on that node. Currently, \type {success}
-is always true if \type {head} (and \type {tail}, if specified) are proper nodes,
-regardless of possible other errors.
+This call inserts hyphenation points (discretionary nodes) in a node list. If
+\type {tail} is given as argument, processing stops on that node. Currently,
+\type {success} is always true if \type {head} (and \type {tail}, if specified)
+are proper nodes, regardless of possible other errors.
Hyphenation works only on \quote {characters}, a special subtype of all the glyph
nodes with the node subtype having the value \type {1}. Glyph modes with
-different subtypes are not processed. See \in {section~} [charsandglyphs] for
+different subtypes are not processed. See \in {section} [charsandglyphs] for
more details.
The following two commands can be used to set or query hj codes:
diff --git a/doc/context/sources/general/manuals/luatex/luatex-lua.tex b/doc/context/sources/general/manuals/luatex/luatex-lua.tex
index 82b060440..c8df17da9 100644
--- a/doc/context/sources/general/manuals/luatex/luatex-lua.tex
+++ b/doc/context/sources/general/manuals/luatex/luatex-lua.tex
@@ -46,7 +46,9 @@ There are two situations that make \LUATEX\ behave like the \LUA\ byte compiler:
In this mode, \LUATEX\ is exactly like \type {luac} from the stand alone \LUA\
distribution, except that it does not have the \type {-l} switch, and that it
-accepts (but ignores) the \type {--luaconly} switch.
+accepts (but ignores) the \type {--luaconly} switch. The current version of \LUA\
+can dump bytecode using \type {string.dump} so we might decide to drop this
+version if \LUATEX.
\subsection{Other commandline processing}
@@ -84,10 +86,8 @@ consequence. The following command|-|line options are understood:
\NC \type{--version} \NC display version and exit \NC \NR
\stoptabulate
-Some of the traditional flags are just ignored: \type {--etex}, \type
-{--translate-file}, \type {--8bit}. \type {--[no-]parse-first-line}, \type
-{--default-translate-file}. Also, we no longer support write18 because \type
-{os.execute} can do the same.
+We don't support \type {\write18} because \type {os.execute} can do the same. It
+simplifies the code and makes more write targets possible.
The value to use for \type {\jobname} is decided as follows:
@@ -104,10 +104,10 @@ The value to use for \type {\jobname} is decided as follows:
part following the last \type {.}) stripped off.
\stopitem
\startitem
- An exception to the previous point: if the command line goes into interactive
- mode (by starting with a command) and there are no files input via \type
- {\everyjob} either, then the \type {\jobname} is set to \type {texput} as a
- last resort.
+ There is an exception to the previous point: if the command line goes into
+ interactive mode (by starting with a command) and there are no files input
+ via \type {\everyjob} either, then the \type {\jobname} is set to \type
+ {texput} as a last resort.
\stopitem
\stopitemize
@@ -116,61 +116,73 @@ attaching the proper extension (\type {log}, \type {pdf}, etc.) to the found
\type {\jobname}. These files are created in the directory pointed to by \type
{--output-directory}, or in the current directory, if that switch is not present.
-\blank
-
Without the \type {--lua} option, command line processing works like it does in
-any other web2c-based typesetting engine, except that \LUATEX\ has a few extra
-switches.
-
-If the \type {--lua} option is present, \LUATEX\ will enter an alternative mode
-of command line processing in comparison to the standard web2c programs.
-
-In this mode, a small series of actions is taken in order. First, it will parse
-the command line as usual, but it will only interpret a small subset of the
-options immediately: \type {--safer}, \type {--nosocket}, \type
-{--[no-]shell-escape}, \type {--enable-write18}, \type {--disable-write18}, \type
-{--shell-restricted}, \type {--help}, \type {--version}, and \type {--credits}.
-
-Next \LUATEX\ searches for the requested \LUA\ initialization script. If it
-cannot be found using the actual name given on the command line, a second attempt
-is made by prepending the value of the environment variable \type {LUATEXDIR}, if
-that variable is defined in the environment.
-
-Then it checks the various safety switches. You can use those to disable some
-\LUA\ commands that can easily be abused by a malicious document. At the moment,
-\type {--safer} \type {nil}s the following functions:
-
-\starttabulate[|l|l|]
-\BC library \BC functions \NC \NR
-\NC \type {os} \NC \type {execute} \type {exec} \type {spawn} \type {setenv} \type {rename} \type {remove} \type {tmpdir} \NC \NR
-\NC \type {io} \NC \type {popen} \type {output} \type {tmpfile} \NC \NR
-\NC \type {lfs} \NC \type {rmdir} \type {mkdir} \type {chdir} \type {lock} \type {touch} \NC \NR
-\stoptabulate
+any other \WEBC|-|based typesetting engine, except that \LUATEX\ has a few extra
+switches and lacks some others. Also, if the \type {--lua} option is present,
+\LUATEX\ will enter an alternative mode of command line processing in comparison
+to the standard \WEBC\ programs. In this mode, a small series of actions is taken
+in order.
-Furthermore, it disables loading of compiled \LUA\ libraries and it makes \type
-{io.open()} fail on files that are opened for anything besides reading.
+\startitemize[n]
-When \LUATEX\ starts it set the locale to a neutral value. If for some reason you
-use \type {os.locale}, you need to make sure you \type {nil} it afterwards
-because otherwise it can interfere with code that for instance generates dates.
-You can nil the locale with
+\startitem
+ First, it will parse the command line as usual, but it will only interpret a
+ small subset of the options immediately: \type {--safer}, \type {--nosocket},
+ \type {--[no-]shell-escape}, \type {--enable-write18}, \type
+ {--disable-write18}, \type {--shell-restricted}, \type {--help}, \type
+ {--version}, and \type {--credits}.
+\stopitem
-\starttyping
-os.setlocale(nil.nil)
-\stoptyping
+\startitem
+ Next \LUATEX\ searches for the requested \LUA\ initialization script. If it
+ cannot be found using the actual name given on the command line, a second
+ attempt is made by prepending the value of the environment variable \type
+ {LUATEXDIR}, if that variable is defined in the environment.
+\stopitem
+
+\startitem
+ Then it checks the various safety switches. You can use those to disable some
+ \LUA\ commands that can easily be abused by a malicious document. At the
+ moment, \type {--safer} \type {nil}s the following functions:
+
+ \starttabulate[|l|l|]
+ \BC library \BC functions \NC \NR
+ \NC \type {os} \NC \type {execute} \type {exec} \type {spawn} \type {setenv} \type {rename} \type {remove} \type {tmpdir} \NC \NR
+ \NC \type {io} \NC \type {popen} \type {output} \type {tmpfile} \NC \NR
+ \NC \type {lfs} \NC \type {rmdir} \type {mkdir} \type {chdir} \type {lock} \type {touch} \NC \NR
+ \stoptabulate
+
+ Furthermore, it disables loading of compiled \LUA\ libraries and it makes
+ \type {io.open()} fail on files that are opened for anything besides reading.
+\stopitem
+
+\startitem
+ When \LUATEX\ starts it set the locale to a neutral value. If for some reason
+ you use \type {os.locale}, you need to make sure you \type {nil} it
+ afterwards because otherwise it can interfere with code that for instance
+ generates dates. You can nil the locale with
+
+ \starttyping
+ os.setlocale(nil.nil)
+ \stoptyping
-The \type {--nosocket} option makes the socket library unavailable, so that \LUA\
-cannot use networking.
+ The \type {--nosocket} option makes the socket library unavailable, so that \LUA\
+ cannot use networking.
+
+ The switches \type {--[no-]shell-escape}, \type {--[enable|disable]-write18}, and
+ \type {--shell-restricted} have the same effects as in \PDFTEX, and additionally
+ make \type {io.popen()}, \type {os.execute}, \type {os.exec} and \type {os.spawn}
+ adhere to the requested option.
+\stopitem
-The switches \type {--[no-]shell-escape}, \type {--[enable|disable]-write18}, and
-\type {--shell-restricted} have the same effects as in \PDFTEX, and additionally
-make \type {io.popen()}, \type {os.execute}, \type {os.exec} and \type {os.spawn}
-adhere to the requested option.
+\startitem
+ Next the initialization script is loaded and executed. From within the
+ script, the entire command line is available in the \LUA\ table \type {arg},
+ beginning with \type {arg[0]}, containing the name of the executable. As
+ consequence warnings about unrecognized options are suppressed.
+\stopitem
-Next the initialization script is loaded and executed. From within the script,
-the entire command line is available in the \LUA\ table \type {arg}, beginning with
-\type {arg[0]}, containing the name of the executable. As consequence warnings
-about unrecognized options are suppressed.
+\stopitemize
Command line processing happens very early on. So early, in fact, that none of
\TEX's initializations have taken place yet. For that reason, the tables that
@@ -209,12 +221,9 @@ check \type {--progname}, or \type {--ini} and \type {--fmt}, if \type
\LUA s \type {tostring} function (and \type {string.format} may return values in
scientific notation, thereby confusing the \TEX\ end of things when it is used as
-the right|-|hand side of an assignment to a \type {\dimen} or \type {\count}.
-
-Loading dynamic \LUA\ libraries will fail if there are two \LUA\ libraries loaded
-at the same time (which will typically happen on \type {win32}, because there is
-one \LUA\ 5.3 inside \LUATEX, and another will likely be linked to the \DLL\ file
-of the module itself).
+the right|-|hand side of an assignment to a \type {\dimen} or \type {\count}. The
+output of these serializers also depend on the \LUA\ version, so in \LUA\ 5.3 you
+can get different output than from 5.2.
\LUATEX\ is able to use the kpathsea library to find \type {require()}d modules.
For this purpose, \type {package.searchers[2]} is replaced by a different loader
@@ -233,12 +242,10 @@ decides at runtime whether to use \KPATHSEA\ or the built|-|in core \LUA\
function. It uses \KPATHSEA\ when that is already initialized at that point in
time, otherwise it reverts to using the normal \type {package.cpath} loader.
-This functionality required an extension to kpathsea:
-
-\startnarrower
-There is a new kpathsea file format: \type {kpse_clua_format} that searches for
-files with extension \type {.dll} and \type {.so}. The \type {texmf.cnf} setting
-for this variable is \type {CLUAINPUTS}, and by default it has this value:
+This functionality required an extension to kpathsea. There is a new kpathsea
+file format: \type {kpse_clua_format} that searches for files with extension
+\type {.dll} and \type {.so}. The \type {texmf.cnf} setting for this variable is
+\type {CLUAINPUTS}, and by default it has this value:
\starttyping
CLUAINPUTS=.:$SELFAUTOLOC/lib/{$progname,$engine,}/lua//
@@ -248,12 +255,14 @@ This path is imperfect (it requires a \TDS\ subtree below the binaries
directory), but the architecture has to be in the path somewhere, and the
currently simplest way to do that is to search below the binaries directory only.
Of course it no big deal to write an alternative loader and use that in a macro
-package.
+package. One level up (a \type {lib} directory parallel to \type {bin}) would
+have been nicer, but that is not doable because \TEXLIVE\ uses a \type
+{bin/<arch>} structure.
-One level up (a \type {lib} directory parallel to \type {bin}) would have been
-nicer, but that is not doable because \TEXLIVE\ uses a \type {bin/<arch>}
-structure.
-\stopnarrower
+Loading dynamic \LUA\ libraries will fail if there are two \LUA\ libraries loaded
+at the same time (which will typically happen on \type {win32}, because there is
+one \LUA\ 5.3 inside \LUATEX, and another will likely be linked to the \DLL\ file
+of the module itself).
In keeping with the other \TEX|-|like programs in \TEXLIVE, the two \LUA\ functions
\type {os.execute} and \type {io.popen}, as well as the two new functions \type
@@ -267,30 +276,28 @@ four functions above if the matching \type {texmf.cnf} variable(s) or their \typ
requested system command. In \quote {script interpreter} runs of \LUATEX, these
settings have no effect, and all four functions function as normal.
-The \type {f:read("*line")} and \type {f:lines()} functions from the io library
-have been adjusted so that they are line|-|ending neutral: any of \type {LF},
-\type {CR} or \type {CR+LF} are acceptable line endings.
-
-\type {luafilesystem} has been extended: there are two extra boolean functions
-(\type {lfs.isdir(filename)} and \type {lfs.isfile(filename)}) and one extra
-string field in its attributes table (\type {permissions}). There is an
-additional function \type {lfs.shortname()} which takes a file name and returns
-its short name on \type {win32} platforms. On other platforms, it just returns
-the given argument. The file name is not tested for existence. Finally, for
-non|-|\type {win32} platforms only, there is the new function \type
-{lfs.readlink()} hat takes an existing symbolic link as argument and returns its
-content. It returns an error on \type {win32}.
-
-The \type {string} library has an extra function: \type {string.explode(s[,m])}.
-This function returns an array containing the string argument \type {s} split
-into sub-strings based on the value of the string argument \type {m}. The second
-argument is a string that is either empty (this splits the string into
-characters), a single character (this splits on each occurrence of that
-character, possibly introducing empty strings), or a single character followed by
-the plus sign \type {+} (this special version does not create empty sub-strings).
-The default value for \type {m} is \quote {\type { +}} (multiple spaces). Note:
-\type {m} is not hidden by surrounding braces as it would be if this function was
-written in \TEX\ macros.
+Some libraries have a few more functions, either coded in \CCODE\ or in \LUA.
+For instance, when we started with \LUATEX\ we added some helpers to the \type
+{luafilesystem} namespace \type {lfs}. The two boolean functions \type
+{lfs.isdir} and \type {lfs.isfile} were speedy and better variants of what could
+be done with \type {lfs.attributes}. The additional function \type
+{lfs.shortname} takes a file name and returns its short name on \type {win32}
+platforms. Finally, for non|-|\type {win32} platforms only, we provided \type
+{lfs.readlink} that takes an existing symbolic link as argument and returns its
+name. However, the \type library evolved sop now we dropped these in favour of
+pure \LUA\ variants. The \type {shortname} helper is considered obsolete and now
+just returns the name.
+
+The \type {string} library has a few extra functions like \type
+{string.explode(s[,m])}. This function returns an array containing the string
+argument \type {s} split into sub-strings based on the value of the string
+argument \type {m}. The second argument is a string that is either empty (this
+splits the string into characters), a single character (this splits on each
+occurrence of that character, possibly introducing empty strings), or a single
+character followed by the plus sign \type {+} (this special version does not
+create empty sub-strings). The default value for \type {m} is \quote {\type { +}}
+(multiple spaces). Note: \type {m} is not hidden by surrounding braces as it
+would be if this function was written in \TEX\ macros.
The \type {string} library also has six extra iterators that return strings
piecemeal:
@@ -323,7 +330,8 @@ are useful especially in the conversion of \UTF16 encoded data into \UTF8.
There is also a two|-|argument form of \type {string.dump()}. The second argument
is a boolean which, if true, strips the symbols from the dumped data. This
-matches an extension made in \type {luajit}.
+matches an extension made in \type {luajit}. This is typically a function that
+gets adapted as \LUA\ itself progresses.
The \type {string} library functions \type {len}, \type {lower}, \type {sub}
etc.\ are not \UNICODE|-|aware. For strings in the \UTF8 encoding, i.e., strings
@@ -355,8 +363,8 @@ similar helpers too:
\stopitemize
These three functions are relative fast and don't do much checking. They can be used
-as building blocks for other helpers.
-
+as building blocks for other helpers. So, eventually we can decide to drop the
+\type {sln} library, just that you know.
\blank
@@ -373,25 +381,37 @@ The \type {os} library has a few extra functions and variables:
\type {os.exec(commandline)} is a variation on \type {os.execute}. Here
\type {commandline} can be either a single string or a single table.
- If the argument is a table \LUATEX\ first checks if there is a value at
- integer index zero. If there is, this is the command to be executed.
- Otherwise, it will use the value at integer index one. If neither are
- present, nothing at all happens.
-
- The set of consecutive values starting at integer~1 in the table are the
- arguments that are passed on to the command (the value at index~1 becomes
- \type {arg[0]}). The command is searched for in the execution path, so there
- is normally no need to pass on a fully qualified path name.
-
- If the argument is a string, then it is automatically converted into a table
- by splitting on whitespace. In this case, it is impossible for the command
- and first argument to differ from each other.
-
- In the string argument format, whitespace can be protected by putting (part
- of) an argument inside single or double quotes. One layer of quotes is
- interpreted by \LUATEX, and all occurrences of \type {\"}, \type {\'} or \type
- {\\} within the quoted text are unescaped. In the table format, there is no
- string handling taking place.
+ \startitemize
+
+ \startitem
+ If the argument is a table \LUATEX\ first checks if there is a value at
+ integer index zero. If there is, this is the command to be executed.
+ Otherwise, it will use the value at integer index one. If neither are
+ present, nothing at all happens.
+ \stopitem
+
+ \startitem
+ The set of consecutive values starting at integer~1 in the table are the
+ arguments that are passed on to the command (the value at index~1 becomes
+ \type {arg[0]}). The command is searched for in the execution path, so
+ there is normally no need to pass on a fully qualified path name.
+ \stopitem
+
+ \startitem
+ If the argument is a string, then it is automatically converted into a
+ table by splitting on whitespace. In this case, it is impossible for the
+ command and first argument to differ from each other.
+ \stopitem
+
+ \startitem
+ In the string argument format, whitespace can be protected by putting
+ (part of) an argument inside single or double quotes. One layer of quotes
+ is interpreted by \LUATEX, and all occurrences of \type {\"}, \type {\'}
+ or \type {\\} within the quoted text are unescaped. In the table format,
+ there is no string handling taking place.
+ \stopitem
+
+ \stopitemize
This function normally does not return control back to the \LUA\ script: the
command will replace the current process. However, it will return the two
@@ -496,11 +516,27 @@ Some modules that are normally external to \LUA\ are statically linked in with
\startitemize
\startitem
+ \type {lpeg}, by Roberto Ierusalimschy, \hyphenatedurl
+ {http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html}. This library is not
+ \UNICODE|-|aware, but interprets strings on a byte|-|per|-|byte basis. This
+ mainly means that \type {lpeg.S} cannot be used with \UTF8 characters encoded
+ in more than two bytes, and thus \type {lpeg.S} will look for one of those
+ two bytes when matching, not the combination of the two. The same is true for
+ \type {lpeg.R}, although the latter will display an error message if used
+ with multibyte characters. Therefore \type {lpeg.R('aä')} results in the
+ message \type {bad argument #1 to 'R' (range must have two characters)},
+ since to \type {lpeg}, \type {ä} is two 'characters' (bytes), so \type {aä}
+ totals three. In practice this is no real issue and with some care you can
+ deal with \UNICODE\ just fine.
+\stopitem
+
+\startitem
\type {slnunicode}, from the \type {selene} libraries, \hyphenatedurl
{http://luaforge.net/projects/sln}. This library has been slightly extended
so that the \type {unicode.utf8.*} functions also accept the first 256 values
of plane~18. This is the range \LUATEX\ uses for raw binary output, as
- explained above.
+ explained above. We have no plans to provide more like this because you can
+ basically do all that you want in \LUA.
\stopitem
\startitem
@@ -514,20 +550,6 @@ Some modules that are normally external to \LUA\ are statically linked in with
\stopitem
\startitem
- \type {lpeg}, by Roberto Ierusalimschy, \hyphenatedurl
- {http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html}. This library is not
- \UNICODE|-|aware, but interprets strings on a byte|-|per|-|byte basis. This
- mainly means that \type {lpeg.S} cannot be used with \UTF8 characters encoded
- in more than two bytes, and thus \type {lpeg.S} will look for one of those
- two bytes when matching, not the combination of the two. The same is true for
- \type {lpeg.R}, although the latter will display an error message if used
- with multibyte characters. Therefore \type {lpeg.R('aä')} results in the
- message \type {bad argument #1 to 'R' (range must have two characters)},
- since to \type {lpeg}, \type {ä} is two 'characters' (bytes), so \type {aä}
- totals three. In practice this is no real issue.
-\stopitem
-
-\startitem
\type {lzlib}, by Tiago Dionizio, \hyphenatedurl
{http://luaforge.net/projects/lzlib/}.
\stopitem
@@ -546,10 +568,6 @@ Some modules that are normally external to \LUA\ are statically linked in with
\stopitemize
-At some point (this also depends on distributions) \LUATEX\ might have these
-libraries loaded on demand. For this reason you can best use \type {require} to
-make sure they are loaded.
-
\section{Testing}
For development reasons you can influence the used startup date and time. This can
@@ -579,17 +597,9 @@ When Universal Time is needed, you can pass the flag \type {utc} to the engine.
property also works when the date and time are set by \LUATEX\ itself. It has a
complementary entry \type {use_utc_time} in the \type {texconfig} table.
-\startnotabene
- To some extend a cleaner solution would be to have a flag that disables all
- variable data in one go (like filenames and so) but we just follow the method
- implemented in \PDFTEX\ where primitives are used to influence other
- properties.
-\stopnotabene
-
-\startnotabene
- In \CONTEXT\ we provide the command line argument \type {--nodates} that does
- bit more disabling of dates.
-\stopnotabene
+There is some control possible, for instance prevent filename to be written to
+the \PDF\ file. This is discussed elsewhere. In \CONTEXT\ we provide the command
+line argument \type {--nodates} that does bit more disabling of dates.
\stopchapter
diff --git a/doc/context/sources/general/manuals/luatex/luatex-math.tex b/doc/context/sources/general/manuals/luatex/luatex-math.tex
index 8ccae83f3..b30e6cf63 100644
--- a/doc/context/sources/general/manuals/luatex/luatex-math.tex
+++ b/doc/context/sources/general/manuals/luatex/luatex-math.tex
@@ -442,77 +442,73 @@ for the parameters for which there are font dimensions).
Besides the parameters below, \LUATEX\ also looks at the \quote {space} font
dimension parameter. For math fonts, this should be set to zero.
-\start
+\def\MathLine#1#2#3#4#5%
+ {\TB
+ \NC \llap{\high{\tx #2\enspace}}\ttbf \string #1 \NC #5 \NC \NR
+ \NC \tx #3 \NC #4 \NC \NR}
-\switchtobodyfont[8pt]
-
-\starttabulate[|l|l|l|p|]
-\BC variable \BC style \BC default value opentype \BC default value tfm \NC \NR
-\NC \type {\Umathaxis} \NC -- \NC AxisHeight \NC axis_height \NC \NR
-\NC \type {\Umathoperatorsize} \NC D, D' \NC DisplayOperatorMinHeight \NC $^6$ \NC \NR
-\NC \type {\Umathfractiondelsize} \NC D, D' \NC FractionDelimiterDisplayStyleSize$^9$ \NC delim1 \NC \NR
-\NC \NC T, T', S, S', SS, SS' \NC FractionDelimiterSize$^9$ \NC delim2 \NC \NR
-\NC \type {\Umathfractiondenomdown} \NC D, D' \NC FractionDenominatorDisplayStyleShiftDown \NC denom1 \NC \NR
-\NC \NC T, T', S, S', SS, SS' \NC FractionDenominatorShiftDown \NC denom2 \NC \NR
-\NC \type {\Umathfractiondenomvgap} \NC D, D' \NC FractionDenominatorDisplayStyleGapMin \NC 3*default_rule_thickness \NC \NR
-\NC \NC T, T', S, S', SS, SS' \NC FractionDenominatorGapMin \NC default_rule_thickness \NC \NR
-\NC \type {\Umathfractionnumup} \NC D, D' \NC FractionNumeratorDisplayStyleShiftUp \NC num1 \NC \NR
-\NC \NC T, T', S, S', SS, SS' \NC FractionNumeratorShiftUp \NC num2 \NC \NR
-\NC \type {\Umathfractionnumvgap} \NC D, D' \NC FractionNumeratorDisplayStyleGapMin \NC 3*default_rule_thickness \NC \NR
-\NC \NC T, T', S, S', SS, SS' \NC FractionNumeratorGapMin \NC default_rule_thickness \NC \NR
-\NC \type {\Umathfractionrule} \NC -- \NC FractionRuleThickness \NC default_rule_thickness \NC \NR
-\NC \type {\Umathskewedfractionhgap} \NC -- \NC SkewedFractionHorizontalGap \NC math_quad/2 \NC \NR
-\NC \type {\Umathskewedfractionvgap} \NC -- \NC SkewedFractionVerticalGap \NC math_x_height \NC \NR
-\NC \type {\Umathlimitabovebgap} \NC -- \NC UpperLimitBaselineRiseMin \NC big_op_spacing3 \NC \NR
-\NC \type {\Umathlimitabovekern} \NC -- \NC 0$^1$ \NC big_op_spacing5 \NC \NR
-\NC \type {\Umathlimitabovevgap} \NC -- \NC UpperLimitGapMin \NC big_op_spacing1 \NC \NR
-\NC \type {\Umathlimitbelowbgap} \NC -- \NC LowerLimitBaselineDropMin \NC big_op_spacing4 \NC \NR
-\NC \type {\Umathlimitbelowkern} \NC -- \NC 0$^1$ \NC big_op_spacing5 \NC \NR
-\NC \type {\Umathlimitbelowvgap} \NC -- \NC LowerLimitGapMin \NC big_op_spacing2 \NC \NR
-\NC \type {\Umathoverdelimitervgap} \NC -- \NC StretchStackGapBelowMin \NC big_op_spacing1 \NC \NR
-\NC \type {\Umathoverdelimiterbgap} \NC -- \NC StretchStackTopShiftUp \NC big_op_spacing3 \NC \NR
-\NC \type {\Umathunderdelimitervgap} \NC-- \NC StretchStackGapAboveMin \NC big_op_spacing2 \NC \NR
-\NC \type {\Umathunderdelimiterbgap} \NC-- \NC StretchStackBottomShiftDown \NC big_op_spacing4 \NC \NR
-\NC \type {\Umathoverbarkern} \NC -- \NC OverbarExtraAscender \NC default_rule_thickness \NC \NR
-\NC \type {\Umathoverbarrule} \NC -- \NC OverbarRuleThickness \NC default_rule_thickness \NC \NR
-\NC \type {\Umathoverbarvgap} \NC -- \NC OverbarVerticalGap \NC 3*default_rule_thickness \NC \NR
-\NC \type {\Umathquad} \NC -- \NC <font_size(f)>$^1$ \NC math_quad \NC \NR
-\NC \type {\Umathradicalkern} \NC -- \NC RadicalExtraAscender \NC default_rule_thickness \NC \NR
-\NC \type {\Umathradicalrule} \NC -- \NC RadicalRuleThickness \NC <not set>$^2$ \NC \NR
-\NC \type {\Umathradicalvgap} \NC D, D' \NC RadicalDisplayStyleVerticalGap \NC (default_rule_thickness+\crlf
- (abs(math_x_height)/4))$^3$ \NC \NR
-\NC \NC T, T', S, S', SS, SS' \NC RadicalVerticalGap \NC (default_rule_thickness+\crlf
- (abs(default_rule_thickness)/4))$^3$ \NC \NR
-\NC \type {\Umathradicaldegreebefore} \NC -- \NC RadicalKernBeforeDegree \NC <not set>$^2$ \NC \NR
-\NC \type {\Umathradicaldegreeafter} \NC -- \NC RadicalKernAfterDegree \NC <not set>$^2$ \NC \NR
-\NC \type {\Umathradicaldegreeraise} \NC -- \NC RadicalDegreeBottomRaisePercent \NC <not set>$^{2,7}$ \NC \NR
-\NC \type {\Umathspaceafterscript} \NC -- \NC SpaceAfterScript \NC script_space$^4$ \NC \NR
-\NC \type {\Umathstackdenomdown} \NC D, D' \NC StackBottomDisplayStyleShiftDown \NC denom1 \NC \NR
-\NC \NC T, T', S, S', SS, SS' \NC StackBottomShiftDown \NC denom2 \NC \NR
-\NC \type {\Umathstacknumup} \NC D, D' \NC StackTopDisplayStyleShiftUp \NC num1 \NC \NR
-\NC \NC T, T', S, S', SS, SS' \NC StackTopShiftUp \NC num3 \NC \NR
-\NC \type {\Umathstackvgap} \NC D, D' \NC StackDisplayStyleGapMin \NC 7*default_rule_thickness \NC \NR
-\NC \NC T, T', S, S', SS, SS' \NC StackGapMin \NC 3*default_rule_thickness \NC \NR
-\NC \type {\Umathsubshiftdown} \NC -- \NC SubscriptShiftDown \NC sub1 \NC \NR
-\NC \type {\Umathsubshiftdrop} \NC -- \NC SubscriptBaselineDropMin \NC sub_drop \NC \NR
-\NC \type {\Umathsubsupshiftdown} \NC -- \NC SubscriptShiftDownWithSuperscript$^8$ \NC \NC \NR
-\NC \NC \NC \quad\ or SubscriptShiftDown \NC sub2 \NC \NR
-\NC \type {\Umathsubtopmax} \NC -- \NC SubscriptTopMax \NC (abs(math_x_height * 4) / 5) \NC \NR
-\NC \type {\Umathsubsupvgap} \NC -- \NC SubSuperscriptGapMin \NC 4*default_rule_thickness \NC \NR
-\NC \type {\Umathsupbottommin} \NC -- \NC SuperscriptBottomMin \NC (abs(math_x_height) / 4) \NC \NR
-\NC \type {\Umathsupshiftdrop} \NC -- \NC SuperscriptBaselineDropMax \NC sup_drop \NC \NR
-\NC \type {\Umathsupshiftup} \NC D \NC SuperscriptShiftUp \NC sup1 \NC \NR
-\NC \NC T, S, SS, \NC SuperscriptShiftUp \NC sup2 \NC \NR
-\NC \NC D', T', S', SS' \NC SuperscriptShiftUpCramped \NC sup3 \NC \NR
-\NC \type {\Umathsupsubbottommax} \NC -- \NC SuperscriptBottomMaxWithSubscript \NC (abs(math_x_height * 4) / 5) \NC \NR
-\NC \type {\Umathunderbarkern} \NC -- \NC UnderbarExtraDescender \NC default_rule_thickness \NC \NR
-\NC \type {\Umathunderbarrule} \NC -- \NC UnderbarRuleThickness \NC default_rule_thickness \NC \NR
-\NC \type {\Umathunderbarvgap} \NC -- \NC UnderbarVerticalGap \NC 3*default_rule_thickness \NC \NR
-\NC \type {\Umathconnectoroverlapmin} \NC -- \NC MinConnectorOverlap \NC 0$^5$ \NC \NR
+\starttabulate[|l|l|]
+\BC variable / style \BC tfm / opentype \NC \NR
+\MathLine{\Umathaxis} {} {} {AxisHeight} {axis_height}
+\MathLine{\Umathoperatorsize} {6} {D, D'} {DisplayOperatorMinHeight} {\emdash}
+\MathLine{\Umathfractiondelsize} {9} {D, D'} {FractionDelimiterDisplayStyleSize} {delim1}
+\MathLine{\Umathfractiondelsize} {9} {T, T', S, S', SS, SS'}{FractionDelimiterSize} {delim2}
+\MathLine{\Umathfractiondenomdown} {} {D, D'} {FractionDenominatorDisplayStyleShiftDown}{denom1}
+\MathLine{\Umathfractiondenomdown} {} {T, T', S, S', SS, SS'}{FractionDenominatorShiftDown} {denom2}
+\MathLine{\Umathfractiondenomvgap} {} {D, D'} {FractionDenominatorDisplayStyleGapMin} {3*default_rule_thickness}
+\MathLine{\Umathfractiondenomvgap} {} {T, T', S, S', SS, SS'}{FractionDenominatorGapMin} {default_rule_thickness}
+\MathLine{\Umathfractionnumup} {} {D, D'} {FractionNumeratorDisplayStyleShiftUp} {num1}
+\MathLine{\Umathfractionnumup} {} {T, T', S, S', SS, SS'}{FractionNumeratorShiftUp} {num2}
+\MathLine{\Umathfractionnumvgap} {} {D, D'} {FractionNumeratorDisplayStyleGapMin} {3*default_rule_thickness}
+\MathLine{\Umathfractionnumvgap} {} {T, T', S, S', SS, SS'}{FractionNumeratorGapMin} {default_rule_thickness}
+\MathLine{\Umathfractionrule} {} {} {FractionRuleThickness} {default_rule_thickness}
+\MathLine{\Umathskewedfractionhgap} {} {} {SkewedFractionHorizontalGap} {math_quad/2}
+\MathLine{\Umathskewedfractionvgap} {} {} {SkewedFractionVerticalGap} {math_x_height}
+\MathLine{\Umathlimitabovebgap} {} {} {UpperLimitBaselineRiseMin} {big_op_spacing3}
+\MathLine{\Umathlimitabovekern} {1} {} {0} {big_op_spacing5}
+\MathLine{\Umathlimitabovevgap} {} {} {UpperLimitGapMin} {big_op_spacing1}
+\MathLine{\Umathlimitbelowbgap} {} {} {LowerLimitBaselineDropMin} {big_op_spacing4}
+\MathLine{\Umathlimitbelowkern} {1} {} {0} {big_op_spacing5}
+\MathLine{\Umathlimitbelowvgap} {} {} {LowerLimitGapMin} {big_op_spacing2}
+\MathLine{\Umathoverdelimitervgap} {} {} {StretchStackGapBelowMin} {big_op_spacing1}
+\MathLine{\Umathoverdelimiterbgap} {} {} {StretchStackTopShiftUp} {big_op_spacing3}
+\MathLine{\Umathunderdelimitervgap} {} {} {StretchStackGapAboveMin} {big_op_spacing2}
+\MathLine{\Umathunderdelimiterbgap} {} {} {StretchStackBottomShiftDown} {big_op_spacing4}
+\MathLine{\Umathoverbarkern} {} {} {OverbarExtraAscender} {default_rule_thickness}
+\MathLine{\Umathoverbarrule} {} {} {OverbarRuleThickness} {default_rule_thickness}
+\MathLine{\Umathoverbarvgap} {} {} {OverbarVerticalGap} {3*default_rule_thickness}
+\MathLine{\Umathquad} {1} {} {<font_size(f)>} {math_quad}
+\MathLine{\Umathradicalkern} {} {} {RadicalExtraAscender} {default_rule_thickness}
+\MathLine{\Umathradicalrule} {2} {} {RadicalRuleThickness} {<not set>}
+\MathLine{\Umathradicalvgap} {3} {D, D'} {RadicalDisplayStyleVerticalGap} {default_rule_thickness+abs(math_x_height)/4}
+\MathLine{\Umathradicalvgap} {3} {T, T', S, S', SS, SS'}{RadicalVerticalGap} {default_rule_thickness+abs(default_rule_thickness)/4}
+\MathLine{\Umathradicaldegreebefore}{2} {} {RadicalKernBeforeDegree} {<not set>}
+\MathLine{\Umathradicaldegreeafter} {2} {} {RadicalKernAfterDegree} {<not set>}
+\MathLine{\Umathradicaldegreeraise} {2,7}{} {RadicalDegreeBottomRaisePercent} {<not set>}
+\MathLine{\Umathspaceafterscript} {4} {} {SpaceAfterScript} {script_space}
+\MathLine{\Umathstackdenomdown} {} {D, D'} {StackBottomDisplayStyleShiftDown} {denom1}
+\MathLine{\Umathstackdenomdown} {} {T, T', S, S', SS, SS'}{StackBottomShiftDown} {denom2}
+\MathLine{\Umathstacknumup} {} {D, D'} {StackTopDisplayStyleShiftUp} {num1}
+\MathLine{\Umathstacknumup} {} {T, T', S, S', SS, SS'}{StackTopShiftUp} {num3}
+\MathLine{\Umathstackvgap} {} {D, D'} {StackDisplayStyleGapMin} {7*default_rule_thickness}
+\MathLine{\Umathstackvgap} {} {T, T', S, S', SS, SS'}{StackGapMin} {3*default_rule_thickness}
+\MathLine{\Umathsubshiftdown} {} {} {SubscriptShiftDown} {sub1}
+\MathLine{\Umathsubshiftdrop} {} {} {SubscriptBaselineDropMin} {sub_drop}
+\MathLine{\Umathsubsupshiftdown} {8} {} {SubscriptShiftDownWithSuperscript} {\emdash}
+\MathLine{\Umathsubtopmax} {} {} {SubscriptTopMax} {abs(math_x_height*4)/5}
+\MathLine{\Umathsubsupvgap} {} {} {SubSuperscriptGapMin} {4*default_rule_thickness}
+\MathLine{\Umathsupbottommin} {} {} {SuperscriptBottomMin} {abs(math_x_height/4)}
+\MathLine{\Umathsupshiftdrop} {} {} {SuperscriptBaselineDropMax} {sup_drop}
+\MathLine{\Umathsupshiftup} {} {D} {SuperscriptShiftUp} {sup1}
+\MathLine{\Umathsupshiftup} {} {T, S, SS,} {SuperscriptShiftUp} {sup2}
+\MathLine{\Umathsupshiftup} {} {D', T', S', SS'} {SuperscriptShiftUpCramped} {sup3}
+\MathLine{\Umathsupsubbottommax} {} {} {SuperscriptBottomMaxWithSubscript} {abs(math_x_height*4)/5}
+\MathLine{\Umathunderbarkern} {} {} {UnderbarExtraDescender} {default_rule_thickness}
+\MathLine{\Umathunderbarrule} {} {} {UnderbarRuleThickness} {default_rule_thickness}
+\MathLine{\Umathunderbarvgap} {} {} {UnderbarVerticalGap} {3*default_rule_thickness}
+\MathLine{\Umathconnectoroverlapmin}{5} {} {MinConnectorOverlap} {0}
\stoptabulate
-\stop
-
Note 1: \OPENTYPE\ fonts set \type {\Umathlimitabovekern} and \type
{\Umathlimitbelowkern} to zero and set \type {\Umathquad} to the font size of the
used font, because these are not supported in the \type {MATH} table,
@@ -641,7 +637,7 @@ example.
This kind of parameters relate to the fact that italic correction in \OPENTYPE\
math is bound to fuzzy rules. So, control is the solution.
-\section{Script boxes}
+\section{Script and kerning}
If you want typeset text in math macro packages often provide something \type
{\text} which obeys the script sizes. As the definition can be anything there is
@@ -675,12 +671,12 @@ italics, while other fonts can lack kerns.
\unexpanded\def\Show#1#2#3%
{\doifelsenothing{#3}
- {\small\typeinlinebuffer[#1]}
+ {\small\tx\typeinlinebuffer[#1]}
{\doifelse{#3}{-}
- {\small\type{mode #2}}
+ {\small\bf\tt mode #2}
{\switchtobodyfont[#3]\showfontkerns\showglyphs\mathscriptboxmode#2\relax\inlinebuffer[#1]}}}
-\starttabulate[|lT|c|c|c|c|c|]
+\starttabulate[|lBT|c|c|c|c|c|]
\NC \NC \Show{1}{0}{} \NC\Show{1}{1}{} \NC \Show{2}{1}{} \NC \Show{2}{2}{} \NC \Show{3}{3}{} \NC \NR
\NC \NC \Show{1}{0}{-} \NC\Show{1}{1}{-} \NC \Show{2}{1}{-} \NC \Show{2}{2}{-} \NC \Show{3}{3}{-} \NC \NR
\NC modern \NC \Show{1}{0}{modern} \NC\Show{1}{1}{modern} \NC \Show{2}{1}{modern} \NC \Show{2}{2}{modern} \NC \Show{3}{3}{modern} \NC \NR
@@ -690,6 +686,39 @@ italics, while other fonts can lack kerns.
\NC dejavu \NC \Show{1}{0}{dejavu} \NC\Show{1}{1}{dejavu} \NC \Show{2}{1}{dejavu} \NC \Show{2}{2}{dejavu} \NC \Show{3}{3}{dejavu} \NC \NR
\stoptabulate
+Kerning between a character subscript is controlled by \type {\mathscriptcharmode}
+which also defaults to~1.
+
+Here is another example. Internally we tag kerns as italic kerns or font kerns
+where font kerns result from the staircase kern tables. In 2018 fonts like Latin
+Modern and Pagella rely on cheats with the boundingbox, Cambria uses staircase
+kerns and Lucida a mixture. Depending on how fonts evolve we might add some more
+control over what one can turn on and off.
+
+\def\MathSample#1#2#3%
+ {\NC
+ #1 \NC
+ #2 \NC
+ \showglyphdata \switchtobodyfont[#2,17.3pt]$#3T_{f}$ \NC
+ \showglyphdata \switchtobodyfont[#2,17.3pt]$#3\gamma_{e}$ \NC
+ \showglyphdata \switchtobodyfont[#2,17.3pt]$#3\gamma_{ee}$ \NC
+ \showglyphdata \switchtobodyfont[#2,17.3pt]$#3T_{\tf fluff}$ \NC
+ \NR}
+
+\starttabulate[|Tl|Tl|l|l|l|l|]
+ \FL
+ \MathSample{normal}{modern} {\mr}
+ \MathSample{} {pagella} {\mr}
+ \MathSample{} {cambria} {\mr}
+ \MathSample{} {lucidaot}{\mr}
+ \ML
+ \MathSample{bold} {modern} {\mb}
+ \MathSample{} {pagella} {\mb}
+ \MathSample{} {cambria} {\mb}
+ \MathSample{} {lucidaot}{\mb}
+ \LL
+\stoptabulate
+
\section{Unscaled fences}
The \type {\mathdelimitersmode} primitive is experimental and deals with the
@@ -1344,6 +1373,20 @@ makes sense. As a bonus we also provide two extra penalties:
They default to inifinite which signals that they don't need to be inserted. When
set they are injected before a binop or rel noad. This is an experimental feature.
+\subsection{Equation spacing: \type {\matheqnogapstep}}
+
+By default \TEX\ will add one quad between the equation and the number. This is
+hard coded. A new primitive can control this:
+
+\startsyntax
+\matheqnogapstep = 1000
+\stopsyntax
+
+Because a math quad from the math text font is used instead of a dimension, we
+use a step to control the size. A value of zero will suppress the gap. The step
+is divided by 1000 which is the usual way to mimmick floating point factors in
+\TEX.
+
\subsection {Tracing}
Because there are quite some math related parameters and values, it is possible
diff --git a/doc/context/sources/general/manuals/luatex/luatex-modifications.tex b/doc/context/sources/general/manuals/luatex/luatex-modifications.tex
index b5d8f2750..e41126142 100644
--- a/doc/context/sources/general/manuals/luatex/luatex-modifications.tex
+++ b/doc/context/sources/general/manuals/luatex/luatex-modifications.tex
@@ -99,7 +99,8 @@ functionality, but with a few small adaptations.
\startitem
The \TEXXET\ extension is not present, so the primitives \type
{\TeXXeTstate}, \type {\beginR}, \type {\beginL}, \type {\endR} and \type
- {\endL} are missing. Instead we use the \OMEGA\ approach to directionality.
+ {\endL} are missing. Instead we used the \OMEGA/\ALEPH\ approach to
+ directionality as starting point.
\stopitem
\startitem
@@ -108,9 +109,9 @@ functionality, but with a few small adaptations.
\stopitem
\startitem
- Register management in \LUATEX\ uses the \ALEPH\ model, so the maximum value
- is 65535 and the implementation uses a flat array instead of the mixed
- flat|\&|sparse model from \ETEX.
+ Register management in \LUATEX\ uses the \OMEGA/\ALEPH\ model, so the maximum
+ value is 65535 and the implementation uses a flat array instead of the mixed
+ flat & sparse model from \ETEX.
\stopitem
\startitem
@@ -144,13 +145,13 @@ The front- and backend are decoupled as much as possible.
\startitem
The (experimental) support for snap nodes has been removed, because it is
much more natural to build this functionality on top of node processing and
- attributes. The associated primitives that are now gone are: \type
+ attributes. The associated primitives that are gone are: \type
{\pdfsnaprefpoint}, \type {\pdfsnapy}, and \type {\pdfsnapycomp}.
\stopitem
\startitem
The (experimental) support for specialized spacing around nodes has also been
- removed. The associated primitives that are now gone are: \type
+ removed. The associated primitives that are gone are: \type
{\pdfadjustinterwordglue}, \type {\pdfprependkern}, and \type
{\pdfappendkern}, as well as the five supporting primitives \type
{\knbscode}, \type {\stbscode}, \type {\shbscode}, \type {\knbccode}, and
@@ -159,17 +160,13 @@ The front- and backend are decoupled as much as possible.
\startitem
A number of \quote {\PDFTEX\ primitives} have been removed as they can be
- implemented using \LUA:
-
- \start \raggedright
- \type {\pdfelapsedtime}, \type {\pdfescapehex}, \type {\pdfescapename}, \type
- {\pdfescapestring}, \type {\pdffiledump}, \type {\pdffilemoddate}, \type
- {\pdffilesize}, \type {\pdfforcepagebox}, \type {\pdflastmatch}, \type
- {\pdfmatch}, \type {\pdfmdfivesum}, \type {\pdfmovechars}, \type
- {\pdfoptionalwaysusepdfpagebox}, \type {\pdfoptionpdfinclusionerrorlevel},
- \type {\pdfresettimer}, \type {\pdfshellescape}, \type {\pdfstrcmp} and \type
- {\pdfunescapehex}
- \par \stop
+ implemented using \LUA: \type {\pdfelapsedtime}, \type {\pdfescapehex}, \type
+ {\pdfescapename}, \type {\pdfescapestring}, \type {\pdffiledump}, \type
+ {\pdffilemoddate}, \type {\pdffilesize}, \type {\pdfforcepagebox}, \type
+ {\pdflastmatch}, \type {\pdfmatch}, \type {\pdfmdfivesum}, \type
+ {\pdfmovechars}, \type {\pdfoptionalwaysusepdfpagebox}, \type
+ {\pdfoptionpdfinclusionerrorlevel}, \type {\pdfresettimer}, \type
+ {\pdfshellescape}, \type {\pdfstrcmp} and \type {\pdfunescapehex}
\stopitem
\startitem
@@ -180,13 +177,8 @@ The front- and backend are decoupled as much as possible.
\startitem
The experimental snapper mechanism has been removed and therefore also the
- primitives:
-
- \start \raggedright
- \type {\pdfignoreddimen}, \type {\pdffirstlineheight}, \type
- {\pdfeachlineheight}, \type {\pdfeachlinedepth} and \type
- {\pdflastlinedepth}
- \par \stop
+ primitives \type {\pdfignoreddimen}, \type {\pdffirstlineheight}, \type
+ {\pdfeachlineheight}, \type {\pdfeachlinedepth} and \type {\pdflastlinedepth}
\stopitem
\startitem
@@ -196,9 +188,9 @@ The front- and backend are decoupled as much as possible.
\stopitem
\startitem
- The \PNG\ transparency fix from 1.40.6 is not applied as high|-|level support
- is pending. Because \LUATEX\ has a different subsystem for managing images,
- more diversion from its ancestor happened in the meantime.
+ Because \LUATEX\ has a different subsystem for managing images, more
+ diversion from its ancestor happened in the meantime. We don't adapt to
+ changes in \PDFTEX.
\stopitem
\startitem
@@ -289,7 +281,7 @@ The front- and backend are decoupled as much as possible.
\stopitem
\startitem
- The pixel multiplier dimension \type {\pdfpxdimen} lots its prefix and is now calles
+ The pixel multiplier dimension \type {\pdfpxdimen} lost its prefix and is now calles
\type {\pxdimen}.
\stopitem
@@ -308,6 +300,10 @@ The front- and backend are decoupled as much as possible.
\stopitem
\startitem
+ There is some more control over what metadata goes into the \PDF\ file.
+\stopitem
+
+\startitem
The promotion of primitives to core primitives as well as the separation of
font- and backend means that the initialization namespace \type {pdftex} is
gone.
@@ -318,8 +314,8 @@ The front- and backend are decoupled as much as possible.
One change involves the so called xforms and ximages. In \PDFTEX\ these are
implemented as so called whatsits. But contrary to other whatsits they have
dimensions that need to be taken into account when for instance calculating
-optimal line breaks. In \LUATEX\ these are now promoted to normal nodes, which
-simplifies code that needs those dimensions.
+optimal line breaks. In \LUATEX\ these are now promoted to a special type of rule
+nodes, which simplifies code that needs those dimensions.
Another reason for promotion is that these are useful concepts. Backends can
provide the ability to use content that has been rendered in several places,
@@ -344,7 +340,7 @@ related) as before, you should not depend on that.
The protrusion detection mechanism is enhanced a bit to enable a bit more complex
situations. When protrusion characters are identified some nodes are skipped:
-\startitemize[packed]
+\startitemize[packed,columns,two]
\startitem zero glue \stopitem
\startitem penalties \stopitem
\startitem empty discretionaries \stopitem
@@ -387,14 +383,11 @@ we say next applies to both these programs.
\startitem
The \OCP\ processing has been removed completely and as a consequence, the
- following primitives have been removed:
-
- \start \raggedright
- \type {\ocp}, \type {\externalocp}, \type {\ocplist}, \type {\pushocplist},
- \type {\popocplist}, \type {\clearocplists}, \type {\addbeforeocplist}, \type
- {\addafterocplist}, \type {\removebeforeocplist}, \type {\removeafterocplist}
- and \type {\ocptracelevel}
- \par \stop
+ following primitives have been removed: \type {\ocp}, \type {\externalocp},
+ \type {\ocplist}, \type {\pushocplist}, \type {\popocplist}, \type
+ {\clearocplists}, \type {\addbeforeocplist}, \type {\addafterocplist}, \type
+ {\removebeforeocplist}, \type {\removeafterocplist} and \type
+ {\ocptracelevel}.
\stopitem
\startitem
@@ -405,17 +398,14 @@ we say next applies to both these programs.
\startitem
The input translations from \ALEPH\ are not implemented, the related
- primitives are not available:
-
- \start \raggedright
- \type {\DefaultInputMode}, \type {\noDefaultInputMode}, \type {\noInputMode},
- \type {\InputMode}, \type {\DefaultOutputMode}, \type {\noDefaultOutputMode},
- \type {\noOutputMode}, \type {\OutputMode}, \type {\DefaultInputTranslation},
- \type {\noDefaultInputTranslation}, \type {\noInputTranslation}, \type
+ primitives are not available: \type {\DefaultInputMode}, \type
+ {\noDefaultInputMode}, \type {\noInputMode}, \type {\InputMode}, \type
+ {\DefaultOutputMode}, \type {\noDefaultOutputMode}, \type {\noOutputMode},
+ \type {\OutputMode}, \type {\DefaultInputTranslation}, \type
+ {\noDefaultInputTranslation}, \type {\noInputTranslation}, \type
{\InputTranslation}, \type {\DefaultOutputTranslation}, \type
{\noDefaultOutputTranslation}, \type {\noOutputTranslation} and \type
- {\OutputTranslation}
- \par \stop
+ {\OutputTranslation}.
\stopitem
\startitem
@@ -473,13 +463,16 @@ we say next applies to both these programs.
\startitem
The promotion of primitives to core primitives as well as the removed of all
- others means that the initialization namespace \type {aleph} is gone.
+ others means that the initialization namespace \type {aleph} that early
+ versions of \LUATEX\ provided is gone.
\stopitem
\stopitemize
The above let's itself summarize as: we took the 32 bit aspects and much of the
-directional mechanisms.
+directional mechanisms and merged it into the \PDFTEX\ code base as starting
+point for further development. Then we simplified directionality, fixed it and
+opened it up.
\stopsubsection
@@ -515,7 +508,8 @@ different:
mode because \type {texmf.cnf} is not read: \type {shell-escape} is off (but
that is not a problem because of \LUA's \type {os.execute}), and the paranoia
checks on \type {openin} and \type {openout} do not happen. However, it is
- easy for a \LUA\ script to do this itself by overloading \type {io.open}.
+ easy for a \LUA\ script to do this itself by overloading \type {io.open} and
+ alike.
\stopitem
\startitem
@@ -535,10 +529,10 @@ others promoted to core \LUATEX\ primitives. That is only part of the story. In
order to separate the backend specific primitives in de code these commands are
now replaced by only a few. In traditional \TEX\ we only had the \DVI\ backend
but now we have two: \DVI\ and \PDF. Additional functionality is implemented as
-\quote {extensions} in \TEX speak. By separating more strickly we are able to
-keep the core (fontend) clean and stable. If for some reason an extra backend
-option is needed, it can be implemented without touching the core. The three
-\PDF\ backend related primitives are
+\quote {extensions} in \TEX\ speak. By separating more strickly we are able to
+keep the core (fontend) clean and stable and isolate these extensions. If for
+some reason an extra backend option is needed, it can be implemented without
+touching the core. The three \PDF\ backend related primitives are:
\starttyping
\pdfextension command [specification]
@@ -1068,22 +1062,15 @@ by setting \type {\breakafterdirmode} to~\type {1}. The following table shows th
difference. Watch your spaces.
\def\ShowSome#1{%
- \BC
- \type{#1}
- \NC
- \breakafterdirmode = 0
- \hsize 0pt
- #1
+ \BC \type{#1}
+ \NC \breakafterdirmode\zerocount\hsize\zeropoint#1
\NC
- \NC
- \breakafterdirmode = 1
- \hsize 0pt
- #1
+ \NC \breakafterdirmode\plusone\hsize\zeropoint#1
\NC
\NC \NR \HL
}
-\starttabulate[|l|Tp(0pt)|w(5em)|Tp(0pt)|p|]
+\starttabulate[|lp(10em)|Tp(1pt)|w(5em)|Tp(1pt)|w(5em)|]
\HL
\BC \type{\breakafterdirmode}
\BC \type{0}
@@ -1115,9 +1102,7 @@ by \type {\hangindent} and \type {\parshape}. This is controlled by a new parame
The value is reset to zero (like \type {\hangindent} and \type {\parshape})
after the paragraph is done with. You can use negative values to prevent
-this.
-
-In \in {figure} [fig:shapemode] a few examples are given.
+this. In \in {figure} [fig:shapemode] a few examples are given.
\startplacefigure[reference=fig:shapemode,title={The effect of \type {shapemode}.}]
\startcombination[2*3]
@@ -1189,7 +1174,7 @@ structures, some of the macros have been duplicated. For instance, there are now
{token_info}. All access to the variable memory array is now hidden behind a
macro called \type {vmem}. We mention this because using the \TEX book as
reference is still quite valid but not for memory related details. Another
-significate detail is that we have double linked node lists and that some nodes
+significate detail is that we have double linked node lists and that most nodes
carry more data.
The implementation of the growth of two arrays (via reallocation) introduces a
@@ -1209,17 +1194,21 @@ The \type {\mathcode}, \type {\delcode}, \type {\catcode}, \type {\sfcode}, \typ
{\lccode} and \type {\uccode} (and the new \type {\hjcode}) tables are now sparse
arrays that are implemented in~\CCODE. They are no longer part of the \TEX\
\quote {equivalence table} and because each had 1.1 million entries with a few
-memory words each, this makes a major difference in memory usage.
+memory words each, this makes a major difference in memory usage. Performance is
+not really hurt by this.
The \type {\catcode}, \type {\sfcode}, \type {\lccode}, \type {\uccode} and \type
-{\hjcode} assignments do not yet show up when using the \ETEX\ tracing routines
-\type {\tracingassigns} and \type {\tracingrestores}.
+{\hjcode} assignments don't show up when using the \ETEX\ tracing routines \type
+{\tracingassigns} and \type {\tracingrestores} but we don't see that as a real
+limitation.
A side|-|effect of the current implementation is that \type {\global} is now more
-expensive in terms of processing than non|-|global assignments.
+expensive in terms of processing than non|-|global assignments but not many users
+will notice that.
The glyph ids within a font are also managed by means of a sparse array as glyph
-ids can go up to index $2^{21}-1$.
+ids can go up to index $2^{21}-1$ but these are never accessed directly so again
+users will not notice this.
\stopsubsection
@@ -1273,7 +1262,7 @@ to be kept. We are aware of the fact that this contradicts some of our other
choices but consistency with other engines and the fact that in \KPSE\ mode a
common file \IO\ layer is used can have a side effect of breaking compatibility.
We still stick to our view that at the log level we can (and might be) more
-incompatible.
+incompatible. We already expose some more details.
\stopsubsection
diff --git a/doc/context/sources/general/manuals/luatex/luatex-style.tex b/doc/context/sources/general/manuals/luatex/luatex-style.tex
index a277a1178..3ea3bb9cd 100644
--- a/doc/context/sources/general/manuals/luatex/luatex-style.tex
+++ b/doc/context/sources/general/manuals/luatex/luatex-style.tex
@@ -207,7 +207,7 @@
fill fullcircle scaled r shifted (d-1/8,d-1/8)
withcolor luaholecolor ;
luaorbitfactor := .25 ;
- ) enddef ;
+ ) enddef ;
\stopMPdefinitions
@@ -217,8 +217,15 @@
fill Page withcolor \MPcolor{othercolor} ;
luaorbitfactor := 1 ;
- picture p ; p := lualogo xsized (3PaperWidth/5) ;
- draw p shifted center Page shifted (0,-.85ypart center ulcorner p) ;
+
+ picture p ; p := lualogo ysized (5*\measure{paperheight}/10) ;
+ draw p
+ shifted - center p
+ shifted (
+ \measure{spreadwidth} - .5*\measure{paperwidth} + \measure{spinewidth},
+ .375*\measure{paperheight}
+ )
+ ;
StopPage ;
\stopuseMPgraphic
@@ -252,40 +259,42 @@
[rightpage]
[background=page]
+\definemeasure[banneroffset][\bottomspace-\footerheight-\footerdistance+2cm]
+
\startsetups pagenumber:right
\setlayerframed
[page]
- [preset=rightbottom,offset=1cm]
+ [preset=rightbottom,x=1.0cm,y=\measure{banneroffset}]
[frame=off,height=1cm,offset=overlay]
- {\useMPgraphic{luanumber}}
+ {\strut\useMPgraphic{luanumber}}
\setlayerframed
[page]
- [preset=rightbottom,offset=1cm,x=1.5cm]
+ [preset=rightbottom,x=2.5cm,y=\measure{banneroffset}]
[frame=off,height=1cm,width=1cm,offset=overlay]
- {\pagenumber}
+ {\strut\pagenumber}
\setlayerframed
[page]
- [preset=rightbottom,offset=1cm,x=2.5cm]
+ [preset=rightbottom,x=3.5cm,y=\measure{banneroffset}]
[frame=off,height=1cm,offset=overlay]
- {\getmarking[chapter]}
+ {\strut\getmarking[chapter]}
\stopsetups
\startsetups pagenumber:left
\setlayerframed
[page]
- [preset=leftbottom,offset=1cm,x=2.5cm]
+ [preset=leftbottom,x=3.5cm,y=\measure{banneroffset}]
[frame=off,height=1cm,offset=overlay]
- {\getmarking[chapter]}
+ {\strut\getmarking[chapter]}
\setlayerframed
[page]
- [preset=leftbottom,offset=1cm,x=1.5cm]
+ [preset=leftbottom,x=2.5cm,y=\measure{banneroffset}]
[frame=off,height=1cm,width=1cm,offset=overlay]
- {\pagenumber}
+ {\strut\pagenumber}
\setlayerframed
[page]
- [preset=leftbottom,offset=1cm]
+ [preset=leftbottom,x=1.0cm,y=\measure{banneroffset}]
[frame=off,height=1cm,offset=overlay]
- {\useMPgraphic{luanumber}}
+ {\strut\useMPgraphic{luanumber}}
\stopsetups
\unexpanded\def\nonterminal#1>{\mathematics{\langle\hbox{\rm #1}\rangle}}
@@ -373,4 +382,11 @@
% \setupinteractionscreen
% [option=bookmark]
+\normalexpanded{\definemeasure[spinewidth] [0pt]}
+\normalexpanded{\definemeasure[paperwidth] [\the\paperwidth ]}
+\normalexpanded{\definemeasure[paperheight][\the\paperheight]}
+\normalexpanded{\definemeasure[spreadwidth][\measure{paperwidth}]}
+
+\dontcomplain
+
\stopenvironment
diff --git a/doc/context/sources/general/manuals/luatex/luatex-titlepage.tex b/doc/context/sources/general/manuals/luatex/luatex-titlepage.tex
index 307741ee1..ba979e5a8 100644
--- a/doc/context/sources/general/manuals/luatex/luatex-titlepage.tex
+++ b/doc/context/sources/general/manuals/luatex/luatex-titlepage.tex
@@ -8,7 +8,7 @@
\switchtobodyfont
[mainfacemedium]
- \definedfont[Bold*default at \the\dimexpr.08\paperheight\relax] \setupinterlinespace
+ \definedfont[Bold*default at \the\dimexpr.06\paperheight\relax] \setupinterlinespace
\setlayer
[page]
@@ -16,55 +16,39 @@
\setlayerframed
[page]
- [preset=middletop,
- voffset=.05\paperheight]
+ [preset=righttop,
+ location=middletop,
+ hoffset=.500\measured{paperwidth},
+ voffset=.175\measured{paperheight}]
[align=middle,
- foregroundcolor=blue,
+ foregroundcolor=white,
frame=off]
- {Lua\TeX\\Reference Manual}
+ {Lua\TeX\crlf Reference\crlf Manual}
- \definedfont[Bold*default at 18pt] \setupinterlinespace
+ \definedfont[Bold*default at 14pt] \setupinterlinespace
\setlayerframed
[page]
[preset=rightbottom,
- offset=.01\paperheight]
+ offset=.025\measured{paperheight}]
[align=flushright,
- foregroundcolor=blue,
+ foregroundcolor=white,
frame=off]
{\doifsomething{\documentvariable{status}}{\documentvariable{status}\par}
\currentdate[month,space,year]\par
Version \documentvariable{version}}
-\stopstandardmakeup
-
-\startstandardmakeup
-
- \start
- \raggedleft
- \definedfont[Bold*default at 48pt]
- \setupinterlinespace
- \blue Lua\TeX \endgraf Reference \endgraf Manual \endgraf
- \stop
-
- \vfill
-
- \definedfont[Bold*default at 12pt]
-
- \starttabulate[|l|l|]
- \NC copyright \EQ Lua\TeX\ development team \NC \NR
- \NC more info \EQ www.luatex.org \NC \NR
- \NC version \EQ \currentdate \doifsomething{\documentvariable{snapshot}}{(snapshot \documentvariable{snapshot})} \NC \NR
- \stoptabulate
+ \setlayerframed
+ [page]
+ [preset=middle,
+ hoffset=-.5\dimexpr\measured{paperwidth}-\measured{spinewidth}\relax]
+ [width=.7\measured{paperwidth},
+ align=normal,
+ foregroundstyle=\bf,
+ foregroundcolor=white,
+ frame=off]
+ {\getbuffer[backpage]}
\stopstandardmakeup
-\setupbackgrounds
- [leftpage]
- [setups=pagenumber:left]
-
-\setupbackgrounds
- [rightpage]
- [setups=pagenumber:right]
-
\stopcomponent
diff --git a/doc/context/sources/general/manuals/luatex/luatex.tex b/doc/context/sources/general/manuals/luatex/luatex.tex
index 3025788bf..dbd307d07 100644
--- a/doc/context/sources/general/manuals/luatex/luatex.tex
+++ b/doc/context/sources/general/manuals/luatex/luatex.tex
@@ -22,10 +22,6 @@
% comment : Some (parts of) chapters might have been published in TugBoat, the NTG Maps, the
% ConTeXt Group journal or otherwise. Thanks to the editors for corrections. Also
% thanks to users for testing, feedback and corrections.
-%
-% 238 pages : 2017-07-06
-% luatex 9.5 sec / luajittex 7.0 sec
-% Dell 7600 / i7 3840QM / passmark 1.922 / Windows 10 64 bit
% \tex vs \type vs \syntax vs. \luatex
% \em \it \/
@@ -38,8 +34,11 @@
% \setupsynctex[state=start,method=max] % adds 5 pct overhead
\environment luatex-style
+% \environment luatex-book
\environment luatex-logos
+% \switchtobodyfont[small]
+
\startmode[export]
\setupbackend
@@ -47,14 +46,13 @@
\stopmode
-\dontcomplain
-
\startdocument
[status=experimental,
version=1.08.0]
\startnotmode[*export]
\component luatex-titlepage
+ \component luatex-firstpage
\stopnotmode
\startmode[*export]