sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

st-charoffsets-20220311-0.8.5.diff (1244B)


      1 From 944b234710e2fc00ea6e9ce9d925dc85514ac9c3 Mon Sep 17 00:00:00 2001
      2 From: Zacchary Dempsey-Plante <zacc@ztdp.ca>
      3 Date: Fri, 11 Mar 2022 01:33:05 -0500
      4 Subject: [PATCH] Added character rendering offsets for correcting different
      5  font dimensions.
      6 
      7 ---
      8  config.def.h | 3 +++
      9  x.c          | 4 ++--
     10  2 files changed, 5 insertions(+), 2 deletions(-)
     11 
     12 diff --git a/config.def.h b/config.def.h
     13 index 91ab8ca..8877e5c 100644
     14 --- a/config.def.h
     15 +++ b/config.def.h
     16 @@ -28,6 +28,9 @@ char *vtiden = "\033[?6c";
     17  /* Kerning / character bounding-box multipliers */
     18  static float cwscale = 1.0;
     19  static float chscale = 1.0;
     20 +/* Character rendering offsets in pixels */
     21 +static short cxoffset = 0;
     22 +static short cyoffset = 0;
     23  
     24  /*
     25   * word delimiter string
     26 diff --git a/x.c b/x.c
     27 index cd96575..6983743 100644
     28 --- a/x.c
     29 +++ b/x.c
     30 @@ -1288,8 +1288,8 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
     31  		if (glyphidx) {
     32  			specs[numspecs].font = font->match;
     33  			specs[numspecs].glyph = glyphidx;
     34 -			specs[numspecs].x = (short)xp;
     35 -			specs[numspecs].y = (short)yp;
     36 +			specs[numspecs].x = (short)xp + cxoffset;
     37 +			specs[numspecs].y = (short)yp + cyoffset;
     38  			xp += runewidth;
     39  			numspecs++;
     40  			continue;
     41 -- 
     42 2.35.1
     43