aboutsummaryrefslogtreecommitdiff
path: root/grid.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-05-02 15:29:00 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-05-02 15:29:00 +0000
commitd945b68b734427a03d114716ff8aeac7998a7c57 (patch)
tree93c73c5ab615ccf66244713d15a2a7a2fd139e0d /grid.c
parentunicode-combining: don't limit ourselves to the (western) diacritics blocks (diff)
unicode-combine: remove utf8proc dependency
We only used utf8proc to try to pre-compose a glyph from a base and combining character. We can do this ourselves by using a pre-compiled table of valid pre-compositions. This table isn't _that_ big, and binary searching it is fast. That is, for a very small amount of code, and not too much extra RO data, we can get rid of the utf8proc dependency.
Diffstat (limited to 'grid.c')
-rw-r--r--grid.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/grid.c b/grid.c
index 22e4ecaf..522df101 100644
--- a/grid.c
+++ b/grid.c
@@ -34,14 +34,14 @@ grid_row_alloc(int cols, bool initialize)
if (initialize) {
row->cells = calloc(cols, sizeof(row->cells[0]));
-#if FOOT_UNICODE_COMBINING
+#if FOOT_UNICODE_MAX_COMBINING_CHARS > 0
row->comb_chars = calloc(cols, sizeof(row->comb_chars[0]));
#endif
for (size_t c = 0; c < cols; c++)
row->cells[c].attrs.clean = 1;
} else {
row->cells = malloc(cols * sizeof(row->cells[0]));
-#if FOOT_UNICODE_COMBINING
+#if FOOT_UNICODE_MAX_COMBINING_CHARS > 0
row->comb_chars = malloc(cols * sizeof(row->comb_chars[0]));
#endif
}
@@ -55,7 +55,7 @@ grid_row_free(struct row *row)
if (row == NULL)
return;
-#if FOOT_UNICODE_COMBINING
+#if FOOT_UNICODE_MAX_COMBINING_CHARS > 0
free(row->comb_chars);
#endif
free(row->cells);
@@ -214,7 +214,7 @@ grid_reflow(struct grid *grid, int new_rows, int new_cols,
new_row->cells[new_col_idx] = *old_cell;
new_row->cells[new_col_idx].attrs.clean = 1;
-#if FOOT_UNICODE_COMBINING
+#if FOOT_UNICODE_MAX_COMBINING_CHARS > 0
struct combining_chars *old_comb_chars
= &old_row->comb_chars[c - empty_count + i];
struct combining_chars *new_comb_chars