From 0cc0c31e0b76c86fecd7314cbcdc853df964046a Mon Sep 17 00:00:00 2001
From: Marius <mariausol@gmail.com>
Date: Mon, 22 Oct 2012 12:40:15 +0300
Subject: beta 2012.10.22 11:01

---
 tex/context/base/cont-new.mkii                     |   2 +-
 tex/context/base/cont-new.mkiv                     |   2 +-
 tex/context/base/context-version.pdf               | Bin 4145 -> 4140 bytes
 tex/context/base/context-version.png               | Bin 106700 -> 105087 bytes
 tex/context/base/context.mkii                      |   2 +-
 tex/context/base/context.mkiv                      |   2 +-
 tex/context/base/font-ini.mkvi                     |  22 +++--
 tex/context/base/font-otn.lua                      |  18 ++--
 tex/context/base/math-ini.mkiv                     | 109 ++++++++++++---------
 tex/context/base/math-noa.lua                      |  37 +++++--
 tex/context/base/status-files.pdf                  | Bin 24572 -> 24597 bytes
 tex/context/base/status-lua.pdf                    | Bin 195718 -> 195718 bytes
 tex/context/base/strc-mat.mkii                     |  10 +-
 tex/generic/context/luatex/luatex-fonts-merged.lua |  20 ++--
 14 files changed, 133 insertions(+), 91 deletions(-)

(limited to 'tex')

diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 3558d782a..caf666d45 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.20 11:51}
+\newcontextversion{2012.10.22 11:01}
 
 %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 34ca807c7..918e0c07f 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.20 11:51}
+\newcontextversion{2012.10.22 11:01}
 
 %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 4511e8475..585e96594 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 c6acd444d..2579cab97 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 4f2df4a0a..6fbd684de 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.20 11:51}
+\edef\contextversion{2012.10.22 11:01}
 
 %D For those who want to use this:
 
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index a413e8e82..dba8823fc 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.20 11:51}
+\edef\contextversion{2012.10.22 11:01}
 
 %D For those who want to use this:
 
diff --git a/tex/context/base/font-ini.mkvi b/tex/context/base/font-ini.mkvi
index 61fa7afd1..7969e58c0 100644
--- a/tex/context/base/font-ini.mkvi
+++ b/tex/context/base/font-ini.mkvi
@@ -2095,16 +2095,18 @@
       \fi
       \the\everysetupbodyfont}}
 
-\unexpanded\def\switchtobodyfont[#specification]%
-  {\doifsomething{#specification}
-     {\edef\m_font_step{\bodyfontvariable{#specification}}%
-      \ifx\m_font_step\empty
-        \font_helpers_set_font\zerocount{#specification}%
-      \else
-        \font_helpers_switch_bodyfont_step % so we have a fast [small] switch
-      \fi
-      \the\everybodyfont
-      \the\everyswitchtobodyfont}}
+\unexpanded\def\font_basics_switchtobodyfont#specification%
+  {\edef\m_font_step{\bodyfontvariable{#specification}}%
+   \ifx\m_font_step\empty
+     \font_helpers_set_font\zerocount{#specification}%
+   \else
+     \font_helpers_switch_bodyfont_step % so we have a fast [small] switch
+   \fi
+   \the\everybodyfont
+   \the\everyswitchtobodyfont}
+
+\unexpanded\def\switchtobodyfont[#specification]% could become an ifx
+  {\doifsomething{#specification}{\font_basics_switchtobodyfont{#specification}}}
 
 \def\font_helpers_switch_bodyfont_step
   {\font_basics_switch_points\m_font_step
diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua
index 6e465ece9..71027d731 100644
--- a/tex/context/base/font-otn.lua
+++ b/tex/context/base/font-otn.lua
@@ -388,21 +388,21 @@ end
 -- third component.
 
 local function getcomponentindex(start)
-	if start.id ~= glyph_code then
+    if start.id ~= glyph_code then
         return 0
-	elseif start.subtype == ligature_code then
+    elseif start.subtype == ligature_code then
         local i = 0
-		local components = start.components
-		while components do
-			i = i + getcomponentindex(components)
-			components = components.next
-		end
-		return i
+        local components = start.components
+        while components do
+            i = i + getcomponentindex(components)
+            components = components.next
+        end
+        return i
     elseif not marks[start.char] then
         return 1
     else
         return 0
-	end
+    end
 end
 
 -- local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- brr head
diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv
index 77441e092..42306c6d5 100644
--- a/tex/context/base/math-ini.mkiv
+++ b/tex/context/base/math-ini.mkiv
@@ -13,17 +13,14 @@
 
 \writestatus{loading}{ConTeXt Math Macros / Initializations}
 
-%D This module provides namespaces for math fonts, thereby
-%D permitting mixed usage of math fonts. Although not strictly
-%D needed, we also provide a family name mapping mechanism as
-%D used in the (original) AMS math definition files, but here
-%D these names can recursively be remapped and if needed,
-%D dynamically be changed. We've tried to minimize the number
-%D of definition commands and use plain \TEX\ definitions as
-%D fallback. We've tried to follow a couple of conventions
-%D from plain and AMS math in order to achieve backward
-%D compatinility. We also kept an eye on future usage of these
-%D modules in the perspective of MathML and unicode fonts.
+%D This module provides namespaces for math fonts, thereby permitting mixed usage of
+%D math fonts. Although not strictly needed, we also provide a family name mapping
+%D mechanism as used in the (original) AMS math definition files, but here these
+%D names can recursively be remapped and if needed, dynamically be changed. We've
+%D tried to minimize the number of definition commands and use plain \TEX\
+%D definitions as fallback. We've tried to follow a couple of conventions from plain
+%D and AMS math in order to achieve backward compatinility. We also kept an eye on
+%D future usage of these modules in the perspective of MathML and unicode fonts.
 
 \unprotect
 
@@ -204,9 +201,9 @@
     \mathdefault
 \to \everymathematics
 
-%D We could set the rendering attribute at the \LUA\ end but as there
-%D can be many small math snippets we keep track of the state at the
-%D \TEX\ end (mapping is export safe).
+%D We could set the rendering attribute at the \LUA\ end but as there can be many
+%D small math snippets we keep track of the state at the \TEX\ end (mapping is
+%D export safe).
 %D
 %D \starttyping
 %D \startformula
@@ -422,8 +419,8 @@
 % \def\mlimitsfunction  #1{\mathlimopcomm{{\mr#1}}
 % \def\mnolimitsfunction#1{\mathnolopcomm{{\mr#1}}
 
-%D Taco posted this solution as response to a mail by Olivier, so
-%D let's integrate it here.
+%D Taco posted this solution as response to a mail by Olivier, so let's integrate
+%D it here.
 
 \def\currentmscaledstyle{rm} % will be plugged into the typeface text=ss option
 
@@ -445,8 +442,7 @@
      {\hbox{\csname\currentmscaledstyle\endcsname\tfx #1}}
      {\hbox{\csname\currentmscaledstyle\endcsname\tfxx#1}}}
 
-%D We can force the way functions are typeset by manipulating the text
-%D option:
+%D We can force the way functions are typeset by manipulating the text option:
 %D
 %D \starttyping
 %D \definetypeface[iwona][ss][sans][iwona][default][encoding=texnansi]
@@ -530,12 +526,11 @@
 
 % Here follows some plain legacy: primes.
 %
-% The \let\prime\math_prime_indeed might become an obsolete as we have
-% \doubleprime and \tripleprime and collapsing can nicely handle the
-% script then.
+% The \let\prime\math_prime_indeed might become an obsolete as we have \doubleprime
+% and \tripleprime and collapsing can nicely handle the script then.
 %
 % Collapsing to 0x2033 and 0x2034 happens elsewhere.
-
+%
 % \switchtobodyfont[modern]
 % \switchtobodyfont[cambria]
 % \switchtobodyfont[xits]
@@ -900,8 +895,8 @@
 %D \macros
 %D   {mathstyle}
 %D
-%D If one want to be sure that something is typeset in the
-%D appropriate style, \type {\mathstyle} can be used:
+%D If one want to be sure that something is typeset in the appropriate style, \type
+%D {\mathstyle} can be used:
 %D
 %D \starttyping
 %D \mathstyle{something}
@@ -914,10 +909,9 @@
 %      {\scriptstyle      #1}%
 %      {\scriptscriptstyle#1}}
 %
-% We now have a primitive operation for this. As the
-% macro overloads a new primitive introduced in \LUATEX,
-% we need to use \type {\normalmathstyle} when we consult
-% the current math style.
+% We now have a primitive operation for this. As the macro overloads a new
+% primitive introduced in \LUATEX, we need to use \type {\normalmathstyle} when we
+% consult the current math style.
 %
 % \let \mathstyle \Ustack % spoils cramped
 %
@@ -972,7 +966,20 @@
      \scriptscriptfont \or
      \scriptscriptfont \else
      \textfont
-   \fi\zerocount}
+   \fi\zerocount} % hm, can ie other value as well
+
+\def\mathstyleface#1% #1 is number (\normalmathstyle)
+  {\ifcase#1
+     \textface         \or
+     \textface         \or
+     \textface         \or
+     \textface         \or
+     \scriptface       \or
+     \scriptface       \or
+     \scriptscriptface \or
+     \scriptscriptface \else
+     \textface
+   \fi}
 
 %D A plain inheritance:
 
@@ -1011,24 +1018,39 @@
   {\normalexpanded{\vcenter\bgroup\vbox\bgroup
      $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup\egroup}
 
-%D Something similar can be used in the (re|)|definition
-%D of \type {\text}. This version is a variation on the one
-%D in the math module (see \type{m-math} and|/|or \type
-%D {m-newmat}).
+%D Something similar can be used in the (re|)|definition of \type {\text}. This
+%D version is a variation on the one in the math module (see \type{m-math} and|/|or
+%D \type {m-newmat}).
 
 \unexpanded\def\mathtext
   {\mathortext\math_text_choice\hbox}
 
-\def\math_text_choice#1%
-  {\mathchoice
-     {\math_text_choice_indeed\displaystyle\textface        {#1}}%
-     {\math_text_choice_indeed\textstyle   \textface        {#1}}%
-     {\math_text_choice_indeed\textstyle   \scriptface      {#1}}%
-     {\math_text_choice_indeed\textstyle   \scriptscriptface{#1}}}
+% \def\math_text_choice#1%
+%   {\mathchoice
+%      {\math_text_choice_indeed\displaystyle\textface        {#1}}%
+%      {\math_text_choice_indeed\textstyle   \textface        {#1}}%
+%      {\math_text_choice_indeed\textstyle   \scriptface      {#1}}%
+%      {\math_text_choice_indeed\textstyle   \scriptscriptface{#1}}}
+%
+% \def\math_text_choice_indeed#1#2#3% no \everymath !
+%   {\hbox{\everymath{#1}\switchtobodyfont[#2]#3}} % 15 sec
+
+% \let\m_math_text_choice_style\relax
+%
+% \def\math_text_choice#1%
+%   {\edef\m_math_text_choice_style{\normalmathstyle}%
+%    \hbox\bgroup
+%    % \everymath{\triggermathstyle\m_math_text_choice_style}%
+%      \normalizebodyfontsize\m_math_text_choice_style{\mathstylefont\m_math_text_choice_style}%
+%      \font_basics_switchtobodyfont\m_math_text_choice_style
+%      #1%
+%    \egroup}
+
+\let\m_math_text_choice_face \relax
 
-\def\math_text_choice_indeed#1#2#3% no \everymath !
- %{\hbox{\everymath{#1}\switchtobodyfont  [#2]#3}} % 15 sec
-  {\hbox{\everymath{#1}\setcurrentfontbody{#2}#3}} %  3 sec (no math)
+\def\math_text_choice#1% if needed we can get rid of the normalize (predo in font code)
+  {\normalizebodyfontsize\m_math_text_choice_face{\mathstyleface\normalmathstyle}%
+   \hbox{\font_basics_switchtobodyfont\m_math_text_choice_face#1}}
 
 %D Safeguard against redefinitions:
 
@@ -1036,8 +1058,7 @@
     \let\_\normalunderscore % is textunderscore or fakeunderscore
 \to \everymathematics
 
-%D Because we may overload \type {\text} in other (structuring)
-%D macros, we say:
+%D Because we may overload \type {\text} in other (structuring) macros, we say:
 
 \appendtoks \let\text\mathtext \to \everymathematics
 
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index 6643a8758..5b7760452 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -89,9 +89,12 @@ local tasks               = nodes.tasks
 local nodecodes           = nodes.nodecodes
 local noadcodes           = nodes.noadcodes
 
-local noad_ord            = noadcodes.ord
-local noad_rel            = noadcodes.rel
-local noad_punct          = noadcodes.punct
+local noad_ord             = noadcodes.ord
+local noad_rel             = noadcodes.rel
+local noad_punct           = noadcodes.punct
+local noad_opdisplaylimits = noadcodes.opdisplaylimits
+local noad_oplimits        = noadcodes.oplimits
+local noad_opnolimits      = noadcodes.opnolimits
 
 local math_noad           = nodecodes.noad           -- attr nucleus sub sup
 local math_accent         = nodecodes.accent         -- attr nucleus sub sup accent
@@ -764,7 +767,6 @@ local a_mathitalics = attributes.private("mathitalics")
 local italics        = { }
 local default_factor = 1/20
 
-
 local function getcorrection(method,font,char)
 
     local correction
@@ -820,6 +822,8 @@ local function insert_kern(current,kern)
     return sub
 end
 
+-- noad_opdisplaylimits noad_oplimits noad_opnolimits
+
 italics[math_char] = function(pointer,what,n,parent)
     local method = has_attribute(pointer,a_mathitalics)
     if method and method > 0 then
@@ -831,13 +835,27 @@ italics[math_char] = function(pointer,what,n,parent)
         -- when sub/sup -> already done
 
         if correction then
-            if parent.id == math_noad and (parent.sub or parent.sup) then
-                if sub then
-                    parent.sub = insert_kern(sub,new_kern(correction))
-                end
-                local sup = parent.sup
+            -- maybe only +/- when subtype == opdisplaylimits
+            local pid = parent.id
+            local sub, sup
+            if pid == math_noad then
+                sup = parent.sup
+                sub = parent.sub
+            end
+            if sup or sub then
                 if sup then
                     parent.sup = insert_kern(sup,new_kern(correction))
+                    if trace_italics then
+                        report_italics("method %s: adding %s italic correction before superscript after %s (0x%05X)",
+                            method,number.points(correction),utfchar(char),char)
+                    end
+                end
+                if sub then
+                    parent.sub = insert_kern(sub,new_kern(-correction))
+                    if trace_italics then
+                        report_italics("method %s: adding %s italic correction before subscript after %s (0x%05X)",
+                            method,number.points(-correction),utfchar(char),char)
+                    end
                 end
             else
                 local next_noad = parent.next
@@ -891,6 +909,7 @@ end
 
 function handlers.italics(head,style,penalties)
 -- nodes.showsimplelist(head)
+-- inspect(nodes.totable(head))
     processnoads(head,italics,"italics")
     return true
 end
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 3216b2237..05448f95f 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 4c8c34cae..27cd5d084 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-mat.mkii b/tex/context/base/strc-mat.mkii
index d85df79e2..34f716f3b 100644
--- a/tex/context/base/strc-mat.mkii
+++ b/tex/context/base/strc-mat.mkii
@@ -46,7 +46,7 @@
 % \to \everymath
 
 % \placeformula\startformula
-% 	H(K|M,C) = H(K|C) - H(M|C)\eqno{\hbox{(\in{}[eq:keyapp])}}
+%   H(K|M,C) = H(K|C) - H(M|C)\eqno{\hbox{(\in{}[eq:keyapp])}}
 % \stopformula
 
 \unexpanded\def\mathortext
@@ -1608,10 +1608,10 @@
 
 \def\domathtext#1%
   {\mathchoice
-     {\dodomathtext\displaystyle\textface        {#1}}%
-     {\dodomathtext\textstyle   \textface        {#1}}%
-     {\dodomathtext\textstyle   \scriptface      {#1}}%
-     {\dodomathtext\textstyle   \scriptscriptface{#1}}}
+     {\dodomathtext\displaystyle     \textface        {#1}}%
+     {\dodomathtext\textstyle        \textface        {#1}}%
+     {\dodomathtext\scriptstyle      \scriptface      {#1}}%
+     {\dodomathtext\scriptscriptstyle\scriptscriptface{#1}}}
 
 \def\dodomathtext#1#2#3% no \everymath !
  %{\hbox{\everymath{#1}\switchtobodyfont  [#2]#3}} % 15 sec
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 1ae484cc4..636656e72 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/20/12 11:51:09
+-- merge date  : 10/22/12 11:01:11
 
 do -- begin closure to overcome local limits and interference
 
@@ -9556,21 +9556,21 @@ end
 -- third component.
 
 local function getcomponentindex(start)
-	if start.id ~= glyph_code then
+    if start.id ~= glyph_code then
         return 0
-	elseif start.subtype == ligature_code then
+    elseif start.subtype == ligature_code then
         local i = 0
-		local components = start.components
-		while components do
-			i = i + getcomponentindex(components)
-			components = components.next
-		end
-		return i
+        local components = start.components
+        while components do
+            i = i + getcomponentindex(components)
+            components = components.next
+        end
+        return i
     elseif not marks[start.char] then
         return 1
     else
         return 0
-	end
+    end
 end
 
 -- local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- brr head
-- 
cgit v1.2.3