Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4535075b56fdb33a076f51fe92cd0bb8832797c8
      
https://github.com/WebKit/WebKit/commit/4535075b56fdb33a076f51fe92cd0bb8832797c8
  Author: Vitor Roriz <vitor.ro...@apple.com>
  Date:   2023-10-19 (Thu, 19 Oct 2023)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/matching/font-unicode-PUA-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/matching/font-unicode-PUA-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/matching/font-unicode-PUA.html
    M LayoutTests/platform/mac/fast/text/softbank-emoji-expected.txt
    M LayoutTests/platform/wpe/fast/text/softbank-emoji-expected.txt
    M Source/WebCore/css/CSSFontSelector.cpp
    M Source/WebCore/platform/graphics/FontCascadeFonts.cpp
    M Source/WebCore/platform/graphics/FontRanges.cpp
    M Source/WebCore/platform/graphics/FontRanges.h
    M Source/WebCore/platform/graphics/WidthIterator.cpp
    M Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp
    M Source/WebCore/platform/text/CharacterProperties.h

  Log Message:
  -----------
  Font fallback should ignore generic families for codepoints in PUA
https://bugs.webkit.org/show_bug.cgi?id=263261
rdar://115901340

Reviewed by Cameron McCormack.

According to spec: https://drafts.csswg.org/css-fonts-4/#char-handling-issues

"If a given character is a Private-Use Area Unicode codepoint, user agents must 
only match font families named in the font-family list that are not generic 
families. If none of the families named in the font-family list contain a glyph 
for that codepoint, user agents must display some form of missing glyph symbol 
for that character rather than attempting installed font fallback for that 
codepoint."

We are currently not ignoring generic font families for font fallback when a 
code point is in the private-use area (PUA).
This patch changes that. Now FontRanges has a flag to signal that the Font 
represented by the FontRanges
object came from a generic family. That way, we can skip it during font 
fallback when finding
the glyph data for a codepoint that is in the private-user area.

After attempting all user-specified font-families, if we couldn't find a font 
that can represent such codepoint,
we then use the .notdef glyph (glyph 0) and the last resource font of WebKit 
for it.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/matching/font-unicode-PUA-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/matching/font-unicode-PUA-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/matching/font-unicode-PUA.html:
 Added.
* LayoutTests/platform/mac/fast/text/softbank-emoji-expected.txt:
* LayoutTests/platform/wpe/fast/text/softbank-emoji-expected.txt:
* Source/WebCore/css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::fontRangesForFamily):
* Source/WebCore/platform/graphics/FontCascadeFonts.cpp:
(WebCore::realizeNextFallback):
(WebCore::FontCascadeFonts::glyphDataForVariant):
(WebCore::FontCascadeFonts::glyphDataForCharacter):
* Source/WebCore/platform/graphics/FontRanges.cpp:
(WebCore::FontRanges::FontRanges):
(WebCore::FontRanges::glyphDataForCharacter const):
* Source/WebCore/platform/graphics/FontRanges.h:
(WebCore::FontRanges::isGeneric const):
* Source/WebCore/platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advanceInternal):
* Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp:
(WebCore::FontCascade::fontForCombiningCharacterSequence const):
* Source/WebCore/platform/text/CharacterProperties.h:
(WebCore::isPrivateUseAreaCharacter):

Canonical link: https://commits.webkit.org/269524@main


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to