summaryrefslogtreecommitdiffstats
path: root/src/gui.c
diff options
context:
space:
mode:
authorDusan Popovic <dpx@binaryapparatus.com>2021-10-16 20:52:05 +0100
committerBram Moolenaar <Bram@vim.org>2021-10-16 20:52:05 +0100
commit4eeedc09fed0cbbb3ba48317e0a01e20cd0b4f80 (patch)
treecac81ddbe09eac705e72e2c3390749cc60a16ae0 /src/gui.c
parentc89c91cafd91fbf17f431d800bbf4cafcffffe7a (diff)
patch 8.2.3524: GUI: ligatures are not usedv8.2.3524
Problem: GUI: ligatures are not used. Solution: Add the 'guiligatures' option. (Dusan Popovic, closes #8933)
Diffstat (limited to 'src/gui.c')
-rw-r--r--src/gui.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gui.c b/src/gui.c
index 687e9daba1..1edf659dd1 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -460,6 +460,10 @@ gui_init_check(void)
gui.scrollbar_width = gui.scrollbar_height = SB_DEFAULT_WIDTH;
gui.prev_wrap = -1;
+# ifdef FEAT_GUI_GTK
+ CLEAR_FIELD(gui.ligatures_map);
+#endif
+
#if defined(ALWAYS_USE_GUI) || defined(VIMDLL)
result = OK;
#else
@@ -1065,6 +1069,36 @@ gui_get_wide_font(void)
return OK;
}
+#if defined(FEAT_GUI_GTK) || defined(PROTO)
+/*
+ * Set list of ascii characters that combined can create ligature.
+ * Store them in char map for quick access from gui_gtk2_draw_string.
+ */
+ void
+gui_set_ligatures(void)
+{
+ char_u *p;
+
+ if (*p_guiligatures != NUL)
+ {
+ // check for invalid characters
+ for (p = p_guiligatures; *p != NUL; ++p)
+ if (*p < 32 || *p > 127)
+ {
+ emsg(_(e_ascii_code_not_in_range));
+ return;
+ }
+
+ // store valid setting into ligatures_map
+ CLEAR_FIELD(gui.ligatures_map);
+ for (p = p_guiligatures; *p != NUL; ++p)
+ gui.ligatures_map[*p] = 1;
+ }
+ else
+ CLEAR_FIELD(gui.ligatures_map);
+}
+#endif
+
static void
gui_set_cursor(int row, int col)
{