termunicode 0.3.0
termunicode: ^0.3.0 copied to clipboard
Unicode library to get character properties (width, emoji, printable, etc)
0.3.0 #
- feature:
widthStringgained a scalar-scan fast path — code-unit widths are summed straight from the table while every unit is a BMP scalar of non-zero width; the first surrogate or zero-width unit (combining marks, ZWJ, variation selectors, controls) falls back to the grapheme-cluster path. One ASCII char drops from ~225 to ~48 ns/call, a 40-char ASCII line from ~5.0 to ~0.3 µs, a 12-char CJK line from ~6.4 to ~0.5 µs; strings the scan cannot answer pay a few percent for the wasted scan. Divergence: a prepend-class cluster (e.g. U+0600 + digit) is summed per codepoint on the fast path, matching what terminals draw, while the cluster path counts only its first codepoint. - chore: the
widthCharscluster fold is a plain loop now; the outdatedbenchmark_width.dartwas removed (benchmark_width_string.dartis the width benchmark). - breaking change: emoji width policy narrowed — the table forces width 2 only
for
Emoji_Presentationcodepoints. Text-presentation-default symbols such as U+2602 umbrella now measure 1 (previously 2); an emoji presentation selector (VS16) still makes them 2. Flags and other emoji-presentation characters are unchanged. - feature: the text presentation selector VS15 (U+FE0E) is honored — a cluster carrying it measures 1. Terminals that ignore VS15 draw the glyph wider than measured; that is their deficiency.
- fix: a lone variation selector now measures 0 (a bare VS16 measured 2).
- fix:
EmojiDataUCD.findbinary-searched overlapping ranges and missed 46 covered codepoints (U+1F484 lipstick, U+1F48B kiss mark and the U+1F493-1F497 hearts among them), which shipped with the emoji bit unset;isEmojiCpnow answers true for them.EmojiDataUCDstores rows per property and gainedfindProp(property, cp). - chore: update unicode data to 17.0.0. Unicode 17 removed non-emoji symbols
(e.g. U+2605 black star) from
Extended_Pictographic, soisEmojiCpno longer reports them. The generated table grows ~2.7% (157.6 KB to 161.9 KB).
0.2.0 #
- fix: include RIS emojis as double width
- feature: refactor generator and added smoke tests
- feature: improve tests for ucd parsers
- chore: update unicode data to 16.0.0
- fix: correct width for some ambiguous characters
- fix: emoji-ambiguous characters widths
- fix: improve performance of width calculation
- Added new function
widthCharsthat use the Characters package. - Updated
widthStringstring to usewidthCharsfunction.
0.1.0 #
- Initial version.