View Source Exmoji.EmojiChar (Exmoji v0.3.2)

EmojiChar is a struct represents a single Emoji character and its associated metadata.

Fields

  • name - The standardized name used in the Unicode specification to represent this emoji character.
  • unified - The primary unified codepoint ID for the emoji.
  • variations - A list of all variant codepoints that may also represent this emoji.
  • short_name - The canonical "short name" or keyword used in many systems to refer to this emoji. Often surrounded by :colons: in systems like GitHub & Campfire.
  • short_names - A full list of possible keywords for the emoji.
  • text - An alternate textual representation of the emoji, for example a smiley face emoji may be represented with an ASCII alternative. Most emoji do not have a text alternative. This is typically used when building an automatic translation from typed emoticons.

It also contains a few helper functions to deal with this data type.

Summary

Functions

Returns a list of all possible bitstring renderings of an EmojiChar.

Returns a list of all possible codepoint string IDs of an EmojiChar.

Is the EmojiChar represented by a doublebyte codepoint in Unicode?

Renders an EmojiChar to its bitstring glyph representation, suitable for printing to screen.

Returns the most likely variant-encoding codepoint ID for an EmojiChar.

Does the EmojiChar have an alternate Unicode variant encoding?

Functions

Returns a list of all possible bitstring renderings of an EmojiChar.

E.g., normal, with variant selectors, etc. This is useful if you want to have all possible values to match against when searching for the emoji in a string representation.

Link to this function

codepoint_ids(emoji_char)

View Source

Returns a list of all possible codepoint string IDs of an EmojiChar.

E.g., normal, with variant selectors, etc. This is useful if you want to have all possible values to match against.

Example

iex> Exmoji.from_short_name("cloud") |> Exmoji.EmojiChar.codepoint_ids
["2601","2601-FE0F"]

Is the EmojiChar represented by a doublebyte codepoint in Unicode?

Link to this function

render(ec, options \\ [variant_encoding: true])

View Source

Renders an EmojiChar to its bitstring glyph representation, suitable for printing to screen.

By passing options field variant_encoding you can manually specify whether the variant encoding selector should be used to hint to rendering devices that "graphic" representation should be used. By default, we use this for all Emoji characters that contain a possible variant.

Returns the most likely variant-encoding codepoint ID for an EmojiChar.

For now we only know of one possible variant encoding for certain characters, but there could be others in the future.

This is typically used to force Emoji rendering for characters that could be represented in standard font glyphs on certain operating systems.

The resulting encoded string will be two codepoints, or three codepoints for doublebyte Emoji characters.

If there is no variant-encoding for a character, returns nil.

Does the EmojiChar have an alternate Unicode variant encoding?