summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2013-03-24 15:11:00 +0100
committerHans Hagen <pragma@wxs.nl>2013-03-24 15:11:00 +0100
commit6f5a110cb2b224aa3724194edfa354d38e7235cc (patch)
treed198651336a53f8dddd508c44ceba4ad467955e3
parent7c3dc990b7eb267958c5e904577c30cc92956db2 (diff)
downloadcontext-6f5a110cb2b224aa3724194edfa354d38e7235cc.tar.gz
beta 2013.03.24 15:11
-rw-r--r--tex/context/base/char-def.lua2
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4135 -> 4137 bytes
-rw-r--r--tex/context/base/context-version.pngbin40244 -> 40261 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/math-def.mkiv5
-rw-r--r--tex/context/base/math-ini.mkiv50
-rw-r--r--tex/context/base/math-map.lua132
-rw-r--r--tex/context/base/math-noa.lua2
-rw-r--r--tex/context/base/mult-def.mkiv1
-rw-r--r--tex/context/base/mult-sys.mkiv3
-rw-r--r--tex/context/base/status-files.pdfbin24759 -> 24756 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin211620 -> 211596 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
16 files changed, 121 insertions, 84 deletions
diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua
index ccf1718c6..b8bf8d2e2 100644
--- a/tex/context/base/char-def.lua
+++ b/tex/context/base/char-def.lua
@@ -169152,11 +169152,11 @@ characters.data={
},
[0x1D6FB]={
category="sm",
+ comment="mathname='nabla'",
description="MATHEMATICAL ITALIC NABLA",
direction="l",
linebreak="al",
mathclass="default",
- mathname="nabla",
specials={ "font", 0x2207 },
unicodeslot=0x1D6FB,
visual="it",
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 3384373c5..1763a50ae 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{2013.03.23 14:11}
+\newcontextversion{2013.03.24 15:11}
%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 4855e0cd8..29e251c13 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{2013.03.23 14:11}
+\newcontextversion{2013.03.24 15:11}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 9f7c0a4be..bbdd8306b 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index 5949427cc..76e54ddeb 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index a9072da32..54f3720da 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{2013.03.23 14:11}
+\edef\contextversion{2013.03.24 15:11}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index ee83bd0ed..b07d561c1 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{2013.03.23 14:11}
+\edef\contextversion{2013.03.24 15:11}
%D For those who want to use this:
diff --git a/tex/context/base/math-def.mkiv b/tex/context/base/math-def.mkiv
index 250c9bc5e..cc2a8fae6 100644
--- a/tex/context/base/math-def.mkiv
+++ b/tex/context/base/math-def.mkiv
@@ -367,6 +367,11 @@
\unexpanded\def\surd{\normalsurd{}}
+% Some special characters:
+
+\unexpanded\def\nabla{∇} % this one adapts
+
+%
% todo mathclass=punctuation ord
% \Umathcode"02C="6 \defaultmathfamily "02C
diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv
index 957dda529..4253ee6e7 100644
--- a/tex/context/base/math-ini.mkiv
+++ b/tex/context/base/math-ini.mkiv
@@ -48,7 +48,7 @@
\definesystemattribute[mathalphabet] [public]
\definesystemattribute[mathsize] [public]
\definesystemattribute[mathpunctuation][public]
-\definesystemattribute[mathgreek] [public]
+\definesystemattribute[mathgreek] [public] % will become generic
\definesystemattribute[mathalternate] [public]
\definesystemattribute[mathrendering] [public]
\definesystemattribute[mathcategory] [public]
@@ -112,13 +112,6 @@
% todo: only in mmode
-\unexpanded\def\mathgreekupright{\attribute\mathgreekattribute22 }
-\unexpanded\def\mathgreekitalic {\attribute\mathgreekattribute33 }
-\unexpanded\def\mathgreekdefault{\attribute\mathgreekattribute\attributeunsetvalue}
-
-\let\mathgreeknormal\mathgreekupright
-\let\mathgreeknone \mathgreekdefault
-
% these commands are semi-public but should not be used directly (lua names wil change)
\unexpanded\def\math_set_attribute #1#2{\ifmmode\ctxcommand{setmathattribute("#1","#2")}\fi}
@@ -805,31 +798,40 @@
\newconstant\c_math_greek_attribute
-\setvalue{\??mathgreek\v!normal :\v!normal}{22}
-\setvalue{\??mathgreek\v!normal :\v!italic}{23}
-\setvalue{\??mathgreek\v!normal :\v!none }{21}
-
-\setvalue{\??mathgreek\v!italic :\v!normal}{32}
-\setvalue{\??mathgreek\v!italic :\v!italic}{33}
-\setvalue{\??mathgreek\v!italic :\v!none }{31}
-
-\setvalue{\??mathgreek\v!none :\v!normal}{12}
-\setvalue{\??mathgreek\v!none :\v!italic}{13}
-\letvalue{\??mathgreek\v!none :\v!none }\attributeunsetvalue
+\setvalue{\??mathgreek\v!none }{1}
+\setvalue{\??mathgreek\v!normal}{2}
+\setvalue{\??mathgreek\v!italic}{3}
\appendtoks
- \edef\p_lcgreek_ucgreek{\mathematicsparameter\s!lcgreek:\mathematicsparameter\s!ucgreek}%
- \c_math_greek_attribute\csname\??mathgreek
- \ifcsname\??mathgreek\p_lcgreek_ucgreek\endcsname\p_lcgreek_ucgreek\else\v!none\fi
- \endcsname\relax
+ \edef\p_sygreek{\mathematicsparameter\s!sygreek}%
+ \edef\p_lcgreek{\mathematicsparameter\s!lcgreek}%
+ \edef\p_ucgreek{\mathematicsparameter\s!ucgreek}%
+ \c_math_greek_attribute"% hex digits
+ \csname\??mathgreek\ifcsname\??mathgreek\p_sygreek\endcsname\p_sygreek\else\v!none\fi\endcsname
+ \csname\??mathgreek\ifcsname\??mathgreek\p_lcgreek\endcsname\p_lcgreek\else\v!none\fi\endcsname
+ \csname\??mathgreek\ifcsname\??mathgreek\p_ucgreek\endcsname\p_ucgreek\else\v!none\fi\endcsname
+ \relax
+ \ifcase\c_math_greek_attribute
+ \c_math_greek_attribute\attributeunsetvalue
+ \fi
\to \everyswitchmathematics
+% only used local
+
+\unexpanded\def\mathgreekupright{\attribute\mathgreekattribute"222\relax}
+\unexpanded\def\mathgreekitalic {\attribute\mathgreekattribute"333\relax}
+\unexpanded\def\mathgreekdefault{\attribute\mathgreekattribute"000\relax}
+
+\let\mathgreeknormal\mathgreekupright
+\let\mathgreeknone \mathgreekdefault
+
\appendtoks
\attribute\mathgreekattribute\c_math_greek_attribute
\to \everymathematics
\setupmathematics
- [\s!lcgreek=\v!italic,
+ [\s!sygreek=\v!normal,
+ \s!lcgreek=\v!italic,
\s!ucgreek=\v!normal] % was: none
%D Math italics (experiment)
diff --git a/tex/context/base/math-map.lua b/tex/context/base/math-map.lua
index 05d63552c..7772a981c 100644
--- a/tex/context/base/math-map.lua
+++ b/tex/context/base/math-map.lua
@@ -31,18 +31,19 @@ if not modules then modules = { } end modules ['math-map'] = {
local type, next = type, next
local floor, div = math.floor, math.div
local merged = table.merged
+local extract = bit32.extract
local allocate = utilities.storage.allocate
local texattribute = tex.attribute
local otffeatures = fonts.constructors.newfeatures("otf")
local registerotffeature = otffeatures.register
+local setmetatableindex = table.setmetatableindex
-local trace_greek = false trackers.register("math.greek", function(v) trace_greek = v end)
+local trace_greek = false trackers.register("math.greek", function(v) trace_greek = v end)
+local report_remapping = logs.reporter("mathematics","remapping")
-local report_remapping = logs.reporter("mathematics","remapping")
-
-mathematics = mathematics or { }
-local mathematics = mathematics
+mathematics = mathematics or { }
+local mathematics = mathematics
-- Unfortunately some alphabets have gaps (thereby troubling all applications that
-- need to deal with math). Somewhat strange considering all those weird symbols that
@@ -515,7 +516,7 @@ end
local mathalphabet = attributes.private("mathalphabet")
function mathematics.getboth(alphabet,style)
- local data = alphabets[alphabet or "regular"] or regular
+ local data = alphabet and alphabets[alphabet] or regular
data = data[style or "tf"] or data.tf
return data and data.attribute
end
@@ -528,8 +529,8 @@ function mathematics.getstyle(style)
end
function mathematics.syncboth(alphabet,style)
- local data = alphabets[alphabet or "regular"] or regular
- data = data[style or "tf"] or data.tf
+ local data = alphabet and alphabets[alphabet] or regular
+ data = style and data[style] or data.tf
texattribute[mathalphabet] = data and data.attribute or texattribute[mathalphabet]
end
@@ -548,64 +549,89 @@ function mathematics.syncname(alphabet)
texattribute[mathalphabet] = data and data.attribute or texattribute[mathalphabet]
end
-local issymbol = regular.tf.symbols
-local islcgreek = regular.tf.lcgreek
-local isucgreek = regular.tf.ucgreek
+local islcgreek = regular_tf.lcgreek
+local isucgreek = regular_tf.ucgreek
+local issygreek = regular_tf.symbols
+local isgreek = merged(islcgreek,isucgreek,issygreek)
-local remapping = {
+local greekremapping = {
[1] = { what = "unchanged" }, -- upright
[2] = { what = "upright", it = "tf", bi = "bf" }, -- upright
[3] = { what = "italic", tf = "it", bf = "bi" }, -- italic
}
+local usedremap = { }
+
+local function resolver(map)
+ return function (t,k)
+ local v =
+ map.digits [k] or
+ map.lcletters[k] or map.ucletters[k] or
+ map.lcgreek [k] or map.ucgreek [k] or
+ map.symbols [k] or k
+ t[k] = v
+ return v
+ end
+end
+
+for k, v in next, mathremap do
+ local t = { }
+ setmetatableindex(t,resolver(v))
+ usedremap[k] = t
+end
+
+local function remapgreek(mathalphabet,how,detail,char)
+ local r = mathremap[mathalphabet] -- what if 0
+ local alphabet = r and r.alphabet or "regular"
+ local style = r and r.style or "tf"
+ local remapping = greekremapping[how]
+ if trace_greek then
+ report_remapping("greek %s, %s char %C, alphabet %a %a, method %a","before",detail,char,alphabet,style,remapping.what)
+ end
+ local newstyle = remapping[style]
+ if newstyle then
+ local data = alphabets[alphabet][newstyle] -- always something
+ mathalphabet = data and data.attribute or mathalphabet
+ style = newstyle
+ end
+ if trace_greek then
+ report_remapping("greek %s, %s char %C, alphabet %a %a, method %a","after",detail,char,alphabet,style,remapping.what)
+ end
+ return mathalphabet, style
+end
+
function mathematics.remapalphabets(char,mathalphabet,mathgreek)
+ if not mathalphabet then
+ return
+ end
if mathgreek and mathgreek > 0 then
- local lc, uc = floor(mathgreek/10), mathgreek % 10 -- 2 == upright 3 == italic
- if lc > 1 or uc > 1 then
- local islc, isuc = islcgreek[char] and lc, isucgreek[char] and uc
- if islc or isuc then
- local r = mathremap[mathalphabet] -- what if 0
- local alphabet = r and r.alphabet or "regular"
- local style = r and r.style or "tf"
- if trace_greek then
- report_remapping("greek before, char %C, alphabet %a %a, lcgreek %a, ucgreek %a",char,alphabet,style,remapping[lc].what,remapping[uc].what)
- end
- local s = remapping[islc or isuc][style]
- if s then
- local data = alphabets[alphabet][s]
- mathalphabet, style = data and data.attribute or mathalphabet, s
- end
- if trace_greek then
- report_remapping("greek after, char %C, alphabet %a %a, lcgreek %a, ucgreek %a",char,alphabet,style,remapping[lc].what,remapping[uc].what)
- end
+ if not isgreek[char] then
+ -- nothing needed
+ elseif islcgreek[char] then
+ local lc = extract(mathgreek,4,4)
+ if lc > 1 then
+ mathalphabet = remapgreek(mathalphabet,lc,"lowercase",char)
+ end
+ elseif isucgreek[char] then
+ local uc = extract(mathgreek,0,4)
+ if uc > 1 then
+ mathalphabet = remapgreek(mathalphabet,uc,"uppercase",char)
+ end
+ elseif issygreek[char] then
+ local sy = extract(mathgreek,8,4)
+ if sy > 1 then
+ mathalphabet = remapgreek(mathalphabet,sy,"symbol",char)
end
end
end
- -- table test can go away
- if mathalphabet and mathalphabet > 0 then
- local newchar
- local offset = mathremap[mathalphabet]
- if not offset then
- -- nothing to remap
- elseif char >= 0x030 and char <= 0x039 then
- local o = offset.digits
- newchar = o and ((type(o) == "table" and (o[char] or char)) or (char - 0x030 + o))
- elseif char >= 0x041 and char <= 0x05A then
- local o = offset.ucletters
- newchar = o and ((type(o) == "table" and (o[char] or char)) or (char - 0x041 + o))
- elseif char >= 0x061 and char <= 0x07A then
- local o = offset.lcletters
- newchar = o and ((type(o) == "table" and (o[char] or char)) or (char - 0x061 + o))
- elseif islcgreek[char] then
- newchar = offset.lcgreek[char]
- elseif isucgreek[char] then
- newchar = offset.ucgreek[char]
- elseif issymbol[char] then
- newchar = offset.symbols[char]
+ if mathalphabet > 0 then
+ local remap = usedremap[mathalphabet] -- redundant check
+ if remap then
+ local newchar = remap[char]
+ return newchar ~= char and newchar
end
- return newchar ~= char and newchar
end
- return nil
+ -- return nil
end
-- begin of experiment
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index ecfb0f85f..2371110c1 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -814,6 +814,8 @@ end)
-- math alternates: (in xits lgf: $ABC$ $\cal ABC$ $\mathalternate{cal}\cal ABC$)
-- math alternates: (in lucidanova lgf: $ABC \mathalternate{italic} ABC$)
+-- todo: set alternate for specific symbols
+
local function initializemathalternates(tfmdata)
local goodies = tfmdata.goodies
if goodies then
diff --git a/tex/context/base/mult-def.mkiv b/tex/context/base/mult-def.mkiv
index 6b4d46a79..069d48d21 100644
--- a/tex/context/base/mult-def.mkiv
+++ b/tex/context/base/mult-def.mkiv
@@ -70,6 +70,7 @@
\def\s!lcgreek {lcgreek}
\def\s!ucgreek {ucgreek}
+\def\s!sygreek {sygreek}
\def\s!italics {italics}
\def\s!integral {integral}
\def\s!insert {insert} % maybe insertclass
diff --git a/tex/context/base/mult-sys.mkiv b/tex/context/base/mult-sys.mkiv
index 9e5ca5034..135d8bcf7 100644
--- a/tex/context/base/mult-sys.mkiv
+++ b/tex/context/base/mult-sys.mkiv
@@ -174,6 +174,7 @@
\definesystemconstant {fraktur}
\definesystemconstant {blackboard}
+\definesystemconstant {mi} % maybe some day a special default vector
\definesystemconstant {tf}
\definesystemconstant {sl}
\definesystemconstant {it}
@@ -301,7 +302,7 @@
%definesystemconstant {encoding}
%definesystemconstant {entities}
%definesystemconstant {resource}
-%definesystemconstant {mapping}
+\definesystemconstant {mapping}
\definesystemconstant {language}
\definesystemconstant {patterns}
\definesystemconstant {rname}
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 45884e446..782fd5aa7 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 9f0f763ae..135c4ba01 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index bffec94bc..87857f01f 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 : 03/23/13 14:11:49
+-- merge date : 03/24/13 15:11:25
do -- begin closure to overcome local limits and interference