Documentation ¶
Index ¶
- Constants
- Variables
- func DisplayWidth(str string) int
- func IsEmoji(r rune) bool
- type Version
- func (v Version) FileBytes(t data.FileType) []byte
- func (v Version) HasFile(t data.FileType) bool
- func (v Version) MergedRangeTable() *unicode.RangeTable
- func (v Version) RangeTable(property data.Property) *unicode.RangeTable
- func (v Version) Sequences(seqType data.SeqType) []string
- func (v Version) String() string
Constants ¶
const ZWJ = '\u200d'
ZWJ is the Unicode zero-width join character
Variables ¶
AllVersions lists all emoji versions in order.
Functions ¶
func DisplayWidth ¶
DisplayWidth attempts to guess at the display width of a string containing emoji, taking into account variation selectors (0xFE00-0xFE0F), zero-width joins (0x200D), combining diacritical marks (0x20d0-0x20ff), flags, and skin tone modifiers.
Types ¶
type Version ¶
type Version int
Version represents an Emoji major release, e.g. V5 for Emoji version 5.0. Note that starting at Emoji version 11.0, the Emoji version is synchronized to the corresponding Unicode version, so there are no versions 6-10.
func (Version) FileBytes ¶
FileBytes returns the byte data of the Unicode.org source file of the specified type for this version, e.g. V12.FileBytes(Sequences) returns the contents of the file http://unicode.org/Public/emoji/12.0/emoji-sequences.txt
func (Version) HasFile ¶
HasFile returns true if this version has a file of the specified type, false otherwise. E.g., ZWJ (zero width joiner) sequences were introduced only in Emoji version 2.0, test files in version 4.0, and variation sequences in version 5.0.
func (Version) MergedRangeTable ¶
func (v Version) MergedRangeTable() *unicode.RangeTable
MergedRangeTable returns the Unicode range table for all characters with all properties in this Emoji version. The list of properties can be found in data.AllProperties. Note that the range table reflects the ranges as defined in the source files from Unicode.org; ranges are guaranteed not to overlap, as per the RangeTable docs, but adjacent ranges are not coalesced.
func (Version) RangeTable ¶
func (v Version) RangeTable(property data.Property) *unicode.RangeTable
RangeTable returns the Unicode range table for characters with the specified property in this Emoji version. Note that the range table reflects the ranges as defined in the source files from Unicode.org; ranges are guaranteed not to overlap, as per the RangeTable docs, but adjacent ranges are not coalesced.