summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/font-ctx.lua15
-rw-r--r--tex/context/base/font-gds.lua4
-rw-r--r--tex/context/base/font-ini.mkiv40
-rw-r--r--tex/context/base/math-ini.mkiv26
-rw-r--r--tex/context/base/math-vfu.lua257
-rw-r--r--tex/context/base/type-otf.mkiv5
-rw-r--r--tex/context/base/type-siz.mkiv2
-rw-r--r--tex/context/base/x-mathml.mkiv4
-rw-r--r--tex/context/fonts/symbol-math.lfg17
11 files changed, 188 insertions, 186 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 5ecae9c44..39f4b7e48 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2010.04.10 13:44}
+\newcontextversion{2010.04.13 16:57}
%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.tex b/tex/context/base/context.tex
index 7d0a30568..34cd917bc 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2010.04.10 13:44}
+\edef\contextversion{2010.04.13 16:57}
%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 95a02265e..ef02f925c 100644
--- a/tex/context/base/font-ctx.lua
+++ b/tex/context/base/font-ctx.lua
@@ -489,7 +489,7 @@ fonts.get_digit_width = fonts.set_digit_width
-- soon to be obsolete:
-local loaded = { -- prevent loading
+local loaded = { -- prevent double loading
["original-base.map" ] = true,
["original-ams-base.map" ] = true,
["original-ams-euler.map"] = true,
@@ -504,8 +504,19 @@ function fonts.map.loadfile(name)
end
end
+local loaded = { -- prevent double loading
+}
+
function fonts.map.loadline(how,line)
- pdf.mapline(how .. " " .. line)
+ if line then
+ how = how .. " " .. line
+ elseif how == "" then
+ how = "= " .. line
+ end
+ if not loaded[how] then
+ pdf.mapline(how)
+ loaded[how] = true
+ end
end
function fonts.map.reset()
diff --git a/tex/context/base/font-gds.lua b/tex/context/base/font-gds.lua
index 601e139ee..cace12509 100644
--- a/tex/context/base/font-gds.lua
+++ b/tex/context/base/font-gds.lua
@@ -272,12 +272,12 @@ local function initialize(goodies)
end
if mapfiles then
for i=1,#mapfiles do
- pdf.mapfile(mapfiles[i]) -- todo: backend function
+ fonts.map.loadfile(mapfiles[i]) -- todo: backend function
end
end
if maplines then
for i=1,#maplines do
- pdf.mapline(maplines[i]) -- todo: backend function
+ fonts.map.loadline(maplines[i]) -- todo: backend function
end
end
end
diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv
index 5ceeb70a9..02d793bc1 100644
--- a/tex/context/base/font-ini.mkiv
+++ b/tex/context/base/font-ini.mkiv
@@ -536,6 +536,21 @@
\appendtoks
\ifcase\boldmathmode\or\dosetmathfamily\mbfam\c!mb\fi
\to \mathstrategies
+
+% \chardef\msfam\plustwo % math symbol
+%
+% \def\c!ms{ms}
+%
+% \unexpanded\def\ms{\ifmmode\fam\plustwo\else\setcurrentfontalternative\c!ms\fi}
+%
+% \chardef\symbolmathmode\zerocount
+%
+% \def\enablesymbolmath {\chardef\symbolmathmode\plusone }
+% \def\disablesymbolmath{\chardef\symbolmathmode\zerocount}
+%
+% \appendtoks
+% \ifcase\symbolmathmode\or\dosetmathfamily\msfam\c!ms\fi
+% \to \mathstrategies
%D All used styles, like rm, ss and tt, are saved in a comma
%D separated list. Appart from practical limitations one can
@@ -2616,29 +2631,6 @@
\checkfontnamecombinations
\setcurrentfontstyle\normalizedbodyfontsize}
-%D The previous macros show that it's is not always
-%D neccessary to define the whole bunch of fonts, take for
-%D instance the sequence:
-%D
-%D \starttyping
-%D \setupbodyfont
-%D [ams]
-%D
-%D \definebodyfont [24pt] [mm]
-%D [ma=msam10 at 24pt,
-%D mb=msbm10 at 24pt]
-%D
-%D \switchtobodyfont
-%D [24pt]
-%D
-%D This is a 24pt $\blacktriangleleft$
-%D \stoptyping
-%D
-%D Here we didn't define the 24 point bodyfont environment, so
-%D it's defined automatically. Of course one can always use the
-%D \TEX\ primitive \type{\font} to switch to whatever font
-%D needed.
-
%D When asking for a complete font switch, for instance from 10
%D to 12~points, the next macro does the job. First we
%D normalize the size, next we define the current range of
@@ -2669,7 +2661,7 @@
%D and/or options defined in files, for example:
%D
%D \starttyping
-%D \setupbodyfont[cmr,ams,12pt,roman]
+%D \setupbodyfont[modern,12pt,roman]
%D \stoptyping
%D
%D This command affects the document as a whole: text, headers
diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv
index d4be17ded..08c2e1604 100644
--- a/tex/context/base/math-ini.mkiv
+++ b/tex/context/base/math-ini.mkiv
@@ -136,15 +136,7 @@
%D \macros
%D {boldsymbol}
%D
-%D The math definition is inspired by amsmath.
-%D
-%D \startbuffer
-%D \definetypeface [boldmath] [mm] [boldmath] [latin-modern] [modern] [encoding=texnansi]
-%D
-%D $a \times b$ $a \boldsymbol{\times} b$
-%D \stopbuffer
-%D
-%D \typebuffer \start \getbuffer \stop
+%D To be done.
\let\mathboldsymbol\relax % yet unsupported, will be
@@ -219,23 +211,7 @@
\def\definemathsymbol {\dosixtupleempty\dodefinemathsymbol}
\def\dodefinemathsymbol [#1][#2][#3][#4][#5][#6]{}
\def\definemathcharacter {\dosixtupleempty\dodefinemathcharacter}
-\def\redefinemathcharacter {\dosixtupleempty\dodefinemathcharacter}
\def\dodefinemathcharacter [#1][#2][#3][#4][#5][#6]{}
-\def\startmathcollection [#1]{}
-\def\setmathcollection #1{}
-\def\stopmathcollection {}
-\def\startrawmathcollection {}
-\def\stoprawmathcollection {}
-\def\setmathtoks {}
-\let\currentmathcollection \s!default
-\let\nomathcollection \s!default
-\let\mathcollection \s!default
-\def\enablemathcollection [#1]{}
-\def\usemathcollection {\dodoubleempty\dousemathcollection}
-\def\dousemathcollection [#1][#2]{}
-\let\mathclass \nomathcollection
-\let\autoenablemathcollection\relax
-\def\resetmathcollection [#1]{}
\def\definemathcommand
{\dotripleempty\dodefinemathcommand}
diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua
index 6097fbecb..5023e6b4d 100644
--- a/tex/context/base/math-vfu.lua
+++ b/tex/context/base/math-vfu.lua
@@ -24,8 +24,7 @@ fonts.vf.math.optional = false
local push, pop, back = { "push" }, { "pop" }, { "slot", 1, 0x2215 }
-local function negate(main,unicode,basecode)
- local characters = main.characters
+local function negate(main,characters,id,size,unicode,basecode)
if not characters[unicode] then
local basechar = characters[basecode]
if basechar then
@@ -54,8 +53,7 @@ end
--~ \Umathchardef\bracelu="0 "1 "FF07C
--~ \Umathchardef\braceru="0 "1 "FF07D
-local function brace(main,unicode,first,rule,left,right,rule,last)
- local characters = main.characters
+local function brace(main,characters,id,size,unicode,first,rule,left,right,rule,last)
if not characters[unicode] then
characters[unicode] = {
horiz_variants = {
@@ -70,24 +68,25 @@ local function brace(main,unicode,first,rule,left,right,rule,last)
end
end
-local function arrow(main,unicode,arrow,minus,isleft)
- if isleft then
- t = {
- { extender = 0, glyph = arrow },
- { extender = 1, glyph = minus },
- }
- else
- t = {
- { extender = 0, glyph = minus },
- { extender = 1, glyph = arrow },
- }
+local function arrow(main,characters,id,size,unicode,arrow,minus,isleft)
+ if characters[unicode] then
+ if isleft then
+ t = {
+ { extender = 0, glyph = arrow },
+ { extender = 1, glyph = minus },
+ }
+ else
+ t = {
+ { extender = 0, glyph = minus },
+ { extender = 1, glyph = arrow },
+ }
+ end
+ --~ main.characters[unicode] = { horiz_variants = t }
+ characters[unicode].horiz_variants = t
end
---~ main.characters[unicode] = { horiz_variants = t }
- main.characters[unicode].horiz_variants = t
end
-local function parent(main,unicode,first,rule,last)
- local characters = main.characters
+local function parent(main,characters,id,size,unicode,first,rule,last)
if not characters[unicode] then
characters[unicode] = {
horiz_variants = {
@@ -101,13 +100,13 @@ end
local push, pop, step = { "push" }, { "pop" }, 0.2 -- 0.1 is nicer but gives larger files
-local function make(main,id,size,n,m)
- local characters = main.characters
- local xu = main.parameters.x_height + 0.3*size
- local xd = 0.3*size
- local old, upslot, dnslot, uprule, dnrule = 0xFF000+n, 0xFF100+n, 0xFF200+n, 0xFF300+m, 0xFF400+m
+local function make(main,characters,id,size,n,m)
+ local old = 0xFF000+n
local c = characters[old]
if c then
+ local upslot, dnslot, uprule, dnrule = 0xFF100+n, 0xFF200+n, 0xFF300+m, 0xFF400+m
+ local xu = main.parameters.x_height + 0.3*size
+ local xd = 0.3*size
local w, h, d = c.width, c.height, c.depth
local thickness = h - d
local rulewidth = step*size -- we could use an overlap
@@ -128,127 +127,131 @@ local function make(main,id,size,n,m)
end
end
-local function minus(main,id,size,unicode)
- local characters = main.characters
- local mu = size/18
+local function minus(main,characters,id,size,unicode)
local minus = characters[0x002D]
- local width = minus.width - 5*mu
- characters[unicode] = {
- width = width, height = minus.height, depth = minus.depth,
- commands = { push, { "right", -3*mu }, { "slot", id, 0x002D }, pop }
- }
+ if minus then
+ local mu = size/18
+ local width = minus.width - 5*mu
+ characters[unicode] = {
+ width = width, height = minus.height, depth = minus.depth,
+ commands = { push, { "right", -3*mu }, { "slot", id, 0x002D }, pop }
+ }
+ end
end
-local function dots(main,id,size,unicode)
- local characters = main.characters
+local function dots(main,characters,id,size,unicode)
local c = characters[0x002E]
- local w, h, d = c.width, c.height, c.depth
- local mu = size/18
- local right3mu = { "right", 3*mu }
- local right1mu = { "right", 1*mu }
- local up1size = { "down", -.1*size }
- local up4size = { "down", -.4*size }
- local up7size = { "down", -.7*size }
- local right2muw = { "right", 2*mu + w }
- local slot = { "slot", id, 0x002E }
- if unicode == 0x22EF then
- local c = characters[0x022C5]
- if c then
- local w, h, d = c.width, c.height, c.depth
- local slot = { "slot", id, 0x022C5 }
+ if c then
+ local w, h, d = c.width, c.height, c.depth
+ local mu = size/18
+ local right3mu = { "right", 3*mu }
+ local right1mu = { "right", 1*mu }
+ local up1size = { "down", -.1*size }
+ local up4size = { "down", -.4*size }
+ local up7size = { "down", -.7*size }
+ local right2muw = { "right", 2*mu + w }
+ local slot = { "slot", id, 0x002E }
+ if unicode == 0x22EF then
+ local c = characters[0x022C5]
+ if c then
+ local w, h, d = c.width, c.height, c.depth
+ local slot = { "slot", id, 0x022C5 }
+ characters[unicode] = {
+ width = 3*w + 2*3*mu, height = h, depth = d,
+ commands = { push, slot, right3mu, slot, right3mu, slot, pop }
+ }
+ end
+ elseif unicode == 0x22EE then
+ -- weird height !
+ characters[unicode] = {
+ width = w, height = h+(1.4)*size, depth = 0,
+ commands = { push, push, slot, pop, up4size, push, slot, pop, up4size, slot, pop }
+ }
+ elseif unicode == 0x22F1 then
+ characters[unicode] = {
+ width = 3*w + 6*size/18, height = 1.5*size, depth = 0,
+ commands = {
+ push,
+ right1mu,
+ push, up7size, slot, pop,
+ right2muw,
+ push, up4size, slot, pop,
+ right2muw,
+ push, up1size, slot, pop,
+ right1mu,
+ pop
+ }
+ }
+ elseif unicode == 0x22F0 then
+ characters[unicode] = {
+ width = 3*w + 6*size/18, height = 1.5*size, depth = 0,
+ commands = {
+ push,
+ right1mu,
+ push, up1size, slot, pop,
+ right2muw,
+ push, up4size, slot, pop,
+ right2muw,
+ push, up7size, slot, pop,
+ right1mu,
+ pop
+ }
+ }
+ else
characters[unicode] = {
width = 3*w + 2*3*mu, height = h, depth = d,
commands = { push, slot, right3mu, slot, right3mu, slot, pop }
}
end
- elseif unicode == 0x22EE then
- -- weird height !
- characters[unicode] = {
- width = w, height = h+(1.4)*size, depth = 0,
- commands = { push, push, slot, pop, up4size, push, slot, pop, up4size, slot, pop }
- }
- elseif unicode == 0x22F1 then
- characters[unicode] = {
- width = 3*w + 6*size/18, height = 1.5*size, depth = 0,
- commands = {
- push,
- right1mu,
- push, up7size, slot, pop,
- right2muw,
- push, up4size, slot, pop,
- right2muw,
- push, up1size, slot, pop,
- right1mu,
- pop
- }
- }
- elseif unicode == 0x22F0 then
- characters[unicode] = {
- width = 3*w + 6*size/18, height = 1.5*size, depth = 0,
- commands = {
- push,
- right1mu,
- push, up1size, slot, pop,
- right2muw,
- push, up4size, slot, pop,
- right2muw,
- push, up7size, slot, pop,
- right1mu,
- pop
- }
- }
- else
- characters[unicode] = {
- width = 3*w + 2*3*mu, height = h, depth = d,
- commands = { push, slot, right3mu, slot, right3mu, slot, pop }
- }
end
end
-local function vertbar(main,id,size,parent,scale,unicode)
- local characters = main.characters
+local function vertbar(main,characters,id,size,parent,scale,unicode)
local cp = characters[parent]
- local sc = scale * size
- local pc = { "slot", id, parent }
- characters[unicode] = {
- width = cp.width,
- height = cp.height + sc,
- depth = cp.depth + sc,
- commands = {
- push, { "down", -sc }, pc, pop,
- push, { "down", sc }, pc, pop,
- pc,
- },
- next = cp.next -- can be extensible
- }
- cp.next = unicode
+ if cp then
+ local sc = scale * size
+ local pc = { "slot", id, parent }
+ characters[unicode] = {
+ width = cp.width,
+ height = cp.height + sc,
+ depth = cp.depth + sc,
+ commands = {
+ push, { "down", -sc }, pc, pop,
+ push, { "down", sc }, pc, pop,
+ pc,
+ },
+ next = cp.next -- can be extensible
+ }
+ cp.next = unicode
+ end
end
function fonts.vf.math.alas(main,id,size)
+ local characters = main.characters
for i=0x7A,0x7D do
- make(main,id,size,i,1)
+ make(main,characters,id,size,i,1)
end
- brace (main,0x23DE,0xFF17A,0xFF301,0xFF17D,0xFF17C,0xFF301,0xFF17B)
- brace (main,0x23DF,0xFF27C,0xFF401,0xFF27B,0xFF27A,0xFF401,0xFF27D)
- parent(main,0x23DC,0xFF17A,0xFF301,0xFF17B)
- parent(main,0x23DD,0xFF27C,0xFF401,0xFF27D)
- negate(main,0x2260,0x003D)
- dots(main,id,size,0x2026) -- ldots
- dots(main,id,size,0x22EE) -- vdots
- dots(main,id,size,0x22EF) -- cdots
- dots(main,id,size,0x22F1) -- ddots
- dots(main,id,size,0x22F0) -- udots
- minus(main,id,size,0xFF501)
- arrow(main,0x2190,0xFE190,0xFF501,true) -- left
- arrow(main,0x2192,0xFE192,0xFF501,false) -- right
- vertbar(main,id,size,0x0007C,0.10,0xFF601) -- big : 0.85 bodyfontsize
- vertbar(main,id,size,0xFF601,0.30,0xFF602) -- Big : 1.15 bodyfontsize
- vertbar(main,id,size,0xFF602,0.30,0xFF603) -- bigg : 1.45 bodyfontsize
- vertbar(main,id,size,0xFF603,0.30,0xFF604) -- Bigg : 1.75 bodyfontsize
- vertbar(main,id,size,0x02225,0.10,0xFF605)
- vertbar(main,id,size,0xFF605,0.30,0xFF606)
- vertbar(main,id,size,0xFF606,0.30,0xFF607)
- vertbar(main,id,size,0xFF607,0.30,0xFF608)
+ brace (main,characters,id,size,0x23DE,0xFF17A,0xFF301,0xFF17D,0xFF17C,0xFF301,0xFF17B)
+ brace (main,characters,id,size,0x23DF,0xFF27C,0xFF401,0xFF27B,0xFF27A,0xFF401,0xFF27D)
+ parent (main,characters,id,size,0x23DC,0xFF17A,0xFF301,0xFF17B)
+ parent (main,characters,id,size,0x23DD,0xFF27C,0xFF401,0xFF27D)
+ negate (main,characters,id,size,0x2260,0x003D)
+ dots (main,characters,id,size,0x2026) -- ldots
+ dots (main,characters,id,size,0x22EE) -- vdots
+ dots (main,characters,id,size,0x22EF) -- cdots
+ dots (main,characters,id,size,0x22F1) -- ddots
+ dots (main,characters,id,size,0x22F0) -- udots
+ minus (main,characters,id,size,0xFF501)
+ arrow (main,characters,id,size,0x2190,0xFE190,0xFF501,true) -- left
+ arrow (main,characters,id,size,0x2192,0xFE192,0xFF501,false) -- right
+ vertbar(main,characters,id,size,0x0007C,0.10,0xFF601) -- big : 0.85 bodyfontsize
+ vertbar(main,characters,id,size,0xFF601,0.30,0xFF602) -- Big : 1.15 bodyfontsize
+ vertbar(main,characters,id,size,0xFF602,0.30,0xFF603) -- bigg : 1.45 bodyfontsize
+ vertbar(main,characters,id,size,0xFF603,0.30,0xFF604) -- Bigg : 1.75 bodyfontsize
+ vertbar(main,characters,id,size,0x02225,0.10,0xFF605)
+ vertbar(main,characters,id,size,0xFF605,0.30,0xFF606)
+ vertbar(main,characters,id,size,0xFF606,0.30,0xFF607)
+ vertbar(main,characters,id,size,0xFF607,0.30,0xFF608)
end
local unique = 0 -- testcase: \startTEXpage \math{!\text{-}\text{-}\text{-}} \stopTEXpage
diff --git a/tex/context/base/type-otf.mkiv b/tex/context/base/type-otf.mkiv
index 3d41371b7..f2dcb71fe 100644
--- a/tex/context/base/type-otf.mkiv
+++ b/tex/context/base/type-otf.mkiv
@@ -24,6 +24,11 @@
\unprotect
+% \starttypescript [math] [modern,computer-modern,latin-modern]
+% \definefontsynonym[MathSymbol][MathSymbol-Regular@symbol-math]
+% \loadfontgoodies[symbol-math]
+% \stoptypescript
+
\starttypescriptcollection[latinmodern]
%D The names have changed (again) ... but I will not change the symbolic names
diff --git a/tex/context/base/type-siz.mkiv b/tex/context/base/type-siz.mkiv
index 734c262b5..fb06267d4 100644
--- a/tex/context/base/type-siz.mkiv
+++ b/tex/context/base/type-siz.mkiv
@@ -218,6 +218,8 @@
\stoptypescript
+% ms=MathSymbol sa 1
+
\starttypescript [math] [modern,computer-modern,latin-modern] [size]
\definebodyfont [12pt] [mm] [mr=LMMathRoman12-Regular sa 1, mb=LMMathRoman12-Bold sa 1]
diff --git a/tex/context/base/x-mathml.mkiv b/tex/context/base/x-mathml.mkiv
index a32009f06..b7865a3c3 100644
--- a/tex/context/base/x-mathml.mkiv
+++ b/tex/context/base/x-mathml.mkiv
@@ -550,10 +550,6 @@
\xmlsetup{#1}{mml:cn:polar}
\stopxmlsetups
-% \doif\MMLcnalternative\v!b{\redefinemathcharacter [.][ord][mi]["3B]\relax}%
-%
-% todo: number function from mmp
-
% helpers ci
\startxmlsetups mml:cn:default
diff --git a/tex/context/fonts/symbol-math.lfg b/tex/context/fonts/symbol-math.lfg
new file mode 100644
index 000000000..d37a3b1ee
--- /dev/null
+++ b/tex/context/fonts/symbol-math.lfg
@@ -0,0 +1,17 @@
+return {
+ name = "symbol-math",
+ version = "1.00",
+ comment = "Goodies that complement symbol math.",
+ author = "Hans Hagen",
+ copyright = "ConTeXt development team",
+ mathematics = {
+ mapfiles = {
+ "mkiv-base.map",
+ },
+ virtuals = {
+ ["symbol-math"] = {
+ { name = "rsfs10", features = "virtualmath", main = true }, -- tfm name needed
+ },
+ }
+ }
+}