summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-01-05 19:27:44 +0100
committerHans Hagen <pragma@wxs.nl>2012-01-05 19:27:44 +0100
commit140009d337d42f52dc7e305c5f500445741a4735 (patch)
treeb0c93432a2cc88e4b3bc80437f56810c1a0e4e3c
parent027f62e76cbada6f7fea7fc71189517d45677aa3 (diff)
downloadcontext-140009d337d42f52dc7e305c5f500445741a4735.tar.gz
beta 2011.12.16 13:54
-rw-r--r--tex/context/base/context-version.pdfbin4074 -> 4072 bytes
-rw-r--r--tex/context/base/context-version.pngbin106151 -> 106268 bytes
-rw-r--r--tex/context/base/font-ini.mkiv151
-rw-r--r--tex/context/base/math-noa.lua37
-rw-r--r--tex/context/base/status-files.pdfbin24024 -> 24019 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin169695 -> 169694 bytes
-rw-r--r--tex/context/base/strc-sec.mkiv4
-rw-r--r--tex/context/base/type-ini.mkiv4
-rw-r--r--tex/context/base/type-otf.mkiv2
9 files changed, 143 insertions, 55 deletions
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 67301fb6a..b999615d8 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 55c03e63e..310a33f3e 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv
index 14c845793..e4c63a4c9 100644
--- a/tex/context/base/font-ini.mkiv
+++ b/tex/context/base/font-ini.mkiv
@@ -14,6 +14,10 @@
% runtime commands will move to modules
+% todo: reconsider design sizes ... kick 'm out which removes the size
+% code and simplifies things considerably. After all, there will be no
+% lm math in sizes.
+
% todo: (so that we can delay font loading to \starttext
% simplification ... we no longer deal with specific mmtfa specifications
@@ -518,77 +522,123 @@
\def\mathsizesuffix{\ifcase0\currentmathsize\or\mathtextsuffix\or\mathscriptsuffix\or\mathscriptscriptsuffix\fi}
-\def\dodosetmathfamily#1#2%
+% Beware: truefontname also does a fallback on defaultfontclass so there
+% can be some interference here, which is why we use a different method
+% for bold.
+
+\def\dodosetmathfamily
{\ifcsname\fontclass \fontbody\c!mm\fontfamily\fontsize\currentmathsize\endcsname \autofontsizefalse
\csname\fontclass \fontbody\c!mm\fontfamily\fontsize\currentmathsize\endcsname \else
\ifcsname\fontclass \fontbody\c!mm\fontfamily \currentmathsize\endcsname \autofontsizetrue
\csname\fontclass \fontbody\c!mm\fontfamily \currentmathsize\endcsname \else
- \dodosetmathfamilyx#1#2%
- \fi\fi
- #1#2\font}
+ \dodosetmathfamilyx
+ \fi\fi}
-\def\dodosetmathfamilyx#1#2% somehow this fallback does now always work
+\def\dodosetmathfamilyx
{\ifcsname\defaultfontclass\fontbody\c!mm\fontfamily\fontsize\currentmathsize\endcsname \autofontsizefalse
\csname\defaultfontclass\fontbody\c!mm\fontfamily\fontsize\currentmathsize\endcsname \else
\ifcsname\defaultfontclass\fontbody\c!mm\fontfamily \currentmathsize\endcsname \autofontsizetrue
\csname\defaultfontclass\fontbody\c!mm\fontfamily \currentmathsize\endcsname \else
- \dodosetmathfamilyxx#1#2%
+ \dodosetmathfamilyxx
\fi\fi}
-\def\dodosetmathfamilyxx#1#2%
+\def\dodosetmathfamilyxx
{\ifcsname \fontbody\c!mm\fontfamily\fontsize\currentmathsize\endcsname \autofontsizefalse
\csname \fontbody\c!mm\fontfamily\fontsize\currentmathsize\endcsname \else
\ifcsname \fontbody\c!mm\fontfamily \currentmathsize\endcsname \autofontsizetrue
\csname \fontbody\c!mm\fontfamily \currentmathsize\endcsname \else
- \nullfont \autofontsizetrue
+ \font\nullfont \autofontsizetrue
\fi\fi}
-\def\dosetmathfamily#1#2%
- {\let\savedfontbody\fontbody % op hoger plan
+\def\dosetmathfamilyindeed#1#2% \currentmathsize etc are also used later on
+ {\let\savedfontbody\fontbody
\let\fontfamily#2%
-% % new per 20100817
-% \checkbodyfontenvironment[\scriptscriptface]% pretty slow when many switches
-% \checkbodyfontenvironment[\scriptface]%
-% \checkbodyfontenvironment[\textface]%
-% %
- \let\currentmathsize\!!plusthree\let\fontbody\scriptscriptface\dodosetmathfamily\scriptscriptfont#1%
- \let\currentmathsize\!!plustwo \let\fontbody\scriptface \dodosetmathfamily\scriptfont #1%
- \let\currentmathsize\!!plusone \let\fontbody\textface \dodosetmathfamily\textfont #1%
+ \let\currentmathsize\!!plusthree\let\fontbody\scriptscriptface\dodosetmathfamily\scriptscriptfont#1\font
+ \let\currentmathsize\!!plustwo \let\fontbody\scriptface \dodosetmathfamily\scriptfont #1\font
+ \let\currentmathsize\!!plusone \let\fontbody\textface \dodosetmathfamily\textfont #1\font
+ \ifconditional\optimizemathfontdefinitions
+ \dosavefontclassmathfamily#1#2%
+ \fi
\let\currentmathsize\empty
\let\fontbody\savedfontbody
\autofontsizefalse}
-% experiment
-%
+\def\dodosetboldmathfamily#1%
+ {\ifcsname\fontclass \fontbody\c!mm\fontfamily\fontsize\currentmathsize\endcsname \autofontsizefalse
+ \csname\fontclass \fontbody\c!mm\fontfamily\fontsize\currentmathsize\endcsname
+ \else\ifcsname\fontclass \fontbody\c!mm\fontfamily \currentmathsize\endcsname \autofontsizetrue
+ \csname\fontclass \fontbody\c!mm\fontfamily \currentmathsize\endcsname
+ \else
+ \font#1%
+ \fi\fi}
+
+\def\dosetboldmathfamilyindeed#1#2#3%
+ {\let\savedfontclass\defaultfontclass
+ \let\defaultfontclass\fontclass % else truefontname falls back on the wrong one
+ \let\savedfontbody\fontbody
+ \let\fontfamily#2%
+ \let\currentmathsize\!!plusthree\let\fontbody\scriptscriptface\dodosetboldmathfamily#3\scriptscriptfont#1\font
+ \let\currentmathsize\!!plustwo \let\fontbody\scriptface \dodosetboldmathfamily#3\scriptfont #1\font
+ \let\currentmathsize\!!plusone \let\fontbody\textface \dodosetboldmathfamily#3\textfont #1\font
+ \ifconditional\optimizemathfontdefinitions
+ \dosavefontclassmathfamily#1#2%
+ \fi
+ \let\currentmathsize\empty
+ \let\fontbody\savedfontbody
+ \let\defaultfontclass\savedfontclass
+ \autofontsizefalse}
+
% optimized: math fonts are never changed (10K \bfa $x$: 3.2 => 2.5 (baseline 1.0))
+%
+% sort of tricky: we cannot reset in \everybeforedefinetypeface as we don't know
+% all sizes so we postpone the optimization to the first starttext
+%
+% pitfall: we should reset 'm when a fontclass name is reused
+
+\newconditional\optimizemathfontdefinitions \settrue\optimizemathfontdefinitions
\def\dosetmathfamily#1#2% fam tag
- {\ifcsname\??ff:\fontclass:\textface:\c!mm:#2:\fontsize\endcsname
- \csname\??ff:\fontclass:\textface:\c!mm:#2:\fontsize\endcsname
+ {\ifconditional\optimizemathfontdefinitions
+ \ifcsname\??ff:\fontclass:\textface:\c!mm:#2:\fontsize\endcsname
+ \csname\??ff:\fontclass:\textface:\c!mm:#2:\fontsize\endcsname
+ \else
+ \dosetmathfamilyindeed#1#2%
+ \fi
\else
\dosetmathfamilyindeed#1#2%
\fi}
-\def\dosetmathfamilyindeed#1#2%
- {\let\savedfontbody\fontbody % op hoger plan
- \let\fontfamily#2%
- \let\currentmathsize\!!plusthree\let\fontbody\scriptscriptface\dodosetmathfamily\scriptscriptfont#1%
- \let\currentmathsize\!!plustwo \let\fontbody\scriptface \dodosetmathfamily\scriptfont #1%
- \let\currentmathsize\!!plusone \let\fontbody\textface \dodosetmathfamily\textfont #1%
- \dosavefontclassmathfamily#1#2%
- \let\currentmathsize\empty
- \let\fontbody\savedfontbody
- \autofontsizefalse}
+\def\dosetboldmathfamily#1#2#3% fam tag
+ {\ifconditional\optimizemathfontdefinitions
+ \ifcsname\??ff:\fontclass:\textface:\c!mm:#2:\fontsize\endcsname
+ \csname\??ff:\fontclass:\textface:\c!mm:#2:\fontsize\endcsname
+ \else
+ \dosetboldmathfamilyindeed#1#2#3%
+ \fi
+ \else
+ \dosetboldmathfamilyindeed#1#2#3%
+ \fi}
-% tricky: we cannot reset in \everybeforedefinetypeface as we don't know all sizes
-% so we postpone the optimization to the first starttext
+\unexpanded\def\doresetfontclassmathfamily#1#2#3%
+ {\global\expandafter\let\csname\??ff:#1:\textface:\c!mm:#2:#3\endcsname\undefined}
-\def\dosavefontclassmathfamilyindeed#1#2%
+\def\dosavefontclassmathfamilyindeed#1#2% weird double 1-3 .. will be cleaned up
{\expandafter\xdef\csname\??ff:\fontclass:\textface:\c!mm:#2:\fontsize\endcsname{%
\scriptscriptfont#1\csname*\fontclass\scriptscriptface\c!mm#23\fontsize3*\endcsname
\scriptfont #1\csname*\fontclass\scriptface \c!mm#22\fontsize2*\endcsname
- \textfont #1\csname*\fontclass\textface \c!mm#21\fontsize1*\endcsname
- }}
+ \textfont #1\csname*\fontclass\textface \c!mm#21\fontsize1*\endcsname}%
+ \ifcsname\??ff:l:\fontclass\endcsname \else
+ \expandafter\newtoks\csname\??ff:l:\fontclass\endcsname
+ \fi
+ \normalexpanded{\global\csname\??ff:l:\fontclass\endcsname
+ {\the\csname\??ff:l:\fontclass\endcsname\doresetfontclassmathfamily{\fontclass}{#2}{\fontsize}}}%
+ }
+
+\def\resetfontclassmathfamilies#1%
+ {\ifcsname\??ff:l:#1\endcsname
+ \the\csname\??ff:l:#1\endcsname
+ \global\csname\??ff:l:#1\endcsname\emptytoks
+ \fi}
\let\dosavefontclassmathfamily\gobbletwoarguments
@@ -647,14 +697,14 @@
\to \mathstrategies
\def\completeboldmathstrategyyesbidi
- {\dosetmathfamily \mbfamlr\c!mblr
- \dosetmathfamily \mbfamrl\c!mbrl
+ {\dosetboldmathfamily\mbfamlr\c!mblr\mrfamlr
+ \dosetboldmathfamily\mbfamrl\c!mbrl\mrfamrl
\textfont \mbfam \textfont \mbfamlr
\scriptfont \mbfam \scriptfont \mbfamlr
\scriptscriptfont\mbfam \scriptscriptfont\mbfamlr}
\def\completeboldmathstrategyyes
- {\dosetmathfamily \mbfam \c!mb
+ {\dosetboldmathfamily\mbfam\c!mb\mrfam
\textfont \mbfamrl\textfont \mbfam
\scriptfont \mbfamrl\scriptfont \mbfam
\scriptscriptfont\mbfamrl\scriptscriptfont\mbfam
@@ -673,16 +723,19 @@
\scriptfont \mbfamlr\scriptfont \mrfamlr
\scriptscriptfont\mbfamlr\scriptscriptfont\mrfamlr}
+\def\applycompleteboldmathstrategy
+ {\ifconditional\completeboldmathstrategy
+ \ifconditional\bidirectionalmathstrategy
+ \completeboldmathstrategyyesbidi
+ \else
+ \completeboldmathstrategyyes
+ \fi
+ \else
+ \completeboldmathstrategynop
+ \fi}
+
\appendtoks
- \ifconditional\completeboldmathstrategy
- \ifconditional\bidirectionalmathstrategy
- \completeboldmathstrategyyesbidi
- \else
- \completeboldmathstrategyyes
- \fi
- \else
- \completeboldmathstrategynop
- \fi
+ \applycompleteboldmathstrategy
\to \mathstrategies
\appendtoks
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index 9f8d4dceb..fe50b4703 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -38,6 +38,7 @@ local trace_collapsing = false trackers.register("math.collapsing", functio
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)
+local trace_italics = false trackers.register("math.families", function(v) trace_families = v end)
local check_coverage = true directives.register("math.checkcoverage", function(v) check_coverage = v end)
@@ -48,6 +49,7 @@ 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")
+local report_families = logs.reporter("mathematics","families")
local set_attribute = node.set_attribute
local has_attribute = node.has_attribute
@@ -672,6 +674,18 @@ local families = { }
local a_mathfamily = attributes.private("mathfamily")
local boldmap = mathematics.boldmap
+local tracemap = { [0] =
+ "regular",
+ "regular",
+ "regular",
+ "bold",
+ "bold",
+ "bold",
+ "pseudobold",
+ "pseudobold",
+ "pseudobold",
+}
+
families[math_char] = function(pointer)
if pointer.fam == 0 then
local a = has_attribute(pointer,a_mathfamily)
@@ -679,16 +693,31 @@ families[math_char] = function(pointer)
set_attribute(pointer,a_mathfamily,0)
if a > 5 then
local char = pointer.char
- local bold = boldmap[pointer.char]
+ local bold = boldmap[char]
+ local newa = a - 3
if bold then
set_attribute(pointer,exportstatus,char)
pointer.char = bold
+ if trace_families then
+ report_families("replacing U+%05X by bold U+%05X, family %s (%s) becomes %s (%s)",
+ char,bold,a,tracemap[a],newa,tracemap[newa])
+ end
+ else
+ if trace_families then
+ report_families("no bold replacement for U+%05X, family %s (%s) becomes %s (%s)",
+ char,a,tracemap[a],newa,tracemap[newa])
+ end
end
- a = a - 3
+ pointer.fam = newa
+ else
+ if trace_families then
+ report_families("family of U+%05X becomes %s (%s)",
+ pointer.char,a,tracemap[a])
+ end
+ pointer.fam = a
end
- pointer.fam = a
else
- pointer.fam = 0
+ -- pointer.fam = 0
end
end
end
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index a1f1bb246..36dc476f7 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 f61b2deaa..19f8ab2ce 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv
index 7216bf162..d18a729e6 100644
--- a/tex/context/base/strc-sec.mkiv
+++ b/tex/context/base/strc-sec.mkiv
@@ -134,12 +134,12 @@
\let\currentnamedsection\empty
\unexpanded\def\startnamedsection
- {\dotripleempty\startnamedsection}
+ {\dotripleempty\dostartnamedsection}
\def\dostartnamedsection[#1]% [#2][#3]
{\pushmacro\currentnamedsection
\edef\currentnamedsection{#1}%
- \dostarthead[#1]} % [#2][#3]
+ \normalexpanded{\dodostarthead[\currentnamedsection]}} % [#2][#3]
\unexpanded\def\stopnamedsection
{\normalexpanded{\dostophead[\currentnamedsection]}%
diff --git a/tex/context/base/type-ini.mkiv b/tex/context/base/type-ini.mkiv
index 9bd4d367f..cb8bc5a50 100644
--- a/tex/context/base/type-ini.mkiv
+++ b/tex/context/base/type-ini.mkiv
@@ -375,6 +375,10 @@
\newtoks \everybeforedefinetypeface
\newtoks \everyafterdefinetypeface
+\appendtoks
+ \resetfontclassmathfamilies\fontclass
+\to \everybeforedefinetypeface
+
\let\fontclassstyle\empty
\def\dostarttypefacedefining#1#2#3%
diff --git a/tex/context/base/type-otf.mkiv b/tex/context/base/type-otf.mkiv
index e7a473cfb..9c18f0546 100644
--- a/tex/context/base/type-otf.mkiv
+++ b/tex/context/base/type-otf.mkiv
@@ -619,6 +619,7 @@
\starttypescript [math][times][all]
\loadfontgoodies[tx-math]
\definefontsynonym[MathRoman][txmath@tx-math]
+ % \definefontsynonym[MathRomanBold][MathRoman]
\stoptypescript
% Palatino Math (px)
@@ -626,6 +627,7 @@
\starttypescript [math][palatino][all]
\loadfontgoodies[px-math]
\definefontsynonym[MathRoman][pxmath@px-math]
+ % \definefontsynonym[MathRomanBold][MathRoman]
\stoptypescript
\stoptypescriptcollection