aboutsummaryrefslogtreecommitdiff
path: root/x.c
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2020-12-22 16:09:42 -0800
committerMike Crute <mike@crute.us>2023-04-25 20:45:27 -0700
commit49af5d59d8bed15678c634d11e86364c8801dc82 (patch)
tree31acbd7d321a0a8303fee0d6b6b65f05100439df /x.c
parent0ddcd0455171f2c52ae68d92bbddecb834350522 (diff)
downloadst-patched-49af5d59d8bed15678c634d11e86364c8801dc82.tar.bz2
st-patched-49af5d59d8bed15678c634d11e86364c8801dc82.tar.xz
st-patched-49af5d59d8bed15678c634d11e86364c8801dc82.zip
Apply st-ligatures-boxdraw-20200430-0.8.3
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 f425641..deb8ea5 100644
--- a/x.c
+++ b/x.c
@@ -20,6 +20,7 @@ char *argv0;
20#include "arg.h" 20#include "arg.h"
21#include "st.h" 21#include "st.h"
22#include "win.h" 22#include "win.h"
23#include "hb.h"
23 24
24/* types used in config.h */ 25/* types used in config.h */
25typedef struct { 26typedef struct {
@@ -1083,6 +1084,9 @@ xunloadfont(Font *f)
1083void 1084void
1084xunloadfonts(void) 1085xunloadfonts(void)
1085{ 1086{
1087 /* Clear Harfbuzz font cache. */
1088 hbunloadfonts();
1089
1086 /* Free the loaded fonts in the font cache. */ 1090 /* Free the loaded fonts in the font cache. */
1087 while (frclen > 0) 1091 while (frclen > 0)
1088 XftFontClose(xw.dpy, frc[--frclen].font); 1092 XftFontClose(xw.dpy, frc[--frclen].font);
@@ -1282,7 +1286,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
1282 mode = glyphs[i].mode; 1286 mode = glyphs[i].mode;
1283 1287
1284 /* Skip dummy wide-character spacing. */ 1288 /* Skip dummy wide-character spacing. */
1285 if (mode == ATTR_WDUMMY) 1289 if (mode & ATTR_WDUMMY)
1286 continue; 1290 continue;
1287 1291
1288 /* Determine font for glyph if different from previous glyph. */ 1292 /* Determine font for glyph if different from previous glyph. */
@@ -1394,6 +1398,9 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
1394 numspecs++; 1398 numspecs++;
1395 } 1399 }
1396 1400
1401 /* Harfbuzz transformation for ligatures. */
1402 hbtransform(specs, glyphs, len, x, y);
1403
1397 return numspecs; 1404 return numspecs;
1398} 1405}
1399 1406
@@ -1547,14 +1554,17 @@ xdrawglyph(Glyph g, int x, int y)
1547} 1554}
1548 1555
1549void 1556void
1550xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) 1557xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int len)
1551{ 1558{
1552 Color drawcol; 1559 Color drawcol;
1553 1560
1554 /* remove the old cursor */ 1561 /* remove the old cursor */
1555 if (selected(ox, oy)) 1562 if (selected(ox, oy))
1556 og.mode ^= ATTR_REVERSE; 1563 og.mode ^= ATTR_REVERSE;
1557 xdrawglyph(og, ox, oy); 1564
1565 /* Redraw the line where cursor was previously.
1566 * It will restore the ligatures broken by the cursor. */
1567 xdrawline(line, 0, oy, len);
1558 1568
1559 if (IS_SET(MODE_HIDE)) 1569 if (IS_SET(MODE_HIDE))
1560 return; 1570 return;