mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
parent
3595d95c27
commit
9e5d740422
4 changed files with 260 additions and 6 deletions
|
|
@ -35,6 +35,9 @@
|
|||
(https://codeberg.org/dnkl/foot/issues/459).
|
||||
* `cursor.beam-thickness` option to `foot.ini`
|
||||
(https://codeberg.org/dnkl/foot/issues/464).
|
||||
* Unicode 13 characters U+1FB70 - U+1FB8B to list of box drawing
|
||||
characters rendered by foot itself (rather than using font glyphs)
|
||||
(https://codeberg.org/dnkl/foot/issues/471).
|
||||
|
||||
|
||||
### Changed
|
||||
|
|
|
|||
229
box-drawing.c
229
box-drawing.c
|
|
@ -1519,6 +1519,36 @@ draw_lower_seven_eighths_block(struct buf *buf)
|
|||
rect(0, buf->height - round(7. * buf->height / 8.), buf->width, buf->height);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_upper_one_quarter_block(struct buf *buf)
|
||||
{
|
||||
rect(0, 0, buf->width, round(buf->height / 4.));
|
||||
}
|
||||
|
||||
static void
|
||||
draw_upper_three_eighths_block(struct buf *buf)
|
||||
{
|
||||
rect(0, 0, buf->width, round(3. * buf->height / 8.));
|
||||
}
|
||||
|
||||
static void
|
||||
draw_upper_five_eighths_block(struct buf *buf)
|
||||
{
|
||||
rect(0, 0, buf->width, round(5. * buf->height / 8.));
|
||||
}
|
||||
|
||||
static void
|
||||
draw_upper_three_quarters_block(struct buf *buf)
|
||||
{
|
||||
rect(0, 0, buf->width, round(3. * buf->height / 4.));
|
||||
}
|
||||
|
||||
static void
|
||||
draw_upper_seven_eighths_block(struct buf *buf)
|
||||
{
|
||||
rect(0, 0, buf->width, round(7. * buf->height / 8.));
|
||||
}
|
||||
|
||||
static void
|
||||
draw_full_block(struct buf *buf)
|
||||
{
|
||||
|
|
@ -1561,10 +1591,54 @@ draw_left_one_quarter_block(struct buf *buf)
|
|||
rect(0, 0, round(buf->width / 4.), buf->height);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_vertical_one_eighth_block_n(struct buf *buf, int n)
|
||||
{
|
||||
double x = round((double)n * buf->width / 8.);
|
||||
double w = round(buf->width / 8.);
|
||||
rect(x, 0, x + w, buf->height);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_left_one_eighth_block(struct buf *buf)
|
||||
{
|
||||
rect(0, 0, round(buf->width / 8.), buf->height);
|
||||
draw_vertical_one_eighth_block_n(buf, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_vertical_one_eighth_block_2(struct buf *buf)
|
||||
{
|
||||
draw_vertical_one_eighth_block_n(buf, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_vertical_one_eighth_block_3(struct buf *buf)
|
||||
{
|
||||
draw_vertical_one_eighth_block_n(buf, 2);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_vertical_one_eighth_block_4(struct buf *buf)
|
||||
{
|
||||
draw_vertical_one_eighth_block_n(buf, 3);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_vertical_one_eighth_block_5(struct buf *buf)
|
||||
{
|
||||
draw_vertical_one_eighth_block_n(buf, 4);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_vertical_one_eighth_block_6(struct buf *buf)
|
||||
{
|
||||
draw_vertical_one_eighth_block_n(buf, 5);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_vertical_one_eighth_block_7(struct buf *buf)
|
||||
{
|
||||
draw_vertical_one_eighth_block_n(buf, 6);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1609,10 +1683,54 @@ draw_dark_shade(struct buf *buf)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
draw_horizontal_one_eighth_block_n(struct buf *buf, int n)
|
||||
{
|
||||
double y = round((double)n * buf->height / 8.);
|
||||
double h = round(buf->height / 8.);
|
||||
rect(0, y, buf->width, y + h);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_upper_one_eighth_block(struct buf *buf)
|
||||
{
|
||||
rect(0, 0, buf->width, round(buf->height / 8.));
|
||||
draw_horizontal_one_eighth_block_n(buf, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_horizontal_one_eighth_block_2(struct buf *buf)
|
||||
{
|
||||
draw_horizontal_one_eighth_block_n(buf, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_horizontal_one_eighth_block_3(struct buf *buf)
|
||||
{
|
||||
draw_horizontal_one_eighth_block_n(buf, 2);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_horizontal_one_eighth_block_4(struct buf *buf)
|
||||
{
|
||||
draw_horizontal_one_eighth_block_n(buf, 3);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_horizontal_one_eighth_block_5(struct buf *buf)
|
||||
{
|
||||
draw_horizontal_one_eighth_block_n(buf, 4);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_horizontal_one_eighth_block_6(struct buf *buf)
|
||||
{
|
||||
draw_horizontal_one_eighth_block_n(buf, 5);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_horizontal_one_eighth_block_7(struct buf *buf)
|
||||
{
|
||||
draw_horizontal_one_eighth_block_n(buf, 6);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1869,6 +1987,80 @@ draw_sextant(wchar_t wc, struct buf *buf)
|
|||
sextant_lower_right(buf);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_left_and_lower_one_eighth_block(struct buf *buf)
|
||||
{
|
||||
draw_left_one_eighth_block(buf);
|
||||
draw_lower_one_eighth_block(buf);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_left_and_upper_one_eighth_block(struct buf *buf)
|
||||
{
|
||||
draw_left_one_eighth_block(buf);
|
||||
draw_upper_one_eighth_block(buf);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_right_and_upper_one_eighth_block(struct buf *buf)
|
||||
{
|
||||
draw_right_one_eighth_block(buf);
|
||||
draw_upper_one_eighth_block(buf);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_right_and_lower_one_eighth_block(struct buf *buf)
|
||||
{
|
||||
draw_right_one_eighth_block(buf);
|
||||
draw_lower_one_eighth_block(buf);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_upper_and_lower_one_eighth_block(struct buf *buf)
|
||||
{
|
||||
draw_upper_one_eighth_block(buf);
|
||||
draw_lower_one_eighth_block(buf);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_horizontal_one_eighth_1358_block(struct buf *buf)
|
||||
{
|
||||
draw_upper_one_eighth_block(buf);
|
||||
draw_horizontal_one_eighth_block_3(buf);
|
||||
draw_horizontal_one_eighth_block_5(buf);
|
||||
draw_lower_one_eighth_block(buf);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_right_one_quarter_block(struct buf *buf)
|
||||
{
|
||||
rect(buf->width - round(buf->width / 4.), 0, buf->width, buf->height);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_right_three_eighths_block(struct buf *buf)
|
||||
{
|
||||
rect(buf->width - round(3. * buf->width / 8.), 0, buf->width, buf->height);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_right_five_eighths_block(struct buf *buf)
|
||||
{
|
||||
rect(buf->width - round(5. * buf->width / 8.), 0, buf->width, buf->height);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_right_three_quarters_block(struct buf *buf)
|
||||
{
|
||||
rect(buf->width - round(3. * buf->width / 4.), 0, buf->width, buf->height);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_right_seven_eighths_block(struct buf *buf)
|
||||
{
|
||||
rect(buf->width - round(7. * buf->width / 8.), 0, buf->width, buf->height);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_glyph(wchar_t wc, struct buf *buf)
|
||||
{
|
||||
|
|
@ -2043,6 +2235,39 @@ draw_glyph(wchar_t wc, struct buf *buf)
|
|||
case 0x259f: draw_quadrant_upper_right_and_lower_left_and_lower_right(buf); break;
|
||||
|
||||
case 0x1fb00 ... 0x1fb3b: draw_sextant(wc, buf); break;
|
||||
|
||||
case 0x1fb70: draw_vertical_one_eighth_block_2(buf); break;
|
||||
case 0x1fb71: draw_vertical_one_eighth_block_3(buf); break;
|
||||
case 0x1fb72: draw_vertical_one_eighth_block_4(buf); break;
|
||||
case 0x1fb73: draw_vertical_one_eighth_block_5(buf); break;
|
||||
case 0x1fb74: draw_vertical_one_eighth_block_6(buf); break;
|
||||
case 0x1fb75: draw_vertical_one_eighth_block_7(buf); break;
|
||||
|
||||
case 0x1fb76: draw_horizontal_one_eighth_block_2(buf); break;
|
||||
case 0x1fb77: draw_horizontal_one_eighth_block_3(buf); break;
|
||||
case 0x1fb78: draw_horizontal_one_eighth_block_4(buf); break;
|
||||
case 0x1fb79: draw_horizontal_one_eighth_block_5(buf); break;
|
||||
case 0x1fb7a: draw_horizontal_one_eighth_block_6(buf); break;
|
||||
case 0x1fb7b: draw_horizontal_one_eighth_block_7(buf); break;
|
||||
|
||||
case 0x1fb82: draw_upper_one_quarter_block(buf); break;
|
||||
case 0x1fb83: draw_upper_three_eighths_block(buf); break;
|
||||
case 0x1fb84: draw_upper_five_eighths_block(buf); break;
|
||||
case 0x1fb85: draw_upper_three_quarters_block(buf); break;
|
||||
case 0x1fb86: draw_upper_seven_eighths_block(buf); break;
|
||||
|
||||
case 0x1fb7c: draw_left_and_lower_one_eighth_block(buf); break;
|
||||
case 0x1fb7d: draw_left_and_upper_one_eighth_block(buf); break;
|
||||
case 0x1fb7e: draw_right_and_upper_one_eighth_block(buf); break;
|
||||
case 0x1fb7f: draw_right_and_lower_one_eighth_block(buf); break;
|
||||
case 0x1fb80: draw_upper_and_lower_one_eighth_block(buf); break;
|
||||
case 0x1fb81: draw_horizontal_one_eighth_1358_block(buf); break;
|
||||
|
||||
case 0x1fb87: draw_right_one_quarter_block(buf); break;
|
||||
case 0x1fb88: draw_right_three_eighths_block(buf); break;
|
||||
case 0x1fb89: draw_right_five_eighths_block(buf); break;
|
||||
case 0x1fb8a: draw_right_three_quarters_block(buf); break;
|
||||
case 0x1fb8b: draw_right_seven_eighths_block(buf); break;
|
||||
}
|
||||
|
||||
UNIGNORE_WARNINGS
|
||||
|
|
|
|||
31
render.c
31
render.c
|
|
@ -484,12 +484,32 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
|||
base = composed->base;
|
||||
}
|
||||
|
||||
if (unlikely((base >= 0x2500 && base <= 0x259f) ||
|
||||
(base >= 0x1fb00 && base <= 0x1fb3b)) &&
|
||||
if (unlikely(
|
||||
/* Classic box drawings */
|
||||
(base >= 0x2500 && base <= 0x259f) ||
|
||||
|
||||
/*
|
||||
* Unicode 13 "Symbols for Legacy Computing"
|
||||
* sub-ranges below.
|
||||
*
|
||||
* Note, the full range is U+1FB00 - U+1FBF9
|
||||
*/
|
||||
|
||||
/* Unicode 13 sextants */
|
||||
(base >= 0x1fb00 && base <= 0x1fb3b) ||
|
||||
|
||||
/* Unicode 13 partial blocks */
|
||||
/* TODO: there's more here! */
|
||||
(base >= 0x1fb70 && base <= 0x1fb8b)) &&
|
||||
|
||||
likely(!term->conf->box_drawings_uses_font_glyphs))
|
||||
{
|
||||
/* Box drawing characters */
|
||||
size_t idx = base >= 0x1fb00 ? base - 0x1fb00 + 160 : base - 0x2500;
|
||||
size_t idx = base >= 0x1fb00
|
||||
? (base >= 0x1fb70
|
||||
? base - 0x1fb70 + 220
|
||||
: base - 0x1fb00 + 160)
|
||||
: base - 0x2500;
|
||||
xassert(idx < ALEN(term->box_drawing));
|
||||
|
||||
if (likely(term->box_drawing[idx] != NULL))
|
||||
|
|
@ -3090,10 +3110,15 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
|
|||
|
||||
sixel_reflow(term);
|
||||
|
||||
#if defined(_DEBUG) && LOG_ENABLE_DBG
|
||||
LOG_DBG("resize: %dx%d, grid: cols=%d, rows=%d "
|
||||
"(left-margin=%d, right-margin=%d, top-margin=%d, bottom-margin=%d)",
|
||||
term->width, term->height, term->cols, term->rows,
|
||||
term->margins.left, term->margins.right, term->margins.top, term->margins.bottom);
|
||||
#else
|
||||
LOG_INFO("resize: %dx%d pixels, %dx%d chars",
|
||||
term->width, term->height, term->cols, term->rows);
|
||||
#endif
|
||||
|
||||
if (term->scroll_region.start >= term->rows)
|
||||
term->scroll_region.start = 0;
|
||||
|
|
|
|||
|
|
@ -328,8 +328,9 @@ struct terminal {
|
|||
/*
|
||||
* 0-159: U+250U+259F
|
||||
* 160-219: U+1FB00-1FB3B
|
||||
* 220-247: U+1FB70-1FB8B
|
||||
*/
|
||||
struct fcft_glyph *box_drawing[220];
|
||||
struct fcft_glyph *box_drawing[248];
|
||||
|
||||
bool is_sending_paste_data;
|
||||
ptmx_buffer_list_t ptmx_buffers;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue