bakkeby / st-flexipatch

An st build with preprocessor directives to decide which patches to include during build time
MIT License
347 stars 107 forks source link

Text vertical alignment is not static for chscale != 1.0 #96

Open UtkarshVerma opened 1 year ago

UtkarshVerma commented 1 year ago

I have noticed that commits bd370228a4a2432baa5f0ec6a39df27460fc6cf2 and a8e2af0d923e7b6f7b19e8fa516bcd0670dfae84 have caused misalignment of text vertically when chscale is not 1.0.

I believe it can be reproduced by enabling ligatures and setting chscale to 1.1. Here's a video showing the bug:

https://user-images.githubusercontent.com/31820255/218300940-f4164b63-2c52-4836-bf0a-fed3d9f043b4.mp4

bakkeby commented 1 year ago

Hmm, if so then this should be reproducible with the latest ligatures patch on the suckless page and a chscale config change.

I wasn't directly able to reproduce this as I don't have that kind of command prediction / suggestion in place.

I grabbed a couple of frames from your video and placed them on top of each other in gimp. What I found was that the misalignment is exactly the that of the underline. So I was wondering didn't you expose a config option in your build to control the offset of that underline and could that be what is causing the misalignment here?

UtkarshVerma commented 1 year ago

I created a branch on my fork for reproducing this with master.

https://github.com/UtkarshVerma/st-flexipatch/tree/alignment-bug

Here are the changes:

diff --git a/config.mk b/config.
index 36e98ce..dde2dc9 100644
--- a/config.mk
+++ b/config.mk
@@ -19,10 +19,10 @@ PKG_CONFIG =
 #XCURSOR = -lXcursor

 # Uncomment the lines below for
-#LIGATURES_C = hb.c
-#LIGATURES_H = hb.h
-#LIGATURES_INC = `$(PKG_CONFIG)
-#LIGATURES_LIBS = `$(PKG_CONFIG
+LIGATURES_C = hb.c
+LIGATURES_H = hb.h
+LIGATURES_INC = `$(PKG_CONFIG)
+LIGATURES_LIBS = `$(PKG_CONFIG)

 # Uncomment this for the SIXEL
 #SIXEL_C = sixel.c sixel_hls.c
~/.local/src/st alignment-bug !1 ❯ diff patches.def.h patches.h
228c228
< #define LIGATURES_PATCH 0
---
> #define LIGATURES_PATCH 1
375c375
< #define UNDERCURL_PATCH 0
---
> #define UNDERCURL_PATCH 1
400c400
< #define VERTCENTER_PATCH 0
---
> #define VERTCENTER_PATCH 1
448c448
< #define XRESOURCES_PATCH 0
---
> #define XRESOURCES_PATCH 1
~/.local/src/st alignment-bug !1 ❯ diff config.def.h config.h
64c64
< static float chscale = 1.0;
---
> static float chscale = 1.1;