# Reduce the space between letter "f" and subscript that follows for Asana-Math (unicode-math)

Following the second part of this answer, I'm trying to do the similar thing for Asana-Math: reducing the space between letter "f" and the subscript that follows. However, my modified version doesn't seem to work:

\documentclass{article}
\usepackage{unicode-math}
\usepackage{luacode}
\begin{luacode*}
-- First create a table specifying the mathkerns we want to set:
local mathkerns = {
["Asana-Math"] = { -- This should be the PostScript name of the font
["f"] = { -- If the character would have a regular name, you could also use the glyphname here
bottomright = {
{height=0,kern=-175},
{height=216,kern=-76},
{kern=0},
},
},
},
}
local function initmathkern(tfmdata)
local values = mathkerns[tfmdata.properties.psname]
if not values then return end
for cp, value in next, values do
local tcp = type(cp)
if tcp == 'string' then
cp = tfmdata.resources.unicodes[cp]
end
local char = tfmdata.characters[cp]
if char then
local mathkern = char.mathkerns
if not mathkern then
mathkern = {}
char.mathkerns = mathkern
end
for corner, v in next, value do
mathkern[corner] = v
end
end
end
end
fonts.constructors.newfeatures'otf'.register{
name = 'mathkern',
description = 'Overwrite mathkern values',
initializers = {
base = initmathkern,
},
}
\end{luacode*}
\setmathfont{Asana-Math.otf}[RawFeature=mathkern]

\begin{document}

$$f_a f_i f_j$$

$$f^a f^i f^j$$

\end{document}


Is there something that I'm doing wrongly?

The problem is that in math mode the letter "f" is not the usual "f", but "MATHEMATICAL ITALIC SMALL F" (U+1D453). Thus the correct code should be:

\documentclass{article}
\usepackage{unicode-math}
\usepackage{luacode}
\begin{luacode}

  -- First create a table specifying the mathkerns we want to set:
local mathkerns = {
["Asana-Math"] = { -- This should be the PostScript name of the font
[0x1D453] = { -- If the character would have a regular name, you could also use the glyphname here
bottomright = {
{height=0,kern=-135},
-- {height=216,kern=-76},
-- {kern=0},
},
},
},
}
local function initmathkern(tfmdata)
local values = mathkerns[tfmdata.properties.psname]
if not values then return end
for cp, value in next, values do
local tcp = type(cp)
if tcp == 'string' then
cp = tfmdata.resources.unicodes[cp]
end
local char = tfmdata.characters[cp]
if char then
local mathkern = char.mathkerns
if not mathkern then
mathkern = {}
char.mathkerns = mathkern
end
for corner, v in next, value do
mathkern[corner] = v
end
end
end
end
fonts.constructors.newfeatures'otf'.register{
name = 'mathkern',
description = 'Overwrite mathkern values',
initializers = {
base = initmathkern,
},
}

\end{luacode}
\setmathfont{Asana-Math.otf}[RawFeature=mathkern]

\begin{document}

$$f_a f_i f_j$$

$$f^a f^i f^j$$

\end{document}