XPLMMeasureString

XPLM_API float      XPLMMeasureString(
                         XPLMFontID           inFontID,
                         const char *         inChar,
                         int                  inNumChars);

This routine returns the width in pixels of a string using a given font. The string is passed as a pointer plus length (and does not need to be null terminated); this is used to allow for measuring substrings. The return value is floating point; it is possible that future font drawing may allow for fractional pixels.