From 237372842f7723f3e493e0523bc538e55923370e Mon Sep 17 00:00:00 2001 From: dahanzimin <353767514@qq.com> Date: Fri, 4 Jul 2025 09:42:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0uframebuf=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=B8=85=E9=99=A4=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default_src/micropython/origin/build/lib/uframebuf.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/boards/default_src/micropython/origin/build/lib/uframebuf.py b/boards/default_src/micropython/origin/build/lib/uframebuf.py index b2a17661..c5678999 100644 --- a/boards/default_src/micropython/origin/build/lib/uframebuf.py +++ b/boards/default_src/micropython/origin/build/lib/uframebuf.py @@ -417,6 +417,7 @@ class FrameBuffer_Uincode(FrameBuffer_Base): if sync: self.fill(bg_color, sync=False) self.set_buffer(data, sync) else: + yy = y if size is None: font_len, font_buffer = self._take_buffer(str(data), space, 1) size = min((self.width // font_len) if font_len > 0 else 1, self.height // self._font.height) @@ -424,7 +425,11 @@ class FrameBuffer_Uincode(FrameBuffer_Base): font_len, font_buffer = self._take_buffer(str(data), space, size) x = (self.width - font_len + space) // 2 if center else x y = (self.height - self._font.height * size) // 2 if y is None else y - if sync: self.fill(bg_color, sync=False) + if sync: + if yy is None: + self.fill(bg_color, sync=False) + else: + self.fill_rect(0, y - 1, self.width, self._font.height * size + 2, bg_color, sync=False) for buffer in font_buffer: #Display character self.bitmap(buffer, x, y, size, bold, color) x = buffer[1][0] * size + x + space