Braille subpixel canvas for the text backend.
A braille canvas maps each terminal character cell to a 2-by-4 grid of dots and encodes the set dots as a Unicode braille codepoint (U+2800 + bitmask). This gives line and scatter data glyphs four times the vertical and twice the horizontal resolution of plain ASCII cells, while axes, ticks, and labels stay ordinary text.
Dot-bit layout matches Drawille's pixel map: column 0 (left): dot1=0x01 dot2=0x02 dot3=0x04 dot7=0x40 column 1 (right): dot4=0x08 dot5=0x10 dot6=0x20 dot8=0x80
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public | :: | n_cols | = | 0 | ||
| integer, | public | :: | n_rows | = | 0 | ||
| integer, | public | :: | sub_w | = | 0 | ||
| integer, | public | :: | sub_h | = | 0 | ||
| integer, | public, | allocatable | :: | mask(:,:) |
Build a blank braille canvas sized to a text grid of n_cols by n_rows character cells. Subpixel resolution is 2n_cols by 4n_rows dots.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n_cols | |||
| integer, | intent(in) | :: | n_rows |
Bit value for one dot within a cell. local_x in {0,1} (left/right), local_y in {0,1,2,3} (top to bottom). Out-of-range positions have no dot and return 0 so an invalid position never sets a spurious bit.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | local_x | |||
| integer, | intent(in) | :: | local_y |
A mask is a valid braille bitmask only within [0, 255]; any other value carries dot bits that do not exist in the U+2800 block.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | mask |
Codepoint for a braille mask, clamped into the valid block so an invalid mask can never encode outside U+2800..U+28FF.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | mask |
UTF-8 encoding of the braille codepoint for a mask. Invalid masks are clamped before encoding (braille_mask_valid reports the raw value).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | mask |
Turn on the subpixel dot at absolute subpixel coordinates (x_sub in [0, sub_w), y_sub in [0, sub_h)). Coordinates outside the canvas are ignored, so callers never corrupt an out-of-range cell.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(braille_canvas_t), | intent(inout) | :: | canvas | |||
| integer, | intent(in) | :: | x_sub | |||
| integer, | intent(in) | :: | y_sub |
Rasterize a line between two subpixel coordinates with Bresenham's algorithm, setting every visited dot.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(braille_canvas_t), | intent(inout) | :: | canvas | |||
| integer, | intent(in) | :: | x0 | |||
| integer, | intent(in) | :: | y0 | |||
| integer, | intent(in) | :: | x1 | |||
| integer, | intent(in) | :: | y1 |