From 4d13b54052e73da1c5acc266be1fd5ddca50e8e0 Mon Sep 17 00:00:00 2001 From: Marius Date: Mon, 3 Dec 2012 21:20:13 +0200 Subject: beta 2012.12.03 20:04 --- tex/context/base/back-ini.lua | 2 +- tex/context/base/chem-str.lua | 12 ++-- tex/context/base/colo-ini.lua | 3 +- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4101 -> 4140 bytes tex/context/base/context-version.png | Bin 40367 -> 40011 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/lpdf-ini.lua | 2 +- tex/context/base/status-files.pdf | Bin 24411 -> 24488 bytes tex/context/base/status-lua.pdf | Bin 199573 -> 199214 bytes tex/context/base/syst-con.lua | 11 +++ tex/context/base/syst-con.mkiv | 10 ++- tex/context/base/type-imp-lucida-opentype.mkiv | 4 +- tex/context/base/util-prs.lua | 74 +++++++++++++++++---- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 17 files changed, 98 insertions(+), 30 deletions(-) (limited to 'tex') diff --git a/tex/context/base/back-ini.lua b/tex/context/base/back-ini.lua index f76b85438..f6b2f60f1 100644 --- a/tex/context/base/back-ini.lua +++ b/tex/context/base/back-ini.lua @@ -97,6 +97,6 @@ tables.vfspecials = allocate { function commands.pdfrotation(a) -- somewhat weird here local s, c = sind(a), cosd(a) - context("%s %s %s %s",c,s,-s,c) + context("%0.6f %0.6f %0.6f %0.6f",c,s,-s,c) end diff --git a/tex/context/base/chem-str.lua b/tex/context/base/chem-str.lua index 83cfba6bf..8c154cc36 100644 --- a/tex/context/base/chem-str.lua +++ b/tex/context/base/chem-str.lua @@ -31,6 +31,7 @@ local format, gmatch, match, lower, gsub = string.format, string.gmatch, string. local concat, insert, remove = table.concat, table.insert, table.remove local processor_tostring = typesetters and typesetters.processors.tostring local settings_to_array = utilities.parsers.settings_to_array +local settings_to_array_with_repeat = utilities.parsers.settings_to_array_with_repeat local lpegmatch = lpeg.match local P, R, S, C, Cs, Ct, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.Cc @@ -216,8 +217,8 @@ function chemistry.define(name,spec,text) definitions[name] = dn end dn[#dn+1] = { - spec = settings_to_array(lower(spec)), - text = settings_to_array(text), + spec = settings_to_array_with_repeat(lower(spec),true), + text = settings_to_array_with_repeat(text,true), } end @@ -582,8 +583,9 @@ end function chemistry.component(spec,text,settings) rulethickness, rulecolor, offset = settings.rulethickness, settings.rulecolor - local spec = settings_to_array(spec) - local text = settings_to_array(text) + local spec = settings_to_array_with_repeat(spec,true) -- no lower? + local text = settings_to_array_with_repeat(text,true) +-- inspect(spec) metacode[#metacode+1] = t_start_component process(spec,text,1,rulethickness,rulecolor) -- offset? metacode[#metacode+1] = t_stop_component @@ -619,7 +621,7 @@ local inline = { } function commands.inlinechemical(spec) - local spec = settings_to_array(spec) + local spec = settings_to_array_with_repeat(spec,true) for i=1,#spec do local s = spec[i] local inl = inline[lower(s)] diff --git a/tex/context/base/colo-ini.lua b/tex/context/base/colo-ini.lua index 51f66025e..4fdbf4545 100644 --- a/tex/context/base/colo-ini.lua +++ b/tex/context/base/colo-ini.lua @@ -288,7 +288,8 @@ local right = P(")") local comma = P(",") local mixnumber = lpegpatterns.number / tonumber local mixname = C(P(1-left-right-comma)^1) -local mixcolor = Cc("M") * mixnumber * left * mixname * (comma * mixname)^-1 * right * P(-1) +----- mixcolor = Cc("M") * mixnumber * left * mixname * (comma * mixname)^-1 * right * P(-1) +local mixcolor = Cc("M") * mixnumber * left * mixname * (comma * mixname)^0 * right * P(-1) -- one is also ok local exclamation = P("!") local pgfnumber = lpegpatterns.digit^0 / function(s) return tonumber(s)/100 end diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 83c27547e..dfa0c04a8 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.12.03 11:33} +\newcontextversion{2012.12.03 20:04} %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/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 75f387e59..94c45f8f3 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.12.03 11:33} +\newcontextversion{2012.12.03 20:04} %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/context-version.pdf b/tex/context/base/context-version.pdf index b42a55d11..4f4f7a4d8 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png index 492244e80..bb7d07636 100644 Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 08ee26d3f..e052354aa 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2012.12.03 11:33} +\edef\contextversion{2012.12.03 20:04} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 60260f68f..01f8969fe 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.12.03 11:33} +\edef\contextversion{2012.12.03 20:04} %D For those who want to use this: diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua index 88999358c..1591d6da1 100644 --- a/tex/context/base/lpdf-ini.lua +++ b/tex/context/base/lpdf-ini.lua @@ -703,7 +703,7 @@ registerpagefinalizer(checkshades,3,"shades") function lpdf.rotationcm(a) local s, c = sind(a), cosd(a) - return format("%s %s %s %s 0 0 cm",c,s,-s,c) + return format("%0.6f %0.6f %0.6f %0.6f 0 0 cm",c,s,-s,c) end -- ! -> universaltime diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 3d9408372..905dd140f 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 0340c0484..cdc59418d 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/syst-con.lua b/tex/context/base/syst-con.lua index 2eaf98fd7..f3f1b98cf 100644 --- a/tex/context/base/syst-con.lua +++ b/tex/context/base/syst-con.lua @@ -39,3 +39,14 @@ function commands.format(fmt,...) -- used ? fmt = gsub(fmt,"@","%%") context(fmt,...) end + +local cosd, sind, tand = math.cosd, math.sind, math.tand +local cos, sin, tan = math.cos, math.sin, math.tan + +function commands.sind(n) context("%0.6f",sind(n)) end +function commands.cosd(n) context("%0.6f",cosd(n)) end +function commands.tand(n) context("%0.6f",tand(n)) end + +function commands.sin(n) context("%0.6f",sin(n)) end +function commands.cos(n) context("%0.6f",cos(n)) end +function commands.tan(n) context("%0.6f",tan(n)) end diff --git a/tex/context/base/syst-con.mkiv b/tex/context/base/syst-con.mkiv index 6ef734c8f..de8ed597e 100644 --- a/tex/context/base/syst-con.mkiv +++ b/tex/context/base/syst-con.mkiv @@ -134,9 +134,13 @@ % \let\calculatecos\gobbleoneargument % \let\calculatetan\gobbleoneargument -\def\setcalculatedsin#1#2{\edef#1{\cldcontext{math.sind(#2)}}} -\def\setcalculatedcos#1#2{\edef#1{\cldcontext{math.cosd(#2)}}} -\def\setcalculatedtan#1#2{\edef#1{\cldcontext{math.tand(#2)}}} +% \def\setcalculatedsin#1#2{\edef#1{\cldcontext{math.sind(#2)}}} % jit-unsafe +% \def\setcalculatedcos#1#2{\edef#1{\cldcontext{math.cosd(#2)}}} % jit-unsafe +% \def\setcalculatedtan#1#2{\edef#1{\cldcontext{math.tand(#2)}}} % jit-unsafe + +\def\setcalculatedsin#1#2{\edef#1{\ctxcommand{sind(#2)}}} +\def\setcalculatedcos#1#2{\edef#1{\ctxcommand{cosd(#2)}}} +\def\setcalculatedtan#1#2{\edef#1{\ctxcommand{tand(#2)}}} \def\formatted#1{\ctxcommand{format(#1)}} \unexpanded\def\format #1{\ctxcommand{format(#1)}} diff --git a/tex/context/base/type-imp-lucida-opentype.mkiv b/tex/context/base/type-imp-lucida-opentype.mkiv index 8c4ff3bba..63a331cad 100644 --- a/tex/context/base/type-imp-lucida-opentype.mkiv +++ b/tex/context/base/type-imp-lucida-opentype.mkiv @@ -56,8 +56,8 @@ \stoptypescript \starttypescript [\s!math] [lucidanova,lucidaot,otlucida] - \definefontsynonym [\s!MathRoman] [\s!file:LucidaBrightMathOT.otf] [\s!features=\s!math\mathsizesuffix,\s!goodies=lucidanova-math] - \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT-Demi.otf] [\s!features=\s!math\mathsizesuffix,\s!goodies=lucidanova-math] + \definefontsynonym [\s!MathRoman] [\s!file:LucidaBrightMathOT.otf] [\s!features=\s!math\mathsizesuffix,\s!goodies=lucida-opentype-math] + \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT-Demi.otf] [\s!features=\s!math\mathsizesuffix,\s!goodies=lucida-opentype-math] \stoptypescript \starttypescript [\s!handwriting] [lucidanova,lucidaot,otlucida] diff --git a/tex/context/base/util-prs.lua b/tex/context/base/util-prs.lua index 3cfb3e5f3..dc1526df7 100644 --- a/tex/context/base/util-prs.lua +++ b/tex/context/base/util-prs.lua @@ -23,11 +23,14 @@ local sortedhash = table.sortedhash -- we share some patterns +local digit = R("09") local space = P(' ') local equal = P("=") local comma = P(",") local lbrace = P("{") local rbrace = P("}") +local lparent = P("(") +local rparent = P(")") local period = S(".") local punctuation = S(".,:;") local spacer = patterns.spacer @@ -36,6 +39,9 @@ local newline = patterns.newline local anything = patterns.anything local endofstring = patterns.endofstring +local nobrace = 1 - ( lbrace + rbrace ) +local noparent = 1 - ( lparent + rparent) + -- we could use a Cf Cg construct local escape, left, right = P("\\"), P('{'), P('}') @@ -45,17 +51,19 @@ patterns.balanced = P { [2] = left * V(1) * right } -local nobrace = 1 - (lbrace+rbrace) -local nested = P { lbrace * (nobrace + V(1))^0 * rbrace } -local spaces = space^0 -local argument = Cs((lbrace/"") * ((nobrace + nested)^0) * (rbrace/"")) -local content = (1-endofstring)^0 +local nestedbraces = P { lbrace * (nobrace + V(1))^0 * rbrace } +local nestedparents = P { lparent * (noparent + V(1))^0 * rparent } +local spaces = space^0 +local argument = Cs((lbrace/"") * ((nobrace + nestedbraces)^0) * (rbrace/"")) +local content = (1-endofstring)^0 -patterns.nested = nested -- no capture -patterns.argument = argument -- argument after e.g. = -patterns.content = content -- rest after e.g = +patterns.nestedbraces = nestedbraces -- no capture +patterns.nestedparents = nestedparents -- no capture +patterns.nested = nestedbraces -- no capture +patterns.argument = argument -- argument after e.g. = +patterns.content = content -- rest after e.g = -local value = P(lbrace * C((nobrace + nested)^0) * rbrace) + C((nested + (1-comma))^0) +local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace) + C((nestedbraces + (1-comma))^0) local key = C((1-equal-comma)^1) local pattern_a = (space+comma)^0 * (key * equal * value + key * C("")) @@ -125,7 +133,8 @@ function parsers.settings_to_hash_strict(str,existing) end local separator = comma * space^0 -local value = P(lbrace * C((nobrace + nested)^0) * rbrace) + C((nested + (1-comma))^0) +local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace) + + C((nestedbraces + (1-comma))^0) local pattern = spaces * Ct(value*(separator*value)^0) -- "aap, {noot}, mies" : outer {} removes, leading spaces ignored @@ -220,7 +229,49 @@ function parsers.simple_hash_to_string(h, separator) return concat(t,separator or ",") end -local value = lbrace * C((nobrace + nested)^0) * rbrace +-- for chem (currently one level) + +local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace) + + C(digit^1 * lparent * (noparent + nestedparents)^0 * rparent) + + C((nestedbraces + (1-comma))^0) +local pattern_a = spaces * Ct(value*(separator*value)^0) + +local function repeater(n,str) + if not n then + return str + else + local s = lpegmatch(pattern_a,str) + if n == 1 then + return unpack(s) + else + local t, tn = { }, 0 + for i=1,n do + for j=1,#s do + tn = tn + 1 + t[tn] = s[j] + end + end + return unpack(t) + end + end +end + +local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace) + + (C(digit^1)/tonumber * lparent * Cs((noparent + nestedparents)^0) * rparent) / repeater + + C((nestedbraces + (1-comma))^0) +local pattern_b = spaces * Ct(value*(separator*value)^0) + +function parsers.settings_to_array_with_repeat(str,expand) + if expand then + return lpegmatch(pattern_b,str) + else + return lpegmatch(pattern_a,str) + end +end + +-- + +local value = lbrace * C((nobrace + nestedbraces)^0) * rbrace local pattern = Ct((space + value)^0) function parsers.arguments_to_table(str) @@ -251,7 +302,6 @@ function parsers.listitem(str) end -- -local digit = R("09") local pattern = Cs { "start", start = V("one") + V("two") + V("three"), diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 75d8ab775..e2bf1f807 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 : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 12/03/12 11:33:58 +-- merge date : 12/03/12 20:04:01 do -- begin closure to overcome local limits and interference -- cgit v1.2.3