Functions to introspect the Unicode Joining_Group property for binaries (Strings) and codepoints.
The Joining_Group property groups Arabic and Syriac letters that share the same shaping behaviour, for example :beh, :alaph or :teh_marbuta. Codepoints that are not cursively joined have the value :no_joining_group.
The primary API is joining_group/1 which returns the joining group of a codepoint, or the list of joining groups of a string. This complements Unicode.JoiningType.
Summary
Functions
Returns a map of aliases for Unicode joining groups.
Returns the count of the codepoints in a given joining group.
Returns the Unicode codepoint ranges for a given joining group.
Returns the Unicode codepoint ranges for a given joining group.
Returns the joining group of the given binary or codepoint.
Returns the map of Unicode joining groups.
Returns a list of known Unicode joining group names.
Functions
Returns a map of aliases for Unicode joining groups.
Returns
- A map where the alias string is the key and the joining group is the value.
Examples
iex> Unicode.JoiningGroup.aliases() |> Map.get("beh")
:beh
Returns the count of the codepoints in a given joining group.
Aliases are resolved by this function.
Arguments
joining_groupis any joining group name or alias, as an atom or string.
Returns
A non-negative integer count of the codepoints in the joining group.
:errorif the joining group is not known.
Examples
iex> is_integer(Unicode.JoiningGroup.count(:beh))
true
Returns the Unicode codepoint ranges for a given joining group.
Aliases are resolved by this function.
Arguments
joining_groupis any joining group name or alias, as an atom or string.
Returns
{:ok, range_list}whererange_listis a list of codepoint ranges as 2-tuples.:errorif the joining group is not known.
Examples
iex> Unicode.JoiningGroup.fetch(:beh) |> elem(0)
:ok
iex> Unicode.JoiningGroup.fetch(:invalid)
:error
Returns the Unicode codepoint ranges for a given joining group.
Aliases are resolved by this function.
Arguments
joining_groupis any joining group name or alias, as an atom or string.
Returns
A list of codepoint ranges as 2-tuples.
nilif the joining group is not known.
Examples
iex> Unicode.JoiningGroup.get(:invalid)
nil
Returns the joining group of the given binary or codepoint.
Arguments
string_or_codepointis either a binary (String) or a codepoint in the range0..0x10FFFF.
Returns
For a codepoint, a single joining group atom is returned. Codepoints that are not cursively joined return
:no_joining_group.For a binary, a list of the distinct joining groups of the codepoints in the binary is returned.
Examples
iex> Unicode.JoiningGroup.joining_group(0x0628)
:beh
iex> Unicode.JoiningGroup.joining_group(?A)
:no_joining_group
Returns the map of Unicode joining groups.
Returns
- A map where the joining group is the key and a list of codepoint ranges as 2-tuples is the value.
Examples
iex> :beh in Map.keys(Unicode.JoiningGroup.joining_groups())
true
Returns a list of known Unicode joining group names.
Returns
- A list of atom joining group names.
Examples
iex> :alaph in Unicode.JoiningGroup.known_joining_groups()
true