Skip to main content

Module breakspace

Module breakspace 

Source
Expand description

Break-space insertion for the stock exe, which only wraps at U+0020. A faithful port of insert_break_spaces in the TC tooling’s scripts/common.py:

  1. Original spaces become wide_space (the CJK fonts give U+0020 ~0 advance). A $But… variable is followed by icon_pad[action] as gamepad icon room, which absorbs one original space right after it. Variables without icon room keep their spaces; at the end of a string they get a trailing wide_space.
  2. U+0020 is inserted between two adjacent CJK characters (or after padding before a CJK character), unless the second is a no-line-start character, the first a no-line-end character, or the second is padding. After a wide space that replaced an original space, U+0020 is inserted before any character except no-line-start characters, padding and tokens.

Tokens ($But…, [br], [u…]) are atomic: nothing is inserted next to them. breaks = false applies only rule 1 (short labels that never wrap).

Structs§

BreakSpaceOptions
Options for insert_break_spaces; the defaults equal the TC tooling’s defaults.

Functions§

default_icon_pad
Padding after each $But<Action> whose default gamepad binding draws an icon (TC tooling: DEFAULT_ICON_PAD, derived from config/default_user_keys_sdl2.cfg plus Exit = Start). LB/RB icons are 2 em wide.
insert_break_spaces
Port of insert_break_spaces; see the module docs for the rules.