From c444fd017ef64c84f0f8660af523009d88d5361c Mon Sep 17 00:00:00 2001 From: Marius Date: Fri, 16 Dec 2011 15:20:15 +0200 Subject: beta 2011.12.16 13:54 --- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4074 -> 4072 bytes tex/context/base/context-version.png | Bin 106151 -> 106268 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/font-ini.mkiv | 151 ++++++++++++++------- tex/context/base/math-noa.lua | 37 ++++- tex/context/base/status-files.pdf | Bin 24024 -> 24019 bytes tex/context/base/status-lua.pdf | Bin 169695 -> 169694 bytes tex/context/base/strc-sec.mkiv | 4 +- tex/context/base/type-ini.mkiv | 4 + tex/context/base/type-otf.mkiv | 2 + tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 14 files changed, 148 insertions(+), 60 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 4e98dde32..ba3d4190b 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.12.15 23:39} +\newcontextversion{2011.12.16 13:54} %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 a4e0b7497..dd7aa3d8b 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.12.15 23:39} +\newcontextversion{2011.12.16 13:54} %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 index 67301fb6a..b999615d8 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png index 55c03e63e..310a33f3e 100644 Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index b29c046ad..5c091f13b 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.12.15 23:39} +\edef\contextversion{2011.12.16 13:54} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 62bd4d532..edd36eb95 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.12.15 23:39} +\edef\contextversion{2011.12.16 13:54} %D For those who want to use this: 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 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index f61b2deaa..19f8ab2ce 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf 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 diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 1aceda930..721822f6c 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 : 12/15/11 23:39:33 +-- merge date : 12/16/11 13:54:31 do -- begin closure to overcome local limits and interference -- cgit v1.2.3