bool SimpleFontData::containsCharacters(const UChar* characters, int length) const
{
    if (m_platformData.isDisabled())
        return true;

    // FIXME: Microsoft documentation seems to imply that characters can be output using a given font and DC
    // merely by testing code page intersection.  This seems suspect though.  Can't a font only partially
    // cover a given code page?

    // FIXME: in the case that we failed to get the interface, still use the font.
    IMLangFontLinkType* langFontLink = fontCache()->getFontLinkInterface();
    if (!langFontLink)
        return true;

    DWORD fontCodePages = m_platformData.codePages();
    if (!fontCodePages)
        return false;

    DWORD acpCodePages = 0;
    langFontLink->CodePageToCodePages(CP_ACP, &acpCodePages);

    DWORD actualCodePages;
    long numCharactersProcessed;
    while (length) {
        langFontLink->GetStrCodePages(characters, length, acpCodePages, &actualCodePages, &numCharactersProcessed);
        if (actualCodePages && !(actualCodePages & fontCodePages))
            return false;

        length -= numCharactersProcessed;
        characters += numCharactersProcessed;
    }

    return true;
}