Adding workaround for Variable Fonts causing too wide letter spacing

This commit is contained in:
bakkeby 2021-04-21 15:48:31 +02:00
parent dbd1d6ece0
commit 08f137a8a0
3 changed files with 22 additions and 0 deletions

View File

@ -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

View File

@ -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/
*/

4
x.c
View File

@ -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;
}