Expand description
UTF-8 decoding and CJK line breaking (避頭尾) shared by the AMFP-2026 exe (C ABI, see
ffi) and the Traditional Chinese translation tooling (PyO3, crate hpl-cjk-text-py).
Two consumers, one set of rules:
- the 2026 exe asks
break_allowedfor every pair of characters while wrapping; - the stock-exe TC build cannot change the engine, so
insert_break_spacesinserts U+0020 wherever a break is allowed (the stock engine only breaks at U+0020).
The rules mirror scripts/common.py of the TC tooling; tests/tc_parity.rs carries its
test table.
Re-exports§
pub use breakspace::default_icon_pad;pub use breakspace::insert_break_spaces;pub use breakspace::BreakSpaceOptions;pub use decode::decode_utf8_bmp;pub use decode::DecodeStats;pub use rules::break_allowed;pub use rules::is_cjk;pub use rules::NO_LINE_END;pub use rules::NO_LINE_START;
Modules§
- breakspace
- Break-space insertion for the stock exe, which only wraps at U+0020. A faithful port of
insert_break_spacesin the TC tooling’sscripts/common.py: - decode
- UTF-8 to UTF-16 decoding restricted to the BMP (the engine’s
wchar_tis 16-bit and its bitmap fonts look glyphs up per code unit). - ffi
- C ABI for the 32-bit game exe. Header:
include/hpl_cjk_text.h(cbindgen, checked bytests/header.rs). Rules: fixed-width types only, no panic crosses the boundary, Rust never keeps caller pointers. - rules
- 避頭尾 (kinsoku) tables and the break predicate.