aboutsummaryrefslogtreecommitdiff
path: root/x.c
diff options
context:
space:
mode:
authorFederico Igne <git@federicoigne.com>2020-05-23 12:01:50 +0100
committerFederico Igne <git@federicoigne.com>2020-05-23 12:01:50 +0100
commit30faefe674c5048b7ffd31c98b1a2193c43c9fe2 (patch)
tree64aad31e5682624aef1c7538b2a9c63079fd5a3a /x.c
parent81df9b428bd0330af98db9c69ffe69b0441e00fd (diff)
downloadst-30faefe674c5048b7ffd31c98b1a2193c43c9fe2.tar.gz
st-30faefe674c5048b7ffd31c98b1a2193c43c9fe2.zip
Apply Ligatures patch
Homepage link: https://st.suckless.org/patches/ligatures/ Patch links: https://st.suckless.org/patches/ligatures/0.8.3/st-ligatures-boxdraw-20200430-0.8.3.diff https://st.suckless.org/patches/ligatures/0.8.3/st-ligatures-scrollback-20200430-0.8.3.diff Additional info: the patch was applied by mixing the two patches linked above in order to provide compatibility with both BoxDraw and Scrollback patches.
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 58c2d98..0f95d60 100644
--- a/x.c
+++ b/x.c
@@ -19,6 +19,7 @@ static char *argv0;
19#include "arg.h" 19#include "arg.h"
20#include "st.h" 20#include "st.h"
21#include "win.h" 21#include "win.h"
22#include "hb.h"
22 23
23/* types used in config.h */ 24/* types used in config.h */
24typedef struct { 25typedef struct {
@@ -1117,6 +1118,9 @@ xunloadfont(Font *f)
1117void 1118void
1118xunloadfonts(void) 1119xunloadfonts(void)
1119{ 1120{
1121 /* Clear Harfbuzz font cache. */
1122 hbunloadfonts();
1123
1120 /* Free the loaded fonts in the font cache. */ 1124 /* Free the loaded fonts in the font cache. */
1121 while (frclen > 0) 1125 while (frclen > 0)
1122 XftFontClose(xw.dpy, frc[--frclen].font); 1126 XftFontClose(xw.dpy, frc[--frclen].font);
@@ -1320,7 +1324,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
1320 mode = glyphs[i].mode; 1324 mode = glyphs[i].mode;
1321 1325
1322 /* Skip dummy wide-character spacing. */ 1326 /* Skip dummy wide-character spacing. */
1323 if (mode == ATTR_WDUMMY) 1327 if (mode & ATTR_WDUMMY)
1324 continue; 1328 continue;
1325 1329
1326 /* Determine font for glyph if different from previous glyph. */ 1330 /* Determine font for glyph if different from previous glyph. */
@@ -1432,6 +1436,9 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
1432 numspecs++; 1436 numspecs++;
1433 } 1437 }
1434 1438
1439 /* Harfbuzz transformation for ligatures. */
1440 hbtransform(specs, glyphs, len, x, y);
1441
1435 return numspecs; 1442 return numspecs;
1436} 1443}
1437 1444
@@ -1585,14 +1592,17 @@ xdrawglyph(Glyph g, int x, int y)
1585} 1592}
1586 1593
1587void 1594void
1588xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) 1595xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int len)
1589{ 1596{
1590 Color drawcol; 1597 Color drawcol;
1591 1598
1592 /* remove the old cursor */ 1599 /* remove the old cursor */
1593 if (selected(ox, oy)) 1600 if (selected(ox, oy))
1594 og.mode ^= ATTR_REVERSE; 1601 og.mode ^= ATTR_REVERSE;
1595 xdrawglyph(og, ox, oy); 1602
1603 /* Redraw the line where cursor was previously.
1604 * It will restore the ligatures broken by the cursor. */
1605 xdrawline(line, 0, oy, len);
1596 1606
1597 if (IS_SET(MODE_HIDE)) 1607 if (IS_SET(MODE_HIDE))
1598 return; 1608 return;