vidconsole: Avoid kerning against an unrelated character

When the cursor position changes, kerning should not be used for the
next character, since it can make the first displayed character shuffle
left or right a bit.

Clear the kern character when setting the position.

Series-to: u-boot
Cover-letter:
video: Enhancements related to truetype and console
This series includes some precursor patches needed for forthcoming expo
enhancements.

- truetype support for multiple lines
- make white-on-black a runtime option
- support drawing a rectangle

This series was split out from schd2
END

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-03-25 04:41:15 -06:00
parent 1473930f94
commit 65ca0514ea
2 changed files with 5 additions and 0 deletions

View File

@@ -490,10 +490,12 @@ static int console_truetype_backspace(struct udevice *dev)
static int console_truetype_entry_start(struct udevice *dev)
{
struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
struct console_tt_priv *priv = dev_get_priv(dev);
/* A new input line has start, so clear our history */
priv->pos_ptr = 0;
vc_priv->last_ch = 0;
return 0;
}

View File

@@ -127,6 +127,9 @@ void vidconsole_set_cursor_pos(struct udevice *dev, int x, int y)
priv->xcur_frac = VID_TO_POS(x);
priv->xstart_frac = priv->xcur_frac;
priv->ycur = y;
/* make sure not to kern against the previous character */
priv->last_ch = 0;
vidconsole_entry_start(dev);
}