Xinqi Bao's Git
projects
/
st.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
st: Fix off-by-one error when calculating character width.
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
ca126d7
..
839136d
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-3291,7
+3291,7
@@
xloadfont(Font *f, FcPattern *pattern)
XftTextExtentsUtf8(xw.dpy, f->match,
(const FcChar8 *) ascii_printable,
XftTextExtentsUtf8(xw.dpy, f->match,
(const FcChar8 *) ascii_printable,
-
LEN
(ascii_printable), &extents);
+
strlen
(ascii_printable), &extents);
f->set = NULL;
f->pattern = FcPatternDuplicate(pattern);
f->set = NULL;
f->pattern = FcPatternDuplicate(pattern);
@@
-3302,7
+3302,7
@@
xloadfont(Font *f, FcPattern *pattern)
f->rbearing = f->match->max_advance_width;
f->height = f->ascent + f->descent;
f->rbearing = f->match->max_advance_width;
f->height = f->ascent + f->descent;
- f->width = DIVCEIL(extents.xOff,
LEN
(ascii_printable));
+ f->width = DIVCEIL(extents.xOff,
strlen
(ascii_printable));
return 0;
}
return 0;
}
@@
-3671,7
+3671,7
@@
xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
specs[numspecs].font = frc[f].font;
specs[numspecs].glyph = glyphidx;
specs[numspecs].x = (short)xp;
specs[numspecs].font = frc[f].font;
specs[numspecs].glyph = glyphidx;
specs[numspecs].x = (short)xp;
- specs[numspecs].y = (short)
(winy + frc[f].font->ascent)
;
+ specs[numspecs].y = (short)
yp
;
xp += runewidth;
numspecs++;
}
xp += runewidth;
numspecs++;
}