diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-09-24 13:11:46 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-09-24 13:11:46 +0200 |
commit | 236690a6367b25187d37013e1e7fc196c5c44eb8 (patch) | |
tree | a1c9520899dc817b2cf492750c10a1990331c273 | |
parent | 9858ddd23d54c56b2ce9e1f5580190d3210d18ed (diff) | |
download | context-236690a6367b25187d37013e1e7fc196c5c44eb8.tar.gz |
2016-09-24 12:45:00
28 files changed, 980 insertions, 56 deletions
diff --git a/doc/context/documents/general/manuals/luatex.pdf b/doc/context/documents/general/manuals/luatex.pdf Binary files differindex a5b873ebd..63f06d4ba 100644 --- a/doc/context/documents/general/manuals/luatex.pdf +++ b/doc/context/documents/general/manuals/luatex.pdf diff --git a/doc/context/documents/general/manuals/math-mkiv.pdf b/doc/context/documents/general/manuals/math-mkiv.pdf Binary files differindex 6a120e30a..1dd24f225 100644 --- a/doc/context/documents/general/manuals/math-mkiv.pdf +++ b/doc/context/documents/general/manuals/math-mkiv.pdf diff --git a/doc/context/documents/general/manuals/rules-mkiv.pdf b/doc/context/documents/general/manuals/rules-mkiv.pdf Binary files differnew file mode 100644 index 000000000..ff2155273 --- /dev/null +++ b/doc/context/documents/general/manuals/rules-mkiv.pdf diff --git a/doc/context/general/qrcs/setup-cs.pdf b/doc/context/general/qrcs/setup-cs.pdf Binary files differindex dab5da3f4..4349fe525 100644 --- a/doc/context/general/qrcs/setup-cs.pdf +++ b/doc/context/general/qrcs/setup-cs.pdf diff --git a/doc/context/general/qrcs/setup-de.pdf b/doc/context/general/qrcs/setup-de.pdf Binary files differindex fb76ba4ab..082e3c2c9 100644 --- a/doc/context/general/qrcs/setup-de.pdf +++ b/doc/context/general/qrcs/setup-de.pdf diff --git a/doc/context/general/qrcs/setup-en.pdf b/doc/context/general/qrcs/setup-en.pdf Binary files differindex 73f85f451..34f77b0b3 100644 --- a/doc/context/general/qrcs/setup-en.pdf +++ b/doc/context/general/qrcs/setup-en.pdf diff --git a/doc/context/general/qrcs/setup-fr.pdf b/doc/context/general/qrcs/setup-fr.pdf Binary files differindex c018d66dd..ad1c7d8aa 100644 --- a/doc/context/general/qrcs/setup-fr.pdf +++ b/doc/context/general/qrcs/setup-fr.pdf diff --git a/doc/context/general/qrcs/setup-it.pdf b/doc/context/general/qrcs/setup-it.pdf Binary files differindex 9fe725d5d..e0e0e71f9 100644 --- a/doc/context/general/qrcs/setup-it.pdf +++ b/doc/context/general/qrcs/setup-it.pdf diff --git a/doc/context/general/qrcs/setup-nl.pdf b/doc/context/general/qrcs/setup-nl.pdf Binary files differindex ca79fafde..cd7df2807 100644 --- a/doc/context/general/qrcs/setup-nl.pdf +++ b/doc/context/general/qrcs/setup-nl.pdf diff --git a/doc/context/general/qrcs/setup-ro.pdf b/doc/context/general/qrcs/setup-ro.pdf Binary files differindex 7609347b1..64bee894d 100644 --- a/doc/context/general/qrcs/setup-ro.pdf +++ b/doc/context/general/qrcs/setup-ro.pdf diff --git a/doc/context/sources/general/manuals/luatex/luatex-math.tex b/doc/context/sources/general/manuals/luatex/luatex-math.tex index b6634f840..0b639f0dc 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-math.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-math.tex @@ -267,7 +267,7 @@ are described as follows: \startitemize \startitem In any style superscripts and subscripts are taken from the next smaller style. - Exception: in display style they are taken in script style. + Exception: in display style they are in script style. \stopitem \startitem Subscripts are always in the cramped variant of the style; superscripts are only @@ -407,7 +407,7 @@ needed. The injection of \type {\abovedisplayskip} and \type {\belowdisplayskip} is not symmetrical. An above one is always inserted, also when zero, but the below is -only inserted when larger than zero. Especially the later mkes it sometimes hard +only inserted when larger than zero. Especially the later makes it sometimes hard to fully control spacing. Therefore \LUATEX\ comes with a new directive: \type {\mathdisplayskipmode}. The following values apply: diff --git a/doc/context/sources/general/manuals/luatex/luatex.tex b/doc/context/sources/general/manuals/luatex/luatex.tex index 74b2a60c8..f571515ae 100644 --- a/doc/context/sources/general/manuals/luatex/luatex.tex +++ b/doc/context/sources/general/manuals/luatex/luatex.tex @@ -12,8 +12,8 @@ \dontcomplain \startdocument - [version=0.99, - status=pre-release] + [%status=release, + version=1.0.0] \component luatex-titlepage diff --git a/doc/context/sources/general/manuals/rules/rules-mkiv.tex b/doc/context/sources/general/manuals/rules/rules-mkiv.tex new file mode 100644 index 000000000..5b207e335 --- /dev/null +++ b/doc/context/sources/general/manuals/rules/rules-mkiv.tex @@ -0,0 +1,817 @@ +% interface=en engine=luatex language=uk + +% author : Hans Hagen +% copyright : PRAGMA ADE & ConTeXt Development Team +% license : Creative Commons Attribution ShareAlike 4.0 International +% reference : pragma-ade.nl | contextgarden.net | texlive (related) distributions +% origin : the ConTeXt distribution +% +% comment : Because this manual is distributed with TeX distributions it comes with a rather +% liberal license. We try to adapt these documents to upgrades in the (sub)systems +% that they describe. Using parts of the content otherwise can therefore conflict +% with existing functionality and we cannot be held responsible for that. Many of +% the manuals contain characteristic graphics and personal notes or examples that +% make no sense when used out-of-context. + +\setupbodyfont + [dejavu,10pt] + +\setuphead + [section] + [style=\bfb] + +\setupwhitespace + [big] + +\setuplayout + [header=15mm, + topspace=15mm, + footer=0mm, + bottomspace=20mm, + height=middle, + backspace=20mm, + cutspace=20mm, + width=middle] + +\usemodule[x][setups-basics] + +\loadsetups[context-en] +\loadsetups[i-linefiller] + +\startdocument + +\startMPpage + + StartPage ; + + linecap := butt ; + + fill Page withcolor .25[yellow/4,green/2] ; + + path p ; p := (ulcorner Page .. urcorner Page .. lrcorner Page) ; + + draw image ( + for i=1/200 step 1/200 until 1 : + draw p scaled i dashed dashpattern (on 4 randomized 2 off 4 randomized 2) ; + endfor ; + ) withcolor white ; + + draw anchored.urt( + textext("\ss RULES") xsized .5PaperWidth, + urcorner Page shifted(-15mm,-20mm) + ) withcolor white ; + + draw anchored.urt( + textext("\ss HANS HAGEN") xsized .5PaperWidth, + lrcorner Page shifted(-15mm,40mm) + ) withcolor white ; + + draw anchored.urt( + textext("\ss A CONTEXT MKIV MANUAL") xsized .5PaperWidth, + lrcorner Page shifted(-15mm,20mm) + ) withcolor white ; + + setbounds currentpicture to Page ; + + StopPage ; + +\stopMPpage + +\startsubject[title=Introduction] + +This manual describes just one type of rules: those that somehow magically are +bound to the typeset text. We will mention a few mechanisms that relate to this +in the sense that they share some of the underlaying code and logic. The term +\quotation {rules} should be interpreted liberally as we can kick in some +\METAPOST\ which then can get us away from straight rules. + +This manual will not be that extensive, after all these mechanisms are not that +complex to configure. + +\stopsubject + +\startsubject[title=Underlining and overstriking] + +Already in \CONTEXT\ \MKII\ we had underlining available but with some +limitations. We could handle more than one word but at some point you hit the +limits of the engine. The \MKIV\ implementation is more flexible. In fact you can +underline a whole document (which was actually a request from a user). This +feature was also used by a collegue who was experimenting with texts for +dyslectic readers. + +This mechanism is generic in the sense that a framework is provided to define +rules that run alongside text. Take this: + +\setupbars[foregroundcolor=darkyellow,color=darkred] + +\startbuffer +\underbars {drawing \underbar{bars} under words is a typewriter leftover} +\overstrikes {striking words makes them \overstrike {unreadable} but +sometimes even \overbar {top lines} come into view.} +\stopbuffer + +\typebuffer + +This shows up as: + +\getbuffer + +We can best explain what happens by looking at how these commands are +defined: + +\starttyping +\definebar[overbar] [method=1,dy=0.4, offset=1.8, continue=yes] +\definebar[underbar] [method=1,dy=-0.4,offset=-0.3,continue=yes] +\definebar[overstrike][method=0,dy=0.4, offset=0.5, continue=yes] + +\definebar + [understrike] + [method=0, + offset=1.375, + rulethickness=2.5, + continue=yes, + order=background] + +\definebar[overbars] [overbar] [continue=no] +\definebar[underbars] [underbar] [continue=no] +\definebar[overstrikes] [overstrike] [continue=no] +\definebar[understrikes][understrike][continue=no] +\stoptyping + +The formal definitions of the commands are show in \definition [definebar, setupbar]. + +\showdefinition{definebar} +\showdefinition{setupbar} + +The \type {dy} parameter specifies the shift up or down. The offset defines how +nested bars are shifted. The \type {method} determines centering of the bar: we +set it to zero when we want an overstrike. The \type {continue} parameter is +responsible for drawing over spaces and the \type {order} determines the layering. + +The units are either hard coded values like points or relate to the font at the spot +of the bar. Here are some examples: + +\startbuffer +\setupbars[unit=mm,rulethickness=1] bar \underbar{foo} bar\quad +\setupbars[unit=ex,rulethickness=1] bar \underbar{foo} bar\quad +\setupbars[unit=pt,rulethickness=1] bar \underbar{foo} bar\quad +\setupbars[unit=pt,rulethickness=10pt] bar \underbar{foo} bar +\stopbuffer + +\typebuffer \blank \start \getbuffer \stop \blank + +As if underlining wasn't already bad enough, of course at some point there came a +request for dashed lines. + +\startbuffer +test \underrandoms{test me} and \underrandom{test} or \underrandom{grep} +test \underdashes {test me} and \underdash {test} or \underdash {grep} +test \underdots {test me} and \underdot {test} or \underdot {grep} +\stopbuffer + +\typebuffer + +The above variants are predefined and render as: + +\startlines +\tfb \getbuffer +\stoplines + +A graphic is defined as follows. It boils down to drawing one or more shapes. In +this example we also force a specific boundingbox so that the result gets +positioned right. + +\starttyping +\startuseMPgraphic{rules:under:...} + draw + ((0,RuleDepth) -- (RuleWidth,RuleDepth)) + shifted (0,RuleFactor*RuleOffset) + withpen pencircle scaled RuleThickness + withcolor RuleColor ; + setbounds currentpicture to unitsquare xysized(RuleWidth,RuleHeight) ; +\stopuseMPgraphic +\stoptyping + +The following variables are available: + +\starttabulate[|T|||] +\BC variable \BC type \BC meaning \NC \NR +\ML +\NC RuleDirection \NC string \NC the direction of the line \NC \NR +\NC RuleOption \NC string \NC whatever the caller finds useful \NC \NR +\NC RuleWidth \NC number \NC the requested width of the rule \NC \NR +\NC RuleHeight \NC number \NC the requested height of the rule \NC \NR +\NC RuleDepth \NC number \NC the requested depth of the rule \NC \NR +\NC RuleThickness \NC number \NC the linewidth \NC \NR +\NC RuleFactor \NC number \NC the set factor (e.g. an \type {ex}) \NC \NR +\NC RuleOffset \NC number \NC an (optional) offset in case of nesting \NC \NR +\NC RuleColor \NC color \NC the color \NC \NR +\stoptabulate + +The \type {RuleFactor} can be used as multiplier for the \type {RuleOffset}. +Later we will see an example of how to use the \type {RuleDirection} and \type +{RuleOption}. + +The extra under commands are defined as follows. Watch the \type {mp} parameter: +it refers to a graphic. + +\starttyping +\definebar + [undergraphic] + [mp=rules:under:dash, + offset=-.2, + order=background] + +\definebar[underrandom] [undergraphic][mp=rules:under:random] +\definebar[underrandoms][underrandom] [continue=yes] + +\definebar[underdash] [undergraphic][mp=rules:under:dash] +\definebar[underdashes] [underdash] [continue=yes] + +\definebar[underdot] [undergraphic][mp=rules:under:dots] +\definebar[underdots] [underdot] [continue=yes] +\stoptyping + +A nasty side effect of the implementation is that because we look mostly at glyphs, +optionally separated by glue or kern some text might get unseen and therefore not +treated. + +\startbuffer +\underbars{We see this \high{\tfxx ®} symbol \runninghbox to 1cm{\hss} often.} +\underbar {We see this \high{\tfxx ®} symbol \runninghbox to 1cm{\hss} often.} +\stopbuffer + +\typebuffer + +This gives: + +\startlines +\getbuffer +\stoplines + +A running box is seen as text. As you (probably) expect, a nested ornamental +rule is supported as well: + +\startbuffer +\underbars{We see this \high{\tfxx\underdot{®}} symbol \runninghbox to 1cm{\hss} often.} +\underbar {We see this \high{\tfxx\underdot{®}} symbol \runninghbox to 1cm{\hss} often.} +\stopbuffer + +\typebuffer + +This time we get (you might need a magnifier to see it): + +\startlines +\getbuffer +\stoplines + +\stopsubject + +\startsubject[title=Shifting] + +We mention shifting here because it shares code with the bars. There are two +shifts defined but you can define more: + +\starttyping +\defineshift + [shiftup] + [method=0, + dy=-1, + unit=ex, + continue=yes, + style=\txx] + +\defineshift + [shiftdown] + [method=1, + dy=.3, + unit=ex, + continue=yes, + style=\txx, + color=] +\stoptyping + +An example of using the commands defined this way is: + +\startbuffer +Let's go \shiftup{up} and \shiftdown{down} a bit! +\stopbuffer + +\typebuffer + +or: \inlinebuffer\ Here we just shift words but you can shift more than that +although I haven't yet seen a useful example of that: + +\startbuffer +We can \shiftup {\input{tufte}} whole paragraphs if we really want. +\stopbuffer + +\typebuffer + +\getbuffer + +The formal definitions are given in \definition[defineshift, setupshift, +startshift]. The \type {align} switch is there for directional (and testing) +purposes and is normally not used (or even useful in a line). The \type {dy} +is multiplied by the \type {factor} that itself can depend on the used font. + +\showdefinition{defineshift} +\showdefinition{setupshift} +\showdefinition{startshift} + +\stopsubject + +\startsubject[title=Fillers] + +The possibility of line fillers was mentioned by Mojca on the \CONTEXT\ mailing +list and it's actually not that hard to implement them. The only need I ever had +for it was to fill out lines on some legal form and that was actually just some +fun challenge in \MKII\ times. The code got lost and never made it into \CONTEXT. +This time it was added as a side effect of a thread at the tenth \CONTEXT\ +meeting. + +The ideas is to fill the rest of a line with some kind of (ornamental) rule. I'm +not sure what sense it makes, even in legal documents. If it is to prevent +additions then one should wonder if additions at the end of a (kind of arbitrary) +broken line is what we should be afraid of most. So, for now, let's consider it +an educational feature. + +\startbuffer +\definelinefiller + [filler-1] + [height=.75\exheight, + distance=.25\emwidth, + rulethickness=.25\exheight, + textcolor=darkyellow, + before=\blank, + after=\blank, + color=darkred] + +\startlinefiller[filler-1] + \input ward +\stoplinefiller +\stopbuffer + +\typebuffer + +Here we define a filler. As you can see, a rule gets added at the end of a +paragraph. + +\getbuffer + +\startbuffer +\startalign[flushleft,broad] + \startlinefiller[filler-1] + \input ward + \stoplinefiller +\stopalign +\stopbuffer + +This time we don't justify: + +\typebuffer + +Now more lines get a rule appended: + +\getbuffer + +Before we continue it must be noted that the environment creates a paragraph. If +you don't want that you need to use \type {\setlinefiller} instead. Next we show +a \type {middle} alignment: + +\startbuffer +\startalign[middle] + \startlinefiller[filler-1] + \input ward + \stoplinefiller +\stopalign +\stopbuffer + +\getbuffer + +\startbuffer +\startalign[middle] + \startnarrower + \startlinefiller[filler-1] + \input ward + \stoplinefiller + \stopnarrower +\stopalign +\stopbuffer + +Let's add another level of complexity, left- and right skips: + +\typebuffer + +Here we get: + +\getbuffer + +The lines stay within the narrower boundaries but you can extend them +to the margins if you like: + +\startbuffer +\startalign[middle] + \startnarrower + \startlinefiller[filler-1][scope=global] + \input ward + \stoplinefiller + \stopnarrower +\stopalign +\stopbuffer + +\typebuffer + +This looks like: + +\getbuffer + +You can also use a \type {left} or \type {right} scope, as in: + +\startbuffer +\startalign[middle] + \startnarrower + \startlinefiller[filler-1][scope=right] + \input ward + \stoplinefiller + \stopnarrower +\stopalign +\stopbuffer + +\typebuffer + +Only the right rules extend into the margins. + +\getbuffer + +\startbuffer +\startalign[middle] + \startnarrower + \startlinefiller[filler-1][scope=right,location=right] + \input ward + \stoplinefiller + \stopnarrower +\stopalign +\stopbuffer + +You can get rid of the left rules: + +\typebuffer + +So: + +\getbuffer + +Of course these rules are somewhat boring so let's now kick in some \METAPOST. + +\startbuffer[mp] +\setuplinefiller + [filler-1] + [mp=rules:filler:demo, + %threshold=.25\emwidth, + color=darkred] + +\startuseMPgraphic{rules:filler:demo} + drawarrow + if RuleDirection == "TRT" : reverse fi + ((0,RuleHeight) -- (RuleWidth,RuleHeight)) + withpen + pencircle scaled RuleThickness + withcolor + if RuleOption == "left" : complemented fi RuleColor ; + setbounds currentpicture to + unitsquare xysized(RuleWidth,RuleHeight) ; +\stopuseMPgraphic +\stopbuffer + +\typebuffer[mp] \getbuffer[mp] + +The previous example now looks like: + +\getbuffer + +\startbuffer +\startalign[middle,r2l] + \startnarrower[4*middle] + \startlinefiller[filler-1] [scope=global] + \input ward + \stoplinefiller + \stopnarrower +\stopalign +\stopbuffer + +This time we also change the direction and we can let the \METAPOST\ graphic +adapt to that by reverting the arrows. + +\typebuffer + +The direction \type {TRT} is \TEX\ speak for a right|-|to|-|left direction. We +use a latin script example for convenience. + +\getbuffer + +\startbuffer[mp] +\startuseMPgraphic{rules:filler:demo} + drawarrow + if RuleDirection == "TRT" : reverse fi + if RuleOption == "right" : reverse fi + ((0,RuleHeight) -- (RuleWidth,RuleHeight)) + withpen + pencircle scaled RuleThickness + withcolor + if RuleOption == "left" : complemented fi RuleColor ; + setbounds currentpicture to + unitsquare xysized(RuleWidth,RuleHeight) ; +\stopuseMPgraphic +\stopbuffer + +% \startbuffer +% \startnarrower[4*middle] +% \startlinefiller[filler-1] [scope=global,align=middle] +% \parindent 100pt +% \parfillskip 100pt +% \input ward +% \stoplinefiller +% \stopnarrower +% \stopbuffer + +\startbuffer +\startnarrower[4*middle] + \startlinefiller[filler-1] [scope=global,align={middle,r2l}] + \parindent 100pt + \parfillskip 100pt + \input ward + \stoplinefiller +\stopnarrower +\stopbuffer + +The next rendering shows what happens when we set \type {\parindent} and \type +{\parfillskip} to an excessive have a \type {100pt}. + +\getbuffer[mp] \getbuffer + +Here we have adapted the graphic a bit: + +\starttyping +if RuleDirection == "TRT" : reverse fi + if RuleOption == "right" : reverse fi + ((0,RuleHeight) -- (RuleWidth,RuleHeight)) +\stoptyping + +\showdefinition{definelinefiller} +\showdefinition{setuplinefiller} + +\stopsubject + +% \startsubject[title=Backgrounds] +% \stopsubject + +\startsubject[title=User rules] + +Characters and rules are the only graphical elements that \TEX\ really knows +about. Even if you see images in a document, you should realize that they are +just blobs with dimensions and that the backend replaces such blobs by real +images. + +The primitive operations for rules are \type {\hrule} and \type {\vrule} and the +main difference is to what way they adapt to their situation when no dimensions +are given and the mode change they trigger. + +\startbuffer +hrule{\darkred \hrule width 10cm height 3mm depth 2mm}\par +vrule{\darkyellow\vrule width 10cm height 3mm depth 2mm}\par +hrule{\darkred \hrule width 10cm }\par +vrule{\darkyellow\vrule height 3mm depth 2mm}\par + +hrule{\darkred \leaders\hrule height 1mm\relax\hfill}hrule\par +\stopbuffer + +\typebuffer + +When more text is to follow you should end a specification with \type {\relax} to +make sure that the scanner stops looking for more arguments. With \type {\leaders} +you can create flexible rules. + +\startlinecorrection +\getbuffer +\stoplinecorrection + +In \CONTEXT\ we also have so called frame rules: + +\startbuffer +\color[darkred]{\frule + width 10cm + height 1cm + line 1mm +\relax} +\stopbuffer + +\typebuffer + +This will produce a rectangle: + +\startlinecorrection +\getbuffer +\stoplinecorrection + +There are a few more keywords. Keep in mind that we actually have a new kind of +primitive here, so we follow the \TEX\ conventions of keywords. + +\startbuffer +\ruledhbox\bgroup + \darkgray \frule width 100mm height 10mm depth 8mm radius 2mm line 2pt type fill\relax + \hskip-100mm + \darkred \frule width 100mm height 10mm depth 8mm radius 2mm line 2pt\relax + \hskip-100mm + \hbox to 100mm{\white \bold \hfill some handy word with frames\hfill} +\egroup +\stopbuffer + +\typebuffer + +Of course this is a rather low level way of doing frames and such, but when you +like that kind of low level programming you get the possibility here. + +\startlinecorrection +\getbuffer +\stoplinecorrection + +You can combine this with existing mechanisms. Take the following: + +\startbuffer +\defineoverlay[normalframe] + [\frule + width \overlaywidth + height\overlayheight + line \overlaylinewidth + ] + +\defineoverlay[ovalframe] + [\frule + width \overlaywidth + height \overlayheight + line \overlaylinewidth + radius \overlayradius + ] +\stopbuffer + +\typebuffer \getbuffer + +\startbuffer +\hbox \bgroup + \framed {test}\quad + \framed[frame=off] {test}\quad + \framed[background=normalframe,frame=off]{test}\quad + \framed[background=normalframe,frame=off]{test}\quad + \framed[corner=round] {test}\quad + \framed[corner=round] {test}\quad + \framed[background=ovalframe,frame=off] {test}\quad + \framed[background=ovalframe,frame=off] {test}\quad + \framed[background=ovalframe,frame=on] {test}\quad + \framed[background=ovalframe,frame=on] {test}\quad +\egroup +\stopbuffer + +This is a variant on the already available round corners: + +\startlinecorrection +\getbuffer +\stoplinecorrection + +The above result is accomplished with: + +\typebuffer + +Given the examples in the previous sections it will be no surprise that we +can also use \METAPOST. + +\startbuffer +\startuseMPgraphic{demoshape:back} + fill + unitcircle xysized (RuleWidth,RuleHeight+RuleDepth) + withcolor RuleColor ; +\stopuseMPgraphic + +\startuseMPgraphic{demoshape:fore} + draw + unitcircle xysized (RuleWidth,RuleHeight+RuleDepth) + withcolor RuleColor + withpen pencircle scaled 4RuleThickness ; +\stopuseMPgraphic + +\hbox\bgroup + \darkgray \frule width 100mm height 10mm depth 8mm type mp line 2pt + data {\includeMPgraphic{demoshape:back}} + \relax + \hskip-100mm + \darkred \frule width 100mm height 10mm depth 8mm type mp line 2pt + data {\includeMPgraphic{demoshape:fore}} + \relax + \hskip-100mm + \hbox to 100mm{\white \bold \hfill some handy word with frames\hfill} +\egroup +\stopbuffer + +\typebuffer + +Or rendered: + +\startlinecorrection +\getbuffer +\stoplinecorrection + +The \type {\blackrule} command is the more high level way to inject a rule. + +\startbuffer +\blackrule + [width=10cm, + height=1cm, + depth=1cm, + color=darkred] +\stopbuffer + +\typebuffer + +This produces a boring rule: + +\startlinecorrection +\getbuffer +\stoplinecorrection + +Again we can revert to \METAPOST: + +\startbuffer +\blackrule + [width=10cm, + height=1cm, + depth=1cm, + color=darkred, + type=mp, + mp=demoshape:back] +\stopbuffer + +\typebuffer + +or: + +\startlinecorrection +\getbuffer +\stoplinecorrection + +The formal definition of this command is shown in \definition [setupblackrules, +blackrule]. + +\showdefinition{setupblackrules} +\showdefinition{blackrule} + +\stopsubject + +\startsubject[title=Hiding] + +In education a to be filled in text is often represented by a gap in the running text +and the bar drawing mechanism supports this. THere is a predefined \type {\hiddenbar} +command: + +\starttyping +\definebar + [hiddenbar] [underbar] + [continue=yes,empty=yes, + left=\zwj,right=\zwj] +\stoptyping + +\startbuffer +\input ward \hiddenbar {\color[red]{invisible}} +\input ward \hiddenbar {\quad\color[red]{invisible}\quad} +\input ward \hiddenbar{\quad\quad\quad\color[red]{invisible}\quad\quad\quad} +\input ward \hiddenbar {\color[red]{invisible}\quad\quad\quad\quad\quad\quad} +\input ward +\stopbuffer + +\getbuffer + +The previous text is generated with: + +\typebuffer + +Here is a variant that inserts spacing at the left and right edges. In this case +the spacing is kept at a linebreak: + +\startbuffer +\definebar + [widehiddenbar] + [hiddenbar] + [left={\quads[3]}, + right={\quads[3]}] + +\widehiddenbar{invisible} \input weisman +\widehiddenbar{invisible} \input weisman +\widehiddenbar{invisible} +\stopbuffer + +\typebuffer + +\getbuffer + +\stopsubject + +\stopdocument diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 844e6862e..c1ec3f967 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2016.09.23 10:13} +\newcontextversion{2016.09.24 12:40} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 4dd632844..4f166f39e 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2016.09.23 10:13} +\edef\contextversion{2016.09.24 12:40} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 2ea69b2c9..506cf489f 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2016.09.23 10:13} +\newcontextversion{2016.09.24 12:40} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index dd73eb503..64587d1b2 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2016.09.23 10:13} +\edef\contextversion{2016.09.24 12:40} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua index 0e415d76a..65a1c6342 100644 --- a/tex/context/base/mkiv/font-ocl.lua +++ b/tex/context/base/mkiv/font-ocl.lua @@ -14,9 +14,6 @@ local round, max = math.round, math.round local formatters = string.formatters local tounicode = fonts.mappings.tounicode -local graytorgb = attributes.colors.graytorgb -local cmyktorgb = attributes.colors.cmyktorgb - local otf = fonts.handlers.otf local f_color = formatters["pdf:direct:%f %f %f rg"] @@ -50,28 +47,49 @@ end local sharedpalettes = { } -function otf.registerpalette(name,values) - sharedpalettes[name] = values - for i=1,#values do - local v = values[i] - local r, g, b - local s = v.s - if s then - r, g, b = graytorgb(s) - else - local c, m, y, k = v.c, v.m, v.y, v.k - if c or m or y or k then - r, g, b = cmyktorgb(c or 0,m or 0,y or 0,k or 0) +if context then + + local graytorgb = attributes.colors.graytorgb + local cmyktorgb = attributes.colors.cmyktorgb + + function otf.registerpalette(name,values) + sharedpalettes[name] = values + for i=1,#values do + local v = values[i] + local r, g, b + local s = v.s + if s then + r, g, b = graytorgb(s) else - r, g, b = v.r, v.g, v.b + local c, m, y, k = v.c, v.m, v.y, v.k + if c or m or y or k then + r, g, b = cmyktorgb(c or 0,m or 0,y or 0,k or 0) + else + r, g, b = v.r, v.g, v.b + end end + values[i] = { + max(r and round(r*255) or 0,255), + max(g and round(g*255) or 0,255), + max(b and round(b*255) or 0,255) + } end - values[i] = { - max(r and round(r*255) or 0,255), - max(g and round(g*255) or 0,255), - max(b and round(b*255) or 0,255) - } end + +else -- for generic + + function otf.registerpalette(name,values) + sharedpalettes[name] = values + for i=1,#values do + local v = values[i] + values[i] = { + max(round((v.r or 0)*255),255), + max(round((v.g or 0)*255),255), + max(round((v.b or 0)*255),255) + } + end + end + end local function initializecolr(tfmdata,kind,value) -- hm, always value diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua index f27f3e00a..2b0d7b73f 100644 --- a/tex/context/base/mkiv/math-noa.lua +++ b/tex/context/base/mkiv/math-noa.lua @@ -1629,7 +1629,9 @@ function handlers.classes(head,style,penalties) return true end -registertracker("math.classes",function(v) tasks.setaction("math","noads.handlers.classes",v) end) +registertracker("math.classes",function(v) + tasks.setaction("math","noads.handlers.classes",v) +end) -- experimental @@ -1790,14 +1792,29 @@ do end - -- just for me function handlers.showtree(head,style,penalties) inspect(nodes.totree(head)) end -registertracker("math.showtree",function(v) tasks.setaction("math","noads.handlers.showtree",v) end) +registertracker("math.showtree",function(v) + tasks.setaction("math","noads.handlers.showtree",v) +end) + +-- also for me + +local applyvisuals = nuts.applyvisuals +local visual = false + +function handlers.makeup(head) + applyvisuals(tonut(head),visual) +end + +registertracker("math.makeup",function(v) + visual = v + tasks.setaction("math","noads.handlers.makeup",v) +end) -- the normal builder diff --git a/tex/context/base/mkiv/node-ini.lua b/tex/context/base/mkiv/node-ini.lua index 1a9d141f4..65f76faea 100644 --- a/tex/context/base/mkiv/node-ini.lua +++ b/tex/context/base/mkiv/node-ini.lua @@ -90,6 +90,13 @@ local listcodes = mark(getsubtypes("list")) local rulecodes = mark(getsubtypes("rule")) +if not rulecodes[5] then + rulecodes[5] = "over" + rulecodes[6] = "under" + rulecodes[7] = "fraction" + rulecodes[8] = "radical" +end + -- local glyphcodes = allocate { -- [0] = "character", -- [1] = "glyph", diff --git a/tex/context/base/mkiv/node-ser.lua b/tex/context/base/mkiv/node-ser.lua index b00268828..847db7a15 100644 --- a/tex/context/base/mkiv/node-ser.lua +++ b/tex/context/base/mkiv/node-ser.lua @@ -26,6 +26,7 @@ local nodecodes = nodes.nodecodes local subtcodes = nodes.codes local noadcodes = nodes.noadcodes local getfields = nodes.fields +local nodekeys = nodes.keys local tonode = nodes.tonode @@ -105,7 +106,7 @@ nodes.ignorablefields = ignore local function astable(n,sparse) -- not yet ok, might get obsolete anyway n = tonode(n) - local f, t = getfields(n), { } + local f = getfields(n) for i=1,#f do local v = f[i] local d = n[v] @@ -258,3 +259,40 @@ function nodes.print(head,n) head = head.next end end + +-- quick hack, nicer is to have a proper expand per node type +-- already prepared + +local function apply(n,action) + while n do + action(n) + local id = n.id + if id == hlist_code or id == vlist_code then + apply(n.list,action) + end + n = n.next + end +end + +nodes.apply = apply + +local nuts = nodes.nuts +local getid = nuts.getid +local getlist = nuts.getlist +local getnext = nuts.getnext + +local function apply(n,action) + while n do + action(n) + local id = getid(n) + if id == hlist_code or id == vlist_code then + local list = getlist(n,action) + if list then + apply(list,action) + end + end + n = getnext(n) + end +end + +nuts.apply = apply diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex e6c10b894..6013ab1b8 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex b10df0d58..c2c701ecc 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/task-ini.lua b/tex/context/base/mkiv/task-ini.lua index 696a3b4a9..3f13ce0d7 100644 --- a/tex/context/base/mkiv/task-ini.lua +++ b/tex/context/base/mkiv/task-ini.lua @@ -108,8 +108,9 @@ appendaction("math", "normalizers", "noads.handlers.italics", nil, "no appendaction("math", "normalizers", "noads.handlers.classes", nil, "nohead") -- disabled appendaction("math", "builders", "builders.kernel.mlist_to_hlist") -- always on -------------("math", "builders", "noads.handlers.italics", nil, "nohead") -- disabled +------------("math", "builders", "noads.handlers.italics", nil, "nohead") -- disabled appendaction("math", "builders", "typesetters.directions.processmath") -- disabled (has to happen pretty late) +appendaction("math", "builders", "noads.handlers.makeup", nil, "nohead") -- disabled (has to happen last) appendaction("finalizers", "lists", "typesetters.paragraphs.normalize") -- moved here appendaction("finalizers", "lists", "typesetters.margins.localhandler") -- disabled @@ -200,6 +201,7 @@ disableaction("math", "noads.handlers.italics") disableaction("math", "noads.handlers.domains") disableaction("math", "noads.handlers.classes") disableaction("math", "noads.handlers.autofences") +disableaction("math", "noads.handlers.makeup") disableaction("math", "typesetters.directions.processmath") disableaction("mvlbuilders", "typesetters.margins.globalhandler") diff --git a/tex/context/base/mkiv/trac-vis.lua b/tex/context/base/mkiv/trac-vis.lua index bffb1807c..ef73d2182 100644 --- a/tex/context/base/mkiv/trac-vis.lua +++ b/tex/context/base/mkiv/trac-vis.lua @@ -99,6 +99,7 @@ local insert_node_before = nuts.insert_before local insert_node_after = nuts.insert_after local traverse_nodes = nuts.traverse local linked_nodes = nuts.linked +local apply_to_nodes = nuts.apply local effectiveglue = nuts.effective_glue @@ -240,7 +241,7 @@ end local function setvisual(n,a,what,list) -- this will become more efficient when we have the bit lib linked in if not n or n == "reset" then return unsetvalue - elseif n == "makeup" then + elseif n == true or n == "makeup" then if not a or a == 0 or a == unsetvalue then a = preset_makeup else @@ -288,6 +289,16 @@ function nuts.setvisuals(n,mode) setattr(n,a_visual,setvisual(mode,getattr(n,a_visual),true,true)) end +function nuts.applyvisuals(n,mode) + local a = unsetvalue + if mode == true then + a = texgetattribute (a_visual) + elseif mode then + a = setvisual(mode) + end + apply_to_nodes(n,function(n) setattr(n,a_visual,a) end) +end + function nuts.copyvisual(n,m) setattr(n,a_visual,getattr(m,a_visual)) end diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 73f85f451..34f77b0b3 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex e653ee5fd..85ee4bfd5 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index c0b459689..c93d2b104 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 09/23/16 10:13:56 +-- merge date : 09/24/16 12:40:11 do -- begin closure to overcome local limits and interference @@ -23273,8 +23273,6 @@ local tostring,next,format=tostring,next,string.format local round,max=math.round,math.round local formatters=string.formatters local tounicode=fonts.mappings.tounicode -local graytorgb=attributes.colors.graytorgb -local cmyktorgb=attributes.colors.cmyktorgb local otf=fonts.handlers.otf local f_color=formatters["pdf:direct:%f %f %f rg"] local f_gray=formatters["pdf:direct:%f g"] @@ -23298,27 +23296,43 @@ else end end local sharedpalettes={} -function otf.registerpalette(name,values) - sharedpalettes[name]=values - for i=1,#values do - local v=values[i] - local r,g,b - local s=v.s - if s then - r,g,b=graytorgb(s) - else - local c,m,y,k=v.c,v.m,v.y,v.k - if c or m or y or k then - r,g,b=cmyktorgb(c or 0,m or 0,y or 0,k or 0) +if context then + local graytorgb=attributes.colors.graytorgb + local cmyktorgb=attributes.colors.cmyktorgb + function otf.registerpalette(name,values) + sharedpalettes[name]=values + for i=1,#values do + local v=values[i] + local r,g,b + local s=v.s + if s then + r,g,b=graytorgb(s) else - r,g,b=v.r,v.g,v.b + local c,m,y,k=v.c,v.m,v.y,v.k + if c or m or y or k then + r,g,b=cmyktorgb(c or 0,m or 0,y or 0,k or 0) + else + r,g,b=v.r,v.g,v.b + end end + values[i]={ + max(r and round(r*255) or 0,255), + max(g and round(g*255) or 0,255), + max(b and round(b*255) or 0,255) + } + end + end +else + function otf.registerpalette(name,values) + sharedpalettes[name]=values + for i=1,#values do + local v=values[i] + values[i]={ + max(round((v.r or 0)*255),255), + max(round((v.g or 0)*255),255), + max(round((v.b or 0)*255),255) + } end - values[i]={ - max(r and round(r*255) or 0,255), - max(g and round(g*255) or 0,255), - max(b and round(b*255) or 0,255) - } end end local function initializecolr(tfmdata,kind,value) |