Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: df0f17533ab4c17991214087049e647a68754ce5
      
https://github.com/WebKit/WebKit/commit/df0f17533ab4c17991214087049e647a68754ce5
  Author: Vitor Roriz <vitor.ro...@apple.com>
  Date:   2024-05-01 (Wed, 01 May 2024)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/platform/mac/fast/text/softbank-emoji-expected.txt
    M LayoutTests/platform/wpe/fast/text/softbank-emoji-expected.txt
    M Source/WebCore/platform/graphics/FontCascadeFonts.cpp

  Log Message:
  -----------
  Select primary font for missing glyph for PUA characters
https://bugs.webkit.org/show_bug.cgi?id=273233
rdar://124036223

Reviewed by Antti Koivisto.

We used to render the missing glyph for PUA characters (see [1])
with the lastResortFontFallback, instead of the primary font.
This is done by FontCascadeFonts::glyphDataForVariant(...)
producing a GlyphData object with such font for the missing glyph (glyph 0).

The ComplexTextController, which handles complex text, would always
use the primary font for getting metrics for the missing glyph. When rendering
PUA characters we would use the simple path (WidthIterator is used instead
of ComplexTextController), selecting the last resort font both for layout and 
painting.

However, when computing the caret position, we still use the 
ComplexTextController
because WidthIterator can't handle partial runs with ligatures (for example).

This would result in WidthIterator being used for layout/painting and selecting 
the
lastResortFont, and ComplexTextController being used for calculating the caret 
position,
selecting the primary font.

We are fixing it by updating the special case for PUA character and selecting
the primary font for such case, instead of the lastResortFont. This also has
the benefit of enforcing interoperability with other browser, as Blink
and Gecko seem to also use the primary font selected by the author.

[1] https://commits.webkit.org/269524@main

* LayoutTests/platform/mac/fast/text/softbank-emoji-expected.txt:
* LayoutTests/platform/wpe/fast/text/softbank-emoji-expected.txt:
- Rebasing this test since they contain PUA characters and font will change.

* LayoutTests/TestExpectations:
- We should pass this test now.

* Source/WebCore/platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::glyphDataForVariant):
- Using primary font instead of last resort font for glyph 0 when PUA 
characters can't be mapped by selected fonts.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to