large-type.com icon indicating copy to clipboard operation
large-type.com copied to clipboard

Properly segment Unicode graphemes.

Open bm-w opened this issue 6 months ago • 0 comments

Use window.Intl.Segmenter to segment the text into graphemes so that non-trivial emojis are displayed properly (such as compound emojis with zero-width joiners).

This API has been supported by the major browsers since 2020/2021, and has recently in April gained support in Firefox as well. Nevertheless, I’ve implemented a graceful fallback to the old behavior for non-supporting browsers.

bm-w avatar Aug 21 '24 23:08 bm-w