diff options
author | rafa_99 <rafa99@protonmail.com> | 2020-05-26 15:31:07 +0000 |
---|---|---|
committer | rafa_99 <rafa99@protonmail.com> | 2020-05-26 15:31:07 +0000 |
commit | 47561ed1e0ab18d4be35bad778a8427a2e42a3ab (patch) | |
tree | 2ee33cb24be2eb5e8e292b441265fe2595a5acb0 /x.c | |
parent | ffc63b6c98acf733308a26abfe7dbb563a35ca2b (diff) |
Ligatures Patch
Diffstat (limited to 'x.c')
-rw-r--r-- | x.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -19,6 +19,7 @@ char *argv0; #include "arg.h" #include "st.h" #include "win.h" +#include "hb.h" /* types used in config.h */ typedef struct { @@ -1138,6 +1139,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); @@ -1347,7 +1351,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. */ @@ -1454,6 +1458,9 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x numspecs++; } + /* Harfbuzz transformation for ligatures. */ + hbtransform(specs, glyphs, len, x, y); + return numspecs; } @@ -1603,14 +1610,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; |