diff options
Diffstat (limited to 'tex')
37 files changed, 377 insertions, 130 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 76ad69c75..939c9d616 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{2020.08.11 15:56} +\newcontextversion{2020.08.13 19:42} %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 3937f8327..fede76b63 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{2020.08.11 15:56} +\edef\contextversion{2020.08.13 19:42} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-ro.mkii b/tex/context/base/mkii/mult-ro.mkii index ba3e165d8..871cc3d30 100644 --- a/tex/context/base/mkii/mult-ro.mkii +++ b/tex/context/base/mkii/mult-ro.mkii @@ -954,6 +954,7 @@ \setinterfaceconstant{limittext}{limittext} \setinterfaceconstant{line}{linie} \setinterfaceconstant{linecorrection}{corectielinie} +\setinterfaceconstant{linedirection}{linedirection} \setinterfaceconstant{lines}{linii} \setinterfaceconstant{list}{lista} \setinterfaceconstant{listtext}{listtext} diff --git a/tex/context/base/mkiv/back-out.lmt b/tex/context/base/mkiv/back-out.lmt index 7d3ab3078..832e93a14 100644 --- a/tex/context/base/mkiv/back-out.lmt +++ b/tex/context/base/mkiv/back-out.lmt @@ -43,6 +43,8 @@ local pageliteral_code = literalvalues.page local directliteral_code = literalvalues.direct local rawliteral_code = literalvalues.raw +local immediate_code = tex.prefixcodes.immediate + local nodeproperties = nodes.properties.data local channels = { } @@ -66,7 +68,7 @@ local open_command, write_command, close_command backends = backends or { } local function immediately(prefix) - return prefix and (prefix & 8) ~= 0 + return prefix and (prefix & immediate_code) ~= 0 end local function openout(prefix) diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua index 9afe4c723..e64381f49 100644 --- a/tex/context/base/mkiv/cldf-ini.lua +++ b/tex/context/base/mkiv/cldf-ini.lua @@ -1712,8 +1712,15 @@ do local modelevels = tex.getmodevalues() local t = table.keys(modelevels) - tex.modelevels = table.swapped(modelevels,modelevels) + tex.modelevels = table.swapped(modelevels,modelevels) -- utilities.storage.allocate() for i=1,#t do local k = t[i] modelevels[-k] = modelevels[k] end + if CONTEXTLMTXMODE > 0 then + + local prefixcodes = tex.getprefixvalues() + tex.prefixcodes = table.swapped(prefixcodes,prefixcodes) -- utilities.storage.allocate() + + end + end diff --git a/tex/context/base/mkiv/cldf-lmt.lmt b/tex/context/base/mkiv/cldf-lmt.lmt index f0ed8a40d..6a9353d2e 100644 --- a/tex/context/base/mkiv/cldf-lmt.lmt +++ b/tex/context/base/mkiv/cldf-lmt.lmt @@ -44,6 +44,8 @@ local skipnext = scanners.skip local getindex = token.get_index local texsetdimen = tex.setdimen +local texsetcount = tex.setcount +local texgetcount = tex.getcount local texget = tex.get local values = tokens.values @@ -55,6 +57,8 @@ local skip_code = values.skip local boolean_code = values.boolean local float_code = values.float +local global_code = tex.prefixcodes.global + local context = context -- variables -- @@ -807,7 +811,7 @@ implement { actions = function(what) local a = scancardinal() if what == "value" then - return cardinal_code, ~ a + return cardinal_code, ~a & 0xFFFFFFFF else youcant("bitwisenot") end @@ -823,7 +827,7 @@ implement { scankeyword("with") local b = scancardinal() if what == "value" then - return cardinal_code, a & (~ b) + return cardinal_code, a & (~b & 0xFFFFFFFF) else youcant("bitwisenil") end @@ -831,6 +835,47 @@ implement { } implement { + name = "bitwiseshift", + public = true, + usage = "value", + actions = function(what) + local a = scancardinal() + scankeyword("by") + local b = scaninteger() + if what == "value" then + return cardinal_code, (b < 0) and (a << -b) or (a >> b) + else + youcant("bitwiseshift") + end + end +} + +implement { + name = "bitwiseflip", + public = true, + usage = "value", + actions = function(what) + local t = scancsname() + local b = scaninteger() + local c = texgetcount(t) + if c then + if b > 0 then + c = c | b + elseif b < 0 then + c = c & (~(-b) & 0xFFFFFFFF) + end + if what == "value" then + return cardinal_code, c + elseif what and (what & global_code) ~= 0 then + texsetcount("global",t,c) + else + texsetcount(t,c) + end + end + end +} + +implement { name = "ifbitwiseand", public = true, usage = "condition", diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 92ff8565e..0f6ad84f5 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2020.08.11 15:56} +\newcontextversion{2020.08.13 19:42} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 367f7ea0f..cee7d0ebc 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2020.08.11 15:56} +\edef\contextversion{2020.08.13 19:42} %D Kind of special: diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl index 4f413f726..c344a48d1 100644 --- a/tex/context/base/mkiv/context.mkxl +++ b/tex/context/base/mkiv/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2020.08.11 15:56} +\edef\contextversion{2020.08.13 19:42} %D Kind of special: @@ -423,7 +423,7 @@ \loadmarkfile{typo-spa} \loadmarkfile{typo-krn} \loadmkvifile{typo-itc} -\loadmarkfile{typo-dir} +\loadmkxlfile{typo-dir} \loadmarkfile{typo-brk} \loadmarkfile{typo-cap} \loadmarkfile{typo-dig} diff --git a/tex/context/base/mkiv/font-nod.lua b/tex/context/base/mkiv/font-nod.lua index ad61d7111..bf0aa3ba0 100644 --- a/tex/context/base/mkiv/font-nod.lua +++ b/tex/context/base/mkiv/font-nod.lua @@ -294,7 +294,6 @@ function step_tracers.glyphs(n,i) end function step_tracers.features() - -- we cannot use first_glyph here as it only finds characters with subtype < 256 local f = collection[1] for n, char, font in nextglyph, f do local tfmdata = fontidentifiers[font] diff --git a/tex/context/base/mkiv/font-vfc.lua b/tex/context/base/mkiv/font-vfc.lua index dfe6b3afc..eff0aa6c6 100644 --- a/tex/context/base/mkiv/font-vfc.lua +++ b/tex/context/base/mkiv/font-vfc.lua @@ -13,7 +13,7 @@ local fonts = fonts local helpers = fonts.helpers local setmetatableindex = table.setmetatableindex -local makeweak = table.makeweak +----- makeweak = table.makeweak -- Helpers dealing with virtual fonts: beware, these are final values so -- don't change the content of tables gotten this way! diff --git a/tex/context/base/mkiv/lang-hyp.mkiv b/tex/context/base/mkiv/lang-hyp.mkiv index 9301fd1d8..fbd83fe0c 100644 --- a/tex/context/base/mkiv/lang-hyp.mkiv +++ b/tex/context/base/mkiv/lang-hyp.mkiv @@ -45,8 +45,10 @@ \newcount\compoundhyphenpenalty -\automatichyphenmode \plusone -\hyphenpenaltymode \plusfour +\ifcase\contextlmtxmode + \hyphenpenaltymode\plusfour + \automatichyphenmode\plusone +\fi \hyphenpenalty 50 % hyphenator \automatichyphenpenalty 50 % - diff --git a/tex/context/base/mkiv/lang-ini.mkiv b/tex/context/base/mkiv/lang-ini.mkiv index 45aea36fb..ffa280b05 100644 --- a/tex/context/base/mkiv/lang-ini.mkiv +++ b/tex/context/base/mkiv/lang-ini.mkiv @@ -723,9 +723,16 @@ %D New: -\unexpanded\def\traceddiscretionary#1#2#3% - {\dontleavehmode - \discretionary{\darkred#1}{\darkgreen#2}{\darkblue#3}} +\unexpanded\def\traceddiscretionary#1#% + {\dontleavehmode\lang_basics_traced_discretionary{#1}} + +\unexpanded\def\lang_basics_traced_discretionary#1#2#3#4% + {\normaldiscretionary#1{\darkred#2}{\darkgreen#3}{\darkblue#4}} + +\installtextracker + {discretionaries} + {\let\discretionary\traceddiscretionary} + {\let\discretionary\normaldiscretionary} \unexpanded\def\samplediscretionary {\traceddiscretionary @@ -733,6 +740,4 @@ {\clf_currentposthyphenchar post}% {replace}} -% todo: make this configurable - \protect \endinput diff --git a/tex/context/base/mkiv/lang-ini.mkxl b/tex/context/base/mkiv/lang-ini.mkxl index 3afbf5680..87b3f3064 100644 --- a/tex/context/base/mkiv/lang-ini.mkxl +++ b/tex/context/base/mkiv/lang-ini.mkxl @@ -418,11 +418,17 @@ % \uchyph\plusone : \chardef \completehyphenationmodecode \numexpr - \normalhyphenationmodecode % \discretionary - + \automatichyphenationmodecode % - - + \explicithyphenationmodecode % \- - + \syllablehyphenationmodecode % pattern driven - + \uppercasehyphenationmodecode % uchyph + \normalhyphenationmodecode % \discretionary + + \automatichyphenationmodecode % - + + \explicithyphenationmodecode % \- + + \syllablehyphenationmodecode % pattern driven + + \uppercasehyphenationmodecode % replaces \uchyph + + \compoundhyphenationmodecode % replaces \compoundhyphenmode + % \strictstarthyphenationmodecode % replaces \hyphenationbounds (strict = original tex) + % \strictendhyphenationmodecode % replaces \hyphenationbounds (strict = original tex) + + \automaticpenaltyhyphenationmodecode % replaces \hyphenpenaltymode (otherwise use \exhyphenpenalty) + + \explicitpenaltyhyphenationmodecode % replaces \hyphenpenaltymode (otherwise use \exhyphenpenalty) + + \permitgluehyphenationmodecode % turn glue into kern in \discretionary \relax \unexpanded\def\dohyphens{\hyphenationmode\completehyphenationmodecode} @@ -728,9 +734,16 @@ %D New: -\unexpanded\def\traceddiscretionary#1#2#3% - {\dontleavehmode - \discretionary{\darkred#1}{\darkgreen#2}{\darkblue#3}} +\unexpanded\def\traceddiscretionary#1#% + {\dontleavehmode\lang_basics_traced_discretionary{#1}} + +\unexpanded\def\lang_basics_traced_discretionary#1#2#3#4% + {\normaldiscretionary#1{\darkred#2}{\darkgreen#3}{\darkblue#4}} + +\installtextracker + {discretionaries} + {\let\discretionary\traceddiscretionary} + {\let\discretionary\normaldiscretionary} \unexpanded\def\samplediscretionary {\traceddiscretionary @@ -738,6 +751,4 @@ {\clf_currentposthyphenchar post}% {replace}} -% todo: make this configurable - \protect \endinput diff --git a/tex/context/base/mkiv/lang-lab.mkxl b/tex/context/base/mkiv/lang-lab.mkxl index 117aa9e2b..bf503c069 100644 --- a/tex/context/base/mkiv/lang-lab.mkxl +++ b/tex/context/base/mkiv/lang-lab.mkxl @@ -220,21 +220,6 @@ \let\m_lang_labels_left \empty \let\m_lang_labels_right\empty -% \def\lang_labels_text_prefix_assign_yes#1[#2,#3,#4]% -% {\def\m_lang_labels_left {#2}% no longer an edef ... else \Word undefined expansion issues -% \def\m_lang_labels_right{#3}% no longer an edef ... else \Word undefined expansion issues -% \ifempty\m_lang_labels_right -% \ifempty\m_lang_labels_left -% \expandafter\def\csname\??label\currenttextprefixclass:\currenttextprefixtag:#1\endcsname{\empty\empty}% -% \else -% \expandafter\def\csname\??label\currenttextprefixclass:\currenttextprefixtag:#1\endcsname{{#2}\empty}% -% \fi -% \else -% \expandafter\def\csname\??label\currenttextprefixclass:\currenttextprefixtag:#1\endcsname{{#2}{#3}}% -% \fi} -% -% how we love obscure efficicency ... - \def\lang_labels_text_prefix_assign_yes#1[#2,#3,#4]% {\def\m_lang_labels_left {#2}% no longer an edef ... else \Word undefined expansion issues \def\m_lang_labels_right{#3}% no longer an edef ... else \Word undefined expansion issues @@ -279,7 +264,7 @@ % \csname\??label\currenttextprefixclass:\currenttextprefixtag:#1\expandafter\endcsname % \csname\??label\currenttextprefixclass:\currenttextprefixtag:#2\endcsname} % -% this delays the aliasing so that we can switch maillanguage in between +% this delays the aliasing so that we can switch mainlanguage in between \def\lang_labels_text_prefix_copy_pair_indeed#1[#2,#3]% {\expandafter\edef\csname\??label\currenttextprefixclass:#1\endcsname diff --git a/tex/context/base/mkiv/math-ali.mkiv b/tex/context/base/mkiv/math-ali.mkiv index c501ea767..ea6045e79 100644 --- a/tex/context/base/mkiv/math-ali.mkiv +++ b/tex/context/base/mkiv/math-ali.mkiv @@ -50,23 +50,6 @@ \def\displayopenupvalue{.25\bodyfontsize} -% \def\math_build_eqalign -% {\scratchtoks\emptytoks -% \d_math_eqalign_distance\mathalignmentparameter\c!distance -% \scratchcounterone\mathalignmentparameter\c!m -% \scratchcountertwo\mathalignmentparameter\c!n -% \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_a}}% -% \scratchcounter\plusone -% \dorecurse{\numexpr\scratchcounterone*\scratchcountertwo-\plusone\relax} -% {\ifnum\scratchcounter=\scratchcountertwo -% \scratchcounter\plusone -% \scratchtoks\expandafter{\the\scratchtoks\math_eqalign_distance}% -% \else -% \advance\scratchcounter\plusone -% \fi -% \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_b}}}% -% \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_c}}} - \def\math_build_eqalign {\scratchtoks\emptytoks \d_math_eqalign_distance\mathalignmentparameter\c!distance\relax diff --git a/tex/context/base/mkiv/mult-ini.mkiv b/tex/context/base/mkiv/mult-ini.mkiv index 8f73c4ef8..c94a55e4d 100644 --- a/tex/context/base/mkiv/mult-ini.mkiv +++ b/tex/context/base/mkiv/mult-ini.mkiv @@ -106,33 +106,35 @@ %D than once. Savings like this should of course be implemented in english, just %D because \TEX\ is english. -\def\s!width {width} \let\!!width \s!width % obsolete -\def\s!height{height} \let\!!height\s!height % obsolete -\def\s!depth {depth} \let\!!depth \s!depth % obsolete -\def\s!spread{spread} \let\!!spread\s!spread % obsolete -\def\s!plus {plus} \let\!!plus \s!plus % obsolete -\def\s!minus {minus} \let\!!minus \s!minus % obsolete -\def\s!left {left} -\def\s!right {right} -\def\s!fil {fil} -\def\s!fill {fill} \let\!!fill \s!fill % obsolete -\def\s!filll {filll} -\def\s!to {to} \let\!!to \s!to % obsolete -\def\s!attr {attr} -\def\s!axis {axis} - -\def\s!bottom{bottom} -\def\s!top {top} -\def\s!both {both} - -\def\s!reverse {reverse} +\def\s!width {width} +\def\s!height {height} +\def\s!depth {depth} +\def\s!spread {spread} +\def\s!plus {plus} +\def\s!minus {minus} +\def\s!to {to} + +\def\s!fil {fil} +\def\s!fill {fill} +\def\s!filll {filll} + +\def\s!attr {attr} +\def\s!axis {axis} +\def\s!both {both} +\def\s!bottom {bottom} +\def\s!left {left} +\def\s!options {options} \def\s!orientation{orientation} -\def\s!xoffset {xoffset} +\def\s!reverse {reverse} +\def\s!right {right} +\def\s!top {top} \def\s!xmove {xmove} -\def\s!yoffset {yoffset} +\def\s!xoffset {xoffset} \def\s!ymove {ymove} +\def\s!yoffset {yoffset} %D \macros + %D {defineinterfaceconstant, %D defineinterfacevariable, %D defineinterfaceelement, diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index f830b7473..bc9913595 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -161,6 +161,10 @@ return { -- "normalhyphenationmodecode", "automatichyphenationmodecode", "explicithyphenationmodecode", "syllablehyphenationmodecode", "uppercasehyphenationmodecode", "completehyphenationmodecode", + "compoundhyphenationmodecode", "strictstarthyphenationmodecode", "strictendhyphenationmodecode", + "automaticpenaltyhyphenationmodecode", "explicitpenaltyhyphenationmodecode", "permitgluehyphenationmodecode", + -- + "normalizelinemodecode", "indentskipmodecode", "swaphangindentmodecode", "swapparskipmodecode", "breakafterdirmodecode", }, ["helpers"] = { -- @@ -515,7 +519,7 @@ return { "boxrangewd", "boxrangeht", "boxrangedp", -- "bitwiseset", "bitwiseand", "bitwiseor", "bitwisexor", "bitwisenot", "bitwisenil", - "ifbitwiseand", "bitwise", + "ifbitwiseand", "bitwise", "bitwiseshift", "bitwiseflip", -- old ... very low level "textdir", "linedir", "pardir", "boxdir", } diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index b38fcbb7d..5f594ca3f 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -241,7 +241,6 @@ return { "attribute", "attributedef", "automaticdiscretionary", - "automatichyphenmode", "automatichyphenpenalty", "automigrationmode", "begincsname", @@ -255,10 +254,8 @@ return { "boxxoffset", "boxymove", "boxyoffset", - "breakafterdirmode", "catcodetable", "clearmarks", - "compoundhyphenmode", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", @@ -297,13 +294,10 @@ return { "gtokspre", "hjcode", "hpack", - "hyphenationbounds", "hyphenationmin", "hyphenationmode", - "hyphenpenaltymode", "ifabsdim", "ifabsnum", - "ifand", "ifarguments", "ifboolean", "ifchkdim", @@ -357,7 +351,6 @@ return { "luatexbanner", "luatexrevision", "luatexversion", - "luavaluefunction", "mathdelimitersmode", "mathdirection", "mathdisplayskipmode", @@ -388,7 +381,6 @@ return { "outputbox", "parattr", "pardirection", - "parindentmode", "postexhyphenchar", "posthyphenchar", "prebinoppenalty", @@ -405,7 +397,6 @@ return { "savecatcodetable", "scantextokens", "setfontid", - "shapemode", "snapshotpar", "supmarkmode", "textdirection", @@ -659,7 +650,6 @@ return { "ifcase", "ifcat", "ifdim", - "ifeof", "iffalse", "ifhbox", "ifhmode", diff --git a/tex/context/base/mkiv/node-fnt.lua b/tex/context/base/mkiv/node-fnt.lua index 3b8bf0586..dd40befc8 100644 --- a/tex/context/base/mkiv/node-fnt.lua +++ b/tex/context/base/mkiv/node-fnt.lua @@ -398,12 +398,11 @@ do if force_discrun then -- basefont is not supported in disc only runs ... it would mean a lot of - -- ranges .. we could try to run basemode as a separate processor run but - -- not for now (we can consider it when the new node code is tested + -- ranges .. we could try to run basemode as a separate processor run but not + -- for now (we can consider it when the new node code is tested for d in nextdisc, head do - -- we could use first_glyph, only doing replace is good enough because - -- pre and post are normally used for hyphens and these come from fonts - -- that part of the hyphenated word + -- doing only replace is good enough because pre and post are normally used + -- for hyphens and these come from fonts that part of the hyphenated word local r = getreplace(d) if r then local prevfont = nil diff --git a/tex/context/base/mkiv/spac-ali.mkxl b/tex/context/base/mkiv/spac-ali.mkxl index ae6aa3736..f4310dfc0 100644 --- a/tex/context/base/mkiv/spac-ali.mkxl +++ b/tex/context/base/mkiv/spac-ali.mkxl @@ -21,6 +21,12 @@ \registerctxluafile{spac-ali}{optimize} +\chardef\normalizelinemodecode = "01 +\chardef\indentskipmodecode = "02 +\chardef\swaphangindentmodecode = "04 +\chardef\swapparskipmodecode = "08 +\chardef\breakafterdirmodecode = "10 + \definesystemattribute[realign] [public] % might be combined with the next one \definesystemattribute[alignstate][public] % will make a single attributes for several states diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 68817dcd6..d652c1143 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 4d7f938ca..b1af2f3e8 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-itm.mklx b/tex/context/base/mkiv/strc-itm.mklx index 51f2cd4b6..8ce31c1a8 100644 --- a/tex/context/base/mkiv/strc-itm.mklx +++ b/tex/context/base/mkiv/strc-itm.mklx @@ -1540,7 +1540,7 @@ {\let\m_strc_itemgroups_text_distance\zeropoint} \setvalue{\??itemgroupdistance\v!space}% - {\def\m_strc_itemgroups_text_distance{\interwordspace\!!plus\interwordstretch\!!minus\interwordshrink}} + {\def\m_strc_itemgroups_text_distance{\interwordspace\s!plus\interwordstretch\s!minus\interwordshrink}} \setvalue\??itemgroupdistance % catches empty value {\let\m_strc_itemgroups_text_distance\zeropoint} @@ -1559,9 +1559,9 @@ {\assignvalue \m_strc_itemgroups_text_distance \m_strc_itemgroups_text_distance - {.5\interwordspace\!!plus.5\emwidth}% - {\interwordspace \!!plus \emwidth}% - {\emwidth \!!plus \interwordstretch\!!minus\interwordshrink}} + {.5\interwordspace\s!plus.5\emwidth}% + {\interwordspace \s!plus \emwidth}% + {\emwidth \s!plus \interwordstretch\!!minus\interwordshrink}} % \unexpanded\def\strc_itemgroups_default_command % {\EveryPar{\ignorespaces}% needed ? diff --git a/tex/context/base/mkiv/strc-itm.mkvi b/tex/context/base/mkiv/strc-itm.mkvi index 1b306fe18..ca47b73f7 100644 --- a/tex/context/base/mkiv/strc-itm.mkvi +++ b/tex/context/base/mkiv/strc-itm.mkvi @@ -1539,7 +1539,7 @@ {\let\m_strc_itemgroups_text_distance\zeropoint} \setvalue{\??itemgroupdistance\v!space}% - {\def\m_strc_itemgroups_text_distance{\interwordspace\!!plus\interwordstretch\!!minus\interwordshrink}} + {\def\m_strc_itemgroups_text_distance{\interwordspace\s!plus\interwordstretch\s!minus\interwordshrink}} \setvalue\??itemgroupdistance % catches empty value {\let\m_strc_itemgroups_text_distance\zeropoint} @@ -1558,9 +1558,9 @@ {\assignvalue \m_strc_itemgroups_text_distance \m_strc_itemgroups_text_distance - {.5\interwordspace\!!plus.5\emwidth}% - {\interwordspace \!!plus \emwidth}% - {\emwidth \!!plus \interwordstretch\!!minus\interwordshrink}} + {.5\interwordspace\s!plus.5\emwidth}% + {\interwordspace \s!plus \emwidth}% + {\emwidth \s!plus \interwordstretch\!!minus\interwordshrink}} % \unexpanded\def\strc_itemgroups_default_command % {\EveryPar{\ignorespaces}% needed ? diff --git a/tex/context/base/mkiv/strc-lst.mkvi b/tex/context/base/mkiv/strc-lst.mkvi index 18b4d4662..678c02e15 100644 --- a/tex/context/base/mkiv/strc-lst.mkvi +++ b/tex/context/base/mkiv/strc-lst.mkvi @@ -76,7 +76,7 @@ %\c!inbetween=, %\c!symbol=, %\c!expansion=, - \c!limittext=\languageparameter\c!limittext] % not used currently + \c!limittext=\languageparameter\c!limittext] % not used currently %D Helpers: @@ -242,7 +242,7 @@ %D When placing a list either one or a set can be giving. This makes %D it possible to flush for instance an nested (or merged) table of %D contents. Keep in mind that placing a list is what we do most (think -%D of tables of contents, figures, etc.\ but other usag eis also possible +%D of tables of contents, figures, etc.\ but other usage is also possible %D in which case low level commands have to be used. \newtoks\everystructurelist @@ -627,14 +627,14 @@ {\strut\symbol[bullet]} \unexpanded\def\strc_lists_symbol_two - {\vrule\!!width\emwidth\!!height\exheight\!!depth\zeropoint} + {\vrule\s!width\emwidth\s!height\exheight\s!depth\zeropoint\relax} \unexpanded\def\strc_lists_symbol_three {\begingroup \strc_lists_assign_dimen\scratchwidth \c!width {1.5\emwidth}% \strc_lists_assign_dimen\scratchheight\c!height\exheight \strc_lists_assign_dimen\scratchdepth \c!depth \zeropoint - \vrule\!!width\scratchwidth\!!height\scratchheight\!!depth\scratchdepth + \vrule\s!width\scratchwidth\s!height\scratchheight\s!depth\scratchdepth \endgroup} \unexpanded\def\strc_lists_symbol_unknown @@ -1139,7 +1139,7 @@ \hangafter\ifx\p_hang\v!no\zerocount\else\plusone\fi \scratchdimen\listalternativeparameter\c!distance\relax \ifzeropt\wd\b_strc_lists_page \else \ifdim\scratchdimen>\zeropoint\relax - \rightskip\scratchdimen\!!plus\listalternativeparameter\c!stretch\relax + \rightskip\scratchdimen\s!plus\listalternativeparameter\c!stretch\relax \parfillskip-\rightskip \fi \fi \else @@ -1262,9 +1262,9 @@ \endgroup \scratchdistance\listparameter\c!distance\relax \ifdim\scratchdistance<\emwidth - \hskip\emwidth\!!plus\emwidth\!!minus.25\emwidth\relax + \hskip\emwidth\s!plus\emwidth\s!minus.25\emwidth\relax \else - \hskip\scratchdistance\!!plus.5\scratchdistance\!!minus.25\scratchdistance\relax + \hskip\scratchdistance\s!plus.5\scratchdistance\s!minus.25\scratchdistance\relax \fi \endgroup \endgroup diff --git a/tex/context/base/mkiv/supp-box.mkiv b/tex/context/base/mkiv/supp-box.mkiv index c48315622..b9835875d 100644 --- a/tex/context/base/mkiv/supp-box.mkiv +++ b/tex/context/base/mkiv/supp-box.mkiv @@ -1799,7 +1799,7 @@ % \setbox\scratchbox\hbox\bgroup} % % \protected\def\stopvboxtohbox -% {\ifcase\vboxtohboxslack\else\hskip\zeropoint\!!minus\vboxtohboxslack\fi +% {\ifcase\vboxtohboxslack\else\hskip\zeropoint\s!minus\vboxtohboxslack\fi % \egroup % \dp\scratchbox\zeropoint % \ht\scratchbox\vboxtohboxfactor\wd\scratchbox @@ -1866,7 +1866,7 @@ % \doreshapebox % {\hbox\bgroup % \unhbox\shapebox -% \ifcase\hboxestohboxslack\else\hskip\zeropoint\!!minus\hboxestohboxslack\fi +% \ifcase\hboxestohboxslack\else\hskip\zeropoint\s!minus\hboxestohboxslack\fi % \egroup}% % \donothing % \donothing diff --git a/tex/context/base/mkiv/supp-box.mkxl b/tex/context/base/mkiv/supp-box.mkxl index d3220052e..4e29550e2 100644 --- a/tex/context/base/mkiv/supp-box.mkxl +++ b/tex/context/base/mkiv/supp-box.mkxl @@ -1662,7 +1662,7 @@ % \setbox\scratchbox\hbox\bgroup} % % \protected\def\stopvboxtohbox -% {\ifcase\vboxtohboxslack\else\hskip\zeropoint\!!minus\vboxtohboxslack\fi +% {\ifcase\vboxtohboxslack\else\hskip\zeropoint\s!minus\vboxtohboxslack\fi % \egroup % \dp\scratchbox\zeropoint % \ht\scratchbox\vboxtohboxfactor\wd\scratchbox diff --git a/tex/context/base/mkiv/toks-aux.lmt b/tex/context/base/mkiv/toks-aux.lmt index 9c392f006..c77c868fc 100644 --- a/tex/context/base/mkiv/toks-aux.lmt +++ b/tex/context/base/mkiv/toks-aux.lmt @@ -102,6 +102,7 @@ if CONTEXTLMTXMODE > 0 then local texchardef = tex.chardef + -- for k, v in next, prefixcodes do texchardef(v .. "prefixcode", k) end for k, v in next, groupcodes do texchardef(v .. "groupcode", k) end for k, v in next, hyphenationcodes do texchardef(v .. "hyphenationmodecode",k) end diff --git a/tex/context/base/mkiv/typo-dir.mkxl b/tex/context/base/mkiv/typo-dir.mkxl new file mode 100644 index 000000000..577434e56 --- /dev/null +++ b/tex/context/base/mkiv/typo-dir.mkxl @@ -0,0 +1,207 @@ +%D \module +%D [ file=typo-dir, +%D version=2009.03.27, % code moved from core-spa.mkiv +%D title=\CONTEXT\ Typesetting Macros, +%D subtitle=Directions, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Typesetting Macros / Directions} + +%D At some point we might default to method 'two' but first I need to make it more +%D efficient (and provide some options). I also want to have some basic tracing. + +\unprotect + +\registerctxluafile{typo-dir}{optimize} +\registerctxluafile{typo-dha}{} +%registerctxluafile{typo-dua}{} +%registerctxluafile{typo-dub}{} +\registerctxluafile{typo-duc}{} + +\definesystemattribute[directions][public,pickup] + +\installcorenamespace{directions} +\installcorenamespace{directionsbidimode} + +% plural as we can have a combination but maybe better singular + +\installsimplecommandhandler \??directions {directions} \??directions % no \define... yet + +\edef\lefttorightmark{\normalUchar"200E} \let\lrm\lefttorightmark +\edef\righttoleftmark{\normalUchar"200F} \let\rlm\righttoleftmark + +\unexpanded\def\setdirection[#1]% todo: symbolic names + {\clf_setdirection#1\relax} + +% \unexpanded\def\resetdirection +% {\clf_setdirection\zerocount} +% +% is in fact: + +\unexpanded\def\resetdirection + {\c_attr_directions\attributeunsetvalue} + +\newconstant\directionsbidimode % this one might become pivate + +% \setupdirections[bidi=global,method=default] +% \setupdirections[bidi=global,method=one] +% \setupdirections[bidi=global,method=two] +% \setupdirections[bidi=global,method=two,fences=no] + +% maybe use chardefs + +\def\typo_dir_get_mode + {\def\currentbidimode{\clf_getbidimode + scope {\directionsparameter\c!bidi}% + method {\directionsparameter\c!method}% + fences {\directionsparameter\c!fences}% + }% + \expandafter\glet\csname\??directionsbidimode\currentbidistamp\endcsname\currentbidimode} + +\appendtoks + \edef\p_bidi{\directionsparameter\c!bidi}% + \edef\currentbidistamp + {\p_bidi + :\directionsparameter\c!method + :\directionsparameter\c!fences}% + \expandafter\let\expandafter\currentbidimode\csname\??directionsbidimode\currentbidistamp\endcsname + \ifx\currentbidimode\relax + \typo_dir_get_mode + \fi + \directionsbidimode\currentbidimode\relax + \ifcase\directionsbidimode + \resetdirection + \else + \setdirection[\number\directionsbidimode]% + \fi + \ifx\p_bidi\v!global + \pickupdirectionsattribute + \else + \forgetdirectionsattribute + \fi +\to \everysetupdirections + +\appendtoks + \edef\p_option{\directionsparameter\c!break}% name can change + \bitwiseflip\normalizelinemode\ifx\p_option\v!both\else-\fi\breakafterdirmodecode +\to \everysetupdirections + +% bidi: local=obey grouping, global=ignore grouping (unicode has no grouping) + +\setupdirections % maybe start/stop + [\c!bidi=\v!off, + \c!method=\v!default, + \c!break=\v!both, % experimental value, maybe \v!no will be default (bad name too) + \c!fences=\v!yes] + +\unexpanded\edef\bidilre{\normalUchar"202A} +\unexpanded\edef\bidirle{\normalUchar"202B} +\unexpanded\edef\bidipop{\normalUchar"202C} +\unexpanded\edef\bidilro{\normalUchar"202D} +\unexpanded\edef\bidirlo{\normalUchar"202E} + +\unexpanded\def\dirlre{\ifcase\directionsbidimode\or\bidilre\or\textdirection\directionlefttoright\fi} +\unexpanded\def\dirrle{\ifcase\directionsbidimode\or\bidirle\or\textdirection\directionrighttoleft\fi} +\unexpanded\def\dirlro{\ifcase\directionsbidimode\or\bidilro\or\setdirection[3]\fi} +\unexpanded\def\dirrlo{\ifcase\directionsbidimode\or\bidirlo\or\setdirection[4]\fi} + +% for the moment: \setdirection[\plusone] + +\definecolor[bidi:left:original] [r=.6] +\definecolor[bidi:left:reversed] [g=.6] +\definecolor[bidi:right:original][b=.6] +\definecolor[bidi:right:reversed][r=.6,g=.6] +\definecolor[bidi:mirrored] [r=.6,b=.6] + +\protect \endinput + +% bidi test + +% \definefontfeature +% [arab] +% [mode=node,language=dflt,script=arab, +% init=yes,medi=yes,fina=yes,isol=yes, +% liga=yes,dlig=yes,rlig=yes,clig=yes, +% mark=yes,mkmk=yes,kern=yes,curs=yes] +% +% \font\Arabic=arabtype*arab at 20pt +% +% \def\LATIN{LATIN} {\setdirection[1]} % enable this +% \def\ARAB {عربي} +% +% \startluacode +% function documentdata.split_tokens(str) +% for s in str:bytes() do +% context.sprint(tex.ctxcatcodes,string.format("\\hbox{\\char %s}",s)) +% end +% end +% \stopluacode +% +% \unexpanded\def\biditest#1#2#3% font text raw +% {\dontleavehmode\hbox +% {\framed[offset=overlay]{\tttf#2}\quad +% \enabletrackers[typesetters.directions]% +% \framed[offset=overlay]{#1#3}\quad +% \disabletrackers[typesetters.directions]% +% \tttf\ctxlua{documentdata.split_tokens([[\detokenize{#3}]])}}} +% +% \startbuffer[bidi-sample] +% \biditest\Arabic{LATIN BARA}{\lefttoright\relax \LATIN\ \ARAB}\par +% \biditest\Arabic{BARA LATIN}{\righttoleft\relax \LATIN\ \ARAB}\par +% \biditest\Arabic{LATIN ARAB}{\lefttoright{\bidilro \LATIN\ \ARAB}}\par % right -> left +% \biditest\Arabic{LATIN ARAB}{\righttoleft{\bidilro \LATIN\ \ARAB}}\par % right -> left +% \biditest\Arabic{BARA NITAL}{\lefttoright{\bidirlo \LATIN\ \ARAB}}\par % left -> right +% \biditest\Arabic{BARA NITAL}{\righttoleft{\bidirlo \LATIN\ \ARAB}}\par % left -> right +% \stopbuffer +% +% \startbuffer[bidi-sample] +% \biditest\Arabic{LATIN BARA}{\lefttoright\relax \LATIN\ \ARAB}\par +% \biditest\Arabic{BARA LATIN}{\righttoleft\relax \LATIN\ \ARAB}\par +% \biditest\Arabic{LATIN ARAB}{\lefttoright\bidilro \LATIN\ \ARAB}\par % right -> left +% \biditest\Arabic{LATIN ARAB}{\righttoleft\bidilro \LATIN\ \ARAB}\par % right -> left +% \biditest\Arabic{BARA NITAL}{\lefttoright\bidirlo \LATIN\ \ARAB}\par % left -> right +% \biditest\Arabic{BARA NITAL}{\righttoleft\bidirlo \LATIN\ \ARAB}\par % left -> right +% \stopbuffer +% +% \startbuffer[bidi-setup] +% \setupdirections[bidi=off] +% \stopbuffer +% +% {\typebuffer[bidi-setup] \getbuffer[bidi-setup] \getbuffer[bidi-sample]} +% +% \startbuffer[bidi-setup] +% \setupdirections[bidi=global] +% \stopbuffer +% +% {\typebuffer[bidi-setup] \getbuffer[bidi-setup] \getbuffer[bidi-sample]} +% +% \startbuffer[bidi-setup] +% \setupdirections[bidi=local] +% \stopbuffer +% +% {\typebuffer[bidi-setup] \getbuffer[bidi-setup] \getbuffer[bidi-sample]} +% +% \startbuffer[bidi-sample] +% \setupdirections[bidi=global] +% +% \hbox{\righttoleft\arabicfont (0001)}\par +% \dontleavehmode\hbox{\righttoleft\arabicfont (0002)}\par +% {\righttoleft\arabicfont (0003)\par} +% {\righttoleft\arabicfont (0004)}\par +% \dontleavehmode{\righttoleft\arabicfont (0005)\par} +% \dontleavehmode{\righttoleft\arabicfont (0006)}\par +% \rtlhbox{\arabicfont (0007)}\par +% \ltrhbox{\arabicfont (0008)}\par +% \dontleavehmode\rtlhbox{\arabicfont (0009)}\par +% \dontleavehmode\ltrhbox{\arabicfont (0010)}\par +% \stopsetups +% +% {\typebuffer[bidi-sample] \getbuffer[bidi-sample]} +% +% \stoptext diff --git a/tex/context/base/mkiv/typo-fln.lua b/tex/context/base/mkiv/typo-fln.lua index 326d3acf5..c4a14846e 100644 --- a/tex/context/base/mkiv/typo-fln.lua +++ b/tex/context/base/mkiv/typo-fln.lua @@ -136,7 +136,7 @@ actions[v_line] = function(head,setting) local temp = copy_node_list(head) local linebreaks = { } - set = function(head) + local set = function(head) for g in nextglyph, head do if dynamic > 0 then setglyphdata(g,dynamic) @@ -180,9 +180,9 @@ actions[v_line] = function(head,setting) -- nodes.handlers.protectglyphs(temp) -- not needed as we discard -- temp = typesetters.spacings.handler(temp) -- maybe when enabled -- temp = typesetters.kerns.handler(temp) -- maybe when enabled --- temp = typesetters.cases.handler(temp) -- maybe when enabled -flush_node_list(temp); + -- temp = typesetters.cases.handler(temp) -- maybe when enabled local width = getdimensions(temp) + flush_node_list(temp) return width end diff --git a/tex/context/base/mkiv/typo-tal.lua b/tex/context/base/mkiv/typo-tal.lua index ff10fb121..db605a491 100644 --- a/tex/context/base/mkiv/typo-tal.lua +++ b/tex/context/base/mkiv/typo-tal.lua @@ -51,7 +51,6 @@ local insert_node_before = nuts.insert_before local insert_node_after = nuts.insert_after local nextglyph = nuts.traversers.glyph local getdimensions = nuts.dimensions -local first_glyph = nuts.first_glyph local setglue = nuts.setglue @@ -174,7 +173,6 @@ function characteralign.handler(head,where) if not datasets then return head end - -- local first = first_glyph(head) -- we could do that once local first for n in nextglyph, head do first = n diff --git a/tex/context/base/mkiv/util-prs.lua b/tex/context/base/mkiv/util-prs.lua index 57ac2b58e..6d2f8c19e 100644 --- a/tex/context/base/mkiv/util-prs.lua +++ b/tex/context/base/mkiv/util-prs.lua @@ -374,8 +374,8 @@ hashes.settings_to_set = table.setmetatableindex(function(t,k) -- experiment, n end) -- as we use a next, we are not sure when the gc kicks in --- --- getmetatable(hashes.settings_to_set).__mode = "kv" -- could be an option (maybe sharing makes sense) + +getmetatable(hashes.settings_to_set).__mode = "kv" -- could be an option (maybe sharing makes sense) function parsers.simple_hash_to_string(h, separator) local t = { } diff --git a/tex/context/interface/mkii/keys-ro.xml b/tex/context/interface/mkii/keys-ro.xml index 151144414..b811b79df 100644 --- a/tex/context/interface/mkii/keys-ro.xml +++ b/tex/context/interface/mkii/keys-ro.xml @@ -960,6 +960,7 @@ <cd:constant name='limittext' value='limittext'/> <cd:constant name='line' value='linie'/> <cd:constant name='linecorrection' value='corectielinie'/> + <cd:constant name='linedirection' value='linedirection'/> <cd:constant name='lines' value='linii'/> <cd:constant name='list' value='lista'/> <cd:constant name='listtext' value='listtext'/> diff --git a/tex/context/modules/mkiv/m-educat.mkiv b/tex/context/modules/mkiv/m-educat.mkiv index e39738e99..215bf3116 100644 --- a/tex/context/modules/mkiv/m-educat.mkiv +++ b/tex/context/modules/mkiv/m-educat.mkiv @@ -71,7 +71,7 @@ \vbox{\hsize\wd\scratchbox\thinrule \ifcase\scratchcounter\else \setbox\scratchbox=\hbox{\space}% - \nobreak\hskip\zeropoint \!!minus \wd\scratchbox + \nobreak\hskip\zeropoint \s!minus \wd\scratchbox \vbox{\hsize\wd\scratchbox\thinrule}% \fi}}% \processisolatedwords{#2}\processisolatedword diff --git a/tex/context/modules/mkiv/m-morse.mkvi b/tex/context/modules/mkiv/m-morse.mkvi index a2c20dff7..a80b3d56f 100644 --- a/tex/context/modules/mkiv/m-morse.mkvi +++ b/tex/context/modules/mkiv/m-morse.mkvi @@ -227,8 +227,8 @@ end \def\MorseHeight {0.2em} %def\MorseShort {\dontleavehmode\blackrule[\c!height=\MorseHeight,\c!width=\dimexpr\MorseWidth]} %def\MorseLong {\dontleavehmode\blackrule[\c!height=\MorseHeight,\c!width=3\dimexpr\MorseWidth]} -\def\MorseShort {\dontleavehmode\vrule\!!width \dimexpr\MorseWidth\!!height\MorseHeight\!!depth\zeropoint\relax} -\def\MorseLong {\dontleavehmode\vrule\!!width3\dimexpr\MorseWidth\!!height\MorseHeight\!!depth\zeropoint\relax} +\def\MorseShort {\dontleavehmode\vrule\s!width \dimexpr\MorseWidth\s!height\MorseHeight\s!depth\zeropoint\relax} +\def\MorseLong {\dontleavehmode\vrule\s!width3\dimexpr\MorseWidth\s!height\MorseHeight\s!depth\zeropoint\relax} \def\MorseBetweenCharacters {\kern\MorseWidth} \def\MorseBetweenWords {\hskip3\dimexpr\MorseWidth\relax} \def\MorseSpace {\hskip7\dimexpr\MorseWidth\relax} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 627d8b5f3..b08cccbf6 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 : 2020-08-11 15:56 +-- merge date : 2020-08-13 19:42 do -- begin closure to overcome local limits and interference @@ -10894,7 +10894,6 @@ local insert=table.insert local fonts=fonts local helpers=fonts.helpers local setmetatableindex=table.setmetatableindex -local makeweak=table.makeweak local push={ "push" } local pop={ "pop" } local dummy={ "comment" } |