diff options
author | mackarelfish <mackarelfish93@gmail.com> | 2020-05-12 03:46:52 +0700 |
---|---|---|
committer | mackarelfish <mackarelfish93@gmail.com> | 2020-05-12 03:46:52 +0700 |
commit | 4edc7282ab841142e970dcb4f03f251bb5ed7292 (patch) | |
tree | 5b389d84174f7640768832d4e07eb6da404570a1 /x.c | |
parent | fdf3989005a9003b90a3e98d4ba5684d52f11d3c (diff) |
Added ligatures patch
Diffstat (limited to 'x.c')
-rw-r--r-- | x.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -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 { @@ -1131,6 +1132,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); @@ -1320,7 +1324,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. */ @@ -1432,6 +1436,9 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x numspecs++; } + /* Harfbuzz transformation for ligatures. */ + hbtransform(specs, glyphs, len, x, y); + return numspecs; } @@ -1581,14 +1588,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; |