[webkit-changes] [WebKit/WebKit] 9df8ed: [Fonts] systemFallbackForCharacters() only works o...

Myles C. Maxfield noreply at github.com
Sun Aug 27 04:46:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9df8edf812b7c4330d6f9c1578ef33e57f37457c
      https://github.com/WebKit/WebKit/commit/9df8edf812b7c4330d6f9c1578ef33e57f37457c
  Author: Myles C. Maxfield <mmaxfield at apple.com>
  Date:   2023-08-27 (Sun, 27 Aug 2023)

  Changed paths:
    M Source/WebCore/platform/graphics/Font.cpp
    M Source/WebCore/platform/graphics/Font.h
    M Source/WebCore/platform/graphics/FontCache.h
    M Source/WebCore/platform/graphics/FontCascade.cpp
    M Source/WebCore/platform/graphics/FontCascade.h
    M Source/WebCore/platform/graphics/FontCascadeFonts.cpp
    M Source/WebCore/platform/graphics/SystemFallbackFontCache.cpp
    M Source/WebCore/platform/graphics/SystemFallbackFontCache.h
    M Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
    M Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
    M Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp
    M Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp
    M Source/WebCore/platform/graphics/freetype/FontSetCache.cpp
    M Source/WebCore/platform/graphics/freetype/FontSetCache.h
    M Source/WebCore/platform/graphics/win/FontCacheWin.cpp

  Log Message:
  -----------
  [Fonts] systemFallbackForCharacters() only works on individual characters, not clusters
https://bugs.webkit.org/show_bug.cgi?id=260758
rdar://114481597

Reviewed by Cameron McCormack.

When you pick a font, you have to pick a font for a whole cluster; different codepoints
in a cluster can't fall back to different fonts. If you've exhausted the whole font-family
list and you fall off the end, you need to ask the system for a font that can render
the cluster. The Core Text platform facilities have support for this: they accept a
character pointer and a length. However, the only problem is that our own system fallback
code operated on an individual UChar32, rather than on a whole cluster.

This is a classic case of impedence mismatch: At the beginning of the procedure, you have
clusters, and at the end of the procedure (when we hit Core Text), we operate on clusters
too. This patch simply hooks up cluster support (via StringViews) throughout the interior
of the procedure.

Right now, this patch has no behavior change, because the only codepath that uses this
functionality is our fast text codepath, which currently only operates on a single
character at a time (another way to think of this: every cluster has exactly one code
point inside it). If we want to stop using the complex text codepath, this will be relaxed
in the future, to allow the fast text codepath to operate on whole clusters. When that day
comes, we'll need to be able to feed the clusters to systemFallbackForCharacters(), like
this patch allows for. (So, right now, this patch doesn't add any tests, because there is
no behavior change.)

* Source/WebCore/platform/graphics/Font.cpp:
(WebCore::Font::systemFallbackFontForCharacter const):
* Source/WebCore/platform/graphics/Font.h:
* Source/WebCore/platform/graphics/FontCache.h:
* Source/WebCore/platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::glyphDataForSystemFallback):
* Source/WebCore/platform/graphics/SystemFallbackFontCache.cpp:
(WebCore::SystemFallbackFontCache::systemFallbackFontForCharacter):
* Source/WebCore/platform/graphics/SystemFallbackFontCache.h:
(WebCore::add):
(WebCore::SystemFallbackFontCache::CharacterFallbackMapKeyHashTraits::constructDeletedValue):
(WebCore::SystemFallbackFontCache::CharacterFallbackMapKeyHashTraits::isDeletedValue):
* Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::lookupFallbackFont):
(WebCore::FontCache::systemFallbackForCharacters):
(WebCore::createFontForCharacters): Deleted.
* Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp:

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




More information about the webkit-changes mailing list