RESOLVED FIXED311246
Ligatures affect layout for 0 font-size
https://bugs.webkit.org/show_bug.cgi?id=311246
Summary Ligatures affect layout for 0 font-size
Alex
Reported 2026-04-01 00:20:28 PDT
Here's an example of the issue: 1. I have an icon-only button. 2. I have text inside that button for accessibility tools. 3. I hide text visually using font-size: 0. 4. I use Google Manrope font that has ligatures, for this example, for double t – "tt" 5. The ligatures affect layout even though font size is 0, see the Codepen below: https://codepen.io/waterplea/pen/OPRZyex A button with "User" inside is displayed correctly, a button with "Settings" inside is off-center in Safari due to double t.
Attachments
wpt-testcase (2.42 KB, text/html)
2026-04-01 01:59 PDT, Karl Dubost
no flags
Ahmad Saleem
Comment 1 2026-04-01 00:54:36 PDT
I am able to reproduce this bug on Safari Technology Preview 240, where in second button `gear` icon is not centered like first one and is bit shifted on left side. I am not able to reproduce this bug on Chrome Canary 148.0.7766.0 (Official Build) canary (arm64) .
Radar WebKit Bug Importer
Comment 2 2026-04-01 00:54:42 PDT
Ahmad Saleem
Comment 3 2026-04-01 01:04:37 PDT
First bit in: void ComplexTextController::collectComplexTextRuns() We have the early return where if computedSize of font is `0`, we early return. if (!m_end || !m_fontCascade->size()) return; So it might fallback to Simple Text Run.
Ahmad Saleem
Comment 4 2026-04-01 01:05:56 PDT
We might be missing same guard in SimpleTextRun and need to skip this bit.
Ahmad Saleem
Comment 5 2026-04-01 01:51:33 PDT
This fixes it: Source/WebCore/platform/graphics/coretext/FontCoreText.cpp Font::applyTransforms if (!platformData().size()) return makeGlyphBufferAdvance(); Before auto handler = ^(CFRange range, CGGl
Karl Dubost
Comment 6 2026-04-01 01:59:47 PDT
Created attachment 478873 [details] wpt-testcase Working locally with https://wpt.live/ To be removed before uploading with the patch.
Ahmad Saleem
Comment 7 2026-04-01 02:17:29 PDT
EWS
Comment 8 2026-04-01 15:23:11 PDT
Committed 310394@main (36d29c6355ca): <https://commits.webkit.org/310394@main> Reviewed commits have been landed. Closing PR #61819 and removing active labels.
Ahmad Saleem
Comment 9 2026-04-01 16:53:24 PDT
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/58928
Note You need to log in before you can comment on or make changes to this bug.