Mojibake.Script (Mojibake v0.8.0)

Copy Markdown View Source

Unicode scripts (UAX #24).

A script is an atom made from the long name of its Script property value, such as :latin, :greek, :han, :common (characters shared by many scripts), :inherited (combining marks that take the script of their base), or :unknown (unassigned codepoints). Three ISO 15924 combinations used by the identifier and confusable checks come last: :han_with_bopomofo, :japanese, and :korean.

Mojibake.Char.script/1 and Mojibake.Char.script_extensions/1 return scripts.

Summary

Types

t()

A script, such as :latin.

Functions

Every script, in the order of the Script property values, then the three ISO 15924 combinations.

The ISO 15924 code of script, or nil if script is not a script.

The script with the ISO 15924 code code, ignoring case, or nil if there is none.

Types

t()

@type t() :: atom()

A script, such as :latin.

Functions

all()

@spec all() :: [t()]

Every script, in the order of the Script property values, then the three ISO 15924 combinations.

Examples

iex> :latin in Mojibake.Script.all()
true

code(script)

@spec code(t()) :: String.t() | nil

The ISO 15924 code of script, or nil if script is not a script.

Examples

iex> Mojibake.Script.code(:latin)
"Latn"

iex> Mojibake.Script.code(:japanese)
"Jpan"

from_code(code)

@spec from_code(String.t()) :: t() | nil

The script with the ISO 15924 code code, ignoring case, or nil if there is none.

Examples

iex> Mojibake.Script.from_code("Grek")
:greek

iex> Mojibake.Script.from_code("zyyy")
:common

iex> Mojibake.Script.from_code("Xxxx")
nil