|
Lines 83-89
FontCascade::FontCascade(FontCascadeDescription&& fd, float letterSpacing, float
a/Source/WebCore/platform/graphics/FontCascade.cpp_sec1
|
| 83 |
, m_wordSpacing(wordSpacing) |
83 |
, m_wordSpacing(wordSpacing) |
| 84 |
, m_useBackslashAsYenSymbol(useBackslashAsYenSignForFamily(m_fontDescription.firstFamily())) |
84 |
, m_useBackslashAsYenSymbol(useBackslashAsYenSignForFamily(m_fontDescription.firstFamily())) |
| 85 |
, m_enableKerning(computeEnableKerning()) |
85 |
, m_enableKerning(computeEnableKerning()) |
| 86 |
, m_requiresShaping(computeRequiresShaping()) |
|
|
| 87 |
{ |
86 |
{ |
| 88 |
} |
87 |
} |
| 89 |
|
88 |
|
|
Lines 91-97
FontCascade::FontCascade(FontCascadeDescription&& fd, float letterSpacing, float
a/Source/WebCore/platform/graphics/FontCascade.cpp_sec2
|
| 91 |
FontCascade::FontCascade(const FontPlatformData& fontData, FontSmoothingMode fontSmoothingMode) |
90 |
FontCascade::FontCascade(const FontPlatformData& fontData, FontSmoothingMode fontSmoothingMode) |
| 92 |
: m_fonts(FontCascadeFonts::createForPlatformFont(fontData)) |
91 |
: m_fonts(FontCascadeFonts::createForPlatformFont(fontData)) |
| 93 |
, m_enableKerning(computeEnableKerning()) |
92 |
, m_enableKerning(computeEnableKerning()) |
| 94 |
, m_requiresShaping(computeRequiresShaping()) |
|
|
| 95 |
{ |
93 |
{ |
| 96 |
m_fontDescription.setFontSmoothing(fontSmoothingMode); |
94 |
m_fontDescription.setFontSmoothing(fontSmoothingMode); |
| 97 |
#if PLATFORM(IOS_FAMILY) |
95 |
#if PLATFORM(IOS_FAMILY) |
|
Lines 109-115
FontCascade::FontCascade(const FontCascade& other)
a/Source/WebCore/platform/graphics/FontCascade.cpp_sec3
|
| 109 |
, m_wordSpacing(other.m_wordSpacing) |
107 |
, m_wordSpacing(other.m_wordSpacing) |
| 110 |
, m_useBackslashAsYenSymbol(other.m_useBackslashAsYenSymbol) |
108 |
, m_useBackslashAsYenSymbol(other.m_useBackslashAsYenSymbol) |
| 111 |
, m_enableKerning(computeEnableKerning()) |
109 |
, m_enableKerning(computeEnableKerning()) |
| 112 |
, m_requiresShaping(computeRequiresShaping()) |
|
|
| 113 |
{ |
110 |
{ |
| 114 |
} |
111 |
} |
| 115 |
|
112 |
|
|
Lines 121-127
FontCascade& FontCascade::operator=(const FontCascade& other)
a/Source/WebCore/platform/graphics/FontCascade.cpp_sec4
|
| 121 |
m_wordSpacing = other.m_wordSpacing; |
118 |
m_wordSpacing = other.m_wordSpacing; |
| 122 |
m_useBackslashAsYenSymbol = other.m_useBackslashAsYenSymbol; |
119 |
m_useBackslashAsYenSymbol = other.m_useBackslashAsYenSymbol; |
| 123 |
m_enableKerning = other.m_enableKerning; |
120 |
m_enableKerning = other.m_enableKerning; |
| 124 |
m_requiresShaping = other.m_requiresShaping; |
|
|
| 125 |
return *this; |
121 |
return *this; |
| 126 |
} |
122 |
} |
| 127 |
|
123 |
|
|
Lines 282-288
void FontCascade::update(RefPtr<FontSelector>&& fontSelector) const
a/Source/WebCore/platform/graphics/FontCascade.cpp_sec5
|
| 282 |
m_fonts = retrieveOrAddCachedFonts(m_fontDescription, WTFMove(fontSelector)); |
278 |
m_fonts = retrieveOrAddCachedFonts(m_fontDescription, WTFMove(fontSelector)); |
| 283 |
m_useBackslashAsYenSymbol = useBackslashAsYenSignForFamily(firstFamily()); |
279 |
m_useBackslashAsYenSymbol = useBackslashAsYenSignForFamily(firstFamily()); |
| 284 |
m_enableKerning = computeEnableKerning(); |
280 |
m_enableKerning = computeEnableKerning(); |
| 285 |
m_requiresShaping = computeRequiresShaping(); |
|
|
| 286 |
} |
281 |
} |
| 287 |
|
282 |
|
| 288 |
GlyphBuffer FontCascade::layoutText(CodePath codePathToUse, const TextRun& run, unsigned from, unsigned to, ForTextEmphasisOrNot forTextEmphasis) const |
283 |
GlyphBuffer FontCascade::layoutText(CodePath codePathToUse, const TextRun& run, unsigned from, unsigned to, ForTextEmphasisOrNot forTextEmphasis) const |
|
Lines 331-337
std::unique_ptr<DisplayList::DisplayList> FontCascade::displayListForTextRun(Gra
a/Source/WebCore/platform/graphics/FontCascade.cpp_sec6
|
| 331 |
|
326 |
|
| 332 |
// FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050 |
327 |
// FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050 |
| 333 |
CodePath codePathToUse = codePath(run); |
328 |
CodePath codePathToUse = codePath(run); |
| 334 |
if (codePathToUse != Complex && (enableKerning() || requiresShaping()) && (from || destination != run.length())) |
329 |
if (codePathToUse != Complex && (from || destination != run.length())) |
| 335 |
codePathToUse = Complex; |
330 |
codePathToUse = Complex; |
| 336 |
|
331 |
|
| 337 |
auto glyphBuffer = layoutText(codePathToUse, run, from, destination); |
332 |
auto glyphBuffer = layoutText(codePathToUse, run, from, destination); |
|
Lines 407-413
float FontCascade::width(const TextRun& run, HashSet<const Font*>* fallbackFonts
a/Source/WebCore/platform/graphics/FontCascade.cpp_sec7
|
| 407 |
} |
402 |
} |
| 408 |
|
403 |
|
| 409 |
bool hasWordSpacingOrLetterSpacing = wordSpacing() || letterSpacing(); |
404 |
bool hasWordSpacingOrLetterSpacing = wordSpacing() || letterSpacing(); |
| 410 |
float* cacheEntry = m_fonts->widthCache().add(run, std::numeric_limits<float>::quiet_NaN(), enableKerning() || requiresShaping(), hasWordSpacingOrLetterSpacing, glyphOverflow); |
405 |
float* cacheEntry = m_fonts->widthCache().add(run, std::numeric_limits<float>::quiet_NaN(), hasWordSpacingOrLetterSpacing, glyphOverflow); |
| 411 |
if (cacheEntry && !std::isnan(*cacheEntry)) |
406 |
if (cacheEntry && !std::isnan(*cacheEntry)) |
| 412 |
return *cacheEntry; |
407 |
return *cacheEntry; |
| 413 |
|
408 |
|
|
Lines 445-451
float FontCascade::widthForSimpleText(StringView text) const
a/Source/WebCore/platform/graphics/FontCascade.cpp_sec8
|
| 445 |
glyphBuffer.add(glyph, font, glyphWidth, i); |
440 |
glyphBuffer.add(glyph, font, glyphWidth, i); |
| 446 |
} |
441 |
} |
| 447 |
|
442 |
|
| 448 |
font.applyTransforms(glyphBuffer, 0, enableKerning(), requiresShaping(), fontDescription().computedLocale()); |
443 |
font.applyTransforms(glyphBuffer, 0, enableKerning(), fontDescription().computedLocale()); |
| 449 |
// This is needed only to match the result of the slow path. |
444 |
// This is needed only to match the result of the slow path. |
| 450 |
// Same glyph widths but different floating point arithmetic can produce different run width. |
445 |
// Same glyph widths but different floating point arithmetic can produce different run width. |
| 451 |
float runWidthDifferenceWithTransformApplied = -runWidth; |
446 |
float runWidthDifferenceWithTransformApplied = -runWidth; |
|
Lines 618-624
FontCascade::CodePath FontCascade::codePath(const TextRun& run, Optional<unsigne
a/Source/WebCore/platform/graphics/FontCascade.cpp_sec9
|
| 618 |
|
613 |
|
| 619 |
#if !USE(FREETYPE) |
614 |
#if !USE(FREETYPE) |
| 620 |
// FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050 |
615 |
// FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050 |
| 621 |
if ((enableKerning() || requiresShaping()) && (from.valueOr(0) || to.valueOr(run.length()) != run.length())) |
616 |
if (from.valueOr(0) || to.valueOr(run.length()) != run.length()) |
| 622 |
return Complex; |
617 |
return Complex; |
| 623 |
#else |
618 |
#else |
| 624 |
UNUSED_PARAM(from); |
619 |
UNUSED_PARAM(from); |
|
Lines 633-639
FontCascade::CodePath FontCascade::codePath(const TextRun& run, Optional<unsigne
a/Source/WebCore/platform/graphics/FontCascade.cpp_sec10
|
| 633 |
|
628 |
|
| 634 |
#else |
629 |
#else |
| 635 |
|
630 |
|
| 636 |
if (run.length() > 1 && (enableKerning() || requiresShaping())) |
631 |
if (run.length() > 1) |
| 637 |
return Complex; |
632 |
return Complex; |
| 638 |
#endif |
633 |
#endif |
| 639 |
|
634 |
|