From d2c353b98119caed68f4c1e1a6109a2be1323e09 Mon Sep 17 00:00:00 2001
From: Luigi Scarso <luigi.scarso@gmail.com>
Date: Thu, 21 Apr 2016 10:24:10 +0000
Subject: [PATCH] add italic correction in otfmath font when nuclues is
 mathchar and following is not nil and no scripts (HH)

---
 source/texk/web2c/luatexdir/tex/mlist.w | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/source/texk/web2c/luatexdir/tex/mlist.w b/source/texk/web2c/luatexdir/tex/mlist.w
index 1695fb7ac..32a8c9b61 100644
--- a/source/texk/web2c/luatexdir/tex/mlist.w
+++ b/source/texk/web2c/luatexdir/tex/mlist.w
@@ -2186,6 +2186,7 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c, int fl
     scaled w;              /* width of the accentee, not including sub/superscripts */
     boolean s_is_absolute; /* will be true if a top-accent is placed in |s| */
     scaled fraction ;
+    scaled ic = 0;
     scaled target ;
     extinfo *ext;
     pointer attr_p;
@@ -2277,6 +2278,12 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c, int fl
             delta = delta + height(x) - h;
             h = height(x);
         }
+    } else if ((vlink(q) != null) && (type(nucleus(q)) == math_char_node)) {
+        /* only pure math char nodes */
+        internal_font_number f = fam_fnt(math_fam(nucleus(q)),cur_size);
+        if (is_new_mathfont(f)) {
+            ic = char_italic(f,math_character(nucleus(q)));
+        }
     }
     /* the top accents of both characters are aligned */
     if (s_is_absolute) {
@@ -2340,6 +2347,10 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c, int fl
     } else {
         shift_amount(y) = -(h - height(y));
     }
+    if (ic != 0) {
+        /* old font codepath has ic built in, new font code doesn't */
+        width(r) += ic ;
+    }
     math_list(nucleus(q)) = y;
     type(nucleus(q)) = sub_box_node;
 }
-- 
GitLab