]> git.armaanb.net Git - st.git/commit
st: Fix off-by-one error when calculating character width.
authorTor Andersson <tor@ccxvii.net>
Wed, 9 Mar 2016 16:11:57 +0000 (17:11 +0100)
committerChristoph Lohmann <20h@r-36.net>
Wed, 9 Mar 2016 21:01:25 +0000 (22:01 +0100)
commit39964614b742c4ec98a326762d98470cb987a45b
tree49873bc7690c3a6f298162f029a4361c3748c327
parent0e48a1995eee1c2babc58523ef0be296e4b1c3e8
st: Fix off-by-one error when calculating character width.

LEN(str) is one larger than strlen(str) because it also counts the zero
terminator. The original code would include the .notdef glyph (since it'll
try to encode character 0, which gets encoded to the .notdef glyph) when
measuring the average dimensions of printable ascii characters.

This causes problems with fonts like GNU Unifont where the .notdef glyph is
not the same width as the usual half-width characters.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
st.c