Expand description
ebbe is u8 number which represents boxchar’s info about ends, 2 bits for each end, starting from Up clockwise elle is [char;4] array of chars, each char represents boxchar’s info about ends, starting from Up clockwise, like ebbe E means Empty, L means Light, H means Heavy, D means Double EELH is a corner where Up and Right ends are empty, down is Light and left is Heavy ELLE is a corner where right and down ends are Light Here Single style equals Light style, see names of chars So you can connect chars with Double and Single styled ends to Light ends Why EBBE? Because it’s lightweight and fast to use, one byte is enough to store all directions and end styles. Why ELLE? Text coding can be easier than byte coding
§Examples
let ebbe = 0b10000000;
// 10 Up is Heavy, so it's Heavy styled short line directed to up side
let elle = ['H', 'E', 'E', 'E']; // for that char
let elle = ['H', 'E', 'L', 'L']; // what is it?// Box Drawing char '┌' is Left Top corner, with ebbe 0b00010100
// and elle ['E', 'L', 'L', 'E']
// '┍' is Left Top corner, with ebbe 0b00011000
// and elle ['E', 'H', 'L', 'E']
// look closely to boxchars, each char can has 4 ends in 4 directions with 4 styles,
// including empty style, or no-end
// ╄
// Up
// |
// Left - - Right
// |
// DownChar can be rotated simply by changing order of chars in elle array or by changing ebbe bits;
What for boxbyte is? It’s impossible to recognize char only from ebbe, so you need to know what char is, for example Arc corners have the same ebbe byte, and this is why find_char_by_ebbe() returns vector diagonal lines and diagonal cross have ebbe equal to zero, so should be coded to boxbyte too merged u16 [ebbe, boxbyte] is unique identifier of char so 2 tables presented Vector to improve library
- implement better extrude function which can be useful in editors
- implement frame struct to draw borders
- implement framelet as simplest border made of boxdrawing chars 2x2 framelet, 3x3 framelet, 4x4 framelet, 5x5 framelet and so on
- implement coloring in terminal, inflate framelet to content
- implement framelet to border route
- application: editor, maps, drawing, etc Simplet or Framelet, it’s the same
Cascadia mono font will have more pleasant look
Library is not finished yet, not deeply tested, but it’s working
Structs§
- Data
- Box Drawing Chars data
Enums§
- Char
Type - Types of char as enum
- Corner
Style - Corner styles as enum
- Corner
Type - Corner types as enum
- Cross
Type - Cross types as enum
- Diagonals
- Diagonal LeftBottom to RightTop or LeftTop to RightBottom
- End
- Ends as enum
- EndStyles
- End point styles as enum
- Line
Style - Line styles as enum
- Line
Type - Line types as enum
Constants§
Functions§
- build_
ebbe - build ebbe from end styles as enum
- chartype_
to_ bits - convert chartype enum to bits
- chartype_
to_ enum - convert chartype bits to enum
- corner_
info - retrieve corner info from boxbyte type is place, style is arc or square
- end_
to_ endstyle - endstyle_
to_ byte - convert endstyle to byte
- get_
char_ type_ bits - get chartype bits from boxbyte
- get_
chartype_ from_ ebbe - retrieve chartype from ebbe
- get_
cross_ type - get cross type from boxbyte
- get_
diagonals - get diagonals from boxbyte or return error message
- get_
ebbe - convert elle to ebbe
- get_
elle - convert ebbe to elle
- get_
end_ style - get end style from ebbe
- get_
end_ styles - get end styles enum from ebbe
- get_
ext_ bits - get ext bits from boxbyte
- get_
info_ bits - get info bits from boxbyte
- line_
info - retrieve line info from boxbyte
- opposite_
end - get opposite end
- rotate_
ccw - rotate_
cw - set_
char_ type_ bits - set chartype bits in boxbyte
- set_
ext_ bits - set ext bits in boxbyte
- set_
info_ bits - set info bits in boxbyte