summaryrefslogtreecommitdiff
path: root/x.c
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2020-07-08 11:15:08 -0400
committerLuke Smith <luke@lukesmith.xyz>2020-07-08 11:15:08 -0400
commitcfef7fa605c6215157c2d2485305f23280b4f6fe (patch)
treea337520766f009c5716110631eec3d12ef059325 /x.c
parent3f51ba298c70c346ed1f8257c5e180a074d6ff9b (diff)
parent6bf7545fc98cd0d42eb727d596215daac809c478 (diff)
Merge branch 'master' of https://github.com/mackarelfish/st into mackarelfish-master
Diffstat (limited to 'x.c')
-rw-r--r--x.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/x.c b/x.c
index 3a99646..d2ed474 100644
--- a/x.c
+++ b/x.c
@@ -20,6 +20,7 @@ static char *argv0;
#include "arg.h"
#include "st.h"
#include "win.h"
+#include "hb.h"
/* types used in config.h */
typedef struct {
@@ -1142,6 +1143,9 @@ xunloadfont(Font *f)
void
xunloadfonts(void)
{
+ /* Clear Harfbuzz font cache. */
+ hbunloadfonts();
+
/* Free the loaded fonts in the font cache. */
while (frclen > 0)
XftFontClose(xw.dpy, frc[--frclen].font);
@@ -1331,7 +1335,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
mode = glyphs[i].mode;
/* Skip dummy wide-character spacing. */
- if (mode == ATTR_WDUMMY)
+ if (mode & ATTR_WDUMMY)
continue;
/* Determine font for glyph if different from previous glyph. */
@@ -1443,6 +1447,9 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
numspecs++;
}
+ /* Harfbuzz transformation for ligatures. */
+ hbtransform(specs, glyphs, len, x, y);
+
return numspecs;
}
@@ -1585,14 +1592,17 @@ xdrawglyph(Glyph g, int x, int y)
}
void
-xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
+xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int len)
{
Color drawcol;
/* remove the old cursor */
if (selected(ox, oy))
og.mode ^= ATTR_REVERSE;
- xdrawglyph(og, ox, oy);
+
+ /* Redraw the line where cursor was previously.
+ * It will restore the ligatures broken by the cursor. */
+ xdrawline(line, 0, oy, len);
if (IS_SET(MODE_HIDE))
return;