Add charoffsets

This commit is contained in:
speedie 2022-11-18 16:45:41 +01:00
parent 7eaf6f5435
commit 9f722b6034
3 changed files with 9 additions and 3 deletions

View file

@ -10,7 +10,7 @@
*
* Font options
*/
static char *font[] = { "Cascadia Code PL:size=8:style=Bold:antialias=true:autohint=true",
static char *font[] = { "Fantasque Sans Mono:size=8:style=Bold:antialias=true:autohint=true",
"DejaVu Sans Mono:size=8:antialias=true:autohint=true",
"Noto Color Emoji:size=8:antialias=true:autohint=true",
"fontawesome:size=8:antialias=true:autohint=true",
@ -31,6 +31,10 @@ char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
static float cwscale = 1.0;
static float chscale = 1.0;
/* Character rendering offsets in pixels */
static float cxoffset = 0;
static float cyoffset = 0;
/* Text drawing options */
static int brightbold = 0; /* Should bright text also be bold? */
static unsigned int cols = 80; /* Number of columns */

4
x.c
View file

@ -1532,8 +1532,8 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
if (glyphidx) {
specs[numspecs].font = font->match;
specs[numspecs].glyph = glyphidx;
specs[numspecs].x = (short)xp;
specs[numspecs].y = (short)yp;
specs[numspecs].x = (short)xp + cxoffset;
specs[numspecs].y = (short)yp + cyoffset;
xp += runewidth;
numspecs++;
continue;

View file

@ -47,4 +47,6 @@ ResourcePref resources[] = {
{ "statalpha", FLOAT, &statalpha },
{ "cwscale", FLOAT, &cwscale },
{ "chscale", FLOAT, &chscale },
{ "cyoffset", FLOAT, &cyoffset },
{ "cxoffset", FLOAT, &cxoffset },
};