Normalization v0.1.0

Source
Canonical and compatibility decomposition, and the NFD, NFC, NFKD and NFKC normal forms.

HangulBase

pub const HangulBase: uint32 = 0xAC00;

The first Hangul syllable, LV and LVT composition's base.

Source

DecomposeCanonical

pub func DecomposeCanonical(
    text: char32[..],
    into: var char32[..],
    written: *var uint
) -> bool

Writes the canonical decomposition of text into into, marks in canonical order: NFD. Reports the length through written, or false without a defined result when the room is short. The decompositions are fully expanded in the tables, so nothing recurses. written must be non-null and writable.

Source

Parameters

NameTypeDescription
textchar32[..]the scalar values to decompose
intovar char32[..]receives the decomposition
written*var uintreceives how many values were written

Returns: false without writing when into is too short

DecomposeCompatibility

pub func DecomposeCompatibility(
    text: char32[..],
    into: var char32[..],
    written: *var uint
) -> bool

Writes the compatibility decomposition of text into into, marks in canonical order: NFKD. written must be non-null and writable.

Source

Parameters

NameTypeDescription
textchar32[..]the scalar values to decompose
intovar char32[..]receives the decomposition
written*var uintreceives how many values were written

Returns: false without writing when into is too short

NormalizeCanonical

pub func NormalizeCanonical(
    text: char32[..],
    into: var char32[..],
    written: *var uint
) -> bool

Writes the NFC of text into into: canonical decomposition, canonical order, then composition. written must be non-null and writable.

Source

Parameters

NameTypeDescription
textchar32[..]the scalar values to normalize
intovar char32[..]receives the normalized form
written*var uintreceives how many values were written

Returns: false without writing when into is too short

NormalizeCompatibility

pub func NormalizeCompatibility(
    text: char32[..],
    into: var char32[..],
    written: *var uint
) -> bool

Writes the NFKC of text into into: compatibility decomposition, canonical order, then composition. written must be non-null and writable.

Source

Parameters

NameTypeDescription
textchar32[..]the scalar values to normalize
intovar char32[..]receives the normalized form
written*var uintreceives how many values were written

Returns: false without writing when into is too short