1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524
|
/*
* Copyright (C) 2007, 2008, 2011, 2013 Apple Inc. All rights reserved.
* (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "CSSFontSelector.h"
#include "CachedFont.h"
#include "CSSFontFace.h"
#include "CSSFontFaceRule.h"
#include "CSSFontFaceSource.h"
#include "CSSFontFaceSrcValue.h"
#include "CSSFontFamily.h"
#include "CSSFontFeatureValue.h"
#include "CSSPrimitiveValue.h"
#include "CSSPrimitiveValueMappings.h"
#include "CSSPropertyNames.h"
#include "CSSSegmentedFontFace.h"
#include "CSSUnicodeRangeValue.h"
#include "CSSValueKeywords.h"
#include "CSSValueList.h"
#include "CSSValuePool.h"
#include "CachedResourceLoader.h"
#include "Document.h"
#include "Font.h"
#include "FontCache.h"
#include "FontVariantBuilder.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "SVGFontFaceElement.h"
#include "SVGNames.h"
#include "Settings.h"
#include "StyleProperties.h"
#include "StyleResolver.h"
#include "StyleRule.h"
#include "WebKitFontFamilyNames.h"
#include <wtf/Ref.h>
#include <wtf/text/AtomicString.h>
namespace WebCore {
static unsigned fontSelectorId;
CSSFontSelector::CSSFontSelector(Document& document)
: m_document(&document)
, m_beginLoadingTimer(*this, &CSSFontSelector::beginLoadTimerFired)
, m_uniqueId(++fontSelectorId)
, m_version(0)
{
// FIXME: An old comment used to say there was no need to hold a reference to m_document
// because "we are guaranteed to be destroyed before the document". But there does not
// seem to be any such guarantee.
ASSERT(m_document);
FontCache::singleton().addClient(*this);
}
CSSFontSelector::~CSSFontSelector()
{
clearDocument();
FontCache::singleton().removeClient(*this);
}
bool CSSFontSelector::isEmpty() const
{
return m_fonts.isEmpty();
}
void CSSFontSelector::appendSources(CSSFontFace& fontFace, CSSValueList& srcList, Document* document, bool isInitiatingElementInUserAgentShadowTree)
{
for (auto& src : srcList) {
// An item in the list either specifies a string (local font name) or a URL (remote font to download).
CSSFontFaceSrcValue& item = downcast<CSSFontFaceSrcValue>(src.get());
std::unique_ptr<CSSFontFaceSource> source;
SVGFontFaceElement* fontFaceElement = nullptr;
bool foundSVGFont = false;
#if ENABLE(SVG_FONTS)
foundSVGFont = item.isSVGFontFaceSrc() || item.svgFontFaceElement();
fontFaceElement = item.svgFontFaceElement();
#endif
if (!item.isLocal()) {
Settings* settings = document ? document->settings() : nullptr;
bool allowDownloading = foundSVGFont || (settings && settings->downloadableBinaryFontsEnabled());
if (allowDownloading && item.isSupportedFormat() && document) {
if (CachedFont* cachedFont = item.cachedFont(document, foundSVGFont, isInitiatingElementInUserAgentShadowTree))
source = std::make_unique<CSSFontFaceSource>(fontFace, item.resource(), cachedFont);
}
} else
source = std::make_unique<CSSFontFaceSource>(fontFace, item.resource(), nullptr, fontFaceElement);
if (source)
fontFace.adoptSource(WTFMove(source));
}
fontFace.sourcesPopulated();
}
String CSSFontSelector::familyNameFromPrimitive(const CSSPrimitiveValue& value)
{
if (value.isFontFamily())
return value.fontFamily().familyName;
if (!value.isValueID())
return { };
// We need to use the raw text for all the generic family types, since @font-face is a way of actually
// defining what font to use for those types.
switch (value.getValueID()) {
case CSSValueSerif:
return serifFamily;
case CSSValueSansSerif:
return sansSerifFamily;
case CSSValueCursive:
return cursiveFamily;
case CSSValueFantasy:
return fantasyFamily;
case CSSValueMonospace:
return monospaceFamily;
case CSSValueWebkitPictograph:
return pictographFamily;
default:
return { };
}
}
void CSSFontSelector::registerLocalFontFacesForFamily(const String& familyName)
{
ASSERT(!m_locallyInstalledFontFaces.contains(familyName));
Vector<FontTraitsMask> traitsMasks = FontCache::singleton().getTraitsInFamily(familyName);
if (traitsMasks.isEmpty())
return;
Vector<Ref<CSSFontFace>> faces = { };
for (auto mask : traitsMasks) {
Ref<CSSFontFace> face = CSSFontFace::create(*this, nullptr, true);
RefPtr<CSSValueList> familyList = CSSValueList::createCommaSeparated();
familyList->append(CSSValuePool::singleton().createFontFamilyValue(familyName));
face->setFamilies(*familyList);
face->setTraitsMask(mask);
face->adoptSource(std::make_unique<CSSFontFaceSource>(face.get(), familyName));
ASSERT(!face->allSourcesFailed());
faces.append(WTFMove(face));
}
m_locallyInstalledFontFaces.add(familyName, WTFMove(faces));
}
void CSSFontSelector::addFontFaceRule(const StyleRuleFontFace& fontFaceRule, bool isInitiatingElementInUserAgentShadowTree)
{
const StyleProperties& style = fontFaceRule.properties();
RefPtr<CSSValue> fontFamily = style.getPropertyCSSValue(CSSPropertyFontFamily);
RefPtr<CSSValue> fontStyle = style.getPropertyCSSValue(CSSPropertyFontStyle);
RefPtr<CSSValue> fontWeight = style.getPropertyCSSValue(CSSPropertyFontWeight);
RefPtr<CSSValue> src = style.getPropertyCSSValue(CSSPropertySrc);
RefPtr<CSSValue> unicodeRange = style.getPropertyCSSValue(CSSPropertyUnicodeRange);
RefPtr<CSSValue> featureSettings = style.getPropertyCSSValue(CSSPropertyFontFeatureSettings);
RefPtr<CSSValue> variantLigatures = style.getPropertyCSSValue(CSSPropertyFontVariantLigatures);
RefPtr<CSSValue> variantPosition = style.getPropertyCSSValue(CSSPropertyFontVariantPosition);
RefPtr<CSSValue> variantCaps = style.getPropertyCSSValue(CSSPropertyFontVariantCaps);
RefPtr<CSSValue> variantNumeric = style.getPropertyCSSValue(CSSPropertyFontVariantNumeric);
RefPtr<CSSValue> variantAlternates = style.getPropertyCSSValue(CSSPropertyFontVariantAlternates);
RefPtr<CSSValue> variantEastAsian = style.getPropertyCSSValue(CSSPropertyFontVariantEastAsian);
if (!is<CSSValueList>(fontFamily.get()) || !is<CSSValueList>(src.get()) || (unicodeRange && !is<CSSValueList>(*unicodeRange)))
return;
CSSValueList& familyList = downcast<CSSValueList>(*fontFamily);
if (!familyList.length())
return;
if (!fontStyle)
fontStyle = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal).ptr();
if (!fontWeight)
fontWeight = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal);
CSSValueList* rangeList = downcast<CSSValueList>(unicodeRange.get());
CSSValueList& srcList = downcast<CSSValueList>(*src);
if (!srcList.length())
return;
Ref<CSSFontFace> fontFace = CSSFontFace::create(*this);
if (!fontFace->setFamilies(*fontFamily))
return;
if (!fontFace->setStyle(*fontStyle))
return;
if (!fontFace->setWeight(*fontWeight))
return;
if (rangeList && !fontFace->setUnicodeRange(*rangeList))
return;
if (variantLigatures && !fontFace->setVariantLigatures(*variantLigatures))
return;
if (variantPosition && !fontFace->setVariantPosition(*variantPosition))
return;
if (variantCaps && !fontFace->setVariantCaps(*variantCaps))
return;
if (variantNumeric && !fontFace->setVariantNumeric(*variantNumeric))
return;
if (variantAlternates && !fontFace->setVariantAlternates(*variantAlternates))
return;
if (variantEastAsian && !fontFace->setVariantEastAsian(*variantEastAsian))
return;
if (featureSettings && !fontFace->setFeatureSettings(*featureSettings))
return;
appendSources(fontFace, srcList, m_document, isInitiatingElementInUserAgentShadowTree);
if (fontFace->allSourcesFailed())
return;
for (auto& item : familyList) {
String familyName = familyNameFromPrimitive(downcast<CSSPrimitiveValue>(item.get()));
if (familyName.isEmpty())
continue;
auto addResult = m_fontFaces.add(familyName, Vector<Ref<CSSFontFace>>());
auto& familyFontFaces = addResult.iterator->value;
if (addResult.isNewEntry) {
registerLocalFontFacesForFamily(familyName);
familyFontFaces = { };
}
familyFontFaces.append(fontFace.copyRef());
++m_version;
}
}
void CSSFontSelector::registerForInvalidationCallbacks(FontSelectorClient& client)
{
m_clients.add(&client);
}
void CSSFontSelector::unregisterForInvalidationCallbacks(FontSelectorClient& client)
{
m_clients.remove(&client);
}
void CSSFontSelector::dispatchInvalidationCallbacks()
{
++m_version;
Vector<FontSelectorClient*> clients;
copyToVector(m_clients, clients);
for (size_t i = 0; i < clients.size(); ++i)
clients[i]->fontsNeedUpdate(*this);
}
void CSSFontSelector::fontLoaded()
{
dispatchInvalidationCallbacks();
}
void CSSFontSelector::fontCacheInvalidated()
{
dispatchInvalidationCallbacks();
}
static const AtomicString& resolveGenericFamily(Document* document, const FontDescription& fontDescription, const AtomicString& familyName)
{
if (!document || !document->frame())
return familyName;
const Settings& settings = document->frame()->settings();
UScriptCode script = fontDescription.script();
if (familyName == serifFamily)
return settings.serifFontFamily(script);
if (familyName == sansSerifFamily)
return settings.sansSerifFontFamily(script);
if (familyName == cursiveFamily)
return settings.cursiveFontFamily(script);
if (familyName == fantasyFamily)
return settings.fantasyFontFamily(script);
if (familyName == monospaceFamily)
return settings.fixedFontFamily(script);
if (familyName == pictographFamily)
return settings.pictographFontFamily(script);
if (familyName == standardFamily)
return settings.standardFontFamily(script);
return familyName;
}
class FontFaceComparator {
public:
FontFaceComparator(FontTraitsMask desiredTraitsMaskForComparison)
: m_desiredTraitsMaskForComparison(desiredTraitsMaskForComparison)
{
ASSERT_WITH_SECURITY_IMPLICATION(m_desiredTraitsMaskForComparison & FontWeightMask);
}
bool operator()(const CSSFontFace& first, const CSSFontFace& second)
{
FontTraitsMask firstTraitsMask = first.traitsMask();
FontTraitsMask secondTraitsMask = second.traitsMask();
bool firstHasDesiredStyle = firstTraitsMask & m_desiredTraitsMaskForComparison & FontStyleMask;
bool secondHasDesiredStyle = secondTraitsMask & m_desiredTraitsMaskForComparison & FontStyleMask;
if (firstHasDesiredStyle != secondHasDesiredStyle)
return firstHasDesiredStyle;
if ((m_desiredTraitsMaskForComparison & FontStyleItalicMask) && !first.isLocalFallback() && !second.isLocalFallback()) {
// Prefer a font that has indicated that it can only support italics to a font that claims to support
// all styles. The specialized font is more likely to be the one the author wants used.
bool firstRequiresItalics = (firstTraitsMask & FontStyleItalicMask) && !(firstTraitsMask & FontStyleNormalMask);
bool secondRequiresItalics = (secondTraitsMask & FontStyleItalicMask) && !(secondTraitsMask & FontStyleNormalMask);
if (firstRequiresItalics != secondRequiresItalics)
return firstRequiresItalics;
}
if (secondTraitsMask & m_desiredTraitsMaskForComparison & FontWeightMask)
return false;
if (firstTraitsMask & m_desiredTraitsMaskForComparison & FontWeightMask)
return true;
// http://www.w3.org/TR/2011/WD-css3-fonts-20111004/#font-matching-algorithm says :
// - If the desired weight is less than 400, weights below the desired weight are checked in descending order followed by weights above the desired weight in ascending order until a match is found.
// - If the desired weight is greater than 500, weights above the desired weight are checked in ascending order followed by weights below the desired weight in descending order until a match is found.
// - If the desired weight is 400, 500 is checked first and then the rule for desired weights less than 400 is used.
// - If the desired weight is 500, 400 is checked first and then the rule for desired weights less than 400 is used.
static const unsigned fallbackRuleSets = 9;
static const unsigned rulesPerSet = 8;
static const FontTraitsMask weightFallbackRuleSets[fallbackRuleSets][rulesPerSet] = {
{ FontWeight200Mask, FontWeight300Mask, FontWeight400Mask, FontWeight500Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
{ FontWeight100Mask, FontWeight300Mask, FontWeight400Mask, FontWeight500Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
{ FontWeight200Mask, FontWeight100Mask, FontWeight400Mask, FontWeight500Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
{ FontWeight500Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
{ FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
{ FontWeight700Mask, FontWeight800Mask, FontWeight900Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask },
{ FontWeight800Mask, FontWeight900Mask, FontWeight600Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask },
{ FontWeight900Mask, FontWeight700Mask, FontWeight600Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask },
{ FontWeight800Mask, FontWeight700Mask, FontWeight600Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask }
};
unsigned ruleSetIndex = 0;
for (; !(m_desiredTraitsMaskForComparison & (1 << (FontWeight100Bit + ruleSetIndex))); ruleSetIndex++) { }
const FontTraitsMask* weightFallbackRule = weightFallbackRuleSets[ruleSetIndex];
for (unsigned i = 0; i < rulesPerSet; ++i) {
if (secondTraitsMask & weightFallbackRule[i])
return false;
if (firstTraitsMask & weightFallbackRule[i])
return true;
}
return false;
}
private:
FontTraitsMask m_desiredTraitsMaskForComparison;
};
FontRanges CSSFontSelector::fontRangesForFamily(const FontDescription& fontDescription, const AtomicString& familyName)
{
// FIXME: The spec (and Firefox) says user specified generic families (sans-serif etc.) should be resolved before the @font-face lookup too.
bool resolveGenericFamilyFirst = familyName == standardFamily;
AtomicString familyForLookup = resolveGenericFamilyFirst ? resolveGenericFamily(m_document, fontDescription, familyName) : familyName;
CSSSegmentedFontFace* face = getFontFace(fontDescription, familyForLookup);
if (!face) {
if (!resolveGenericFamilyFirst)
familyForLookup = resolveGenericFamily(m_document, fontDescription, familyName);
return FontRanges(FontCache::singleton().fontForFamily(fontDescription, familyForLookup));
}
return face->fontRanges(fontDescription);
}
CSSSegmentedFontFace* CSSFontSelector::getFontFace(const FontDescription& fontDescription, const AtomicString& family)
{
auto iterator = m_fontFaces.find(family);
if (iterator == m_fontFaces.end())
return nullptr;
auto& familyFontFaces = iterator->value;
auto& segmentedFontFaceCache = m_fonts.add(family, HashMap<unsigned, std::unique_ptr<CSSSegmentedFontFace>>()).iterator->value;
FontTraitsMask traitsMask = fontDescription.traitsMask();
auto& face = segmentedFontFaceCache.add(traitsMask, nullptr).iterator->value;
if (face)
return face.get();
face = std::make_unique<CSSSegmentedFontFace>(*this);
Vector<std::reference_wrapper<CSSFontFace>, 32> candidateFontFaces;
for (int i = familyFontFaces.size() - 1; i >= 0; --i) {
CSSFontFace& candidate = familyFontFaces[i];
unsigned candidateTraitsMask = candidate.traitsMask();
if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & FontStyleNormalMask))
continue;
candidateFontFaces.append(candidate);
}
auto localIterator = m_locallyInstalledFontFaces.find(family);
if (localIterator != m_locallyInstalledFontFaces.end()) {
for (auto& candidate : localIterator->value) {
unsigned candidateTraitsMask = candidate->traitsMask();
if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & FontStyleNormalMask))
continue;
candidateFontFaces.append(candidate);
}
}
std::stable_sort(candidateFontFaces.begin(), candidateFontFaces.end(), FontFaceComparator(traitsMask));
for (auto& candidate : candidateFontFaces)
face->appendFontFace(candidate.get());
return face.get();
}
void CSSFontSelector::clearDocument()
{
if (!m_document) {
ASSERT(!m_beginLoadingTimer.isActive());
ASSERT(m_fontsToBeginLoading.isEmpty());
return;
}
m_beginLoadingTimer.stop();
CachedResourceLoader& cachedResourceLoader = m_document->cachedResourceLoader();
for (auto& fontHandle : m_fontsToBeginLoading) {
// Balances incrementRequestCount() in beginLoadingFontSoon().
cachedResourceLoader.decrementRequestCount(fontHandle.get());
}
m_fontsToBeginLoading.clear();
m_document = nullptr;
// FIXME: This object should outlive the Document.
m_fontFaces.clear();
m_locallyInstalledFontFaces.clear();
m_fonts.clear();
m_clients.clear();
}
void CSSFontSelector::beginLoadingFontSoon(CachedFont* font)
{
if (!m_document)
return;
m_fontsToBeginLoading.append(font);
// Increment the request count now, in order to prevent didFinishLoad from being dispatched
// after this font has been requested but before it began loading. Balanced by
// decrementRequestCount() in beginLoadTimerFired() and in clearDocument().
m_document->cachedResourceLoader().incrementRequestCount(font);
m_beginLoadingTimer.startOneShot(0);
}
void CSSFontSelector::beginLoadTimerFired()
{
Vector<CachedResourceHandle<CachedFont>> fontsToBeginLoading;
fontsToBeginLoading.swap(m_fontsToBeginLoading);
// CSSFontSelector could get deleted via beginLoadIfNeeded() or loadDone() unless protected.
Ref<CSSFontSelector> protect(*this);
CachedResourceLoader& cachedResourceLoader = m_document->cachedResourceLoader();
for (auto& fontHandle : fontsToBeginLoading) {
fontHandle->beginLoadIfNeeded(cachedResourceLoader);
// Balances incrementRequestCount() in beginLoadingFontSoon().
cachedResourceLoader.decrementRequestCount(fontHandle.get());
}
// Ensure that if the request count reaches zero, the frame loader will know about it.
cachedResourceLoader.loadDone(nullptr);
// New font loads may be triggered by layout after the document load is complete but before we have dispatched
// didFinishLoading for the frame. Make sure the delegate is always dispatched by checking explicitly.
if (m_document && m_document->frame())
m_document->frame()->loader().checkLoadComplete();
}
size_t CSSFontSelector::fallbackFontCount()
{
if (!m_document)
return 0;
if (Settings* settings = m_document->settings())
return settings->fontFallbackPrefersPictographs() ? 1 : 0;
return 0;
}
RefPtr<Font> CSSFontSelector::fallbackFontAt(const FontDescription& fontDescription, size_t index)
{
ASSERT_UNUSED(index, !index);
if (!m_document)
return nullptr;
Settings* settings = m_document->settings();
if (!settings || !settings->fontFallbackPrefersPictographs())
return nullptr;
return FontCache::singleton().fontForFamily(fontDescription, settings->pictographFontFamily());
}
}
|