fix(lua): drawTextLines line height now same as older ETX versions (#2428)
* fix(gui): line height in EdgeTX<2.8 was smaller at the same font size as with Edgetx >=2.8 to allow lua scripts to be optimized for odler and newer versions, drawTextLines now draws the text vertically condensed needs https://github.com/EdgeTX/libopenui/pull/69 * chore: Bump `libopenui` * fix: `FontHeightCorrection` needs to exist Will be optimised out since not used in bootloader
This commit is contained in:
@@ -580,7 +580,7 @@ void drawTextLines(BitmapBuffer * dc, coord_t left, coord_t top, coord_t width,
|
||||
{
|
||||
coord_t x = left;
|
||||
coord_t y = top;
|
||||
coord_t line = getFontHeight(flags & 0xFFFF);
|
||||
coord_t line = getFontHeightCondensed(flags & 0xFFFF);
|
||||
coord_t space = getTextWidth(" ", 1, flags);
|
||||
coord_t word;
|
||||
const char * nxt = str;
|
||||
|
||||
@@ -45,6 +45,17 @@
|
||||
|
||||
#endif // BOOT
|
||||
|
||||
// used to set the line height to the line heights used in Edgetx < 2.7 and OpenTX
|
||||
static const int8_t FontHeightCorrection[FONTS_COUNT] {
|
||||
-2, // STD
|
||||
-2, // BOLD
|
||||
-2, // XXS
|
||||
-2, // XS
|
||||
-3, // L
|
||||
-5, // XL
|
||||
-2, // XXL
|
||||
};
|
||||
|
||||
const lv_font_t* getFont(LcdFlags flags)
|
||||
{
|
||||
#if defined(BOOT)
|
||||
@@ -62,6 +73,12 @@ uint8_t getFontHeight(LcdFlags flags)
|
||||
return lv_font_get_line_height(font);
|
||||
}
|
||||
|
||||
uint8_t getFontHeightCondensed(LcdFlags flags)
|
||||
{
|
||||
auto font = getFont(flags);
|
||||
return lv_font_get_line_height(font) + FontHeightCorrection[FONT_INDEX(flags)];
|
||||
}
|
||||
|
||||
int getTextWidth(const char * s, int len, LcdFlags flags)
|
||||
{
|
||||
auto font = getFont(flags);
|
||||
|
||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: 2ccef5198a...3dc03495a6
Reference in New Issue
Block a user