Skip to main content

Module inline_emoji

Module inline_emoji 

Expand description

A workspace’s own emoji inside text: :name: drawn as its picture.

A run that writes the :name: of an emoji the window’s workspace has (crate::workspace_emoji) keeps its bytes, so selection, the caret, copying, search and hit-testing all read the real :name:. It is shaped to take one emoji square instead of its letters’ width: its glyphs are set at a size too small to see or to measure and spaced out to the square’s advance, so the row keeps its height and wraps as if the picture were one glyph. The text renderer leaves those glyphs out and paints the picture into the run’s box, centred on the row as the letters around it are.

Text whose workspace has no such emoji, or whose picture is not decoded yet, keeps :name: as text.

Constants§

ADVANCE_EM
How far an inline emoji advances, in ems of the text it stands in: its picture and a hair of room either side.
SIDE_EM
The side of an inline emoji’s picture, in ems of its text, at most the height of its row.

Functions§

emoji_ranges
Where text writes the :name: of an emoji emoji has a picture for, colons included, in order. A colon that closes one name never opens the next.
split_spans
spans with every :name: of an emoji emoji has split out as a run of its own marked RichSpan::workspace_emoji, in the style of the run it was written in. Code (monospaced runs) stays as written.
split_spans_in_window
split_spans with the emoji of the window whose code is running.
writes_window_emoji
Whether text writes any :name: the window’s workspace has a picture for.