Implement getTextWidth for display classes

- Added getTextWidth method to DisplayDriver interface
- Implemented getTextWidth in all display classes
- Updated examples to use getTextWidth directly
This commit is contained in:
JQ committed 2025-05-04 18:17:18 -07:00
1 parent f4d8b559b5
commit 8c0e86c171
10 files changed
+32 -8

No files matched your search

+7
View File
@@ -94,6 +94,13 @@ void GxEPDDisplay::drawXbm(int x, int y, const uint8_t* bits, int w, int h) {
display.drawBitmap(x*1.5, (y*1.5) + 10, bits, w, h, GxEPD_BLACK);
}
uint16_t GxEPDDisplay::getTextWidth(const char* str) {
int16_t x1, y1;
uint16_t w, h;
display.getTextBounds(str, 0, 0, &x1, &y1, &w, &h);
return w;
}
void GxEPDDisplay::endFrame() {
display.display(true);
}