From 8e37d4e49ac04b90c4f9ba7128205a20edd9ff7d Mon Sep 17 00:00:00 2001 From: philmoz Date: Sun, 22 Dec 2024 12:02:26 +1100 Subject: [PATCH] fix(color): VCENTER does not work for Lua drawText function (#5730) --- radio/src/lua/api_colorlcd.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/radio/src/lua/api_colorlcd.cpp b/radio/src/lua/api_colorlcd.cpp index 37ca8e60b..2a93dae55 100644 --- a/radio/src/lua/api_colorlcd.cpp +++ b/radio/src/lua/api_colorlcd.cpp @@ -181,6 +181,10 @@ static void drawString(lua_State *L, const char * s, LcdFlags flags) int x = luaL_checkinteger(L, 1); int y = luaL_checkinteger(L, 2); + // If VCENTER flag is on then Y position is assumed to be center line for text. + if (flags & VCENTERED) + y -= getFontHeight(flags) / 2; + bool invers = flags & INVERS; if (flags & BLINK) invers = invers && !BLINK_ON_PHASE;