aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-06-01 10:22:36 -0600
committerTom Rini <trini@konsulko.com>2023-07-14 12:54:51 -0400
commita8f80409b06a39605aadaaf64bdbf71b31d463ca (patch)
tree90dcc296aa1837b769024fd73a175119ea7c10c9 /drivers
parent14a86a510792cb8a69ded6ea3b6c34a150bae3ab (diff)
downloadu-boot-a8f80409b06a39605aadaaf64bdbf71b31d463ca.zip
u-boot-a8f80409b06a39605aadaaf64bdbf71b31d463ca.tar.gz
u-boot-a8f80409b06a39605aadaaf64bdbf71b31d463ca.tar.bz2
console: Correct truetype spacing error
The putc_xy() method is supposed to return the amount of space used. The existing implementation erroneously adds the previous sub-pixel position to the returned value. This spaces out the characters very slightly more than it should. It is seldom noticeable but it does make accurate measurement of the text impossible. Fix this minor but long-standing bug. Fixes: a29b012037c ("video: Add a console driver that uses TrueType fonts") Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/console_truetype.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c
index 63d7557..6f3fc82 100644
--- a/drivers/video/console_truetype.c
+++ b/drivers/video/console_truetype.c
@@ -256,7 +256,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y,
*/
x_shift = xpos - (double)tt_floor(xpos);
xpos += advance * met->scale;
- width_frac = (int)VID_TO_POS(xpos);
+ width_frac = (int)VID_TO_POS(advance * met->scale);
if (x + width_frac >= vc_priv->xsize_frac)
return -EAGAIN;