From patchwork Fri Sep 19 20:14:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 366 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313010; bh=7+byhfuBqcbK9++1cBgJ8q5276a6d++d/6Zak2d5rHc=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=n4GBsmozPQU5aa2iz4Dwd3hX3z7UWWGy21aWBiCWO5LxWHm1dxN6+j0ma3nJBJNe0 65qo+JbCObz+Fo2Wql31iESmIISYjUgrKJJ4lEsO5TVjfcZ1g2rV/X+X8zl2yUNqY6 uXpBCyXLGlGOKsHIxHfc8z77AI4pvaVcGJt8Z5MUViDgUT237VZ6jZvsURSGbt3hcY ij2lxCywlohYk2OROT9csP5IEM5Pe5BxxWi++VkslDXuWJXuMvc/qJirRK0MzBD+R/ /tU21z9eWrXxgevdx9L2dQ9REk+a04FiLtkMTgbR6chlzdxwPw6sFAbjA96fNI844d lGwZX4ABteOWQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 33C5D67C6C for ; Fri, 19 Sep 2025 14:16:50 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id lDhtuQ-NhuAT for ; Fri, 19 Sep 2025 14:16:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313010; bh=7+byhfuBqcbK9++1cBgJ8q5276a6d++d/6Zak2d5rHc=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=n4GBsmozPQU5aa2iz4Dwd3hX3z7UWWGy21aWBiCWO5LxWHm1dxN6+j0ma3nJBJNe0 65qo+JbCObz+Fo2Wql31iESmIISYjUgrKJJ4lEsO5TVjfcZ1g2rV/X+X8zl2yUNqY6 uXpBCyXLGlGOKsHIxHfc8z77AI4pvaVcGJt8Z5MUViDgUT237VZ6jZvsURSGbt3hcY ij2lxCywlohYk2OROT9csP5IEM5Pe5BxxWi++VkslDXuWJXuMvc/qJirRK0MzBD+R/ /tU21z9eWrXxgevdx9L2dQ9REk+a04FiLtkMTgbR6chlzdxwPw6sFAbjA96fNI844d lGwZX4ABteOWQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 23B5867BB6 for ; Fri, 19 Sep 2025 14:16:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313008; bh=mROGzMiFVaFx7tlFdZMXKkSBWBnEown+MuMIX+cSPQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I3YW/DxKjToqPzDxs9jbTfDA6r4g7P/WTr6PRHvmtp92S59aiBn4Nxu/RRGI8bWF2 ZvLYETNELiBliUR3sxRpKdqBfDOdxjF1TvLApo6lnSv4A09s1apPJTPTHE/MBjHDqn M9krM0RXrsxSD1/iU6CgPMNLb9O4g5CBXzLdRixC+xNWA8tugengmjCPkt5EtHYEca HyMV6vTqSEgSuYkM5fanBgYmEk+ehDO0TGZ7XIU34q5lxxY6Ap751kQ4arasA5XkSV EfZgsWMXEeIt/OxY61eF15p+wTJZzCFO421J7wo0UNAuSOChdFRt769PnAmfn9aG12 kEfCL3BMeSlKA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6C91467C20; Fri, 19 Sep 2025 14:16:48 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id EI04ImkXpJbA; Fri, 19 Sep 2025 14:16:48 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313001; bh=OKKIlUNjfuRMEYhxvPYL2dfPH9glg2veY4a+uVk/2B8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k6BFA1HhtYz2uVJeniPfN6bamFKVfQRxO38RLWyE3R3YuuJKhXMpU99lrZsXOQSfX h/tPiabFcDofQ1bUy5qx4c/PICSh3L7bFP3FGXTUHOPeh4VjoGcLsqemkBr5Ga5Hxu xJmG2IWwKVpzz7Bv59x6h5qOeimgvRGtuyHj6f8gJdpcqYtkopaXxBHXfvtFhmHcmK n4fnAKB2oX5vRujt8imKUr/pCORGY3+alUIt31N9Axu6+Uv/GuKpYn2hJEtGFs/2u9 8xNIRxz+ZaIJhwZdI+KA7tKsYZ/Y2a/tQklM8Kkl4zsQ0aab+GF/fSvhVBGiQOLu5W gRHS+vn47p96A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5EF3467BB6; Fri, 19 Sep 2025 14:16:41 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:31 -0600 Message-ID: <20250919201507.4024144-25-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: VNY5R6IZYFY5YAW2RMI3ZLCAZTJYR3EA X-Message-ID-Hash: VNY5R6IZYFY5YAW2RMI3ZLCAZTJYR3EA X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 24/42] console: Add debugging for kerning List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass 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 --- 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 +#include #include #include #include @@ -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