From f9ccde99028609a89c3a933a9ec761cb2f7d0815 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 29 Apr 2010 22:30:00 +0200 Subject: beta 2010.04.29 22:30 --- tex/context/base/back-pdf.mkiv | 2 +- tex/context/base/buff-ver.mkii | 5 ++ tex/context/base/buff-ver.mkiv | 5 ++ tex/context/base/chem-str.lua | 2 +- tex/context/base/core-def.mkii | 9 ++++ tex/context/base/core-def.mkiv | 4 ++ tex/context/base/font-otn.lua | 56 ++++++++++++++++++--- tex/context/base/math-def.mkiv | 2 + tex/context/base/math-tex.mkii | 2 + tex/context/base/meta-ini.mkiv | 62 ++++++++++++++++------- tex/context/base/mlib-ctx.lua | 37 ++++++++++++-- tex/context/base/mlib-pdf.lua | 2 + tex/context/base/mlib-pps.lua | 77 ++++++++++++++--------------- tex/context/base/mult-de.tex | 2 + tex/context/base/mult-def.lua | 8 +++ tex/context/base/mult-en.tex | 2 + tex/context/base/mult-fr.tex | 2 + tex/context/base/mult-it.tex | 2 + tex/context/base/mult-nl.tex | 2 + tex/context/base/mult-ro.tex | 2 + tex/context/base/page-mis.mkiv | 4 +- tex/context/base/s-pre-64.tex | 2 +- tex/context/base/spac-ver.lua | 28 +++++++++-- tex/context/base/strc-ren.mkiv | 6 +-- tex/context/base/supp-ran.lua | 7 ++- tex/context/base/type-otf.mkiv | 28 ++++++++--- tex/context/interface/keys-cs.xml | 2 + tex/context/interface/keys-de.xml | 2 + tex/context/interface/keys-en.xml | 2 + tex/context/interface/keys-fr.xml | 2 + tex/context/interface/keys-it.xml | 2 + tex/context/interface/keys-nl.xml | 2 + tex/context/interface/keys-pe.xml | 2 + tex/context/interface/keys-ro.xml | 2 + tex/generic/context/luatex-fonts-merged.lua | 58 +++++++++++++++++++--- 35 files changed, 334 insertions(+), 100 deletions(-) (limited to 'tex') diff --git a/tex/context/base/back-pdf.mkiv b/tex/context/base/back-pdf.mkiv index 4201a5fce..a10afd5b9 100644 --- a/tex/context/base/back-pdf.mkiv +++ b/tex/context/base/back-pdf.mkiv @@ -107,7 +107,7 @@ \def\dostartmirroring{\pdfliteral{-1 0 0 1 0 0 cm}} \def\dostopmirroring {\pdfliteral{-1 0 0 1 0 0 cm}} -\def\dostartclipping#1#2#3% todo +\def\dostartclipping#1#2#3% todo (still needed?) {\PointsToBigPoints{#2}\width \PointsToBigPoints{#3}\height \grabMPclippath{#1}{1}\width\height{0 0 m \width\space 0 l \width \height l 0 \height l}% diff --git a/tex/context/base/buff-ver.mkii b/tex/context/base/buff-ver.mkii index 87a269ab9..e7ad5474f 100644 --- a/tex/context/base/buff-ver.mkii +++ b/tex/context/base/buff-ver.mkii @@ -635,6 +635,11 @@ \unexpanded\def\mat{\groupedcommand{\setgroupedtype\$}{\$}} \unexpanded\def\dis{\groupedcommand{\setgroupedtype\$\$}{\$\$}} +\let\normaltexttex\tex +\let\normaltextarg\arg +\let\normaltextmat\mat +\let\normaltextdis\dis + %D \macros %D {starttyping} %D diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv index 9948ccf7e..15b40e9b9 100644 --- a/tex/context/base/buff-ver.mkiv +++ b/tex/context/base/buff-ver.mkiv @@ -514,6 +514,11 @@ \unexpanded\def\mat{\groupedcommand{\setgroupedtype\$}{\$}} \unexpanded\def\dis{\groupedcommand{\setgroupedtype\$\$}{\$\$}} +\let\normaltexttex\tex +\let\normaltextarg\arg +\let\normaltextmat\mat +\let\normaltextdis\dis + \def\astype {\groupedcommand\dorawtype\relax} diff --git a/tex/context/base/chem-str.lua b/tex/context/base/chem-str.lua index 8dc073d49..ad4cc6c1b 100644 --- a/tex/context/base/chem-str.lua +++ b/tex/context/base/chem-str.lua @@ -443,7 +443,7 @@ function chemicals.stop() if trace_structure then logs.report("chemical", "metapost code:\n%s", mpcode) end - metapost.graphic(chemicals.instance,chemicals.format,mpcode,"") + metapost.graphic(chemicals.instance,chemicals.format,mpcode) metacode = nil end diff --git a/tex/context/base/core-def.mkii b/tex/context/base/core-def.mkii index bcf8d6b9d..840f853a7 100644 --- a/tex/context/base/core-def.mkii +++ b/tex/context/base/core-def.mkii @@ -74,6 +74,13 @@ % \appendtoks\everyjob\expandafter{\the\everyjob\checkpreprocessor}\to\everydump +% temporary here: + +% \in \at \about \from \over + +\unexpanded\def\arg{\mathortext\normalmatharg\normaltextarg} + +% brrr % normally one does not want this to happen nested, maybe there % is more; non public vars btw, will become conditionals @@ -93,4 +100,6 @@ \prependtoks \synctexwarning \to \everystarttext \appendtoks \synctexwarning \to \everystoptext +% last minute hacks + \protect \endinput diff --git a/tex/context/base/core-def.mkiv b/tex/context/base/core-def.mkiv index d94a46405..64b63e58d 100644 --- a/tex/context/base/core-def.mkiv +++ b/tex/context/base/core-def.mkiv @@ -66,6 +66,10 @@ \ifdefined\from \let\normalmathfrom \from \unexpanded\def\from {\mathortext\normalmathfrom \dospecialfrom } \else \let\from \dospecialfrom \fi \ifdefined\over \let\normalmathover \over \unexpanded\def\over {\mathortext\normalmathover \dospecialabout} \else \let\over \dospecialabout \fi +\unexpanded\def\arg{\mathortext\normalmatharg\normaltextarg} + +% brrr + \appendtoks \synchronizegloballinespecs \synchronizelocallinespecs diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua index eb7c7e315..3aa1927d3 100644 --- a/tex/context/base/font-otn.lua +++ b/tex/context/base/font-otn.lua @@ -1541,6 +1541,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence local skipmark, skipligature, skipbase = flags[1], flags[2], flags[3] local someskip = skipmark or skipligature or skipbase -- could be stored in flags for a fast test (hm, flags could be false !) local markclass = sequence.markclass -- todo, first we need a proper test + local skipped = false for k=1,#contexts do local match, current, last = true, start, start local ck = contexts[k] @@ -1575,6 +1576,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence if ccd then local class = ccd.class if class == skipmark or class == skipligature or class == skipbase or (markclass and class == "mark" and not markclass[char]) then + skipped = true if trace_skips then show_skip(kind,chainname,char,ck,class) end @@ -1619,6 +1621,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence if ccd then local class = ccd.class if class == skipmark or class == skipligature or class == skipbase or (markclass and class == "mark" and not markclass[char]) then + skipped = true if trace_skips then show_skip(kind,chainname,char,ck,class) end @@ -1673,6 +1676,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence if ccd then local class = ccd.class if class == skipmark or class == skipligature or class == skipbase or (markclass and class == "mark" and not markclass[char]) then + skipped = true if trace_skips then show_skip(kind,chainname,char,ck,class) end @@ -1738,8 +1742,47 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence end else -- actually this needs a more complex treatment for which we will use chainmores +--~ local i = 1 +--~ repeat +--~ local chainlookupname = chainlookups[i] +--~ local chainlookup = lookuptable[chainlookupname] +--~ local cp = chainmores[chainlookup.type] +--~ if cp then +--~ local ok, n +--~ start, ok, n = cp(start,last,kind,chainname,ck,cache,chainlookup,chainlookupname,i,sequence) +--~ -- messy since last can be changed ! +--~ if ok then +--~ done = true +--~ start = start.next +--~ if n then +--~ -- skip next one(s) if ligature +--~ i = i + n - 1 +--~ end +--~ end +--~ else +--~ logprocess("%s: multiple subchains for %s are not yet supported",cref(kind,chainname,chainlookupname),chainlookup.type) +--~ end +--~ i = i + 1 +--~ until i > nofchainlookups + local i = 1 repeat +if skipped then + while true do + local char = start.char + local ccd = descriptions[char] + if ccd then + local class = ccd.class + if class == skipmark or class == skipligature or class == skipbase or (markclass and class == "mark" and not markclass[char]) then + start = start.next + else + break + end + else + break + end + end +end local chainlookupname = chainlookups[i] local chainlookup = lookuptable[chainlookupname] local cp = chainmores[chainlookup.type] @@ -1749,17 +1792,18 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence -- messy since last can be changed ! if ok then done = true - start = start.next - if n then - -- skip next one(s) if ligature - i = i + n - 1 - end + -- skip next one(s) if ligature + i = i + (n or 1) + else + i = i + 1 end else logprocess("%s: multiple subchains for %s are not yet supported",cref(kind,chainname,chainlookupname),chainlookup.type) + i = i + 1 end - i = i + 1 + start = start.next until i > nofchainlookups + end else local replacements = ck[7] diff --git a/tex/context/base/math-def.mkiv b/tex/context/base/math-def.mkiv index 604e2d8d2..a61023eae 100644 --- a/tex/context/base/math-def.mkiv +++ b/tex/context/base/math-def.mkiv @@ -104,6 +104,8 @@ \definemathcommand [complexes] {{\mathblackboard C}} \definemathcommand [primes] {{\mathblackboard P}} +\let\normalmatharg\arg % todo: maybe automatically + % using attributes \chardef\bigmathdelimitermethod\plusone diff --git a/tex/context/base/math-tex.mkii b/tex/context/base/math-tex.mkii index c833db956..8f34a190e 100644 --- a/tex/context/base/math-tex.mkii +++ b/tex/context/base/math-tex.mkii @@ -180,6 +180,8 @@ \stopmathcollection +\let\normalmatharg\arg % todo: maybe automatically + \startmathcollection[default] \definemathcommand [integers] {\mfunction{Z}} diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv index 14d7af1c3..9b26dbd44 100644 --- a/tex/context/base/meta-ini.mkiv +++ b/tex/context/base/meta-ini.mkiv @@ -138,9 +138,14 @@ \def\MPaskedfigure{false} -\long\def\processMPgraphic#1% todo: extensions and inclusions outside beginfig - {\begingroup % needed? -\forgetall +\def\currentMPinitializations + {\ifconditional\includeMPinitializations\the\MPinitializations;\fi\theMPrandomseed;} + +\def\currentMPpreamble + {\ifconditional\includeMPextensions\the\MPextensions;\the\MPuserinclusions;\fi\the\MPinstancetoks;} + +\def\dostartcurrentMPgraphic + {\begingroup \enableincludeMPgraphics \the\everyMPgraphic \presetMPdefinitions @@ -151,18 +156,28 @@ {\setfalse\includeMPextensions}% \doifelsevalue{\@@MPF\currentMPgraphicinstance\s!initializations}\v!yes {\settrue \includeMPinitializations}% - {\setfalse\includeMPinitializations}% + {\setfalse\includeMPinitializations}} + +\def\dostopcurrentMPgraphic + {\global\MPinstancetoks\emptytoks + \global\settrue\METAFUNinitialized % becomes obsolete + \endgroup} + +\unexpanded\long\def\processMPgraphic#1% todo: extensions and inclusions outside beginfig + {\dostartcurrentMPgraphic + \forgetall \setbox\MPgraphicbox\hbox\bgroup - \normalexpanded{\noexpand\ctxlua{metapost.graphic("\currentMPgraphicinstance", "\currentMPgraphicformat", - \!!bs\ifconditional\includeMPinitializations\the\MPinitializations;\fi\theMPrandomseed;#1;\!!es, - \!!bs\ifconditional\includeMPextensions\the\MPextensions;\the\MPuserinclusions;\fi\the\MPinstancetoks;\!!es, - \MPaskedfigure + \normalexpanded{\noexpand\ctxlua{metapost.graphic( + "\currentMPgraphicinstance", + "\currentMPgraphicformat", + \!!bs#1\!!es, + \!!bs\currentMPinitializations\!!es, + \!!bs\currentMPpreamble\!!es, + \MPaskedfigure )}}% \egroup - \global\MPinstancetoks\emptytoks - \global\settrue\METAFUNinitialized % becomes obsolete \placeMPgraphic - \endgroup} + \dostopcurrentMPgraphic} \newif\ifsetMPrandomseed \setMPrandomseedtrue % false by default @@ -235,7 +250,7 @@ \def\getMPdrawing {\ifMPdrawingdone - \expandafter\processMPgraphic\expandafter{\MPdrawingdata}% + \expandafter\processMPgraphic\expandafter{\MPdrawingdata}% is this expansion still needed? \fi} \def\startMPdrawing @@ -252,8 +267,19 @@ \let\stopMPdrawing\relax -\long\def\startMPclip#1#2\stopMPclip - {\long\setgvalue{MPC:#1}{\ctxlua{metapost.getclippath(\!!bs#2\!!es)}}} +\long\def\startMPclip#1#2\stopMPclip % todo: store at the lua end + {\dostartcurrentMPgraphic + \long\setxvalue{MPC:#1}{\noexpand\ctxlua{metapost.theclippath( + "\currentMPgraphicinstance", + "\currentMPgraphicformat", + \!!bs#2\!!es, + \!!bs\currentMPinitializations\!!es, + \!!bs\currentMPpreamble\!!es + )}}% + \dostopcurrentMPgraphic} + +% \unexpanded\def\processMPgraphic +% {\doprocessMPgraphic\placeMPgraphic} \let\stopMPclip\relax @@ -447,8 +473,7 @@ \def\@@meta{#1:}% \extendMPoverlaystamp{#2}% incl prepare \ifcsname\@@MPG\overlaystamp:#1\endcsname\else - \enableincludeMPgraphics -% \forgetall + \enableincludeMPgraphics % redundant \global\advance\MPobjectcounter\plusone \setobject{MP}{\number\MPobjectcounter}\hbox{\processMPgraphic{#3}}% was vbox, graphic must end up as hbox \setxvalue{\@@MPG\overlaystamp:#1}{\noexpand\reuseMPbox{\number\MPobjectcounter}{\MPllx}{\MPlly}{\MPurx}{\MPury}}% @@ -475,10 +500,9 @@ \long\def\handleuseMPgraphic#1#2#3% {\begingroup -% \forgetall % check this \def\@@meta{#1:}% \prepareMPvariables{#2}% - \enableincludeMPgraphics + \enableincludeMPgraphics % redundant \processMPgraphic{#3}% \endgroup} @@ -501,7 +525,7 @@ {\begingroup \def\@@meta{#1:}% \prepareMPvariables{#2}% - \enableincludeMPgraphics + \enableincludeMPgraphics % redundant \global\advance\MPobjectcounter\plusone \setobject{MP}{\number\MPobjectcounter}\hbox{\processMPgraphic{#3}}% was vbox, graphic must end up as hbox \setxvalue{\@@MPG#1}{\noexpand\reuseMPbox{\number\MPobjectcounter}{\MPllx}{\MPlly}{\MPurx}{\MPury}}% diff --git a/tex/context/base/mlib-ctx.lua b/tex/context/base/mlib-ctx.lua index 588833f65..7d7e936cf 100644 --- a/tex/context/base/mlib-ctx.lua +++ b/tex/context/base/mlib-ctx.lua @@ -11,12 +11,32 @@ if not modules then modules = { } end modules ['mlib-ctx'] = { local format, join = string.format, table.concat local sprint = tex.sprint +local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming + metapost = metapost or {} metapost.defaultformat = "metafun" -function metapost.graphic(instance,mpsformat,str,preamble,askedfig) +function metapost.graphic(instance,mpsformat,str,initializations,preamble,askedfig) local mpx = metapost.format(instance,mpsformat or metapost.defaultformat) - metapost.graphic_base_pass(mpx,str,preamble,askedfig) + metapost.graphic_base_pass(mpx,str,initializations,preamble,askedfig) +end + +function metapost.getclippath(instance,mpsformat,data,initializations,preamble) + local mpx = metapost.format(instance,mpsformat or metapost.defaultformat) + if mpx and data then + starttiming(metapost) + starttiming(metapost.exectime) + local result = mpx:execute(format("%s;beginfig(1);%s;%s;endfig;",preamble or "",initializations or "",data)) + stoptiming(metapost.exectime) + if result.status > 0 then + logs.report("metafun", "%s: %s", result.status, result.error or result.term or result.log) + result = nil + else + result = metapost.filterclippath(result) + end + stoptiming(metapost) + return result + end end function metapost.filterclippath(result) @@ -26,16 +46,25 @@ function metapost.filterclippath(result) local figure = figures[1] local objects = figure:objects() if objects then + local lastclippath for o=1,#objects do local object = objects[o] if object.type == "start_clip" then - return join(metapost.flushnormalpath(object.path,{ }),"\n") + lastclippath = object.path end end + return lastclippath end end end - return "" +end + +function metapost.theclippath(...) + local result = metapost.getclippath(...) + if result then -- we could just print the table + result = join(metapost.flushnormalpath(object.path),"\n") + sprint(result) + end end statistics.register("metapost processing time", function() diff --git a/tex/context/base/mlib-pdf.lua b/tex/context/base/mlib-pdf.lua index ca405925f..352070408 100644 --- a/tex/context/base/mlib-pdf.lua +++ b/tex/context/base/mlib-pdf.lua @@ -155,6 +155,7 @@ local function curved(ith,pth) end local function flushnormalpath(path, t, open) + t = t or { } local pth, ith for i=1,#path do pth = path[i] @@ -183,6 +184,7 @@ local function flushnormalpath(path, t, open) end local function flushconcatpath(path, t, open) + t = t or { } t[#t+1] = format("%f %f %f %f %f %f cm", sx, rx, ry, sy, tx ,ty) local pth, ith for i=1,#path do diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua index 36bf45c2b..900e0c7e7 100644 --- a/tex/context/base/mlib-pps.lua +++ b/tex/context/base/mlib-pps.lua @@ -16,6 +16,7 @@ local sprint = tex.sprint local tonumber, type = tonumber, type local lpegmatch = lpeg.match local texbox = tex.box +local copy_list = node.copy_list local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming @@ -421,7 +422,7 @@ end -- no need for a before here -local current_format, current_graphic +local current_format, current_graphic, current_initializations -- metapost.first_box = metapost.first_box or 1000 -- metapost.last_box = metapost.last_box or 1100 @@ -450,7 +451,7 @@ function metapost.free_boxes() -- todo: mp direct list ipv box end function metapost.settext(box,slot) - textexts[slot] = node.copy_list(texbox[box]) + textexts[slot] = copy_list(texbox[box]) texbox[box] = nil -- this will become -- textexts[slot] = texbox[box] @@ -458,8 +459,8 @@ function metapost.settext(box,slot) end function metapost.gettext(box,slot) - texbox[box] = textexts[slot] - textexts[slot] = nil + texbox[box] = copy_list(textexts[slot]) +-- textexts[slot] = nil -- no, pictures can be placed several times end function metapost.specials.tf(specification,object) @@ -727,6 +728,13 @@ function metapost.sxsy(wd,ht,dp) -- helper for text return (wd ~= 0 and factor/wd) or 0, (hd ~= 0 and factor/hd) or 0 end +local no_trial_run = "_trial_run_ := false ;" +local do_trial_run = "if unknown _trial_run_ : boolean _trial_run_ fi ; _trial_run_ := true ;" +local text_data_template = "_tt_w_[%i]:=%f;_tt_h_[%i]:=%f;_tt_d_[%i]:=%f;" +local do_begin_fig = "; beginfig(1); " +local do_end_fig = "; endfig ;" +local do_safeguard = ";" + function metapost.text_texts_data() local t, n = { }, 0 --~ for i = metapost.first_box, metapost.last_box do @@ -737,8 +745,7 @@ function metapost.text_texts_data() logs.report("metapost","passed data: order %s, box %s",n,i) end if box then - t[#t+1] = format("_tt_w_[%i]:=%f;_tt_h_[%i]:=%f;_tt_d_[%i]:=%f;", - n,box.width/factor,n,box.height/factor,n,box.depth/factor) + t[#t+1] = format(text_data_template,n,box.width/factor,n,box.height/factor,n,box.depth/factor) else break end @@ -753,27 +760,29 @@ metapost.intermediate.needed = false metapost.method = 1 -- 1:dumb 2:clever -function metapost.graphic_base_pass(mpsformat,str,preamble,askedfig) +function metapost.graphic_base_pass(mpsformat,str,initializations,preamble,askedfig) local nofig = (askedfig and "") or false local done_1, done_2, forced_1, forced_2 str, done_1, forced_1 = metapost.check_texts(str) - if preamble then - preamble, done_2, forced_2 = metapost.check_texts(preamble) - else + if not preamble or preamble == "" then preamble, done_2, forced_2 = "", false, false + else + preamble, done_2, forced_2 = metapost.check_texts(preamble) end -- metapost.textext_current = metapost.first_box metapost.intermediate.needed = false metapost.multipass = false -- no needed here - current_format, current_graphic = mpsformat, str + current_format, current_graphic, current_initializations = mpsformat, str, initializations or "" if metapost.method == 1 or (metapost.method == 2 and (done_1 or done_2)) then -- first true means: trialrun, second true means: avoid extra run if no multipass local flushed = metapost.process(mpsformat, { preamble, - nofig or "beginfig(1); ", - "if unknown _trial_run_ : boolean _trial_run_ fi ; _trial_run_ := true ;", - str, - nofig or "endfig ;" + nofig or do_begin_fig, + do_trial_run, + current_initializations, + do_safeguard, + current_graphic, + nofig or do_end_fig -- }, true, nil, true ) }, true, nil, not (forced_1 or forced_2), false, askedfig) if metapost.intermediate.needed then @@ -788,11 +797,13 @@ function metapost.graphic_base_pass(mpsformat,str,preamble,askedfig) end else metapost.process(mpsformat, { - preamble or "", - nofig or "beginfig(1); ", - "_trial_run_ := false ;", - str, - nofig or "endfig ;" + preamble, + nofig or do_begin_fig, + no_trial_run, + current_initializations, + do_safeguard, + current_graphic, + nofig or do_end_fig }, false, nil, false, false, askedfig ) end -- here we could free the textext boxes @@ -803,32 +814,16 @@ function metapost.graphic_extra_pass(askedfig) local nofig = (askedfig and "") or false -- metapost.textext_current = metapost.first_box metapost.process(current_format, { - nofig or "beginfig(1); ", - "_trial_run_ := false ;", + nofig or do_begin_fig, + no_trial_run, concat(metapost.text_texts_data()," ;\n"), + current_initializations, + do_safeguard, current_graphic, - nofig or "endfig ;" + nofig or do_end_fig }, false, nil, false, true, askedfig ) end -function metapost.getclippath(data) - local mpx = metapost.format("metafun") - if mpx and data then - starttiming(metapost) - starttiming(metapost.exectime) - local result = mpx:execute(format("beginfig(1);%s;endfig;",data)) - stoptiming(metapost.exectime) - if result.status > 0 then - print("error", result.status, result.error or result.term or result.log) - result = "" - else - result = metapost.filterclippath(result) - end - stoptiming(metapost) - sprint(result) - end -end - metapost.tex = metapost.tex or { } do -- only used in graphictexts diff --git a/tex/context/base/mult-de.tex b/tex/context/base/mult-de.tex index 0b6cf6be8..bce73f3d7 100644 --- a/tex/context/base/mult-de.tex +++ b/tex/context/base/mult-de.tex @@ -137,6 +137,7 @@ \setinterfacevariable{display}{bildschirm} \setinterfacevariable{dot}{punkt} \setinterfacevariable{doublesided}{doppelseitig} +\setinterfacevariable{down}{down} \setinterfacevariable{each}{jede} \setinterfacevariable{edge}{kante} \setinterfacevariable{empty}{leer} @@ -491,6 +492,7 @@ \setinterfacevariable{units}{einheiten} \setinterfacevariable{unknown}{unbekannt} \setinterfacevariable{unpacked}{ungepackt} +\setinterfacevariable{up}{up} \setinterfacevariable{url}{url} \setinterfacevariable{used}{verwende} \setinterfacevariable{value}{wert} diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua index ffa3bc240..df65f4bcc 100644 --- a/tex/context/base/mult-def.lua +++ b/tex/context/base/mult-def.lua @@ -11119,6 +11119,14 @@ return { }, }, ["variables"]={ + ["down"]={ + ["en"]="down", + ["nl"]="omlaag", + }, + ["up"]={ + ["en"]="up", + ["nl"]="omhoog", + }, ["underbar"]={ ["cs"]="podtrzeno", ["de"]="unterstrichen", diff --git a/tex/context/base/mult-en.tex b/tex/context/base/mult-en.tex index 2bba103a3..897e30db1 100644 --- a/tex/context/base/mult-en.tex +++ b/tex/context/base/mult-en.tex @@ -137,6 +137,7 @@ \setinterfacevariable{display}{display} \setinterfacevariable{dot}{dot} \setinterfacevariable{doublesided}{doublesided} +\setinterfacevariable{down}{down} \setinterfacevariable{each}{each} \setinterfacevariable{edge}{edge} \setinterfacevariable{empty}{empty} @@ -491,6 +492,7 @@ \setinterfacevariable{units}{units} \setinterfacevariable{unknown}{unknown} \setinterfacevariable{unpacked}{unpacked} +\setinterfacevariable{up}{up} \setinterfacevariable{url}{url} \setinterfacevariable{used}{used} \setinterfacevariable{value}{value} diff --git a/tex/context/base/mult-fr.tex b/tex/context/base/mult-fr.tex index 0e61e77ac..e7c0e7dc6 100644 --- a/tex/context/base/mult-fr.tex +++ b/tex/context/base/mult-fr.tex @@ -137,6 +137,7 @@ \setinterfacevariable{display}{affichage} \setinterfacevariable{dot}{point} \setinterfacevariable{doublesided}{rectoverso} +\setinterfacevariable{down}{down} \setinterfacevariable{each}{chaque} \setinterfacevariable{edge}{bord} \setinterfacevariable{empty}{vide} @@ -491,6 +492,7 @@ \setinterfacevariable{units}{unites} \setinterfacevariable{unknown}{inconnu} \setinterfacevariable{unpacked}{degroupe} +\setinterfacevariable{up}{up} \setinterfacevariable{url}{url} \setinterfacevariable{used}{used} \setinterfacevariable{value}{valeur} diff --git a/tex/context/base/mult-it.tex b/tex/context/base/mult-it.tex index 263a5a6f7..340643ad3 100644 --- a/tex/context/base/mult-it.tex +++ b/tex/context/base/mult-it.tex @@ -137,6 +137,7 @@ \setinterfacevariable{display}{schermo} \setinterfacevariable{dot}{punto} \setinterfacevariable{doublesided}{doppiafaccia} +\setinterfacevariable{down}{down} \setinterfacevariable{each}{ogni} \setinterfacevariable{edge}{bordo} \setinterfacevariable{empty}{vuoto} @@ -491,6 +492,7 @@ \setinterfacevariable{units}{unita} \setinterfacevariable{unknown}{ignoto} \setinterfacevariable{unpacked}{unpacked} +\setinterfacevariable{up}{up} \setinterfacevariable{url}{url} \setinterfacevariable{used}{usato} \setinterfacevariable{value}{valore} diff --git a/tex/context/base/mult-nl.tex b/tex/context/base/mult-nl.tex index 50bfa337b..fa49e7c4d 100644 --- a/tex/context/base/mult-nl.tex +++ b/tex/context/base/mult-nl.tex @@ -137,6 +137,7 @@ \setinterfacevariable{display}{scherm} \setinterfacevariable{dot}{punt} \setinterfacevariable{doublesided}{dubbelzijdig} +\setinterfacevariable{down}{omlaag} \setinterfacevariable{each}{elk} \setinterfacevariable{edge}{rand} \setinterfacevariable{empty}{leeg} @@ -491,6 +492,7 @@ \setinterfacevariable{units}{eenheden} \setinterfacevariable{unknown}{onbekend} \setinterfacevariable{unpacked}{vanelkaar} +\setinterfacevariable{up}{omhoog} \setinterfacevariable{url}{url} \setinterfacevariable{used}{gebruikt} \setinterfacevariable{value}{waarde} diff --git a/tex/context/base/mult-ro.tex b/tex/context/base/mult-ro.tex index f79f9c3ac..884716b04 100644 --- a/tex/context/base/mult-ro.tex +++ b/tex/context/base/mult-ro.tex @@ -137,6 +137,7 @@ \setinterfacevariable{display}{display} \setinterfacevariable{dot}{punct} \setinterfacevariable{doublesided}{douafete} +\setinterfacevariable{down}{down} \setinterfacevariable{each}{fiecare} \setinterfacevariable{edge}{bordura} \setinterfacevariable{empty}{gol} @@ -491,6 +492,7 @@ \setinterfacevariable{units}{unitati} \setinterfacevariable{unknown}{necunoscut} \setinterfacevariable{unpacked}{despachetat} +\setinterfacevariable{up}{up} \setinterfacevariable{url}{url} \setinterfacevariable{used}{folosit} \setinterfacevariable{value}{valoare} diff --git a/tex/context/base/page-mis.mkiv b/tex/context/base/page-mis.mkiv index 8bc040064..bb61ad96f 100644 --- a/tex/context/base/page-mis.mkiv +++ b/tex/context/base/page-mis.mkiv @@ -88,13 +88,13 @@ \setbox\preparedmarginbox\vbox {\@@mbbefore\box\preparedmarginbox\@@mbafter}% \def\rightmarginbox - {\def\plaatsrechtermargeblok + {\def\placerightmarginblock {\setbox\preparedmarginbox\hbox to \rightmarginwidth {\@@mbleft\box\preparedmarginbox\@@mbright}% \vsmashbox\preparedmarginbox \box\preparedmarginbox}}% \def\leftmarginbox - {\def\plaatslinkermargeblok + {\def\placeleftmarginblock {\setbox\preparedmarginbox\hbox to \leftmarginwidth {\@@mbright\box\preparedmarginbox\@@mbleft}% \vsmashbox\preparedmarginbox diff --git a/tex/context/base/s-pre-64.tex b/tex/context/base/s-pre-64.tex index bdc17e18c..b9dc10002 100644 --- a/tex/context/base/s-pre-64.tex +++ b/tex/context/base/s-pre-64.tex @@ -131,7 +131,7 @@ \def\StartItem {\blank[line] \begingroup - \EveryPar {\AdaptShape}} % beware: \ABBREV aan gegin gaat fout + \EveryPar {\AdaptShape}} % beware: \ABBREV aan begin gaat fout \def\StopItem {\endgraf diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua index 9d4b8ac18..45ca1475a 100644 --- a/tex/context/base/spac-ver.lua +++ b/tex/context/base/spac-ver.lua @@ -102,7 +102,7 @@ local values = { local colonsplitter = lpeg.splitat(":") -local function listtohash(str) -- redundant? +local function listtohash(str) local t = { } for s in gmatch(str,"[^, ]+") do local key, detail = lpegmatch(colonsplitter,s) @@ -114,7 +114,7 @@ local function listtohash(str) -- redundant? if k then detail = tonumber("0" .. detail) if detail then - t[k] = fraction + t[k] = detail end else k = values[key] @@ -150,15 +150,30 @@ function vspacing.define_snap_method(name,method) tex.write(n) end +--~ local rule_id = node.id("rule") +--~ local vlist_id = node.id("vlist") +--~ function nodes.makevtop(n) +--~ if n.id == vlist_id then +--~ local list = n.list +--~ local height = (list and list.id <= rule_id and list.height) or 0 +--~ n.depth = n.depth - height + n.height +--~ n.height = height +--~ end +--~ end + local function snap_hlist(current,method,height,depth) -- method.strut is default local snapht, snapdp +--~ print(table.serialize(method)) if method["local"] then + -- snapping is done immediately here snapht, snapdp = texdimen.bodyfontstrutheight, texdimen.bodyfontstrutdepth else + -- snapping might happen later in the otr snapht, snapdp = texdimen.globalbodyfontstrutheight, texdimen.globalbodyfontstrutdepth end local h, d = height or current.height, depth or current.depth local hr, dr, ch, cd = method.hfraction or 1, method.dfraction or 1, h, d + local tlines, blines = method.tlines or 1, method.blines or 1 local done, plusht, plusdp = false, snapht, snapdp local snaphtdp = snapht + snapdp if method.none then @@ -170,6 +185,7 @@ local function snap_hlist(current,method,height,depth) -- method.strut is defaul if method.line then plusht, plusdp = plusht + snaphtdp, plusdp + snaphtdp end + if method.first then if current.id == vlist then local list, lh, ld = current.list @@ -203,6 +219,7 @@ local function snap_hlist(current,method,height,depth) -- method.strut is defaul end end end + if done then -- first or last elseif method.minheight then @@ -222,13 +239,15 @@ local function snap_hlist(current,method,height,depth) -- method.strut is defaul cd = plusdp end if method.top then - ch = ch + (method.tlines or 1) * snaphtdp + ch = ch + tlines * snaphtdp end if method.bottom then - cd = cd + (method.blines or 1) * snaphtdp + cd = cd + blines * snaphtdp end + local offset = method.offset if offset then + -- we need to set the attr local shifted = vpack_node(current.list) shifted.shift = offset current.list = shifted @@ -239,6 +258,7 @@ local function snap_hlist(current,method,height,depth) -- method.strut is defaul if not depth then current.depth = cd end + -- set_attribute(current,snap_method,0) return h, d, ch, cd, (ch+cd)/snaphtdp end diff --git a/tex/context/base/strc-ren.mkiv b/tex/context/base/strc-ren.mkiv index 5cdf3703f..04782fe7b 100644 --- a/tex/context/base/strc-ren.mkiv +++ b/tex/context/base/strc-ren.mkiv @@ -127,7 +127,6 @@ \def\doplacestructureheadtext#1#2#3% nodes, text, endstuff {\beginheadplacement -% \postponenotes \doresettructureheadnumbercontent \ifconditional\structureheadleaveempty \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \structureheadattribute to \zeropoint {#1}% @@ -143,7 +142,6 @@ \def\doplacestructureheadnumbertext#1#2#3#4% nodes number text nodes {\beginheadplacement -% \postponenotes \doiftextelse{#2}\dosettructureheadnumbercontent\doresettructureheadnumbercontent \ifconditional\structureheadleaveempty \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \structureheadattribute to \zeropoint{#1}% @@ -277,8 +275,8 @@ % kind of special, we want to snap heads also according to local specs local \ifgridsnapping \begingroup + \edef\currentstructureheadgridsnapping{\structureheadparameter\c!grid}% \ifconditional\structureheadisdisplay - \edef\currentstructureheadgridsnapping{\structureheadparameter\c!grid}% \ifx\currentstructureheadgridsnapping\empty\else \dosetstructureheadattributes\c!style\c!color \setupinterlinespace @@ -286,7 +284,7 @@ \setupinterlinespace \fi \fi - \snaptogrid[\structureheadparameter\c!grid]\hbox + \snaptogrid[\currentstructureheadgridsnapping]\hbox {\hskip\localheadskip\hskip\structureheadparameter\c!margin\box\sectionheadbox}% \endgroup \else diff --git a/tex/context/base/supp-ran.lua b/tex/context/base/supp-ran.lua index 0d374541f..fe635fc7f 100644 --- a/tex/context/base/supp-ran.lua +++ b/tex/context/base/supp-ran.lua @@ -48,8 +48,10 @@ end -- maybe stack function commands.freezerandomseed(n) - if seed == false then + -- print("<<<<",seed,last) + if seed == false or seed == nil then seed = last + math.setrandomseedi(seed,"freeze",seed) end if n then randomseed(n) @@ -57,8 +59,9 @@ function commands.freezerandomseed(n) end function commands.defrostrandomseed() + -- print(">>>>",seed,last) if seed ~= false then - math.setrandomseedi(last,"defrost") + math.setrandomseedi(seed,"defrost",seed) -- was last (bug) seed = false end end diff --git a/tex/context/base/type-otf.mkiv b/tex/context/base/type-otf.mkiv index d898a29c7..ddbf3f13c 100644 --- a/tex/context/base/type-otf.mkiv +++ b/tex/context/base/type-otf.mkiv @@ -1658,10 +1658,10 @@ \starttypescriptcollection[postscript] \starttypescript [postscript] - \definetypeface [postscript] [rm] [serif] [times] [default] - \definetypeface [postscript] [ss] [sans] [helvetica] [default] [rscale=0.9] - \definetypeface [postscript] [tt] [mono] [courier] [default] [rscale=1.1] - \definetypeface [postscript] [mm] [math] [times] [default] + \definetypeface [postscript] [rm] [\s!serif] [times] [\s!default] + \definetypeface [postscript] [ss] [\s!sans] [helvetica] [\s!default] [\s!rscale=0.9] + \definetypeface [postscript] [tt] [\s!mono] [courier] [\s!default] [\s!rscale=1.1] + \definetypeface [postscript] [mm] [\s!math] [times] [\s!default] \quittypescriptscanning \stoptypescript @@ -1679,10 +1679,22 @@ \stoptypescript \starttypescript [pagella-euler] - \definetypeface [\typescriptone] [rm] [serif] [pagella] [default] - % \definetypeface [\typescriptone] [ss] [sans] [pagella] [default] [rscale=auto] - \definetypeface [\typescriptone] [tt] [mono] [modern] [default] [rscale=auto] - \definetypeface [\typescriptone] [mm] [math] [euler] [default] [rscale=auto] + \definetypeface [\typescriptone] [rm] [\s!serif] [pagella] [\s!default] + % \definetypeface [\typescriptone] [ss] [\s!sans] [pagella] [\s!default] [\s!rscale=auto] + \definetypeface [\typescriptone] [tt] [\s!mono] [modern] [\s!default] [\s!rscale=auto] + \definetypeface [\typescriptone] [mm] [\s!math] [euler] [\s!default] [\s!rscale=auto] + \quittypescriptscanning + \stoptypescript + + \starttypescript [serif] [euler] [name] + \setups[\s!font:\s!fallback:\s!serif] + \definefontsynonym [Serif] [\s!file:euler.otf] [\s!features=\s!default] + \stoptypescript + + \starttypescript [euler] + \definetypeface [euler] [rm] [\s!serif] [euler] [\s!default] + \definetypeface [euler] [tt] [\s!mono] [modern] [\s!default] [\s!rscale=auto] + \definetypeface [euler] [mm] [\s!math] [euler] [\s!default] \quittypescriptscanning \stoptypescript diff --git a/tex/context/interface/keys-cs.xml b/tex/context/interface/keys-cs.xml index 0cecf9dbc..edef67e7b 100644 --- a/tex/context/interface/keys-cs.xml +++ b/tex/context/interface/keys-cs.xml @@ -140,6 +140,7 @@ + @@ -494,6 +495,7 @@ + diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 45443f7ce..3a13fd632 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -140,6 +140,7 @@ + @@ -494,6 +495,7 @@ + diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index 30dcc8923..593073018 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -140,6 +140,7 @@ + @@ -494,6 +495,7 @@ + diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index 911f7e130..c560c48a8 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -140,6 +140,7 @@ + @@ -494,6 +495,7 @@ + diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 16d8e507f..6a920dfd8 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -140,6 +140,7 @@ + @@ -494,6 +495,7 @@ + diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index 51777f26e..3d33c84ac 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -140,6 +140,7 @@ + @@ -494,6 +495,7 @@ + diff --git a/tex/context/interface/keys-pe.xml b/tex/context/interface/keys-pe.xml index a7914a263..fc00846fa 100644 --- a/tex/context/interface/keys-pe.xml +++ b/tex/context/interface/keys-pe.xml @@ -140,6 +140,7 @@ + @@ -494,6 +495,7 @@ + diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index 0fb615785..8104bb6f5 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -140,6 +140,7 @@ + @@ -494,6 +495,7 @@ + diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 3fecdb88c..e256689cb 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 04/25/10 15:55:41 +-- merge date : 04/29/10 22:30:18 do -- begin closure to overcome local limits and interference @@ -9593,6 +9593,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence local skipmark, skipligature, skipbase = flags[1], flags[2], flags[3] local someskip = skipmark or skipligature or skipbase -- could be stored in flags for a fast test (hm, flags could be false !) local markclass = sequence.markclass -- todo, first we need a proper test + local skipped = false for k=1,#contexts do local match, current, last = true, start, start local ck = contexts[k] @@ -9627,6 +9628,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence if ccd then local class = ccd.class if class == skipmark or class == skipligature or class == skipbase or (markclass and class == "mark" and not markclass[char]) then + skipped = true if trace_skips then show_skip(kind,chainname,char,ck,class) end @@ -9671,6 +9673,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence if ccd then local class = ccd.class if class == skipmark or class == skipligature or class == skipbase or (markclass and class == "mark" and not markclass[char]) then + skipped = true if trace_skips then show_skip(kind,chainname,char,ck,class) end @@ -9725,6 +9728,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence if ccd then local class = ccd.class if class == skipmark or class == skipligature or class == skipbase or (markclass and class == "mark" and not markclass[char]) then + skipped = true if trace_skips then show_skip(kind,chainname,char,ck,class) end @@ -9790,8 +9794,47 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence end else -- actually this needs a more complex treatment for which we will use chainmores +--~ local i = 1 +--~ repeat +--~ local chainlookupname = chainlookups[i] +--~ local chainlookup = lookuptable[chainlookupname] +--~ local cp = chainmores[chainlookup.type] +--~ if cp then +--~ local ok, n +--~ start, ok, n = cp(start,last,kind,chainname,ck,cache,chainlookup,chainlookupname,i,sequence) +--~ -- messy since last can be changed ! +--~ if ok then +--~ done = true +--~ start = start.next +--~ if n then +--~ -- skip next one(s) if ligature +--~ i = i + n - 1 +--~ end +--~ end +--~ else +--~ logprocess("%s: multiple subchains for %s are not yet supported",cref(kind,chainname,chainlookupname),chainlookup.type) +--~ end +--~ i = i + 1 +--~ until i > nofchainlookups + local i = 1 repeat +if skipped then + while true do + local char = start.char + local ccd = descriptions[char] + if ccd then + local class = ccd.class + if class == skipmark or class == skipligature or class == skipbase or (markclass and class == "mark" and not markclass[char]) then + start = start.next + else + break + end + else + break + end + end +end local chainlookupname = chainlookups[i] local chainlookup = lookuptable[chainlookupname] local cp = chainmores[chainlookup.type] @@ -9801,17 +9844,18 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence -- messy since last can be changed ! if ok then done = true - start = start.next - if n then - -- skip next one(s) if ligature - i = i + n - 1 - end + -- skip next one(s) if ligature + i = i + (n or 1) + else + i = i + 1 end else logprocess("%s: multiple subchains for %s are not yet supported",cref(kind,chainname,chainlookupname),chainlookup.type) + i = i + 1 end - i = i + 1 + start = start.next until i > nofchainlookups + end else local replacements = ck[7] -- cgit v1.2.3