Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a5831b78ade6e207c0cab878d354e6798b06e993
      
https://github.com/WebKit/WebKit/commit/a5831b78ade6e207c0cab878d354e6798b06e993
  Author: Elika Etemad <[email protected]>
  Date:   2026-07-13 (Mon, 13 Jul 2026)

  Changed paths:
    M Source/WebCore/platform/graphics/FontPlatformData.cpp
    M Source/WebCore/platform/graphics/FontPlatformData.h
    M Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
    M Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
    M Source/WebCore/platform/graphics/coretext/FontCoreText.cpp
    M Source/WebCore/platform/graphics/coretext/FontPlatformDataCoreText.cpp
    M Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
    M Source/WebCore/platform/graphics/skia/FontPlatformDataSkia.cpp
    M Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp
    M Source/WebKit/Shared/WebCoreFont.serialization.in

  Log Message:
  -----------
  Synchronize Font metadata representation (size, orientation, etc.)
https://bugs.webkit.org/show_bug.cgi?id=319132
rdar://182108081

Reviewed by Alan Baradlay.

We're investigating a hard-to-reproduce bug where we are using the glyphIDs
of one system-ui font to render text using a different system-ui font. Since
this is a lookup error, the main thing to check is if the lookups on both
sides of IPC (CPU layout vs GPU draw) are using the same data. The bug is
sensitive to locale and hardware, which means paying special attention to
locale and sizing information.

Since six of the core lookup data parameters are duplicated in three (!)
different data structs, it's easy for these to get out of sync. And in fact,
they are out of sync, so this patch aims to clean this up, on the theory
that this might be causing the lookup mismatch.

A. Makes FontPlatformData, FontPlatformDataAttributes, and InstalledFont etc.
   all use the same FontMetadata struct, ensuring a consistent representation
   and streamlining parameter passing and data copying.

B. Aligns this FontMetadata struct with all other representations of font
   data in WebKit to use `float` rather than `double` for the size. This
   ensures that any numeric type conversions are consistent for all lookups.

C. Corrects Font::toSerializableInstalledFont() and Font::toSerializableFont()
   to use WebKit's size data rather than pulling it off the CT font object.
   These values are not guaranteed to match, so we should be consistent about
   which one we use for lookups.

D. Removes FontPlatformData::toIPCData() from CoreText which we would need to
   update also, except it's dead code that should have been removed already.

E. Adds logging to an error condition in InstalledFont::PostScriptFont::toCTFont
   in case we are somehow landing in this case. (We should log this error
   regardless.)

F. Adds a missing locale parameter to the -apple-system-monospaced-numbers font
   lookup, which seems unlikely to be the problem but fixing it just in case.

* Source/WebCore/platform/graphics/FontPlatformData.cpp:
(WebCore::FontPlatformData::FontPlatformData):
(WebCore::m_customPlatformData):
(WebCore::FontPlatformData::cloneWithOrientation):
(WebCore::FontPlatformData::updateSize):
* Source/WebCore/platform/graphics/FontPlatformData.h:
(WebCore::FontPlatformDataAttributes::FontPlatformDataAttributes):
(WebCore::FontPlatformData::size const):
(WebCore::FontPlatformData::syntheticBold const):
(WebCore::FontPlatformData::syntheticOblique const):
(WebCore::FontPlatformData::orientation const):
(WebCore::FontPlatformData::widthVariant const):
(WebCore::FontPlatformData::textRenderingMode const):
(WebCore::FontPlatformData::metadata const):
(WebCore::FontPlatformData::operator== const):
* Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::fontDescriptorWithFamilySpecialCase):
* Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::hash const):
* Source/WebCore/platform/graphics/coretext/FontCoreText.cpp:
(WebCore::Font::fromIPCData):
(WebCore::Font::toSerializableInstalledFont const):
(WebCore::Font::toSerializableFont const):
* Source/WebCore/platform/graphics/coretext/FontPlatformDataCoreText.cpp:
(WebCore::FontPlatformDataAttributes::FontPlatformDataAttributes):
(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::create):
(WebCore::FontPlatformData::description const):
(WebCore::FontPlatformData::updateSize):
(WebCore::FontPlatformData::attributes const):
(WebCore::InstalledFont::SystemUIFont::toCTFont const):
(WebCore::InstalledFont::PostScriptFont::toCTFont const):
(WebCore::InstalledFont::toFont const):
(WebCore::FontPlatformData::toIPCData const): Deleted.
* Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp:
(WebCore::FontPlatformData::cloneWithOrientation):
(WebCore::FontPlatformData::updateSize):
(WebCore::FontPlatformData::buildScaledFont):
(WebCore::FontPlatformData::create):
(WebCore::FontPlatformData::attributes const):
(WebCore::FontPlatformData::fromIPCData):
* Source/WebCore/platform/graphics/skia/FontPlatformDataSkia.cpp:
(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::platformDataInit):
(WebCore::FontPlatformData::fromIPCData):
(WebCore::FontPlatformData::hash const):
(WebCore::FontPlatformData::create):
(WebCore::FontPlatformData::attributes const):
(WebCore::FontPlatformData::updateSize):
* Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp:
(WebCore::FontPlatformData::create):
(WebCore::FontPlatformData::attributes const):
(WebCore::FontPlatformData::fromIPCData):
* Source/WebKit/Shared/WebCoreFont.serialization.in:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to