Functions to introspect the Unicode Indic_Positional_Category property for binaries (Strings) and codepoints.
The Indic_Positional_Category property describes the visual position of a dependent character relative to its base, for example :top, :bottom, :left, :right or :top_and_bottom. Codepoints to which it does not apply have the value :na (Not_Applicable).
The primary API is indic_positional_category/1 which returns the category of a codepoint, or the list of categories of a string.
Summary
Functions
Returns a map of aliases for Unicode indic positional categories.
Returns the count of the codepoints with a given indic positional category.
Returns the Unicode codepoint ranges for a given indic positional category.
Returns the Unicode codepoint ranges for a given indic positional category.
Returns the map of Unicode indic positional categories.
Returns the indic positional category of the given binary or codepoint.
Returns a list of known Unicode indic positional category names.
Functions
Returns a map of aliases for Unicode indic positional categories.
Returns
- A map where the alias string is the key and the indic positional category is the value.
Examples
iex> Unicode.IndicPositionalCategory.aliases() |> Map.get("top")
:top
Returns the count of the codepoints with a given indic positional category.
Aliases are resolved by this function.
Arguments
indic_positional_categoryis any category name or alias, as an atom or string.
Returns
A non-negative integer count of the codepoints with the indic positional category.
:errorif the indic positional category is not known.
Examples
iex> is_integer(Unicode.IndicPositionalCategory.count(:top))
true
Returns the Unicode codepoint ranges for a given indic positional category.
Aliases are resolved by this function.
Arguments
indic_positional_categoryis any category name or alias, as an atom or string.
Returns
{:ok, range_list}whererange_listis a list of codepoint ranges as 2-tuples.:errorif the indic positional category is not known.
Examples
iex> Unicode.IndicPositionalCategory.fetch(:top) |> elem(0)
:ok
iex> Unicode.IndicPositionalCategory.fetch(:invalid)
:error
Returns the Unicode codepoint ranges for a given indic positional category.
Aliases are resolved by this function.
Arguments
indic_positional_categoryis any category name or alias, as an atom or string.
Returns
A list of codepoint ranges as 2-tuples.
nilif the indic positional category is not known.
Examples
iex> Unicode.IndicPositionalCategory.get(:invalid)
nil
Returns the map of Unicode indic positional categories.
Returns
- A map where the indic positional category is the key and a list of codepoint ranges as 2-tuples is the value.
Examples
iex> :top in Map.keys(Unicode.IndicPositionalCategory.indic_positional_categories())
true
Returns the indic positional category 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 category atom is returned. Codepoints to which the property does not apply return
:na.For a binary, a list of the distinct categories of the codepoints in the binary is returned.
Examples
iex> Unicode.IndicPositionalCategory.indic_positional_category(0x0903)
:right
iex> Unicode.IndicPositionalCategory.indic_positional_category(?A)
:na
Returns a list of known Unicode indic positional category names.
Returns
- A list of atom indic positional category names.
Examples
iex> :bottom in Unicode.IndicPositionalCategory.known_indic_positional_categories()
true