diff options
Diffstat (limited to 'tex')
23 files changed, 517 insertions, 138 deletions
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 4b36feacb..a8a372180 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/mkiv/colo-ini.lua b/tex/context/base/mkiv/colo-ini.lua index 1213a637f..31db0a691 100644 --- a/tex/context/base/mkiv/colo-ini.lua +++ b/tex/context/base/mkiv/colo-ini.lua @@ -1251,3 +1251,12 @@ end -- inspect(attributes.colors.spec("red")) -- inspect(attributes.colors.spec("red socks")) + +implement { + name = "negatedcolorcomponent", + arguments = "string", + actions = function(s) + s = 1 - (tonumber(s) or 0) + context((s < 0 and 0) or (s > 1 and 1) or s) + end +} diff --git a/tex/context/base/mkiv/colo-ini.mkiv b/tex/context/base/mkiv/colo-ini.mkiv index 915a5559b..4e6e58032 100644 --- a/tex/context/base/mkiv/colo-ini.mkiv +++ b/tex/context/base/mkiv/colo-ini.mkiv @@ -679,20 +679,26 @@ %D %D These speak for themselves. See \type {colo-ext} for usage. +% \def\negatedcolorcomponent#1% +% {\ifdim\dimexpr\onepoint-#1\onepoint\relax<\zeropoint +% \!!zerocount +% \else +% \expandafter\withoutpt\the\dimexpr\onepoint-#1\onepoint\relax +% \fi} +% +% \unexpanded\def\negatecolorcomponent#1% #1 = \macro +% {\scratchdimen\onepoint\advance\scratchdimen-#1\onepoint +% \ifdim\scratchdimen<\zeropoint\scratchdimen\zeropoint\fi +% \edef#1{\withoutpt\the\scratchdimen}} +% +% \unexpanded\def\negatecolorcomponent#1% #1 = \macro +% {\edef#1{\negatedcolorcomponent{#1}}} + \unexpanded\def\negatecolorcomponent#1% #1 = \macro - {\scratchdimen\onepoint\advance\scratchdimen-#1\onepoint - \ifdim\scratchdimen<\zeropoint\scratchdimen\zeropoint\fi - \edef#1{\withoutpt\the\scratchdimen}} + {\edef#1{\clf_negatecolorcomponent{#1}}} \def\negatedcolorcomponent#1% - {\ifdim\dimexpr\onepoint-#1\onepoint\relax<\zeropoint - \!!zerocount - \else - \expandafter\withoutpt\the\dimexpr\onepoint-#1\onepoint\relax - \fi} - -\unexpanded\def\negatecolorcomponent#1% #1 = \macro - {\edef#1{\negatedcolorcomponent{#1}}} + {\clf_negatecolorcomponent{#1}} %D \macros %D {MPcolor} @@ -1330,7 +1336,6 @@ \colo_helpers_inherited_current_ca{#1} % \colo_helpers_inherited_current_ta{#1} } - \def\thecolormodelattribute {\the\attribute\colormodelattribute} %def\thecolorattribute #1{\number\csname\??colorattribute \ifcsname\??colorattribute \currentcolorprefix#1\endcsname\currentcolorprefix#1\else\ifcsname\??colorattribute #1\endcsname#1\fi\fi\endcsname} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index cad11bcd0..8e28247cd 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.07.15 23:30} +\newcontextversion{2016.07.18 16:46} %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 1a6eccdb9..7259b70ad 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.07.15 23:30} +\edef\contextversion{2016.07.18 16:46} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/lang-cnt.lua b/tex/context/base/mkiv/lang-cnt.lua new file mode 100644 index 000000000..21de6c2d1 --- /dev/null +++ b/tex/context/base/mkiv/lang-cnt.lua @@ -0,0 +1,164 @@ +if not modules then modules = { } end modules ['lang-cnt'] = { + version = 1.001, + comment = "companion to lang-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- This is generated with help from ctx-checkedcombined.lua (an ugly local +-- helper script). + +-- We don't really need this as we compose and decompose already. The only +-- exception are the ae etc but these can best be entered in their unicode +-- form anyway. So, even if we can support hjcodes with counts is is not +-- needed in practice. It's anyway debatable if æ should be seen as one +-- character or two. And ffi and ij and such are not used in patterns anyway. + +languages = languages or { } + +languages.hjcounts = { -- used: used in registered unicode characters + -- + [0x000C6] = { category = "letter", count = 2 }, -- Æ + [0x000E6] = { category = "letter", count = 2 }, -- æ + -- + [0x01E9E] = { category = "letter", count = 2 }, -- ẞ + [0x000DF] = { category = "letter", count = 2 }, -- ß + -- + [0x00132] = { category = "dubious", count = 2 }, -- IJ + [0x00133] = { category = "dubious", count = 2 }, -- ij + -- + [0x00152] = { category = "dubious", count = 2 }, -- Œ + [0x00153] = { category = "dubious", count = 2 }, -- œ + -- + [0x001C7] = { category = "letter", count = 2 }, -- LJ + [0x001C8] = { category = "letter", count = 2 }, -- Lj + [0x001C9] = { category = "letter", count = 2 }, -- lj + -- + [0x001CA] = { category = "letter", count = 2 }, -- NJ + [0x001CC] = { category = "letter", count = 2 }, -- nj + -- not in patterns + [0x0FB01] = { category = "ligature", count = 2 }, -- fi + [0x0FB02] = { category = "ligature", count = 2 }, -- fl + [0x0FB03] = { category = "ligature", count = 3 }, -- ffi + [0x0FB04] = { category = "ligature", count = 3 }, -- ffl + [0x0FB06] = { category = "ligature", count = 2 }, -- st + -- + [0x00300] = { category = "combining", count = 0, used = true }, -- ̀ + [0x00301] = { category = "combining", count = 0, used = true }, -- ́ + [0x00302] = { category = "combining", count = 0, used = true }, -- ̂ + [0x00303] = { category = "combining", count = 0, used = true }, -- ̃ + [0x00304] = { category = "combining", count = 0, used = true }, -- ̄ + [0x00305] = { category = "combining", count = 0, used = false }, -- ̅ + [0x00306] = { category = "combining", count = 0, used = true }, -- ̆ + [0x00307] = { category = "combining", count = 0, used = true }, -- ̇ + [0x00308] = { category = "combining", count = 0, used = true }, -- ̈ + [0x00309] = { category = "combining", count = 0, used = true }, -- ̉ + [0x0030A] = { category = "combining", count = 0, used = true }, -- ̊ + [0x0030B] = { category = "combining", count = 0, used = true }, -- ̋ + [0x0030C] = { category = "combining", count = 0, used = true }, -- ̌ + [0x0030D] = { category = "combining", count = 0, used = false }, -- ̍ + [0x0030E] = { category = "combining", count = 0, used = false }, -- ̎ + [0x0030F] = { category = "combining", count = 0, used = true }, -- ̏ + [0x00310] = { category = "combining", count = 0, used = false }, -- ̐ + [0x00311] = { category = "combining", count = 0, used = true }, -- ̑ + [0x00312] = { category = "combining", count = 0, used = false }, -- ̒ + [0x00313] = { category = "combining", count = 0, used = true }, -- ̓ + [0x00314] = { category = "combining", count = 0, used = true }, -- ̔ + [0x00315] = { category = "combining", count = 0, used = false }, -- ̕ + [0x00316] = { category = "combining", count = 0, used = false }, -- ̖ + [0x00317] = { category = "combining", count = 0, used = false }, -- ̗ + [0x00318] = { category = "combining", count = 0, used = false }, -- ̘ + [0x00319] = { category = "combining", count = 0, used = false }, -- ̙ + [0x0031A] = { category = "combining", count = 0, used = false }, -- ̚ + [0x0031B] = { category = "combining", count = 0, used = true }, -- ̛ + [0x0031C] = { category = "combining", count = 0, used = false }, -- ̜ + [0x0031D] = { category = "combining", count = 0, used = false }, -- ̝ + [0x0031E] = { category = "combining", count = 0, used = false }, -- ̞ + [0x0031F] = { category = "combining", count = 0, used = false }, -- ̟ + [0x00320] = { category = "combining", count = 0, used = false }, -- ̠ + [0x00321] = { category = "combining", count = 0, used = false }, -- ̡ + [0x00322] = { category = "combining", count = 0, used = false }, -- ̢ + [0x00323] = { category = "combining", count = 0, used = true }, -- ̣ + [0x00324] = { category = "combining", count = 0, used = true }, -- ̤ + [0x00325] = { category = "combining", count = 0, used = true }, -- ̥ + [0x00326] = { category = "combining", count = 0, used = true }, -- ̦ + [0x00327] = { category = "combining", count = 0, used = true }, -- ̧ + [0x00328] = { category = "combining", count = 0, used = true }, -- ̨ + [0x00329] = { category = "combining", count = 0, used = false }, -- ̩ + [0x0032A] = { category = "combining", count = 0, used = false }, -- ̪ + [0x0032B] = { category = "combining", count = 0, used = false }, -- ̫ + [0x0032C] = { category = "combining", count = 0, used = false }, -- ̬ + [0x0032D] = { category = "combining", count = 0, used = true }, -- ̭ + [0x0032E] = { category = "combining", count = 0, used = true }, -- ̮ + [0x0032F] = { category = "combining", count = 0, used = false }, -- ̯ + [0x00330] = { category = "combining", count = 0, used = true }, -- ̰ + [0x00331] = { category = "combining", count = 0, used = true }, -- ̱ + [0x00332] = { category = "combining", count = 0, used = false }, -- ̲ + [0x00333] = { category = "combining", count = 0, used = false }, -- ̳ + [0x00334] = { category = "combining", count = 0, used = false }, -- ̴ + [0x00335] = { category = "combining", count = 0, used = false }, -- ̵ + [0x00336] = { category = "combining", count = 0, used = false }, -- ̶ + [0x00337] = { category = "combining", count = 0, used = false }, -- ̷ + [0x00338] = { category = "combining", count = 0, used = false }, -- ̸ + [0x00339] = { category = "combining", count = 0, used = false }, -- ̹ + [0x0033A] = { category = "combining", count = 0, used = false }, -- ̺ + [0x0033B] = { category = "combining", count = 0, used = false }, -- ̻ + [0x0033C] = { category = "combining", count = 0, used = false }, -- ̼ + [0x0033D] = { category = "combining", count = 0, used = false }, -- ̽ + [0x0033E] = { category = "combining", count = 0, used = false }, -- ̾ + [0x0033F] = { category = "combining", count = 0, used = false }, -- ̿ + [0x00340] = { category = "combining", count = 0, used = false }, -- ̀ + [0x00341] = { category = "combining", count = 0, used = false }, -- ́ + [0x00342] = { category = "combining", count = 0, used = true }, -- ͂ + [0x00343] = { category = "combining", count = 0, used = false }, -- ̓ + [0x00344] = { category = "combining", count = 0, used = false }, -- ̈́ + [0x00345] = { category = "combining", count = 0, used = true }, -- ͅ + [0x00346] = { category = "combining", count = 0, used = false }, -- ͆ + [0x00347] = { category = "combining", count = 0, used = false }, -- ͇ + [0x00348] = { category = "combining", count = 0, used = false }, -- ͈ + [0x00349] = { category = "combining", count = 0, used = false }, -- ͉ + [0x0034A] = { category = "combining", count = 0, used = false }, -- ͊ + [0x0034B] = { category = "combining", count = 0, used = false }, -- ͋ + [0x0034C] = { category = "combining", count = 0, used = false }, -- ͌ + [0x0034D] = { category = "combining", count = 0, used = false }, -- ͍ + [0x0034E] = { category = "combining", count = 0, used = false }, -- ͎ + [0x0034F] = { category = "combining", count = 0, used = false }, -- ͏ + [0x00350] = { category = "combining", count = 0, used = false }, -- ͐ + [0x00351] = { category = "combining", count = 0, used = false }, -- ͑ + [0x00352] = { category = "combining", count = 0, used = false }, -- ͒ + [0x00353] = { category = "combining", count = 0, used = false }, -- ͓ + [0x00354] = { category = "combining", count = 0, used = false }, -- ͔ + [0x00355] = { category = "combining", count = 0, used = false }, -- ͕ + [0x00356] = { category = "combining", count = 0, used = false }, -- ͖ + [0x00357] = { category = "combining", count = 0, used = false }, -- ͗ + [0x00358] = { category = "combining", count = 0, used = false }, -- ͘ + [0x00359] = { category = "combining", count = 0, used = false }, -- ͙ + [0x0035A] = { category = "combining", count = 0, used = false }, -- ͚ + [0x0035B] = { category = "combining", count = 0, used = false }, -- ͛ + [0x0035C] = { category = "combining", count = 0, used = false }, -- ͜ + [0x0035D] = { category = "combining", count = 0, used = false }, -- ͝ + [0x0035E] = { category = "combining", count = 0, used = false }, -- ͞ + [0x0035F] = { category = "combining", count = 0, used = false }, -- ͟ + [0x00360] = { category = "combining", count = 0, used = false }, -- ͠ + [0x00361] = { category = "combining", count = 0, used = false }, -- ͡ + [0x00362] = { category = "combining", count = 0, used = false }, -- ͢ + [0x00363] = { category = "combining", count = 0, used = false }, -- ͣ + [0x00364] = { category = "combining", count = 0, used = false }, -- ͤ + [0x00365] = { category = "combining", count = 0, used = false }, -- ͥ + [0x00366] = { category = "combining", count = 0, used = false }, -- ͦ + [0x00367] = { category = "combining", count = 0, used = false }, -- ͧ + [0x00368] = { category = "combining", count = 0, used = false }, -- ͨ + [0x00369] = { category = "combining", count = 0, used = false }, -- ͩ + [0x0036A] = { category = "combining", count = 0, used = false }, -- ͪ + [0x0036B] = { category = "combining", count = 0, used = false }, -- ͫ + [0x0036C] = { category = "combining", count = 0, used = false }, -- ͬ + [0x0036D] = { category = "combining", count = 0, used = false }, -- ͭ + [0x0036E] = { category = "combining", count = 0, used = false }, -- ͮ + [0x0036F] = { category = "combining", count = 0, used = false }, -- ͯ + [0x00483] = { category = "combining", count = 0, used = false }, -- ҃ + [0x00484] = { category = "combining", count = 0, used = false }, -- ҄ + [0x00485] = { category = "combining", count = 0, used = false }, -- ҅ + [0x00486] = { category = "combining", count = 0, used = false }, -- ҆ + [0x00487] = { category = "combining", count = 0, used = false }, -- ҇ +} diff --git a/tex/context/base/mkiv/lang-hyp.lua b/tex/context/base/mkiv/lang-hyp.lua index b797f85e1..3d166de40 100644 --- a/tex/context/base/mkiv/lang-hyp.lua +++ b/tex/context/base/mkiv/lang-hyp.lua @@ -333,11 +333,11 @@ local function hyphenate(dictionary,word,n) -- odd is okay end local l = 1 local w = { "." } - -- local d = dictionary.codehash or lcchars[c] + -- local d = dictionary.codehash for i=1,n do local c = word[i] + -- l = l + (d[c] or 1) l = l + 1 - -- w[l] = d[c] or c -- needs testing w[l] = lcchars[c] or c end l = l + 1 diff --git a/tex/context/base/mkiv/lang-ini.lua b/tex/context/base/mkiv/lang-ini.lua index 347cb0281..62786d9ab 100644 --- a/tex/context/base/mkiv/lang-ini.lua +++ b/tex/context/base/mkiv/lang-ini.lua @@ -22,7 +22,7 @@ local type, tonumber = type, tonumber local utfbyte = utf.byte local format, gsub, gmatch, find = string.format, string.gsub, string.gmatch, string.find local concat, sortedkeys, sortedpairs, keys, insert = table.concat, table.sortedkeys, table.sortedpairs, table.keys, table.insert -local utfbytes, strip = string.utfvalues, string.strip +local utfbytes, strip, utfcharacters = string.utfvalues, string.strip, utf.characters local context = context local commands = commands @@ -72,6 +72,11 @@ storage.register("languages/associated",associated,"languages.associated") storage.register("languages/numbers", numbers, "languages.numbers") storage.register("languages/data", data, "languages.data") +local variables = interfaces.variables + +local v_reset = variables.reset +local v_yes = variables.yes + local nofloaded = 0 local function resolve(tag) @@ -133,25 +138,63 @@ local function validdata(loaded,what,tag) end end -local function sethjcodes(instance,loaded,what) +-- languages.hjcounts[unicode].count + +-- hjcode: 0 not to be hyphenated +-- 1--31 length +-- 32 zero length +-- > 32 hyphenated with length 1 + +local function sethjcodes(instance,loaded,what,factor) local l = loaded[what] local c = l and l.characters if c then - local h = l.codehash + local hjcounts = factor and languages.hjcounts or false + -- + local h = loaded.codehash if not h then h = { } - l.codehash = h + loaded.codehash = h + end + -- + local function setcode(l) + local u = uccodes[l] + local s = 1 + if hjcounts then + local c = hjcounts[l] + if c then + c = c.count + if not c then + -- error, keep as 1 + elseif c <= 0 then + -- counts as 0 i.e. ignored + s = 32 + elseif c >= 31 then + -- counts as 31 + s = 31 + else + -- count c times + s = c + end + end + end + sethjcode(instance,l,s) + h[l] = s + if u ~= l and type(u) == "number" then + sethjcode(instance,u,s) + h[u] = s + end end + -- local s = tex.savinghyphcodes tex.savinghyphcodes = 0 - for l in utfbytes(c) do - local u = uccodes[l] - sethjcode(instance,l,l) - h[l] = l - if type(u) == "number" then - -- we don't want ß -> SS - sethjcode(instance,u,l) - h[u] = l + if type(c) == "table" then + for l in next, c do + setcode(utfbyte(l)) + end + else + for l in utfbytes(c) do + setcode(l) end end tex.savinghyphcodes = s @@ -255,7 +298,7 @@ local function loaddefinitions(tag,specification) local definition = definitions[i] if definition == "" then -- error - elseif definition == "reset" then -- interfaces.variables.reset + elseif definition == v_reset then if trace_patterns then report_initialization("clearing patterns for language %a",tag) end @@ -278,8 +321,8 @@ local function loaddefinitions(tag,specification) local loaded = table.load(fullname,gzipped and gzip.load) if loaded then -- todo: version test ok, nofloaded = true, nofloaded + 1 - sethjcodes(instance,loaded,"patterns") - sethjcodes(instance,loaded,"exceptions") + sethjcodes(instance,loaded,"patterns",specification.factor) + sethjcodes(instance,loaded,"exceptions",specification.factor) local p = validdata(loaded,"patterns",tag) local e = validdata(loaded,"exceptions",tag) if p and p ~= "" then @@ -396,10 +439,11 @@ if environment.initex then else - function languages.getnumber(tag,default,patterns) + function languages.getnumber(tag,default,patterns,factor) local l = registered[tag] if l then if l.dirty then + l.factor = factor == v_yes and true or false if trace_patterns then report_initialization("checking patterns for %a with default %a",tag,default) end @@ -454,19 +498,43 @@ function languages.postexhyphenchar(what) return postexhyphenchar(tolang(what)) -- e['user-friendly'] = 'user=friend-ly' -- e['exceptionally-friendly'] = 'excep-tionally=friend-ly' +local invalid = { "{", "}", "-" } + +local function collecthjcodes(data,str) + local found = data.extras and data.extras.characters or { } + for s in utfcharacters(str) do + if not found[s] then + found[s] = true + end + end + for i=1,#invalid do -- less checks this way + local c = invalid[i] + if found[c] then + found[c] = nil + end + end + data.extras = { characters = found } + sethjcodes(data.instance,data,"extras",data.factor) +end + function languages.loadwords(tag,filename) local data, instance = resolve(tag) if data then statistics.starttiming(languages) - instance:hyphenation(io.loaddata(filename) or "") + local str = io.loaddata(filename) or "" + collecthjcodes(data,str) + instance:hyphenation(str) statistics.stoptiming(languages) end end + function languages.setexceptions(tag,str) local data, instance = resolve(tag) if data then - instance:hyphenation(strip(str)) -- we need to strip leading spaces + str = strip(str) -- we need to strip leading spaces + collecthjcodes(data,str) + instance:hyphenation(str) end end @@ -523,7 +591,7 @@ end) implement { name = "languagenumber", actions = { languages.getnumber, context }, - arguments = { "string", "string", "string" } + arguments = { "string", "string", "string", "string" } } implement { @@ -555,7 +623,6 @@ implement { arguments = { "string", "string" } } - implement { name = "currentprehyphenchar", actions = function() diff --git a/tex/context/base/mkiv/lang-ini.mkiv b/tex/context/base/mkiv/lang-ini.mkiv index 214ce8ca3..4e6b203ad 100644 --- a/tex/context/base/mkiv/lang-ini.mkiv +++ b/tex/context/base/mkiv/lang-ini.mkiv @@ -24,6 +24,7 @@ \registerctxluafile{lang-ini}{1.001} \registerctxluafile{lang-def}{1.001} +\registerctxluafile{lang-cnt}{1.001} \unprotect @@ -458,6 +459,7 @@ {\currentlanguage}% {\defaultlanguage\currentlanguage}% {\languageparameter\s!patterns}% + {\languageparameter\c!factor}% \relax \normallanguage\csname\??languagenumbers\currentlanguage\endcsname} @@ -583,36 +585,26 @@ %D Fast switcher -% \def\lang_basics_switch_asked -% {\ifx\askedlanguage\empty \else -% \ifcsname\??languagelinked\askedlanguage\endcsname -% \edef\askedlanguage{\csname\??languagelinked\askedlanguage\endcsname}% -% \ifx\currentlanguage\askedlanguage \else -% \setcurrentlanguage\currentmainlanguage\askedlanguage -% \lang_basics_synchronize -% \fi -% \fi -% \fi} - \def\lang_basics_switch_asked - {\ifx\askedlanguage\empty \else - \ifcsname\??languagelinked\askedlanguage\endcsname - %\edef\askedlanguage{\csname\??languagelinked\askedlanguage\endcsname}% - \edef\askedlanguage{\lastnamedcs}% - \ifx\currentlanguage\askedlanguage \else - \setcurrentlanguage\currentmainlanguage\askedlanguage - \lang_basics_synchronize - \fi + {\ifcsname\??languagelinked\askedlanguage\endcsname + \edef\askedlanguage{\lastnamedcs}% + \ifx\currentlanguage\askedlanguage \else + \setcurrentlanguage\currentmainlanguage\askedlanguage + \lang_basics_synchronize \fi \fi} \unexpanded\def\uselanguageparameter#1% {\edef\askedlanguage{#1\c!language}% - \lang_basics_switch_asked} + \ifx\askedlanguage\empty\else\lang_basics_switch_asked\fi} + +\unexpanded\def\douselanguageparameter#1% fast setter + {\edef\askedlanguage{#1}% + \ifx\askedlanguage\empty\else\lang_basics_switch_asked\fi} \unexpanded\def\lang_basics_set_current[#1]% {\edef\askedlanguage{#1}% - \lang_basics_switch_asked} + \ifx\askedlanguage\empty\else\lang_basics_switch_asked\fi} \unexpanded\def\language {\doifelsenextoptionalcs\lang_basics_set_current\normallanguage} @@ -809,6 +801,9 @@ \clf_setlanguageexceptions{\askedlanguage}{#2}% \endgroup} +\unexpanded\def\hyphenation + {\clf_setlanguageexceptions{\currentlanguage}} + %D For the moment here: \uchyph 1 % also treat uppercase diff --git a/tex/context/base/mkiv/lpdf-ano.lua b/tex/context/base/mkiv/lpdf-ano.lua index 72800bc64..15ce2ca82 100644 --- a/tex/context/base/mkiv/lpdf-ano.lua +++ b/tex/context/base/mkiv/lpdf-ano.lua @@ -25,7 +25,8 @@ local trace_references = false trackers.register("references.references" local trace_destinations = false trackers.register("references.destinations", function(v) trace_destinations = v end) local trace_bookmarks = false trackers.register("references.bookmarks", function(v) trace_bookmarks = v end) -local log_destinations = false directives.register("destinations.log", function(v) log_destinations = v end) +local log_destinations = false directives.register("destinations.log", function(v) log_destinations = v end) +local untex_urls = true directives.register("references.untexurls", function(v) untex_urls = v end) local report_reference = logs.reporter("backend","references") local report_destination = logs.reporter("backend","destinations") @@ -579,10 +580,15 @@ local function pdffilelink(filename,destination,page,actions) } end +local untex = references.urls.untex + local function pdfurllink(url,destination,page) if not url or url == "" then return false end + if untex_urls then + url = untex(url) -- last minute cleanup of \* and spaces + end if destination and destination ~= "" then url = url .. "#" .. destination end diff --git a/tex/context/base/mkiv/mlib-pdf.lua b/tex/context/base/mkiv/mlib-pdf.lua index 711b860b8..5dbb308bc 100644 --- a/tex/context/base/mkiv/mlib-pdf.lua +++ b/tex/context/base/mkiv/mlib-pdf.lua @@ -391,7 +391,9 @@ local function setvariables(figure) return variables end -function metapost.comment() end +local function nocomment() end + +metapost.comment = nocomment function metapost.flush(result,flusher,askedfig) if result then @@ -408,7 +410,7 @@ function metapost.flush(result,flusher,askedfig) local textfigure = flusher.textfigure local processspecial = flusher.processspecial or metapost.processspecial local variables = setvariables(figure) -- also resets then in case of not found - metapost.comment = flusher.comment + metapost.comment = flusher.comment or nocomment for index=1,#figures do local figure = figures[index] local properties = setproperties(figure) @@ -633,7 +635,7 @@ function metapost.flush(result,flusher,askedfig) end end end - function metapost.comment() end + metapost.comment = nocomment end end end diff --git a/tex/context/base/mkiv/page-lay.mkiv b/tex/context/base/mkiv/page-lay.mkiv index 1fde9e9c9..eff30046f 100644 --- a/tex/context/base/mkiv/page-lay.mkiv +++ b/tex/context/base/mkiv/page-lay.mkiv @@ -372,7 +372,11 @@ \doifelseassignment{#2} {\definelayouttarget[#1][#2]} {\setevalue{\??layoutpaper#1}{#2}% - \setevalue{\??layoutprint#1}{#3}}% + \ifthirdargument + \setevalue{\??layoutprint#1}{#3}% + \else + \setevalue{\??layoutprint#1}{#2}% + \fi}% \fi} \appendtoks @@ -447,15 +451,12 @@ \let\setuppaper\page_paper_setup_size_settings \unexpanded\def\adaptpapersize - {\global\let\page_paper_reinstate\page_paper_reinstate_indeed + {\glet\page_paper_reinstate\page_paper_restore \setuppapersize} -\unexpanded\def\page_paper_reinstate_indeed - {\page_paper_restore - \global\let\page_paper_reinstate\relax} - \appendtoks \page_paper_reinstate + \global\let\page_paper_reinstate\relax \to \everyaftershipout \unexpanded\def\page_paper_set_restore#1#2% diff --git a/tex/context/base/mkiv/scrn-ini.mkvi b/tex/context/base/mkiv/scrn-ini.mkvi index 0e00fb456..6a4967961 100644 --- a/tex/context/base/mkiv/scrn-ini.mkvi +++ b/tex/context/base/mkiv/scrn-ini.mkvi @@ -177,15 +177,52 @@ %D Identity +% \def\scrn_identity_synchronize +% {\clf_setupidentity +% title {\interactionparameter\c!title}% +% subtitle {\interactionparameter\c!subtitle}% +% author {\interactionparameter\c!author}% +% creator {ConTeXt - \contextversion}% +% date {\interactionparameter\c!date}% +% keywords {\interactionparameter\c!keyword}% +% \relax} + +\newconditional\c_scrn_identity_preroll + +\installtexdirective + {interaction.identity.preroll} + {\settrue \c_scrn_identity_preroll} + {\setfalse\c_scrn_identity_preroll} + +\def\scrn_identity_prerolled#1% + {\begingroup + \edef\tempstring{\interactionparameter#1}% + \ifx\tempstring\empty + \endgroup + \else + \the\everypreroll + \nodestostring\tempstring{\tempstring}% + \normalexpanded{\endgroup\setexpandedinteractionparameter{#1}{\tempstring}}% + \fi} + \def\scrn_identity_synchronize - {\clf_setupidentity + {\begingroup + \ifconditional\c_scrn_identity_preroll + \scrn_identity_prerolled\c!title + \scrn_identity_prerolled\c!subtitle + \scrn_identity_prerolled\c!author + \scrn_identity_prerolled\c!date + \scrn_identity_prerolled\c!keyword + \fi + \clf_setupidentity title {\interactionparameter\c!title}% subtitle {\interactionparameter\c!subtitle}% author {\interactionparameter\c!author}% creator {ConTeXt - \contextversion}% date {\interactionparameter\c!date}% keywords {\interactionparameter\c!keyword}% - \relax} + \relax + \endgroup} \appendtoks \scrn_identity_synchronize @@ -193,11 +230,18 @@ % this comes before starttext +\def\scrn_identity_document#1#2% + {\doifvariable{document}{metadata:#1}{\setupinteraction[#2=\documentvariable{metadata:#1}]}} + \appendtoks % not interfaced i.e. english - \doifvariable{document}{metadata:author} {\setupinteraction [\c!author=\documentvariable{metadata:author}]}% - \doifvariable{document}{metadata:title} {\setupinteraction [\c!title=\documentvariable{metadata:title}]}% - \doifvariable{document}{metadata:subject} {\setupinteraction[\c!subject=\documentvariable{metadata:subject}]}% - \doifvariable{document}{metadata:keywords}{\setupinteraction[\c!keyword=\documentvariable{metadata:keywords}]}% + \scrn_identity_document {title}\c!title + \scrn_identity_document {subject}\c!subject + \scrn_identity_document{subtitle}\c!subtitle + \scrn_identity_document {author}\c!author + \scrn_identity_document {authors}\c!author + \scrn_identity_document {keyword}\c!keyword + \scrn_identity_document{keywords}\c!keyword + \scrn_identity_document {date}\c!date \to \everysetupdocument \setupinteraction diff --git a/tex/context/base/mkiv/spac-hor.mkiv b/tex/context/base/mkiv/spac-hor.mkiv index ab877d1d1..89ade8cfd 100644 --- a/tex/context/base/mkiv/spac-hor.mkiv +++ b/tex/context/base/mkiv/spac-hor.mkiv @@ -692,7 +692,7 @@ \global\s_spac_narrower_left \zeropoint \global\s_spac_narrower_right \zeropoint \global\s_spac_narrower_middle\zeropoint - \processcommalistwithparameters[#1]\spac_narrower_initialize + \normalexpanded{\processcommalistwithparameters[#1]}\spac_narrower_initialize \advance\leftskip \dimexpr\s_spac_narrower_left +\s_spac_narrower_middle\relax \advance\rightskip\dimexpr\s_spac_narrower_right+\s_spac_narrower_middle\relax \seteffectivehsize} diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex c8d2ebb99..814d9d80a 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 ce6b42056..0234cf08f 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-ref.lua b/tex/context/base/mkiv/strc-ref.lua index 4cb74095b..b678bd0d7 100644 --- a/tex/context/base/mkiv/strc-ref.lua +++ b/tex/context/base/mkiv/strc-ref.lua @@ -20,6 +20,7 @@ local rawget, tonumber, type = rawget, tonumber, type local lpegmatch = lpeg.match local insert, remove, copytable = table.insert, table.remove, table.copy local formatters = string.formatters +local P, Cs, lpegmatch = lpeg.P, lpeg.Cs, lpeg.match local allocate = utilities.storage.allocate local mark = utilities.storage.mark @@ -33,9 +34,7 @@ local trace_empty = false trackers.register("structures.referencing.empt local check_duplicates = true -directives.register("structures.referencing.checkduplicates", function(v) - check_duplicates = v -end) +directives.register("structures.referencing.checkduplicates", function(v) check_duplicates = v end) local report_references = logs.reporter("references") local report_unknown = logs.reporter("references","unknown") @@ -580,13 +579,24 @@ end) -- urls -local urls = references.urls or { } -references.urls = urls -local urldata = urls.data or { } -urls.data = urldata +local urls = references.urls or { } +references.urls = urls +local urldata = urls.data or { } +urls.data = urldata + +local p_untexurl = Cs ( ( + P("\\")/"" * (P("%")/"%%" + P(1)) + + P(" ")/"%%20" + + P(1) +)^1 ) + +function urls.untex(url) + return lpegmatch(p_untexurl,url) or url +end function urls.define(name,url,file,description) if name and name ~= "" then + -- url = lpegmatch(replacer,url) urldata[name] = { url or "", file or "", description or url or file or ""} end end diff --git a/tex/context/base/mkiv/typo-del.mkiv b/tex/context/base/mkiv/typo-del.mkiv index eb51a06e1..4c6d374a6 100644 --- a/tex/context/base/mkiv/typo-del.mkiv +++ b/tex/context/base/mkiv/typo-del.mkiv @@ -267,10 +267,41 @@ \def\c_typo_delimited_nesting{\csname\??delimitedtextlevel\currentparentdelimitedtext\endcsname} -\def\typo_delimited_push#1% - {\globalpushmacro\currentdelimitedtext - \def\currentdelimitedtext{#1}% - \setlanguageparameter\delimitedtextparameter +% the \setlanguageparameter macro sets but we are ungrouped .. only used here +% +% \currentusedlanguage +% \usedlanguageparameter + +\let\currentdelimitedlanguage\empty + +\def\typo_delimited_push#1#2% + {\globalpushmacro\currentdelimitedtext % can we combine these two + \globalpushmacro\currentdelimitedlanguage + \edef\currentdelimitedtext{#1}% + \edef\m_delimited_argument{#2}% + \expandafter\splitstring\m_delimited_argument\at:\to\outerdelimitedlanguage\and\innerdelimitedlanguage + \edef\m_delimited_argument_checked{\outerdelimitedlanguage:}% + \ifx\m_delimited_argument\m_delimited_argument_checked + \let\currentdelimitedlanguage\empty + \setlanguageparameter\delimitedtextparameter + \else + \ifx\innerdelimitedlanguage\empty + \let\currentdelimitedlanguage\empty + \else + \doiflanguageelse\innerdelimitedlanguage + {\let\currentdelimitedlanguage\innerdelimitedlanguage + \let\m_delimited_argument\empty}% + {\let\currentdelimitedlanguage\empty}% + \fi + \ifx\outerdelimitedlanguage\empty + \setlanguageparameter\delimitedtextparameter + \else + \doiflanguageelse\outerdelimitedlanguage + {\let\currentlanguage\outerdelimitedlanguage + \let\m_delimited_argument\empty}% + {\setlanguageparameter\delimitedtextparameter}% + \fi + \fi \let\currentparentdelimitedtext\currentdelimitedtext \global\advance\c_typo_delimited_nesting\plusone \edef\delimitedtextlevel{\number\c_typo_delimited_nesting}% @@ -279,6 +310,7 @@ \def\typo_delimited_pop {\global\advance\c_typo_delimited_nesting\minusone + \globalpopmacro\currentdelimitedlanguage \globalpopmacro\currentdelimitedtext} \installcorenamespace{delimitedtext} @@ -308,6 +340,7 @@ \c!right=, %\c!level=0, \c!method=, + %\c!language\v!local, \c!repeat=\v!no] \def\typo_delimited_repeat_ideed @@ -317,9 +350,12 @@ \let\typo_delimited_repeat\relax -\unexpanded\def\startdelimitedtext[#1]% +\unexpanded\def\startdelimitedtext + {\dodoubleempty\typo_delimited_text_start} + +\unexpanded\def\typo_delimited_text_start[#1][#2]% {\begingroup - \typo_delimited_push{#1}% + \typo_delimited_push{#1}{#2}% \dostarttaggedchained\t!delimitedblock\currentdelimitedtext\??delimitedtext \edef\p_delimited_method{\delimitedtextparameter\c!method}% \ifx\p_delimited_method\s!font @@ -355,12 +391,40 @@ \fi\fi} \def\typo_delimitedtexts_finish_font - {\removeunwantedspaces + {\removeunwantedspaces % again ? \dostarttagged\t!delimitedsymbol\empty \dotagsetdelimitedsymbol\s!right \delimitedtextparameter\c!right \dostoptagged} +\def\typo_delimited_show_language_indeed#1#2% + {\begingroup + \infofont + \setbox\scratchbox\hpack{\lower\strutht\hbox to \zeropoint{\darkred#1\currentlanguage:\currentdelimitedlanguage#2}}% + \vsmashbox\scratchbox + \box\scratchbox + \endgroup} + +\let\typo_delimited_show_language\gobbletwoarguments + +\installtextracker{delimited.language} + {\let\typo_delimited_show_language\typo_delimited_show_language_indeed} + {\let\typo_delimited_show_language\gobbletwoarguments} + +\def\typo_delimited_start_content + {\dostarttagged\t!delimitedcontent\empty + \begingroup + \douselanguageparameter\currentdelimitedlanguage + \typo_delimited_show_language<\hss + \ignorespaces} + +\def\typo_delimited_stop_content + {\removeunwantedspaces + \removelastskip % redundant + \typo_delimited_show_language\hss<% + \endgroup + \dostoptagged} + \def\typo_delimited_start_par {\dosingleempty\typo_delimited_start_par_indeed} @@ -373,14 +437,19 @@ \blank[\p_delimited_spacebefore]% \fi \delimitedtextparameter\c!before - \edef\m_typo_delimited_narrower{#1}% - \ifx\m_typo_delimited_narrower\empty + \iffirstargument + \edef\m_delimited_argument{#1}% + \fi + \ifx\m_delimited_argument\empty + \let\m_delimited_argument\m_delimited_argument + \fi + \ifx\m_delimited_argument\empty \endgraf \doadaptleftskip {\delimitedtextparameter\c!leftmargin}% \doadaptrightskip{\delimitedtextparameter\c!rightmargin}% \let\typo_delimited_stop_par_indeed\endgraf \else % backward compatible direct directive - \startnarrower[#1]% + \startnarrower[\m_delimited_argument]% \let\typo_delimited_stop_par_indeed\stopnarrower \fi % so far @@ -400,13 +469,10 @@ \setnextleftdelimitedtextmark \setnextrightdelimitedtextmark % - \ignorespaces - \dostarttagged\t!delimitedcontent\empty} + \typo_delimited_start_content} \def\typo_delimited_stop_par - {\removeunwantedspaces - \removelastskip - \dostoptagged + {\typo_delimited_stop_content \rightdelimitedtextmark \carryoverpar\endgroup % new per 2013-01-21 ... please left floats \popmacro\checkindentation @@ -424,12 +490,10 @@ \begingroup \usedelimitedtextstyleandcolor\c!style\c!color \typo_delimited_handle_left\c!left - \ignorespaces - \dostarttagged\t!delimitedcontent\empty} + \typo_delimited_start_content} \def\typo_delimited_stop_txt - {\removeunwantedspaces - \dostoptagged + {\typo_delimited_stop_content \typo_delimited_handle_right\c!right \endgroup} @@ -439,9 +503,12 @@ \typo_delimited_pop \endgroup} -\unexpanded\def\delimitedtext[#1]% +\unexpanded\def\delimitedtext + {\dodoubleempty\typo_delimited_text} + +\unexpanded\def\typo_delimited_text[#1][#2]% {\dontleavehmode % following ones can be omited - \typo_delimited_push{#1}% + \typo_delimited_push{#1}{#2}% \edef\p_delimited_method{\delimitedtextparameter\c!method}% \ifx\p_delimited_method\s!font \expandafter\typo_delimited_fontdriven @@ -569,7 +636,7 @@ % \stoptext \def\typo_delimited_handle_middle#1% - {\dostoptagged + {\typo_delimited_stop_content \begingroup \usedelimitedtextstyleandcolor\c!symstyle\c!symcolor \setbox\scratchbox\hbox{\delimitedtextparameter#1}% @@ -591,7 +658,7 @@ \kern\d_typo_delimited_signal % +- \prewordbreak \fi \endgroup - \dostarttagged\t!delimitedcontent\empty} + \typo_delimited_start_content} \def\typo_delimited_handle_left#1% {\begingroup @@ -652,10 +719,10 @@ {\dostarttaggedchained\t!delimited\currentdelimitedtext\??delimitedtext % block? \usedelimitedtextstyleandcolor\c!style\c!color \typo_delimited_handle_left\c!left - \dostarttagged\t!delimitedcontent\empty} - {\dostoptagged + \typo_delimited_start_content} + {\typo_delimited_stop_content \typo_delimited_handle_right\c!right - \removelastskip + \removelastskip % hm \dostoptagged \typo_delimited_pop}} @@ -667,52 +734,56 @@ \expandafter\typo_delimited_quoted \fi} -\def\typo_delimited_quoted_b - {\dostarttaggedchained\t!delimited\currentdelimitedtext\??delimitedtext +\def\typo_delimited_quoted + {\dontleavehmode + \begingroup + \dostarttaggedchained\t!delimited\currentdelimitedtext\??delimitedtext \typo_delimited_handle_left\c!left \usedelimitedtextstyleandcolor\c!style\c!color - \dostarttagged\t!delimitedcontent\empty} + \typo_delimited_start_content + \bgroup + \aftergroup\typo_delimited_quoted_e + \let\next=} \def\typo_delimited_quoted_e - {\dostoptagged + {\typo_delimited_stop_content \typo_delimited_handle_right\c!right \removelastskip % ? \dostoptagged - \typo_delimited_pop} + \typo_delimited_pop + \endgroup} -\def\typo_delimited_attributed_b - {\dostarttaggedchained\t!delimited\currentdelimitedtext\??delimitedtext +\def\typo_delimited_attributed + {\dontleavehmode + \begingroup + \dostarttaggedchained\t!delimited\currentdelimitedtext\??delimitedtext \usedelimitedtextstyleandcolor\c!style\c!color - \dostarttagged\t!delimitedcontent\empty - \ignorespaces} + \typo_delimited_start_content + \typo_delimited_attributed_e + \let\next=} \def\typo_delimited_attributed_e - {\dostoptagged + {\typo_delimited_stop_content \dostoptagged - \typo_delimited_pop} + \typo_delimited_pop + \endgroup} -\def\typo_delimited_fontdriven_b - {\dostarttaggedchained\t!delimited\currentdelimitedtext\??delimitedtext +\def\typo_delimited_fontdriven + {\dontleavehmode + \begingroup + \dostarttaggedchained\t!delimited\currentdelimitedtext\??delimitedtext \usedlanguageparameter{\c!left\currentparentdelimitedtext}% was: \currentdelimitedtext \usedelimitedtextstyleandcolor\c!style\c!color - \dostarttagged\t!delimitedcontent\empty} + \typo_delimited_start_content + \aftergroup\typo_delimited_fontdriven_e + \let\next=} \def\typo_delimited_fontdriven_e - {\dostoptagged + {\typo_delimited_stop_content \usedlanguageparameter{\c!right\currentparentdelimitedtext}% was: \currentdelimitedtext \dostoptagged - \typo_delimited_pop} - -% We now assume proper argument usage (so no longer grouped -% command). - -% \def\typo_delimited_quoted {\groupedcommand \typo_delimited_quoted_b \typo_delimited_quoted_e } -% \def\typo_delimited_attributed{\groupedcommand \typo_delimited_attributed_b\typo_delimited_attributed_e} -% \def\typo_delimited_fontdriven{\simplegroupedcommand\typo_delimited_fontdriven_b\typo_delimited_fontdriven_e} - -\def\typo_delimited_quoted {\bgroup\typo_delimited_quoted_b \aftergroup\typo_delimited_quoted_e \let\next=} -\def\typo_delimited_attributed{\bgroup\typo_delimited_attributed_b\aftergroup\typo_delimited_attributed_e\let\next=} -\def\typo_delimited_fontdriven{\bgroup\typo_delimited_fontdriven_b\aftergroup\typo_delimited_fontdriven_e\let\next=} + \typo_delimited_pop + \endgroup} % testcase for nesting: % diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex ef3eda61d..47ccdf72d 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-language.xml b/tex/context/interface/mkiv/i-language.xml index 26bdbf060..2339d925a 100644 --- a/tex/context/interface/mkiv/i-language.xml +++ b/tex/context/interface/mkiv/i-language.xml @@ -40,6 +40,10 @@ <cd:parameter name="patterns"> <cd:constant type="cd:file"/> </cd:parameter> + <cd:parameter name="factor"> + <cd:constant type="yes"/> + <cd:constant type="no" default="yes"/> + </cd:parameter> <cd:parameter name="lefthyphenmin"> <cd:constant type="cd:number"/> </cd:parameter> @@ -127,7 +131,7 @@ <cd:resolve name="argument-false"/> </cd:arguments> </cd:command> - + <cd:command name="doiflanguageelse" file="lang-ini.mkiv"> <cd:arguments> <cd:resolve name="argument-language"/> @@ -143,7 +147,7 @@ <cd:resolve name="argument-false"/> </cd:arguments> </cd:command> - + <cd:command name="doifpatternselse" file="lang-ini.mkiv"> <cd:arguments> <cd:resolve name="argument-language"/> @@ -197,4 +201,4 @@ </cd:arguments> </cd:command> -</cd:interface>
\ No newline at end of file +</cd:interface> diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 1dc8b1bcd..3f81a9213 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/common/s-abr-01.tex b/tex/context/modules/common/s-abr-01.tex index 156b9b938..fd6c66419 100644 --- a/tex/context/modules/common/s-abr-01.tex +++ b/tex/context/modules/common/s-abr-01.tex @@ -179,6 +179,7 @@ \logo [METATYPE] {MetaType1} \logo [MODULA] {Modula} \logo [MOV] {mov} +\logo [MPEG] {mpeg} \logo [MPS] {mps} \logo [MPTOPDF] {mptopdf} \logo [MPLIB] {mplib} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index e293f83d7..3fb2ad368 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 : 07/15/16 23:30:10 +-- merge date : 07/18/16 16:46:35 do -- begin closure to overcome local limits and interference |