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
textwrites the:name:of an emojiemojihas a picture for, colons included, in order. A colon that closes one name never opens the next. - split_
spans spanswith every:name:of an emojiemojihas split out as a run of its own markedRichSpan::workspace_emoji, in the style of the run it was written in. Code (monospaced runs) stays as written.- split_
spans_ in_ window split_spanswith the emoji of the window whose code is running.- writes_
window_ emoji - Whether
textwrites any:name:the window’s workspace has a picture for.