runefix_core/
consts.rs

1/// Unicode Version used by this build (auto-synced).
2/// auto-updated: 2025-05-27
3pub const UNICODE_VERSION: (u8, u8, u8) = (16, 0, 0);
4
5#[allow(dead_code)]
6/// ⚠️ Deprecated: `DOUBLE_WIDTH_BLOCKS` is a static Unicode block-based heuristic.
7///
8/// This was originally used to determine whether a character belongs to a wide-width
9/// Unicode range, such as CJK Unified Ideographs or fullwidth variants. However, this
10/// approach is imprecise and not recommended for production use.
11///
12/// ### Drawbacks:
13/// - Too coarse-grained (e.g., `0x3040–0x30FF` includes non-kana symbols)
14/// - Poor alignment with real terminal rendering behaviors
15/// - Not synchronized with Unicode updates (ranges are hardcoded)
16///
17/// ### Recommended Replacement:
18/// ✅ Use modular per-category functions instead, such as:
19/// - [`rules::cjk::is_cjk`]
20/// - [`rules::kana::is_kana`]
21/// - [`rules::hangul::is_hangul`] etc.
22///
23/// These offer better maintainability, precision, and extensibility.
24pub const DOUBLE_WIDTH_BLOCKS: &[(u32, u32)] = &[
25    (0x4E00, 0x9FFF),   // CJK Unified Ideographs
26    (0x3400, 0x4DBF),   // CJK Extension A (rare characters)
27    (0x3040, 0x30FF),   // Japanese Kana (Hiragana + Katakana)
28    (0xAC00, 0xD7AF),   // Hangul Syllables (Korean)
29    (0x20000, 0x2A6DF), // CJK Extension B (historical/rare)
30    (0xFF01, 0xFF60),   // Fullwidth ASCII and punctuation
31    (0xFFE0, 0xFFE6),   // Fullwidth variants (e.g., ¥, ¢, %)
32];
33
34#[allow(dead_code)]
35/// ⚠️ Deprecated: `EMOJI_RANGES` is a static heuristic and no longer recommended.
36///
37/// This table was originally used to roughly detect emoji via Unicode ranges, such as:
38/// - (0x1F600–0x1F64F) for faces
39/// - (0x1F680–0x1F6FF) for transport icons
40///
41/// ### Limitations:
42/// - ❌ Does not support composite emoji (e.g., `👩‍💻`, `🧑🏿‍🦲`)
43/// - ❌ Cannot match ZWJ sequences, skin tone modifiers, or regional flags
44/// - ❌ Does not auto-update with new Unicode emoji releases
45///
46/// ### Recommended Replacement:
47/// ✅ Use [`rules::emoji::is_emoji`] instead. It supports all fully-qualified emoji,
48/// including ZWJ and variation sequences, with proper Unicode compliance.
49///
50/// ### Compatibility Use:
51/// - ✅ Can be used for fast pre-filtering or fallback indexing
52/// - ❌ Should **not** be used for terminal display width calculations
53pub const EMOJI_RANGES: &[(u32, u32)] = &[
54    (0x1F600, 0x1F64F), // Emoticons (faces)
55    (0x1F300, 0x1F5FF), // Misc symbols (weather, food, etc.)
56    (0x1F680, 0x1F6FF), // Transport and map symbols
57    (0x2600, 0x26FF),   // Misc symbols (sun, umbrella, zodiac)
58    (0x2700, 0x27BF),   // Dingbats (arrows, hands)
59    (0x1F900, 0x1F9FF), // Supplemental symbols and pictographs
60];