Crates.io | text_block_layout |
lib.rs | text_block_layout |
version | 1.2.1 |
source | src |
created_at | 2021-01-09 13:57:57.398787 |
updated_at | 2024-11-22 21:24:33.56087 |
description | Library for joining together blocks of text characters, in for example a TUI or text document. |
homepage | |
repository | https://github.com/jockbert/text_block_layout |
max_upload_size | |
id | 336454 |
size | 62,853 |
Rust library for joining together blocks of text characters, in for example a TUI or text document.
The key feature of the library is that it enables you to easily specify how blocks of text should be positioned in relation to other block, by joining blocks together, either vertically or horizontally, and using paddings and fills.
See Examples directory for example uses.
The text block layout is used in the math_expressions example to generates the following output:
2
⌠ 2 ⌠ ⎛ ix -ix⎞
⎮ cos (x) dx = ⎮ ⎜e + e ⎟ dx
⌡ ⌡ ⎜──────────⎟
⎝ 2 ⎠
1 ⌠ ⎛ 2ix -2ix⎞
= ─ ⎮ ⎝e + 2 + e ⎠ dx
4 ⌡
1
= ─ (2x + sin(2x)) + C
4
Example overlapping_boxes shows that blocks can be layered over each other. Transperancy character can be configured.
Blocks can be put on top of each other, with transparency!
OOOOO
O O
O **O****
O * O *
OOOOO *
* *
* *
* *
*******
Example named invoice shows yet another usage example.
INVOICE
Acme DATE 2020/01/01
Where customers are billed INVOICE # 12345678
Address
City, State ZIP
SHIP TO Name BILL TO Name
Address Address
City, State ZIP City, State ZIP
DESCRIPTION UNIT PRICE QUANTITY AMMOUNT
──────────────────────────────────────────────────────────────────────
Toilet paper, 13-pack $ 3.95 200 $ 790.00
Coffee, medium ground, 3 lbs $ 6.95 4 $ 27.80
──────────────────────────────────────────────────────────────────────
SUBTOTAL $ 817.80
──────────────────────
TAX RATE 8 %
──────────────────────
SALES TAX $ 65.42
──────────────────────
TOTAL $ 883.22
══════════════════════
Feel free to open a issue or open a pull request in the GitHub repository.