From ccd55a8e84a01b8262c230941333226cbefc0cb4 Mon Sep 17 00:00:00 2001
From: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com>
Date: Thu, 27 Mar 2025 11:31:55 +1100
Subject: [PATCH] [display] Don't assume glyph x_offset is zero. (#8473)

---
 esphome/components/display/display.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/esphome/components/display/display.cpp b/esphome/components/display/display.cpp
index b12a81e050..a13464ce1b 100644
--- a/esphome/components/display/display.cpp
+++ b/esphome/components/display/display.cpp
@@ -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: