[webkit-changes] [WebKit/WebKit] 9c7a8b: Measure glyphs in a single CoreText call rather th...

Brent Fulgham noreply at github.com
Fri Mar 14 17:25:37 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9c7a8b92644023967579ef9b941cc94fba9009f6
      https://github.com/WebKit/WebKit/commit/9c7a8b92644023967579ef9b941cc94fba9009f6
  Author: Brent Fulgham <bfulgham at apple.com>
  Date:   2025-03-14 (Fri, 14 Mar 2025)

  Changed paths:
    M Source/WebCore/platform/graphics/ComplexTextController.cpp
    M Source/WebCore/platform/graphics/Font.h
    M Source/WebCore/platform/graphics/Glyph.h
    M Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp
    M Source/WebCore/platform/graphics/coretext/FontCoreText.cpp

  Log Message:
  -----------
  Measure glyphs in a single CoreText call rather than repeated calls
https://bugs.webkit.org/show_bug.cgi?id=288780
rdar://145797633

Reviewed by Ryan Reno.

Rather than calling `CTFontGetBoundingRectsForGlyphs` once for each glyph (and passing a
single `CGRect` to get the size), collect all glyphs needing measurement and ask CoreText
to measure the entire set of glyphs in a single API call.

In theory, this will avoid the repeated work of creating graphics contexts, selecting a
specific font face into it, transforming, etc., before making the measurement.

* Source/WebCore/platform/graphics/ComplexTextController.cpp:
(WebCore::ComplexTextController::enclosingGlyphBoundsForTextRun): Adopt bulk font measuring.
(WebCore::ComplexTextController::adjustGlyphsAndAdvances): Ditto.
* Source/WebCore/platform/graphics/Font.h:
(WebCore::Font::boundsForGlyphs const): Added.
* Source/WebCore/platform/graphics/Glyph.h:Use #pragma once
* Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp:
(WebCore::DrawGlyphsRecorder::drawOTSVGRun): Adopt bulk font measuring.
* Source/WebCore/platform/graphics/coretext/FontCoreText.cpp:
(WebCore::Font::platformBoundsForGlyphs const): Added.

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



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


More information about the webkit-changes mailing list