diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-12-27 17:42:23 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-01-01 20:09:35 +0000 |
| commit | bca7c75393f1b05566da4c6422a8b68eabdfbf14 (patch) | |
| tree | 2b2cbca922b1c2c34ff44b4744151ee23deff8dc | |
| parent | box-drawing: use floating point math, and round(), when drawing block elements (diff) | |
box-drawing: RIGHT HALF, UPPER ONE EIGHTH and RIGHT ONE EIGTH
* U+2590
* U+2594
* U+2595
| -rw-r--r-- | box-drawing.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/box-drawing.c b/box-drawing.c index 5e3caf5a..1cdf0e06 100644 --- a/box-drawing.c +++ b/box-drawing.c @@ -804,6 +804,24 @@ draw_left_one_eighth_block(uint8_t *buf, int width, int height, int stride, int } static void +draw_right_half_block(uint8_t *buf, int width, int height, int stride, int dpi) +{ + rect(round(width / 2.), 0, width, height); +} + +static void +draw_upper_one_eighth_block(uint8_t *buf, int width, int height, int stride, int dpi) +{ + rect(0, 0, width, round(height / 8.)); +} + +static void +draw_right_one_eighth_block(uint8_t *buf, int width, int height, int stride, int dpi) +{ + rect(width - round(width / 8.), 0, width, height); +} + +static void draw_glyph(wchar_t wc, uint8_t *buf, int width, int height, int stride, int dpi) { switch (wc) { @@ -973,12 +991,12 @@ draw_glyph(wchar_t wc, uint8_t *buf, int width, int height, int stride, int dpi) case 0x258e: draw_left_one_quarter_block(buf, width, height, stride, dpi); break; case 0x258f: draw_left_one_eighth_block(buf, width, height, stride, dpi); break; - case 0x2590: + case 0x2590: draw_right_half_block(buf, width, height, stride, dpi); break; + case 0x2594: draw_upper_one_eighth_block(buf, width, height, stride, dpi); break; + case 0x2595: draw_right_one_eighth_block(buf, width, height, stride, dpi); break; case 0x2591: case 0x2592: case 0x2593: - case 0x2594: - case 0x2595: case 0x2596: case 0x2597: case 0x2598: |
