Raxol.Terminal.CharacterSets (Raxol v0.2.0)
View SourceHandles character set management and translation for the terminal emulator.
This module defines the character set state, including designated G0-G3 sets and active GL/GR sets. It also provides translation tables for different character sets and functions to translate characters based on the active set.
Summary
Functions
Invokes a designated character set as GL or GR.
Handles SI (invokes G0 as GL), SO (invokes G1 as GL),
ESC ~ (invokes G1 as GR), ESC } (invokes G2 as GR), ESC | (invokes G3 as GR).
Updates the active_set
based on the new GL mapping.
Note: This implementation assumes basic SO/SI for GL.
More complex shift functions (LS, SS) modify active_set
differently.
Creates a new character set state with default values (US-ASCII).
Designates a character set for a specific target (G0-G3).
target_set
should be :g0, :g1, :g2, or :g3.
charset
is the atom representing the character set (e.g., :us_ascii, :dec_special_graphics).
Translates a codepoint based on the currently active character set in the state.
Types
Functions
@spec invoke_designator(charset_state(), atom()) :: charset_state()
Invokes a designated character set as GL or GR.
Handles SI (invokes G0 as GL), SO (invokes G1 as GL),
ESC ~ (invokes G1 as GR), ESC } (invokes G2 as GR), ESC | (invokes G3 as GR).
Updates the active_set
based on the new GL mapping.
Note: This implementation assumes basic SO/SI for GL.
More complex shift functions (LS, SS) modify active_set
differently.
@spec new() :: charset_state()
Creates a new character set state with default values (US-ASCII).
@spec set_designator(charset_state(), atom(), atom()) :: charset_state()
Designates a character set for a specific target (G0-G3).
target_set
should be :g0, :g1, :g2, or :g3.
charset
is the atom representing the character set (e.g., :us_ascii, :dec_special_graphics).
@spec translate_active(charset_state(), non_neg_integer()) :: non_neg_integer()
Translates a codepoint based on the currently active character set in the state.