#unicode #tui #no-std #lookup-tables

no-std boxy

Declarative builder for Unicode box-drawing characters

1 unstable release

0.1.0 Jan 10, 2022

#1283 in Text processing

Download history 7/week @ 2024-03-11 7/week @ 2024-03-18 10/week @ 2024-03-25 43/week @ 2024-04-01 3/week @ 2024-04-08 4/week @ 2024-04-15 15/week @ 2024-04-22 10/week @ 2024-04-29 10/week @ 2024-05-06 22/week @ 2024-05-13 24/week @ 2024-05-20 22/week @ 2024-05-27 22/week @ 2024-06-03 15/week @ 2024-06-10 6/week @ 2024-06-17 14/week @ 2024-06-24

58 downloads per month
Used in 3 crates (2 directly)

Apache-2.0

26KB
354 lines

boxy - declarative box-drawing characters

Crates.io docs.rs

Box-drawing characters are used extensively in text user interfaces software for drawing lines, boxes, and other shapes. Unicode provides a large assortment of them in the Box Drawing block (U+2500 to U+257F).

Unfortunately it can be quite irritating to construct code points in this range, and generating graphics using box drawing characters can be tedious. This is true even when explicit formulas exist for subsets of the block.

This crate provides the relevant lookup tables and exposes a nice interface for generating characters via the boxy::Char type. For example:

let corner = boxy::Char::upper_left(boxy::Weight::Doubled);
let side = boxy::Char::horizontal(boxy::Weight::Doubled);

let bx = format!(
  "{}{}{}\n{}{}{}",
  corner, side, corner.rotate_cw(1),
  corner.rotate_cw(3), side, corner.rotate_cw(2),
);

assert_eq!(bx, "
╔═╗
╚═╝
".trim());

This crate is no_std and will never panic, making it ideal for your a e s t h e t i c kernel panic messages.

No runtime deps