Is there a way to make \setsansfont conditional on the font being available, or to skip over that line if it gives an error?
I'm using fontspec with XeLaTeX to use the TeX Gyre Heros font for a document, but I'd like to revert to the default font if that font isn't available, so that if someone else compiles the document but doesn't have that font installed, they get something that's readable, rather than just an error.
A minimal example:
\documentclass{article}
\usepackage{fontspec}
\setsansfont{TeX Gyre Heros}
\begin{document}
{\sffamily blah}
\end{document}
Update: it was reported that this is a duplicate of "Check for missing fonts/characters in XeLaTeX?", but really that question concerns whether individual characters are available in a font or not.
What I want to know is: can I test whether the whole font is available or not, and go with the default if it's not available.

A, and it is not found, then you can assume the font is not there. Otherwise it is there and can be loaded. – mafp Feb 28 '14 at 00:58