Script reordering for collation (kr= / reorder option).
Remaps primary weights to change the relative order of scripts.
For example, reorder: [:Grek, :Latn] would sort Greek characters
before Latin characters.
Summary
Functions
Apply a reorder mapping to a primary weight.
Build a reorder mapping function from the given script codes.
Load a mapping from allkeys integer primary weights to their fractional lead bytes and sub-bytes.
Load the script-to-lead-byte-range mapping from FractionalUCA.txt.
Functions
@spec apply_mapping((non_neg_integer() -> non_neg_integer()) | nil, non_neg_integer()) :: non_neg_integer()
Apply a reorder mapping to a primary weight.
Arguments
mapping_fn- a reorder mapping function frombuild_mapping/1, ornil.primary- the primary weight to remap.
Returns
The remapped primary weight, or the original if mapping_fn is nil.
@spec build_mapping([atom()]) :: (non_neg_integer() -> non_neg_integer()) | nil
Build a reorder mapping function from the given script codes.
Arguments
reorder_codes- a list of script code atoms (e.g.,[:Grek, :Latn]).
Returns
A function
(primary :: integer()) -> integer()that remaps primary weights.nilif the list is empty or no valid mappings were found.
@spec load_primary_to_fractional_lead() :: %{ required(integer() | {:sub, integer()}) => non_neg_integer() }
Load a mapping from allkeys integer primary weights to their fractional lead bytes and sub-bytes.
Returns
A map %{integer() | {:sub, integer()} => non_neg_integer()}.
@spec load_script_ranges() :: %{ required(String.t()) => {non_neg_integer(), non_neg_integer()} }
Load the script-to-lead-byte-range mapping from FractionalUCA.txt.
Returns
A map %{String.t() => {start_byte, end_byte}}.