From 6eed9a40c1dc74c988ee5d723911bca86c8b5c87 Mon Sep 17 00:00:00 2001 From: Reed Nightingale Date: Tue, 31 Dec 2019 18:46:31 -0800 Subject: [PATCH] Fix text alignment --- nano_gui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nano_gui.cpp b/nano_gui.cpp index 01dd3be..00ac5b5 100644 --- a/nano_gui.cpp +++ b/nano_gui.cpp @@ -210,9 +210,9 @@ void displayText(char *text, int x1, int y1, int w, int h, int color, int backgr uint16_t width_out; uint16_t height_out; tft.getTextBounds(text,x1,y1,&x1_out,&y1_out,&width_out,&height_out); - x1_out += (w - width_out)/2; - y1_out += 2*height_out + (h - height_out)/2; - displayRawText(text,x1_out,y1_out,color,background); + x1 += (w - ( width_out + (x1_out-x1)))/2; + y1 += h - (h - height_out)/2; + displayRawText(text,x1,y1,color,background); } void setupTouch(){