aboutsummaryrefslogtreecommitdiff
path: root/terminal.h
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-09-14 07:50:49 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-09-14 07:50:49 +0000
commit37b15adcd8306652ce21804cb6140d1361adc94f (patch)
tree171295b380458ed96a2bbbd3b6502eff608c227e /terminal.h
parentbox-drawing: NOINLINE braille (diff)
term: turn ‘box-drawings’ array into three dynamically allocated arrays
The box_drawings array is now quite large, and uses up ~4K when *empty*. This patch splits it up into three separate, dynamically allocated arrays; one for the traditional box+line drawing and block elements glyphs, one for braille, and one for the legacy computing symbols. When we need to render a glyph, the *entire* array (that it belongs to) is allocated. I.e this is one step closer to a dynamic glyph cache (like the one fcft uses), but doesn’t go all the way. This is especially nice for people with ‘box-drawings-uses-font-glyphs=yes’; for them, the custom glyphs now uses 3*8 bytes (for the three array pointers), instead of 4K.
Diffstat (limited to 'terminal.h')
-rw-r--r--terminal.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/terminal.h b/terminal.h
index bfb327e3..028b4844 100644
--- a/terminal.h
+++ b/terminal.h
@@ -333,13 +333,26 @@ struct terminal {
int16_t font_y_ofs;
enum fcft_subpixel font_subpixel;
- /*
- * 0-159: U+02500+0259F
- * 160-415: U+02800-028FF
- * 416-555: U+1FB00-1FB8B
- * 556-557: U+1FB9A-1FB9B
- */
- struct fcft_glyph *box_drawing[558];
+ struct {
+ struct fcft_glyph **box_drawing;
+ struct fcft_glyph **braille;
+ struct fcft_glyph **legacy;
+
+ #define GLYPH_BOX_DRAWING_FIRST 0x2500
+ #define GLYPH_BOX_DRAWING_LAST 0x259F
+ #define GLYPH_BOX_DRAWING_COUNT \
+ (GLYPH_BOX_DRAWING_LAST - GLYPH_BOX_DRAWING_FIRST + 1)
+
+ #define GLYPH_BRAILLE_FIRST 0x2800
+ #define GLYPH_BRAILLE_LAST 0x28FF
+ #define GLYPH_BRAILLE_COUNT \
+ (GLYPH_BRAILLE_LAST - GLYPH_BRAILLE_FIRST + 1)
+
+ #define GLYPH_LEGACY_FIRST 0x1FB00
+ #define GLYPH_LEGACY_LAST 0x1FB9B
+ #define GLYPH_LEGACY_COUNT \
+ (GLYPH_LEGACY_LAST - GLYPH_LEGACY_FIRST + 1)
+ } custom_glyphs;
bool is_sending_paste_data;
ptmx_buffer_list_t ptmx_buffers;