From 9a1b9756939e12e328dea3633d9fe3cbde8f154b Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 8 Apr 2020 15:36:51 +0200 Subject: 2020-04-08 14:37:00 --- .../documents/general/manuals/luametatex.pdf | Bin 1194728 -> 1202234 bytes doc/context/documents/general/manuals/luatex.pdf | Bin 1540615 -> 1544345 bytes .../manuals/luametatex/luametatex-fonts.tex | 50 +++++----- .../manuals/luametatex/luametatex-metapost.tex | 102 ++++++++++++++++++++- .../general/manuals/luametatex/luametatex-pdf.tex | 10 ++ .../general/manuals/luatex/luatex-enhancements.tex | 23 +++++ .../general/manuals/luatex/luatex-fonts.tex | 21 +++++ .../sources/general/manuals/luatex/luatex-math.tex | 25 +++++ .../sources/general/manuals/luatex/luatex.tex | 2 +- 9 files changed, 202 insertions(+), 31 deletions(-) (limited to 'doc') diff --git a/doc/context/documents/general/manuals/luametatex.pdf b/doc/context/documents/general/manuals/luametatex.pdf index f74a5aa73..c267b6704 100644 Binary files a/doc/context/documents/general/manuals/luametatex.pdf and b/doc/context/documents/general/manuals/luametatex.pdf differ diff --git a/doc/context/documents/general/manuals/luatex.pdf b/doc/context/documents/general/manuals/luatex.pdf index f01b77711..eed48236a 100644 Binary files a/doc/context/documents/general/manuals/luatex.pdf and b/doc/context/documents/general/manuals/luatex.pdf differ diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-fonts.tex b/doc/context/sources/general/manuals/luametatex/luametatex-fonts.tex index 7cea6f865..2edf06f3e 100644 --- a/doc/context/sources/general/manuals/luametatex/luametatex-fonts.tex +++ b/doc/context/sources/general/manuals/luametatex/luametatex-fonts.tex @@ -438,7 +438,7 @@ omit the kern and ligature tables, which has the same effect as the above. \stopsubsection -\startsubsection[title={\type{\nospaces}}] +\startsubsection[title={\lpr{nospaces}}] \topicindex {spaces+suppress} @@ -461,7 +461,7 @@ space. \stopsubsection -\startsubsection[title={\type{\protrusionboundary}}] +\startsubsection[title={\lpr{protrusionboundary}}] \topicindex {protrusion} \topicindex {boundaries} @@ -497,6 +497,29 @@ instance content moved into the margin: \stopsubsection +\startsubsection[title={\lpr{glyphdimensionsmode}}] + +Already in the early days of \LUATEX\ the decision was made to calculate the +effective height and depth of glyphs in a way that reflected the applied vertical +offset. The height got that offset added, the depth only when the offset was +larger than zero. We can now control this in more detail with this mode +parameter. An offset is added to the height and|/|or subtracted from the depth. +The effective values are never negative. The zero mode is the default. + +\starttabulate[|l|pl|] +\DB value \BC effect \NC\NR +\TB +\NC \type {0} \NC the old behaviour: add the offset to the height and only subtract + the offset only from the depth when it is positive \NC \NR +\NC \type {1} \NC add the offset to the height and subtract it from the depth \NC \NR +\NC \type {2} \NC add the offset to the height and subtract it from the depth but + keep the maxima of the current and previous results \NC \NR +\NC \type {3} \NC use the height and depth of the glyph, so no offset is applied \NC \NR +\LL +\stoptabulate + +\stopsubsection + \stopsection \startsection[title={The \LUA\ font library}][library=font] @@ -588,29 +611,6 @@ font.current( i) % % \stopsubsection -\startsubsection[title={\type{\glyphdimensionsmode}}] - -Already in the early days of \LUATEX\ the decision was made to calculate the -effective height and depth of glyphs in a way that reflected the applied vertical -offset. The height got that offset added, the depth only when the offset was -larger than zero. We can now control this in more detail with this mode -parameter. An offset is added to the height and|/|or subtracted from the depth. -The effective values are never negative. The zero mode is the default. - -\starttabulate[|l|pl|] -\DB value \BC effect \NC\NR -\TB -\NC \type {0} \NC the old behavior: add the offset to the height and only subtract - the offset only from the depth when it is positive \NC \NR -\NC \type {1} \NC add the offset to the height and subtract it from the depth \NC \NR -\NC \type {2} \NC add the offset to the height and subtract it from the depth but - keep the maxima of the current and previous results \NC \NR -\NC \type {3} \NC use the height and depth of the glyph, so no offset is applied \NC \NR -\LL -\stoptabulate - -\stopsubsection - \stopsection \stopchapter diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-metapost.tex b/doc/context/sources/general/manuals/luametatex/luametatex-metapost.tex index bd9189956..85dc30036 100644 --- a/doc/context/sources/general/manuals/luametatex/luametatex-metapost.tex +++ b/doc/context/sources/general/manuals/luametatex/luametatex-metapost.tex @@ -427,10 +427,6 @@ a bunch of vital characteristics of the used pen (all values are floats): \LL \stoptabulate -\stopsection - -\startsection[title=Acessors] - \subsection[title={Character size information}] \libindex{char_width} @@ -441,13 +437,109 @@ These functions find the size of a glyph in a defined font. The \type {fontname} is the same name as the argument to \type {infont}; the \type {char} is a glyph id in the range 0 to 255; the returned \type {w} is in AFM units. - \startfunctioncall w = char_width(mp, fontname, char) h = char_height(mp, fontname, char) d = char_depth(mp, fontname, char) \stopfunctioncall +\stopsection + +\startsection[title=Scanners] + +After a relative long period of testing the scanners are now part of the +interface. That doesn't mean that there will be no changes: depending on the +needs and experiences details might evolve. The summary below is there +still preliminary and mostly provided as reminder. + +\starttabulate[|l|l|p|] +\DB scanner \BC argument \BC returns \NC \NR +\TB +\NC \type{scan_next} \NC instance, keep \NC token, mode, type \NC \NR +\NC \type{scan_expression} \NC instance, keep \NC type \NC \NR +\NC \type{scan_token} \NC instance, keep \NC token, mode, kind \NC \NR +\NC \type{scan_symbol} \NC instance, keep, expand \NC string \NC \NR +\NC \type{scan_numeric} \NC instance, type \NC number \NC \NR +\NC \type{scan_integer} \NC instance, type \NC integer \NC \NR +\NC \type{scan_boolean} \NC instance, type \NC boolean \NC \NR +\NC \type{scan_string} \NC instance, type \NC string \NC \NR +\NC \type{scan_pair} \NC instance, hashed, type \NC table or two numbers \NC \NR +\NC \type{scan_color} \NC instance, hashed, type \NC table or three numbers \NC \NR +\NC \type{scan_cmykcolor} \NC instance, hashed, type \NC table or four numbers \NC \NR +\NC \type{scan_transform} \NC instance, hashed, type \NC table or six numbers \NC \NR +\NC \type{scan_path} \NC instance, hashed, type \NC table with hashes or arrays \NC \NR +\NC \type{scan_pen} \NC instance, hashed, type \NC table with hashes or arrays \NC \NR +\LL +\stoptabulate + +The types and token codes are numbers but they actually depend on the +implementation (although changes are unlikely). The types of data structures can +be queried with \type {mplib.types()}: + +\dontleavehmode \startluacode + local t = mplib.types() + for i=0,#t do + if i > 0 then + context(", ") + end + context("%i: %s",i,t[i]) + end +\stopluacode . + +The command codes are available with \type {mplib.codes()}: + +\dontleavehmode \startluacode + local t = mplib.codes() + for i=0,#t do + if i > 0 then + context(", ") + end + context("%i: %s",i,t[i]) + end +\stopluacode . + +Now, if you really want to use these, keep in mind that the internals of +\METAPOST\ are not trivial, especially because expression scanning can be +complex. So you need to experiment a bit. In \CONTEXT\ all is (and will be) +hidden below an abstraction layer so users are not bothered by all these +look|-|ahead and push|-|back issues that originate in the way \METAPOST\ scans +its input. + +\stopsection + +\startsection[title=Injectors] + +It is important to know that piping code into the library is pretty fast and +efficient. Most processing time relates to memory management, calculations and +generation of output can not be neglected either. Out of curiousity I added some +functions that directly push data into the library but the gain is not that +large. \footnote {The main motivation was checking of huge paths could be +optimized. The other data structures were then added for completeness.} + +\starttabulate[|l|l|] +\DB scanner \BC argument \NC \NR +\TB +\NC \type{inject_numeric} \NC instance, number \NC \NR +\NC \type{inject_integer} \NC instance, number \NC \NR +\NC \type{inject_boolean} \NC instance, boolean \NC \NR +\NC \type{inject_string} \NC instance, string \NC \NR +\NC \type{inject_pair} \NC instance, (table with) two numbers \NC \NR +\NC \type{inject_color} \NC instance, (table with) three numbers \NC \NR +\NC \type{inject_cmykcolor} \NC instance, (table with) four numbers \NC \NR +\NC \type{inject_transform} \NC instance, (table with) six numbers \NC \NR +\NC \type{inject_path} \NC instance, table with hashes or arrays, cycle, variant \NC \NR +\LL +\stoptabulate + +The path injector takes a table with subtables that are either hashed (like the +path solver) or arrays with two, four or six entries. When the third argument has +the value \type {true} the path is closed. When the fourth argument is \type +{true} the path is constructed out of straight lines (as with \type {--}) by +setting the \type {curl} values to~1 automatically. \footnote {This is all +experimental so future versions might provide more control.} + +\stopsection + \stopchapter \stopcomponent diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-pdf.tex b/doc/context/sources/general/manuals/luametatex/luametatex-pdf.tex index 79653fdf8..3412d0820 100644 --- a/doc/context/sources/general/manuals/luametatex/luametatex-pdf.tex +++ b/doc/context/sources/general/manuals/luametatex/luametatex-pdf.tex @@ -183,6 +183,16 @@ b = getboolean(,index|key) n = getname (,index|key) \stoptyping +The \type {getstring} function has two extra variants: + +\starttyping +s, h = getstring (,index|key,false) +s = getstring (,index|key,true) +\stoptyping + +The first call returns the original string plus a boolean indicating if the +string is hex encoded. The second call returns the unencoded string. + \stopsubsection \startsubsection[title={\type {get[dictionary|array|stream]}}] diff --git a/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex b/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex index b81e1dbda..537961661 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex @@ -1266,6 +1266,29 @@ related primitives. \stopsubsection +\startsubsection[title={\prm {glyphdimensionsmode}}] + +Already in the early days of \LUATEX\ the decision was made to calculate the +effective height and depth of glyphs in a way that reflected the applied vertical +offset. The height got that offset added, the depth only when the offset was +larger than zero. We can now control this in more detail with this mode +parameter. An offset is added to the height and|/|or subtracted from the depth. +The effective values are never negative. The zero mode is the default. + +\starttabulate[|l|pl|] +\DB value \BC effect \NC\NR +\TB +\NC \type {0} \NC the old behaviour: add the offset to the height and only subtract + the offset only from the depth when it is positive \NC \NR +\NC \type {1} \NC add the offset to the height and subtract it from the depth \NC \NR +\NC \type {2} \NC add the offset to the height and subtract it from the depth but + keep the maxima of the current and previous results \NC \NR +\NC \type {3} \NC use the height and depth of the glyph, so no offset is applied \NC \NR +\LL +\stoptabulate + +\stopsubsection + \stopsection \startsection[title={Control and debugging}] diff --git a/doc/context/sources/general/manuals/luatex/luatex-fonts.tex b/doc/context/sources/general/manuals/luatex/luatex-fonts.tex index 400550a96..e944b2c5b 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-fonts.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-fonts.tex @@ -861,6 +861,27 @@ value is the index in \type {font.fonts}, the second the font itself, as a \LUA\ table. The indices are listed incrementally, but they do not always form an array of consecutive numbers: in some cases there can be holes in the sequence. +\startsubsection[title={\type{\glyphdimensionsmode}}] + +Already in the early days of \LUATEX\ the decision was made to calculate the +effective height and depth of glyphs in a way that reflected the applied vertical +offset. The height got that offset added, the depth only when the offset was +larger than zero. We can now control this in more detail with this mode +parameter. An offset is added to the height and|/|or subtracted from the depth. +The effective values are never negative. The zero mode is the default. + +\starttabulate[|l|pl|] +\DB value \BC effect \NC\NR +\TB +\NC \type {0} \NC the old behavior: add the offset to the height and only subtract + the offset only from the depth when it is positive \NC \NR +\NC \type {1} \NC add the offset to the height and subtract it from the depth \NC \NR +\NC \type {2} \NC add the offset to the height and subtract it from the depth but + keep the maxima of the current and previous results \NC \NR +\NC \type {3} \NC use the height and depth of the glyph, so no offset is applied \NC \NR +\LL +\stoptabulate + \stopsection \stopchapter diff --git a/doc/context/sources/general/manuals/luatex/luatex-math.tex b/doc/context/sources/general/manuals/luatex/luatex-math.tex index e5999e72f..b4a2d4b05 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-math.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-math.tex @@ -1242,6 +1242,31 @@ $\Uhextensible width 1pt middle 0 "2194$ font metrics are involved we have a different code path for traditional fonts end \OPENTYPE\ fonts. +Sometimes you might want to act upon the size of a delimiter, something that is +not really possible because of the fact that they are calculated {\em after} most +has been typeset already. In the following example the all|-|zero specification +is the trigger to make a fake box with the last delimiter dimensions and shift. +It's an ugly hack but its relative simple and not intrusive implementation has no +side effects. Any other heuristic solution would not satisfy possible demands +anyway. Here is a rather low level example: + +\startbuffer +\startformula +\Uleft \Udelimiter 5 0 "222B +\frac{\frac{a}{b}}{\frac{c}{d}} +\Uright \Udelimiter 5 0 "222B +\kern-2\fontcharwd\textfont0 "222B +\mathlimop{\Uvextensible \Udelimiter 0 0 0}_1^2 x +\stopformula +\stopbuffer + +\typebuffer + +The last line, by passing zero values, results in a fake operator that has the +dimensions of the previous delimiter. We can then backtrack over the (presumed) +width and the two numbers become limit operators. As said, it's not pretty but it +works. + \subsection{Fractions} \topicindex {math+fractions} diff --git a/doc/context/sources/general/manuals/luatex/luatex.tex b/doc/context/sources/general/manuals/luatex/luatex.tex index 24fcf979b..46739513a 100644 --- a/doc/context/sources/general/manuals/luatex/luatex.tex +++ b/doc/context/sources/general/manuals/luatex/luatex.tex @@ -1,4 +1,4 @@ -% macros=mkvi +% macros=mkvi engine=luatex % \nopdfcompression -- cgit v1.2.3