summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/luatex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-10-29 16:50:11 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-10-29 16:50:11 +0100
commit7fc4b935d045c84e89459e726ff54ae331e4c574 (patch)
tree0a4587b2e4f72ccb5feff81c348c5138f4ece7e7 /doc/context/sources/general/manuals/luatex
parentd91c37679b13162a4ead85abbe564090b2e1b51c (diff)
downloadcontext-7fc4b935d045c84e89459e726ff54ae331e4c574.tar.gz
2017-10-29 15:50:00
Diffstat (limited to 'doc/context/sources/general/manuals/luatex')
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-lua.tex32
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-math.tex53
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-style.tex6
3 files changed, 82 insertions, 9 deletions
diff --git a/doc/context/sources/general/manuals/luatex/luatex-lua.tex b/doc/context/sources/general/manuals/luatex/luatex-lua.tex
index 3d7e14700..d95415b05 100644
--- a/doc/context/sources/general/manuals/luatex/luatex-lua.tex
+++ b/doc/context/sources/general/manuals/luatex/luatex-lua.tex
@@ -303,17 +303,17 @@ piecemeal:
\type {string.utfcharacters(s)}: a string with a single \UTF-8 token in it
\stopitem
\startitem
- \type {string.characters(s)} \NC a string containing one byte
+ \type {string.characters(s)}: a string containing one byte
\stopitem
\startitem
- \type {string.characterpairs(s)} two strings each containing one byte or an
+ \type {string.characterpairs(s)}: two strings each containing one byte or an
empty second string if the string length was odd
\stopitem
\startitem
- \type {string.bytes(s)} a single byte value
+ \type {string.bytes(s)}: a single byte value
\stopitem
\startitem
- \type {string.bytepairs(s)} two byte values or nil instead of a number as
+ \type {string.bytepairs(s)}: two byte values or nil instead of a number as
its second return value if the string length was odd
\stopitem
\stopitemize
@@ -335,8 +335,28 @@ always returns byte positions in a string, and \type {unicode.utf8.match} and
are} \UNICODE|-|aware, they fall|-|back to non|-|\UNICODE|-|aware behavior when
using the empty capture \type {()} but other captures work as expected. For the
interpretation of character classes in \type {unicode.utf8} functions refer to
-the library sources at \hyphenatedurl {http://luaforge.net/projects/sln}. Version
-5.3 of \LUA\ will provide some native \UTF8 support.
+the library sources at \hyphenatedurl {http://luaforge.net/projects/sln}.
+
+Version 5.3 of \LUA\ provides some native \UTF8 support but we have added a few
+similar helpers too:
+
+\startitemize
+\startitem
+ \type {string.utfvalue(s)}: returns the codepoints of the characters in the
+ given string
+\stopitem
+\startitem
+ \type {string.utfcharacter(c,...)}: returns a string with the characters of
+ the given code points
+\stopitem
+\startitem
+ \type {string.utflength(s)}: returns the length oif the given string
+\stopitem
+\stopitemize
+
+These three functions are relative fast and don't do much checking. They can be used
+as building blocks for other helpers.
+
\blank
diff --git a/doc/context/sources/general/manuals/luatex/luatex-math.tex b/doc/context/sources/general/manuals/luatex/luatex-math.tex
index 9fb0c02ab..cf5489641 100644
--- a/doc/context/sources/general/manuals/luatex/luatex-math.tex
+++ b/doc/context/sources/general/manuals/luatex/luatex-math.tex
@@ -631,7 +631,7 @@ example.
\stoptexdefinition
\start
- \setupbodyfont[cambria]
+ \switchtobodyfont[cambria]
\starttabulate[|c|c|c|c|c|c|]
\Whatever{0}%
\Whatever{1}%
@@ -641,6 +641,55 @@ 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}
+
+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
+a good change that the kerning doesn't come out well when used in a script. Given
+that the first glyph ends up in an \type {\hbox} we have some control over this.
+And, as a bonus we also added control over the normal sublist kerning. The \type
+{\mathscriptboxmode} parameter defaults to~1.
+
+\starttabulate[|l|l|]
+\NC \type {0} \NC forget about kerning \NC \NR
+\NC \type {1} \NC kern math sub lists with a valid glyph \NC \NR
+\NC \type {2} \NC also kern math sub boxes that have a valid glyph \NC \NR
+\NC \type {2} \NC only kern math sub boxes with a boundary node present\NC \NR
+\stoptabulate
+
+Here we show some examples. Of course this doesn't solve all our problems, if
+only because some fonts have characters with bounding boxes that compensate for
+italics, while other fonts can lack kerns.
+
+\startbuffer[1]
+ $T_{\tf fluff}$
+\stopbuffer
+
+\startbuffer[2]
+ $T_{\text{fluff}}$
+\stopbuffer
+
+\startbuffer[3]
+ $T_{\text{\boundary1 fluff}}$
+\stopbuffer
+
+\unexpanded\def\Show#1#2#3%
+ {\doifelsenothing{#3}
+ {\small\typeinlinebuffer[#1]}
+ {\doifelse{#3}{-}
+ {\small\type{mode #2}}
+ {\switchtobodyfont[#3]\showfontkerns\showglyphs\mathscriptboxmode#2\relax\inlinebuffer[#1]}}}
+
+\starttabulate[|lT|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
+ \NC lucidaot \NC \Show{1}{0}{lucidaot} \NC\Show{1}{1}{lucidaot} \NC \Show{2}{1}{lucidaot} \NC \Show{2}{2}{lucidaot} \NC \Show{3}{3}{lucidaot} \NC \NR
+ \NC pagella \NC \Show{1}{0}{pagella} \NC\Show{1}{1}{pagella} \NC \Show{2}{1}{pagella} \NC \Show{2}{2}{pagella} \NC \Show{3}{3}{pagella} \NC \NR
+ \NC cambria \NC \Show{1}{0}{cambria} \NC\Show{1}{1}{cambria} \NC \Show{2}{1}{cambria} \NC \Show{2}{2}{cambria} \NC \Show{3}{3}{cambria} \NC \NR
+ \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
+
\section{Unscaled fences}
The \type {\mathdelimitersmode} primitive is experimental and deals with the
@@ -659,7 +708,7 @@ so that the same spacing applies as with unfenced variants. Here we show Cambria
\stoptexdefinition
\start
- \setupbodyfont[cambria]
+ \switchtobodyfont[cambria]
\starttabulate[|l|l|l|]
\Whatever{0}\Whatever{1}\Whatever{2}\Whatever{3}%
\Whatever{4}\Whatever{5}\Whatever{6}\Whatever{7}%
diff --git a/doc/context/sources/general/manuals/luatex/luatex-style.tex b/doc/context/sources/general/manuals/luatex/luatex-style.tex
index 547fd204a..a277a1178 100644
--- a/doc/context/sources/general/manuals/luatex/luatex-style.tex
+++ b/doc/context/sources/general/manuals/luatex/luatex-style.tex
@@ -89,7 +89,11 @@
\definecolor[keptcolor] [b=.5]
\definecolor[othercolor][r=.5,g=.5]
-\setupbodyfont[modern] % we need this in examples so we predefine
+\usebodyfont[lucidaot]
+\usebodyfont[pagella]
+\usebodyfont[cambria]
+%usebodyfont[dejavu]
+\usebodyfont[modern] % we need this in examples so we predefine
% \doifmodeelse {atpragma} {
%