Q:

Use different math font in inline-style and display-style formulas

I would like to use a different font in inline-style math mode ($...$) and displayed equations (e.g., \begin{equation} ... \end{equation}). Currently, I set my fonts with
\setmainfont{Frutiger 45 Light}
\setmathrm{Cambria Math}
\setmathfont(Digits,Latin){Cambria Math}

but I would like to use Frutiger in mathmode as well so there is no break in font style for in-line math. I tried defining a new command
\newcommandx{\textvar}[1]{
{
\setmathrm{Frutiger 45 Light}
\setmathfont(Digits){Frutiger 45 Light}
#1
}
\setmathrm{Cambria Math}
\setmathfont(Digits,Latin){Cambria Math}
}

but \setmath* seem to work only in the preamble and not in the document itself.
Is there any way to do this?

A:

As we are fans of good typography, the discussion about best practises is always mandatory and important. 
I want to second what Chris says above:
Please do not try that at home!
% arara: lualatex

\documentclass{article}
\usepackage{unicode-math}
\setmathfont[version=lm]{Latin Modern Math}
\setmathfont[version=asana]{Asana Math}

\begingroup
\catcode`\$=\active
\protected\gdef$#1${\mathversion{asana}\(#1\)\mathversion{lm}}
\endgroup
\AtBeginDocument{\catcode`\$=\active}

\begin{document}
    \mathversion{lm}
    \begin{equation}E=mc^2\end{equation} where $E$ stands for energy \begin{equation}E=mc^2\end{equation}
\end{document}

Edit:
In comment you mention that you want to keep the old behaviour. In this case you should (highly recommended) define a new command for such things:
\newcommand*{\myinlinemath}[1]{{\mathversion{asana}\ensuremath{#1}}}

Edit 2:
For your very example I would just recommend to use the siuntix package:
% arara: xelatex

\documentclass{article}
\usepackage{fontspec}
\setmainfont{linux libertine o}
\usepackage{siunitx}

\begin{document}
\begin{equation}E=mc^2\end{equation}

something like \SI{2.8 \pm 0.5}{\mu\metre} in the middle of a line

\sisetup{detect-all}
something like \SI{2.8 \pm 0.5}{\mu\metre} in the middle of a line
\end{document}

A:

Here's a solution that uses the \everymath and \everydisplay primitives to switch between two pre-defined math versions -- "Asana Math" for inline math and "XITS Math" for displayed equations.
The code needs to be run under LuaLaTeX; for some reason, I get a "TeX capacity exceeded, sorry" error message if I try to compile it under XeLaTeX. 
Caveat: The code has been tested with several display-style math environments, but definitely not with all conceivable ones.

% !TEX TS-program = lualatex
\documentclass{article}

\usepackage{amsmath}

\usepackage[no-math]{fontspec}
\setmainfont{Myriad Pro}

\usepackage{unicode-math}
\setmathfont[version=XITS]{XITS Math}
\setmathfont[version=Asana]{Asana Math}
\mathversion{Asana}
\everymath{\mathversion{Asana}}
\everydisplay{\mathversion{XITS}}

\setlength\textwidth{7cm} % just for this example
\begin{document}
$E=mc^2$, where $E$ stands for energy \dots 
\begin{equation} E=mc^2  \end{equation}

$E=mc^2$, where $E$ stands for energy \dots 
\begin{gather} E=mc^2  \end{gather}
\end{document}

