Functions to introspect the Unicode Vertical_Orientation property for binaries (Strings) and codepoints.
The Vertical_Orientation property describes how a codepoint is oriented when laid out in vertical text (see UAX #50). The values are :u (Upright), :r (Rotated), :tu (Transformed_Upright) and :tr (Transformed_Rotated). Codepoints without an explicit assignment default to :r.
The primary API is vertical_orientation/1 which returns the orientation of a codepoint, or the list of orientations of a string.
Summary
Functions
Returns a map of aliases for Unicode vertical orientations.
Returns the count of the codepoints with a given vertical orientation.
Returns the Unicode codepoint ranges for a given vertical orientation.
Returns the Unicode codepoint ranges for a given vertical orientation.
Returns a list of known Unicode vertical orientation names.
Returns the vertical orientation of the given binary or codepoint.
Returns the map of Unicode vertical orientations.
Functions
Returns a map of aliases for Unicode vertical orientations.
Returns
- A map where the alias string is the key and the vertical orientation is the value.
Examples
iex> Unicode.VerticalOrientation.aliases() |> Map.get("upright")
:u
Returns the count of the codepoints with a given vertical orientation.
Aliases are resolved by this function.
Arguments
vertical_orientationis any orientation name or alias, as an atom or string.
Returns
A non-negative integer count of the codepoints with the vertical orientation.
:errorif the vertical orientation is not known.
Examples
iex> is_integer(Unicode.VerticalOrientation.count(:u))
true
Returns the Unicode codepoint ranges for a given vertical orientation.
Aliases are resolved by this function.
Arguments
vertical_orientationis any orientation name or alias, as an atom or string.
Returns
{:ok, range_list}whererange_listis a list of codepoint ranges as 2-tuples.:errorif the vertical orientation is not known.
Examples
iex> Unicode.VerticalOrientation.fetch(:u) |> elem(0)
:ok
iex> Unicode.VerticalOrientation.fetch(:invalid)
:error
Returns the Unicode codepoint ranges for a given vertical orientation.
Aliases are resolved by this function.
Arguments
vertical_orientationis any orientation name or alias, as an atom or string.
Returns
A list of codepoint ranges as 2-tuples.
nilif the vertical orientation is not known.
Examples
iex> Unicode.VerticalOrientation.get(:invalid)
nil
Returns a list of known Unicode vertical orientation names.
Returns
- A list of atom vertical orientation names.
Examples
iex> :tu in Unicode.VerticalOrientation.known_vertical_orientations()
true
Returns the vertical orientation 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 orientation atom is returned. Codepoints without an explicit assignment return
:r.For a binary, a list of the distinct orientations of the codepoints in the binary is returned.
Examples
iex> Unicode.VerticalOrientation.vertical_orientation(?A)
:r
iex> Unicode.VerticalOrientation.vertical_orientation(0x3042)
:u
Returns the map of Unicode vertical orientations.
Returns
- A map where the vertical orientation is the key and a list of codepoint ranges as 2-tuples is the value.
Examples
iex> :u in Map.keys(Unicode.VerticalOrientation.vertical_orientations())
true