bool FontFaceSet::check(const String& fontString, const String& text, ExceptionState& exceptionState) { if (!inActiveDocumentContext()) return false; Font font; if (!resolveFontStyle(fontString, font)) { exceptionState.ThrowDOMException(SyntaxError, "Could not resolve '" + fontString + "' as a font."); return false; } CSSFontSelector* fontSelector = document()->styleEngine()->fontSelector(); FontFaceCache* fontFaceCache = fontSelector->fontFaceCache(); bool hasLoadedFaces = false; for (const FontFamily* f = &font.fontDescription().family(); f; f = f->next()) { CSSSegmentedFontFace* face = fontFaceCache->get(font.fontDescription(), f->family()); if (face) { if (!face->checkFont(nullToSpace(text))) return false; hasLoadedFaces = true; } } if (hasLoadedFaces) return true; for (const FontFamily* f = &font.fontDescription().family(); f; f = f->next()) { if (fontSelector->isPlatformFontAvailable(font.fontDescription(), f->family())) return true; } return false; }
bool FontLoader::checkFont(const String& fontString, const String&) { // FIXME: The second parameter (text) is ignored. FontCascade font; if (!resolveFontStyle(fontString, font)) return false; for (unsigned i = 0; i < font.familyCount(); i++) { CSSSegmentedFontFace* face = m_document->fontSelector().getFontFace(font.fontDescription(), font.familyAt(i)); if (!face || !face->checkFont()) return false; } return true; }