The letterspace feature of luaotfload does not work in math mode. I tried to implement my own feature as follows:

```
\documentclass{minimal}

\directlua{
do
  local function mathletterspace(tfmdata, value)
    local ls = tonumber (value)
    if not ls then
      luaotfload.log.report ("both", 0, "letterspace",
                 "Invalid argument to letterspace.")
      return
    end
    if tfmdata.parameters.factor then
      ls = ls * tfmdata.parameters.factor
    end

    for idx,chr in next, tfmdata.characters do
      if chr and chr.width then
        chr.width = chr.width + 2*ls
        chr.commands = {
          { 'right', ls },
          { 'char',  idx }
        }
      end
    end
  end
  fonts.constructors.features.otf.register {
    name         = 'mathletterspace',
    description  = 'add math letterspacing',
    default      = 20,
    initializers = {
      base = mathletterspace,
      node = mathletterspace,
      plug = mathletterspace,
    },
  }
end
}

\begin{document}     

\font\f="DejaVuSerif-Italic:mathletterspace=20" at 10pt
\f

\hfill abcdefxyz\hfill\hbox{}

\hfill$\textfont1=\f abcdefxyz$\hfill\hbox{}

\hfill$\textfont1=\f\displaystyle abcdefxyz$\hfill\hbox{}

$$\textfont1=\f abcdefxyz$$

$$\textfont1=\f\textstyle abcdefxyz$$

\end{document}

```

But this does not work since the width field is nil. Any ideas how to fix this? (I'm not really familiar with luaotfload and lua in general.)