diff options
author | Marius <mariausol@gmail.com> | 2011-10-19 19:40:14 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-10-19 19:40:14 +0300 |
commit | c7071b17e99c543f0480726468420f9ee88e7435 (patch) | |
tree | d6e226668bafa81e7859f42439e91a3efa0fed17 | |
parent | db5d5aa67829cb4c0c70bbe545f3e840457acf08 (diff) | |
download | context-c7071b17e99c543f0480726468420f9ee88e7435.tar.gz |
beta 2011.10.19 18:24
21 files changed, 185 insertions, 78 deletions
diff --git a/metapost/context/base/metafun.mpiv b/metapost/context/base/metafun.mpiv index 8466e1d83..f801717f1 100644 --- a/metapost/context/base/metafun.mpiv +++ b/metapost/context/base/metafun.mpiv @@ -26,11 +26,10 @@ input "mp-shap.mpiv" ; % will be improved input "mp-grph.mpiv" ; % todo: namespace and cleanup input "mp-grid.mpiv" ; % todo: namespace and cleanup input "mp-form.mpiv" ; % under (re)construction - input "mp-figs.mpiv" ; % obsolete, needs checking -input "mp-text.mpiv" ; % will be redone into a module input "mp-func.mpiv" ; % under construction +% "mp-text.mpiv" ; % loaded on demand % "mp-char.mpiv" ; % loaded on demand % "mp-step.mpiv" ; % loaded on demand % "mp-chem.mpiv" ; % loaded on demand diff --git a/tex/context/base/char-utf.lua b/tex/context/base/char-utf.lua index 4817c3537..a411c2d82 100644 --- a/tex/context/base/char-utf.lua +++ b/tex/context/base/char-utf.lua @@ -50,6 +50,8 @@ local filters = characters.filters filters.utf = filters.utf or { } local utffilters = characters.filters.utf +-- is characters.combined cached? + --[[ldx-- <p>It only makes sense to collapse at runtime, since we don't expect source code to depend on collapsing.</p> @@ -81,7 +83,8 @@ local function initialize() -- maybe only 'mn' for unicode, v in next, data do -- using vs and first testing for length is faster (.02->.01 s) local vs = v.specials - if vs and #vs == 3 and vs[1] == "char" then + local vc = vs and #vs == 3 and vs[1] + if vc == "char" then local one, two = vs[2], vs[3] if data[two].category == "mn" then local cgf = combined[one] @@ -116,6 +119,7 @@ local function initialize() -- maybe only 'mn' mps[first] = combination end end + -- elseif vc == "compat" then -- else -- local description = v.description -- if find(description,"LIGATURE") then diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 0746a3aad..626011f35 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{2011.10.19 00:02} +\newcontextversion{2011.10.19 18:24} %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 07d18e487..449c3567b 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{2011.10.19 00:02} +\newcontextversion{2011.10.19 18:24} %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/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 3a88873dd..f7d784e7d 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 6ebef33b3..6dff771ad 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index b4a822878..77977156d 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{2011.10.19 00:02} +\edef\contextversion{2011.10.19 18:24} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 4bf35d766..8f6f21389 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.10.19 00:02} +\edef\contextversion{2011.10.19 18:24} %D For those who want to use this: diff --git a/tex/context/base/lpdf-nod.lua b/tex/context/base/lpdf-nod.lua index 184e9cff7..fe0c975f7 100644 --- a/tex/context/base/lpdf-nod.lua +++ b/tex/context/base/lpdf-nod.lua @@ -6,17 +6,24 @@ if not modules then modules = { } end modules ['lpdf-nod'] = { license = "see context related readme files" } -local copy_node = node.copy -local new_node = node.new +local format = string.format -local nodepool = nodes.pool -local register = nodepool.register +local copy_node = node.copy +local new_node = node.new -local pdfliteral = register(new_node("whatsit", 8)) pdfliteral.mode = 1 -local pdfdest = register(new_node("whatsit",19)) pdfdest.named_id = 1 -- xyz_zoom untouched -local pdfannot = register(new_node("whatsit",15)) +local nodepool = nodes.pool +local register = nodepool.register +local whatsitcodes = nodes.whatsitcodes +local nodeinjections = backends.nodeinjections -local variables = interfaces.variables +local pdfliteral = register(new_node("whatsit", whatsitcodes.pdfliteral)) pdfliteral.mode = 1 +local pdfsave = register(new_node("whatsit", whatsitcodes.pdfsave)) +local pdfrestore = register(new_node("whatsit", whatsitcodes.pdfrestore)) +local pdfsetmatrix = register(new_node("whatsit", whatsitcodes.pdfsetmatrix)) +local pdfdest = register(new_node("whatsit", whatsitcodes.pdfdest)) pdfdest.named_id = 1 -- xyz_zoom untouched +local pdfannot = register(new_node("whatsit", whatsitcodes.pdfannot)) + +local variables = interfaces.variables local views = { -- beware, we do support the pdf keys but this is *not* official xyz = 0, [variables.standard] = 0, @@ -42,6 +49,24 @@ function nodepool.pdfdirect(str) return t end +function nodepool.pdfsave() + return copy_node(pdfsave) +end + +function nodepool.pdfrestore() + return copy_node(pdfrestore) +end + +function nodepool.pdfsetmatrix(rx,sx,sy,ry,tx,ty) + local t = copy_node(pdfsetmatrix) + t.data = format("%s %s %s %s",rs or 0,sx or 0,sy or 0,rx or 0) -- todo: tx ty + return t +end + +nodeinjections.save = nodepool.pdfsave +nodeinjections.restore = nodepool.pdfrestore +nodeinjections.transform = nodepool.pdfsetmatrix + function nodepool.pdfannotation(w,h,d,data,n) local t = copy_node(pdfannot) if w and w ~= 0 then t.width = w end diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index 8282f1b83..9f8d4dceb 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -34,6 +34,7 @@ local trace_remapping = false trackers.register("math.remapping", functio local trace_processing = false trackers.register("math.processing", function(v) trace_processing = v end) local trace_analyzing = false trackers.register("math.analyzing", function(v) trace_analyzing = v end) local trace_normalizing = false trackers.register("math.normalizing", function(v) trace_normalizing = v end) +local trace_collapsing = false trackers.register("math.collapsing", function(v) trace_collapsing = v end) local trace_goodies = false trackers.register("math.goodies", function(v) trace_goodies = v end) local trace_variants = false trackers.register("math.variants", function(v) trace_variants = v end) local trace_italics = false trackers.register("math.italics", function(v) trace_italics = v end) @@ -43,6 +44,7 @@ local check_coverage = true directives.register("math.checkcoverage", fun local report_processing = logs.reporter("mathematics","processing") local report_remapping = logs.reporter("mathematics","remapping") local report_normalizing = logs.reporter("mathematics","normalizing") +local report_collapsing = logs.reporter("mathematics","collapsing") local report_goodies = logs.reporter("mathematics","goodies") local report_variants = logs.reporter("mathematics","variants") local report_italics = logs.reporter("mathematics","italics") @@ -52,6 +54,7 @@ local has_attribute = node.has_attribute local mlist_to_hlist = node.mlist_to_hlist local font_of_family = node.family_font local insert_node_after = node.insert_after +local free_node = node.free local new_kern = nodes.pool.kern @@ -391,7 +394,7 @@ respace[math_char] = function(pointer,what,n,parent) -- not math_noad .. math_ch --~ next_noad.attr = nil ord.next = last_noad pointer.next = ord - node.free(next_noad) + free_node(next_noad) end end end @@ -419,35 +422,50 @@ local collapse = { } processors.collapse = collapse local mathpairs = characters.mathpairs -collapse[math_char] = function(pointer,what,n,parent) - pointer = parent - if pointer and pointer.subtype == noad_rel then - local current_nucleus = pointer.nucleus - if current_nucleus.id == math_char then - local current_char = current_nucleus.char - local mathpair = mathpairs[current_char] - if mathpair then - local next_noad = pointer.next - if next_noad and next_noad.id == math_noad and next_noad.subtype == noad_rel then - local next_nucleus = next_noad.nucleus - if next_nucleus.id == math_char then - local next_char = next_nucleus.char - local newchar = mathpair[next_char] - if newchar then - local fam = current_nucleus.fam - local id = font_of_family(fam) - local characters = fontcharacters[id] - if characters and characters[newchar] then - -- print("!!!!!",current_char,next_char,newchar) - current_nucleus.char = newchar - local next_next_noad = next_noad.next - if next_next_noad then - pointer.next = next_next_noad - next_next_noad.prev = pointer - else - pointer.next = nil +mathpairs[0x2032] = { [0x2032] = 0x2033, [0x2033] = 0x2034 } -- (prime,prime) (prime,doubleprime) +mathpairs[0x2033] = { [0x2032] = 0x2034 } -- (doubleprime,prime) + +local function collapsepair(pointer,what,n,parent) -- todo: switch to turn in on and off + if parent then + local subtype = parent.subtype + if subtype == noad_rel or subtype == noad_ord then -- ord is new + local current_nucleus = parent.nucleus + if not parent.sub and not parent.sup and current_nucleus.id == math_char then + local current_char = current_nucleus.char + local mathpair = mathpairs[current_char] + if mathpair then + local next_noad = parent.next + if next_noad and next_noad.id == math_noad then + local next_subtype = next_noad.subtype + if next_subtype == noad_rel or next_subtype == noad_ord then -- ord is new + local next_nucleus = next_noad.nucleus + if next_nucleus.id == math_char then + local next_char = next_nucleus.char + local newchar = mathpair[next_char] + if newchar then + local fam = current_nucleus.fam + local id = font_of_family(fam) + local characters = fontcharacters[id] + if characters and characters[newchar] then + if trace_collapsing then + report_collapsing("U+%05X + U+%05X => U+%05X",current_char,next_char,newchar) + end + current_nucleus.char = newchar + local next_next_noad = next_noad.next + if next_next_noad then + parent.next = next_next_noad + next_next_noad.prev = parent + else + parent.next = nil + end + parent.sup = next_noad.sup + parent.sub = next_noad.sub + next_noad.sup = nil + next_noad.sub = nil + free_node(next_noad) + collapsepair(pointer,what,n,parent) + end end - node.free(next_noad) end end end @@ -457,6 +475,8 @@ collapse[math_char] = function(pointer,what,n,parent) end end +collapse[math_char] = collapsepair + function noads.handlers.collapse(head,style,penalties) processnoads(head,collapse,"collapse") return true @@ -853,7 +873,7 @@ variants[math_char] = function(pointer,what,n,parent) -- also set export value end next.prev = pointer parent.next = next.next - node.free(next) + free_node(next) end end end diff --git a/tex/context/base/math-pln.mkiv b/tex/context/base/math-pln.mkiv index 6a70c6711..295c58d48 100644 --- a/tex/context/base/math-pln.mkiv +++ b/tex/context/base/math-pln.mkiv @@ -68,20 +68,66 @@ \ifx\!\undefined \def\!{\mskip-\thinmuskip } \fi \ifx\*\undefined \def\*{\discretionary{\thinspace\the\textfont2\char2}{}{}} \fi +% \switchtobodyfont[modern] +% \switchtobodyfont[cambria] +% \switchtobodyfont[xits] +% \switchtobodyfont[minion] +% \setupbodyfont[dejavu] +% +% \startbuffer +% \def\SampleLine#1{% +% \NC#1 +% \NC\switchtobodyfont[#1]$f^2$ % 1 +% \NC\switchtobodyfont[#1]$f\prime^2$ % 2 +% \NC\switchtobodyfont[#1]$f\prime\prime^2$ % 3 +% \NC\switchtobodyfont[#1]$f\prime\prime\prime^2$ % 4 +% \NC\switchtobodyfont[#1]$f{\prime}^2$ % 5 +% \NC\switchtobodyfont[#1]$f{\prime\prime}^2$ % 6 +% \NC\switchtobodyfont[#1]$f{\prime\prime\prime}^2$ % 7 +% \NC\switchtobodyfont[#1]$f'(x)$ % 8 +% \NC\switchtobodyfont[#1]$f''(x)$ % 9 +% \NC\switchtobodyfont[#1]$f'''(x)$ % 10 +% \NC\NR +% } +% +% \starttabulate[|Tl|Tc|Tc|Tc|Tc|Tc|Tc|Tc|Tc|Tc|Tc|] +% \NC\NC1\NC2\NC3\NC4\NC5\NC6\NC7\NC8\NC9\NC10\NC\NR +% \SampleLine{modern} +% \SampleLine{cambria} +% \SampleLine{xits} +% \SampleLine{minion} +% \stoptabulate +% \stopbuffer +% +% \typebuffer \getbuffer + { \catcode\circumflexasciicode\othercatcode \global\let\othercircumflextoken ^ } { \catcode\circumflexasciicode\superscriptcatcode \global\let\superscriptcircumflextoken^ } -\def\domathprime{^\bgroup\dodomathprime} +% collapsing to 0x2033 and 0x2034 happens elsewhere + +\let\normalprime\prime + +\unexpanded\def\domathprime + {\iffontchar\textfont\zerocount"FE325\relax + ^\bgroup\expandafter\dodomathprime % virtual mess (using funny signal) + \else + \expandafter\normalprime % gets collapsed + \fi} + +\let\prime\domathprime \def\dodomathprime - {\prime\futurelet\nexttoken\dododomathprime} + {\normalprime\futurelet\nexttoken\dododomathprime} \def\dododomathprime {\csname domathprime@% \ifx '\nexttoken a\else + \ifx \normalprime\nexttoken a\else + \ifx \prime\nexttoken a\else \ifx\superscriptcircumflextoken\nexttoken b\else \ifx\othercircumflextoken \nexttoken b\else - c\fi\fi\fi + c\fi\fi\fi\fi\fi \endcsname} \def\domathprime@a #1{\dodomathprime} diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua index 31c13cf8c..7a5822d6b 100644 --- a/tex/context/base/math-vfu.lua +++ b/tex/context/base/math-vfu.lua @@ -153,21 +153,43 @@ local function minus(main,characters,id,size,unicode) -- push/pop needed? end end --- pdf:page pdf:direct don't work here +-- fails: pdf:page: pdf:direct: ... some funny displacement -local scale_factor = 0.7 -local scale_down = { "special", format("pdf: %s 0 0 %s 0 0 cm", scale_factor, scale_factor) } -- we need a scale -local scale_up = { "special", format("pdf: %s 0 0 %s 0 0 cm",1/scale_factor,1/scale_factor) } +-- this does not yet work ... { "scale", 2, 0, 0, 3 } .. commented code +-- +-- this does not work ... no interpretation going on here +-- +-- local nodeinjections = backends.nodeinjections +-- { "node", nodeinjections.save() }, +-- { "node", nodeinjections.transform(.7,0,0,.7) }, +-- commands[#commands+1] = { "node", nodeinjections.restore() } + +local done = { } -local function raise(main,characters,id,size,unicode,private) -- this is a real fake mess +local function raise(main,characters,id,size,unicode,private,n) -- this is a real fake mess local raised = characters[private] if raised then - local up = .85 * main.parameters.x_height + if not done[unicode] then + report_virtual("temporary too large U+%05X due to issues in luatex backend",unicode) + done[unicode] = true + end + local up = 0.85 * main.parameters.x_height + local slot = { "slot", id, private } + local commands = { + push, + { "down", - up }, + -- { "scale", .7, 0, 0, .7 }, + slot, + } + for i=2,n do + commands[#commands+1] = slot + end + commands[#commands+1] = pop characters[unicode] = { - width = .7 * raised.width, + width = .7 * n * raised.width, height = .7 * (raised.height + up), depth = .7 * (raised.depth - up), - commands = { push, { "down", -up }, scale_down, { "slot", id, private }, scale_up, pop } + commands = commands, } end end @@ -366,7 +388,9 @@ function vfmath.addmissing(main,id,size) jointhree(main,characters,id,size,0x27FC,0xFE321,0,0x0002D,joinrelfactor,0x02192) -- \mapstochar\relbar\joinrel\rightarrow jointwo (main,characters,id,size,0x2254,0x03A,0,0x03D) -- := (≔) --- raise (main,characters,id,size,0x02032,0xFE325) -- prime + -- raise (main,characters,id,size,0x02032,0xFE325,1) -- prime + -- raise (main,characters,id,size,0x02033,0xFE325,2) -- double prime + -- raise (main,characters,id,size,0x02034,0xFE325,3) -- triple prime -- there are more (needs discussion first): diff --git a/tex/context/base/meta-imp-txt.mkiv b/tex/context/base/meta-imp-txt.mkiv index dc8bb7ca8..08373c0c4 100644 --- a/tex/context/base/meta-imp-txt.mkiv +++ b/tex/context/base/meta-imp-txt.mkiv @@ -29,7 +29,7 @@ \unprotect \startMPextensions - if unknown context_text: input mp-text; fi; + if unknown context_text: input "mp-text.mpiv" ; fi; \stopMPextensions %%%%%%% diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv index da52c1368..ddf345391 100644 --- a/tex/context/base/meta-ini.mkiv +++ b/tex/context/base/meta-ini.mkiv @@ -275,14 +275,6 @@ % gsub the result to ps \endgroup} -%D Next we will use these support macros. - -\startMPextensions - if unknown context_tool: input mp-tool; fi; - if unknown context_spec: input mp-spec; fi; - if unknown context_grph: input mp-grph; fi; -\stopMPextensions - %D Since we want lables to follow the document settings, we %D also set the font related variables. diff --git a/tex/context/base/meta-pag.mkiv b/tex/context/base/meta-pag.mkiv index 22483319b..60f7d7830 100644 --- a/tex/context/base/meta-pag.mkiv +++ b/tex/context/base/meta-pag.mkiv @@ -19,10 +19,6 @@ \unprotect -\startMPextensions - if unknown context_page: input mp-page; fi; -\stopMPextensions - %D The next few macros tell \METAPOST\ how the \CONTEXT\ %D pagebody looks. diff --git a/tex/context/base/s-fnt-10.mkiv b/tex/context/base/s-fnt-10.mkiv index 7e6b89679..a104e6b7d 100644 --- a/tex/context/base/s-fnt-10.mkiv +++ b/tex/context/base/s-fnt-10.mkiv @@ -135,15 +135,16 @@ end \page \egroup} -\doifnotmode{demo} {\endinput} +% \doifnotmode{demo} {\endinput} \starttext -\ShowCompleteFont{name:dejavusansmono}{10pt}{1} +% \ShowCompleteFont{name:dejavusansmono}{10pt}{1} % \ShowCompleteFont{name:dejavuserif}{10pt}{2} % \ShowCompleteFont{name:officinasansbookitcregular}{10pt}{2} % \ShowCompleteFont{name:officinaserifbookitcregular}{10pt}{2} % \ShowCompleteFont{name:serpentineserifeflight}{10pt}{2} +\ShowCompleteFont{name:lmroman10-regular}{10pt}{1} % \ShowCompleteFont{name:lmtypewriter10-regular}{10pt}{2} % \ShowCompleteFont{lt55485}{10pt}{2} % \ShowCompleteFont{lmr10}{10pt}{2} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex f56801740..c10a64d95 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 66ae19cd8..e14bfa84a 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-num.mkiv b/tex/context/base/strc-num.mkiv index 0d9d30ab4..7daffc399 100644 --- a/tex/context/base/strc-num.mkiv +++ b/tex/context/base/strc-num.mkiv @@ -422,7 +422,7 @@ list = \!!bs\detokenize\expandafter{\currentlisttitle}\!!es, \fi }, - \ifx\hasstructurecountercaption\v!yes + \ifx\hasstructurecounternumber\v!yes prefixdata = { prefix = "#3\c!prefix", separatorset = "#3\c!prefixseparatorset", diff --git a/tex/context/base/supp-fun.mkiv b/tex/context/base/supp-fun.mkiv index e31074e4d..99cfbc1d4 100644 --- a/tex/context/base/supp-fun.mkiv +++ b/tex/context/base/supp-fun.mkiv @@ -34,7 +34,7 @@ %D \startbuffer %D \DroppedCaps %D {\color[green]} {SerifBold} -%D {2.2\baselineskip} {2pt} {\baselineskip} {2} +%D {\the\dimexpr2.2\baselineskip} {2pt} {\the\baselineskip} {2} %D Let's start %D \stopbuffer %D @@ -59,7 +59,7 @@ %D \startbuffer %D \DroppedCaps %D {\color[red]} {SerifBold} -%D {\baselineskip} {0pt} {0pt} {1} +%D {\the\baselineskip} {0pt} {0pt} {1} %D This simple %D \stopbuffer %D @@ -71,7 +71,7 @@ %D \startbuffer %D \DroppedCaps %D {\color[red]} {SerifBold} -%D {2\baselineskip} {0pt} {\baselineskip} {2} +%D {\the\dimexpr2\baselineskip} {0pt} {\the\baselineskip} {2} %D Is this ugly %D \stopbuffer %D @@ -99,7 +99,7 @@ %D \def\MyDroppedCaps% %D {\DroppedCaps %D {\color[green]} {SerifBold} -%D {5\baselineskip} {3pt} {3\baselineskip} {4}} +%D {\the\dimexpr5\baselineskip} {3pt} {\the\dimexpr3\baselineskip} {4}} %D %D \MyDroppedCaps The implementation %D \stopbuffer diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 6c947293d..1da99b200 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 : 10/19/11 00:02:57 +-- merge date : 10/19/11 18:24:29 do -- begin closure to overcome local limits and interference |