Functions to introspect the Unicode joining type property for binaries (Strings) and codepoints.
The primary API is joining_type/1 which returns the joining type for a codepoint or the list of joining types for a string.
The functions fetch/1, get/1 and count/1 provide introspection of the codepoint ranges associated with a given joining type. joining_types/0, known_joining_types/0 and aliases/0 return the underlying property data.
Summary
Functions
Returns a map of aliases for Unicode joining types.
Returns the count of the number of characters for a given joining type.
Returns the Unicode codepoint ranges for a given joining type.
Returns the Unicode codepoint ranges for a given joining type.
Returns the joining type name(s) for the given binary or codepoint.
Returns the map of Unicode joining types.
Returns a list of known Unicode joining type names.
Functions
Returns a map of aliases for Unicode joining types.
An alias is an alternative name for referring to a joining type. Aliases are resolved by the fetch/1 and get/1 functions.
Returns
- A map with the alias as a string key and the joining type name as an atom value.
Examples
iex> Unicode.JoiningType.aliases() |> Map.get("dualjoining")
:d
Returns the count of the number of characters for a given joining type.
Arguments
joining_typeis any joining type name as an atom, or a string alias for a joining type.
Returns
The number of codepoints that have the given joining type.
:errorif the joining type name is not known.
Examples
iex> Unicode.JoiningType.count(:d)
615
Returns the Unicode codepoint ranges for a given joining type.
Aliases are resolved by this function.
Arguments
joining_typeis any joining type name as an atom, or a string alias for a joining type.
Returns
{:ok, range_list}whererange_listis a list of codepoint ranges as 2-tuples.:errorif the joining type name is not known.
Examples
iex> Unicode.JoiningType.fetch(:c)
{:ok, [{1600, 1600}, {2042, 2042}, {2179, 2181}, {6154, 6154}, {8205, 8205}]}
iex> Unicode.JoiningType.fetch(:invalid)
:error
Returns the Unicode codepoint ranges for a given joining type.
Aliases are resolved by this function.
Arguments
joining_typeis any joining type name as an atom, or a string alias for a joining type.
Returns
range_listwhich is a list of codepoint ranges as 2-tuples.nilif the joining type name is not known.
Examples
iex> Unicode.JoiningType.get(:c)
[{1600, 1600}, {2042, 2042}, {2179, 2181}, {6154, 6154}, {8205, 8205}]
iex> Unicode.JoiningType.get(:invalid)
nil
Returns the joining type name(s) for the given binary or codepoint.
Arguments
codepoint_or_stringis either an integer codepoint or a string.
Returns
In the case of a codepoint, a single joining type name as an atom. Codepoints with no explicit
Joining_Typeassignment default to:u(Non_Joining).In the case of a string, a list of the distinct joining type names represented by the codepoints in the string.
Examples
iex> Unicode.JoiningType.joining_type(?A)
:u
iex> Unicode.JoiningType.joining_type(0x0628)
:d
Returns the map of Unicode joining types.
Returns
- A map with the joining type name as the key and a list of codepoint ranges as 2-tuples as the value.
Examples
iex> Unicode.JoiningType.joining_types() |> Map.get(:c)
[{1600, 1600}, {2042, 2042}, {2179, 2181}, {6154, 6154}, {8205, 8205}]
Returns a list of known Unicode joining type names.
This function does not return the names of any joining type aliases.
Returns
- A list of joining type names as atoms.
Examples
iex> Unicode.JoiningType.known_joining_types() |> Enum.sort()
[:c, :d, :l, :r, :t]