From e4473c5bfc835fe69b7e85c1deef4aacce63a291 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 14 Aug 2020 09:36:25 +0200 Subject: 2020-08-13 19:45:00 --- .../sources/general/magazines/mag-1105-mkiv.tex | 6 +- .../sources/general/manuals/evenmore/evenmore.tex | 2 + .../manuals/luametatex/luametatex-enhancements.tex | 196 +++++++++++---------- .../manuals/luametatex/luametatex-languages.tex | 109 +++--------- 4 files changed, 123 insertions(+), 190 deletions(-) (limited to 'doc') diff --git a/doc/context/sources/general/magazines/mag-1105-mkiv.tex b/doc/context/sources/general/magazines/mag-1105-mkiv.tex index f5aaa6eb3..b068f517b 100644 --- a/doc/context/sources/general/magazines/mag-1105-mkiv.tex +++ b/doc/context/sources/general/magazines/mag-1105-mkiv.tex @@ -11,8 +11,7 @@ % the manuals contain characteristic graphics and personal notes or examples that % make no sense when used out-of-context. -\ifdefined\parindentmode \parindentmode \plusone \fi % this will become default in lmtx -\ifdefined\normalizelinemode \normalizelinemode\plusone \fi % this will become default in lmtx +\bitwiseflip \normalizelinemode \plusthree \usemodule[magazine-basic,abr-02] @@ -42,8 +41,7 @@ do. For that we have a an interface to the lines on such a box. We start with a few settings: \starttyping[option=TEX] -\parindentmode \plusone -\normalizelinemode\plusone +\bitwiseflip \normalizelinemode \plusthree % indent and normalize \stoptyping These two settings will become default in \CONTEXT\ \LMTX, but here we need them in diff --git a/doc/context/sources/general/manuals/evenmore/evenmore.tex b/doc/context/sources/general/manuals/evenmore/evenmore.tex index c38e76f20..9f67f13f0 100644 --- a/doc/context/sources/general/manuals/evenmore/evenmore.tex +++ b/doc/context/sources/general/manuals/evenmore/evenmore.tex @@ -26,6 +26,8 @@ \component evenmore-tokens \component evenmore-keywords % \component evenmore-paragraphs + % \component evenmore-hyphenation + % \component evenmore-bitwise \stopbodymatter \stopdocument diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex b/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex index 687e6e8b5..03dfc1bad 100644 --- a/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex +++ b/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex @@ -1728,106 +1728,108 @@ convenience extra which could also have been implemented using node list parsing \stopsubsection -\startsubsection[title={Controlling glue with \lpr {breakafterdirmode}}] - -Glue after a dir node is ignored in the linebreak decision but you can bypass that -by setting \lpr {breakafterdirmode} to~\type {1}. The following table shows the -difference. Watch your spaces. - -\def\ShowSome#1{% - \BC \type{#1} - \NC \breakafterdirmode\zerocount\hsize\zeropoint#1 - \NC - \NC \breakafterdirmode\plusone\hsize\zeropoint#1 - \NC - \NC \NR -} - -\starttabulate[|l|Tp(1pt)|w(5em)|Tp(1pt)|w(5em)|] - \DB - \BC \type{0} - \NC - \BC \type{1} - \NC - \NC \NR - \TB - \ShowSome{pre {\textdirection 0 xxx} post} - \ShowSome{pre {\textdirection 0 xxx }post} - \ShowSome{pre{ \textdirection 0 xxx} post} - \ShowSome{pre{ \textdirection 0 xxx }post} - \ShowSome{pre { \textdirection 0 xxx } post} - \ShowSome{pre {\textdirection 0\relax\space xxx} post} - \LL -\stoptabulate - -\stopsubsection +\startsubsection[title={Normalizing lines}] -\startsubsection[title={Controlling parshapes with \lpr {shapemode}}] +{\em Experimental!} -Another adaptation to the \ALEPH\ directional model is control over shapes driven -by \prm {hangindent} and \prm {parshape}. This is controlled by a new parameter -\lpr {shapemode}: - -\starttabulate[|c|l|l|] -\DB value \BC \prm {hangindent} \BC \prm {parshape} \NC \NR -\TB -\BC \type{0} \NC normal \NC normal \NC \NR -\BC \type{1} \NC mirrored \NC normal \NC \NR -\BC \type{2} \NC normal \NC mirrored \NC \NR -\BC \type{3} \NC mirrored \NC mirrored \NC \NR -\LL -\stoptabulate +% Swapping shapes +% +% Another adaptation to the \ALEPH\ directional model is control over shapes driven +% by \prm {hangindent} and \prm {parshape}. This is controlled by a new parameter +% \lpr {shapemode}: +% +% \starttabulate[|c|l|l|] +% \DB value \BC \prm {hangindent} \BC \prm {parshape} \NC \NR +% \TB +% \BC \type{0} \NC normal \NC normal \NC \NR +% \BC \type{1} \NC mirrored \NC normal \NC \NR +% \BC \type{2} \NC normal \NC mirrored \NC \NR +% \BC \type{3} \NC mirrored \NC mirrored \NC \NR +% \LL +% \stoptabulate +% +% The value is reset to zero (like \prm {hangindent} and \prm {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. +% +% \startplacefigure[reference=fig:shapemode,title={The effect of \type {shapemode}.}] +% \startcombination[2*3] +% {\ruledvbox \bgroup \setuptolerance[verytolerant] +% \hsize .45\textwidth \switchtobodyfont[6pt] +% \pardirection 0 \textdirection 0 +% \hangindent 40pt \hangafter -3 +% \leftskip10pt \input tufte \par +% \egroup} {TLT: hangindent} +% {\ruledvbox \bgroup \setuptolerance[verytolerant] +% \hsize .45\textwidth \switchtobodyfont[6pt] +% \pardirection 0 \textdirection 0 +% \parshape 4 0pt .8\hsize 10pt .8\hsize 20pt .8\hsize 0pt \hsize +% \input tufte \par +% \egroup} {TLT: parshape} +% {\ruledvbox \bgroup \setuptolerance[verytolerant] +% \hsize .45\textwidth \switchtobodyfont[6pt] +% \pardirection 1 \textdirection 1 +% \hangindent 40pt \hangafter -3 +% \leftskip10pt \input tufte \par +% \egroup} {TRT: hangindent mode 0} +% {\ruledvbox \bgroup \setuptolerance[verytolerant] +% \hsize .45\textwidth \switchtobodyfont[6pt] +% \pardirection 1 \textdirection 1 +% \parshape 4 0pt .8\hsize 10pt .8\hsize 20pt .8\hsize 0pt \hsize +% \input tufte \par +% \egroup} {TRT: parshape mode 0} +% {\ruledvbox \bgroup \setuptolerance[verytolerant] +% \hsize .45\textwidth \switchtobodyfont[6pt] +% \shapemode=3 +% \pardirection 1 \textdirection 1 +% \hangindent 40pt \hangafter -3 +% \leftskip10pt \input tufte \par +% \egroup} {TRT: hangindent mode 1 & 3} +% {\ruledvbox \bgroup \setuptolerance[verytolerant] +% \hsize .45\textwidth \switchtobodyfont[6pt] +% \shapemode=3 +% \pardirection 1 \textdirection 1 +% \parshape 4 0pt .8\hsize 10pt .8\hsize 20pt .8\hsize 0pt \hsize +% \input tufte \par +% \egroup} {TRT: parshape mode 2 & 3} +% \stopcombination +% \stopplacefigure +% +% We have \type {\pardirection}, \type {\textdirection}, \type {\mathdirection} and +% \type {\linedirection} that is like \type {\textdirection} but with some +% additional (inline) glue checking. -The value is reset to zero (like \prm {hangindent} and \prm {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. - -\startplacefigure[reference=fig:shapemode,title={The effect of \type {shapemode}.}] - \startcombination[2*3] - {\ruledvbox \bgroup \setuptolerance[verytolerant] - \hsize .45\textwidth \switchtobodyfont[6pt] - \pardirection 0 \textdirection 0 - \hangindent 40pt \hangafter -3 - \leftskip10pt \input tufte \par - \egroup} {TLT: hangindent} - {\ruledvbox \bgroup \setuptolerance[verytolerant] - \hsize .45\textwidth \switchtobodyfont[6pt] - \pardirection 0 \textdirection 0 - \parshape 4 0pt .8\hsize 10pt .8\hsize 20pt .8\hsize 0pt \hsize - \input tufte \par - \egroup} {TLT: parshape} - {\ruledvbox \bgroup \setuptolerance[verytolerant] - \hsize .45\textwidth \switchtobodyfont[6pt] - \pardirection 1 \textdirection 1 - \hangindent 40pt \hangafter -3 - \leftskip10pt \input tufte \par - \egroup} {TRT: hangindent mode 0} - {\ruledvbox \bgroup \setuptolerance[verytolerant] - \hsize .45\textwidth \switchtobodyfont[6pt] - \pardirection 1 \textdirection 1 - \parshape 4 0pt .8\hsize 10pt .8\hsize 20pt .8\hsize 0pt \hsize - \input tufte \par - \egroup} {TRT: parshape mode 0} - {\ruledvbox \bgroup \setuptolerance[verytolerant] - \hsize .45\textwidth \switchtobodyfont[6pt] - \shapemode=3 - \pardirection 1 \textdirection 1 - \hangindent 40pt \hangafter -3 - \leftskip10pt \input tufte \par - \egroup} {TRT: hangindent mode 1 & 3} - {\ruledvbox \bgroup \setuptolerance[verytolerant] - \hsize .45\textwidth \switchtobodyfont[6pt] - \shapemode=3 - \pardirection 1 \textdirection 1 - \parshape 4 0pt .8\hsize 10pt .8\hsize 20pt .8\hsize 0pt \hsize - \input tufte \par - \egroup} {TRT: parshape mode 2 & 3} - \stopcombination -\stopplacefigure - -We have \type {\pardirection}, \type {\textdirection}, \type {\mathdirection} and -\type {\linedirection} that is like \type {\textdirection} but with some -additional (inline) glue checking. +% Controlling glue with \lpr {breakafterdirmode} +% +% Glue after a dir node is ignored in the linebreak decision but you can bypass that +% by setting \lpr {breakafterdirmode} to~\type {1}. The following table shows the +% difference. Watch your spaces. +% +% \def\ShowSome#1{% +% \BC \type{#1} +% \NC \breakafterdirmode\zerocount\hsize\zeropoint#1 +% \NC +% \NC \breakafterdirmode\plusone\hsize\zeropoint#1 +% \NC +% \NC \NR +% } +% +% \starttabulate[|l|Tp(1pt)|w(5em)|Tp(1pt)|w(5em)|] +% \DB +% \BC \type{0} +% \NC +% \BC \type{1} +% \NC +% \NC \NR +% \TB +% \ShowSome{pre {\textdirection 0 xxx} post} +% \ShowSome{pre {\textdirection 0 xxx }post} +% \ShowSome{pre{ \textdirection 0 xxx} post} +% \ShowSome{pre{ \textdirection 0 xxx }post} +% \ShowSome{pre { \textdirection 0 xxx } post} +% \ShowSome{pre {\textdirection 0\relax\space xxx} post} +% \LL +% \stoptabulate \stopsubsection diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex b/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex index 78d739851..0a3ecd6bf 100644 --- a/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex +++ b/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex @@ -305,82 +305,28 @@ min values to 1 and make sure that the words hyphenate at each character. \stopcombination \stopplacefigure -% (Future versions of \LUATEX\ might provide more granularity.) - In traditional \TEX\ ligature building and hyphenation are interwoven with the line break mechanism. In \LUATEX\ these phases are isolated. As a consequence we deal differently with (a sequence of) explicit hyphens. We already have added some control over aspects of the hyphenation and yet another one concerns automatic hyphens (e.g.\ \type {-} characters in the input). -When \lpr {automatichyphenmode} has a value of 0, a hyphen will be turned into -an automatic discretionary. The snippets before and after it will not be -hyphenated. A side effect is that a leading hyphen can lead to a split but one -will seldom run into that situation. Setting a pre and post character makes this -more prominent. A value of 1 will prevent this side effect and a value of 2 will -not turn the hyphen into a discretionary. Experiments with other options, like -permitting hyphenation of the words on both sides were discarded. - -\startbuffer[a] -before-after \par -before--after \par -before---after \par -\stopbuffer - -\startbuffer[b] --before \par -after- \par ---before \par -after-- \par ----before \par -after--- \par -\stopbuffer - -\startbuffer[c] -before-after \par -before--after \par -before---after \par -\stopbuffer - -\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} - {\framed[align=normal,strut=no,top=\vskip.5ex,bottom=\vskip.5ex]{\automatichyphenmode\zerocount \hsize2pt \getbuffer[a]}} {A~0~2pt} - {\framed[align=normal,strut=no,top=\vskip.5ex,bottom=\vskip.5ex]{\automatichyphenmode\plusone \hsize2pt \getbuffer[a]}} {A~1~2pt} - {\framed[align=normal,strut=no,top=\vskip.5ex,bottom=\vskip.5ex]{\automatichyphenmode\plustwo \hsize2pt \getbuffer[a]}} {A~2~2pt} - {\framed[align=normal,strut=no,top=\vskip.5ex,bottom=\vskip.5ex]{\automatichyphenmode\zerocount \hsize6em \getbuffer[b]}} {B~0~6em} - {\framed[align=normal,strut=no,top=\vskip.5ex,bottom=\vskip.5ex]{\automatichyphenmode\zerocount \hsize2pt \getbuffer[b]}} {B~0~2pt} - {\framed[align=normal,strut=no,top=\vskip.5ex,bottom=\vskip.5ex]{\automatichyphenmode\plusone \hsize2pt \getbuffer[b]}} {B~1~2pt} - {\framed[align=normal,strut=no,top=\vskip.5ex,bottom=\vskip.5ex]{\automatichyphenmode\plustwo \hsize2pt \getbuffer[b]}} {B~2~2pt} - {\framed[align=normal,strut=no,top=\vskip.5ex,bottom=\vskip.5ex]{\automatichyphenmode\zerocount \hsize6em \getbuffer[c]}} {C~0~6em} - {\framed[align=normal,strut=no,top=\vskip.5ex,bottom=\vskip.5ex]{\automatichyphenmode\zerocount \hsize2pt \getbuffer[c]}} {C~0~2pt} - {\framed[align=normal,strut=no,top=\vskip.5ex,bottom=\vskip.5ex]{\automatichyphenmode\plusone \hsize2pt \getbuffer[c]}} {C~1~2pt} - {\framed[align=normal,strut=no,top=\vskip.5ex,bottom=\vskip.5ex]{\automatichyphenmode\plustwo \hsize2pt \getbuffer[c]}} {C~2~2pt} -\stopcombination -\stopbuffer - -\startplacefigure[reference=automatichyphenmode:1,title={The automatic modes \type {0} (default), \type {1} and \type {2}, with a \prm {hsize} -of 6em and 2pt (which triggers a linebreak).}] - \dontcomplain \tt \getbuffer[demo] -\stopplacefigure - -\startplacefigure[reference=automatichyphenmode:2,title={The automatic modes \type {0} (default), \type {1} and \type {2}, with \lpr {preexhyphenchar} and \lpr {postexhyphenchar} set to characters \type {A} and \type {B}.}] - \postexhyphenchar`A\relax - \preexhyphenchar `B\relax - \dontcomplain \tt \getbuffer[demo] -\stopplacefigure - -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 \prm {-} -command has a more verbose primitive version in \lpr {explicitdiscretionary} -and the normally intercepted in the hyphenator character \type {-} (or whatever -is configured) is available as \lpr {automaticdiscretionary}. +Hyphenation and discretionary injection is driven by a mode parameter which is +a bitset made from the following values. + +\starttabulate[|||] +\NC \number \normalhyphenationmodecode \NC honour (normal) \prm{discretionary}'s \NC \NR +\NC \number \automatichyphenationmodecode \NC turn \type {-} into (automatic) discretionaries \NC \NR +\NC \number \explicithyphenationmodecode \NC turn \type {\-} into (explicit) discretionaries \NC \NR +\NC \number \syllablehyphenationmodecode \NC hyphenate (syllable) according to language \NC \NR +\NC \number \uppercasehyphenationmodecode \NC hyphenate uppercase characters too (replaces \prm {uchyph} \NC \NR +\NC \number \compoundhyphenationmodecode \NC permit break at an explicit hyphen (border cases) \NC \NR +\NC \number \strictstarthyphenationmodecode \NC traditional \TEX\ compatibility wrt the start of a word \NC \NR +\NC \number \strictendhyphenationmodecode \NC traditional \TEX\ compatibility wrt the end of a word \NC \NR +\NC \number \automaticpenaltyhyphenationmodecode \NC use \lpr {automatichyphenpenalty} \NC \NR +\NC \number \explicitpenaltyhyphenationmodecode \NC use \lpr {explicithyphenpenalty} \NC \NR +\NC \number \permitgluehyphenationmodecode \NC turn glue in discretionaries into kerns \NC \NR +\stoptabulate \stopsection @@ -493,25 +439,10 @@ have been added: \explicithyphenpenalty \stoptyping -The first parameter has the following consequences for automatic discs (the ones -resulting from an \prm {exhyphenchar}): - -\starttabulate[|c|l|l|] -\DB mode \BC automatic disc \type {-} \BC explicit disc \prm{-} \NC \NR -\TB -\NC \type{0} \NC \prm {exhyphenpenalty} \NC \prm {exhyphenpenalty} \NC \NR -\NC \type{1} \NC \prm {hyphenpenalty} \NC \prm {hyphenpenalty} \NC \NR -\NC \type{2} \NC \prm {exhyphenpenalty} \NC \prm {hyphenpenalty} \NC \NR -\NC \type{3} \NC \prm {hyphenpenalty} \NC \prm {exhyphenpenalty} \NC \NR -\NC \type{4} \NC \lpr {automatichyphenpenalty} \NC \lpr {explicithyphenpenalty} \NC \NR -\NC \type{5} \NC \prm {exhyphenpenalty} \NC \lpr {explicithyphenpenalty} \NC \NR -\NC \type{6} \NC \prm {hyphenpenalty} \NC \lpr {explicithyphenpenalty} \NC \NR -\NC \type{7} \NC \lpr {automatichyphenpenalty} \NC \prm {exhyphenpenalty} \NC \NR -\NC \type{8} \NC \lpr {automatichyphenpenalty} \NC \prm {hyphenpenalty} \NC \NR -\LL -\stoptabulate - -other values do what we always did in \LUATEX: insert \prm {exhyphenpenalty}. +The usage of these penalties is controlled by the \lpr {hyphenationmode} flags +\number\automaticpenaltyhyphenationmodecode\space and +\number\explicitpenaltyhyphenationmodecode\space and when these are not set \prm +{exhyphenpenalty} is used. \stopsection -- cgit v1.2.3