st-flexipatch

My st-flexipatch configuration
git clone git://git.ethandl.dev/st-flexipatch
Log | Files | Refs | README | LICENSE

commit 08f137a8a094728b1b5613b987704d164d96bfcd
parent dbd1d6ece0e910eca249cd4eeee95439d3f6b97b
Author: bakkeby <bakkeby@gmail.com>
Date:   Wed, 21 Apr 2021 15:48:31 +0200

Adding workaround for Variable Fonts causing too wide letter spacing

Diffstat:
MREADME.md | 8++++++++
Mpatches.def.h | 10++++++++++
Mx.c | 4++++
3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the ### Changelog: +2021-04-21 - Added (temporary?) hack for Variable Fonts (VT) support + 2021-03-10 - Added sixel support 2021-02-26 - Added the dynamic cursor color patch @@ -172,6 +174,12 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the - [wide-glyphs](https://www.reddit.com/r/suckless/comments/jt90ai/update_support_for_proper_glyph_rendering_in_st/) - adds proper support for wide glyphs, as opposed to rendering smaller or cut glyphs + - [wide-glyph-spacing](https://github.com/googlefonts/Inconsolata/issues/42#issuecomment-737508890) + - there is a known issue that Google's Variable Fonts (VF) can end up with letter spacing + that is too wide in programs that use Xft, for example Inconsolata v3.000 + - this is intended as a temporary workaround / patch / hack until (if) this is fixed in the + Xft library itself + - [workingdir](https://st.suckless.org/patches/workingdir/) - allows user to specify the initial path st should use as the working directory diff --git a/patches.def.h b/patches.def.h @@ -272,6 +272,16 @@ */ #define WIDE_GLYPHS_PATCH 0 +/* There is a known issue that Google's Variable Fonts (VF) can end up with letter spacing + * that is too wide in programs that use Xft, for example Inconsolata v3.000. + * + * This is intended as a temporary patch / hack until (if) this is fixed in the Xft library + * itself. + * + * https://github.com/googlefonts/Inconsolata/issues/42#issuecomment-737508890 + */ +#define WIDE_GLYPH_SPACING_PATCH 0 + /* This patch allows user to specify the initial path st should use as the working directory. * https://st.suckless.org/patches/workingdir/ */ diff --git a/x.c b/x.c @@ -1025,7 +1025,11 @@ xloadfont(Font *f, FcPattern *pattern) f->rbearing = f->match->max_advance_width; f->height = f->ascent + f->descent; + #if WIDE_GLYPH_SPACING_PATCH + f->width = DIVCEIL(extents.xOff > 18 ? extents.xOff / 3 : extents.xOff, strlen(ascii_printable)); + #else f->width = DIVCEIL(extents.xOff, strlen(ascii_printable)); + #endif //WIDE_GLYPH_SPACING_PATCH return 0; }