diff options
author | Hans Hagen <pragma@wxs.nl> | 2012-10-02 22:03:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2012-10-02 22:03:00 +0200 |
commit | 08f8bbb60ad11fe3fe1b5632b2eca97422c5bf8c (patch) | |
tree | 1ea0d9f304ed82d113e109c4f17277dd062d7f93 | |
parent | df4e78545a9a7e02cca523a2912aa1684f6867c6 (diff) | |
download | context-08f8bbb60ad11fe3fe1b5632b2eca97422c5bf8c.tar.gz |
beta 2012.10.02 22:03
-rw-r--r-- | tex/context/base/chem-str.mkiv | 65 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4146 -> 4143 bytes | |||
-rw-r--r-- | tex/context/base/context-version.png | bin | 104882 -> 104331 bytes | |||
-rw-r--r-- | tex/context/base/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/font-ctx.lua | 9 | ||||
-rw-r--r-- | tex/context/base/math-arr.mkiv | 18 | ||||
-rw-r--r-- | tex/context/base/math-ext.lua | 5 | ||||
-rw-r--r-- | tex/context/base/math-fbk.lua | 153 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24499 -> 24528 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 195100 -> 195100 bytes | |||
-rw-r--r-- | tex/context/base/strc-flt.mkvi | 23 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
15 files changed, 214 insertions, 69 deletions
diff --git a/tex/context/base/chem-str.mkiv b/tex/context/base/chem-str.mkiv index eca3b1b40..121adf6fd 100644 --- a/tex/context/base/chem-str.mkiv +++ b/tex/context/base/chem-str.mkiv @@ -293,8 +293,8 @@ \def\chem_arrow_construct#1#2#3% {\enspace \mathematics{#1% - {\strut\hbox \s!spread 2\emwidth{\hss\ctxcommand{inlinechemical(\!!bs#2\!!es)}\hss}}% {\strut\hbox \s!spread 2em{\hss#2\hss}}% - {\strut\hbox \s!spread 2\emwidth{\hss\ctxcommand{inlinechemical(\!!bs#3\!!es)}\hss}}}% {\strut\hbox \s!spread 2em{\hss#3\hss}}}% + {\strut\hbox \s!spread 2\emwidth{\hss\ctxcommand{inlinechemical(\!!bs#3\!!es)}\hss}}% {\strut\hbox \s!spread 2em{\hss#3\hss}}}% + {\strut\hbox \s!spread 2\emwidth{\hss\ctxcommand{inlinechemical(\!!bs#2\!!es)}\hss}}}% {\strut\hbox \s!spread 2em{\hss#2\hss}}% \enspace} % special macros (probably needs some more work) @@ -512,23 +512,60 @@ \fi \egroup} +% for the moment we have a special set + +\definechemicalsymbol[d:space] [\enspace\quad\enspace] +\definechemicalsymbol[d:plus] [\enspace+\enspace] +\definechemicalsymbol[d:minus] [\enspace-\enspace] +\definechemicalsymbol[d:gives] [\rightarrowfill] % \chem_arrow_construct\xrightarrow +\definechemicalsymbol[d:equilibrium] [\rightoverleftarrowfill] % \chem_arrow_construct\xrightoverleftarrow +\definechemicalsymbol[d:mesomeric] [\leftarrowfill] % \chem_arrow_construct\xleftrightarrow +\definechemicalsymbol[d:opencomplex] [\mathematics{\Bigg[}] % not yet ok +\definechemicalsymbol[d:closecomplex][\mathematics{\Bigg]}] % not yet ok + +\definechemicalsymbol[d:SPACE] [{\chemicalsymbol[d:space]}] +\definechemicalsymbol[d:PLUS] [{\chemicalsymbol[d:plus]}] +\definechemicalsymbol[d:MINUS] [{\chemicalsymbol[d:minus]}] +\definechemicalsymbol[d:GIVES] [{\chemicalsymbol[d:gives]}] +\definechemicalsymbol[d:EQUILIBRIUM] [{\chemicalsymbol[d:equilibrium]}] +\definechemicalsymbol[d:MESOMERIC] [{\chemicalsymbol[d:mesomeric]}] +\definechemicalsymbol[d:OPENCOMPLEX] [{\chemicalsymbol[d:opencomplex]}] +\definechemicalsymbol[d:CLOSECOMPLEX][{\chemicalsymbol[d:closecomplex]}] + \unexpanded\def\formulachemical {\relax\dotriplegroupempty\chem_formula} +% \def\chem_formula#1#2#3% we could do hboxes and measure +% {\ifcsname\??chemicalsymbol\detokenize{#1}\endcsname +% \t_chem_mid\expandafter{\the\t_chem_mid\chem_formula_mid{#1}{#2}{#3}}% +% \else +% \ifthirdargument +% \doifelsenothing{#2}\chem_formula_top_nop{\chem_formula_top_yes{#2}}% +% \doifelsenothing{#3}\chem_formula_bot_nop{\chem_formula_bot_yes{#3}}% +% \else\ifsecondargument +% \chem_formula_top_nop +% \doifelsenothing{#2}\chem_formula_bot_nop{\chem_formula_bot_yes{#2}}% +% \else +% \chem_formula_top_nop +% \chem_formula_bot_nop +% \fi\fi +% \t_chem_mid\expandafter{\the\t_chem_mid\molecule{#1}\aligntab}% +% \fi} + \def\chem_formula#1#2#3% we could do hboxes and measure - {\ifcsname\??chemicalsymbol\detokenize{#1}\endcsname - \t_chem_mid\expandafter{\the\t_chem_mid\chem_formula_mid{#1}{#2}{#3}}% + {\ifthirdargument + \doifelsenothing{#2}\chem_formula_top_nop{\chem_formula_top_yes{#2}}% + \doifelsenothing{#3}\chem_formula_bot_nop{\chem_formula_bot_yes{#3}}% + \else\ifsecondargument + \chem_formula_top_nop + \doifelsenothing{#2}\chem_formula_bot_nop{\chem_formula_bot_yes{#2}}% + \else + \chem_formula_top_nop + \chem_formula_bot_nop + \fi\fi + \ifcsname\??chemicalsymbol d:\detokenize{#1}\endcsname + \t_chem_mid\expandafter{\the\t_chem_mid\chemicalsymbol[d:#1]\aligntab}% \else - \ifthirdargument - \doifelsenothing{#2}\chem_formula_top_nop{\chem_formula_top_yes{#2}}% - \doifelsenothing{#3}\chem_formula_bot_nop{\chem_formula_bot_yes{#3}}% - \else\ifsecondargument - \chem_formula_top_nop - \doifelsenothing{#2}\chem_formula_bot_nop{\chem_formula_bot_yes{#2}}% - \else - \chem_formula_top_nop - \chem_formula_bot_nop - \fi\fi \t_chem_mid\expandafter{\the\t_chem_mid\molecule{#1}\aligntab}% \fi} diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 6ceeafd46..d398d6cc5 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.10.02 15:13} +\newcontextversion{2012.10.02 22:03} %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 7604ff84e..c5e0682b0 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.10.02 15:13} +\newcontextversion{2012.10.02 22:03} %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 Binary files differindex 07042d62c..b04ab3399 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 33ac9f216..7d1880385 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 0a1f16567..02d5ae27c 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.10.02 15:13} +\edef\contextversion{2012.10.02 22:03} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index f18a92afa..d491e43e7 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.10.02 15:13} +\edef\contextversion{2012.10.02 22:03} %D For those who want to use this: diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index 4961c4ae8..7d4fa35db 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -8,6 +8,9 @@ if not modules then modules = { } end modules ['font-ctx'] = { -- At some point I will clean up the code here so that at the tex end -- the table interface is used. +-- +-- Todo: make a proper 'next id' mechanism (register etc) or wait till 'true' +-- in virtual fonts indices is implemented. local context, commands = context, commands @@ -1007,7 +1010,11 @@ function commands.definefont_two(global,cs,str,size,inheritancemode,classfeature end -- texsetcount("global","lastfontid",lastfontid) - if mathsize then + if not mathsize then + -- forget about it + elseif mathsize == 0 then + lastmathids[1] = lastfontid + else lastmathids[mathsize] = lastfontid end -- diff --git a/tex/context/base/math-arr.mkiv b/tex/context/base/math-arr.mkiv index 6de27f4af..2d57a9337 100644 --- a/tex/context/base/math-arr.mkiv +++ b/tex/context/base/math-arr.mkiv @@ -30,14 +30,14 @@ % \mathord\rightarrow % $} % -% \def\leftarrowfill % brrr no longer in luated +% \def\leftarrowfill % brrr no longer in luatex % {$% % \mathsurround\zeropoint % \mathord\leftarrow % \mkern-7mu% % \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill % \mkern-7mu -% \smash-$ +% \smash-% % $} \def\math_stylebuilders_fract#1#2#3#4#5#6#7% @@ -310,8 +310,8 @@ \unexpanded\def\specrightarrowfill {\defaultmtharrowfill \relbar \relbar \rightarrow} \unexpanded\def\specleftarrowfill {\defaultmtharrowfill \leftarrow \relbar \relbar} -\unexpanded\def\rightarrowfill {\specrightarrowfill \textstyle} -\unexpanded\def\leftarrowfill {\specleftarrowfill \textstyle} +\unexpanded\def\rightarrowfill {\specrightarrowfill \textstyle} +\unexpanded\def\leftarrowfill {\specleftarrowfill \textstyle} \unexpanded\def\equalfill {\defaultmtharrowfill \Relbar \Relbar \Relbar} \unexpanded\def\Rightarrowfill {\defaultmtharrowfill \Relbar \Relbar \Rightarrow} @@ -336,6 +336,16 @@ \unexpanded\def\doublebond{{\xequal}} \unexpanded\def\triplebond{{\xtriplerel}} +\unexpanded\def\rightoverleftarrowfill + {\specrightoverleftarrowfill} + +\unexpanded\def\specrightoverleftarrowfill + {\defaultmtharrowfill + \ctxdoublearrowfillleftend + \ctxdoublearrowfillmiddlepart + \ctxdoublearrowfillrightend + \textstyle} + %D Now we define most commonly used arrows. These include arrows defined in \filename %D {amsmath.sty}, \filename {extarrows.sty}, \filename {extpfel.sty} and \filename %D {mathtools.sty} packages for \LATEX\ (plus a few more). diff --git a/tex/context/base/math-ext.lua b/tex/context/base/math-ext.lua index da00c7a9e..047543970 100644 --- a/tex/context/base/math-ext.lua +++ b/tex/context/base/math-ext.lua @@ -20,8 +20,11 @@ characters.math = characters.math or { } local mathdata = characters.math local chardata = characters.data -function extras.add(unicode,t) +function extras.add(unicode,t) -- todo: if already stored ... local min, max = mathematics.extrabase, mathematics.privatebase - 1 + -- if mathdata[unicode] or chardata[unicode] then + -- report_math("extra U+%05X overloads existing character",unicode) + -- end if unicode >= min and unicode <= max then mathdata[unicode], chardata[unicode] = t, t else diff --git a/tex/context/base/math-fbk.lua b/tex/context/base/math-fbk.lua index 192e58f0f..b2b7ed5f0 100644 --- a/tex/context/base/math-fbk.lua +++ b/tex/context/base/math-fbk.lua @@ -37,48 +37,58 @@ function fallbacks.apply(target,original) usedfonts = { } target.fonts = usedfonts end - local textid = true -- font.nextid() -- this will fail when we create more than one virtual set - local scriptid = textid - local scriptscriptid = textid - local lastscriptid = lastmathids[2] - local lastscriptscriptid = lastmathids[3] + -- This is not okay yet ... we have no proper way to refer to 'self' + -- otherwise I will make my own id allocator). +local self = #usedfonts == 0 and font.nextid() or nil -- will be true + local textid, scriptid, scriptscriptid + local textindex, scriptindex, scriptscriptindex + local textdata, scriptdata, scriptscriptdata if mathsize == 3 then -- scriptscriptsize + -- textid = nil -- self + -- scriptid = nil -- no smaller + -- scriptscriptid = nil -- no smaller +textid = self +scriptid = self +scriptscriptid = self elseif mathsize == 2 then -- scriptsize - scriptid = lastscriptscriptid or textid - scriptscriptid = scriptid + -- textid = nil -- self +textid = self + scriptid = lastmathids[3] + scriptscriptid = lastmathids[3] else -- textsize - scriptid = lastscriptid or textid - scriptscriptid = lastscriptscriptid or scriptid + -- textid = nil -- self +textid = self + scriptid = lastmathids[2] + scriptscriptid = lastmathids[3] end - local textindex, scriptindex, scriptscriptindex - local textdata, scriptdata, scriptscriptdata - if textid ~= true then - textindex = #usedfonts + 1 + if textid then + textindex = #usedfonts + 1 usedfonts[textindex] = { id = textid } textdata = identifiers[textid] else - textid = nil textdata = target end - if scriptid ~= true then + if scriptid then scriptindex = #usedfonts + 1 usedfonts[scriptindex] = { id = scriptid } scriptdata = identifiers[scriptid] else - scriptid = textid - scriptdata = textdata + scriptindex = textindex + scriptdata = textdata end - if scriptscriptid ~= true then + if scriptscriptid then scriptscriptindex = #usedfonts + 1 usedfonts[scriptscriptindex] = { id = scriptscriptid } scriptscriptdata = identifiers[scriptscriptid] else - scriptscriptid = scriptid - scriptscriptdata = scriptdata + scriptscriptindex = scriptindex + scriptscriptdata = scriptdata end +-- report_fallbacks("used textid: %s, used script id: %s, used scriptscript id: %s", +-- tostring(textid),tostring(scriptid),tostring(scriptscriptid)) local data = { textdata = textdata, scriptdata = scriptdata, @@ -91,7 +101,9 @@ function fallbacks.apply(target,original) target = target, original = original, size = size, + mathsize = mathsize, } +-- inspect(usedfonts) for k, v in next, virtualcharacters do if not characters[k] then local tv = type(v) @@ -137,7 +149,7 @@ local function raised(data,down) height = character.height, depth = character.depth, commands = { - { "down", down and data.size/4 or -data.size/2 } , -- maybe exheight + { "down", down and data.size/4 or -data.size/2 }, -- maybe exheight reference(data.scriptindex,replacement) } } @@ -168,3 +180,102 @@ virtualcharacters[0x208B] = function(data) data.replacement = 0x002B return raised(data,true) end + +local addextra = mathematics.extras.add + +addextra(0xFE350, { + category="sm", + description="MATHEMATICAL DOUBLE ARROW LEFT END", + mathclass="relation", + mathname="ctxdoublearrowfillleftend", + unicodeslot=0xFE350, +} ) + +addextra(0xFE351, { + category="sm", + description="MATHEMATICAL DOUBLE ARROW MIDDLE PART", + mathclass="relation", + mathname="ctxdoublearrowfillmiddlepart", + unicodeslot=0xFE351, +} ) + +addextra(0xFE352, { + category="sm", + description="MATHEMATICAL DOUBLE ARROW RIGHT END", + mathclass="relation", + mathname="ctxdoublearrowfillrightend", + unicodeslot=0xFE352, +} ) + +local push = { "push" } +local pop = { "pop" } +local leftarrow = { "char", 0x2190 } +local relbar = { "char", 0x2212 } +local rightarrow = { "char", 0x2192 } + +virtualcharacters[0xFE350] = function(data) + -- return combined(data,0x2190,0x2212) -- leftarrow relbar + local charone = data.characters[0x2190] + local chartwo = data.characters[0x2212] + if charone and chartwo then + local size = data.size/2 + return { + width = chartwo.width, + height = size, + depth = size, + commands = { + push, + { "down", size/2 }, + leftarrow, + pop, + { "down", -size/2 }, + relbar, + } + } + end +end + +virtualcharacters[0xFE351] = function(data) + -- return combined(data,0x2212,0x2212) -- relbar, relbar + local char = data.characters[0x2212] + if char then + local size = data.size/2 + return { + width = char.width, + height = size, + depth = size, + commands = { + push, + { "down", size/2 }, + relbar, + pop, + { "down", -size/2 }, + relbar, + } + } + end +end + +virtualcharacters[0xFE352] = function(data) + -- return combined(data,0x2192,0x2212) -- rightarrow relbar + local charone = data.characters[0x2192] + local chartwo = data.characters[0x2212] + if charone and chartwo then + local size = data.size/2 + return { + width = chartwo.width, + height = size, + depth = size, + commands = { + push, + { "down", size/2 }, + relbar, + pop, + { "right", chartwo.width - charone.width }, + { "down", -size/2 }, + rightarrow, + } + } + end +end + diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex c7d5a188a..7cda58a77 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 9507ef95c..02aab58d1 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi index 128cc824d..12159a4fe 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -1231,29 +1231,6 @@ \fi\fi \strc_floats_align_content{\copy\b_strc_floats_content}}} -% \def\strc_floats_prepare_page_caption -% {\dostarttagged\t!floatcaption\empty -% \edef\p_strc_floats_caption_location{\floatcaptionparameter\c!location}% -% \edef\p_strc_floats_caption_align {\floatcaptionparameter\c!align}% -% \doifinsetelse{\floatcaptionparameter\c!location}{\v!top,\v!bottom} -% {\doifinsetelse{\floatcaptionparameter\c!width}{\v!fit,\v!max} -% {\doifelse{\floatcaptionparameter\c!minwidth}\v!fit -% {\doifelse{\floatcaptionparameter\c!width}\v!max -% {\strc_floats_prepare_stack_caption_max} -% {\ifdim\wd\b_strc_floats_caption>\wd\b_strc_floats_content % wider caption -% \doifelse{\floatcaptionparameter\c!width}\v!fit -% {\strc_floats_prepare_stack_caption_auto} -% {\strc_floats_prepare_stack_caption_width}% -% \else -% \strc_floats_prepare_stack_caption_min -% \fi}} -% {\strc_floats_prepare_stack_caption_fixed}}% -% {\strc_floats_prepare_side_width_caption}}% new, special effects (see icare) -% {\doifinsetelse{\floatcaptionparameter\c!width}{\v!fit,\v!max} -% {\strc_floats_prepare_side_auto_caption} -% {\strc_floats_prepare_side_width_caption}}% -% \dostoptagged} - \def\strc_floats_prepare_page_caption {\edef\p_strc_floats_caption_location{\floatcaptionparameter\c!location}% \edef\p_strc_floats_caption_width {\floatcaptionparameter\c!width}% diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 844ff18cf..1a375d009 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/02/12 15:13:09 +-- merge date : 10/02/12 22:03:14 do -- begin closure to overcome local limits and interference |