summaryrefslogtreecommitdiff
path: root/vendor/unicode-width/README.md
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-02 18:36:06 -0600
committermo khan <mo@mokhan.ca>2025-07-02 18:36:06 -0600
commit8cdfa445d6629ffef4cb84967ff7017654045bc2 (patch)
tree22f0b0907c024c78d26a731e2e1f5219407d8102 /vendor/unicode-width/README.md
parent4351c74c7c5f97156bc94d3a8549b9940ac80e3f (diff)
chore: add vendor directory
Diffstat (limited to 'vendor/unicode-width/README.md')
-rw-r--r--vendor/unicode-width/README.md57
1 files changed, 57 insertions, 0 deletions
diff --git a/vendor/unicode-width/README.md b/vendor/unicode-width/README.md
new file mode 100644
index 00000000..632ae159
--- /dev/null
+++ b/vendor/unicode-width/README.md
@@ -0,0 +1,57 @@
+# `unicode-width`
+
+[![Build status](https://github.com/unicode-rs/unicode-width/actions/workflows/rust.yml/badge.svg)](https://github.com/unicode-rs/unicode-width/actions/workflows/rust.yml)
+[![crates.io version](https://img.shields.io/crates/v/unicode-width)](https://crates.io/crates/unicode-width)
+[![Docs status](https://img.shields.io/docsrs/unicode-width)](https://docs.rs/unicode-width/)
+
+Determine displayed width of `char` and `str` types according to [Unicode Standard Annex #11][UAX11]
+and other portions of the Unicode standard.
+
+This crate is `#![no_std]`.
+
+[UAX11]: http://www.unicode.org/reports/tr11/
+
+```rust
+use unicode_width::UnicodeWidthStr;
+
+fn main() {
+ let teststr = "Hello, world!";
+ let width = teststr.width();
+ println!("{}", teststr);
+ println!("The above string is {} columns wide.", width);
+ let width = teststr.width_cjk();
+ println!("The above string is {} columns wide (CJK).", width);
+}
+```
+
+**NOTE:** The computed width values may not match the actual rendered column
+width. For example, many Brahmic scripts like Devanagari have complex rendering rules
+which this crate does not currently handle (and will never fully handle, because
+the exact rendering depends on the font):
+
+```rust
+extern crate unicode_width;
+use unicode_width::UnicodeWidthStr;
+
+fn main() {
+ assert_eq!("क".width(), 1); // Devanagari letter Ka
+ assert_eq!("ष".width(), 1); // Devanagari letter Ssa
+ assert_eq!("क्ष".width(), 2); // Ka + Virama + Ssa
+}
+```
+
+Additionally, [defective combining character sequences](https://unicode.org/glossary/#defective_combining_character_sequence)
+and nonstandard [Korean jamo](https://unicode.org/glossary/#jamo) sequences may
+be rendered with a different width than what this crate says. (This is not an
+exhaustive list.) For a list of what this crate *does* handle, see
+[docs.rs](https://docs.rs/unicode-width/latest/unicode_width/#rules-for-determining-width).
+
+## crates.io
+
+You can use this package in your project by adding the following
+to your `Cargo.toml`:
+
+```toml
+[dependencies]
+unicode-width = "0.1.11"
+```