diff options
Diffstat (limited to 'tex')
19 files changed, 440 insertions, 367 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index b3055e1ae..a6c702685 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{2017.09.25 19:19} +\newcontextversion{2017.09.28 10:07} %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 9ae5d53b6..72af2dd25 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{2017.09.25 19:19} +\edef\contextversion{2017.09.28 10:07} %D For those who want to use this: diff --git a/tex/context/base/mkiv/back-pdf.mkiv b/tex/context/base/mkiv/back-pdf.mkiv index f59b59c29..70ffae197 100644 --- a/tex/context/base/mkiv/back-pdf.mkiv +++ b/tex/context/base/mkiv/back-pdf.mkiv @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +%D The less ther ei shere, the better. + \writestatus{loading}{ConTeXt Backend Macros / PDF} %registerctxluafile{lpdf-aux}{1.001} % common helpers @@ -37,8 +39,8 @@ \unprotect -%D We will minimize the number of calls to \PDF\ specific primitives -%D and delegate all management and injection of code to the backend. +%D We will minimize the number of calls to \PDF\ specific primitives and delegate +%D all management and injection of code to the backend. %D %D Here we initialize some internal quantities. We also protect them. @@ -71,8 +73,8 @@ \unexpanded\def\pdfannot{\clf_pdfannot} \unexpanded\def\pdfdest {\clf_pdfdest} -%D Here we do intercept (silently) what gets passed. One should use the -%D \CONTEXT\ interfaces instead. +%D Here we do intercept (silently) what gets passed. One should use the \CONTEXT\ +%D interfaces instead. \let\pdfcatalog \relax \newtoks\pdfcatalog \let\pdfinfo \relax \newtoks\pdfinfo @@ -84,8 +86,8 @@ \let\pdfxformattr \relax \newtoks\pdfxformattr \let\pdfxformresources\relax \newtoks\pdfxformresources -%D We use the \LUA\ interface (which then permits more control over -%D possible pdf/x extensions). +%D We use the \LUA\ interface (which then permits more control over possible pdf/x +%D extensions). \let\pdfcompresslevel \relax \newcount\pdfcompresslevel \let\pdfobjcompresslevel\relax \newcount\pdfobjcompresslevel @@ -157,9 +159,8 @@ \let\pdfxform \saveboxresource \let\pdfximage \saveimageresource -%D For the moment we keep these as they are but they will become \LUA\ -%D calls eventually, after which we will nil the three \type {\pdf} -%D interface primitives. +%D For the moment we keep these as they are but they will become \LUA\ calls +%D eventually, after which we will nil the three \type {\pdf} interface primitives. \normalprotected\def\pdfliteral {\pdfextension literal } \normalprotected\def\pdfobj {\pdfextension obj } @@ -169,8 +170,7 @@ \normalprotected\def\pdfsave {\pdfextension save\relax} \normalprotected\def\pdfsetmatrix{\pdfextension setmatrix } -%D This one can be consulted by users although the suffix is also -%D a system mode. +%D This one can be consulted by users although the suffix is also a system mode. \back_job_set_suffix{pdf} @@ -303,8 +303,8 @@ \unexpanded\def\dostartclipping#1#2#3% we can move this to lua and only set a box here {\forcecolorhack - \PointsToBigPoints{#2}\width - \PointsToBigPoints{#3}\height + \edef\width {\tobigpoints#2}% + \edef\height{\tobigpoints#3}% \meta_grab_clip_path{#1}\width\height{% 0 0 m % \width\space 0 l % @@ -323,252 +323,221 @@ %def\TransparencyHack{\ctxlua{backends.codeinjections.addtransparencygroup()}} \def\TransparencyHack{\setupcolors[\c!pagecolormodel=\v!auto]} -% \let\lastpredefinedsymbol\empty % some day we can do more at the lua end -% -% \unexpanded\def\predefinesymbol[#1]% -% {\begingroup -% \xdef\lastpredefinedsymbol{#1}% -% \settightobject{SYM}{#1}\hbox{\symbol[#1]}% to be checked ... maybe only fitting -% \dogetobjectreference{SYM}{#1}\m_back_object_reference -% \clf_registerbackendsymbol{#1}\m_back_object_reference\relax -% \endgroup} - % Still here: %D \macros %D {back_ovalbox} %D -%D Drawing frames with round corners is inherited from the -%D main module. -%D -%D For drawing ovals we use quite raw \PDF\ code. The next -%D implementation does not differ that much from the one -%D implemented in the \POSTSCRIPT\ driver. This code is -%D somewhat obsolete as we now have metapost embedded. - -% \def\back_oval_calculate#1#2#3% -% {\PointsToBigPoints{\dimexpr#2+#3\relax}#1} +%D Drawing frames with round corners is inherited from the main module. For drawing +%D ovals we use quite raw \PDF\ code. The next implementation does not differ that +%D much from the one implemented in the \POSTSCRIPT\ driver. This code is somewhat +%D obsolete as we now have metapost embedded. \unexpanded\def\back_ovalbox#1#2#3#4#5#6#7#8% {\forcecolorhack \bgroup -% \scratchdimen#4% -% \divide\scratchdimen\plustwo -% \back_oval_calculate\xmin \zeropoint\scratchdimen -% \back_oval_calculate\xmax {#1}{-\scratchdimen}% -% \back_oval_calculate\ymax {#2}{-\scratchdimen}% -% \back_oval_calculate\ymin {-#3}\scratchdimen -% \advance\scratchdimen by #5% -% \back_oval_calculate\xxmin \zeropoint\scratchdimen -% \back_oval_calculate\xxmax {#1}{-\scratchdimen}% -% \back_oval_calculate\yymax {#2}{-\scratchdimen}% -% \back_oval_calculate\yymin {-#3}\scratchdimen -% \back_oval_calculate\stroke{#4}\zeropoint -% \back_oval_calculate\radius{#5}\zeropoint - % - \PointsToBigPoints{#4} \stroke - \PointsToBigPoints{#5} \radius + \edef\stroke{\tobigpoints\dimexpr#4\relax\space}% + \edef\radius{\tobigpoints\dimexpr#5\relax\space}% \scratchdimen\dimexpr#4/\plustwo\relax - \PointsToBigPoints \scratchdimen \xmin - \PointsToBigPoints{\dimexpr #1-\scratchdimen}\xmax - \PointsToBigPoints{\dimexpr #2-\scratchdimen}\ymax - \PointsToBigPoints{\dimexpr-#3+\scratchdimen}\ymin + \edef\xmin {\tobigpoints \scratchdimen \space}% + \edef\xmax {\tobigpoints\dimexpr #1-\scratchdimen\relax\space}% + \edef\ymax {\tobigpoints\dimexpr #2-\scratchdimen\relax\space}% + \edef\ymin {\tobigpoints\dimexpr-#3+\scratchdimen\relax\space}% \advance\scratchdimen by #5\relax - \PointsToBigPoints \scratchdimen \xxmin - \PointsToBigPoints{\dimexpr #1-\scratchdimen}\xxmax - \PointsToBigPoints{\dimexpr #2-\scratchdimen}\yymax - \PointsToBigPoints{\dimexpr-#3+\scratchdimen}\yymin + \edef\xxmin{\tobigpoints \scratchdimen \space}% + \edef\xxmax{\tobigpoints\dimexpr #1-\scratchdimen\relax\space}% + \edef\yymax{\tobigpoints\dimexpr #2-\scratchdimen\relax\space}% + \edef\yymin{\tobigpoints\dimexpr-#3+\scratchdimen\relax\space}% % \edef\dostroke{\number#6}% - \edef\dofill{\number#7}% - \edef\mode{\number#8}% - % no \ifcase, else \relax in pdfcode + \edef\dofill {\number#7}% + \scratchcounter#8\relax \setbox\scratchbox\naturalhpack {\ifnum\dostroke\dofill>\zerocount \pdfliteral {q - \stroke\space w - \ifcase\mode\space - \xxmin\space \ymin \space m - \xxmax\space \ymin \space l - \xmax \space \ymin \space \xmax \space \yymin\space y - \xmax \space \yymax\space l - \xmax \space \ymax \space \xxmax\space \ymax \space y - \xxmin\space \ymax \space l - \xmin \space \ymax \space \xmin \space \yymax\space y - \xmin \space \yymin\space l - \xmin \space \ymin \space \xxmin\space \ymin \space y + \stroke w + \ifcase\scratchcounter + \xxmin \ymin m + \xxmax \ymin l + \xmax \ymin \xmax \yymin y + \xmax \yymax l + \xmax \ymax \xxmax \ymax y + \xxmin \ymax l + \xmin \ymax \xmin \yymax y + \xmin \yymin l + \xmin \ymin \xxmin \ymin y h \or % 1 - \xxmin\space \ymin \space m - \xxmax\space \ymin \space l - \xmax \space \ymin \space \xmax \space \yymin\space y - \xmax \space \ymax \space l - \xmin \space \ymax \space l - \xmin \space \yymin\space l - \xmin \space \ymin \space \xxmin\space \ymin \space y + \xxmin \ymin m + \xxmax \ymin l + \xmax \ymin \xmax \yymin y + \xmax \ymax l + \xmin \ymax l + \xmin \yymin l + \xmin \ymin \xxmin \ymin y h \or % 2 - \xxmin\space \ymin \space m - \xmax \space \ymin \space l - \xmax \space \ymax \space l - \xxmin\space \ymax \space l - \xmin \space \ymax \space \xmin \space \yymax\space y - \xmin \space \yymin\space l - \xmin \space \ymin \space \xxmin\space \ymin \space y + \xxmin \ymin m + \xmax \ymin l + \xmax \ymax l + \xxmin \ymax l + \xmin \ymax \xmin \yymax y + \xmin \yymin l + \xmin \ymin \xxmin \ymin y h \or % 3 - \xmin \space \ymin \space m - \xmax \space \ymin \space l - \xmax \space \yymax\space l - \xmax \space \ymax \space \xxmax\space \ymax \space y - \xxmin\space \ymax \space l - \xmin \space \ymax \space \xmin \space \yymax\space y - \xmin \space \ymin \space l + \xmin \ymin m + \xmax \ymin l + \xmax \yymax l + \xmax \ymax \xxmax \ymax y + \xxmin \ymax l + \xmin \ymax \xmin \yymax y + \xmin \ymin l h \or % 4 - \xmin \space \ymin \space m - \xxmax\space \ymin \space l - \xmax \space \ymin \space \xmax \space \yymin\space y - \xmax \space \yymax\space l - \xmax \space \ymax \space \xxmax\space \ymax \space y - \xmin \space \ymax \space l - \xmin \space \ymin\space l + \xmin \ymin m + \xxmax \ymin l + \xmax \ymin \xmax \yymin y + \xmax \yymax l + \xmax \ymax \xxmax \ymax y + \xmin \ymax l + \xmin \ymin l h \or % 5 - \xmin \space \ymin \space m - \xmax \space \ymin \space l - \xmax \space \yymax\space l - \xmax \space \ymax \space \xxmax\space \ymax \space y - \xmin \space \ymax \space l - \xmin \space \ymin \space l + \xmin \ymin m + \xmax \ymin l + \xmax \yymax l + \xmax \ymax \xxmax \ymax y + \xmin \ymax l + \xmin \ymin l h \or % 6 - \xmin \space \ymin \space m - \xxmax\space \ymin \space l - \xmax \space \ymin \space \xmax \space \yymin\space y - \xmax \space \ymax \space l - \xmin \space \ymax \space l - \xmin \space \ymin \space l + \xmin \ymin m + \xxmax \ymin l + \xmax \ymin \xmax \yymin y + \xmax \ymax l + \xmin \ymax l + \xmin \ymin l h - \or - \xxmin\space \ymin \space m - \xmax \space \ymin \space l - \xmax \space \ymax \space l - \xmin \space \ymax \space l - \xmin \space \yymin\space l - \xmin \space \ymin \space \xxmin\space \ymin \space y + \or % 7 + \xxmin \ymin m + \xmax \ymin l + \xmax \ymax l + \xmin \ymax l + \xmin \yymin l + \xmin \ymin \xxmin \ymin y h - \or - \xmin \space \ymin \space m - \xmax \space \ymin \space l - \xmax \space \ymax \space l - \xxmin\space \ymax \space l - \xmin \space \ymax \space \xmin \space \yymax\space y - \xmin \space \ymin \space l + \or % 8 + \xmin \ymin m + \xmax \ymin l + \xmax \ymax l + \xxmin \ymax l + \xmin \ymax \xmin \yymax y + \xmin \ymin l h \or % 9 top open - \xmin \space \ymax \space m - \xmin \space \yymin\space l - \xmin \space \ymin \space \xxmin\space \ymin \space y - \xxmax\space \ymin \space l - \xmax \space \ymin \space \xmax \space \yymin\space y - \xmax \space \ymax \space l + \xmin \ymax m + \xmin \yymin l + \xmin \ymin \xxmin \ymin y + \xxmax \ymin l + \xmax \ymin \xmax \yymin y + \xmax \ymax l \or % 10 right open - \xmax \space \ymax \space m - \xxmin\space \ymax \space l - \xmin \space \ymax \space \xmin \space \yymax\space y - \xmin \space \yymin\space l - \xmin \space \ymin \space \xxmin\space \ymin \space y - \xmax\space \ymin \space l + \xmax \ymax m + \xxmin \ymax l + \xmin \ymax \xmin \yymax y + \xmin \yymin l + \xmin \ymin \xxmin \ymin y + \xmax \ymin l \or % 11 bottom open - \xmax \space \ymin \space m - \xmax \space \yymax\space l - \xmax \space \ymax \space \xxmax \space \ymax\space y - \xxmin\space \ymax \space l - \xmin \space \ymax \space \xmin \space \yymax\space y - \xmin \space \ymin \space l + \xmax \ymin m + \xmax \yymax l + \xmax \ymax \xxmax \ymax y + \xxmin \ymax l + \xmin \ymax \xmin \yymax y + \xmin \ymin l \or % 12 left open - \xmin \space \ymax \space m - \xxmax\space \ymax \space l - \xmax \space \ymax \space \xmax \space \yymax\space y - \xmax \space \yymin\space l - \xmax \space \ymin \space \xxmax\space \ymin \space y - \xmin \space \ymin \space l + \xmin \ymax m + \xxmax \ymax l + \xmax \ymax \xmax \yymax y + \xmax \yymin l + \xmax \ymin \xxmax \ymin y + \xmin \ymin l \or % 13 - \xmin \space \ymax \space m - \xxmax\space \ymax \space l - \xmax \space \ymax \space \xmax \space \yymax\space y - \xmax\space \ymin \space l + \xmin \ymax m + \xxmax \ymax l + \xmax \ymax \xmax \yymax y + \xmax \ymin l \or % 14 - \xmax \space \ymax \space m - \xmax \space \yymin\space l - \xmax \space \ymin \space \xxmax\space \ymin \space y - \xmin \space \ymin \space l + \xmax \ymax m + \xmax \yymin l + \xmax \ymin \xxmax \ymin y + \xmin \ymin l \or % 15 - \xmax \space \ymin \space m - \xxmin\space \ymin \space l - \xmin \space \ymin \space \xmin \space \yymin\space y - \xmin \space \ymax \space l + \xmax \ymin m + \xxmin \ymin l + \xmin \ymin \xmin \yymin y + \xmin \ymax l \or % 16 - \xmin \space \ymin \space m - \xmin \space \yymax\space l - \xmin \space \ymax \space \xxmin\space \ymax \space y - \xmax \space \ymax \space l + \xmin \ymin m + \xmin \yymax l + \xmin \ymax \xxmin \ymax y + \xmax \ymax l \or % 17 - \xxmax\space \ymax \space m - \xmax \space \ymax \space \xmax \space \yymax\space y + \xxmax \ymax m + \xmax \ymax \xmax \yymax y \or % 18 - \xmax \space \yymin\space m - \xmax \space \ymin \space \xxmax\space \ymin \space y + \xmax \yymin m + \xmax \ymin \xxmax \ymin y \or % 19 - \xxmin\space \ymin \space m - \xmin \space \ymin \space \xmin \space \yymin\space y + \xxmin \ymin m + \xmin \ymin \xmin \yymin y \or % 20 - \xmin \space \yymax\space m - \xmin \space \ymax \space \xxmin\space \ymax \space y + \xmin \yymax m + \xmin \ymax \xxmin \ymax y \or % 21 - \xxmax\space \ymax \space m - \xmax \space \ymax \space \xmax \space \yymax\space y - \xmin \space \yymax\space m - \xmin \space \ymax \space \xxmin\space \ymax \space y + \xxmax \ymax m + \xmax \ymax \xmax \yymax y + \xmin \yymax m + \xmin \ymax \xxmin \ymax y \or % 22 - \xxmax\space \ymax \space m - \xmax \space \ymax \space \xmax \space \yymax\space y - \xmax \space \yymin\space m - \xmax \space \ymin \space \xxmax\space \ymin \space y + \xxmax \ymax m + \xmax \ymax \xmax \yymax y + \xmax \yymin m + \xmax \ymin \xxmax \ymin y \or % 23 - \xmax \space \yymin\space m - \xmax \space \ymin \space \xxmax\space \ymin \space y - \xxmin\space \ymin \space m - \xmin \space \ymin \space \xmin \space \yymin\space y + \xmax \yymin m + \xmax \ymin \xxmax \ymin y + \xxmin \ymin m + \xmin \ymin \xmin \yymin y \or % 24 - \xxmin\space \ymin \space m - \xmin \space \ymin \space \xmin \space \yymin\space y - \xmin \space \yymax\space m - \xmin \space \ymax \space \xxmin\space \ymax \space y + \xxmin \ymin m + \xmin \ymin \xmin \yymin y + \xmin \yymax m + \xmin \ymax \xxmin \ymax y \or % 25 - \xxmax\space \ymax \space m - \xmax \space \ymax \space \xmax \space \yymax\space y - \xmax \space \yymin\space m - \xmax \space \ymin \space \xxmax\space \ymin \space y - \xxmin\space \ymin \space m - \xmin \space \ymin \space \xmin \space \yymin\space y - \xmin \space \yymax\space m - \xmin \space \ymax \space \xxmin\space \ymax \space y + \xxmax \ymax m + \xmax \ymax \xmax \yymax y + \xmax \yymin m + \xmax \ymin \xxmax \ymin y + \xxmin \ymin m + \xmin \ymin \xmin \yymin y + \xmin \yymax m + \xmin \ymax \xxmin \ymax y \or % 26 - \xmax \space \yymin\space m - \xmax \space \ymin \space \xxmax\space \ymin \space y - \xmin \space \yymax\space m - \xmin \space \ymax \space \xxmin\space \ymax \space y + \xmax \yymin m + \xmax \ymin \xxmax \ymin y + \xmin \yymax m + \xmin \ymax \xxmin \ymax y \or % 27 - \xxmax\space \ymax \space m - \xmax \space \ymax \space \xmax \space \yymax\space y - \xxmin\space \ymin \space m - \xmin \space \ymin \space \xmin \space \yymin\space y + \xxmax \ymax m + \xmax \ymax \xmax \yymax y + \xxmin \ymin m + \xmin \ymin \xmin \yymin y \or % 28 \fi - \ifnum\mode>\pluseight\space + \ifnum\scratchcounter>\pluseight S \else \ifnum\dostroke=\plusone S \fi @@ -594,14 +563,3 @@ % \stoptext \protect \endinput - -% \chapter{FIRST} -% -% \goto{bar}[bar] -% -% HERE \pdfannot width 20pt height 20pt depth 20pt {/Subtype /Link /Dest (bar) /Border [1 1 1] /F 4}\par -% HERE \pdfannot width 20pt height 20pt depth 20pt {/Subtype /Link /Dest (foo) /Border [1 1 1] /F 4}\par -% -% \chapter[bar]{SECOND} -% -% THERE \pdfdest name {foo} \par diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 493147baa..a37e7187f 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{2017.09.25 19:19} +\newcontextversion{2017.09.28 10:07} %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 6707a66bf..fb967c947 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -41,7 +41,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.09.25 19:19} +\edef\contextversion{2017.09.28 10:07} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/data-sch.lua b/tex/context/base/mkiv/data-sch.lua index 9d36c882a..f6801cb4d 100644 --- a/tex/context/base/mkiv/data-sch.lua +++ b/tex/context/base/mkiv/data-sch.lua @@ -16,6 +16,8 @@ local report_schemes = logs.reporter("resolvers","schemes") local http = require("socket.http") local ltn12 = require("ltn12") +if mbox then mbox = nil end -- useless and even bugged (helper overwrites lib) + local resolvers = resolvers local schemes = resolvers.schemes or { } resolvers.schemes = schemes diff --git a/tex/context/base/mkiv/font-otc.lua b/tex/context/base/mkiv/font-otc.lua index 1d0db7b81..8059ad272 100644 --- a/tex/context/base/mkiv/font-otc.lua +++ b/tex/context/base/mkiv/font-otc.lua @@ -10,6 +10,7 @@ local format, insert, sortedkeys, tohash = string.format, table.insert, table.so local type, next = type, next local lpegmatch = lpeg.match local utfbyte, utflen, utfsplit = utf.byte, utf.len, utf.split +local match = string.match -- we assume that the other otf stuff is loaded already @@ -1031,7 +1032,8 @@ registerotffeature { local lookups = { } local protect = { } local revert = { } -local zwj = { 0x200C } +local zwjchar = 0x200C +local zwj = { zwjchar } otf.addfeature { name = "blockligatures", @@ -1075,21 +1077,49 @@ registerotffeature { local settings_to_array = utilities.parsers and utilities.parsers.settings_to_array or function(s) return string.split(s,",") end -- for generic +local splitter = lpeg.splitat(":") + local function blockligatures(str) local t = settings_to_array(str) for i=1,#t do - local ti = utfsplit(t[i]) - if #ti > 1 then - local one = ti[1] - local two = ti[2] - lookups[one] = { one, 0x200C } + local ti = t[i] + local before, current, after = lpegmatch(splitter,ti) + if current and after then -- before is returned when no match + -- experimental joke + if before then + before = utfsplit(before) + for i=1,#before do + before[i] = { before[i] } + end + end + if current then + current = utfsplit(current) + end + if after then + after = utfsplit(after) + for i=1,#after do + after[i] = { after[i] } + end + end + + else + before = nil + current = utfsplit(ti) + after = nil + end + if #current > 1 then + local one = current[1] + local two = current[2] + lookups[one] = { one, zwjchar } local one = { one } local two = { two } local new = #protect + 1 protect[new] = { + before = before, current = { one, two }, + after = after, lookups = { 1 }, -- not shared ! } revert[new] = { @@ -1099,7 +1129,6 @@ local function blockligatures(str) } end end - end -- blockligatures("\0\0") @@ -1108,6 +1137,7 @@ otf.helpers.blockligatures = blockligatures -- blockligatures("fi,ff") -- blockligatures("fl") +-- blockligatures("u:fl:age") if context then diff --git a/tex/context/base/mkiv/grph-inc.mkiv b/tex/context/base/mkiv/grph-inc.mkiv index 3c4d3b980..5865c7702 100644 --- a/tex/context/base/mkiv/grph-inc.mkiv +++ b/tex/context/base/mkiv/grph-inc.mkiv @@ -65,8 +65,8 @@ \c!symbol =\v!no, \c!controls =\v!no, \c!resources =, - \c!preview =\v!no - \c!repeat =\v!no + \c!preview =\v!no, + \c!repeat =\v!no, \c!foregroundcolor=, \c!interaction =\v!none, \c!hfactor =, @@ -118,14 +118,14 @@ % \useexternalfigure[gamma][cow][alpha] % \useexternalfigure[delta][cow][alpha][width=2cm] % -% volle breedte: \externalfigure[cow] \par -% 3cm breed: \externalfigure[cow] [width=3cm] \par -% volle breedte: \externalfigure[alpha] \par -% 1cm breed: \externalfigure[beta] \par -% volle breedte: \externalfigure[gamma] \par -% 2cm breed: \externalfigure[delta] \par -% 4cm breed: \externalfigure[beta] [width=4cm] \par -% 5cm breed: \externalfigure[gamma][width=5cm] \par +% full width : \externalfigure[cow] \par +% 3cm width : \externalfigure[cow] [width=3cm] \par +% full width : \externalfigure[alpha] \par +% 1cm width : \externalfigure[beta] \par +% full width : \externalfigure[gamma] \par +% 2cm width : \externalfigure[delta] \par +% 4cm width : \externalfigure[beta] [width=4cm] \par +% 5cm width : \externalfigure[gamma][width=5cm] \par % % \defineexternalfigure[a][width=10cm] % \defineexternalfigure[b][width=5cm] @@ -153,14 +153,13 @@ % % \defineexternalfigure[name][settings] -%D Defining is persistent, i.e.\ when you redefine an instance, -%D the already set parameters need to be set again or otherwise -%D the old values will be used. - +%D Defining is persistent, i.e.\ when you redefine an instance, the already set +%D parameters need to be set again or otherwise the old values will be used. +%D %D New: \type {method=auto}: strips suffix and uses \quote {order} which is handy in -%D some of four workflows where sources are used for web and print and where -%D the web tools need a suffix (like gif) which we don't want as we want a high -%D quality format. +%D some of four workflows where sources are used for web and print and where the web +%D tools need a suffix (like gif) which we don't want as we want a high quality +%D format. \newconditional\c_grph_include_trace_inheritance @@ -910,9 +909,10 @@ \protect \endinput -% Moved here because this already old code is nowhere documents (so I need to -% check it: +%D Moved here because this already old code is nowhere documents (so I need to check +%D it: % +% \starttyping % \starttext % % \startluaparameterset [u3d:myset:controls:1] diff --git a/tex/context/base/mkiv/l-lpeg.lua b/tex/context/base/mkiv/l-lpeg.lua index 5fef7439d..81d13433d 100644 --- a/tex/context/base/mkiv/l-lpeg.lua +++ b/tex/context/base/mkiv/l-lpeg.lua @@ -843,48 +843,42 @@ end local p_false = P(false) local p_true = P(true) --- local function making(t) --- local p = p_false --- local keys = sortedkeys(t) --- for i=1,#keys do --- local k = keys[i] --- if k ~= "" then +-- local function collapse(t,x) +-- if type(t) ~= "table" then +-- return t, x +-- else +-- local n = next(t) +-- if n == nil then +-- return t, x +-- elseif next(t,n) == nil then +-- -- one entry +-- local k = n -- local v = t[k] --- if v == true then --- p = p + P(k) * p_true --- elseif v == false then --- -- can't happen +-- if type(v) == "table" then +-- return collapse(v,x..k) -- else --- p = p + P(k) * making(v) +-- return v, x .. k -- end --- end --- end --- if t[""] then --- p = p + p_true --- end --- return p --- end - --- local function make(t) --- local p = p_false --- local keys = sortedkeys(t) --- for i=1,#keys do --- local k = keys[i] --- if k ~= "" then --- local v = t[k] --- if v == true then --- p = p + P(k) * p_true --- elseif v == false then --- -- can't happen --- else --- p = p + P(k) * making(v) +-- else +-- local tt = { } +-- for k, v in next, t do +-- local vv, kk = collapse(v,k) +-- tt[kk] = vv -- end +-- return tt, x -- end -- end --- return p -- end -local function make(t,rest) +local lower = utf and utf.lower or string.lower +local upper = utf and utf.upper or string.upper + +function lpeg.setutfcasers(l,u) + lower = l or lower + upper = u or upper +end + +local function make1(t,rest) local p = p_false local keys = sortedkeys(t) for i=1,#keys do @@ -896,7 +890,7 @@ local function make(t,rest) elseif v == false then -- can't happen else - p = p + P(k) * make(v,v[""]) + p = p + P(k) * make1(v,v[""]) end end end @@ -906,34 +900,29 @@ local function make(t,rest) return p end -local function collapse(t,x) - if type(t) ~= "table" then - return t, x - else - local n = next(t) - if n == nil then - return t, x - elseif next(t,n) == nil then - -- one entry - local k = n +local function make2(t,rest) -- only ascii + local p = p_false + local keys = sortedkeys(t) + for i=1,#keys do + local k = keys[i] + if k ~= "" then local v = t[k] - if type(v) == "table" then - return collapse(v,x..k) + if v == true then + p = p + (P(lower(k))+P(upper(k))) * p_true + elseif v == false then + -- can't happen else - return v, x .. k + p = p + (P(lower(k))+P(upper(k))) * make2(v,v[""]) end - else - local tt = { } - for k, v in next, t do - local vv, kk = collapse(v,k) - tt[kk] = vv - end - return tt, x end end + if rest then + p = p + p_true + end + return p end -function lpeg.utfchartabletopattern(list) -- goes to util-lpg +function lpeg.utfchartabletopattern(list,insensitive) -- goes to util-lpg local tree = { } local n = #list if n == 0 then @@ -1006,9 +995,9 @@ function lpeg.utfchartabletopattern(list) -- goes to util-lpg end end end --- collapse(tree,"") -- needs testing, maybe optional, slightly faster because P("x")*P("X") seems slower than P"(xX") (why) --- inspect(tree) - return make(tree) + -- collapse(tree,"") -- needs testing, maybe optional, slightly faster because P("x")*P("X") seems slower than P"(xX") (why) + -- inspect(tree) + return (insensitive and make2 or make1)(tree) end -- local t = { "start", "stoep", "staart", "paard" } diff --git a/tex/context/base/mkiv/lang-rep.lua b/tex/context/base/mkiv/lang-rep.lua index f7eeefdba..a09574ef4 100644 --- a/tex/context/base/mkiv/lang-rep.lua +++ b/tex/context/base/mkiv/lang-rep.lua @@ -16,6 +16,7 @@ if not modules then modules = { } end modules ['lang-rep'] = { -- is somewhat unique. local type, tonumber = type, tonumber +local gmatch, gsub = string.gmatch, string.gsub local utfbyte, utfsplit = utf.byte, utf.split local P, C, U, Cc, Ct, Cs, lpegmatch = lpeg.P, lpeg.C, lpeg.patterns.utf8character, lpeg.Cc, lpeg.Ct, lpeg.Cs, lpeg.match local find = string.find @@ -140,6 +141,26 @@ function replacements.add(category,word,replacement) end end +-- local strip = lpeg.stripper("{}") + +function languages.replacements.addlist(category,list) + local root = lists[category].list + if type(list) == "string" then + for new in gmatch(list,"%S+") do + local old = gsub(new,"[{}]","") + -- local old = lpegmatch(strip,new) + add(root,old,new) + end + else + for i=1,#list do + local new = list[i] + local old = gsub(new,"[{}]","") + -- local old = lpegmatch(strip,new) + add(root,old,new) + end + end +end + local function hit(a,head) local tree = trees[a] if tree then @@ -336,3 +357,9 @@ implement { actions = replacements.add, arguments = { "string", "string", "string" } } + +implement { + name = "addreplacementslist", + actions = replacements.addlist, + arguments = { "string", "string" } +} diff --git a/tex/context/base/mkiv/lang-rep.mkiv b/tex/context/base/mkiv/lang-rep.mkiv index 48e1fd44b..cdb98a154 100644 --- a/tex/context/base/mkiv/lang-rep.mkiv +++ b/tex/context/base/mkiv/lang-rep.mkiv @@ -57,12 +57,14 @@ {\attribute\replacementsattribute\attributeunsetvalue} \unexpanded\def\replaceword - {\dotripleargument\languages_replacements_replace} + {\dotripleempty\languages_replacements_replace} \unexpanded\def\languages_replacements_replace[#1][#2][#3]% {\ifthirdargument \clf_addreplacements{#1}{#2}{#3}% - \fi} + \else\ifsecondargument + \clf_addreplacementslist{#1}{#2}% + \fi\fi} \appendtoks \resetreplacements diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 80163a4be..0fdfef63f 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 0a429d4d3..89a249d31 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/syst-aux.lua b/tex/context/base/mkiv/syst-aux.lua index f19dbfdb7..b5ebe1681 100644 --- a/tex/context/base/mkiv/syst-aux.lua +++ b/tex/context/base/mkiv/syst-aux.lua @@ -652,3 +652,18 @@ implement { -- context(s) -- end -- } + +local bp = number.dimenfactors.bp + +interfaces.implement { + name = "tobigpoints", + actions = function(d) context("%.5F",bp * d) end, + arguments = "dimension", +} + +interfaces.implement { + name = "towholebigpoints", + actions = function(d) context("%r",bp * d) end, + arguments = "dimension", +} + diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv index 5fd515da9..dcad3b873 100644 --- a/tex/context/base/mkiv/syst-aux.mkiv +++ b/tex/context/base/mkiv/syst-aux.mkiv @@ -6111,40 +6111,46 @@ %D \macros %D {ScaledPointsToBigPoints,ScaledPointsToWholeBigPoints} %D -%D One characteristic of \POSTSCRIPT\ and \PDF\ is that both -%D used big points (\TEX's bp). The next macros convert points -%D and scaled points into big points. +%D One characteristic of \POSTSCRIPT\ and \PDF\ is that both used big points (\TEX's +%D bp). The next macros convert points and scaled points into big points. The magic +%D factor $72/72.27$ can be found in most \TEX\ related books. %D %D \starttyping %D \ScaledPointsToBigPoints {number} \target %D \ScaledPointsToWholeBigPoints {number} \target %D \stoptyping %D -%D The magic factor $72/72.27$ can be found in most \TEX\ -%D related books. -% \PointsToBigPoints{10.53940pt}\test \test -% \PointsToBigPoints{10.53941pt}\test \test -% \PointsToBigPoints{10.53942pt}\test \test +%D In pure \TEX: -% \PointsToWholeBigPoints{10.53940pt}\test \test -% \PointsToWholeBigPoints{10.53941pt}\test \test -% \PointsToWholeBigPoints{10.53942pt}\test \test +% \unexpanded\def\PointsToBigPoints#1#2% +% {\edef#2{\withoutpt\the\dimexpr.996264\dimexpr#1\relax\relax}} +% +% \unexpanded\def\PointsToWholeBigPoints#1#2% +% {\edef#2{\the\numexpr\dimexpr.996264\dimexpr#1\relax\relax/\maxcard\relax}} +% +% \unexpanded\def\ScaledPointsToBigPoints#1% % #2 +% {\PointsToBigPoints{\number#1\scaledpoint}} % {#2} +% +% \unexpanded\def\ScaledPointsToWholeBigPoints#1% % #2 +% {\PointsToWholeBigPoints{\number#1\scaledpoint}} % {#2} -\unexpanded\def\PointsToBigPoints#1#2% - {\edef#2{\withoutpt\the\dimexpr.996264\dimexpr#1\relax\relax}} +%D This is slower but cleaner and more accurate too. The only place these are still +%D used is in a few backend related macros. -\unexpanded\def\PointsToWholeBigPoints#1#2% - {\edef#2{\the\numexpr\dimexpr.996264\dimexpr#1\relax\relax/\maxcard\relax}} +\let\tobigpoints \clf_tobigpoints +\let\towholebigpoints\clf_towholebigpoints -\unexpanded\def\ScaledPointsToBigPoints #1{\PointsToBigPoints {\number#1\scaledpoint}} -\unexpanded\def\ScaledPointsToWholeBigPoints#1{\PointsToWholeBigPoints{\number#1\scaledpoint}} +\unexpanded\def\PointsToBigPoints #1#2{\edef#2{\tobigpoints #1}} % can be avoided +\unexpanded\def\PointsToWholeBigPoints #1#2{\edef#2{\towholebigpoints#1}} % can be avoided +\unexpanded\def\ScaledPointsToBigPoints #1#2{\edef#2{\tobigpoints #1\scaledpoint}} % obsolete +\unexpanded\def\ScaledPointsToWholeBigPoints#1#2{\edef#2{\towholebigpoints#1\scaledpoint}} % obsolete %D \macros %D {PointsToReal} %D -%D Points can be stripped from their suffix by using -%D \type{\withoutpt}. The next macro enveloppes this macro. +%D Points can be stripped from their suffix by using \type {\withoutpt}. The next +%D macro enveloppes this macro. %D %D \starttyping %D \PointsToReal {dimension} \target diff --git a/tex/context/base/mkiv/trac-log.lua b/tex/context/base/mkiv/trac-log.lua index 25f30f25a..c7b6f6d2d 100644 --- a/tex/context/base/mkiv/trac-log.lua +++ b/tex/context/base/mkiv/trac-log.lua @@ -1070,15 +1070,6 @@ if tex then insert(finalactions,...) -- so we can force an order if needed end - function logs.finalactions() - if #finalactions > 0 then - for i=1,#finalactions do - finalactions[i]() - end - return next(possiblefatal) and sortedkeys(possiblefatal) or false - end - end - local what = nil local report = nil local state = nil @@ -1119,14 +1110,39 @@ if tex then return startlogging("logfile", ...) end + logs.stopfilelogging = stoplogging + + local done = false + function logs.starterrorlogging(r,w,...) + if not done then + pushtarget("terminal") + newline() + logs.report("error logging","start possible issues") + poptarget() + done = true + end if fatalerrors[w] then possiblefatal[w] = true end return startlogging("terminal",r,w,...) end - logs.stopfilelogging = stoplogging logs.stoperrorlogging = stoplogging + function logs.finalactions() + if #finalactions > 0 then + for i=1,#finalactions do + finalactions[i]() + end + if done then + pushtarget("terminal") + newline() + logs.report("error logging","stop possible issues") + poptarget() + end + return next(possiblefatal) and sortedkeys(possiblefatal) or false + end + end + end diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 7e1e6dd8d..5c5e1d2af 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 607388fa5..1dc3ae1a7 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 a6397043b..38e94a091 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/25/17 19:19:22 +-- merge date : 09/28/17 10:07:40 do -- begin closure to overcome local limits and interference @@ -691,7 +691,13 @@ function lpeg.append(list,pp,delayed,checked) end local p_false=P(false) local p_true=P(true) -local function make(t,rest) +local lower=utf and utf.lower or string.lower +local upper=utf and utf.upper or string.upper +function lpeg.setutfcasers(l,u) + lower=l or lower + upper=u or upper +end +local function make1(t,rest) local p=p_false local keys=sortedkeys(t) for i=1,#keys do @@ -702,7 +708,7 @@ local function make(t,rest) p=p+P(k)*p_true elseif v==false then else - p=p+P(k)*make(v,v[""]) + p=p+P(k)*make1(v,v[""]) end end end @@ -711,32 +717,27 @@ local function make(t,rest) end return p end -local function collapse(t,x) - if type(t)~="table" then - return t,x - else - local n=next(t) - if n==nil then - return t,x - elseif next(t,n)==nil then - local k=n +local function make2(t,rest) + local p=p_false + local keys=sortedkeys(t) + for i=1,#keys do + local k=keys[i] + if k~="" then local v=t[k] - if type(v)=="table" then - return collapse(v,x..k) + if v==true then + p=p+(P(lower(k))+P(upper(k)))*p_true + elseif v==false then else - return v,x..k + p=p+(P(lower(k))+P(upper(k)))*make2(v,v[""]) end - else - local tt={} - for k,v in next,t do - local vv,kk=collapse(v,k) - tt[kk]=vv - end - return tt,x end end + if rest then + p=p+p_true + end + return p end -function lpeg.utfchartabletopattern(list) +function lpeg.utfchartabletopattern(list,insensitive) local tree={} local n=#list if n==0 then @@ -807,7 +808,7 @@ function lpeg.utfchartabletopattern(list) end end end - return make(tree) + return (insensitive and make2 or make1)(tree) end patterns.containseol=lpeg.finder(eol) local function nextstep(n,step,result) @@ -28763,6 +28764,7 @@ local format,insert,sortedkeys,tohash=string.format,table.insert,table.sortedkey local type,next=type,next local lpegmatch=lpeg.match local utfbyte,utflen,utfsplit=utf.byte,utf.len,utf.split +local match=string.match local trace_loading=false trackers.register("otf.loading",function(v) trace_loading=v end) local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts @@ -29582,7 +29584,8 @@ registerotffeature { local lookups={} local protect={} local revert={} -local zwj={ 0x200C } +local zwjchar=0x200C +local zwj={ zwjchar } otf.addfeature { name="blockligatures", type="chainsubstitution", @@ -29621,19 +29624,44 @@ registerotffeature { } local settings_to_array=utilities.parsers and utilities.parsers.settings_to_array or function(s) return string.split(s,",") end +local splitter=lpeg.splitat(":") local function blockligatures(str) local t=settings_to_array(str) for i=1,#t do - local ti=utfsplit(t[i]) - if #ti>1 then - local one=ti[1] - local two=ti[2] - lookups[one]={ one,0x200C } + local ti=t[i] + local before,current,after=lpegmatch(splitter,ti) + if current and after then + if before then + before=utfsplit(before) + for i=1,#before do + before[i]={ before[i] } + end + end + if current then + current=utfsplit(current) + end + if after then + after=utfsplit(after) + for i=1,#after do + after[i]={ after[i] } + end + end + else + before=nil + current=utfsplit(ti) + after=nil + end + if #current>1 then + local one=current[1] + local two=current[2] + lookups[one]={ one,zwjchar } local one={ one } local two={ two } local new=#protect+1 protect[new]={ + before=before, current={ one,two }, + after=after, lookups={ 1 }, } revert[new]={ |