Bug 262762 - Implement percentage values for letter-spacing and word-spacing [css-text-4]
Summary: Implement percentage values for letter-spacing and word-spacing [css-text-4]
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: Safari 17
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-10-05 22:22 PDT by fantasai
Modified: 2024-03-01 06:46 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fantasai 2023-10-05 22:22:20 PDT
Background:
  CSS Text Level 4 <https://www.w3.org/TR/css-text-4/> adds support for percentage values of word-spacing and letter-spacing. These inherit as percentages, so that they are always relative to the currently-effective font-size.

Current Status:
  WebKit has support for percentage values of word-spacing (but not calc() values) but calculates them against the width of a space instead of the font-size, and doesn't inherit them properly; and has no support for percentage letter-spacing.

Proposal:
  Re-implement percentage values of word-spacing per spec, add support for percentage values of letter-spacing, and implement support for calc().

Compat Risks:
  Firefox also implements percentage word-spacing in a similar way to WebKit, but Chrome doesn't implement percentage word-spacing, so it's unlikely that Web content depends on it. There could be some lock-in in single-engine environments, but because the current implementation doesn't implement inheritance properly, the benefit of using % over fixed values is not fully realized in the current implementation, so the incentive to use them over 'em' values (which have existed since CSS1) is limited.
Comment 1 fantasai 2023-10-05 22:27:09 PDT
rdar://114538918
Comment 2 Radar WebKit Bug Importer 2023-10-05 22:27:54 PDT Comment hidden (obsolete)
Comment 3 Alexey Proskuryakov 2023-10-07 13:46:26 PDT
rdar://114538918
Comment 4 Tim Nguyen (:ntim) 2023-10-22 23:58:49 PDT
https://github.com/WebKit/WebKit/pull/18771/
Comment 5 EWS 2023-11-30 13:52:32 PST
Committed 271357@main (6abbfb00701a): <https://commits.webkit.org/271357@main>

Reviewed commits have been landed. Closing PR #18771 and removing active labels.