1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-08 03:40:28 +01:00

[display] Don't assume glyph x_offset is zero. (#8473)

This commit is contained in:
Clyde Stubbs 2025-03-27 11:31:55 +11:00 committed by GitHub
parent 4bb59ce1d1
commit ccd55a8e84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -555,10 +555,10 @@ void Display::get_text_bounds(int x, int y, const char *text, BaseFont *font, Te
switch (x_align) {
case TextAlign::RIGHT:
*x1 = x - *width;
*x1 = x - *width - x_offset;
break;
case TextAlign::CENTER_HORIZONTAL:
*x1 = x - (*width) / 2;
*x1 = x - (*width + x_offset) / 2;
break;
case TextAlign::LEFT:
default: