[webkit-changes] [WebKit/WebKit] 356312: [WebGPU] Hook up UnrealizedCoreTextFont to callers

Myles C. Maxfield noreply at github.com
Mon Feb 13 23:37:38 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3563129ef78f532b8395346823cd2d4f186fd499
      https://github.com/WebKit/WebKit/commit/3563129ef78f532b8395346823cd2d4f186fd499
  Author: Myles C. Maxfield <mmaxfield at apple.com>
  Date:   2023-02-13 (Mon, 13 Feb 2023)

  Changed paths:
    M Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
    M Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h
    M Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp
    M Source/WebCore/platform/graphics/mac/FontCustomPlatformDataMac.cpp

  Log Message:
  -----------
  [WebGPU] Hook up UnrealizedCoreTextFont to callers
https://bugs.webkit.org/show_bug.cgi?id=252221

Reviewed by Cameron McCormack.

The solution to https://bugs.webkit.org/show_bug.cgi?id=247987 requires having explicit locations where we transform
a CTFontDescriptor into a CTFont. UnrealizedCoreTextFont is the critical object in a design which enforces this: It
holds the original CTFontDescriptor/CTFont which Core Text gave us originally, plus a CFMutableDictionary of
modifications to be made to it. Updating the modifications never hits Core Text, and are as such very lightweight.
Once we're done setting the modifications, there's a "commit" step where we finally make the final CTFont. This
means that we avoid ping-ponging between CTFontDescriptors and CTFonts unnecessarily.

Eventually, preparePlatformFont() will be integrated into this object, but that's too big for a single patch. This
patch just hooks up callers of preparePlatformFont() to use this object, which will temporarily be resolved to a
CTFont just before calling preparePlatformFont. The next few patches will be updating preparePlatformFont() to be
able to represent it as a pure modification to the UnrealizedCoreTextFont.

* Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::preparePlatformFont):
(WebCore::fontDescriptorWithFamilySpecialCase):
(WebCore::fontWithFamily):
(WebCore::FontCache::systemFallbackForCharacters):
* Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h:
* Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
(WebCore::FontFamilySpecificationCoreText::fontRanges const):
* Source/WebCore/platform/graphics/mac/FontCustomPlatformDataMac.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):

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




More information about the webkit-changes mailing list