You can test whether a font is installed with any number of tricks. For example, render white text on a white background with "sans". Then, change the font to the candidate font, with a fallback of sans. If the width of the text changes, the font must be installed.