
From: Simon Glass <sjg@chromium.org> Add some debugging which can be used to manually check that truetype is kerning against the expected character. This is tested by the image-based tests but they are sometimes hard to debug. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/console_truetype.c | 10 ++++++++++ drivers/video/vidconsole-uclass.c | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index eee4ea2e2a9..d87b3828bb0 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -6,6 +6,7 @@ #define LOG_CATEGORY UCLASS_VIDEO #include <abuf.h> +#include <console.h> #include <dm.h> #include <log.h> #include <malloc.h> @@ -321,8 +322,17 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, if (vc_priv->last_ch) { kern = stbtt_GetCodepointKernAdvance(font, vc_priv->last_ch, cp); + if (_DEBUG) { + console_printf_select_stderr(true, "kern %c (%02x)", + vc_priv->last_ch, + vc_priv->last_ch); + } xpos += met->scale * kern; } + if (_DEBUG) { + console_printf_select_stderr(true, " %c (%02x)\n", + cp >= ' ' ? cp : ' ', cp); + } /* * Figure out where the cursor will move to after this character, and diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 0a7cf5ad81a..9d161f4688e 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -442,6 +442,11 @@ static int vidconsole_output_glyph(struct udevice *dev, int ch) struct vidconsole_priv *priv = dev_get_uclass_priv(dev); int ret; + if (_DEBUG) { + console_printf_select_stderr(true, + "glyph last_ch '%c': ch '%c' (%02x): ", + priv->last_ch, ch >= ' ' ? ch : ' ', ch); + } /* * Failure of this function normally indicates an unsupported * colour depth. Check this and return an error to help with -- 2.43.0