1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! # runefix-core
//!
//! Unicode-aware display width engine for terminals, TUI, and Markdown rendering.
//!
//! `runefix-core` provides precise width computation for multilingual text,
//! with support for:
//!
//! - East Asian fullwidth characters (CJK)
//! - Emoji (including multi-codepoint ZWJ sequences)
//! - Fullwidth punctuation and symbol variants
//! - Grapheme-aware string truncation and wrapping
//!
//! It ensures consistent text alignment across platforms and fonts
//! by working at the grapheme cluster level, consulting curated Unicode-derived datasets.
//!
//! ## Features
//!
//! 𧬠**Atom API**
//! - [`atoms`] β Runefix-specific visual segmentation for layout (width-based units)
//!
//! π§© **Segmentation API**
//! - [`graphemes`] β Unicode-compliant grapheme cluster splitting (UAX #29)
//!
//! π **Measurement API**
//! - [`display_width`] β Total width of a string (grapheme-aware, terminal-style)
//! - [`display_widths`] β Widths of each grapheme cluster (`Vec<usize>`)
//! - [`grapheme_widths`] β Widths with original clusters (`Vec<(&str, usize)>`)
//!
//! π **Layout API**
//! - [`truncate_by_width`] β Truncates text by width without splitting graphemes
//! - [`split_by_width`] β Wraps a string into lines based on terminal width
//!
//! π **Ergonomic Extensions**
//! - [`RuneDisplayWidth`] β Trait for:
//! - `.rune_width()` on `char`
//! - `.width()`, `.display_width()`, `.display_widths()` on `str`
//!
//! ## Example
//!
//! ```rust
//! use runefix_core::{RuneDisplayWidth, grapheme_widths};
//!
//! assert_eq!('δ½ '.rune_width(), 2);
//! assert_eq!(
//! grapheme_widths("HiοΌδΈη"),
//! vec![("H", 1), ("i", 1), ("οΌ", 2), ("δΈ", 2), ("η", 2)]
//! );
//! ```
//!
//! ## Resources
//!
//! - [π Dataset source & CLI](https://github.com/pokeyaro/runefix-rs/tree/main/crates/core)
//! - [π¦ Crates.io](https://crates.io/crates/runefix-core)
//! - [π§ͺ docs.rs Documentation](https://docs.rs/runefix-core)
//!
//! > **Note:** Enable the `policy` feature to use configurable width strategies
//! > such as `terminal()`, `markdown()`, or `compact()`.
// βββββ Public APIs βββββββββββββββββββββββββββββββββββββββββββββ
// Atom-based segmentation for layout units (runefix-specific)
pub use atoms;
// Grapheme-based core processing functions (always available)
pub use ;
// Unicode-aware trait extensions for `char` and `str`
pub use RuneDisplayWidth;
// Unicode data version used internally
pub use UNICODE_VERSION;
// βββββ Optional: Feature-gated APIs (requires `policy`) βββββββββ
// Configurable width strategy struct
pub use WidthPolicy;
// Ergonomic wrapper for applying a WidthPolicy to strings
pub use WithPolicy;
// Policy-aware versions of grapheme layout functions
pub use crate;
// βββββ Internal Modules (implementation details) βββββββββββββββ